yvan-ext.js 1.3 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782
  1. define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx', 'localforage', 'modeler', 'bpmn-js-properties-panel', 'echarts', 'lay-excel', 'handlebars', 'xterm', 'xterm-addon-fit', 'sql-formatter'], function (exports, axios, Qs, _$2, $$2, moment$1, recast, XLSX, localforage, BpmnModeler, bpmnJsPropertiesPanel, echarts, LAY_EXCEL, handlebars, xterm, xtermAddonFit, sqlFormat) { '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. BpmnModeler = BpmnModeler && Object.prototype.hasOwnProperty.call(BpmnModeler, 'default') ? BpmnModeler['default'] : BpmnModeler;
  10. LAY_EXCEL = LAY_EXCEL && Object.prototype.hasOwnProperty.call(LAY_EXCEL, 'default') ? LAY_EXCEL['default'] : LAY_EXCEL;
  11. handlebars = handlebars && Object.prototype.hasOwnProperty.call(handlebars, 'default') ? handlebars['default'] : handlebars;
  12. sqlFormat = sqlFormat && Object.prototype.hasOwnProperty.call(sqlFormat, 'default') ? sqlFormat['default'] : sqlFormat;
  13. var labelWidth = 80;
  14. var windows = {
  15. modal: true,
  16. width: 900,
  17. height: 600,
  18. maximizable: true,
  19. constrain: true,
  20. shadow: false,
  21. };
  22. var date = {
  23. labelAlign: 'right',
  24. labelWidth: labelWidth,
  25. };
  26. var tagfield = {
  27. labelAlign: 'right',
  28. labelWidth: labelWidth,
  29. valueField: 'id',
  30. displayField: 'text',
  31. autoLoad: true,
  32. mode: 'local',
  33. forceSelection: true,
  34. triggerAction: 'all',
  35. enableKeyEvents: true,
  36. queryMode: 'local',
  37. filterPickList: true,
  38. };
  39. var combo = {
  40. labelAlign: 'right',
  41. labelWidth: labelWidth,
  42. valueField: 'id',
  43. displayField: 'text',
  44. autoLoad: true,
  45. mode: 'local',
  46. forceSelection: true,
  47. triggerAction: 'all',
  48. enableKeyEvents: true,
  49. typeAheadDelay: 1,
  50. queryDelay: 1,
  51. };
  52. var comboGrid = {
  53. selectOnTab: true,
  54. pickerHeight: 500,
  55. pickerWidth: 850,
  56. editEnable: null,
  57. };
  58. var comboGridPicker = {
  59. xtype: 'yvgrid',
  60. layout: 'fit',
  61. selModel: {
  62. selType: 'rowmodel',
  63. mode: 'SINGLE'
  64. },
  65. };
  66. var comboGridMulti = {
  67. selectOnTab: true,
  68. pickerHeight: 500,
  69. pickerWidth: 850,
  70. editEnable: null,
  71. splitChar: ',',
  72. displayField: 'text',
  73. valueField: 'id',
  74. autoLoad: true,
  75. };
  76. var comboGridMultiPicker = {
  77. selType: 'checkboxmodel',
  78. selModel: {
  79. type: 'checkboxmodel',
  80. checkOnly: false
  81. },
  82. };
  83. var numberfield = {
  84. labelAlign: 'right',
  85. decimalPrecision: 6,
  86. labelWidth: labelWidth,
  87. };
  88. var checkbox = {
  89. labelAlign: 'right',
  90. labelWidth: labelWidth,
  91. checkedValue: true,
  92. uncheckedValue: false,
  93. };
  94. var checkboxgroup = {
  95. labelAlign: 'right',
  96. labelWidth: labelWidth,
  97. };
  98. var radio = {
  99. labelAlign: 'right',
  100. labelWidth: labelWidth,
  101. };
  102. var radiogroup = {
  103. labelAlign: 'right',
  104. labelWidth: labelWidth,
  105. simpleValue: true,
  106. layout: 'hbox',
  107. defaults: {
  108. xtype: 'radio',
  109. name: 'type',
  110. margin: '0 15 0 0'
  111. },
  112. };
  113. var form = {
  114. margin: '5 5 0 0',
  115. border: false,
  116. defaults: {
  117. margin: '0 0 5 0',
  118. border: false,
  119. },
  120. };
  121. var column = {
  122. filter: { type: 'string' },
  123. };
  124. var grid = {
  125. border: true,
  126. columnLines: true,
  127. rowLines: true,
  128. plugins: {
  129. cellediting: {
  130. clicksToEdit: 1,
  131. },
  132. gridfilters: true
  133. },
  134. multiColumnSort: true,
  135. viewConfig: {
  136. enableTextSelection: true,
  137. sortOnClick: false,
  138. emptyText: '没有数据'
  139. },
  140. selModel: {
  141. type: 'checkboxmodel',
  142. checkOnly: false
  143. },
  144. pagination: true,
  145. pageSize: 50,
  146. pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
  147. hideFootbar: false,
  148. hideRefresh: false,
  149. hideExport: false,
  150. hideAutoSize: false,
  151. hideClearFilter: false,
  152. hideSaveGridUIConfig: false,
  153. hideClearGridUIConfig: false,
  154. autoLoad: true,
  155. remoteSort: false,
  156. remoteFilter: false,
  157. enableLocking: true,
  158. syncRowHeight: false,
  159. enableColumnMove: true,
  160. enableColumnHide: true,
  161. enableColumnResize: true,
  162. hidden: false,
  163. disabled: false,
  164. exportExcelPageSize: 100,
  165. exportExcelCurrentPage: 1,
  166. exportExcelTotal: 0,
  167. cellTip: false,
  168. };
  169. var fieldContainer = {
  170. labelAlign: 'right',
  171. labelWidth: labelWidth,
  172. layout: 'hbox',
  173. defaults: {
  174. flex: 1,
  175. }
  176. };
  177. var tree = {
  178. autoLoad: true,
  179. hideFilter: false,
  180. hideToolbar: false,
  181. hideRefresh: false,
  182. hideExpand: false,
  183. hideCollapse: false,
  184. root: [],
  185. rootVisible: false,
  186. };
  187. var search = {
  188. labelAlign: 'right',
  189. labelWidth: labelWidth,
  190. };
  191. var text = {
  192. labelAlign: 'right',
  193. labelWidth: labelWidth,
  194. msgTarget: 'qtip',
  195. };
  196. var toolbar = {
  197. overflowHandler: 'menu',
  198. };
  199. var tbfill = {};
  200. var tbseparator = {};
  201. var button = {};
  202. var fieldSet = {
  203. margin: '5 5 0 0',
  204. border: false,
  205. defaults: {
  206. margin: '0 0 5 0',
  207. border: false,
  208. },
  209. };
  210. var storeAjax = {
  211. timeout: 60000
  212. };
  213. var panel = {};
  214. var splitter = {};
  215. var maintab = {};
  216. var rows = {};
  217. var cols = {
  218. defaults: {
  219. flex: 1
  220. },
  221. };
  222. var bpmn = {
  223. hideRefresh: false,
  224. autoLoad: true,
  225. dataSource: '',
  226. bpmnConfig: {}
  227. };
  228. var Defaults = /*#__PURE__*/Object.freeze({
  229. __proto__: null,
  230. windows: windows,
  231. date: date,
  232. tagfield: tagfield,
  233. combo: combo,
  234. comboGrid: comboGrid,
  235. comboGridPicker: comboGridPicker,
  236. comboGridMulti: comboGridMulti,
  237. comboGridMultiPicker: comboGridMultiPicker,
  238. numberfield: numberfield,
  239. checkbox: checkbox,
  240. checkboxgroup: checkboxgroup,
  241. radio: radio,
  242. radiogroup: radiogroup,
  243. form: form,
  244. column: column,
  245. grid: grid,
  246. fieldContainer: fieldContainer,
  247. tree: tree,
  248. search: search,
  249. text: text,
  250. toolbar: toolbar,
  251. tbfill: tbfill,
  252. tbseparator: tbseparator,
  253. button: button,
  254. fieldSet: fieldSet,
  255. storeAjax: storeAjax,
  256. panel: panel,
  257. splitter: splitter,
  258. maintab: maintab,
  259. rows: rows,
  260. cols: cols,
  261. bpmn: bpmn
  262. });
  263. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  264. function createCommonjsModule(fn, module) {
  265. return module = { exports: {} }, fn(module, module.exports), module.exports;
  266. }
  267. var dist = createCommonjsModule(function (module, exports) {
  268. (function (global, factory) {
  269. module.exports = factory() ;
  270. }(commonjsGlobal, (function () {
  271. function createCommonjsModule(fn, module) {
  272. return module = { exports: {} }, fn(module, module.exports), module.exports;
  273. }
  274. var _global = createCommonjsModule(function (module) {
  275. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  276. var global = module.exports = typeof window != 'undefined' && window.Math == Math
  277. ? window : typeof self != 'undefined' && self.Math == Math ? self
  278. // eslint-disable-next-line no-new-func
  279. : Function('return this')();
  280. if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
  281. });
  282. var _core = createCommonjsModule(function (module) {
  283. var core = module.exports = { version: '2.6.5' };
  284. if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
  285. });
  286. var _core_1 = _core.version;
  287. var _isObject = function (it) {
  288. return typeof it === 'object' ? it !== null : typeof it === 'function';
  289. };
  290. var _anObject = function (it) {
  291. if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
  292. return it;
  293. };
  294. var _fails = function (exec) {
  295. try {
  296. return !!exec();
  297. } catch (e) {
  298. return true;
  299. }
  300. };
  301. // Thank's IE8 for his funny defineProperty
  302. var _descriptors = !_fails(function () {
  303. return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
  304. });
  305. var document = _global.document;
  306. // typeof document.createElement is 'object' in old IE
  307. var is = _isObject(document) && _isObject(document.createElement);
  308. var _domCreate = function (it) {
  309. return is ? document.createElement(it) : {};
  310. };
  311. var _ie8DomDefine = !_descriptors && !_fails(function () {
  312. return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
  313. });
  314. // 7.1.1 ToPrimitive(input [, PreferredType])
  315. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  316. // and the second argument - flag - preferred type is a string
  317. var _toPrimitive = function (it, S) {
  318. if (!_isObject(it)) { return it; }
  319. var fn, val;
  320. if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  321. if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  322. if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
  323. throw TypeError("Can't convert object to primitive value");
  324. };
  325. var dP = Object.defineProperty;
  326. var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
  327. _anObject(O);
  328. P = _toPrimitive(P, true);
  329. _anObject(Attributes);
  330. if (_ie8DomDefine) { try {
  331. return dP(O, P, Attributes);
  332. } catch (e) { /* empty */ } }
  333. if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
  334. if ('value' in Attributes) { O[P] = Attributes.value; }
  335. return O;
  336. };
  337. var _objectDp = {
  338. f: f
  339. };
  340. var _propertyDesc = function (bitmap, value) {
  341. return {
  342. enumerable: !(bitmap & 1),
  343. configurable: !(bitmap & 2),
  344. writable: !(bitmap & 4),
  345. value: value
  346. };
  347. };
  348. var _hide = _descriptors ? function (object, key, value) {
  349. return _objectDp.f(object, key, _propertyDesc(1, value));
  350. } : function (object, key, value) {
  351. object[key] = value;
  352. return object;
  353. };
  354. var hasOwnProperty = {}.hasOwnProperty;
  355. var _has = function (it, key) {
  356. return hasOwnProperty.call(it, key);
  357. };
  358. var id = 0;
  359. var px = Math.random();
  360. var _uid = function (key) {
  361. return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
  362. };
  363. var _shared = createCommonjsModule(function (module) {
  364. var SHARED = '__core-js_shared__';
  365. var store = _global[SHARED] || (_global[SHARED] = {});
  366. (module.exports = function (key, value) {
  367. return store[key] || (store[key] = value !== undefined ? value : {});
  368. })('versions', []).push({
  369. version: _core.version,
  370. mode: 'global',
  371. copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
  372. });
  373. });
  374. var _functionToString = _shared('native-function-to-string', Function.toString);
  375. var _redefine = createCommonjsModule(function (module) {
  376. var SRC = _uid('src');
  377. var TO_STRING = 'toString';
  378. var TPL = ('' + _functionToString).split(TO_STRING);
  379. _core.inspectSource = function (it) {
  380. return _functionToString.call(it);
  381. };
  382. (module.exports = function (O, key, val, safe) {
  383. var isFunction = typeof val == 'function';
  384. if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
  385. if (O[key] === val) { return; }
  386. if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
  387. if (O === _global) {
  388. O[key] = val;
  389. } else if (!safe) {
  390. delete O[key];
  391. _hide(O, key, val);
  392. } else if (O[key]) {
  393. O[key] = val;
  394. } else {
  395. _hide(O, key, val);
  396. }
  397. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  398. })(Function.prototype, TO_STRING, function toString() {
  399. return typeof this == 'function' && this[SRC] || _functionToString.call(this);
  400. });
  401. });
  402. var _aFunction = function (it) {
  403. if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
  404. return it;
  405. };
  406. // optional / simple context binding
  407. var _ctx = function (fn, that, length) {
  408. _aFunction(fn);
  409. if (that === undefined) { return fn; }
  410. switch (length) {
  411. case 1: return function (a) {
  412. return fn.call(that, a);
  413. };
  414. case 2: return function (a, b) {
  415. return fn.call(that, a, b);
  416. };
  417. case 3: return function (a, b, c) {
  418. return fn.call(that, a, b, c);
  419. };
  420. }
  421. return function (/* ...args */) {
  422. return fn.apply(that, arguments);
  423. };
  424. };
  425. var PROTOTYPE = 'prototype';
  426. var $export = function (type, name, source) {
  427. var IS_FORCED = type & $export.F;
  428. var IS_GLOBAL = type & $export.G;
  429. var IS_STATIC = type & $export.S;
  430. var IS_PROTO = type & $export.P;
  431. var IS_BIND = type & $export.B;
  432. var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
  433. var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
  434. var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
  435. var key, own, out, exp;
  436. if (IS_GLOBAL) { source = name; }
  437. for (key in source) {
  438. // contains in native
  439. own = !IS_FORCED && target && target[key] !== undefined;
  440. // export native or passed
  441. out = (own ? target : source)[key];
  442. // bind timers to global for call from export context
  443. exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
  444. // extend global
  445. if (target) { _redefine(target, key, out, type & $export.U); }
  446. // export
  447. if (exports[key] != out) { _hide(exports, key, exp); }
  448. if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
  449. }
  450. };
  451. _global.core = _core;
  452. // type bitmap
  453. $export.F = 1; // forced
  454. $export.G = 2; // global
  455. $export.S = 4; // static
  456. $export.P = 8; // proto
  457. $export.B = 16; // bind
  458. $export.W = 32; // wrap
  459. $export.U = 64; // safe
  460. $export.R = 128; // real proto method for `library`
  461. var _export = $export;
  462. // 7.1.4 ToInteger
  463. var ceil = Math.ceil;
  464. var floor = Math.floor;
  465. var _toInteger = function (it) {
  466. return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
  467. };
  468. // 7.2.1 RequireObjectCoercible(argument)
  469. var _defined = function (it) {
  470. if (it == undefined) { throw TypeError("Can't call method on " + it); }
  471. return it;
  472. };
  473. // true -> String#at
  474. // false -> String#codePointAt
  475. var _stringAt = function (TO_STRING) {
  476. return function (that, pos) {
  477. var s = String(_defined(that));
  478. var i = _toInteger(pos);
  479. var l = s.length;
  480. var a, b;
  481. if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
  482. a = s.charCodeAt(i);
  483. return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
  484. ? TO_STRING ? s.charAt(i) : a
  485. : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
  486. };
  487. };
  488. var $at = _stringAt(false);
  489. _export(_export.P, 'String', {
  490. // 21.1.3.3 String.prototype.codePointAt(pos)
  491. codePointAt: function codePointAt(pos) {
  492. return $at(this, pos);
  493. }
  494. });
  495. var codePointAt = _core.String.codePointAt;
  496. var max = Math.max;
  497. var min = Math.min;
  498. var _toAbsoluteIndex = function (index, length) {
  499. index = _toInteger(index);
  500. return index < 0 ? max(index + length, 0) : min(index, length);
  501. };
  502. var fromCharCode = String.fromCharCode;
  503. var $fromCodePoint = String.fromCodePoint;
  504. // length should be 1, old FF problem
  505. _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
  506. // 21.1.2.2 String.fromCodePoint(...codePoints)
  507. fromCodePoint: function fromCodePoint(x) {
  508. var arguments$1 = arguments;
  509. // eslint-disable-line no-unused-vars
  510. var res = [];
  511. var aLen = arguments.length;
  512. var i = 0;
  513. var code;
  514. while (aLen > i) {
  515. code = +arguments$1[i++];
  516. if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
  517. res.push(code < 0x10000
  518. ? fromCharCode(code)
  519. : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
  520. );
  521. } return res.join('');
  522. }
  523. });
  524. var fromCodePoint = _core.String.fromCodePoint;
  525. // This is a generated file. Do not edit.
  526. var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
  527. 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]/;
  528. 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]/;
  529. var unicode = {
  530. Space_Separator: Space_Separator,
  531. ID_Start: ID_Start,
  532. ID_Continue: ID_Continue
  533. };
  534. var util = {
  535. isSpaceSeparator: function isSpaceSeparator (c) {
  536. return typeof c === 'string' && unicode.Space_Separator.test(c)
  537. },
  538. isIdStartChar: function isIdStartChar (c) {
  539. return typeof c === 'string' && (
  540. (c >= 'a' && c <= 'z') ||
  541. (c >= 'A' && c <= 'Z') ||
  542. (c === '$') || (c === '_') ||
  543. unicode.ID_Start.test(c)
  544. )
  545. },
  546. isIdContinueChar: function isIdContinueChar (c) {
  547. return typeof c === 'string' && (
  548. (c >= 'a' && c <= 'z') ||
  549. (c >= 'A' && c <= 'Z') ||
  550. (c >= '0' && c <= '9') ||
  551. (c === '$') || (c === '_') ||
  552. (c === '\u200C') || (c === '\u200D') ||
  553. unicode.ID_Continue.test(c)
  554. )
  555. },
  556. isDigit: function isDigit (c) {
  557. return typeof c === 'string' && /[0-9]/.test(c)
  558. },
  559. isHexDigit: function isHexDigit (c) {
  560. return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
  561. },
  562. };
  563. var source;
  564. var parseState;
  565. var stack;
  566. var pos;
  567. var line;
  568. var column;
  569. var token;
  570. var key;
  571. var root;
  572. var parse = function parse (text, reviver) {
  573. source = String(text);
  574. parseState = 'start';
  575. stack = [];
  576. pos = 0;
  577. line = 1;
  578. column = 0;
  579. token = undefined;
  580. key = undefined;
  581. root = undefined;
  582. do {
  583. token = lex();
  584. // This code is unreachable.
  585. // if (!parseStates[parseState]) {
  586. // throw invalidParseState()
  587. // }
  588. parseStates[parseState]();
  589. } while (token.type !== 'eof')
  590. if (typeof reviver === 'function') {
  591. return internalize({'': root}, '', reviver)
  592. }
  593. return root
  594. };
  595. function internalize (holder, name, reviver) {
  596. var value = holder[name];
  597. if (value != null && typeof value === 'object') {
  598. for (var key in value) {
  599. var replacement = internalize(value, key, reviver);
  600. if (replacement === undefined) {
  601. delete value[key];
  602. } else {
  603. value[key] = replacement;
  604. }
  605. }
  606. }
  607. return reviver.call(holder, name, value)
  608. }
  609. var lexState;
  610. var buffer;
  611. var doubleQuote;
  612. var sign;
  613. var c;
  614. function lex () {
  615. lexState = 'default';
  616. buffer = '';
  617. doubleQuote = false;
  618. sign = 1;
  619. for (;;) {
  620. c = peek();
  621. // This code is unreachable.
  622. // if (!lexStates[lexState]) {
  623. // throw invalidLexState(lexState)
  624. // }
  625. var token = lexStates[lexState]();
  626. if (token) {
  627. return token
  628. }
  629. }
  630. }
  631. function peek () {
  632. if (source[pos]) {
  633. return String.fromCodePoint(source.codePointAt(pos))
  634. }
  635. }
  636. function read () {
  637. var c = peek();
  638. if (c === '\n') {
  639. line++;
  640. column = 0;
  641. } else if (c) {
  642. column += c.length;
  643. } else {
  644. column++;
  645. }
  646. if (c) {
  647. pos += c.length;
  648. }
  649. return c
  650. }
  651. var lexStates = {
  652. default: function default$1 () {
  653. switch (c) {
  654. case '\t':
  655. case '\v':
  656. case '\f':
  657. case ' ':
  658. case '\u00A0':
  659. case '\uFEFF':
  660. case '\n':
  661. case '\r':
  662. case '\u2028':
  663. case '\u2029':
  664. read();
  665. return
  666. case '/':
  667. read();
  668. lexState = 'comment';
  669. return
  670. case undefined:
  671. read();
  672. return newToken('eof')
  673. }
  674. if (util.isSpaceSeparator(c)) {
  675. read();
  676. return
  677. }
  678. // This code is unreachable.
  679. // if (!lexStates[parseState]) {
  680. // throw invalidLexState(parseState)
  681. // }
  682. return lexStates[parseState]()
  683. },
  684. comment: function comment () {
  685. switch (c) {
  686. case '*':
  687. read();
  688. lexState = 'multiLineComment';
  689. return
  690. case '/':
  691. read();
  692. lexState = 'singleLineComment';
  693. return
  694. }
  695. throw invalidChar(read())
  696. },
  697. multiLineComment: function multiLineComment () {
  698. switch (c) {
  699. case '*':
  700. read();
  701. lexState = 'multiLineCommentAsterisk';
  702. return
  703. case undefined:
  704. throw invalidChar(read())
  705. }
  706. read();
  707. },
  708. multiLineCommentAsterisk: function multiLineCommentAsterisk () {
  709. switch (c) {
  710. case '*':
  711. read();
  712. return
  713. case '/':
  714. read();
  715. lexState = 'default';
  716. return
  717. case undefined:
  718. throw invalidChar(read())
  719. }
  720. read();
  721. lexState = 'multiLineComment';
  722. },
  723. singleLineComment: function singleLineComment () {
  724. switch (c) {
  725. case '\n':
  726. case '\r':
  727. case '\u2028':
  728. case '\u2029':
  729. read();
  730. lexState = 'default';
  731. return
  732. case undefined:
  733. read();
  734. return newToken('eof')
  735. }
  736. read();
  737. },
  738. value: function value () {
  739. switch (c) {
  740. case '{':
  741. case '[':
  742. return newToken('punctuator', read())
  743. case 'n':
  744. read();
  745. literal('ull');
  746. return newToken('null', null)
  747. case 't':
  748. read();
  749. literal('rue');
  750. return newToken('boolean', true)
  751. case 'f':
  752. read();
  753. literal('alse');
  754. return newToken('boolean', false)
  755. case '-':
  756. case '+':
  757. if (read() === '-') {
  758. sign = -1;
  759. }
  760. lexState = 'sign';
  761. return
  762. case '.':
  763. buffer = read();
  764. lexState = 'decimalPointLeading';
  765. return
  766. case '0':
  767. buffer = read();
  768. lexState = 'zero';
  769. return
  770. case '1':
  771. case '2':
  772. case '3':
  773. case '4':
  774. case '5':
  775. case '6':
  776. case '7':
  777. case '8':
  778. case '9':
  779. buffer = read();
  780. lexState = 'decimalInteger';
  781. return
  782. case 'I':
  783. read();
  784. literal('nfinity');
  785. return newToken('numeric', Infinity)
  786. case 'N':
  787. read();
  788. literal('aN');
  789. return newToken('numeric', NaN)
  790. case '"':
  791. case "'":
  792. doubleQuote = (read() === '"');
  793. buffer = '';
  794. lexState = 'string';
  795. return
  796. }
  797. throw invalidChar(read())
  798. },
  799. identifierNameStartEscape: function identifierNameStartEscape () {
  800. if (c !== 'u') {
  801. throw invalidChar(read())
  802. }
  803. read();
  804. var u = unicodeEscape();
  805. switch (u) {
  806. case '$':
  807. case '_':
  808. break
  809. default:
  810. if (!util.isIdStartChar(u)) {
  811. throw invalidIdentifier()
  812. }
  813. break
  814. }
  815. buffer += u;
  816. lexState = 'identifierName';
  817. },
  818. identifierName: function identifierName () {
  819. switch (c) {
  820. case '$':
  821. case '_':
  822. case '\u200C':
  823. case '\u200D':
  824. buffer += read();
  825. return
  826. case '\\':
  827. read();
  828. lexState = 'identifierNameEscape';
  829. return
  830. }
  831. if (util.isIdContinueChar(c)) {
  832. buffer += read();
  833. return
  834. }
  835. return newToken('identifier', buffer)
  836. },
  837. identifierNameEscape: function identifierNameEscape () {
  838. if (c !== 'u') {
  839. throw invalidChar(read())
  840. }
  841. read();
  842. var u = unicodeEscape();
  843. switch (u) {
  844. case '$':
  845. case '_':
  846. case '\u200C':
  847. case '\u200D':
  848. break
  849. default:
  850. if (!util.isIdContinueChar(u)) {
  851. throw invalidIdentifier()
  852. }
  853. break
  854. }
  855. buffer += u;
  856. lexState = 'identifierName';
  857. },
  858. sign: function sign$1 () {
  859. switch (c) {
  860. case '.':
  861. buffer = read();
  862. lexState = 'decimalPointLeading';
  863. return
  864. case '0':
  865. buffer = read();
  866. lexState = 'zero';
  867. return
  868. case '1':
  869. case '2':
  870. case '3':
  871. case '4':
  872. case '5':
  873. case '6':
  874. case '7':
  875. case '8':
  876. case '9':
  877. buffer = read();
  878. lexState = 'decimalInteger';
  879. return
  880. case 'I':
  881. read();
  882. literal('nfinity');
  883. return newToken('numeric', sign * Infinity)
  884. case 'N':
  885. read();
  886. literal('aN');
  887. return newToken('numeric', NaN)
  888. }
  889. throw invalidChar(read())
  890. },
  891. zero: function zero () {
  892. switch (c) {
  893. case '.':
  894. buffer += read();
  895. lexState = 'decimalPoint';
  896. return
  897. case 'e':
  898. case 'E':
  899. buffer += read();
  900. lexState = 'decimalExponent';
  901. return
  902. case 'x':
  903. case 'X':
  904. buffer += read();
  905. lexState = 'hexadecimal';
  906. return
  907. }
  908. return newToken('numeric', sign * 0)
  909. },
  910. decimalInteger: function decimalInteger () {
  911. switch (c) {
  912. case '.':
  913. buffer += read();
  914. lexState = 'decimalPoint';
  915. return
  916. case 'e':
  917. case 'E':
  918. buffer += read();
  919. lexState = 'decimalExponent';
  920. return
  921. }
  922. if (util.isDigit(c)) {
  923. buffer += read();
  924. return
  925. }
  926. return newToken('numeric', sign * Number(buffer))
  927. },
  928. decimalPointLeading: function decimalPointLeading () {
  929. if (util.isDigit(c)) {
  930. buffer += read();
  931. lexState = 'decimalFraction';
  932. return
  933. }
  934. throw invalidChar(read())
  935. },
  936. decimalPoint: function decimalPoint () {
  937. switch (c) {
  938. case 'e':
  939. case 'E':
  940. buffer += read();
  941. lexState = 'decimalExponent';
  942. return
  943. }
  944. if (util.isDigit(c)) {
  945. buffer += read();
  946. lexState = 'decimalFraction';
  947. return
  948. }
  949. return newToken('numeric', sign * Number(buffer))
  950. },
  951. decimalFraction: function decimalFraction () {
  952. switch (c) {
  953. case 'e':
  954. case 'E':
  955. buffer += read();
  956. lexState = 'decimalExponent';
  957. return
  958. }
  959. if (util.isDigit(c)) {
  960. buffer += read();
  961. return
  962. }
  963. return newToken('numeric', sign * Number(buffer))
  964. },
  965. decimalExponent: function decimalExponent () {
  966. switch (c) {
  967. case '+':
  968. case '-':
  969. buffer += read();
  970. lexState = 'decimalExponentSign';
  971. return
  972. }
  973. if (util.isDigit(c)) {
  974. buffer += read();
  975. lexState = 'decimalExponentInteger';
  976. return
  977. }
  978. throw invalidChar(read())
  979. },
  980. decimalExponentSign: function decimalExponentSign () {
  981. if (util.isDigit(c)) {
  982. buffer += read();
  983. lexState = 'decimalExponentInteger';
  984. return
  985. }
  986. throw invalidChar(read())
  987. },
  988. decimalExponentInteger: function decimalExponentInteger () {
  989. if (util.isDigit(c)) {
  990. buffer += read();
  991. return
  992. }
  993. return newToken('numeric', sign * Number(buffer))
  994. },
  995. hexadecimal: function hexadecimal () {
  996. if (util.isHexDigit(c)) {
  997. buffer += read();
  998. lexState = 'hexadecimalInteger';
  999. return
  1000. }
  1001. throw invalidChar(read())
  1002. },
  1003. hexadecimalInteger: function hexadecimalInteger () {
  1004. if (util.isHexDigit(c)) {
  1005. buffer += read();
  1006. return
  1007. }
  1008. return newToken('numeric', sign * Number(buffer))
  1009. },
  1010. string: function string () {
  1011. switch (c) {
  1012. case '\\':
  1013. read();
  1014. buffer += escape();
  1015. return
  1016. case '"':
  1017. if (doubleQuote) {
  1018. read();
  1019. return newToken('string', buffer)
  1020. }
  1021. buffer += read();
  1022. return
  1023. case "'":
  1024. if (!doubleQuote) {
  1025. read();
  1026. return newToken('string', buffer)
  1027. }
  1028. buffer += read();
  1029. return
  1030. case '\n':
  1031. case '\r':
  1032. throw invalidChar(read())
  1033. case '\u2028':
  1034. case '\u2029':
  1035. separatorChar(c);
  1036. break
  1037. case undefined:
  1038. throw invalidChar(read())
  1039. }
  1040. buffer += read();
  1041. },
  1042. start: function start () {
  1043. switch (c) {
  1044. case '{':
  1045. case '[':
  1046. return newToken('punctuator', read())
  1047. // This code is unreachable since the default lexState handles eof.
  1048. // case undefined:
  1049. // return newToken('eof')
  1050. }
  1051. lexState = 'value';
  1052. },
  1053. beforePropertyName: function beforePropertyName () {
  1054. switch (c) {
  1055. case '$':
  1056. case '_':
  1057. buffer = read();
  1058. lexState = 'identifierName';
  1059. return
  1060. case '\\':
  1061. read();
  1062. lexState = 'identifierNameStartEscape';
  1063. return
  1064. case '}':
  1065. return newToken('punctuator', read())
  1066. case '"':
  1067. case "'":
  1068. doubleQuote = (read() === '"');
  1069. lexState = 'string';
  1070. return
  1071. }
  1072. if (util.isIdStartChar(c)) {
  1073. buffer += read();
  1074. lexState = 'identifierName';
  1075. return
  1076. }
  1077. throw invalidChar(read())
  1078. },
  1079. afterPropertyName: function afterPropertyName () {
  1080. if (c === ':') {
  1081. return newToken('punctuator', read())
  1082. }
  1083. throw invalidChar(read())
  1084. },
  1085. beforePropertyValue: function beforePropertyValue () {
  1086. lexState = 'value';
  1087. },
  1088. afterPropertyValue: function afterPropertyValue () {
  1089. switch (c) {
  1090. case ',':
  1091. case '}':
  1092. return newToken('punctuator', read())
  1093. }
  1094. throw invalidChar(read())
  1095. },
  1096. beforeArrayValue: function beforeArrayValue () {
  1097. if (c === ']') {
  1098. return newToken('punctuator', read())
  1099. }
  1100. lexState = 'value';
  1101. },
  1102. afterArrayValue: function afterArrayValue () {
  1103. switch (c) {
  1104. case ',':
  1105. case ']':
  1106. return newToken('punctuator', read())
  1107. }
  1108. throw invalidChar(read())
  1109. },
  1110. end: function end () {
  1111. // This code is unreachable since it's handled by the default lexState.
  1112. // if (c === undefined) {
  1113. // read()
  1114. // return newToken('eof')
  1115. // }
  1116. throw invalidChar(read())
  1117. },
  1118. };
  1119. function newToken (type, value) {
  1120. return {
  1121. type: type,
  1122. value: value,
  1123. line: line,
  1124. column: column,
  1125. }
  1126. }
  1127. function literal (s) {
  1128. for (var i = 0, list = s; i < list.length; i += 1) {
  1129. var c = list[i];
  1130. var p = peek();
  1131. if (p !== c) {
  1132. throw invalidChar(read())
  1133. }
  1134. read();
  1135. }
  1136. }
  1137. function escape () {
  1138. var c = peek();
  1139. switch (c) {
  1140. case 'b':
  1141. read();
  1142. return '\b'
  1143. case 'f':
  1144. read();
  1145. return '\f'
  1146. case 'n':
  1147. read();
  1148. return '\n'
  1149. case 'r':
  1150. read();
  1151. return '\r'
  1152. case 't':
  1153. read();
  1154. return '\t'
  1155. case 'v':
  1156. read();
  1157. return '\v'
  1158. case '0':
  1159. read();
  1160. if (util.isDigit(peek())) {
  1161. throw invalidChar(read())
  1162. }
  1163. return '\0'
  1164. case 'x':
  1165. read();
  1166. return hexEscape()
  1167. case 'u':
  1168. read();
  1169. return unicodeEscape()
  1170. case '\n':
  1171. case '\u2028':
  1172. case '\u2029':
  1173. read();
  1174. return ''
  1175. case '\r':
  1176. read();
  1177. if (peek() === '\n') {
  1178. read();
  1179. }
  1180. return ''
  1181. case '1':
  1182. case '2':
  1183. case '3':
  1184. case '4':
  1185. case '5':
  1186. case '6':
  1187. case '7':
  1188. case '8':
  1189. case '9':
  1190. throw invalidChar(read())
  1191. case undefined:
  1192. throw invalidChar(read())
  1193. }
  1194. return read()
  1195. }
  1196. function hexEscape () {
  1197. var buffer = '';
  1198. var c = peek();
  1199. if (!util.isHexDigit(c)) {
  1200. throw invalidChar(read())
  1201. }
  1202. buffer += read();
  1203. c = peek();
  1204. if (!util.isHexDigit(c)) {
  1205. throw invalidChar(read())
  1206. }
  1207. buffer += read();
  1208. return String.fromCodePoint(parseInt(buffer, 16))
  1209. }
  1210. function unicodeEscape () {
  1211. var buffer = '';
  1212. var count = 4;
  1213. while (count-- > 0) {
  1214. var c = peek();
  1215. if (!util.isHexDigit(c)) {
  1216. throw invalidChar(read())
  1217. }
  1218. buffer += read();
  1219. }
  1220. return String.fromCodePoint(parseInt(buffer, 16))
  1221. }
  1222. var parseStates = {
  1223. start: function start () {
  1224. if (token.type === 'eof') {
  1225. throw invalidEOF()
  1226. }
  1227. push();
  1228. },
  1229. beforePropertyName: function beforePropertyName () {
  1230. switch (token.type) {
  1231. case 'identifier':
  1232. case 'string':
  1233. key = token.value;
  1234. parseState = 'afterPropertyName';
  1235. return
  1236. case 'punctuator':
  1237. // This code is unreachable since it's handled by the lexState.
  1238. // if (token.value !== '}') {
  1239. // throw invalidToken()
  1240. // }
  1241. pop();
  1242. return
  1243. case 'eof':
  1244. throw invalidEOF()
  1245. }
  1246. // This code is unreachable since it's handled by the lexState.
  1247. // throw invalidToken()
  1248. },
  1249. afterPropertyName: function afterPropertyName () {
  1250. // This code is unreachable since it's handled by the lexState.
  1251. // if (token.type !== 'punctuator' || token.value !== ':') {
  1252. // throw invalidToken()
  1253. // }
  1254. if (token.type === 'eof') {
  1255. throw invalidEOF()
  1256. }
  1257. parseState = 'beforePropertyValue';
  1258. },
  1259. beforePropertyValue: function beforePropertyValue () {
  1260. if (token.type === 'eof') {
  1261. throw invalidEOF()
  1262. }
  1263. push();
  1264. },
  1265. beforeArrayValue: function beforeArrayValue () {
  1266. if (token.type === 'eof') {
  1267. throw invalidEOF()
  1268. }
  1269. if (token.type === 'punctuator' && token.value === ']') {
  1270. pop();
  1271. return
  1272. }
  1273. push();
  1274. },
  1275. afterPropertyValue: function afterPropertyValue () {
  1276. // This code is unreachable since it's handled by the lexState.
  1277. // if (token.type !== 'punctuator') {
  1278. // throw invalidToken()
  1279. // }
  1280. if (token.type === 'eof') {
  1281. throw invalidEOF()
  1282. }
  1283. switch (token.value) {
  1284. case ',':
  1285. parseState = 'beforePropertyName';
  1286. return
  1287. case '}':
  1288. pop();
  1289. }
  1290. // This code is unreachable since it's handled by the lexState.
  1291. // throw invalidToken()
  1292. },
  1293. afterArrayValue: function afterArrayValue () {
  1294. // This code is unreachable since it's handled by the lexState.
  1295. // if (token.type !== 'punctuator') {
  1296. // throw invalidToken()
  1297. // }
  1298. if (token.type === 'eof') {
  1299. throw invalidEOF()
  1300. }
  1301. switch (token.value) {
  1302. case ',':
  1303. parseState = 'beforeArrayValue';
  1304. return
  1305. case ']':
  1306. pop();
  1307. }
  1308. // This code is unreachable since it's handled by the lexState.
  1309. // throw invalidToken()
  1310. },
  1311. end: function end () {
  1312. // This code is unreachable since it's handled by the lexState.
  1313. // if (token.type !== 'eof') {
  1314. // throw invalidToken()
  1315. // }
  1316. },
  1317. };
  1318. function push () {
  1319. var value;
  1320. switch (token.type) {
  1321. case 'punctuator':
  1322. switch (token.value) {
  1323. case '{':
  1324. value = {};
  1325. break
  1326. case '[':
  1327. value = [];
  1328. break
  1329. }
  1330. break
  1331. case 'null':
  1332. case 'boolean':
  1333. case 'numeric':
  1334. case 'string':
  1335. value = token.value;
  1336. break
  1337. // This code is unreachable.
  1338. // default:
  1339. // throw invalidToken()
  1340. }
  1341. if (root === undefined) {
  1342. root = value;
  1343. } else {
  1344. var parent = stack[stack.length - 1];
  1345. if (Array.isArray(parent)) {
  1346. parent.push(value);
  1347. } else {
  1348. parent[key] = value;
  1349. }
  1350. }
  1351. if (value !== null && typeof value === 'object') {
  1352. stack.push(value);
  1353. if (Array.isArray(value)) {
  1354. parseState = 'beforeArrayValue';
  1355. } else {
  1356. parseState = 'beforePropertyName';
  1357. }
  1358. } else {
  1359. var current = stack[stack.length - 1];
  1360. if (current == null) {
  1361. parseState = 'end';
  1362. } else if (Array.isArray(current)) {
  1363. parseState = 'afterArrayValue';
  1364. } else {
  1365. parseState = 'afterPropertyValue';
  1366. }
  1367. }
  1368. }
  1369. function pop () {
  1370. stack.pop();
  1371. var current = stack[stack.length - 1];
  1372. if (current == null) {
  1373. parseState = 'end';
  1374. } else if (Array.isArray(current)) {
  1375. parseState = 'afterArrayValue';
  1376. } else {
  1377. parseState = 'afterPropertyValue';
  1378. }
  1379. }
  1380. // This code is unreachable.
  1381. // function invalidParseState () {
  1382. // return new Error(`JSON5: invalid parse state '${parseState}'`)
  1383. // }
  1384. // This code is unreachable.
  1385. // function invalidLexState (state) {
  1386. // return new Error(`JSON5: invalid lex state '${state}'`)
  1387. // }
  1388. function invalidChar (c) {
  1389. if (c === undefined) {
  1390. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1391. }
  1392. return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
  1393. }
  1394. function invalidEOF () {
  1395. return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
  1396. }
  1397. // This code is unreachable.
  1398. // function invalidToken () {
  1399. // if (token.type === 'eof') {
  1400. // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
  1401. // }
  1402. // const c = String.fromCodePoint(token.value.codePointAt(0))
  1403. // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
  1404. // }
  1405. function invalidIdentifier () {
  1406. column -= 5;
  1407. return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
  1408. }
  1409. function separatorChar (c) {
  1410. console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
  1411. }
  1412. function formatChar (c) {
  1413. var replacements = {
  1414. "'": "\\'",
  1415. '"': '\\"',
  1416. '\\': '\\\\',
  1417. '\b': '\\b',
  1418. '\f': '\\f',
  1419. '\n': '\\n',
  1420. '\r': '\\r',
  1421. '\t': '\\t',
  1422. '\v': '\\v',
  1423. '\0': '\\0',
  1424. '\u2028': '\\u2028',
  1425. '\u2029': '\\u2029',
  1426. };
  1427. if (replacements[c]) {
  1428. return replacements[c]
  1429. }
  1430. if (c < ' ') {
  1431. var hexString = c.charCodeAt(0).toString(16);
  1432. return '\\x' + ('00' + hexString).substring(hexString.length)
  1433. }
  1434. return c
  1435. }
  1436. function syntaxError (message) {
  1437. var err = new SyntaxError(message);
  1438. err.lineNumber = line;
  1439. err.columnNumber = column;
  1440. return err
  1441. }
  1442. var stringify = function stringify (value, replacer, space) {
  1443. var stack = [];
  1444. var indent = '';
  1445. var propertyList;
  1446. var replacerFunc;
  1447. var gap = '';
  1448. var quote;
  1449. if (
  1450. replacer != null &&
  1451. typeof replacer === 'object' &&
  1452. !Array.isArray(replacer)
  1453. ) {
  1454. space = replacer.space;
  1455. quote = replacer.quote;
  1456. replacer = replacer.replacer;
  1457. }
  1458. if (typeof replacer === 'function') {
  1459. replacerFunc = replacer;
  1460. } else if (Array.isArray(replacer)) {
  1461. propertyList = [];
  1462. for (var i = 0, list = replacer; i < list.length; i += 1) {
  1463. var v = list[i];
  1464. var item = (void 0);
  1465. if (typeof v === 'string') {
  1466. item = v;
  1467. } else if (
  1468. typeof v === 'number' ||
  1469. v instanceof String ||
  1470. v instanceof Number
  1471. ) {
  1472. item = String(v);
  1473. }
  1474. if (item !== undefined && propertyList.indexOf(item) < 0) {
  1475. propertyList.push(item);
  1476. }
  1477. }
  1478. }
  1479. if (space instanceof Number) {
  1480. space = Number(space);
  1481. } else if (space instanceof String) {
  1482. space = String(space);
  1483. }
  1484. if (typeof space === 'number') {
  1485. if (space > 0) {
  1486. space = Math.min(10, Math.floor(space));
  1487. gap = ' '.substr(0, space);
  1488. }
  1489. } else if (typeof space === 'string') {
  1490. gap = space.substr(0, 10);
  1491. }
  1492. return serializeProperty('', {'': value})
  1493. function serializeProperty (key, holder) {
  1494. var value = holder[key];
  1495. if (value != null) {
  1496. if (typeof value.toJSON5 === 'function') {
  1497. value = value.toJSON5(key);
  1498. } else if (typeof value.toJSON === 'function') {
  1499. value = value.toJSON(key);
  1500. }
  1501. }
  1502. if (replacerFunc) {
  1503. value = replacerFunc.call(holder, key, value);
  1504. }
  1505. if (value instanceof Number) {
  1506. value = Number(value);
  1507. } else if (value instanceof String) {
  1508. value = String(value);
  1509. } else if (value instanceof Boolean) {
  1510. value = value.valueOf();
  1511. }
  1512. switch (value) {
  1513. case null: return 'null'
  1514. case true: return 'true'
  1515. case false: return 'false'
  1516. }
  1517. if (typeof value === 'string') {
  1518. return quoteString(value)
  1519. }
  1520. if (typeof value === 'number') {
  1521. return String(value)
  1522. }
  1523. if (typeof value === 'object') {
  1524. return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
  1525. }
  1526. return undefined
  1527. }
  1528. function quoteString (value) {
  1529. var quotes = {
  1530. "'": 0.1,
  1531. '"': 0.2,
  1532. };
  1533. var replacements = {
  1534. "'": "\\'",
  1535. '"': '\\"',
  1536. '\\': '\\\\',
  1537. '\b': '\\b',
  1538. '\f': '\\f',
  1539. '\n': '\\n',
  1540. '\r': '\\r',
  1541. '\t': '\\t',
  1542. '\v': '\\v',
  1543. '\0': '\\0',
  1544. '\u2028': '\\u2028',
  1545. '\u2029': '\\u2029',
  1546. };
  1547. var product = '';
  1548. for (var i = 0; i < value.length; i++) {
  1549. var c = value[i];
  1550. switch (c) {
  1551. case "'":
  1552. case '"':
  1553. quotes[c]++;
  1554. product += c;
  1555. continue
  1556. case '\0':
  1557. if (util.isDigit(value[i + 1])) {
  1558. product += '\\x00';
  1559. continue
  1560. }
  1561. }
  1562. if (replacements[c]) {
  1563. product += replacements[c];
  1564. continue
  1565. }
  1566. if (c < ' ') {
  1567. var hexString = c.charCodeAt(0).toString(16);
  1568. product += '\\x' + ('00' + hexString).substring(hexString.length);
  1569. continue
  1570. }
  1571. product += c;
  1572. }
  1573. var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
  1574. product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
  1575. return quoteChar + product + quoteChar
  1576. }
  1577. function serializeObject (value) {
  1578. if (stack.indexOf(value) >= 0) {
  1579. throw TypeError('Converting circular structure to JSON5')
  1580. }
  1581. stack.push(value);
  1582. var stepback = indent;
  1583. indent = indent + gap;
  1584. var keys = propertyList || Object.keys(value);
  1585. var partial = [];
  1586. for (var i = 0, list = keys; i < list.length; i += 1) {
  1587. var key = list[i];
  1588. var propertyString = serializeProperty(key, value);
  1589. if (propertyString !== undefined) {
  1590. var member = serializeKey(key) + ':';
  1591. if (gap !== '') {
  1592. member += ' ';
  1593. }
  1594. member += propertyString;
  1595. partial.push(member);
  1596. }
  1597. }
  1598. var final;
  1599. if (partial.length === 0) {
  1600. final = '{}';
  1601. } else {
  1602. var properties;
  1603. if (gap === '') {
  1604. properties = partial.join(',');
  1605. final = '{' + properties + '}';
  1606. } else {
  1607. var separator = ',\n' + indent;
  1608. properties = partial.join(separator);
  1609. final = '{\n' + indent + properties + ',\n' + stepback + '}';
  1610. }
  1611. }
  1612. stack.pop();
  1613. indent = stepback;
  1614. return final
  1615. }
  1616. function serializeKey (key) {
  1617. if (key.length === 0) {
  1618. return quoteString(key)
  1619. }
  1620. var firstChar = String.fromCodePoint(key.codePointAt(0));
  1621. if (!util.isIdStartChar(firstChar)) {
  1622. return quoteString(key)
  1623. }
  1624. for (var i = firstChar.length; i < key.length; i++) {
  1625. if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
  1626. return quoteString(key)
  1627. }
  1628. }
  1629. return key
  1630. }
  1631. function serializeArray (value) {
  1632. if (stack.indexOf(value) >= 0) {
  1633. throw TypeError('Converting circular structure to JSON5')
  1634. }
  1635. stack.push(value);
  1636. var stepback = indent;
  1637. indent = indent + gap;
  1638. var partial = [];
  1639. for (var i = 0; i < value.length; i++) {
  1640. var propertyString = serializeProperty(String(i), value);
  1641. partial.push((propertyString !== undefined) ? propertyString : 'null');
  1642. }
  1643. var final;
  1644. if (partial.length === 0) {
  1645. final = '[]';
  1646. } else {
  1647. if (gap === '') {
  1648. var properties = partial.join(',');
  1649. final = '[' + properties + ']';
  1650. } else {
  1651. var separator = ',\n' + indent;
  1652. var properties$1 = partial.join(separator);
  1653. final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
  1654. }
  1655. }
  1656. stack.pop();
  1657. indent = stepback;
  1658. return final
  1659. }
  1660. };
  1661. var JSON5 = {
  1662. parse: parse,
  1663. stringify: stringify,
  1664. };
  1665. var lib = JSON5;
  1666. var es5 = lib;
  1667. return es5;
  1668. })));
  1669. });
  1670. /*! *****************************************************************************
  1671. Copyright (c) Microsoft Corporation.
  1672. Permission to use, copy, modify, and/or distribute this software for any
  1673. purpose with or without fee is hereby granted.
  1674. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
  1675. REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  1676. AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
  1677. INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  1678. LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  1679. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  1680. PERFORMANCE OF THIS SOFTWARE.
  1681. ***************************************************************************** */
  1682. /* global Reflect, Promise */
  1683. var extendStatics = function(d, b) {
  1684. extendStatics = Object.setPrototypeOf ||
  1685. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  1686. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  1687. return extendStatics(d, b);
  1688. };
  1689. function __extends(d, b) {
  1690. extendStatics(d, b);
  1691. function __() { this.constructor = d; }
  1692. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  1693. }
  1694. var __assign = function() {
  1695. __assign = Object.assign || function __assign(t) {
  1696. for (var s, i = 1, n = arguments.length; i < n; i++) {
  1697. s = arguments[i];
  1698. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  1699. }
  1700. return t;
  1701. };
  1702. return __assign.apply(this, arguments);
  1703. };
  1704. function __decorate(decorators, target, key, desc) {
  1705. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  1706. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  1707. 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;
  1708. return c > 3 && r && Object.defineProperty(target, key, r), r;
  1709. }
  1710. function __param(paramIndex, decorator) {
  1711. return function (target, key) { decorator(target, key, paramIndex); }
  1712. }
  1713. function __metadata(metadataKey, metadataValue) {
  1714. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  1715. }
  1716. function __values(o) {
  1717. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1718. if (m) return m.call(o);
  1719. if (o && typeof o.length === "number") return {
  1720. next: function () {
  1721. if (o && i >= o.length) o = void 0;
  1722. return { value: o && o[i++], done: !o };
  1723. }
  1724. };
  1725. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1726. }
  1727. function __read(o, n) {
  1728. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1729. if (!m) return o;
  1730. var i = m.call(o), r, ar = [], e;
  1731. try {
  1732. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1733. }
  1734. catch (error) { e = { error: error }; }
  1735. finally {
  1736. try {
  1737. if (r && !r.done && (m = i["return"])) m.call(i);
  1738. }
  1739. finally { if (e) throw e.error; }
  1740. }
  1741. return ar;
  1742. }
  1743. function __spread() {
  1744. for (var ar = [], i = 0; i < arguments.length; i++)
  1745. ar = ar.concat(__read(arguments[i]));
  1746. return ar;
  1747. }
  1748. var PropertyDescription = /** @class */ (function () {
  1749. function PropertyDescription() {
  1750. var _this = this;
  1751. var args = [];
  1752. for (var _i = 0; _i < arguments.length; _i++) {
  1753. args[_i] = arguments[_i];
  1754. }
  1755. this.propertyes = {
  1756. props: [],
  1757. events: []
  1758. };
  1759. _$2.each(args, function (arg) {
  1760. _this.merge(arg);
  1761. });
  1762. }
  1763. PropertyDescription.prototype.merge = function (pd) {
  1764. this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
  1765. if (pd.events) {
  1766. if (this.propertyes.events) {
  1767. this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
  1768. }
  1769. else {
  1770. this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
  1771. }
  1772. }
  1773. };
  1774. /**
  1775. * 根据分组名 获取属性定义
  1776. */
  1777. PropertyDescription.prototype.getPropsByGroup = function (name) {
  1778. return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
  1779. };
  1780. /**
  1781. * 获取全部事件
  1782. */
  1783. PropertyDescription.prototype.getEvents = function () {
  1784. return this.propertyes.events;
  1785. };
  1786. return PropertyDescription;
  1787. }());
  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. /**
  2134. * 弹出输入框,输入文字
  2135. * @param message 提示文字
  2136. * @param defaultValue 默认值
  2137. * @param multiLine 是否多行输入
  2138. */
  2139. function prompt$1(message, defaultValue, multiLine) {
  2140. if (defaultValue === void 0) { defaultValue = ""; }
  2141. if (multiLine === void 0) { multiLine = false; }
  2142. return new Promise(function (resolve) {
  2143. Ext.MessageBox.prompt('请输入', message, function (button, value) {
  2144. if (button === 'ok') {
  2145. resolve(value);
  2146. }
  2147. }, null, multiLine, defaultValue);
  2148. });
  2149. }
  2150. /**
  2151. * 显示错误异常信息
  2152. * @param msg 错误内容
  2153. * @param sender 发送者按钮(可以为空)
  2154. */
  2155. function showErrorDialog(msg, sender) {
  2156. console.error(msg);
  2157. Ext.MessageBox.show({
  2158. title: '错误',
  2159. msg: msg,
  2160. buttons: Ext.MessageBox.OK,
  2161. animateTarget: sender,
  2162. icon: 'error',
  2163. cls: 'show-icon-messagebox',
  2164. });
  2165. }
  2166. /**
  2167. * 显示错误异常信息
  2168. * @param msg 错误内容
  2169. * @param sender 发送者按钮(可以为空)
  2170. */
  2171. function showInfoDialogSimple(msg, sender) {
  2172. console.info(msg);
  2173. Ext.MessageBox.show({
  2174. title: '提示',
  2175. msg: msg,
  2176. buttons: Ext.MessageBox.OK,
  2177. animateTarget: sender,
  2178. icon: 'info',
  2179. cls: 'show-icon-messagebox',
  2180. });
  2181. }
  2182. function msgError(msg, sender) {
  2183. showErrorDialog(msg, sender);
  2184. }
  2185. /**
  2186. * 中间灰底白字提示
  2187. */
  2188. function msg(message) {
  2189. console.log(message);
  2190. var t = { message: message };
  2191. var WMSTranslate = window["WMSTranslate"];
  2192. if (WMSTranslate) {
  2193. if (typeof window['viewTranslate'] === 'function') {
  2194. window['viewTranslate'](t, message, "message");
  2195. }
  2196. }
  2197. var $body = $$2('body');
  2198. $body.find('[xtype=tooltip]').remove();
  2199. var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
  2200. ' <div class="yvan-msg-content">' +
  2201. _$2.escape(t.message) +
  2202. '</div></div>');
  2203. $body.append($w);
  2204. var iframeWidth = $w.parent().width();
  2205. var iframeHeight = $w.parent().height();
  2206. var windowWidth = $w.width();
  2207. var windowHeight = $w.height();
  2208. var setWidth = (iframeWidth - windowWidth) / 2;
  2209. var setHeight = (iframeHeight - windowHeight) / 2;
  2210. if (iframeHeight < windowHeight || setHeight < 0) {
  2211. setHeight = 0;
  2212. }
  2213. if (iframeWidth < windowWidth || setWidth < 0) {
  2214. setWidth = 0;
  2215. }
  2216. $w.css({ left: setWidth, top: setHeight });
  2217. setTimeout(function () {
  2218. $w.remove();
  2219. }, 3000);
  2220. }
  2221. localforage.config({
  2222. name: "studio",
  2223. storeName: "item",
  2224. });
  2225. function getItem(key, callback) {
  2226. localforage.getItem(key).then(function (value) {
  2227. if (callback) {
  2228. callback(value);
  2229. }
  2230. });
  2231. }
  2232. function setItem(key, value, callback) {
  2233. localforage.setItem(key, value).then(function (val) {
  2234. if (callback) {
  2235. callback();
  2236. }
  2237. });
  2238. }
  2239. var native = {
  2240. /**
  2241. * 读取文件
  2242. */
  2243. loadFile: function (fileName, callback) {
  2244. console.log('loadFile', fileName);
  2245. getItem('NATIVE_' + fileName, callback);
  2246. },
  2247. /**
  2248. * 保存文件
  2249. */
  2250. saveFile: function (fileName, content) {
  2251. console.log('saveFile', fileName, content);
  2252. setItem('NATIVE_' + fileName, content);
  2253. },
  2254. openInIdea: function (path) {
  2255. msg(path);
  2256. },
  2257. /**
  2258. * 初始化 native 工具类
  2259. */
  2260. init: function () {
  2261. var ClipboardJS = window['ClipboardJS'];
  2262. if (!ClipboardJS) {
  2263. msg('没有引入 ClipboardJS');
  2264. return;
  2265. }
  2266. $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
  2267. var clipboard = new ClipboardJS('.__btnClipboard');
  2268. },
  2269. /**
  2270. * 设置剪切板
  2271. */
  2272. clipboardSet: function (c) {
  2273. var $btn = $('.__btnClipboard');
  2274. $btn.attr('data-clipboard-text', c);
  2275. $btn.trigger("click");
  2276. },
  2277. };
  2278. /**
  2279. * 判断变量是否有值 value === null || value === undefined
  2280. * @param value 目标变量
  2281. */
  2282. var noValue = function (value) {
  2283. return value === null || value === undefined;
  2284. };
  2285. function initStateTree () {
  2286. Ext.define('com.yvan.studio.StateTree', {
  2287. extend: 'Ext.tree.Panel',
  2288. _saveStateFlag: true,
  2289. _filterText: '',
  2290. fbar: [
  2291. {
  2292. xtype: 'textfield',
  2293. flex: 1,
  2294. emptyText: '搜索过滤',
  2295. enableKeyEvents: true,
  2296. listeners: {
  2297. change: function (sender) {
  2298. var tree = sender.up("treepanel");
  2299. tree.filterByText(this.getRawValue());
  2300. },
  2301. keyup: function (sender, e) {
  2302. var tree = sender.up("treepanel");
  2303. if (e.ESC === e.getKey()) {
  2304. sender.setValue('');
  2305. tree.filterByText('');
  2306. }
  2307. }
  2308. }
  2309. },
  2310. ],
  2311. getStateFilename: function () {
  2312. throw Error('没有实现这个函数');
  2313. },
  2314. initComponent: function () {
  2315. var me = this;
  2316. this.on({
  2317. afterrender: function () {
  2318. var _this = this;
  2319. // 回车后打开节点
  2320. $(me.el.dom).keydown(function (event) {
  2321. if (event.keyCode === 13) {
  2322. event.preventDefault();
  2323. _this.fireEvent('itemverify');
  2324. return;
  2325. }
  2326. });
  2327. },
  2328. afteritemexpand: {
  2329. fn: function (node, index, item, eOpts) {
  2330. this.saveState();
  2331. },
  2332. buffer: 100,
  2333. },
  2334. afteritemcollapse: {
  2335. fn: function (node, index, item, eOpts) {
  2336. this.saveState();
  2337. },
  2338. buffer: 100,
  2339. },
  2340. itemdblclick: function (sender, record) {
  2341. this.fireEvent('itemverify');
  2342. },
  2343. itemclick: {
  2344. fn: function (node, index, item, eOpts) {
  2345. this.saveState();
  2346. },
  2347. buffer: 100,
  2348. }
  2349. });
  2350. this.superclass.superclass.initComponent.apply(this, arguments);
  2351. },
  2352. restoreState: function () {
  2353. var _this = this;
  2354. native.loadFile(this.getStateFilename(), function (content) {
  2355. if (!content)
  2356. return;
  2357. var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  2358. _this._saveStateFlag = false;
  2359. if (_.isArray(expands)) {
  2360. _.forEach(expands, function (p) {
  2361. _this.expandPath(p);
  2362. });
  2363. }
  2364. if (_.isArray(selections) && selections[0]) {
  2365. try {
  2366. _this.selectPath(selections[0]);
  2367. }
  2368. catch (e) {
  2369. }
  2370. }
  2371. if (scrollPosition && scrollSize) {
  2372. var size = _this.scrollable.getSize();
  2373. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  2374. try {
  2375. _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  2376. }
  2377. catch (e) {
  2378. }
  2379. }
  2380. }
  2381. setTimeout(function () {
  2382. _this._saveStateFlag = true;
  2383. }, 200);
  2384. });
  2385. },
  2386. saveState: function () {
  2387. if (!this._saveStateFlag) {
  2388. return;
  2389. }
  2390. if (this._filterText) {
  2391. // 有筛选,不保存展开状态
  2392. return;
  2393. }
  2394. var expands = [];
  2395. var selections = [];
  2396. var selection = this.getSelection();
  2397. _.forEach(selection, function (item) {
  2398. selections.push(item.getPath());
  2399. });
  2400. var data = this.getStore().data;
  2401. _.forEach(data.items, function (item) {
  2402. if (item.data.expanded === true) {
  2403. expands.push(item.getPath());
  2404. }
  2405. });
  2406. var scrollPosition = this.scrollable.position;
  2407. var scrollSize = this.scrollable.getSize();
  2408. native.saveFile(this.getStateFilename(), {
  2409. selections: selections,
  2410. expands: expands,
  2411. scrollPosition: scrollPosition,
  2412. scrollSize: scrollSize
  2413. });
  2414. },
  2415. filterByText: function (text) {
  2416. this._filterText = text;
  2417. this._filterBy(this, text, 'text');
  2418. },
  2419. _filterBy: _.debounce(function (me, text, by) {
  2420. var view = me.getView();
  2421. me.store.clearFilter();
  2422. if (!me._filterText) {
  2423. // 没有筛选内容,还原状态
  2424. var selections = me.getSelection();
  2425. var selectionPaths_1 = [];
  2426. _.forEach(me.getSelection(), function (item) {
  2427. selectionPaths_1.push(item.getPath());
  2428. });
  2429. me.collapseAll();
  2430. me.restoreState();
  2431. _.forEach(selectionPaths_1, function (path) {
  2432. me.expandPath(path);
  2433. });
  2434. me.setSelection(selections);
  2435. return;
  2436. }
  2437. // 递归查找所有需要可见的节点 id 数组
  2438. var nodesAndParents = [];
  2439. var expandPaths = [];
  2440. me.getRootNode().cascadeBy(function (tree, view) {
  2441. var currNode = this;
  2442. currNode.collapse();
  2443. if (currNode && currNode.data[by] &&
  2444. currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
  2445. // 展开到匹配的路径
  2446. // me.expandPath(currNode.getPath());
  2447. expandPaths.push(currNode.getPath());
  2448. // 沿途父节点全部设定为可见
  2449. while (currNode.parentNode) {
  2450. nodesAndParents.push(currNode.id);
  2451. currNode = currNode.parentNode;
  2452. }
  2453. }
  2454. }, null, [me, view]);
  2455. me.store.filterBy(function (r) {
  2456. return Ext.Array.contains(nodesAndParents, r.get('id'));
  2457. });
  2458. _.forEach(expandPaths, function (path) {
  2459. me.expandPath(path);
  2460. });
  2461. }, 1000),
  2462. });
  2463. }
  2464. function initDashboard () {
  2465. Ext.define('com.yvan.studio.Dashboard', {
  2466. extend: 'Ext.panel.Panel',
  2467. alias: 'widget.dashboard',
  2468. xtype: 'dashboard',
  2469. html: ''
  2470. });
  2471. }
  2472. var handles$1 = {
  2473. mainWindow: undefined,
  2474. fileTree: undefined,
  2475. dbTree: undefined,
  2476. viewoutlinetree: undefined,
  2477. statusbar: undefined,
  2478. dictTree: undefined,
  2479. property: undefined,
  2480. dbcode: undefined,
  2481. report: undefined,
  2482. widget: undefined,
  2483. whLayout: undefined,
  2484. };
  2485. window['handles'] = handles$1;
  2486. function setDictTree(value) {
  2487. handles$1.dictTree = value;
  2488. }
  2489. function setMainWindow(value) {
  2490. handles$1.mainWindow = value;
  2491. }
  2492. function setReport(value) {
  2493. handles$1.report = value;
  2494. }
  2495. function setStatusbar(statusbar) {
  2496. handles$1.statusbar = statusbar;
  2497. }
  2498. function setFileTree(value) {
  2499. handles$1.fileTree = value;
  2500. }
  2501. function setDbTree(value) {
  2502. handles$1.dbTree = value;
  2503. }
  2504. function setWidget(value) {
  2505. handles$1.widget = value;
  2506. }
  2507. function setWhLayout(value) {
  2508. handles$1.whLayout = value;
  2509. }
  2510. function setViewoutlinetree(value) {
  2511. handles$1.viewoutlinetree = value;
  2512. }
  2513. function setPropertyPanel(value) {
  2514. handles$1.property = value;
  2515. }
  2516. function setDbCode(value) {
  2517. handles$1.dbcode = value;
  2518. }
  2519. /**
  2520. * 调用方法
  2521. */
  2522. function invokeMethod(fn, sender, args) {
  2523. if (typeof fn === 'function') {
  2524. fn.apply.apply(fn, __spread([sender], args));
  2525. }
  2526. }
  2527. /**
  2528. * 判断事件是否为有效的输入字符
  2529. * @param e
  2530. */
  2531. function isChartEvent(e) {
  2532. if (e.key === 'Shift' ||
  2533. e.key === 'Control' ||
  2534. e.key === 'Alt' ||
  2535. e.key === 'Escape' ||
  2536. e.key === 'ArrowRight' ||
  2537. e.key === 'Tab' ||
  2538. e.key === 'ArrowLeft') {
  2539. return false;
  2540. }
  2541. if (e.keyCode >= 48 && e.keyCode <= 57) {
  2542. // 0-9
  2543. return true;
  2544. }
  2545. if (e.keyCode >= 65 && e.keyCode <= 90) {
  2546. // a-z
  2547. return true;
  2548. }
  2549. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  2550. // 小键盘 0-9
  2551. return true;
  2552. }
  2553. return false;
  2554. }
  2555. if (!window["time_offset"]) {
  2556. window["time_offset"] = 0;
  2557. }
  2558. function syncDate(date) {
  2559. if (date && date.setTime && date.getTime) {
  2560. date.setTime(date.getTime() + window["time_offset"]);
  2561. }
  2562. return date;
  2563. }
  2564. function isDesignMode(control, config) {
  2565. var _a, _b;
  2566. if (window["IS_DESIGN_MODE"]) {
  2567. return true;
  2568. }
  2569. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  2570. return true;
  2571. }
  2572. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  2573. return true;
  2574. }
  2575. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  2576. return true;
  2577. }
  2578. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  2579. return true;
  2580. }
  2581. return false;
  2582. }
  2583. function toString(value) {
  2584. if (typeof value === 'undefined' || value === null) {
  2585. return "";
  2586. }
  2587. if (typeof value === 'number' && isNaN(value)) {
  2588. return "";
  2589. }
  2590. if (value == 'N/A') {
  2591. return "";
  2592. }
  2593. return ("" + value);
  2594. }
  2595. function isEmpty(value) {
  2596. if (typeof value === 'undefined' || value === null) {
  2597. return true;
  2598. }
  2599. if (typeof value === 'number' && isNaN(value)) {
  2600. return true;
  2601. }
  2602. if (value == 'N/A') {
  2603. return true;
  2604. }
  2605. return ("" + value).trim().length <= 0;
  2606. }
  2607. function createUUID() {
  2608. //@ts-ignore
  2609. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  2610. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  2611. });
  2612. }
  2613. function getRegList() {
  2614. var regList = _$2.get(window, 'yvanLib.regList');
  2615. if (!regList) {
  2616. regList = [];
  2617. _$2.set(window, 'yvanLib.regList', regList);
  2618. }
  2619. return regList;
  2620. }
  2621. function getRegParamList(methodName) {
  2622. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  2623. if (!regParamList) {
  2624. regParamList = {};
  2625. _$2.set(window, 'yvanLib.regParamList', regParamList);
  2626. }
  2627. if (!_$2.has(regParamList, methodName)) {
  2628. regParamList[methodName] = [];
  2629. }
  2630. return regParamList[methodName];
  2631. }
  2632. /**
  2633. * 模拟点击按钮
  2634. */
  2635. function raiseClick(buttonHandle) {
  2636. if (!buttonHandle) {
  2637. return false;
  2638. }
  2639. if (buttonHandle.disabled) {
  2640. // 按钮是禁止状态
  2641. return false;
  2642. }
  2643. if (buttonHandle.hidden) {
  2644. // 按钮是隐藏状态
  2645. return false;
  2646. }
  2647. // 按钮点击
  2648. buttonHandle.click();
  2649. return true;
  2650. }
  2651. /**
  2652. * 标注系统全局函数的参数
  2653. * @param title 函数名称
  2654. * @param type 函数类型
  2655. * @param allowEmpty 可否为空
  2656. */
  2657. function LibParam(title, type, allowEmpty) {
  2658. if (allowEmpty === void 0) { allowEmpty = false; }
  2659. return function (target, methodName, paramsIndex) {
  2660. var systemFnArgs = getRegParamList(methodName);
  2661. systemFnArgs[paramsIndex] = {
  2662. type: type,
  2663. title: title,
  2664. name: methodName,
  2665. allowEmpty: allowEmpty,
  2666. };
  2667. };
  2668. }
  2669. /**
  2670. * 标注函数变成"系统全局函数"
  2671. */
  2672. function Lib(registe) {
  2673. return function (target, propertyKey, descriptor) {
  2674. var libList = getRegList();
  2675. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  2676. if (registe.type === 'system') {
  2677. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  2678. }
  2679. else if (registe.type === 'format') {
  2680. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  2681. }
  2682. return target;
  2683. };
  2684. }
  2685. /**
  2686. * 解析事件
  2687. * 'scope.私有方法名'
  2688. * 'system.系统函数名'
  2689. * 'format.格式化名'
  2690. */
  2691. function lookupFn(scope, event, errorWho) {
  2692. if (isDesignMode(scope, undefined)) {
  2693. return Ext.emptyFn;
  2694. }
  2695. if (!_$2.startsWith(event, 'scope.') &&
  2696. !_$2.startsWith(event, 'system.') &&
  2697. !_$2.startsWith(event, 'format.')) {
  2698. console.error('无法识别的事件响应类型', event);
  2699. throw new TypeError('无法识别的事件响应类型');
  2700. }
  2701. // 为 eval 准备环境
  2702. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  2703. var data = scope.viewModel.data;
  2704. var keys = [];
  2705. var values = [];
  2706. _$2.forOwn(data, function (value, key) {
  2707. var idxKey = key.indexOf('//');
  2708. if (idxKey >= 0) {
  2709. keys.push(key.substr(0, idxKey));
  2710. }
  2711. else {
  2712. keys.push(key);
  2713. }
  2714. values.push(value);
  2715. });
  2716. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  2717. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  2718. if (typeof funcResult !== 'function') {
  2719. console.error('无法识别的事件响应类型', event, func, errorWho);
  2720. throw new TypeError('无法识别的事件响应类型');
  2721. }
  2722. return funcResult;
  2723. }
  2724. /**
  2725. * 从 ext.element 获取 scope 对象
  2726. */
  2727. function lookupScope(extHandle) {
  2728. if (!extHandle) {
  2729. // @ts-ignore
  2730. return;
  2731. }
  2732. if (extHandle.isScope) {
  2733. return extHandle;
  2734. }
  2735. if (extHandle.column) {
  2736. // 列上的组件
  2737. return extHandle.column.lookupReferenceHolder().yvanScope;
  2738. }
  2739. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  2740. if (typeof extHandle.lookupViewModel === 'function') {
  2741. var vm = extHandle.lookupViewModel();
  2742. return vm.yvanScope;
  2743. }
  2744. return;
  2745. }
  2746. /**
  2747. * 全局 ajax 方法
  2748. */
  2749. var ajax = {};
  2750. /**
  2751. * 计算拼音的函数
  2752. */
  2753. var pinyinFunc = function (str) { return (str); };
  2754. exports.scopeOnLoad = null;
  2755. exports.apiConvert = undefined;
  2756. var baseConfigProcessList = [];
  2757. /**
  2758. * 在基类添加 Config 的处理方法
  2759. */
  2760. function baseConfigProcess(option) {
  2761. return function (target, propertyKey) {
  2762. baseConfigProcessList.push(target[propertyKey]);
  2763. };
  2764. }
  2765. // let designMode: boolean = false
  2766. //
  2767. // export function isDesignMode(): boolean {
  2768. // return designMode
  2769. // }
  2770. //
  2771. // export function setDesignMode(v: boolean) {
  2772. // designMode = v
  2773. // }
  2774. /**
  2775. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  2776. */
  2777. function serverInvokeUrlTransform(url, option) {
  2778. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  2779. }
  2780. /**
  2781. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  2782. */
  2783. function sqlUrlTransform(url) {
  2784. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  2785. }
  2786. /**
  2787. * YvanUI 全局扩展配置
  2788. */
  2789. function extend(option) {
  2790. if (option.ajax) {
  2791. ajax.func = option.ajax;
  2792. }
  2793. if (option.serverInvokeUrlTransform) {
  2794. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  2795. }
  2796. if (option.sqlUrlTransform) {
  2797. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  2798. }
  2799. if (option.pinyinFunction) {
  2800. pinyinFunc = option.pinyinFunction;
  2801. }
  2802. if (option.scopeOnLoad) {
  2803. exports.scopeOnLoad = option.scopeOnLoad;
  2804. }
  2805. if (option.scopeOnCreate) {
  2806. exports.scopeOnCreate = option.scopeOnCreate;
  2807. }
  2808. if (option.apiConvert) {
  2809. exports.apiConvert = option.apiConvert;
  2810. }
  2811. // if (typeof option.designMode !== 'undefined') {
  2812. // setDesignMode(option.designMode)
  2813. // }
  2814. }
  2815. function getApiConvert() {
  2816. return exports.apiConvert;
  2817. }
  2818. function getScopeOnCreate() {
  2819. return exports.scopeOnCreate;
  2820. }
  2821. function getPinyin(v) {
  2822. return pinyinFunc(v);
  2823. }
  2824. /**
  2825. * 适用于 Select / Tree 等,作筛选的通用方法.
  2826. * 1.首字母模糊匹配(不区分大小写)
  2827. * 2.标识的模糊匹配(不区分大小写)
  2828. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  2829. */
  2830. function keywordFilter(keyword, label, value) {
  2831. if (!keyword) {
  2832. return true;
  2833. }
  2834. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  2835. // const labelPy = _.toLower(getPinyin(label))
  2836. //@ts-ignore
  2837. var labelPy = _$2.toLower(getFirstPinyin2(label));
  2838. value = _$2.toLower(_$2.trim(value));
  2839. var found = 0;
  2840. _$2.some(ws, function (word) {
  2841. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  2842. found++;
  2843. return;
  2844. }
  2845. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  2846. found++;
  2847. return;
  2848. }
  2849. });
  2850. return found >= ws.length;
  2851. }
  2852. var idPrefix = "_ds_";
  2853. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  2854. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  2855. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  2856. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  2857. var layoutOrXtypeNameMap = {
  2858. fit: 'fit布局',
  2859. border: 'border布局',
  2860. center: '中部',
  2861. north: '上部',
  2862. south: '下部',
  2863. west: '左部',
  2864. east: '右部',
  2865. yvgrid: '表格',
  2866. tree: '树',
  2867. tabpanel: '标签页',
  2868. form: '表单',
  2869. fieldset: '字段组',
  2870. tbar: '顶部工具栏',
  2871. fbar: '底部工具栏',
  2872. toolbar: '工具栏',
  2873. cols: '列容器',
  2874. rows: '行容器',
  2875. textfield: '文本框',
  2876. textareafield: '长文本框',
  2877. numberfield: '数字框',
  2878. label: "文本",
  2879. combo: "下拉框",
  2880. combobox: "下拉框",
  2881. combotree: "下拉树",
  2882. combogrid: "下拉表",
  2883. datefield: "日期框",
  2884. searchfield: "搜索框",
  2885. button: "按钮",
  2886. checkbox: "勾选",
  2887. checkboxgroup: "勾选组",
  2888. radio: "点选",
  2889. radiogroup: "点选组",
  2890. container: "占位"
  2891. };
  2892. /**
  2893. * 从 VJSON 中找到 rows/cols 的数组
  2894. */
  2895. function findArrayContainer(vjson, id) {
  2896. var parentVJson = getSuperVjson(vjson, id);
  2897. if (_$2.isArray(parentVJson)) {
  2898. return parentVJson;
  2899. }
  2900. if (parentVJson.hasOwnProperty('items')) {
  2901. return parentVJson.items;
  2902. }
  2903. }
  2904. /**
  2905. * 根据id查找上级vjson
  2906. * @param vjson 原始 vjson 视图
  2907. * @param targetId 子元素的id
  2908. */
  2909. function getSuperVjson(vjson, targetId) {
  2910. return deepTravFindSuper(vjson, vjson, targetId);
  2911. }
  2912. /**
  2913. * 根据id查找上级vjson id
  2914. * @param vjson 原始 vjson 视图
  2915. * @param targetId 子元素的id
  2916. */
  2917. function getSuperVjsonId(vjson, targetId) {
  2918. var vj = getSuperVjson(vjson, targetId);
  2919. return vj.id;
  2920. }
  2921. function deepTravFindSuper(superVjson, vjson, targetId) {
  2922. var rObj = null;
  2923. _$2.forOwn(vjson, function (value, key) {
  2924. if (rObj) {
  2925. return;
  2926. }
  2927. if (typeof value !== "object") {
  2928. return;
  2929. }
  2930. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  2931. if (key !== 'items') {
  2932. return;
  2933. }
  2934. }
  2935. else {
  2936. // 模型、数据、数据源不扫描
  2937. if (key === 'data' ||
  2938. key === 'dataSource' ||
  2939. key === 'suggest' ||
  2940. key === 'options' ||
  2941. key === 'config' ||
  2942. key === 'columns' ||
  2943. key === 'viewModel' ||
  2944. key === 'store') {
  2945. return;
  2946. }
  2947. }
  2948. //事件不扫描
  2949. if (key === "on" && _$2.isObject(value)) {
  2950. return;
  2951. }
  2952. if (key.startsWith("on") && _$2.size(key) > 2) {
  2953. return;
  2954. }
  2955. if (value.id === targetId) {
  2956. if (_$2.isArray(vjson)) {
  2957. rObj = superVjson;
  2958. }
  2959. else {
  2960. rObj = vjson;
  2961. }
  2962. return;
  2963. }
  2964. rObj = deepTravFindSuper(vjson, value, targetId);
  2965. });
  2966. return rObj;
  2967. }
  2968. /**
  2969. * 深度遍历 vjson
  2970. * @param vjson 视图JSON
  2971. * @param resolver 分析函数
  2972. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  2973. */
  2974. function deepTravVJson(vjson, resolver, propDeep) {
  2975. if (propDeep === void 0) { propDeep = false; }
  2976. var markerList = [];
  2977. deepTrav1(vjson, resolver, markerList, propDeep);
  2978. return markerList;
  2979. }
  2980. function deepTrav1(obj, resolver, marker, propDeep) {
  2981. if (propDeep === void 0) { propDeep = false; }
  2982. var isMarker = resolver(obj);
  2983. if (marker && isMarker === true) {
  2984. marker.unshift({ id: 0, keyName: '', object: obj });
  2985. }
  2986. _$2.forOwn(obj, function (value, key) {
  2987. if (typeof value !== 'object') {
  2988. return;
  2989. }
  2990. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  2991. if (key !== 'items' && key !== 'children') {
  2992. return;
  2993. }
  2994. }
  2995. else {
  2996. // 模型、数据、数据源不扫描
  2997. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  2998. return;
  2999. }
  3000. if (!propDeep &&
  3001. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  3002. key === 'listeners' || key === 'bind')) {
  3003. return;
  3004. }
  3005. }
  3006. //事件不扫描
  3007. if (key === 'on' && _$2.isObject(value)) {
  3008. return;
  3009. }
  3010. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3011. return;
  3012. }
  3013. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  3014. if (marker && isMarkerChild === true) {
  3015. isMarker = true;
  3016. marker.unshift({ id: obj.id, keyName: key, object: value });
  3017. }
  3018. });
  3019. // @ts-ignore 删除作废对象
  3020. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  3021. return isMarker;
  3022. }
  3023. /**
  3024. * 在代码中找到 reference 对应的对象
  3025. */
  3026. function findInCode(code, id) {
  3027. try {
  3028. deepTravVJson(code, function (child) {
  3029. if (child.id === id) {
  3030. throw child;
  3031. }
  3032. });
  3033. return undefined;
  3034. }
  3035. catch (err) {
  3036. return err;
  3037. }
  3038. }
  3039. function replaceVjsonById(vjson, itemVjson, itemId) {
  3040. if (!itemVjson || (!itemVjson.id && !itemId)) {
  3041. msgError('无法定位组件!');
  3042. debugger;
  3043. return;
  3044. }
  3045. var id = itemId || itemVjson.id;
  3046. deepTravVJson(vjson, function (obj) {
  3047. if (obj.id == id) {
  3048. _$2.assign(obj, itemVjson, { id: id });
  3049. }
  3050. });
  3051. }
  3052. function deepTravDeleteVjson(obj, targetId) {
  3053. var isDelete = false;
  3054. _$2.forOwn(obj, function (value, key) {
  3055. if (isDelete) {
  3056. return;
  3057. }
  3058. if (typeof value !== 'object') {
  3059. return;
  3060. }
  3061. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3062. if (key !== 'items') {
  3063. return;
  3064. }
  3065. }
  3066. else {
  3067. // 模型、数据、数据源不扫描
  3068. if (key === 'data' ||
  3069. key === 'dataSource' ||
  3070. key === 'suggest' ||
  3071. key === 'options' ||
  3072. key === 'config' ||
  3073. key === 'columns' ||
  3074. key === 'viewModel' ||
  3075. key === 'store') {
  3076. return;
  3077. }
  3078. }
  3079. //事件不扫描
  3080. if (key === 'on' && _$2.isObject(value)) {
  3081. return;
  3082. }
  3083. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3084. return;
  3085. }
  3086. if (value.id === targetId) {
  3087. isDelete = true;
  3088. /** 如果是数组的元素*/
  3089. if (_$2.isArray(obj)) {
  3090. obj.splice(key, 1);
  3091. }
  3092. else {
  3093. delete obj[key];
  3094. }
  3095. return;
  3096. }
  3097. isDelete = deepTravDeleteVjson(value, targetId);
  3098. });
  3099. return isDelete;
  3100. }
  3101. /**
  3102. * 根据id删除Vjson 会删除因删除元素造成的空对象
  3103. * @param obj 原始 vjson 视图
  3104. * @param targetId 子元素的id
  3105. */
  3106. function deletVjsonById(vjson, targetId) {
  3107. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  3108. // if (_.isArray(obj)) {
  3109. // if (obj.length <= 0) {
  3110. // let T: any = {
  3111. // view: "template",
  3112. // template: "拖动任何组件到此处",
  3113. // role: "placeholder",
  3114. // id: webix.uid()
  3115. // }
  3116. // obj.push(T);
  3117. // }
  3118. // }
  3119. return isDeleted;
  3120. }
  3121. function removeDesignProp(vjson) {
  3122. deepTravVJson(vjson, function (obj) {
  3123. if (obj.hasOwnProperty('id')) {
  3124. delete obj.id;
  3125. }
  3126. if (obj.hasOwnProperty("designMode")) {
  3127. delete obj.designMode;
  3128. }
  3129. });
  3130. if (vjson.hasOwnProperty("cls")) {
  3131. delete vjson.cls;
  3132. }
  3133. if (vjson.hasOwnProperty("viewModel")) {
  3134. delete vjson.viewModel;
  3135. }
  3136. if (vjson.hasOwnProperty("store")) {
  3137. delete vjson.store;
  3138. }
  3139. }
  3140. function getLayoutOutline(vjson) {
  3141. deepTravVJson(vjson, function (obj) {
  3142. if (!Array.isArray(obj)) {
  3143. _$2.forOwn(obj, function (value, key) {
  3144. if (key === 'id' || key === 'region' || key === 'layoutName'
  3145. || key === 'text' || key === 'fieldLabel' || key === 'title'
  3146. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  3147. if (key === 'region'
  3148. || (key === 'xtype' && !_$2.has(obj, 'region'))
  3149. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  3150. if (!_$2.has(obj, 'layoutName')) {
  3151. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  3152. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  3153. // console.log(obj.layoutName, obj.layoutNameDesc)
  3154. }
  3155. }
  3156. }
  3157. else {
  3158. if (key === 'items') {
  3159. obj.children = obj[key];
  3160. }
  3161. if (key === 'tbar') {
  3162. var t = obj[key];
  3163. t.layoutName = key;
  3164. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3165. // console.log(t.layoutName, t.layoutNameDesc)
  3166. if (_$2.has(obj, "items")) {
  3167. obj.items.splice(0, 0, t);
  3168. }
  3169. else if (_$2.has(obj, "children")) {
  3170. obj.children.splice(0, 0, t);
  3171. }
  3172. else {
  3173. obj.children = [t];
  3174. }
  3175. }
  3176. if (key === 'fbar') {
  3177. var t = obj[key];
  3178. t.layoutName = key;
  3179. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3180. // console.log(t.layoutName, t.layoutNameDesc)
  3181. if (_$2.has(obj, "items")) {
  3182. obj.items.push(t);
  3183. }
  3184. else if (_$2.has(obj, "children")) {
  3185. obj.children.push(t);
  3186. }
  3187. else {
  3188. obj.children = [t];
  3189. }
  3190. }
  3191. delete obj[key];
  3192. }
  3193. });
  3194. if (!obj.hasOwnProperty("children")) {
  3195. obj.leaf = true;
  3196. }
  3197. if (!obj.hasOwnProperty("expanded")) {
  3198. obj.expanded = true;
  3199. }
  3200. }
  3201. });
  3202. return vjson;
  3203. }
  3204. var Scope = /** @class */ (function () {
  3205. function Scope(args) {
  3206. /**
  3207. * 业务模块的唯一编号
  3208. */
  3209. this.id = _$2.uniqueId('scope_');
  3210. this.IS_DESIGN_MODE = false;
  3211. /**
  3212. * onload 运行完成之后才会设置本标记为 true
  3213. */
  3214. this.isLoadFinish = false;
  3215. this._isLoading = false;
  3216. var model = args.model, vjson = args.vjson, i18n = args.i18n;
  3217. this.model = model;
  3218. if (typeof vjson.layout === 'undefined') {
  3219. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  3220. var ret = buildPlus({ model: model, vjson: vjson });
  3221. model = ret.model;
  3222. vjson = ret.vjson;
  3223. }
  3224. this.originalVjson = _$2.cloneDeep(vjson);
  3225. this.vjson = this.originalVjson; // this.buildVjson()
  3226. var WMSTranslate = window["WMSTranslate"];
  3227. if (WMSTranslate) {
  3228. var i18nPath_1 = this.constructor.name;
  3229. if (i18n) {
  3230. WMSTranslate[i18nPath_1] = i18n;
  3231. }
  3232. this.vjson.i18nPath = i18nPath_1;
  3233. deepTravVJson(this.vjson, function (obj) {
  3234. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
  3235. return;
  3236. }
  3237. obj.i18nPath = i18nPath_1;
  3238. });
  3239. }
  3240. var extScope = getScopeOnCreate();
  3241. if (typeof extScope === 'function') {
  3242. extScope({ vjson: vjson, model: model }, this);
  3243. }
  3244. }
  3245. Scope.prototype._addWatch = function (tplExpress, fn) {
  3246. if (!this._watchList) {
  3247. this._watchList = [];
  3248. }
  3249. this._watchList.push({ watch: tplExpress, fn: fn });
  3250. };
  3251. Scope.prototype._applyWatchList = function () {
  3252. var _this = this;
  3253. _$2.forEach(this._watchList, function (item) {
  3254. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  3255. });
  3256. };
  3257. Object.defineProperty(Scope.prototype, "isScope", {
  3258. get: function () {
  3259. return true;
  3260. },
  3261. enumerable: true,
  3262. configurable: true
  3263. });
  3264. /**
  3265. * 产生一个当前模块有效的唯一id
  3266. * @param key 唯一编号
  3267. */
  3268. Scope.prototype.uid = function (key) {
  3269. return this.id + key;
  3270. };
  3271. /**
  3272. * 对话框"保存"成功.
  3273. * 关闭对话框,并响应 success 方法
  3274. * @param data 要傳回的數據(可以為空)
  3275. */
  3276. Scope.prototype.dialogSuccess = function (data) {
  3277. this._handle.fireEvent('success', this, data);
  3278. var sender = this._handle.config.animateTarget;
  3279. var scope = lookupScope(sender);
  3280. if (typeof this['success'] === 'function') {
  3281. this['success'].call(scope, sender, data);
  3282. }
  3283. this.close();
  3284. };
  3285. /**
  3286. * 设置等待状态
  3287. * @param value
  3288. * @param msg
  3289. */
  3290. Scope.prototype.setLoading = function (value) {
  3291. var _a;
  3292. var scope = this;
  3293. this._isLoading = value;
  3294. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  3295. };
  3296. Scope.prototype.getLoading = function () {
  3297. return this._isLoading;
  3298. };
  3299. /**
  3300. * 以对话框模式打开当前模块
  3301. * @param sender 发送者(按钮或Scope对象)
  3302. * @param vjsonOption 界面覆盖选项(可以为空)
  3303. * @param dataOption 数据覆盖选项(可以为空)
  3304. */
  3305. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  3306. var _a;
  3307. var that = this;
  3308. var vmodel = _$2.defaultsDeep({
  3309. //
  3310. }, dataOption, that.model);
  3311. this.viewModel = new Ext.app.ViewModel(vmodel);
  3312. this.viewModel.yvanScope = this;
  3313. this._applyWatchList();
  3314. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3315. var config = _$2.defaultsDeep({
  3316. animateTarget: sender,
  3317. viewModel: this.viewModel,
  3318. yvanScope: this,
  3319. referenceHolder: true,
  3320. }, vjsonOption, that.vjson, windows);
  3321. if (config.height === 'unset') {
  3322. delete config.height;
  3323. }
  3324. if (config.width === 'unset') {
  3325. delete config.width;
  3326. }
  3327. // const holder = sender?.lookupReferenceHolder()
  3328. // delete config.constrain
  3329. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  3330. if (topScope) {
  3331. config.constrain = true;
  3332. this.topScope = topScope;
  3333. }
  3334. var win = new Ext.Window(config);
  3335. // if (holder) {
  3336. // holder.add(win)
  3337. // }
  3338. if (topScope) {
  3339. topScope._handle.add(win);
  3340. }
  3341. win.addListener('beforerender', function (sender) {
  3342. // 记录句柄
  3343. if (sender && !that._handle) {
  3344. that._handle = sender;
  3345. }
  3346. });
  3347. win.addListener('afterrender', function (sender) {
  3348. // 调用onLoad回调
  3349. try {
  3350. that._onLoad();
  3351. }
  3352. catch (e) {
  3353. console.error('errorAt onLoad', e);
  3354. }
  3355. window['cw'] = that;
  3356. });
  3357. win.addListener('destroy', this._destroy.bind(this));
  3358. win.show();
  3359. };
  3360. /**
  3361. * 以标签模式打开当前模块
  3362. * @param vjsonOption 界面覆盖选项(可以为空)
  3363. * @param dataOption 数据覆盖选项(可以为空)
  3364. */
  3365. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  3366. var _this = this;
  3367. var that = this;
  3368. this._vjsonOption = vjsonOption;
  3369. this._dataOption = dataOption;
  3370. var vmodel = _$2.defaultsDeep({
  3371. data: {}
  3372. }, dataOption, that.model);
  3373. this.viewModel = new Ext.app.ViewModel(vmodel);
  3374. this.viewModel.yvanScope = this;
  3375. this._applyWatchList();
  3376. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3377. // 根级不能设置id
  3378. delete that.vjson.id;
  3379. var config = _$2.defaultsDeep({
  3380. viewModel: this.viewModel,
  3381. yvanScope: this,
  3382. referenceHolder: true,
  3383. }, vjsonOption, that.vjson);
  3384. var tt = Ext.getCmp('TT');
  3385. var handle = tt.addScope(this, config, function (handle) {
  3386. handle.addListener('added', function (sender) {
  3387. // 记录句柄
  3388. if (sender && !that._handle) {
  3389. that._handle = sender;
  3390. }
  3391. });
  3392. handle.addListener('afterrender', function (sender) {
  3393. // 调用onLoad回调
  3394. try {
  3395. that._onLoad();
  3396. }
  3397. catch (e) {
  3398. console.error('errorAt onLoad', e);
  3399. }
  3400. });
  3401. handle.addListener('destroy', _this._destroy.bind(_this));
  3402. });
  3403. return handle;
  3404. };
  3405. /**
  3406. * 直接渲染到元素
  3407. * @param element 渲染目标
  3408. * @param vjsonOption 界面覆盖选项(可以为空)
  3409. * @param dataOption 数据覆盖选项(可以为空)
  3410. */
  3411. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  3412. var that = this;
  3413. this._vjsonOption = vjsonOption;
  3414. this._dataOption = dataOption;
  3415. var vmodel = _$2.defaultsDeep({
  3416. data: {}
  3417. }, that.model, dataOption);
  3418. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3419. this.viewModel = new Ext.app.ViewModel(vmodel);
  3420. this.viewModel.yvanScope = this;
  3421. this._applyWatchList();
  3422. var config = _$2.defaultsDeep({
  3423. viewModel: this.viewModel,
  3424. yvanScope: this,
  3425. referenceHolder: true,
  3426. renderTo: element,
  3427. listeners: {
  3428. afterrender: function (sender) {
  3429. var _a;
  3430. // 记录句柄
  3431. if (sender && !that._handle) {
  3432. that._handle = sender;
  3433. }
  3434. // 调用onLoad回调
  3435. that._onLoad();
  3436. // 如果vjson中配置了 afterrender ,需要恢复状态
  3437. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3438. },
  3439. },
  3440. }, vjsonOption, that.vjson);
  3441. new Ext.container.Viewport(config);
  3442. };
  3443. Scope.prototype.showDesigner = function (designer, option) {
  3444. var that = this;
  3445. var vmodel = _$2.defaultsDeep({
  3446. data: {
  3447. IS_DESIGN_MODE: true,
  3448. }
  3449. }, that.model);
  3450. this.IS_DESIGN_MODE = true;
  3451. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  3452. this.viewModel = new Ext.app.ViewModel(vmodel);
  3453. this.viewModel.yvanScope = this;
  3454. this._applyWatchList();
  3455. var config = _$2.defaultsDeep({
  3456. viewModel: this.viewModel,
  3457. yvanScope: this,
  3458. referenceHolder: true,
  3459. listeners: {
  3460. afterrender: function (sender) {
  3461. var _a;
  3462. // 记录句柄
  3463. if (sender && !that._handle) {
  3464. that._handle = sender;
  3465. }
  3466. // 调用onLoad回调
  3467. that._onLoad();
  3468. // 如果vjson中配置了 afterrender ,需要恢复状态
  3469. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3470. },
  3471. },
  3472. }, that.vjson);
  3473. designer.removeAll(true);
  3474. designer.add(config);
  3475. };
  3476. /**
  3477. * 关闭对话框(或标签页)
  3478. */
  3479. Scope.prototype.close = function () {
  3480. this._handle.close();
  3481. };
  3482. Object.defineProperty(Scope.prototype, "data", {
  3483. /**
  3484. * 获取 viewModel 里包含的数据(只读)
  3485. */
  3486. get: function () {
  3487. return this.viewModel.getData();
  3488. },
  3489. enumerable: true,
  3490. configurable: true
  3491. });
  3492. /**
  3493. * 设置 viewModel 中的数据
  3494. * 可以是 key, value 模式
  3495. * 也可以是 {key:value} 模式
  3496. */
  3497. Scope.prototype.set = function (path, value) {
  3498. return this.viewModel.set(path, value);
  3499. };
  3500. /**
  3501. * 寻找模块内所有的 xtype 对应的对象
  3502. * @param xtypeKey
  3503. */
  3504. Scope.prototype.down = function (xtypeKey) {
  3505. return this._handle.down(xtypeKey);
  3506. };
  3507. Object.defineProperty(Scope.prototype, "refs", {
  3508. /**
  3509. * 获取所有设置过 Reference 名称的组件
  3510. */
  3511. get: function () {
  3512. var _a, _b;
  3513. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  3514. },
  3515. enumerable: true,
  3516. configurable: true
  3517. });
  3518. Scope.prototype._destroy = function () {
  3519. var that = this;
  3520. that.onDestroy();
  3521. delete that._watchList;
  3522. delete that._handle;
  3523. this.isLoadFinish = false;
  3524. };
  3525. /**
  3526. * 私有渲染完成后的回调
  3527. */
  3528. Scope.prototype._onLoad = function () {
  3529. var _this = this;
  3530. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  3531. exports.scopeOnLoad(this);
  3532. }
  3533. this.onLoad();
  3534. _$2.defer(function () {
  3535. _this.isLoadFinish = true;
  3536. });
  3537. };
  3538. /**
  3539. * 默认 渲染完成之后调用的函数
  3540. */
  3541. Scope.prototype.onLoad = function () {
  3542. };
  3543. /**
  3544. * 组件卸载之后的回调
  3545. */
  3546. Scope.prototype.onDestroy = function () {
  3547. };
  3548. return Scope;
  3549. }());
  3550. /**
  3551. * 观察装饰器,viewModel 属性更改时触发成员方法
  3552. * @param tplExpress tpl表达式,例如 "{form.f1}"
  3553. */
  3554. function watch(tplExpress, deep) {
  3555. if (deep === void 0) { deep = false; }
  3556. return function (target, propertyKey, pd) {
  3557. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  3558. return target[propertyKey];
  3559. };
  3560. }
  3561. // 获取vjson的hash值
  3562. function getVjsonHash(str) {
  3563. var hash = 3465217896, i, ch;
  3564. for (i = str.length - 1; i >= 0; i--) {
  3565. ch = str.charCodeAt(i);
  3566. hash ^= ((hash << 5) + ch + (hash >> 2));
  3567. }
  3568. return (hash & 0x7FFFFFFF) + "";
  3569. }
  3570. function buildPlus(_a) {
  3571. var model = _a.model, vjson = _a.vjson;
  3572. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  3573. {
  3574. layout: 'border',
  3575. // tbar: vjson.action,
  3576. items: vjson.items,
  3577. },
  3578. ] });
  3579. if (_$2.isArray(vjson.action)) {
  3580. vjsonNew.items[0].tbar = vjson.action;
  3581. }
  3582. return { model: model, vjson: vjsonNew };
  3583. }
  3584. var model = {
  3585. data: {
  3586. leftTabTitle: ''
  3587. }
  3588. };
  3589. var vjson = {
  3590. frame: false,
  3591. layout: 'border',
  3592. width: '100%',
  3593. height: '100%',
  3594. border: false,
  3595. defaults: {
  3596. border: false
  3597. },
  3598. items: [
  3599. {
  3600. region: 'north',
  3601. height: 60,
  3602. cls: 'main-header',
  3603. reference: 'mainTop',
  3604. layout: 'hbox',
  3605. items: [
  3606. {
  3607. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  3608. flex: 1,
  3609. border: false
  3610. },
  3611. {
  3612. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  3613. menu: [
  3614. {
  3615. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  3616. reference: 'commonSetting'
  3617. },
  3618. {
  3619. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  3620. listeners: {
  3621. // click: 'scope.ready_api_click'
  3622. }
  3623. },
  3624. ]
  3625. },
  3626. {
  3627. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  3628. cls: 'header-menu',
  3629. menu: [
  3630. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  3631. ]
  3632. },
  3633. ]
  3634. },
  3635. {
  3636. region: 'west',
  3637. bind: {
  3638. title: '{leftTabTitle}',
  3639. },
  3640. titleAlign: 'center',
  3641. border: true, split: true, width: 340, collapsible: true,
  3642. reference: 'leftTab',
  3643. xtype: 'tabpanel',
  3644. tabPosition: 'left',
  3645. tabRotation: 0,
  3646. tabBar: {
  3647. border: false
  3648. },
  3649. listeners: {
  3650. tabchange: 'scope.leftTabChange',
  3651. },
  3652. items: [
  3653. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  3654. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  3655. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  3656. // {tooltip: '表单转换', iconCls: 'x-fa fa-exchange',},
  3657. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  3658. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  3659. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  3660. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  3661. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  3662. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  3663. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  3664. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  3665. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  3666. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  3667. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  3668. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  3669. ]
  3670. },
  3671. {
  3672. region: 'east',
  3673. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  3674. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  3675. },
  3676. {
  3677. region: 'center',
  3678. split: true, border: true,
  3679. xtype: 'maintab', reference: 'tt', id: 'TT',
  3680. plain: true,
  3681. listeners: {
  3682. restorypage: 'scope.openScope',
  3683. tabchange: 'scope.tabchange'
  3684. },
  3685. items: []
  3686. },
  3687. ],
  3688. };
  3689. /**
  3690. * 获取当前打开的项目资料
  3691. */
  3692. function getCurrentProject() {
  3693. // const value = sessionStorage.getItem('CurrentProject');
  3694. // if (value) {
  3695. // project = JSON.parse(value)
  3696. // if (!project.url) {
  3697. // project = undefined
  3698. // }
  3699. // }
  3700. // return project
  3701. return {
  3702. uuid: '00000000',
  3703. name: '本服项目',
  3704. url: '',
  3705. };
  3706. }
  3707. /**
  3708. * 设置当前打开的项目资料(全局)
  3709. */
  3710. function setCurrentProject(value) {
  3711. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  3712. }
  3713. // ------------------------------------------------------------------------------------------ types
  3714. /** 订阅消息key类型 */
  3715. var EventType;
  3716. (function (EventType) {
  3717. /** FileTree打开Module */
  3718. EventType["ModuleOpen"] = "ModuleOpen";
  3719. /** ModulePage 创建 */
  3720. EventType["ModulePageCreate"] = "ModulePageCreate";
  3721. /** ModuleItem内容变化 */
  3722. EventType["ModuleItemChange"] = "ModuleItemChange";
  3723. /** ModuleItem的 jsView 内容变化 */
  3724. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3725. /** 设置 vjson */
  3726. EventType["SetVjson"] = "SetVjson";
  3727. /** 更新 vjson */
  3728. EventType["UpdateVjson"] = "UpdateVjson";
  3729. /** 更新 组件vjson */
  3730. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3731. /** Component 选中内容变化 */
  3732. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3733. /** Component 选中内容变化 */
  3734. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3735. /** Component 删除事件 */
  3736. EventType["ComponentDelete"] = "ComponentDelete";
  3737. /** MainTab 选中改变事件 */
  3738. EventType["MainTabChange"] = "MainTabChange";
  3739. /** ModuleTab 选中改变事件 */
  3740. EventType["ModuleTabChange"] = "ModuleTabChange";
  3741. /** 保存事件 */
  3742. EventType["SaveCall"] = "SaveCall";
  3743. /** 撤销 */
  3744. EventType["Undo"] = "Undo";
  3745. /** 还原 */
  3746. EventType["Redo"] = "Redo";
  3747. /** 剪切 */
  3748. EventType["Cut"] = "Cut";
  3749. /** 复制 */
  3750. EventType["Copy"] = "Copy";
  3751. /** 粘贴 */
  3752. EventType["Paste"] = "Paste";
  3753. /** 全选 */
  3754. EventType["SelectAll"] = "SelectAll";
  3755. /** 读取剪切板 */
  3756. EventType["ClipboardRead"] = "ClipboardRead";
  3757. /** 检查模块更新 */
  3758. EventType["RunCheckModule"] = "RunCheckModule";
  3759. /** 停止检查模块更新 */
  3760. EventType["StopCheckModule"] = "StopCheckModule";
  3761. })(EventType || (EventType = {}));
  3762. // ------------------------------------------------------------------------------------------ impls
  3763. var EventBus = /** @class */ (function () {
  3764. function EventBus() {
  3765. /** 事件数据 */
  3766. this.store = {};
  3767. /** 事件订阅者注册表 */
  3768. this.observeStoreTable = {};
  3769. this.init();
  3770. }
  3771. EventBus.prototype.init = function () {
  3772. var _this = this;
  3773. // 更改store值就会自动publish消息 - 实现
  3774. this.store = new Proxy({}, {
  3775. get: function (target, key) {
  3776. return target[key];
  3777. },
  3778. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3779. set: function (target, key, data) {
  3780. if (noValue(key))
  3781. return false;
  3782. target[key] = data;
  3783. // 消息通知订阅者
  3784. var observerArr = _this.observeStoreTable[key];
  3785. if (noValue(observerArr) || observerArr.length <= 0)
  3786. return true;
  3787. observerArr.forEach(function (handler) {
  3788. //try {
  3789. handler(data, key);
  3790. // } catch (err) {
  3791. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3792. // }
  3793. });
  3794. return true;
  3795. },
  3796. });
  3797. };
  3798. /** 取消注册订阅者 */
  3799. EventBus.prototype.unregisterObserver = function (key, handler) {
  3800. var _this = this;
  3801. var observerArr = this.observeStoreTable[key];
  3802. if (noValue(observerArr) || observerArr.length <= 0)
  3803. return;
  3804. if (noValue(handler)) {
  3805. this.observeStoreTable[key] = [];
  3806. }
  3807. else {
  3808. observerArr.forEach(function (obsHandler, index) {
  3809. if (obsHandler !== handler)
  3810. return;
  3811. _this.observeStoreTable[key].splice(index, 1);
  3812. });
  3813. }
  3814. };
  3815. /** 注册订阅者 */
  3816. EventBus.prototype.registerObserver = function (key, handler) {
  3817. var observerArr = this.observeStoreTable[key];
  3818. if (noValue(observerArr) || observerArr.length <= 0) {
  3819. observerArr = [];
  3820. this.observeStoreTable[key] = observerArr;
  3821. }
  3822. observerArr.push(handler);
  3823. // if (noValue(key)) return;
  3824. // const sourceValue = this.store[key];
  3825. // if (noValue(sourceValue)) return;
  3826. // handler(sourceValue, key);
  3827. };
  3828. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3829. EventBus.prototype.getStore = function () {
  3830. return this.store;
  3831. };
  3832. /**
  3833. * 取消订阅
  3834. * @param key 订阅的消息key
  3835. * @param handler 指定取消的监听函数
  3836. */
  3837. EventBus.prototype.unsubscribe = function (key, handler) {
  3838. var _this = this;
  3839. if (key instanceof Array) {
  3840. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3841. }
  3842. else {
  3843. this.unregisterObserver(key, handler);
  3844. }
  3845. };
  3846. /**
  3847. * 消息订阅
  3848. * @param key 订阅的消息key
  3849. * @param handler 监听函数
  3850. */
  3851. EventBus.prototype.subscribe = function (key, handler) {
  3852. var _this = this;
  3853. var cancelSubscribe = {
  3854. key: key,
  3855. cancel: function () {
  3856. },
  3857. };
  3858. if (key instanceof Array) {
  3859. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3860. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3861. }
  3862. else {
  3863. this.registerObserver(key, handler);
  3864. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3865. }
  3866. return cancelSubscribe;
  3867. };
  3868. /**
  3869. * 消息订阅(只订阅一次)
  3870. * @param key 订阅的消息key
  3871. * @param handler 监听函数
  3872. */
  3873. EventBus.prototype.subscribeOnce = function (key, handler) {
  3874. var cancelSubscribe = this.subscribe(key, function (data) {
  3875. // try {
  3876. handler(data, key);
  3877. // } catch (err) {
  3878. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3879. // }
  3880. cancelSubscribe.cancel();
  3881. });
  3882. };
  3883. /**
  3884. * 发送消息(触发订阅监听函数)
  3885. * @param key 消息key
  3886. * @param eventData 消息值
  3887. */
  3888. EventBus.prototype.publish = function (key, eventData) {
  3889. var _this = this;
  3890. if (key instanceof Array) {
  3891. key.forEach(function (k) { return _this.store[k] = eventData; });
  3892. }
  3893. else {
  3894. this.store[key] = eventData;
  3895. }
  3896. };
  3897. return EventBus;
  3898. }());
  3899. // ------------------------------------------------------------------------------------------ use
  3900. var eventBus = new EventBus();
  3901. var model$1 = {
  3902. data: {
  3903. dataSync_isStart: false,
  3904. dataSync: {
  3905. skipError: false,
  3906. clearData: false,
  3907. tables: []
  3908. },
  3909. dataSyncResult: {
  3910. jobId: ''
  3911. },
  3912. dataSource1: '',
  3913. dataSource2: '',
  3914. schema1: '',
  3915. schema2: '',
  3916. hasDiff: false,
  3917. }
  3918. };
  3919. var vjson$1 = {
  3920. title: '数据库同步',
  3921. layout: 'fit',
  3922. items: [
  3923. {
  3924. reference: 'wizard1',
  3925. layout: 'card',
  3926. items: [
  3927. {
  3928. reference: 'first',
  3929. layout: 'fit',
  3930. bbar: [
  3931. '->',
  3932. {
  3933. xtype: 'button',
  3934. iconCls: 'x-fa fa-road',
  3935. text: '结构同步 &raquo;',
  3936. bind: {
  3937. disabled: '{!hasDiff}'
  3938. },
  3939. listeners: {
  3940. click: 'scope.structCopyTo',
  3941. }
  3942. },
  3943. {
  3944. xtype: 'button',
  3945. iconCls: 'x-fa fa-files-o',
  3946. text: '数据同步 &raquo;',
  3947. bind: {
  3948. disabled: '{!hasDiff}'
  3949. },
  3950. listeners: {
  3951. click: 'scope.dataCopyTo',
  3952. }
  3953. },
  3954. {
  3955. xtype: 'button',
  3956. iconCls: 'x-fa fa-sort-alpha-desc',
  3957. text: '索引同步 &raquo;',
  3958. bind: {
  3959. disabled: '{!hasDiff}'
  3960. },
  3961. listeners: {
  3962. click: 'scope.indexCopyTo',
  3963. }
  3964. },
  3965. {
  3966. xtype: 'button',
  3967. iconCls: 'x-fa fa-product-hunt',
  3968. text: '存储过程同步 &raquo;',
  3969. bind: {
  3970. disabled: '{!hasDiff}'
  3971. },
  3972. listeners: {
  3973. click: 'scope.procedureCopyTo',
  3974. }
  3975. },
  3976. ],
  3977. items: [
  3978. {
  3979. title: '数据库对比',
  3980. reference: 'grid1',
  3981. xtype: 'yvgrid',
  3982. pagination: false,
  3983. border: false,
  3984. cellTip: true,
  3985. selModel: {
  3986. type: 'checkboxmodel',
  3987. mode: 'MULTI',
  3988. },
  3989. tbar: {
  3990. xtype: 'toolbar',
  3991. items: [
  3992. {
  3993. xtype: 'combo',
  3994. fieldLabel: '源数据库',
  3995. bind: {
  3996. value: '{dataSource1}'
  3997. },
  3998. dataSource: 'scope.getDataBaseName'
  3999. },
  4000. {
  4001. xtype: 'combo',
  4002. fieldLabel: '目标数据库',
  4003. bind: {
  4004. value: '{dataSource2}'
  4005. },
  4006. dataSource: 'scope.getDataBaseName'
  4007. },
  4008. {
  4009. xtype: 'button',
  4010. iconCls: 'x-fa fa-flash',
  4011. text: '对比',
  4012. bind: {
  4013. disabled: '{!dataSource1 || !dataSource2}'
  4014. },
  4015. listeners: {
  4016. click: 'scope.diff',
  4017. }
  4018. },
  4019. {
  4020. xtype: 'button',
  4021. iconCls: 'x-fa fa-cloud-download',
  4022. text: '重新拉取结构(耗时!)',
  4023. bind: {
  4024. disabled: '{!dataSource1 || !dataSource2}'
  4025. },
  4026. listeners: {
  4027. click: 'scope.dbToMeta',
  4028. }
  4029. },
  4030. ]
  4031. },
  4032. columns: [
  4033. {
  4034. dataIndex: 'table_name1',
  4035. header: '源表',
  4036. width: 300,
  4037. },
  4038. {
  4039. dataIndex: 'table_name2',
  4040. header: '目标表',
  4041. width: 300,
  4042. },
  4043. {
  4044. dataIndex: 'diff',
  4045. header: '对比结果',
  4046. width: 100,
  4047. },
  4048. {
  4049. xtype: 'actioncolumn',
  4050. width: 30,
  4051. sortable: false,
  4052. menuDisabled: true,
  4053. items: [
  4054. {
  4055. iconCls: 'x-fa fa-bars',
  4056. text: '打开',
  4057. handler: 'scope.showDetail',
  4058. }
  4059. ]
  4060. },
  4061. {
  4062. dataIndex: 'remark',
  4063. header: '详情',
  4064. width: 200,
  4065. sortable: true,
  4066. },
  4067. ],
  4068. },
  4069. ]
  4070. },
  4071. {
  4072. reference: 'ddl',
  4073. layout: {
  4074. type: 'vbox',
  4075. pack: 'start',
  4076. align: 'stretch'
  4077. },
  4078. items: [
  4079. {
  4080. xtype: 'sqleditor',
  4081. reference: 'ddleditor',
  4082. flex: 1,
  4083. },
  4084. {
  4085. xtype: 'toolbar',
  4086. items: [
  4087. '->',
  4088. {
  4089. xtype: 'button',
  4090. text: '&laquo; 上一步',
  4091. listeners: {
  4092. click: 'scope.back'
  4093. }
  4094. },
  4095. {
  4096. xtype: 'button',
  4097. iconCls: 'x-fa fa-flash',
  4098. text: '执行',
  4099. listeners: {
  4100. click: 'scope.executeDDL'
  4101. }
  4102. },
  4103. ]
  4104. }
  4105. ]
  4106. },
  4107. {
  4108. reference: 'ddl_idx',
  4109. layout: {
  4110. type: 'vbox',
  4111. pack: 'start',
  4112. align: 'stretch'
  4113. },
  4114. items: [
  4115. {
  4116. xtype: 'sqleditor',
  4117. reference: 'ddleditor_idx',
  4118. flex: 1,
  4119. },
  4120. {
  4121. xtype: 'toolbar',
  4122. items: [
  4123. '->',
  4124. {
  4125. xtype: 'button',
  4126. text: '&laquo; 上一步',
  4127. listeners: {
  4128. click: 'scope.back'
  4129. }
  4130. },
  4131. {
  4132. xtype: 'button',
  4133. iconCls: 'x-fa fa-flash',
  4134. text: '执行',
  4135. listeners: {
  4136. click: 'scope.executeDDLIdx'
  4137. }
  4138. },
  4139. ]
  4140. }
  4141. ]
  4142. },
  4143. {
  4144. reference: 'ddl_procedure',
  4145. layout: {
  4146. type: 'vbox',
  4147. pack: 'start',
  4148. align: 'stretch'
  4149. },
  4150. items: [
  4151. {
  4152. xtype: 'sqleditor',
  4153. reference: 'ddleditor_procedure',
  4154. flex: 1,
  4155. },
  4156. {
  4157. xtype: 'toolbar',
  4158. items: [
  4159. '->',
  4160. {
  4161. xtype: 'button',
  4162. text: '&laquo; 上一步',
  4163. listeners: {
  4164. click: 'scope.back'
  4165. }
  4166. },
  4167. {
  4168. xtype: 'button',
  4169. iconCls: 'x-fa fa-flash',
  4170. text: '执行',
  4171. listeners: {
  4172. click: 'scope.executeProcedureSQL'
  4173. }
  4174. },
  4175. ]
  4176. }
  4177. ]
  4178. },
  4179. {
  4180. reference: 'datacopy',
  4181. xtype: 'yvgrid',
  4182. pagination: false,
  4183. tbar: {
  4184. xtype: 'toolbar',
  4185. items: [
  4186. {
  4187. xtype: 'checkbox',
  4188. fieldLabel: '忽略错误',
  4189. bind: {
  4190. value: '{dataSync.skipError}'
  4191. },
  4192. },
  4193. {
  4194. xtype: 'checkbox',
  4195. fieldLabel: '清空数据',
  4196. bind: {
  4197. value: '{dataSync.clearData}'
  4198. },
  4199. },
  4200. {
  4201. xtype: 'button',
  4202. iconCls: 'x-fa fa-play-circle',
  4203. text: '开始',
  4204. bind: {
  4205. disabled: '{dataSync_isStart}'
  4206. },
  4207. listeners: { click: 'scope.dataSync_start' }
  4208. },
  4209. {
  4210. xtype: 'button',
  4211. iconCls: 'x-fa fa-stop-circle',
  4212. text: '停止',
  4213. bind: {
  4214. disabled: '{!dataSync_isStart}'
  4215. },
  4216. listeners: { click: 'scope.dataSync_stop' }
  4217. },
  4218. ]
  4219. },
  4220. columns: [
  4221. {
  4222. dataIndex: 'tableName', header: '表名',
  4223. width: 300,
  4224. },
  4225. {
  4226. dataIndex: 'dataCount', header: '总记录数',
  4227. width: 150,
  4228. },
  4229. {
  4230. dataIndex: 'currentIdx', header: '当前记录数',
  4231. width: 150,
  4232. },
  4233. {
  4234. dataIndex: 'syncCount', header: '同步数',
  4235. width: 150,
  4236. },
  4237. {
  4238. dataIndex: 'deleteCount', header: '删除',
  4239. width: 150,
  4240. },
  4241. {
  4242. dataIndex: 'syncProgress', header: '进度',
  4243. width: 150, dataType: 'int', formatter: 'percentRenderer'
  4244. },
  4245. ]
  4246. }
  4247. ]
  4248. }
  4249. ]
  4250. };
  4251. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  4252. function createEmptyModule(path, filename) {
  4253. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  4254. }
  4255. function createFolder(parentPath, filename) {
  4256. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  4257. }
  4258. function getModuleFileContent(module) {
  4259. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  4260. }
  4261. function saveFile(fileFullPath, fileContent) {
  4262. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4263. // @ts-ignore
  4264. system.msg("保存成功");
  4265. return res;
  4266. });
  4267. }
  4268. function getQueryDslInfo(tableName) {
  4269. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  4270. args: [
  4271. { tableName: tableName }
  4272. ]
  4273. }).catch(function (e) {
  4274. var _a, _b;
  4275. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  4276. showErrorDialog(msg);
  4277. console.error(msg, e);
  4278. });
  4279. }
  4280. function invokeServer(url, param) {
  4281. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  4282. return request.post(url, {
  4283. args: [
  4284. param
  4285. ]
  4286. }).catch(function (e) {
  4287. var _a, _b;
  4288. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  4289. showErrorDialog(msg);
  4290. console.error(msg, e);
  4291. });
  4292. }
  4293. function parseSqlApi(sql) {
  4294. return request.post(getBaseUrl() + "@parseSqlApi", {
  4295. args: [sql]
  4296. }).catch(function (e) {
  4297. var _a, _b;
  4298. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  4299. showErrorDialog(msg);
  4300. console.error(msg, e);
  4301. });
  4302. }
  4303. function saveModuleFiles(param) {
  4304. return request.post(getBaseUrl() + "@saveModuleFiles", {
  4305. args: [
  4306. param
  4307. ]
  4308. }).catch(function (e) {
  4309. var _a, _b;
  4310. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  4311. showErrorDialog(msg);
  4312. console.error(msg, e);
  4313. });
  4314. }
  4315. function createQueryDSLFile(_a) {
  4316. var schema_name = _a.schema_name, table_name = _a.table_name;
  4317. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  4318. args: [{ schema_name: schema_name, table_name: table_name }]
  4319. }).catch(function (e) {
  4320. var _a, _b;
  4321. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  4322. showErrorDialog(msg);
  4323. console.error(msg, e);
  4324. });
  4325. }
  4326. function dbToMeta(param) {
  4327. if (typeof param === 'undefined') {
  4328. param = { datasource: 'master' };
  4329. }
  4330. else if (typeof param.datasource === 'undefined') {
  4331. param.datasource = 'master';
  4332. }
  4333. return request.post(getBaseUrl() + "@dbToMeta", {
  4334. args: [
  4335. param
  4336. ]
  4337. }).catch(function (e) {
  4338. var _a, _b;
  4339. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  4340. showErrorDialog(msg);
  4341. console.error(msg, e);
  4342. });
  4343. }
  4344. function getColumnDomainApi(param) {
  4345. if (typeof param === 'undefined') {
  4346. param = { datasource: 'master' };
  4347. }
  4348. else if (typeof param.datasource === 'undefined') {
  4349. param.datasource = 'master';
  4350. }
  4351. return request.post(getBaseUrl() + "@getColumnDomain", {
  4352. args: [
  4353. param
  4354. ]
  4355. }).catch(function (e) {
  4356. var _a, _b;
  4357. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  4358. showErrorDialog(msg);
  4359. console.error(msg, e);
  4360. });
  4361. }
  4362. function getMateData(param) {
  4363. if (typeof param === 'undefined') {
  4364. param = { datasource: 'master' };
  4365. }
  4366. else if (typeof param.datasource === 'undefined') {
  4367. param.datasource = 'master';
  4368. }
  4369. return request.post(getBaseUrl() + "@getMateData", {
  4370. args: [
  4371. param
  4372. ]
  4373. }).catch(function (e) {
  4374. var _a, _b;
  4375. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  4376. showErrorDialog(msg);
  4377. console.error(msg, e);
  4378. });
  4379. }
  4380. function getMateDataByTableName(param) {
  4381. if (typeof param === 'undefined') {
  4382. param = { datasource: 'master' };
  4383. }
  4384. else if (typeof param.datasource === 'undefined') {
  4385. param.datasource = 'master';
  4386. }
  4387. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  4388. args: [
  4389. param
  4390. ]
  4391. }).catch(function (e) {
  4392. var _a, _b;
  4393. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  4394. showErrorDialog(msg);
  4395. console.error(msg, e);
  4396. });
  4397. }
  4398. function saveMetaTableChanges(param) {
  4399. if (typeof param === 'undefined') {
  4400. param = { datasource: 'master' };
  4401. }
  4402. else if (typeof param.datasource === 'undefined') {
  4403. param.datasource = 'master';
  4404. }
  4405. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  4406. args: [
  4407. param
  4408. ]
  4409. }).catch(function (e) {
  4410. var _a, _b;
  4411. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  4412. showErrorDialog(msg);
  4413. console.error(msg, e);
  4414. });
  4415. }
  4416. function getModifyTableDDL(param) {
  4417. if (typeof param === 'undefined') {
  4418. param = { datasource: 'master' };
  4419. }
  4420. else if (typeof param.datasource === 'undefined') {
  4421. param.datasource = 'master';
  4422. }
  4423. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  4424. args: [
  4425. param
  4426. ]
  4427. }).catch(function (e) {
  4428. var _a, _b;
  4429. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  4430. showErrorDialog(msg);
  4431. console.error(msg, e);
  4432. });
  4433. }
  4434. function pushToDbCommitApi(param) {
  4435. if (typeof param === 'undefined') {
  4436. param = { datasource: 'master' };
  4437. }
  4438. else if (typeof param.datasource === 'undefined') {
  4439. param.datasource = 'master';
  4440. }
  4441. return request.post(getBaseUrl() + "@pushToDbCommit", {
  4442. args: [
  4443. param
  4444. ]
  4445. }).catch(function (e) {
  4446. var _a, _b;
  4447. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  4448. showErrorDialog(msg);
  4449. console.error(msg, e);
  4450. });
  4451. }
  4452. /**
  4453. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  4454. */
  4455. function saveMetaExBuildDDL(param) {
  4456. if (typeof param === 'undefined') {
  4457. param = { datasource: 'master' };
  4458. }
  4459. else if (typeof param.datasource === 'undefined') {
  4460. param.datasource = 'master';
  4461. }
  4462. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  4463. args: [
  4464. param
  4465. ]
  4466. }).catch(function (e) {
  4467. var _a, _b;
  4468. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  4469. showErrorDialog(msg);
  4470. console.error(msg, e);
  4471. });
  4472. }
  4473. function registerResource(params) {
  4474. return request.post(getBaseUrl() + "@registerResource", {
  4475. args: [params]
  4476. }).catch(function (e) {
  4477. var _a, _b;
  4478. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  4479. showErrorDialog(msg);
  4480. console.error(msg, e);
  4481. });
  4482. }
  4483. function getMenuTree(params) {
  4484. return request.post(getBaseUrl() + "@getMenuTree", {
  4485. args: [params]
  4486. }).catch(function (e) {
  4487. var _a, _b;
  4488. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4489. showErrorDialog(msg);
  4490. console.error(msg, e);
  4491. });
  4492. }
  4493. function moduleTree() {
  4494. return request.post(getBaseUrl() + "@moduleTree")
  4495. .catch(function (e) {
  4496. var _a, _b;
  4497. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4498. showErrorDialog(msg);
  4499. console.error(msg, e);
  4500. });
  4501. }
  4502. function dropTableDDL(schemaName, tableName) {
  4503. return request.post(getBaseUrl() + "@dropTableDDL", {
  4504. args: [
  4505. { schemaName: schemaName, tableName: tableName },
  4506. ]
  4507. }).catch(function (e) {
  4508. var _a, _b;
  4509. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  4510. showErrorDialog(msg);
  4511. console.error(msg, e);
  4512. });
  4513. }
  4514. function renameTableDDL(schemaName, tableName, reTableName) {
  4515. return request.post(getBaseUrl() + "@renameTableDDL", {
  4516. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  4517. }).catch(function (e) {
  4518. var _a, _b;
  4519. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  4520. showErrorDialog(msg);
  4521. console.error(msg, e);
  4522. });
  4523. }
  4524. function executeModifyProcedureSQL(param) {
  4525. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  4526. args: [
  4527. param,
  4528. ]
  4529. }).catch(function (e) {
  4530. var _a, _b;
  4531. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4532. showErrorDialog(msg);
  4533. console.error(msg, e);
  4534. });
  4535. }
  4536. function parseDynamicSqlApi(sql, dataSource) {
  4537. return request.post(getBaseUrl() + "@parseDynamicSql", {
  4538. args: [
  4539. { sql: sql, dataSource: dataSource },
  4540. ]
  4541. }).catch(function (e) {
  4542. var _a, _b;
  4543. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  4544. showErrorDialog(msg);
  4545. console.error(msg, e);
  4546. });
  4547. }
  4548. function exporerList() {
  4549. return request.post(getBaseUrl() + "@exporerList", {
  4550. args: [{}]
  4551. }).catch(function (e) {
  4552. var _a, _b;
  4553. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4554. showErrorDialog(msg);
  4555. console.error(msg, e);
  4556. });
  4557. }
  4558. function reportListApi() {
  4559. return request.post(getBaseUrl() + "@reportList", {
  4560. args: []
  4561. }).catch(function (e) {
  4562. var _a, _b;
  4563. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  4564. showErrorDialog(msg);
  4565. console.error(msg, e);
  4566. });
  4567. }
  4568. function reportByIdApi(reportId) {
  4569. return request.post(getBaseUrl() + "@reportById", {
  4570. args: [
  4571. { reportId: reportId },
  4572. ]
  4573. }).catch(function (e) {
  4574. var _a, _b;
  4575. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  4576. showErrorDialog(msg);
  4577. console.error(msg, e);
  4578. });
  4579. }
  4580. function createReportApi(reportName) {
  4581. return request.post(getBaseUrl() + "@createReport", {
  4582. args: [
  4583. { reportName: reportName },
  4584. ]
  4585. }).catch(function (e) {
  4586. var _a, _b;
  4587. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  4588. showErrorDialog(msg);
  4589. console.error(msg, e);
  4590. });
  4591. }
  4592. function saveReportApi(param) {
  4593. return request.post(getBaseUrl() + "@saveReport", {
  4594. args: [
  4595. param,
  4596. ]
  4597. }).catch(function (e) {
  4598. var _a, _b;
  4599. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  4600. showErrorDialog(msg);
  4601. console.error(msg, e);
  4602. });
  4603. }
  4604. function delReportApi(report_id) {
  4605. return request.post(getBaseUrl() + "@delReport", {
  4606. args: [{ report_id: report_id },]
  4607. }).catch(function (e) {
  4608. var _a, _b;
  4609. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  4610. showErrorDialog(msg);
  4611. console.error(msg, e);
  4612. });
  4613. }
  4614. function getDict(param) {
  4615. if (typeof param === 'undefined') {
  4616. param = { datasource: 'master' };
  4617. }
  4618. else if (typeof param.datasource === 'undefined') {
  4619. param.datasource = 'master';
  4620. }
  4621. return request.post(getBaseUrl() + "@getDict", {
  4622. args: [
  4623. param
  4624. ]
  4625. });
  4626. }
  4627. function saveDictApi(param) {
  4628. if (typeof param === 'undefined') {
  4629. param = { datasource: 'master' };
  4630. }
  4631. else if (typeof param.datasource === 'undefined') {
  4632. param.datasource = 'master';
  4633. }
  4634. return request.post(getBaseUrl() + "@saveDict", {
  4635. args: [
  4636. param
  4637. ]
  4638. }).catch(function (e) {
  4639. var _a, _b;
  4640. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  4641. showErrorDialog(msg);
  4642. console.error(msg, e);
  4643. });
  4644. }
  4645. function saveDictItemsApi(param) {
  4646. if (typeof param === 'undefined') {
  4647. param = { datasource: 'master' };
  4648. }
  4649. else if (typeof param.datasource === 'undefined') {
  4650. param.datasource = 'master';
  4651. }
  4652. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  4653. args: [
  4654. param
  4655. ]
  4656. }).catch(function (e) {
  4657. var _a, _b;
  4658. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  4659. showErrorDialog(msg);
  4660. console.error(msg, e);
  4661. });
  4662. }
  4663. function createDictEnum(param) {
  4664. return request.post(getBaseUrl() + "@createDictEnum", {
  4665. args: [
  4666. param
  4667. ]
  4668. }).catch(function (e) {
  4669. var _a, _b;
  4670. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  4671. showErrorDialog(msg);
  4672. console.error(msg, e);
  4673. });
  4674. }
  4675. function loadSqlContentApi(url) {
  4676. return request.post(getBaseUrl() + "@loadSqlContent", {
  4677. args: [
  4678. {
  4679. url: GLOBAL_NAMESPACE_PREFIX + url,
  4680. }
  4681. ]
  4682. }).catch(function (e) {
  4683. var _a, _b;
  4684. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  4685. showErrorDialog(msg);
  4686. console.error(msg, e);
  4687. });
  4688. }
  4689. function saveSqlContentApi(url, content) {
  4690. return request.post(getBaseUrl() + "@saveSqlContent", {
  4691. args: [
  4692. {
  4693. url: GLOBAL_NAMESPACE_PREFIX + url,
  4694. content: content,
  4695. }
  4696. ]
  4697. }).catch(function (e) {
  4698. var _a, _b;
  4699. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  4700. showErrorDialog(msg);
  4701. console.error(msg, e);
  4702. });
  4703. }
  4704. function readBpmn(param) {
  4705. return request.post(getBaseUrl() + "@readBpmn", {
  4706. args: [param]
  4707. }).catch(function (e) {
  4708. var _a, _b;
  4709. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4710. showErrorDialog(msg);
  4711. console.error(msg, e);
  4712. });
  4713. }
  4714. function createBpmn(path, filename) {
  4715. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4716. var _a, _b;
  4717. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  4718. showErrorDialog(msg);
  4719. console.error(msg, e);
  4720. });
  4721. }
  4722. function saveBpmn(fileFullPath, fileContent) {
  4723. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4724. // @ts-ignore
  4725. system.msg("保存成功");
  4726. return res;
  4727. });
  4728. }
  4729. function deleteBpmn(path, filename) {
  4730. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4731. var _a, _b;
  4732. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  4733. showErrorDialog(msg);
  4734. console.error(msg, e);
  4735. });
  4736. }
  4737. function createDevForm(param) {
  4738. return request.post(getBaseUrl() + "@createDevForm", {
  4739. args: [param]
  4740. }).catch(function (e) {
  4741. var _a, _b;
  4742. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4743. showErrorDialog(msg);
  4744. console.error(msg, e);
  4745. });
  4746. }
  4747. function readDevForm(param) {
  4748. return request.post(getBaseUrl() + "@readDevForm", {
  4749. args: [param]
  4750. }).catch(function (e) {
  4751. var _a, _b;
  4752. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4753. showErrorDialog(msg);
  4754. console.error(msg, e);
  4755. });
  4756. }
  4757. function calcColumnForm(param) {
  4758. return request.post(getBaseUrl() + "@calcColumnForm", {
  4759. args: [param]
  4760. }).catch(function (e) {
  4761. var _a, _b;
  4762. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  4763. showErrorDialog(msg);
  4764. console.error(msg, e);
  4765. });
  4766. }
  4767. function widgetListApi(param) {
  4768. return request.post(getBaseUrl() + "@widgetListApi", {
  4769. args: [param]
  4770. }).catch(function (e) {
  4771. var _a, _b;
  4772. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  4773. showErrorDialog(msg);
  4774. console.error(msg, e);
  4775. });
  4776. }
  4777. function readWidget(param) {
  4778. return request.post(getBaseUrl() + "@readWidget", {
  4779. args: [param]
  4780. }).catch(function (e) {
  4781. var _a, _b;
  4782. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4783. showErrorDialog(msg);
  4784. console.error(msg, e);
  4785. });
  4786. }
  4787. function saveWidget(param) {
  4788. return request.post(getBaseUrl() + "@saveWidget", {
  4789. args: [param]
  4790. }).catch(function (e) {
  4791. var _a, _b;
  4792. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  4793. showErrorDialog(msg);
  4794. console.error(msg, e);
  4795. });
  4796. }
  4797. function deleteWidget(param) {
  4798. return request.post(getBaseUrl() + "@deleteWidget", {
  4799. args: [param]
  4800. }).catch(function (e) {
  4801. var _a, _b;
  4802. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  4803. showErrorDialog(msg);
  4804. console.error(msg, e);
  4805. });
  4806. }
  4807. function getDataBaseNameApi() {
  4808. return request.post(getBaseUrl() + "@getDataBaseName", {
  4809. args: []
  4810. }).catch(function (e) {
  4811. var _a, _b;
  4812. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4813. showErrorDialog(msg);
  4814. console.error(msg, e);
  4815. });
  4816. }
  4817. function getDiffDDLApi(param) {
  4818. return request.post(getBaseUrl() + "@getDiffDDL", {
  4819. args: [
  4820. param
  4821. ]
  4822. }).catch(function (e) {
  4823. var _a, _b;
  4824. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  4825. showErrorDialog(msg);
  4826. console.error(msg, e);
  4827. });
  4828. }
  4829. function dataSyncApi(param) {
  4830. return request.post(getBaseUrl() + "@dataSync", {
  4831. args: [
  4832. param
  4833. ]
  4834. }).catch(function (e) {
  4835. var _a, _b;
  4836. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  4837. showErrorDialog(msg);
  4838. console.error(msg, e);
  4839. });
  4840. }
  4841. function dataSyncInfoApi(param) {
  4842. return request.post(getBaseUrl() + "@dataSyncInfo", {
  4843. args: [
  4844. param
  4845. ]
  4846. }).catch(function (e) {
  4847. var _a, _b;
  4848. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  4849. showErrorDialog(msg);
  4850. console.error(msg, e);
  4851. });
  4852. }
  4853. function saveColumnDomain(param) {
  4854. if (typeof param === 'undefined') {
  4855. param = { datasource: 'master' };
  4856. }
  4857. else if (typeof param.datasource === 'undefined') {
  4858. param.datasource = 'master';
  4859. }
  4860. return request.post(getBaseUrl() + "@saveColumnDomain", {
  4861. args: [
  4862. param
  4863. ]
  4864. }).catch(function (e) {
  4865. var _a, _b;
  4866. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  4867. showErrorDialog('发生错误:' + msg);
  4868. console.error(msg, e);
  4869. });
  4870. }
  4871. function devOpsList() {
  4872. return request.post(getBaseUrl() + "@devOpsList", {
  4873. args: [{}]
  4874. }).catch(function (e) {
  4875. var _a, _b;
  4876. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  4877. showErrorDialog('发生错误:' + msg);
  4878. console.error(msg, e);
  4879. });
  4880. }
  4881. function devOpsById(opsId) {
  4882. return request.post(getBaseUrl() + "@devOpsById", {
  4883. args: [{ opsId: opsId }]
  4884. }).catch(function (e) {
  4885. var _a, _b;
  4886. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  4887. showErrorDialog('发生错误:' + msg);
  4888. console.error(msg, e);
  4889. });
  4890. }
  4891. function metricsRequestApi() {
  4892. return request.get("/api/metrics/request")
  4893. .catch(function (e) {
  4894. var _a, _b;
  4895. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  4896. showErrorDialog('发生错误:' + msg);
  4897. console.error(msg, e);
  4898. });
  4899. }
  4900. function metricsJdbcApi() {
  4901. return request.get("/api/metrics/jdbc")
  4902. .catch(function (e) {
  4903. var _a, _b;
  4904. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  4905. showErrorDialog('发生错误:' + msg);
  4906. console.error(msg, e);
  4907. });
  4908. }
  4909. function executeDDL(param) {
  4910. return request.post(getBaseUrl() + "@executeDDL", {
  4911. args: [
  4912. param,
  4913. ]
  4914. }).catch(function (e) {
  4915. var _a, _b;
  4916. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  4917. showErrorDialog('发生错误:' + msg);
  4918. console.error(msg, e);
  4919. });
  4920. }
  4921. function getModifyIdxDDL(param) {
  4922. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  4923. args: [
  4924. param,
  4925. ]
  4926. }).catch(function (e) {
  4927. var _a, _b;
  4928. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  4929. showErrorDialog('发生错误:' + msg);
  4930. console.error(msg, e);
  4931. });
  4932. }
  4933. function getModifyProcedureSQL(param) {
  4934. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  4935. args: [
  4936. param,
  4937. ]
  4938. }).catch(function (e) {
  4939. var _a, _b;
  4940. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4941. showErrorDialog('发生错误:' + msg);
  4942. console.error(msg, e);
  4943. });
  4944. }
  4945. function saveWhLayout(param) {
  4946. return request.post(getLayoutUrl() + "@saveWhLayout", {
  4947. args: [
  4948. param,
  4949. ]
  4950. }).catch(function (e) {
  4951. var _a, _b;
  4952. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  4953. showErrorDialog('发生错误:' + msg);
  4954. console.error(msg, e);
  4955. });
  4956. }
  4957. function deleteWhLayout(param) {
  4958. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  4959. args: [
  4960. param,
  4961. ]
  4962. }).catch(function (e) {
  4963. var _a, _b;
  4964. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  4965. showErrorDialog('发生错误:' + msg);
  4966. console.error(msg, e);
  4967. });
  4968. }
  4969. function loadWhLayoutAll() {
  4970. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  4971. args: []
  4972. }).catch(function (e) {
  4973. var _a, _b;
  4974. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  4975. showErrorDialog('发生错误:' + msg);
  4976. console.error(msg, e);
  4977. });
  4978. }
  4979. function loadWhLayout(param) {
  4980. return request.post(getLayoutUrl() + "@loadWhLayout", {
  4981. args: [
  4982. param,
  4983. ]
  4984. }).catch(function (e) {
  4985. var _a, _b;
  4986. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  4987. showErrorDialog('发生错误:' + msg);
  4988. console.error(msg, e);
  4989. });
  4990. }
  4991. var baseUrl = "/api/com/yvan/studio/FileManager";
  4992. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  4993. function getBaseUrl() {
  4994. // return getCurrentProject().url + baseUrl
  4995. return baseUrl;
  4996. }
  4997. function getLayoutUrl() {
  4998. // return getCurrentProject().url + baseUrl
  4999. return layoutUrl;
  5000. }
  5001. var Request = /** @class */ (function () {
  5002. function Request(axiosInstance) {
  5003. this.axiosInstance = axiosInstance;
  5004. }
  5005. // 全局响应数据转换处理
  5006. Request.transformResponse = function (response) {
  5007. var _a;
  5008. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  5009. };
  5010. Request.prototype.get = function (url, config) {
  5011. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  5012. };
  5013. Request.prototype.delete = function (url, config) {
  5014. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  5015. };
  5016. Request.prototype.head = function (url, config) {
  5017. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  5018. };
  5019. Request.prototype.options = function (url, config) {
  5020. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  5021. };
  5022. Request.prototype.post = function (url, data, config) {
  5023. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5024. };
  5025. Request.prototype.put = function (url, data, config) {
  5026. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5027. };
  5028. Request.prototype.patch = function (url, data, config) {
  5029. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5030. };
  5031. Request.prototype.request = function (config) {
  5032. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  5033. };
  5034. return Request;
  5035. }());
  5036. /** 创建一个axios实例对象 */
  5037. function axiosCreate(config) {
  5038. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  5039. }
  5040. var axiosInstance;
  5041. function init() {
  5042. axiosInstance = axiosCreate({
  5043. validateStatus: function (status) { return (status >= 200 && status < 400); },
  5044. });
  5045. request = new Request(axiosInstance);
  5046. }
  5047. var request;
  5048. /**
  5049. * 对比两个列 是否存在不一致
  5050. */
  5051. function compareColumn(t1, c1, t2, c2) {
  5052. if (typeof c2 === 'undefined') {
  5053. return 'column_name';
  5054. }
  5055. if (c1.column_name !== c2.column_name) {
  5056. return 'column_name';
  5057. }
  5058. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  5059. return 'default_value';
  5060. }
  5061. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  5062. return 'column_comment';
  5063. }
  5064. if (c1.is_primary_key !== c2.is_primary_key) {
  5065. return 'is_primary_key';
  5066. }
  5067. if (c1.not_null !== c2.not_null) {
  5068. return 'not_null';
  5069. }
  5070. var symbol1 = getDataTypeSymbol(t1, c1);
  5071. var symbol2 = getDataTypeSymbol(t2, c2);
  5072. if (symbol1 !== symbol2) {
  5073. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5074. return 'data_type';
  5075. }
  5076. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5077. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  5078. // 只关注长度
  5079. if (c1.column_size != c2.column_size) {
  5080. return 'column_size';
  5081. }
  5082. }
  5083. else {
  5084. // 其他情况,长度和精度都要关注
  5085. if (c1.column_size != c2.column_size) {
  5086. return 'column_size';
  5087. }
  5088. if (c1.decimal_digits !== c2.decimal_digits) {
  5089. return 'decimal_digits';
  5090. }
  5091. }
  5092. }
  5093. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  5094. var symbol1 = getDataTypeSymbol(tableInfo, column);
  5095. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  5096. if (symbol1 !== symbol2) {
  5097. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5098. return 'data_type';
  5099. }
  5100. if (is_fix_size) {
  5101. // 字段域吧大小限制住了
  5102. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5103. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  5104. // 只关注长度
  5105. if (column.column_size != domain.column_size) {
  5106. return 'column_size';
  5107. }
  5108. }
  5109. else {
  5110. // 其他情况,长度和精度都要关注
  5111. if (column.column_size != domain.column_size) {
  5112. return 'column_size';
  5113. }
  5114. if (column.decimal_digits !== domain.decimal_digits) {
  5115. return 'decimal_digits';
  5116. }
  5117. }
  5118. }
  5119. }
  5120. function checkColumn(table, col) {
  5121. if (isEmpty(col.column_name)) {
  5122. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  5123. }
  5124. if (isKeyword(col.column_name)) {
  5125. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  5126. }
  5127. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  5128. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  5129. }
  5130. return undefined;
  5131. }
  5132. function applyDomain(dbType, domain) {
  5133. var editRow = {
  5134. data_type: domain[dbType + '_datatype'],
  5135. };
  5136. domain = _$2.cloneDeep(domain);
  5137. if (!editRow.data_type) {
  5138. throw Error('字段域没有定义数据类型!');
  5139. }
  5140. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  5141. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  5142. if (match) {
  5143. // 类型里面包含括号
  5144. var sz = parseInt(match[2]);
  5145. if (isNaN(sz)) {
  5146. throw Error('字段域的定义错误:' + editRow.data_type);
  5147. }
  5148. domain.is_fix_size = true;
  5149. editRow.data_type = match[1];
  5150. domain.column_size = sz;
  5151. domain.decimal_digits = 0;
  5152. }
  5153. else {
  5154. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  5155. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  5156. if (match2) {
  5157. // 类型里面包含括号
  5158. var sz = parseInt(match2[2]);
  5159. if (isNaN(sz)) {
  5160. throw Error('字段域的定义错误:' + editRow.data_type);
  5161. }
  5162. var dg = parseInt(match2[3]);
  5163. if (isNaN(dg)) {
  5164. throw Error('字段域的定义错误:' + editRow.data_type);
  5165. }
  5166. domain.is_fix_size = true;
  5167. editRow.data_type = match[1];
  5168. domain.column_size = sz;
  5169. domain.decimal_digits = dg;
  5170. }
  5171. }
  5172. if (domain.domain_column_ui) {
  5173. _$2.extend(editRow, {
  5174. column_ui: domain.domain_column_ui,
  5175. });
  5176. }
  5177. if (domain.domain_column_dict) {
  5178. _$2.extend(editRow, {
  5179. column_dict: domain.domain_column_dict,
  5180. });
  5181. }
  5182. if (domain.is_fix_size) {
  5183. _$2.extend(editRow, {
  5184. column_size: domain.column_size,
  5185. decimal_digits: domain.decimal_digits
  5186. });
  5187. }
  5188. if (domain.is_fix_default_value) {
  5189. _$2.extend(editRow, {
  5190. default_value: domain.default_value,
  5191. });
  5192. }
  5193. return editRow;
  5194. }
  5195. /**
  5196. * 获取字段类型代号(用于做跨数据库数据类型对比)
  5197. */
  5198. function getDataTypeSymbol(table, col) {
  5199. if (table.db_type === 'oracle') {
  5200. switch (col.data_type) {
  5201. case 'number':
  5202. if (col.column_size <= 10 && !col.decimal_digits) {
  5203. return 'integer';
  5204. }
  5205. else if (col.column_size <= 19 && !col.decimal_digits) {
  5206. return 'long';
  5207. }
  5208. return 'bigdecimal';
  5209. case 'char':
  5210. if (col.column_size > 3000) {
  5211. return 'clob';
  5212. }
  5213. return 'char';
  5214. case 'integer':
  5215. return 'integer';
  5216. case 'varchar':
  5217. case 'varchar2':
  5218. if (col.column_size > 3000) {
  5219. return 'clob';
  5220. }
  5221. return 'varchar';
  5222. case 'clob':
  5223. return 'clob';
  5224. case 'blob':
  5225. return 'blob';
  5226. case 'date':
  5227. case 'timestamp':
  5228. case 'timestamp(6)':
  5229. case 'timestamp with local time zone':
  5230. case 'timestamp(6) with local time zone':
  5231. case 'timestamp(6) with time zone':
  5232. return 'timestamp';
  5233. }
  5234. return "undefined";
  5235. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  5236. }
  5237. if (table.db_type === 'pgsql') {
  5238. switch (col.data_type) {
  5239. case 'int4':
  5240. return 'integer';
  5241. case 'int8':
  5242. return 'long';
  5243. case 'char':
  5244. return 'char';
  5245. case 'varchar':
  5246. case 'varchar2':
  5247. if (col.column_size > 3000) {
  5248. return 'clob';
  5249. }
  5250. return 'varchar';
  5251. case 'numeric':
  5252. if (col.column_size <= 10 && !col.decimal_digits) {
  5253. return 'integer';
  5254. }
  5255. else if (col.column_size <= 19 && !col.decimal_digits) {
  5256. return 'long';
  5257. }
  5258. return 'bigdecimal';
  5259. case 'timestamp':
  5260. case 'timestamptz':
  5261. return 'timestamp';
  5262. case 'bytea':
  5263. return 'blob';
  5264. }
  5265. return "undefined";
  5266. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  5267. }
  5268. throw Error('未知数据库类型:' + table.db_type);
  5269. }
  5270. /**
  5271. * 判断对象名称是不是数据库关键字(保留字)
  5272. */
  5273. function isKeyword(word) {
  5274. if (!word || typeof word !== 'string') {
  5275. return false;
  5276. }
  5277. var kk = ['access',
  5278. 'add',
  5279. 'all',
  5280. 'alter',
  5281. 'and',
  5282. 'any',
  5283. 'as',
  5284. 'asc',
  5285. 'audit',
  5286. 'between',
  5287. 'by',
  5288. 'char',
  5289. 'check',
  5290. 'cluster',
  5291. 'column',
  5292. 'comment',
  5293. 'compress',
  5294. 'connect',
  5295. 'create',
  5296. 'current',
  5297. 'date',
  5298. 'decimal',
  5299. 'default',
  5300. 'delete',
  5301. 'desc',
  5302. 'distinct',
  5303. 'drop',
  5304. 'else',
  5305. 'exclusive',
  5306. 'exists',
  5307. 'file',
  5308. 'float',
  5309. 'for',
  5310. 'from',
  5311. 'grant',
  5312. 'group',
  5313. 'having',
  5314. 'identified',
  5315. 'immediate',
  5316. 'in',
  5317. 'increment',
  5318. 'index',
  5319. 'initial',
  5320. 'insert',
  5321. 'integer',
  5322. 'intersect',
  5323. 'into',
  5324. 'is',
  5325. 'level',
  5326. 'like',
  5327. 'lock',
  5328. 'long',
  5329. 'maxextents',
  5330. 'minus',
  5331. 'mlslabel',
  5332. 'mode',
  5333. 'modify',
  5334. 'noaudit',
  5335. 'nocompress',
  5336. 'not',
  5337. 'nowait',
  5338. 'null',
  5339. 'number',
  5340. 'of',
  5341. 'offline',
  5342. 'on',
  5343. 'online',
  5344. 'option',
  5345. 'or',
  5346. 'order',
  5347. 'p',
  5348. 'ctfree',
  5349. 'prior',
  5350. 'privileges',
  5351. 'public',
  5352. 'raw',
  5353. 'rename',
  5354. 'resource',
  5355. 'revoke',
  5356. 'row',
  5357. 'rowid',
  5358. 'rownum',
  5359. 'rows',
  5360. 'select',
  5361. 'session',
  5362. 'set',
  5363. 'share',
  5364. 'size',
  5365. 'smallint',
  5366. 'start',
  5367. 'successful',
  5368. 'synonym',
  5369. 'sysdate',
  5370. 'table',
  5371. 'then',
  5372. 'to',
  5373. 'trigger',
  5374. 'uid',
  5375. 'union',
  5376. 'unique',
  5377. 'update',
  5378. 'user',
  5379. 'validate',
  5380. 'values',
  5381. 'varchar',
  5382. 'varchar2',
  5383. 'view',
  5384. 'whenever',
  5385. 'where',
  5386. 'with'];
  5387. return _$2.includes(kk, word.toLowerCase());
  5388. }
  5389. var DbSync = /** @class */ (function (_super) {
  5390. __extends(DbSync, _super);
  5391. function DbSync() {
  5392. return _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  5393. }
  5394. DbSync.prototype.onLoad = function () {
  5395. };
  5396. DbSync.prototype.getDataBaseName = function (sender, _a) {
  5397. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  5398. getDataBaseNameApi().then(function (res) {
  5399. successCallback(res.data.map(function (name) {
  5400. return {
  5401. id: name, text: name
  5402. };
  5403. }));
  5404. });
  5405. };
  5406. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  5407. showInfoDialog(record.get('remark'));
  5408. };
  5409. DbSync.prototype.diff = function () {
  5410. var _this = this;
  5411. var promise1 = getMateData({
  5412. datasource: this.viewModel.get('dataSource1')
  5413. });
  5414. var promise2 = getMateData({
  5415. datasource: this.viewModel.get('dataSource2')
  5416. });
  5417. this.viewModel.set('schema1', '');
  5418. this.viewModel.set('schema2', '');
  5419. this.refs.grid1.setLoading(true);
  5420. Promise.all([promise1, promise2]).then(function (_a) {
  5421. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5422. var rows = [];
  5423. if (_$2.size(res1) > 0) {
  5424. // res1 起码有一个 schema
  5425. _this.viewModel.set('schema1', res1[0].schema_name);
  5426. _this.viewModel.set('schema2', res2[0].schema_name);
  5427. if (!_this.viewModel.get('schema1')) {
  5428. msg$1('datasource1 最起码需要一张表');
  5429. return;
  5430. }
  5431. if (!_this.viewModel.get('schema2')) {
  5432. msg$1('datasource2 最起码需要一张表');
  5433. return;
  5434. }
  5435. _$2.forEach(res1[0].table_list, function (table1) {
  5436. var _a;
  5437. 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; });
  5438. if (table1.schema_name) {
  5439. _this.viewModel.set('schema1', table1.schema_name);
  5440. }
  5441. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  5442. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  5443. }
  5444. var row = {
  5445. table_name1: table1.table_name,
  5446. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  5447. table_info: table1
  5448. };
  5449. if (!table2) {
  5450. row.diff = '不一致';
  5451. row.remark = '目标表缺失';
  5452. }
  5453. else if (table1.column_list.length !== table2.column_list.length) {
  5454. row.diff = '不一致';
  5455. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  5456. }
  5457. else {
  5458. row.diff = '一致';
  5459. var remark_1 = [];
  5460. _$2.forEach(table1.column_list, function (col1) {
  5461. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  5462. if (!col2) {
  5463. row.diff = '不一致';
  5464. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  5465. }
  5466. else {
  5467. var colDiff = compareColumn(table1, col1, table2, col2);
  5468. if (colDiff) {
  5469. row.diff = '不一致';
  5470. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  5471. }
  5472. }
  5473. });
  5474. row.remark = remark_1.join('\n');
  5475. }
  5476. rows.push(row);
  5477. });
  5478. }
  5479. _this.refs.grid1.setData(rows);
  5480. _this.viewModel.set('hasDiff', true);
  5481. }).finally(function () {
  5482. _this.refs.grid1.setLoading(false);
  5483. });
  5484. };
  5485. DbSync.prototype.structCopyTo = function () {
  5486. var _this = this;
  5487. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5488. msg$1('选择数据源!');
  5489. return;
  5490. }
  5491. var recordList = this.refs.grid1.getSelection();
  5492. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5493. if (_$2.size(tableNameList) <= 0) {
  5494. msg$1('请选择要同步的表');
  5495. return;
  5496. }
  5497. var error = undefined;
  5498. _$2.forEach(tableNameList, function (tableInfo) {
  5499. _$2.forEach(tableInfo.column_list, function (col) {
  5500. error = checkColumn(tableInfo, col);
  5501. return false;
  5502. });
  5503. if (error) {
  5504. return false;
  5505. }
  5506. });
  5507. if (error) {
  5508. msg$1(error);
  5509. return;
  5510. }
  5511. var schema1 = this.viewModel.get('schema1');
  5512. var schema2 = this.viewModel.get('schema2');
  5513. if (!schema1 || !schema2) {
  5514. msg$1('无法识别 schema 名称');
  5515. return;
  5516. }
  5517. this.refs.grid1.setLoading(true);
  5518. getDiffDDLApi({
  5519. datasource1: this.viewModel.get('dataSource1'),
  5520. datasource2: this.viewModel.get('dataSource2'),
  5521. schema1: this.viewModel.get('schema1'),
  5522. schema2: this.viewModel.get('schema2'),
  5523. tables: tableNameList,
  5524. }).then(function (res) {
  5525. if (res.success) {
  5526. _this.refs.ddleditor.setCode(res.data);
  5527. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  5528. }
  5529. }).finally(function () {
  5530. _this.refs.grid1.setLoading(false);
  5531. });
  5532. };
  5533. DbSync.prototype.indexCopyTo = function () {
  5534. var _this = this;
  5535. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5536. msg$1('选择数据源!');
  5537. return;
  5538. }
  5539. var recordList = this.refs.grid1.getSelection();
  5540. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5541. if (_$2.size(tableNameList) <= 0) {
  5542. msg$1('请选择要同步的表');
  5543. return;
  5544. }
  5545. var schema1 = this.viewModel.get('schema1');
  5546. var schema2 = this.viewModel.get('schema2');
  5547. if (!schema1 || !schema2) {
  5548. msg$1('无法识别 schema 名称');
  5549. return;
  5550. }
  5551. this.refs.grid1.setLoading(true);
  5552. getModifyIdxDDL({
  5553. datasource1: this.viewModel.get('dataSource1'),
  5554. datasource2: this.viewModel.get('dataSource2'),
  5555. schema1: this.viewModel.get('schema1'),
  5556. schema2: this.viewModel.get('schema2'),
  5557. tables: tableNameList,
  5558. }).then(function (res) {
  5559. if (res.success) {
  5560. _this.refs.ddleditor_idx.setCode(res.data);
  5561. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  5562. }
  5563. }).finally(function () {
  5564. _this.refs.grid1.setLoading(false);
  5565. });
  5566. };
  5567. DbSync.prototype.procedureCopyTo = function () {
  5568. var _this = this;
  5569. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5570. msg$1('选择数据源!');
  5571. return;
  5572. }
  5573. var schema1 = this.viewModel.get('schema1');
  5574. var schema2 = this.viewModel.get('schema2');
  5575. if (!schema1 || !schema2) {
  5576. msg$1('无法识别 schema 名称');
  5577. return;
  5578. }
  5579. this.refs.grid1.setLoading(true);
  5580. getModifyProcedureSQL({
  5581. datasource1: this.viewModel.get('dataSource1'),
  5582. datasource2: this.viewModel.get('dataSource2'),
  5583. schema1: this.viewModel.get('schema1'),
  5584. schema2: this.viewModel.get('schema2'),
  5585. }).then(function (res) {
  5586. if (res.success) {
  5587. _this.refs.ddleditor_procedure.setCode(res.data);
  5588. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  5589. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  5590. }
  5591. }).finally(function () {
  5592. _this.refs.grid1.setLoading(false);
  5593. });
  5594. };
  5595. DbSync.prototype.dataSync_start = function () {
  5596. var _this = this;
  5597. this.viewModel.set('dataSync_isStart', true);
  5598. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  5599. this.refs.datacopy.setLoading(true);
  5600. dataSyncApi(dataSync)
  5601. .then(function (res) {
  5602. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  5603. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  5604. })
  5605. .finally(function () {
  5606. _this.refs.datacopy.setLoading(false);
  5607. });
  5608. };
  5609. DbSync.prototype.dataSync_process = function () {
  5610. var _this = this;
  5611. var jobId = this.viewModel.get('dataSyncResult.jobId');
  5612. dataSyncInfoApi({ jobId: jobId })
  5613. .then(function (res) {
  5614. if (_$2.isArray(res.tableSyncInfos)) {
  5615. var scrollPosition = _this.refs.datacopy.scrollable.position;
  5616. _this.refs.datacopy.setData(res.tableSyncInfos);
  5617. try {
  5618. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  5619. }
  5620. catch (e) {
  5621. }
  5622. }
  5623. if (res.endTime) {
  5624. // 已经结束
  5625. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  5626. if (res.success) {
  5627. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5628. }
  5629. else {
  5630. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5631. }
  5632. _this.dataSync_stop();
  5633. }
  5634. })
  5635. .catch(function (e) {
  5636. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  5637. console.error(e);
  5638. // this.dataSync_stop()
  5639. })
  5640. .finally(function () {
  5641. _this.refs.datacopy.setLoading(false);
  5642. });
  5643. };
  5644. DbSync.prototype.dataSync_stop = function () {
  5645. this.viewModel.set('dataSync_isStart', false);
  5646. clearInterval(this.dataSyncInterval);
  5647. delete this.dataSyncInterval;
  5648. };
  5649. DbSync.prototype.dataCopyTo = function () {
  5650. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5651. msg$1('选择数据源!');
  5652. return;
  5653. }
  5654. var recordList = this.refs.grid1.getSelection();
  5655. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5656. if (_$2.size(tableNameList) <= 0) {
  5657. msg$1('请选择要同步的表');
  5658. return;
  5659. }
  5660. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  5661. this.viewModel.set('dataSync.tables', tableNameList);
  5662. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  5663. };
  5664. DbSync.prototype.next = function () {
  5665. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  5666. };
  5667. DbSync.prototype.back = function () {
  5668. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  5669. };
  5670. DbSync.prototype.dbToMeta = function () {
  5671. var _this = this;
  5672. var dataSource1 = this.viewModel.get('dataSource1');
  5673. var dataSource2 = this.viewModel.get('dataSource2');
  5674. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  5675. var promise1 = dbToMeta({ datasource: dataSource1 });
  5676. var promise2 = dbToMeta({ datasource: dataSource2 });
  5677. _this.refs.grid1.setLoading(true);
  5678. Promise.all([promise1, promise2]).then(function (_a) {
  5679. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5680. _this.diff();
  5681. }).catch(function (res) {
  5682. _this.refs.grid1.setLoading(false);
  5683. showErrorDialog$1(res);
  5684. });
  5685. });
  5686. };
  5687. DbSync.prototype.executeDDL = function () {
  5688. var _this = this;
  5689. var code = this.refs.ddleditor.getValue();
  5690. var dataSource2 = this.viewModel.get('dataSource2');
  5691. var target_schema_name = this.viewModel.get('schema2');
  5692. var recordList = this.refs.grid1.getSelection();
  5693. var table_infos = _$2.map(recordList, function (r) {
  5694. return r.get('table_info');
  5695. });
  5696. this.setLoading(true);
  5697. pushToDbCommitApi({
  5698. datasource: dataSource2,
  5699. ddl: code,
  5700. table_infos: table_infos,
  5701. target_schema_name: target_schema_name,
  5702. }).then(function (res) {
  5703. if (res === null || res === void 0 ? void 0 : res.success) {
  5704. msg$1('执行成功');
  5705. _this.back();
  5706. _this.diff();
  5707. return;
  5708. }
  5709. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5710. }).finally(function () {
  5711. _this.setLoading(false);
  5712. });
  5713. };
  5714. DbSync.prototype.executeDDLIdx = function () {
  5715. var _this = this;
  5716. var code = this.refs.ddleditor_idx.getValue();
  5717. var dataSource2 = this.viewModel.get('dataSource2');
  5718. this.setLoading(true);
  5719. executeDDL({
  5720. datasource: dataSource2,
  5721. ddl: code,
  5722. }).then(function (res) {
  5723. if (res === null || res === void 0 ? void 0 : res.success) {
  5724. msg$1('执行成功');
  5725. _this.back();
  5726. return;
  5727. }
  5728. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5729. }).finally(function () {
  5730. _this.setLoading(false);
  5731. });
  5732. };
  5733. DbSync.prototype.executeProcedureSQL = function () {
  5734. var _this = this;
  5735. this.setLoading(true);
  5736. executeModifyProcedureSQL({
  5737. datasource1: this.viewModel.get('dataSource1'),
  5738. datasource2: this.viewModel.get('dataSource2'),
  5739. schema1: this.viewModel.get('schema1'),
  5740. schema2: this.viewModel.get('schema2'),
  5741. }).then(function (res) {
  5742. if (res === null || res === void 0 ? void 0 : res.success) {
  5743. msg$1('执行成功');
  5744. _this.back();
  5745. return;
  5746. }
  5747. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5748. }).finally(function () {
  5749. _this.setLoading(false);
  5750. });
  5751. };
  5752. return DbSync;
  5753. }(Scope));
  5754. var model$2 = {
  5755. data: {}
  5756. };
  5757. var vjson$2 = {
  5758. title: '示例代码',
  5759. layout: 'fit',
  5760. items: [
  5761. {
  5762. layout: 'border',
  5763. items: [
  5764. {
  5765. region: 'north',
  5766. split: true,
  5767. height: 200,
  5768. title: '表格数据',
  5769. reference: 'dataeditor',
  5770. xtype: 'jsoneditor',
  5771. listeners: {
  5772. change: 'scope.dataChanged'
  5773. },
  5774. },
  5775. {
  5776. region: 'west',
  5777. split: true,
  5778. width: 230,
  5779. title: '模板',
  5780. reference: 'tree1',
  5781. xtype: 'treepanel',
  5782. rootVisible: false,
  5783. useArrows: true,
  5784. colspan: 2,
  5785. lines: true,
  5786. multiSelect: false,
  5787. listeners: {
  5788. itemclick: 'scope.templateChange',
  5789. },
  5790. },
  5791. {
  5792. region: 'center',
  5793. title: '参考代码',
  5794. reference: 'preview',
  5795. xtype: 'jsoneditor',
  5796. },
  5797. ]
  5798. }
  5799. ]
  5800. };
  5801. var rootNode = {
  5802. id: 'ROOT',
  5803. type: "ROOT",
  5804. path: "",
  5805. expanded: true,
  5806. leaf: false,
  5807. children: [
  5808. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  5809. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  5810. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  5811. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  5812. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  5813. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  5814. ],
  5815. };
  5816. var TemplateDev = /** @class */ (function (_super) {
  5817. __extends(TemplateDev, _super);
  5818. function TemplateDev() {
  5819. var _this = _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  5820. _this.dataChanged = _$2.debounce(function () {
  5821. var me = _this;
  5822. if (me.refs.tree1.selection) {
  5823. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  5824. }
  5825. }, 50);
  5826. return _this;
  5827. }
  5828. TemplateDev.prototype.onDestroy = function () {
  5829. setDbCode(undefined);
  5830. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  5831. };
  5832. TemplateDev.prototype.onLoad = function () {
  5833. setDbCode(this);
  5834. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  5835. this.refs.tree1.setRootNode(rootNode);
  5836. getColumnDomainApi({}).then(function (_a) {
  5837. var data = _a.data;
  5838. return window['dev_column_domain'] = data;
  5839. });
  5840. };
  5841. TemplateDev.prototype.dbTreeNodeChange = function () {
  5842. var me = handles$1.dbcode;
  5843. var tables = [];
  5844. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  5845. var raw = _$2.cloneDeep(r.get('raw'));
  5846. raw.id = r.get('id');
  5847. if (r.get('type') === 'table') {
  5848. tables.push(raw);
  5849. return;
  5850. }
  5851. if (r.get('type') === 'column') {
  5852. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  5853. if (!tableInfo) {
  5854. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  5855. tables.push(tableInfo);
  5856. }
  5857. if (!tableInfo.column_list) {
  5858. tableInfo.column_list = [raw];
  5859. }
  5860. else {
  5861. tableInfo.column_list.push(raw);
  5862. }
  5863. }
  5864. });
  5865. // 对于没有选择列的表格,默认加上所有列
  5866. _$2.forEach(tables, function (tableInfo) {
  5867. if (typeof tableInfo.column_list === 'undefined') {
  5868. tableInfo.column_list = [];
  5869. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  5870. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  5871. });
  5872. }
  5873. });
  5874. var code = JSON.stringify(tables, null, ' ');
  5875. me.refs.dataeditor.setCode(code);
  5876. };
  5877. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  5878. var url = record.data.url;
  5879. var rd = _$2.uniqueId('db_code_request');
  5880. if (url) {
  5881. var data = void 0;
  5882. try {
  5883. data = JSON.parse(this.refs.dataeditor.getCode());
  5884. }
  5885. catch (e) {
  5886. return;
  5887. }
  5888. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  5889. // if (typeof node.default === "function") {
  5890. // const v = toString(node.default(data))
  5891. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  5892. // this.refs.preview.setLanguage("plaintext")
  5893. // this.refs.preview.setCode(v)
  5894. // }
  5895. // })
  5896. showErrorDialog$1('没做这里');
  5897. }
  5898. };
  5899. return TemplateDev;
  5900. }(Scope));
  5901. var model$3 = {
  5902. data: {
  5903. hasChanged: false,
  5904. }
  5905. };
  5906. var vjson$3 = {
  5907. bind: {
  5908. title: '字段域{grid1.ischanged?" *":""}',
  5909. },
  5910. layout: 'fit',
  5911. items: [
  5912. {
  5913. layout: 'border',
  5914. items: [
  5915. {
  5916. region: 'center',
  5917. xtype: 'yvgrid',
  5918. selModel: {
  5919. type: 'spreadsheet',
  5920. columnSelect: true,
  5921. pruneRemoved: false,
  5922. extensible: 'y'
  5923. },
  5924. plugins: {
  5925. clipboard: true,
  5926. selectionreplicator: true
  5927. },
  5928. reference: 'grid1',
  5929. pagination: false,
  5930. tbar: {
  5931. xtype: 'toolbar',
  5932. items: [
  5933. {
  5934. xtype: 'button',
  5935. text: '添加',
  5936. iconCls: 'x-fa fa-plus-circle',
  5937. listeners: {
  5938. click: 'scope.addField'
  5939. }
  5940. },
  5941. {
  5942. xtype: 'button',
  5943. text: '删除',
  5944. iconCls: 'x-fa fa-minus-circle',
  5945. listeners: {
  5946. click: 'scope.removeField'
  5947. }
  5948. },
  5949. {
  5950. xtype: 'button',
  5951. text: '保存',
  5952. iconCls: 'x-fa fa-save',
  5953. bind: {
  5954. disabled: '{!grid1.ischanged}'
  5955. },
  5956. listeners: {
  5957. click: 'scope.save'
  5958. }
  5959. },
  5960. ]
  5961. },
  5962. listeners: {
  5963. editfinish: 'scope.gridEditFinish',
  5964. },
  5965. columns: [
  5966. {
  5967. text: '字段域名称', dataIndex: 'domain_name',
  5968. sortable: false,
  5969. menuDisabled: true,
  5970. locked: true,
  5971. editor: {
  5972. selectOnFocus: true
  5973. }
  5974. },
  5975. {
  5976. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  5977. sortable: false, menuDisabled: true,
  5978. editor: {
  5979. selectOnFocus: true
  5980. }
  5981. },
  5982. {
  5983. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  5984. sortable: false, menuDisabled: true,
  5985. editor: {
  5986. selectOnFocus: true
  5987. }
  5988. },
  5989. {
  5990. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  5991. sortable: false, menuDisabled: true,
  5992. editor: {
  5993. selectOnFocus: true
  5994. }
  5995. },
  5996. {
  5997. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  5998. sortable: false, menuDisabled: true,
  5999. editor: {
  6000. selectOnFocus: true
  6001. }
  6002. },
  6003. {
  6004. text: 'Java类型', dataIndex: 'java_datatype',
  6005. sortable: false, menuDisabled: true,
  6006. editor: {
  6007. selectOnFocus: true
  6008. }
  6009. },
  6010. {
  6011. text: '固定长度', dataIndex: 'is_fix_size',
  6012. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6013. width: 88, resizable: false,
  6014. },
  6015. {
  6016. text: '长度', dataIndex: 'column_size',
  6017. sortable: false, menuDisabled: true, dataType: 'int',
  6018. xtype: 'numbercolumn', format: '0',
  6019. editor: { selectOnFocus: true }
  6020. },
  6021. {
  6022. text: '小数位', dataIndex: 'decimal_digits',
  6023. sortable: false, menuDisabled: true, dataType: 'int',
  6024. xtype: 'numbercolumn', format: '0',
  6025. editor: { selectOnFocus: true }
  6026. },
  6027. {
  6028. text: '字典', dataIndex: 'domain_column_dict',
  6029. sortable: false, menuDisabled: true,
  6030. // fix: ['system.getDict("DICT")'],
  6031. width: 200,
  6032. editor: {
  6033. xtype: 'combo',
  6034. listConfig: {
  6035. minWidth: 350
  6036. },
  6037. }
  6038. },
  6039. {
  6040. text: '固定默认值', dataIndex: 'is_fix_default_value',
  6041. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6042. width: 88, resizable: false,
  6043. },
  6044. {
  6045. text: '默认值', dataIndex: 'default_value',
  6046. sortable: false, menuDisabled: true,
  6047. editor: {
  6048. selectOnFocus: true
  6049. }
  6050. },
  6051. {
  6052. text: 'UI建议', dataIndex: 'domain_column_ui',
  6053. sortable: false, menuDisabled: true,
  6054. // fix: ['system.getDict("column_ui")'],
  6055. editor: {
  6056. xtype: 'combo',
  6057. allowBlank: true,
  6058. listConfig: {
  6059. minWidth: 200
  6060. },
  6061. }
  6062. },
  6063. {
  6064. text: '详细描述', dataIndex: 'domain_note',
  6065. sortable: false, menuDisabled: true,
  6066. editor: {}
  6067. },
  6068. {
  6069. text: '责任人', dataIndex: 'domain_person',
  6070. sortable: false, menuDisabled: true,
  6071. editor: {
  6072. selectOnFocus: true
  6073. }
  6074. },
  6075. {
  6076. text: '版本', dataIndex: 'domain_version',
  6077. sortable: false, menuDisabled: true,
  6078. editor: {
  6079. selectOnFocus: true
  6080. }
  6081. },
  6082. ]
  6083. }
  6084. ]
  6085. },
  6086. ]
  6087. };
  6088. var CacheStore = /** @class */ (function () {
  6089. function CacheStore() {
  6090. // 订阅
  6091. this.subscribeList = [];
  6092. this.apiResponse = undefined;
  6093. }
  6094. /**
  6095. * 订阅结果集
  6096. */
  6097. CacheStore.prototype.registe = function (fn) {
  6098. this.subscribeList.push(fn);
  6099. };
  6100. /**
  6101. * 取消订阅
  6102. */
  6103. CacheStore.prototype.unregiste = function (fn) {
  6104. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  6105. };
  6106. /**
  6107. * 尝试取数据(先读缓存)
  6108. */
  6109. CacheStore.prototype.reloadIfNeed = function (param) {
  6110. var _this = this;
  6111. if (typeof this.apiResponse === 'undefined') {
  6112. // 从未有获取过值
  6113. var cacheKey = this.getCacheKey(param);
  6114. if (cacheKey) {
  6115. // 可以从缓存读
  6116. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6117. native.loadFile(fileName, function (res) {
  6118. if (res) {
  6119. // 缓存有值
  6120. _this.apiResponse = res;
  6121. _this.notifyRefresh();
  6122. }
  6123. else {
  6124. // 缓存没值
  6125. _this.reloadForce(param).then(function (res) {
  6126. });
  6127. }
  6128. });
  6129. }
  6130. else {
  6131. // 不能从缓存读
  6132. this.reloadForce(param).then(function (res) {
  6133. });
  6134. }
  6135. return true;
  6136. }
  6137. return false;
  6138. };
  6139. /**
  6140. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  6141. */
  6142. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  6143. var _this = this;
  6144. return new Promise(function (resolve, reject) {
  6145. if (typeof _this.apiResponse === 'undefined') {
  6146. // 从未有获取过值
  6147. var cacheKey = _this.getCacheKey(param);
  6148. if (cacheKey) {
  6149. // 可以从缓存读
  6150. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6151. native.loadFile(fileName, function (res) {
  6152. if (res) {
  6153. // 缓存有值
  6154. _this.apiResponse = res;
  6155. _this.notifyRefresh();
  6156. resolve(_this.apiResponse);
  6157. }
  6158. else {
  6159. // 缓存没值
  6160. _this.reloadForce(param).then(function (res) {
  6161. resolve(_this.apiResponse);
  6162. });
  6163. }
  6164. });
  6165. }
  6166. else {
  6167. // 不能从缓存读
  6168. _this.reloadForce(param).then(function (res) {
  6169. resolve(_this.apiResponse);
  6170. });
  6171. }
  6172. }
  6173. else {
  6174. // 有值,获取过
  6175. resolve(_this.apiResponse);
  6176. }
  6177. });
  6178. };
  6179. /**
  6180. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  6181. */
  6182. CacheStore.prototype.reloadForce = function (param) {
  6183. var _this = this;
  6184. _$2.forEach(this.subscribeList, function (fn) {
  6185. fn(true);
  6186. });
  6187. return this.invokeApi(param)
  6188. .then(function (res) {
  6189. _this.apiResponse = res;
  6190. var cacheKey = _this.getCacheKey(param);
  6191. if (cacheKey) {
  6192. // 可以保存到缓存
  6193. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  6194. native.saveFile(fileName, res);
  6195. }
  6196. // 通知订阅者刷新
  6197. _this.notifyRefresh();
  6198. })
  6199. .finally(function () {
  6200. _$2.forEach(_this.subscribeList, function (fn) {
  6201. fn(false);
  6202. });
  6203. });
  6204. };
  6205. /**
  6206. * 通知组件,isLoading状态被更改
  6207. */
  6208. CacheStore.prototype.notifyLoading = function (isLoading) {
  6209. var _this = this;
  6210. _$2.forEach(this.subscribeList, function (fn) {
  6211. fn(_this.apiResponse);
  6212. });
  6213. };
  6214. /**
  6215. * 通知数据更改,需要刷新
  6216. */
  6217. CacheStore.prototype.notifyRefresh = function () {
  6218. var _this = this;
  6219. _$2.forEach(this.subscribeList, function (fn) {
  6220. fn(_this.apiResponse);
  6221. });
  6222. };
  6223. return CacheStore;
  6224. }());
  6225. // 字段域数据
  6226. var columnDomain = undefined;
  6227. var DomainStore = /** @class */ (function (_super) {
  6228. __extends(DomainStore, _super);
  6229. function DomainStore() {
  6230. return _super !== null && _super.apply(this, arguments) || this;
  6231. }
  6232. DomainStore.prototype.getCacheKey = function (param) {
  6233. return "domain_data.json";
  6234. };
  6235. DomainStore.prototype.invokeApi = function (param) {
  6236. return getColumnDomainApi();
  6237. };
  6238. /**
  6239. * 设置全局可访问的 字段域数据
  6240. */
  6241. DomainStore.prototype.getColumnDomainComboData = function () {
  6242. var _this = this;
  6243. return new Promise(function (resolve) {
  6244. _this.reloadIfNeedPromise(undefined).then(function (res) {
  6245. resolve(_this.apiResponse.data.map(function (v) {
  6246. return { id: v.domain_id, text: v.domain_name };
  6247. }));
  6248. });
  6249. });
  6250. };
  6251. /**
  6252. * 设置全局可访问的 字段域数据
  6253. */
  6254. DomainStore.prototype.getColumnDomainById = function (value) {
  6255. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  6256. };
  6257. DomainStore.prototype.getAllDomain = function () {
  6258. return new Promise(function (resolve, reject) {
  6259. getColumnDomainApi()
  6260. .then(function (res) {
  6261. if (res.success) {
  6262. if (res.success) {
  6263. var tt = _$2.map(res.data, function (row) {
  6264. return {
  6265. text: row.domain_name,
  6266. id: row.domain_id,
  6267. };
  6268. });
  6269. _$2.set(window, 'DICT_CACHE.column_domain', tt);
  6270. }
  6271. columnDomain = res.data;
  6272. resolve(res.data);
  6273. }
  6274. else {
  6275. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  6276. console.error('getColumnDomain', res.msg);
  6277. }
  6278. })
  6279. .catch(function (e) {
  6280. window['showErrorDialog']('getColumnDomain error!');
  6281. console.error('getColumnDomain', e);
  6282. reject(e);
  6283. });
  6284. });
  6285. };
  6286. return DomainStore;
  6287. }(CacheStore));
  6288. var instance = new DomainStore();
  6289. var DbDomain = /** @class */ (function (_super) {
  6290. __extends(DbDomain, _super);
  6291. function DbDomain() {
  6292. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  6293. }
  6294. DbDomain.prototype.onLoad = function () {
  6295. var _this = this;
  6296. instance.getAllDomain().then(function (data) {
  6297. _this.refs.grid1.setData(data);
  6298. });
  6299. };
  6300. DbDomain.prototype.gridEditFinish = function () {
  6301. this.viewModel.set('hasChanged', true);
  6302. };
  6303. DbDomain.prototype.addField = function () {
  6304. this.refs.grid1.appendEditRow({
  6305. domainName: '',
  6306. pgSqlDataType: '',
  6307. mysqlDataType: '',
  6308. oracleDataType: '',
  6309. sqlserverDataType: '',
  6310. javaDataType: '',
  6311. isFixSize: true,
  6312. size: '',
  6313. decimalDigits: '',
  6314. isFixDefaultValue: false,
  6315. defaultValue: null,
  6316. domainColumnDict: '',
  6317. domainColumnUI: '',
  6318. note: '',
  6319. domainPerson: '',
  6320. domainVersion: '',
  6321. }, 0);
  6322. };
  6323. DbDomain.prototype.removeField = function () {
  6324. var _this = this;
  6325. var rows = [];
  6326. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  6327. rows.push(r);
  6328. });
  6329. _.forEach(rows, function (r) {
  6330. _this.refs.grid1.getStore().remove(r);
  6331. });
  6332. };
  6333. DbDomain.prototype.save = function () {
  6334. var _this = this;
  6335. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  6336. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  6337. if (err) {
  6338. // 如果有异常就不保存
  6339. return;
  6340. }
  6341. // 进行业务上的逻辑校验,比如说必填校验等等
  6342. var hasError = false;
  6343. _.forEach(rows, function (row, i) {
  6344. if (isEmpty(row.domain_name)) {
  6345. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  6346. hasError = true;
  6347. return false;
  6348. }
  6349. if (isEmpty(row.pgsql_datatype) ||
  6350. isEmpty(row.mysql_datatype) ||
  6351. isEmpty(row.oracle_datatype) ||
  6352. isEmpty(row.sqlserver_datatype)) {
  6353. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  6354. hasError = true;
  6355. return false;
  6356. }
  6357. });
  6358. if (hasError) {
  6359. return;
  6360. }
  6361. // 设置当前界面为 "保存中..." 状态
  6362. this.setLoading(true);
  6363. saveColumnDomain({
  6364. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  6365. newRows: newRows,
  6366. modifyRows: modifyRows,
  6367. removeRecords: removeRecords,
  6368. }).then(function (res) {
  6369. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  6370. system.msg(res.msg);
  6371. instance.reloadForce({}).then(function () {
  6372. instance.getAllDomain().then(function (data) {
  6373. _this.refs.grid1.setData(data);
  6374. });
  6375. }).finally(function () {
  6376. // 无论正常异常,关闭 "保存中..." 状态
  6377. _this.setLoading(false);
  6378. });
  6379. }).catch(function (e) {
  6380. // 无论正常异常,关闭 "保存中..." 状态
  6381. _this.setLoading(false);
  6382. });
  6383. };
  6384. return DbDomain;
  6385. }(Scope));
  6386. var model$4 = {
  6387. data: {
  6388. report_id: '',
  6389. report_name: '',
  6390. report_enable: false,
  6391. report: {
  6392. dataSource: '',
  6393. grid: {
  6394. pagination: true,
  6395. },
  6396. query: [],
  6397. columns: [],
  6398. summary: [],
  6399. },
  6400. querySql: '',
  6401. summarySql: '',
  6402. createAt: '',
  6403. createBy: '',
  6404. updateAt: '',
  6405. updateBy: '',
  6406. }
  6407. };
  6408. var vjson$4 = {
  6409. bind: {
  6410. title: '报表-{report_name}',
  6411. },
  6412. layout: 'fit',
  6413. items: [
  6414. {
  6415. layout: 'border',
  6416. items: [
  6417. {
  6418. region: 'north',
  6419. items: [
  6420. {
  6421. xtype: 'toolbar',
  6422. border: false,
  6423. items: [
  6424. {
  6425. xtype: 'button',
  6426. text: '刷新',
  6427. iconCls: 'x-fa fa-refresh',
  6428. listeners: {
  6429. click: 'scope.load'
  6430. }
  6431. },
  6432. {
  6433. xtype: 'button',
  6434. text: '保存',
  6435. iconCls: 'x-fa fa-save',
  6436. listeners: {
  6437. click: 'scope.save'
  6438. }
  6439. },
  6440. {
  6441. xtype: 'button',
  6442. text: '预览',
  6443. iconCls: 'x-fa fa-play-circle-o',
  6444. listeners: {
  6445. click: 'scope.preview'
  6446. }
  6447. },
  6448. {
  6449. xtype: 'textfield',
  6450. fieldLabel: '报表名称',
  6451. flex: 1,
  6452. bind: {
  6453. value: '{report_name}'
  6454. }
  6455. },
  6456. {
  6457. xtype: 'checkbox',
  6458. fieldLabel: '启用报表',
  6459. checkedValue: 1,
  6460. uncheckedValue: 0,
  6461. bind: {
  6462. value: '{report_enable}'
  6463. }
  6464. },
  6465. {
  6466. xtype: 'checkbox',
  6467. fieldLabel: '启用分页',
  6468. bind: {
  6469. value: '{report.grid.pagination}'
  6470. }
  6471. },
  6472. {
  6473. xtype: 'textfield',
  6474. fieldLabel: '数据源',
  6475. flex: 1,
  6476. bind: {
  6477. value: '{report.dataSource}'
  6478. }
  6479. },
  6480. ]
  6481. }
  6482. ]
  6483. },
  6484. {
  6485. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  6486. items: [
  6487. {
  6488. title: 'SQL和查询条件',
  6489. layout: 'border',
  6490. border: false,
  6491. items: [
  6492. {
  6493. region: 'north',
  6494. height: 200,
  6495. border: false,
  6496. split: true,
  6497. xtype: 'yvgrid',
  6498. reference: 'gridCondition',
  6499. pagination: false,
  6500. hideFootbar: true,
  6501. plugins: {
  6502. clipboard: true,
  6503. selectionreplicator: true
  6504. },
  6505. selModel: {
  6506. type: 'spreadsheet',
  6507. columnSelect: false,
  6508. pruneRemoved: false,
  6509. extensible: 'y'
  6510. },
  6511. tbar: {
  6512. xtype: 'toolbar',
  6513. border: false,
  6514. items: [
  6515. {
  6516. xtype: 'button',
  6517. text: '添加条件',
  6518. iconCls: 'x-fa fa-plus-circle',
  6519. listeners: {
  6520. click: 'scope.addCondition'
  6521. }
  6522. },
  6523. {
  6524. xtype: 'button',
  6525. text: '删除条件',
  6526. iconCls: 'x-fa fa-minus-circle',
  6527. listeners: {
  6528. click: 'scope.removeCondition'
  6529. }
  6530. },
  6531. '-',
  6532. {
  6533. xtype: 'button',
  6534. text: '自动分析条件变量',
  6535. iconCls: 'x-fa fa-code-fork',
  6536. listeners: {
  6537. click: 'scope.calcCondition'
  6538. }
  6539. },
  6540. {
  6541. xtype: 'button',
  6542. text: '上移',
  6543. iconCls: 'x-fa fa-arrow-up',
  6544. listeners: {
  6545. click: 'scope.moveUp'
  6546. }
  6547. },
  6548. {
  6549. xtype: 'button',
  6550. text: '下移',
  6551. iconCls: 'x-fa fa-arrow-down',
  6552. listeners: {
  6553. click: 'scope.moveDown'
  6554. }
  6555. },
  6556. ]
  6557. },
  6558. columns: [
  6559. {
  6560. text: '条件变量',
  6561. dataIndex: 'conditionFieldBind',
  6562. width: 140,
  6563. sortable: false,
  6564. menuDisabled: true,
  6565. editor: {
  6566. selectOnFocus: true
  6567. },
  6568. },
  6569. {
  6570. text: '中文标题',
  6571. dataIndex: 'conditionFieldLabel',
  6572. width: 120,
  6573. sortable: false,
  6574. menuDisabled: true,
  6575. editor: {
  6576. selectOnFocus: true
  6577. },
  6578. },
  6579. {
  6580. text: '编辑类型',
  6581. dataIndex: 'conditionFieldXtype',
  6582. width: 80,
  6583. sortable: false,
  6584. menuDisabled: true,
  6585. editor: {
  6586. xtype: 'combo',
  6587. typeAhead: true,
  6588. triggerAction: 'all',
  6589. selectOnFocus: true,
  6590. store: [
  6591. ['textfield', 'textfield'],
  6592. ['combo', 'combo'],
  6593. ['datefield', 'datefield'],
  6594. ['datetimefield', 'datetimefield'],
  6595. ['numberfield', 'numberfield'],
  6596. ['multiplesearch', 'multiplesearch'],
  6597. ]
  6598. }
  6599. },
  6600. {
  6601. text: '权重',
  6602. dataIndex: 'conditionFieldFlex',
  6603. align: 'right',
  6604. width: 60,
  6605. sortable: false,
  6606. menuDisabled: true,
  6607. editor: {
  6608. xtype: 'numberfield',
  6609. selectOnFocus: false,
  6610. minValue: 0,
  6611. maxValue: 10
  6612. },
  6613. },
  6614. {
  6615. text: '字典',
  6616. dataIndex: 'conditionFieldDict',
  6617. width: 160,
  6618. sortable: false,
  6619. menuDisabled: true,
  6620. editor: {
  6621. selectOnFocus: false
  6622. },
  6623. },
  6624. {
  6625. xtype: 'checkcolumn',
  6626. dataIndex: "conditionFieldWrap", header: "换行",
  6627. width: 65,
  6628. sortable: false,
  6629. menuDisabled: true,
  6630. },
  6631. {
  6632. text: '扩展参数',
  6633. dataIndex: 'conditionFieldExtend',
  6634. sortable: false,
  6635. menuDisabled: true,
  6636. editor: {
  6637. selectOnFocus: false
  6638. },
  6639. },
  6640. ]
  6641. },
  6642. {
  6643. region: 'center',
  6644. xtype: 'sqleditor',
  6645. layout: 'fit',
  6646. reference: 'sqlEditor',
  6647. split: true,
  6648. },
  6649. ]
  6650. },
  6651. {
  6652. title: '查询结果字段',
  6653. xtype: 'yvgrid',
  6654. reference: 'gridColumn',
  6655. pagination: false,
  6656. hideFootbar: true,
  6657. border: false,
  6658. plugins: {
  6659. clipboard: true,
  6660. selectionreplicator: true
  6661. },
  6662. selModel: {
  6663. type: 'spreadsheet',
  6664. columnSelect: false,
  6665. pruneRemoved: false,
  6666. extensible: 'y'
  6667. },
  6668. tbar: {
  6669. xtype: 'toolbar',
  6670. items: [
  6671. {
  6672. xtype: 'button',
  6673. text: '添加',
  6674. iconCls: 'x-fa fa-plus-circle',
  6675. listeners: {
  6676. click: 'scope.addColumn'
  6677. }
  6678. },
  6679. {
  6680. xtype: 'button',
  6681. text: '删除',
  6682. iconCls: 'x-fa fa-minus-circle',
  6683. listeners: {
  6684. click: 'scope.removeColumn'
  6685. }
  6686. },
  6687. '-',
  6688. {
  6689. xtype: 'button',
  6690. text: '自动分析',
  6691. iconCls: 'x-fa fa-code-fork',
  6692. listeners: {
  6693. click: 'scope.calcColumn'
  6694. }
  6695. },
  6696. {
  6697. xtype: 'button',
  6698. text: '上移',
  6699. iconCls: 'x-fa fa-arrow-up',
  6700. listeners: {
  6701. click: 'scope.moveUp'
  6702. }
  6703. },
  6704. {
  6705. xtype: 'button',
  6706. text: '下移',
  6707. iconCls: 'x-fa fa-arrow-down',
  6708. listeners: {
  6709. click: 'scope.moveDown'
  6710. }
  6711. },
  6712. ]
  6713. },
  6714. columns: [
  6715. { xtype: 'rownumberer' },
  6716. {
  6717. text: '字段',
  6718. dataIndex: 'dataIndex',
  6719. width: 140,
  6720. sortable: false,
  6721. menuDisabled: true,
  6722. editor: {
  6723. selectOnFocus: true
  6724. },
  6725. },
  6726. {
  6727. text: '标题',
  6728. dataIndex: 'header',
  6729. width: 120,
  6730. sortable: false,
  6731. menuDisabled: true,
  6732. editor: {
  6733. selectOnFocus: true
  6734. },
  6735. },
  6736. {
  6737. text: '显示类型',
  6738. dataIndex: 'xtype',
  6739. width: 90,
  6740. sortable: false,
  6741. menuDisabled: true,
  6742. editor: {
  6743. xtype: 'combo',
  6744. typeAhead: true,
  6745. triggerAction: 'all',
  6746. selectOnFocus: true,
  6747. store: [
  6748. ['', ''],
  6749. ['rownum', 'rownum'],
  6750. ['button', 'button'],
  6751. ['checkbox', 'checkbox'],
  6752. ['progres', 'progres'],
  6753. ]
  6754. }
  6755. },
  6756. {
  6757. text: '数据类型',
  6758. dataIndex: 'dataType',
  6759. width: 90,
  6760. sortable: false,
  6761. menuDisabled: true,
  6762. editor: {
  6763. xtype: 'combo',
  6764. typeAhead: true,
  6765. triggerAction: 'all',
  6766. selectOnFocus: true,
  6767. store: [
  6768. ['', ''],
  6769. ['string', 'string'],
  6770. ['number', 'number'],
  6771. ['date', 'date'],
  6772. ]
  6773. }
  6774. },
  6775. {
  6776. text: '宽度',
  6777. dataIndex: 'width',
  6778. align: 'right',
  6779. width: 60,
  6780. sortable: false,
  6781. menuDisabled: true,
  6782. editor: {
  6783. xtype: 'numberfield',
  6784. selectOnFocus: true,
  6785. minValue: 0,
  6786. maxValue: 1000
  6787. },
  6788. },
  6789. {
  6790. text: '权重',
  6791. dataIndex: 'flex',
  6792. align: 'right',
  6793. width: 60,
  6794. sortable: false,
  6795. menuDisabled: true,
  6796. editor: {
  6797. xtype: 'numberfield',
  6798. selectOnFocus: true,
  6799. minValue: 0,
  6800. maxValue: 10
  6801. },
  6802. },
  6803. {
  6804. text: '字典',
  6805. dataIndex: 'dict',
  6806. sortable: false,
  6807. menuDisabled: true,
  6808. width: 120,
  6809. editor: {
  6810. selectOnFocus: true,
  6811. },
  6812. },
  6813. {
  6814. text: '对齐',
  6815. dataIndex: 'align',
  6816. width: 60,
  6817. sortable: false,
  6818. menuDisabled: true,
  6819. editor: {
  6820. xtype: 'combo',
  6821. typeAhead: true,
  6822. triggerAction: 'all',
  6823. selectOnFocus: false,
  6824. store: [
  6825. ['', ''],
  6826. ['start', 'start'],
  6827. ['center', 'center'],
  6828. ['end', 'end'],
  6829. ]
  6830. },
  6831. },
  6832. {
  6833. text: '过滤',
  6834. dataIndex: 'filterable',
  6835. xtype: 'checkcolumn',
  6836. width: 50,
  6837. resizable: false,
  6838. sortable: false,
  6839. menuDisabled: true,
  6840. },
  6841. {
  6842. text: '隐藏',
  6843. dataIndex: 'hidden',
  6844. xtype: 'checkcolumn',
  6845. width: 50,
  6846. resizable: false,
  6847. sortable: false,
  6848. menuDisabled: true,
  6849. },
  6850. {
  6851. text: '排序',
  6852. dataIndex: 'sortable',
  6853. xtype: 'checkcolumn',
  6854. width: 50,
  6855. resizable: false,
  6856. sortable: false,
  6857. menuDisabled: true,
  6858. },
  6859. {
  6860. text: '扩展参数',
  6861. dataIndex: 'fieldExtend',
  6862. sortable: false,
  6863. menuDisabled: true,
  6864. editor: {
  6865. selectOnFocus: false
  6866. },
  6867. },
  6868. ],
  6869. },
  6870. {
  6871. title: '汇总和汇总逻辑',
  6872. layout: 'border',
  6873. border: false,
  6874. items: [
  6875. {
  6876. xtype: 'yvgrid', region: 'north', layout: 'fit',
  6877. reference: 'gridSum',
  6878. pagination: false,
  6879. hideFootbar: true,
  6880. height: 200,
  6881. split: true,
  6882. border: false,
  6883. plugins: {
  6884. clipboard: true,
  6885. selectionreplicator: true
  6886. },
  6887. selModel: {
  6888. type: 'spreadsheet',
  6889. columnSelect: false,
  6890. pruneRemoved: false,
  6891. extensible: 'y'
  6892. },
  6893. tbar: {
  6894. xtype: 'toolbar',
  6895. border: false,
  6896. items: [
  6897. {
  6898. xtype: 'button',
  6899. text: '添加',
  6900. iconCls: 'x-fa fa-plus-circle',
  6901. listeners: {
  6902. click: 'scope.addSum'
  6903. }
  6904. },
  6905. {
  6906. xtype: 'button',
  6907. text: '删除',
  6908. iconCls: 'x-fa fa-minus-circle',
  6909. listeners: {
  6910. click: 'scope.removeSum'
  6911. }
  6912. },
  6913. '-',
  6914. {
  6915. xtype: 'button',
  6916. text: '自动分析',
  6917. iconCls: 'x-fa fa-code-fork',
  6918. listeners: {
  6919. click: 'scope.calcSum'
  6920. }
  6921. },
  6922. {
  6923. xtype: 'button',
  6924. text: '上移',
  6925. iconCls: 'x-fa fa-arrow-up',
  6926. listeners: {
  6927. click: 'scope.moveUp'
  6928. }
  6929. },
  6930. {
  6931. xtype: 'button',
  6932. text: '下移',
  6933. iconCls: 'x-fa fa-arrow-down',
  6934. listeners: {
  6935. click: 'scope.moveDown'
  6936. }
  6937. },
  6938. ]
  6939. },
  6940. columns: [
  6941. {
  6942. text: '字段名',
  6943. dataIndex: 'sumFieldBind',
  6944. width: 140,
  6945. sortable: false,
  6946. menuDisabled: true,
  6947. editor: {
  6948. selectOnFocus: true
  6949. },
  6950. },
  6951. {
  6952. text: '标题',
  6953. dataIndex: 'sumFieldLabel',
  6954. width: 120,
  6955. sortable: false,
  6956. menuDisabled: true,
  6957. editor: {
  6958. selectOnFocus: true
  6959. },
  6960. },
  6961. {
  6962. text: '权重',
  6963. dataIndex: 'sumFieldFlex',
  6964. align: 'right',
  6965. width: 60,
  6966. sortable: false,
  6967. menuDisabled: true,
  6968. editor: {
  6969. xtype: 'numberfield',
  6970. selectOnFocus: false,
  6971. allowBlank: true,
  6972. minValue: 0,
  6973. maxValue: 10
  6974. },
  6975. },
  6976. {
  6977. xtype: 'checkcolumn',
  6978. dataIndex: "sumFieldWrap", header: "换行",
  6979. sortable: false,
  6980. menuDisabled: true,
  6981. width: 65,
  6982. },
  6983. {
  6984. text: '扩展参数',
  6985. dataIndex: 'sumFieldExtend',
  6986. sortable: false,
  6987. menuDisabled: true,
  6988. editor: {
  6989. selectOnFocus: false
  6990. },
  6991. },
  6992. ]
  6993. },
  6994. {
  6995. region: 'center',
  6996. xtype: 'sqleditor',
  6997. layout: 'fit',
  6998. reference: 'sqlSumEditor',
  6999. },
  7000. ]
  7001. },
  7002. ]
  7003. }
  7004. ]
  7005. }
  7006. ]
  7007. }; //
  7008. //
  7009. var DbStore = /** @class */ (function (_super) {
  7010. __extends(DbStore, _super);
  7011. function DbStore() {
  7012. return _super !== null && _super.apply(this, arguments) || this;
  7013. }
  7014. DbStore.prototype.getCacheKey = function (param) {
  7015. return "db_data.json";
  7016. };
  7017. DbStore.prototype.invokeApi = function (param) {
  7018. return getMateData(param);
  7019. };
  7020. /**
  7021. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  7022. */
  7023. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  7024. return new Promise(function (resolve, reject) {
  7025. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  7026. resolve(res1);
  7027. // TODO 好像不需要,先跳过
  7028. // reloadByTableName(schema_name, table_name).then(res2 => {
  7029. // resolve(res1)
  7030. // }).catch(e => {
  7031. // reject(e)
  7032. // })
  7033. }).catch(function (e) {
  7034. reject(e);
  7035. });
  7036. });
  7037. };
  7038. /**
  7039. * 保存元数据至表格
  7040. */
  7041. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  7042. var _this = this;
  7043. return new Promise(function (resolve, reject) {
  7044. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  7045. // 保存后重新刷新
  7046. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  7047. resolve({
  7048. data: res2,
  7049. msg: res1.msg
  7050. });
  7051. }).catch(function (e) {
  7052. reject(e);
  7053. });
  7054. }).catch(function (e) {
  7055. reject(e);
  7056. });
  7057. });
  7058. };
  7059. /**
  7060. * 预览生成的 DDL 语句
  7061. */
  7062. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  7063. return new Promise(function (resolve, reject) {
  7064. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  7065. .then(function (res) {
  7066. resolve(res);
  7067. });
  7068. });
  7069. };
  7070. /**
  7071. * 执行 DDL
  7072. */
  7073. DbStore.prototype.pushToDbCommit = function (arg) {
  7074. return new Promise(function (resolve, reject) {
  7075. pushToDbCommitApi(arg).then(function (res) {
  7076. resolve(res);
  7077. }).catch(function (e) {
  7078. reject(e);
  7079. });
  7080. });
  7081. };
  7082. /**
  7083. * 重读某一个表格的 meta 元数据
  7084. */
  7085. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  7086. var _this = this;
  7087. return new Promise(function (resolve, reject) {
  7088. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  7089. if (!res[0] || !res[0].table_list[0]) {
  7090. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  7091. return;
  7092. }
  7093. var tableRow = _this.getTableByName(schema_name, table_name);
  7094. if (!tableRow) {
  7095. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  7096. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  7097. if (!schemaRow) {
  7098. showErrorDialog$1('没有找到 schema:' + schema_name);
  7099. return;
  7100. }
  7101. schemaRow.table_list.push(res[0].table_list[0]);
  7102. }
  7103. else {
  7104. // 找到了目标表格,就吧 table 所有属性都赋值过去
  7105. Object.assign(tableRow, res[0].table_list[0]);
  7106. }
  7107. // 所有界面通知一遍刷新
  7108. _this.notifyRefresh();
  7109. resolve(res);
  7110. }).catch(function (e) {
  7111. reject(e);
  7112. });
  7113. });
  7114. };
  7115. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  7116. var result = undefined;
  7117. _$2.forEach(this.apiResponse, function (schemaRow) {
  7118. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  7119. if (tableRow) {
  7120. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  7121. if (columnRow) {
  7122. result = columnRow;
  7123. return false;
  7124. }
  7125. }
  7126. });
  7127. return result;
  7128. };
  7129. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  7130. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  7131. if (!schemaRow) {
  7132. showErrorDialog$1('没有找到 schema:' + schemaName);
  7133. return;
  7134. }
  7135. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  7136. if (!schemaRow) {
  7137. showErrorDialog$1('没有找到 table:' + tableName);
  7138. return;
  7139. }
  7140. return tableRow;
  7141. };
  7142. /**
  7143. * 添加一个新表格
  7144. */
  7145. DbStore.prototype.appendNewTable = function (tableInfo) {
  7146. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  7147. if (!schemaRow) {
  7148. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  7149. return;
  7150. }
  7151. schemaRow.table_list.push(tableInfo);
  7152. };
  7153. /**
  7154. * 从数据库结构重新生成元数据
  7155. */
  7156. DbStore.prototype.dbToMetaAndReload = function () {
  7157. var _this = this;
  7158. this.notifyLoading(true);
  7159. dbToMeta().then(function () {
  7160. _this.reloadForce(undefined);
  7161. }).catch(function (e) {
  7162. _this.notifyLoading(false);
  7163. });
  7164. };
  7165. DbStore.prototype.getSchemaDbType = function (schemaName) {
  7166. var dbType = undefined;
  7167. _$2.forEach(this.apiResponse, function (schemaRow) {
  7168. if (schemaRow.schema_name === schemaName) {
  7169. dbType = schemaRow.db_type;
  7170. return false;
  7171. }
  7172. });
  7173. return dbType;
  7174. };
  7175. return DbStore;
  7176. }(CacheStore));
  7177. function syncQueryDSL(_a) {
  7178. var schema_name = _a.schema_name, table_name = _a.table_name;
  7179. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  7180. }
  7181. var instance$1 = new DbStore();
  7182. // // 字段域数据
  7183. // let columnDomain = undefined
  7184. // // 元数据
  7185. // let apiResponse = []
  7186. //
  7187. // // 订阅
  7188. // const subscribeList = []
  7189. // /**
  7190. // * 获取全部元数据
  7191. // */
  7192. // export function getApiResponse() {
  7193. // return apiResponse
  7194. // }
  7195. //
  7196. // export function getColumnDomain() {
  7197. // return columnDomain
  7198. // }
  7199. // window['getApiResponse'] = getApiResponse
  7200. // window['getColumnDomain'] = getColumnDomain
  7201. // window['getDbTreeStore'] = function () {
  7202. // return apiResponse
  7203. // }
  7204. //
  7205. // /**
  7206. // * 订阅结果集
  7207. // */
  7208. // export function subscribe(fn) {
  7209. // subscribeList.push(fn)
  7210. // }
  7211. //
  7212. // /**
  7213. // * 取消订阅
  7214. // */
  7215. // export function describe(fn) {
  7216. // _.remove(subscribeList, item => item === fn)
  7217. // }
  7218. //
  7219. // /**
  7220. // * 刷新,如果前端从来没有取到过结果的话
  7221. // * 如果强制刷新成功,就返回 true
  7222. // * 如果没有被强制刷新,返回 false
  7223. // */
  7224. // export function reloadIfNeed() {
  7225. // if (_.size(apiResponse) <= 0) {
  7226. // reloadForce()
  7227. // return true
  7228. // }
  7229. // return false
  7230. // }
  7231. //
  7232. // export function reloadIfNeedPromise() {
  7233. // return new Promise((resolve, reject) => {
  7234. // if (_.size(apiResponse) <= 0) {
  7235. // // 从未有获取过值
  7236. // reloadForce().then(res => {
  7237. // resolve(apiResponse)
  7238. // })
  7239. // return
  7240. // }
  7241. // resolve(apiResponse)
  7242. // return
  7243. // })
  7244. // }
  7245. //
  7246. // /**
  7247. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  7248. // */
  7249. // export function reloadForce() {
  7250. // _.forEach(subscribeList, fn => {
  7251. // fn(true)
  7252. // })
  7253. //
  7254. // return getMateData().then((content) => {
  7255. // apiResponse = content
  7256. // _.forEach(subscribeList, fn => {
  7257. // fn(apiResponse)
  7258. // })
  7259. // }).finally(() => {
  7260. // _.forEach(subscribeList, fn => {
  7261. // fn(false)
  7262. // })
  7263. // })
  7264. // }
  7265. //
  7266. // /**
  7267. // * 通知刷新元数据
  7268. // */
  7269. // export function notifyRefresh() {
  7270. // _.forEach(subscribeList, fn => {
  7271. // fn(apiResponse)
  7272. // })
  7273. // }
  7274. // export function getAllDomain() {
  7275. // return new Promise((resolve, reject) => {
  7276. // getColumnDomainApi()
  7277. // .then(res => {
  7278. // if (res.success) {
  7279. // columnDomain = res.data
  7280. // resolve(res.data)
  7281. // } else {
  7282. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  7283. // console.error('getColumnDomain', res.msg)
  7284. // }
  7285. //
  7286. // })
  7287. // .catch(e => {
  7288. // showErrorDialog('getColumnDomain error!')
  7289. // console.error('getColumnDomain', e)
  7290. // reject(e)
  7291. // })
  7292. // })
  7293. // }
  7294. var PROJECT_DICT_CACHE = {};
  7295. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  7296. /**
  7297. *项目运行时构建
  7298. **/
  7299. function createRuntime() {
  7300. {
  7301. // 已经构建过了
  7302. return new Promise(function (resolve) {
  7303. resolve();
  7304. });
  7305. }
  7306. }
  7307. function ReportRunner(reportId, setLoadingFn) {
  7308. return new Promise(function (resolve) {
  7309. setLoadingFn(true);
  7310. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  7311. // const {model, vjson, report} = buildVjson(res.data)
  7312. // const ret = new ReportScope({model, vjson})
  7313. // ret.report_id = reportId
  7314. // ret.report = report
  7315. // resolve(ret)
  7316. var _b = __read(_a, 1), res = _b[0];
  7317. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  7318. resolve(ret);
  7319. }).finally(function () {
  7320. setLoadingFn(false);
  7321. });
  7322. });
  7323. }
  7324. //gridCondition
  7325. //gridColumn
  7326. //gridSum
  7327. //sqlSumEditor
  7328. //sqlEditor
  7329. var ReportDesign = /** @class */ (function (_super) {
  7330. __extends(ReportDesign, _super);
  7331. function ReportDesign() {
  7332. return _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  7333. }
  7334. ReportDesign.prototype.onLoad = function () {
  7335. this.load();
  7336. };
  7337. ReportDesign.prototype.save = function (sender) {
  7338. var _this = this;
  7339. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  7340. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  7341. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  7342. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  7343. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  7344. var report = this.viewModel.get('report');
  7345. var data = {
  7346. report_id: this.viewModel.get('report_id'),
  7347. report_name: this.viewModel.get('report_name'),
  7348. report_enable: this.viewModel.get('report_enable'),
  7349. query_sql: this.viewModel.get('querySql'),
  7350. summary_sql: this.viewModel.get('summarySql'),
  7351. report: json5.stringify(report, null, ' '),
  7352. };
  7353. sender.setLoading(true);
  7354. saveReportApi(data).then(function (res) {
  7355. if (res.success) {
  7356. msg$1('保存成功');
  7357. _this.dialogSuccess(data);
  7358. _this.load();
  7359. }
  7360. }).finally(function () {
  7361. sender.setLoading(false);
  7362. });
  7363. };
  7364. ReportDesign.prototype.preview = function (sender) {
  7365. var reportId = this.viewModel.get('report_id');
  7366. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  7367. handles.mainWindow.showReportPreview(reportId, scope);
  7368. });
  7369. };
  7370. ReportDesign.prototype.load = function () {
  7371. var _this = this;
  7372. var reportId = this.viewModel.get('report_id');
  7373. this.setLoading(true);
  7374. reportByIdApi(reportId).then(function (res) {
  7375. 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;
  7376. if (report) {
  7377. report = json5.parse(report);
  7378. }
  7379. else {
  7380. report = {};
  7381. }
  7382. _this.viewModel.set('report_enable', report_enable);
  7383. _this.viewModel.set('report_name', report_name);
  7384. _this.viewModel.set('querySql', query_sql || '');
  7385. _this.viewModel.set('summarySql', summary_sql || '');
  7386. system.mergeViewModel(_this.viewModel, 'report', report, false);
  7387. var query = _this.viewModel.get('report.query') || [];
  7388. var columns = _this.viewModel.get('report.columns') || [];
  7389. var summary = _this.viewModel.get('report.summary') || [];
  7390. var querySql = _this.viewModel.get('querySql');
  7391. var summarySql = _this.viewModel.get('summarySql');
  7392. _this.refs.gridCondition.setData(query);
  7393. _this.refs.gridColumn.setData(columns);
  7394. _this.refs.gridSum.setData(summary);
  7395. _this.refs.sqlEditor.setCode(querySql);
  7396. _this.refs.sqlSumEditor.setCode(summarySql);
  7397. }).finally(function () {
  7398. _this.setLoading(false);
  7399. });
  7400. };
  7401. ReportDesign.prototype.addCondition = function () {
  7402. this.refs.gridCondition.appendEditRow({
  7403. conditionFieldBind: '',
  7404. conditionFieldLabel: '',
  7405. conditionFieldXtype: 'textfield',
  7406. conditionFieldFlex: 1,
  7407. conditionFieldDict: '',
  7408. conditionFieldWrap: false,
  7409. conditionFieldExtend: '{}',
  7410. }, 'conditionFieldBind');
  7411. };
  7412. ReportDesign.prototype.removeCondition = function () {
  7413. var _this = this;
  7414. var rows = [];
  7415. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  7416. rows.push(r);
  7417. });
  7418. _.forEach(rows, function (r) {
  7419. _this.refs.gridCondition.getStore().remove(r);
  7420. });
  7421. };
  7422. ReportDesign.prototype.moveUp = function (sender) {
  7423. var grid = sender.up('grid');
  7424. grid.rowMoveUp();
  7425. };
  7426. ReportDesign.prototype.moveDown = function (sender) {
  7427. var grid = sender.up('grid');
  7428. grid.rowMoveDown();
  7429. };
  7430. ReportDesign.prototype.calcCondition = function () {
  7431. var _this = this;
  7432. var sql = this.refs.sqlEditor.getCode();
  7433. var re = sql.matchAll(/#{(.+?)}/gi);
  7434. var rows = this.refs.gridCondition.getDataRows();
  7435. this.refs.gridCondition.setLoading(true);
  7436. Promise.all([
  7437. parseDynamicSqlApi(sql),
  7438. instance$1.reloadIfNeedPromise(),
  7439. ]).then(function (_a) {
  7440. var e_1, _b;
  7441. var _c = __read(_a, 1), res1 = _c[0];
  7442. if (res1.success) {
  7443. var tables_1 = [];
  7444. _.forEach(res1.data, function (parseItem) {
  7445. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7446. if (tableName && !_.includes(tables_1, tableName)) {
  7447. tables_1.push(tableName);
  7448. }
  7449. });
  7450. var _loop_1 = function (m) {
  7451. var e_2, _a;
  7452. var columnName = m[1];
  7453. // 没有这个列才添加
  7454. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  7455. var meta = undefined;
  7456. try {
  7457. 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()) {
  7458. var tableName = tables_2_1.value;
  7459. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7460. if (meta) {
  7461. break;
  7462. }
  7463. }
  7464. }
  7465. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  7466. finally {
  7467. try {
  7468. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  7469. }
  7470. finally { if (e_2) throw e_2.error; }
  7471. }
  7472. if (meta) {
  7473. // 找到元数据
  7474. var r = {
  7475. conditionFieldBind: meta.column_name,
  7476. conditionFieldLabel: meta.column_comment,
  7477. conditionFieldXtype: 'textfield',
  7478. conditionFieldFlex: 1,
  7479. conditionFieldDict: '',
  7480. conditionFieldWrap: false,
  7481. conditionFieldExtend: '{}',
  7482. };
  7483. if (meta.column_ui === 'combo' && meta.column_dict) {
  7484. r.conditionFieldXtype = 'combo';
  7485. r.conditionFieldDict = meta.column_dict;
  7486. }
  7487. else if (meta.column_ui === "checkbox") {
  7488. r.conditionFieldXtype = 'checkbox';
  7489. }
  7490. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7491. r.conditionFieldXtype = 'numberfield';
  7492. }
  7493. _this.refs.gridCondition.appendEditRow(r);
  7494. }
  7495. else {
  7496. // 没找到元数据,直接添加
  7497. _this.refs.gridCondition.appendEditRow({
  7498. conditionFieldBind: columnName,
  7499. conditionFieldLabel: '',
  7500. conditionFieldXtype: 'textfield',
  7501. conditionFieldFlex: 1,
  7502. conditionFieldDict: '',
  7503. conditionFieldWrap: false,
  7504. conditionFieldExtend: '{}',
  7505. });
  7506. }
  7507. }
  7508. };
  7509. try {
  7510. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  7511. var m = re_1_1.value;
  7512. _loop_1(m);
  7513. }
  7514. }
  7515. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  7516. finally {
  7517. try {
  7518. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  7519. }
  7520. finally { if (e_1) throw e_1.error; }
  7521. }
  7522. }
  7523. }).finally(function () {
  7524. _this.refs.gridCondition.setLoading(false);
  7525. });
  7526. };
  7527. ReportDesign.prototype.addColumn = function () {
  7528. this.refs.gridColumn.appendEditRow({
  7529. dataIndex: '',
  7530. header: '',
  7531. xtype: '',
  7532. dataType: '',
  7533. width: '',
  7534. dict: '',
  7535. align: '',
  7536. filterable: true,
  7537. hidden: false,
  7538. sortable: true,
  7539. fieldExtend: '{}',
  7540. }, 'header');
  7541. };
  7542. ReportDesign.prototype.removeColumn = function () {
  7543. var _this = this;
  7544. var rows = [];
  7545. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  7546. rows.push(r);
  7547. });
  7548. _.forEach(rows, function (r) {
  7549. _this.refs.gridColumn.getStore().remove(r);
  7550. });
  7551. };
  7552. ReportDesign.prototype.calcColumn = function () {
  7553. var _this = this;
  7554. var sql = this.refs.sqlEditor.getCode();
  7555. this.refs.gridColumn.setLoading(true);
  7556. var rows = this.refs.gridColumn.getDataRows();
  7557. Promise.all([
  7558. parseDynamicSqlApi(sql),
  7559. instance$1.reloadIfNeedPromise(),
  7560. ]).then(function (_a) {
  7561. var _b = __read(_a, 1), res1 = _b[0];
  7562. if (res1.success) {
  7563. _.forEach(res1.data, function (parseItem) {
  7564. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  7565. // 是否找到重复字段
  7566. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  7567. if (exists) {
  7568. if ((columnTypeName || "").toLowerCase() === "number") {
  7569. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  7570. if (record) {
  7571. record.set("dataType", "number");
  7572. record.set("align", "end");
  7573. }
  7574. }
  7575. return;
  7576. }
  7577. if (tableName) {
  7578. // 解出表格名和字段名
  7579. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7580. if (meta) {
  7581. // 找到了元数据
  7582. var r = {
  7583. dataIndex: meta.column_name,
  7584. header: meta.column_comment,
  7585. xtype: '',
  7586. dataType: '',
  7587. width: '',
  7588. dict: '',
  7589. align: '',
  7590. filterable: true,
  7591. hidden: false,
  7592. sortable: true,
  7593. fieldExtend: '{}',
  7594. };
  7595. if (meta.column_ui === 'combo' && meta.column_dict) {
  7596. r.dict = meta.column_dict;
  7597. }
  7598. else if (meta.column_ui === "checkbox") {
  7599. r.xtype = 'checkbox';
  7600. }
  7601. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7602. r.dataType = meta.data_type;
  7603. r.align = 'end';
  7604. }
  7605. if ((columnTypeName || "").toLowerCase() === "number") {
  7606. r.dataType = "number";
  7607. r.align = 'end';
  7608. }
  7609. _this.refs.gridColumn.appendEditRow(r);
  7610. return;
  7611. }
  7612. }
  7613. if (columnName) {
  7614. // 解出字段名
  7615. var r = {
  7616. dataIndex: columnName,
  7617. header: columnName,
  7618. xtype: '',
  7619. dataType: '',
  7620. width: '',
  7621. dict: '',
  7622. align: '',
  7623. filterable: true,
  7624. hidden: false,
  7625. sortable: true,
  7626. fieldExtend: '{}',
  7627. };
  7628. if ((columnTypeName || "").toLowerCase() === "number") {
  7629. r.dataType = "number";
  7630. r.align = 'end';
  7631. }
  7632. _this.refs.gridColumn.appendEditRow(r);
  7633. }
  7634. });
  7635. }
  7636. }).finally(function () {
  7637. _this.refs.gridColumn.setLoading(false);
  7638. });
  7639. };
  7640. ReportDesign.prototype.addSum = function () {
  7641. this.refs.gridSum.appendEditRow({
  7642. sumFieldBind: '',
  7643. sumFieldLabel: '',
  7644. sumFieldFlex: 1,
  7645. sumFieldWrap: false,
  7646. sumFieldExtend: '{}',
  7647. }, 'sumFieldBind');
  7648. };
  7649. ReportDesign.prototype.removeSum = function () {
  7650. var _this = this;
  7651. var rows = [];
  7652. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  7653. rows.push(r);
  7654. });
  7655. _.forEach(rows, function (r) {
  7656. _this.refs.gridSum.getStore().remove(r);
  7657. });
  7658. };
  7659. ReportDesign.prototype.calcSum = function () {
  7660. var _this = this;
  7661. var sql = this.refs.sqlSumEditor.getCode();
  7662. var rows = this.refs.gridSum.getDataRows();
  7663. this.refs.gridSum.setLoading(true);
  7664. parseDynamicSqlApi(sql).then(function (res1) {
  7665. if (res1.success) {
  7666. _.forEach(res1.data, function (parseItem) {
  7667. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7668. // 是否找到重复字段
  7669. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  7670. return;
  7671. }
  7672. if (columnName) {
  7673. // 解出字段名
  7674. _this.refs.gridSum.appendEditRow({
  7675. sumFieldBind: columnName,
  7676. sumFieldLabel: columnName,
  7677. sumFieldFlex: 1,
  7678. sumFieldWrap: false,
  7679. sumFieldExtend: '{}',
  7680. });
  7681. }
  7682. });
  7683. }
  7684. }).finally(function () {
  7685. _this.refs.gridSum.setLoading(false);
  7686. });
  7687. };
  7688. Object.defineProperty(ReportDesign.prototype, "reportId", {
  7689. get: function () {
  7690. return this.viewModel.get('report_id');
  7691. },
  7692. enumerable: true,
  7693. configurable: true
  7694. });
  7695. return ReportDesign;
  7696. }(Scope));
  7697. var model$5 = {
  7698. data: {
  7699. originalTableInfo: {
  7700. table_name: '',
  7701. description: '',
  7702. },
  7703. hasChanged: false,
  7704. schema_name: undefined,
  7705. table_name: undefined,
  7706. column_name: undefined,
  7707. tableInfo: {
  7708. schema_name: '',
  7709. table_name: '',
  7710. description: '',
  7711. biz_category: '',
  7712. note: '',
  7713. archive_enable: false,
  7714. archive_cron: '',
  7715. archive_condition: '',
  7716. column_list: []
  7717. },
  7718. },
  7719. formulas: {
  7720. shouldSave: function (get) {
  7721. // console.log("-->", get('grid1.ischanged'))
  7722. return get('grid1.ischanged')
  7723. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  7724. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  7725. },
  7726. },
  7727. };
  7728. var vjson$5 = {
  7729. bind: {
  7730. title: '{tableName}{shouldSave?" *":""}',
  7731. },
  7732. layout: 'fit',
  7733. items: [
  7734. {
  7735. layout: 'border',
  7736. tbar: {
  7737. xtype: 'toolbar',
  7738. items: [
  7739. // {
  7740. // xtype: 'button',
  7741. // text: '拉取库结构',
  7742. // iconCls: 'x-fa fa-cloud-download',
  7743. // listeners: {
  7744. // click: 'scope.pullFromDb'
  7745. // }
  7746. // },
  7747. {
  7748. xtype: 'button',
  7749. text: '保存至数据库',
  7750. iconCls: 'x-fa fa-save',
  7751. bind: {
  7752. disabled: '{!shouldSave}'
  7753. },
  7754. listeners: {
  7755. click: 'scope.pushToDb'
  7756. }
  7757. },
  7758. '-',
  7759. {
  7760. xtype: 'button',
  7761. text: '刷新 QueryDSL',
  7762. iconCls: 'x-fa fa-refresh',
  7763. listeners: {
  7764. click: 'scope.syncQueryDSL'
  7765. }
  7766. },
  7767. {
  7768. xtype: 'button',
  7769. text: '生成 DDL',
  7770. iconCls: 'x-fa fa-file-text',
  7771. listeners: {
  7772. click: 'scope.buildDDL'
  7773. }
  7774. }
  7775. ]
  7776. },
  7777. items: [
  7778. {
  7779. region: 'center',
  7780. xtype: 'tabpanel',
  7781. items: [
  7782. {
  7783. title: '字段',
  7784. xtype: 'yvgrid',
  7785. selModel: {
  7786. type: 'spreadsheet',
  7787. columnSelect: true,
  7788. pruneRemoved: false,
  7789. extensible: 'y'
  7790. },
  7791. enableLocking: false,
  7792. idField: 'column_name',
  7793. plugins: {
  7794. clipboard: true,
  7795. selectionreplicator: true
  7796. },
  7797. reference: 'grid1',
  7798. pagination: false,
  7799. // hideFootbar: true,
  7800. tbar: {
  7801. xtype: 'form',
  7802. items: [
  7803. {
  7804. xtype: 'cols',
  7805. items: [
  7806. {
  7807. xtype: 'textfield',
  7808. fieldLabel: '表格名',
  7809. reference: 'text_table_name',
  7810. readOnly: true,
  7811. bind: {
  7812. value: '{tableInfo.table_name}'
  7813. }
  7814. },
  7815. {
  7816. xtype: 'textfield',
  7817. fieldLabel: '描述',
  7818. // readOnly: true,
  7819. bind: {
  7820. value: '{tableInfo.description}'
  7821. }
  7822. },
  7823. ]
  7824. },
  7825. {
  7826. xtype: 'toolbar',
  7827. items: [
  7828. {
  7829. xtype: 'button',
  7830. text: '添加',
  7831. iconCls: 'x-fa fa-plus-circle',
  7832. listeners: {
  7833. click: 'scope.addField'
  7834. }
  7835. },
  7836. {
  7837. xtype: 'button',
  7838. text: '删除',
  7839. iconCls: 'x-fa fa-minus-circle',
  7840. listeners: {
  7841. click: 'scope.removeField'
  7842. }
  7843. },
  7844. ]
  7845. },
  7846. ]
  7847. },
  7848. listeners: {
  7849. editbefore: 'scope.gridEditBefore'
  7850. },
  7851. columns: [
  7852. {
  7853. text: '字段名', dataIndex: 'column_name',
  7854. sortable: false,
  7855. menuDisabled: true,
  7856. width: 120,
  7857. editor: {
  7858. allowBlank: true,
  7859. selectOnFocus: false
  7860. }
  7861. },
  7862. {
  7863. text: '字段中文', dataIndex: 'column_comment',
  7864. width: 130,
  7865. sortable: false,
  7866. menuDisabled: true,
  7867. editor: {
  7868. allowBlank: true,
  7869. selectOnFocus: false
  7870. }
  7871. },
  7872. {
  7873. text: '主键', dataIndex: 'is_primary_key',
  7874. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7875. width: 48, resizable: false,
  7876. },
  7877. {
  7878. text: '必填', dataIndex: 'not_null',
  7879. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7880. width: 48, resizable: false,
  7881. },
  7882. {
  7883. text: '字段域', dataIndex: 'column_domain',
  7884. sortable: false, menuDisabled: true,
  7885. width: 148,
  7886. dict: 'column_domain',
  7887. editor: {
  7888. xtype: 'combo',
  7889. allowBlank: true,
  7890. selectOnFocus: true,
  7891. // fix: ['system.getDict("column_domain")'],
  7892. dict: 'column_domain',
  7893. listConfig: {
  7894. minWidth: 200
  7895. },
  7896. listeners: {
  7897. change: 'scope.columnDomainChange',
  7898. }
  7899. }
  7900. },
  7901. {
  7902. text: '数据类型', dataIndex: 'data_type',
  7903. sortable: false, menuDisabled: true,
  7904. editor: { allowBlank: true, selectOnFocus: true }
  7905. },
  7906. {
  7907. text: '长度', dataIndex: 'column_size',
  7908. sortable: false, menuDisabled: true,
  7909. xtype: 'numbercolumn', format: '0',
  7910. editor: { allowBlank: true, selectOnFocus: true }
  7911. },
  7912. {
  7913. text: '小数位', dataIndex: 'decimal_digits',
  7914. sortable: false, menuDisabled: true,
  7915. xtype: 'numbercolumn', format: '0',
  7916. editor: { allowBlank: true, selectOnFocus: true }
  7917. },
  7918. {
  7919. text: '默认值', dataIndex: 'default_value',
  7920. sortable: false, menuDisabled: true,
  7921. editor: { allowBlank: true, selectOnFocus: true }
  7922. },
  7923. {
  7924. text: '字典', dataIndex: 'column_dict',
  7925. sortable: false, menuDisabled: true,
  7926. // fix: ['system.getDict("DICT")'],
  7927. width: 200,
  7928. editor: {
  7929. xtype: 'combo',
  7930. allowBlank: true,
  7931. listConfig: {
  7932. minWidth: 350
  7933. },
  7934. }
  7935. },
  7936. {
  7937. text: 'UI建议', dataIndex: 'column_ui',
  7938. sortable: false, menuDisabled: true,
  7939. // fix: ['system.getDict("column_ui")'],
  7940. editor: {
  7941. xtype: 'combo',
  7942. allowBlank: true,
  7943. listConfig: {
  7944. minWidth: 200
  7945. },
  7946. }
  7947. },
  7948. {
  7949. text: '详细描述', dataIndex: 'column_note',
  7950. sortable: false, menuDisabled: true,
  7951. editor: { allowBlank: true, }
  7952. },
  7953. ]
  7954. },
  7955. {
  7956. title: '高级属性',
  7957. xtype: 'form',
  7958. items: [
  7959. // {
  7960. // xtype: 'textfield',
  7961. // fieldLabel: '表格名',
  7962. // bind: {
  7963. // value: '{tableName}'
  7964. // }
  7965. // },
  7966. // {
  7967. // xtype: 'textfield',
  7968. // fieldLabel: '中文含义',
  7969. // bind: {
  7970. // value: '{tableInfo.description}'
  7971. // }
  7972. // },
  7973. {
  7974. xtype: 'combo',
  7975. fieldLabel: '业务类型',
  7976. bind: {
  7977. value: '{tableInfo.biz_category}'
  7978. },
  7979. store: [
  7980. '基础资料',
  7981. '系统',
  7982. '账目与库存',
  7983. '单据',
  7984. '指令',
  7985. '规则与流程',
  7986. '开发辅助',
  7987. ]
  7988. },
  7989. {
  7990. xtype: 'textfield',
  7991. fieldLabel: '详细描述',
  7992. bind: {
  7993. value: '{tableInfo.note}'
  7994. },
  7995. },
  7996. {
  7997. xtype: 'checkbox',
  7998. fieldLabel: '允许归档',
  7999. bind: "{tableInfo.archive_enable}",
  8000. },
  8001. {
  8002. xtype: 'textfield',
  8003. fieldLabel: '归档周期',
  8004. bind: {
  8005. value: '{tableInfo.archive_cron}',
  8006. hidden: '{!tableInfo.archive_enable}',
  8007. }
  8008. },
  8009. {
  8010. xtype: 'textfield',
  8011. fieldLabel: '归档条件',
  8012. bind: {
  8013. value: '{tableInfo.archive_condition}',
  8014. hidden: '{!tableInfo.archive_enable}',
  8015. }
  8016. },
  8017. ]
  8018. },
  8019. ]
  8020. }
  8021. ]
  8022. },
  8023. ]
  8024. };
  8025. var DbColumn = /** @class */ (function (_super) {
  8026. __extends(DbColumn, _super);
  8027. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  8028. var _this = _super.call(this, {
  8029. model: getModel(model$5, schemaName, tableName, columnName, isCreateTable),
  8030. vjson: vjson$5
  8031. }) || this;
  8032. _this.isCreate = false;
  8033. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  8034. return _this;
  8035. }
  8036. DbColumn.prototype.onLoad = function () {
  8037. var _this = this;
  8038. var _a, _b, _c, _d, _e, _f, _g, _h;
  8039. console.log('me', this);
  8040. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  8041. this.refs.grid1.autoSizeColumns();
  8042. // this.refs.grid1.columns[0].hide()
  8043. // 自动定位到选定的列
  8044. if (this.viewModel.get('column_name')) {
  8045. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  8046. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  8047. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  8048. return;
  8049. }
  8050. }
  8051. }
  8052. instance.getColumnDomainComboData().then(function () {
  8053. _this.checkDomain();
  8054. });
  8055. 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 : "");
  8056. 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 : "");
  8057. if (this.isCreate)
  8058. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  8059. };
  8060. DbColumn.prototype.checkDomain = function () {
  8061. // 走查一遍 domain
  8062. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8063. var dbType = this.viewModel.get('tableInfo.db_type');
  8064. var diffColumnName = [];
  8065. var tableInfo = this.viewModel.get('tableInfo');
  8066. this.refs.grid1.store.data.items.forEach(function (record) {
  8067. var data = record.data;
  8068. var column_domain = data.column_domain;
  8069. var domain = instance.getColumnDomainById(column_domain);
  8070. if (!domain) {
  8071. // 没有找到 domain
  8072. return;
  8073. }
  8074. var editRow = applyDomain(dbType, domain);
  8075. // 字段跟领域做对比
  8076. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  8077. if (typeof compareResult === 'string') {
  8078. // 不一样的情况下,要改成一致
  8079. _$2.forOwn(editRow, function (value, key) {
  8080. // 改成与 domain 一致
  8081. record.set(key, value);
  8082. });
  8083. diffColumnName.push(data.column_name + '.' + compareResult);
  8084. }
  8085. });
  8086. if (diffColumnName.length > 0) {
  8087. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  8088. }
  8089. };
  8090. DbColumn.prototype.addField = function () {
  8091. this.refs.grid1.appendEditRow({
  8092. column_name: '',
  8093. column_comment: '',
  8094. is_primary_key: false,
  8095. not_null: true,
  8096. column_domain: '',
  8097. data_type: '',
  8098. column_size: 0,
  8099. decimal_digits: 0,
  8100. default_value: '',
  8101. column_dict: '',
  8102. column_ui: '',
  8103. column_note: '',
  8104. }, 'column_name');
  8105. };
  8106. DbColumn.prototype.removeField = function () {
  8107. var _this = this;
  8108. var rows = [];
  8109. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  8110. rows.push(r);
  8111. });
  8112. _$2.forEach(rows, function (r) {
  8113. _this.refs.grid1.getStore().remove(r);
  8114. });
  8115. };
  8116. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  8117. instance.getColumnDomainComboData().then(function (data) {
  8118. editor.cmp.columns[5].getEditor().setStore({ data: data });
  8119. });
  8120. // 被字段域锁定的内容,不允许修改
  8121. var record = context.record, field = context.field;
  8122. var domainId = record.get('column_domain');
  8123. if (!domainId) {
  8124. return;
  8125. }
  8126. var domain = instance.getColumnDomainById(domainId);
  8127. if (!domain) {
  8128. msg$1('没有找到字段域' + domainId);
  8129. return;
  8130. }
  8131. if (field === "data_type") {
  8132. // 字段类型不允许修改
  8133. context.cancel = true;
  8134. return;
  8135. }
  8136. if (domain.is_fix_size &&
  8137. (field === "column_size" ||
  8138. field === "decimal_digits")) {
  8139. // 锁定长度的情况下,大小不允许修改
  8140. context.cancel = true;
  8141. return;
  8142. }
  8143. if (domain.is_fix_default_value && field === "default_value") {
  8144. // 锁定默认值的情况下,默认值不允许修改
  8145. context.cancel = true;
  8146. return;
  8147. }
  8148. };
  8149. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  8150. if (!newValue) {
  8151. return;
  8152. }
  8153. var grid = editor.up('grid').ownerGrid;
  8154. var domain = instance.getColumnDomainById(newValue);
  8155. if (!domain) {
  8156. msg$1('没有找到 domain:' + newValue);
  8157. return;
  8158. }
  8159. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8160. var dbType = this.viewModel.get('tableInfo.db_type');
  8161. var editRow = applyDomain(dbType, domain);
  8162. grid.setEditRow(editRow);
  8163. };
  8164. DbColumn.prototype.pullFromDb = function () {
  8165. };
  8166. DbColumn.prototype.pushToDb = function (sender) {
  8167. var _this = this;
  8168. // 设置当前界面为 "保存中..." 状态
  8169. var me = this;
  8170. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  8171. this.viewModel.set('tableInfo.table_name', table_name);
  8172. this.viewModel.set('tableInfo.schema_name', schema_name);
  8173. var tableInfo = this.viewModel.get('tableInfo');
  8174. var column_list = this.refs.grid1.getDataRows();
  8175. var hasError = false;
  8176. if (column_list.length <= 0) {
  8177. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  8178. hasError = true;
  8179. }
  8180. var columnNameExistsCheck = {};
  8181. _$2.forEach(column_list, function (row, i) {
  8182. var checkResult = checkColumn(tableInfo, row);
  8183. if (typeof checkResult !== 'undefined') {
  8184. msg$1(checkResult);
  8185. hasError = true;
  8186. _this.refs.grid1.beginEdit(i, 'column_name');
  8187. return false;
  8188. }
  8189. if (!row.column_domain || row.column_domain === '0') {
  8190. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  8191. hasError = true;
  8192. _this.refs.grid1.beginEdit(i, 'column_domain');
  8193. return false;
  8194. }
  8195. if (isEmpty(row.data_type)) {
  8196. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  8197. hasError = true;
  8198. _this.refs.grid1.beginEdit(i, 'data_type');
  8199. return false;
  8200. }
  8201. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  8202. // 列名已存在
  8203. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  8204. hasError = true;
  8205. _this.refs.grid1.beginEdit(i, 'column_name');
  8206. return false;
  8207. }
  8208. columnNameExistsCheck[row.column_name] = true;
  8209. });
  8210. if (hasError)
  8211. return;
  8212. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  8213. me.setLoading(true);
  8214. instance$1.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  8215. .then(function (res) {
  8216. var _a;
  8217. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  8218. // 返回 DDL 就要显示出来
  8219. var window_1 = Ext.create('Ext.window.Window', {
  8220. title: 'SQL 预览',
  8221. height: 400,
  8222. width: 600,
  8223. modal: true,
  8224. animateTarget: sender,
  8225. maximizable: true,
  8226. layout: 'fit',
  8227. items: {
  8228. xtype: 'sqleditor',
  8229. value: res.data.ddl
  8230. },
  8231. buttons: [
  8232. {
  8233. xtype: 'button',
  8234. text: '执行',
  8235. iconCls: 'x-fa fa-save',
  8236. handler: function (sender) {
  8237. var editor = sender.up('window').down('sqleditor');
  8238. var ddl = editor.getValue();
  8239. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  8240. }
  8241. },
  8242. {
  8243. xtype: 'button',
  8244. text: '取消',
  8245. iconCls: 'x-fa fa-times',
  8246. handler: function () {
  8247. window_1.close();
  8248. }
  8249. }
  8250. ]
  8251. }).show();
  8252. return;
  8253. }
  8254. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8255. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8256. if (!tableRow) {
  8257. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8258. console.log('这是一个新 table');
  8259. instance$1.appendNewTable(tableInfo);
  8260. }
  8261. _this.viewModel.set('schema_name', schema_name);
  8262. _this.viewModel.set('table_name', table_name);
  8263. _this.viewModel.set('tableInfo', tableInfo);
  8264. _this.refs.grid1.setData(tableInfo.column_list);
  8265. if (tableRow)
  8266. Object.assign(tableRow, tableInfo);
  8267. msg$1('保存成功');
  8268. _this.viewModel.set('hasChanged', false);
  8269. })
  8270. .finally(function () {
  8271. me.setLoading(false);
  8272. });
  8273. };
  8274. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  8275. var _this = this;
  8276. window.setLoading(true);
  8277. instance$1.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  8278. .then(function (res) {
  8279. var _a, _b, _c, _d;
  8280. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8281. // 保存成功就提示一下,并重新载入数据
  8282. msg$1(res.msg);
  8283. instance$1.reloadForce(undefined);
  8284. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8285. if (!tableRow) {
  8286. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8287. console.log('这是一个新 table');
  8288. instance$1.appendNewTable(tableInfo);
  8289. }
  8290. _this.viewModel.set('schema_name', schema_name);
  8291. _this.viewModel.set('table_name', table_name);
  8292. _this.viewModel.set('tableInfo', tableInfo);
  8293. _this.refs.grid1.setData(tableInfo.column_list);
  8294. if (tableRow)
  8295. Object.assign(tableRow, tableInfo);
  8296. instance$1.notifyRefresh();
  8297. window.close();
  8298. _this.viewModel.set('hasChanged', false);
  8299. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  8300. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  8301. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  8302. })
  8303. .finally(function () {
  8304. // 无论正常异常,关闭 "保存中..." 状态
  8305. window.setLoading(false);
  8306. });
  8307. };
  8308. DbColumn.prototype.syncQueryDSL = function () {
  8309. var _this = this;
  8310. var tableInfo = this.viewModel.get("tableInfo");
  8311. this.setLoading(true);
  8312. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  8313. .then(function () {
  8314. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  8315. })
  8316. .finally(function () {
  8317. _this.setLoading(false);
  8318. });
  8319. };
  8320. DbColumn.prototype.buildDDL = function () {
  8321. };
  8322. return DbColumn;
  8323. }(Scope));
  8324. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  8325. model.data.schema_name = schemaName;
  8326. model.data.table_name = tableName;
  8327. model.data.column_name = columnName;
  8328. if (isCreateTable) {
  8329. var dbType = instance$1.getSchemaDbType(schemaName);
  8330. if (!dbType) {
  8331. throw Error('无法识别数据库类型' + schemaName);
  8332. }
  8333. model.data.tableInfo.schema_name = model.data.schema_name;
  8334. model.data.tableInfo.table_name = model.data.table_name;
  8335. model.data.tableInfo.db_type = dbType;
  8336. model.data.tableInfo.column_list = [];
  8337. model.data.tableInfo.is_create = true;
  8338. return model;
  8339. }
  8340. var tableRow = instance$1.getTableByName(schemaName, tableName);
  8341. if (!tableRow) {
  8342. throw Error('没有找到 table' + schemaName + tableName + columnName);
  8343. }
  8344. model.data.tableInfo = _$2.cloneDeep(tableRow);
  8345. model.data.tableInfo.is_create = false;
  8346. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  8347. return model;
  8348. }
  8349. var model$6 = {
  8350. data: {
  8351. id: '',
  8352. path: '',
  8353. form: {
  8354. title: '',
  8355. sqlId: '',
  8356. }
  8357. }
  8358. };
  8359. var vjson$6 = {
  8360. bind: {
  8361. title: '{title}',
  8362. },
  8363. layout: 'fit',
  8364. items: [
  8365. {
  8366. layout: 'border',
  8367. items: [
  8368. {
  8369. region: 'center',
  8370. layout: 'border',
  8371. items: [
  8372. {
  8373. region: 'north',
  8374. items: [
  8375. {
  8376. xtype: 'toolbar',
  8377. border: false,
  8378. items: [
  8379. {
  8380. xtype: 'button',
  8381. text: '刷新',
  8382. iconCls: 'x-fa fa-refresh',
  8383. listeners: {
  8384. click: 'scope.load'
  8385. }
  8386. },
  8387. {
  8388. xtype: 'button',
  8389. text: '保存',
  8390. iconCls: 'x-fa fa-save',
  8391. listeners: {
  8392. click: 'scope.widgetSave'
  8393. }
  8394. },
  8395. {
  8396. xtype: 'button',
  8397. text: '预览',
  8398. iconCls: 'x-fa fa-play-circle-o',
  8399. listeners: {
  8400. //click: 'scope.preview'
  8401. }
  8402. },
  8403. {
  8404. xtype: 'textfield',
  8405. fieldLabel: '弹窗文件',
  8406. reference: "wPath",
  8407. labelWidth: 80,
  8408. //width: 200,
  8409. bind: {
  8410. value: '{widgetPath}',
  8411. },
  8412. readOnly: true,
  8413. },
  8414. {
  8415. xtype: 'textfield',
  8416. fieldLabel: '弹窗名称',
  8417. reference: "wTitle",
  8418. labelWidth: 80,
  8419. //width: 200,
  8420. bind: {
  8421. value: '{form.title}',
  8422. },
  8423. readOnly: true,
  8424. },
  8425. {
  8426. xtype: 'textfield',
  8427. fieldLabel: 'sqlId',
  8428. bind: {
  8429. value: '{form.sqlId}',
  8430. },
  8431. readOnly: true,
  8432. },
  8433. ]
  8434. },
  8435. ]
  8436. },
  8437. {
  8438. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  8439. items: [
  8440. {
  8441. title: "SQL和条件",
  8442. layout: 'border',
  8443. border: false,
  8444. items: [
  8445. {
  8446. region: 'north',
  8447. height: 200,
  8448. xtype: 'yvgrid',
  8449. reference: "grid2",
  8450. split: true,
  8451. selModel: {
  8452. selType: 'rowmodel',
  8453. mode: 'SINGLE',
  8454. },
  8455. store: {},
  8456. pagination: false,
  8457. hideFootbar: true,
  8458. tbar: {
  8459. xtype: 'toolbar',
  8460. items: [
  8461. {
  8462. xtype: 'button',
  8463. text: '添加',
  8464. iconCls: 'x-fa fa-plus-circle',
  8465. listeners: {}
  8466. },
  8467. {
  8468. xtype: 'button',
  8469. text: '删除',
  8470. iconCls: 'x-fa fa-minus-circle',
  8471. listeners: {
  8472. click: 'scope.delCondition'
  8473. }
  8474. },
  8475. '-',
  8476. {
  8477. xtype: 'button',
  8478. text: '上移',
  8479. iconCls: 'x-fa fa-refresh',
  8480. listeners: {
  8481. //click: 'scope.saveAll'
  8482. }
  8483. },
  8484. {
  8485. xtype: 'button',
  8486. text: '下移',
  8487. iconCls: 'x-fa fa-refresh',
  8488. listeners: {
  8489. //click: 'scope.saveAll'
  8490. }
  8491. },
  8492. '-',
  8493. {
  8494. xtype: 'button',
  8495. text: '自动分析',
  8496. iconCls: 'x-fa fa-refresh',
  8497. listeners: {
  8498. click: 'scope.calcCondition'
  8499. }
  8500. },
  8501. ]
  8502. },
  8503. columns: [
  8504. {
  8505. text: '条件变量',
  8506. dataIndex: 'conditionFieldBind',
  8507. width: 140,
  8508. sortable: false,
  8509. menuDisabled: true,
  8510. editor: {
  8511. selectOnFocus: true
  8512. },
  8513. },
  8514. {
  8515. text: '中文标题',
  8516. dataIndex: 'conditionFieldLabel',
  8517. width: 120,
  8518. sortable: false,
  8519. menuDisabled: true,
  8520. editor: {
  8521. selectOnFocus: true
  8522. },
  8523. },
  8524. {
  8525. text: '编辑类型',
  8526. dataIndex: 'xtype',
  8527. sortable: false,
  8528. menuDisabled: true,
  8529. editor: {
  8530. xtype: 'combo',
  8531. typeAhead: true,
  8532. triggerAction: 'all',
  8533. selectOnFocus: true,
  8534. store: [
  8535. ['textfield', 'textfield'],
  8536. ['combo', 'combo'],
  8537. ['datefield', 'datefield'],
  8538. ['datetimefield', 'datetimefield'],
  8539. ['numberfield', 'numberfield'],
  8540. ['multiplesearch', 'multiplesearch'],
  8541. ]
  8542. }
  8543. },
  8544. {
  8545. text: '权重',
  8546. dataIndex: 'conditionFieldFlex',
  8547. align: 'right',
  8548. sortable: false,
  8549. menuDisabled: true,
  8550. editor: {
  8551. xtype: 'numberfield',
  8552. selectOnFocus: false,
  8553. minValue: 0,
  8554. maxValue: 10
  8555. },
  8556. },
  8557. {
  8558. text: '字典',
  8559. dataIndex: 'conditionFieldDict',
  8560. width: 160,
  8561. sortable: false,
  8562. menuDisabled: true,
  8563. editor: {
  8564. selectOnFocus: false
  8565. },
  8566. },
  8567. {
  8568. xtype: 'checkcolumn',
  8569. dataIndex: "conditionFieldWrap", header: "换行",
  8570. width: 65,
  8571. sortable: false,
  8572. menuDisabled: true,
  8573. },
  8574. ]
  8575. },
  8576. {
  8577. region: 'center',
  8578. xtype: 'sqleditor',
  8579. layout: 'fit',
  8580. reference: 'sqlEditor',
  8581. split: true,
  8582. bind: {
  8583. value: "{form.sql}"
  8584. },
  8585. },
  8586. ]
  8587. },
  8588. {
  8589. title: "结果字段定义",
  8590. border: false,
  8591. xtype: 'yvgrid',
  8592. reference: "grid3",
  8593. selModel: {
  8594. selType: 'rowmodel',
  8595. mode: 'SINGLE',
  8596. },
  8597. store: {},
  8598. pagination: false,
  8599. hideFootbar: true,
  8600. tbar: {
  8601. xtype: 'toolbar',
  8602. items: [
  8603. {
  8604. xtype: 'button',
  8605. text: '添加',
  8606. iconCls: 'x-fa fa-plus-circle',
  8607. listeners: {}
  8608. },
  8609. {
  8610. xtype: 'button',
  8611. text: '删除',
  8612. iconCls: 'x-fa fa-minus-circle',
  8613. listeners: {
  8614. click: 'scope.delColumn'
  8615. }
  8616. },
  8617. '-',
  8618. {
  8619. xtype: 'button',
  8620. text: '上移',
  8621. iconCls: 'x-fa fa-refresh',
  8622. listeners: {
  8623. //click: 'scope.saveAll'
  8624. }
  8625. },
  8626. {
  8627. xtype: 'button',
  8628. text: '下移',
  8629. iconCls: 'x-fa fa-refresh',
  8630. listeners: {
  8631. //click: 'scope.saveAll'
  8632. }
  8633. },
  8634. '-',
  8635. {
  8636. xtype: 'button',
  8637. text: '自动分析',
  8638. iconCls: 'x-fa fa-refresh',
  8639. listeners: {
  8640. click: 'scope.calcColumn'
  8641. }
  8642. },
  8643. ]
  8644. },
  8645. columns: [
  8646. { xtype: 'rownumberer' },
  8647. {
  8648. text: '字段',
  8649. dataIndex: 'dataIndex',
  8650. width: 140,
  8651. sortable: false,
  8652. menuDisabled: true,
  8653. editor: {
  8654. selectOnFocus: true
  8655. },
  8656. },
  8657. {
  8658. text: '标题',
  8659. dataIndex: 'header',
  8660. width: 120,
  8661. sortable: false,
  8662. menuDisabled: true,
  8663. editor: {
  8664. selectOnFocus: true
  8665. },
  8666. },
  8667. {
  8668. text: '显示类型',
  8669. dataIndex: 'xtype',
  8670. width: 90,
  8671. sortable: false,
  8672. menuDisabled: true,
  8673. editor: {
  8674. xtype: 'combo',
  8675. typeAhead: true,
  8676. triggerAction: 'all',
  8677. selectOnFocus: true,
  8678. store: [
  8679. ['', ''],
  8680. ['rownum', 'rownum'],
  8681. ['button', 'button'],
  8682. ['checkbox', 'checkbox'],
  8683. ['progres', 'progres'],
  8684. ]
  8685. }
  8686. },
  8687. {
  8688. text: '数据类型',
  8689. dataIndex: 'dataType',
  8690. width: 90,
  8691. sortable: false,
  8692. menuDisabled: true,
  8693. editor: {
  8694. xtype: 'combo',
  8695. typeAhead: true,
  8696. triggerAction: 'all',
  8697. selectOnFocus: true,
  8698. store: [
  8699. ['', ''],
  8700. ['string', 'string'],
  8701. ['number', 'number'],
  8702. ['date', 'date'],
  8703. ]
  8704. }
  8705. },
  8706. {
  8707. text: '数据字典',
  8708. dataIndex: 'dict',
  8709. sortable: false,
  8710. menuDisabled: true,
  8711. width: 120,
  8712. editor: {
  8713. selectOnFocus: true,
  8714. },
  8715. },
  8716. ],
  8717. },
  8718. ]
  8719. },
  8720. ]
  8721. },
  8722. ]
  8723. }
  8724. ]
  8725. }; //
  8726. //
  8727. var WidgetDesign = /** @class */ (function (_super) {
  8728. __extends(WidgetDesign, _super);
  8729. function WidgetDesign(widgetPath, widgetName) {
  8730. var _this = _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  8731. _this.widgetPath = widgetPath;
  8732. _this.widgetName = widgetName;
  8733. return _this;
  8734. }
  8735. WidgetDesign.prototype.onLoad = function () {
  8736. if (this.widgetPath) {
  8737. this.loadForm(this.widgetPath);
  8738. this.viewModel.set("widgetPath", this.widgetPath);
  8739. this.refs.wTitle.setReadOnly(true);
  8740. this.refs.wPath.setReadOnly(true);
  8741. }
  8742. else {
  8743. this.refs.wTitle.setReadOnly(false);
  8744. this.refs.wPath.setReadOnly(false);
  8745. }
  8746. };
  8747. WidgetDesign.prototype.load = function () {
  8748. var widgetPath = this.viewModel.get("widgetPath");
  8749. if (widgetPath) {
  8750. this.loadForm(widgetPath);
  8751. }
  8752. };
  8753. WidgetDesign.prototype.loadForm = function (widgetPath) {
  8754. var _this = this;
  8755. var me = this;
  8756. me.setLoading(true);
  8757. readWidget({ widgetPath: widgetPath }).then(function (res) {
  8758. msg$1(res.msg);
  8759. if (res.success) {
  8760. _this.viewModel.set("widgetPath", widgetPath);
  8761. me.refs.grid3.getStore().removeAll();
  8762. if (res.data.form.columns) {
  8763. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  8764. }
  8765. _this.viewModel.set("form.title", res.data.form.title);
  8766. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  8767. // set sql
  8768. _this.refs.sqlEditor.setCode(res.data.sql);
  8769. }
  8770. }).finally(function () {
  8771. me.setLoading(false);
  8772. });
  8773. };
  8774. WidgetDesign.prototype.widgetAdd = function (sender) {
  8775. var _this = this;
  8776. var title = this.viewModel.get("form.title");
  8777. if (title) {
  8778. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  8779. if (btn == 'yes') {
  8780. alert(1);
  8781. }
  8782. else {
  8783. alert(2);
  8784. }
  8785. });
  8786. }
  8787. else {
  8788. var me_1 = this;
  8789. var win_1 = new Ext.Window({
  8790. autoDestroy: true,
  8791. title: "新建弹框",
  8792. width: 400,
  8793. height: 220,
  8794. resizable: true,
  8795. closable: true,
  8796. maximizable: true,
  8797. minimizable: true,
  8798. plain: true,
  8799. // constrainHeader: true,
  8800. constrain: true,
  8801. layout: 'fit',
  8802. animateTarget: sender,
  8803. buttonAlign: 'center',
  8804. items: [
  8805. {
  8806. xtype: "form",
  8807. layout: "hbox",
  8808. margin: '10px 20px',
  8809. border: 0,
  8810. items: [
  8811. {
  8812. flex: 1,
  8813. layout: 'vbox',
  8814. items: [
  8815. {
  8816. xtype: "textfield",
  8817. name: "widgetcode",
  8818. fieldLabel: "弹框编号",
  8819. flex: 1,
  8820. allowBlank: false,
  8821. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  8822. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  8823. labelWidth: 50,
  8824. width: "100%",
  8825. },
  8826. {
  8827. xtype: "textfield",
  8828. name: "widgetname",
  8829. fieldLabel: "弹框名称",
  8830. flex: 1,
  8831. allowBlank: false,
  8832. labelWidth: 50,
  8833. width: "100%",
  8834. },
  8835. ]
  8836. },
  8837. ]
  8838. }
  8839. ],
  8840. //窗口按钮
  8841. buttons: [
  8842. {
  8843. xtype: 'button', text: '保存', handler: function (btn) {
  8844. //窗口获取表单
  8845. var form = win_1.down('form');
  8846. var vaildSuccess = form.isValid();
  8847. if (!vaildSuccess) {
  8848. return;
  8849. }
  8850. var title = form.down('textfield[name="widgetname"]').getValue();
  8851. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  8852. me_1.viewModel.set("form.title", title);
  8853. me_1.viewModel.set("widgetPath", widgetPath);
  8854. var formdata = _this.viewModel.get("form");
  8855. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  8856. if (res.success) {
  8857. msg$1('添加成功');
  8858. }
  8859. me_1.loadForm(widgetPath);
  8860. win_1.close();
  8861. });
  8862. }
  8863. },
  8864. {
  8865. xtype: 'button', text: '取消', handler: function (btn) {
  8866. //窗口关闭
  8867. win_1.close();
  8868. }
  8869. }
  8870. ]
  8871. });
  8872. win_1.show();
  8873. }
  8874. };
  8875. WidgetDesign.prototype.widgetSave = function () {
  8876. var _this = this;
  8877. var _a, _b;
  8878. var widgetPath = this.viewModel.get("widgetPath");
  8879. if (!widgetPath) {
  8880. msg$1("请选择或添加弹框后再保存!");
  8881. return;
  8882. }
  8883. var title = this.viewModel.get("form.title");
  8884. if (!title) {
  8885. msg$1("请选择或添加弹框后再保存!");
  8886. return;
  8887. }
  8888. // 获取条件
  8889. 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) {
  8890. delete r.id;
  8891. return r;
  8892. });
  8893. this.viewModel.set("form.conditions", conditions);
  8894. // 获取查询列
  8895. 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) {
  8896. delete r.id;
  8897. if (r.dict) {
  8898. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  8899. }
  8900. return r;
  8901. });
  8902. this.viewModel.set("form.columns", columns);
  8903. // sql
  8904. var sql = this.refs.sqlEditor.getCode();
  8905. this.viewModel.set("form.sql", sql);
  8906. var form = this.viewModel.get("form");
  8907. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  8908. msg$1(res.msg);
  8909. if (res.success) {
  8910. msg$1('保存成功');
  8911. _this.loadForm(widgetPath);
  8912. }
  8913. }).catch(function (res) {
  8914. });
  8915. };
  8916. WidgetDesign.prototype.delCondition = function () {
  8917. var _a;
  8918. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8919. };
  8920. WidgetDesign.prototype.delColumn = function () {
  8921. var _a;
  8922. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8923. };
  8924. WidgetDesign.prototype.calcCondition = function () {
  8925. var _this = this;
  8926. var sql = this.refs.sqlEditor.getCode();
  8927. var re = sql.matchAll(/#{(.+?)}/gi);
  8928. var rows = this.refs.grid2.getDataRows();
  8929. this.refs.grid2.setLoading(true);
  8930. parseDynamicSqlApi(sql).then(function (res) {
  8931. var e_1, _a;
  8932. if (res.success) {
  8933. var tables_1 = [];
  8934. _.forEach(res.data, function (parseItem) {
  8935. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  8936. if (tableName && !_.includes(tables_1, tableName)) {
  8937. tables_1.push(tableName);
  8938. }
  8939. });
  8940. var _loop_1 = function (m) {
  8941. var e_2, _a;
  8942. var columnName = m[1];
  8943. // 没有这个列才添加
  8944. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  8945. var meta = undefined;
  8946. try {
  8947. 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()) {
  8948. var tableName = tables_2_1.value;
  8949. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  8950. if (meta) {
  8951. break;
  8952. }
  8953. }
  8954. }
  8955. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  8956. finally {
  8957. try {
  8958. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  8959. }
  8960. finally { if (e_2) throw e_2.error; }
  8961. }
  8962. if (meta) {
  8963. // 没找到元数据,直接添加
  8964. _this.refs.grid2.appendEditRow({
  8965. conditionFieldBind: columnName,
  8966. conditionFieldLabel: meta.column_comment,
  8967. conditionFieldXtype: 'textfield',
  8968. conditionFieldFlex: 1,
  8969. conditionFieldDict: '',
  8970. conditionFieldWrap: false,
  8971. });
  8972. }
  8973. else {
  8974. _this.refs.grid2.appendEditRow({
  8975. conditionFieldBind: columnName,
  8976. conditionFieldLabel: '',
  8977. conditionFieldXtype: 'textfield',
  8978. conditionFieldFlex: 1,
  8979. conditionFieldDict: '',
  8980. conditionFieldWrap: false,
  8981. });
  8982. }
  8983. }
  8984. };
  8985. try {
  8986. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  8987. var m = re_1_1.value;
  8988. _loop_1(m);
  8989. }
  8990. }
  8991. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  8992. finally {
  8993. try {
  8994. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  8995. }
  8996. finally { if (e_1) throw e_1.error; }
  8997. }
  8998. }
  8999. }).finally(function () {
  9000. _this.refs.grid2.setLoading(false);
  9001. });
  9002. };
  9003. WidgetDesign.prototype.calcColumn = function () {
  9004. var _this = this;
  9005. var sql = this.refs.sqlEditor.getCode();
  9006. var rows = this.refs.grid3.getDataRows();
  9007. this.refs.grid3.setLoading(true);
  9008. parseDynamicSqlApi(sql).then(function (res) {
  9009. _.forEach(res.data, function (parseItem) {
  9010. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  9011. // 是否找到重复字段
  9012. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  9013. if (exists) {
  9014. return;
  9015. }
  9016. if (tableName) {
  9017. // 解出表格名和字段名
  9018. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  9019. if (meta) {
  9020. // 找到了元数据
  9021. var r = {
  9022. dataIndex: meta.column_name,
  9023. header: meta.column_comment,
  9024. xtype: '',
  9025. dataType: 'string',
  9026. dict: '',
  9027. };
  9028. if (meta.column_ui === 'combo' && meta.column_dict) {
  9029. r.dict = meta.column_dict;
  9030. }
  9031. else if (meta.column_ui === "checkbox") {
  9032. r.xtype = 'checkbox';
  9033. }
  9034. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  9035. r.dataType = meta.data_type;
  9036. }
  9037. _this.refs.grid3.appendEditRow(r);
  9038. return;
  9039. }
  9040. }
  9041. if (columnName) {
  9042. // 解出字段名
  9043. var r = {
  9044. dataIndex: columnName,
  9045. header: columnName,
  9046. xtype: '',
  9047. dataType: 'string',
  9048. dict: '',
  9049. };
  9050. _this.refs.grid3.appendEditRow(r);
  9051. }
  9052. });
  9053. }).finally(function () {
  9054. _this.refs.grid3.setLoading(false);
  9055. });
  9056. };
  9057. return WidgetDesign;
  9058. }(Scope));
  9059. var model$7 = {
  9060. data: {
  9061. // spreadsheet: false,
  9062. // multSelect: false,
  9063. // showCheckColumn: false,
  9064. // checkColumncheckOnly: false,
  9065. // disableSelection: false,
  9066. vjson: {
  9067. reference: '',
  9068. pagination: false,
  9069. pageSize: false,
  9070. pageSizeOption: false,
  9071. hideFootbar: false,
  9072. hideRefresh: false,
  9073. hideExport: false,
  9074. hideAutoSize: false,
  9075. hideClearFilter: false,
  9076. hideSaveGridUIConfig: false,
  9077. hideClearGridUIConfig: false,
  9078. selectMode: '',
  9079. cellediting_clicksToEdit: 1,
  9080. columnLines: false,
  9081. rowLines: false,
  9082. border: false,
  9083. autoLoad: false,
  9084. remoteSort: false,
  9085. remoteFilter: false,
  9086. enableLocking: false,
  9087. enableColumnHide: false,
  9088. enableColumnMove: false,
  9089. gridfilters: false,
  9090. enableColumnResize: false,
  9091. sortOnClick: false,
  9092. hidden: false,
  9093. cls: '',
  9094. dataSource: {
  9095. url: '',
  9096. params: {
  9097. formData: '{form}',
  9098. },
  9099. },
  9100. listeners: {
  9101. beforeselect: '',
  9102. selectionchange: '',
  9103. itemclick: '',
  9104. itemdblclick: '',
  9105. cellClick: '',
  9106. celldblclick: '',
  9107. afterrender: '',
  9108. destory: '',
  9109. }
  9110. },
  9111. }
  9112. };
  9113. var vjson$7 = {
  9114. title: '表格-高级',
  9115. height: 450,
  9116. width: 970,
  9117. layout: 'fit',
  9118. modal: true,
  9119. items: [
  9120. {
  9121. xtype: 'tabpanel',
  9122. items: [
  9123. {
  9124. title: '属性',
  9125. xtype: 'form',
  9126. scrollable: true,
  9127. items: [
  9128. {
  9129. xtype: 'cols',
  9130. items: [
  9131. {
  9132. xtype: 'textfield',
  9133. fieldLabel: '引用名',
  9134. tooltip: 'reference',
  9135. bind: '{vjson.reference}',
  9136. },
  9137. ]
  9138. },
  9139. {
  9140. xtype: 'cols',
  9141. border: false,
  9142. items: [
  9143. // 允许分页、页大小、页大小选项
  9144. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  9145. // 多选、显示勾选、自动勾选、
  9146. // 单击编辑、列分割线、行分割线、边框
  9147. // 数据源自动加载、后端排序、后端过滤
  9148. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  9149. {
  9150. xtype: 'checkbox',
  9151. fieldLabel: '允许分页',
  9152. bind: {
  9153. value: "{vjson.pagination}"
  9154. }
  9155. },
  9156. {
  9157. xtype: 'numberfield',
  9158. fieldLabel: '页大小',
  9159. bind: '{vjson.pageSize}',
  9160. },
  9161. {
  9162. xtype: 'textfield',
  9163. fieldLabel: '页大小选项',
  9164. flex: 2,
  9165. bind: '{vjson.pageSizeOption}',
  9166. },
  9167. ]
  9168. },
  9169. {
  9170. layout: 'hbox',
  9171. border: false,
  9172. items: [
  9173. {
  9174. xtype: 'combo',
  9175. fieldLabel: '选择模式',
  9176. flex: 4,
  9177. data: [
  9178. { id: 'spreadsheet', text: 'Excel模式' },
  9179. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  9180. { id: 'checkColumn', text: '勾选框' },
  9181. { id: 'row_mulity', text: '行选择-允许多选' },
  9182. { id: 'row_single', text: '行选择-单选' },
  9183. { id: 'disableSelection', text: '禁用' },
  9184. ],
  9185. bind: {
  9186. value: '{vjson.selectMode}'
  9187. }
  9188. }
  9189. ]
  9190. },
  9191. {
  9192. layout: 'hbox',
  9193. border: false,
  9194. defaults: {
  9195. xtype: 'checkbox',
  9196. margin: '0 15 0 0',
  9197. },
  9198. items: [
  9199. {
  9200. xtype: 'container',
  9201. margin: '3',
  9202. border: false,
  9203. width: 80,
  9204. },
  9205. {
  9206. boxLabel: '隐藏底部',
  9207. bind: {
  9208. value: "{vjson.hideFootbar}"
  9209. }
  9210. },
  9211. {
  9212. boxLabel: '隐藏刷新',
  9213. bind: {
  9214. value: "{vjson.hideRefresh}"
  9215. }
  9216. },
  9217. {
  9218. boxLabel: '隐藏导出',
  9219. bind: {
  9220. value: "{vjson.hideExport}"
  9221. }
  9222. },
  9223. {
  9224. boxLabel: '隐藏自动调宽',
  9225. bind: {
  9226. value: "{vjson.hideAutoSize}"
  9227. }
  9228. },
  9229. {
  9230. boxLabel: '隐藏清空筛选',
  9231. bind: {
  9232. value: "{vjson.hideClearFilter}"
  9233. }
  9234. },
  9235. {
  9236. boxLabel: '隐藏保存布局',
  9237. bind: {
  9238. value: "{vjson.hideSaveGridUIConfig}"
  9239. }
  9240. },
  9241. {
  9242. boxLabel: '隐藏重置布局',
  9243. bind: {
  9244. value: "{vjson.hideClearGridUIConfig}"
  9245. }
  9246. },
  9247. ]
  9248. },
  9249. {
  9250. layout: 'hbox',
  9251. border: false,
  9252. defaults: {
  9253. xtype: 'checkbox',
  9254. margin: '0 15 0 0',
  9255. },
  9256. items: [
  9257. {
  9258. xtype: 'container',
  9259. margin: '3',
  9260. border: false,
  9261. width: 80
  9262. },
  9263. {
  9264. boxLabel: '单击编辑',
  9265. bind: {
  9266. value: "{vjson.cellediting_clicksToEdit}"
  9267. }
  9268. },
  9269. {
  9270. boxLabel: '列分隔线',
  9271. bind: {
  9272. value: "{vjson.columnLines}"
  9273. }
  9274. },
  9275. {
  9276. boxLabel: '行分隔线',
  9277. bind: {
  9278. value: "{vjson.rowLines}"
  9279. }
  9280. },
  9281. {
  9282. boxLabel: '边框',
  9283. bind: {
  9284. value: "{vjson.border}"
  9285. }
  9286. },
  9287. ]
  9288. },
  9289. {
  9290. layout: 'hbox',
  9291. border: false,
  9292. defaults: {
  9293. xtype: 'checkbox',
  9294. margin: '0 15 0 0',
  9295. },
  9296. items: [
  9297. {
  9298. xtype: 'container',
  9299. margin: '3',
  9300. border: false,
  9301. width: 80
  9302. },
  9303. {
  9304. boxLabel: '数据源自动加载',
  9305. bind: {
  9306. value: "{vjson.autoLoad}"
  9307. }
  9308. },
  9309. {
  9310. boxLabel: '后端排序',
  9311. bind: {
  9312. value: "{vjson.remoteSort}"
  9313. }
  9314. },
  9315. {
  9316. boxLabel: '后端过滤',
  9317. bind: {
  9318. value: "{vjson.remoteFilter}"
  9319. }
  9320. },
  9321. ]
  9322. },
  9323. {
  9324. layout: 'hbox',
  9325. border: false,
  9326. defaults: {
  9327. xtype: 'checkbox',
  9328. margin: '0 15 0 0',
  9329. },
  9330. items: [
  9331. {
  9332. xtype: 'container',
  9333. margin: '3',
  9334. border: false,
  9335. width: 80
  9336. },
  9337. {
  9338. boxLabel: '自定义锁定',
  9339. bind: {
  9340. value: "{vjson.enableLocking}"
  9341. }
  9342. },
  9343. {
  9344. boxLabel: '自定义隐藏',
  9345. bind: {
  9346. value: "{vjson.enableColumnHide}"
  9347. }
  9348. },
  9349. {
  9350. boxLabel: '用户拖拽字段',
  9351. bind: {
  9352. value: "{vjson.enableColumnMove}"
  9353. }
  9354. },
  9355. {
  9356. boxLabel: '自定义筛选',
  9357. bind: {
  9358. value: "{vjson.gridfilters}"
  9359. }
  9360. },
  9361. {
  9362. boxLabel: '用户拖拽字段宽度',
  9363. bind: {
  9364. value: "{vjson.enableColumnResize}"
  9365. }
  9366. },
  9367. {
  9368. boxLabel: '点击列头排序',
  9369. bind: {
  9370. value: "{vjson.sortOnClick}"
  9371. }
  9372. },
  9373. {
  9374. xtype: 'checkbox',
  9375. boxLabel: '隐藏',
  9376. bind: {
  9377. value: "{vjson.hidden}"
  9378. }
  9379. },
  9380. ]
  9381. },
  9382. {
  9383. xtype: 'cols',
  9384. items: [
  9385. {
  9386. xtype: 'textfield',
  9387. fieldLabel: '样式',
  9388. bind: '{vjson.cls}',
  9389. flex: 4
  9390. },
  9391. ]
  9392. },
  9393. ]
  9394. },
  9395. {
  9396. title: '字段',
  9397. xtype: 'yvgrid',
  9398. reference: 'grid1',
  9399. pagination: false,
  9400. hideFootbar: true,
  9401. plugins: {
  9402. clipboard: true,
  9403. selectionreplicator: true
  9404. },
  9405. selModel: {
  9406. type: 'spreadsheet',
  9407. columnSelect: true,
  9408. pruneRemoved: false,
  9409. extensible: 'y'
  9410. },
  9411. listeners: {
  9412. editfinish: 'scope.gridEditFinish',
  9413. },
  9414. tbar: {
  9415. xtype: 'toolbar',
  9416. items: [
  9417. {
  9418. xtype: 'button',
  9419. text: '添加',
  9420. iconCls: 'x-fa fa-plus-circle',
  9421. listeners: {
  9422. click: 'scope.addColumn'
  9423. }
  9424. },
  9425. {
  9426. xtype: 'button',
  9427. text: '删除',
  9428. iconCls: 'x-fa fa-minus-circle',
  9429. listeners: {
  9430. click: 'scope.removeColumn'
  9431. }
  9432. },
  9433. '-',
  9434. {
  9435. xtype: 'button',
  9436. text: '自动分析',
  9437. iconCls: 'x-fa fa-code-fork',
  9438. listeners: {
  9439. click: 'scope.calcColumn'
  9440. }
  9441. },
  9442. {
  9443. xtype: 'button',
  9444. text: '上移',
  9445. iconCls: 'x-fa fa-arrow-up',
  9446. listeners: {
  9447. click: 'scope.moveUp'
  9448. }
  9449. },
  9450. {
  9451. xtype: 'button',
  9452. text: '下移',
  9453. iconCls: 'x-fa fa-arrow-down',
  9454. listeners: {
  9455. click: 'scope.moveDown'
  9456. }
  9457. },
  9458. ]
  9459. },
  9460. columns: [
  9461. { xtype: 'rownumberer' },
  9462. {
  9463. text: '字段',
  9464. dataIndex: 'dataIndex',
  9465. width: 140,
  9466. sortable: false,
  9467. menuDisabled: true,
  9468. editor: {
  9469. selectOnFocus: true,
  9470. },
  9471. },
  9472. {
  9473. text: '标题',
  9474. dataIndex: 'header',
  9475. width: 120,
  9476. sortable: false,
  9477. menuDisabled: true,
  9478. editor: {
  9479. selectOnFocus: true,
  9480. },
  9481. },
  9482. {
  9483. text: '类型',
  9484. dataIndex: 'xtype',
  9485. width: 100,
  9486. sortable: false,
  9487. menuDisabled: true,
  9488. editor: {
  9489. xtype: 'combo',
  9490. typeAhead: true,
  9491. triggerAction: 'all',
  9492. selectOnFocus: false,
  9493. listConfig: {
  9494. minWidth: 200
  9495. },
  9496. store: [
  9497. ['', '默认'],
  9498. ['rownum', 'rownum'],
  9499. ['checkcolumn', 'checkcolumn'],
  9500. ]
  9501. },
  9502. },
  9503. {
  9504. text: '数据类型',
  9505. dataIndex: 'dataType',
  9506. width: 100,
  9507. sortable: false,
  9508. menuDisabled: true,
  9509. editor: {
  9510. xtype: 'combo',
  9511. selectOnFocus: true,
  9512. listConfig: {
  9513. minWidth: 200
  9514. },
  9515. store: [
  9516. ['', '默认'],
  9517. ['string', 'string'],
  9518. ['number', 'number'],
  9519. ['date', 'date'],
  9520. ]
  9521. },
  9522. },
  9523. {
  9524. text: '编辑模式',
  9525. dataIndex: 'editor',
  9526. width: 100,
  9527. sortable: false,
  9528. menuDisabled: true,
  9529. editor: {
  9530. xtype: 'combo',
  9531. selectOnFocus: true,
  9532. listConfig: {
  9533. minWidth: 200
  9534. },
  9535. store: [
  9536. ['', ''],
  9537. ['textfield', 'textfield'],
  9538. ['numberfield', 'numberfield'],
  9539. ['combo', 'combo'],
  9540. ['combogrid', 'combogrid'],
  9541. ['datefield', 'datefield'],
  9542. ]
  9543. },
  9544. },
  9545. {
  9546. text: '宽度',
  9547. dataIndex: 'width',
  9548. align: 'right',
  9549. width: 100,
  9550. sortable: false,
  9551. menuDisabled: true,
  9552. editor: {
  9553. xtype: 'numberfield',
  9554. selectOnFocus: true,
  9555. minValue: 0,
  9556. maxValue: 1000
  9557. },
  9558. },
  9559. {
  9560. text: '权重',
  9561. dataIndex: 'flex',
  9562. align: 'right',
  9563. width: 90,
  9564. sortable: false,
  9565. menuDisabled: true,
  9566. editor: {
  9567. xtype: 'numberfield',
  9568. selectOnFocus: true,
  9569. minValue: 0,
  9570. maxValue: 10
  9571. },
  9572. },
  9573. {
  9574. text: '字典',
  9575. dataIndex: 'dict',
  9576. sortable: false,
  9577. menuDisabled: true,
  9578. width: 210,
  9579. editor: {
  9580. selectOnFocus: true,
  9581. },
  9582. },
  9583. {
  9584. text: '对齐',
  9585. dataIndex: 'align',
  9586. width: 90,
  9587. sortable: false,
  9588. menuDisabled: true,
  9589. editor: {
  9590. xtype: 'combo',
  9591. selectOnFocus: true,
  9592. listConfig: {
  9593. minWidth: 120
  9594. },
  9595. store: [
  9596. ['start', 'start'],
  9597. ['center', 'center'],
  9598. ['end', 'end'],
  9599. ]
  9600. },
  9601. },
  9602. {
  9603. text: '必填',
  9604. dataIndex: 'notAllowBlank',
  9605. width: 50,
  9606. resizable: false,
  9607. sortable: false,
  9608. menuDisabled: true,
  9609. xtype: 'checkcolumn',
  9610. },
  9611. {
  9612. text: '禁用',
  9613. dataIndex: 'disabled',
  9614. width: 50,
  9615. resizable: false,
  9616. sortable: false,
  9617. menuDisabled: true,
  9618. xtype: 'checkcolumn',
  9619. },
  9620. {
  9621. text: '禁菜',
  9622. dataIndex: 'menuDisabled',
  9623. width: 50,
  9624. resizable: false,
  9625. sortable: false,
  9626. menuDisabled: true,
  9627. xtype: 'checkcolumn',
  9628. },
  9629. {
  9630. text: '过滤',
  9631. dataIndex: 'filterable',
  9632. xtype: 'checkcolumn',
  9633. width: 50,
  9634. resizable: false,
  9635. sortable: false,
  9636. menuDisabled: true,
  9637. },
  9638. {
  9639. text: '隐藏',
  9640. dataIndex: 'hidden',
  9641. xtype: 'checkcolumn',
  9642. width: 50,
  9643. resizable: false,
  9644. sortable: false,
  9645. menuDisabled: true,
  9646. },
  9647. {
  9648. text: '可隐',
  9649. dataIndex: 'hideable',
  9650. xtype: 'checkcolumn',
  9651. width: 50,
  9652. resizable: false,
  9653. sortable: false,
  9654. menuDisabled: true,
  9655. },
  9656. {
  9657. text: '调宽',
  9658. dataIndex: 'resizable',
  9659. xtype: 'checkcolumn',
  9660. width: 50,
  9661. resizable: false,
  9662. sortable: false,
  9663. menuDisabled: true,
  9664. },
  9665. {
  9666. text: '排序',
  9667. dataIndex: 'sortable',
  9668. xtype: 'checkcolumn',
  9669. width: 50,
  9670. resizable: false,
  9671. sortable: false,
  9672. menuDisabled: true,
  9673. },
  9674. {
  9675. text: '适宽',
  9676. dataIndex: 'autoSize',
  9677. xtype: 'checkcolumn',
  9678. width: 50,
  9679. resizable: false,
  9680. sortable: false,
  9681. menuDisabled: true,
  9682. },
  9683. ],
  9684. },
  9685. {
  9686. title: '数据源',
  9687. layout: 'border',
  9688. listeners: {
  9689. activate: 'scope.dataSourceActivate'
  9690. },
  9691. items: [
  9692. {
  9693. region: 'north',
  9694. xtype: 'toolbar',
  9695. border: false,
  9696. items: [
  9697. {
  9698. xtype: 'textfield',
  9699. fieldLabel: '数据源',
  9700. flex: 1,
  9701. bind: {
  9702. value: '{vjson.dataSource.url}'
  9703. }
  9704. },
  9705. {
  9706. xtype: 'button',
  9707. text: '保存',
  9708. iconCls: 'x-fa fa-save',
  9709. listeners: {
  9710. click: 'scope.dataSourceSave'
  9711. }
  9712. },
  9713. {
  9714. xtype: 'button',
  9715. text: '读取',
  9716. iconCls: 'x-fa fa-folder-open',
  9717. listeners: {
  9718. click: 'scope.reloadSqlContent'
  9719. }
  9720. },
  9721. ]
  9722. },
  9723. {
  9724. region: 'center',
  9725. xtype: 'sqleditor',
  9726. layout: 'fit',
  9727. reference: 'sqlEditor',
  9728. },
  9729. {
  9730. region: 'south',
  9731. xtype: 'jsoneditor',
  9732. height: 200,
  9733. split: true,
  9734. collapsible: true,
  9735. title: '参数',
  9736. reference: 'sqlParams',
  9737. }
  9738. ]
  9739. },
  9740. {
  9741. title: '事件',
  9742. xtype: 'form',
  9743. scrollable: true,
  9744. margin: '10',
  9745. defaults: {
  9746. width: '100%',
  9747. labelAlign: 'top',
  9748. },
  9749. items: [
  9750. {
  9751. xtype: 'textfield',
  9752. fieldLabel: '选中前触发 beforeSelect',
  9753. bind: {
  9754. value: '{vjson.listeners.beforeselect}'
  9755. },
  9756. },
  9757. {
  9758. xtype: 'textfield',
  9759. fieldLabel: '选择范围改变 selectionChange',
  9760. bind: {
  9761. value: '{vjson.listeners.selectionchange}'
  9762. },
  9763. },
  9764. {
  9765. xtype: 'textfield',
  9766. fieldLabel: '行点击 itemClick',
  9767. bind: {
  9768. value: '{vjson.listeners.itemclick}'
  9769. },
  9770. },
  9771. {
  9772. xtype: 'textfield',
  9773. fieldLabel: '行双击 itemDblClick',
  9774. bind: {
  9775. value: '{vjson.listeners.itemdblclick}'
  9776. },
  9777. },
  9778. {
  9779. xtype: 'textfield',
  9780. fieldLabel: '单元格点击 cellClick',
  9781. bind: {
  9782. value: '{vjson.listeners.cellClick}'
  9783. },
  9784. },
  9785. {
  9786. xtype: 'textfield',
  9787. fieldLabel: '单元格双击 cellDblClick',
  9788. bind: {
  9789. value: '{vjson.listeners.celldblclick}'
  9790. },
  9791. },
  9792. {
  9793. xtype: 'textfield',
  9794. fieldLabel: '渲染后触发 afterrender',
  9795. bind: {
  9796. value: '{vjson.listeners.afterrender}'
  9797. },
  9798. },
  9799. {
  9800. xtype: 'textfield',
  9801. fieldLabel: '销毁后触发 destory',
  9802. bind: {
  9803. value: '{vjson.listeners.destory}'
  9804. },
  9805. },
  9806. ]
  9807. },
  9808. ],
  9809. }
  9810. ],
  9811. fbar: [
  9812. {
  9813. text: '应用', iconCls: 'x-fa fa-save',
  9814. listeners: {
  9815. click: 'scope.save'
  9816. }
  9817. },
  9818. '-',
  9819. {
  9820. text: '确定', iconCls: 'x-fa fa-check-circle',
  9821. listeners: {
  9822. click: 'scope.saveClose'
  9823. }
  9824. },
  9825. {
  9826. text: '取消', iconCls: 'x-fa fa-times-circle',
  9827. listeners: {
  9828. click: 'system.closeMe()'
  9829. }
  9830. },
  9831. ]
  9832. };
  9833. var checkFlags = {};
  9834. // ------------------------------------------------------------------------------------------ impls
  9835. function jsViewToVJson(modulePage, jsView) {
  9836. if (!jsView)
  9837. return {};
  9838. jsView = jsView.replace(/^\s*export\s+default/, "");
  9839. jsView = _$2.trim(jsView) || "{}";
  9840. try {
  9841. var json = dist.parse(jsView);
  9842. return modulePage.addViewId(json);
  9843. }
  9844. catch (e) {
  9845. //@ts-ignore
  9846. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  9847. }
  9848. }
  9849. function stringToJsonObj(jsonStr) {
  9850. if (!jsonStr)
  9851. return {};
  9852. try {
  9853. return dist.parse(jsonStr);
  9854. }
  9855. catch (e) {
  9856. return {};
  9857. }
  9858. }
  9859. /**
  9860. * 获取view.js 文件 string
  9861. */
  9862. function vjsonTojsView(vjson) {
  9863. var reVjson = _$2.cloneDeep(vjson);
  9864. removeDesignProp(reVjson);
  9865. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  9866. }
  9867. var ModuleStore = /** @class */ (function (_super) {
  9868. __extends(ModuleStore, _super);
  9869. function ModuleStore() {
  9870. var _this = _super.call(this) || this;
  9871. _this.store = {};
  9872. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  9873. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  9874. _this.addModule(id, module, modulePage);
  9875. });
  9876. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  9877. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  9878. _this.onMainTabChange(moduleId, oldModuleId, from);
  9879. });
  9880. return _this;
  9881. }
  9882. ModuleStore.prototype.getCacheKey = function (param) {
  9883. return "filetree_data.json";
  9884. };
  9885. ModuleStore.prototype.invokeApi = function (param) {
  9886. return moduleTree();
  9887. };
  9888. ModuleStore.prototype.reloadModule = function (id) {
  9889. var moduleObject = this.store[id];
  9890. if (!moduleObject)
  9891. return;
  9892. var module = moduleObject.module;
  9893. getModuleFileContent(module).then(function (_a) {
  9894. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9895. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  9896. moduleObject.lastModifyTime = lastModifyTime;
  9897. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  9898. // 触发事件 ModuleItemChange
  9899. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9900. moduleObject.moduleEventBus.publish(EventType.SetVjson, {
  9901. vjson: moduleObject.moduleObj.vjson,
  9902. from: "reloadModule"
  9903. });
  9904. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  9905. });
  9906. };
  9907. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  9908. var _this = this;
  9909. window['mainWindow'].setLoading(true);
  9910. getModuleFileContent(module)
  9911. .then(function (_a) {
  9912. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9913. var moduleObject = {
  9914. id: id, module: module,
  9915. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  9916. lastModifyTime: lastModifyTime,
  9917. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  9918. modulePage: modulePage,
  9919. moduleEventBus: modulePage.moduleEventBus
  9920. };
  9921. _this.store[id] = moduleObject;
  9922. // 触发事件 ModuleItemChange
  9923. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9924. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  9925. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  9926. })
  9927. .finally(function () {
  9928. window['mainWindow'].setLoading(false);
  9929. });
  9930. };
  9931. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  9932. if (this.store[moduleId]) {
  9933. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  9934. }
  9935. };
  9936. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  9937. var moduleObject = this.store[id];
  9938. moduleObject.fileContent.jsController = codeValue;
  9939. };
  9940. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  9941. var moduleObject = this.store[id];
  9942. moduleObject.fileContent.jsView = codeValue;
  9943. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  9944. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, {
  9945. vjson: moduleObject.moduleObj.vjson,
  9946. from: from
  9947. });
  9948. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  9949. };
  9950. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  9951. var moduleObject = this.store[id];
  9952. moduleObject.fileContent.jsModel = codeValue;
  9953. };
  9954. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  9955. var moduleObject = this.store[id];
  9956. moduleObject.fileContent.groovy = codeValue;
  9957. };
  9958. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  9959. var moduleObject = this.store[id];
  9960. moduleObject.fileContent.mybatis = codeValue;
  9961. };
  9962. ModuleStore.prototype.getModuleObject = function (id) {
  9963. return this.store[id];
  9964. };
  9965. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  9966. if (checkFlags[moduleId] === 1) {
  9967. // @ts-ignore
  9968. system.msg("正在检测文件是否有外部修改,请稍后操作");
  9969. }
  9970. eventBus.publish(EventType.StopCheckModule, {});
  9971. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  9972. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  9973. saveFile(fileFullPath, fileContent).then(function (res) {
  9974. if (res.data && res.data.lastModified) {
  9975. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  9976. }
  9977. }).finally(function () {
  9978. eventBus.publish(EventType.RunCheckModule, {});
  9979. });
  9980. };
  9981. ModuleStore.prototype.check = function (moduleId) {
  9982. {
  9983. return;
  9984. }
  9985. };
  9986. return ModuleStore;
  9987. }(CacheStore));
  9988. // ------------------------------------------------------------------------------------------ use
  9989. var moduleStore = new ModuleStore();
  9990. var VjsonExchange = /** @class */ (function () {
  9991. function VjsonExchange(vjson) {
  9992. this.pendingSet = true;
  9993. this.vjsonOrigin = _$2.cloneDeep(vjson);
  9994. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  9995. }
  9996. /**
  9997. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  9998. * @param propName
  9999. * @param value
  10000. */
  10001. VjsonExchange.prototype.setPropValue = function (propName, value) {
  10002. if (this.pendingSet) {
  10003. return;
  10004. }
  10005. // selectMode
  10006. // pageSizeOption
  10007. // cellediting_clicksToEdit
  10008. msg$1('' + propName + '=' + value);
  10009. _$2.set(this.vjson, propName, value);
  10010. };
  10011. /**
  10012. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  10013. */
  10014. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  10015. var _a, _b, _c;
  10016. if (this.pendingSet) {
  10017. return;
  10018. }
  10019. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  10020. // 如果不使用默认属性,就直接设定 undefined
  10021. var vs = {
  10022. dataIndex: undefined,
  10023. header: undefined,
  10024. xtype: '',
  10025. width: undefined,
  10026. flex: undefined,
  10027. align: 'start',
  10028. editor: undefined,
  10029. dataType: 'string',
  10030. dict: undefined,
  10031. disabled: false,
  10032. menuDisabled: false,
  10033. notAllowBlank: false,
  10034. filterable: true,
  10035. hidden: false,
  10036. hideable: true,
  10037. resizable: true,
  10038. sortable: true,
  10039. autoSize: true,
  10040. };
  10041. var raw = record.get('raw');
  10042. if (raw === undefined || raw == null) {
  10043. raw = {};
  10044. record.set('raw', raw);
  10045. }
  10046. var setRaw = function (propName, value) {
  10047. if (typeof value === 'undefined' || value == null) {
  10048. msg$1("delete columns[" + rowIdx + "]." + propName);
  10049. delete raw[propName];
  10050. return;
  10051. }
  10052. var defaultValue = vs[propName];
  10053. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  10054. // 要设的值,与默认值相同,就直接删除这个属性
  10055. msg$1("delete columns[" + rowIdx + "]." + propName);
  10056. delete raw[propName];
  10057. return;
  10058. }
  10059. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  10060. _$2.set(raw, propName, value);
  10061. };
  10062. if (!vs.hasOwnProperty(propName)) {
  10063. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  10064. return;
  10065. }
  10066. else if (propName === 'dict') {
  10067. if (value) {
  10068. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  10069. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  10070. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  10071. }
  10072. }
  10073. else {
  10074. setRaw('fix', undefined);
  10075. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  10076. msg$1("delete columns[" + rowIdx + "].editor.fix");
  10077. delete raw.editor.fix;
  10078. }
  10079. }
  10080. }
  10081. else if (propName === 'xtype') {
  10082. if (!value) {
  10083. setRaw('xtype', undefined);
  10084. }
  10085. else {
  10086. setRaw('xtype', value);
  10087. }
  10088. }
  10089. else if (propName === 'notAllowBlank') {
  10090. setRaw('editor.allowBlank', !value);
  10091. }
  10092. else if (propName === 'editor') {
  10093. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  10094. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  10095. value = undefined;
  10096. }
  10097. // editor.xtype
  10098. if (!value) {
  10099. // 不需要编辑器
  10100. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  10101. msg$1("delete columns[" + rowIdx + "].editor");
  10102. delete raw.editor;
  10103. record.set('notAllowBlank', false);
  10104. }
  10105. }
  10106. else {
  10107. setRaw('editor.xtype', value);
  10108. var dict = record.get('dict');
  10109. if (value === 'combo' && dict) {
  10110. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  10111. }
  10112. }
  10113. }
  10114. else if (propName === 'width') {
  10115. var width = value;
  10116. var flex = record.get('flex');
  10117. if (!width && !flex) {
  10118. setRaw('width', undefined);
  10119. setRaw('flex', undefined);
  10120. record.set('flex', undefined);
  10121. record.set('width', undefined);
  10122. return;
  10123. }
  10124. else if (!!width) {
  10125. setRaw('flex', undefined);
  10126. record.set('flex', undefined);
  10127. setRaw('width', width);
  10128. return;
  10129. }
  10130. }
  10131. else if (propName === 'flex') {
  10132. var width = record.get('width');
  10133. var flex = value;
  10134. if (!width && !flex) {
  10135. setRaw('width', undefined);
  10136. setRaw('flex', undefined);
  10137. record.set('flex', undefined);
  10138. record.set('width', undefined);
  10139. return;
  10140. }
  10141. else if (!!flex) {
  10142. setRaw('width', undefined);
  10143. record.set('width', undefined);
  10144. setRaw('flex', flex);
  10145. return;
  10146. }
  10147. }
  10148. else {
  10149. // 其他属性,作为同名属性,与 raw 同步
  10150. setRaw(propName, value);
  10151. }
  10152. };
  10153. /**
  10154. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  10155. */
  10156. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  10157. var _this = this;
  10158. var vs = [
  10159. 'reference', 'pagination', 'pageSize',
  10160. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  10161. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  10162. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  10163. 'listeners.beforeselect',
  10164. 'listeners.selectionchange',
  10165. 'listeners.itemclick',
  10166. 'listeners.itemdblclick',
  10167. 'listeners.cellClick',
  10168. 'listeners.celldblclick',
  10169. 'listeners.afterrender',
  10170. 'listeners.destory',
  10171. ];
  10172. _$2.forEach(vs, function (v) {
  10173. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  10174. });
  10175. };
  10176. VjsonExchange.prototype.bindChangeProp = function (propName) {
  10177. var me = this;
  10178. return function (value) {
  10179. me.setPropValue(propName, value);
  10180. };
  10181. };
  10182. VjsonExchange.prototype.parseModel = function () {
  10183. var _this = this;
  10184. 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;
  10185. //@ts-ignore
  10186. var df = YvanUI.Defaults.grid;
  10187. var vjson = _$2.assign({}, df, this.vjson);
  10188. var model = {
  10189. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  10190. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  10191. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  10192. pageSizeOption: '["20", "50", "100", "200", "300"]',
  10193. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  10194. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  10195. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  10196. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  10197. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  10198. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  10199. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  10200. selectMode: 'spreadsheet',
  10201. cellediting_clicksToEdit: true,
  10202. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  10203. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  10204. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  10205. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  10206. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  10207. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  10208. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  10209. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  10210. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  10211. gridfilters: true,
  10212. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  10213. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  10214. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  10215. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  10216. columns: [],
  10217. listeners: {
  10218. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  10219. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  10220. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  10221. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  10222. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  10223. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  10224. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  10225. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  10226. }
  10227. };
  10228. if (_$2.isArray(this.vjson.pageSizeOption)) {
  10229. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  10230. }
  10231. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  10232. if (_$2.get(vjson, 'disableSelection') == true) {
  10233. model.selectMode = 'disableSelection';
  10234. }
  10235. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  10236. model.selectMode = 'spreadsheet';
  10237. }
  10238. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  10239. model.selectMode = 'onlyCheckColumn';
  10240. }
  10241. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  10242. model.selectMode = 'checkColumn';
  10243. }
  10244. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  10245. model.selectMode = 'row_mulity';
  10246. }
  10247. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  10248. model.selectMode = 'row_single';
  10249. }
  10250. else {
  10251. model.selectMode = 'row_single';
  10252. }
  10253. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  10254. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  10255. model.dataSource = {
  10256. url: _$2.get(vjson, 'dataSource.url'),
  10257. //@ts-ignore
  10258. params: _$2.get(vjson, 'dataSource.params')
  10259. };
  10260. }
  10261. _$2.forEach(vjson.columns, function (column) {
  10262. model.columns.push(_this.parseColumn(column));
  10263. });
  10264. return model;
  10265. };
  10266. VjsonExchange.prototype.parseColumn = function (column) {
  10267. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  10268. var model = {
  10269. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  10270. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  10271. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  10272. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  10273. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  10274. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  10275. editor: '',
  10276. editParam: '',
  10277. dict: '',
  10278. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  10279. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  10280. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  10281. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  10282. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  10283. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  10284. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  10285. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  10286. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  10287. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  10288. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  10289. raw: _$2.cloneDeep(column),
  10290. };
  10291. // width / flex 只能留一个属性, 或者全不留
  10292. if (model.width <= 0 && model.flex <= 0) {
  10293. delete model.width;
  10294. delete model.flex;
  10295. }
  10296. else if (model.width > 0) {
  10297. delete model.flex;
  10298. }
  10299. else {
  10300. delete model.width;
  10301. }
  10302. // editor
  10303. if (_$2.isObject(_$2.get(column, 'editor'))) {
  10304. model.editor = _$2.get(column, 'editor.xtype');
  10305. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  10306. if (!model.editor) {
  10307. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  10308. model.editor = 'textfield';
  10309. }
  10310. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  10311. msg$1('不可识别的 editor.xtype=' + model.editor);
  10312. console.error('不可识别的 editor.xtype', column);
  10313. }
  10314. if (_$2.get(column, 'editor.allowBlank') === false) {
  10315. model.notAllowBlank = true;
  10316. }
  10317. }
  10318. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  10319. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  10320. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  10321. if (match && match[1]) {
  10322. model.dict = match[1];
  10323. }
  10324. }
  10325. return model;
  10326. };
  10327. return VjsonExchange;
  10328. }());
  10329. //
  10330. var YvgridDesign = /** @class */ (function (_super) {
  10331. __extends(YvgridDesign, _super);
  10332. function YvgridDesign(moduleId) {
  10333. var _this = _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  10334. _this.moduleId = '';
  10335. _this.name = 'YvgridDesign';
  10336. _this.dataSourceIsActived = false;
  10337. _this.setModuleId(moduleId);
  10338. return _this;
  10339. }
  10340. YvgridDesign.prototype.setModuleId = function (moduleId) {
  10341. var _this = this;
  10342. this.moduleId = moduleId;
  10343. if (this.componentSelectionChangeSubscribe) {
  10344. this.componentSelectionChangeSubscribe.cancel();
  10345. this.componentSelectionChangeSubscribe = null;
  10346. }
  10347. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10348. var id = _a.id, from = _a.from;
  10349. _this.onComponentSelectionChange(id, from);
  10350. });
  10351. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  10352. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  10353. if (vj.xtype !== 'yvgrid') {
  10354. throw Error('非 yvgrid 组件');
  10355. }
  10356. this.vjsonExchange = new VjsonExchange(vj);
  10357. };
  10358. YvgridDesign.prototype.onLoad = function () {
  10359. var _this = this;
  10360. var model = this.vjsonExchange.parseModel();
  10361. this.vjsonExchange.pendingSet = true;
  10362. mergeViewModel(this.viewModel, "vjson", model, false);
  10363. this.refs.grid1.setData(model.columns);
  10364. this.vjsonExchange.attachViewModel(this.viewModel);
  10365. _$2.defer(function () {
  10366. _this.vjsonExchange.pendingSet = false;
  10367. });
  10368. };
  10369. YvgridDesign.prototype.moveUp = function (sender) {
  10370. var grid = sender.up('grid');
  10371. grid.rowMoveUp();
  10372. };
  10373. YvgridDesign.prototype.moveDown = function (sender) {
  10374. var grid = sender.up('grid');
  10375. grid.rowMoveDown();
  10376. };
  10377. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  10378. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  10379. };
  10380. YvgridDesign.prototype.reloadSqlContent = function () {
  10381. var _this = this;
  10382. var url = this.viewModel.get('vjson.dataSource.url');
  10383. if (url) {
  10384. loadSqlContentApi(url).then(function (res) {
  10385. _this.refs.sqlEditor.setCode('');
  10386. if (res.success) {
  10387. _this.refs.sqlEditor.setCode(res.data.content);
  10388. }
  10389. }).catch(function () {
  10390. _this.refs.sqlEditor.setCode('');
  10391. });
  10392. }
  10393. };
  10394. YvgridDesign.prototype.dataSourceSave = function () {
  10395. var url = this.viewModel.get('vjson.dataSource.url');
  10396. if (!url) {
  10397. msg$1('必须填写 groovy/SQL 模块路径');
  10398. return;
  10399. }
  10400. var content = this.refs.sqlEditor.getCode();
  10401. saveSqlContentApi(url, content).then(function (res) {
  10402. if (res.success) {
  10403. msg$1('保存成功');
  10404. }
  10405. else {
  10406. msg$1(res.msg);
  10407. }
  10408. });
  10409. };
  10410. YvgridDesign.prototype.dataSourceActivate = function () {
  10411. if (!this.dataSourceIsActived) {
  10412. // 激活
  10413. this.reloadSqlContent();
  10414. var params = this.viewModel.get('vjson.dataSource.params');
  10415. if (_$2.isObject(params)) {
  10416. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  10417. }
  10418. this.dataSourceIsActived = true;
  10419. }
  10420. };
  10421. // 外部控件选择发生改变
  10422. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  10423. if (!id || from === this.name) {
  10424. return;
  10425. }
  10426. this.setVjson(id);
  10427. };
  10428. YvgridDesign.prototype.setVjson = function (id) {
  10429. // 找到对应的组件 判断是不是表格
  10430. };
  10431. YvgridDesign.prototype.save = function () {
  10432. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  10433. if (this.dataSourceIsActived) {
  10434. var url = this.viewModel.get('vjson.dataSource.url');
  10435. // 解析 params
  10436. var paramsString = this.refs.sqlParams.getCode('');
  10437. var params = undefined;
  10438. if (paramsString) {
  10439. try {
  10440. params = window['YvanUI'].json5.parse(paramsString);
  10441. }
  10442. catch (e) {
  10443. msg$1('dataSource.params 格式非法,请检查');
  10444. return;
  10445. }
  10446. }
  10447. if (typeof params === 'undefined') {
  10448. params = this.viewModel.get('vjson.dataSource.params');
  10449. }
  10450. if (url) {
  10451. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  10452. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  10453. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  10454. }
  10455. else {
  10456. delete this.vjsonExchange.vjson['dataSource'];
  10457. }
  10458. }
  10459. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  10460. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  10461. from: this.name,
  10462. ignoreRenderUI: false
  10463. });
  10464. };
  10465. YvgridDesign.prototype.saveClose = function () {
  10466. this.save();
  10467. this.close();
  10468. };
  10469. YvgridDesign.prototype.addColumn = function () {
  10470. this.refs.grid1.appendEditRow({
  10471. dataIndex: '',
  10472. header: '',
  10473. xtype: '',
  10474. width: 80,
  10475. align: '',
  10476. editor: '',
  10477. editParam: '',
  10478. dict: '',
  10479. disabled: false,
  10480. notAllowBlank: false,
  10481. menuDisabled: false,
  10482. filterable: false,
  10483. hidden: false,
  10484. hideable: true,
  10485. resizable: true,
  10486. sortable: true,
  10487. locked: false,
  10488. lockable: false,
  10489. autoSize: true,
  10490. raw: undefined,
  10491. }, 'header');
  10492. };
  10493. YvgridDesign.prototype.removeColumn = function () {
  10494. var _this = this;
  10495. var rows = [];
  10496. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  10497. rows.push(r);
  10498. });
  10499. _$2.forEach(rows, function (r) {
  10500. _this.refs.grid1.getStore().remove(r);
  10501. });
  10502. };
  10503. YvgridDesign.prototype.calcColumn = function () {
  10504. msg$1('暂未实现');
  10505. };
  10506. YvgridDesign.prototype.onDestroy = function () {
  10507. if (this.componentSelectionChangeSubscribe) {
  10508. this.componentSelectionChangeSubscribe.cancel();
  10509. this.componentSelectionChangeSubscribe = null;
  10510. }
  10511. };
  10512. return YvgridDesign;
  10513. }(Scope));
  10514. // export const idPrefix = "_ds_"
  10515. var _designInstance;
  10516. function setDesignInstance(instance) {
  10517. _designInstance = instance;
  10518. }
  10519. function getDesignInstance() {
  10520. return _designInstance;
  10521. }
  10522. function delegateDragmove(node, source, info) {
  10523. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  10524. //@ts-ignore
  10525. _designInstance.dragmove(node, source, info);
  10526. }
  10527. }
  10528. function delegateDragend(node, source, info) {
  10529. if (_designInstance && typeof _designInstance.dragend === 'function') {
  10530. //@ts-ignore
  10531. _designInstance.dragend(node, source, info);
  10532. }
  10533. }
  10534. var YvanUI$1 = window['YvanUI'];
  10535. var _$1 = window["_"];
  10536. var Ext$1 = window['Ext'];
  10537. var $$1 = window["$"];
  10538. var historySize = 100;
  10539. var ViewDesign = /** @class */ (function () {
  10540. function ViewDesign(moduleId, reference) {
  10541. var _this = this;
  10542. this.name = "ViewDesign";
  10543. this.expandedVjsonObjArray = [];
  10544. // 编辑历史
  10545. this.undoVjsonList = [];
  10546. // 撤销历史
  10547. this.redoVjsonList = [];
  10548. // 订阅事件列表
  10549. this.subscribeList = [];
  10550. // private getOuterCopyValueTimer: any = null
  10551. /**
  10552. * 唯一编号
  10553. */
  10554. this.id = _$1.uniqueId("_dv");
  10555. this.moduleId = moduleId;
  10556. this.moduleObject = moduleStore.getModuleObject(moduleId);
  10557. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  10558. this.designReference = reference;
  10559. this.designElement = reference.ariaEl.dom;
  10560. this.$overlay.appendTo(this.designElement);
  10561. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  10562. // 添加到撤销
  10563. this.lastVjson = _$1.cloneDeep(this.vjson);
  10564. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  10565. event.stopPropagation();
  10566. event.preventDefault();
  10567. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  10568. });
  10569. this.$overlay.on('click', '.studio_mask', function (event) {
  10570. event.stopPropagation();
  10571. event.preventDefault();
  10572. _this.clearSelection();
  10573. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  10574. _$1.defer(function () {
  10575. _this.$overlay.focus();
  10576. });
  10577. });
  10578. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  10579. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  10580. this.$overlay.on('copy', this.onCopy.bind(this));
  10581. this.$overlay.on('paste', this.onPaste.bind(this));
  10582. this.$overlay.on('focus', this.onfocus.bind(this));
  10583. // this.$overlay.on('mouseenter', ()=>{
  10584. // clearTimeout(this.getOuterCopyValueTimer);
  10585. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  10586. // })
  10587. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  10588. _this.onMousemove(event);
  10589. }, 300, { maxWait: 500 }).bind(this));
  10590. window.addEventListener('message', this.onMessageEvent.bind(this));
  10591. this.subscribe();
  10592. setDesignInstance(this);
  10593. }
  10594. // todo ======== 方法 ==========
  10595. ViewDesign.prototype.subscribe = function () {
  10596. var _this = this;
  10597. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10598. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  10599. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  10600. _this.setVjson(vjson, from, ignoreRenderUI);
  10601. }));
  10602. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10603. var id = _a.id, from = _a.from;
  10604. _this.onComponentSelectionChange(id, from);
  10605. }));
  10606. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  10607. var id = _a.id, from = _a.from;
  10608. _this.onComponentDelete(id, from);
  10609. }));
  10610. };
  10611. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  10612. if (vjson === void 0) { vjson = this.vjson; }
  10613. if (from === void 0) { from = this.name; }
  10614. this.vjson = vjson;
  10615. if (from !== "undo" && from !== "redo") {
  10616. if (this.undoVjsonList.length >= 100) {
  10617. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  10618. }
  10619. this.undoVjsonList.push(this.lastVjson);
  10620. }
  10621. this.lastVjson = _$1.cloneDeep(vjson);
  10622. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10623. };
  10624. /**
  10625. * 覆盖层点击事件
  10626. */
  10627. ViewDesign.prototype.overlayClickFunction = function (event) {
  10628. if (!event.altKey && !event.shiftKey) {
  10629. var target = this.findElByXY(event.clientX, event.clientY);
  10630. if (target) {
  10631. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  10632. var extHandle = Ext$1.get(target).component;
  10633. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10634. rect.x = position.x;
  10635. rect.y = position.y;
  10636. this.clearSelection();
  10637. this.appendMaskbox(rect, extHandle.id);
  10638. }
  10639. }
  10640. };
  10641. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  10642. if (dragType === void 0) { dragType = ""; }
  10643. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  10644. var ele = document.elementsFromPoint(x, y);
  10645. if (ele.length <= 1) {
  10646. return;
  10647. }
  10648. var target = null;
  10649. for (var i = 0; i < ele.length; i++) {
  10650. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  10651. 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) {
  10652. switch (dragType) {
  10653. case "cols-container":
  10654. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  10655. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  10656. target = ele[i];
  10657. }
  10658. break;
  10659. case "col-item":
  10660. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  10661. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  10662. target = ele[i];
  10663. }
  10664. break;
  10665. case "rows-container":
  10666. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  10667. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  10668. target = ele[i];
  10669. }
  10670. break;
  10671. case "row-item":
  10672. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  10673. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  10674. target = ele[i];
  10675. }
  10676. break;
  10677. default:
  10678. target = ele[i];
  10679. break;
  10680. }
  10681. if (target) {
  10682. break;
  10683. }
  10684. }
  10685. }
  10686. return target;
  10687. };
  10688. /**
  10689. * 清空选择项
  10690. */
  10691. ViewDesign.prototype.clearSelection = function () {
  10692. // $(this.designElement).removeClass('selected');
  10693. // // $(this.designElement).find('.selected').removeClass('selected')
  10694. // $(this.designElement).find('.ds_mask')
  10695. // .not('.mask_not_hide')
  10696. // .remove();
  10697. $$1('.studio_mask').remove();
  10698. // $(this.designElement).find('.selected').each(function () {
  10699. // $(this).removeClass('selected');
  10700. // // const extHandle = Ext.get(this).component
  10701. // // if (extHandle) {
  10702. // // extHandle.removeCls('selected')
  10703. // // }
  10704. // })
  10705. };
  10706. /**
  10707. * 添加遮罩层
  10708. */
  10709. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  10710. var that = this;
  10711. if (vjsonId) {
  10712. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  10713. }
  10714. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  10715. // return item === cj.xtype
  10716. // }) >= 0
  10717. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10718. 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>");
  10719. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  10720. this.$mask.css({
  10721. position: 'absolute',
  10722. top: top, left: left, width: width, height: height,
  10723. border: '2px dashed #1890ff',
  10724. zIndex: 100,
  10725. });
  10726. this.$mask.appendTo(this.$overlay);
  10727. this.$mask.on("click", ".ds_del", function (e) {
  10728. e.stopPropagation();
  10729. e.preventDefault();
  10730. that.deleteComponent(vjsonId);
  10731. });
  10732. // 点击选中父级
  10733. this.$mask.on('click', '.ds_parent', function (e) {
  10734. e.stopPropagation();
  10735. e.preventDefault();
  10736. that.selectParent(vjsonId);
  10737. });
  10738. var sel = document.getElementById(vjsonId);
  10739. var sVjosn = findInCode(this.vjson, vjsonId);
  10740. // 限制可以拖动的组件
  10741. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  10742. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  10743. this.dragSource = new Ext$1.drag.Source({
  10744. element: this.$mask[0],
  10745. constrain: this.$overlay[0],
  10746. listeners: {
  10747. dragmove: this.dragmove.bind(that, this.vjson),
  10748. dragend: this.dragend.bind(that, this.vjson)
  10749. },
  10750. startRect: rect,
  10751. sourceVjson: findInCode(this.vjson, vjsonId),
  10752. sourceVjsonId: vjsonId,
  10753. dragType: dragType
  10754. });
  10755. }
  10756. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  10757. };
  10758. /**
  10759. * 选中某个选项
  10760. */
  10761. ViewDesign.prototype.setSelection = function (id) {
  10762. var _a, _b;
  10763. if (!this.designElement) {
  10764. return;
  10765. }
  10766. // 清空选中内容
  10767. this.clearSelection();
  10768. if (!id) {
  10769. return;
  10770. }
  10771. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  10772. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10773. rect.x = position.x;
  10774. rect.y = position.y;
  10775. this.appendMaskbox(rect, id);
  10776. };
  10777. /**
  10778. * 删除组件
  10779. * @param id
  10780. */
  10781. ViewDesign.prototype.deleteComponent = function (id) {
  10782. deletVjsonById(this.vjson, id);
  10783. this.moduleObject.modulePage.currentComponentSelectId = null;
  10784. this.setVjson();
  10785. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  10786. this.clearSelection();
  10787. };
  10788. ViewDesign.prototype.selectParent = function (id) {
  10789. var pid = getSuperVjsonId(this.vjson, id);
  10790. this.moduleObject.modulePage.currentComponentSelectId = pid;
  10791. this.setSelection(pid);
  10792. };
  10793. // todo ====== 拖拽事件 ======
  10794. ViewDesign.prototype.dragmove = function (node, source, info) {
  10795. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10796. if (!target) {
  10797. return;
  10798. }
  10799. var rect = target.getBoundingClientRect();
  10800. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10801. var extHandle = Ext$1.get(target).component;
  10802. if (!extHandle) {
  10803. return;
  10804. }
  10805. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10806. rect.x = position.x;
  10807. rect.y = position.y;
  10808. this.appendDirection(rect, extHandle.id, direction);
  10809. };
  10810. ViewDesign.prototype.dragend = function (node, source, info) {
  10811. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10812. if (!target) {
  10813. return;
  10814. }
  10815. var rect = target.getBoundingClientRect();
  10816. var extHandle = Ext$1.get(target).component;
  10817. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10818. if (!extHandle) {
  10819. return;
  10820. }
  10821. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  10822. this.removeDirection();
  10823. };
  10824. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  10825. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10826. var cv = findInCode(this.vjson, vjsonId);
  10827. if (this.$direction) {
  10828. $$1('#direction' + this.id).remove();
  10829. }
  10830. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  10831. //
  10832. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  10833. if (direction) {
  10834. if (direction === "top") {
  10835. // direction = 'center'
  10836. height = height / 4;
  10837. }
  10838. else if (direction === "bottom") {
  10839. // direction = 'center'
  10840. top = top + height / 4 * 3;
  10841. height = height / 4;
  10842. }
  10843. else if (direction === "left") {
  10844. width = width / 4;
  10845. }
  10846. else if (direction === "right") {
  10847. left = left + width / 4 * 3;
  10848. width = width / 4;
  10849. }
  10850. this.$direction = $$1("<div id='direction" + this.id + "'>");
  10851. this.$direction.css({
  10852. position: 'absolute',
  10853. top: top, left: left, width: width, height: height,
  10854. // border: '2px dashed #1890ff',
  10855. background: 'rgba(40,224,218,0.75)',
  10856. zIndex: 100,
  10857. });
  10858. this.$direction.appendTo(this.$overlay);
  10859. // }
  10860. }
  10861. };
  10862. ViewDesign.prototype.removeDirection = function () {
  10863. if (this.$direction) {
  10864. this.$direction.remove();
  10865. this.$direction = null;
  10866. }
  10867. };
  10868. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  10869. var arrS;
  10870. if (sourceVjId) {
  10871. arrS = findArrayContainer(this.vjson, sourceVjId);
  10872. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  10873. var indexS = _$1.findIndex(arrS, function (v) {
  10874. return v.id === sourceVjId;
  10875. });
  10876. if (indexS < 0) {
  10877. return;
  10878. }
  10879. }
  10880. delete sourceVjson.id;
  10881. var vjsonT = findInCode(this.vjson, targetVjId);
  10882. var arrT = findArrayContainer(this.vjson, targetVjId);
  10883. var indexT = _$1.findIndex(arrT, function (v) {
  10884. return v.id === targetVjId;
  10885. });
  10886. if (indexT < 0) {
  10887. return;
  10888. }
  10889. switch (direction) {
  10890. case 'top':
  10891. case 'left':
  10892. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10893. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10894. vjsonT.items.splice(0, 0, sourceVjson);
  10895. }
  10896. else {
  10897. arrT.splice(indexT, 0, sourceVjson);
  10898. }
  10899. break;
  10900. case 'bottom':
  10901. case 'right':
  10902. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10903. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10904. vjsonT.items.push(sourceVjson);
  10905. }
  10906. else {
  10907. arrT.splice(indexT + 1, 0, sourceVjson);
  10908. }
  10909. break;
  10910. case 'center':
  10911. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10912. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10913. vjsonT.items.push(sourceVjson);
  10914. }
  10915. else {
  10916. arrT.splice(indexT, 1, sourceVjson);
  10917. }
  10918. break;
  10919. }
  10920. if (sourceVjId) {
  10921. deletVjsonById(this.vjson, sourceVjId);
  10922. sourceVjson.id = sourceVjId;
  10923. }
  10924. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  10925. };
  10926. // todo ======== 事件 ==========
  10927. // 接收 postMessage 事件分发
  10928. ViewDesign.prototype.onMessageEvent = function (event) {
  10929. var _a, _b;
  10930. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  10931. if (fucName && typeof this[fucName] === 'function') {
  10932. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  10933. }
  10934. };
  10935. // 接收外部选中组件事件
  10936. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  10937. if (from !== this.name) {
  10938. this.setSelection(id);
  10939. }
  10940. };
  10941. // 接收外部组件删除事件
  10942. ViewDesign.prototype.onComponentDelete = function (id, from) {
  10943. if (from !== this.name) {
  10944. this.deleteComponent(id);
  10945. }
  10946. };
  10947. // 组件被选中
  10948. ViewDesign.prototype.onComponentSelect = function (args) {
  10949. if (args[2] != this.moduleId) {
  10950. return;
  10951. }
  10952. if (args[0]) {
  10953. var rect = args[0];
  10954. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  10955. rect.x = position.x;
  10956. rect.y = position.y;
  10957. this.clearSelection();
  10958. this.appendMaskbox(rect, args[1]);
  10959. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  10960. }
  10961. };
  10962. ViewDesign.prototype.onComponentInfo = function (_a) {
  10963. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  10964. if (moduleId != this.moduleId) {
  10965. return;
  10966. }
  10967. if (rect) {
  10968. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  10969. rect.x = position.x;
  10970. rect.y = position.y;
  10971. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10972. var cv_1 = findInCode(this.vjson, vjsonId);
  10973. if (this.$direction) {
  10974. $$1('#direction' + this.id).remove();
  10975. }
  10976. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  10977. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  10978. if (direction) {
  10979. if (direction === "top") {
  10980. direction = 'center';
  10981. //height = height/3
  10982. }
  10983. else if (direction === "bottom") {
  10984. direction = 'center';
  10985. // top=top+height/3*2
  10986. // height = height/3
  10987. }
  10988. else if (direction === "left") {
  10989. width = width / 3;
  10990. }
  10991. else if (direction === "right") {
  10992. left = left + width / 3 * 2;
  10993. width = width / 3;
  10994. }
  10995. this.$direction = $$1("<div id='direction" + this.id + "'>");
  10996. this.$direction.css({
  10997. position: 'absolute',
  10998. top: top, left: left, width: width, height: height,
  10999. // border: '2px dashed #1890ff',
  11000. background: 'rgba(74,106,201,0.42)',
  11001. zIndex: 100,
  11002. });
  11003. this.$direction.appendTo(this.$overlay);
  11004. }
  11005. }
  11006. console.log("direction", direction);
  11007. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  11008. // rect.x = position.x
  11009. // rect.y = position.y
  11010. // this.clearSelection()
  11011. // this.appendMaskbox(rect, args[1])
  11012. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  11013. }
  11014. };
  11015. ViewDesign.prototype.onUndo = function () {
  11016. if (this.undoVjsonList.length > 0) {
  11017. if (this.redoVjsonList.length >= 100) {
  11018. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  11019. }
  11020. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11021. this.vjson = this.undoVjsonList.pop();
  11022. // this.setVjson(this.vjson, "", false, "undo")
  11023. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  11024. }
  11025. };
  11026. ViewDesign.prototype.onRedo = function () {
  11027. if (this.redoVjsonList.length > 0) {
  11028. if (this.undoVjsonList.length >= 100) {
  11029. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  11030. }
  11031. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11032. this.vjson = this.redoVjsonList.pop();
  11033. // this.setVjson(this.vjson, "", false, "redo")
  11034. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  11035. }
  11036. };
  11037. ViewDesign.prototype.onKeyPress = function (event) {
  11038. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  11039. // if (this.backStep()) {
  11040. // event.stopPropagation()
  11041. // event.preventDefault()
  11042. // return
  11043. // }
  11044. // }
  11045. //
  11046. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  11047. // if (this.recoverStep()) {
  11048. // event.stopPropagation()
  11049. // event.preventDefault()
  11050. // return
  11051. // }
  11052. // }
  11053. // if (event.key === 'ArrowUp') {
  11054. // if (this.selectParent()) {
  11055. // event.stopPropagation()
  11056. // event.preventDefault()
  11057. // return;
  11058. // }
  11059. // }
  11060. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  11061. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  11062. event.stopPropagation();
  11063. event.preventDefault();
  11064. return;
  11065. }
  11066. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  11067. // if (this.copyView()) {
  11068. // event.stopPropagation()
  11069. // event.preventDefault()
  11070. // return;
  11071. // }
  11072. // }
  11073. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  11074. // if (this.copyView(true)) {
  11075. // event.stopPropagation()
  11076. // event.preventDefault()
  11077. // return;
  11078. // }
  11079. // }
  11080. //
  11081. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  11082. // if (this.selectRoot()) {
  11083. // event.stopPropagation()
  11084. // event.preventDefault()
  11085. // return;
  11086. // }
  11087. //
  11088. };
  11089. ViewDesign.prototype.onCopy = function (event) {
  11090. if (this.moduleObject.modulePage.currentComponentSelectId) {
  11091. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  11092. if (copyVjson) {
  11093. removeDesignProp(copyVjson);
  11094. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  11095. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  11096. }
  11097. }
  11098. };
  11099. ViewDesign.prototype.onPaste = function (event) {
  11100. debugger;
  11101. };
  11102. ViewDesign.prototype.onfocus = function () {
  11103. console.log("getCopy");
  11104. console.log("document.activeElement", document.activeElement.id);
  11105. // clearTimeout(this.getOuterCopyValueTimer);
  11106. // native.clipboardRead()
  11107. };
  11108. ViewDesign.prototype.onMousemove = function (event) {
  11109. var _a;
  11110. if (document.activeElement.id === this.$overlay[0].id) {
  11111. // console.log(event.clientX, event.clientY)
  11112. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  11113. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  11114. // this.iframeWindow.postMessage({
  11115. // method: 'overlayGetInfo',
  11116. // args: [position, this.moduleId]
  11117. // }, '*')
  11118. }
  11119. }
  11120. };
  11121. ViewDesign.prototype.onDestroy = function () {
  11122. window.removeEventListener('message', this.onMessageEvent.bind(this));
  11123. for (var i = 0; i < this.subscribeList.length; i++) {
  11124. this.subscribeList[i].cancel();
  11125. }
  11126. };
  11127. // todo ======== 工具方法 ==========
  11128. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  11129. if (relative === void 0) { relative = null; }
  11130. if (from === "main" && to === "overlay") {
  11131. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11132. var x = overlayRect.x;
  11133. var y = overlayRect.y;
  11134. if (relative) {
  11135. var relativeRect = relative.getBoundingClientRect();
  11136. console.log("main->", relativeRect.x, relativeRect.y);
  11137. x = x - relativeRect.x;
  11138. y = y - relativeRect.y;
  11139. }
  11140. pos.x = pos.x - x;
  11141. pos.y = pos.y - y;
  11142. }
  11143. else if (from === "overlay" && to === "main") {
  11144. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11145. var x = overlayRect.x;
  11146. var y = overlayRect.y;
  11147. if (relative) {
  11148. var relativeRect = relative.getBoundingClientRect();
  11149. console.log("iframe->", relativeRect.x, relativeRect.y);
  11150. x = x - relativeRect.x;
  11151. y = y - relativeRect.y;
  11152. }
  11153. pos.x = pos.x + x;
  11154. pos.y = pos.y + y;
  11155. }
  11156. return pos;
  11157. };
  11158. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  11159. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  11160. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  11161. return "center";
  11162. }
  11163. // col-item 只能放左右
  11164. if (dragType === "col-item" || dragType === "") {
  11165. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  11166. if (x > rect.x && x < rect.x + rect.width / 3) {
  11167. return "left";
  11168. }
  11169. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  11170. return "right";
  11171. }
  11172. }
  11173. }
  11174. // cols-container 只能放上下
  11175. if (dragType === "cols-container" || dragType === "") {
  11176. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  11177. if (y > rect.y && y < rect.y + rect.height / 3) {
  11178. return "top";
  11179. }
  11180. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  11181. return "bottom";
  11182. }
  11183. }
  11184. }
  11185. return "";
  11186. };
  11187. return ViewDesign;
  11188. }());
  11189. //
  11190. var model$8 = {
  11191. data: {
  11192. iframeSrc: ''
  11193. }
  11194. };
  11195. var vjson$8 = {
  11196. layout: 'fit',
  11197. border: false,
  11198. iconCls: 'x-fa fa-newspaper-o',
  11199. referenceHolder: true,
  11200. items: [
  11201. {
  11202. layout: 'border',
  11203. border: false,
  11204. items: [
  11205. {
  11206. region: 'center',
  11207. xtype: 'tabpanel',
  11208. border: false,
  11209. tabPosition: 'bottom',
  11210. reference: 'tabPanel',
  11211. listeners: {
  11212. tabchange: 'scope.tabchange'
  11213. },
  11214. defaults: {
  11215. border: false,
  11216. },
  11217. items: [
  11218. {
  11219. title: 'controller.js',
  11220. xtype: 'jseditor',
  11221. reference: 'controllerEditor',
  11222. },
  11223. {
  11224. title: 'view.design',
  11225. xtype: 'designer',
  11226. reference: 'designer',
  11227. listeners: {
  11228. afterrender: 'scope.previewRender'
  11229. },
  11230. },
  11231. {
  11232. title: 'view.js',
  11233. xtype: 'jseditor',
  11234. reference: 'viewEditor',
  11235. },
  11236. {
  11237. title: 'model.js',
  11238. xtype: 'jseditor',
  11239. reference: 'modelEditor',
  11240. },
  11241. {
  11242. title: 'groovy',
  11243. xtype: 'groovyeditor',
  11244. reference: 'groovyEditor',
  11245. },
  11246. {
  11247. title: 'SQL',
  11248. xtype: 'sqleditor',
  11249. reference: 'sqlEditor',
  11250. }
  11251. ]
  11252. }
  11253. ]
  11254. }
  11255. ]
  11256. };
  11257. var ModulePage = /** @class */ (function (_super) {
  11258. __extends(ModulePage, _super);
  11259. function ModulePage(moduleId, module) {
  11260. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  11261. _this.name = "ModulePage";
  11262. _this.viewDesign = null;
  11263. _this.maxViewId = 0;
  11264. _this.moduleEventBus = new EventBus();
  11265. _this.codeChange = _$2.debounce(function (code, from, e) {
  11266. try {
  11267. switch (from) {
  11268. case _this.refs.controllerEditor.name:
  11269. moduleStore.updateJsController(_this.moduleId, code, from);
  11270. break;
  11271. case _this.refs.viewEditor.name:
  11272. moduleStore.updateJsView(_this.moduleId, code, from);
  11273. break;
  11274. case _this.refs.modelEditor.name:
  11275. moduleStore.updateJsModel(_this.moduleId, code, from);
  11276. break;
  11277. case _this.refs.groovyEditor.name:
  11278. moduleStore.updateGroovy(_this.moduleId, code, from);
  11279. break;
  11280. case _this.refs.sqlEditor.name:
  11281. moduleStore.updateMybatis(_this.moduleId, code, from);
  11282. break;
  11283. }
  11284. }
  11285. catch (e) {
  11286. }
  11287. }, 500, { maxWait: 10000 });
  11288. _this.moduleId = moduleId;
  11289. _this.module = module;
  11290. _this.cancelSubscribe = [];
  11291. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  11292. _this.initEditor(moduleItem);
  11293. }));
  11294. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  11295. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11296. _this.previewReRender();
  11297. }));
  11298. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11299. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11300. _this.updateVjson(vjson, from, ignoreRenderUI);
  11301. }));
  11302. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  11303. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11304. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  11305. }));
  11306. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11307. var id = _a.id, from = _a.from;
  11308. _this.onComponentSelectionChange(id, from);
  11309. }));
  11310. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  11311. _this.onUndo();
  11312. }));
  11313. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  11314. _this.onRedo();
  11315. }));
  11316. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  11317. _this.currentCopyVjson = stringToJsonObj(value);
  11318. }));
  11319. return _this;
  11320. }
  11321. ModulePage.prototype.onLoad = function () {
  11322. var _this = this;
  11323. // this.refs.preview.src = href
  11324. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  11325. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  11326. _this.saveCall();
  11327. }));
  11328. this.activeEditor = this.refs.controllerEditor;
  11329. this.refs.controllerEditor.modulePage = this;
  11330. this.refs.viewEditor.modulePage = this;
  11331. this.refs.modelEditor.modulePage = this;
  11332. this.refs.groovyEditor.modulePage = this;
  11333. this.refs.sqlEditor.modulePage = this;
  11334. this.refs.controllerEditor.name = "controllerEditor";
  11335. this.refs.viewEditor.name = "viewEditor";
  11336. this.refs.modelEditor.name = "modelEditor";
  11337. this.refs.groovyEditor.name = "groovyEditor";
  11338. this.refs.sqlEditor.name = "sqlEditor";
  11339. this.refs.controllerEditor.codeChange = this.codeChange;
  11340. this.refs.viewEditor.codeChange = this.codeChange;
  11341. this.refs.modelEditor.codeChange = this.codeChange;
  11342. this.refs.groovyEditor.codeChange = this.codeChange;
  11343. this.refs.sqlEditor.codeChange = this.codeChange;
  11344. };
  11345. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  11346. if (!cmpVjson || from === this.name) {
  11347. return;
  11348. }
  11349. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11350. replaceVjsonById(vj, cmpVjson);
  11351. this.updateVjson(vj, from, ignoreRenderUI);
  11352. };
  11353. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  11354. var _this = this;
  11355. var _a, _b;
  11356. if (!vjson || from === this.name) {
  11357. return;
  11358. }
  11359. this.addViewId(vjson);
  11360. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  11361. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  11362. (_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);
  11363. this.previewReRender();
  11364. _$2.defer(function () {
  11365. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  11366. });
  11367. };
  11368. ModulePage.prototype.previewRender = function (sender) {
  11369. var _this = this;
  11370. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11371. if (!this.designScope) {
  11372. this.designScope = new Scope({
  11373. vjson: vjson,
  11374. model: {
  11375. data: {}
  11376. }
  11377. });
  11378. }
  11379. else {
  11380. this.designScope.vjson = vjson;
  11381. }
  11382. this.designScope.showDesigner(sender, {
  11383. moduleId: this.moduleId,
  11384. });
  11385. if (this.viewDesign) {
  11386. return;
  11387. }
  11388. _$2.defer(function () {
  11389. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  11390. handles$1.mainWindow.setLoading(false);
  11391. });
  11392. };
  11393. ModulePage.prototype.previewReRender = function () {
  11394. var designer = this.refs.designer;
  11395. this.previewRender(designer);
  11396. };
  11397. ModulePage.prototype.initEditor = function (moduleItem) {
  11398. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  11399. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  11400. return;
  11401. (_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);
  11402. (_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);
  11403. (_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);
  11404. (_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);
  11405. (_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);
  11406. };
  11407. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  11408. this.currentComponentSelectId = id;
  11409. };
  11410. ModulePage.prototype.onUndo = function () {
  11411. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11412. this.viewDesign.onUndo();
  11413. }
  11414. };
  11415. ModulePage.prototype.onRedo = function () {
  11416. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11417. this.viewDesign.onRedo();
  11418. }
  11419. };
  11420. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  11421. this.activeEditor = newCard;
  11422. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  11423. };
  11424. ModulePage.prototype.saveCall = function () {
  11425. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  11426. moduleStore.saveFile(this.moduleId, "jsView");
  11427. }
  11428. else if (this.activeEditor === this.refs.controllerEditor) {
  11429. moduleStore.saveFile(this.moduleId, "jsController");
  11430. }
  11431. else if (this.activeEditor === this.refs.modelEditor) {
  11432. moduleStore.saveFile(this.moduleId, "jsModel");
  11433. }
  11434. else if (this.activeEditor === this.refs.groovyEditor) {
  11435. moduleStore.saveFile(this.moduleId, "groovy");
  11436. }
  11437. else if (this.activeEditor === this.refs.sqlEditor) {
  11438. moduleStore.saveFile(this.moduleId, "mybatis");
  11439. }
  11440. };
  11441. ModulePage.prototype.check = function () {
  11442. moduleStore.check(this.moduleId);
  11443. };
  11444. /**
  11445. * 为vjson添加id
  11446. * @param vjson
  11447. * @param isAll
  11448. */
  11449. ModulePage.prototype.addViewId = function (vjson, isAll) {
  11450. var _this = this;
  11451. if (isAll === void 0) { isAll = false; }
  11452. var maxIdTag = 0;
  11453. // 先提取当前的最大id
  11454. deepTravVJson(vjson, function (obj) {
  11455. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11456. return;
  11457. }
  11458. if (obj.id && obj.id.indexOf(idPrefix)) {
  11459. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  11460. if (sutr.length > 0) {
  11461. var tid = sutr.replace(idPrefix, "");
  11462. var idNum = parseInt(tid);
  11463. if (idNum && maxIdTag < idNum) {
  11464. maxIdTag = idNum;
  11465. }
  11466. }
  11467. }
  11468. });
  11469. // 标记最大的id号,避免重复
  11470. this.maxViewId = maxIdTag;
  11471. deepTravVJson(vjson, function (obj) {
  11472. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11473. return;
  11474. }
  11475. if (!obj.hasOwnProperty('id')) {
  11476. obj.id = _this.createViewId();
  11477. }
  11478. if (!obj.hasOwnProperty('designMode')) {
  11479. obj.designMode = true;
  11480. }
  11481. // if (obj.xtype == "tabview" && obj.activeTab) {
  11482. // // 设置默认的选项
  11483. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  11484. // if (typeof obj.activeTab === 'number') {
  11485. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  11486. // } else if (typeof obj.activeTab === 'string') {
  11487. // this._tabViewSelect[obj.id] = obj.activeTab
  11488. // }
  11489. //
  11490. // }
  11491. // }
  11492. if (isAll && obj.hasOwnProperty("view")) ;
  11493. });
  11494. return vjson;
  11495. };
  11496. /**
  11497. * 为组件创建 ID
  11498. */
  11499. ModulePage.prototype.createViewId = function () {
  11500. this.maxViewId++;
  11501. return this.id + idPrefix + this.maxViewId;
  11502. };
  11503. ModulePage.prototype.onDestroy = function () {
  11504. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  11505. this.cancelSubscribe[i].cancel();
  11506. }
  11507. _super.prototype.onDestroy.call(this);
  11508. };
  11509. return ModulePage;
  11510. }(Scope));
  11511. var camundaModdleDescriptor = {
  11512. "name": "Camunda",
  11513. "uri": "http://camunda.org/schema/1.0/bpmn",
  11514. "prefix": "camunda",
  11515. "xml": {
  11516. "tagAlias": "lowerCase"
  11517. },
  11518. "associations": [],
  11519. "types": [
  11520. {
  11521. "name": "Definitions",
  11522. "isAbstract": true,
  11523. "extends": [
  11524. "bpmn:Definitions"
  11525. ],
  11526. "properties": [
  11527. {
  11528. "name": "diagramRelationId",
  11529. "isAttr": true,
  11530. "type": "String"
  11531. }
  11532. ]
  11533. },
  11534. {
  11535. "name": "InOutBinding",
  11536. "superClass": [
  11537. "Element"
  11538. ],
  11539. "isAbstract": true,
  11540. "properties": [
  11541. {
  11542. "name": "source",
  11543. "isAttr": true,
  11544. "type": "String"
  11545. },
  11546. {
  11547. "name": "sourceExpression",
  11548. "isAttr": true,
  11549. "type": "String"
  11550. },
  11551. {
  11552. "name": "target",
  11553. "isAttr": true,
  11554. "type": "String"
  11555. },
  11556. {
  11557. "name": "businessKey",
  11558. "isAttr": true,
  11559. "type": "String"
  11560. },
  11561. {
  11562. "name": "local",
  11563. "isAttr": true,
  11564. "type": "Boolean",
  11565. "default": false
  11566. },
  11567. {
  11568. "name": "variables",
  11569. "isAttr": true,
  11570. "type": "String"
  11571. }
  11572. ]
  11573. },
  11574. {
  11575. "name": "In",
  11576. "superClass": [
  11577. "InOutBinding"
  11578. ],
  11579. "meta": {
  11580. "allowedIn": [
  11581. "bpmn:CallActivity",
  11582. "bpmn:SignalEventDefinition"
  11583. ]
  11584. }
  11585. },
  11586. {
  11587. "name": "Out",
  11588. "superClass": [
  11589. "InOutBinding"
  11590. ],
  11591. "meta": {
  11592. "allowedIn": [
  11593. "bpmn:CallActivity"
  11594. ]
  11595. }
  11596. },
  11597. {
  11598. "name": "AsyncCapable",
  11599. "isAbstract": true,
  11600. "extends": [
  11601. "bpmn:Activity",
  11602. "bpmn:Gateway",
  11603. "bpmn:Event"
  11604. ],
  11605. "properties": [
  11606. {
  11607. "name": "async",
  11608. "isAttr": true,
  11609. "type": "Boolean",
  11610. "default": false
  11611. },
  11612. {
  11613. "name": "asyncBefore",
  11614. "isAttr": true,
  11615. "type": "Boolean",
  11616. "default": false
  11617. },
  11618. {
  11619. "name": "asyncAfter",
  11620. "isAttr": true,
  11621. "type": "Boolean",
  11622. "default": false
  11623. },
  11624. {
  11625. "name": "exclusive",
  11626. "isAttr": true,
  11627. "type": "Boolean",
  11628. "default": true
  11629. }
  11630. ]
  11631. },
  11632. {
  11633. "name": "JobPriorized",
  11634. "isAbstract": true,
  11635. "extends": [
  11636. "bpmn:Process",
  11637. "camunda:AsyncCapable"
  11638. ],
  11639. "properties": [
  11640. {
  11641. "name": "jobPriority",
  11642. "isAttr": true,
  11643. "type": "String"
  11644. }
  11645. ]
  11646. },
  11647. {
  11648. "name": "SignalEventDefinitionExtension",
  11649. "isAbstract": true,
  11650. "extends": [
  11651. "bpmn:SignalEventDefinition"
  11652. ],
  11653. "properties": [
  11654. {
  11655. "name": "async",
  11656. "isAttr": true,
  11657. "type": "Boolean",
  11658. "default": false
  11659. }
  11660. ]
  11661. },
  11662. {
  11663. "name": "ErrorEventDefinitionExtension",
  11664. "isAbstract": true,
  11665. "extends": [
  11666. "bpmn:ErrorEventDefinition"
  11667. ],
  11668. "properties": [
  11669. {
  11670. "name": "errorCodeVariable",
  11671. "isAttr": true,
  11672. "type": "String"
  11673. },
  11674. {
  11675. "name": "errorMessageVariable",
  11676. "isAttr": true,
  11677. "type": "String"
  11678. }
  11679. ]
  11680. },
  11681. {
  11682. "name": "ErrorEventDefinition",
  11683. "superClass": [
  11684. "bpmn:ErrorEventDefinition",
  11685. "Element"
  11686. ],
  11687. "properties": [
  11688. {
  11689. "name": "expression",
  11690. "isAttr": true,
  11691. "type": "String"
  11692. }
  11693. ],
  11694. "meta": {
  11695. "allowedIn": ["bpmn:ServiceTask"]
  11696. }
  11697. },
  11698. {
  11699. "name": "Error",
  11700. "isAbstract": true,
  11701. "extends": [
  11702. "bpmn:Error"
  11703. ],
  11704. "properties": [
  11705. {
  11706. "name": "camunda:errorMessage",
  11707. "isAttr": true,
  11708. "type": "String"
  11709. }
  11710. ]
  11711. },
  11712. {
  11713. "name": "PotentialStarter",
  11714. "superClass": [
  11715. "Element"
  11716. ],
  11717. "properties": [
  11718. {
  11719. "name": "resourceAssignmentExpression",
  11720. "type": "bpmn:ResourceAssignmentExpression"
  11721. }
  11722. ]
  11723. },
  11724. {
  11725. "name": "FormSupported",
  11726. "isAbstract": true,
  11727. "extends": [
  11728. "bpmn:StartEvent",
  11729. "bpmn:UserTask"
  11730. ],
  11731. "properties": [
  11732. {
  11733. "name": "formHandlerClass",
  11734. "isAttr": true,
  11735. "type": "String"
  11736. },
  11737. {
  11738. "name": "formKey",
  11739. "isAttr": true,
  11740. "type": "String"
  11741. },
  11742. {
  11743. "name": "formRef",
  11744. "isAttr": true,
  11745. "type": "String"
  11746. },
  11747. {
  11748. "name": "formRefBinding",
  11749. "isAttr": true,
  11750. "type": "String"
  11751. },
  11752. {
  11753. "name": "formRefVersion",
  11754. "isAttr": true,
  11755. "type": "String"
  11756. }
  11757. ]
  11758. },
  11759. {
  11760. "name": "TemplateSupported",
  11761. "isAbstract": true,
  11762. "extends": [
  11763. "bpmn:Collaboration",
  11764. "bpmn:Process",
  11765. "bpmn:FlowElement"
  11766. ],
  11767. "properties": [
  11768. {
  11769. "name": "modelerTemplate",
  11770. "isAttr": true,
  11771. "type": "String"
  11772. },
  11773. {
  11774. "name": "modelerTemplateVersion",
  11775. "isAttr": true,
  11776. "type": "Integer"
  11777. }
  11778. ]
  11779. },
  11780. {
  11781. "name": "Initiator",
  11782. "isAbstract": true,
  11783. "extends": ["bpmn:StartEvent"],
  11784. "properties": [
  11785. {
  11786. "name": "initiator",
  11787. "isAttr": true,
  11788. "type": "String"
  11789. }
  11790. ]
  11791. },
  11792. {
  11793. "name": "ScriptTask",
  11794. "isAbstract": true,
  11795. "extends": [
  11796. "bpmn:ScriptTask"
  11797. ],
  11798. "properties": [
  11799. {
  11800. "name": "resultVariable",
  11801. "isAttr": true,
  11802. "type": "String"
  11803. },
  11804. {
  11805. "name": "resource",
  11806. "isAttr": true,
  11807. "type": "String"
  11808. }
  11809. ]
  11810. },
  11811. {
  11812. "name": "Process",
  11813. "isAbstract": true,
  11814. "extends": [
  11815. "bpmn:Process"
  11816. ],
  11817. "properties": [
  11818. {
  11819. "name": "candidateStarterGroups",
  11820. "isAttr": true,
  11821. "type": "String"
  11822. },
  11823. {
  11824. "name": "candidateStarterUsers",
  11825. "isAttr": true,
  11826. "type": "String"
  11827. },
  11828. {
  11829. "name": "versionTag",
  11830. "isAttr": true,
  11831. "type": "String"
  11832. },
  11833. {
  11834. "name": "historyTimeToLive",
  11835. "isAttr": true,
  11836. "type": "String"
  11837. },
  11838. {
  11839. "name": "isStartableInTasklist",
  11840. "isAttr": true,
  11841. "type": "Boolean",
  11842. "default": true
  11843. }
  11844. ]
  11845. },
  11846. {
  11847. "name": "EscalationEventDefinitionExtension",
  11848. "isAbstract": true,
  11849. "extends": [
  11850. "bpmn:EscalationEventDefinition"
  11851. ],
  11852. "properties": [
  11853. {
  11854. "name": "escalationCodeVariable",
  11855. "isAttr": true,
  11856. "type": "String"
  11857. }
  11858. ]
  11859. },
  11860. {
  11861. "name": "FormalExpression",
  11862. "isAbstract": true,
  11863. "extends": [
  11864. "bpmn:FormalExpression"
  11865. ],
  11866. "properties": [
  11867. {
  11868. "name": "resource",
  11869. "isAttr": true,
  11870. "type": "String"
  11871. }
  11872. ]
  11873. },
  11874. {
  11875. "name": "Assignable",
  11876. "extends": ["bpmn:UserTask"],
  11877. "properties": [
  11878. {
  11879. "name": "assignee",
  11880. "isAttr": true,
  11881. "type": "String"
  11882. },
  11883. {
  11884. "name": "candidateUsers",
  11885. "isAttr": true,
  11886. "type": "String"
  11887. },
  11888. {
  11889. "name": "candidateGroups",
  11890. "isAttr": true,
  11891. "type": "String"
  11892. },
  11893. {
  11894. "name": "dueDate",
  11895. "isAttr": true,
  11896. "type": "String"
  11897. },
  11898. {
  11899. "name": "followUpDate",
  11900. "isAttr": true,
  11901. "type": "String"
  11902. },
  11903. {
  11904. "name": "priority",
  11905. "isAttr": true,
  11906. "type": "String"
  11907. }
  11908. ]
  11909. },
  11910. {
  11911. "name": "CallActivity",
  11912. "extends": ["bpmn:CallActivity"],
  11913. "properties": [
  11914. {
  11915. "name": "calledElementBinding",
  11916. "isAttr": true,
  11917. "type": "String",
  11918. "default": "latest"
  11919. },
  11920. {
  11921. "name": "calledElementVersion",
  11922. "isAttr": true,
  11923. "type": "String"
  11924. },
  11925. {
  11926. "name": "calledElementVersionTag",
  11927. "isAttr": true,
  11928. "type": "String"
  11929. },
  11930. {
  11931. "name": "calledElementTenantId",
  11932. "isAttr": true,
  11933. "type": "String"
  11934. },
  11935. {
  11936. "name": "caseRef",
  11937. "isAttr": true,
  11938. "type": "String"
  11939. },
  11940. {
  11941. "name": "caseBinding",
  11942. "isAttr": true,
  11943. "type": "String",
  11944. "default": "latest"
  11945. },
  11946. {
  11947. "name": "caseVersion",
  11948. "isAttr": true,
  11949. "type": "String"
  11950. },
  11951. {
  11952. "name": "caseTenantId",
  11953. "isAttr": true,
  11954. "type": "String"
  11955. },
  11956. {
  11957. "name": "variableMappingClass",
  11958. "isAttr": true,
  11959. "type": "String"
  11960. },
  11961. {
  11962. "name": "variableMappingDelegateExpression",
  11963. "isAttr": true,
  11964. "type": "String"
  11965. }
  11966. ]
  11967. },
  11968. {
  11969. "name": "ServiceTaskLike",
  11970. "extends": [
  11971. "bpmn:ServiceTask",
  11972. "bpmn:BusinessRuleTask",
  11973. "bpmn:SendTask",
  11974. "bpmn:MessageEventDefinition"
  11975. ],
  11976. "properties": [
  11977. {
  11978. "name": "expression",
  11979. "isAttr": true,
  11980. "type": "String"
  11981. },
  11982. {
  11983. "name": "class",
  11984. "isAttr": true,
  11985. "type": "String"
  11986. },
  11987. {
  11988. "name": "delegateExpression",
  11989. "isAttr": true,
  11990. "type": "String"
  11991. },
  11992. {
  11993. "name": "resultVariable",
  11994. "isAttr": true,
  11995. "type": "String"
  11996. }
  11997. ]
  11998. },
  11999. {
  12000. "name": "DmnCapable",
  12001. "extends": [
  12002. "bpmn:BusinessRuleTask"
  12003. ],
  12004. "properties": [
  12005. {
  12006. "name": "decisionRef",
  12007. "isAttr": true,
  12008. "type": "String"
  12009. },
  12010. {
  12011. "name": "decisionRefBinding",
  12012. "isAttr": true,
  12013. "type": "String",
  12014. "default": "latest"
  12015. },
  12016. {
  12017. "name": "decisionRefVersion",
  12018. "isAttr": true,
  12019. "type": "String"
  12020. },
  12021. {
  12022. "name": "mapDecisionResult",
  12023. "isAttr": true,
  12024. "type": "String",
  12025. "default": "resultList"
  12026. },
  12027. {
  12028. "name": "decisionRefTenantId",
  12029. "isAttr": true,
  12030. "type": "String"
  12031. }
  12032. ]
  12033. },
  12034. {
  12035. "name": "ExternalCapable",
  12036. "extends": [
  12037. "camunda:ServiceTaskLike"
  12038. ],
  12039. "properties": [
  12040. {
  12041. "name": "type",
  12042. "isAttr": true,
  12043. "type": "String"
  12044. },
  12045. {
  12046. "name": "topic",
  12047. "isAttr": true,
  12048. "type": "String"
  12049. }
  12050. ]
  12051. },
  12052. {
  12053. "name": "TaskPriorized",
  12054. "extends": [
  12055. "bpmn:Process",
  12056. "camunda:ExternalCapable"
  12057. ],
  12058. "properties": [
  12059. {
  12060. "name": "taskPriority",
  12061. "isAttr": true,
  12062. "type": "String"
  12063. }
  12064. ]
  12065. },
  12066. {
  12067. "name": "Properties",
  12068. "superClass": [
  12069. "Element"
  12070. ],
  12071. "meta": {
  12072. "allowedIn": ["*"]
  12073. },
  12074. "properties": [
  12075. {
  12076. "name": "values",
  12077. "type": "Property",
  12078. "isMany": true
  12079. }
  12080. ]
  12081. },
  12082. {
  12083. "name": "Property",
  12084. "superClass": [
  12085. "Element"
  12086. ],
  12087. "properties": [
  12088. {
  12089. "name": "id",
  12090. "type": "String",
  12091. "isAttr": true
  12092. },
  12093. {
  12094. "name": "name",
  12095. "type": "String",
  12096. "isAttr": true
  12097. },
  12098. {
  12099. "name": "value",
  12100. "type": "String",
  12101. "isAttr": true
  12102. }
  12103. ]
  12104. },
  12105. {
  12106. "name": "Connector",
  12107. "superClass": [
  12108. "Element"
  12109. ],
  12110. "meta": {
  12111. "allowedIn": [
  12112. "camunda:ServiceTaskLike"
  12113. ]
  12114. },
  12115. "properties": [
  12116. {
  12117. "name": "inputOutput",
  12118. "type": "InputOutput"
  12119. },
  12120. {
  12121. "name": "connectorId",
  12122. "type": "String"
  12123. }
  12124. ]
  12125. },
  12126. {
  12127. "name": "InputOutput",
  12128. "superClass": [
  12129. "Element"
  12130. ],
  12131. "meta": {
  12132. "allowedIn": [
  12133. "bpmn:FlowNode",
  12134. "camunda:Connector"
  12135. ]
  12136. },
  12137. "properties": [
  12138. {
  12139. "name": "inputOutput",
  12140. "type": "InputOutput"
  12141. },
  12142. {
  12143. "name": "connectorId",
  12144. "type": "String"
  12145. },
  12146. {
  12147. "name": "inputParameters",
  12148. "isMany": true,
  12149. "type": "InputParameter"
  12150. },
  12151. {
  12152. "name": "outputParameters",
  12153. "isMany": true,
  12154. "type": "OutputParameter"
  12155. }
  12156. ]
  12157. },
  12158. {
  12159. "name": "InputOutputParameter",
  12160. "properties": [
  12161. {
  12162. "name": "name",
  12163. "isAttr": true,
  12164. "type": "String"
  12165. },
  12166. {
  12167. "name": "value",
  12168. "isBody": true,
  12169. "type": "String"
  12170. },
  12171. {
  12172. "name": "definition",
  12173. "type": "InputOutputParameterDefinition"
  12174. }
  12175. ]
  12176. },
  12177. {
  12178. "name": "InputOutputParameterDefinition",
  12179. "isAbstract": true
  12180. },
  12181. {
  12182. "name": "List",
  12183. "superClass": ["InputOutputParameterDefinition"],
  12184. "properties": [
  12185. {
  12186. "name": "items",
  12187. "isMany": true,
  12188. "type": "InputOutputParameterDefinition"
  12189. }
  12190. ]
  12191. },
  12192. {
  12193. "name": "Map",
  12194. "superClass": ["InputOutputParameterDefinition"],
  12195. "properties": [
  12196. {
  12197. "name": "entries",
  12198. "isMany": true,
  12199. "type": "Entry"
  12200. }
  12201. ]
  12202. },
  12203. {
  12204. "name": "Entry",
  12205. "properties": [
  12206. {
  12207. "name": "key",
  12208. "isAttr": true,
  12209. "type": "String"
  12210. },
  12211. {
  12212. "name": "value",
  12213. "isBody": true,
  12214. "type": "String"
  12215. },
  12216. {
  12217. "name": "definition",
  12218. "type": "InputOutputParameterDefinition"
  12219. }
  12220. ]
  12221. },
  12222. {
  12223. "name": "Value",
  12224. "superClass": [
  12225. "InputOutputParameterDefinition"
  12226. ],
  12227. "properties": [
  12228. {
  12229. "name": "id",
  12230. "isAttr": true,
  12231. "type": "String"
  12232. },
  12233. {
  12234. "name": "name",
  12235. "isAttr": true,
  12236. "type": "String"
  12237. },
  12238. {
  12239. "name": "value",
  12240. "isBody": true,
  12241. "type": "String"
  12242. }
  12243. ]
  12244. },
  12245. {
  12246. "name": "Script",
  12247. "superClass": ["InputOutputParameterDefinition"],
  12248. "properties": [
  12249. {
  12250. "name": "scriptFormat",
  12251. "isAttr": true,
  12252. "type": "String"
  12253. },
  12254. {
  12255. "name": "resource",
  12256. "isAttr": true,
  12257. "type": "String"
  12258. },
  12259. {
  12260. "name": "value",
  12261. "isBody": true,
  12262. "type": "String"
  12263. }
  12264. ]
  12265. },
  12266. {
  12267. "name": "Field",
  12268. "superClass": ["Element"],
  12269. "meta": {
  12270. "allowedIn": [
  12271. "camunda:ServiceTaskLike",
  12272. "camunda:ExecutionListener",
  12273. "camunda:TaskListener"
  12274. ]
  12275. },
  12276. "properties": [
  12277. {
  12278. "name": "name",
  12279. "isAttr": true,
  12280. "type": "String"
  12281. },
  12282. {
  12283. "name": "expression",
  12284. "type": "String"
  12285. },
  12286. {
  12287. "name": "stringValue",
  12288. "isAttr": true,
  12289. "type": "String"
  12290. },
  12291. {
  12292. "name": "string",
  12293. "type": "String"
  12294. }
  12295. ]
  12296. },
  12297. {
  12298. "name": "InputParameter",
  12299. "superClass": ["InputOutputParameter"]
  12300. },
  12301. {
  12302. "name": "OutputParameter",
  12303. "superClass": ["InputOutputParameter"]
  12304. },
  12305. {
  12306. "name": "Collectable",
  12307. "isAbstract": true,
  12308. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  12309. "superClass": ["camunda:AsyncCapable"],
  12310. "properties": [
  12311. {
  12312. "name": "collection",
  12313. "isAttr": true,
  12314. "type": "String"
  12315. },
  12316. {
  12317. "name": "elementVariable",
  12318. "isAttr": true,
  12319. "type": "String"
  12320. }
  12321. ]
  12322. },
  12323. {
  12324. "name": "FailedJobRetryTimeCycle",
  12325. "superClass": ["Element"],
  12326. "meta": {
  12327. "allowedIn": [
  12328. "camunda:AsyncCapable",
  12329. "bpmn:MultiInstanceLoopCharacteristics"
  12330. ]
  12331. },
  12332. "properties": [
  12333. {
  12334. "name": "body",
  12335. "isBody": true,
  12336. "type": "String"
  12337. }
  12338. ]
  12339. },
  12340. {
  12341. "name": "ExecutionListener",
  12342. "superClass": ["Element"],
  12343. "meta": {
  12344. "allowedIn": [
  12345. "bpmn:Task",
  12346. "bpmn:ServiceTask",
  12347. "bpmn:UserTask",
  12348. "bpmn:BusinessRuleTask",
  12349. "bpmn:ScriptTask",
  12350. "bpmn:ReceiveTask",
  12351. "bpmn:ManualTask",
  12352. "bpmn:ExclusiveGateway",
  12353. "bpmn:SequenceFlow",
  12354. "bpmn:ParallelGateway",
  12355. "bpmn:InclusiveGateway",
  12356. "bpmn:EventBasedGateway",
  12357. "bpmn:StartEvent",
  12358. "bpmn:IntermediateCatchEvent",
  12359. "bpmn:IntermediateThrowEvent",
  12360. "bpmn:EndEvent",
  12361. "bpmn:BoundaryEvent",
  12362. "bpmn:CallActivity",
  12363. "bpmn:SubProcess",
  12364. "bpmn:Process"
  12365. ]
  12366. },
  12367. "properties": [
  12368. {
  12369. "name": "expression",
  12370. "isAttr": true,
  12371. "type": "String"
  12372. },
  12373. {
  12374. "name": "class",
  12375. "isAttr": true,
  12376. "type": "String"
  12377. },
  12378. {
  12379. "name": "delegateExpression",
  12380. "isAttr": true,
  12381. "type": "String"
  12382. },
  12383. {
  12384. "name": "event",
  12385. "isAttr": true,
  12386. "type": "String"
  12387. },
  12388. {
  12389. "name": "script",
  12390. "type": "Script"
  12391. },
  12392. {
  12393. "name": "fields",
  12394. "type": "Field",
  12395. "isMany": true
  12396. }
  12397. ]
  12398. },
  12399. {
  12400. "name": "TaskListener",
  12401. "superClass": ["Element"],
  12402. "meta": {
  12403. "allowedIn": [
  12404. "bpmn:UserTask"
  12405. ]
  12406. },
  12407. "properties": [
  12408. {
  12409. "name": "expression",
  12410. "isAttr": true,
  12411. "type": "String"
  12412. },
  12413. {
  12414. "name": "class",
  12415. "isAttr": true,
  12416. "type": "String"
  12417. },
  12418. {
  12419. "name": "delegateExpression",
  12420. "isAttr": true,
  12421. "type": "String"
  12422. },
  12423. {
  12424. "name": "event",
  12425. "isAttr": true,
  12426. "type": "String"
  12427. },
  12428. {
  12429. "name": "script",
  12430. "type": "Script"
  12431. },
  12432. {
  12433. "name": "fields",
  12434. "type": "Field",
  12435. "isMany": true
  12436. },
  12437. {
  12438. "name": "id",
  12439. "type": "String",
  12440. "isAttr": true
  12441. },
  12442. {
  12443. "name": "eventDefinitions",
  12444. "type": "bpmn:TimerEventDefinition",
  12445. "isMany": true
  12446. }
  12447. ]
  12448. },
  12449. {
  12450. "name": "FormProperty",
  12451. "superClass": ["Element"],
  12452. "meta": {
  12453. "allowedIn": [
  12454. "bpmn:StartEvent",
  12455. "bpmn:UserTask"
  12456. ]
  12457. },
  12458. "properties": [
  12459. {
  12460. "name": "id",
  12461. "type": "String",
  12462. "isAttr": true
  12463. },
  12464. {
  12465. "name": "name",
  12466. "type": "String",
  12467. "isAttr": true
  12468. },
  12469. {
  12470. "name": "type",
  12471. "type": "String",
  12472. "isAttr": true
  12473. },
  12474. {
  12475. "name": "required",
  12476. "type": "String",
  12477. "isAttr": true
  12478. },
  12479. {
  12480. "name": "readable",
  12481. "type": "String",
  12482. "isAttr": true
  12483. },
  12484. {
  12485. "name": "writable",
  12486. "type": "String",
  12487. "isAttr": true
  12488. },
  12489. {
  12490. "name": "variable",
  12491. "type": "String",
  12492. "isAttr": true
  12493. },
  12494. {
  12495. "name": "expression",
  12496. "type": "String",
  12497. "isAttr": true
  12498. },
  12499. {
  12500. "name": "datePattern",
  12501. "type": "String",
  12502. "isAttr": true
  12503. },
  12504. {
  12505. "name": "default",
  12506. "type": "String",
  12507. "isAttr": true
  12508. },
  12509. {
  12510. "name": "values",
  12511. "type": "Value",
  12512. "isMany": true
  12513. }
  12514. ]
  12515. },
  12516. {
  12517. "name": "FormData",
  12518. "superClass": ["Element"],
  12519. "meta": {
  12520. "allowedIn": [
  12521. "bpmn:StartEvent",
  12522. "bpmn:UserTask"
  12523. ]
  12524. },
  12525. "properties": [
  12526. {
  12527. "name": "fields",
  12528. "type": "FormField",
  12529. "isMany": true
  12530. },
  12531. {
  12532. "name": "businessKey",
  12533. "type": "String",
  12534. "isAttr": true
  12535. }
  12536. ]
  12537. },
  12538. {
  12539. "name": "FormField",
  12540. "superClass": ["Element"],
  12541. "properties": [
  12542. {
  12543. "name": "id",
  12544. "type": "String",
  12545. "isAttr": true
  12546. },
  12547. {
  12548. "name": "label",
  12549. "type": "String",
  12550. "isAttr": true
  12551. },
  12552. {
  12553. "name": "type",
  12554. "type": "String",
  12555. "isAttr": true
  12556. },
  12557. {
  12558. "name": "datePattern",
  12559. "type": "String",
  12560. "isAttr": true
  12561. },
  12562. {
  12563. "name": "defaultValue",
  12564. "type": "String",
  12565. "isAttr": true
  12566. },
  12567. {
  12568. "name": "properties",
  12569. "type": "Properties"
  12570. },
  12571. {
  12572. "name": "validation",
  12573. "type": "Validation"
  12574. },
  12575. {
  12576. "name": "values",
  12577. "type": "Value",
  12578. "isMany": true
  12579. }
  12580. ]
  12581. },
  12582. {
  12583. "name": "Validation",
  12584. "superClass": ["Element"],
  12585. "properties": [
  12586. {
  12587. "name": "constraints",
  12588. "type": "Constraint",
  12589. "isMany": true
  12590. }
  12591. ]
  12592. },
  12593. {
  12594. "name": "Constraint",
  12595. "superClass": ["Element"],
  12596. "properties": [
  12597. {
  12598. "name": "name",
  12599. "type": "String",
  12600. "isAttr": true
  12601. },
  12602. {
  12603. "name": "config",
  12604. "type": "String",
  12605. "isAttr": true
  12606. }
  12607. ]
  12608. },
  12609. {
  12610. "name": "ConditionalEventDefinitionExtension",
  12611. "isAbstract": true,
  12612. "extends": [
  12613. "bpmn:ConditionalEventDefinition"
  12614. ],
  12615. "properties": [
  12616. {
  12617. "name": "variableName",
  12618. "isAttr": true,
  12619. "type": "String"
  12620. },
  12621. {
  12622. "name": "variableEvents",
  12623. "isAttr": true,
  12624. "type": "String"
  12625. }
  12626. ]
  12627. }
  12628. ],
  12629. "emumerations": []
  12630. };
  12631. /**
  12632. * This is a sample file that should be replaced with the actual translation.
  12633. *
  12634. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  12635. * translations and labels to translate.
  12636. */
  12637. var translations = {
  12638. // Labels
  12639. 'Activate the global connect tool': '激活全局连接工具',
  12640. 'Append {type}': '追加 {type}',
  12641. 'Append EndEvent': '追加 结束事件 ',
  12642. 'Append Task': '追加 任务',
  12643. 'Append Gateway': '追加 网关',
  12644. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  12645. 'Add Lane above': '在上面添加道',
  12646. 'Divide into two Lanes': '分割成两个道',
  12647. 'Divide into three Lanes': '分割成三个道',
  12648. 'Add Lane below': '在下面添加道',
  12649. 'Append compensation activity': '追加补偿活动',
  12650. 'Change type': '修改类型',
  12651. 'Connect using Association': '使用关联连接',
  12652. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  12653. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  12654. 'Remove': '移除',
  12655. 'Activate the hand tool': '激活抓手工具',
  12656. 'Activate the lasso tool': '激活套索工具',
  12657. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  12658. 'Create expanded SubProcess': '创建扩展子过程',
  12659. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  12660. 'Create Pool/Participant': '创建池/参与者',
  12661. 'Parallel Multi Instance': '并行多重事件',
  12662. 'Sequential Multi Instance': '时序多重事件',
  12663. 'DataObjectReference': '数据对象参考',
  12664. 'DataStoreReference': '数据存储参考',
  12665. 'Loop': '循环',
  12666. 'Ad-hoc': '即席',
  12667. 'Create {type}': '创建 {type}',
  12668. 'Create Task': '创建任务',
  12669. 'Create StartEvent': '创建开始事件',
  12670. 'Create EndEvent': '创建结束事件',
  12671. 'Create Group': '创建组',
  12672. 'Task': '任务',
  12673. 'Send Task': '发送任务',
  12674. 'Receive Task': '接收任务',
  12675. 'User Task': '用户任务',
  12676. 'Manual Task': '手工任务',
  12677. 'Business Rule Task': '业务规则任务',
  12678. 'Service Task': '服务任务',
  12679. 'Script Task': '脚本任务',
  12680. 'Call Activity': '调用活动',
  12681. 'Sub Process (collapsed)': '子流程(折叠的)',
  12682. 'Sub Process (expanded)': '子流程(展开的)',
  12683. 'Start Event': '开始事件',
  12684. 'StartEvent': '开始事件',
  12685. 'Intermediate Throw Event': '中间事件',
  12686. 'End Event': '结束事件',
  12687. 'EndEvent': '结束事件',
  12688. 'Create Gateway': '创建网关',
  12689. 'GateWay': '网关',
  12690. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  12691. 'Message Start Event': '消息开始事件',
  12692. 'Timer Start Event': '定时开始事件',
  12693. 'Conditional Start Event': '条件开始事件',
  12694. 'Signal Start Event': '信号开始事件',
  12695. 'Error Start Event': '错误开始事件',
  12696. 'Escalation Start Event': '升级开始事件',
  12697. 'Compensation Start Event': '补偿开始事件',
  12698. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  12699. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  12700. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  12701. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  12702. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  12703. 'Message Intermediate Catch Event': '消息中间捕获事件',
  12704. 'Message Intermediate Throw Event': '消息中间抛出事件',
  12705. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  12706. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  12707. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  12708. 'Link Intermediate Catch Event': '链接中间捕获事件',
  12709. 'Link Intermediate Throw Event': '链接中间抛出事件',
  12710. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  12711. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  12712. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  12713. 'Message End Event': '消息结束事件',
  12714. 'Escalation End Event': '定时结束事件',
  12715. 'Error End Event': '错误结束事件',
  12716. 'Cancel End Event': '取消结束事件',
  12717. 'Compensation End Event': '补偿结束事件',
  12718. 'Signal End Event': '信号结束事件',
  12719. 'Terminate End Event': '终止结束事件',
  12720. 'Message Boundary Event': '消息边界事件',
  12721. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  12722. 'Timer Boundary Event': '定时边界事件',
  12723. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  12724. 'Escalation Boundary Event': '升级边界事件',
  12725. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  12726. 'Conditional Boundary Event': '条件边界事件',
  12727. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  12728. 'Error Boundary Event': '错误边界事件',
  12729. 'Cancel Boundary Event': '取消边界事件',
  12730. 'Signal Boundary Event': '信号边界事件',
  12731. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  12732. 'Compensation Boundary Event': '补偿边界事件',
  12733. 'Exclusive Gateway': '互斥网关',
  12734. 'Parallel Gateway': '并行网关',
  12735. 'Inclusive Gateway': '相容网关',
  12736. 'Complex Gateway': '复杂网关',
  12737. 'Event based Gateway': '事件网关',
  12738. 'Transaction': '转运',
  12739. 'Sub Process': '子流程',
  12740. 'Event Sub Process': '事件子流程',
  12741. 'Collapsed Pool': '折叠池',
  12742. 'Expanded Pool': '展开池',
  12743. // Errors
  12744. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  12745. 'no shape type specified': '没有指定的形状类型',
  12746. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  12747. 'out of bounds release': 'out of bounds release',
  12748. 'more than {count} child lanes': '子道大于{count} ',
  12749. 'element required': '元素不能为空',
  12750. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  12751. 'no diagram to display': '没有可展示的流程图',
  12752. 'no process or collaboration to display': '没有可展示的流程/协作',
  12753. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  12754. 'already rendered {element}': '{element} 已被渲染',
  12755. 'failed to import {element}': '导入{element}失败',
  12756. // 属性面板的参数
  12757. 'Id': '编号',
  12758. 'Name': '名称',
  12759. 'General': '常规',
  12760. 'Details': '详情',
  12761. 'Message Name': '消息名称',
  12762. 'Message': '消息',
  12763. 'Initiator': '创建者',
  12764. 'Asynchronous Continuations': '持续异步',
  12765. 'Asynchronous Before': '异步前',
  12766. 'Asynchronous After': '异步后',
  12767. 'Job Configuration': '工作配置',
  12768. 'Exclusive': '排除',
  12769. 'Job Priority': '工作优先级',
  12770. 'Retry Time Cycle': '重试时间周期',
  12771. 'Documentation': '文档',
  12772. 'Element Documentation': '元素文档',
  12773. 'History Configuration': '历史配置',
  12774. 'History Time To Live': '历史的生存时间',
  12775. 'Forms': '表单',
  12776. 'Form Key': '表单key',
  12777. 'Form Fields': '表单字段',
  12778. 'Business Key': '业务key',
  12779. 'Form Field': '表单字段',
  12780. 'ID': '编号',
  12781. 'Type': '类型',
  12782. 'Label': '名称',
  12783. 'Default Value': '默认值',
  12784. 'Validation': '校验',
  12785. 'Add Constraint': '添加约束',
  12786. 'Config': '配置',
  12787. 'Properties': '属性',
  12788. 'Add Property': '添加属性',
  12789. 'Value': '值',
  12790. 'Add': '添加',
  12791. 'Values': '值',
  12792. 'Add Value': '添加值',
  12793. 'Listeners': '监听器',
  12794. 'Execution Listener': '执行监听',
  12795. 'Event Type': '事件类型',
  12796. 'Listener Type': '监听器类型',
  12797. 'Java Class': 'Java类',
  12798. 'Expression': '表达式',
  12799. 'Must provide a value': '必须提供一个值',
  12800. 'Delegate Expression': '代理表达式',
  12801. 'Script': '脚本',
  12802. 'Script Format': '脚本格式',
  12803. 'Script Type': '脚本类型',
  12804. 'Inline Script': '内联脚本',
  12805. 'External Script': '外部脚本',
  12806. 'Resource': '资源',
  12807. 'Field Injection': '字段注入',
  12808. 'Extensions': '扩展',
  12809. 'Input/Output': '输入/输出',
  12810. 'Input Parameters': '输入参数',
  12811. 'Output Parameters': '输出参数',
  12812. 'Parameters': '参数',
  12813. 'Output Parameter': '输出参数',
  12814. 'Timer Definition Type': '定时器定义类型',
  12815. 'Timer Definition': '定时器定义',
  12816. 'Date': '日期',
  12817. 'Duration': '持续',
  12818. 'Cycle': '循环',
  12819. 'Signal': '信号',
  12820. 'Signal Name': '信号名称',
  12821. 'Escalation': '升级',
  12822. 'Error': '错误',
  12823. 'Link Name': '链接名称',
  12824. 'Condition': '条件名称',
  12825. 'Variable Name': '变量名称',
  12826. 'Variable Event': '变量事件',
  12827. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  12828. 'Wait for Completion': '等待完成',
  12829. 'Activity Ref': '活动参考',
  12830. 'Version Tag': '版本标签',
  12831. 'Executable': '可执行文件',
  12832. 'External Task Configuration': '扩展任务配置',
  12833. 'Task Priority': '任务优先级',
  12834. 'External': '外部',
  12835. 'Connector': '连接器',
  12836. 'Must configure Connector': '必须配置连接器',
  12837. 'Connector Id': '连接器编号',
  12838. 'Implementation': '实现方式',
  12839. 'Field Injections': '字段注入',
  12840. 'Fields': '字段',
  12841. 'Result Variable': '结果变量',
  12842. 'Topic': '主题',
  12843. 'Configure Connector': '配置连接器',
  12844. 'Input Parameter': '输入参数',
  12845. 'Assignee': '代理人',
  12846. 'Candidate Users': '候选用户',
  12847. 'Candidate Groups': '候选组',
  12848. 'Due Date': '到期时间',
  12849. 'Follow Up Date': '跟踪日期',
  12850. 'Priority': '优先级',
  12851. // eslint-disable-next-line no-template-curly-in-string
  12852. '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',
  12853. // eslint-disable-next-line no-template-curly-in-string
  12854. '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',
  12855. 'Variables': '变量',
  12856. 'Candidate Starter Configuration': '候选开始配置',
  12857. 'Task Listener': '任务监听器',
  12858. 'Candidate Starter Groups': '候选开始组',
  12859. 'Candidate Starter Users': '候选开始用户',
  12860. 'Tasklist Configuration': '任务列表配置',
  12861. 'Startable': '启动',
  12862. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  12863. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  12864. 'This maps to the process definition key.': '这会映射为流程定义的键',
  12865. 'CallActivity Type': '调用活动类型',
  12866. 'Condition Type': '条件类型',
  12867. 'Create UserTask': '创建用户任务',
  12868. 'Create CallActivity': '创建调用活动',
  12869. 'Called Element': '调用元素',
  12870. 'Create DataObjectReference': '创建数据对象引用',
  12871. 'Create DataStoreReference': '创建数据存储引用',
  12872. 'Multi Instance': '多实例',
  12873. 'Loop Cardinality': '实例数量',
  12874. Collection: '任务参与人列表',
  12875. 'Element Variable': '元素变量',
  12876. 'Completion Condition': '完成条件'
  12877. };
  12878. function customTranslate(template, replacements) {
  12879. replacements = replacements || {};
  12880. // Translate
  12881. template = translations[template] || template;
  12882. // Replace
  12883. return template.replace(/{([^}]+)}/g, function (_, key) {
  12884. return replacements[key] || '{' + key + '}';
  12885. });
  12886. }
  12887. var vjson$9 = {
  12888. title: '导入流程',
  12889. layout: 'fit',
  12890. width: 400,
  12891. height: 400,
  12892. items: [
  12893. {
  12894. layout: 'border',
  12895. items: [
  12896. {
  12897. xtype: 'form',
  12898. items: [
  12899. // {
  12900. // xtype: 'cols',
  12901. // items: [
  12902. // {
  12903. // xtype: 'textfield',
  12904. // allowBlank: false,
  12905. // fieldLabel: '流程名称',
  12906. // bind: '{name}'
  12907. // },
  12908. // ],
  12909. // },
  12910. {
  12911. xtype: 'cols',
  12912. items: [
  12913. {
  12914. xtype: 'filefield',
  12915. name: 'deployFile',
  12916. fieldLabel: '文件名称',
  12917. // labelWidth: '100%',
  12918. msgTarget: 'side',
  12919. reference: 'MOBANB_FILE',
  12920. fileUpload: true,
  12921. allowBlank: false,
  12922. // flex: 1,
  12923. // width: '100%',
  12924. buttonText: '请选择文件位置',
  12925. listeners: {
  12926. change: 'scope.fileChange'
  12927. }
  12928. // bind: '{FILE}'
  12929. },
  12930. ]
  12931. }
  12932. ],
  12933. region: 'center',
  12934. split: true,
  12935. },
  12936. ],
  12937. },
  12938. ],
  12939. fbar: {
  12940. xtype: 'toolbar',
  12941. items: [
  12942. {
  12943. xtype: 'button',
  12944. text: '保存',
  12945. iconCls: 'x-fa fa-save',
  12946. listeners: {
  12947. click: 'scope.save',
  12948. },
  12949. }
  12950. ],
  12951. },
  12952. };
  12953. var model$9 = {
  12954. data: {
  12955. name: '',
  12956. file_content: ''
  12957. }
  12958. };
  12959. var ImportBpmn = /** @class */ (function (_super) {
  12960. __extends(ImportBpmn, _super);
  12961. function ImportBpmn() {
  12962. return _super.call(this, { model: model$9, vjson: vjson$9 }) || this;
  12963. }
  12964. ImportBpmn.prototype.onLoad = function () {
  12965. };
  12966. ImportBpmn.prototype.save = function (sender) {
  12967. if (this.data.file_content) {
  12968. this.dialogSuccess(this.data);
  12969. }
  12970. else {
  12971. Ext.Msg.alert('提示', "请先上传文件");
  12972. }
  12973. };
  12974. ImportBpmn.prototype.fileChange = function (e) {
  12975. var _this = this;
  12976. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  12977. var file = e.fileInputEl.dom.files[0]; //获取文件
  12978. var reader = new FileReader();
  12979. reader.readAsText(file, "UTF-8");
  12980. reader.onload = function () {
  12981. _this.data.file_content = reader.result;
  12982. };
  12983. };
  12984. return ImportBpmn;
  12985. }(Scope));
  12986. var model$a = {
  12987. data: {
  12988. form_id: '',
  12989. form_name: '',
  12990. save_dir_path: '',
  12991. absolute_path: '',
  12992. form: {
  12993. id: '',
  12994. code: '',
  12995. name: '',
  12996. table: '',
  12997. controller: '',
  12998. groovy: '',
  12999. fields: [],
  13000. buttons: [],
  13001. },
  13002. }
  13003. };
  13004. var vjson$a = {
  13005. title: '配置适配策略',
  13006. layout: 'fit',
  13007. items: [
  13008. {
  13009. layout: 'border',
  13010. items: [
  13011. {
  13012. region: 'center',
  13013. xtype: 'yvgrid',
  13014. pagination: false,
  13015. hideFootbar: true,
  13016. plugins: {
  13017. clipboard: true,
  13018. selectionreplicator: true
  13019. },
  13020. tbar: {
  13021. xtype: 'toolbar',
  13022. items: [
  13023. {
  13024. xtype: 'button',
  13025. text: '添加策略',
  13026. iconCls: 'x-fa fa-plus-circle',
  13027. listeners: {
  13028. click: 'scope.addStrategy'
  13029. }
  13030. },
  13031. {
  13032. xtype: 'button',
  13033. text: '删除',
  13034. iconCls: 'x-fa fa-minus-circle',
  13035. listeners: {}
  13036. },
  13037. '-',
  13038. {
  13039. xtype: 'button',
  13040. text: '上移',
  13041. iconCls: 'x-fa fa-arrow-up',
  13042. listeners: {}
  13043. },
  13044. {
  13045. xtype: 'button',
  13046. text: '下移',
  13047. iconCls: 'x-fa fa-arrow-down',
  13048. listeners: {}
  13049. },
  13050. ]
  13051. },
  13052. columns: [
  13053. { xtype: 'rownumberer' },
  13054. {
  13055. header: '优先级',
  13056. dataIndex: 'priority',
  13057. width: 140,
  13058. sortable: false,
  13059. menuDisabled: true,
  13060. editor: {
  13061. selectOnFocus: true
  13062. },
  13063. },
  13064. {
  13065. header: '策略编号',
  13066. dataIndex: 'strategy_code',
  13067. width: 140,
  13068. sortable: false,
  13069. menuDisabled: true,
  13070. editor: {
  13071. selectOnFocus: true
  13072. },
  13073. },
  13074. {
  13075. header: '策略名称',
  13076. dataIndex: 'strategy_name',
  13077. width: 140,
  13078. sortable: false,
  13079. menuDisabled: true,
  13080. editor: {
  13081. selectOnFocus: true
  13082. },
  13083. },
  13084. {
  13085. header: "条件表达式",
  13086. dataIndex: "strategy_exp",
  13087. },
  13088. ],
  13089. },
  13090. {
  13091. title: '适配条件',
  13092. region: 'south',
  13093. height: '50%',
  13094. xtype: 'form',
  13095. items: [
  13096. {
  13097. xtype: 'cols',
  13098. items: [
  13099. {
  13100. xtype: 'rows',
  13101. items: [
  13102. {
  13103. xtype: 'textfield',
  13104. fieldLabel: "仓库",
  13105. },
  13106. {
  13107. xtype: 'textfield',
  13108. fieldLabel: "货主",
  13109. },
  13110. {
  13111. xtype: 'textfield',
  13112. fieldLabel: "项目",
  13113. },
  13114. {
  13115. xtype: 'textfield',
  13116. fieldLabel: "行政区划",
  13117. },
  13118. {
  13119. xtype: 'textfield',
  13120. fieldLabel: "客户",
  13121. },
  13122. {
  13123. xtype: 'textfield',
  13124. fieldLabel: "商品",
  13125. }
  13126. ]
  13127. },
  13128. {
  13129. xtype: 'rows',
  13130. margin: '8 0 0 10',
  13131. items: [
  13132. {
  13133. xtype: 'label',
  13134. html: '自定义表达式',
  13135. },
  13136. {
  13137. xtype: 'textarea',
  13138. }
  13139. ]
  13140. }
  13141. ]
  13142. }
  13143. ]
  13144. }
  13145. ]
  13146. }
  13147. ]
  13148. };
  13149. //
  13150. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  13151. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  13152. // import ReportRunner from "./ReportRunner";
  13153. var ConfigStrategy = /** @class */ (function (_super) {
  13154. __extends(ConfigStrategy, _super);
  13155. function ConfigStrategy() {
  13156. return _super.call(this, { model: model$a, vjson: vjson$a }) || this;
  13157. }
  13158. ConfigStrategy.prototype.onLoad = function () {
  13159. this.load();
  13160. };
  13161. ConfigStrategy.prototype.load = function () {
  13162. var _this = this;
  13163. var form_id = this.viewModel.get("form_id");
  13164. var absolute_path = this.viewModel.get("absolute_path");
  13165. var save_dir_path = this.viewModel.get("save_dir_path");
  13166. if (absolute_path && form_id) {
  13167. this.setLoading(true);
  13168. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  13169. if (res.success) {
  13170. // 基础属性
  13171. _this.viewModel.set('form', res.data.form);
  13172. // 字段定义
  13173. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  13174. // 按钮
  13175. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  13176. }
  13177. }).finally(function () {
  13178. _this.setLoading(false);
  13179. });
  13180. }
  13181. };
  13182. ConfigStrategy.prototype.saveAll = function () {
  13183. var _this = this;
  13184. var save_dir_path = this.viewModel.get("save_dir_path");
  13185. if (!save_dir_path) {
  13186. msg("save_dir_path error");
  13187. return;
  13188. }
  13189. var form_id = this.viewModel.get("form_id");
  13190. var absolute_path = this.viewModel.get("absolute_path");
  13191. // 表格校验
  13192. if (!this.refs.form1.isValid()) {
  13193. msg("请检查表单必填项!");
  13194. return;
  13195. }
  13196. // 字段数据
  13197. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  13198. delete item.id;
  13199. if (item.hide) {
  13200. delete item.hide_text;
  13201. }
  13202. else {
  13203. item.hide = item.hide_text;
  13204. delete item.hide_text;
  13205. }
  13206. if (item.readonly) {
  13207. delete item.readonly_text;
  13208. }
  13209. else {
  13210. item.readonly = item.readonly_text;
  13211. delete item.readonly_text;
  13212. }
  13213. if (item.disabled) {
  13214. delete item.disabled_text;
  13215. }
  13216. else {
  13217. item.disabled = item.disabled_text;
  13218. delete item.disabled_text;
  13219. }
  13220. if (item.required) {
  13221. delete item.required_text;
  13222. }
  13223. else {
  13224. item.required = item.required_text;
  13225. delete item.required_text;
  13226. }
  13227. return item;
  13228. });
  13229. this.viewModel.set("form.fields", gridColumnRows);
  13230. // 按钮数据
  13231. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  13232. delete item.id;
  13233. return item;
  13234. });
  13235. this.viewModel.set("form.buttons", gridBtnRows);
  13236. // 查询条件
  13237. // 策略
  13238. var form = this.viewModel.get("form");
  13239. this.setLoading(true);
  13240. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  13241. if (res.success) {
  13242. msg('保存成功');
  13243. handles$1.mainWindow.refs['exporerTree'].reload();
  13244. }
  13245. }).finally(function () {
  13246. _this.setLoading(false);
  13247. });
  13248. };
  13249. ConfigStrategy.prototype.addColumn = function () {
  13250. this.refs.gridColumn.getStore().add({});
  13251. };
  13252. ConfigStrategy.prototype.removeColumn = function () {
  13253. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  13254. };
  13255. ConfigStrategy.prototype.calcColumn = function (sender) {
  13256. var _this = this;
  13257. var table = this.viewModel.get("form.table");
  13258. if (!table) {
  13259. msg("表名不存在!");
  13260. return;
  13261. }
  13262. this.setLoading(true);
  13263. calcColumnForm({ table: table }).then(function (res) {
  13264. if (res.success) {
  13265. msg(res.msg);
  13266. if (res.data.columns.length > 0) {
  13267. _$2.forEach(res.data.columns, function (it) {
  13268. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  13269. });
  13270. }
  13271. }
  13272. }).finally(function () {
  13273. _this.setLoading(false);
  13274. });
  13275. };
  13276. ConfigStrategy.prototype.addButton = function () {
  13277. this.refs.gridButton.getStore().add({});
  13278. };
  13279. ConfigStrategy.prototype.moveUp = function (sender) {
  13280. var grid = sender.up('grid');
  13281. grid.rowMoveUp();
  13282. };
  13283. ConfigStrategy.prototype.moveDown = function (sender) {
  13284. var grid = sender.up('grid');
  13285. grid.rowMoveDown();
  13286. };
  13287. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  13288. var win = new Ext.Window({
  13289. autoDestroy: true,
  13290. title: "添加(编辑)策略",
  13291. width: 400,
  13292. height: 300,
  13293. resizable: true,
  13294. closable: true,
  13295. maximizable: true,
  13296. minimizable: true,
  13297. plain: true,
  13298. // constrainHeader: true,
  13299. constrain: true,
  13300. layout: 'fit',
  13301. animateTarget: sender,
  13302. buttonAlign: 'center',
  13303. items: [
  13304. {
  13305. xtype: "form",
  13306. layout: "hbox",
  13307. margin: '10px 20px',
  13308. border: 0,
  13309. items: [
  13310. {
  13311. flex: 1,
  13312. layout: 'vbox',
  13313. items: [
  13314. {
  13315. xtype: "numberfield",
  13316. fieldLabel: "优先级",
  13317. flex: 1,
  13318. allowBlank: false,
  13319. labelWidth: 50,
  13320. width: "100%",
  13321. },
  13322. {
  13323. xtype: "textfield",
  13324. fieldLabel: "策略名称",
  13325. flex: 1,
  13326. allowBlank: false,
  13327. labelWidth: 50,
  13328. width: "100%",
  13329. },
  13330. {
  13331. xtype: "textfield",
  13332. fieldLabel: "策略编号",
  13333. flex: 1,
  13334. allowBlank: false,
  13335. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13336. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13337. labelWidth: 50,
  13338. width: "100%",
  13339. },
  13340. {
  13341. xtype: "textfield",
  13342. fieldLabel: "仓库ID",
  13343. flex: 1,
  13344. allowBlank: false,
  13345. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13346. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13347. labelWidth: 50,
  13348. width: "100%",
  13349. },
  13350. ]
  13351. },
  13352. ]
  13353. }
  13354. ],
  13355. //窗口按钮
  13356. buttons: [
  13357. {
  13358. xtype: 'button', text: '保存', handler: function (btn) {
  13359. //窗口获取表单
  13360. var form = win.down('form');
  13361. var vaildSuccess = form.isValid();
  13362. if (!vaildSuccess) {
  13363. return;
  13364. }
  13365. var filename = form.down('textfield[name="filename"]').getValue();
  13366. }
  13367. },
  13368. {
  13369. xtype: 'button', text: '取消', handler: function (btn) {
  13370. //窗口关闭
  13371. win.close();
  13372. }
  13373. }
  13374. ]
  13375. });
  13376. win.show();
  13377. };
  13378. return ConfigStrategy;
  13379. }(Scope));
  13380. var buildVjson = function () {
  13381. return {
  13382. bind: {
  13383. title: '流程编辑-{text}',
  13384. },
  13385. layout: 'fit',
  13386. items: [{
  13387. layout: 'border',
  13388. tbar: {
  13389. xtype: 'toolbar',
  13390. items: [
  13391. {
  13392. xtype: 'button',
  13393. text: '撤销',
  13394. listeners: {
  13395. click: "scope.undo"
  13396. }
  13397. },
  13398. {
  13399. xtype: 'button',
  13400. text: '还原',
  13401. listeners: {
  13402. click: "scope.redo"
  13403. }
  13404. },
  13405. {
  13406. xtype: 'button',
  13407. text: '保存',
  13408. listeners: {
  13409. click: "scope.save"
  13410. }
  13411. },
  13412. {
  13413. xtype: 'button',
  13414. text: '导入BPM',
  13415. listeners: {
  13416. click: "scope.importBpm"
  13417. }
  13418. },
  13419. {
  13420. xtype: 'button',
  13421. text: '配置适配策略',
  13422. listeners: {
  13423. click: "scope.configStrategy"
  13424. }
  13425. },
  13426. {
  13427. fieldLabel: '选择配置分支',
  13428. xtype: 'combogrid',
  13429. },
  13430. ]
  13431. },
  13432. items: [
  13433. {
  13434. xtype: "panel",
  13435. region: 'center',
  13436. reference: "bpmn_view",
  13437. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  13438. },
  13439. {
  13440. split: true,
  13441. xtype: "panel",
  13442. region: 'east',
  13443. width: '30%',
  13444. reference: "bpmn_properties",
  13445. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  13446. }
  13447. ],
  13448. }],
  13449. listeners: {
  13450. afterrender: 'scope.onViewRender'
  13451. }
  13452. };
  13453. };
  13454. var BpmnDesign = /** @class */ (function (_super) {
  13455. __extends(BpmnDesign, _super);
  13456. function BpmnDesign() {
  13457. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  13458. _this.bpmnModeler = null;
  13459. _this.bpmnModelerName = "";
  13460. return _this;
  13461. }
  13462. BpmnDesign.prototype.onLoad = function () {
  13463. var _this = this;
  13464. _super.prototype.onLoad.call(this);
  13465. this.setLoading(true);
  13466. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  13467. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  13468. if (res && res.success && res.data && res.data.bpmn) {
  13469. var diagramXML = res.data.bpmn;
  13470. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  13471. var elements = _this.bpmnModeler._definitions.rootElements;
  13472. if (Array.isArray(elements) && elements.length > 0) {
  13473. elements[0].name = _this.bpmnModelerName;
  13474. }
  13475. }).catch(function (err) {
  13476. msgError(err);
  13477. });
  13478. }
  13479. else {
  13480. msgError(res.msg);
  13481. }
  13482. }).finally(function () {
  13483. _this.setLoading(false);
  13484. });
  13485. };
  13486. BpmnDesign.prototype.onViewRender = function (sender) {
  13487. var customTranslateModule = {
  13488. translate: ['value', customTranslate]
  13489. };
  13490. this.bpmnModeler = new BpmnModeler({
  13491. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  13492. propertiesPanel: {
  13493. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  13494. },
  13495. additionalModules: [
  13496. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  13497. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  13498. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  13499. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  13500. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  13501. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  13502. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  13503. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  13504. customTranslateModule,
  13505. ],
  13506. moddleExtensions: {
  13507. camunda: camundaModdleDescriptor
  13508. },
  13509. keyboard: { bindTo: document } // 使用键盘快捷键
  13510. });
  13511. };
  13512. //开启快捷键
  13513. //modeler.get('keyboard').bind(document);
  13514. //关闭快捷键
  13515. //modeler.get('keyboard').unbind();
  13516. BpmnDesign.prototype.undo = function (sender) {
  13517. this.bpmnModeler.get('commandStack').undo();
  13518. };
  13519. BpmnDesign.prototype.redo = function (sender) {
  13520. this.bpmnModeler.get('commandStack').redo();
  13521. };
  13522. BpmnDesign.prototype.save = function (sender) {
  13523. var _this = this;
  13524. this.setLoading(true);
  13525. this.bpmnModeler.saveXML().then(function (resBpm) {
  13526. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  13527. if (res.success) {
  13528. msg$1("保存成功");
  13529. }
  13530. else {
  13531. msgError(res.msg);
  13532. }
  13533. }).catch(function (e) {
  13534. var _a, _b;
  13535. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  13536. msgError(msg);
  13537. }).finally(function () {
  13538. _this.setLoading(false);
  13539. });
  13540. }).catch(function (e) {
  13541. msgError(e);
  13542. _this.setLoading(false);
  13543. });
  13544. };
  13545. BpmnDesign.prototype.importBpm = function (sender) {
  13546. var _this = this;
  13547. var dlg = new ImportBpmn();
  13548. //@ts-ignore
  13549. dlg.success = function (sen, data) {
  13550. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  13551. var elements = _this.bpmnModeler._definitions.rootElements;
  13552. if (Array.isArray(elements) && elements.length > 0) {
  13553. elements[0].name = _this.bpmnModelerName;
  13554. }
  13555. }).catch(function (err) {
  13556. msgError(err);
  13557. });
  13558. };
  13559. dlg.showDialog(sender, {}, {});
  13560. // this.bpmnModeler.importXML()
  13561. };
  13562. BpmnDesign.prototype.configStrategy = function (sender) {
  13563. var configStrategy = new ConfigStrategy();
  13564. configStrategy.showDialog(sender, {}, {});
  13565. };
  13566. return BpmnDesign;
  13567. }(Scope));
  13568. var model$b = {
  13569. data: {
  13570. id: '',
  13571. path: '',
  13572. form: {
  13573. title: '',
  13574. sqlId: '',
  13575. }
  13576. }
  13577. };
  13578. var vjson$b = {
  13579. bind: {
  13580. title: '{title}',
  13581. },
  13582. layout: 'fit',
  13583. items: [
  13584. {
  13585. layout: 'border',
  13586. items: [
  13587. {
  13588. region: 'center',
  13589. reference: 'editor',
  13590. border: true,
  13591. // html: '<div class="geEditor"></div>',
  13592. // listeners: {
  13593. // afterrender: 'scope.editorInit'
  13594. // }
  13595. html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
  13596. listeners: {
  13597. afterrender: 'scope.iframeRender'
  13598. }
  13599. },
  13600. ]
  13601. }
  13602. ]
  13603. }; //
  13604. //
  13605. var WidgetDesign$1 = /** @class */ (function (_super) {
  13606. __extends(WidgetDesign, _super);
  13607. function WidgetDesign(layoutCode, layoutName) {
  13608. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  13609. _this.layoutCode = layoutCode;
  13610. _this.layoutName = layoutName;
  13611. return _this;
  13612. }
  13613. WidgetDesign.prototype.onLoad = function () {
  13614. this.viewModel.set('layoutCode', this.layoutCode);
  13615. this.viewModel.set('layoutName', this.layoutName);
  13616. if (this.layoutCode) {
  13617. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13618. }
  13619. else {
  13620. this.viewModel.set('title', '新建图纸');
  13621. }
  13622. };
  13623. WidgetDesign.prototype.reload = function () {
  13624. var _this = this;
  13625. this.setLoading(true);
  13626. loadWhLayout({
  13627. layoutCode: this.layoutCode,
  13628. layoutName: this.layoutName,
  13629. }).then(function (res) {
  13630. if (res.success) {
  13631. var xml = res.data.layoutContent;
  13632. var doc = _this.mxUtils.parseXml(xml);
  13633. var graph = _this.editorUi.editor.graph;
  13634. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  13635. }
  13636. }).finally(function () {
  13637. _this.setLoading(false);
  13638. });
  13639. };
  13640. WidgetDesign.prototype.editorInit = function (sender) {
  13641. var that = this;
  13642. var dom = $(sender.el.dom).find('.geEditor')[0];
  13643. //@ts-ignore
  13644. require(['mxgraph'], function () {
  13645. var editorUiInit = EditorUi.prototype.init;
  13646. EditorUi.prototype.init = function () {
  13647. editorUiInit.apply(this, arguments);
  13648. this.actions.get('save').funct = that.onFileSave.bind(that);
  13649. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13650. this.actions.get('open').visible = false;
  13651. this.actions.get('new').visible = false;
  13652. this.actions.get('preview').visible = false;
  13653. this.actions.get('print').visible = false;
  13654. this.actions.get('pageSetup').visible = false;
  13655. this.actions.get('help').visible = false;
  13656. this.actions.get('export').visible = false;
  13657. this.actions.get('about').visible = false;
  13658. this.menus.menus.help.setEnabled(false);
  13659. that.editorUi = this;
  13660. if (that.layoutCode) {
  13661. that.reload();
  13662. }
  13663. };
  13664. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  13665. var mxLanguage = 'zh';
  13666. mxResources.loadDefaultBundle = false;
  13667. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  13668. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  13669. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  13670. // Fixes possible asynchronous requests
  13671. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  13672. // Adds bundle text to resources
  13673. mxResources.parse(xhr[0].getText());
  13674. // Configures the default graph theme
  13675. var themes = new Object();
  13676. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  13677. // Main
  13678. new EditorUi(new Editor(false, themes), dom);
  13679. }, function () {
  13680. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  13681. });
  13682. });
  13683. };
  13684. WidgetDesign.prototype.iframeRender = function (sender) {
  13685. var that = this;
  13686. var iframe = $(sender.el.dom).find('iframe')[0];
  13687. iframe.contentWindow['designer'] = that;
  13688. iframe.contentWindow['editorInitFn'] = function (editorUi) {
  13689. editorUi.actions.get('save').funct = that.onFileSave.bind(that);
  13690. editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13691. editorUi.actions.get('open').visible = false;
  13692. editorUi.actions.get('new').visible = false;
  13693. editorUi.actions.get('preview').visible = false;
  13694. editorUi.actions.get('print').visible = false;
  13695. editorUi.actions.get('pageSetup').visible = false;
  13696. editorUi.actions.get('help').visible = false;
  13697. editorUi.actions.get('export').visible = false;
  13698. editorUi.actions.get('about').visible = false;
  13699. editorUi.menus.menus.help.setEnabled(false);
  13700. that.editorUi = editorUi;
  13701. that.mxUtils = iframe.contentWindow['mxUtils'];
  13702. if (that.layoutCode) {
  13703. that.reload();
  13704. }
  13705. };
  13706. };
  13707. WidgetDesign.prototype.onDestroy = function () {
  13708. var _a;
  13709. try {
  13710. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  13711. }
  13712. catch (e) {
  13713. }
  13714. };
  13715. WidgetDesign.prototype.onFileSaveAs = function () {
  13716. var _this = this;
  13717. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  13718. .then(function (_a) {
  13719. var code = _a.code, name = _a.name;
  13720. _this.layoutCode = code;
  13721. _this.layoutName = name;
  13722. _this.onSave();
  13723. });
  13724. };
  13725. WidgetDesign.prototype.onSave = function () {
  13726. var _this = this;
  13727. var layoutContent = this.editorUi.getEditBlankXml();
  13728. var layoutCode = this.layoutCode;
  13729. var layoutName = this.layoutName;
  13730. if (!layoutCode || !layoutName) {
  13731. msg$1('图形编号和图形名称必填');
  13732. return;
  13733. }
  13734. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13735. this.setLoading(true);
  13736. saveWhLayout({
  13737. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  13738. }).then(function (res) {
  13739. msg$1(res.msg);
  13740. handles$1.whLayout.reload();
  13741. }).finally(function () {
  13742. _this.setLoading(false);
  13743. });
  13744. };
  13745. WidgetDesign.prototype.onFileSave = function () {
  13746. if (!this.layoutCode || !this.layoutName) {
  13747. this.onFileSaveAs();
  13748. }
  13749. else {
  13750. this.onSave();
  13751. }
  13752. };
  13753. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  13754. var code = _a.code, name = _a.name;
  13755. return new Promise(function (resolve, reject) {
  13756. var viewModel = new Ext.app.ViewModel({
  13757. data: {
  13758. code: code !== null && code !== void 0 ? code : '',
  13759. name: name !== null && name !== void 0 ? name : '',
  13760. }
  13761. });
  13762. var dlg = Ext.create('Ext.window.Window', {
  13763. title: '保存',
  13764. viewModel: viewModel,
  13765. layout: {
  13766. type: "vbox",
  13767. pack: "start",
  13768. align: "stretch"
  13769. },
  13770. items: [
  13771. {
  13772. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  13773. bind: '{code}'
  13774. },
  13775. {
  13776. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  13777. bind: '{name}'
  13778. }
  13779. ],
  13780. fbar: [
  13781. {
  13782. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  13783. click: function () {
  13784. var code = viewModel.get('code');
  13785. var name = viewModel.get('name');
  13786. resolve({ code: code, name: name });
  13787. dlg.close();
  13788. }
  13789. }
  13790. },
  13791. {
  13792. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  13793. click: function () {
  13794. dlg.close();
  13795. }
  13796. }
  13797. },
  13798. ]
  13799. });
  13800. dlg.show();
  13801. });
  13802. };
  13803. return WidgetDesign;
  13804. }(Scope));
  13805. // init()
  13806. var Workbench = /** @class */ (function (_super) {
  13807. __extends(Workbench, _super);
  13808. // activeModulePage: ModulePage = null
  13809. function Workbench() {
  13810. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  13811. _this.name = "MainWindow";
  13812. _this.modules = [];
  13813. _this.yvgridDesign = null;
  13814. return _this;
  13815. }
  13816. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  13817. if (newCard) {
  13818. this.viewModel.set('leftTabTitle', newCard.tooltip);
  13819. }
  13820. else {
  13821. this.viewModel.set('leftTabTitle', '未选中');
  13822. }
  13823. };
  13824. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  13825. get: function () {
  13826. var _a;
  13827. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  13828. },
  13829. enumerable: true,
  13830. configurable: true
  13831. });
  13832. Workbench.prototype.documentKeydown = function (event) {
  13833. if (event.ctrlKey || event.metaKey) {
  13834. if (event.key.toLowerCase() === 's') {
  13835. eventBus.publish(EventType.SaveCall, {});
  13836. event.stopPropagation();
  13837. event.preventDefault();
  13838. }
  13839. else if (event.key.toLowerCase() === 'z') {
  13840. if (event.shiftKey) {
  13841. eventBus.publish(EventType.Redo, {});
  13842. event.stopPropagation();
  13843. event.preventDefault();
  13844. }
  13845. else {
  13846. eventBus.publish(EventType.Undo, {});
  13847. event.stopPropagation();
  13848. event.preventDefault();
  13849. }
  13850. }
  13851. }
  13852. };
  13853. Workbench.prototype.onLoad = function () {
  13854. var _this = this;
  13855. window["tt"] = this.refs['tt'];
  13856. window["vm"] = this.viewModel;
  13857. $('#loading').remove();
  13858. setMainWindow(this);
  13859. setStatusbar(this.down('statusbar'));
  13860. document.addEventListener('keydown', this.documentKeydown.bind(this));
  13861. var currentProject = getCurrentProject();
  13862. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  13863. // handles.fileTree.reload()
  13864. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  13865. _this.showModule(rawData);
  13866. });
  13867. eventBus.subscribe(EventType.Undo, function () {
  13868. _this.onUndo();
  13869. });
  13870. eventBus.subscribe(EventType.Redo, function () {
  13871. _this.onRedo();
  13872. });
  13873. eventBus.subscribe(EventType.Cut, function (_a) {
  13874. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13875. _this.onCut(a, b, c, d);
  13876. });
  13877. eventBus.subscribe(EventType.Copy, function (_a) {
  13878. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13879. _this.onCopy(a, b, c, d);
  13880. });
  13881. eventBus.subscribe(EventType.Paste, function (_a) {
  13882. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13883. _this.onPaste(a, b, c, d);
  13884. });
  13885. eventBus.subscribe(EventType.SelectAll, function () {
  13886. _this.onSelectAll();
  13887. });
  13888. eventBus.subscribe(EventType.SelectAll, function () {
  13889. _this.onSelectAll();
  13890. });
  13891. eventBus.subscribe(EventType.RunCheckModule, function () {
  13892. _this.runCheckModule();
  13893. });
  13894. eventBus.subscribe(EventType.StopCheckModule, function () {
  13895. _this.stopCheckModule();
  13896. });
  13897. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  13898. _this.onCompoentContextMenu(args);
  13899. });
  13900. this.runCheckModule();
  13901. };
  13902. Workbench.prototype.onCompoentContextMenu = function (args) {
  13903. var _this = this;
  13904. if (!this.yvgridDesign) {
  13905. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  13906. this.yvgridDesign.showDialog(null, {}, {});
  13907. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  13908. this.yvgridDesign.onDestroy = function () {
  13909. fn_1();
  13910. _this.yvgridDesign = null;
  13911. };
  13912. }
  13913. };
  13914. Workbench.prototype.runCheckModule = function () {
  13915. var _this = this;
  13916. if (this.checkTimer) {
  13917. return;
  13918. }
  13919. this.checkTimer = setInterval(function () {
  13920. var _a;
  13921. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  13922. _this.activeModulePage.check();
  13923. }
  13924. }, 5000);
  13925. };
  13926. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  13927. var dlg = new WidgetDesign(widgetPath, widgetName);
  13928. dlg.showPage({
  13929. id: 'widget_' + widgetPath,
  13930. path: 'widget_' + widgetPath,
  13931. }, {
  13932. data: {
  13933. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  13934. }
  13935. });
  13936. dlg.dialogSuccess = successCallback;
  13937. };
  13938. Workbench.prototype.stopCheckModule = function () {
  13939. clearInterval(this.checkTimer);
  13940. this.checkTimer = null;
  13941. };
  13942. Workbench.prototype.showDataSync = function () {
  13943. var ins = new DbSync();
  13944. ins.showPage({
  13945. id: 'db_sync__',
  13946. path: 'db_sync__',
  13947. }, {
  13948. data: {}
  13949. });
  13950. };
  13951. /**
  13952. * 打开一个项目
  13953. */
  13954. Workbench.prototype.openProject = function (project) {
  13955. setCurrentProject(project);
  13956. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  13957. handles$1.fileTree.reload();
  13958. };
  13959. /**
  13960. * 打开模板开发面板
  13961. */
  13962. Workbench.prototype.showTemplateDev = function () {
  13963. var ins = new TemplateDev();
  13964. ins.showPage({
  13965. id: 'template_dev__',
  13966. path: 'template_dev__',
  13967. }, {
  13968. data: {}
  13969. });
  13970. };
  13971. Workbench.prototype.openScope = function () {
  13972. };
  13973. /**
  13974. * 显示字段域管理器
  13975. */
  13976. Workbench.prototype.showColumnDomain = function () {
  13977. var instance = new DbDomain();
  13978. instance.showPage({
  13979. id: 'domain__',
  13980. path: 'domain__',
  13981. }, {
  13982. data: {}
  13983. });
  13984. };
  13985. /**
  13986. * 显示性能统计
  13987. */
  13988. Workbench.prototype.showPerform = function () {
  13989. // const instance = new PerformStats()
  13990. // instance.showPage({
  13991. // id: 'perform__',
  13992. // path: 'perform__',
  13993. //
  13994. // }, {
  13995. // data: {}
  13996. // })
  13997. };
  13998. /**
  13999. * 显示数据库代码模板库
  14000. */
  14001. Workbench.prototype.showDbCodeTemplate = function () {
  14002. // const instance = new DbCodeTemplate()
  14003. // instance.showPage({
  14004. // id: 'dbcode__',
  14005. // path: 'dbcode__',
  14006. //
  14007. // }, {
  14008. // data: {}
  14009. // })
  14010. };
  14011. /**
  14012. * 显示数据库代码模板库
  14013. */
  14014. Workbench.prototype.showReport = function (report_id, report_name, success) {
  14015. var instance = new ReportDesign();
  14016. instance.showPage({
  14017. id: 'report_' + report_id,
  14018. path: 'report_' + report_id,
  14019. }, {
  14020. data: {
  14021. report_id: report_id,
  14022. report_name: report_name,
  14023. }
  14024. });
  14025. instance.dialogSuccess = success;
  14026. };
  14027. /**
  14028. * 显示报表
  14029. */
  14030. Workbench.prototype.showReportPreview = function (report_id, instance) {
  14031. instance.showPage({
  14032. id: 'REPORT__' + report_id,
  14033. path: 'REPORT__' + report_id,
  14034. }, {
  14035. data: {
  14036. report_id: report_id,
  14037. }
  14038. });
  14039. var reportName = instance.viewModel.get('report_name');
  14040. instance.viewModel.set('report_name', '[预览]-' + reportName);
  14041. };
  14042. /**
  14043. * 显示运维页面
  14044. */
  14045. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  14046. // const instance = new DevOpsTerminal()
  14047. // instance.showPage({
  14048. // id: 'ops_' + opsId,
  14049. // path: 'ops_' + opsId,
  14050. //
  14051. // }, {
  14052. // data: {
  14053. // opsId: opsId,
  14054. // name: name,
  14055. // }
  14056. // })
  14057. // instance.dialogSuccess = success
  14058. };
  14059. /**
  14060. * 显示表结构
  14061. * tableName 为空的情况就是新建表,否则就是要编辑的表
  14062. * columnName 可以为空
  14063. */
  14064. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  14065. var id = 'tableColumn_' + tableName;
  14066. var isCreateTable = false;
  14067. // /ROOT/schema$public/schema$public$bas_location_group_rel
  14068. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  14069. if (!tableName) {
  14070. id = _$2.uniqueId('new_table');
  14071. tableName = id;
  14072. isCreateTable = true;
  14073. }
  14074. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  14075. instance.showPage({
  14076. id: id,
  14077. path: id,
  14078. locatPath: locatPath
  14079. }, {
  14080. data: {
  14081. tableName: tableName,
  14082. columnName: columnName
  14083. }
  14084. });
  14085. };
  14086. /**
  14087. * 打开某个模块
  14088. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  14089. */
  14090. Workbench.prototype.showModule = function (rawData) {
  14091. var id = rawData.id, path = rawData.path;
  14092. var separator = '/';
  14093. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  14094. var module = this.modules[idx];
  14095. var pageId = path.replaceAll('/', '_');
  14096. console.log('open module', module);
  14097. var instance = new ModulePage(id, module);
  14098. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  14099. instance.showPage({
  14100. id: 'module_' + pageId,
  14101. path: path,
  14102. title: module.name
  14103. }, {
  14104. data: {}
  14105. });
  14106. };
  14107. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  14108. var bpmnDesign = new BpmnDesign();
  14109. bpmnDesign.showPage({}, {
  14110. data: {
  14111. absolutePath: absolutePath,
  14112. id: id,
  14113. text: text
  14114. }
  14115. });
  14116. };
  14117. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  14118. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  14119. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  14120. layoutDesign.showPage({
  14121. id: id,
  14122. path: id,
  14123. }, {
  14124. data: {}
  14125. });
  14126. };
  14127. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  14128. var _a;
  14129. // this.activeModulePage = newCard.yvanScope
  14130. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  14131. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  14132. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  14133. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  14134. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  14135. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  14136. eventBus.publish(EventType.MainTabChange, {
  14137. moduleId: newCard.yvanScope.moduleId,
  14138. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  14139. from: this.name
  14140. });
  14141. };
  14142. Workbench.prototype.onUndo = function () {
  14143. var _a;
  14144. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  14145. };
  14146. Workbench.prototype.onRedo = function () {
  14147. var _a;
  14148. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  14149. };
  14150. Workbench.prototype.onCut = function (a, b, c, d) {
  14151. var _a;
  14152. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  14153. };
  14154. Workbench.prototype.onCopy = function (a, b, c, d) {
  14155. var _a;
  14156. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  14157. };
  14158. Workbench.prototype.onPaste = function (a, b, c, d) {
  14159. var _a;
  14160. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  14161. };
  14162. Workbench.prototype.onSelectAll = function () {
  14163. var _a;
  14164. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  14165. };
  14166. return Workbench;
  14167. }(Scope));
  14168. (function (FuncDomain) {
  14169. FuncDomain["SCOPE"] = "scope";
  14170. FuncDomain["SYSTEM"] = "system";
  14171. })(exports.FuncDomain || (exports.FuncDomain = {}));
  14172. (function (BizMode) {
  14173. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  14174. BizMode[BizMode["query"] = 1] = "query";
  14175. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  14176. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  14177. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  14178. })(exports.BizMode || (exports.BizMode = {}));
  14179. (function (BizFormat) {
  14180. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  14181. BizFormat[BizFormat["button"] = 1] = "button";
  14182. BizFormat[BizFormat["progress"] = 2] = "progress";
  14183. BizFormat[BizFormat["date"] = 3] = "date";
  14184. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  14185. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  14186. })(exports.BizFormat || (exports.BizFormat = {}));
  14187. (function (BizUnique) {
  14188. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  14189. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  14190. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  14191. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  14192. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  14193. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  14194. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  14195. })(exports.BizUnique || (exports.BizUnique = {}));
  14196. var ScopeEngine = /** @class */ (function () {
  14197. function ScopeEngine() {
  14198. }
  14199. ScopeEngine.getBizFile = function (director) {
  14200. return new Promise(function (resolve, reject) {
  14201. debugger;
  14202. });
  14203. };
  14204. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  14205. return new Promise(function (resolve, reject) {
  14206. var requireArr = [];
  14207. var requireKeyArr = [];
  14208. _$2.forOwn(billFile.domains, function (v, k) {
  14209. requireArr.push(v.domain);
  14210. requireKeyArr.push(k);
  14211. if (v.layout) {
  14212. requireArr.push(v.layout);
  14213. requireKeyArr.push(k + "_layout");
  14214. }
  14215. });
  14216. requireArr.push(billFile.layout);
  14217. requireKeyArr.push("layout");
  14218. requireArr.push(billFile.converter);
  14219. requireKeyArr.push("converter");
  14220. // @ts-ignore
  14221. require(requireArr, function () {
  14222. var requireReArr = [];
  14223. for (var _i = 0; _i < arguments.length; _i++) {
  14224. requireReArr[_i] = arguments[_i];
  14225. }
  14226. if (requireReArr.length <= 0) {
  14227. reject(new Error("没有加载到相关的文件!"));
  14228. }
  14229. var domains = {};
  14230. for (var i = 0; i < requireReArr.length - 2; i++) {
  14231. if (requireKeyArr[i].endsWith("_layout")) {
  14232. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  14233. domains[key_d].layout = requireReArr[i].default;
  14234. }
  14235. else {
  14236. domains[requireKeyArr[i]] = requireReArr[i].default;
  14237. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  14238. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  14239. }
  14240. }
  14241. var bizFile = {
  14242. bill: billFile,
  14243. domains: domains,
  14244. layout: requireReArr[requireReArr.length - 2].default,
  14245. converter: requireReArr[requireReArr.length - 1].default,
  14246. };
  14247. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  14248. scope.billSetting = bizFile;
  14249. resolve(scope);
  14250. });
  14251. });
  14252. };
  14253. ScopeEngine.buildScopeFromPath = function (path) {
  14254. return new Promise(function (resolve, reject) {
  14255. // @ts-ignore
  14256. require([path], function (bill) {
  14257. bill = bill.default;
  14258. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  14259. resolve(scope);
  14260. }).catch(function (e) {
  14261. reject(e);
  14262. });
  14263. });
  14264. });
  14265. };
  14266. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  14267. var controller = {};
  14268. var vjson = {
  14269. layout: 'fit',
  14270. title: bizFile.bill.name,
  14271. items: []
  14272. };
  14273. var model = {};
  14274. if (bizFile.layout.layout === "fit") {
  14275. vjson.items = bizFile.layout.items;
  14276. }
  14277. else if (bizFile.layout.layout === "border") {
  14278. vjson.items = [bizFile.layout];
  14279. }
  14280. var domainsVjson = {};
  14281. _$2.forOwn(bizFile.domains, function (v, k) {
  14282. var domainVjson = null;
  14283. var buttons = bizFile.domains[k].buttons;
  14284. if (bizFile.bill.domains[k].mode === "form") {
  14285. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  14286. if (Array.isArray(buttons) && buttons.length > 0) {
  14287. if (bizFile.bill.domains[k].type === "header") {
  14288. vjson.tbar = {
  14289. xtype: 'toolbar',
  14290. items: ScopeEngine.buildButton(controller, buttons)
  14291. };
  14292. }
  14293. else {
  14294. domainVjson.items.push({
  14295. xtype: "cols",
  14296. items: ScopeEngine.buildButton(controller, buttons)
  14297. });
  14298. }
  14299. }
  14300. }
  14301. else if (bizFile.bill.domains[k].mode === "table") {
  14302. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  14303. if (Array.isArray(buttons) && buttons.length > 0) {
  14304. if (bizFile.bill.domains[k].type === "header") {
  14305. vjson.tbar = {
  14306. xtype: 'toolbar',
  14307. items: ScopeEngine.buildButton(controller, buttons)
  14308. };
  14309. }
  14310. else {
  14311. domainVjson.tbar = {
  14312. xtype: 'toolbar',
  14313. items: ScopeEngine.buildButton(controller, buttons)
  14314. };
  14315. }
  14316. }
  14317. }
  14318. if (domainVjson) {
  14319. domainsVjson[k] = domainVjson;
  14320. }
  14321. });
  14322. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  14323. var scope = new Scope({ model: model, vjson: vjson });
  14324. scope['bill_define'] = bizFile;
  14325. _$2.merge(scope, controller);
  14326. console.log('bill_define', vjson, scope, scope['bill_define']);
  14327. return scope;
  14328. };
  14329. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  14330. var fieldGroups = {};
  14331. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14332. var field = bizFile.domains[domainKey].fields[i];
  14333. var item = { sort: field.form_sort };
  14334. item.xtype = field.xtype;
  14335. item.fieldLabel = field.column_desc;
  14336. item.bind = {
  14337. value: "{" + domainKey + "." + field.column_name + "}",
  14338. };
  14339. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  14340. // if (field.disabled !== "true" && field.disabled !== "false") {
  14341. // item.bind.disabled = eval(field.disabled)
  14342. // } else {
  14343. // item.disabled = (field.disabled === "true")
  14344. // }
  14345. // if (field.readonly !== "true" && field.readonly !== "false") {
  14346. // item.bind.disabled = eval(field.readonly)
  14347. // } else {
  14348. // item.readonly = (field.readonly === "true")
  14349. // }
  14350. // if (field.required !== "true" && field.required !== "false") {
  14351. // item.bind.required = eval(field.required)
  14352. // } else {
  14353. // item.required = (field.required === "true")
  14354. // }
  14355. // if (field.hide !== "true" && field.hide !== "false") {
  14356. // item.bind.hidden = eval(field.hide)
  14357. // } else {
  14358. // item.hidden = (field.hide === "true")
  14359. // }
  14360. // item.flex = field.
  14361. if (field.dict) {
  14362. item.fix = eval(field.dict);
  14363. }
  14364. // _.set(formModel, "", "")
  14365. item.field = field;
  14366. if (field.form_group) {
  14367. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  14368. fieldGroups[field.form_group] = [item];
  14369. }
  14370. else {
  14371. fieldGroups[field.form_group].push(item);
  14372. }
  14373. }
  14374. }
  14375. var formVjson = {
  14376. xtype: "form",
  14377. title: bizFile.domains[domainKey].name,
  14378. items: []
  14379. };
  14380. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  14381. var items = ScopeEngine.buildFieldSet(fieldGroup);
  14382. if (items) {
  14383. var fieldsetVjson = {
  14384. xtype: "fieldset",
  14385. title: k,
  14386. items: items
  14387. };
  14388. formVjson.items.push(fieldsetVjson);
  14389. }
  14390. });
  14391. return formVjson;
  14392. };
  14393. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  14394. // const vjson = { xtype: "grid", items: []}
  14395. var gridVjson = {
  14396. xtype: "yvgrid",
  14397. columns: [],
  14398. split: true,
  14399. reference: domainKey,
  14400. listeners: {
  14401. itemdblclick: function () {
  14402. },
  14403. },
  14404. };
  14405. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14406. var field = bizFile.domains[domainKey].fields[i];
  14407. gridVjson.columns.push({
  14408. dataIndex: field.column_name,
  14409. header: field.column_desc,
  14410. });
  14411. }
  14412. return gridVjson;
  14413. };
  14414. ScopeEngine.buildFieldSet = function (fieldGroup) {
  14415. var colGroups = [{
  14416. xtype: "cols",
  14417. items: []
  14418. }];
  14419. var colGroup = colGroups[0];
  14420. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  14421. for (var i = 0; i < fieldGroup.length; i++) {
  14422. var field = fieldGroup[i];
  14423. if (field.field.form_newline === "true") {
  14424. if (colGroup.items.length > 0) {
  14425. colGroup = {
  14426. xtype: "cols",
  14427. items: [field]
  14428. };
  14429. colGroups.push(colGroup);
  14430. }
  14431. }
  14432. else {
  14433. colGroup.items.push(field);
  14434. }
  14435. delete field.field;
  14436. }
  14437. return colGroups;
  14438. };
  14439. ScopeEngine.buildButton = function (controller, buttons) {
  14440. var buttonsVjson = [];
  14441. var _loop_1 = function (i) {
  14442. var item = buttons[i];
  14443. var button = {
  14444. xtype: "button",
  14445. text: item.btn_name,
  14446. iconCls: item.icon
  14447. };
  14448. if (item.hidden === "true" || item.hidden === "false") {
  14449. button.hidden = (item.hidden === "true");
  14450. }
  14451. if (item.listeners) {
  14452. var listeners_1 = {};
  14453. _$2.forOwn(item.listeners, function (v, k) {
  14454. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  14455. listeners_1[k] = v;
  14456. }
  14457. else {
  14458. try {
  14459. listeners_1[k] = eval(v);
  14460. }
  14461. catch (e) {
  14462. throw e;
  14463. }
  14464. }
  14465. });
  14466. button.listeners = listeners_1;
  14467. }
  14468. buttonsVjson.push(button);
  14469. };
  14470. for (var i = 0; i < buttons.length; i++) {
  14471. _loop_1(i);
  14472. }
  14473. return buttonsVjson;
  14474. };
  14475. ScopeEngine.buildListeners = function (controller, item) {
  14476. if (!item.hasOwnProperty("listeners")) {
  14477. return;
  14478. }
  14479. _$2.forOwn(item.listeners, function (v, k) {
  14480. if (v && typeof v === "string") {
  14481. if (v.indexOf(".") > -1) {
  14482. var strArr = v.split(".");
  14483. if (strArr.length != 2) {
  14484. console.error(item.listeners, "语法解析错误,请检查!");
  14485. }
  14486. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  14487. switch (funcDomain) {
  14488. case exports.FuncDomain.SCOPE:
  14489. controller[k] = findCustFunc(item, k);
  14490. break;
  14491. case exports.FuncDomain.SYSTEM:
  14492. break;
  14493. default:
  14494. throw new Error("错误的函数域定义");
  14495. }
  14496. }
  14497. else {
  14498. var func = eval(v);
  14499. if (typeof func === 'function') {
  14500. controller[k] = func;
  14501. }
  14502. throw new Error("解析自定义函数出错");
  14503. }
  14504. }
  14505. });
  14506. var findCustFunc = function (item, funcName) {
  14507. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  14508. throw new Error("没有找到相关的函数定义");
  14509. }
  14510. var func = eval(item[funcName]);
  14511. if (typeof func === 'function') {
  14512. return func;
  14513. }
  14514. throw new Error("解析自定义函数出错");
  14515. };
  14516. };
  14517. /**
  14518. * 只检索 items 的模式,深度遍历 vjson
  14519. */
  14520. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  14521. if (Array.isArray(vjson)) {
  14522. for (var i = 0; i < vjson.length; i++) {
  14523. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  14524. }
  14525. }
  14526. else {
  14527. _$2.forOwn(vjson, function (v, k) {
  14528. if (k !== "domain") {
  14529. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  14530. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  14531. }
  14532. }
  14533. else {
  14534. delete vjson.domain;
  14535. _$2.merge(vjson, domainsVjson[v]);
  14536. }
  14537. });
  14538. }
  14539. };
  14540. return ScopeEngine;
  14541. }());
  14542. function initComponent () {
  14543. var ct = Ext.Component.prototype.constructor;
  14544. Ext.Component.override({
  14545. constructor: function (config) {
  14546. var _a, _b;
  14547. if (!isDesignMode(this, config)) {
  14548. var me_1 = this;
  14549. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  14550. _$2.each(baseConfigProcessList, function (process) {
  14551. process.call(me_1, me_1, config);
  14552. });
  14553. }
  14554. if (config) {
  14555. if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
  14556. config.i18nPath = config.$initParent.i18nPath;
  14557. }
  14558. if ((_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.setTitle) {
  14559. var setTitle_1 = config.$initParent.setTitle;
  14560. var handel_1 = config.$initParent;
  14561. config.$initParent.setTitle = function (title) {
  14562. var t = { title: title };
  14563. var WMSTranslate = window["WMSTranslate"];
  14564. if (WMSTranslate) {
  14565. if (typeof window['viewTranslate'] === 'function') {
  14566. window['viewTranslate'](t, title, "title");
  14567. }
  14568. }
  14569. setTitle_1.call(handel_1, t.title);
  14570. }.bind(config.$initParent);
  14571. }
  14572. var WMSTranslate = window["WMSTranslate"];
  14573. if (WMSTranslate) {
  14574. if (typeof window['viewTranslate'] === 'function') {
  14575. window['viewTranslate'](config, config.text, "text");
  14576. window['viewTranslate'](config, config.title, "title");
  14577. window['viewTranslate'](config, config.header, "header");
  14578. window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
  14579. window['viewTranslate'](config, config.emptyText, "emptyText");
  14580. }
  14581. }
  14582. }
  14583. ct.call(this, config);
  14584. }
  14585. });
  14586. var _initComponent = Ext.picker.Date.prototype.initComponent;
  14587. Ext.picker.Date.override({
  14588. initComponent: function () {
  14589. var me = this;
  14590. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  14591. _initComponent.call(me);
  14592. },
  14593. selectToday: function () {
  14594. var me = this, btn = me.todayBtn, handler = me.handler;
  14595. if (btn && !btn.disabled) {
  14596. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  14597. me.fireEvent('select', me, me.value);
  14598. if (handler) {
  14599. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  14600. }
  14601. me.onSelect();
  14602. }
  14603. return me;
  14604. },
  14605. });
  14606. }
  14607. function initMainTab () {
  14608. Ext.define('Yvan.MainTab', {
  14609. extend: 'Ext.tab.Panel',
  14610. xtype: 'maintab',
  14611. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  14612. closeTabText: '关闭',
  14613. closeOthersTabsText: '关闭其他',
  14614. closeAllTabsText: '关闭所有'
  14615. }),
  14616. constructor: function (config) {
  14617. var me = this;
  14618. var newConfig = _$2.defaultsDeep({
  14619. // 强制属性
  14620. }, config);
  14621. this.superclass.constructor.call(me, newConfig);
  14622. },
  14623. initComponent: function () {
  14624. var me = this;
  14625. this.on({
  14626. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  14627. _$2.defer(function () {
  14628. me.changeHash(newCard.id);
  14629. window['cp'] = newCard.yvanScope;
  14630. });
  14631. $$2(window).trigger('tabChange', {
  14632. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  14633. });
  14634. },
  14635. afterrender: function () {
  14636. _$2.defer(function () {
  14637. me.tryRestoryPage();
  14638. });
  14639. }
  14640. });
  14641. this.superclass.initComponent.call(me);
  14642. },
  14643. tryRestoryPage: function () {
  14644. var me = this;
  14645. var hash = '' + window.location.hash;
  14646. if (hash && hash.indexOf('page=') > 0) {
  14647. if (hash.startsWith('#')) {
  14648. hash = hash.substr(1);
  14649. }
  14650. if (hash) {
  14651. var page = Qs.parse(hash).page;
  14652. if (page) {
  14653. // this.openScope(page)
  14654. me.fireEvent('restorypage', page);
  14655. }
  14656. }
  14657. }
  14658. },
  14659. changeHash: function (id) {
  14660. window.location.hash = Qs.stringify({ page: id });
  14661. },
  14662. /**
  14663. * 添加一个业务模块实例到选项卡
  14664. * @param scopeInstance 业务对象实例
  14665. * @param config ExtJS配置对象
  14666. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  14667. */
  14668. addScope: function (scopeInstance, config, panelInitCallback) {
  14669. scopeInstance.topScope = scopeInstance;
  14670. var me = this;
  14671. if (config.path) {
  14672. for (var i = 0; i < this.items.items.length; i++) {
  14673. // 找到当前 tabs 里有没有已经打开过
  14674. var tab = this.items.items[i];
  14675. if (_$2.isEqual(tab.path, config.path)) {
  14676. // 激活
  14677. this.setActiveTab(tab);
  14678. return tab;
  14679. }
  14680. }
  14681. }
  14682. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  14683. if (typeof panelInitCallback === 'function') {
  14684. panelInitCallback(newPanel);
  14685. }
  14686. // 添加业务模块
  14687. var newTab = this.add(newPanel);
  14688. this.setActiveTab(newTab);
  14689. newTab.on({
  14690. destroy: function (sender) {
  14691. me.changeHash('');
  14692. delete window['cp'];
  14693. }
  14694. });
  14695. return newTab;
  14696. }
  14697. });
  14698. }
  14699. /**
  14700. * 构建所有组件的公共属性
  14701. * @param config 原始config
  14702. * @param dragType 组件模式
  14703. * 不填,代表不能在设计时被拖拽
  14704. * row-container 是一个rows容器
  14705. * col-container 是一个cols容器
  14706. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  14707. * row-item rows中的一行,比如 tree / grid / panel 等等
  14708. */
  14709. function baseConfig(config, dragType) {
  14710. // if (isDesignMode(config, undefined) && dragType) {
  14711. if (typeof config === 'object') {
  14712. var cc = '';
  14713. switch (dragType) {
  14714. case "cols-container":
  14715. cc = 'design_cols_container';
  14716. break;
  14717. case "col-item":
  14718. cc = 'design_col_item';
  14719. break;
  14720. case "rows-container":
  14721. cc = 'design_rows_container';
  14722. break;
  14723. case "row-item":
  14724. cc = 'design_row_item';
  14725. break;
  14726. }
  14727. if (typeof config.cls === 'string') {
  14728. _$2.extend(config, {
  14729. cls: [config.cls, 'yvan_design', cc]
  14730. });
  14731. }
  14732. else if (_$2.isArray(config.cls)) {
  14733. _$2.extend(config, {
  14734. cls: __spread(config.cls, ['yvan_design', cc])
  14735. });
  14736. }
  14737. else {
  14738. _$2.extend(config, {
  14739. cls: ['yvan_design', cc]
  14740. });
  14741. }
  14742. }
  14743. return config;
  14744. }
  14745. function initPanel () {
  14746. /**
  14747. *
  14748. */
  14749. var ct = Ext.panel.Panel.prototype.constructor;
  14750. Ext.panel.Panel.override({
  14751. constructor: function (config) {
  14752. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  14753. ct.call(this, newConfig);
  14754. }
  14755. });
  14756. var ss = Ext.form.FieldContainer.prototype;
  14757. Ext.form.FieldContainer.override({
  14758. config: __assign({}, fieldContainer)
  14759. });
  14760. }
  14761. function initGridColumn () {
  14762. var ct = Ext.grid.column.Column.prototype.constructor;
  14763. Ext.grid.column.Column.override({
  14764. constructor: function (config) {
  14765. var scope = lookupScope(config.$initParent.$initParent);
  14766. var newConfig = _$2.defaults({}, config, column);
  14767. if (typeof newConfig.summaryRenderer === 'string') {
  14768. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  14769. if (typeof newConfig.summaryRenderer === 'function') {
  14770. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  14771. }
  14772. }
  14773. if (config.formatter === 'datetime') {
  14774. newConfig.fix = ['system.formatDate()'];
  14775. delete newConfig.formatter;
  14776. }
  14777. // 在 grid.constructor 已经转换过了
  14778. // if (typeof newConfig.renderer === 'string') {
  14779. // newConfig.renderer = lookupFn(scope, config.renderer)
  14780. // if (typeof newConfig.renderer === 'function') {
  14781. // newConfig.renderer = newConfig.renderer.bind(scope)
  14782. // }
  14783. // }
  14784. ct.call(this, newConfig);
  14785. }
  14786. });
  14787. var ctAction = Ext.grid.column.Action.prototype.constructor;
  14788. Ext.grid.column.Action.override({
  14789. constructor: function (config) {
  14790. var scope = lookupScope(config.$initParent.$initParent);
  14791. _$2.forEach(config.items, function (item) {
  14792. if (typeof item.handler === 'string') {
  14793. item.handler = lookupFn(scope, item.handler);
  14794. if (typeof item.handler === 'function') {
  14795. item.handler = item.handler.bind(scope);
  14796. }
  14797. }
  14798. });
  14799. ctAction.call(this, config);
  14800. }
  14801. });
  14802. var ck = Ext.grid.column.Check.prototype.constructor;
  14803. Ext.grid.column.Check.override({
  14804. constructor: function (config) {
  14805. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  14806. var grid = sender.view.grid.ownerGrid;
  14807. var column = grid.getColumns()[sender.fullColumnIndex];
  14808. var context = {
  14809. event: e,
  14810. column: column,
  14811. field: sender.dataIndex,
  14812. value: checked,
  14813. record: record,
  14814. rowIdx: rowIndex
  14815. };
  14816. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  14817. });
  14818. ck.call(this, config);
  14819. }
  14820. });
  14821. // 227573
  14822. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  14823. // Ext.define('Yvan.ColumnOverride', {
  14824. // override: 'Ext.grid.column.Column',
  14825. //
  14826. // config: {
  14827. // enableSortOnClick: false,
  14828. // },
  14829. //
  14830. // // /**@Overrides*/
  14831. // onTitleElClick: function (e, t, sortOnClick) {
  14832. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  14833. // if (!$(e.target).is('.x-column-header-trigger')) {
  14834. // // 不是点击菜单的情况下,让列自适应宽度
  14835. // this.autoSize()
  14836. // }
  14837. // return onTitleElClick.call(this, e, t, false)
  14838. // }
  14839. // });
  14840. }
  14841. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  14842. /**
  14843. * 判断目标字符串与关键字是否重叠
  14844. * @param target 目标字符串
  14845. * @param keyword 搜索关键字
  14846. */
  14847. function pinyinMatch(target, keyword) {
  14848. if (typeof target != 'string' || typeof keyword != 'string') {
  14849. return false;
  14850. }
  14851. if (!keyword || !target) {
  14852. return false;
  14853. }
  14854. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  14855. keyword = _$2.toLower(keyword);
  14856. var pos1 = _$2.toLower(target).indexOf(keyword);
  14857. if (pos1 >= 0) {
  14858. return true;
  14859. }
  14860. var len = _$2.intersection(keyword.split('')).length;
  14861. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  14862. return true;
  14863. }
  14864. return false;
  14865. }
  14866. /**
  14867. * 对某个表达式进行求值
  14868. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  14869. *
  14870. * @example
  14871. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  14872. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  14873. *
  14874. * @param data 数据环境对象
  14875. * @param express 表达式对象
  14876. */
  14877. function calcExpress(data, express) {
  14878. var result = express;
  14879. if (SIMPLE_RE.test(express)) {
  14880. // '{foo}' 简单表达式
  14881. var path = express.substring(1, express.length - 1);
  14882. var ret = _$2.get(data, path);
  14883. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  14884. }
  14885. while (true) {
  14886. var mlist = result.match(/{(.*?)}/);
  14887. if (!mlist) {
  14888. break;
  14889. }
  14890. var pathC = mlist[0]; // {query.a}
  14891. var path = mlist[1]; // query.a
  14892. var value = _$2.get(data, path);
  14893. result = result.replaceAll(pathC, value || '');
  14894. }
  14895. return result;
  14896. }
  14897. /**
  14898. * 对个对象进行表达式求值,不用回调
  14899. * @example
  14900. * 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}'] })
  14901. *
  14902. * {
  14903. * a: '{query.a}',
  14904. * b: {
  14905. * b1: '{query.b1}',
  14906. * b2: '{query.b2}',
  14907. * },
  14908. * c: 'aa',
  14909. * d: [
  14910. * '{query.d1}',
  14911. * '{query.d2}'
  14912. * ]
  14913. * }
  14914. *
  14915. * 计算结果为
  14916. * {
  14917. * a: 'aValue',
  14918. * b: {
  14919. * b1: 'b1Value',
  14920. * b2: 'b2Value'
  14921. * },
  14922. * c: 'aa'
  14923. * d: [
  14924. * '1',
  14925. * '2'
  14926. * ]
  14927. * }
  14928. *
  14929. * @param data
  14930. * @param paramObject
  14931. */
  14932. function calcObjectFlat(data, paramObject) {
  14933. var result = _$2.cloneDeep(paramObject);
  14934. if (typeof paramObject === 'string') {
  14935. return calcExpress(data, paramObject);
  14936. }
  14937. var trav = function (param) {
  14938. _$2.forOwn(param, function (value, key) {
  14939. if (_$2.isPlainObject(value)) {
  14940. // 深度递归,对子对象进行求解
  14941. trav(value);
  14942. }
  14943. else if (_$2.isString(value)) {
  14944. // 字符串直接用 calcExpress 表达式求解
  14945. param[key] = calcExpress(data, param[key]);
  14946. }
  14947. else if (_$2.isArray(value)) {
  14948. // 数组求解
  14949. _$2.each(value, function (v, idx) {
  14950. value[idx] = calcExpress(data, v);
  14951. });
  14952. }
  14953. });
  14954. };
  14955. trav(result);
  14956. return result;
  14957. }
  14958. /**
  14959. * 合併 data 到當前的 ViewModel 對象
  14960. */
  14961. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  14962. var newRow = {};
  14963. if (isFlat == false) {
  14964. newRow = data;
  14965. }
  14966. else {
  14967. flatObject(newRow, '', data);
  14968. }
  14969. if (!propertyName) {
  14970. _$2.forOwn(newRow, function (value, key) {
  14971. viewModel.set(key, value);
  14972. });
  14973. }
  14974. else {
  14975. _$2.forOwn(newRow, function (value, key) {
  14976. viewModel.set(propertyName + "." + key, value);
  14977. });
  14978. }
  14979. }
  14980. /**
  14981. * 转换内联结构的行,到平面结构
  14982. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  14983. *
  14984. * @param array
  14985. * @param flatOption
  14986. * @return {[]}
  14987. */
  14988. function flatRow(array) {
  14989. var ret = [];
  14990. _$2.forEach(array, function (row) {
  14991. var newRow = {};
  14992. flatObject(newRow, '', row);
  14993. ret.push(newRow);
  14994. });
  14995. return ret;
  14996. }
  14997. function flatObject(parentObj, parentProp, obj) {
  14998. _$2.forOwn(obj, function (value, key) {
  14999. var fullKey = parentProp ? parentProp + '_' + key : key;
  15000. if (_$2.isArray(value)) {
  15001. parentObj[fullKey] = _$2.map(value, function (row) {
  15002. var newRow = {};
  15003. flatObject(newRow, '', row);
  15004. return newRow;
  15005. });
  15006. }
  15007. else {
  15008. if (typeof value === 'object') {
  15009. flatObject(parentObj, fullKey, value);
  15010. }
  15011. else {
  15012. parentObj[fullKey] = value;
  15013. }
  15014. }
  15015. });
  15016. }
  15017. /**
  15018. * 替换内部结构中,所有 N/A
  15019. */
  15020. function replaceNA(obj) {
  15021. if (obj === 'N/A') {
  15022. return '';
  15023. }
  15024. if (_$2.isArray(obj)) {
  15025. _$2.forEach(obj, function (value, idx) {
  15026. if (value === 'N/A') {
  15027. obj[idx] = '';
  15028. }
  15029. else {
  15030. if (typeof value === "string" && /^-?\d*\.\d+$/.test(value)) {
  15031. var count = 0;
  15032. for (var i = value.length - 1; i > 0; i--) {
  15033. if (value[i] === "0") {
  15034. count++;
  15035. }
  15036. else if (value[i] === ".") {
  15037. count++;
  15038. break;
  15039. }
  15040. else {
  15041. break;
  15042. }
  15043. }
  15044. obj[idx] = value.substr(0, value.length - count);
  15045. }
  15046. else {
  15047. replaceNA(value);
  15048. }
  15049. }
  15050. });
  15051. }
  15052. else if (_$2.isPlainObject(obj)) {
  15053. _$2.forOwn(obj, function (value, key) {
  15054. if (value === 'N/A') {
  15055. obj[key] = '';
  15056. }
  15057. else {
  15058. if (typeof value === "string" && /^-?\d*\.\d+$/.test(value)) {
  15059. var count = 0;
  15060. for (var i = value.length - 1; i > 0; i--) {
  15061. if (value[i] === "0") {
  15062. count++;
  15063. }
  15064. else if (value[i] === ".") {
  15065. count++;
  15066. break;
  15067. }
  15068. else {
  15069. break;
  15070. }
  15071. }
  15072. obj[key] = value.substr(0, value.length - count);
  15073. }
  15074. else {
  15075. replaceNA(value);
  15076. }
  15077. }
  15078. });
  15079. }
  15080. }
  15081. function deepTravJson(obj, resolver) {
  15082. if (_$2.isArray(obj)) {
  15083. _$2.forEach(obj, function (value, idx) {
  15084. if (typeof value === 'string') {
  15085. resolver(obj, value, idx);
  15086. }
  15087. else {
  15088. deepTravJson(value, resolver);
  15089. }
  15090. });
  15091. }
  15092. else if (_$2.isPlainObject(obj)) {
  15093. _$2.forOwn(obj, function (value, key) {
  15094. if (typeof value === 'string') {
  15095. resolver(obj, value, key);
  15096. }
  15097. else {
  15098. deepTravJson(value, resolver);
  15099. }
  15100. });
  15101. }
  15102. }
  15103. /**
  15104. * 根据表达式进入写值
  15105. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  15106. * express="test-{query.a}" 写值就会失败
  15107. *
  15108. * @example
  15109. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  15110. * 写值成功
  15111. *
  15112. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  15113. * 写值失败
  15114. *
  15115. * @param viewModel VM对象
  15116. * @param express 表达式对象
  15117. * @param value 目标值
  15118. */
  15119. function tryWriteByExpress(viewModel, express, value) {
  15120. if (SIMPLE_RE.test(express)) {
  15121. // '{foo}' 简单表达式
  15122. express = express.substring(1, express.length - 1);
  15123. viewModel.set(express, value);
  15124. }
  15125. }
  15126. /**
  15127. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  15128. * @example
  15129. * 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]})
  15130. *
  15131. * expressObject:
  15132. * {
  15133. * a: '{query.a}',
  15134. * b: {
  15135. * b1: '{query.b1}',
  15136. * b2: '{query.b2}',
  15137. * },
  15138. * c: 'aa',
  15139. * d: [
  15140. * '{query.a}',
  15141. * '{query.b2}'
  15142. * ]
  15143. * }
  15144. *
  15145. * valueObject:
  15146. * {
  15147. * a: 'aValue',
  15148. * b: {
  15149. * b1: 'b1Value',
  15150. * b2: 'b2Value'
  15151. * },
  15152. * c: 'aa'
  15153. * c: [
  15154. * 'aValue',
  15155. * 'b2Value'
  15156. * ]
  15157. * }
  15158. *
  15159. * 系统会尝试回写
  15160. * viewModel.set('query.a', 'aValue')
  15161. * viewModel.set('query.b1', 'b1Value')
  15162. * viewModel.set('query.b2', 'b2Value')
  15163. *
  15164. * @param expressObject 含表达式的对象
  15165. * @param valueObject 表达式计算完成之后的结果对象
  15166. * @param writeFn 写入的方法 (path, value)=>void
  15167. */
  15168. function tryWriteObject(expressObject, valueObject, writeFn) {
  15169. var trav = function (pathPrefix) {
  15170. var parent = expressObject;
  15171. if (_$2.size(pathPrefix) > 1) {
  15172. parent = _$2.get(parent, pathPrefix.substring(1));
  15173. }
  15174. _$2.forOwn(parent, function (value, key) {
  15175. if (_$2.isPlainObject(value)) {
  15176. // 深度递归,对子对象进行求解
  15177. trav(pathPrefix + "." + key);
  15178. }
  15179. else if (_$2.isString(value)) {
  15180. // 字符串直接用 calcExpress 表达式求解
  15181. if (SIMPLE_RE.test(value)) {
  15182. // If we have '{foo}' alone it is a literal 简单表达式
  15183. var targetPath = value.substring(1, value.length - 1);
  15184. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  15185. if (!writeFn) {
  15186. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15187. }
  15188. else {
  15189. writeFn(targetPath, targetValue);
  15190. }
  15191. }
  15192. }
  15193. else if (_$2.isArray(value)) {
  15194. _$2.each(value, function (v, idx) {
  15195. if (SIMPLE_RE.test(v)) {
  15196. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  15197. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  15198. if (!writeFn) {
  15199. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15200. }
  15201. else {
  15202. writeFn(targetPath, targetValue);
  15203. }
  15204. }
  15205. });
  15206. }
  15207. });
  15208. };
  15209. trav("");
  15210. }
  15211. /**
  15212. * 尝试去掉变量两边括号
  15213. * {a} => a
  15214. * a => a
  15215. */
  15216. function tryVarSimple(value) {
  15217. if (SIMPLE_RE.test(value)) {
  15218. // If we have '{foo}' alone it is a literal 简单表达式
  15219. return value.substring(1, value.length - 1);
  15220. }
  15221. return value;
  15222. }
  15223. /**
  15224. * 对多个表达式进行求值. 异步回调的方式返回
  15225. * {
  15226. * a: 1,
  15227. * b: '{someBind}',
  15228. * c: ['a', 'b', 'c'],
  15229. * d: ['a', 'b', '{someBind}'],
  15230. * e: {
  15231. * y: 1,
  15232. * z: 2
  15233. * },
  15234. * f: {
  15235. * y: 1,
  15236. * z: '{someBind}'
  15237. * }
  15238. * }
  15239. *
  15240. * // Will produce
  15241. * {
  15242. * b: value,
  15243. * d: ['a', 'b', value],
  15244. * f: {
  15245. * y: 1,
  15246. * z: value
  15247. * }
  15248. * }
  15249. * @param viewModel scope.viewModel对象
  15250. * @param paramObject 求值对象
  15251. */
  15252. function calcObject(viewModel, paramObject) {
  15253. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  15254. return new Promise(function (resolve) {
  15255. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  15256. schedule.destroy();
  15257. // 从 Ext.data.Model 对象转换为 js-object 对象
  15258. ret = toPlainObject(ret);
  15259. resolve(ret);
  15260. }, viewModel, { single: true });
  15261. });
  15262. }
  15263. /**
  15264. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  15265. * @param config 组件构造函数传入的 config 配置文件
  15266. */
  15267. function getParentGrid(config) {
  15268. var _a;
  15269. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  15270. }
  15271. /**
  15272. * 解析
  15273. * {
  15274. * condition: "{skuId}",
  15275. * errorMsg: "无法编辑",
  15276. * notice: 'msg'
  15277. * }
  15278. */
  15279. function tryEnable(data, enableSetting) {
  15280. if (!enableSetting) {
  15281. // 没有这一段配置,可以编辑
  15282. return true;
  15283. }
  15284. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  15285. if (!evalFunction(data, condition)) {
  15286. // 没有达成 condition 条件
  15287. // 计算 msg 消息内容
  15288. var msgContent = calcExpress(data, errorMsg);
  15289. if (msgContent) {
  15290. if (!notice || notice === 'msg') {
  15291. // 进行提示
  15292. msg$1(msgContent);
  15293. }
  15294. }
  15295. return false;
  15296. }
  15297. return true;
  15298. }
  15299. /**
  15300. * 动态的为 combo 或 columns.combo 设置下拉框的值
  15301. * @param sender 目标对象
  15302. * @param config 目标对象的配置(在构造函数之前也可以)
  15303. * @param getDictFn 获取字典的方法
  15304. * @param bizKey 传入字典的参数
  15305. * @param multiValueSeparator 多个字典值的分割符号
  15306. */
  15307. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  15308. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  15309. // sender 和 config为空的时候获取值、
  15310. if (_$2.isArray(getDictFn)) {
  15311. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  15312. var realArray_1 = getDictFn;
  15313. getDictFn = function () {
  15314. return realArray_1;
  15315. };
  15316. }
  15317. if (!sender) {
  15318. return new Promise(function (resolve, reject) {
  15319. getDictFn(bizKey, function (r) {
  15320. resolve({ config: config, r: r });
  15321. });
  15322. });
  15323. }
  15324. if (sender.xtype === 'combotree') {
  15325. getDictFn(bizKey, function (r) {
  15326. if (sender.store) {
  15327. // 异步回传
  15328. sender.setStore(new Ext.data.TreeStore({ root: r }));
  15329. }
  15330. else {
  15331. // 同步回传
  15332. config.store = new Ext.data.TreeStore({ root: r });
  15333. }
  15334. });
  15335. return;
  15336. }
  15337. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  15338. getDictFn(bizKey, function (r) {
  15339. var _a, _b;
  15340. if (sender.store) {
  15341. // 异步回传
  15342. sender.setStore(new Ext.data.Store(r));
  15343. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  15344. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  15345. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  15346. if (typeof realValue !== 'undefined') {
  15347. sender.setValue(realValue);
  15348. }
  15349. }
  15350. else {
  15351. // 同步回传
  15352. config.store = new Ext.data.Store(r);
  15353. }
  15354. });
  15355. return;
  15356. }
  15357. else if (sender.xtype === 'gridcolumn') {
  15358. var grid = getParentGrid(config);
  15359. var editor_1 = config.editor, renderer = config.renderer;
  15360. getDictFn(bizKey, function (r) {
  15361. if (sender.store) {
  15362. // 已经渲染出来了, 用方法进行修改
  15363. var editor_2 = sender.getEditor();
  15364. if (editor_2 && editor_2.xtype === 'combo') {
  15365. var valueField_1 = r.field[0];
  15366. var displayField_1 = r.field[1];
  15367. editor_2.valueField = valueField_1;
  15368. editor_2.setDisplayField(displayField_1);
  15369. editor_2.setStore(new Ext.data.Store(r));
  15370. }
  15371. if (!sender.disableListFilter) {
  15372. sender.setFilter({
  15373. type: 'list',
  15374. options: _$2.map(r.data, function (r) { return ({
  15375. id: '' + r.id,
  15376. text: r.text,
  15377. }); })
  15378. });
  15379. }
  15380. }
  15381. else {
  15382. // 没有渲染之前,修改 config 即可
  15383. if (editor_1 && editor_1.xtype === 'combo') {
  15384. // 带编辑模式
  15385. editor_1.store = new Ext.data.Store(r);
  15386. }
  15387. if (!sender.disableListFilter) {
  15388. config.filter = {
  15389. type: 'list',
  15390. options: _$2.map(r.data, function (r) { return ({
  15391. id: r.id,
  15392. text: r.text,
  15393. }); })
  15394. };
  15395. }
  15396. }
  15397. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  15398. var renderer = function (value, metaData) {
  15399. if (metaData === void 0) { metaData = false; }
  15400. if (!value && value != 0) {
  15401. return '';
  15402. }
  15403. var valueField = r.field[metaData === true ? 1 : 0];
  15404. var displayField = r.field[metaData === true ? 0 : 1];
  15405. var separator = multiValueSeparator;
  15406. if (separator) {
  15407. var arr = value.split(separator);
  15408. var displayValue_1 = "";
  15409. var _loop_1 = function (i) {
  15410. var itv = arr[i];
  15411. if (i > 0) {
  15412. displayValue_1 += separator;
  15413. }
  15414. _$2.each(r.data, function (row) {
  15415. // 从 valueField 找到要显示的 displayField
  15416. if (row[valueField] == itv) {
  15417. displayValue_1 += row[displayField];
  15418. return false;
  15419. }
  15420. else {
  15421. if (i >= r.data.length - 1) {
  15422. displayValue_1 += itv;
  15423. }
  15424. }
  15425. });
  15426. };
  15427. for (var i = 0; i < arr.length; i++) {
  15428. _loop_1(i);
  15429. }
  15430. return displayValue_1;
  15431. }
  15432. _$2.each(r.data, function (row) {
  15433. // 从 valueField 找到要显示的 displayField
  15434. if (row[valueField] == value) {
  15435. value = row[displayField];
  15436. return false;
  15437. }
  15438. });
  15439. return value;
  15440. };
  15441. var dictForExcel = {};
  15442. var valueField = r.field[0];
  15443. var displayField = r.field[1];
  15444. _$2.each(r.data, function (row) {
  15445. // 从 valueField 找到要显示的 displayField
  15446. var key = row[valueField];
  15447. if (key != '' && typeof key != "undefined" && key != null) {
  15448. dictForExcel[key] = row[displayField];
  15449. }
  15450. });
  15451. if (sender.rendered) {
  15452. // 已经渲染出来了, 对列进行渲染
  15453. sender.renderer = renderer;
  15454. sender.dictForExcel = dictForExcel;
  15455. sender.getView().refresh();
  15456. }
  15457. else {
  15458. sender.renderer = renderer;
  15459. sender.dictForExcel = dictForExcel;
  15460. config.renderer = renderer;
  15461. config.dictForExcel = dictForExcel;
  15462. }
  15463. });
  15464. return;
  15465. }
  15466. throw new TypeError("无法识别的组件类型");
  15467. }
  15468. /**
  15469. * 调用服务器 Ajax
  15470. */
  15471. function invokeServer$1(url) {
  15472. var args = [];
  15473. for (var _i = 1; _i < arguments.length; _i++) {
  15474. args[_i - 1] = arguments[_i];
  15475. }
  15476. // @ts-ignore
  15477. return ajax.func({
  15478. url: url,
  15479. method: 'invoke',
  15480. args: args
  15481. });
  15482. }
  15483. function clearViewModelValues(viewModel, propertyName) {
  15484. if (!propertyName) {
  15485. var dd_1 = viewModel.getData();
  15486. _$2.forOwn(dd_1, function (value, key) {
  15487. viewModel.set(key, '');
  15488. });
  15489. return;
  15490. }
  15491. var dd = _$2.get(viewModel.getData(), propertyName);
  15492. _$2.forOwn(dd, function (value, key) {
  15493. viewModel.set(propertyName + '.' + key, '');
  15494. });
  15495. }
  15496. function reloadGrid(scope, gridRefName) {
  15497. var _a;
  15498. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  15499. }
  15500. /**
  15501. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  15502. */
  15503. function toPlainObject(obj) {
  15504. if (obj.isModel) {
  15505. obj = obj.data;
  15506. }
  15507. _$2.forOwn(obj, function (v, k) {
  15508. // Ext.data.Model.constructor
  15509. if (!v) {
  15510. return;
  15511. }
  15512. if (v.isModel) {
  15513. v = v.data;
  15514. }
  15515. if (typeof v === 'object') {
  15516. obj[k] = toPlainObject(v);
  15517. }
  15518. else {
  15519. obj[k] = v;
  15520. }
  15521. });
  15522. return obj;
  15523. }
  15524. function confirm(msg, sender) {
  15525. return new Promise(function (resolve) {
  15526. var _a, _b;
  15527. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  15528. var t = { msg: msg };
  15529. var WMSTranslate = window["WMSTranslate"];
  15530. if (WMSTranslate) {
  15531. if (typeof window['viewTranslate'] === 'function') {
  15532. window['viewTranslate'](t, msg, "msg");
  15533. }
  15534. }
  15535. var config = {
  15536. title: '请确认',
  15537. modal: true,
  15538. animateTarget: sender,
  15539. // resizable: false,
  15540. // constrainHeader: true,
  15541. // constrain: true,
  15542. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  15543. layout: {
  15544. type: 'hbox',
  15545. pack: 'start',
  15546. align: 'stretch'
  15547. },
  15548. items: [
  15549. {
  15550. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  15551. border: false,
  15552. },
  15553. {
  15554. flex: 1,
  15555. border: false,
  15556. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
  15557. }
  15558. ],
  15559. buttons: [
  15560. {
  15561. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  15562. handler: function () {
  15563. resolve();
  15564. win.close();
  15565. }
  15566. },
  15567. {
  15568. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  15569. handler: function () {
  15570. win.close();
  15571. }
  15572. }
  15573. ],
  15574. keyMapEnabled: true,
  15575. keyMap: {
  15576. ENTER: function () {
  15577. resolve();
  15578. win.close();
  15579. }
  15580. }
  15581. };
  15582. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15583. config.constrain = true;
  15584. }
  15585. var win = new Ext.Window(config);
  15586. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15587. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  15588. }
  15589. win.show();
  15590. });
  15591. }
  15592. /**
  15593. * 任何符号字符串都替换成下换线
  15594. */
  15595. function normId(value) {
  15596. return _$2.replace(value, /[^\w]/g, '_');
  15597. }
  15598. /**
  15599. *
  15600. * @param sender
  15601. * @param propertyName
  15602. * @param gridRefName
  15603. */
  15604. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  15605. var _a, _b;
  15606. var scope = lookupScope(sender);
  15607. clearViewModelValues(scope.viewModel, propertyName);
  15608. if (!gridRefName) {
  15609. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15610. }
  15611. else {
  15612. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15613. }
  15614. }
  15615. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  15616. if ([10, 13, 20, 40].includes(event.keyCode)) {
  15617. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  15618. var value = _$2.trim(sender.rawValue);
  15619. raiseClick(eOpts.handle);
  15620. }
  15621. }, 150);
  15622. function saveGridRow(grid1) {
  15623. var _a;
  15624. var config = grid1.config;
  15625. var scope = lookupScope(grid1);
  15626. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  15627. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  15628. // "表格保存"的相关配置
  15629. var dbSaveConfig = {
  15630. columns: [],
  15631. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  15632. saveRowValues: saveRowValues,
  15633. path: scope.originalVjson.__custom_path,
  15634. };
  15635. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  15636. if (err) {
  15637. // 如果有异常就不保存
  15638. return;
  15639. }
  15640. // 构建"表格保存"的相关配置
  15641. for (var i = 0; i < config.columns.length; i++) {
  15642. var c = config.columns[i];
  15643. var v = {
  15644. dataIndex: c.dataIndex,
  15645. header: c.header,
  15646. dbColumn: c.dbColumn,
  15647. serverCreateValue: c.serverCreateValue,
  15648. dbIsDeleteKey: c.dbIsDeleteKey,
  15649. dbIsUpdateKey: c.dbIsUpdateKey,
  15650. dbUpdateEnable: c.dbUpdateEnable,
  15651. serverValueConvert: c.dbUpdateEnable,
  15652. };
  15653. if (c.editor) {
  15654. v.editor = {
  15655. xtype: c.editor.xtype,
  15656. required: c.editor.required,
  15657. };
  15658. }
  15659. dbSaveConfig.columns.push(v);
  15660. }
  15661. // 进行业务上的逻辑校验
  15662. var hasError = false;
  15663. _$2.forEach(rows, function (row, i) {
  15664. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  15665. var c = config.columns[i_1];
  15666. var value = row[c.dataIndex];
  15667. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  15668. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  15669. hasError = true;
  15670. return false;
  15671. }
  15672. if (c.xtype === 'checkcolumn') {
  15673. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  15674. row[c.dataIndex] = c.uncheckedValue;
  15675. }
  15676. if (value === true && typeof c.checkedValue !== 'undefined') {
  15677. row[c.dataIndex] = c.checkedValue;
  15678. }
  15679. }
  15680. }
  15681. });
  15682. if (hasError) {
  15683. return;
  15684. }
  15685. // 设置当前界面为 "保存中..." 状态
  15686. grid1.setLoading(true);
  15687. invokeServer$1('/Dev@batchSave', {
  15688. newRows: newRows,
  15689. modifyRows: modifyRows,
  15690. removeRecords: removeRecords,
  15691. config: dbSaveConfig,
  15692. }).then(function (res) {
  15693. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  15694. msg$1(res.msg);
  15695. grid1.reload();
  15696. }).catch(function (e) {
  15697. console.error(e);
  15698. showErrorDialog$1(_$2.toString(e));
  15699. }).finally(function () {
  15700. // 无论正常异常,关闭 "保存中..." 状态
  15701. grid1.setLoading(false);
  15702. });
  15703. }
  15704. function insertGridRow(grid1) {
  15705. var config = grid1.config;
  15706. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  15707. var insertRow = {};
  15708. _$2.forEach(config.columns, function (c) {
  15709. var fn = c.createValue;
  15710. if (_$2.startsWith(fn, 'scope.') ||
  15711. _$2.startsWith(fn, 'system.')) {
  15712. var scope = lookupScope(grid1);
  15713. var fn2 = lookupFn(scope, fn, c);
  15714. if (_$2.isFunction(fn2)) {
  15715. var newValue = fn2();
  15716. if (!_$2.isUndefined(newValue)) {
  15717. insertRow[c.dataIndex] = newValue;
  15718. }
  15719. }
  15720. }
  15721. else if (_$2.isString(fn) && fn) {
  15722. insertRow[c.dataIndex] = fn;
  15723. }
  15724. });
  15725. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  15726. }
  15727. function commitMe(sender) {
  15728. var window = sender.up('window');
  15729. var scope = lookupScope(sender);
  15730. if (typeof scope['commit'] === 'function') {
  15731. scope['commit']().then(function (res) {
  15732. window.close();
  15733. });
  15734. }
  15735. }
  15736. function removeGridRow(grid1) {
  15737. var _a;
  15738. var config = grid1.config;
  15739. var rows = [];
  15740. if (grid1.selModel.selType === "rowmodel") {
  15741. rows.push(grid1.selection);
  15742. }
  15743. else {
  15744. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  15745. rows.push(r);
  15746. });
  15747. }
  15748. if (rows.length > 1) {
  15749. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  15750. if (_$2.isUndefined(batchRemoveConfirm)) {
  15751. //不需要提示
  15752. _$2.forEach(rows, function (r) {
  15753. grid1.getStore().remove(r);
  15754. });
  15755. }
  15756. else {
  15757. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  15758. confirm(tip).then(function () {
  15759. _$2.forEach(rows, function (r) {
  15760. grid1.getStore().remove(r);
  15761. });
  15762. });
  15763. }
  15764. }
  15765. else if (rows.length === 1) {
  15766. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  15767. if (_$2.isUndefined(singleRemoveConfirm)) {
  15768. //不需要提示
  15769. grid1.getStore().remove(rows[0]);
  15770. }
  15771. else {
  15772. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  15773. _$2.forEach(config.columns, function (c) {
  15774. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  15775. });
  15776. confirm(tip_1).then(function () {
  15777. grid1.getStore().remove(rows[0]);
  15778. });
  15779. }
  15780. }
  15781. else {
  15782. msg$1('请选择要删除的数据!');
  15783. }
  15784. }
  15785. function moveUpGridRow(grid) {
  15786. grid.rowMoveUp();
  15787. }
  15788. function moveDownGridRow(grid) {
  15789. grid.rowMoveDown();
  15790. }
  15791. var SystemEventFu = /** @class */ (function () {
  15792. function SystemEventFu() {
  15793. }
  15794. SystemEventFu.prototype.moveUpGridRow = function () {
  15795. return function (sender) {
  15796. var grid1 = sender.up('yvgrid');
  15797. moveUpGridRow(grid1);
  15798. };
  15799. };
  15800. SystemEventFu.prototype.commitMe = function () {
  15801. return function (sender) {
  15802. commitMe(sender);
  15803. };
  15804. };
  15805. SystemEventFu.prototype.moveDownGridRow = function () {
  15806. return function (sender) {
  15807. var grid1 = sender.up('yvgrid');
  15808. moveDownGridRow(grid1);
  15809. };
  15810. };
  15811. SystemEventFu.prototype.saveGridRow = function () {
  15812. return function (sender) {
  15813. var grid1 = sender.up('yvgrid');
  15814. saveGridRow(grid1);
  15815. };
  15816. };
  15817. SystemEventFu.prototype.insertGridRow = function () {
  15818. return function (sender) {
  15819. var grid1 = sender.up('yvgrid');
  15820. insertGridRow(grid1);
  15821. };
  15822. };
  15823. SystemEventFu.prototype.removeGridRow = function () {
  15824. return function (sender) {
  15825. var grid1 = sender.up('yvgrid');
  15826. removeGridRow(grid1);
  15827. };
  15828. };
  15829. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  15830. return function (sender, config) {
  15831. if (!config.listeners) {
  15832. config.listeners = {};
  15833. }
  15834. config.listeners.afterrender = function (sender) {
  15835. var scope = lookupScope(sender);
  15836. // $(sender.el.dom).on('keydown', (e) => {
  15837. // const xtype = Ext.fly(e.target).component.xtype
  15838. // if (xtype === 'textfield' && e.keyCode === 13) {
  15839. // Ext.defer(() => {
  15840. // raiseClick(scope.refs[btnReferenceName])
  15841. // })
  15842. // e.preventDefault()
  15843. // e.stopPropagation()
  15844. // return false
  15845. // }
  15846. // })
  15847. $(sender.el.dom).on('keyup', function (e) {
  15848. var tt = Ext.fly(e.target).component;
  15849. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  15850. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  15851. ![10, 13, 20, 40].includes(e.keyCode)) {
  15852. return;
  15853. }
  15854. e.preventDefault();
  15855. e.stopPropagation();
  15856. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  15857. return;
  15858. });
  15859. };
  15860. };
  15861. };
  15862. SystemEventFu.prototype.confirm = function (text, fn) {
  15863. return function (sender) {
  15864. var scope = lookupScope(sender);
  15865. var msg = calcExpress(scope.viewModel.data, text);
  15866. confirm(msg, sender).then(function () {
  15867. fn.call(scope, sender);
  15868. });
  15869. };
  15870. };
  15871. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  15872. return function (sender) {
  15873. var scope = lookupScope(sender);
  15874. var grid = scope.refs[gridRefName];
  15875. if (grid) {
  15876. var records = grid.getSelectionModel().getLastSelected();
  15877. grid.store.remove(records);
  15878. }
  15879. };
  15880. };
  15881. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  15882. //可以是 scope.XX / system.XX / string / lookup表达式
  15883. writeTarget) {
  15884. return function (sender) {
  15885. if (!invokeUrl) {
  15886. return;
  15887. }
  15888. var scope = lookupScope(sender);
  15889. scope.setLoading(true);
  15890. var data = scope.viewModel.data;
  15891. if (invokeParam) {
  15892. data = calcObjectFlat(data, invokeParam);
  15893. }
  15894. invokeServer$1(invokeUrl, data).then(function (res) {
  15895. if (res.success) {
  15896. if (typeof writeTarget === "string") {
  15897. _$2.forOwn(res.data, function (v, k) {
  15898. scope.viewModel.set(writeTarget + "." + k, v);
  15899. });
  15900. }
  15901. else if (typeof writeTarget === 'function') {
  15902. writeTarget.call(scope, res.data);
  15903. }
  15904. else if (typeof writeTarget === 'object') {
  15905. var ret = calcObjectFlat(res.data, writeTarget);
  15906. _$2.forOwn(ret, function (v, k) {
  15907. scope.viewModel.set(k, v);
  15908. });
  15909. }
  15910. }
  15911. else {
  15912. showErrorDialog$1(res.msg || '未知错误', sender);
  15913. }
  15914. }).catch(function (e) {
  15915. var _a, _b;
  15916. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15917. showErrorDialog$1(msg || e.toString(), sender);
  15918. }).finally(function () {
  15919. scope.setLoading(false);
  15920. });
  15921. };
  15922. };
  15923. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  15924. return function (sender) {
  15925. var scope = lookupScope(sender);
  15926. scope.setLoading(true);
  15927. var data = scope.viewModel.data;
  15928. if (arg0) {
  15929. data = calcObjectFlat(data, arg0);
  15930. }
  15931. invokeServer$1(groovyUrl, data).then(function (res) {
  15932. if (res.success) {
  15933. if (res.msg) {
  15934. msg(res.msg);
  15935. }
  15936. if (typeof successCallback === 'function') {
  15937. successCallback.call(scope, sender, res.data);
  15938. }
  15939. }
  15940. else {
  15941. showErrorDialog$1(res.msg || '未知错误', sender);
  15942. }
  15943. }).catch(function (e) {
  15944. var _a, _b;
  15945. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15946. showErrorDialog$1(msg || e.toString(), sender);
  15947. }).finally(function () {
  15948. scope.setLoading(false);
  15949. });
  15950. };
  15951. };
  15952. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  15953. return function (sender) {
  15954. var scope = lookupScope(sender);
  15955. var form = scope.down('form');
  15956. if (form) {
  15957. // 如果下级有表单,就做表单校验
  15958. var valid = form.isValid();
  15959. if (!valid) {
  15960. return;
  15961. }
  15962. }
  15963. scope.setLoading(true);
  15964. var data = scope.viewModel.data;
  15965. if (arg0) {
  15966. data = calcObjectFlat(data, arg0);
  15967. }
  15968. invokeServer$1(groovyUrl, data).then(function (res) {
  15969. if (res.success) {
  15970. if (res.msg) {
  15971. msg(res.msg);
  15972. }
  15973. scope.dialogSuccess(res);
  15974. }
  15975. else {
  15976. showErrorDialog$1(res.msg || '未知错误', sender);
  15977. }
  15978. }).catch(function (e) {
  15979. var _a, _b;
  15980. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15981. showErrorDialog$1(msg || e.toString(), sender);
  15982. }).finally(function () {
  15983. scope.setLoading(false);
  15984. });
  15985. };
  15986. };
  15987. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  15988. return function (sender) {
  15989. var scope = lookupScope(sender);
  15990. if (lookupObject) {
  15991. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  15992. }
  15993. else {
  15994. scope.dialogSuccess();
  15995. }
  15996. };
  15997. };
  15998. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  15999. return function (sender) {
  16000. var scope = lookupScope(sender);
  16001. clearViewModelValues(scope.viewModel, propertyName);
  16002. };
  16003. };
  16004. SystemEventFu.prototype.getGrid = function (url) {
  16005. return function (sender, config) {
  16006. if (config.xtype == "combogridmulti") {
  16007. // @ts-ignore
  16008. require([url], function (grid) {
  16009. _$2.forOwn(grid.default, function (v, k) {
  16010. sender[k] = v;
  16011. sender.config[k] = v;
  16012. if (sender.rendered) {
  16013. // 已经渲染出来了,重新调用 reload 强制刷新
  16014. sender.reload();
  16015. }
  16016. });
  16017. });
  16018. }
  16019. else {
  16020. // @ts-ignore
  16021. require([url], function (grid) {
  16022. sender.grid = grid.default;
  16023. config.grid = grid.default;
  16024. });
  16025. }
  16026. };
  16027. };
  16028. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  16029. return function (sender) {
  16030. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  16031. };
  16032. };
  16033. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  16034. return function (sender) {
  16035. var _a, _b;
  16036. var scope = lookupScope(sender);
  16037. if (!gridRefName) {
  16038. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  16039. }
  16040. else {
  16041. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  16042. }
  16043. };
  16044. };
  16045. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  16046. return function (sender) {
  16047. var scope = lookupScope(sender);
  16048. var data = scope.viewModel.data;
  16049. var param = calcObjectFlat(data, lookupForData);
  16050. // @ts-ignore
  16051. require([url], function (module) {
  16052. var ScopeClass = module.default;
  16053. var scope = new ScopeClass();
  16054. scope.success = successCallback;
  16055. scope.showDialog(sender, {}, { data: param });
  16056. });
  16057. };
  16058. };
  16059. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  16060. return function (sender, queryValue) {
  16061. showWidget(widgetUrl, lookup, sender, queryValue);
  16062. };
  16063. };
  16064. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  16065. return function (sender) {
  16066. clearViewModelByLookup(sender, lookup);
  16067. };
  16068. };
  16069. SystemEventFu.prototype.closeMe = function (callBack) {
  16070. return function (sender) {
  16071. var scope = lookupScope(sender);
  16072. scope.close();
  16073. if (callBack) {
  16074. callBack.call(sender);
  16075. }
  16076. };
  16077. };
  16078. // 未完成
  16079. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  16080. return function (sender) {
  16081. var scope = lookupScope(sender);
  16082. var data = scope.viewModel.data;
  16083. var billSetting = scope.billSetting;
  16084. var param = calcObjectFlat(data, lookupForData);
  16085. return new Promise(function (resolve, reject) {
  16086. var sf = function (scope) {
  16087. scope.success = function (dlgScope, dlgSender, reData) {
  16088. };
  16089. scope.showDialog(sender, {}, { data: param });
  16090. };
  16091. // @ts-ignore
  16092. require([url], function (module) {
  16093. // 业务描述文件
  16094. if (url.endsWith(".bill")) {
  16095. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  16096. sf(scope);
  16097. });
  16098. }
  16099. else { //原生yvanui文件
  16100. var ScopeClass = module.default;
  16101. var scope_1 = new ScopeClass();
  16102. sf(scope_1);
  16103. }
  16104. });
  16105. });
  16106. };
  16107. };
  16108. __decorate([
  16109. Lib({
  16110. title: '为某个表格,上移行',
  16111. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16112. }),
  16113. __metadata("design:type", Function),
  16114. __metadata("design:paramtypes", []),
  16115. __metadata("design:returntype", void 0)
  16116. ], SystemEventFu.prototype, "moveUpGridRow", null);
  16117. __decorate([
  16118. Lib({
  16119. title: '为某个表格,上移行',
  16120. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16121. }),
  16122. __metadata("design:type", Function),
  16123. __metadata("design:paramtypes", []),
  16124. __metadata("design:returntype", void 0)
  16125. ], SystemEventFu.prototype, "commitMe", null);
  16126. __decorate([
  16127. Lib({
  16128. title: '为某个表格,下移行',
  16129. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16130. }),
  16131. __metadata("design:type", Function),
  16132. __metadata("design:paramtypes", []),
  16133. __metadata("design:returntype", void 0)
  16134. ], SystemEventFu.prototype, "moveDownGridRow", null);
  16135. __decorate([
  16136. Lib({
  16137. title: '为某个表格,批量保存至数据库',
  16138. author: '罗一帆',
  16139. createAt: '2022-07-19',
  16140. updateAt: '2022-07-19',
  16141. type: 'system',
  16142. category: '表格',
  16143. }),
  16144. __metadata("design:type", Function),
  16145. __metadata("design:paramtypes", []),
  16146. __metadata("design:returntype", void 0)
  16147. ], SystemEventFu.prototype, "saveGridRow", null);
  16148. __decorate([
  16149. Lib({
  16150. title: '为某个表格插入数据行',
  16151. author: '罗一帆',
  16152. createAt: '2022-07-19',
  16153. updateAt: '2022-07-19',
  16154. type: 'system',
  16155. category: '表格',
  16156. }),
  16157. __metadata("design:type", Function),
  16158. __metadata("design:paramtypes", []),
  16159. __metadata("design:returntype", void 0)
  16160. ], SystemEventFu.prototype, "insertGridRow", null);
  16161. __decorate([
  16162. Lib({
  16163. title: '为某个表格删除所选数据行',
  16164. author: '罗一帆',
  16165. createAt: '2022-07-19',
  16166. updateAt: '2022-07-19',
  16167. type: 'system',
  16168. category: '表格',
  16169. }),
  16170. __metadata("design:type", Function),
  16171. __metadata("design:paramtypes", []),
  16172. __metadata("design:returntype", void 0)
  16173. ], SystemEventFu.prototype, "removeGridRow", null);
  16174. __decorate([
  16175. Lib({
  16176. title: '按下回车键之后默认是否按下某个按钮',
  16177. author: '罗一帆',
  16178. createAt: '2021-07-02',
  16179. updateAt: '2021-07-02',
  16180. type: 'system',
  16181. category: '字典',
  16182. }),
  16183. __metadata("design:type", Function),
  16184. __metadata("design:paramtypes", [Object]),
  16185. __metadata("design:returntype", void 0)
  16186. ], SystemEventFu.prototype, "enterToClick", null);
  16187. __decorate([
  16188. Lib({
  16189. title: '弹出确认对话框,回答 YES 之后调用某方法',
  16190. author: '罗一帆',
  16191. createAt: '2021-07-06',
  16192. updateAt: '2021-07-06',
  16193. type: 'system',
  16194. category: '对话框',
  16195. }),
  16196. __param(0, LibParam('对话框的确认文字', 'string')),
  16197. __param(1, LibParam('确认之后的调用的方法', 'event')),
  16198. __metadata("design:type", Function),
  16199. __metadata("design:paramtypes", [Object, Object]),
  16200. __metadata("design:returntype", void 0)
  16201. ], SystemEventFu.prototype, "confirm", null);
  16202. __decorate([
  16203. Lib({
  16204. title: '删除表格当前的选中行(前端删除)',
  16205. author: '罗一帆',
  16206. createAt: '2021-07-08',
  16207. updateAt: '2021-07-08',
  16208. type: 'system',
  16209. category: '表格',
  16210. }),
  16211. __param(0, LibParam('表格引用名', 'refs')),
  16212. __metadata("design:type", Function),
  16213. __metadata("design:paramtypes", [Object]),
  16214. __metadata("design:returntype", void 0)
  16215. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  16216. __decorate([
  16217. Lib({
  16218. title: '查询表单,如果 url 为空值,就取消查询',
  16219. author: '罗一帆',
  16220. createAt: '2021-07-06',
  16221. updateAt: '2021-07-06',
  16222. type: 'system',
  16223. category: '表单',
  16224. }),
  16225. __param(0, LibParam('后端服务路径', 'string')),
  16226. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16227. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  16228. __metadata("design:type", Function),
  16229. __metadata("design:paramtypes", [String, Object, Object]),
  16230. __metadata("design:returntype", void 0)
  16231. ], SystemEventFu.prototype, "loadForm", null);
  16232. __decorate([
  16233. Lib({
  16234. title: '提交(不做校验、不关闭窗体)',
  16235. author: '罗一帆',
  16236. createAt: '2021-07-02',
  16237. updateAt: '2021-07-02',
  16238. type: 'system',
  16239. category: '表单',
  16240. }),
  16241. __param(0, LibParam('后端服务路径', 'string')),
  16242. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16243. __param(2, LibParam('提交成功后的回调', 'event', true)),
  16244. __metadata("design:type", Function),
  16245. __metadata("design:paramtypes", [String, Object, Object]),
  16246. __metadata("design:returntype", void 0)
  16247. ], SystemEventFu.prototype, "commit", null);
  16248. __decorate([
  16249. Lib({
  16250. title: '提交表单',
  16251. author: '罗一帆',
  16252. createAt: '2021-07-02',
  16253. updateAt: '2021-07-02',
  16254. type: 'system',
  16255. category: '表单',
  16256. }),
  16257. __param(0, LibParam('后端服务路径', 'string')),
  16258. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  16259. __metadata("design:type", Function),
  16260. __metadata("design:paramtypes", [String, Object]),
  16261. __metadata("design:returntype", void 0)
  16262. ], SystemEventFu.prototype, "formCommit", null);
  16263. __decorate([
  16264. Lib({
  16265. title: '对话框成功回调',
  16266. author: '罗一帆',
  16267. createAt: '2021-07-02',
  16268. updateAt: '2021-07-02',
  16269. type: 'system',
  16270. category: '对话框',
  16271. }),
  16272. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  16273. __metadata("design:type", Function),
  16274. __metadata("design:paramtypes", [Object]),
  16275. __metadata("design:returntype", void 0)
  16276. ], SystemEventFu.prototype, "dialogSuccess", null);
  16277. __decorate([
  16278. Lib({
  16279. title: '清空 viewModel 某个属性',
  16280. author: '罗一帆',
  16281. createAt: '2021-07-02',
  16282. updateAt: '2021-07-02',
  16283. type: 'system',
  16284. category: '表单',
  16285. }),
  16286. __param(0, LibParam('属性路径', 'viewModel', true)),
  16287. __metadata("design:type", Function),
  16288. __metadata("design:paramtypes", [String]),
  16289. __metadata("design:returntype", void 0)
  16290. ], SystemEventFu.prototype, "clearViewModelValues", null);
  16291. __decorate([
  16292. Lib({
  16293. title: '从其他资源获取表格设置',
  16294. author: '罗一帆',
  16295. createAt: '2021-07-02',
  16296. updateAt: '2021-07-02',
  16297. type: 'system',
  16298. category: '表单',
  16299. }),
  16300. __param(0, LibParam('定义文件', 'module')),
  16301. __metadata("design:type", Function),
  16302. __metadata("design:paramtypes", [Object]),
  16303. __metadata("design:returntype", void 0)
  16304. ], SystemEventFu.prototype, "getGrid", null);
  16305. __decorate([
  16306. Lib({
  16307. title: '清空 viewModel 某个属性,并刷新表格',
  16308. author: '罗一帆',
  16309. createAt: '2021-07-02',
  16310. updateAt: '2021-07-02',
  16311. type: 'system',
  16312. category: '表单',
  16313. }),
  16314. __param(0, LibParam('清空的属性', 'viewModel')),
  16315. __param(1, LibParam('要刷新的表格', 'refs', true)),
  16316. __metadata("design:type", Function),
  16317. __metadata("design:paramtypes", [String, String]),
  16318. __metadata("design:returntype", void 0)
  16319. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  16320. __decorate([
  16321. Lib({
  16322. title: '刷新表格',
  16323. author: '罗一帆',
  16324. createAt: '2021-07-02',
  16325. updateAt: '2021-07-02',
  16326. type: 'system',
  16327. category: '表单',
  16328. }),
  16329. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  16330. __metadata("design:type", Function),
  16331. __metadata("design:paramtypes", [String]),
  16332. __metadata("design:returntype", void 0)
  16333. ], SystemEventFu.prototype, "reloadGrid", null);
  16334. __decorate([
  16335. Lib({
  16336. title: '显示对话框',
  16337. author: '罗一帆',
  16338. createAt: '2021-07-02',
  16339. updateAt: '2021-07-02',
  16340. type: 'system',
  16341. category: '对话框',
  16342. }),
  16343. __param(0, LibParam('业务模块名', 'module')),
  16344. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16345. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  16346. __metadata("design:type", Function),
  16347. __metadata("design:paramtypes", [String, Object, Object]),
  16348. __metadata("design:returntype", void 0)
  16349. ], SystemEventFu.prototype, "showDialog", null);
  16350. __decorate([
  16351. Lib({
  16352. title: '弹出查找框(不借助 search)',
  16353. author: '罗一帆',
  16354. createAt: '2021-07-02',
  16355. updateAt: '2021-07-02',
  16356. type: 'system',
  16357. category: '对话框',
  16358. }),
  16359. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  16360. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  16361. __metadata("design:type", Function),
  16362. __metadata("design:paramtypes", [Object, Object]),
  16363. __metadata("design:returntype", void 0)
  16364. ], SystemEventFu.prototype, "showWidget", null);
  16365. __decorate([
  16366. Lib({
  16367. title: '根据 lookup 清空 viewModel',
  16368. author: '罗一帆',
  16369. createAt: '2021-07-05',
  16370. updateAt: '2021-07-05',
  16371. type: 'system',
  16372. category: '表单',
  16373. }),
  16374. __param(0, LibParam('设值表达式', 'lookup')),
  16375. __metadata("design:type", Function),
  16376. __metadata("design:paramtypes", [Object]),
  16377. __metadata("design:returntype", void 0)
  16378. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  16379. __decorate([
  16380. Lib({
  16381. title: '关闭对话框',
  16382. author: '罗一帆',
  16383. createAt: '2021-07-05',
  16384. updateAt: '2021-07-05',
  16385. type: 'system',
  16386. category: '对话框',
  16387. }),
  16388. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  16389. __metadata("design:type", Function),
  16390. __metadata("design:paramtypes", [Object]),
  16391. __metadata("design:returntype", void 0)
  16392. ], SystemEventFu.prototype, "closeMe", null);
  16393. __decorate([
  16394. Lib({
  16395. title: '打开对话框并返回数据',
  16396. author: '余亮',
  16397. createAt: '2022-07-07',
  16398. updateAt: '2022-07-07',
  16399. type: 'system',
  16400. category: '对话框',
  16401. }),
  16402. __param(0, LibParam('业务模块名', 'module')),
  16403. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16404. __param(2, LibParam('结果映射关系', 'string', true)),
  16405. __metadata("design:type", Function),
  16406. __metadata("design:paramtypes", [String, Object, Object]),
  16407. __metadata("design:returntype", void 0)
  16408. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  16409. return SystemEventFu;
  16410. }());
  16411. /**
  16412. * 清空 viewmodel 里下属的所有属性
  16413. * @param viewModel VM对象
  16414. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  16415. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  16416. */
  16417. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  16418. var data = viewModel.data;
  16419. if (propertyKey) {
  16420. data = _$2.get(data, propertyKey);
  16421. }
  16422. _$2.forOwn(data, function (value, key) {
  16423. var targetKey = propertyKey ? propertyKey + "." + key : key;
  16424. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  16425. return;
  16426. }
  16427. viewModel.set(targetKey, '');
  16428. });
  16429. }
  16430. function clearViewModelByLookup(sender, lookup) {
  16431. if (_$2.isPlainObject(lookup)) {
  16432. var parentScope_1 = lookupScope(sender);
  16433. _$2.forOwn(lookup, function (value, key) {
  16434. if (SIMPLE_RE.test(value)) {
  16435. // '{foo}' 简单表达式
  16436. var path = value.substring(1, value.length - 1);
  16437. if (path !== 'queryValue') {
  16438. parentScope_1.viewModel.set(path, '');
  16439. }
  16440. }
  16441. });
  16442. }
  16443. }
  16444. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  16445. if (vjson === void 0) { vjson = {}; }
  16446. var parentScope = lookupScope(sender);
  16447. var me = sender;
  16448. // @ts-ignore
  16449. require([widgetUrl], function (widgetScope) {
  16450. var WidgetScopeClass = widgetScope.default;
  16451. widgetScope = new WidgetScopeClass();
  16452. // 传递进 widget.model 的数据
  16453. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  16454. widgetScope.parentScope = parentScope;
  16455. widgetScope.searchWidgetSuccess = function (data) {
  16456. if (typeof lookup === 'string') {
  16457. // lookup 是字符串的情况下,就是取某个列作为 value 值
  16458. me.setValue(data[lookup]);
  16459. return;
  16460. }
  16461. /**
  16462. * lookup: {
  16463. * // 扩展到 viewModel 的值做更改
  16464. * WH_CODE: "{queryValue}",
  16465. * WH_NAME: "{query.WH_NAME}",
  16466. * }
  16467. */
  16468. if (_$2.isPlainObject(lookup)) {
  16469. var parentScope_2 = lookupScope(sender);
  16470. tryWriteObject(lookup, data, function (path, value) {
  16471. if (path === 'queryValue') {
  16472. me.setValue(value);
  16473. }
  16474. else {
  16475. parentScope_2.viewModel.set(path, value);
  16476. }
  16477. });
  16478. }
  16479. return true;
  16480. };
  16481. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  16482. });
  16483. }
  16484. /**
  16485. * 停止事件的默认行为
  16486. * @param e
  16487. */
  16488. function stopEvent(e) {
  16489. e.preventDefault();
  16490. e.stopPropagation();
  16491. // @ts-ignore
  16492. window.event.cancelBubble = true;
  16493. e.returnValue = false;
  16494. e.cancelBubble = true;
  16495. }
  16496. /**
  16497. * 屏幕中央显示一个黑框提示
  16498. */
  16499. function msg$1(content) {
  16500. msg(content);
  16501. }
  16502. /**
  16503. * 错误对话框的强提醒
  16504. */
  16505. function showErrorDialog$1(msg, sender) {
  16506. showErrorDialog(msg, sender);
  16507. }
  16508. /**
  16509. * 错误对话框的强提醒
  16510. */
  16511. function showInfoDialog(msg, sender) {
  16512. showInfoDialogSimple(msg, sender);
  16513. }
  16514. /**
  16515. * 错误对话框的强提醒
  16516. */
  16517. function prompt$2(message, defaultValue, multiLine) {
  16518. if (defaultValue === void 0) { defaultValue = ""; }
  16519. if (multiLine === void 0) { multiLine = false; }
  16520. return prompt$1(message, defaultValue, multiLine);
  16521. }
  16522. /**
  16523. * 用于计算 express 表达式
  16524. */
  16525. function evalFunction(data, express) {
  16526. var keys = [];
  16527. var values = [];
  16528. _$2.forOwn(data, function (value, key) {
  16529. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  16530. if (match) {
  16531. key = key.substring(0, match.index);
  16532. }
  16533. keys.push(key);
  16534. values.push(value);
  16535. });
  16536. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  16537. try {
  16538. return func.apply(void 0, __spread(values));
  16539. }
  16540. catch (e) {
  16541. return;
  16542. }
  16543. }
  16544. /**
  16545. * 获取表格编辑的行数据
  16546. */
  16547. function getGridEditRows(grid) {
  16548. return grid.getGridEditRows();
  16549. }
  16550. var SystemLib = /*#__PURE__*/Object.freeze({
  16551. __proto__: null,
  16552. SIMPLE_RE: SIMPLE_RE,
  16553. pinyinMatch: pinyinMatch,
  16554. calcExpress: calcExpress,
  16555. calcObjectFlat: calcObjectFlat,
  16556. mergeViewModel: mergeViewModel,
  16557. flatRow: flatRow,
  16558. replaceNA: replaceNA,
  16559. deepTravJson: deepTravJson,
  16560. tryWriteByExpress: tryWriteByExpress,
  16561. tryWriteObject: tryWriteObject,
  16562. tryVarSimple: tryVarSimple,
  16563. calcObject: calcObject,
  16564. getParentGrid: getParentGrid,
  16565. tryEnable: tryEnable,
  16566. setComboStore: setComboStore,
  16567. invokeServer: invokeServer$1,
  16568. clearViewModelValues: clearViewModelValues,
  16569. reloadGrid: reloadGrid,
  16570. toPlainObject: toPlainObject,
  16571. confirm: confirm,
  16572. normId: normId,
  16573. clearViewModelReloadGrid: clearViewModelReloadGrid,
  16574. saveGridRow: saveGridRow,
  16575. insertGridRow: insertGridRow,
  16576. commitMe: commitMe,
  16577. removeGridRow: removeGridRow,
  16578. moveUpGridRow: moveUpGridRow,
  16579. moveDownGridRow: moveDownGridRow,
  16580. SystemEventFu: SystemEventFu,
  16581. clearViewModel: clearViewModel,
  16582. clearViewModelByLookup: clearViewModelByLookup,
  16583. showWidget: showWidget,
  16584. stopEvent: stopEvent,
  16585. msg: msg$1,
  16586. showErrorDialog: showErrorDialog$1,
  16587. showInfoDialog: showInfoDialog,
  16588. prompt: prompt$2,
  16589. evalFunction: evalFunction,
  16590. getGridEditRows: getGridEditRows
  16591. });
  16592. function initTree () {
  16593. Ext.define('Yvan.Tree', {
  16594. extend: 'Ext.tree.Panel',
  16595. alias: 'widget.yvtree',
  16596. xtype: 'yvtree',
  16597. constructor: function (config) {
  16598. var newConfig = _$2.defaultsDeep({
  16599. // 强制性属性
  16600. }, baseConfig(config, 'row-item'), config, tree);
  16601. _$2.assign(newConfig, {
  16602. tbar: [
  16603. {
  16604. xtype: 'textfield',
  16605. // triggerCls: 'x-form-clear-trigger',
  16606. flex: 1,
  16607. emptyText: '搜索过滤',
  16608. enableKeyEvents: true,
  16609. listeners: {
  16610. change: function (sender) {
  16611. var tree = sender.up("treepanel");
  16612. tree.filterByText(this.getRawValue());
  16613. },
  16614. keyup: function (sender, e) {
  16615. var tree = sender.up("treepanel");
  16616. if (e.ESC === e.getKey()) {
  16617. sender.setValue('');
  16618. tree.filterByText('');
  16619. }
  16620. }
  16621. }
  16622. },
  16623. ],
  16624. });
  16625. if (!newConfig.hideRefresh) {
  16626. newConfig.tbar.push({
  16627. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  16628. listeners: {
  16629. click: function (sender) {
  16630. var scope = sender.up("yvtree");
  16631. scope.reload();
  16632. }
  16633. }
  16634. });
  16635. }
  16636. if (!newConfig.hideExpand) {
  16637. newConfig.tbar.push({
  16638. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  16639. listeners: {
  16640. click: function (sender) {
  16641. var scope = sender.up("yvtree");
  16642. scope.expandAll();
  16643. }
  16644. }
  16645. });
  16646. }
  16647. if (!newConfig.hideCollapse) {
  16648. newConfig.tbar.push({
  16649. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  16650. listeners: {
  16651. click: function (sender) {
  16652. var scope = sender.up("yvtree");
  16653. scope.collapseAll();
  16654. }
  16655. }
  16656. });
  16657. }
  16658. this.superclass.constructor.call(this, newConfig);
  16659. },
  16660. /**
  16661. * 在根节点上增加一个节点,会触发 addNode 事件
  16662. * @param props
  16663. */
  16664. addRoot: function (props) {
  16665. var me = this;
  16666. var tableNode = me.getRootNode();
  16667. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  16668. if (_$2.isFunction(props)) {
  16669. props = props.call(this, parent);
  16670. }
  16671. _$2.forOwn(props, function (value, key) {
  16672. fieldNode.set(key, value);
  16673. });
  16674. var node = tableNode.appendChild(fieldNode);
  16675. me.ensureVisible(node);
  16676. me.setSelection(node);
  16677. me.fireEvent('addNode', me, {
  16678. parent: tableNode,
  16679. node: node,
  16680. });
  16681. },
  16682. addLast: function (props) {
  16683. var me = this;
  16684. var sel = me.selModel.getSelection();
  16685. if (!sel || sel.length <= 0) {
  16686. msg('请选择一个要添加的同级节点路径');
  16687. return;
  16688. }
  16689. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  16690. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16691. if (_$2.isFunction(props)) {
  16692. props = props.call(this, parent);
  16693. }
  16694. _$2.forOwn(props, function (value, key) {
  16695. fieldNode.set(key, value);
  16696. });
  16697. var node = parent.appendChild(fieldNode);
  16698. me.ensureVisible(node);
  16699. me.setSelection(node);
  16700. me.fireEvent('addNode', me, {
  16701. parent: parent,
  16702. node: node,
  16703. });
  16704. },
  16705. addChildren: function (props) {
  16706. var me = this;
  16707. var sel = me.selModel.getSelection();
  16708. if (!sel || sel.length <= 0) {
  16709. msg('请选择一个要添加子节点的路径');
  16710. return;
  16711. }
  16712. var parent = sel[0];
  16713. if (_$2.isFunction(props)) {
  16714. props = props.call(this, parent);
  16715. }
  16716. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16717. _$2.forOwn(props, function (value, key) {
  16718. fieldNode.set(key, value);
  16719. });
  16720. var node = parent.appendChild(fieldNode);
  16721. parent.expand();
  16722. me.ensureVisible(node);
  16723. me.setSelection(node);
  16724. me.fireEvent('addNode', me, {
  16725. parent: parent,
  16726. node: node,
  16727. });
  16728. },
  16729. initComponent: function () {
  16730. var me = this;
  16731. var config = me.config;
  16732. var scope = lookupScope(this);
  16733. if (!isDesignMode(scope, config)) {
  16734. // 转换 dataSource 属性
  16735. convertDataSource(me, scope, config);
  16736. }
  16737. this.superclass.initComponent.call(this);
  16738. this.on({
  16739. afterrender: function (sender) {
  16740. var me = this;
  16741. var config = this.config;
  16742. var dataSource = config.dataSource;
  16743. if (config.autoLoad) {
  16744. if (config.dataSourceCallbackFn) {
  16745. me.reload();
  16746. }
  16747. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  16748. me.reload();
  16749. }
  16750. }
  16751. }
  16752. });
  16753. },
  16754. _setDataReal: function (value) {
  16755. var me = this;
  16756. // me.setStore(new Ext.data.TreeStore({
  16757. // root: {
  16758. // expanded: true,
  16759. // // children: value
  16760. // children: [
  16761. // {
  16762. // id: '1', text: 'A',
  16763. // children: [
  16764. // {id: '1', text: 'A',},
  16765. // {id: '2', text: 'B'},
  16766. // ]
  16767. // },
  16768. // {id: '2', text: 'B'},
  16769. // ]
  16770. // }
  16771. // }))
  16772. me.store.setRoot({
  16773. expanded: true,
  16774. children: value
  16775. });
  16776. // me.store = new Ext.data.TreeStore({
  16777. // root: {
  16778. // expanded: true,
  16779. // // children: value
  16780. // children: [
  16781. // {
  16782. // id: '1', text: 'A',
  16783. // children: [
  16784. // {id: '1', text: 'A',},
  16785. // {id: '2', text: 'B'},
  16786. // ]
  16787. // },
  16788. // {id: '2', text: 'B'},
  16789. // ]
  16790. // }
  16791. // })
  16792. },
  16793. /**
  16794. * 重新载入数据(重新计算参数)
  16795. */
  16796. reload: function (reloadParams) {
  16797. if (reloadParams === void 0) { reloadParams = {}; }
  16798. var me = this;
  16799. var config = me.config;
  16800. if (config.dataSourceCallbackFn) {
  16801. // 函数请求刷新
  16802. var scope_1 = lookupScope(this);
  16803. // me.setLoading(true)
  16804. config.dataSourceCallbackFn.call(scope_1, me, {
  16805. successCallback: function (value) {
  16806. me._setDataReal(value);
  16807. // me.setLoading(false)
  16808. me.fireEvent('dataLoadComplete', me, true, value);
  16809. },
  16810. failCallback: function (error) {
  16811. // me.setLoading(false)
  16812. me.fireEvent('dataLoadComplete', me, false, error);
  16813. }
  16814. });
  16815. return;
  16816. }
  16817. var scope = lookupScope(me);
  16818. var dataSource = config.dataSource;
  16819. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  16820. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  16821. me.setLoading(true);
  16822. invokeServer$1(dataSource.url, params)
  16823. .then(function (res) {
  16824. me._setDataReal(res.data);
  16825. me.fireEvent('dataLoadComplete', me, res);
  16826. })
  16827. .finally(function () {
  16828. me.setLoading(false);
  16829. });
  16830. }
  16831. },
  16832. filterByText: function (text) {
  16833. this._filterText = text;
  16834. this._filterBy(this, text, 'text');
  16835. },
  16836. _filterBy: _$2.debounce(function (me, text, by) {
  16837. var view = me.getView();
  16838. me.store.clearFilter();
  16839. if (!me._filterText) {
  16840. // 没有筛选内容,还原状态
  16841. var selections = me.getSelection();
  16842. var selectionPaths_1 = [];
  16843. _$2.forEach(me.getSelection(), function (item) {
  16844. selectionPaths_1.push(item.getPath());
  16845. });
  16846. me.collapseAll();
  16847. _$2.forEach(selectionPaths_1, function (path) {
  16848. me.expandPath(path);
  16849. });
  16850. me.setSelection(selections);
  16851. return;
  16852. }
  16853. // 递归查找所有需要可见的节点 id 数组
  16854. var nodesAndParents = [];
  16855. var expandPaths = [];
  16856. me.getRootNode().cascadeBy(function (tree, view) {
  16857. var currNode = this;
  16858. currNode.collapse();
  16859. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  16860. // 展开到匹配的路径
  16861. // me.expandPath(currNode.getPath());
  16862. expandPaths.push(currNode.getPath());
  16863. // 沿途父节点全部设定为可见
  16864. while (currNode.parentNode) {
  16865. nodesAndParents.push(currNode.id);
  16866. currNode = currNode.parentNode;
  16867. }
  16868. }
  16869. }, null, [me, view]);
  16870. me.store.filterBy(function (r) {
  16871. return Ext.Array.contains(nodesAndParents, r.get('id'));
  16872. });
  16873. _$2.forEach(expandPaths, function (path) {
  16874. me.expandPath(path);
  16875. });
  16876. }, 1000),
  16877. });
  16878. }
  16879. function convertDataSource(sender, scope, newConfig) {
  16880. if (typeof newConfig.store !== 'undefined') {
  16881. // 有 store 属性的情况下,不做任何事
  16882. return;
  16883. }
  16884. if (typeof newConfig.dataSource === 'undefined') {
  16885. // 没有定义 dataSource 的情况下,不做任何事
  16886. return;
  16887. }
  16888. var dataSource = newConfig.dataSource;
  16889. if (typeof dataSource === 'string') {
  16890. // dataSource 是字符串的情况下,找到成员函数
  16891. dataSource = lookupFn(scope, dataSource);
  16892. }
  16893. if (typeof dataSource === 'function') {
  16894. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  16895. newConfig.store = new Ext.data.TreeStore({
  16896. root: {
  16897. expanded: true,
  16898. children: []
  16899. }
  16900. });
  16901. newConfig.dataSourceCallbackFn = dataSource;
  16902. return;
  16903. }
  16904. // throw new TypeError('无法识别的调用方法')
  16905. }
  16906. /**
  16907. * 构建一个 grid 支持的 dataSource
  16908. */
  16909. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  16910. if (reloadParams === void 0) { reloadParams = {}; }
  16911. if (isExcelExport === void 0) { isExcelExport = false; }
  16912. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  16913. var _a;
  16914. var me = grid;
  16915. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  16916. var storeOption = {};
  16917. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  16918. if (dataSource.sqlId) {
  16919. dataSource.method = 'invoke';
  16920. dataSource.url = '/Dev@executeSQL';
  16921. if (_$2.startsWith(dataSource.sqlId, '@')) {
  16922. // sqlId 是 @ 开头,代表直接带中文名
  16923. var scope_1 = lookupScope(grid);
  16924. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  16925. params.sqlId = dataSource.sqlId.substring(1);
  16926. }
  16927. else {
  16928. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  16929. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  16930. params.path = path;
  16931. params.sqlId = sqlId;
  16932. }
  16933. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  16934. }
  16935. var fields_1 = [];
  16936. _$2.forEach(grid.columns, function (col) {
  16937. var c = {};
  16938. if (col.dataIndex) {
  16939. c.name = col.dataIndex;
  16940. fields_1.push(c);
  16941. }
  16942. if (col.dataType) {
  16943. c.type = col.dataType;
  16944. }
  16945. });
  16946. // 默认支持 gridInvoke
  16947. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  16948. //@ts-ignore
  16949. storeOption = {
  16950. fields: fields_1,
  16951. remoteSort: config.remoteSort,
  16952. remoteFilter: config.remoteFilter,
  16953. autoLoad: true,
  16954. pageSize: me.store.pageSize || config.pageSize,
  16955. proxy: {
  16956. type: 'jsonAjax',
  16957. $owner: me,
  16958. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  16959. extraParams: extraParams,
  16960. reader: {
  16961. type: 'json',
  16962. rootProperty: 'data',
  16963. totalProperty: 'pagination.total',
  16964. successProperty: 'success',
  16965. messageProperty: 'msg',
  16966. transform: function (data) {
  16967. if (typeof window['ajaxProcess'] === 'function') {
  16968. window['ajaxProcess'](data);
  16969. }
  16970. if (typeof window['apiTranslate'] === 'function') {
  16971. window['apiTranslate'](data, dataSource.url);
  16972. }
  16973. if (typeof grid._transform === 'function') {
  16974. // 系统转换函数
  16975. grid._transform(data.data);
  16976. }
  16977. if (grid.dataTransform) {
  16978. if (typeof grid.dataTransform === 'string') {
  16979. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  16980. }
  16981. return grid.dataTransform.call(scope, grid, data);
  16982. }
  16983. return data;
  16984. }
  16985. }
  16986. },
  16987. listeners: {
  16988. load: function (store, records, successful, operation) {
  16989. var _a, _b, _c;
  16990. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  16991. if (rep.pagination) {
  16992. grid.dbInfo = rep.pagination.dbInfo;
  16993. grid.exportDataSql = rep.pagination.exportDataSql;
  16994. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  16995. }
  16996. 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;
  16997. if (isExcelExport) {
  16998. if (typeof excelExportCallBack === 'function') {
  16999. excelExportCallBack(rep);
  17000. }
  17001. else if (excelExportCallBack) {
  17002. console.error("导出回调方法错误!");
  17003. }
  17004. me.fireEvent('excelDataLoadComplete', me, successful, records);
  17005. }
  17006. else {
  17007. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  17008. // 自动选中第一行
  17009. var data = grid.getStore().data;
  17010. if (data.length > 0) {
  17011. grid.setSelection(data.items[0]);
  17012. }
  17013. }
  17014. me.fireEvent('dataLoadComplete', me, successful, records);
  17015. }
  17016. }
  17017. }
  17018. };
  17019. }
  17020. else if (exports.apiConvert) {
  17021. // 外部扩展的 apiConvert
  17022. //@ts-ignore
  17023. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack);
  17024. }
  17025. else {
  17026. throw new TypeError("不支持的 API 请求方式");
  17027. }
  17028. if (isExcelExport) {
  17029. var excelStore = new Ext.data.Store(storeOption);
  17030. excelStore.load();
  17031. }
  17032. else {
  17033. if (me.groupField) {
  17034. console.log('groupField', storeOption.groupField);
  17035. storeOption.groupField = me.groupField;
  17036. }
  17037. me.setStore(new Ext.data.Store(storeOption));
  17038. }
  17039. }
  17040. function initStores () {
  17041. Ext.define('Yvan.JsonAjaxProxy', {
  17042. extend: 'Ext.data.proxy.Ajax',
  17043. alias: 'proxy.jsonAjax',
  17044. actionMethods: {
  17045. create: "POST",
  17046. read: "POST",
  17047. update: "POST",
  17048. destroy: "POST"
  17049. },
  17050. timeout: storeAjax.timeout,
  17051. buildRequest: function (operation) {
  17052. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  17053. var me = this;
  17054. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  17055. var scope = lookupScope($owner);
  17056. var gridParam = me.getParams(operation);
  17057. var customParam = {};
  17058. // 提取 srot 元素
  17059. if (gridParam.sort) {
  17060. var sort = JSON.parse(gridParam.sort);
  17061. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  17062. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  17063. customParam.sortModel = [];
  17064. _$2.forEach(sort, function (s) {
  17065. customParam.sortModel.push({
  17066. colId: s.property,
  17067. sort: _$2.toLower(s.direction)
  17068. });
  17069. });
  17070. delete gridParam.sort;
  17071. }
  17072. // 提取筛选元素
  17073. if (gridParam.filter) {
  17074. var filter = JSON.parse(gridParam.filter);
  17075. console.log('gridParam.filter', gridParam.filter);
  17076. // "[{"operator":"like","value":"1","property":"id"}]"
  17077. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  17078. customParam.filterModel = {};
  17079. _$2.forEach(filter, function (s) {
  17080. var newFilterItem = {};
  17081. if (s.operator === 'like') {
  17082. newFilterItem.filterType = 'text';
  17083. newFilterItem.type = 'contains';
  17084. newFilterItem.filter = s.value;
  17085. }
  17086. else {
  17087. // 无法识别的筛选类型
  17088. newFilterItem.filterType = 'dict';
  17089. newFilterItem.type = 'in';
  17090. newFilterItem.filter = s.value;
  17091. }
  17092. customParam.filterModel[s.property] = newFilterItem;
  17093. });
  17094. delete gridParam.filter;
  17095. }
  17096. // 被 grid.constructor 作为方法存在
  17097. var extraParams = _$2.cloneDeep(me.getExtraParams());
  17098. var params = _$2.defaultsDeep(gridParam, extraParams);
  17099. // var request = this.superclass.buildRequest.apply(this, arguments);
  17100. var request = new Ext.data.Request({
  17101. params: {},
  17102. action: operation.getAction(),
  17103. records: operation.getRecords(),
  17104. url: me.buildUrl(),
  17105. jsonData: __assign({ args: [
  17106. params
  17107. ] }, customParam),
  17108. proxy: me
  17109. });
  17110. operation.setRequest(request);
  17111. return request;
  17112. },
  17113. afterRequest: function (req, res) {
  17114. // Extend.afterExtRequest(req, res)
  17115. }
  17116. });
  17117. Ext.define('Ext.ux.data.MyReader', {
  17118. extend: 'Ext.data.reader.Json',
  17119. xtype: 'yvgridreader',
  17120. useSimpleAccessors: false,
  17121. });
  17122. }
  17123. function initBehaviorEdit(config) {
  17124. var _a, _b, _c;
  17125. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  17126. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  17127. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  17128. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  17129. if (dbTableName) {
  17130. // 生成增删查改
  17131. var tbar = [
  17132. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  17133. click: 'system.saveGridRow()'
  17134. }, bind: {
  17135. disabled: '{!' + config.reference + '.ischanged}'
  17136. } }, saveButtonConfig),
  17137. '-',
  17138. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  17139. click: 'system.insertGridRow()'
  17140. } }, addButtonConfig),
  17141. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  17142. click: 'system.removeGridRow()'
  17143. } }, deleteButtonConfig),
  17144. ];
  17145. if (_$2.isArray(config.tbar)) {
  17146. config.tbar = __spread(tbar, [
  17147. '-'
  17148. ], config.tbar);
  17149. }
  17150. else if (_$2.isPlainObject(config.tbar)) {
  17151. config.tbar = {
  17152. border: false,
  17153. layout: {
  17154. type: 'vbox',
  17155. align: 'stretch'
  17156. },
  17157. items: [
  17158. {
  17159. xtype: 'toolbar',
  17160. border: false,
  17161. items: tbar
  17162. },
  17163. config.tbar,
  17164. ]
  17165. };
  17166. }
  17167. else if (_$2.isUndefined(config.tbar)) {
  17168. config.tbar = tbar;
  17169. }
  17170. else {
  17171. console.error("can't build tbar property!", config.tbar);
  17172. }
  17173. }
  17174. }
  17175. function initGridDialog(config) {
  17176. var detailDialog = _$2.get(config, 'detailDialog');
  17177. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  17178. if (_$2.isPlainObject(detailDialog)) {
  17179. var tbar = [
  17180. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  17181. click: 'system.showGridRowDetail()',
  17182. }, bind: {
  17183. disabled: '{!' + config.reference + '.selection}'
  17184. } }, detailButtonConfig)
  17185. ];
  17186. if (_$2.isArray(config.tbar)) {
  17187. config.tbar = __spread(config.tbar, [
  17188. '-'
  17189. ], tbar);
  17190. }
  17191. else if (_$2.isPlainObject(config.tbar)) {
  17192. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  17193. config.tbar.items = __spread(config.tbar.items);
  17194. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  17195. if (!toolbar) {
  17196. config.tbar.items = __spread(config.tbar.items, [
  17197. {
  17198. xtype: 'toolbar',
  17199. border: false,
  17200. items: tbar
  17201. },
  17202. ]);
  17203. }
  17204. else {
  17205. toolbar.items = __spread(toolbar.items, [
  17206. '-'
  17207. ], tbar);
  17208. }
  17209. }
  17210. else {
  17211. config.tbar = {
  17212. border: false,
  17213. layout: {
  17214. type: 'vbox',
  17215. align: 'stretch'
  17216. },
  17217. items: [
  17218. {
  17219. xtype: 'toolbar',
  17220. border: false,
  17221. items: tbar
  17222. },
  17223. config.tbar,
  17224. ]
  17225. };
  17226. }
  17227. }
  17228. else if (_$2.isUndefined(config.tbar)) {
  17229. config.tbar = tbar;
  17230. }
  17231. else {
  17232. console.error("can't build tbar property!", config.tbar);
  17233. }
  17234. }
  17235. }
  17236. var SystemEventFu$1 = /** @class */ (function () {
  17237. function SystemEventFu() {
  17238. }
  17239. SystemEventFu.prototype.showGridRowDetail = function () {
  17240. return function (sender) {
  17241. var grid1 = sender.up('yvgrid');
  17242. showGridRowDetail(grid1);
  17243. };
  17244. };
  17245. __decorate([
  17246. Lib({
  17247. title: '为某个表格所选数据行, 显示其对话框',
  17248. author: '罗一帆',
  17249. createAt: '2022-07-27',
  17250. updateAt: '2022-07-27',
  17251. type: 'system',
  17252. category: '表格',
  17253. }),
  17254. __metadata("design:type", Function),
  17255. __metadata("design:paramtypes", []),
  17256. __metadata("design:returntype", void 0)
  17257. ], SystemEventFu.prototype, "showGridRowDetail", null);
  17258. return SystemEventFu;
  17259. }());
  17260. function showGridRowDetail(grid1, isEdit) {
  17261. if (isEdit === void 0) { isEdit = true; }
  17262. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
  17263. if (!grid1.selection) {
  17264. msg$1('请选中要展示的数据行!');
  17265. return;
  17266. }
  17267. var record = grid1.selection;
  17268. if (_$2.isArray(record)) {
  17269. record = record[0];
  17270. }
  17271. if (!record) {
  17272. msg$1('请选中要展示的数据行!');
  17273. return;
  17274. }
  17275. var config = grid1._originVJson;
  17276. var detailDialog = config.detailDialog;
  17277. var vjson = {};
  17278. var parentScope = lookupScope(grid1);
  17279. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  17280. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  17281. _$2.defaultsDeep(vjson, {
  17282. // 强制属性
  17283. layout: 'fit',
  17284. __custom_path: __custom_path,
  17285. __custom_version: __custom_version,
  17286. fbar: __spread([
  17287. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  17288. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  17289. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  17290. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  17291. }, detailDialog, {
  17292. // 默认属性
  17293. width: 800,
  17294. height: 450,
  17295. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  17296. });
  17297. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  17298. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  17299. vjson.items.push(tabpanel);
  17300. if (tabpanel) {
  17301. // 有多个选项卡,按每个选项卡进行过滤
  17302. _$2.forEach(tabpanel.items, function (tab) {
  17303. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  17304. if (tabColumns.length > 0) {
  17305. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  17306. _$2.extend(tab, tabVjson);
  17307. }
  17308. });
  17309. }
  17310. }
  17311. else {
  17312. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  17313. }
  17314. var model = {
  17315. data: {
  17316. _edit: isEdit,
  17317. _editType: isEdit ? '编辑' : '添加',
  17318. }
  17319. };
  17320. _$2.forOwn(record.data, function (value, key) {
  17321. if (key === 'id') {
  17322. // 忽略 ID 属性
  17323. return;
  17324. }
  17325. if (_$2.startsWith(key, '_')) {
  17326. // 忽略 _ 开头的所有属性
  17327. return;
  17328. }
  17329. model.data[key] = value;
  17330. });
  17331. console.log(vjson);
  17332. if (((_e = (_d = grid1 === null || grid1 === void 0 ? void 0 : grid1._originVJson) === null || _d === void 0 ? void 0 : _d.detailDialog) === null || _e === void 0 ? void 0 : _e.beforVjson) && ((_g = (_f = grid1 === null || grid1 === void 0 ? void 0 : grid1._originVJson) === null || _f === void 0 ? void 0 : _f.detailDialog) === null || _g === void 0 ? void 0 : _g.beforVjson) instanceof Function) {
  17333. grid1._originVJson.detailDialog.beforVjson(vjson);
  17334. }
  17335. var scope = new Scope({ vjson: vjson, model: model, });
  17336. //@ts-ignore
  17337. scope.commit = function () {
  17338. return new Promise(function (resolve) {
  17339. _$2.forOwn(scope.viewModel.data, function (value, key) {
  17340. if (_$2.startsWith(key, '_')) {
  17341. // _origin 等属性可以被忽略
  17342. return;
  17343. }
  17344. if (key === 'id') {
  17345. // id 属性被忽略
  17346. return;
  17347. }
  17348. record.set(key, value);
  17349. });
  17350. resolve();
  17351. });
  17352. };
  17353. scope.showDialog(grid1, {}, {});
  17354. if (((_j = (_h = grid1 === null || grid1 === void 0 ? void 0 : grid1._originVJson) === null || _h === void 0 ? void 0 : _h.detailDialog) === null || _j === void 0 ? void 0 : _j.afterVjson) && ((_l = (_k = grid1 === null || grid1 === void 0 ? void 0 : grid1._originVJson) === null || _k === void 0 ? void 0 : _k.detailDialog) === null || _l === void 0 ? void 0 : _l.afterVjson) instanceof Function) {
  17355. grid1._originVJson.detailDialog.afterVjson(scope, grid1);
  17356. }
  17357. }
  17358. function buildForm(columns, tabpanel, detailDialog) {
  17359. var vjson = __assign({ border: false, layout: {
  17360. type: 'vbox',
  17361. pack: 'start',
  17362. align: 'stretch'
  17363. }, defaults: {
  17364. border: false,
  17365. anchor: '100%',
  17366. margin: '5',
  17367. }, scrollable: true, items: [] }, detailDialog.form);
  17368. var emptyFieldset = [];
  17369. var fieldsetList = [];
  17370. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  17371. _$2.forEach(columns, function (c) {
  17372. var fieldset = _$2.get(c, 'form.fieldset');
  17373. if (fieldset) {
  17374. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  17375. if (idx < 0) {
  17376. fieldsetList.push({
  17377. fieldset: fieldset,
  17378. columns: [c]
  17379. });
  17380. }
  17381. else {
  17382. fieldsetList[idx].columns.push(c);
  17383. }
  17384. }
  17385. else {
  17386. emptyFieldset.push(c);
  17387. }
  17388. });
  17389. _$2.forEach(fieldsetList, function (fs) {
  17390. var fieldSetVjson = {
  17391. xtype: 'fieldset',
  17392. title: fs.fieldset,
  17393. items: []
  17394. };
  17395. buildFieldItems(fieldSetVjson.items, fs.columns);
  17396. vjson.items.push(fieldSetVjson);
  17397. });
  17398. buildFieldItems(vjson.items, emptyFieldset);
  17399. return vjson;
  17400. }
  17401. // 构建字段组
  17402. function buildFieldItems(items, columns) {
  17403. var _a, _b, _c, _d, _e;
  17404. var row = {
  17405. xtype: 'cols',
  17406. items: []
  17407. };
  17408. for (var i = 0; i < columns.length; i++) {
  17409. var column = columns[i];
  17410. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  17411. delete row.xtype;
  17412. row.layout = column.form.rowlayout;
  17413. }
  17414. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  17415. row.items.push({ border: false, flex: column.form.prefix });
  17416. }
  17417. var fieldVjson = buildField(column, row.items.length);
  17418. if (!fieldVjson) {
  17419. continue;
  17420. }
  17421. row.items.push(fieldVjson);
  17422. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  17423. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  17424. }
  17425. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  17426. items.push(row);
  17427. row = {
  17428. xtype: 'cols',
  17429. items: []
  17430. };
  17431. }
  17432. }
  17433. if (row.items.length > 0) {
  17434. items.push(row);
  17435. }
  17436. }
  17437. // 构建字段
  17438. function buildField(column, colIdx) {
  17439. var ret;
  17440. if (column.xtype === 'checkcolumn') {
  17441. ret = _$2.defaultsDeep({
  17442. xtype: 'checkbox',
  17443. uncheckedValue: column.uncheckedValue,
  17444. checkedValue: column.checkedValue,
  17445. boxLabel: column.header,
  17446. bind: {
  17447. value: '{' + column.dataIndex + '}'
  17448. }
  17449. }, column.form);
  17450. if (colIdx == 0) {
  17451. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  17452. ret.margin = '0 0 0 85';
  17453. }
  17454. }
  17455. else {
  17456. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  17457. fieldLabel: column.header,
  17458. bind: {
  17459. value: '{' + column.dataIndex + '}'
  17460. },
  17461. });
  17462. }
  17463. if (!ret.xtype) {
  17464. return;
  17465. }
  17466. if (!ret.dict && ret.xtype === 'combo') {
  17467. ret.dict = column.dict;
  17468. }
  17469. // 删除辅助属性
  17470. delete ret.order;
  17471. delete ret.wrap;
  17472. return ret;
  17473. }
  17474. var model$c = {
  17475. data: {}
  17476. };
  17477. var vjson$c = {
  17478. title: '自定义表格属性',
  17479. layout: 'fit',
  17480. width: 980,
  17481. height: 500,
  17482. fbar: [
  17483. {
  17484. xtype: "button",
  17485. text: "保存",
  17486. iconCls: 'x-fa fa-save',
  17487. listeners: {
  17488. click: 'scope.commit',
  17489. }
  17490. },
  17491. {
  17492. xtype: "button",
  17493. text: "关闭",
  17494. iconCls: 'x-fa fa-times',
  17495. listeners: {
  17496. click: 'system.closeMe()',
  17497. }
  17498. },
  17499. ],
  17500. items: [
  17501. {
  17502. region: 'center',
  17503. xtype: 'tabpanel',
  17504. items: [
  17505. {
  17506. title: '基本信息', reference: 'basic',
  17507. layout: {
  17508. type: 'vbox',
  17509. pack: 'start',
  17510. align: 'stretch'
  17511. },
  17512. defaults: {
  17513. border: false,
  17514. anchor: '100%',
  17515. margin: '5',
  17516. },
  17517. scrollable: true,
  17518. items: [
  17519. {
  17520. xtype: 'cols',
  17521. items: [
  17522. {
  17523. fieldLabel: '路径',
  17524. bind: { value: '{__custom_path}' },
  17525. xtype: 'textfield',
  17526. flex: 2,
  17527. },
  17528. {
  17529. fieldLabel: '版本',
  17530. bind: { value: '{__custom_version}' },
  17531. xtype: 'textfield',
  17532. },
  17533. ]
  17534. },
  17535. {
  17536. xtype: 'cols',
  17537. items: [
  17538. {
  17539. fieldLabel: '配置点',
  17540. bind: { value: '{__custom_point}' },
  17541. xtype: 'textfield',
  17542. },
  17543. {
  17544. fieldLabel: 'reference',
  17545. bind: { value: '{reference}' },
  17546. xtype: 'textfield',
  17547. },
  17548. {
  17549. fieldLabel: '编辑模式',
  17550. bind: { value: '{_mode}' },
  17551. xtype: 'combo',
  17552. dict: 'GRID_MODE',
  17553. },
  17554. ]
  17555. },
  17556. {
  17557. layout: 'hbox',
  17558. defaults: {
  17559. margin: '0 0 0 15',
  17560. },
  17561. items: [
  17562. {
  17563. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  17564. bind: {
  17565. value: "{hideFootbar}"
  17566. }
  17567. },
  17568. {
  17569. boxLabel: '隐藏刷新', xtype: 'checkbox',
  17570. bind: {
  17571. value: "{hideRefresh}"
  17572. }
  17573. },
  17574. {
  17575. boxLabel: '隐藏导出', xtype: 'checkbox',
  17576. bind: {
  17577. value: "{hideExport}"
  17578. }
  17579. },
  17580. {
  17581. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  17582. bind: {
  17583. value: "{hideAutoSize}"
  17584. }
  17585. },
  17586. {
  17587. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  17588. bind: {
  17589. value: "{hideClearFilter}"
  17590. }
  17591. },
  17592. {
  17593. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  17594. bind: {
  17595. value: "{hideSaveGridUIConfig}"
  17596. }
  17597. },
  17598. {
  17599. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  17600. bind: {
  17601. value: "{hideClearGridUIConfig}"
  17602. }
  17603. },
  17604. ]
  17605. },
  17606. {
  17607. layout: 'hbox',
  17608. defaults: {
  17609. margin: '0 0 0 15',
  17610. },
  17611. items: [
  17612. {
  17613. boxLabel: '自动载入数据源', xtype: 'checkbox',
  17614. bind: { value: '{autoLoad}' },
  17615. margin: '0 0 0 85',
  17616. },
  17617. {
  17618. boxLabel: '分页模式', xtype: 'checkbox',
  17619. bind: { value: '{pagination}' },
  17620. },
  17621. {
  17622. boxLabel: '显示行序号', xtype: 'checkbox',
  17623. bind: { value: '{show_rownum}' },
  17624. },
  17625. {
  17626. boxLabel: '后端排序', xtype: 'checkbox',
  17627. bind: {
  17628. value: "{remoteSort}"
  17629. }
  17630. },
  17631. {
  17632. boxLabel: '后端过滤', xtype: 'checkbox',
  17633. bind: {
  17634. value: "{remoteFilter}"
  17635. }
  17636. },
  17637. {
  17638. boxLabel: '隐藏', xtype: 'checkbox',
  17639. bind: {
  17640. value: "{hidden}"
  17641. }
  17642. },
  17643. ]
  17644. },
  17645. {
  17646. layout: 'hbox',
  17647. defaults: {
  17648. margin: '0 0 0 15',
  17649. },
  17650. items: [
  17651. {
  17652. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  17653. bind: {
  17654. value: "{enableColumnHide}"
  17655. }
  17656. },
  17657. {
  17658. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  17659. bind: {
  17660. value: "{enableColumnMove}"
  17661. }
  17662. },
  17663. {
  17664. boxLabel: '自定义筛选', xtype: 'checkbox',
  17665. bind: {
  17666. value: "{gridfilters}"
  17667. }
  17668. },
  17669. {
  17670. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  17671. bind: {
  17672. value: "{enableColumnResize}"
  17673. }
  17674. },
  17675. {
  17676. boxLabel: '点击列头排序', xtype: 'checkbox',
  17677. bind: {
  17678. value: "{sortOnClick}"
  17679. }
  17680. },
  17681. ]
  17682. },
  17683. {
  17684. xtype: 'cols',
  17685. items: [
  17686. {
  17687. fieldLabel: 'dbTableName',
  17688. labelWidth: 110,
  17689. bind: { value: '{behavior.dbTableName}' },
  17690. xtype: 'textfield',
  17691. },
  17692. {
  17693. fieldLabel: 'theid',
  17694. bind: { value: '{theid}' },
  17695. xtype: 'textfield',
  17696. },
  17697. {
  17698. fieldLabel: '添加行聚焦',
  17699. bind: { value: '{behavior.focusColumnAfterInsert}' },
  17700. xtype: 'textfield',
  17701. },
  17702. ]
  17703. },
  17704. {
  17705. xtype: 'cols',
  17706. items: [
  17707. {
  17708. fieldLabel: '批量删除提示',
  17709. labelWidth: 110,
  17710. bind: { value: '{behavior.batchRemoveConfirm}' },
  17711. xtype: 'textfield',
  17712. },
  17713. {
  17714. fieldLabel: '删除提示',
  17715. bind: { value: '{behavior.singleRemoveConfirm}' },
  17716. xtype: 'textfield',
  17717. },
  17718. {
  17719. fieldLabel: '触发刷新',
  17720. labelWidth: 110,
  17721. bind: { value: '{behavior.selectToReload}' },
  17722. xtype: 'textfield',
  17723. },
  17724. ]
  17725. },
  17726. ]
  17727. },
  17728. {
  17729. title: '字段', reference: 'grid1',
  17730. xtype: 'yvgrid',
  17731. pagination: false,
  17732. _mode: 'edit',
  17733. listeners: {
  17734. buttonclick: 'scope.grid1Buttonclick',
  17735. },
  17736. hideFootbar: true,
  17737. tbar: [
  17738. {
  17739. xtype: 'button',
  17740. text: '添加',
  17741. iconCls: 'x-fa fa-plus-circle',
  17742. listeners: {
  17743. click: 'scope.addField'
  17744. }
  17745. },
  17746. {
  17747. xtype: 'button',
  17748. text: '删除',
  17749. iconCls: 'x-fa fa-minus-circle',
  17750. listeners: {
  17751. click: 'scope.removeField'
  17752. }
  17753. },
  17754. '-',
  17755. {
  17756. xtype: 'button',
  17757. text: '自动分析',
  17758. iconCls: 'x-fa fa-code-fork',
  17759. listeners: {
  17760. click: 'scope.calcField'
  17761. }
  17762. },
  17763. {
  17764. xtype: 'button',
  17765. text: '上移',
  17766. iconCls: 'x-fa fa-arrow-up',
  17767. listeners: {
  17768. click: 'scope.moveUp'
  17769. }
  17770. },
  17771. {
  17772. xtype: 'button',
  17773. text: '下移',
  17774. iconCls: 'x-fa fa-arrow-down',
  17775. listeners: {
  17776. click: 'scope.moveDown'
  17777. }
  17778. },
  17779. ],
  17780. store: {},
  17781. columns: [
  17782. {
  17783. dataIndex: 'dataIndex', header: "字段名", width: 140,
  17784. editor: { xtype: 'textfield' }
  17785. },
  17786. {
  17787. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  17788. editor: { xtype: 'textfield' }
  17789. },
  17790. {
  17791. dataIndex: 'header', header: '中文', width: 140,
  17792. editor: { xtype: 'textfield' }
  17793. },
  17794. {
  17795. dataIndex: 'dict', header: '字典', width: 110,
  17796. editor: { xtype: 'combogrid' }
  17797. },
  17798. {
  17799. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  17800. editor: { xtype: 'combogrid' }, hidden: true,
  17801. },
  17802. {
  17803. dataIndex: 'width', header: '宽度', width: 80,
  17804. editor: { xtype: 'numberfield' }, hidden: true,
  17805. },
  17806. {
  17807. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  17808. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  17809. },
  17810. {
  17811. dataIndex: 'serverCreateValue', header: '服务端创建值',
  17812. editor: { xtype: 'textfield' },
  17813. },
  17814. {
  17815. dataIndex: 'createValue', text: '客户端新创建值',
  17816. editor: { xtype: 'textfield' },
  17817. },
  17818. {
  17819. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  17820. resizable: false, sortable: false, menuDisabled: true,
  17821. checkedValue: true, uncheckedValue: false,
  17822. },
  17823. {
  17824. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  17825. resizable: false, sortable: false, menuDisabled: true,
  17826. checkedValue: true, uncheckedValue: false,
  17827. },
  17828. {
  17829. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  17830. resizable: false, sortable: false, menuDisabled: true,
  17831. checkedValue: true, uncheckedValue: false,
  17832. },
  17833. {
  17834. dataIndex: 'formatter', header: '格式化', width: 110,
  17835. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  17836. },
  17837. {
  17838. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  17839. resizable: false, sortable: false, menuDisabled: true,
  17840. checkedValue: true, uncheckedValue: false, hidden: true,
  17841. },
  17842. {
  17843. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  17844. resizable: false, sortable: false, menuDisabled: true,
  17845. hidden: true,
  17846. },
  17847. {
  17848. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  17849. resizable: false, sortable: false, menuDisabled: true,
  17850. checkedValue: true, uncheckedValue: false, hidden: true,
  17851. },
  17852. {
  17853. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  17854. resizable: false, sortable: false, menuDisabled: true,
  17855. },
  17856. {
  17857. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  17858. resizable: false, sortable: false, menuDisabled: true,
  17859. checkedValue: true, uncheckedValue: false, hidden: true,
  17860. },
  17861. {
  17862. dataIndex: 'form_order', text: '对话框序号',
  17863. editor: { xtype: 'numberfield' },
  17864. },
  17865. {
  17866. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  17867. resizable: false, sortable: false, menuDisabled: true,
  17868. checkedValue: true, uncheckedValue: false,
  17869. },
  17870. {
  17871. dataIndex: 'form_xtype', text: '对话框编辑器',
  17872. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  17873. },
  17874. {
  17875. dataIndex: 'form_fieldset', text: '对话框字段组',
  17876. editor: { xtype: 'textfield' }, hidden: true,
  17877. },
  17878. {
  17879. dataIndex: 'form_tab', text: '对话框选项卡',
  17880. editor: { xtype: 'textfield' }, hidden: true,
  17881. },
  17882. {
  17883. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  17884. resizable: false, sortable: false, menuDisabled: true,
  17885. checkedValue: true, uncheckedValue: false, hidden: true,
  17886. },
  17887. ],
  17888. },
  17889. {
  17890. title: 'SQL和查询条件', reference: 'sql',
  17891. layout: 'border',
  17892. border: false,
  17893. items: [
  17894. {
  17895. region: 'north',
  17896. height: 200,
  17897. border: false,
  17898. split: true,
  17899. xtype: 'yvgrid',
  17900. reference: 'gridCondition',
  17901. pagination: false,
  17902. hideFootbar: true,
  17903. _mode: 'edit',
  17904. listeners: {
  17905. buttonclick: 'scope.conditionButtonclick',
  17906. },
  17907. store: {},
  17908. tbar: {
  17909. xtype: 'toolbar',
  17910. border: false,
  17911. items: [
  17912. {
  17913. xtype: 'button',
  17914. text: '添加条件',
  17915. iconCls: 'x-fa fa-plus-circle',
  17916. listeners: {
  17917. click: 'scope.addCondition'
  17918. }
  17919. },
  17920. {
  17921. xtype: 'button',
  17922. text: '删除条件',
  17923. iconCls: 'x-fa fa-minus-circle',
  17924. listeners: {
  17925. click: 'scope.removeCondition'
  17926. }
  17927. },
  17928. '-',
  17929. {
  17930. xtype: 'button',
  17931. text: '自动分析条件变量',
  17932. iconCls: 'x-fa fa-code-fork',
  17933. listeners: {
  17934. click: 'scope.calcCondition'
  17935. }
  17936. },
  17937. {
  17938. xtype: 'button',
  17939. text: '上移',
  17940. iconCls: 'x-fa fa-arrow-up',
  17941. listeners: {
  17942. click: 'scope.moveUpCondition'
  17943. }
  17944. },
  17945. {
  17946. xtype: 'button',
  17947. text: '下移',
  17948. iconCls: 'x-fa fa-arrow-down',
  17949. listeners: {
  17950. click: 'scope.moveDownCondition'
  17951. }
  17952. },
  17953. ]
  17954. },
  17955. columns: [
  17956. {
  17957. text: '条件变量',
  17958. dataIndex: 'param_name',
  17959. width: 140,
  17960. sortable: false,
  17961. menuDisabled: true,
  17962. editor: {
  17963. selectOnFocus: true
  17964. },
  17965. },
  17966. {
  17967. text: '中文标题',
  17968. dataIndex: 'fieldLabel',
  17969. width: 120,
  17970. sortable: false,
  17971. menuDisabled: true,
  17972. editor: {
  17973. selectOnFocus: true
  17974. },
  17975. },
  17976. {
  17977. text: '编辑类型',
  17978. dataIndex: 'xtype',
  17979. width: 80,
  17980. sortable: false,
  17981. menuDisabled: true,
  17982. editor: {
  17983. xtype: 'combo',
  17984. typeAhead: true,
  17985. triggerAction: 'all',
  17986. selectOnFocus: true,
  17987. store: [
  17988. ['textfield', 'textfield'],
  17989. ['combo', 'combo'],
  17990. ['datefield', 'datefield'],
  17991. ['datetimefield', 'datetimefield'],
  17992. ['numberfield', 'numberfield'],
  17993. ['multiplesearch', 'multiplesearch'],
  17994. ]
  17995. }
  17996. },
  17997. {
  17998. text: '权重',
  17999. dataIndex: 'conditionFieldFlex',
  18000. align: 'right',
  18001. width: 60,
  18002. sortable: false,
  18003. menuDisabled: true,
  18004. editor: {
  18005. xtype: 'numberfield',
  18006. selectOnFocus: false,
  18007. minValue: 0,
  18008. maxValue: 10
  18009. },
  18010. },
  18011. {
  18012. text: '字典',
  18013. dataIndex: 'conditionFieldDict',
  18014. width: 160,
  18015. sortable: false,
  18016. menuDisabled: true,
  18017. editor: {
  18018. selectOnFocus: false
  18019. },
  18020. },
  18021. {
  18022. xtype: 'checkcolumn',
  18023. dataIndex: "conditionFieldWrap", header: "换行",
  18024. width: 65,
  18025. sortable: false,
  18026. menuDisabled: true,
  18027. },
  18028. {
  18029. text: '扩展参数',
  18030. dataIndex: 'conditionFieldExtend',
  18031. sortable: false,
  18032. menuDisabled: true,
  18033. editor: {
  18034. selectOnFocus: false
  18035. },
  18036. },
  18037. ]
  18038. },
  18039. {
  18040. region: 'center',
  18041. xtype: 'sqleditor',
  18042. layout: 'fit',
  18043. reference: 'sqlEditor',
  18044. split: true,
  18045. },
  18046. ]
  18047. },
  18048. {
  18049. title: '详情对话框',
  18050. layout: {
  18051. type: 'vbox',
  18052. pack: 'start',
  18053. align: 'stretch'
  18054. },
  18055. defaults: {
  18056. border: false,
  18057. anchor: '100%',
  18058. margin: '5',
  18059. },
  18060. scrollable: true,
  18061. items: [
  18062. {
  18063. xtype: 'cols',
  18064. items: [
  18065. {
  18066. fieldLabel: '对话框标题',
  18067. bind: { value: '{detailDialog.title}' },
  18068. xtype: 'textfield',
  18069. flex: 2,
  18070. },
  18071. {
  18072. fieldLabel: '宽度',
  18073. bind: { value: '{detailDialog.width}' },
  18074. xtype: 'numberfield',
  18075. },
  18076. {
  18077. fieldLabel: '高度',
  18078. bind: { value: '{detailDialog.height}' },
  18079. xtype: 'numberfield',
  18080. },
  18081. ]
  18082. },
  18083. ]
  18084. },
  18085. {
  18086. title: '界面源码',
  18087. xtype: 'jseditor',
  18088. reference: 'jseditor'
  18089. }
  18090. ]
  18091. }
  18092. ]
  18093. };
  18094. var GridColumnCustom = /** @class */ (function (_super) {
  18095. __extends(GridColumnCustom, _super);
  18096. function GridColumnCustom() {
  18097. return _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  18098. }
  18099. GridColumnCustom.prototype.commit = function () {
  18100. };
  18101. GridColumnCustom.prototype.grid1Buttonclick = function () {
  18102. };
  18103. GridColumnCustom.prototype.conditionButtonclick = function () {
  18104. };
  18105. GridColumnCustom.prototype.addField = function () {
  18106. };
  18107. GridColumnCustom.prototype.removeField = function () {
  18108. };
  18109. GridColumnCustom.prototype.calcField = function () {
  18110. };
  18111. GridColumnCustom.prototype.moveUp = function () {
  18112. };
  18113. GridColumnCustom.prototype.moveDown = function () {
  18114. };
  18115. GridColumnCustom.prototype.addCondition = function () {
  18116. };
  18117. GridColumnCustom.prototype.removeCondition = function () {
  18118. };
  18119. GridColumnCustom.prototype.calcCondition = function () {
  18120. };
  18121. GridColumnCustom.prototype.moveUpCondition = function () {
  18122. };
  18123. GridColumnCustom.prototype.moveDownCondition = function () {
  18124. };
  18125. return GridColumnCustom;
  18126. }(Scope));
  18127. function initGridCode(grid, newConfig, buttons) {
  18128. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  18129. buttons.push({
  18130. xtype: 'button',
  18131. tooltip: '定义表格属性',
  18132. iconCls: 'x-fa fa-codepen',
  18133. handler: function (btn) {
  18134. var customWindow = new GridColumnCustom();
  18135. customWindow.showDialog(btn, {}, {});
  18136. }
  18137. });
  18138. buttons.push({
  18139. xtype: 'button',
  18140. tooltip: '定义表格数据源',
  18141. iconCls: 'x-fa fa-database',
  18142. handler: function () {
  18143. // showCustomGridDataSource(grid)
  18144. }
  18145. });
  18146. }
  18147. }
  18148. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  18149. var hexToString = function (hex) {
  18150. var arr = hex.split("");
  18151. var out = "";
  18152. for (var i = 0; i < arr.length / 2; i++) {
  18153. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  18154. // @ts-ignore
  18155. var charValue = String.fromCharCode(tmp);
  18156. out += charValue;
  18157. }
  18158. return out;
  18159. };
  18160. var defaultGrid = grid;
  18161. function initGrid () {
  18162. Ext.define('Yvan.Grid', {
  18163. extend: 'Ext.grid.Panel',
  18164. xtype: 'yvgrid',
  18165. __suspendReload: false,
  18166. _originVJson: {},
  18167. constructor: function (config) {
  18168. var _this = this;
  18169. var _a, _b, _c, _d, _e, _f;
  18170. var me = this;
  18171. var dataSource = config.dataSource;
  18172. 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);
  18173. me._originVJson = config;
  18174. if (!isDesignMode(scope, config)) {
  18175. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  18176. if (Array.isArray(config.columns) && config.columns.length > 0) {
  18177. var cacheData = this.getColumnConfigCache();
  18178. if (Array.isArray(cacheData) && cacheData.length > 0) {
  18179. var newColumns = [];
  18180. for (var j = 0; j < cacheData.length; j++) {
  18181. var itData = cacheData[j];
  18182. for (var i = 0; i < config.columns.length; i++) {
  18183. var column = config.columns[i];
  18184. if (itData.dataIndex === column.dataIndex) {
  18185. if (itData.width) {
  18186. column.width = itData.width;
  18187. }
  18188. column.hidden = itData.hidden;
  18189. column.locked = itData.locked;
  18190. newColumns.push(column);
  18191. break;
  18192. }
  18193. }
  18194. }
  18195. config.columns = newColumns;
  18196. }
  18197. }
  18198. }
  18199. var newConfig = _$2.defaultsDeep({
  18200. // 强制性属性 bug.
  18201. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  18202. // enableLocking: false,
  18203. // syncRowHeight: false,
  18204. }, baseConfig(config, 'row-item'), config, grid);
  18205. // 在面板上的组件
  18206. // const scope = newConfig.$initParent?.yvanScope ||
  18207. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  18208. // config.$vmParent?.yvanScope ||
  18209. // newConfig.$vmParent?._parent?.yvanScope;
  18210. var buttons = [];
  18211. var getRowClass = newConfig.getRowClass;
  18212. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  18213. _$2.startsWith(getRowClass, "system."))) {
  18214. var fn = lookupFn(scope, getRowClass);
  18215. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  18216. }
  18217. if (!newConfig.hideExport) {
  18218. buttons.push({
  18219. xtype: 'button',
  18220. tooltip: '导出Excel',
  18221. iconCls: 'x-fa fa-download',
  18222. listeners: {
  18223. click: this.exportExcel
  18224. },
  18225. });
  18226. }
  18227. if (!newConfig.hideAutoSize) {
  18228. buttons.push({
  18229. xtype: 'button',
  18230. iconCls: 'x-fa fa-text-width',
  18231. tooltip: '自适应宽度',
  18232. listeners: {
  18233. click: this.autoSizeColumns
  18234. }
  18235. });
  18236. }
  18237. if (!newConfig.hideClearFilter) {
  18238. buttons.push({
  18239. xtype: 'button',
  18240. tooltip: '清空筛选',
  18241. iconCls: 'x-fa fa-filter',
  18242. handler: this.clearFilter
  18243. });
  18244. }
  18245. if (!newConfig.hideSaveGridUIConfig) {
  18246. buttons.push({
  18247. xtype: 'button',
  18248. tooltip: '保存布局',
  18249. iconCls: 'x-fa fa-cogs',
  18250. handler: this.saveGridUIConfig
  18251. });
  18252. }
  18253. if (!newConfig.hideClearGridUIConfig) {
  18254. buttons.push({
  18255. xtype: 'button',
  18256. tooltip: '还原布局',
  18257. iconCls: 'x-fa fa-reply-all',
  18258. handler: this.clearGridUIConfig
  18259. });
  18260. }
  18261. initGridCode(me, newConfig, buttons);
  18262. if (!newConfig.hideFootbar) {
  18263. if (newConfig.pagination) {
  18264. newConfig.bbar = new Ext.PagingToolbar({
  18265. // pageSize: newConfig.pageSize, 这个值是无效的
  18266. displayInfo: true,
  18267. store: this.store,
  18268. emptyMsg: '没有记录',
  18269. cls: 'grid-bbar',
  18270. items: __spread([
  18271. {
  18272. xtype: 'combobox',
  18273. tooltip: '分页',
  18274. queryMode: 'local',
  18275. editable: false,
  18276. allowBlank: true,
  18277. labelAlign: 'right',
  18278. width: 90,
  18279. // labelWidth: 30,
  18280. listConfig: {
  18281. minWidth: null
  18282. },
  18283. value: 50,
  18284. valueField: undefined,
  18285. displayField: undefined,
  18286. hideClear: true,
  18287. store: newConfig.pageSizeOption,
  18288. listeners: {
  18289. change: function (sender, nv, ov) {
  18290. _this.store.pageSize = nv;
  18291. _this.store.loadPage(1);
  18292. }
  18293. }
  18294. }
  18295. ], buttons),
  18296. doRefresh: function () {
  18297. me.reload();
  18298. }
  18299. });
  18300. }
  18301. else {
  18302. newConfig.bbar = {
  18303. xtype: 'toolbar', overflowHandler: 'menu',
  18304. cls: 'grid-bbar',
  18305. items: __spread([
  18306. {
  18307. xtype: 'button',
  18308. tooltip: '刷新',
  18309. iconCls: 'x-fa fa-refresh',
  18310. handler: function () {
  18311. _this.reload();
  18312. }
  18313. },
  18314. '-'
  18315. ], buttons)
  18316. };
  18317. if (newConfig.hideRefresh) {
  18318. newConfig.bbar.items.splice(0, 1);
  18319. }
  18320. }
  18321. }
  18322. if (_$2.isArray(newConfig.condition)) {
  18323. // 带查询条件
  18324. var conditionRows_1 = [];
  18325. var newRow_1 = false;
  18326. var currentRow_1 = { xtype: 'cols', items: [], };
  18327. conditionRows_1.push(currentRow_1);
  18328. _$2.forEach(newConfig.condition, function (item) {
  18329. var _a;
  18330. if (newRow_1) {
  18331. currentRow_1 = { xtype: 'cols', items: [], };
  18332. conditionRows_1.push(currentRow_1);
  18333. }
  18334. var vj = _$2.cloneDeep(item);
  18335. if (vj.xtype) {
  18336. if (item.xtype === 'combo' && item.dict) {
  18337. vj.fix = ['system.getDict("' + item.dict + '")'];
  18338. }
  18339. if (item.xtype === 'datetimefield') {
  18340. _$2.defer(function () {
  18341. //@ts-ignore
  18342. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  18343. });
  18344. }
  18345. else if (item.xtype === 'datefield') {
  18346. _$2.defer(function () {
  18347. //@ts-ignore
  18348. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  18349. });
  18350. }
  18351. else {
  18352. scope.viewModel.set(item.param_name, '');
  18353. }
  18354. }
  18355. else {
  18356. // 没有组件类型,是个空占位符
  18357. vj.border = false;
  18358. }
  18359. if (item.param_name) {
  18360. vj.bind = {
  18361. value: '{' + item.param_name + '}'
  18362. };
  18363. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18364. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18365. }
  18366. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  18367. currentRow_1.items.push(vj);
  18368. });
  18369. newConfig.tbar = {
  18370. xtype: 'form',
  18371. border: false,
  18372. items: conditionRows_1,
  18373. defaults: {
  18374. margin: '8 0 8 0'
  18375. },
  18376. };
  18377. console.log('newConfig', newConfig);
  18378. }
  18379. _$2.each(newConfig.columns, function (c) {
  18380. var renderer = c.renderer, formatter = c.formatter;
  18381. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  18382. _$2.startsWith(renderer, "system."))) {
  18383. if (newConfig.$initParent) {
  18384. if (scope) {
  18385. var rendererFn = lookupFn(scope, renderer);
  18386. c.renderer = rendererFn.bind(scope);
  18387. }
  18388. }
  18389. }
  18390. if (c.dict) {
  18391. c.fix = ['system.getDict("' + c.dict + '")'];
  18392. if (c.editor && c.editor.xtype === 'combo') {
  18393. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  18394. c.editor.typeAhead = true;
  18395. c.editor.triggerAction = 'all';
  18396. c.editor.selectOnFocus = false;
  18397. c.editor.listConfig = {
  18398. minWidth: 200
  18399. };
  18400. }
  18401. }
  18402. if (formatter === 'button') {
  18403. c.tdCls = 'td-btn';
  18404. if (!c.listeners) {
  18405. c.listeners = {};
  18406. }
  18407. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  18408. if ($(event.target).is('input')) {
  18409. me.fireEvent('buttonclick', me, this, record);
  18410. }
  18411. };
  18412. }
  18413. else if (formatter === 'percentRenderer') {
  18414. c.tdCls = 'td-percent';
  18415. }
  18416. });
  18417. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  18418. // 强制为编辑模式
  18419. newConfig.selModel = {
  18420. type: 'spreadsheet',
  18421. columnSelect: true,
  18422. pruneRemoved: false,
  18423. extensible: 'y'
  18424. };
  18425. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  18426. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  18427. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18428. }
  18429. else {
  18430. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  18431. }
  18432. }
  18433. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  18434. // 强制为勾选模式
  18435. newConfig.selModel = {
  18436. type: 'checkboxmodel',
  18437. mode: 'MULTI',
  18438. };
  18439. }
  18440. else if (newConfig._mode === 'checkonly') {
  18441. newConfig.selModel = {
  18442. type: 'checkboxmodel',
  18443. mode: 'MULTI',
  18444. checkOnly: true,
  18445. };
  18446. }
  18447. else if (newConfig._mode === 'select') {
  18448. // 强制为选择模式
  18449. newConfig.selModel = {
  18450. selType: 'rowmodel',
  18451. mode: 'SINGLE',
  18452. };
  18453. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  18454. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18455. }
  18456. }
  18457. initBehaviorEdit(newConfig);
  18458. initGridDialog(newConfig);
  18459. this.superclass.constructor.call(this, newConfig);
  18460. this.store.pageSize = newConfig.pageSize;
  18461. },
  18462. setData: function (value) {
  18463. var me = this;
  18464. me._setDataReal(value);
  18465. },
  18466. /**
  18467. * 添加行,并进入编辑状态
  18468. * @param record 新行的属性集
  18469. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  18470. */
  18471. appendEditRow: function (record, editRowCol) {
  18472. var records = this.getStore().add(record);
  18473. var recNew = records[0];
  18474. this.setSelection(records);
  18475. if (typeof editRowCol === 'string' && editRowCol) {
  18476. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18477. }
  18478. if (typeof editRowCol === 'number') {
  18479. var ce = this.findPlugin('cellediting');
  18480. this.editingPlugin = ce;
  18481. ce.startEdit(recNew, editRowCol);
  18482. }
  18483. },
  18484. beginEdit: function (record, editRowCol) {
  18485. if (typeof record === 'number') {
  18486. record = this.store.data.getAt(record);
  18487. }
  18488. if (record.isEntity === true) {
  18489. this.setSelection([record]);
  18490. if (typeof editRowCol === 'string' && editRowCol) {
  18491. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18492. }
  18493. if (typeof editRowCol === 'number') {
  18494. var ce = this.findPlugin('cellediting');
  18495. this.editingPlugin = ce;
  18496. ce.startEdit(record, editRowCol);
  18497. }
  18498. }
  18499. },
  18500. /**
  18501. * 移除行
  18502. * @param record 如果记录传空,就是当前选中的行
  18503. */
  18504. removeEditRow: function (record) {
  18505. if (!record) {
  18506. record = this.selection;
  18507. }
  18508. if (!record) {
  18509. msg('请选中要删除的行');
  18510. return;
  18511. }
  18512. this.getStore().remove(record);
  18513. },
  18514. /**
  18515. * 获取全部原始数据
  18516. */
  18517. getDataRows: function () {
  18518. return this.getStore().data.items.map(function (r) { return r.data; });
  18519. },
  18520. /**
  18521. * 获取全部原始数据, 不带 id/ 不带 origin
  18522. */
  18523. getDataRowsOnlyData: function () {
  18524. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  18525. delete r.id;
  18526. delete r._origin;
  18527. return r;
  18528. });
  18529. },
  18530. rowMoveUp: function () {
  18531. var grid = this;
  18532. if (!grid.selection) {
  18533. msg('无法对多行进行移动');
  18534. return;
  18535. }
  18536. var record = grid.selection;
  18537. if (_$2.isArray(record)) {
  18538. record = record[0];
  18539. }
  18540. if (!record) {
  18541. msg('无法对多行进行移动');
  18542. return;
  18543. }
  18544. // const records = grid.selModel.getSelection()
  18545. // if (records.length !== 1) {
  18546. // msg('无法对多行进行移动')
  18547. // return
  18548. // }
  18549. //
  18550. // const [record] = records
  18551. var index = grid.store.indexOf(record);
  18552. if (index > 0) {
  18553. grid.store.removeAt(index);
  18554. grid.store.insert(index - 1, record);
  18555. grid.getView().refresh();
  18556. grid.selModel.select([record]);
  18557. }
  18558. },
  18559. rowMoveDown: function () {
  18560. var grid = this;
  18561. // const records = grid.selModel.getSelection()
  18562. // if (records.length !== 1) {
  18563. // msg('无法对多行进行移动')
  18564. // return
  18565. // }
  18566. if (!grid.selection) {
  18567. msg('无法对多行进行移动');
  18568. return;
  18569. }
  18570. var record = grid.selection;
  18571. if (_$2.isArray(record)) {
  18572. record = record[0];
  18573. }
  18574. if (!record) {
  18575. msg('无法对多行进行移动');
  18576. return;
  18577. }
  18578. var index = grid.store.indexOf(record);
  18579. if (index < grid.store.getCount() - 1) {
  18580. grid.store.removeAt(index);
  18581. grid.store.insert(index + 1, record);
  18582. grid.getView().refresh();
  18583. grid.selModel.select([record]);
  18584. }
  18585. },
  18586. getEditRecord: function () {
  18587. var _a, _b;
  18588. var me = this;
  18589. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  18590. 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;
  18591. var record;
  18592. if (typeof rowIdx === 'undefined') {
  18593. record = me.getSelectionModel().getLastSelected();
  18594. }
  18595. else {
  18596. record = me.store.getAt(rowIdx);
  18597. }
  18598. return record;
  18599. },
  18600. getEditRow: function () {
  18601. var _a;
  18602. var me = this;
  18603. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  18604. },
  18605. setEditRow: function (rowValues) {
  18606. var me = this;
  18607. var record = me.getEditRecord();
  18608. if (record) {
  18609. _$2.forOwn(rowValues, function (v, k) {
  18610. record.set(k, v);
  18611. });
  18612. }
  18613. },
  18614. _transform: function (data) {
  18615. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  18616. _$2.forEach(data, function (row) {
  18617. row._origin = _$2.clone(row);
  18618. });
  18619. },
  18620. _setDataReal: function (value) {
  18621. var me = this;
  18622. this._transform(value);
  18623. var storeOpt = {
  18624. fields: getFileds(this),
  18625. data: value,
  18626. };
  18627. if (this.groupField) {
  18628. storeOpt.groupField = this.groupField;
  18629. }
  18630. var store = new Ext.data.Store(storeOpt);
  18631. me.setStore(store);
  18632. },
  18633. setStore: function (store) {
  18634. var me = this;
  18635. if (_$2.isArray(store)) {
  18636. var value = store;
  18637. this._transform(value);
  18638. var storeOpt = {
  18639. fields: getFileds(this),
  18640. data: value,
  18641. };
  18642. if (this.groupField) {
  18643. storeOpt.groupField = this.groupField;
  18644. }
  18645. store = new Ext.data.Store(storeOpt);
  18646. }
  18647. me.superclass.setStore.call(this, store);
  18648. var reference = this.reference;
  18649. if (reference) {
  18650. var scope = lookupScope(this);
  18651. scope.viewModel.set(reference + '.ischanged', false);
  18652. scope.viewModel.set(reference + '.theid', null);
  18653. scope.viewModel.set(reference + '.theid2', null);
  18654. scope.viewModel.set(reference + '.theid3', null);
  18655. }
  18656. if (store) {
  18657. store.on({
  18658. add: function (store, records, index, eOpts) {
  18659. me._raiseChange(store, 'add');
  18660. },
  18661. remove: function (store, records, index, isMove, eOpts) {
  18662. me._raiseChange(store, 'remove');
  18663. },
  18664. datachanged: function (sender, opt) {
  18665. me._raiseChange(store, 'datachanged');
  18666. }
  18667. });
  18668. }
  18669. },
  18670. _raiseChange: function (store, type) {
  18671. var _a, _b;
  18672. var reference = this.reference;
  18673. if (reference && store) {
  18674. var ischanged = false;
  18675. if (store.getModifiedRecords().length > 0 ||
  18676. store.getNewRecords().length > 0 ||
  18677. store.getRemovedRecords().length > 0) {
  18678. ischanged = true;
  18679. }
  18680. else {
  18681. ischanged = false;
  18682. }
  18683. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  18684. }
  18685. },
  18686. /**
  18687. * 轻量级刷新
  18688. */
  18689. refreshData: function () {
  18690. var store = this.getStore();
  18691. if (store) {
  18692. store.reload();
  18693. }
  18694. },
  18695. /**
  18696. * 为表格强制设置焦点
  18697. * @param seq 顺序号
  18698. */
  18699. focusRow: function (seq) {
  18700. this.setSelection(this.store.getAt(seq));
  18701. this.getView().focusRow(seq);
  18702. },
  18703. /**
  18704. * 重新载入数据(重新计算参数)
  18705. */
  18706. reload: function (reloadParams) {
  18707. if (reloadParams === void 0) { reloadParams = {}; }
  18708. var me = this;
  18709. var config = me.config;
  18710. if (config.dataSourceCallbackFn) {
  18711. // 函数请求刷新
  18712. var scope_1 = lookupScope(this);
  18713. _$2.defer(function () {
  18714. me.setLoading(true);
  18715. });
  18716. config.dataSourceCallbackFn.call(scope_1, me, {
  18717. successCallback: function (value) {
  18718. me._setDataReal(value);
  18719. _$2.defer(function () {
  18720. me.setLoading(false);
  18721. });
  18722. // 自动选中第一行
  18723. var data = me.getStore().data;
  18724. if (data.length > 0) {
  18725. me.setSelection(data.items[0]);
  18726. }
  18727. me.fireEvent('dataLoadComplete', me, true, value);
  18728. },
  18729. failCallback: function (error) {
  18730. _$2.defer(function () {
  18731. me.setLoading(false);
  18732. });
  18733. me.fireEvent('dataLoadComplete', me, false, error);
  18734. }
  18735. });
  18736. return;
  18737. }
  18738. // if (this.store) {
  18739. // this.store.reload({aaaa: 1, bbbb: 2})
  18740. // }
  18741. var dataSource = config.dataSource;
  18742. var scope = lookupScope(me);
  18743. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  18744. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  18745. }
  18746. },
  18747. exportCurrentExcelClick: function () {
  18748. var _a;
  18749. var me = this;
  18750. var config = me.config;
  18751. var scope = lookupScope(me);
  18752. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18753. if (excelFileName.endsWith(".xlsx")) {
  18754. excelFileName = excelFileName.split(".xlsx")[0];
  18755. }
  18756. excelFileName += ".xlsx";
  18757. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  18758. var excelData = me.makeExcelData(rowsAll);
  18759. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18760. },
  18761. /**
  18762. * excel 导出
  18763. * excelExportParams 导出参数
  18764. * isContinue 是否继续导出
  18765. */
  18766. exportExcelClick: function (excelExportParams, isContinue) {
  18767. if (isContinue === void 0) { isContinue = false; }
  18768. var me = this;
  18769. var config = me.config;
  18770. excelExportParams.isExcelExport = true;
  18771. var scope = lookupScope(me);
  18772. var dataSource = config.dataSource;
  18773. var ep = function () {
  18774. scope.setLoading(true);
  18775. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  18776. var _a, _b, _c, _d;
  18777. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || me.exportExcelCurrentPage || 1;
  18778. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  18779. 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;
  18780. me.exportExcelCurrentPage = page;
  18781. me.exportExcelPageSize = size;
  18782. me.exportExcelTotal = total;
  18783. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18784. if (excelFileName.endsWith(".xlsx")) {
  18785. excelFileName = excelFileName.split(".xlsx")[0];
  18786. }
  18787. var pageExcelData = me.makeExcelData(responseData.data);
  18788. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  18789. excelFileName += ".xlsx";
  18790. LAY_EXCEL.exportExcel(pageExcelData, excelFileName, 'xlsx');
  18791. scope.setLoading(false);
  18792. if (page < total / size) {
  18793. page++;
  18794. me.exportExcelCurrentPage = page;
  18795. if (isContinue === true) {
  18796. excelExportParams.exportExcelCurrentPage = page;
  18797. ep();
  18798. }
  18799. }
  18800. });
  18801. };
  18802. ep();
  18803. },
  18804. exportBigExcelClick: function () {
  18805. var _a;
  18806. var me = this;
  18807. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  18808. showErrorDialog('当前表格不支持大批量导出');
  18809. return;
  18810. }
  18811. var config = me.config;
  18812. var scope = lookupScope(me);
  18813. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18814. var head = [];
  18815. var dict = {};
  18816. _$2.forEach(me.columns, function (column) {
  18817. if (column.isHidden())
  18818. return;
  18819. if (!column.dataIndex)
  18820. return;
  18821. if (!column.text)
  18822. return;
  18823. head.push({ field: column.dataIndex, name: column.text });
  18824. if (column.dictForExcel) {
  18825. dict[column.dataIndex] = column.dictForExcel;
  18826. }
  18827. });
  18828. // 判断是否需要解密
  18829. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  18830. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  18831. me.dbInfo.password = hexToString(me.dbInfo.password);
  18832. me.dbInfo.username = hexToString(me.dbInfo.username);
  18833. }
  18834. scope.setLoading(true);
  18835. Ext.Ajax.request({
  18836. timeout: 15000,
  18837. url: window["EXPORT_DATA_HOST"],
  18838. method: "POST",
  18839. jsonData: {
  18840. file: excelFileName,
  18841. dbInfo: me.dbInfo,
  18842. exportDataSql: me.exportDataSql,
  18843. exportDataSqlParams: me.exportDataSqlParams,
  18844. head: head,
  18845. dict: dict,
  18846. },
  18847. }).then(function () {
  18848. scope.setLoading(false);
  18849. msg('请求成功');
  18850. }).catch(function () {
  18851. scope.setLoading(false);
  18852. showErrorDialog('请求失败,请确认是否已安装客户端');
  18853. });
  18854. },
  18855. makeExcelData: function (jsonData) {
  18856. var me = this;
  18857. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  18858. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  18859. return;
  18860. }
  18861. var data = [];
  18862. // 获取表格的列定义
  18863. var headerTextArr = [];
  18864. var headers = [];
  18865. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  18866. var header = me.headerCt.getGridColumns()[i];
  18867. if (!header.isHidden()) {
  18868. var textStr = _$2.trim(header.text);
  18869. var dataIndexStr = _$2.trim(header.dataIndex);
  18870. if (dataIndexStr) {
  18871. if (textStr === '') {
  18872. headerTextArr.push(dataIndexStr);
  18873. }
  18874. else {
  18875. headerTextArr.push(textStr);
  18876. }
  18877. headers.push(header);
  18878. }
  18879. }
  18880. }
  18881. if (headers.length === 0) {
  18882. return;
  18883. }
  18884. data.push(headerTextArr);
  18885. for (var i = 0; i < jsonData.length; i++) {
  18886. var dataRow = jsonData[i];
  18887. var row = [];
  18888. for (var j = 0; j < headers.length; j++) {
  18889. var key = headers[j].dataIndex;
  18890. var value = dataRow[key];
  18891. if (!value && value !== 0) {
  18892. value = '';
  18893. }
  18894. var oValue = value;
  18895. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  18896. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  18897. try {
  18898. value = headers[j].renderer(value);
  18899. if (!value && value !== 0) {
  18900. value = oValue;
  18901. }
  18902. }
  18903. catch (e) {
  18904. value = oValue;
  18905. }
  18906. }
  18907. row.push(value);
  18908. }
  18909. data.push(row);
  18910. }
  18911. return data;
  18912. },
  18913. initComponent: function () {
  18914. var _this = this;
  18915. var _a;
  18916. var me = this;
  18917. var config = me.config;
  18918. var scope = lookupScope(this);
  18919. if (isDesignMode(scope, config)) {
  18920. this.superclass.initComponent.call(this);
  18921. return;
  18922. }
  18923. // 转换 dataSource 属性
  18924. convertDataSource$1(me, scope, config);
  18925. this.on({
  18926. afterrender: function (sender) {
  18927. var me = this;
  18928. var config = this.config;
  18929. var dataSource = config.dataSource;
  18930. if (config.autoLoad) {
  18931. if (config.dataSourceCallbackFn) {
  18932. me.reload();
  18933. }
  18934. else if (_$2.isPlainObject(dataSource)) {
  18935. me.reload();
  18936. }
  18937. }
  18938. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  18939. var vm = this.lookupViewModel();
  18940. this.contextMenu = this.add(new Ext.menu.Menu({
  18941. viewModel: vm,
  18942. items: _$2.map(config.tbar, function (item) {
  18943. var menuItem = __assign({}, item);
  18944. if (menuItem.xtype === 'button') {
  18945. delete menuItem.xtype;
  18946. }
  18947. return menuItem;
  18948. })
  18949. }));
  18950. }
  18951. else if (_$2.isPlainObject(config.contextMenu)) {
  18952. this.contextMenu = this.add(config.contextMenu);
  18953. }
  18954. var $dom = $(sender.el.dom);
  18955. $dom.on('keydown', function (e) {
  18956. me.fireEvent('keydown', me, e);
  18957. }).on('keyup', function (e) {
  18958. me.fireEvent('keyup', me, e);
  18959. });
  18960. // 默认显示提示
  18961. if (this.cellTip) {
  18962. this.tip = Ext.create('Ext.tip.ToolTip', {
  18963. target: this.el,
  18964. delegate: '.x-grid-cell-inner',
  18965. trackMouse: true,
  18966. ancor: 'top',
  18967. style: 'background-color: #0D6EFD;',
  18968. listeners: {
  18969. beforeshow: function (tip) {
  18970. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  18971. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  18972. return false;
  18973. }
  18974. tip.update(tipText);
  18975. }
  18976. }
  18977. });
  18978. }
  18979. },
  18980. itemcontextmenu: function (view, rec, node, index, e) {
  18981. if (this.contextMenu) {
  18982. e.stopEvent();
  18983. this.contextMenu.show().setLocalXY(e.getXY());
  18984. return false;
  18985. }
  18986. },
  18987. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  18988. // this.setColumnConfigCache()
  18989. // },
  18990. // columnhide(sender, column, eOpts) {
  18991. // this.setColumnConfigCache()
  18992. // },
  18993. // columnshow(sender, column, eOpts) {
  18994. // this.setColumnConfigCache()
  18995. // },
  18996. // columnresize(sender, column, width, eOpts) {
  18997. // this.setColumnConfigCache()
  18998. // },
  18999. destory: function () {
  19000. },
  19001. selectionchange: function (sender, param) {
  19002. var record = undefined;
  19003. if (_$2.isArray(param)) {
  19004. record = param[0];
  19005. }
  19006. else if (_$2.isObject(param)) {
  19007. record = _$2.get(param, 'endCell.record');
  19008. }
  19009. itemselectFun(this, sender, record);
  19010. },
  19011. itemclick: function (sender, record) {
  19012. itemselectFun(this, sender, record);
  19013. },
  19014. show: function (sender) {
  19015. if (sender.__suspendReload) {
  19016. sender.__suspendReload = false;
  19017. sender.reload();
  19018. }
  19019. }
  19020. });
  19021. _$2.defer(function () {
  19022. var ce = _this.findPlugin('cellediting');
  19023. ce.on({
  19024. beforeedit: function (editor, context, eOpts) {
  19025. me.fireEvent('editbefore', me, editor, context, eOpts);
  19026. },
  19027. canceledit: function (editor, context, eOpts) {
  19028. me.fireEvent('editcancel', me, editor, context, eOpts);
  19029. },
  19030. edit: function (editor, context, eOpts) {
  19031. me.fireEvent('editfinish', me, editor, context, eOpts);
  19032. },
  19033. validateedit: function (editor, context, eOpts) {
  19034. me.fireEvent('editvalidate', me, editor, context, eOpts);
  19035. },
  19036. });
  19037. });
  19038. var itemselectFun = _$2.debounce(function (me, sender, record) {
  19039. var reference = me.reference;
  19040. var scope = lookupScope(me);
  19041. var theid = _$2.get(config, 'behavior.theid');
  19042. if (theid && reference) {
  19043. if (!record) {
  19044. scope.viewModel.set(reference + '.theid', null);
  19045. }
  19046. else {
  19047. scope.viewModel.set(reference + '.theid', record.get(theid));
  19048. }
  19049. }
  19050. var theid2 = _$2.get(config, 'behavior.theid2');
  19051. if (theid2 && reference) {
  19052. if (!record) {
  19053. scope.viewModel.set(reference + '.theid2', null);
  19054. }
  19055. else {
  19056. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  19057. }
  19058. }
  19059. var theid3 = _$2.get(config, 'behavior.theid3');
  19060. if (theid3 && reference) {
  19061. if (!record) {
  19062. scope.viewModel.set(reference + '.theid3', null);
  19063. }
  19064. else {
  19065. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  19066. }
  19067. }
  19068. me.fireEvent('itemselect', sender, record);
  19069. }, 50);
  19070. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  19071. // 为 stores.proxy.buildRequest 做准备
  19072. this.store.proxy.$owner = this;
  19073. }
  19074. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  19075. if (selectToReload) {
  19076. // 点击后触发某个目标表格刷新
  19077. this.on({
  19078. itemselect: function (sender) {
  19079. if (_$2.isArray(selectToReload)) {
  19080. _$2.forEach(selectToReload, function (ref) {
  19081. if (ref) {
  19082. var ctlTarget = scope.refs[ref];
  19083. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19084. if (ctlTarget.isVisible()) {
  19085. ctlTarget.reload();
  19086. }
  19087. else {
  19088. ctlTarget.__suspendReload = true;
  19089. }
  19090. }
  19091. }
  19092. });
  19093. }
  19094. else if (_$2.isString(selectToReload)) {
  19095. var ctlTarget = scope.refs[selectToReload];
  19096. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19097. ctlTarget.reload();
  19098. }
  19099. }
  19100. }
  19101. });
  19102. }
  19103. this.superclass.initComponent.call(this);
  19104. },
  19105. // 生成列自定义的缓存key
  19106. makeColumnConfigCacheKey: function (config) {
  19107. var _a, _b, _c, _d, _e, _f;
  19108. 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);
  19109. var key = "gridColumnCache-" + scope.scopeKey + "-";
  19110. if (config.reference) {
  19111. key += config.reference;
  19112. }
  19113. else {
  19114. var subKey = "";
  19115. for (var i = 0; i < config.columns.length; i++) {
  19116. var column = config.columns[i];
  19117. if (column.dataIndex) {
  19118. subKey += column.dataIndex;
  19119. }
  19120. }
  19121. key += subKey;
  19122. }
  19123. return key;
  19124. },
  19125. getColumnConfigCache: function () {
  19126. var key = this.columnConfigCacheKey;
  19127. var dataStr = localStorage.getItem(key);
  19128. if (dataStr) {
  19129. return JSON.parse(dataStr);
  19130. }
  19131. return "";
  19132. },
  19133. setColumnConfigCache: function () {
  19134. var key = this.columnConfigCacheKey;
  19135. var cacheData = [];
  19136. var columns = this.headerCt.getGridColumns();
  19137. var index = 0;
  19138. for (var i = 0; i < columns.length; i++) {
  19139. var column = columns[i];
  19140. if (column.dataIndex) {
  19141. cacheData.push({
  19142. dataIndex: column.dataIndex,
  19143. width: column.width,
  19144. hidden: column.hidden,
  19145. locked: column.locked,
  19146. index: index
  19147. });
  19148. index++;
  19149. }
  19150. }
  19151. localStorage.setItem(key, JSON.stringify(cacheData));
  19152. },
  19153. autoSizeColumns: function (sender) {
  19154. var grid = sender ? sender.up('grid') : this;
  19155. // const columns = grid.columns;
  19156. // for (let i = 0; i < columns.length; i++) {
  19157. // const column = columns[i];
  19158. // grid.getView().autoSizeColumn(column);
  19159. // column.setWidth(column.getWidth() + 5);
  19160. // }
  19161. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19162. grid.headerCt.getGridColumns()[i].autoSize(i);
  19163. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19164. }
  19165. },
  19166. clearFilter: function (sender) {
  19167. var grid = sender.up('grid');
  19168. grid.filters.clearFilters();
  19169. grid.getStore().sorters.removeAll();
  19170. // grid.getStore().reload()
  19171. },
  19172. saveGridUIConfig: function (sender) {
  19173. var grid = sender.up('grid');
  19174. grid.setColumnConfigCache();
  19175. msg('保存设置成功!');
  19176. },
  19177. clearGridUIConfig: function (sender) {
  19178. var grid = sender.up('grid');
  19179. var key = grid.columnConfigCacheKey;
  19180. localStorage.setItem(key, "");
  19181. msg('清空设置成功,重新打开后生效!');
  19182. },
  19183. setLoading: function (value) {
  19184. if (value) {
  19185. this.mask('读取中');
  19186. }
  19187. else {
  19188. this.unmask();
  19189. }
  19190. },
  19191. exportExcel: function (sender) {
  19192. var _a, _b;
  19193. var rect = sender.btnEl.dom.getBoundingClientRect();
  19194. var scope = lookupScope(this);
  19195. var grid = sender.up('grid');
  19196. var menuItems = [];
  19197. var topOffset = 0;
  19198. if (((_a = grid === null || grid === void 0 ? void 0 : grid.dataSource) === null || _a === void 0 ? void 0 : _a.method) === 'invoke' || ((_b = grid === null || grid === void 0 ? void 0 : grid.dataSource) === null || _b === void 0 ? void 0 : _b.sqlId)) {
  19199. menuItems.push({
  19200. text: '大批量导出 (需要客户端支持!)',
  19201. iconCls: 'x-fa fa-download',
  19202. listeners: {
  19203. click: function (sender, value) {
  19204. // @ts-ignore
  19205. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  19206. .then(function (res) {
  19207. grid.exportBigExcelClick();
  19208. });
  19209. }
  19210. }
  19211. });
  19212. menuItems.push('-');
  19213. topOffset += 30;
  19214. }
  19215. menuItems.push({
  19216. text: '导出当前数据',
  19217. iconCls: 'x-fa fa-download',
  19218. listeners: {
  19219. click: function (sender, value) {
  19220. grid.exportCurrentExcelClick();
  19221. }
  19222. }
  19223. });
  19224. topOffset += 30;
  19225. if (grid === null || grid === void 0 ? void 0 : grid.dataSource) {
  19226. menuItems.push({
  19227. xtype: "textfield",
  19228. fieldLabel: '当前导出页',
  19229. maskRe: /[0-9]/,
  19230. value: grid.exportExcelCurrentPage,
  19231. listeners: {
  19232. render: function (sender) {
  19233. grid.exportExcelCurrentPageCmp = sender;
  19234. },
  19235. change: function (sender, value) {
  19236. var v = parseInt(value);
  19237. if (isNaN(v) || v === 0) {
  19238. window['system'].msg("页码不能为0");
  19239. v = 1;
  19240. sender.setValue(v);
  19241. }
  19242. var size = parseInt(grid.exportExcelPageSize);
  19243. var total = parseInt(grid.exportExcelTotal);
  19244. if (v > total / size) {
  19245. v = parseInt(total / size + "");
  19246. }
  19247. grid.exportExcelCurrentPage = v + "";
  19248. }
  19249. }
  19250. }, {
  19251. xtype: "textfield",
  19252. fieldLabel: '导出页大小',
  19253. maskRe: /[0-9]/,
  19254. value: grid.exportExcelPageSize,
  19255. listeners: {
  19256. render: function (sender) {
  19257. grid.exportExcelPageSizeCmp = sender;
  19258. },
  19259. change: function (sender, value) {
  19260. var v = parseInt(value);
  19261. if (isNaN(v) || v === 0) {
  19262. window['system'].msg("导出页大小不能为0");
  19263. v = defaultGrid.exportExcelPageSize;
  19264. sender.setValue(v);
  19265. }
  19266. if (window['__isNNDSL'] === true) {
  19267. if (v > 100000) {
  19268. window['system'].msg("导出页大小不能大于100000");
  19269. v = 100000;
  19270. sender.setValue(v);
  19271. }
  19272. }
  19273. else {
  19274. if (v > 10000) {
  19275. window['system'].msg("导出页大小不能大于10000");
  19276. v = 10000;
  19277. sender.setValue(v);
  19278. }
  19279. }
  19280. var page = parseInt(grid.exportExcelCurrentPage);
  19281. var total = parseInt(grid.exportExcelTotal);
  19282. if (page > total / v) {
  19283. page = parseInt(total / v + "") + 1;
  19284. grid.exportExcelCurrentPageCmp.setValue(page);
  19285. }
  19286. grid.exportExcelPageSize = v + "";
  19287. }
  19288. }
  19289. }, {
  19290. xtype: "textfield",
  19291. fieldLabel: '总条数',
  19292. value: grid.exportExcelTotal,
  19293. readOnly: true
  19294. }, {
  19295. text: '导出',
  19296. iconCls: 'x-fa fa-download',
  19297. listeners: {
  19298. click: function (sender, value) {
  19299. grid.exportExcelClick({
  19300. exportExcelPageSize: grid.exportExcelPageSize,
  19301. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19302. });
  19303. }
  19304. }
  19305. }, {
  19306. text: '连续导出',
  19307. iconCls: 'x-fa fa-download',
  19308. listeners: {
  19309. click: function (sender, value) {
  19310. grid.exportExcelClick({
  19311. exportExcelPageSize: grid.exportExcelPageSize,
  19312. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19313. }, true);
  19314. }
  19315. }
  19316. });
  19317. topOffset += 150;
  19318. }
  19319. var treeMenu = new Ext.menu.Menu({
  19320. xtype: 'menu',
  19321. floated: false,
  19322. width: 300,
  19323. docked: 'left',
  19324. items: menuItems
  19325. });
  19326. treeMenu.showAt(rect.left, rect.top - topOffset);
  19327. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19328. // grid.headerCt.getGridColumns()[i].autoSize(i);
  19329. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19330. // }
  19331. },
  19332. /**
  19333. * 获取表格编辑的行数据
  19334. */
  19335. getGridEditRows: function () {
  19336. var grid = this;
  19337. var store = grid.getStore();
  19338. var rows = [];
  19339. var modifyRows = [];
  19340. var newRows = [];
  19341. var err = "";
  19342. var records = store.getModifiedRecords();
  19343. var newRecords = store.getNewRecords();
  19344. var removeRecords = [];
  19345. _$2.forEach(store.getRemovedRecords(), function (row) {
  19346. removeRecords.push(row.data);
  19347. });
  19348. _$2.forEach(records, function (record) {
  19349. var colums = grid.columns;
  19350. var errFunc = undefined;
  19351. _$2.forEach(colums, function (col) {
  19352. var name = col.dataIndex;
  19353. var value = record.data[name];
  19354. var colIndex = col.getIndex(); //获得列号
  19355. var rowIndex = store.indexOfId(record.id); //获得行号
  19356. var editor = col.getEditor(); //使用的编辑器
  19357. var tmpErrFunc = function () {
  19358. var text = col.text || col.name;
  19359. msg(text + ' 校验失败, 请确保输入的数据正确');
  19360. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  19361. };
  19362. if (editor && !editor.allowBlank && isEmpty(value)) {
  19363. errFunc = tmpErrFunc;
  19364. return false;
  19365. }
  19366. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  19367. errFunc = tmpErrFunc;
  19368. return false;
  19369. }
  19370. });
  19371. if (typeof errFunc === 'function') {
  19372. err = "1";
  19373. _$2.remove(rows, function (n) {
  19374. return true;
  19375. });
  19376. //@ts-ignore
  19377. errFunc();
  19378. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  19379. return false;
  19380. }
  19381. else {
  19382. if (_$2.findIndex(newRecords, function (item) {
  19383. return item === record;
  19384. }) >= 0) {
  19385. newRows.push(record.data);
  19386. }
  19387. else {
  19388. modifyRows.push(record.data);
  19389. }
  19390. rows.push(record.data);
  19391. }
  19392. });
  19393. return {
  19394. rows: rows,
  19395. newRows: newRows,
  19396. modifyRows: modifyRows,
  19397. removeRecords: removeRecords,
  19398. err: err
  19399. };
  19400. }
  19401. // reload() {
  19402. // dataSourceReload(this)
  19403. // },
  19404. });
  19405. }
  19406. /**
  19407. * 获取 columns 中所有的 dataIndex
  19408. */
  19409. function getFileds(newConfig) {
  19410. var fields = [];
  19411. _$2.forEach(newConfig.columns, function (c) {
  19412. if (c.dataIndex) {
  19413. fields.push(c.dataIndex);
  19414. }
  19415. });
  19416. return fields;
  19417. }
  19418. function convertDataSource$1(sender, scope, newConfig) {
  19419. if (typeof newConfig.store !== 'undefined') {
  19420. // 有 store 属性的情况下,不做任何事
  19421. return;
  19422. }
  19423. if (typeof newConfig.dataSource === 'undefined') {
  19424. // 没有定义 dataSource 的情况下,不做任何事
  19425. return;
  19426. }
  19427. if (_$2.isArray(newConfig.data)) {
  19428. // 有 data 属性赋值的情况下
  19429. newConfig.store = {
  19430. fields: getFileds(newConfig),
  19431. data: newConfig.data
  19432. };
  19433. delete newConfig.data;
  19434. return;
  19435. }
  19436. var dataSource = newConfig.dataSource;
  19437. if (typeof dataSource === 'string') {
  19438. // dataSource 是字符串的情况下,找到成员函数
  19439. dataSource = lookupFn(scope, dataSource);
  19440. }
  19441. if (typeof dataSource === 'function') {
  19442. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  19443. newConfig.store = new Ext.data.Store({
  19444. fields: getFileds(newConfig),
  19445. // data: [],
  19446. autoLoad: true,
  19447. proxy: {
  19448. type: 'memory',
  19449. data: [],
  19450. }
  19451. });
  19452. newConfig.dataSourceCallbackFn = dataSource;
  19453. return;
  19454. }
  19455. // throw new TypeError('无法识别的调用方法')
  19456. }
  19457. function initTextfield () {
  19458. var cc = Ext.form.field.Text.prototype.constructor;
  19459. var initComponent = Ext.form.field.Text.prototype.initComponent;
  19460. Ext.form.field.Text.override({
  19461. constructor: function (config) {
  19462. var newConfig = _$2.defaultsDeep({
  19463. // 强制属性
  19464. triggers: {
  19465. clear: {
  19466. weight: -1,
  19467. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  19468. hidden: true,
  19469. handler: 'onClearClick',
  19470. },
  19471. }
  19472. }, baseConfig(config, 'col-item'), config, text);
  19473. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19474. newConfig.enableKeyEvents = true;
  19475. }
  19476. cc.call(this, newConfig);
  19477. },
  19478. /**
  19479. * 清空所有值
  19480. */
  19481. onClearClick: function (sender, e) {
  19482. var me = this;
  19483. me.setValue('');
  19484. },
  19485. /**
  19486. * 尝试获取下一个要获取焦点的控件
  19487. */
  19488. _raiseNextFocus: function (sender) {
  19489. var config = sender.config;
  19490. var scope = lookupScope(sender);
  19491. if (typeof config.nextFocus === 'function') {
  19492. config.nextFocus(sender);
  19493. }
  19494. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  19495. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  19496. var fn = lookupFn(scope, config.nextFocus);
  19497. if (typeof fn === 'function') {
  19498. var nextCtlReference = fn(sender);
  19499. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  19500. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  19501. if (ctl) {
  19502. if (typeof ctl.focus2 === 'function') {
  19503. ctl.focus2();
  19504. }
  19505. else {
  19506. ctl.focus();
  19507. }
  19508. }
  19509. }
  19510. }
  19511. }
  19512. else {
  19513. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  19514. if (ctl) {
  19515. if (typeof ctl.focus2 === 'function') {
  19516. ctl.focus2();
  19517. }
  19518. else {
  19519. ctl.focus();
  19520. }
  19521. }
  19522. }
  19523. }
  19524. },
  19525. initComponent: function () {
  19526. /**
  19527. * 改变必填项之前加星号
  19528. */
  19529. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  19530. // this.beforeLabelTextTpl = [
  19531. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19532. // ];
  19533. this.afterLabelTextTpl = [
  19534. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19535. ];
  19536. }
  19537. var me = this;
  19538. this.on({
  19539. change: function (sender, newVal) {
  19540. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  19541. if (hideTrigger || disabled || readOnly || hideClear) {
  19542. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  19543. return;
  19544. }
  19545. var value = newVal;
  19546. if (value) {
  19547. me.getTrigger('clear').show();
  19548. me.updateLayout();
  19549. }
  19550. else {
  19551. me.getTrigger('clear').hide();
  19552. me.updateLayout();
  19553. }
  19554. },
  19555. afterrender: function (sender) {
  19556. var _this = this;
  19557. var _a;
  19558. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  19559. sender.inputEl.dom.setAttribute('spellcheck', "false");
  19560. $$2(sender.inputEl.dom).on('click', function (e) {
  19561. sender.fireEvent('click', _this, e);
  19562. });
  19563. $$2(sender.inputEl.dom).on('keydown', function (e) {
  19564. var _a, _b, _c, _d;
  19565. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  19566. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  19567. if (sender.isExpanded === true) {
  19568. // 弹开下拉框的基础上,不干预上下选择
  19569. return;
  19570. }
  19571. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19572. var grid = sender.ownerCt.up('grid');
  19573. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  19574. if (editingPlugin) {
  19575. 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;
  19576. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  19577. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  19578. // editingPlugin
  19579. var targetRecord = void 0;
  19580. if (e.code === 'ArrowDown') {
  19581. targetRecord = grid.store.data.getAt(rowIdx + 1);
  19582. }
  19583. else {
  19584. targetRecord = grid.store.data.getAt(rowIdx - 1);
  19585. }
  19586. if (targetRecord) {
  19587. grid.setSelection([targetRecord]);
  19588. editingPlugin.startEdit(targetRecord, column);
  19589. }
  19590. e.stopPropagation();
  19591. e.preventDefault();
  19592. }
  19593. }
  19594. }
  19595. }
  19596. });
  19597. }
  19598. var config = sender.config;
  19599. if (config.ff && config.ff > 0) {
  19600. setTimeout(function () {
  19601. if (typeof sender.focus2 === 'function') {
  19602. sender.focus2();
  19603. }
  19604. else {
  19605. sender.focus();
  19606. }
  19607. }, config.ff);
  19608. }
  19609. }
  19610. });
  19611. var config = this.config;
  19612. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19613. this.on({
  19614. keyup: function (sender, e) {
  19615. if ([10, 13, 20, 40].includes(e.keyCode)) {
  19616. sender._raiseNextFocus(sender);
  19617. }
  19618. }
  19619. });
  19620. }
  19621. var that = this;
  19622. this.on({
  19623. keyup: function (sender, e, eOpts) {
  19624. if (![10, 13, 20, 40].includes(e.keyCode)) {
  19625. return;
  19626. }
  19627. that.keydown_fun_item(sender, e, eOpts);
  19628. }
  19629. });
  19630. initComponent.call(this);
  19631. },
  19632. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  19633. var that = sender;
  19634. if ([10, 13, 20, 40].includes(event.keyCode)) {
  19635. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  19636. var value = _$2.trim(sender.rawValue);
  19637. var r = that.fireEvent('scancode', that, value, event);
  19638. if (r === 'OK') {
  19639. // 停止事件的默认处理程序,停止事件的冒泡
  19640. // event.stopEvent();
  19641. event.preventDefault();
  19642. event.stopPropagation();
  19643. }
  19644. }
  19645. }, 100)
  19646. });
  19647. }
  19648. function initTbFill () {
  19649. /**
  19650. *
  19651. */
  19652. var ct = Ext.toolbar.Fill.prototype.constructor;
  19653. Ext.toolbar.Fill.override({
  19654. constructor: function (config) {
  19655. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  19656. ct.call(this, newConfig);
  19657. }
  19658. });
  19659. }
  19660. function initTbSeparator () {
  19661. /**
  19662. *
  19663. */
  19664. var ct = Ext.toolbar.Separator.prototype.constructor;
  19665. Ext.toolbar.Separator.override({
  19666. constructor: function (config) {
  19667. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  19668. ct.call(this, newConfig);
  19669. }
  19670. });
  19671. }
  19672. function initToolbar () {
  19673. /**
  19674. *
  19675. */
  19676. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  19677. Ext.toolbar.Toolbar.override({
  19678. constructor: function (config) {
  19679. var newConfig = _$2.defaultsDeep({
  19680. // 强制性属性
  19681. }, baseConfig(config, 'cols-container'), config, toolbar);
  19682. ct.call(this, newConfig);
  19683. }
  19684. });
  19685. initTbFill();
  19686. initTbSeparator();
  19687. }
  19688. function initSplitter () {
  19689. var ct = Ext.resizer.Splitter.prototype.constructor;
  19690. Ext.resizer.Splitter.override({
  19691. constructor: function (config) {
  19692. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  19693. ct.call(this, newConfig);
  19694. }
  19695. });
  19696. }
  19697. /**
  19698. * 通用 dataSource 解析,
  19699. * Tree/Combo/Grid/PageList ... 都会从这里解析
  19700. */
  19701. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  19702. var config = ctl.config;
  19703. return new Promise(function (resolve, reject) {
  19704. if (!config.dataSource) {
  19705. // 没有设置数据源,直接置空
  19706. return Promise.resolve();
  19707. }
  19708. var option = {
  19709. extraParam: extraParam,
  19710. _successCb: _successCb,
  19711. successCallback: function (value) {
  19712. if (typeof successCallback === "function") {
  19713. successCallback(value);
  19714. }
  19715. else {
  19716. ctl.setData(value);
  19717. }
  19718. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  19719. ctl.setLoading(false);
  19720. resolve(value);
  19721. },
  19722. failCallback: function (error) {
  19723. if (typeof failCallback === "function") {
  19724. failCallback(error);
  19725. }
  19726. ctl.fireEvent('dataLoadComplete', ctl, false);
  19727. ctl.setLoading(false);
  19728. reject(error);
  19729. }
  19730. };
  19731. // 请求前要求确认一下
  19732. var isCanceled = false;
  19733. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  19734. isCanceled = true;
  19735. } }, option));
  19736. if (!isCanceled) {
  19737. // 请求没有被取消
  19738. // 调用异步接口返回 Promise
  19739. return _innerReload(ctl, option);
  19740. }
  19741. return reject();
  19742. });
  19743. }
  19744. function _innerReload(ctl, option) {
  19745. var config = ctl.config;
  19746. ctl.setLoading(true);
  19747. var scope = lookupScope(ctl);
  19748. var dataSource = config.dataSource;
  19749. if (typeof dataSource == 'string') {
  19750. dataSource = lookupFn(scope, config.dataSource);
  19751. }
  19752. if (typeof dataSource === 'function') {
  19753. // @ts-ignore
  19754. dataSource.call(scope, ctl, option);
  19755. return;
  19756. }
  19757. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19758. if (!ajax.func) {
  19759. console.error("没有配置 ajax");
  19760. return;
  19761. }
  19762. var params_1 = {};
  19763. var sortModel = null;
  19764. var filterModel = null;
  19765. if (option.extraParam && option.extraParam.filterModel) {
  19766. filterModel = option.extraParam.filterModel;
  19767. }
  19768. if (option.extraParam && option.extraParam.sortModel) {
  19769. sortModel = option.extraParam.sortModel;
  19770. }
  19771. _$2.forOwn(option.extraParam, function (v, key) {
  19772. if (key != "filterModel" && key != "sortModel") {
  19773. if (typeof v === 'function') {
  19774. params_1[key] = v();
  19775. }
  19776. else {
  19777. params_1[key] = v;
  19778. }
  19779. }
  19780. });
  19781. var ds = dataSource;
  19782. _$2.forOwn(ds.params, function (v, key) {
  19783. if (typeof v === 'function') {
  19784. params_1[key] = v();
  19785. }
  19786. else {
  19787. params_1[key] = v;
  19788. }
  19789. });
  19790. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  19791. // @ts-ignore
  19792. ajax.func({
  19793. method: dataSource.method,
  19794. url: ds.url,
  19795. data: params_1,
  19796. filterModel: filterModel,
  19797. sortModel: sortModel,
  19798. }).then(function (res) {
  19799. if (res.success) {
  19800. option.successCallback(res.data);
  19801. }
  19802. else {
  19803. option.failCallback(res.msg);
  19804. }
  19805. }).catch(function (e) {
  19806. option.failCallback(e);
  19807. });
  19808. }
  19809. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19810. var ds_1 = ctl.dataSource;
  19811. // @ts-ignore
  19812. Extend.ajax.func({
  19813. url: ds_1.sqlId,
  19814. data: params_1,
  19815. db: ds_1.db,
  19816. method: 'sql',
  19817. filterModel: filterModel,
  19818. sortModel: sortModel,
  19819. }).then(function (res) {
  19820. if (res.success) {
  19821. option.successCallback(res.data);
  19822. }
  19823. else {
  19824. option.failCallback(res.msg);
  19825. }
  19826. }).catch(function (e) {
  19827. option.failCallback(e);
  19828. }).finally(function () {
  19829. ctl.loading = false;
  19830. });
  19831. return;
  19832. }
  19833. else {
  19834. console.error("非法的 dataSource", ctl.dataSource);
  19835. debugger;
  19836. throw new Error("非法的 dataSource");
  19837. }
  19838. }
  19839. }
  19840. function initCombo () {
  19841. var cc = Ext.form.field.ComboBox.prototype.constructor;
  19842. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19843. Ext.form.field.ComboBox.override({
  19844. constructor: function (config) {
  19845. var newConfig = _$2.defaultsDeep({
  19846. // 强制性属性
  19847. }, baseConfig(config, 'col-item'), config, combo);
  19848. if (typeof config.dict === 'string') {
  19849. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19850. }
  19851. else if (typeof newConfig.store == 'undefined') {
  19852. if (_$2.isArray(newConfig.data)) {
  19853. // ExtJS 无法直接接受数组模式
  19854. newConfig.store = {
  19855. fields: [newConfig.valueField, newConfig.displayField],
  19856. data: newConfig.data
  19857. };
  19858. delete newConfig.data;
  19859. }
  19860. else if (typeof newConfig.data !== 'object') {
  19861. newConfig.store = {
  19862. fields: [newConfig.valueField, newConfig.displayField],
  19863. data: []
  19864. };
  19865. delete newConfig.data;
  19866. }
  19867. }
  19868. cc.call(this, newConfig);
  19869. },
  19870. setDict: function (bizKey) {
  19871. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  19872. this.dict = bizKey;
  19873. },
  19874. getDict: function () {
  19875. return this.dict;
  19876. },
  19877. setData: function (value) {
  19878. if (!value) {
  19879. return;
  19880. }
  19881. var config = value.config;
  19882. if (!this.store) {
  19883. this.store = new Ext.data.Store({
  19884. fields: [config.valueField, config.displayField],
  19885. data: value
  19886. });
  19887. }
  19888. else {
  19889. this.store.getProxy().setData(value);
  19890. this.store.load();
  19891. }
  19892. },
  19893. setLoading: function (value) {
  19894. if (value) {
  19895. if (!this.loadMask) {
  19896. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  19897. }
  19898. }
  19899. else {
  19900. if (this.loadMask) {
  19901. this.loadMask.destroy();
  19902. delete this.loadMask;
  19903. }
  19904. }
  19905. },
  19906. reload: function () {
  19907. dataSourceReload(this);
  19908. },
  19909. initComponent: function () {
  19910. var that = this;
  19911. var toggle = function (e) {
  19912. var readOnly = that.readOnly, disabled = that.disabled;
  19913. if (readOnly || disabled) {
  19914. return;
  19915. }
  19916. if ($(e.target).is('.x-form-trigger')) {
  19917. return;
  19918. }
  19919. // 点击后下拉
  19920. if (that.isExpanded) {
  19921. that.collapse();
  19922. }
  19923. else {
  19924. that.expand();
  19925. that.doQuery(that.allQuery, true);
  19926. }
  19927. };
  19928. this.on({
  19929. afterrender: function (sender) {
  19930. var config = this.config;
  19931. if (config.dataSource && config.autoLoad) {
  19932. dataSourceReload(this);
  19933. }
  19934. // 点击后下拉
  19935. $(this.el.dom).on('click', toggle.bind(this));
  19936. },
  19937. focusenter: function (sender, event, opt) {
  19938. var _a;
  19939. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19940. // 表格内编辑框,获取焦点后自动弹开
  19941. toggle.call(this, event);
  19942. }
  19943. },
  19944. destory: function () {
  19945. $(this.el.dom).off('click', toggle.bind(this));
  19946. },
  19947. beforequery: function (context) {
  19948. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  19949. // console.log('beforequery', query)
  19950. if (!forceAll && query) {
  19951. combo.store.clearFilter();
  19952. combo.store.filterBy(function (record, id) {
  19953. var text = record.get(combo.displayField);
  19954. // 用拼音筛选的方式
  19955. return keywordFilter(query, text, id);
  19956. });
  19957. combo.expand();
  19958. return false;
  19959. }
  19960. combo.store.clearFilter();
  19961. combo.expand();
  19962. return false;
  19963. },
  19964. });
  19965. initComponent.call(this);
  19966. },
  19967. focus2: function () {
  19968. this.focus();
  19969. var that = this;
  19970. _$2.defer(function () {
  19971. if (that.isExpanded) {
  19972. that.collapse();
  19973. }
  19974. else {
  19975. that.expand();
  19976. that.doQuery(that.allQuery, true);
  19977. }
  19978. });
  19979. }
  19980. });
  19981. }
  19982. /**
  19983. xtype: 'tagfield',
  19984. displayField: 'show',
  19985. valueField: 'id',
  19986. queryMode: 'local',
  19987. filterPickList: true,
  19988. store: {
  19989. fields: ['id', 'show'],
  19990. data: [
  19991. {id: 0, show: 'Battlestar Galactica'},
  19992. {id: 1, show: 'Doctor Who'},
  19993. {id: 2, show: 'Farscape'},
  19994. {id: 3, show: 'Firefly'},
  19995. {id: 4, show: 'Star Trek'},
  19996. {id: 5, show: 'Star Wars: Christmas Special'}
  19997. ]
  19998. }
  19999. */
  20000. function initTag () {
  20001. var cc = Ext.form.field.Tag.prototype.constructor;
  20002. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  20003. Ext.form.field.Tag.override({
  20004. constructor: function (config) {
  20005. var newConfig = _$2.defaultsDeep({
  20006. // 强制性属性
  20007. }, baseConfig(config, 'col-item'), config, tagfield);
  20008. if (typeof config.dict === 'string') {
  20009. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  20010. }
  20011. else if (typeof newConfig.store == 'undefined') {
  20012. if (_$2.isArray(newConfig.data)) {
  20013. // ExtJS 无法直接接受数组模式
  20014. newConfig.store = {
  20015. fields: [newConfig.valueField, newConfig.displayField],
  20016. data: newConfig.data
  20017. };
  20018. delete newConfig.data;
  20019. }
  20020. else if (typeof newConfig.data !== 'object') {
  20021. newConfig.store = {
  20022. fields: [newConfig.valueField, newConfig.displayField],
  20023. data: []
  20024. };
  20025. delete newConfig.data;
  20026. }
  20027. }
  20028. cc.call(this, newConfig);
  20029. },
  20030. setDict: function (bizKey) {
  20031. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  20032. this.dict = bizKey;
  20033. },
  20034. getDict: function () {
  20035. return this.dict;
  20036. },
  20037. setData: function (value) {
  20038. if (!value) {
  20039. return;
  20040. }
  20041. var config = value.config;
  20042. if (!this.store) {
  20043. this.store = new Ext.data.Store({
  20044. fields: [config.valueField, config.displayField],
  20045. data: value
  20046. });
  20047. }
  20048. else {
  20049. this.store.getProxy().setData(value);
  20050. this.store.load();
  20051. }
  20052. },
  20053. setLoading: function (value) {
  20054. if (value) {
  20055. if (!this.loadMask) {
  20056. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  20057. }
  20058. }
  20059. else {
  20060. if (this.loadMask) {
  20061. this.loadMask.destroy();
  20062. delete this.loadMask;
  20063. }
  20064. }
  20065. },
  20066. reload: function () {
  20067. dataSourceReload(this);
  20068. },
  20069. initComponent: function () {
  20070. var that = this;
  20071. var toggle = function (e) {
  20072. var readOnly = that.readOnly, disabled = that.disabled;
  20073. if (readOnly || disabled) {
  20074. return;
  20075. }
  20076. if ($(e.target).is('.x-form-trigger')) {
  20077. return;
  20078. }
  20079. // 点击后下拉
  20080. if (that.isExpanded) {
  20081. that.collapse();
  20082. }
  20083. else {
  20084. that.expand();
  20085. that.doQuery(that.allQuery, true);
  20086. }
  20087. };
  20088. this.on({
  20089. afterrender: function (sender) {
  20090. var config = this.config;
  20091. if (config.dataSource && config.autoLoad) {
  20092. dataSourceReload(this);
  20093. }
  20094. // 点击后下拉
  20095. $(this.el.dom).on('click', toggle.bind(this));
  20096. },
  20097. focusenter: function (sender, event, opt) {
  20098. var _a;
  20099. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  20100. // 表格内编辑框,获取焦点后自动弹开
  20101. toggle.call(this, event);
  20102. }
  20103. },
  20104. destory: function () {
  20105. $(this.el.dom).off('click', toggle.bind(this));
  20106. },
  20107. });
  20108. initComponent.call(this);
  20109. },
  20110. focus2: function () {
  20111. this.focus();
  20112. var that = this;
  20113. _$2.defer(function () {
  20114. if (that.isExpanded) {
  20115. that.collapse();
  20116. }
  20117. else {
  20118. that.expand();
  20119. that.doQuery(that.allQuery, true);
  20120. }
  20121. });
  20122. }
  20123. });
  20124. }
  20125. function initComboGridMulti () {
  20126. Ext.define('Yvan.LocalComboGrid', {
  20127. extend: 'Ext.form.field.Picker',
  20128. // extend: 'Yvan.PickerAlignCenter',
  20129. xtype: 'combogridmulti',
  20130. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20131. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  20132. editable: false,
  20133. initComponent: function () {
  20134. this.on({
  20135. afterrender: function () {
  20136. var config = this.config;
  20137. if (config.dataSource && config.autoLoad) {
  20138. dataSourceReload(this);
  20139. }
  20140. },
  20141. });
  20142. this.superclass.initComponent.apply(this, arguments);
  20143. },
  20144. setStore: function (store) {
  20145. this.store = store;
  20146. var me = this;
  20147. if (me.store) {
  20148. if (me.picker) {
  20149. me.picker.setStore(store);
  20150. if (me.isExpanded) {
  20151. me.collapse();
  20152. delete me.picker;
  20153. me.expand();
  20154. }
  20155. }
  20156. this.onLoad();
  20157. me.mon(me.store, {
  20158. scope: me,
  20159. load: me.onLoad,
  20160. update: me.onUpdate
  20161. });
  20162. }
  20163. },
  20164. reload: function () {
  20165. dataSourceReload(this);
  20166. },
  20167. setData: function (value) {
  20168. var me = this;
  20169. var config = me.config;
  20170. if (!value) {
  20171. return;
  20172. }
  20173. if (!this.store) {
  20174. this.store = new Ext.data.Store({
  20175. fields: [config.valueField, config.displayField],
  20176. data: value
  20177. });
  20178. }
  20179. else {
  20180. this.store.getProxy().setData(value);
  20181. this.store.load();
  20182. }
  20183. this.onLoad();
  20184. },
  20185. createPicker: function () {
  20186. var me = this;
  20187. 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: {
  20188. scope: me,
  20189. selectionchange: me.onSelectionChange,
  20190. itemkeydown: me.onPickerKeyDown
  20191. } })), view = picker.getView();
  20192. if (Ext.isIE9 && Ext.isStrict) {
  20193. view.on({
  20194. scope: me,
  20195. highlightitem: me.repaintPickerView,
  20196. unhighlightitem: me.repaintPickerView,
  20197. afteritemexpand: me.repaintPickerView,
  20198. afteritemcollapse: me.repaintPickerView
  20199. });
  20200. }
  20201. return picker;
  20202. },
  20203. repaintPickerView: function () {
  20204. var style = this.picker.getView().getEl().dom.style;
  20205. style.display = style.display;
  20206. },
  20207. onSelectionChange: function (view, record, node, rowIndex, e) {
  20208. this.selectItem(view, record);
  20209. },
  20210. onPickerKeyDown: function (treeView, record, item, index, e) {
  20211. var key = e.getKey();
  20212. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  20213. this.selectItem(treeView, record);
  20214. }
  20215. },
  20216. selectItem: function (sender, record) {
  20217. var me = this;
  20218. var ids = [];
  20219. _$2.forEach(me.picker.getSelection(), function (record) {
  20220. ids.push(record.get(me.valueField));
  20221. });
  20222. me.fireEvent('select', me, record);
  20223. me.setValue(ids.join(me.splitChar));
  20224. // me.collapse();
  20225. },
  20226. onExpand: function () {
  20227. var me = this;
  20228. var picker = this.picker;
  20229. var value = this.value;
  20230. if (!me.store) {
  20231. msg('正在初始化数据,请稍后');
  20232. me.collapse();
  20233. return;
  20234. }
  20235. var vs = _$2.split(value, me.splitChar);
  20236. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  20237. picker.setSelection(records);
  20238. },
  20239. setValue: function (value) {
  20240. var me = this;
  20241. console.log('setValue', value);
  20242. me.value = value;
  20243. if (!me.store || me.store.loading) {
  20244. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  20245. return me.mixins.field.setValue.call(me, value);
  20246. // return me;
  20247. }
  20248. var vs = _$2.split(value, me.splitChar);
  20249. var displayValues = [];
  20250. _$2.forEach(vs, function (v) {
  20251. var _a;
  20252. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  20253. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  20254. if (dv) {
  20255. displayValues.push(dv);
  20256. }
  20257. else {
  20258. displayValues.push(v);
  20259. }
  20260. });
  20261. // set the raw value to the record's display field if a record was found
  20262. me.setRawValue(displayValues.join(me.splitChar));
  20263. return me.mixins.field.setValue.call(me, value);
  20264. },
  20265. getSubmitValue: function () {
  20266. return this.value;
  20267. },
  20268. getValue: function () {
  20269. return this.value;
  20270. },
  20271. onLoad: function () {
  20272. var value = this.value;
  20273. if (value) {
  20274. this.setValue(value);
  20275. }
  20276. },
  20277. onUpdate: function (store, rec, type, modifiedFieldNames) {
  20278. var display = this.displayField;
  20279. var me = this;
  20280. if (type === 'edit' && modifiedFieldNames &&
  20281. Ext.Array.contains(modifiedFieldNames, display) &&
  20282. this.value === rec.getId()) {
  20283. me.mixins.field.setValue.call(me, this.value);
  20284. this.setRawValue(rec.get(display));
  20285. }
  20286. }
  20287. });
  20288. }
  20289. function initSearch () {
  20290. Ext.define('Yvan.Search', {
  20291. extend: 'Ext.form.field.Text',
  20292. alias: 'widget.searchfield',
  20293. xtype: 'searchfield',
  20294. constructor: function (config) {
  20295. var self = this;
  20296. var newConfig = _$2.defaultsDeep({
  20297. // 强制性属性
  20298. triggers: {
  20299. clear: {
  20300. weight: 0,
  20301. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20302. hidden: true,
  20303. handler: 'onClearClick',
  20304. },
  20305. search: {
  20306. weight: 1,
  20307. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  20308. handler: 'onSearchClick'
  20309. },
  20310. },
  20311. listeners: {
  20312. blur: function (sender, e) {
  20313. this.revertOnblur();
  20314. },
  20315. specialkey: function (sender, e) {
  20316. var _a;
  20317. var me = this;
  20318. if (e.getKey() === e.ENTER) {
  20319. me.onSearchClick(sender, {}, e);
  20320. return;
  20321. }
  20322. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20323. },
  20324. afterrender: function (sender, e) {
  20325. var _a;
  20326. this.replaceRawInputEvent();
  20327. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20328. }
  20329. },
  20330. }, baseConfig(config, 'col-item'), config, search);
  20331. this.superclass.constructor.call(self, newConfig);
  20332. },
  20333. revertOnblur: function () {
  20334. this.setRawValue(this.lastValue);
  20335. },
  20336. onSearchClick: function (sender, vv, e) {
  20337. var me = this;
  20338. var config = me.config;
  20339. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  20340. if (e) {
  20341. e.preventDefault();
  20342. e.stopPropagation();
  20343. }
  20344. this.fireEvent('search', sender, e);
  20345. if (!widget) {
  20346. return;
  20347. }
  20348. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  20349. },
  20350. replaceRawInputEvent: function () {
  20351. var me = this;
  20352. var $dom = $(me.inputEl.dom);
  20353. $dom.on('input', function (e) {
  20354. stopEvent(e);
  20355. // console.log('has input', e)
  20356. });
  20357. $dom.on('keyup', function (e) {
  20358. if (e.key === "Enter") {
  20359. me.onSearchClick(me, {}, e);
  20360. return;
  20361. }
  20362. stopEvent(e);
  20363. });
  20364. $dom.on('change', function (e) {
  20365. stopEvent(e);
  20366. });
  20367. },
  20368. onChange: function (newVal, oldVal) {
  20369. var me = this;
  20370. var value = newVal;
  20371. if (value) {
  20372. me.getTrigger('clear').show();
  20373. me.updateLayout();
  20374. }
  20375. else {
  20376. me.getTrigger('clear').hide();
  20377. me.updateLayout();
  20378. }
  20379. },
  20380. /**
  20381. * 清空所有值
  20382. */
  20383. onClearClick: function (sender, e) {
  20384. var me = this;
  20385. var config = me.config;
  20386. var lookup = config.lookup;
  20387. me.setValue('');
  20388. clearViewModelByLookup(sender, lookup);
  20389. }
  20390. });
  20391. }
  20392. function initMultipleSearch () {
  20393. Ext.define('Yvan.MultipleSearch', {
  20394. extend: 'Ext.form.field.Text',
  20395. xtype: 'multiplesearch',
  20396. bindTargert: '',
  20397. constructor: function (config) {
  20398. var _a, _b, _c, _d;
  20399. var self = this;
  20400. var newConfig = _$2.defaultsDeep({
  20401. // 强制性属性
  20402. triggers: {
  20403. clear: {
  20404. weight: 0,
  20405. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20406. hidden: true,
  20407. handler: 'onClearClick',
  20408. }
  20409. },
  20410. transformRawValue: function (o) {
  20411. return o;
  20412. },
  20413. listeners: {
  20414. specialkey: function (sender, e) {
  20415. var me = this;
  20416. if (e.getKey() === e.ENTER) {
  20417. me.fireEvent('search', me, e);
  20418. }
  20419. },
  20420. afterrender: function (sender, e) {
  20421. var _a;
  20422. this.replaceRawInputEvent();
  20423. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20424. }
  20425. },
  20426. }, baseConfig(config, 'col-item'), config, search);
  20427. this.superclass.constructor.call(self, newConfig);
  20428. 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 : '';
  20429. vv = _$2.replace(vv, "{", "");
  20430. vv = _$2.replace(vv, "}", "");
  20431. this.bindTargert = vv;
  20432. this.bindTargert = _$2.trim(this.bindTargert);
  20433. },
  20434. setBindValue: function (arrValue) {
  20435. if (this.bindTargert) {
  20436. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  20437. }
  20438. },
  20439. replaceRawInputEvent: function () {
  20440. var me = this;
  20441. var $dom = $(me.inputEl.dom);
  20442. $dom.on('input', function (e) {
  20443. var _a, _b, _c, _d, _e, _f;
  20444. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  20445. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  20446. if (!a.endsWith(",") && a.length > 0) {
  20447. e.currentTarget.value = a + ",";
  20448. }
  20449. else {
  20450. e.currentTarget.value = a;
  20451. }
  20452. }
  20453. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  20454. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  20455. _$2.remove(arr, function (it) {
  20456. return !it;
  20457. });
  20458. me.setBindValue(arr);
  20459. stopEvent(e);
  20460. });
  20461. $dom.on('keyup', function (e) {
  20462. me.fireEvent('keyup', me, e);
  20463. // invokeMethod(me.config.listeners?.keyup, me, e)
  20464. stopEvent(e);
  20465. });
  20466. $dom.on('keydown', function (e) {
  20467. me.fireEvent('keydown', me, e);
  20468. // invokeMethod(me.config.listeners?.keydown, me, e)
  20469. //stopEvent(e)
  20470. });
  20471. $dom.on('change', function (e) {
  20472. stopEvent(e);
  20473. });
  20474. $dom.on('paste', function (e) {
  20475. var _a;
  20476. // @ts-ignore
  20477. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  20478. var text = clipdata.getData("text/plain");
  20479. var spliter = ',';
  20480. text = text.replaceAll("\r", "");
  20481. text = text.replaceAll("\n", spliter);
  20482. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  20483. var arr = text.split(spliter);
  20484. if (arr && Array.isArray(arr)) {
  20485. for (var i = 0; i < arr.length; i++) {
  20486. arr[i] = _$2.trim(arr[i]);
  20487. }
  20488. }
  20489. _$2.remove(arr, function (it) {
  20490. return !it;
  20491. });
  20492. me.setBindValue(arr);
  20493. stopEvent(e);
  20494. });
  20495. },
  20496. onChange: function (newVal, oldVal) {
  20497. var me = this;
  20498. var value = newVal;
  20499. if (value) {
  20500. me.getTrigger('clear').show();
  20501. me.updateLayout();
  20502. }
  20503. else {
  20504. me.getTrigger('clear').hide();
  20505. me.updateLayout();
  20506. }
  20507. },
  20508. /**
  20509. * 清空所有值
  20510. */
  20511. onClearClick: function (sender, e) {
  20512. var me = this;
  20513. var config = me.config;
  20514. var lookup = config.lookup;
  20515. me.setValue('');
  20516. clearViewModelByLookup(sender, lookup);
  20517. }
  20518. });
  20519. }
  20520. function initDate () {
  20521. var cc = Ext.form.field.Date.prototype.constructor;
  20522. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  20523. Ext.form.field.Date.override({
  20524. format: 'Y-m-d',
  20525. altFormats: 'Y-m-d',
  20526. constructor: function (config) {
  20527. var newConfig = _$2.defaultsDeep({
  20528. // 强制属性
  20529. }, baseConfig(config, 'col-item'), config, date);
  20530. cc.call(this, newConfig);
  20531. },
  20532. getValue: function () {
  20533. var ov = getValue.call(this);
  20534. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  20535. // console.log('cc:', nv, ov)
  20536. return nv;
  20537. },
  20538. // focus2() {
  20539. // const that = this
  20540. // if (that.isExpanded) {
  20541. // that.collapse()
  20542. //
  20543. // } else {
  20544. // that.expand();
  20545. // }
  20546. // _.defer(() => {
  20547. // that.focus()
  20548. // })
  20549. // },
  20550. initComponent: function () {
  20551. this.on({
  20552. afterrender: function () {
  20553. var config = this.config;
  20554. // 日期框,不要默认弹出
  20555. // $(this.el.dom).on('click', toggle.bind(this))
  20556. },
  20557. destory: function () {
  20558. // 日期框,不要默认弹出
  20559. // $(this.el.dom).off('click', toggle.bind(this))
  20560. },
  20561. change: {
  20562. fn: function (sender) {
  20563. if (sender.format === 'Y-m-d') {
  20564. // 年月日格式
  20565. var value = sender.getRawValue();
  20566. if (/^\d{8}$/.test(value)) {
  20567. // 8位数字,自动转换为 YYYY-MM-DD
  20568. var newValue = [
  20569. value.substr(0, 4),
  20570. value.substr(4, 2),
  20571. value.substr(6, 2)
  20572. ].join('-');
  20573. sender.setValue(newValue);
  20574. }
  20575. }
  20576. },
  20577. }
  20578. // focus: {
  20579. // // 获得焦点后自动下拉
  20580. // fn(sender) {
  20581. // sender.expand();
  20582. // this.doQuery(this.allQuery, true);
  20583. // },
  20584. // },
  20585. });
  20586. initComponent.call(this);
  20587. },
  20588. createInitialDate: function (value) {
  20589. var minValue = this.minValue, maxValue = this.maxValue;
  20590. value = value || syncDate(new Date());
  20591. if (minValue && minValue > value) {
  20592. value = minValue;
  20593. }
  20594. else if (maxValue && maxValue < value) {
  20595. value = maxValue;
  20596. }
  20597. return value;
  20598. },
  20599. });
  20600. }
  20601. function initDateTimePicker () {
  20602. Ext.define('Yvan.DateTimePicker', {
  20603. extend: 'Ext.picker.Date',
  20604. alias: 'datetimepicker',
  20605. alternateClassName: 'Ext.DateTimePicker',
  20606. renderTpl: [
  20607. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  20608. '<div class="{baseCls}-header">',
  20609. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  20610. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  20611. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  20612. '</div>',
  20613. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  20614. '<thead>',
  20615. '<tr role="row">',
  20616. '<tpl for="dayNames">',
  20617. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  20618. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  20619. '</th>',
  20620. '</tpl>',
  20621. '</tr>',
  20622. '</thead>',
  20623. '<tbody>',
  20624. '<tr role="row">',
  20625. '<tpl for="days">',
  20626. '{#:this.isEndOfWeek}',
  20627. '<td role="gridcell">',
  20628. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  20629. '</td>',
  20630. '</tpl>',
  20631. '</tr>',
  20632. '</tbody>',
  20633. '</table>',
  20634. '<tpl if="showToday">',
  20635. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  20636. '</tpl>',
  20637. // These elements are used with Assistive Technologies such as screen readers
  20638. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  20639. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  20640. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  20641. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  20642. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  20643. '</div>',
  20644. {
  20645. firstInitial: function (value) {
  20646. return Ext.picker.Date.prototype.getDayInitial(value);
  20647. },
  20648. isEndOfWeek: function (value) {
  20649. // convert from 1 based index to 0 based
  20650. // by decrementing value once.
  20651. value--;
  20652. // eslint-disable-next-line vars-on-top
  20653. var end = value % 7 === 0 && value !== 0;
  20654. return end ? '</tr><tr role="row">' : '';
  20655. },
  20656. renderTodayBtn: function (values, out) {
  20657. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  20658. },
  20659. renderMonthBtn: function (values, out) {
  20660. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  20661. }
  20662. }
  20663. ],
  20664. beforeRender: function () {
  20665. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  20666. this.superclass.beforeRender.call(this);
  20667. function handleInput(extHandle, $input) {
  20668. var $dom = $(extHandle.el.dom);
  20669. // const $up = $dom.find('.x-form-spinner-up')
  20670. // const $down = $dom.find('.x-form-spinner-down')
  20671. // debugger
  20672. // $up.on('mousedown', () => {
  20673. // debugger
  20674. // });
  20675. // $up.on('click', () => {
  20676. // debugger
  20677. // });
  20678. extHandle.on('click', function (sender) {
  20679. var hideBak = me.hide;
  20680. me.hide = Ext.emptyFn;
  20681. extHandle.focus();
  20682. me.hide = hideBak;
  20683. });
  20684. var changeValue = function (delta) {
  20685. if (_$2.trim(extHandle.getValue()) === '') {
  20686. extHandle.setValue(extHandle.minValue);
  20687. }
  20688. else {
  20689. var v = parseInt('' + extHandle.getValue());
  20690. if (v + delta > extHandle.maxValue) {
  20691. extHandle.setValue(extHandle.minValue);
  20692. }
  20693. else if (v + delta < extHandle.minValue) {
  20694. extHandle.setValue(extHandle.maxValue);
  20695. }
  20696. else {
  20697. extHandle.setValue(v + delta);
  20698. }
  20699. }
  20700. };
  20701. $input.on('mousewheel', function (e) {
  20702. e.stopPropagation();
  20703. var event = e.originalEvent;
  20704. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  20705. // if (event.wheelDelta) {
  20706. // delta = event.wheelDelta / 120;
  20707. // } else if (event.detail) {
  20708. // delta = -event.detail / 3;
  20709. // }
  20710. var zoomSize = Math.ceil(eventDelta / 120);
  20711. changeValue(zoomSize);
  20712. // console.log('delta', delta)
  20713. // $input.focus()
  20714. });
  20715. }
  20716. me.input1 = Ext.create('Ext.form.field.Number', {
  20717. minValue: 0,
  20718. maxValue: 23,
  20719. flex: 1,
  20720. enableKeyEvents: true,
  20721. fieldLabel: '时',
  20722. labelWidth: 20,
  20723. hideLabel: true,
  20724. spinDownEnabled: false,
  20725. spinUpEnabled: false,
  20726. style: {
  20727. marginLeft: '5px',
  20728. },
  20729. listeners: {
  20730. afterrender: function (sender) {
  20731. var $input = $(sender.inputEl.dom);
  20732. handleInput(me.input1, $input);
  20733. },
  20734. change: function (sender, e) {
  20735. if (me.getValue()) {
  20736. me.value.setHours(sender.getValue());
  20737. }
  20738. },
  20739. }
  20740. });
  20741. me.input2 = Ext.create('Ext.form.field.Number', {
  20742. minValue: 0,
  20743. maxValue: 59,
  20744. flex: 1,
  20745. enableKeyEvents: true,
  20746. fieldLabel: ' ',
  20747. hideLabel: false,
  20748. labelWidth: 8,
  20749. spinDownEnabled: false,
  20750. spinUpEnabled: false,
  20751. listeners: {
  20752. afterrender: function (sender) {
  20753. var $input = $(sender.inputEl.dom);
  20754. handleInput(me.input2, $input);
  20755. },
  20756. change: function (sender, e) {
  20757. if (me.getValue()) {
  20758. me.value.setMinutes(sender.getValue());
  20759. }
  20760. },
  20761. }
  20762. });
  20763. me.input3 = Ext.create('Ext.form.field.Number', {
  20764. minValue: 0,
  20765. maxValue: 59,
  20766. flex: 1,
  20767. enableKeyEvents: true,
  20768. fieldLabel: ' ',
  20769. hideLabel: false,
  20770. labelWidth: 8,
  20771. spinDownEnabled: false,
  20772. spinUpEnabled: false,
  20773. style: {
  20774. marginRight: '5px',
  20775. },
  20776. listeners: {
  20777. afterrender: function (sender) {
  20778. var $input = $(sender.inputEl.dom);
  20779. handleInput(me.input3, $input);
  20780. },
  20781. change: function (sender, e) {
  20782. if (me.getValue()) {
  20783. me.value.setSeconds(sender.getValue());
  20784. }
  20785. },
  20786. }
  20787. });
  20788. me.confirmBtn = new Ext.button.Button({
  20789. text: '确认',
  20790. handler: me.confirmClick,
  20791. scope: me
  20792. });
  20793. me.tdBtn = new Ext.button.Button({
  20794. text: '现在',
  20795. handler: me.selectToday,
  20796. scope: me
  20797. });
  20798. me.todayBtn = Ext.create('Ext.container.Container', {
  20799. layout: 'anchor', border: false,
  20800. defaults: {
  20801. border: false, anchor: '100%',
  20802. margin: '0 0 5 0',
  20803. },
  20804. items: [
  20805. {
  20806. layout: 'hbox',
  20807. items: [
  20808. me.input1,
  20809. me.input2,
  20810. me.input3,
  20811. ]
  20812. },
  20813. {
  20814. layout: 'hbox',
  20815. items: [
  20816. me.confirmBtn,
  20817. me.tdBtn,
  20818. ]
  20819. }
  20820. ]
  20821. });
  20822. },
  20823. // finishRenderChildren() {
  20824. // var me = this;
  20825. //
  20826. // this.superclass.finishRenderChildren.call(this);
  20827. // //*
  20828. // me.input1.finishRender();
  20829. // me.input2.finishRender();
  20830. // me.input3.finishRender();
  20831. // //
  20832. // me.tdBtn.finishRender();
  20833. // me.confirmBtn.finishRender();
  20834. // },
  20835. setValue: function (value) {
  20836. //this.value = Ext.Date.clearTime(value, true);
  20837. this.value = value;
  20838. this.input1.setValue(this.value.getHours());
  20839. this.input2.setValue(this.value.getMinutes());
  20840. this.input3.setValue(this.value.getSeconds());
  20841. return this.update(this.value);
  20842. },
  20843. selectDate: function (value) {
  20844. if (this.showTime) {
  20845. value.setHours(this.input1.getValue());
  20846. value.setMinutes(this.input2.getValue());
  20847. value.setSeconds(this.input3.getValue());
  20848. }
  20849. this.value = value;
  20850. return this.update(this.value);
  20851. },
  20852. setDisabledStatus: function (disabled) {
  20853. var me = this;
  20854. debugger;
  20855. // me.callParent();
  20856. if (me.showTime) {
  20857. me.confirmBtn.setDisabled(disabled);
  20858. }
  20859. if (me.isShowFooter()) {
  20860. me.footerContainer.setDisabled(disabled);
  20861. }
  20862. },
  20863. handleDateClick: function (e, t) {
  20864. var me = this, handler = me.handler;
  20865. // e.stopEvent();
  20866. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  20867. me.doCancelFocus = me.focusOnSelect === false;
  20868. me.selectDate(new Date(t.dateValue));
  20869. delete me.doCancelFocus;
  20870. /* 有时间输入时单击事件不退出选择,只移动光标 */
  20871. if (me.showTime) {
  20872. return;
  20873. }
  20874. me.fireEvent('select', me, me.value);
  20875. if (handler) {
  20876. handler.call(me.scope || me, me, me.value);
  20877. }
  20878. me.onSelect();
  20879. }
  20880. },
  20881. selectToday: function () {
  20882. var me = this, btn = me.todayBtn, handler = me.handler;
  20883. if (btn && !btn.disabled) {
  20884. me.value = syncDate(new Date());
  20885. me.update(me.value);
  20886. me.fireEvent('select', me, me.value);
  20887. if (handler) {
  20888. handler.call(me.scope || me, me, me.value);
  20889. }
  20890. me.onSelect();
  20891. me.hide();
  20892. }
  20893. return me;
  20894. },
  20895. confirmClick: function () {
  20896. var me = this, btn = me.confirmBtn, handler = me.handler;
  20897. if (btn && !btn.disabled) {
  20898. me.fireEvent('select', me, me.value);
  20899. if (handler) {
  20900. handler.call(me.scope || me, me, me.value);
  20901. }
  20902. me.onSelect();
  20903. me.hide();
  20904. }
  20905. return me;
  20906. },
  20907. selectedUpdate: function (date) {
  20908. var me = this,
  20909. //t = date.getTime(),
  20910. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  20911. cells.removeCls(cls);
  20912. for (c = 0; c < cLen; c++) {
  20913. cell = Ext.fly(cellItems[c]);
  20914. if (cell.dom.firstChild.dateValue == t) {
  20915. me.fireEvent('highlightitem', me, cell);
  20916. cell.addCls(cls);
  20917. if (me.isVisible() && !me.doCancelFocus) {
  20918. Ext.fly(cell.dom.firstChild).focus(50);
  20919. }
  20920. break;
  20921. }
  20922. }
  20923. },
  20924. // private, inherit docs
  20925. beforeDestroy: function () {
  20926. var me = this;
  20927. if (me.rendered) {
  20928. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  20929. }
  20930. me.superclass.beforeDestroy.call(this);
  20931. }
  20932. });
  20933. }
  20934. function initDateTime () {
  20935. Ext.define('Yvan.DateTimeField', {
  20936. extend: 'Ext.form.field.Date',
  20937. xtype: 'datetimefield',
  20938. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  20939. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20940. showTime: true,
  20941. format: "Y-m-d H:i:s",
  20942. constructor: function (config) {
  20943. var newConfig = _$2.defaultsDeep({
  20944. // 强制属性
  20945. }, baseConfig(config, 'col-item'), config, date);
  20946. this.superclass.constructor.call(this, newConfig);
  20947. },
  20948. initComponent: function () {
  20949. this.superclass.initComponent.call(this);
  20950. var setInitValue = function () {
  20951. var value = this.getRawValue();
  20952. if (!value) {
  20953. // 没填内容的时候,自动设置当前时间
  20954. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  20955. }
  20956. };
  20957. this.on({
  20958. afterrender: function () {
  20959. var config = this.config;
  20960. // 日期框,不要默认弹出
  20961. $(this.el.dom).on('click', setInitValue.bind(this));
  20962. },
  20963. destory: function () {
  20964. // 日期框,不要默认弹出
  20965. $(this.el.dom).off('click', setInitValue.bind(this));
  20966. },
  20967. change: {
  20968. fn: function (sender) {
  20969. if (sender.format === "Y-m-d H:i:s") {
  20970. // 年月日格式
  20971. var value = sender.getRawValue();
  20972. if (/^\d{14}$/.test(value)) {
  20973. // 8位数字,自动转换为 YYYY-MM-DD
  20974. var newValue = [
  20975. value.substr(0, 4),
  20976. '-',
  20977. value.substr(4, 2),
  20978. '-',
  20979. value.substr(6, 2),
  20980. ' ',
  20981. value.substr(8, 2),
  20982. ':',
  20983. value.substr(10, 2),
  20984. ':',
  20985. value.substr(12, 2)
  20986. ].join('');
  20987. sender.setValue(newValue);
  20988. }
  20989. }
  20990. },
  20991. }
  20992. });
  20993. },
  20994. getValue: function () {
  20995. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  20996. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  20997. // console.log('cc:', nv, ov)
  20998. return nv;
  20999. },
  21000. onExpand: function () {
  21001. var strValue = this.getValue();
  21002. var value;
  21003. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  21004. 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)));
  21005. }
  21006. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  21007. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  21008. }
  21009. else {
  21010. value = syncDate(new Date());
  21011. }
  21012. this.picker.setValue(value);
  21013. },
  21014. createPicker: function () {
  21015. var me = this, format = Ext.String.format;
  21016. //@ts-ignore
  21017. return new Yvan.DateTimePicker({
  21018. pickerField: me,
  21019. ownerCt: me.ownerCt,
  21020. renderTo: document.body,
  21021. floating: true,
  21022. hidden: true,
  21023. focusOnShow: true,
  21024. minDate: me.minValue,
  21025. maxDate: me.maxValue,
  21026. disabledDatesRE: me.disabledDatesRE,
  21027. disabledDatesText: me.disabledDatesText,
  21028. disabledDays: me.disabledDays,
  21029. disabledDaysText: me.disabledDaysText,
  21030. format: me.format,
  21031. showToday: me.showToday,
  21032. showTime: me.showTime,
  21033. startDay: me.startDay,
  21034. minText: format(me.minText, me.formatDate(me.minValue)),
  21035. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  21036. listeners: {
  21037. scope: me,
  21038. select: me.onSelect
  21039. },
  21040. keyNavConfig: {
  21041. esc: function () {
  21042. me.collapse();
  21043. }
  21044. }
  21045. });
  21046. },
  21047. });
  21048. }
  21049. function initNumber () {
  21050. var cc = Ext.form.field.Number.prototype.constructor;
  21051. var initComponent = Ext.form.field.Number.prototype.initComponent;
  21052. Ext.form.field.Number.override({
  21053. constructor: function (config) {
  21054. var newConfig = _$2.defaultsDeep({
  21055. // 强制属性
  21056. }, baseConfig(config, 'col-item'), config, numberfield);
  21057. cc.call(this, newConfig);
  21058. },
  21059. initComponent: function () {
  21060. this.on({
  21061. afterrender: function (sender) {
  21062. var _this = this;
  21063. var _a;
  21064. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  21065. sender.inputEl.dom.setAttribute('spellcheck', "false");
  21066. $$2(sender.inputEl.dom).on('click', function (e) {
  21067. sender.fireEvent('click', _this, e);
  21068. });
  21069. }
  21070. }
  21071. });
  21072. initComponent.call(this);
  21073. },
  21074. });
  21075. }
  21076. function initCheckbox () {
  21077. var cc = Ext.form.field.Checkbox.prototype.constructor;
  21078. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  21079. Ext.form.field.Checkbox.override({
  21080. constructor: function (config) {
  21081. var newConfig = _$2.defaultsDeep({
  21082. // 强制属性
  21083. }, baseConfig(config, 'col-item'), config, checkbox);
  21084. cc.call(this, newConfig);
  21085. },
  21086. getValue: function () {
  21087. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21088. var ov = getValue.call(this);
  21089. // const ov = this.getRawValue()
  21090. return (ov ? checkedValue : uncheckedValue);
  21091. },
  21092. setValue: function (nv) {
  21093. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21094. var value;
  21095. if (nv === checkedValue) {
  21096. value = true;
  21097. }
  21098. else if (nv === uncheckedValue) {
  21099. value = false;
  21100. }
  21101. else {
  21102. value = !!nv;
  21103. }
  21104. // me.setRawValue(value)
  21105. // me.checked = value
  21106. // return me.mixins.field.setValue.call(me, value);
  21107. setValue.call(this, value);
  21108. },
  21109. updateCheckedCls: function (checked) {
  21110. var me = this;
  21111. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  21112. checked = checked != null ? checked : me.getValue();
  21113. if (checked === uncheckedValue) {
  21114. checked = false;
  21115. }
  21116. else if (checked === checkedValue) {
  21117. checked = true;
  21118. }
  21119. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  21120. },
  21121. initComponent: function () {
  21122. initComponent.call(this);
  21123. },
  21124. });
  21125. }
  21126. function initCheckboxGroup () {
  21127. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  21128. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  21129. Ext.form.CheckboxGroup.override({
  21130. constructor: function (config) {
  21131. var newConfig = _$2.defaultsDeep({
  21132. // 强制属性
  21133. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  21134. cc.call(this, newConfig);
  21135. },
  21136. initComponent: function () {
  21137. initComponent.call(this);
  21138. },
  21139. });
  21140. }
  21141. function initRadio () {
  21142. var cc = Ext.form.field.Radio.prototype.constructor;
  21143. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  21144. Ext.form.field.Radio.override({
  21145. constructor: function (config) {
  21146. var newConfig = _$2.defaultsDeep({
  21147. // 强制属性
  21148. }, baseConfig(config, 'col-item'), config, radio);
  21149. cc.call(this, newConfig);
  21150. },
  21151. initComponent: function () {
  21152. initComponent.call(this);
  21153. },
  21154. });
  21155. }
  21156. function initRadioGroup () {
  21157. var cc = Ext.form.RadioGroup.prototype.constructor;
  21158. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  21159. Ext.form.RadioGroup.override({
  21160. constructor: function (config) {
  21161. var newConfig = _$2.defaultsDeep({
  21162. // 强制属性
  21163. }, baseConfig(config, 'col-item'), config, radiogroup);
  21164. cc.call(this, newConfig);
  21165. },
  21166. initComponent: function () {
  21167. initComponent.call(this);
  21168. },
  21169. });
  21170. }
  21171. function initFieldset () {
  21172. /**
  21173. *
  21174. */
  21175. var ct = Ext.form.FieldSet.prototype.constructor;
  21176. Ext.form.FieldSet.override({
  21177. constructor: function (config) {
  21178. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  21179. ct.call(this, newConfig);
  21180. }
  21181. });
  21182. }
  21183. function initCombotree () {
  21184. Ext.define('Yvan.ComboTree', {
  21185. extend: 'Ext.form.field.Picker',
  21186. xtype: 'combotree',
  21187. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  21188. config: {
  21189. store: null,
  21190. displayField: null,
  21191. columns: null,
  21192. selectOnTab: true,
  21193. maxPickerHeight: 300,
  21194. minPickerHeight: 100,
  21195. minPickerWidth: 350,
  21196. rootVisible: true,
  21197. },
  21198. editable: false,
  21199. setStore: function (store) {
  21200. this.store = store;
  21201. var me = this;
  21202. if (me.store) {
  21203. if (me.picker) {
  21204. me.picker.setStore(store);
  21205. if (me.isExpanded) {
  21206. me.collapse();
  21207. delete me.picker;
  21208. me.expand();
  21209. }
  21210. }
  21211. this.onLoad();
  21212. me.mon(me.store, {
  21213. scope: me,
  21214. load: me.onLoad,
  21215. update: me.onUpdate
  21216. });
  21217. }
  21218. },
  21219. createPicker: function () {
  21220. var me = this;
  21221. var picker = new Ext.tree.Panel({
  21222. border: false,
  21223. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21224. shrinkWrapDock: 2,
  21225. store: me.store,
  21226. floating: true,
  21227. rootVisible: me.rootVisible,
  21228. displayField: me.displayField,
  21229. columns: me.columns,
  21230. minHeight: me.minPickerHeight,
  21231. maxHeight: me.maxPickerHeight,
  21232. minWidth: me.minPickerWidth,
  21233. manageHeight: false,
  21234. shadow: false,
  21235. scrollable: true,
  21236. // modal: true,
  21237. // constrain: true,
  21238. // constrainTo: topScope._handle.el.dom,
  21239. // renderTo: topScope._handle.el.dom,
  21240. // alignTarget: topScope._handle,
  21241. listeners: {
  21242. scope: me,
  21243. itemclick: me.onItemClick,
  21244. itemkeydown: me.onPickerKeyDown
  21245. }
  21246. }), view = picker.getView();
  21247. if (Ext.isIE9 && Ext.isStrict) {
  21248. view.on({
  21249. scope: me,
  21250. highlightitem: me.repaintPickerView,
  21251. unhighlightitem: me.repaintPickerView,
  21252. afteritemexpand: me.repaintPickerView,
  21253. afteritemcollapse: me.repaintPickerView
  21254. });
  21255. }
  21256. return picker;
  21257. },
  21258. repaintPickerView: function () {
  21259. var style = this.picker.getView().getEl().dom.style;
  21260. style.display = style.display;
  21261. },
  21262. onItemClick: function (view, record, node, rowIndex, e) {
  21263. this.selectItem(view, record);
  21264. },
  21265. onPickerKeyDown: function (treeView, record, item, index, e) {
  21266. var key = e.getKey();
  21267. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  21268. this.selectItem(treeView, record);
  21269. }
  21270. },
  21271. selectItem: function (sender, record) {
  21272. var me = this;
  21273. me.setValue(record.getId());
  21274. me.fireEvent('select', me, record);
  21275. me.collapse();
  21276. },
  21277. onExpand: function () {
  21278. var picker = this.picker;
  21279. var store = picker.store;
  21280. var value = this.value;
  21281. var node;
  21282. if (value) {
  21283. node = store.getNodeById(value);
  21284. }
  21285. if (!node) {
  21286. node = store.getRoot();
  21287. }
  21288. picker.ensureVisible(node, {
  21289. select: true,
  21290. focus: true
  21291. });
  21292. },
  21293. setValue: function (value) {
  21294. var me = this;
  21295. console.log('setValue', value);
  21296. me.value = value;
  21297. if (!me.store || me.store.loading) {
  21298. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  21299. return me.mixins.field.setValue.call(me, value);
  21300. // return me;
  21301. }
  21302. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  21303. if (value === undefined) {
  21304. record = me.store.getRoot();
  21305. console.log('setValue', record.getId());
  21306. me.value = record.getId();
  21307. return me.mixins.field.setValue.call(me, value);
  21308. }
  21309. else {
  21310. record = me.store.getNodeById(value);
  21311. }
  21312. // set the raw value to the record's display field if a record was found
  21313. me.setRawValue(record ? record.get(me.displayField) : '');
  21314. return me.mixins.field.setValue.call(me, value);
  21315. },
  21316. getSubmitValue: function () {
  21317. return this.value;
  21318. },
  21319. getValue: function () {
  21320. return this.value;
  21321. },
  21322. onLoad: function () {
  21323. var value = this.value;
  21324. if (value) {
  21325. this.setValue(value);
  21326. }
  21327. },
  21328. onUpdate: function (store, rec, type, modifiedFieldNames) {
  21329. var display = this.displayField;
  21330. var me = this;
  21331. if (type === 'edit' && modifiedFieldNames &&
  21332. Ext.Array.contains(modifiedFieldNames, display) &&
  21333. this.value === rec.getId()) {
  21334. me.mixins.field.setValue.call(me, this.value);
  21335. this.setRawValue(rec.get(display));
  21336. }
  21337. }
  21338. });
  21339. }
  21340. function initPickerPlus () {
  21341. Ext.define('Yvan.PickerAlignCenter', {
  21342. extend: 'Ext.form.field.Picker',
  21343. /**
  21344. * Performs the alignment on the picker using the class defaults
  21345. * @private
  21346. */
  21347. doAlign: function () {
  21348. // 不要挪动就好
  21349. },
  21350. });
  21351. }
  21352. function initCombogrid () {
  21353. Ext.define('Yvan.ComboGrid', {
  21354. extend: 'Ext.form.field.Picker',
  21355. // extend: 'Yvan.PickerAlignCenter',
  21356. xtype: 'combogrid',
  21357. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  21358. triggers: {
  21359. clear: {
  21360. weight: 0,
  21361. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  21362. hidden: true,
  21363. handler: 'onClearClick',
  21364. },
  21365. },
  21366. config: __assign({}, comboGrid),
  21367. editable: true,
  21368. _superBlur: false,
  21369. allowCustomInput: false,
  21370. pressEnterPopup: true,
  21371. initComponent: function () {
  21372. var that = this;
  21373. var scope = lookupScope(that);
  21374. var config = that.config;
  21375. if (isDesignMode(scope, config)) {
  21376. this.superclass.initComponent.call(this, arguments);
  21377. return;
  21378. }
  21379. this.on({
  21380. blur: function (sender, e) {
  21381. if (this._superBlur) {
  21382. // 挂起时不恢复内容
  21383. return;
  21384. }
  21385. // 离开焦点时,恢复原来的值
  21386. sender.setRawValue(sender.value);
  21387. },
  21388. afterrender: function (sender) {
  21389. var $dom = $(sender.inputEl.dom);
  21390. that.scope = lookupScope(sender);
  21391. if (sender.column) {
  21392. // 列模式,拦截 keydown
  21393. $dom.on('keydown', function (e) {
  21394. if (isChartEvent(e) && !that.tryEnable()) {
  21395. // 没有达成 editEnable 条件,不用响应
  21396. stopEvent(e);
  21397. return;
  21398. }
  21399. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21400. stopEvent(e);
  21401. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21402. return;
  21403. }
  21404. });
  21405. }
  21406. else {
  21407. // 常规模式,拦截 keyup
  21408. $dom.on('keyup', function (e) {
  21409. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  21410. return;
  21411. }
  21412. if (isChartEvent(e) && !that.tryEnable()) {
  21413. // 没有达成 editEnable 条件,不用响应
  21414. stopEvent(e);
  21415. return;
  21416. }
  21417. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21418. stopEvent(e);
  21419. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21420. return;
  21421. }
  21422. if (!that.allowCustomInput) {
  21423. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  21424. stopEvent(e);
  21425. }
  21426. });
  21427. $dom.on('change', function (e) {
  21428. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  21429. // if (that.isExpanded) {
  21430. // that.filterChange(that, e.target.value)
  21431. // }
  21432. stopEvent(e);
  21433. });
  21434. }
  21435. $dom.on('input', function (e) {
  21436. stopEvent(e);
  21437. });
  21438. },
  21439. });
  21440. this.superclass.initComponent.apply(this, arguments);
  21441. },
  21442. createPicker: function () {
  21443. var me = this;
  21444. var cfg = {
  21445. layout: 'fit',
  21446. border: 0,
  21447. // border: 5,
  21448. style: {
  21449. // borderColor: 'black',
  21450. // borderWidth: '5px',
  21451. // borderStyle: 'solid',
  21452. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  21453. },
  21454. shadow: 'side',
  21455. shadowOffset: 100,
  21456. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21457. shrinkWrapDock: 2,
  21458. floating: true,
  21459. width: me.pickerWidth,
  21460. height: me.pickerHeight,
  21461. minWidth: me.pickerWidth,
  21462. minHeight: me.pickerHeight,
  21463. maxWidth: me.pickerWidth,
  21464. maxHeight: me.pickerHeight,
  21465. items: [
  21466. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  21467. xtype: 'toolbar',
  21468. items: [
  21469. { xtype: 'textfield', fieldLabel: '筛选' },
  21470. {
  21471. xtype: 'button',
  21472. text: '查询',
  21473. iconCls: 'x-fa fa-search',
  21474. cssType: 'primary',
  21475. listeners: {
  21476. click: function () {
  21477. me.reloadGrid();
  21478. }
  21479. }
  21480. },
  21481. ]
  21482. }, autoLoad: false, listeners: {
  21483. afterrender: function (grid) {
  21484. me.grid = grid;
  21485. grid.focus();
  21486. grid.on({
  21487. rowdblclick: function (sender, row) {
  21488. me.selectItem(row);
  21489. },
  21490. dataLoadComplete: function (sender) {
  21491. _$2.defer(function () {
  21492. me.setFocus();
  21493. });
  21494. },
  21495. keydown: function (sender, e) {
  21496. if (me.column) {
  21497. // 列模式,拦截 keydown
  21498. me.processKey(e);
  21499. }
  21500. },
  21501. keyup: function (sender, e) {
  21502. if (!me.column) {
  21503. // 常规模式,拦截 keyup
  21504. me.processKey(e);
  21505. }
  21506. }
  21507. });
  21508. },
  21509. } })
  21510. ]
  21511. };
  21512. // @ts-ignore
  21513. var picker = new Ext.container.Container(cfg);
  21514. return picker;
  21515. },
  21516. setFocus: function () {
  21517. if (this.grid.store.getCount() > 0) {
  21518. this.grid.focusRow(0);
  21519. }
  21520. },
  21521. processKey: function (e) {
  21522. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  21523. this.selectItem(this.grid.selection);
  21524. stopEvent(e);
  21525. }
  21526. else if (e.key === 'Escape') {
  21527. this.collapse();
  21528. }
  21529. },
  21530. repaintPickerView: function () {
  21531. var style = this.picker.getView().getEl().dom.style;
  21532. style.display = style.display;
  21533. },
  21534. onItemClick: function (view, record, node, rowIndex, e) {
  21535. this.selectItem(record);
  21536. },
  21537. onPickerKeyDown: function (treeView, record, item, index, e) {
  21538. var key = e.getKey();
  21539. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  21540. this.selectItem(record);
  21541. }
  21542. },
  21543. filterChange: _$2.debounce(function (sender, value) {
  21544. sender.onExpand();
  21545. }, 1000),
  21546. selectItem: function (record) {
  21547. var me = this;
  21548. var lookup = this.lookup;
  21549. var scope = lookupScope(this);
  21550. me.fireEvent('select', me, record);
  21551. if (record.isModel) {
  21552. record = record.data;
  21553. }
  21554. tryWriteObject(lookup, record, function (path, value) {
  21555. me._lookupSet(path, value);
  21556. });
  21557. // lookup
  21558. // fromColumn: 'toTarget'
  21559. // fromColumn: 'toTarget'
  21560. // fromColumn: 'toTarget'
  21561. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21562. var value = _$2.get(record, fromColumn);
  21563. me._lookupSet(toTarget, value);
  21564. });
  21565. // 选定之后不能做清空
  21566. // const {lookupClearOnChange} = me
  21567. // if (_.isArray(lookupClearOnChange)) {
  21568. // _.each(lookupClearOnChange, item => {
  21569. // me._lookupSet(item, '')
  21570. // })
  21571. // }
  21572. me.collapse();
  21573. // 触发 _raiseNextFocus
  21574. me._raiseNextFocus(me);
  21575. },
  21576. onExpand: function () {
  21577. // 展开时,根据 lookup 带入查询参数
  21578. var expressData = this.getExpressData();
  21579. var txtField = this.grid.down('toolbar').down('textfield');
  21580. txtField.setValue(expressData.queryValue);
  21581. this.reloadGrid();
  21582. },
  21583. reloadGrid: function () {
  21584. // 展开时,根据 lookup 带入查询参数
  21585. var expressData = this.getExpressData();
  21586. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  21587. var txtField = this.grid.down('toolbar').down('textfield');
  21588. // 每个 combogrid 默认带上 __queryValue 属性
  21589. reloadParam["__queryValue"] = txtField.getValue();
  21590. this.grid.reload(reloadParam);
  21591. },
  21592. onTriggerClick: function (sender) {
  21593. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  21594. if (!grid) {
  21595. msg('正在初始化,请稍后');
  21596. return;
  21597. }
  21598. if (!this.tryEnable()) {
  21599. // 没有达成 editEnable 条件,不用弹出
  21600. return;
  21601. }
  21602. if (isExpanded || readOnly || disabled) {
  21603. // 已弹出、只读、禁用状态下,不允许弹出
  21604. return;
  21605. }
  21606. this._superBlur = true;
  21607. this.superclass.onTriggerClick.apply(this, arguments);
  21608. this._superBlur = false;
  21609. },
  21610. onCollapse: function () {
  21611. // 每次收回时,删除下拉组件
  21612. // delete this.picker
  21613. },
  21614. /**
  21615. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  21616. */
  21617. setValue: function (value) {
  21618. var me = this;
  21619. // 设值用户看到的表面内容
  21620. this.setRawValue(value);
  21621. // 设值 setValue 调用链,正常触发 change 事件等
  21622. return me.mixins.field.setValue.call(me, value);
  21623. },
  21624. _lookupSet: function (path, value) {
  21625. var me = this;
  21626. path = tryVarSimple(path);
  21627. if (me.column) {
  21628. // 判断写入目标,是否与自己绑定的属性相等
  21629. if (path === 'queryValue' || me.column.dataIndex === path) {
  21630. me.setValue(value);
  21631. }
  21632. // 列模式下,写当前编辑行
  21633. var parentRecord = me._lookupEditorRecord();
  21634. if (parentRecord) {
  21635. // Ext.data.Record / Ext.data.Model
  21636. parentRecord.set(path, value);
  21637. }
  21638. else {
  21639. debugger;
  21640. }
  21641. }
  21642. else {
  21643. // 常规模式下,写 viewModel
  21644. me.scope.viewModel.set(path, value);
  21645. }
  21646. },
  21647. _lookupGrid: function () {
  21648. return this.column.up('grid');
  21649. },
  21650. _lookupEditorRecord: function () {
  21651. var _a, _b, _c, _d;
  21652. // parentGrid.getSelectionModel().getLastSelected()
  21653. var grid = this._lookupGrid();
  21654. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  21655. if (!editingPlugin) {
  21656. return grid.getSelectionModel().getLastSelected();
  21657. }
  21658. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  21659. if (_$2.isNumber(rowIdx)) {
  21660. return grid.store.getAt(rowIdx);
  21661. }
  21662. else {
  21663. return grid.getSelectionModel().getLastSelected();
  21664. }
  21665. },
  21666. onChange: function (newVal, oldVal) {
  21667. var me = this;
  21668. var value = newVal;
  21669. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  21670. if (hideTrigger || disabled || readOnly || hideClear) {
  21671. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  21672. return;
  21673. }
  21674. if (value) {
  21675. me.getTrigger('clear').show();
  21676. me.updateLayout();
  21677. }
  21678. else {
  21679. me.getTrigger('clear').hide();
  21680. me.updateLayout();
  21681. }
  21682. },
  21683. /**
  21684. * 得到能用于 express 表达式计算的上下文数据
  21685. */
  21686. getExpressData: function () {
  21687. var queryValue = this.getRawValue();
  21688. if (!queryValue) {
  21689. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  21690. queryValue = this.getPicker().down('textfield').getRawValue();
  21691. }
  21692. if (this.column) {
  21693. // 列模式, 准备好判断 editEnable 表达式用的数据
  21694. var parentRecord = this._lookupEditorRecord();
  21695. if (!parentRecord) {
  21696. debugger;
  21697. }
  21698. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  21699. }
  21700. else {
  21701. // 编辑模式,准备好判断用的数据
  21702. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  21703. }
  21704. },
  21705. tryEnable: function () {
  21706. return tryEnable(this.getExpressData(), this.editEnable);
  21707. },
  21708. /**
  21709. * 清空所有值
  21710. */
  21711. onClearClick: function (sender, e) {
  21712. var me = this;
  21713. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  21714. me.fireEvent('clear', sender, e);
  21715. me.setValue('');
  21716. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21717. me._lookupSet(toTarget, '');
  21718. });
  21719. _$2.each(lookupClearOnChange, function (item) {
  21720. me._lookupSet(item, '');
  21721. });
  21722. }
  21723. });
  21724. }
  21725. function initContainer () {
  21726. var cc = Ext.container.Container.prototype.constructor;
  21727. //const {initComponent} = Ext.container.Container.prototype
  21728. Ext.container.Container.override({
  21729. constructor: function (config) {
  21730. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  21731. cc.call(this, newConfig);
  21732. },
  21733. });
  21734. }
  21735. function initRows () {
  21736. Ext.define('Yvan.Rows', {
  21737. extend: 'Ext.container.Container',
  21738. xtype: 'rows',
  21739. constructor: function (config) {
  21740. var self = this;
  21741. var newConfig = _$2.defaultsDeep({
  21742. // 强制性属性
  21743. layout: 'anchor', border: false,
  21744. defaults: {
  21745. border: false, anchor: '100%',
  21746. margin: '0 0 5 0',
  21747. },
  21748. }, baseConfig(config, 'rows-container'), config, rows);
  21749. this.superclass.constructor.call(self, newConfig);
  21750. },
  21751. });
  21752. }
  21753. function initForm () {
  21754. var ct = Ext.form.Panel.prototype.constructor;
  21755. Ext.form.Panel.override({
  21756. constructor: function (config) {
  21757. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  21758. ct.call(this, newConfig);
  21759. }
  21760. });
  21761. }
  21762. function initCols () {
  21763. Ext.define('Yvan.Cols', {
  21764. extend: 'Ext.container.Container',
  21765. xtype: 'cols',
  21766. constructor: function (config) {
  21767. var self = this;
  21768. var newConfig = _$2.defaultsDeep({
  21769. // 强制性属性
  21770. layout: 'hbox',
  21771. minHeight: config.designMode ? 32 : 0
  21772. }, baseConfig(config, 'cols-container'), config, cols);
  21773. this.superclass.constructor.call(self, newConfig);
  21774. },
  21775. });
  21776. }
  21777. function initButton () {
  21778. /**
  21779. *
  21780. */
  21781. var ct = Ext.button.Button.prototype.constructor;
  21782. Ext.button.Button.override({
  21783. constructor: function (config) {
  21784. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  21785. ct.call(this, newConfig);
  21786. },
  21787. setLoading: function (value) {
  21788. if (value) {
  21789. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  21790. this._originIconCls = this.iconCls;
  21791. }
  21792. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  21793. this.setDisabled(true);
  21794. }
  21795. else {
  21796. this.setIconCls(this._originIconCls);
  21797. this.setDisabled(false);
  21798. }
  21799. }
  21800. });
  21801. }
  21802. function initIframe () {
  21803. Ext.define('Ext.ux.IFrame', {
  21804. extend: 'Ext.Component',
  21805. alias: 'widget.uxiframe',
  21806. loadMask: 'Loading...',
  21807. src: 'about:blank',
  21808. renderTpl: [
  21809. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  21810. ],
  21811. childEls: ['iframeEl'],
  21812. initComponent: function () {
  21813. this.superclass.initComponent.call(this);
  21814. this.superclass.initEvents.call(this);
  21815. this.frameName = this.frameName || this.id + '-frame';
  21816. },
  21817. initEvents: function () {
  21818. var me = this;
  21819. this.superclass.initEvents.call(this);
  21820. me.iframeEl.on('load', me.onLoad, me);
  21821. },
  21822. initRenderData: function () {
  21823. return Ext.apply(this.superclass.initRenderData.call(this), {
  21824. src: this.src,
  21825. frameName: this.frameName
  21826. });
  21827. },
  21828. getBody: function () {
  21829. var doc = this.getDoc();
  21830. return doc.body || doc.documentElement;
  21831. },
  21832. getDoc: function () {
  21833. try {
  21834. return this.getWin().document;
  21835. }
  21836. catch (ex) {
  21837. return null;
  21838. }
  21839. },
  21840. getWin: function () {
  21841. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  21842. return win;
  21843. },
  21844. getFrame: function () {
  21845. var me = this;
  21846. return me.iframeEl.dom;
  21847. },
  21848. onLoad: function () {
  21849. var me = this, doc = me.getDoc();
  21850. if (doc) {
  21851. this.el.unmask();
  21852. this.fireEvent('load', this);
  21853. }
  21854. else if (me.src) {
  21855. this.el.unmask();
  21856. this.fireEvent('error', this);
  21857. }
  21858. },
  21859. load: function (src) {
  21860. var me = this, text = me.loadMask, frame = me.getFrame();
  21861. if (me.fireEvent('beforeload', me, src) !== false) {
  21862. if (text && me.el) {
  21863. me.el.mask(text);
  21864. }
  21865. frame.src = me.src = (src || me.src);
  21866. }
  21867. }
  21868. });
  21869. }
  21870. /**
  21871. * 属性:
  21872. * - autoLoad: true
  21873. * - dataSource: ''
  21874. * 方法:
  21875. * - handleZoomBig
  21876. * - handleZoomSmall
  21877. * - handleZoomReset
  21878. * - openDiagram
  21879. * - getBpmn
  21880. * - getBpmnCanvas
  21881. * - getBpmnOverlays
  21882. * - getBpmnZoomScroll
  21883. * 事件:
  21884. * - initFinish
  21885. * - failed
  21886. * - success
  21887. * - itemHover
  21888. * - itemOut
  21889. * - itemClick
  21890. * - itemDblclick
  21891. * - itemMousedown
  21892. * - itemMouseup
  21893. */
  21894. function initBpmn () {
  21895. Ext.define('Yvan.Bpmn', {
  21896. // extend: 'Ext.container.Container',
  21897. extend: 'Ext.panel.Panel',
  21898. alias: 'widget.bpmn',
  21899. xtype: 'bpmn',
  21900. constructor: function (config) {
  21901. var self = this;
  21902. var newConfig = _$2.defaultsDeep({
  21903. // 强制性属性
  21904. }, baseConfig(config, 'row-item'), config, bpmn);
  21905. if (!newConfig.hideToolbar) {
  21906. newConfig.tbar = [];
  21907. newConfig.tbar.push({
  21908. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  21909. listeners: {
  21910. click: function (sender) {
  21911. self.reload();
  21912. }
  21913. }
  21914. });
  21915. newConfig.tbar.push({
  21916. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  21917. listeners: {
  21918. click: function (sender) {
  21919. self.handleZoomBig();
  21920. }
  21921. },
  21922. });
  21923. newConfig.tbar.push({
  21924. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  21925. listeners: {
  21926. click: function (sender) {
  21927. self.handleZoomSmall();
  21928. }
  21929. },
  21930. });
  21931. newConfig.tbar.push({
  21932. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  21933. listeners: {
  21934. click: function (sender) {
  21935. self.handleZoomReset();
  21936. }
  21937. },
  21938. });
  21939. }
  21940. this.superclass.constructor.call(self, newConfig);
  21941. },
  21942. initComponent: function () {
  21943. var _this = this;
  21944. var me = this;
  21945. var config = me.config;
  21946. var scope = lookupScope(this);
  21947. if (!isDesignMode(scope, config)) {
  21948. //@ts-ignore
  21949. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  21950. console.log('BpNavigated', me, BpNavigated);
  21951. var dom = me.el.dom;
  21952. var $dom = $(dom);
  21953. var $container = $dom.find('.x-autocontainer-innerCt');
  21954. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  21955. _this._bpmn = bpmn;
  21956. if (_this.autoLoad) {
  21957. _this.reload();
  21958. }
  21959. _this.fireEvent('initFinish', _this);
  21960. var eventBus = bpmn.get('eventBus');
  21961. eventBus.on('element.hover', function (e) {
  21962. // this.fireEvent('itemHover', this, e);
  21963. });
  21964. eventBus.on('element.out', function (e) {
  21965. _this.fireEvent('itemOut', _this, e);
  21966. });
  21967. eventBus.on('element.click', function (e) {
  21968. _this.fireEvent('itemClick', _this, e);
  21969. });
  21970. eventBus.on('element.dblclick', function (e) {
  21971. _this.fireEvent('itemDblclick', _this, e);
  21972. });
  21973. eventBus.on('element.mousedown', function (e) {
  21974. _this.fireEvent('itemMousedown', _this, e);
  21975. });
  21976. eventBus.on('element.mouseup', function (e) {
  21977. _this.fireEvent('itemMouseup', _this, e);
  21978. });
  21979. });
  21980. }
  21981. this.superclass.initComponent.call(this);
  21982. this.on({
  21983. afterrender: function (sender) {
  21984. }
  21985. });
  21986. },
  21987. /**
  21988. * 重新载入
  21989. */
  21990. reload: function () {
  21991. var _this = this;
  21992. var _a;
  21993. if (typeof this.dataSource === 'string' && this.dataSource) {
  21994. var scope = lookupScope(this);
  21995. var fn = lookupFn(scope, this.dataSource);
  21996. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  21997. _this.openDiagram(res.data);
  21998. });
  21999. }
  22000. },
  22001. /**
  22002. * 获取bpmn
  22003. */
  22004. getBpmn: function () {
  22005. return this._bpmn;
  22006. },
  22007. getBpmnCanvas: function () {
  22008. var _a;
  22009. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  22010. },
  22011. getBpmnOverlays: function () {
  22012. var _a;
  22013. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  22014. },
  22015. getBpmnZoomScroll: function () {
  22016. var _a;
  22017. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  22018. },
  22019. handleZoomBig: function () {
  22020. var _a;
  22021. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  22022. },
  22023. handleZoomSmall: function () {
  22024. var _a;
  22025. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  22026. },
  22027. handleZoomReset: function () {
  22028. var _a;
  22029. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  22030. },
  22031. openDiagram: function (diagram) {
  22032. var _this = this;
  22033. if (!this.getBpmn()) {
  22034. return;
  22035. }
  22036. this.getBpmn().importXML(diagram, function (err) {
  22037. if (err) {
  22038. // YvEventDispatch(this.onFailed, this, undefined);
  22039. _this.fireEvent('failed', _this, err);
  22040. return console.error('could not import BPMN 2.0 diagram', err);
  22041. }
  22042. // zoom to fit full viewport
  22043. _this.getBpmnCanvas().zoom('fit-viewport');
  22044. _this.fireEvent('success', _this);
  22045. });
  22046. },
  22047. });
  22048. }
  22049. function initSqlComplex () {
  22050. Ext.define('Yvan.SqlComplex', {
  22051. extend: 'Ext.panel.Panel',
  22052. xtype: 'sqlcomplex',
  22053. alias: 'widget.sqlcomplex',
  22054. getSqlExpress: function () {
  22055. },
  22056. constructor: function (config) {
  22057. var reference = config.reference;
  22058. var me = this;
  22059. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22060. {
  22061. region: 'west',
  22062. width: 280,
  22063. border: false,
  22064. split: true,
  22065. reference: reference + '_tree',
  22066. xtype: 'yvtree',
  22067. hideRefresh: true,
  22068. hideExpand: true,
  22069. hideCollapse: true,
  22070. listeners: {
  22071. itemdblclick: function (sender, record, item, index, e) {
  22072. var field = record.get('field');
  22073. var defaultValue = record.get('defaultValue');
  22074. if (!field) {
  22075. return;
  22076. }
  22077. var tabExpress = me.down('tabpanel');
  22078. var sqleditor = me.down('sqleditor');
  22079. var expressGrid = me.down('yvgrid');
  22080. if (tabExpress.getActiveTab().key !== 'grid') {
  22081. // SQL 模式
  22082. sqleditor.insertText(field + '=');
  22083. }
  22084. else {
  22085. // 表格模式
  22086. expressGrid.appendEditRow({
  22087. field: field,
  22088. operator: '=',
  22089. value: defaultValue,
  22090. remark: '',
  22091. });
  22092. _$2.defer(function () {
  22093. gridChanged(me, expressGrid);
  22094. });
  22095. }
  22096. }
  22097. },
  22098. },
  22099. {
  22100. region: 'center',
  22101. xtype: 'tabpanel',
  22102. reference: reference + '_tab',
  22103. tabPosition: 'bottom',
  22104. listeners: {
  22105. afterrender: function (sender) {
  22106. var scope = lookupScope(me);
  22107. var value = scope.viewModel.get(me.config.bindValue);
  22108. // sql 转换为 grid
  22109. try {
  22110. var list_1 = parseSqlToGrid(value);
  22111. _$2.defer(function () {
  22112. var grid = me.down('yvgrid');
  22113. grid.setData(list_1);
  22114. });
  22115. }
  22116. catch (e) {
  22117. console.error(e);
  22118. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22119. var tabSql = sender.down('sqleditor');
  22120. sender.setActiveTab(tabSql);
  22121. }
  22122. },
  22123. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22124. var scope = lookupScope(me);
  22125. var value = scope.viewModel.get(me.config.bindValue);
  22126. if (newCard.key === 'grid') {
  22127. // sql 转换为 grid
  22128. try {
  22129. var list_2 = parseSqlToGrid(value);
  22130. _$2.defer(function () {
  22131. var grid = me.down('yvgrid');
  22132. grid.setData(list_2);
  22133. });
  22134. return true;
  22135. }
  22136. catch (e) {
  22137. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22138. console.error(e);
  22139. return false;
  22140. }
  22141. }
  22142. else if (newCard.key === 'sql') {
  22143. // grid 转换为 sql
  22144. _$2.defer(function () {
  22145. var editor = me.down('sqleditor');
  22146. editor.setValue(value);
  22147. });
  22148. return true;
  22149. }
  22150. }
  22151. },
  22152. items: [
  22153. {
  22154. title: '表格模式',
  22155. key: 'grid',
  22156. xtype: 'yvgrid',
  22157. _mode: 'select',
  22158. reference: reference + '_grid',
  22159. hideFootbar: true,
  22160. pagination: false,
  22161. tbar: [
  22162. {
  22163. xtype: 'button',
  22164. text: '删除',
  22165. iconCls: 'x-fa fa-minus-circle',
  22166. cls: 'ext-btn-danger',
  22167. bind: {
  22168. disabled: '{!' + reference + '_grid.selection}',
  22169. },
  22170. listeners: {
  22171. click: function (sender) {
  22172. var grid = sender.up('yvgrid');
  22173. removeGridRow(grid);
  22174. gridChanged(me, grid);
  22175. }
  22176. },
  22177. },
  22178. ],
  22179. store: {},
  22180. listeners: {
  22181. editfinish: function (sender) {
  22182. gridChanged(me, sender);
  22183. },
  22184. },
  22185. columns: [
  22186. {
  22187. dataIndex: 'field',
  22188. header: '字段', sortable: false, menuDisabled: true,
  22189. width: 190,
  22190. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22191. var column = context.column;
  22192. var propertyConfig = me.config.propertyConfig;
  22193. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22194. var field = record.get('field');
  22195. if (field) {
  22196. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22197. if (idx >= 0) {
  22198. var meta = propertyConfig[idx];
  22199. return meta.text;
  22200. }
  22201. }
  22202. return value;
  22203. }
  22204. },
  22205. {
  22206. dataIndex: 'operator',
  22207. header: '运算符', sortable: false, menuDisabled: true,
  22208. dict: 'operator',
  22209. width: 65,
  22210. editor: { xtype: 'combo' },
  22211. },
  22212. {
  22213. dataIndex: 'value',
  22214. header: '值', sortable: false, menuDisabled: true,
  22215. flex: 1,
  22216. getEditor: function (record) {
  22217. var column = this;
  22218. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22219. var propertyConfig = me.config.propertyConfig;
  22220. var field = record.get('field');
  22221. if (!field) {
  22222. // 没有填 propertyName
  22223. return;
  22224. }
  22225. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22226. if (idx < 0) {
  22227. console.error('没有找到 field=' + field + ". propertyConfig");
  22228. return;
  22229. }
  22230. var meta = propertyConfig[idx];
  22231. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22232. return new Ext.grid.CellEditor({
  22233. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22234. });
  22235. }
  22236. return new Ext.grid.CellEditor({
  22237. field: __assign({ dict: meta.dict }, meta.editor)
  22238. });
  22239. },
  22240. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22241. var column = context.column;
  22242. var grid = _$2.get(view, 'ownerGrid');
  22243. var propertyConfig = me.config.propertyConfig;
  22244. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22245. var field = record.get('field');
  22246. if (field) {
  22247. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22248. if (idx >= 0) {
  22249. var meta = propertyConfig[idx];
  22250. var dictName = _$2.get(meta, 'dict');
  22251. if (dictName && window['DICT_CACHE'][dictName]) {
  22252. var dict_1 = window['DICT_CACHE'][dictName];
  22253. var valueText_1 = [];
  22254. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22255. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22256. if (idxKv >= 0) {
  22257. valueText_1.push(dict_1[idxKv].text);
  22258. }
  22259. else {
  22260. valueText_1.push(value);
  22261. }
  22262. });
  22263. return valueText_1.join(',');
  22264. }
  22265. }
  22266. }
  22267. return valueList;
  22268. },
  22269. },
  22270. ]
  22271. },
  22272. {
  22273. title: 'SQL模式',
  22274. key: 'sql',
  22275. xtype: 'sqleditor',
  22276. reference: reference + '_sql',
  22277. listeners: {
  22278. change: function (sender) {
  22279. var scope = lookupScope(me);
  22280. // 保存 editor 写入的值
  22281. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22282. }
  22283. }
  22284. },
  22285. ]
  22286. }
  22287. ] });
  22288. this.superclass.constructor.call(this, newConfig);
  22289. },
  22290. initComponent: function () {
  22291. // 货位条件树
  22292. var me = this;
  22293. me.superclass.initComponent.apply(this, arguments);
  22294. var tree = this.down('yvtree');
  22295. var config = me.config;
  22296. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22297. },
  22298. });
  22299. function gridChanged(me, grid) {
  22300. var data = grid.getDataRows();
  22301. var propertyConfig = me.config.propertyConfig;
  22302. var bindValue = me.config.bindValue;
  22303. var scope = lookupScope(me);
  22304. var sql = parseGridToSql(data);
  22305. scope.viewModel.set(bindValue, sql);
  22306. }
  22307. /**
  22308. * 用于从 propertyConfig 解析出树形结构
  22309. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22310. * ->
  22311. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22312. */
  22313. function buildConfigTree(propertyConfig) {
  22314. var root = {
  22315. expanded: true,
  22316. leaf: false,
  22317. children: []
  22318. };
  22319. var categoryObj = {};
  22320. var cfgList = propertyConfig;
  22321. _$2.forEach(cfgList, function (cfg) {
  22322. var cateNode = categoryObj[cfg.category];
  22323. if (!cateNode) {
  22324. cateNode = {
  22325. text: cfg.category, expanded: true, leaf: false,
  22326. children: []
  22327. };
  22328. categoryObj[cfg.category] = cateNode;
  22329. root.children.push(cateNode);
  22330. }
  22331. cateNode.children.push({
  22332. text: cfg.text,
  22333. field: cfg.field,
  22334. operator: cfg.operator,
  22335. defaultValue: cfg.defaultValue,
  22336. leaf: true,
  22337. });
  22338. });
  22339. return root;
  22340. }
  22341. /**
  22342. * 将表格变成 SQL where语句 [
  22343. * {field: 'f1', value: 1, operator: '='}
  22344. * {field: 'f2', value: 2, operator: '='}
  22345. * {field: 'f3', value: '3', operator: '>='}
  22346. * {field: 'f4', value: 4, operator: '='}
  22347. * ]
  22348. * ->
  22349. * f1=v1 and f2=v2
  22350. */
  22351. function parseGridToSql(list) {
  22352. var sqls = [];
  22353. _$2.forEach(list, function (i) {
  22354. var _a;
  22355. if (i.operator === 'in') {
  22356. sqls.push(i.field + ' in (' + (i.value) + ')');
  22357. }
  22358. else if (i.operator === 'notIn') {
  22359. sqls.push(i.field + ' not in (' + (i.value) + ')');
  22360. }
  22361. else {
  22362. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  22363. }
  22364. });
  22365. return sqls.join(' AND ');
  22366. }
  22367. /**
  22368. * 将 SQL 语句的 where 片段变成表格
  22369. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  22370. * @return [
  22371. {field: 'f1', value: 1, operator: '='}
  22372. {field: 'f2', value: 2, operator: '='}
  22373. {field: 'f3', value: '3', operator: '>='}
  22374. {field: 'f4', value: 4, operator: '='}
  22375. ]
  22376. */
  22377. function parseSqlToGrid(sql) {
  22378. if (!sql || !_$2.trim(sql)) {
  22379. return [];
  22380. }
  22381. var parser = new window['NodeSQLParser'].Parser();
  22382. var ast = parser.astify('select * from dual where ' + sql);
  22383. var ret = [];
  22384. exp(ast.where, ret);
  22385. return ret;
  22386. }
  22387. function exp(ast, ret) {
  22388. if (ast.type === 'binary_expr') {
  22389. if (_$2.toUpper(ast.operator) === 'AND') {
  22390. if (ast.left.type === 'binary_expr') {
  22391. exp(ast.left, ret);
  22392. }
  22393. if (ast.right.type === 'binary_expr') {
  22394. exp(ast.right, ret);
  22395. }
  22396. }
  22397. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  22398. if (ast.left.type === 'column_ref') {
  22399. if (ast.right.type === 'number' ||
  22400. ast.right.type === 'single_quote_string' ||
  22401. ast.right.type === 'double_quote_string') {
  22402. // 具体值相等
  22403. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  22404. }
  22405. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  22406. && ast.right.type === 'expr_list') {
  22407. // in / not in
  22408. var valueList_1 = [];
  22409. _$2.forEach(ast.right.value, function (item) {
  22410. valueList_1.push(item.value);
  22411. });
  22412. var operator = void 0;
  22413. if (_$2.toUpper(ast.operator) === 'IN') {
  22414. operator = 'in';
  22415. }
  22416. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  22417. operator = 'notIn';
  22418. }
  22419. ret.push({
  22420. field: ast.left.column, value: valueList_1.join(','),
  22421. operator: operator
  22422. });
  22423. }
  22424. else {
  22425. throw new Error('ast.right must is value.');
  22426. }
  22427. }
  22428. else {
  22429. throw new Error('ast.left must is column_ref.');
  22430. }
  22431. }
  22432. else {
  22433. // 必须用 AND 条件符匹配
  22434. throw new Error('ast.operator must is "AND / =".');
  22435. }
  22436. }
  22437. else {
  22438. throw new Error('ast.type must is "binary_expr".');
  22439. }
  22440. }
  22441. /**
  22442. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  22443. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  22444. {
  22445. type: 'binary_expr',
  22446. operator: 'AND',
  22447. left: {
  22448. type: 'binary_expr',
  22449. operator: 'AND',
  22450. left: {
  22451. type: 'binary_expr',
  22452. operator: 'AND',
  22453. left: {
  22454. type: 'binary_expr',
  22455. operator: 'AND',
  22456. left: {
  22457. type: 'binary_expr',
  22458. operator: '=',
  22459. left: {
  22460. type: 'column_ref',
  22461. table: null,
  22462. column: 'f1'
  22463. },
  22464. right: {
  22465. type: 'number',
  22466. value: 1
  22467. }
  22468. },
  22469. right: {
  22470. type: 'binary_expr',
  22471. operator: '=',
  22472. left: {
  22473. type: 'column_ref',
  22474. table: null,
  22475. column: 'f2'
  22476. },
  22477. right: {
  22478. type: 'number',
  22479. value: 2
  22480. }
  22481. }
  22482. },
  22483. right: {
  22484. type: 'binary_expr',
  22485. operator: '=',
  22486. left: {
  22487. type: 'column_ref',
  22488. table: null,
  22489. column: 'f3'
  22490. },
  22491. right: {
  22492. type: 'single_quote_string',
  22493. value: '3'
  22494. }
  22495. }
  22496. },
  22497. right: {
  22498. type: 'binary_expr',
  22499. operator: '>=',
  22500. left: {
  22501. type: 'column_ref',
  22502. table: null,
  22503. column: 'f4'
  22504. },
  22505. right: {
  22506. type: 'number',
  22507. value: 4
  22508. }
  22509. }
  22510. },
  22511. right: {
  22512. type: 'binary_expr',
  22513. operator: '<',
  22514. left: {
  22515. type: 'column_ref',
  22516. table: null,
  22517. column: 'f4'
  22518. },
  22519. right: {
  22520. type: 'number',
  22521. value: 3
  22522. }
  22523. }
  22524. }
  22525. * */
  22526. }
  22527. function initParamComplex () {
  22528. Ext.define('Yvan.ParamComplex', {
  22529. extend: 'Ext.panel.Panel',
  22530. xtype: 'paramcomplex',
  22531. alias: 'widget.paramcomplex',
  22532. getSqlExpress: function () {
  22533. },
  22534. constructor: function (config) {
  22535. var reference = config.reference;
  22536. var me = this;
  22537. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22538. {
  22539. region: 'west',
  22540. width: 280,
  22541. border: false,
  22542. split: true,
  22543. reference: reference + '_tree',
  22544. xtype: 'yvtree',
  22545. hideRefresh: true,
  22546. hideExpand: true,
  22547. hideCollapse: true,
  22548. listeners: {
  22549. itemdblclick: function (sender, record, item, index, e) {
  22550. var field = record.get('field');
  22551. var defaultValue = record.get('defaultValue');
  22552. if (!field) {
  22553. return;
  22554. }
  22555. var tabExpress = me.down('tabpanel');
  22556. var sqleditor = me.down('sqleditor');
  22557. var expressGrid = me.down('yvgrid');
  22558. if (tabExpress.getActiveTab().key !== 'grid') {
  22559. // SQL 模式
  22560. sqleditor.insertText(field + '=');
  22561. }
  22562. else {
  22563. // 表格模式
  22564. expressGrid.appendEditRow({
  22565. field: field,
  22566. operator: '=',
  22567. value: defaultValue,
  22568. remark: '',
  22569. });
  22570. _$2.defer(function () {
  22571. gridChanged(me, expressGrid);
  22572. });
  22573. }
  22574. }
  22575. },
  22576. },
  22577. {
  22578. region: 'center',
  22579. xtype: 'tabpanel',
  22580. reference: reference + '_tab',
  22581. tabPosition: 'bottom',
  22582. listeners: {
  22583. afterrender: function (sender) {
  22584. var scope = lookupScope(me);
  22585. var value = scope.viewModel.get(me.config.bindValue);
  22586. // sql 转换为 grid
  22587. try {
  22588. var list_1 = parseParamToGrid(value);
  22589. _$2.defer(function () {
  22590. var grid = me.down('yvgrid');
  22591. grid.setData(list_1);
  22592. });
  22593. }
  22594. catch (e) {
  22595. console.error(e);
  22596. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22597. var tabSql = sender.down('sqleditor');
  22598. sender.setActiveTab(tabSql);
  22599. }
  22600. },
  22601. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22602. var scope = lookupScope(me);
  22603. var value = scope.viewModel.get(me.config.bindValue);
  22604. if (newCard.key === 'grid') {
  22605. // sql 转换为 grid
  22606. try {
  22607. var list_2 = parseParamToGrid(value);
  22608. _$2.defer(function () {
  22609. var grid = me.down('yvgrid');
  22610. grid.setData(list_2);
  22611. });
  22612. return true;
  22613. }
  22614. catch (e) {
  22615. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22616. console.error(e);
  22617. return false;
  22618. }
  22619. }
  22620. else if (newCard.key === 'sql') {
  22621. // grid 转换为 sql
  22622. _$2.defer(function () {
  22623. var editor = me.down('sqleditor');
  22624. editor.setValue(value);
  22625. });
  22626. return true;
  22627. }
  22628. }
  22629. },
  22630. items: [
  22631. {
  22632. title: '表格模式',
  22633. key: 'grid',
  22634. xtype: 'yvgrid',
  22635. _mode: 'select',
  22636. reference: reference + '_grid',
  22637. hideFootbar: true,
  22638. pagination: false,
  22639. tbar: [
  22640. {
  22641. xtype: 'button',
  22642. text: '删除',
  22643. iconCls: 'x-fa fa-minus-circle',
  22644. cls: 'ext-btn-danger',
  22645. bind: {
  22646. disabled: '{!' + reference + '_grid.selection}',
  22647. },
  22648. listeners: {
  22649. click: function (sender) {
  22650. var grid = sender.up('yvgrid');
  22651. removeGridRow(grid);
  22652. gridChanged(me, grid);
  22653. }
  22654. },
  22655. },
  22656. ],
  22657. store: {},
  22658. listeners: {
  22659. editfinish: function (sender) {
  22660. gridChanged(me, sender);
  22661. },
  22662. },
  22663. columns: [
  22664. {
  22665. dataIndex: 'field',
  22666. header: '字段', sortable: false, menuDisabled: true,
  22667. width: 190,
  22668. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22669. var column = context.column;
  22670. var propertyConfig = me.config.propertyConfig;
  22671. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22672. var field = record.get('field');
  22673. if (field) {
  22674. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22675. if (idx >= 0) {
  22676. var meta = propertyConfig[idx];
  22677. return meta.text;
  22678. }
  22679. }
  22680. return value;
  22681. }
  22682. },
  22683. {
  22684. dataIndex: 'value',
  22685. header: '值', sortable: false, menuDisabled: true,
  22686. flex: 1,
  22687. getEditor: function (record) {
  22688. var column = this;
  22689. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22690. var propertyConfig = me.config.propertyConfig;
  22691. var field = record.get('field');
  22692. if (!field) {
  22693. // 没有填 propertyName
  22694. return;
  22695. }
  22696. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22697. if (idx < 0) {
  22698. console.error('没有找到 field=' + field + ". propertyConfig");
  22699. return;
  22700. }
  22701. var meta = propertyConfig[idx];
  22702. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22703. return new Ext.grid.CellEditor({
  22704. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22705. });
  22706. }
  22707. return new Ext.grid.CellEditor({
  22708. field: __assign({ dict: meta.dict }, meta.editor)
  22709. });
  22710. },
  22711. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22712. var column = context.column;
  22713. var grid = _$2.get(view, 'ownerGrid');
  22714. var propertyConfig = me.config.propertyConfig;
  22715. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22716. var field = record.get('field');
  22717. if (field) {
  22718. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22719. if (idx >= 0) {
  22720. var meta = propertyConfig[idx];
  22721. var dictName = _$2.get(meta, 'dict');
  22722. if (dictName && window['DICT_CACHE'][dictName]) {
  22723. var dict_1 = window['DICT_CACHE'][dictName];
  22724. var valueText_1 = [];
  22725. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22726. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22727. if (idxKv >= 0) {
  22728. valueText_1.push(dict_1[idxKv].text);
  22729. }
  22730. else {
  22731. valueText_1.push(value);
  22732. }
  22733. });
  22734. return valueText_1.join(',');
  22735. }
  22736. }
  22737. }
  22738. return valueList;
  22739. },
  22740. },
  22741. ]
  22742. },
  22743. {
  22744. title: '文本模式',
  22745. key: 'sql',
  22746. xtype: 'sqleditor',
  22747. reference: reference + '_sql',
  22748. listeners: {
  22749. change: function (sender) {
  22750. var scope = lookupScope(me);
  22751. // 保存 editor 写入的值
  22752. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22753. }
  22754. }
  22755. },
  22756. ]
  22757. }
  22758. ] });
  22759. this.superclass.constructor.call(this, newConfig);
  22760. },
  22761. initComponent: function () {
  22762. // 货位条件树
  22763. var me = this;
  22764. me.superclass.initComponent.apply(this, arguments);
  22765. var tree = this.down('yvtree');
  22766. var config = me.config;
  22767. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22768. },
  22769. });
  22770. function gridChanged(me, grid) {
  22771. var data = grid.getDataRows();
  22772. var propertyConfig = me.config.propertyConfig;
  22773. var bindValue = me.config.bindValue;
  22774. var scope = lookupScope(me);
  22775. var sql = parseGridToParam(data);
  22776. scope.viewModel.set(bindValue, sql);
  22777. }
  22778. /**
  22779. * 用于从 propertyConfig 解析出树形结构
  22780. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22781. * ->
  22782. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22783. */
  22784. function buildConfigTree(propertyConfig) {
  22785. var root = {
  22786. expanded: true,
  22787. leaf: false,
  22788. children: []
  22789. };
  22790. var categoryObj = {};
  22791. var cfgList = propertyConfig;
  22792. _$2.forEach(cfgList, function (cfg) {
  22793. var cateNode = categoryObj[cfg.category];
  22794. if (!cateNode) {
  22795. cateNode = {
  22796. text: cfg.category, expanded: true, leaf: false,
  22797. children: []
  22798. };
  22799. categoryObj[cfg.category] = cateNode;
  22800. root.children.push(cateNode);
  22801. }
  22802. cateNode.children.push({
  22803. text: cfg.text,
  22804. field: cfg.field,
  22805. operator: cfg.operator,
  22806. defaultValue: cfg.defaultValue,
  22807. leaf: true,
  22808. });
  22809. });
  22810. return root;
  22811. }
  22812. /**
  22813. * 将表格变成参数语句 [
  22814. * {field: 'f1', value: 1}
  22815. * {field: 'f2', value: 2}
  22816. * {field: 'f3', value: '3'}
  22817. * {field: 'f4', value: 4}
  22818. * ]
  22819. * ->
  22820. * f1=v1, f2=v2
  22821. */
  22822. function parseGridToParam(list) {
  22823. var sqls = [];
  22824. _$2.forEach(list, function (i) {
  22825. sqls.push(i.field + '=' + (i.value));
  22826. });
  22827. return sqls.join('; ');
  22828. }
  22829. /**
  22830. * 将 分号分割的的参数设置 变成表格
  22831. * @param param a=1; b=2; c='3'
  22832. * @return [
  22833. {field: 'a', value: 1}
  22834. {field: 'b', value: 2}
  22835. {field: 'c', value: '3'}
  22836. ]
  22837. */
  22838. function parseParamToGrid(param) {
  22839. if (!param || !_$2.trim(param)) {
  22840. return [];
  22841. }
  22842. var ret = [];
  22843. var sp = _$2.split(param, ';');
  22844. _$2.forEach(sp, function (v) {
  22845. var vi = _$2.indexOf(v, '=');
  22846. var field = _$2.trim(v.substr(0, vi));
  22847. var value = eval(v.substr(vi + 1));
  22848. ret.push({ field: field, value: value });
  22849. });
  22850. return ret;
  22851. }
  22852. }
  22853. function initSqlEditor () {
  22854. Ext.define('com.yvan.studio.SqlEditor', {
  22855. extend: 'Ext.panel.Panel',
  22856. alias: 'widget.sqleditor',
  22857. xtype: 'sqleditor',
  22858. layout: 'fit',
  22859. border: false,
  22860. html: "<div class=\"editor\"/>",
  22861. config: {
  22862. value: ''
  22863. },
  22864. codeChange: undefined,
  22865. isChangeFromOuter: false,
  22866. setCode: function (value) {
  22867. var _this = this;
  22868. this.code = value;
  22869. this.value = value;
  22870. _$2.defer(function () {
  22871. _this.isChangeFromOuter = true;
  22872. if (_this.editor) {
  22873. _this.editor.setValue(value);
  22874. }
  22875. });
  22876. },
  22877. getCode: function () {
  22878. return this.getValue();
  22879. },
  22880. updateOptions: function (options) {
  22881. if (this.editor && options) {
  22882. this.editor.updateOptions(options);
  22883. }
  22884. },
  22885. getValue: function () {
  22886. if (!this.editor) {
  22887. return this.code;
  22888. }
  22889. return this.editor.getValue();
  22890. },
  22891. applyPosition: function () {
  22892. var _this = this;
  22893. if (this.autoFocusMethod) {
  22894. if (this.editor) {
  22895. _$2.defer(function () {
  22896. if (_this.autoFocusStartLine) {
  22897. _this.editor.setPosition({
  22898. lineNumber: _this.autoFocusStartLine,
  22899. column: _this.autoFocusStartColumn
  22900. });
  22901. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  22902. }
  22903. _this.editor.focus();
  22904. });
  22905. delete this.autoFocusMethod;
  22906. }
  22907. }
  22908. this.editor.layout();
  22909. },
  22910. insertText: function (text) {
  22911. var editor = this.editor;
  22912. var position = editor.getPosition();
  22913. editor.executeEdits('', [
  22914. {
  22915. range: {
  22916. startLineNumber: position.lineNumber,
  22917. startColumn: position.column,
  22918. endLineNumber: position.lineNumber,
  22919. endColumn: position.column
  22920. },
  22921. text: text
  22922. }
  22923. ]);
  22924. },
  22925. setValue: function (value, fromEditor) {
  22926. this.setCode(value);
  22927. var me = this;
  22928. if (me.value === value) {
  22929. // 值相等,不需要变化
  22930. return;
  22931. }
  22932. if (fromEditor !== true && me.editor) {
  22933. // 不是来源于编辑器的变化,才设置编辑器的值
  22934. me.editor.setValue(value);
  22935. }
  22936. // 通知mixins setValue
  22937. me.value = value;
  22938. me.fireEvent('change', value);
  22939. },
  22940. initComponent: function () {
  22941. var that = this;
  22942. this.superclass.initComponent.call(this);
  22943. that.on({
  22944. resize: function () {
  22945. if (that.editor) {
  22946. that.editor.layout();
  22947. }
  22948. },
  22949. destory: function () {
  22950. if (that.editor) {
  22951. that.editor.dispose();
  22952. delete that.editor;
  22953. }
  22954. },
  22955. afterrender: function (sender) {
  22956. var $dom = $(that.el.dom).find('.editor');
  22957. attach_2($dom[0], {
  22958. value: that.code
  22959. }).then(function (editor) {
  22960. that.editor = editor;
  22961. that.applyPosition();
  22962. that.editor.onDidChangeModelContent(function (e) {
  22963. that.fireEvent('change', that.editor, e);
  22964. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  22965. that.codeChange(that.editor.getValue(), that.name, e);
  22966. }
  22967. that.isChangeFromOuter = false;
  22968. });
  22969. });
  22970. }
  22971. });
  22972. }
  22973. });
  22974. function attach_2(element, opts) {
  22975. if (!window['monaco']) {
  22976. return;
  22977. }
  22978. var monaco = window['monaco'];
  22979. return new Promise(function (resolve) {
  22980. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  22981. enabled: false
  22982. } }));
  22983. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  22984. // const sql = editor.getValue()
  22985. // if (_.trim(sql).length > 0) {
  22986. // editor.setValue(format(sql, {
  22987. // indent: ' ',
  22988. // uppercase: true,
  22989. // }))
  22990. // }
  22991. // })
  22992. editor.onKeyUp(function (e) {
  22993. // console.log(e)
  22994. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  22995. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  22996. }
  22997. });
  22998. resolve(editor);
  22999. });
  23000. }
  23001. }
  23002. function initJsonEditor () {
  23003. Ext.define('com.yvan.studio.JsonEditor', {
  23004. extend: 'Ext.panel.Panel',
  23005. alias: 'widget.jsoneditor',
  23006. xtype: 'jsoneditor',
  23007. layout: 'fit',
  23008. border: false,
  23009. html: "<div class=\"editor\"/>",
  23010. autoFocusMethod: true,
  23011. autoFocusStartLine: 0,
  23012. autoFocusStartColumn: 0,
  23013. codeChange: undefined,
  23014. funcArr: [],
  23015. modulePage: null,
  23016. isChangeFromOuter: false,
  23017. name: "",
  23018. /**
  23019. * 设置代码
  23020. */
  23021. setCode: function (value) {
  23022. var _this = this;
  23023. this.code = value;
  23024. _$2.defer(function () {
  23025. _this.isChangeFromOuter = true;
  23026. if (_this.editor) {
  23027. _this.editor.setValue(value);
  23028. }
  23029. });
  23030. },
  23031. updateOptions: function (options) {
  23032. if (this.editor && options) {
  23033. this.editor.updateOptions(options);
  23034. }
  23035. },
  23036. setLanguage: function (lang) {
  23037. if (!window['monaco']) {
  23038. return;
  23039. }
  23040. var monaco = window['monaco'];
  23041. if (this.editor && lang) {
  23042. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  23043. }
  23044. },
  23045. getCode: function () {
  23046. var _a;
  23047. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23048. },
  23049. applyPosition: function () {
  23050. var _this = this;
  23051. if (this.autoFocusMethod) {
  23052. if (this.editor) {
  23053. _$2.defer(function () {
  23054. if (_this.autoFocusStartLine) {
  23055. _this.editor.setPosition({
  23056. lineNumber: _this.autoFocusStartLine,
  23057. column: _this.autoFocusStartColumn
  23058. });
  23059. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23060. }
  23061. _this.editor.focus();
  23062. });
  23063. delete this.autoFocusMethod;
  23064. }
  23065. }
  23066. this.editor.layout();
  23067. },
  23068. initComponent: function () {
  23069. var that = this;
  23070. this.superclass.initComponent.apply(this, arguments);
  23071. this.on({
  23072. resize: function (sender, width, height) {
  23073. if (that.editor) {
  23074. that.editor.layout();
  23075. }
  23076. },
  23077. destory: function () {
  23078. if (that.editor) {
  23079. that.editor.dispose();
  23080. delete that.editor;
  23081. }
  23082. },
  23083. afterrender: function (sender) {
  23084. var $dom = $(that.el.dom).find('.editor');
  23085. attach_116($dom[0], {
  23086. value: that.code
  23087. }).then(function (editor) {
  23088. that.editor = editor;
  23089. that.applyPosition();
  23090. that.editor.onDidChangeModelContent(function (e) {
  23091. that.fireEvent('change', that.editor, e);
  23092. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23093. that.codeChange(that.editor.getValue(), that.name, e);
  23094. }
  23095. that.isChangeFromOuter = false;
  23096. });
  23097. });
  23098. }
  23099. });
  23100. },
  23101. });
  23102. function attach_116(element, opts) {
  23103. if (!window['monaco']) {
  23104. return;
  23105. }
  23106. var monaco = window['monaco'];
  23107. return new Promise(function (resolve) {
  23108. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  23109. enabled: false
  23110. } }));
  23111. editor.onKeyUp(function (e) {
  23112. // console.log(e)
  23113. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23114. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23115. }
  23116. });
  23117. resolve(editor);
  23118. });
  23119. }
  23120. }
  23121. function initJsEditor () {
  23122. Ext.define('com.yvan.studio.JsEditor', {
  23123. extend: 'Ext.panel.Panel',
  23124. alias: 'widget.jseditor',
  23125. xtype: 'jseditor',
  23126. layout: 'fit',
  23127. border: false,
  23128. html: "<div class=\"editor\"/>",
  23129. autoFocusMethod: true,
  23130. autoFocusStartLine: 0,
  23131. autoFocusStartColumn: 0,
  23132. codeChange: undefined,
  23133. funcArr: [],
  23134. modulePage: null,
  23135. isChangeFromOuter: false,
  23136. name: "",
  23137. /**
  23138. * 设置代码
  23139. */
  23140. setCode: function (value) {
  23141. var _this = this;
  23142. this.code = value;
  23143. _$2.defer(function () {
  23144. _this.isChangeFromOuter = true;
  23145. if (_this.editor) {
  23146. _this.editor.setValue(value);
  23147. if (_this.name === "controllerEditor") {
  23148. _this.funcArr = _this.getAllFunction();
  23149. }
  23150. }
  23151. });
  23152. },
  23153. getCode: function () {
  23154. var _a;
  23155. if (!this.editor) {
  23156. return this.code;
  23157. }
  23158. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23159. },
  23160. applyPosition: function () {
  23161. var _this = this;
  23162. if (this.autoFocusMethod) {
  23163. if (this.editor) {
  23164. _$2.defer(function () {
  23165. if (_this.autoFocusStartLine) {
  23166. _this.editor.setPosition({
  23167. lineNumber: _this.autoFocusStartLine,
  23168. column: _this.autoFocusStartColumn
  23169. });
  23170. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23171. }
  23172. _this.editor.focus();
  23173. });
  23174. delete this.autoFocusMethod;
  23175. }
  23176. }
  23177. this.editor.layout();
  23178. },
  23179. initComponent: function () {
  23180. var that = this;
  23181. this.superclass.initComponent.apply(this, arguments);
  23182. this.on({
  23183. resize: function (sender, width, height) {
  23184. if (that.editor) {
  23185. that.editor.layout();
  23186. }
  23187. },
  23188. destory: function () {
  23189. if (that.editor) {
  23190. that.editor.dispose();
  23191. delete that.editor;
  23192. }
  23193. },
  23194. afterrender: function () {
  23195. var $dom = $(that.el.dom).find('.editor');
  23196. attach_1($dom[0], {
  23197. value: that.code
  23198. }).then(function (editor) {
  23199. that.editor = editor;
  23200. that.applyPosition();
  23201. that.editor.onDidChangeModelContent(function (e) {
  23202. that.fireEvent('change', that.editor, e);
  23203. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23204. that.codeChange(that.editor.getValue(), that.name, e);
  23205. }
  23206. that.isChangeFromOuter = false;
  23207. });
  23208. });
  23209. }
  23210. });
  23211. },
  23212. getAllFunction: function () {
  23213. var funcArr = [];
  23214. var ast = window['YvanUI'].recast.parse(this.code);
  23215. if (ast && ast.program && ast.program.body) {
  23216. if (Array.isArray(ast.program.body)) {
  23217. for (var i = 0; i < ast.program.body.length; i++) {
  23218. var m = ast.program.body[i];
  23219. if (m.type === "ExportDefaultDeclaration") {
  23220. if (m.declaration.type === "ClassDeclaration") {
  23221. if (m.declaration.body.type === "ClassBody") {
  23222. if (Array.isArray(m.declaration.body.body)) {
  23223. for (var j = 0; j < m.declaration.body.body.length; j++) {
  23224. var ob = m.declaration.body.body[j];
  23225. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  23226. var funcItem = { name: ob.key.name, args: [] };
  23227. if (Array.isArray(ob.value.params)) {
  23228. for (var k = 0; k < ob.value.params.length; k++) {
  23229. var p = ob.value.params[k];
  23230. funcItem.args.push(p.name);
  23231. }
  23232. }
  23233. funcArr.push(funcItem);
  23234. }
  23235. }
  23236. }
  23237. }
  23238. }
  23239. }
  23240. }
  23241. }
  23242. }
  23243. return funcArr;
  23244. }
  23245. });
  23246. var isInited = false;
  23247. function attach_1(element, opts) {
  23248. if (!window['monaco']) {
  23249. return;
  23250. }
  23251. var monaco = window['monaco'];
  23252. return new Promise(function (resolve) {
  23253. if (!isInited) {
  23254. isInited = true;
  23255. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  23256. noSemanticValidation: true,
  23257. noSyntaxValidation: false
  23258. });
  23259. // compiler options
  23260. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  23261. target: monaco.languages.typescript.ScriptTarget.ES2016,
  23262. allowNonTsExtensions: true,
  23263. });
  23264. // extra libraries
  23265. var libSource = [
  23266. 'declare class Facts {',
  23267. ' /**',
  23268. ' * Returns the next fact',
  23269. ' */',
  23270. ' static next():string',
  23271. ' static next222():string',
  23272. '}',
  23273. "\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 ",
  23274. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  23275. ].join('\n');
  23276. var libUri = 'file:///index.d.ts';
  23277. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  23278. // When resolving definitions and references, the editor will try to use created models.
  23279. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  23280. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  23281. }
  23282. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  23283. resolve(editor);
  23284. });
  23285. }
  23286. }
  23287. function initClipboard () {
  23288. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  23289. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  23290. Ext.grid.plugin.Clipboard.override({
  23291. getCellData: function (format, erase) {
  23292. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  23293. if (selection) {
  23294. selection.eachCell(function (cellContext) {
  23295. column = cellContext.column;
  23296. view = cellContext.column.getView();
  23297. record = cellContext.record;
  23298. // Do not copy the check column or row numberer column
  23299. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  23300. return;
  23301. }
  23302. if (lastRecord !== record) {
  23303. lastRecord = record;
  23304. ret.push(row = []);
  23305. }
  23306. dataIndex = column.dataIndex;
  23307. // 记录原始数据
  23308. var rData = record.data[dataIndex];
  23309. if (isRaw) {
  23310. data = record.data[dataIndex];
  23311. }
  23312. else {
  23313. // Try to access the view node.
  23314. viewNode = view.all.item(cellContext.rowIdx);
  23315. // If we could not, it's because it's outside of the rendered block -
  23316. // recreate it.
  23317. if (!viewNode) {
  23318. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  23319. }
  23320. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  23321. data = cell.innerHTML;
  23322. if (isText) {
  23323. data = Ext.util.Format.stripTags(data);
  23324. }
  23325. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  23326. data = data || rData;
  23327. }
  23328. row.push(data);
  23329. if (erase && dataIndex) {
  23330. record.set(dataIndex, null);
  23331. }
  23332. });
  23333. }
  23334. // See decode() comment below
  23335. return Ext.util.TSV.encode(ret, undefined, null);
  23336. },
  23337. getCells: function (format, erase) {
  23338. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  23339. if (selection) {
  23340. selection.eachCell(function (cellContext) {
  23341. record = cellContext.record;
  23342. if (lastRecord !== record) {
  23343. lastRecord = record;
  23344. ret.push(row = {
  23345. model: record.self,
  23346. fields: []
  23347. });
  23348. }
  23349. dataIndex = cellContext.column.dataIndex;
  23350. row.fields.push({
  23351. name: dataIndex,
  23352. value: record.data[dataIndex]
  23353. });
  23354. if (erase && dataIndex) {
  23355. record.set(dataIndex, null);
  23356. }
  23357. });
  23358. }
  23359. return ret;
  23360. },
  23361. getTextData: function (format, erase) {
  23362. return this.getCellData(format, erase);
  23363. },
  23364. putCellData: function (data, format) {
  23365. var _a;
  23366. 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 = {};
  23367. // If the view is not focused, use the first cell of the selection as the destination.
  23368. if (!destination && selected) {
  23369. selected.eachCell(function (c) {
  23370. destination = c;
  23371. return false;
  23372. });
  23373. }
  23374. if (destination) {
  23375. // Create a new Context based upon the outermost View.
  23376. // NavigationModel works on local views.
  23377. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  23378. // At that point, we can use navModel.getPosition()
  23379. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  23380. }
  23381. else {
  23382. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  23383. }
  23384. destinationStartColumn = destination.colIdx;
  23385. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  23386. row = values[sourceRowIdx];
  23387. // Collect new values in dataObject
  23388. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  23389. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  23390. continue;
  23391. }
  23392. dataIndex = destination.column.dataIndex;
  23393. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  23394. if (dataIndex) {
  23395. switch (format) {
  23396. // Raw field values
  23397. case 'raw':
  23398. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23399. break;
  23400. // Textual data with HTML tags stripped
  23401. case 'text':
  23402. {
  23403. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  23404. // 获取字典原始的value
  23405. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  23406. }
  23407. else {
  23408. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23409. }
  23410. break;
  23411. }
  23412. }
  23413. }
  23414. // If we are at the end of the destination row, break the column loop.
  23415. if (destination.colIdx === maxColIdx) {
  23416. break;
  23417. }
  23418. destination.setColumn(destination.colIdx + 1);
  23419. }
  23420. // Update the record in one go.
  23421. destination.record.set(dataObject);
  23422. // If we are at the end of the destination store, break the row loop.
  23423. if (destination.rowIdx === maxRowIdx) {
  23424. break;
  23425. }
  23426. // Jump to next row in destination
  23427. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  23428. }
  23429. },
  23430. putTextData: function (data, format) {
  23431. var _a, _b, _c;
  23432. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  23433. // 根据复制的行数自动添加新的行
  23434. 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;
  23435. if (selected.startCell.rowIdx + values.length >= dataLength) {
  23436. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  23437. this.cmp.getStore().add({});
  23438. }
  23439. }
  23440. this.putCellData(data, format);
  23441. },
  23442. });
  23443. }
  23444. function initDict () {
  23445. var DICT_CACHE = window['DICT_CACHE'];
  23446. if (!DICT_CACHE) {
  23447. DICT_CACHE = {};
  23448. window['DICT_CACHE'] = DICT_CACHE;
  23449. }
  23450. DICT_CACHE.XTYPE = [
  23451. { id: 'datefield', text: '日期' },
  23452. { id: 'datetimefield', text: '日期时间' },
  23453. { id: 'textfield', text: '文本' },
  23454. { id: 'numberfield', text: '数字' },
  23455. { id: 'combo', text: '下拉框' },
  23456. ];
  23457. DICT_CACHE.operator = [
  23458. { id: '=', text: '=' },
  23459. { id: '>', text: '>' },
  23460. { id: '<', text: '<' },
  23461. { id: '>=', text: '>=' },
  23462. { id: '<=', text: '<=' },
  23463. { id: 'in', text: 'in' },
  23464. { id: 'notIn', text: 'notIn' },
  23465. ];
  23466. DICT_CACHE.GRID_MODE = [
  23467. { id: 'edit1', text: '单机编辑模式' },
  23468. { id: 'edit2', text: '双击编辑模式' },
  23469. { id: 'checkbox', text: '勾选' },
  23470. { id: 'checkonly', text: '只勾选' },
  23471. { id: 'select', text: '行选择模式' },
  23472. ];
  23473. DICT_CACHE.BOTH_SELECT = [
  23474. { id: 'N/A', text: '<无>' },
  23475. { id: 'textfield', text: '文本' },
  23476. { id: 'numberfield', text: '数字框' },
  23477. { id: 'datefield', text: '日期' },
  23478. { id: 'datetimefield', text: '日期时间' },
  23479. { id: 'combo', text: '下拉框' },
  23480. { id: 'combogrid', text: '下拉表' },
  23481. { id: 'checkbox', text: '勾选' },
  23482. ];
  23483. DICT_CACHE.ROW_LAYOUT = [
  23484. { id: 'flex', text: '按权重摆放' },
  23485. { id: 'hbox', text: '按宽度摆放' },
  23486. ];
  23487. DICT_CACHE.GRID_XTYPE = [
  23488. { id: 'N/A', text: '<无>' },
  23489. { id: 'textfield', text: '文本-textfield' },
  23490. { id: 'numberfield', text: '数字框-numberfield' },
  23491. { id: 'datefield', text: '日期-datefield' },
  23492. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23493. { id: 'combo', text: '下拉框-combo' },
  23494. { id: 'combogrid', text: '下拉表-combogrid' },
  23495. { id: 'checkbox', text: '勾选-checkbox' },
  23496. ];
  23497. DICT_CACHE.FORM_XTYPE = [
  23498. { id: 'N/A', text: '<无>' },
  23499. { id: 'textfield', text: '文本-textfield' },
  23500. { id: 'numberfield', text: '数字框-numberfield' },
  23501. { id: 'datefield', text: '日期-datefield' },
  23502. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23503. { id: 'combo', text: '下拉框-combo' },
  23504. { id: 'combogrid', text: '下拉表-combogrid' },
  23505. { id: 'checkbox', text: '勾选-checkbox' },
  23506. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  23507. ];
  23508. DICT_CACHE.GRID_FORMATTER = [
  23509. { id: 'N/A', text: '默认' },
  23510. { id: 'rownum', text: '序号-rownum' },
  23511. { id: 'button', text: '按钮-button' },
  23512. { id: 'checkbox', text: '勾选-checkbox' },
  23513. { id: 'progres', text: '进度条-progres' },
  23514. ];
  23515. }
  23516. function initDesigner () {
  23517. Ext.define('com.yvan.studio.designer', {
  23518. extend: 'Ext.panel.Panel',
  23519. alias: 'widget.designer',
  23520. xtype: 'designer',
  23521. layout: 'fit',
  23522. items: [],
  23523. constructor: function (config) {
  23524. var self = this;
  23525. var newConfig = _$2.defaultsDeep({
  23526. // 强制性属性
  23527. }, config);
  23528. this.superclass.constructor.call(self, newConfig);
  23529. },
  23530. initComponent: function () {
  23531. var me = this;
  23532. me.on({
  23533. afterrender: function () {
  23534. }
  23535. });
  23536. this.superclass.initComponent.call(me);
  23537. }
  23538. });
  23539. }
  23540. var FixClass = /** @class */ (function () {
  23541. function FixClass() {
  23542. }
  23543. FixClass.prototype.fix = function (me, config) {
  23544. var _this = this;
  23545. if (isDesignMode(me, config)) {
  23546. return;
  23547. }
  23548. if (!config) {
  23549. return;
  23550. }
  23551. var fix = config.fix;
  23552. if (!fix) {
  23553. return;
  23554. }
  23555. delete config.fix;
  23556. // 这里有个 bug
  23557. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  23558. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  23559. var scope;
  23560. if (config.$initParent) {
  23561. // 在面板上的组件
  23562. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23563. }
  23564. else if (config.column) {
  23565. // 在列上的组件
  23566. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23567. }
  23568. if (_$2.isArray(fix)) {
  23569. _$2.each(fix, function (f) {
  23570. var fn = lookupFn(scope, f);
  23571. fn.call(_this, me, config);
  23572. });
  23573. }
  23574. else if (_$2.isString(fix)) {
  23575. var fn = lookupFn(scope, fix);
  23576. fn.call(this, me, config);
  23577. }
  23578. };
  23579. __decorate([
  23580. baseConfigProcess(),
  23581. __metadata("design:type", Function),
  23582. __metadata("design:paramtypes", [Object, Object]),
  23583. __metadata("design:returntype", void 0)
  23584. ], FixClass.prototype, "fix", null);
  23585. return FixClass;
  23586. }());
  23587. function init$1() {
  23588. // 引入 filters 过滤插件
  23589. Ext.require([
  23590. 'Ext.grid.filters.Filters'
  23591. ]);
  23592. // 启用 tooltip 快捷提示
  23593. Ext.QuickTips.init();
  23594. // 定义日期格式化方法
  23595. if (Ext.util && Ext.util.Format) {
  23596. Ext.apply(Ext.util.Format, {
  23597. dateFormat: 'Y-m-d'
  23598. });
  23599. }
  23600. Ext.form.field.Display.override({
  23601. cls: 'yvan-display-field',
  23602. labelAlign: 'right'
  23603. });
  23604. Ext.define("Ext.locale.zh_CN.picker.Date", {
  23605. override: "Ext.picker.Date",
  23606. format: "Y-m-d",
  23607. });
  23608. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  23609. override: "Ext.form.field.Date",
  23610. format: "Y-m-d",
  23611. });
  23612. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  23613. override: "Ext.grid.PropertyColumnModel",
  23614. format: "Y-m-d",
  23615. });
  23616. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  23617. override: "Ext.view.AbstractView",
  23618. loadingText: "读取中..."
  23619. });
  23620. Ext.LoadMask.prototype.msg = '请稍后...';
  23621. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  23622. override: "Ext.grid.header.Container",
  23623. sortClearText: '不排序',
  23624. sortAscText: "正序",
  23625. sortDescText: "倒序",
  23626. lockText: "锁定列",
  23627. unlockText: "解除锁定",
  23628. columnsText: "字段隐藏"
  23629. });
  23630. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  23631. override: "Ext.grid.filters.filter.Date",
  23632. fields: {
  23633. lt: { text: '之前' },
  23634. gt: { text: '之后' },
  23635. eq: { text: '相等' },
  23636. },
  23637. // Defaults to Ext.Date.defaultFormat
  23638. dateFormat: null
  23639. });
  23640. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  23641. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  23642. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  23643. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  23644. override: "Ext.grid.locking.Lockable",
  23645. lockText: "锁定",
  23646. unlockText: '解锁',
  23647. });
  23648. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  23649. override: "Ext.grid.filters.Filters",
  23650. menuFilterText: "过滤"
  23651. });
  23652. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  23653. override: "Ext.grid.filters.filter.Boolean",
  23654. yesText: "已钩选",
  23655. noText: "未勾选"
  23656. });
  23657. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  23658. override: "Ext.grid.filters.filter.String",
  23659. emptyText: "输入过滤文本..."
  23660. });
  23661. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  23662. override: "Ext.grid.filters.filter.Number",
  23663. emptyText: "输入数字..."
  23664. });
  23665. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  23666. override: "Ext.PagingToolbar",
  23667. beforePageText: "第",
  23668. // update
  23669. afterPageText: "/ {0} 页",
  23670. // update
  23671. firstText: "第一页",
  23672. prevText: "上一页",
  23673. // update
  23674. nextText: "下一页",
  23675. lastText: "最后页",
  23676. refreshText: "刷新",
  23677. displayMsg: "总共 {2} 条",
  23678. // update
  23679. emptyMsg: '没有数据'
  23680. });
  23681. /**
  23682. * 改变事件的获取方式.
  23683. * 具体见: ext-all-debug.js:23216 addListener
  23684. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  23685. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  23686. */
  23687. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  23688. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  23689. if (typeof fn === 'string' &&
  23690. (_$2.startsWith(fn, 'scope.') ||
  23691. _$2.startsWith(fn, 'system.') ||
  23692. _$2.startsWith(fn, 'format.'))) {
  23693. scope = lookupScope(this);
  23694. if (isDesignMode(scope, undefined)) {
  23695. fn = Ext.emptyFn;
  23696. }
  23697. else {
  23698. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  23699. // const vm = this.lookupViewModel()
  23700. // if (vm && vm.yvanScope) {
  23701. // scope = vm.yvanScope
  23702. // fn = scope[fn.substr('scope.'.length)]
  23703. // }
  23704. fn = lookupFn(scope, fn, this);
  23705. }
  23706. }
  23707. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  23708. };
  23709. // 将 SystemLib 扩展到 window.system 下
  23710. if (!window['system']) {
  23711. window['system'] = {};
  23712. }
  23713. _$2.extend(window['system'], SystemLib);
  23714. _$2.extend(window['system'], {
  23715. showGridRowDetail: showGridRowDetail
  23716. });
  23717. Ext.apply(Ext.util.Format, {
  23718. // 百分比
  23719. percentRenderer: function (v, rd, model) {
  23720. if (!v) {
  23721. v = 0;
  23722. }
  23723. if (typeof v === 'string') {
  23724. v = parseInt(v);
  23725. }
  23726. var valueString = v.toFixed(2);
  23727. var valueFixed = v > 100 ? 100 : v;
  23728. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  23729. var cls = '';
  23730. if (v < 90) {
  23731. cls = 'danger';
  23732. }
  23733. else if (v < 100) {
  23734. cls = 'warning';
  23735. }
  23736. else {
  23737. cls = 'success';
  23738. }
  23739. return Ext.String
  23740. .format(
  23741. // '<div>'
  23742. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  23743. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  23744. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  23745. // + '</div></div>', valueString, valueFixed, cls);
  23746. '<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(
  23747. // '<div>'
  23748. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  23749. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  23750. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  23751. // + '</div></div>', v, valueFixed, valueString);
  23752. },
  23753. //button
  23754. button: function (v, rd, model) {
  23755. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  23756. }
  23757. });
  23758. initComponent();
  23759. initPanel();
  23760. initGridColumn();
  23761. initTree();
  23762. initGrid();
  23763. initMainTab();
  23764. initTextfield();
  23765. initCombo();
  23766. initTag();
  23767. initContainer();
  23768. initRows();
  23769. initCols();
  23770. initForm();
  23771. initToolbar();
  23772. initSplitter();
  23773. initButton();
  23774. initStores();
  23775. initSearch();
  23776. initMultipleSearch();
  23777. initDate();
  23778. initDateTimePicker();
  23779. initDateTime();
  23780. initNumber();
  23781. initCheckbox();
  23782. initCheckboxGroup();
  23783. initRadio();
  23784. initRadioGroup();
  23785. initFieldset();
  23786. initCombotree();
  23787. initPickerPlus();
  23788. initCombogrid();
  23789. initComboGridMulti();
  23790. initIframe();
  23791. initBpmn();
  23792. initSqlEditor();
  23793. initJsonEditor();
  23794. initJsEditor();
  23795. initClipboard();
  23796. initSqlComplex();
  23797. initParamComplex();
  23798. initDict();
  23799. initDesigner();
  23800. }
  23801. /**
  23802. * 创建一个 Ajax 客户端
  23803. */
  23804. function createAjax(createOption) {
  23805. if (createOption.baseUrl) {
  23806. axios__default.defaults.baseURL = createOption.baseUrl;
  23807. axios__default.defaults.timeout = createOption.timeout;
  23808. storeAjax.timeout = createOption.timeout;
  23809. axios__default.defaults.timeoutErrorMessage = '网络超时';
  23810. }
  23811. return function (option) {
  23812. //@ts-ignore
  23813. option.method = (option.method || 'get').toLocaleLowerCase();
  23814. //@ts-ignore
  23815. var ax = __assign({}, option);
  23816. switch (option.method) {
  23817. case 'get':
  23818. ax.method = 'GET';
  23819. ax.params = option.param;
  23820. ax.headers = __assign({}, option.headers);
  23821. break;
  23822. case 'post':
  23823. ax.method = 'POST';
  23824. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  23825. ax.params = option.param;
  23826. ax.data = Qs.stringify(option.data);
  23827. break;
  23828. case 'put':
  23829. case 'patch':
  23830. case 'delete':
  23831. ax.method = option.method;
  23832. ax.headers = option.headers;
  23833. ax.params = option.param;
  23834. ax.data = Qs.stringify(option.data);
  23835. break;
  23836. case 'download':
  23837. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  23838. return new Promise(function (resolver, reject) {
  23839. });
  23840. case "invoke":
  23841. ax.url = serverInvokeUrlTransform(option.url, option);
  23842. ax.method = 'POST';
  23843. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23844. if (typeof option.args === 'object') {
  23845. ax.data = JSON.stringify({
  23846. args: option.args,
  23847. });
  23848. }
  23849. else {
  23850. ax.data = JSON.stringify({
  23851. args: [
  23852. __assign(__assign({}, option.data), option.param)
  23853. ],
  23854. filterModel: option.filterModel,
  23855. sortModel: option.sortModel
  23856. });
  23857. }
  23858. break;
  23859. case 'post-json':
  23860. ax.method = 'POST';
  23861. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23862. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  23863. break;
  23864. case 'post-file':
  23865. //TODO 刘壮. 上传文件
  23866. var forms = new FormData();
  23867. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  23868. _$2.forOwn(option.data, function (value, key) {
  23869. if (key === 'files') {
  23870. var i_1 = 0;
  23871. _$2.each(value, function (f) {
  23872. // @ts-ignore
  23873. forms.append('file' + (++i_1), f);
  23874. });
  23875. }
  23876. else {
  23877. forms.append(key, value);
  23878. }
  23879. });
  23880. ax.data = forms;
  23881. ax.method = 'POST';
  23882. break;
  23883. case "sql":
  23884. ax.url = sqlUrlTransform(option.url);
  23885. ax.method = 'POST';
  23886. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23887. ax.data = JSON.stringify({
  23888. args: [option.data],
  23889. db: option.db,
  23890. filterModel: option.filterModel,
  23891. sortModel: option.sortModel
  23892. });
  23893. break;
  23894. default:
  23895. throw new Error('not implements');
  23896. }
  23897. return new Promise(function (resolver, reject) {
  23898. axios__default(ax).then(function (resolverRaw) {
  23899. var apiResult = {
  23900. rawData: resolverRaw.data,
  23901. status: resolverRaw.status,
  23902. success: (resolverRaw.data && resolverRaw.data.success),
  23903. data: resolverRaw.data.data,
  23904. pagination: resolverRaw.data.pagination,
  23905. msg: (resolverRaw.data.msg),
  23906. errors: resolverRaw.data.errors,
  23907. headers: resolverRaw.headers
  23908. };
  23909. if (typeof window['apiTranslate'] === 'function') {
  23910. window['apiTranslate'](apiResult.rawData, option.url);
  23911. }
  23912. resolver(apiResult);
  23913. }).catch(function (reason) {
  23914. reject(reason);
  23915. });
  23916. });
  23917. };
  23918. }
  23919. function downLoad(downLoadUrl, filename, data, header, isJson) {
  23920. if (isJson === void 0) { isJson = false; }
  23921. var YvanUI = _$2.get(window, 'YvanUI');
  23922. YvanUI.loading();
  23923. var createObjectURL = function (object) {
  23924. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  23925. };
  23926. // const formData = new FormData();
  23927. // _.forOwn(data, (v, k) => {
  23928. // formData.append(k, v);
  23929. // });
  23930. var formData = '';
  23931. var xhr = new XMLHttpRequest();
  23932. xhr.open('POST', downLoadUrl);
  23933. xhr.responseType = 'blob';
  23934. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  23935. if (isJson) {
  23936. formData = data ? JSON.stringify(data) : '';
  23937. xhr.setRequestHeader('Content-Type', 'application/json');
  23938. }
  23939. else {
  23940. formData = data ? Qs.stringify(data) : '';
  23941. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  23942. }
  23943. //
  23944. if (header) {
  23945. _$2.forOwn(header, function (v, k) {
  23946. xhr.setRequestHeader(k, v);
  23947. });
  23948. }
  23949. xhr.onload = function (e) {
  23950. if (this.status === 200) {
  23951. var blob = this.response;
  23952. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  23953. navigator.msSaveBlob(blob, filename);
  23954. YvanUI.clearLoading();
  23955. }
  23956. else {
  23957. var a = document.createElement('a');
  23958. var url = createObjectURL(blob);
  23959. a.href = url;
  23960. a.download = filename;
  23961. document.append(a);
  23962. a.click();
  23963. a.remove();
  23964. window.URL.revokeObjectURL(url);
  23965. YvanUI.clearLoading();
  23966. }
  23967. }
  23968. };
  23969. xhr.send(formData);
  23970. }
  23971. function readExcel(file) {
  23972. return new Promise(function (resolve, reject) {
  23973. if (!file) {
  23974. reject("文件读取失败!!!");
  23975. return;
  23976. }
  23977. var reader = new FileReader();
  23978. reader.onload = function (e) {
  23979. if (e.target) {
  23980. var data = e.target.result;
  23981. var workbook = XLSX.read(data, { type: 'binary' });
  23982. resolve(workbook);
  23983. }
  23984. else {
  23985. reject("文件读取失败!!!");
  23986. }
  23987. };
  23988. try {
  23989. reader.readAsBinaryString(file);
  23990. }
  23991. catch (e) {
  23992. reject(e);
  23993. }
  23994. });
  23995. }
  23996. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  23997. if (dataStartRow === void 0) { dataStartRow = 2; }
  23998. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  23999. if (rowValidate === void 0) { rowValidate = undefined; }
  24000. if (otherValidate === void 0) { otherValidate = undefined; }
  24001. if (fieldValidate === void 0) { fieldValidate = undefined; }
  24002. return new Promise(function (resolve, reject) {
  24003. var promiseArr = [];
  24004. for (var i = 0; i < columnsSet.length; i++) {
  24005. var fix = columnsSet[i].fix;
  24006. if (_$2.isArray(fix) && fix.length > 0) {
  24007. var ss = fix[0].toLowerCase();
  24008. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24009. columnsSet[i].importFormatter = function (vdata) {
  24010. // @ts-ignore
  24011. return window.moment(vdata.ov) - 0;
  24012. };
  24013. }
  24014. else {
  24015. var fn = lookupFn(topScope, fix[0]);
  24016. promiseArr.push(fn(null, columnsSet[i]));
  24017. delete columnsSet[i].fix;
  24018. }
  24019. }
  24020. else if (_$2.isString(fix)) {
  24021. var ss = fix.toLowerCase();
  24022. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24023. columnsSet[i].importFormatter = function (vdata) {
  24024. // @ts-ignore
  24025. return window.moment(vdata.ov) - 0;
  24026. };
  24027. }
  24028. else {
  24029. var fn = lookupFn(topScope, fix);
  24030. promiseArr.push(fn(null, columnsSet[i]));
  24031. delete columnsSet[i].fix;
  24032. }
  24033. }
  24034. }
  24035. var read = function () {
  24036. readExcel(file).then(function (workbook) {
  24037. var sheetNames = workbook.SheetNames; // 工作表名称集合
  24038. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  24039. var titleRowValue = [];
  24040. var titleRowKey = [];
  24041. var needLoop = false; // 是否需要迭代
  24042. var columns = [];
  24043. if (worksheet && worksheet["!ref"]) {
  24044. var t = worksheet["!ref"];
  24045. var tempArr = t.split(':');
  24046. if (tempArr.length >= 2) {
  24047. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  24048. // 选取title的行,删除之前的行
  24049. if (titleRowNumber > firstRowNumber) {
  24050. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  24051. for (var key in worksheet) {
  24052. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  24053. delete worksheet[key];
  24054. }
  24055. }
  24056. }
  24057. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  24058. firstRowNumber = titleRowNumber + '';
  24059. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  24060. }
  24061. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  24062. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  24063. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  24064. for (var key in worksheet) {
  24065. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  24066. titleRowKey.push(key);
  24067. titleRowValue.push(worksheet[key].v);
  24068. }
  24069. }
  24070. if (columnsSet && columnsSet.length > 0) {
  24071. var length = columnsSet.length;
  24072. length = length <= titleRowKey.length ? length : titleRowKey.length;
  24073. for (var i = 0; i < length; i++) {
  24074. var vk = titleRowKey[i];
  24075. var item = columnsSet[i];
  24076. var column = {};
  24077. if (typeof item === 'string') {
  24078. column.dataIndex = item;
  24079. column.header = worksheet[vk].v;
  24080. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  24081. }
  24082. else if (typeof item.dataIndex === "string") {
  24083. column.dataIndex = item.dataIndex;
  24084. column.header = worksheet[vk].v;
  24085. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  24086. if (typeof item.validate === "function") {
  24087. column.validate = item.validate;
  24088. needLoop = true;
  24089. }
  24090. if (typeof item.importFormatter === "function") {
  24091. column.importFormatter = item.importFormatter;
  24092. needLoop = true;
  24093. }
  24094. if ((item.data instanceof Array && item.data.length > 0)
  24095. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  24096. column.data = item.data;
  24097. needLoop = true;
  24098. }
  24099. }
  24100. columns.push(column);
  24101. }
  24102. }
  24103. }
  24104. }
  24105. if (fieldValidate && typeof fieldValidate === "function") {
  24106. if (fieldValidate(columns, titleRowValue) !== true) {
  24107. reject("fields validate error");
  24108. return;
  24109. }
  24110. }
  24111. var allData = XLSX.utils.sheet_to_json(worksheet);
  24112. var okData = [], errorData = [], errorMsgData = [];
  24113. var needItemLoop = needLoop;
  24114. if (rowValidate && typeof rowValidate === "function") {
  24115. needLoop = true;
  24116. }
  24117. if (needLoop === true) {
  24118. for (var index = 0; index < allData.length; index++) {
  24119. var row = allData[index];
  24120. var rowNumber = dataStartRow + index;
  24121. row.__importID__ = rowNumber;
  24122. var isRowOk = true;
  24123. if (needItemLoop) {
  24124. var _loop_1 = function (num) {
  24125. var column = columns[num];
  24126. var ov = row[column.dataIndex];
  24127. var nv = ov;
  24128. var hasError = false;
  24129. var rowNumber_1 = dataStartRow + index;
  24130. var ei = {
  24131. errorId: rowNumber_1 + '_' + column.dataIndex,
  24132. importID: rowNumber_1,
  24133. dataIndex: column.dataIndex,
  24134. header: column.header,
  24135. value: ov,
  24136. errormessage: ""
  24137. };
  24138. // 格式化
  24139. if (column.data instanceof Array) {
  24140. nv = undefined;
  24141. ei.errormessage = "字典匹配失败";
  24142. _$2.forEach(column.data, function (v, index) {
  24143. if (v.text === ov) {
  24144. nv = v.id;
  24145. return;
  24146. }
  24147. });
  24148. }
  24149. else if (_$2.isPlainObject(column.data)) {
  24150. nv = undefined;
  24151. ei.errormessage = "字典匹配失败";
  24152. _$2.forEach(column.data, function (value, key) {
  24153. if (value === ov) {
  24154. nv = key;
  24155. return;
  24156. }
  24157. });
  24158. }
  24159. if (typeof column.importFormatter === 'function') {
  24160. var vdata = {
  24161. column: column,
  24162. ov: ov,
  24163. nv: nv,
  24164. rowIndex: index,
  24165. data: row,
  24166. rowDatas: allData
  24167. };
  24168. nv = undefined;
  24169. ei.errormessage = "格式化失败";
  24170. nv = column.importFormatter(vdata);
  24171. }
  24172. if (!nv && nv != 0) {
  24173. hasError = true;
  24174. }
  24175. else {
  24176. row[column.dataIndex] = nv;
  24177. ei.errormessage = "";
  24178. }
  24179. // 校验
  24180. if (typeof column.validate === 'function') {
  24181. var vdata = {
  24182. column: column,
  24183. ov: ov,
  24184. nv: nv,
  24185. rowIndex: index,
  24186. data: row,
  24187. rowDatas: allData
  24188. };
  24189. var errormessage = column.validate(vdata);
  24190. if (errormessage === true) ;
  24191. else {
  24192. hasError = true;
  24193. ei.errormessage = ei.errormessage + "/" + errormessage;
  24194. }
  24195. }
  24196. if (hasError === true) {
  24197. isRowOk = false;
  24198. errorMsgData.push(ei);
  24199. }
  24200. };
  24201. for (var num = 0; num < columns.length; num++) {
  24202. _loop_1(num);
  24203. }
  24204. }
  24205. if (rowValidate && typeof rowValidate === "function") {
  24206. var errormessage = rowValidate({
  24207. columns: columns,
  24208. data: row,
  24209. rowIndex: index,
  24210. rowDatas: allData
  24211. });
  24212. if (errormessage === true) ;
  24213. else {
  24214. isRowOk = false;
  24215. var ei = {
  24216. errorId: rowNumber + '',
  24217. dataIndex: "row",
  24218. header: "数据行",
  24219. value: "当前行的数据",
  24220. importID: rowNumber,
  24221. errormessage: errormessage
  24222. };
  24223. errorMsgData.push(ei);
  24224. }
  24225. }
  24226. row.__hasError__ = !isRowOk;
  24227. if (isRowOk === true) {
  24228. okData.push(row);
  24229. }
  24230. else {
  24231. errorData.push(row);
  24232. }
  24233. }
  24234. }
  24235. else {
  24236. // 添加数据的唯一标识
  24237. for (var index = 0; index < allData.length; index++) {
  24238. var row = allData[index];
  24239. var rowNumber = dataStartRow + index;
  24240. row.__importID__ = rowNumber;
  24241. row.__hasError__ = false;
  24242. }
  24243. okData = allData;
  24244. }
  24245. if (otherValidate && typeof otherValidate === "function") {
  24246. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  24247. }
  24248. else {
  24249. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  24250. }
  24251. // clearLoading()
  24252. }).catch(function (e) {
  24253. reject(e);
  24254. });
  24255. };
  24256. if (promiseArr.length > 0) {
  24257. Promise.all(promiseArr).then(function (resArr) {
  24258. for (var i = 0; i < resArr.length; i++) {
  24259. var tmp = resArr[i];
  24260. tmp.config.data = [];
  24261. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  24262. if (tmp.r.field.length > 1) {
  24263. var keyKey = tmp.r.field[0];
  24264. var valueKey = tmp.r.field[1];
  24265. for (var j = 0; j < tmp.r.data.length; j++) {
  24266. var it = tmp.r.data[j];
  24267. var newIt = {};
  24268. newIt.id = it[keyKey];
  24269. newIt.text = it[valueKey];
  24270. tmp.config.data.push(newIt);
  24271. }
  24272. }
  24273. }
  24274. }
  24275. read();
  24276. });
  24277. }
  24278. else {
  24279. setTimeout(read, 50);
  24280. }
  24281. });
  24282. }
  24283. var ExcelImportDialog = /** @class */ (function (_super) {
  24284. __extends(ExcelImportDialog, _super);
  24285. function ExcelImportDialog(option) {
  24286. var _this = this;
  24287. var vjson = vjsonFunc(option);
  24288. _this = _super.call(this, { model: model$d, vjson: vjson }) || this;
  24289. _this.importExcelOption = option;
  24290. return _this;
  24291. }
  24292. ExcelImportDialog.prototype.onLoad = function () {
  24293. _super.prototype.onLoad.call(this);
  24294. };
  24295. ExcelImportDialog.prototype.fileChange = function (sender) {
  24296. var _this = this;
  24297. var file = sender.fileInputEl.dom.files[0];
  24298. // const senderScope = lookupScope(sender)
  24299. var topScope = this.topScope;
  24300. var rowValidate = this.importExcelOption.rowValidate;
  24301. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  24302. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  24303. }
  24304. var afterClientValidate = this.importExcelOption.afterClientValidate;
  24305. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  24306. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  24307. }
  24308. var fieldValidate = this.importExcelOption.fieldValidate;
  24309. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  24310. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  24311. }
  24312. this.setLoading(true);
  24313. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  24314. _this.importData = res;
  24315. _this.refs.dataGrid.setData(res.allData);
  24316. _this.viewModel.set("dataCount", res.allData.length);
  24317. _this.refs.errGrid.setData(res.errorMsgData);
  24318. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  24319. }).catch(function (e) {
  24320. _this.importData = null;
  24321. _this.refs.dataGrid.setData();
  24322. _this.refs.errGrid.setData();
  24323. msg(e.toString());
  24324. }).finally(function () {
  24325. _this.setLoading(false);
  24326. });
  24327. };
  24328. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  24329. if (record.get('__hasError__')) {
  24330. return "x-grid-record-bg-red";
  24331. }
  24332. };
  24333. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  24334. return "x-grid-record-bg-red";
  24335. };
  24336. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  24337. var _a;
  24338. var id = record.data.__importID__;
  24339. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  24340. var selectRecord = null;
  24341. var dataIndex = -1;
  24342. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24343. for (var i = 0; i < rows.length; i++) {
  24344. if (rows[i].importID === id) {
  24345. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24346. dataIndex = i;
  24347. }
  24348. if (rows[i].errorId === id + "_" + subId) {
  24349. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24350. dataIndex = i;
  24351. break;
  24352. }
  24353. }
  24354. if (selectRecord) {
  24355. this.refs.errGrid.ensureVisible(selectRecord);
  24356. this.refs.errGrid.selModel.select(dataIndex);
  24357. // this.refs.errGrid.reload()
  24358. }
  24359. };
  24360. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  24361. var _a;
  24362. var id = record.data.importID;
  24363. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24364. var selectRecord = null;
  24365. var dataIndex = -1;
  24366. for (var i = 0; i < rows.length; i++) {
  24367. if (rows[i].__importID__ === id) {
  24368. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  24369. dataIndex = i;
  24370. break;
  24371. }
  24372. }
  24373. if (selectRecord) {
  24374. this.refs.dataGrid.ensureVisible(selectRecord);
  24375. this.refs.dataGrid.selModel.select(dataIndex);
  24376. // this.refs.dataGrid.reload()
  24377. }
  24378. };
  24379. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  24380. this.viewModel.set("dataType", newValue);
  24381. if (this.importData) {
  24382. this.refs.dataGrid.setData(this.importData[newValue]);
  24383. this.viewModel.set("dataCount", this.importData[newValue].length);
  24384. }
  24385. };
  24386. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  24387. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  24388. window.location.href = this.importExcelOption.dowLoadUrl;
  24389. return;
  24390. }
  24391. var xt = [];
  24392. _$2.forEach(this.importExcelOption.columns, function (v) {
  24393. xt.push(v.header);
  24394. });
  24395. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  24396. if (filename.endsWith(".xlsx")) {
  24397. filename = filename.split(".xlsx")[0];
  24398. }
  24399. filename = filename + ".xlsx";
  24400. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  24401. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  24402. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  24403. XLSX.writeFile(wb, filename); //导出Excel
  24404. };
  24405. ExcelImportDialog.prototype.getData = function (sender) {
  24406. _$2.each(this.importData.okData, function (item) {
  24407. delete item.id;
  24408. delete item.__hasError__;
  24409. delete item.__importID__;
  24410. delete item._origin;
  24411. });
  24412. _$2.each(this.importData.allData, function (item) {
  24413. delete item.id;
  24414. delete item.__hasError__;
  24415. delete item.__importID__;
  24416. delete item._origin;
  24417. });
  24418. _$2.each(this.importData.errorData, function (item) {
  24419. delete item.id;
  24420. delete item.__hasError__;
  24421. delete item.__importID__;
  24422. delete item._origin;
  24423. });
  24424. this.dialogSuccess(this.importData);
  24425. };
  24426. return ExcelImportDialog;
  24427. }(Scope));
  24428. var model$d = {
  24429. data: {
  24430. dataType: "all",
  24431. errMsgCount: 0,
  24432. dataCount: 0
  24433. }
  24434. };
  24435. var vjsonFunc = function (option) {
  24436. return {
  24437. title: option.title || 'excel导入',
  24438. layout: 'fit',
  24439. items: [
  24440. {
  24441. layout: 'border',
  24442. tbar: {
  24443. xtype: "form",
  24444. items: [
  24445. {
  24446. xtype: "cols",
  24447. items: [
  24448. {
  24449. xtype: "filefield",
  24450. fieldLabel: 'excel文件',
  24451. buttonText: '请选择excel文件',
  24452. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  24453. flex: 3,
  24454. listeners: {
  24455. change: "scope.fileChange"
  24456. }
  24457. }, {
  24458. xtype: "button",
  24459. iconCls: "x-fa fa-download",
  24460. text: "下载模版",
  24461. listeners: {
  24462. click: "scope.downloadTemplate"
  24463. }
  24464. }, {
  24465. xtype: 'container',
  24466. border: false,
  24467. layout: 'hbox',
  24468. }, {
  24469. xtype: "button",
  24470. iconCls: "x-fa fa-upload",
  24471. text: option.tQButtonText || "提取数据",
  24472. listeners: {
  24473. click: "scope.getData"
  24474. }
  24475. }
  24476. ]
  24477. },
  24478. ]
  24479. },
  24480. items: [
  24481. {
  24482. tbar: {
  24483. xtype: "toolbar",
  24484. title: "导入的数据",
  24485. items: [{
  24486. xtype: 'label',
  24487. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  24488. }, {
  24489. xtype: 'radiogroup',
  24490. items: [
  24491. {
  24492. boxLabel: '所有数据',
  24493. checked: true,
  24494. inputValue: 'allData',
  24495. }, {
  24496. boxLabel: '正确数据',
  24497. inputValue: 'okData',
  24498. }, {
  24499. boxLabel: '错误数据',
  24500. inputValue: 'errorData',
  24501. }
  24502. ],
  24503. listeners: {
  24504. change: 'scope.filterData',
  24505. },
  24506. }, {
  24507. xtype: "textfield",
  24508. readOnly: true,
  24509. fieldLabel: "条目数",
  24510. bind: "{dataCount}"
  24511. }]
  24512. },
  24513. xtype: 'yvgrid',
  24514. reference: 'dataGrid',
  24515. layout: 'fit',
  24516. pagination: false,
  24517. // pageSize: 50,
  24518. getRowClass: 'scope.getDataGridRowRecord',
  24519. columns: option.columns,
  24520. region: 'center',
  24521. split: true,
  24522. listeners: {
  24523. cellclick: "scope.dataGridClick",
  24524. },
  24525. selModel: {
  24526. // type: 'rowmodel',
  24527. mode: 'SINGLE',
  24528. },
  24529. }, {
  24530. tbar: {
  24531. xtype: "toolbar", items: [
  24532. {
  24533. xtype: 'label',
  24534. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  24535. }, {
  24536. xtype: "textfield",
  24537. readOnly: true,
  24538. fieldLabel: "条目数",
  24539. bind: "{errMsgCount}"
  24540. }
  24541. ]
  24542. },
  24543. xtype: 'yvgrid',
  24544. reference: 'errGrid',
  24545. layout: 'fit',
  24546. pagination: false,
  24547. getRowClass: 'scope.getErrGridRowRecord',
  24548. height: "40%",
  24549. columns: [
  24550. { dataIndex: "errorId", header: "ID", hidden: true },
  24551. { dataIndex: "importID", header: "行号", width: 80 },
  24552. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  24553. { dataIndex: "value", header: "值", width: 120 },
  24554. { dataIndex: "header", header: "字段名", width: 120 },
  24555. { dataIndex: "dataIndex", header: "字段", width: 120 }
  24556. ],
  24557. region: 'south',
  24558. split: true,
  24559. listeners: {
  24560. itemclick: "scope.errGridClick"
  24561. },
  24562. selModel: {
  24563. // type: 'rowmodel',
  24564. mode: 'SINGLE',
  24565. },
  24566. },
  24567. ],
  24568. },
  24569. ],
  24570. referenceHolder: true,
  24571. };
  24572. };
  24573. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  24574. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  24575. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  24576. ret.report_id = reportId;
  24577. ret.report = report;
  24578. return ret;
  24579. }
  24580. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  24581. var e_1, _a, e_2, _b;
  24582. var model = {
  24583. data: {
  24584. report_name: config.report_name,
  24585. query: {},
  24586. sum: {},
  24587. }
  24588. };
  24589. var json5 = window['YvanUI'].json5;
  24590. var report = config.report ? json5.parse(config.report) : {};
  24591. var conditionRows = [];
  24592. var sumRows = [];
  24593. model.data.has_sum = _$2.size(report.summary) > 0;
  24594. // query 查询条件
  24595. var newRow = false;
  24596. var currentRow = { xtype: 'cols', items: [], };
  24597. conditionRows.push(currentRow);
  24598. _$2.forEach(report.query, function (item) {
  24599. if (newRow) {
  24600. currentRow = { xtype: 'cols', items: [], };
  24601. conditionRows.push(currentRow);
  24602. }
  24603. var vj = json5.parse(item.conditionFieldExtend);
  24604. if (item.conditionFieldXtype) {
  24605. vj.xtype = item.conditionFieldXtype;
  24606. if (item.conditionFieldXtype === 'combo') {
  24607. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  24608. }
  24609. if (item.conditionFieldXtype === 'datetimefield') {
  24610. // console.log("#####", item)
  24611. if ((item === null || item === void 0 ? void 0 : item.conditionFieldBind) === "start_time") {
  24612. //@ts-ignore
  24613. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD 00:00:00'));
  24614. }
  24615. else if ((item === null || item === void 0 ? void 0 : item.conditionFieldBind) === "end_time") {
  24616. //@ts-ignore
  24617. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).add(1, 'days').format('YYYY-MM-DD 00:00:00'));
  24618. }
  24619. else {
  24620. //@ts-ignore
  24621. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD 00:00:00'));
  24622. }
  24623. }
  24624. else if (item.conditionFieldXtype === 'datefield') {
  24625. //@ts-ignore
  24626. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  24627. }
  24628. else {
  24629. model.data.query[item.conditionFieldBind] = '';
  24630. }
  24631. }
  24632. else {
  24633. // 没有组件类型,是个空占位符
  24634. vj.border = false;
  24635. }
  24636. if (item.conditionFieldBind) {
  24637. vj.bind = {
  24638. value: '{query.' + item.conditionFieldBind + '}'
  24639. };
  24640. }
  24641. if (item.conditionFieldFlex) {
  24642. vj.flex = item.conditionFieldFlex;
  24643. }
  24644. if (item.conditionFieldXtype) {
  24645. vj.fieldLabel = item.conditionFieldLabel;
  24646. }
  24647. if (item.fieldLabel) {
  24648. vj.fieldLabel = item.fieldLabel;
  24649. }
  24650. newRow = item.conditionFieldWrap || false;
  24651. currentRow.items.push(vj);
  24652. });
  24653. if (currentRow) {
  24654. currentRow.margin = '10 0 10 0';
  24655. }
  24656. // sum 汇总条件
  24657. newRow = true;
  24658. try {
  24659. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  24660. var item = _d.value;
  24661. if (newRow) {
  24662. currentRow = {
  24663. xtype: 'cols',
  24664. defaultType: 'displayfield',
  24665. defaults: {
  24666. labelWidth: 70,
  24667. },
  24668. items: []
  24669. };
  24670. sumRows.push(currentRow);
  24671. }
  24672. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  24673. if (item.sumFieldBind) {
  24674. vj.bind = '{sum.' + item.sumFieldBind + '}';
  24675. model.data.sum[item.sumFieldBind] = '';
  24676. }
  24677. else {
  24678. // 没有组件类型,是个空占位符
  24679. vj.border = false;
  24680. }
  24681. if (item.sumFieldFlex) {
  24682. vj.flex = item.sumFieldFlex;
  24683. }
  24684. if (item.sumFieldLabel) {
  24685. vj.fieldLabel = item.sumFieldLabel;
  24686. }
  24687. // sumFieldBind: "zs"
  24688. // sumFieldExtend: "{}"
  24689. // sumFieldFlex: 1
  24690. // sumFieldLabel: "总数"
  24691. // sumFieldWrap: false
  24692. newRow = item.sumFieldWrap || false;
  24693. currentRow.items.push(vj);
  24694. }
  24695. }
  24696. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  24697. finally {
  24698. try {
  24699. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  24700. }
  24701. finally { if (e_1) throw e_1.error; }
  24702. }
  24703. if (currentRow) {
  24704. currentRow.margin = '10 0 10 0';
  24705. }
  24706. // column 结果字段
  24707. var columns = [];
  24708. try {
  24709. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  24710. var item = _f.value;
  24711. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  24712. if (item.xtype) {
  24713. if (item.xtype == 'checkbox') {
  24714. vj.xtype = 'checkcolumn';
  24715. vj.disabled = true;
  24716. }
  24717. else {
  24718. vj.xtype = item.xtype;
  24719. }
  24720. }
  24721. if (item.dataType) {
  24722. vj.dataType = item.dataType;
  24723. }
  24724. if (item.align) {
  24725. vj.align = item.align;
  24726. }
  24727. if (item.width) {
  24728. vj.width = item.width;
  24729. }
  24730. if (item.dict) {
  24731. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  24732. }
  24733. columns.push(vj);
  24734. }
  24735. }
  24736. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  24737. finally {
  24738. try {
  24739. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  24740. }
  24741. finally { if (e_2) throw e_2.error; }
  24742. }
  24743. var vjson = {
  24744. bind: {
  24745. title: '{report_name}',
  24746. },
  24747. layout: 'fit',
  24748. referenceHolder: true,
  24749. items: [
  24750. {
  24751. layout: 'border',
  24752. border: false,
  24753. items: [
  24754. {
  24755. region: 'north',
  24756. border: false,
  24757. tbar: {
  24758. xtype: 'toolbar',
  24759. border: false,
  24760. items: [
  24761. {
  24762. xtype: 'button',
  24763. text: '查询',
  24764. reference: 'btnSearch',
  24765. iconCls: 'x-fa fa-search',
  24766. listeners: {
  24767. click: 'scope.reload',
  24768. },
  24769. },
  24770. {
  24771. xtype: 'button',
  24772. text: '关闭',
  24773. iconCls: 'x-fa fa-times',
  24774. listeners: {
  24775. click: 'system.closeMe()',
  24776. },
  24777. },
  24778. ],
  24779. },
  24780. defaults: {
  24781. margin: '8 0 0 0'
  24782. },
  24783. items: __spread(conditionRows, sumRows),
  24784. fix: ['system.enterToClick("btnSearch")'],
  24785. },
  24786. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  24787. method: 'invoke',
  24788. url: '/report/Report@execute',
  24789. params: {
  24790. dataSource: report.dataSource,
  24791. pagination: report.grid.pagination || true,
  24792. report_id: config.report_id,
  24793. query: '{query}',
  24794. },
  24795. }, columns: columns }, report.grid),
  24796. ],
  24797. },
  24798. ],
  24799. };
  24800. return { model: model, vjson: vjson, report: report };
  24801. }
  24802. var ReportScope = /** @class */ (function (_super) {
  24803. __extends(ReportScope, _super);
  24804. function ReportScope(_a, invokeServerFn) {
  24805. var model = _a.model, vjson = _a.vjson;
  24806. var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this;
  24807. _this.invokeServerFn = invokeServerFn;
  24808. return _this;
  24809. }
  24810. ReportScope.prototype.onLoad = function () {
  24811. // this.reload()
  24812. };
  24813. ReportScope.prototype.reload = function () {
  24814. var _this = this;
  24815. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  24816. if (this.viewModel.get('has_sum')) {
  24817. this.invokeServerFn('/report/Report@executeSum', {
  24818. dataSource: this.report.dataSource,
  24819. report_id: this.report_id,
  24820. query: this.viewModel.get('query'),
  24821. }).then(function (res) {
  24822. if (!res.success) {
  24823. showErrorDialog$1(res.msg);
  24824. }
  24825. else {
  24826. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  24827. }
  24828. });
  24829. }
  24830. this.refs.grid1.reload();
  24831. };
  24832. return ReportScope;
  24833. }(Scope));
  24834. var model$e = {
  24835. data: {
  24836. form: {
  24837. resource_parent: '',
  24838. resource_name: '',
  24839. resource_icon: '',
  24840. scope_url: '',
  24841. scope_params: '',
  24842. resource_order: '',
  24843. permission_code: '',
  24844. },
  24845. }
  24846. };
  24847. var vjson$d = {
  24848. title: '注册模块',
  24849. layout: 'fit',
  24850. width: "40%",
  24851. height: "50%",
  24852. fbar: {
  24853. xtype: 'toolbar',
  24854. items: [
  24855. {
  24856. xtype: "button",
  24857. text: "确定",
  24858. iconCls: 'x-fa fa-check',
  24859. listeners: {
  24860. click: 'scope.saveNode',
  24861. }
  24862. },
  24863. {
  24864. xtype: "button",
  24865. text: "关闭",
  24866. iconCls: 'x-fa fa-times',
  24867. listeners: {
  24868. click: 'system.closeMe()',
  24869. }
  24870. },
  24871. ]
  24872. },
  24873. items: [
  24874. {
  24875. layout: 'border',
  24876. items: [
  24877. {
  24878. region: 'west',
  24879. layout: 'fit',
  24880. xtype: 'tabpanel',
  24881. reference: 'tabs',
  24882. width: "50%",
  24883. split: true,
  24884. listeners: {
  24885. tabchange: 'scope.tabchange',
  24886. },
  24887. items: [
  24888. {
  24889. region: 'center',
  24890. layout: 'fit',
  24891. title: 'PC菜单',
  24892. key: "1",
  24893. items: [
  24894. {
  24895. xtype: 'treepanel',
  24896. layout: 'fit',
  24897. region: 'west',
  24898. rootVisible: false,
  24899. useArrows: true,
  24900. reference: 'tree1',
  24901. listeners: {
  24902. itemclick: "scope.tree1NodeClick",
  24903. }
  24904. },
  24905. ]
  24906. },
  24907. {
  24908. region: 'center',
  24909. layout: 'fit',
  24910. title: 'PDA菜单',
  24911. key: "2",
  24912. items: [
  24913. {
  24914. xtype: 'treepanel',
  24915. layout: 'fit',
  24916. region: 'west',
  24917. reference: 'tree2',
  24918. rootVisible: false,
  24919. useArrows: true,
  24920. listeners: {
  24921. itemclick: "scope.tree1NodeClick",
  24922. }
  24923. },
  24924. ]
  24925. },
  24926. ]
  24927. },
  24928. {
  24929. region: 'center',
  24930. xtype: 'form',
  24931. margin: '0 0 0 0',
  24932. split: true,
  24933. width: '50%',
  24934. items: [
  24935. {
  24936. xtype: 'cols',
  24937. items: [
  24938. {
  24939. xtype: 'textfield',
  24940. fieldLabel: '上级资源ID',
  24941. bind: {
  24942. readOnly: true,
  24943. disabled: true,
  24944. value: '{form.resource_parent}'
  24945. },
  24946. },
  24947. ],
  24948. },
  24949. {
  24950. xtype: 'cols',
  24951. items: [
  24952. {
  24953. xtype: 'textfield',
  24954. fieldLabel: '资源名称',
  24955. bind: {
  24956. value: '{form.resource_name}'
  24957. },
  24958. allowBlank: false,
  24959. },
  24960. ],
  24961. },
  24962. {
  24963. xtype: 'cols',
  24964. items: [
  24965. {
  24966. xtype: 'numberfield',
  24967. fieldLabel: '资源排序',
  24968. bind: {
  24969. value: '{form.resource_order}'
  24970. },
  24971. allowBlank: false,
  24972. },
  24973. ],
  24974. },
  24975. {
  24976. xtype: 'cols',
  24977. items: [
  24978. {
  24979. xtype: 'textfield',
  24980. fieldLabel: '功能URL',
  24981. bind: {
  24982. disabled: true,
  24983. value: '{form.scope_url}'
  24984. },
  24985. },
  24986. ]
  24987. },
  24988. {
  24989. xtype: 'cols',
  24990. items: [
  24991. {
  24992. xtype: 'textfield',
  24993. fieldLabel: '权限编码',
  24994. bind: {
  24995. value: '{form.permission_code}'
  24996. }
  24997. },
  24998. ],
  24999. },
  25000. {
  25001. xtype: 'cols',
  25002. items: [
  25003. {
  25004. xtype: 'textfield',
  25005. fieldLabel: '功能参数',
  25006. bind: {
  25007. value: '{form.scope_params}'
  25008. }
  25009. },
  25010. ],
  25011. },
  25012. ],
  25013. },
  25014. ],
  25015. },
  25016. ],
  25017. referenceHolder: true,
  25018. };
  25019. var RegisterModule = /** @class */ (function (_super) {
  25020. __extends(RegisterModule, _super);
  25021. function RegisterModule() {
  25022. return _super.call(this, { model: model$e, vjson: vjson$d }) || this;
  25023. }
  25024. RegisterModule.prototype.onLoad = function () {
  25025. this.reloadTree("PC");
  25026. };
  25027. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  25028. var currTabKey = b.key;
  25029. if (currTabKey === '1') {
  25030. this.viewModel.set('form', '');
  25031. this.reloadTree("PC");
  25032. }
  25033. else {
  25034. this.viewModel.set('form', '');
  25035. this.reloadTree("PDA");
  25036. }
  25037. };
  25038. RegisterModule.prototype.reloadTree = function (type) {
  25039. var _this = this;
  25040. if ("PC" === type) {
  25041. this.setLoading(true);
  25042. getMenuTree({ type: "PC" }).then(function (res) {
  25043. if (res.success) {
  25044. _this.refs.tree1.store.setRootNode({
  25045. expanded: true,
  25046. children: res.data
  25047. });
  25048. }
  25049. }).finally(function () {
  25050. _this.setLoading(false);
  25051. });
  25052. }
  25053. else {
  25054. this.setLoading(true);
  25055. getMenuTree({ type: "PDA" }).then(function (res) {
  25056. if (res.success) {
  25057. _this.refs.tree2.store.setRoot({
  25058. expanded: true,
  25059. children: res.data
  25060. });
  25061. }
  25062. }).finally(function () {
  25063. _this.setLoading(false);
  25064. });
  25065. }
  25066. };
  25067. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  25068. var id = _$2.split(node.data.id, '_')[1];
  25069. if (!id) {
  25070. return;
  25071. }
  25072. this.viewModel.set('form.resource_parent', id);
  25073. };
  25074. RegisterModule.prototype.saveNode = function () {
  25075. var _this = this;
  25076. var tabKey = this.refs.tabs.activeTab.key;
  25077. // 检验菜单数据
  25078. var param = this.viewModel.get('form');
  25079. if (!param.resource_parent) {
  25080. msg('请选择一个父节点');
  25081. return;
  25082. }
  25083. if (!param.resource_name) {
  25084. msg('资源名称不能为空');
  25085. return;
  25086. }
  25087. if (!param.scope_url) {
  25088. msg('功能URL不能为空');
  25089. return;
  25090. }
  25091. var type;
  25092. if (tabKey === '1') {
  25093. type = 'PC';
  25094. }
  25095. else {
  25096. type = 'PDA';
  25097. }
  25098. this.setLoading(true);
  25099. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  25100. if (res.success) {
  25101. msg("注册成功");
  25102. _this.close();
  25103. }
  25104. }).finally(function () {
  25105. _this.setLoading(false);
  25106. });
  25107. };
  25108. return RegisterModule;
  25109. }(Scope));
  25110. var model$f = {
  25111. data: {
  25112. title: "模板选择",
  25113. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  25114. moduleType: 1,
  25115. // 当前模块包路径 "com/galaxis/wms/bas/area"
  25116. packagePath: "",
  25117. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  25118. fileSavePath: "",
  25119. // 模块名称 "Dict"
  25120. moduleName: "NewModule",
  25121. // 页面标题 "字典维护"
  25122. pageTitle: "新模块",
  25123. // 单表查询
  25124. singleTable: {
  25125. sql: "select * from bas_dict",
  25126. // 新增或者删除所用的表
  25127. tableName: "",
  25128. // 是否分页查询
  25129. pagination: true,
  25130. // 是否需要删除
  25131. delete: true,
  25132. // 删除条件字段
  25133. deleteWhereColumn: "",
  25134. // 删除提示语
  25135. deleteTips: "确定要删除?",
  25136. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  25137. editType: 2,
  25138. },
  25139. singleTableView: {
  25140. tableNameList: [
  25141. // { value: "aaa"},
  25142. ],
  25143. columnList: [
  25144. // { value: "aaa"},
  25145. ],
  25146. }
  25147. }
  25148. };
  25149. var vjson$e = {
  25150. bind: {
  25151. title: '新建模块-{title}',
  25152. },
  25153. width: "55%",
  25154. height: "60%",
  25155. minWidth: 500,
  25156. minHeight: 400,
  25157. modal: true,
  25158. frame: true,
  25159. layout: 'card',
  25160. bbar: [
  25161. '->',
  25162. {
  25163. itemId: 'card-prev',
  25164. text: '&laquo; 上一步',
  25165. disabled: true,
  25166. listeners: {
  25167. click: 'scope.showPrevious',
  25168. },
  25169. },
  25170. {
  25171. itemId: 'card-next',
  25172. text: '下一步 &raquo;',
  25173. listeners: {
  25174. click: 'scope.showNext',
  25175. },
  25176. },
  25177. {
  25178. itemId: 'card-finish',
  25179. text: '立刻执行',
  25180. iconCls: 'x-fa fa-flash',
  25181. hidden: true,
  25182. listeners: {
  25183. click: 'scope.finish',
  25184. },
  25185. },
  25186. ],
  25187. items: [
  25188. {
  25189. vtitle: '模板选择',
  25190. reference: 'templateSelection',
  25191. layout: {
  25192. type: 'hbox',
  25193. pack: 'start',
  25194. align: 'stretch'
  25195. },
  25196. listeners: {
  25197. cardEnter: 'scope.templateEnter',
  25198. cardLevel: 'scope.templateLevel'
  25199. },
  25200. items: [
  25201. {
  25202. width: 150,
  25203. xtype: 'form',
  25204. border: false,
  25205. layout: {
  25206. type: 'vbox',
  25207. align: 'stretch'
  25208. },
  25209. defaults: {
  25210. border: false,
  25211. anchor: '100%',
  25212. margin: '5',
  25213. },
  25214. items: [
  25215. {
  25216. xtype: 'radiogroup',
  25217. bind: {
  25218. value: '{moduleType}'
  25219. },
  25220. layout: 'vbox',
  25221. defaults: {
  25222. border: false,
  25223. anchor: '100%',
  25224. margin: '5',
  25225. },
  25226. items: [
  25227. { boxLabel: '单表查询', inputValue: 1 },
  25228. { boxLabel: '主/明细查询', inputValue: 2 },
  25229. { boxLabel: '树/明细查询', inputValue: 3 },
  25230. { boxLabel: '卡片表单', inputValue: 4 },
  25231. { boxLabel: '主/详情查询', inputValue: 5 },
  25232. ]
  25233. },
  25234. ]
  25235. },
  25236. {
  25237. flex: 1,
  25238. region: 'center',
  25239. xtype: "panel",
  25240. border: false,
  25241. frame: true,
  25242. padding: "4px 8px",
  25243. html: "描述...",
  25244. }
  25245. ]
  25246. },
  25247. {
  25248. vtitle: '模块名称',
  25249. reference: 'moduleName',
  25250. layout: 'fit',
  25251. listeners: {
  25252. cardEnter: 'scope.moduleEnter',
  25253. cardLevel: 'scope.moduleLevel'
  25254. },
  25255. items: [
  25256. {
  25257. xtype: 'form',
  25258. border: false,
  25259. layout: {
  25260. type: 'vbox',
  25261. align: 'stretch'
  25262. },
  25263. defaults: {
  25264. border: false,
  25265. anchor: '100%',
  25266. margin: '5',
  25267. },
  25268. items: [
  25269. {
  25270. xtype: 'textfield',
  25271. fieldLabel: '包路径',
  25272. allowBlank: false,
  25273. bind: { value: '{packagePath}' },
  25274. },
  25275. {
  25276. xtype: 'textfield',
  25277. fieldLabel: '文件路径',
  25278. allowBlank: false,
  25279. bind: { value: '{fileSavePath}' },
  25280. },
  25281. {
  25282. xtype: 'textfield',
  25283. fieldLabel: '模块名',
  25284. allowBlank: false,
  25285. bind: { value: '{moduleName}' },
  25286. },
  25287. {
  25288. xtype: 'textfield',
  25289. fieldLabel: '菜单名',
  25290. allowBlank: false,
  25291. bind: { value: '{pageTitle}' },
  25292. },
  25293. ]
  25294. },
  25295. ]
  25296. },
  25297. {
  25298. vtitle: '确认结果',
  25299. reference: 'confirmResult',
  25300. layout: 'fit',
  25301. listeners: {
  25302. cardEnter: 'scope.optionEnter',
  25303. cardLevel: 'scope.optionLevel',
  25304. },
  25305. items: [
  25306. {
  25307. xtype: 'jsoneditor',
  25308. reference: 'jsoneditor'
  25309. }
  25310. ]
  25311. },
  25312. // ---------------------------------------------------------------------------------- 单表查询
  25313. {
  25314. vtitle: '查询SQL',
  25315. reference: 'singleTable_1',
  25316. layout: 'fit',
  25317. listeners: {
  25318. cardEnter: 'scope.editorEnter',
  25319. cardLevel: 'scope.editorLevel'
  25320. },
  25321. items: [
  25322. {
  25323. xtype: 'sqleditor',
  25324. }
  25325. ],
  25326. },
  25327. {
  25328. vtitle: '字段选项',
  25329. reference: 'singleTable_2',
  25330. layout: 'fit',
  25331. listeners: {
  25332. cardEnter: 'scope.columnEnter',
  25333. cardLevel: 'scope.columnLevel',
  25334. },
  25335. items: [
  25336. {
  25337. xtype: 'yvgrid',
  25338. border: false,
  25339. selModel: {
  25340. type: 'spreadsheet',
  25341. columnSelect: true,
  25342. pruneRemoved: false,
  25343. extensible: 'y'
  25344. },
  25345. plugins: {
  25346. clipboard: true,
  25347. selectionreplicator: true
  25348. },
  25349. reference: 'grid1',
  25350. idField: 'column_name',
  25351. hideFootbar: true,
  25352. tbar: {
  25353. xtype: 'toolbar',
  25354. items: [
  25355. {
  25356. xtype: 'button',
  25357. text: '添加',
  25358. iconCls: 'x-fa fa-plus-circle',
  25359. listeners: {
  25360. click: 'scope.addField'
  25361. }
  25362. },
  25363. {
  25364. xtype: 'button',
  25365. text: '删除',
  25366. iconCls: 'x-fa fa-minus-circle',
  25367. listeners: {
  25368. click: 'scope.removeField'
  25369. }
  25370. },
  25371. {
  25372. xtype: 'button',
  25373. text: '分析SQL',
  25374. iconCls: 'x-fa fa-refresh',
  25375. listeners: {
  25376. click: 'scope.parseSQL'
  25377. }
  25378. },
  25379. ]
  25380. },
  25381. columns: [
  25382. {
  25383. text: '字段名', dataIndex: 'column_name',
  25384. sortable: false,
  25385. menuDisabled: true,
  25386. width: 150,
  25387. editor: {
  25388. allowBlank: true,
  25389. selectOnFocus: false,
  25390. }
  25391. },
  25392. {
  25393. text: '字段中文', dataIndex: 'column_comment',
  25394. width: 150,
  25395. sortable: false,
  25396. menuDisabled: true,
  25397. editor: {
  25398. allowBlank: true,
  25399. selectOnFocus: false,
  25400. }
  25401. },
  25402. {
  25403. dataIndex: "column_useto",
  25404. // fix: ['system.getDict("column_useto")'],
  25405. header: "用途",
  25406. editor: {
  25407. xtype: 'combo',
  25408. allowBlank: false,
  25409. },
  25410. },
  25411. {
  25412. text: '主键', dataIndex: 'is_primary_key',
  25413. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25414. width: 48, resizable: false,
  25415. },
  25416. {
  25417. text: '必填', dataIndex: 'not_null',
  25418. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25419. width: 48, resizable: false,
  25420. },
  25421. {
  25422. text: '长度', dataIndex: 'column_size',
  25423. sortable: false, menuDisabled: true,
  25424. xtype: 'numbercolumn', format: '0',
  25425. editor: { allowBlank: true, selectOnFocus: true }
  25426. },
  25427. {
  25428. text: '字典', dataIndex: 'column_dict',
  25429. sortable: false, menuDisabled: true,
  25430. width: 200,
  25431. editor: {
  25432. allowBlank: true,
  25433. }
  25434. },
  25435. {
  25436. text: 'UI组件', dataIndex: 'column_ui',
  25437. sortable: false, menuDisabled: true,
  25438. // fix: ['system.getDict("column_ui")'],
  25439. width: 150,
  25440. editor: {
  25441. xtype: 'combo',
  25442. allowBlank: true,
  25443. }
  25444. },
  25445. {
  25446. dataIndex: 'data_type',
  25447. hidden: true,
  25448. },
  25449. ]
  25450. }
  25451. ],
  25452. },
  25453. {
  25454. vtitle: '其他选项',
  25455. reference: 'singleTable_3',
  25456. isEnd: true,
  25457. listeners: {
  25458. cardEnter: 'scope.extendEnter',
  25459. cardLevel: 'scope.extendLevel',
  25460. },
  25461. layout: 'fit',
  25462. items: [
  25463. {
  25464. xtype: 'form',
  25465. border: false,
  25466. layout: {
  25467. type: 'vbox',
  25468. align: 'stretch'
  25469. },
  25470. defaults: {
  25471. border: false,
  25472. anchor: '100%',
  25473. margin: '5',
  25474. },
  25475. items: [
  25476. {
  25477. xtype: 'checkbox',
  25478. fieldLabel: '需要分页',
  25479. labelWidth: 100,
  25480. bind: {
  25481. value: '{singleTable.pagination}',
  25482. },
  25483. },
  25484. {
  25485. xtype: 'combobox',
  25486. fieldLabel: '操作数据库表',
  25487. labelWidth: 100,
  25488. publishes: 'singleTable.tableName',
  25489. displayField: 'value',
  25490. valueField: 'value',
  25491. bind: {
  25492. data: '{singleTableView.tableNameList}',
  25493. value: '{singleTable.tableName}',
  25494. },
  25495. },
  25496. {
  25497. xtype: 'checkboxfield',
  25498. fieldLabel: '需要删除',
  25499. labelWidth: 100,
  25500. bind: {
  25501. value: '{singleTable.delete}',
  25502. },
  25503. },
  25504. {
  25505. xtype: 'combobox',
  25506. fieldLabel: '删除条件字段',
  25507. labelWidth: 100,
  25508. publishes: 'singleTable.deleteWhereColumn',
  25509. displayField: 'value',
  25510. valueField: 'value',
  25511. bind: {
  25512. data: '{singleTableView.columnList}',
  25513. hidden: '{!singleTable.delete}',
  25514. value: '{singleTable.deleteWhereColumn}',
  25515. },
  25516. },
  25517. {
  25518. xtype: 'textfield',
  25519. fieldLabel: '删除提示语句',
  25520. labelWidth: 100,
  25521. bind: {
  25522. hidden: '{!singleTable.delete}',
  25523. value: '{singleTable.deleteTips}',
  25524. },
  25525. },
  25526. {
  25527. fieldLabel: '新增与编辑',
  25528. labelWidth: 100,
  25529. xtype: 'radiogroup',
  25530. bind: {
  25531. value: '{singleTable.editType}'
  25532. },
  25533. layout: 'vbox',
  25534. defaults: {
  25535. border: false,
  25536. anchor: '100%',
  25537. margin: '5',
  25538. },
  25539. items: [
  25540. { boxLabel: '不要新增和编辑', inputValue: 1 },
  25541. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  25542. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  25543. ]
  25544. },
  25545. ]
  25546. }
  25547. ]
  25548. },
  25549. // ---------------------------------------------------------------------------------- 主/明细查询
  25550. {
  25551. vtitle: '主表查询SQL',
  25552. reference: 'mainDetailTable_1',
  25553. layout: 'fit',
  25554. listeners: {},
  25555. items: [],
  25556. },
  25557. {
  25558. vtitle: '主表字段选项',
  25559. reference: 'mainDetailTable_2',
  25560. layout: 'fit',
  25561. listeners: {},
  25562. items: [],
  25563. },
  25564. {
  25565. vtitle: '主表其他选项',
  25566. reference: 'mainDetailTable_3',
  25567. layout: 'fit',
  25568. listeners: {},
  25569. items: [],
  25570. },
  25571. {
  25572. vtitle: '子表查询SQL',
  25573. reference: 'mainDetailTable_4',
  25574. layout: 'fit',
  25575. listeners: {},
  25576. items: [],
  25577. },
  25578. {
  25579. vtitle: '子表字段选项',
  25580. reference: 'mainDetailTable_5',
  25581. layout: 'fit',
  25582. listeners: {},
  25583. items: [],
  25584. },
  25585. {
  25586. vtitle: '子表其他选项',
  25587. reference: 'mainDetailTable_6',
  25588. isEnd: true,
  25589. layout: 'fit',
  25590. listeners: {},
  25591. items: [],
  25592. },
  25593. // ---------------------------------------------------------------------------------- 树/明细查询
  25594. // ---------------------------------------------------------------------------------- 卡片表单
  25595. {
  25596. vtitle: '表单字段',
  25597. reference: 'cardForm_1',
  25598. layout: 'fit',
  25599. listeners: {},
  25600. items: [],
  25601. },
  25602. {
  25603. vtitle: '表单初始化',
  25604. reference: 'cardForm_2',
  25605. isEnd: true,
  25606. layout: 'fit',
  25607. listeners: {},
  25608. items: [],
  25609. },
  25610. ]
  25611. };
  25612. // noinspection TypeScriptCheckImport
  25613. function getSingleTableData(origin) {
  25614. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  25615. var _a, _b, _c;
  25616. var data = {
  25617. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  25618. package: _$2.replace(origin.packagePath, /\//g, "."),
  25619. groovyClass: origin.moduleName,
  25620. qClass: queryDslInfo.qClass,
  25621. qClassTable: queryDslInfo.qClassTable,
  25622. queryColumns: [],
  25623. insertColumns: [],
  25624. updateColumns: [],
  25625. updateWheres: [],
  25626. deleteWheres: [],
  25627. gridColumns: [],
  25628. sql: origin.sql,
  25629. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  25630. addButton: origin.editType !== 1,
  25631. saveButton: origin.editType === 2,
  25632. deleteButton: true,
  25633. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  25634. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  25635. fileSavePath: origin.fileSavePath,
  25636. };
  25637. origin.columnList.forEach(function (column) {
  25638. 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;
  25639. var query = origin.queryColumns.indexOf(column_name) >= 0;
  25640. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  25641. var update = origin.updateColumns.indexOf(column_name) >= 0;
  25642. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  25643. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  25644. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  25645. if (query) {
  25646. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  25647. }
  25648. if (insert) {
  25649. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  25650. }
  25651. if (update) {
  25652. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  25653. }
  25654. if (grid) {
  25655. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  25656. if (column_dict) {
  25657. gridColumn.fix = { dictName: column_dict };
  25658. }
  25659. if (origin.editType == 2 && (insert || update)) {
  25660. gridColumn.editor = { xtype: column_ui, fix: undefined };
  25661. if (column_dict) {
  25662. gridColumn.editor.fix = { dictName: column_dict };
  25663. }
  25664. }
  25665. data.gridColumns.push(gridColumn);
  25666. }
  25667. if (is_primary_key) {
  25668. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25669. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25670. }
  25671. });
  25672. return data;
  25673. });
  25674. }
  25675. // noinspection HttpUrlsUsage
  25676. var urlPrefix = "/static/studio-template/single_table";
  25677. function generateCode(data) {
  25678. return Promise.all([
  25679. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  25680. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  25681. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  25682. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  25683. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  25684. ]).then(function (values) {
  25685. var groovy = handlebars.compile(values[0]);
  25686. var mybatis = handlebars.compile(values[1]);
  25687. var controller = handlebars.compile(values[2]);
  25688. var view = handlebars.compile(values[3]);
  25689. var model = handlebars.compile(values[4]);
  25690. var code = {
  25691. groovy: groovy(data),
  25692. mybatis: mybatis(data),
  25693. controller: controller(data),
  25694. view: view(data),
  25695. model: model(data),
  25696. };
  25697. return code;
  25698. });
  25699. }
  25700. var CreateModule = /** @class */ (function (_super) {
  25701. __extends(CreateModule, _super);
  25702. function CreateModule() {
  25703. var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this;
  25704. _this.columns = [];
  25705. return _this;
  25706. }
  25707. CreateModule.prototype.onLoad = function () {
  25708. this.refs.grid1.setData([]);
  25709. };
  25710. CreateModule.prototype.addField = function () {
  25711. this.refs.grid1.appendEditRow({
  25712. column_name: '',
  25713. column_comment: '',
  25714. is_primary_key: false,
  25715. not_null: true,
  25716. column_domain: '',
  25717. data_type: '',
  25718. column_size: 0,
  25719. decimal_digits: 0,
  25720. default_value: '',
  25721. column_dict: '',
  25722. column_ui: '',
  25723. column_note: '',
  25724. }, 0);
  25725. };
  25726. CreateModule.prototype.removeField = function () {
  25727. var _this = this;
  25728. var rows = [];
  25729. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  25730. rows.push(r);
  25731. });
  25732. _$2.forEach(rows, function (r) {
  25733. _this.refs.grid1.getStore().remove(r);
  25734. });
  25735. };
  25736. CreateModule.prototype.parseSQL = function (sender) {
  25737. var _this = this;
  25738. var sql = this.viewModel.get('singleTable.sql');
  25739. sender.up('window').setLoading(true);
  25740. instance$1.reloadIfNeedPromise(undefined).then(function (res) {
  25741. parseSqlApi(sql).then(function (parseResult) {
  25742. if (!parseResult.success) {
  25743. msg(parseResult.msg);
  25744. return;
  25745. }
  25746. var tableNameList = [];
  25747. var columnList = [];
  25748. var singleTableTableName;
  25749. var singleTableDeleteWhereColumn;
  25750. _this.refs.grid1.setData([]);
  25751. var rows = _this.refs.grid1.getDataRows();
  25752. _$2.forEach(parseResult.data, function (parseRetColumn) {
  25753. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  25754. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  25755. return;
  25756. }
  25757. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  25758. tableNameList.push({ value: tableName });
  25759. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  25760. columnList.push({ value: columnName });
  25761. if (!singleTableTableName)
  25762. singleTableTableName = tableName;
  25763. if (!singleTableDeleteWhereColumn)
  25764. singleTableDeleteWhereColumn = columnName;
  25765. // 已经加过这个列了
  25766. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  25767. if (rowExists) {
  25768. return;
  25769. }
  25770. var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  25771. if (columnRow) {
  25772. _this.refs.grid1.appendEditRow({
  25773. table_name: tableName,
  25774. column_name: columnRow.column_name,
  25775. column_comment: columnRow.column_comment,
  25776. column_useto: 2,
  25777. is_primary_key: columnRow.is_primary_key,
  25778. not_null: columnRow.not_null,
  25779. column_size: columnRow.column_size,
  25780. column_dict: columnRow.column_dict,
  25781. column_ui: columnRow.column_ui,
  25782. data_type: columnRow.data_type,
  25783. });
  25784. if (columnRow.is_primary_key)
  25785. singleTableDeleteWhereColumn = columnName;
  25786. }
  25787. else {
  25788. _this.refs.grid1.appendEditRow({
  25789. table_name: tableName,
  25790. column_name: columnName,
  25791. column_useto: 2,
  25792. });
  25793. }
  25794. });
  25795. _this.viewModel.set("singleTableView.columnList", columnList);
  25796. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  25797. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  25798. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  25799. }).finally(function () {
  25800. sender.up('window').setLoading(false);
  25801. });
  25802. }).catch(function () {
  25803. sender.up('window').setLoading(false);
  25804. });
  25805. };
  25806. CreateModule.prototype.templateEnter = function (sender) {
  25807. };
  25808. CreateModule.prototype.templateLevel = function (sender, opt) {
  25809. if (!this.viewModel.get('moduleType')) {
  25810. msg('请选择模板类型');
  25811. opt.cancel = true;
  25812. return;
  25813. }
  25814. };
  25815. CreateModule.prototype.moduleEnter = function (sender) {
  25816. };
  25817. CreateModule.prototype.moduleLevel = function (sender, opt) {
  25818. if (!sender.down('form').isValid()) {
  25819. opt.cancel = true;
  25820. return;
  25821. }
  25822. };
  25823. CreateModule.prototype.editorEnter = function (sender) {
  25824. var editor = sender.down('sqleditor');
  25825. editor.setValue(this.viewModel.get('singleTable.sql'));
  25826. };
  25827. CreateModule.prototype.editorLevel = function (sender, opt) {
  25828. var editor = sender.down('sqleditor');
  25829. var sql = editor.getValue();
  25830. if (!sql) {
  25831. msg('查询SQL语句必填');
  25832. opt.cancel = true;
  25833. return;
  25834. }
  25835. this.viewModel.set('singleTable.sql', sql);
  25836. };
  25837. CreateModule.prototype.columnEnter = function (sender) {
  25838. };
  25839. CreateModule.prototype.columnLevel = function (sender, opt) {
  25840. };
  25841. CreateModule.prototype.extendEnter = function (sender) {
  25842. };
  25843. CreateModule.prototype.extendLevel = function (sender, opt) {
  25844. };
  25845. // 确认结果 - Enter
  25846. CreateModule.prototype.optionEnter = function (sender) {
  25847. var _this = this;
  25848. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25849. var moduleType = this.viewModel.get("moduleType");
  25850. var data = this.viewModel.getData();
  25851. var code = "";
  25852. var origin = {};
  25853. if (moduleType === 1) {
  25854. var singleTable = data.singleTable;
  25855. var editColumns = this.refs.grid1.getDataRows();
  25856. origin.moduleType = data.moduleType;
  25857. origin.packagePath = data.packagePath;
  25858. origin.fileSavePath = data.fileSavePath;
  25859. origin.moduleName = data.moduleName;
  25860. origin.pageTitle = data.pageTitle;
  25861. if (singleTable) {
  25862. origin.sql = singleTable.sql;
  25863. origin.tableName = singleTable.tableName;
  25864. origin.pagination = singleTable.pagination;
  25865. origin.delete = singleTable.delete;
  25866. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  25867. origin.deleteTips = singleTable.deleteTips;
  25868. origin.editType = singleTable.editType;
  25869. }
  25870. origin.columnList = [];
  25871. origin.queryColumns = [];
  25872. origin.insertColumns = [];
  25873. origin.updateColumns = [];
  25874. origin.gridColumns = [];
  25875. editColumns.forEach(function (column) {
  25876. var row = {
  25877. table_name: column.table_name,
  25878. column_name: column.column_name,
  25879. column_comment: column.column_comment,
  25880. is_primary_key: column.is_primary_key,
  25881. not_null: column.not_null,
  25882. column_size: column.column_size,
  25883. column_dict: column.column_dict,
  25884. column_ui: column.column_ui,
  25885. data_type: column.data_type,
  25886. column_type: column.column_type,
  25887. };
  25888. origin.columnList.push(row);
  25889. // 1:查询条件; 2:查询结果; 3:条件+结果;
  25890. var column_name = column.column_name, column_useto = column.column_useto;
  25891. switch (column_useto) {
  25892. case 1:
  25893. origin.queryColumns.push(column_name);
  25894. break;
  25895. case 2:
  25896. origin.gridColumns.push(column_name);
  25897. break;
  25898. case 3:
  25899. origin.queryColumns.push(column_name);
  25900. origin.gridColumns.push(column_name);
  25901. break;
  25902. }
  25903. origin.insertColumns.push(column_name);
  25904. origin.updateColumns.push(column_name);
  25905. });
  25906. }
  25907. this.setLoading(true);
  25908. getSingleTableData(origin).then(function (data) {
  25909. code = JSON.stringify(data, null, 4);
  25910. window['lastTemplateData'] = code;
  25911. var editor = _this.refs.jsoneditor;
  25912. editor.setCode(code);
  25913. }).finally(function () { return _this.setLoading(false); });
  25914. };
  25915. // 确认结果 - Level
  25916. CreateModule.prototype.optionLevel = function (sender, opt) {
  25917. };
  25918. // 上一步
  25919. CreateModule.prototype.showPrevious = function () {
  25920. this.doCardNavigation(false);
  25921. };
  25922. // 下一步
  25923. CreateModule.prototype.showNext = function () {
  25924. this.doCardNavigation(true, true);
  25925. };
  25926. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  25927. if (isNext === void 0) { isNext = true; }
  25928. if (isCancelable === void 0) { isCancelable = false; }
  25929. var layout = this._handle.getLayout();
  25930. var activeItem = layout.activeItem;
  25931. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  25932. if (isNext)
  25933. this.prevCard = reference;
  25934. var activeCard;
  25935. if (reference === "templateSelection") {
  25936. if (isNext) {
  25937. activeCard = this.refs['moduleName'];
  25938. }
  25939. }
  25940. else if (reference === "moduleName") {
  25941. if (isNext) {
  25942. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25943. var moduleType = this.viewModel.get("moduleType");
  25944. switch (moduleType) {
  25945. case 1:
  25946. activeCard = this.refs['singleTable_1'];
  25947. break;
  25948. case 2:
  25949. activeCard = this.refs['mainDetailTable_1'];
  25950. break;
  25951. case 3:
  25952. // activeCard =
  25953. break;
  25954. case 4:
  25955. activeCard = this.refs['cardForm_1'];
  25956. break;
  25957. }
  25958. }
  25959. else {
  25960. activeCard = this.refs['templateSelection'];
  25961. }
  25962. }
  25963. else if (reference === "confirmResult") {
  25964. if (!isNext) {
  25965. activeCard = this.refs[this.prevCard];
  25966. }
  25967. }
  25968. else {
  25969. var name = reference.split('_')[0];
  25970. var idx = parseInt(reference.split('_')[1], 10);
  25971. if (isNext) {
  25972. if (isEnd) {
  25973. activeCard = this.refs['confirmResult'];
  25974. }
  25975. else {
  25976. idx += 1;
  25977. }
  25978. }
  25979. else {
  25980. idx -= 1;
  25981. }
  25982. if (idx <= 0) {
  25983. activeCard = this.refs['moduleName'];
  25984. }
  25985. else if (!activeCard) {
  25986. activeCard = this.refs[name + "_" + idx];
  25987. }
  25988. }
  25989. // 按钮状态
  25990. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  25991. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  25992. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  25993. // 设置下一页显示
  25994. if (activeCard) {
  25995. var optCancel = { cancel: false };
  25996. // 发出 cardLevel 事件
  25997. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  25998. if (isCancelable && optCancel.cancel) {
  25999. // 取消了
  26000. return;
  26001. }
  26002. layout.setActiveItem(activeCard);
  26003. this.viewModel.set('title', layout.activeItem.vtitle);
  26004. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  26005. }
  26006. };
  26007. // 立刻执行
  26008. CreateModule.prototype.finish = function (sender) {
  26009. var _this = this;
  26010. var parent = sender.up('window');
  26011. var editor = this.refs.jsoneditor;
  26012. var data = JSON.parse(editor.getCode());
  26013. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  26014. var moduleType = this.viewModel.get("moduleType");
  26015. if (moduleType === 1) {
  26016. this.setLoading(true);
  26017. generateCode(data).then(function (code) {
  26018. console.log("===> ", code);
  26019. _this.setLoading(true);
  26020. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  26021. .then(function () {
  26022. msg("创建成功!");
  26023. parent.close();
  26024. handles$1.fileTree.reload();
  26025. }).finally(function () { return _this.setLoading(false); });
  26026. }).finally(function () { return _this.setLoading(false); });
  26027. }
  26028. };
  26029. return CreateModule;
  26030. }(Scope));
  26031. function getModuleId(path) {
  26032. var separator = "/";
  26033. var sps = path.split(separator);
  26034. var joinSps = sps.join('$');
  26035. if (!joinSps) {
  26036. return "ROOT";
  26037. }
  26038. return joinSps;
  26039. }
  26040. /**
  26041. * Module数据转换成Tree数据
  26042. */
  26043. function modulesToTreeData(modules) {
  26044. var separator = "/";
  26045. var treeNodeMap = new Map();
  26046. var root = {
  26047. type: "Dir",
  26048. path: "",
  26049. expanded: true,
  26050. leaf: false,
  26051. children: [],
  26052. };
  26053. root.id = getModuleId(root.path);
  26054. treeNodeMap.set(root.path, root);
  26055. modules.forEach(function (module) {
  26056. var _a;
  26057. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  26058. if (paths.length <= 0)
  26059. return;
  26060. var path = [];
  26061. var parent = root;
  26062. paths.forEach(function (dirName, idx) {
  26063. var parentPath = path.join(separator);
  26064. parent = treeNodeMap.get(parentPath);
  26065. path.push(dirName);
  26066. var currentPath = path.join(separator);
  26067. var child = treeNodeMap.get(currentPath);
  26068. if (child == null) {
  26069. // 获取当前path 绝对路径
  26070. var indexLength = module.absolutePath.indexOf(currentPath);
  26071. var currentAbsolutePath = "";
  26072. if (indexLength > 0) {
  26073. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  26074. }
  26075. child = {
  26076. type: "Dir",
  26077. path: currentPath,
  26078. absolutePath: currentAbsolutePath,
  26079. leaf: false,
  26080. children: [],
  26081. text: dirName
  26082. };
  26083. child.id = getModuleId(child.path);
  26084. parent.children.push(child);
  26085. treeNodeMap.set(child.path, child);
  26086. }
  26087. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  26088. var leaf = {
  26089. type: "Module",
  26090. path: module.path + separator + module.name,
  26091. absolutePath: module.absolutePath,
  26092. leaf: true,
  26093. text: module.name,
  26094. module: module,
  26095. };
  26096. leaf.id = getModuleId(leaf.path);
  26097. child.children.push(leaf);
  26098. treeNodeMap.set(leaf.path, leaf);
  26099. }
  26100. });
  26101. });
  26102. // 排序处理
  26103. treeNodeMap.forEach(function (module) {
  26104. if (module.children) {
  26105. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  26106. module.children.length = 0;
  26107. children.forEach(function (item) { return module.children.push(item); });
  26108. }
  26109. });
  26110. return root;
  26111. }
  26112. function showDialog(sender, option) {
  26113. var _a, _b;
  26114. var win = new Ext.Window({
  26115. autoDestroy: true,
  26116. title: option.title,
  26117. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  26118. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  26119. resizable: false,
  26120. closable: true,
  26121. modal: true,
  26122. maximizable: false,
  26123. minimizable: false,
  26124. // constrainHeader: true,
  26125. constrain: true,
  26126. layout: 'fit',
  26127. animateTarget: sender,
  26128. buttonAlign: 'center',
  26129. items: [
  26130. {
  26131. xtype: "form",
  26132. layout: "hbox",
  26133. margin: '10px 20px',
  26134. border: 0,
  26135. items: option.items
  26136. }
  26137. ],
  26138. //窗口按钮
  26139. fbar: [
  26140. {
  26141. xtype: 'button', text: '保存', handler: function (btn) {
  26142. //窗口获取表单
  26143. var form = win.down('form');
  26144. var vaildSuccess = form.isValid();
  26145. if (!vaildSuccess) {
  26146. return;
  26147. }
  26148. option.submitFunc(form);
  26149. }
  26150. },
  26151. {
  26152. xtype: 'button', text: '取消', handler: function (btn) {
  26153. //窗口关闭
  26154. btn.up('window').close();
  26155. }
  26156. }
  26157. ],
  26158. });
  26159. win.show();
  26160. }
  26161. function showCreateFolderWin(sender, parentPath) {
  26162. showDialog(sender, {
  26163. title: '新建文件夹',
  26164. height: 150,
  26165. items: [
  26166. {
  26167. xtype: "textfield",
  26168. name: "filename",
  26169. fieldLabel: "文件夹名称",
  26170. allowBlank: false,
  26171. selectOnFocus: true,
  26172. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  26173. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  26174. labelWidth: 80,
  26175. width: "100%",
  26176. listeners: {
  26177. afterrender: function (sender) {
  26178. _$2.defer(function () {
  26179. sender.focus();
  26180. });
  26181. }
  26182. }
  26183. },
  26184. ],
  26185. submitFunc: function (form) {
  26186. var filename = form.down('textfield[name="filename"]').getValue();
  26187. createFolder(parentPath, filename).then(function (res) {
  26188. if (res.success) {
  26189. msg$1('创建成功');
  26190. handles$1.fileTree.reload();
  26191. form.up('window').close();
  26192. }
  26193. else {
  26194. showErrorDialog$1(res.msg);
  26195. }
  26196. }).catch(function (e) {
  26197. showErrorDialog$1(e.responseJSON.msg);
  26198. });
  26199. }
  26200. });
  26201. }
  26202. function showCreateModuleCrudWin(sender, path, absolutePath) {
  26203. var dlg = new CreateModule();
  26204. dlg.showDialog(sender, {}, {
  26205. data: {
  26206. packagePath: path,
  26207. fileSavePath: absolutePath,
  26208. }
  26209. });
  26210. }
  26211. function registerModule$1(sender, path, name, icon) {
  26212. // 前缀 com/galaxis/wms 写死了
  26213. var dlg = new RegisterModule();
  26214. dlg.showDialog(sender, {}, {
  26215. data: {
  26216. form: {
  26217. scope_url: path.replace("com/galaxis/wms", "."),
  26218. resource_name: name,
  26219. resource_icon: icon,
  26220. }
  26221. }
  26222. });
  26223. }
  26224. function showCreateEmptyModule(sender, path) {
  26225. var win = new Ext.Window({
  26226. autoDestroy: true,
  26227. title: "新建空模块",
  26228. width: 400,
  26229. height: 150,
  26230. resizable: true,
  26231. closable: true,
  26232. maximizable: true,
  26233. minimizable: true,
  26234. plain: true,
  26235. // constrainHeader: true,
  26236. constrain: true,
  26237. layout: 'fit',
  26238. animateTarget: sender,
  26239. buttonAlign: 'center',
  26240. items: [
  26241. {
  26242. xtype: "form",
  26243. layout: "hbox",
  26244. margin: '10px 20px',
  26245. border: 0,
  26246. items: [
  26247. {
  26248. flex: 1,
  26249. layout: 'vbox',
  26250. items: [
  26251. {
  26252. xtype: "textfield",
  26253. name: "filename",
  26254. fieldLabel: "模块名",
  26255. flex: 1,
  26256. allowBlank: false,
  26257. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  26258. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  26259. labelWidth: 50,
  26260. width: "100%",
  26261. },
  26262. ]
  26263. },
  26264. ]
  26265. }
  26266. ],
  26267. //窗口按钮
  26268. buttons: [
  26269. {
  26270. xtype: 'button', text: '保存', handler: function (btn) {
  26271. //窗口获取表单
  26272. var form = win.down('form');
  26273. var vaildSuccess = form.isValid();
  26274. if (!vaildSuccess) {
  26275. return;
  26276. }
  26277. var filename = form.down('textfield[name="filename"]').getValue();
  26278. createEmptyModule(path, filename).then(function (res) {
  26279. if (res.success) {
  26280. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  26281. handles$1.fileTree.reload();
  26282. win.close();
  26283. }
  26284. else {
  26285. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  26286. }
  26287. }).catch(function (e) {
  26288. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  26289. });
  26290. }
  26291. },
  26292. {
  26293. xtype: 'button', text: '取消', handler: function (btn) {
  26294. //窗口关闭
  26295. win.close();
  26296. }
  26297. }
  26298. ]
  26299. });
  26300. win.show();
  26301. }
  26302. function initFileTree () {
  26303. Ext.define('com.yvan.studio.FileTree', {
  26304. extend: 'com.yvan.studio.StateTree',
  26305. xtype: 'filetree',
  26306. tooltip: '文件',
  26307. iconCls: 'x-fa fa-file',
  26308. rootVisible: false,
  26309. useArrows: true,
  26310. colspan: 2,
  26311. lines: true,
  26312. reference: 'filetree',
  26313. multiSelect: true,
  26314. getStateFilename: function () {
  26315. return getCurrentProject().uuid + "/filetree.json";
  26316. },
  26317. openNode: function () {
  26318. var selection = this.getSelection();
  26319. var _a = __read(selection, 1), record = _a[0];
  26320. if (!record) {
  26321. return;
  26322. }
  26323. var raw = record.raw;
  26324. if (raw.type === 'Dir') {
  26325. return;
  26326. }
  26327. if (raw.type === "Module" && raw.module) {
  26328. eventBus.publish(EventType.ModuleOpen, raw);
  26329. }
  26330. },
  26331. openInIdea: function () {
  26332. var _a = __read(this.getSelection(), 1), record = _a[0];
  26333. if (record) {
  26334. var data = record.data;
  26335. if (data.type === "Module") {
  26336. if (data.module.groovyFile && data.module.groovyFile.exists) {
  26337. native.openInIdea(data.module.groovyFile.absolutePath);
  26338. }
  26339. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  26340. native.openInIdea(data.module.jsControllerFile.absolutePath);
  26341. }
  26342. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  26343. native.openInIdea(data.module.jsViewFile.absolutePath);
  26344. }
  26345. return;
  26346. }
  26347. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  26348. }
  26349. },
  26350. deleteSelection: function () {
  26351. var selection = this.getSelection();
  26352. var pathList = [];
  26353. _.forEach(selection, function (item) {
  26354. if (item.data.type === "Dir") {
  26355. pathList.push({ path: item.data.path, isFolder: true });
  26356. }
  26357. else {
  26358. pathList.push({ path: item.data.path, isFolder: false });
  26359. }
  26360. });
  26361. {
  26362. return;
  26363. }
  26364. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  26365. //
  26366. // Ext.Msg.confirm('提示', title, (btn) => {
  26367. // if (btn === 'yes') {
  26368. // deleteFileOrFolder(raw.path, title, true)
  26369. // }
  26370. // })
  26371. // const title = '您确定要删除(' + raw.path + ')吗?'
  26372. // deleteFileOrFolder(raw.path, title, false)
  26373. },
  26374. listeners: {
  26375. itemverify: function () {
  26376. this.openNode();
  26377. },
  26378. afterrender: function (me) {
  26379. console.log('filetree_afterrender', 'reloadIfNeed');
  26380. moduleStore.registe(me.subscribeModule.bind(this));
  26381. moduleStore.reloadIfNeed("PC");
  26382. },
  26383. destroy: function (me) {
  26384. console.log('filetree_destroy');
  26385. moduleStore.unregiste(me.subscribeModule.bind(this));
  26386. },
  26387. itemcontextmenu: function (sender, node, element, idx, e) {
  26388. e.preventDefault();
  26389. var raw = node.raw;
  26390. var option = {};
  26391. if (raw.type === 'Dir') {
  26392. // 文件夹右键
  26393. option = {
  26394. shadow: 'frame', allowOtherMenus: true,
  26395. items: [
  26396. {
  26397. text: '新建空模块',
  26398. iconCls: 'x-fa fa-plus-circle',
  26399. handler: function (sender) {
  26400. showCreateEmptyModule(sender, raw.path);
  26401. }
  26402. },
  26403. {
  26404. text: '新建模块',
  26405. iconCls: 'x-fa fa-plus-circle',
  26406. handler: function (sender) {
  26407. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  26408. }
  26409. },
  26410. '-',
  26411. {
  26412. text: '新建文件夹',
  26413. iconCls: 'x-fa fa-folder-o',
  26414. handler: function (sender) {
  26415. var parentPath = raw.path;
  26416. showCreateFolderWin(sender, parentPath);
  26417. }
  26418. },
  26419. {
  26420. text: '复制路径',
  26421. iconCls: 'x-fa fa-external-link',
  26422. handler: function (sender) {
  26423. native.clipboardSet(raw.path);
  26424. }
  26425. },
  26426. ]
  26427. };
  26428. }
  26429. else {
  26430. // 文件右键
  26431. option = {
  26432. shadow: 'frame', allowOtherMenus: true,
  26433. items: [
  26434. // {
  26435. // text: '重命名',
  26436. // iconCls: 'x-fa fa-terminal',
  26437. // handler(sender) {
  26438. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  26439. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  26440. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  26441. // }
  26442. // },
  26443. // {
  26444. // text: '另存为',
  26445. // iconCls: 'x-fa fa-exchange',
  26446. // handler(sender) {
  26447. // console.error('没做')
  26448. // }
  26449. // },
  26450. {
  26451. text: '复制路径',
  26452. iconCls: 'x-fa fa-external-link',
  26453. handler: function (sender) {
  26454. native.clipboardSet(raw.path);
  26455. }
  26456. },
  26457. '-',
  26458. {
  26459. text: '注册模块',
  26460. iconCls: 'x-fa fa-sign-in',
  26461. handler: function (sender) {
  26462. registerModule$1(sender, raw.path);
  26463. }
  26464. },
  26465. ]
  26466. };
  26467. }
  26468. var treeMenu = new Ext.menu.Menu(option);
  26469. treeMenu.showAt(e.getXY());
  26470. },
  26471. },
  26472. tbar: [
  26473. {
  26474. xtype: 'button',
  26475. iconCls: 'x-fa fa-crosshairs',
  26476. tooltip: '选中当前打开的文件',
  26477. handler: function (sender) {
  26478. msg$1('没做');
  26479. }
  26480. },
  26481. {
  26482. xtype: 'button',
  26483. iconCls: 'x-fa fa-link',
  26484. tooltip: '在IDEA中打开',
  26485. handler: function (sender) {
  26486. var scope = sender.up("filetree");
  26487. scope.openInIdea();
  26488. }
  26489. },
  26490. {
  26491. xtype: 'button',
  26492. iconCls: 'x-fa fa-refresh',
  26493. tooltip: '刷新',
  26494. handler: function (sender) {
  26495. var scope = sender.up("filetree");
  26496. scope.reload();
  26497. }
  26498. },
  26499. {
  26500. xtype: 'button',
  26501. iconCls: 'x-fa fa-percent',
  26502. tooltip: '监控',
  26503. handler: function (sender) {
  26504. // handles.mainWindow.showPerform()
  26505. }
  26506. },
  26507. ],
  26508. initComponent: function () {
  26509. setFileTree(this);
  26510. this.superclass.initComponent.apply(this, arguments);
  26511. // super.initComponent.apply(this, arguments)
  26512. },
  26513. subscribeModule: function (res) {
  26514. if (typeof res === 'object') {
  26515. var rootNode = modulesToTreeData(res.data);
  26516. this.setRootNode(rootNode);
  26517. this.restoreState();
  26518. handles$1.mainWindow.modules = res.data;
  26519. }
  26520. else if (typeof res === 'boolean') {
  26521. this.setLoading(res);
  26522. }
  26523. },
  26524. reload: function () {
  26525. console.log('filetree_reloadForce');
  26526. moduleStore.reloadForce("PC").then(function (res) {
  26527. });
  26528. }
  26529. });
  26530. }
  26531. function initDbTree () {
  26532. var define = {
  26533. extend: 'com.yvan.studio.StateTree',
  26534. xtype: 'dbtree',
  26535. tooltip: '数据库',
  26536. iconCls: 'x-fa fa-database',
  26537. rootVisible: false,
  26538. useArrows: true,
  26539. reference: 'dbtree',
  26540. multiSelect: true,
  26541. getStateFilename: function () {
  26542. return getCurrentProject().uuid + "/dbtree.json";
  26543. },
  26544. tbar: [
  26545. {
  26546. xtype: 'button',
  26547. iconCls: 'x-fa fa-crosshairs',
  26548. tooltip: '选中当前打开的表',
  26549. handler: function (sender) {
  26550. var _a;
  26551. // 获取当前选中的活动标签 tableColumn_bas_car
  26552. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  26553. if (!locatPath) {
  26554. return;
  26555. }
  26556. handles$1.dbTree.selectPath(locatPath);
  26557. }
  26558. },
  26559. {
  26560. xtype: 'button',
  26561. iconCls: 'x-fa fa-refresh',
  26562. tooltip: '刷新',
  26563. handler: function (sender) {
  26564. handles$1.dbTree.reload();
  26565. }
  26566. },
  26567. {
  26568. xtype: 'button',
  26569. iconCls: 'x-fa fa-cloud-download',
  26570. tooltip: '重新拉取生成元数据(耗时很长!)',
  26571. handler: function (sender) {
  26572. handles$1.dbTree.dbToMetaAndReload(sender);
  26573. }
  26574. },
  26575. // {
  26576. // xtype: 'button',
  26577. // iconCls: 'x-fa fa-files-o',
  26578. // tooltip: '数据同步',
  26579. // handler(sender) {
  26580. //
  26581. // }
  26582. // },
  26583. {
  26584. xtype: 'button',
  26585. iconCls: 'x-fa fa-exchange',
  26586. tooltip: '数据结构同步',
  26587. handler: function (sender) {
  26588. // handles.mainWindow.showDataSync(sender)
  26589. }
  26590. },
  26591. {
  26592. xtype: 'button',
  26593. iconCls: 'x-fa fa-window-maximize',
  26594. tooltip: 'SQL查询分析器',
  26595. handler: function (sender) {
  26596. // handles.mainWindow.showDbCodeTemplate(sender)
  26597. }
  26598. },
  26599. {
  26600. xtype: 'button',
  26601. iconCls: 'x-fa fa-cubes',
  26602. tooltip: '数据域管理',
  26603. handler: function (sender) {
  26604. // handles.mainWindow.showColumnDomain()
  26605. }
  26606. },
  26607. {
  26608. xtype: 'button',
  26609. iconCls: 'x-fa fa-edit',
  26610. tooltip: '修改结构',
  26611. handler: function (sender) {
  26612. var tree = sender.up("treepanel");
  26613. var selection = tree.getSelection();
  26614. var _a = __read(selection, 1), node = _a[0];
  26615. if (!node) {
  26616. msg$1('请选择一个表');
  26617. return;
  26618. }
  26619. var raw = node.data.raw;
  26620. if (node.get('type') === 'table') ;
  26621. else if (node.get('type') === 'column') ;
  26622. }
  26623. },
  26624. ],
  26625. listeners: {
  26626. afterrender: function (me) {
  26627. setDbTree(this);
  26628. // 找管理器订阅刷新的事件
  26629. instance$1.registe(this.refreshData.bind(this));
  26630. instance$1.reloadIfNeed(undefined);
  26631. },
  26632. destory: function (me) {
  26633. setDbTree(undefined);
  26634. instance$1.unregiste(this.refreshData.bind(this));
  26635. },
  26636. itemcontextmenu: function (sender, node, element, idx, e) {
  26637. var _this = this;
  26638. e.preventDefault();
  26639. var option = {};
  26640. var raw = node.raw.raw;
  26641. if (node.get('type') === 'column') {
  26642. option = {
  26643. shadow: 'frame', allowOtherMenus: true,
  26644. items: [
  26645. {
  26646. text: '设计结构',
  26647. iconCls: 'x-fa fa-edit',
  26648. handler: function (sender) {
  26649. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  26650. }
  26651. },
  26652. ]
  26653. };
  26654. }
  26655. else if (node.get('type') === 'table') {
  26656. option = {
  26657. shadow: 'frame', allowOtherMenus: true,
  26658. items: [
  26659. {
  26660. text: '新建',
  26661. iconCls: 'x-fa fa-plus',
  26662. handler: function (sender) {
  26663. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  26664. }
  26665. },
  26666. {
  26667. text: '设计结构',
  26668. iconCls: 'x-fa fa-edit',
  26669. handler: function (sender) {
  26670. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  26671. }
  26672. },
  26673. {
  26674. text: '重命名',
  26675. iconCls: 'x-fa fa-pencil',
  26676. handler: function (sender) {
  26677. _this.renameTable(sender, node.data.raw);
  26678. }
  26679. },
  26680. '-',
  26681. {
  26682. text: '删除',
  26683. iconCls: 'x-fa fa-minus',
  26684. handler: function (sender) {
  26685. _this.removeTable(sender, node.data.raw);
  26686. }
  26687. },
  26688. ]
  26689. };
  26690. }
  26691. var treeMenu = new Ext.menu.Menu(option);
  26692. treeMenu.showAt(e.getXY());
  26693. }
  26694. },
  26695. // DbTreeStore 刷新时,会回调到这个方法
  26696. refreshData: function (isLoadingState) {
  26697. var me = this;
  26698. if (typeof isLoadingState === 'boolean') {
  26699. me.setLoading(isLoadingState);
  26700. return;
  26701. }
  26702. var rootNode = getDbTree(instance$1.apiResponse);
  26703. me.setRootNode(rootNode);
  26704. this.restoreState();
  26705. },
  26706. renameTable: function (sender, tableRow) {
  26707. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  26708. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  26709. if (!res.data)
  26710. return;
  26711. var window = Ext.create('Ext.window.Window', {
  26712. title: 'SQL 预览',
  26713. height: 400,
  26714. width: 600,
  26715. modal: true,
  26716. animateTarget: sender,
  26717. maximizable: true,
  26718. layout: 'fit',
  26719. items: {
  26720. xtype: 'sqleditor',
  26721. value: res.data,
  26722. },
  26723. buttons: [
  26724. {
  26725. xtype: 'button',
  26726. text: '执行',
  26727. iconCls: 'x-fa fa-save',
  26728. handler: function (sender) {
  26729. var editor = sender.up('window').down('sqleditor');
  26730. var ddl = editor.getValue();
  26731. window.setLoading(true);
  26732. instance$1.pushToDbCommit({
  26733. schema_name: tableRow.schema_name,
  26734. table_name: name,
  26735. old_table_name: tableRow.table_name,
  26736. ddl: ddl,
  26737. }).then(function () {
  26738. handles$1.dbTree.reload();
  26739. window.close();
  26740. }).finally(function () { return window.setLoading(false); });
  26741. },
  26742. },
  26743. {
  26744. xtype: 'button',
  26745. text: '取消',
  26746. iconCls: 'x-fa fa-times',
  26747. handler: function () {
  26748. window.close();
  26749. }
  26750. },
  26751. ]
  26752. }).show();
  26753. });
  26754. });
  26755. },
  26756. removeTable: function (sender, tableRow) {
  26757. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  26758. if (!res.data)
  26759. return;
  26760. var window = Ext.create('Ext.window.Window', {
  26761. title: 'SQL 预览',
  26762. height: 400,
  26763. width: 600,
  26764. modal: true,
  26765. animateTarget: sender,
  26766. maximizable: true,
  26767. layout: 'fit',
  26768. items: {
  26769. xtype: 'sqleditor',
  26770. value: res.data,
  26771. },
  26772. buttons: [
  26773. {
  26774. xtype: 'button',
  26775. text: '执行',
  26776. iconCls: 'x-fa fa-save',
  26777. handler: function (sender) {
  26778. var editor = sender.up('window').down('sqleditor');
  26779. var ddl = editor.getValue();
  26780. window.setLoading(true);
  26781. instance$1.pushToDbCommit({
  26782. schema_name: tableRow.schema_name,
  26783. table_name: tableRow.table_name,
  26784. ddl: ddl
  26785. })
  26786. .then(function () {
  26787. handles$1.dbTree.reload();
  26788. window.close();
  26789. }).finally(function () { return window.setLoading(false); });
  26790. }
  26791. },
  26792. {
  26793. xtype: 'button',
  26794. text: '取消',
  26795. iconCls: 'x-fa fa-times',
  26796. handler: function () {
  26797. window.close();
  26798. }
  26799. }
  26800. ]
  26801. }).show();
  26802. });
  26803. },
  26804. // hideHeaders: true,
  26805. // columns: [
  26806. // {
  26807. // xtype: 'treecolumn',
  26808. // text: '名称',
  26809. // dataIndex: 'text',
  26810. // flex: 2,
  26811. // }, {
  26812. // text: '描述',
  26813. // dataIndex: 'comment',
  26814. // flex: 1,
  26815. // }
  26816. // ],
  26817. reload: function () {
  26818. // 强制刷新 DbManager
  26819. instance$1.reloadForce(undefined);
  26820. },
  26821. dbToMetaAndReload: function () {
  26822. // 从数据库结构重新生成元数据
  26823. instance$1.dbToMetaAndReload();
  26824. }
  26825. };
  26826. Ext.define('com.yvan.studio.DbTree', define);
  26827. }
  26828. /**
  26829. * 将数据构建成 dbTree 需要的格式
  26830. */
  26831. function getDbTree(apiResponse) {
  26832. var rootNode = {
  26833. children: [],
  26834. expanded: true,
  26835. id: "ROOT",
  26836. leaf: false,
  26837. };
  26838. _$2.forEach(apiResponse, function (schemaRow) {
  26839. var schemaNode = {
  26840. id: 'schema$' + schemaRow.schema_name,
  26841. type: "schema",
  26842. expanded: true,
  26843. leaf: false,
  26844. iconCls: 'x-fa fa-th-large ',
  26845. text: schemaRow.schema_name,
  26846. raw: __assign({}, schemaRow),
  26847. children: [],
  26848. };
  26849. delete schemaNode.raw.table_list;
  26850. rootNode.children.push(schemaNode);
  26851. _$2.forEach(schemaRow.table_list, function (tableRow) {
  26852. var _a;
  26853. var tableNode = {
  26854. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  26855. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  26856. comment: tableRow.description,
  26857. type: "table",
  26858. iconCls: 'x-fa fa-table',
  26859. expanded: false,
  26860. leaf: false,
  26861. children: [],
  26862. raw: __assign({}, tableRow)
  26863. };
  26864. delete tableNode.raw.column_list;
  26865. schemaNode.children.push(tableNode);
  26866. _$2.forEach(tableRow.column_list, function (columnRow) {
  26867. var _a;
  26868. var iconCls = 'x-fa fa-square-o';
  26869. if (columnRow.is_primary_key) {
  26870. iconCls = 'x-fa fa-key';
  26871. }
  26872. else if (columnRow.not_null) {
  26873. iconCls = 'x-fa fa-check-square';
  26874. }
  26875. var columnNode = {
  26876. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  26877. type: "column",
  26878. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  26879. comment: columnRow.column_comment,
  26880. leaf: true,
  26881. iconCls: iconCls,
  26882. raw: __assign({}, columnRow)
  26883. };
  26884. tableNode.children.push(columnNode);
  26885. }); // column
  26886. }); // table
  26887. }); // schema
  26888. return rootNode;
  26889. }
  26890. var ReportGridController = /** @class */ (function () {
  26891. function ReportGridController() {
  26892. }
  26893. ReportGridController.prototype.onLoad = function (sender) {
  26894. this.reload();
  26895. setReport(this);
  26896. };
  26897. ReportGridController.prototype.showSingle = function (sender) {
  26898. var _this = this;
  26899. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  26900. if (record) {
  26901. handles.mainWindow.showFormSingle(record.data, function () {
  26902. _this.reload();
  26903. });
  26904. }
  26905. };
  26906. ReportGridController.prototype.filterChanged = function (sender, value) {
  26907. console.log('filterChange', sender, value);
  26908. this.view.store.clearFilter();
  26909. if (value) {
  26910. this.view.store.filterBy(function (record) {
  26911. var code = _.lowerCase(record.get('report_name'));
  26912. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  26913. return (code.includes(value) ||
  26914. dict_desc_py.includes(value));
  26915. });
  26916. }
  26917. };
  26918. ReportGridController.prototype.onClearClick = function () {
  26919. var _a, _b;
  26920. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  26921. };
  26922. ReportGridController.prototype.reload = function () {
  26923. var me = this;
  26924. me.getView().setLoading(true);
  26925. reportListApi().then(function (res) {
  26926. _.forEach(res.data, function (r) {
  26927. r.report_enable = r.report_enable === 1;
  26928. });
  26929. me.getView().setStore(new Ext.data.Store({
  26930. fields: ['report_id', 'report_name', 'report_enable'],
  26931. data: res.data,
  26932. }));
  26933. }).finally(function () {
  26934. me.getView().setLoading(false);
  26935. });
  26936. };
  26937. ReportGridController.prototype.reportAdd = function () {
  26938. var _this = this;
  26939. prompt$2('请输入报表名称').then(function (name) {
  26940. createReportApi(name).then(function (res) {
  26941. if (res.success) {
  26942. msg$1('添加成功');
  26943. handles.mainWindow.showReport(res.data, name, function () {
  26944. _this.reload();
  26945. });
  26946. }
  26947. _this.reload();
  26948. });
  26949. });
  26950. };
  26951. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  26952. e.preventDefault();
  26953. var me = sender.up('grid').ownerGrid.getController();
  26954. var option = {
  26955. shadow: 'frame', allowOtherMenus: true,
  26956. items: [
  26957. {
  26958. text: '添加',
  26959. iconCls: 'x-fa fa-plus-circle',
  26960. handler: function (sender) {
  26961. me.reportAdd();
  26962. }
  26963. },
  26964. {
  26965. text: '编辑',
  26966. iconCls: 'x-fa fa-edit',
  26967. handler: function (sender) {
  26968. me.reportEdit();
  26969. }
  26970. },
  26971. {
  26972. text: '删除',
  26973. iconCls: 'x-fa fa-minus-circle',
  26974. handler: function (sender) {
  26975. me.reportRemove();
  26976. }
  26977. },
  26978. '-',
  26979. {
  26980. text: '注册(至菜单)',
  26981. iconCls: 'x-fa fa-sign-in',
  26982. handler: function (sender) {
  26983. me.reportRegiste(sender);
  26984. }
  26985. },
  26986. {
  26987. text: '卸载',
  26988. iconCls: 'x-fa fa-sign-out',
  26989. handler: function (sender) {
  26990. console.error('没做');
  26991. }
  26992. },
  26993. ]
  26994. };
  26995. var treeMenu = new Ext.menu.Menu(option);
  26996. treeMenu.showAt(e.getXY());
  26997. };
  26998. ReportGridController.prototype.reportRegiste = function (sender) {
  26999. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27000. if (record) {
  27001. var reportName = record.get('report_name');
  27002. var reportId = record.get('report_id');
  27003. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  27004. }
  27005. };
  27006. ReportGridController.prototype.reportRemove = function () {
  27007. var _this = this;
  27008. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27009. if (record) {
  27010. var reportName = record.get('report_name');
  27011. var reportId_1 = record.get('report_id');
  27012. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  27013. delReportApi(reportId_1).then(function (res) {
  27014. if (res.success) {
  27015. msg$1('删除成功');
  27016. _this.reload();
  27017. }
  27018. });
  27019. });
  27020. }
  27021. };
  27022. ReportGridController.prototype.reportEdit = function () {
  27023. var _this = this;
  27024. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27025. if (record) {
  27026. var reportName = record.get('report_name');
  27027. var reportId = record.get('report_id');
  27028. handles.mainWindow.showReport(reportId, reportName, function () {
  27029. _this.reload();
  27030. });
  27031. }
  27032. };
  27033. ReportGridController.prototype.onDblClick = function (sender) {
  27034. this.reportEdit();
  27035. };
  27036. return ReportGridController;
  27037. }());
  27038. function initReportGrid () {
  27039. var controller = new ReportGridController();
  27040. Ext.define('com.yvan.studio.ReportGrid', {
  27041. extend: 'Ext.grid.Panel',
  27042. xtype: 'reportGrid',
  27043. controller: controller,
  27044. scope: controller,
  27045. referenceHolder: true,
  27046. tooltip: '查询报表',
  27047. iconCls: 'x-fa fa-bar-chart',
  27048. useArrows: true,
  27049. reference: 'reportgrid',
  27050. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  27051. listeners: {
  27052. itemdblclick: 'onDblClick',
  27053. afterrender: 'onLoad',
  27054. },
  27055. viewConfig: {
  27056. enableTextSelection: true,
  27057. listeners: {
  27058. itemcontextmenu: 'onGridContextMenu',
  27059. },
  27060. },
  27061. tbar: {
  27062. xtype: 'toolbar',
  27063. items: [
  27064. {
  27065. xtype: 'button',
  27066. tooltip: '测试',
  27067. iconCls: 'x-fa fa-bars',
  27068. listeners: {
  27069. click: 'showSingle'
  27070. }
  27071. },
  27072. {
  27073. xtype: 'button',
  27074. tooltip: '刷新',
  27075. iconCls: 'x-fa fa-refresh',
  27076. listeners: {
  27077. click: 'reload'
  27078. }
  27079. },
  27080. {
  27081. xtype: 'button',
  27082. tooltip: '添加',
  27083. iconCls: 'x-fa fa-plus-circle',
  27084. listeners: {
  27085. click: 'reportAdd'
  27086. }
  27087. },
  27088. {
  27089. xtype: 'button',
  27090. tooltip: '删除',
  27091. iconCls: 'x-fa fa-minus-circle',
  27092. listeners: {
  27093. click: 'reportRemove'
  27094. }
  27095. },
  27096. {
  27097. xtype: 'textfield',
  27098. flex: 1,
  27099. reference: "txtFilter",
  27100. emptyText: '搜索过滤',
  27101. enableKeyEvents: true,
  27102. listeners: {
  27103. change: {
  27104. fn: 'filterChanged',
  27105. buffer: 50
  27106. }
  27107. }
  27108. },
  27109. ]
  27110. },
  27111. columns: [
  27112. {
  27113. text: 'ID', dataIndex: 'report_id',
  27114. hidden: true,
  27115. },
  27116. {
  27117. text: '报表名称', dataIndex: 'report_name',
  27118. flex: 1,
  27119. },
  27120. ]
  27121. });
  27122. }
  27123. /** 所有变量类型 */
  27124. var TypeEnum;
  27125. (function (TypeEnum) {
  27126. TypeEnum["string"] = "string";
  27127. TypeEnum["number"] = "number";
  27128. TypeEnum["object"] = "object";
  27129. TypeEnum["array"] = "array";
  27130. TypeEnum["function"] = "function";
  27131. TypeEnum["null"] = "null";
  27132. TypeEnum["boolean"] = "boolean";
  27133. TypeEnum["symbol"] = "symbol";
  27134. TypeEnum["json"] = "json";
  27135. TypeEnum["math"] = "math";
  27136. TypeEnum["regexp"] = "regexp";
  27137. TypeEnum["date"] = "date";
  27138. TypeEnum["undefined"] = "undefined";
  27139. TypeEnum["nan"] = "nan";
  27140. TypeEnum["reactNode"] = "react_node";
  27141. })(TypeEnum || (TypeEnum = {}));
  27142. /**
  27143. * 判断对象类型
  27144. * @param object 对象
  27145. */
  27146. var variableTypeOf = function (object) {
  27147. var typeStr = Object.prototype.toString.call(object);
  27148. var typeName;
  27149. switch (("" + typeStr).toLowerCase()) {
  27150. case '[object string]':
  27151. typeName = TypeEnum.string;
  27152. break;
  27153. case '[object number]':
  27154. if (Number.isNaN(object)) {
  27155. return TypeEnum.nan;
  27156. }
  27157. typeName = TypeEnum.number;
  27158. break;
  27159. case '[object object]':
  27160. if (object.$$typeof && object.props) {
  27161. var type = variableTypeOf(object.$$typeof);
  27162. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  27163. return TypeEnum.reactNode;
  27164. }
  27165. }
  27166. typeName = TypeEnum.object;
  27167. break;
  27168. case '[object array]':
  27169. typeName = TypeEnum.array;
  27170. break;
  27171. case '[object function]':
  27172. typeName = TypeEnum.function;
  27173. break;
  27174. case '[object null]':
  27175. typeName = TypeEnum.null;
  27176. break;
  27177. case '[object boolean]':
  27178. typeName = TypeEnum.boolean;
  27179. break;
  27180. case '[object date]':
  27181. typeName = TypeEnum.date;
  27182. break;
  27183. // 不常用
  27184. case '[object symbol]':
  27185. typeName = TypeEnum.symbol;
  27186. break;
  27187. case '[object json]':
  27188. typeName = TypeEnum.json;
  27189. break;
  27190. case '[object math]':
  27191. typeName = TypeEnum.math;
  27192. break;
  27193. case '[object regexp]':
  27194. typeName = TypeEnum.regexp;
  27195. break;
  27196. // 貌似不会走的分支
  27197. case '[object undefined]':
  27198. typeName = TypeEnum.undefined;
  27199. break;
  27200. // 无法识别
  27201. default:
  27202. if (object === undefined) {
  27203. return TypeEnum.undefined;
  27204. }
  27205. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  27206. typeName = TypeEnum.object;
  27207. }
  27208. return typeName;
  27209. };
  27210. function initGroovyEditor () {
  27211. Ext.define('com.yvan.studio.GroovyEditor', {
  27212. extend: 'Ext.panel.Panel',
  27213. alias: 'widget.groovyeditor',
  27214. xtype: 'groovyeditor',
  27215. layout: 'fit',
  27216. border: false,
  27217. html: "<div class=\"editor\"/>",
  27218. config: {
  27219. value: ''
  27220. },
  27221. codeChange: undefined,
  27222. isChangeFromOuter: false,
  27223. getCode: function () {
  27224. if (this.editor) {
  27225. return this.editor.getValue();
  27226. }
  27227. else {
  27228. return this.code;
  27229. }
  27230. },
  27231. setCode: function (value) {
  27232. var _this = this;
  27233. this.code = value;
  27234. this.value = value;
  27235. _$2.defer(function () {
  27236. _this.isChangeFromOuter = true;
  27237. if (_this.editor) {
  27238. _this.editor.setValue(value);
  27239. }
  27240. });
  27241. },
  27242. applyPosition: function () {
  27243. var _this = this;
  27244. if (this.autoFocusMethod) {
  27245. if (this.editor) {
  27246. _$2.defer(function () {
  27247. if (_this.autoFocusStartLine) {
  27248. _this.editor.setPosition({
  27249. lineNumber: _this.autoFocusStartLine,
  27250. column: _this.autoFocusStartColumn
  27251. });
  27252. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27253. }
  27254. _this.editor.focus();
  27255. });
  27256. delete this.autoFocusMethod;
  27257. }
  27258. }
  27259. this.editor.layout();
  27260. },
  27261. getValue: function () {
  27262. return this.value;
  27263. },
  27264. setValue: function (value, fromEditor) {
  27265. var me = this;
  27266. if (me.value === value) {
  27267. // 值相等,不需要变化
  27268. return;
  27269. }
  27270. if (fromEditor !== true && me.editor) {
  27271. // 不是来源于编辑器的变化,才设置编辑器的值
  27272. me.editor.setValue(value);
  27273. }
  27274. // 通知mixins setValue
  27275. me.value = value;
  27276. me.fireEvent('change', value);
  27277. },
  27278. initComponent: function () {
  27279. var that = this;
  27280. this.superclass.initComponent.call(this, arguments);
  27281. that.on({
  27282. resize: function () {
  27283. if (that.editor) {
  27284. that.editor.layout();
  27285. }
  27286. },
  27287. destory: function () {
  27288. if (that.editor) {
  27289. that.editor.dispose();
  27290. delete that.editor;
  27291. }
  27292. },
  27293. afterrender: function (sender) {
  27294. var $dom = $(that.el.dom).find('.editor');
  27295. attach_3($dom[0], {
  27296. value: that.code
  27297. }).then(function (editor) {
  27298. that.editor = editor;
  27299. that.applyPosition();
  27300. that.editor.onDidChangeModelContent(function (e) {
  27301. that.fireEvent('change', that.editor, e);
  27302. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  27303. that.codeChange(that.editor.getValue(), that.name, e);
  27304. }
  27305. that.isChangeFromOuter = false;
  27306. });
  27307. });
  27308. }
  27309. });
  27310. }
  27311. });
  27312. }
  27313. function attach_3(element, opts) {
  27314. return new Promise(function (resolve) {
  27315. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  27316. enabled: false
  27317. } }));
  27318. editor.onKeyUp(function (e) {
  27319. // console.log(e)
  27320. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27321. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27322. }
  27323. });
  27324. resolve(editor);
  27325. });
  27326. }
  27327. function initJsEditor$1 () {
  27328. Ext.define('com.yvan.studio.JsEditor', {
  27329. extend: 'Ext.panel.Panel',
  27330. alias: 'widget.jseditor',
  27331. xtype: 'jseditor',
  27332. layout: 'fit',
  27333. border: false,
  27334. html: "<div class=\"editor\"/>",
  27335. autoFocusMethod: true,
  27336. autoFocusStartLine: 0,
  27337. autoFocusStartColumn: 0,
  27338. codeChange: undefined,
  27339. funcArr: [],
  27340. modulePage: null,
  27341. isChangeFromOuter: false,
  27342. name: "",
  27343. /**
  27344. * 设置代码
  27345. */
  27346. setCode: function (value) {
  27347. var _this = this;
  27348. this.code = value;
  27349. _$2.defer(function () {
  27350. _this.isChangeFromOuter = true;
  27351. if (_this.editor) {
  27352. _this.editor.setValue(value);
  27353. if (_this.name === "controllerEditor") {
  27354. _this.funcArr = _this.getAllFunction();
  27355. }
  27356. }
  27357. });
  27358. },
  27359. getCode: function () {
  27360. var _a;
  27361. if (!this.editor) {
  27362. return this.code;
  27363. }
  27364. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27365. },
  27366. applyPosition: function () {
  27367. var _this = this;
  27368. if (this.autoFocusMethod) {
  27369. if (this.editor) {
  27370. _$2.defer(function () {
  27371. if (_this.autoFocusStartLine) {
  27372. _this.editor.setPosition({
  27373. lineNumber: _this.autoFocusStartLine,
  27374. column: _this.autoFocusStartColumn
  27375. });
  27376. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27377. }
  27378. _this.editor.focus();
  27379. });
  27380. delete this.autoFocusMethod;
  27381. }
  27382. }
  27383. this.editor.layout();
  27384. },
  27385. initComponent: function () {
  27386. var that = this;
  27387. this.superclass.initComponent.apply(this, arguments);
  27388. this.on({
  27389. resize: function (sender, width, height) {
  27390. if (that.editor) {
  27391. that.editor.layout();
  27392. }
  27393. },
  27394. destory: function () {
  27395. if (that.editor) {
  27396. that.editor.dispose();
  27397. delete that.editor;
  27398. }
  27399. },
  27400. afterrender: function () {
  27401. var $dom = $(that.el.dom).find('.editor');
  27402. attach_1($dom[0], {
  27403. value: that.code
  27404. }).then(function (editor) {
  27405. that.editor = editor;
  27406. that.applyPosition();
  27407. that.editor.onDidChangeModelContent(function (e) {
  27408. that.fireEvent('change', that.editor, e);
  27409. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27410. that.codeChange(that.editor.getValue(), that.name, e);
  27411. }
  27412. that.isChangeFromOuter = false;
  27413. });
  27414. });
  27415. }
  27416. });
  27417. },
  27418. getAllFunction: function () {
  27419. var funcArr = [];
  27420. var ast = window['YvanUI'].recast.parse(this.code);
  27421. if (ast && ast.program && ast.program.body) {
  27422. if (Array.isArray(ast.program.body)) {
  27423. for (var i = 0; i < ast.program.body.length; i++) {
  27424. var m = ast.program.body[i];
  27425. if (m.type === "ExportDefaultDeclaration") {
  27426. if (m.declaration.type === "ClassDeclaration") {
  27427. if (m.declaration.body.type === "ClassBody") {
  27428. if (Array.isArray(m.declaration.body.body)) {
  27429. for (var j = 0; j < m.declaration.body.body.length; j++) {
  27430. var ob = m.declaration.body.body[j];
  27431. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  27432. var funcItem = { name: ob.key.name, args: [] };
  27433. if (Array.isArray(ob.value.params)) {
  27434. for (var k = 0; k < ob.value.params.length; k++) {
  27435. var p = ob.value.params[k];
  27436. funcItem.args.push(p.name);
  27437. }
  27438. }
  27439. funcArr.push(funcItem);
  27440. }
  27441. }
  27442. }
  27443. }
  27444. }
  27445. }
  27446. }
  27447. }
  27448. }
  27449. return funcArr;
  27450. }
  27451. });
  27452. }
  27453. var isInited = false;
  27454. function attach_1(element, opts) {
  27455. return new Promise(function (resolve) {
  27456. var monaco = window['monaco'];
  27457. if (!isInited) {
  27458. isInited = true;
  27459. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  27460. noSemanticValidation: true,
  27461. noSyntaxValidation: false
  27462. });
  27463. // compiler options
  27464. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  27465. target: monaco.languages.typescript.ScriptTarget.ES2016,
  27466. allowNonTsExtensions: true,
  27467. });
  27468. // extra libraries
  27469. var libSource = [
  27470. 'declare class Facts {',
  27471. ' /**',
  27472. ' * Returns the next fact',
  27473. ' */',
  27474. ' static next():string',
  27475. ' static next222():string',
  27476. '}',
  27477. "\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 ",
  27478. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  27479. ].join('\n');
  27480. var libUri = 'file:///index.d.ts';
  27481. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  27482. // When resolving definitions and references, the editor will try to use created models.
  27483. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  27484. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  27485. }
  27486. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  27487. resolve(editor);
  27488. });
  27489. }
  27490. function initJsonEditor$1 () {
  27491. Ext.define('com.yvan.studio.JsonEditor', {
  27492. extend: 'Ext.panel.Panel',
  27493. alias: 'widget.jsoneditor',
  27494. xtype: 'jsoneditor',
  27495. layout: 'fit',
  27496. border: false,
  27497. html: "<div class=\"editor\"/>",
  27498. autoFocusMethod: true,
  27499. autoFocusStartLine: 0,
  27500. autoFocusStartColumn: 0,
  27501. codeChange: undefined,
  27502. funcArr: [],
  27503. modulePage: null,
  27504. isChangeFromOuter: false,
  27505. name: "",
  27506. /**
  27507. * 设置代码
  27508. */
  27509. setCode: function (value) {
  27510. var _this = this;
  27511. this.code = value;
  27512. _$2.defer(function () {
  27513. _this.isChangeFromOuter = true;
  27514. if (_this.editor) {
  27515. _this.editor.setValue(value);
  27516. }
  27517. });
  27518. },
  27519. updateOptions: function (options) {
  27520. if (this.editor && options) {
  27521. this.editor.updateOptions(options);
  27522. }
  27523. },
  27524. setLanguage: function (lang) {
  27525. if (this.editor && lang) {
  27526. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  27527. }
  27528. },
  27529. getCode: function () {
  27530. var _a;
  27531. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27532. },
  27533. applyPosition: function () {
  27534. var _this = this;
  27535. if (this.autoFocusMethod) {
  27536. if (this.editor) {
  27537. _$2.defer(function () {
  27538. if (_this.autoFocusStartLine) {
  27539. _this.editor.setPosition({
  27540. lineNumber: _this.autoFocusStartLine,
  27541. column: _this.autoFocusStartColumn
  27542. });
  27543. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27544. }
  27545. _this.editor.focus();
  27546. });
  27547. delete this.autoFocusMethod;
  27548. }
  27549. }
  27550. this.editor.layout();
  27551. },
  27552. initComponent: function () {
  27553. var that = this;
  27554. this.superclass.initComponent.apply(this, arguments);
  27555. this.on({
  27556. resize: function (sender, width, height) {
  27557. if (that.editor) {
  27558. that.editor.layout();
  27559. }
  27560. },
  27561. destory: function () {
  27562. if (that.editor) {
  27563. that.editor.dispose();
  27564. delete that.editor;
  27565. }
  27566. },
  27567. afterrender: function (sender) {
  27568. var $dom = $(that.el.dom).find('.editor');
  27569. attach_116($dom[0], {
  27570. value: that.code
  27571. }).then(function (editor) {
  27572. that.editor = editor;
  27573. that.applyPosition();
  27574. that.editor.onDidChangeModelContent(function (e) {
  27575. that.fireEvent('change', that.editor, e);
  27576. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27577. that.codeChange(that.editor.getValue(), that.name, e);
  27578. }
  27579. that.isChangeFromOuter = false;
  27580. });
  27581. });
  27582. }
  27583. });
  27584. },
  27585. });
  27586. }
  27587. function attach_116(element, opts) {
  27588. return new Promise(function (resolve) {
  27589. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  27590. enabled: false
  27591. } }));
  27592. editor.onKeyUp(function (e) {
  27593. // console.log(e)
  27594. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27595. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27596. }
  27597. });
  27598. resolve(editor);
  27599. });
  27600. }
  27601. function initSqlEditor$1 () {
  27602. Ext.define('com.yvan.studio.SqlEditor', {
  27603. extend: 'Ext.panel.Panel',
  27604. alias: 'widget.sqleditor',
  27605. xtype: 'sqleditor',
  27606. layout: 'fit',
  27607. border: false,
  27608. html: "<div class=\"editor\"/>",
  27609. config: {
  27610. value: ''
  27611. },
  27612. codeChange: undefined,
  27613. isChangeFromOuter: false,
  27614. setCode: function (value) {
  27615. var _this = this;
  27616. this.code = value;
  27617. this.value = value;
  27618. _$2.defer(function () {
  27619. _this.isChangeFromOuter = true;
  27620. if (_this.editor) {
  27621. _this.editor.setValue(value);
  27622. }
  27623. });
  27624. },
  27625. getCode: function () {
  27626. return this.getValue();
  27627. },
  27628. updateOptions: function (options) {
  27629. if (this.editor && options) {
  27630. this.editor.updateOptions(options);
  27631. }
  27632. },
  27633. getValue: function () {
  27634. if (!this.editor) {
  27635. return this.code;
  27636. }
  27637. return this.editor.getValue();
  27638. },
  27639. applyPosition: function () {
  27640. var _this = this;
  27641. if (this.autoFocusMethod) {
  27642. if (this.editor) {
  27643. _$2.defer(function () {
  27644. if (_this.autoFocusStartLine) {
  27645. _this.editor.setPosition({
  27646. lineNumber: _this.autoFocusStartLine,
  27647. column: _this.autoFocusStartColumn
  27648. });
  27649. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27650. }
  27651. _this.editor.focus();
  27652. });
  27653. delete this.autoFocusMethod;
  27654. }
  27655. }
  27656. this.editor.layout();
  27657. },
  27658. setValue: function (value, fromEditor) {
  27659. this.setCode(value);
  27660. var me = this;
  27661. if (me.value === value) {
  27662. // 值相等,不需要变化
  27663. return;
  27664. }
  27665. if (fromEditor !== true && me.editor) {
  27666. // 不是来源于编辑器的变化,才设置编辑器的值
  27667. me.editor.setValue(value);
  27668. }
  27669. // 通知mixins setValue
  27670. me.value = value;
  27671. me.fireEvent('change', value);
  27672. },
  27673. initComponent: function () {
  27674. var that = this;
  27675. this.superclass.initComponent.call(this);
  27676. that.on({
  27677. resize: function () {
  27678. if (that.editor) {
  27679. that.editor.layout();
  27680. }
  27681. },
  27682. destory: function () {
  27683. if (that.editor) {
  27684. that.editor.dispose();
  27685. delete that.editor;
  27686. }
  27687. },
  27688. afterrender: function (sender) {
  27689. var $dom = $(that.el.dom).find('.editor');
  27690. attach_2($dom[0], {
  27691. value: that.code
  27692. }).then(function (editor) {
  27693. that.editor = editor;
  27694. that.applyPosition();
  27695. that.editor.onDidChangeModelContent(function (e) {
  27696. that.fireEvent('change', that.editor, e);
  27697. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27698. that.codeChange(that.editor.getValue(), that.name, e);
  27699. }
  27700. that.isChangeFromOuter = false;
  27701. });
  27702. });
  27703. }
  27704. });
  27705. }
  27706. });
  27707. }
  27708. function attach_2(element, opts) {
  27709. return new Promise(function (resolve) {
  27710. var monaco = window['monaco'];
  27711. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  27712. enabled: false
  27713. } }));
  27714. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  27715. // const sql = editor.getValue()
  27716. // if (_.trim(sql).length > 0) {
  27717. // editor.setValue(format(sql, {
  27718. // indent: ' ',
  27719. // uppercase: true,
  27720. // }))
  27721. // }
  27722. msg$1('没做');
  27723. });
  27724. editor.onKeyUp(function (e) {
  27725. // console.log(e)
  27726. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27727. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27728. }
  27729. });
  27730. resolve(editor);
  27731. });
  27732. }
  27733. function initTemplateEditor () {
  27734. Ext.define('com.yvan.studio.TemplateEditor', {
  27735. extend: 'Ext.panel.Panel',
  27736. alias: 'widget.templateeditor',
  27737. xtype: 'templateeditor',
  27738. layout: 'fit',
  27739. border: false,
  27740. html: "<div class=\"editor\"/>",
  27741. autoFocusMethod: true,
  27742. autoFocusStartLine: 0,
  27743. autoFocusStartColumn: 0,
  27744. codeChange: undefined,
  27745. funcArr: [],
  27746. modulePage: null,
  27747. isChangeFromOuter: false,
  27748. name: "",
  27749. /**
  27750. * 设置代码
  27751. */
  27752. setCode: function (value) {
  27753. var _this = this;
  27754. this.code = value;
  27755. _$2.defer(function () {
  27756. _this.isChangeFromOuter = true;
  27757. if (_this.editor) {
  27758. _this.editor.setValue(value);
  27759. }
  27760. });
  27761. },
  27762. getCode: function () {
  27763. var _a;
  27764. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27765. },
  27766. applyPosition: function () {
  27767. var _this = this;
  27768. if (this.autoFocusMethod) {
  27769. if (this.editor) {
  27770. _$2.defer(function () {
  27771. if (_this.autoFocusStartLine) {
  27772. _this.editor.setPosition({
  27773. lineNumber: _this.autoFocusStartLine,
  27774. column: _this.autoFocusStartColumn
  27775. });
  27776. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27777. }
  27778. _this.editor.focus();
  27779. });
  27780. delete this.autoFocusMethod;
  27781. }
  27782. }
  27783. this.editor.layout();
  27784. },
  27785. initComponent: function () {
  27786. var that = this;
  27787. this.superclass.initComponent.apply(this, arguments);
  27788. this.on({
  27789. resize: function (sender, width, height) {
  27790. if (that.editor) {
  27791. that.editor.layout();
  27792. }
  27793. },
  27794. destory: function () {
  27795. if (that.editor) {
  27796. that.editor.dispose();
  27797. delete that.editor;
  27798. }
  27799. },
  27800. afterrender: function (sender) {
  27801. var $dom = $(that.el.dom).find('.editor');
  27802. attach_117($dom[0], {
  27803. value: that.code
  27804. }).then(function (editor) {
  27805. that.editor = editor;
  27806. that.applyPosition();
  27807. that.editor.onDidChangeModelContent(function (e) {
  27808. that.fireEvent('change', that.editor, e);
  27809. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  27810. that.codeChange(that.editor.getValue(), that.name, e);
  27811. }
  27812. that.isChangeFromOuter = false;
  27813. });
  27814. });
  27815. }
  27816. });
  27817. },
  27818. });
  27819. }
  27820. function attach_117(element, opts) {
  27821. return new Promise(function (resolve) {
  27822. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  27823. enabled: false
  27824. } }));
  27825. editor.onKeyUp(function (e) {
  27826. // console.log(e)
  27827. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27828. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27829. }
  27830. });
  27831. resolve(editor);
  27832. });
  27833. }
  27834. var DictStore = /** @class */ (function (_super) {
  27835. __extends(DictStore, _super);
  27836. function DictStore() {
  27837. return _super !== null && _super.apply(this, arguments) || this;
  27838. }
  27839. DictStore.prototype.getCacheKey = function (param) {
  27840. return "dict_data.json";
  27841. };
  27842. DictStore.prototype.invokeApi = function (param) {
  27843. return getDict(param);
  27844. };
  27845. DictStore.prototype.getDicts = function () {
  27846. return this.apiResponse.data.dict;
  27847. };
  27848. DictStore.prototype.getDictCodes = function () {
  27849. return new Promise(function (resolve) {
  27850. // reloadIfNeedPromise().then(() => {
  27851. // const result = []
  27852. // _.forEach(this.getDicts(), dictRow => {
  27853. // result.push({
  27854. // id: dictRow.dict_code,
  27855. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  27856. // })
  27857. // })
  27858. // resolve(result)
  27859. // })
  27860. });
  27861. };
  27862. DictStore.prototype.saveDict = function (param) {
  27863. return saveDictApi(param);
  27864. };
  27865. DictStore.prototype.saveDictItems = function (param) {
  27866. return saveDictItemsApi(param);
  27867. };
  27868. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  27869. var results = [];
  27870. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  27871. if (dictItemRow.dict_code === dict_code) {
  27872. results.push(_$2.clone(dictItemRow));
  27873. }
  27874. });
  27875. return results;
  27876. };
  27877. return DictStore;
  27878. }(CacheStore));
  27879. var instance$2 = new DictStore();
  27880. var DictTreeController = /** @class */ (function () {
  27881. function DictTreeController() {
  27882. this._saveStateFlag = true;
  27883. }
  27884. DictTreeController.prototype.dictSave = function () {
  27885. var _this = this;
  27886. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27887. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  27888. if (err) {
  27889. // 如果有异常就不保存
  27890. return;
  27891. }
  27892. // 进行业务上的逻辑校验,比如说必填校验等等
  27893. var hasError = false;
  27894. _$2.forEach(rows, function (row, i) {
  27895. if (isEmpty(row.dict_code)) {
  27896. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  27897. hasError = true;
  27898. return false;
  27899. }
  27900. });
  27901. if (hasError) {
  27902. return;
  27903. }
  27904. // 设置当前界面为 "保存中..." 状态
  27905. this.view.setLoading(true);
  27906. instance$2.saveDict({
  27907. newRows: newRows,
  27908. modifyRows: modifyRows,
  27909. removeRecords: removeRecords,
  27910. }).then(function (res) {
  27911. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27912. msg$1(res.msg);
  27913. _this.reload();
  27914. }).finally(function () {
  27915. // 无论正常异常,关闭 "保存中..." 状态
  27916. _this.view.setLoading(false);
  27917. });
  27918. };
  27919. DictTreeController.prototype.dictItemSave = function () {
  27920. var _this = this;
  27921. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27922. var currentDictCode = undefined;
  27923. if (record) {
  27924. currentDictCode = record.get('dict_code');
  27925. }
  27926. if (!currentDictCode) {
  27927. msg$1('请选择一个字典');
  27928. return;
  27929. }
  27930. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  27931. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  27932. if (err) {
  27933. // 如果有异常就不保存
  27934. return;
  27935. }
  27936. // 进行业务上的逻辑校验,比如说必填校验等等
  27937. var hasError = false;
  27938. _$2.forEach(rows, function (row, i) {
  27939. if (!row.dict_value && row.dict_value !== 0) {
  27940. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  27941. hasError = true;
  27942. return false;
  27943. }
  27944. });
  27945. if (hasError) {
  27946. return;
  27947. }
  27948. // 设置当前界面为 "保存中..." 状态
  27949. this.view.setLoading(true);
  27950. instance$2.saveDictItems({
  27951. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  27952. newRows: newRows,
  27953. modifyRows: modifyRows,
  27954. removeRecords: removeRecords,
  27955. dict_code: currentDictCode
  27956. }).then(function (res) {
  27957. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  27958. msg$1(res.msg);
  27959. _this.reload();
  27960. }).finally(function () {
  27961. // 无论正常异常,关闭 "保存中..." 状态
  27962. _this.view.setLoading(false);
  27963. });
  27964. };
  27965. DictTreeController.prototype.createDictEnum = function () {
  27966. var _this = this;
  27967. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  27968. var currentDictCode = undefined;
  27969. if (record) {
  27970. currentDictCode = record.get('dict_code');
  27971. }
  27972. if (!currentDictCode) {
  27973. msg$1('请选择一个字典');
  27974. return;
  27975. }
  27976. // 设置当前界面为 "保存中..." 状态
  27977. this.view.setLoading(true);
  27978. createDictEnum({ dictCode: currentDictCode })
  27979. .then(function () { return _this.reload(); })
  27980. .finally(function () { return _this.view.setLoading(false); });
  27981. };
  27982. DictTreeController.prototype.onLoad = function () {
  27983. setDictTree(this);
  27984. this.grid1 = this.view.lookupReference('grid1');
  27985. this.grid2 = this.view.lookupReference('grid2');
  27986. this.grid1.setData([]);
  27987. this.grid2.setData([]);
  27988. // this.grid1.columns[0].hide()
  27989. this.grid2.columns[0].hide();
  27990. // 找管理器订阅刷新的事件
  27991. instance$2.registe(this.refreshData.bind(this));
  27992. // 非强制性刷新 DbManager
  27993. instance$2.reloadIfNeed(undefined);
  27994. };
  27995. DictTreeController.prototype.onDestory = function () {
  27996. instance$2.unregiste(this.refreshData.bind(this));
  27997. };
  27998. // dictStore 刷新时,会回调到这个方法
  27999. DictTreeController.prototype.refreshData = function (isLoadingState) {
  28000. var me = this;
  28001. if (typeof isLoadingState === 'boolean') {
  28002. me.view.setLoading(isLoadingState);
  28003. return;
  28004. }
  28005. this.grid1.setData(instance$2.getDicts());
  28006. this.restoreState();
  28007. };
  28008. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  28009. var _this = this;
  28010. _$2.defer(function () {
  28011. _this.saveState();
  28012. });
  28013. if (!record) {
  28014. this.grid2.setData([]);
  28015. return;
  28016. }
  28017. var dict_code = record.get('dict_code');
  28018. var data = instance$2.getDictItemByDictcode(dict_code);
  28019. this.grid2.setData(data);
  28020. };
  28021. DictTreeController.prototype.reload = function () {
  28022. var _this = this;
  28023. // 强制刷新 DbManager
  28024. instance$2.reloadForce(undefined).then(function (res) {
  28025. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  28026. });
  28027. };
  28028. DictTreeController.prototype.dictAdd = function () {
  28029. this.grid1.appendEditRow({
  28030. _createFlag: true,
  28031. dict_code: '',
  28032. dict_desc: '',
  28033. }, 0);
  28034. };
  28035. DictTreeController.prototype.dictRemove = function () {
  28036. this.grid1.removeEditRow();
  28037. };
  28038. DictTreeController.prototype.dictItemAdd = function () {
  28039. var _a, _b;
  28040. 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;
  28041. if (!dict_code) {
  28042. msg$1('请先保存字典');
  28043. return;
  28044. }
  28045. this.grid2.appendEditRow({
  28046. dict_code: dict_code,
  28047. dict_text: '',
  28048. dict_value: '',
  28049. }, 0);
  28050. };
  28051. DictTreeController.prototype.dictItemRemove = function () {
  28052. var _this = this;
  28053. var rows = [];
  28054. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  28055. rows.push(r);
  28056. });
  28057. _$2.forEach(rows, function (r) {
  28058. _this.grid2.getStore().remove(r);
  28059. });
  28060. };
  28061. DictTreeController.prototype.clearSearch1 = function () {
  28062. this.grid1.store.clearFilter();
  28063. };
  28064. DictTreeController.prototype.search1 = function (sender) {
  28065. this.grid1.store.clearFilter();
  28066. this.getViewModel().set('grid1.selection', null);
  28067. this.grid1.fireEvent('itemselect');
  28068. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28069. if (!value) {
  28070. return;
  28071. }
  28072. this.grid1.store.filterBy(function (record) {
  28073. if (record.get('_createFlag')) {
  28074. return true;
  28075. }
  28076. var dict_code = _$2.lowerCase(record.get('dict_code'));
  28077. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  28078. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  28079. return (dict_code.includes(value) ||
  28080. dict_desc.includes(value) ||
  28081. dict_desc_py.includes(value));
  28082. });
  28083. };
  28084. DictTreeController.prototype.clearSearch2 = function () {
  28085. this.grid2.store.clearFilter();
  28086. };
  28087. DictTreeController.prototype.search2 = function (sender) {
  28088. this.grid2.store.clearFilter();
  28089. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28090. if (!value) {
  28091. return;
  28092. }
  28093. this.grid2.store.filterBy(function (record) {
  28094. var dict_text = _$2.lowerCase(record.get('dict_text'));
  28095. var dict_value = _$2.lowerCase(record.get('dict_value'));
  28096. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  28097. return (dict_text.includes(value) ||
  28098. dict_value === value ||
  28099. dict_text_py.includes(value));
  28100. });
  28101. };
  28102. DictTreeController.prototype.getStateFilename = function () {
  28103. return getCurrentProject().uuid + "/dicttree.json";
  28104. };
  28105. DictTreeController.prototype.restoreState = function () {
  28106. var _this = this;
  28107. var grid = this.grid1;
  28108. native.loadFile(this.getStateFilename(), function (content) {
  28109. if (!content)
  28110. return;
  28111. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  28112. _this._saveStateFlag = false;
  28113. if (selection) {
  28114. var idx = grid.store.findExact('dict_code', selection);
  28115. if (idx >= 0) {
  28116. var record = grid.store.getAt(idx);
  28117. if (record) {
  28118. grid.setSelection([record]);
  28119. }
  28120. }
  28121. }
  28122. if (scrollPosition && scrollSize) {
  28123. var size = grid.scrollable.getSize();
  28124. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  28125. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  28126. }
  28127. }
  28128. setTimeout(function () {
  28129. _this._saveStateFlag = true;
  28130. }, 200);
  28131. });
  28132. };
  28133. DictTreeController.prototype.saveState = function () {
  28134. if (!this._saveStateFlag) {
  28135. return;
  28136. }
  28137. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28138. var selection = undefined;
  28139. if (record) {
  28140. selection = record.get('dict_code');
  28141. }
  28142. var scrollPosition = this.grid1.scrollable.position;
  28143. var scrollSize = this.grid1.scrollable.getSize();
  28144. native.saveFile(this.getStateFilename(), {
  28145. selection: selection,
  28146. scrollPosition: scrollPosition,
  28147. scrollSize: scrollSize
  28148. });
  28149. };
  28150. return DictTreeController;
  28151. }());
  28152. function initDict$1 () {
  28153. var controller = new DictTreeController();
  28154. Ext.define('com.yvan.studio.DictTree', {
  28155. extend: 'Ext.panel.Panel',
  28156. xtype: 'dicttree',
  28157. controller: controller,
  28158. scope: controller,
  28159. referenceHolder: true,
  28160. tooltip: '字典',
  28161. iconCls: 'x-fa fa-book',
  28162. rootVisible: false,
  28163. useArrows: true,
  28164. reference: 'dicttree',
  28165. layout: 'border',
  28166. listeners: {
  28167. afterrender: 'onLoad',
  28168. destory: 'onDestory',
  28169. },
  28170. items: [
  28171. {
  28172. region: 'center',
  28173. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  28174. _mode: 'select',
  28175. tbar: [
  28176. {
  28177. xtype: 'button',
  28178. tooltip: '刷新',
  28179. iconCls: 'x-fa fa-refresh',
  28180. listeners: {
  28181. click: 'reload'
  28182. }
  28183. },
  28184. {
  28185. xtype: 'button',
  28186. tooltip: '添加',
  28187. iconCls: 'x-fa fa-plus-circle',
  28188. listeners: {
  28189. click: 'dictAdd'
  28190. }
  28191. },
  28192. {
  28193. xtype: 'button',
  28194. tooltip: '删除',
  28195. iconCls: 'x-fa fa-minus-circle',
  28196. bind: {
  28197. disabled: '{!grid1.selection}'
  28198. },
  28199. listeners: {
  28200. click: 'dictRemove'
  28201. }
  28202. },
  28203. {
  28204. xtype: 'button',
  28205. tooltip: '保存',
  28206. iconCls: 'x-fa fa-save',
  28207. bind: {
  28208. disabled: '{!grid1.ischanged}'
  28209. },
  28210. listeners: {
  28211. click: 'dictSave'
  28212. }
  28213. },
  28214. {
  28215. xtype: 'textfield',
  28216. hideClear: true,
  28217. triggers: {
  28218. clear: {
  28219. cls: 'x-form-clear-trigger',
  28220. handler: 'clearSearch1'
  28221. },
  28222. },
  28223. flex: 1,
  28224. emptyText: '搜索过滤',
  28225. enableKeyEvents: true,
  28226. listeners: {
  28227. keyup: {
  28228. fn: 'search1',
  28229. buffer: 50
  28230. }
  28231. }
  28232. },
  28233. ],
  28234. listeners: {
  28235. itemselect: 'grid1Selected',
  28236. },
  28237. idField: 'dict_code',
  28238. columns: [
  28239. {
  28240. text: '字典编号', dataIndex: 'dict_code',
  28241. menuDisabled: true, flex: 1,
  28242. editor: {
  28243. allowBlank: true,
  28244. selectOnFocus: false
  28245. }
  28246. },
  28247. {
  28248. text: '中文描述', dataIndex: 'dict_desc',
  28249. menuDisabled: true, flex: 1,
  28250. editor: {
  28251. allowBlank: true,
  28252. selectOnFocus: false
  28253. }
  28254. },
  28255. ]
  28256. },
  28257. {
  28258. region: 'south', height: '50%',
  28259. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  28260. split: true,
  28261. _mode: 'edit1',
  28262. listeners: {},
  28263. tbar: [
  28264. {
  28265. xtype: 'button',
  28266. tooltip: '添加',
  28267. iconCls: 'x-fa fa-plus-circle',
  28268. bind: {
  28269. disabled: '{!grid1.selection}'
  28270. },
  28271. listeners: {
  28272. click: 'dictItemAdd'
  28273. }
  28274. },
  28275. {
  28276. xtype: 'button',
  28277. tooltip: '删除',
  28278. iconCls: 'x-fa fa-minus-circle',
  28279. bind: {
  28280. disabled: '{!grid1.selection}'
  28281. },
  28282. listeners: {
  28283. click: 'dictItemRemove'
  28284. }
  28285. },
  28286. {
  28287. xtype: 'button',
  28288. tooltip: '保存',
  28289. iconCls: 'x-fa fa-save',
  28290. bind: {
  28291. disabled: '{!grid2.ischanged}'
  28292. },
  28293. listeners: {
  28294. click: 'dictItemSave'
  28295. }
  28296. },
  28297. {
  28298. xtype: 'button',
  28299. tooltip: '刷新代码',
  28300. iconCls: 'x-fa fa-code',
  28301. bind: {
  28302. disabled: '{!grid1.selection}'
  28303. },
  28304. listeners: {
  28305. click: 'createDictEnum'
  28306. }
  28307. },
  28308. ],
  28309. columns: [
  28310. {
  28311. text: '字典项', dataIndex: 'dict_text',
  28312. menuDisabled: true, flex: 1,
  28313. editor: {
  28314. allowBlank: true,
  28315. selectOnFocus: false
  28316. }
  28317. },
  28318. {
  28319. text: '字典值', dataIndex: 'dict_value',
  28320. menuDisabled: true, flex: 1,
  28321. dataType: 'int',
  28322. editor: {
  28323. xtype: 'numberfield',
  28324. allowBlank: true,
  28325. selectOnFocus: false
  28326. }
  28327. },
  28328. {
  28329. text: '激活', dataIndex: 'is_enable',
  28330. xtype: 'checkcolumn', menuDisabled: true,
  28331. },
  28332. {
  28333. text: '变量名', dataIndex: 'var_name',
  28334. menuDisabled: true, flex: 1,
  28335. editor: {
  28336. allowBlank: true,
  28337. selectOnFocus: false
  28338. }
  28339. },
  28340. ]
  28341. }
  28342. ]
  28343. });
  28344. }
  28345. var model$g = {
  28346. data: {
  28347. form: {
  28348. path: "",
  28349. requestBody: "",
  28350. responseBody: "",
  28351. }
  28352. }
  28353. };
  28354. var vjson$f = {
  28355. title: '接口信息',
  28356. layout: 'fit',
  28357. width: 800,
  28358. height: 500,
  28359. items: [
  28360. {
  28361. xtype: 'form',
  28362. layout: {
  28363. type: 'vbox',
  28364. pack: 'start',
  28365. align: 'stretch'
  28366. },
  28367. defaults: {
  28368. border: false,
  28369. anchor: '100%',
  28370. margin: '5',
  28371. },
  28372. items: [
  28373. {
  28374. xtype: 'textfield',
  28375. fieldLabel: '接口路径',
  28376. bind: {
  28377. value: "{form.path}",
  28378. },
  28379. },
  28380. {
  28381. xtype: 'textareafield',
  28382. // height: 150,
  28383. flex: 2,
  28384. fieldLabel: '请求数据',
  28385. bind: {
  28386. value: "{form.requestBody}",
  28387. },
  28388. },
  28389. {
  28390. xtype: 'textareafield',
  28391. // height: 150,
  28392. flex: 5,
  28393. fieldLabel: '响应数据',
  28394. bind: {
  28395. value: "{form.responseBody}",
  28396. },
  28397. },
  28398. ]
  28399. }
  28400. ]
  28401. };
  28402. var ApiInfoDialog = /** @class */ (function (_super) {
  28403. __extends(ApiInfoDialog, _super);
  28404. function ApiInfoDialog() {
  28405. return _super.call(this, { model: model$g, vjson: vjson$f }) || this;
  28406. }
  28407. return ApiInfoDialog;
  28408. }(Scope));
  28409. var model$h = {
  28410. data: {
  28411. query: {
  28412. role_id: '',
  28413. resource_id: '',
  28414. },
  28415. form: {},
  28416. form2: {
  28417. key: "",
  28418. start_at: "",
  28419. end_at: "",
  28420. }
  28421. }
  28422. };
  28423. var vjson$g = {
  28424. title: '接口信息',
  28425. layout: 'fit',
  28426. items: [
  28427. {
  28428. layout: 'border',
  28429. border: false,
  28430. items: [
  28431. {
  28432. region: 'center',
  28433. layout: 'border',
  28434. items: [
  28435. {
  28436. region: 'north',
  28437. bind: {
  28438. title: '{form.title}',
  28439. },
  28440. xtype: 'form',
  28441. scrollable: true,
  28442. layout: {
  28443. type: 'vbox',
  28444. pack: 'start',
  28445. align: 'stretch'
  28446. },
  28447. defaults: {
  28448. border: false,
  28449. anchor: '100%',
  28450. margin: '5',
  28451. },
  28452. tbar: {
  28453. xtype: 'toolbar',
  28454. items: [
  28455. {
  28456. xtype: 'button',
  28457. text: '查询',
  28458. iconCls: 'x-fa fa-search',
  28459. listeners: {
  28460. click: 'scope.requestLogs'
  28461. },
  28462. },
  28463. {
  28464. xtype: 'button',
  28465. text: '保存',
  28466. iconCls: 'x-fa fa-save',
  28467. listeners: {},
  28468. },
  28469. {
  28470. xtype: 'button',
  28471. text: '禁用',
  28472. iconCls: 'x-fa fa-stop-circle',
  28473. bind: {},
  28474. listeners: {},
  28475. },
  28476. {
  28477. xtype: 'button',
  28478. text: '启用',
  28479. iconCls: 'x-fa fa-play-circle',
  28480. bind: {},
  28481. listeners: {},
  28482. },
  28483. ],
  28484. },
  28485. items: [
  28486. {
  28487. xtype: 'cols',
  28488. defaults: { labelWidth: 120 },
  28489. items: [
  28490. {
  28491. xtype: 'textfield',
  28492. fieldLabel: 'URL',
  28493. bind: {
  28494. value: '{form.api_url}',
  28495. },
  28496. readOnly: true,
  28497. },
  28498. {
  28499. xtype: 'textfield',
  28500. fieldLabel: '名称',
  28501. bind: {
  28502. value: '{form.api_name}',
  28503. },
  28504. readOnly: true,
  28505. },
  28506. ],
  28507. },
  28508. {
  28509. xtype: 'cols',
  28510. defaults: { labelWidth: 120 },
  28511. items: [
  28512. {
  28513. xtype: 'textfield',
  28514. fieldLabel: '实现类',
  28515. bind: {
  28516. value: '{form.api_class}',
  28517. },
  28518. readOnly: true,
  28519. },
  28520. {
  28521. border: false,
  28522. flex: 1
  28523. },
  28524. ]
  28525. },
  28526. {
  28527. xtype: 'cols',
  28528. defaults: { labelWidth: 120 },
  28529. items: [
  28530. {
  28531. xtype: 'textfield',
  28532. fieldLabel: '超时时间',
  28533. bind: {
  28534. value: '{form.timeout}',
  28535. },
  28536. readOnly: true,
  28537. },
  28538. {
  28539. border: false,
  28540. flex: 1
  28541. },
  28542. ]
  28543. },
  28544. {
  28545. xtype: 'cols',
  28546. defaults: { labelWidth: 120 },
  28547. items: [
  28548. {
  28549. xtype: 'textfield',
  28550. fieldLabel: 'Remote IP',
  28551. bind: {
  28552. value: '{form.remote_ip}',
  28553. },
  28554. readOnly: true,
  28555. },
  28556. {
  28557. border: false,
  28558. flex: 1
  28559. },
  28560. ]
  28561. },
  28562. {
  28563. xtype: 'cols',
  28564. defaults: { labelWidth: 120 },
  28565. items: [
  28566. {
  28567. xtype: 'textfield',
  28568. fieldLabel: '解析表单',
  28569. bind: {
  28570. value: '{form.chandi}',
  28571. },
  28572. readOnly: true,
  28573. },
  28574. {
  28575. border: false,
  28576. flex: 1
  28577. },
  28578. ]
  28579. },
  28580. ],
  28581. },
  28582. {
  28583. region: 'center',
  28584. // title: 'Request',
  28585. layout: 'border',
  28586. items: [
  28587. {
  28588. region: 'north',
  28589. xtype: 'form',
  28590. reference: 'form2',
  28591. split: true,
  28592. items: [
  28593. {
  28594. xtype: 'cols',
  28595. width: 700,
  28596. items: [
  28597. {
  28598. xtype: 'textfield',
  28599. fieldLabel: '关键字',
  28600. bind: {
  28601. value: "{form2.key}"
  28602. },
  28603. },
  28604. {
  28605. xtype: 'datefield',
  28606. fieldLabel: '开始时间',
  28607. bind: {
  28608. value: "{form2.start_at}"
  28609. },
  28610. },
  28611. {
  28612. xtype: 'datefield',
  28613. fieldLabel: '结束时间',
  28614. bind: {
  28615. value: "{form2.end_at}"
  28616. },
  28617. },
  28618. ]
  28619. }
  28620. ]
  28621. },
  28622. {
  28623. region: 'center',
  28624. xtype: 'yvgrid',
  28625. layout: 'fit',
  28626. reference: 'grid1',
  28627. pagination: true,
  28628. autoLoad: false,
  28629. selModel: {
  28630. selType: 'rowmodel',
  28631. mode: 'SINGLE',
  28632. },
  28633. dataSource: {
  28634. method: 'invoke',
  28635. url: '/sys/api/Api@requestLogs',
  28636. params: {
  28637. formData: '{form2}',
  28638. path: '{form.api_url}',
  28639. },
  28640. },
  28641. listeners: {
  28642. rowdblclick: 'scope.showDialog',
  28643. },
  28644. columns: [
  28645. { dataIndex: "@timestamp", header: "时间", width: 150 },
  28646. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  28647. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  28648. { dataIndex: "size", header: "大小", width: 80 },
  28649. { dataIndex: "path", header: "path", flex: 1 },
  28650. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  28651. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  28652. ]
  28653. }
  28654. ]
  28655. },
  28656. ],
  28657. },
  28658. ],
  28659. },
  28660. ],
  28661. referenceHolder: true,
  28662. };
  28663. var Api = /** @class */ (function (_super) {
  28664. __extends(Api, _super);
  28665. function Api() {
  28666. return _super.call(this, { model: model$h, vjson: vjson$g }) || this;
  28667. }
  28668. Api.prototype.onLoad = function () {
  28669. _super.prototype.onLoad.call(this);
  28670. this.requestLogs();
  28671. };
  28672. Api.prototype.selectList = function (sender, selected, eOpts) {
  28673. this.viewModel.set("form", selected.data);
  28674. if (selected.data.api_type === '1') {
  28675. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  28676. }
  28677. else {
  28678. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  28679. }
  28680. };
  28681. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  28682. var sel = [];
  28683. _$2.forEach(records, function (item) {
  28684. if (item.data.flg === 'Y') {
  28685. sel.push(item);
  28686. }
  28687. });
  28688. this.refs.methodGrid.selModel.select(sel);
  28689. };
  28690. Api.prototype.saveAll = function () {
  28691. var _this = this;
  28692. var _a, _b, _c;
  28693. var role_id = this.viewModel.get("query.role_id");
  28694. if (!role_id) {
  28695. msg$1("请先选择一个角色");
  28696. return;
  28697. }
  28698. var wh_id = this.viewModel.get("form.wh_id");
  28699. if (!wh_id) {
  28700. msg$1("请先选择一个仓库");
  28701. return;
  28702. }
  28703. var menus = this.refs.theTree.getChecked();
  28704. var rowsMenus = [];
  28705. _$2.forEach(menus, function (m) {
  28706. if (m.data.resource_id) {
  28707. rowsMenus.push(m.data.resource_id);
  28708. }
  28709. });
  28710. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  28711. 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; });
  28712. _$2.remove(mm, function (x) {
  28713. return methodsArry.includes(x.resource_id);
  28714. });
  28715. var rowsBtn = [];
  28716. _$2.forEach(mm, function (m) {
  28717. rowsBtn.push({ resource_id: m.resource_id });
  28718. });
  28719. this.setLoading(true);
  28720. invokeServer$1('/sys/role/Role@saveAll', {
  28721. wh_id: wh_id,
  28722. role_id: role_id,
  28723. rowsMenus: rowsMenus,
  28724. rowsBtn: rowsBtn,
  28725. }).then(function (res) {
  28726. msg$1(res.msg);
  28727. if (res.success) {
  28728. _this.reloadTree();
  28729. // this.viewModel.set('query.role_id', '')
  28730. _this.viewModel.set('query.resource_id', '');
  28731. _this.refs.methodGrid.reload();
  28732. }
  28733. }).finally(function () {
  28734. _this.setLoading(false);
  28735. });
  28736. };
  28737. Api.prototype.editRoleSuccess = function (sender, data) {
  28738. if (data.success) {
  28739. this.refs.roleGrid.reload();
  28740. this.viewModel.set("query.JIAOS_ID", "");
  28741. this.reloadTree();
  28742. this.viewModel.set("query.CAID_ID", "");
  28743. this.refs.methodGrid.reload();
  28744. }
  28745. };
  28746. Api.prototype.deleteRole = function (sender) {
  28747. var _this = this;
  28748. var role_id = this.viewModel.get("query.role_id");
  28749. if (!role_id) {
  28750. msg$1("请先选择一个角色");
  28751. return;
  28752. }
  28753. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  28754. if (btn === 'yes') {
  28755. invokeServer$1('/sys/role/Role@deleteRole', {
  28756. role_id: role_id,
  28757. wh_id: window['whId']
  28758. }).then(function (res) {
  28759. msg$1(res.msg);
  28760. if (res.success) {
  28761. _this.refs.roleGrid.reload();
  28762. _this.viewModel.set("query.role_id", "");
  28763. _this.reloadTree();
  28764. _this.refs.methodGrid.reload();
  28765. }
  28766. });
  28767. }
  28768. });
  28769. };
  28770. Api.prototype.reloadTree = function () {
  28771. showErrorDialog$1('reloadTree 不存在');
  28772. };
  28773. Api.prototype.whChange = function (sender, value) {
  28774. this.viewModel.set("form.wh_id", value);
  28775. this.reloadTree();
  28776. this.refs.methodGrid.reload();
  28777. };
  28778. Api.prototype.requestLogs = function () {
  28779. var path = this.viewModel.get("form.api_url");
  28780. if (!path)
  28781. return;
  28782. this.refs.grid1.reload();
  28783. };
  28784. Api.prototype.showDialog = function (sender) {
  28785. var _a, _b;
  28786. 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; });
  28787. if (!rows || rows.length <= 0)
  28788. return;
  28789. var dialog = new ApiInfoDialog();
  28790. dialog.showDialog(null, {}, {
  28791. data: {
  28792. form: __assign({}, rows[0])
  28793. }
  28794. });
  28795. };
  28796. return Api;
  28797. }(Scope));
  28798. var Controller = /** @class */ (function () {
  28799. function Controller() {
  28800. }
  28801. Controller.prototype.selectList = function (sender, selected, eOpts) {
  28802. var _a, _b, _c, _d, _e, _f, _g, _h;
  28803. // @ts-ignore
  28804. 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; });
  28805. if (!rows || rows.length <= 0)
  28806. return;
  28807. var apiPage = new Api();
  28808. apiPage.showPage({
  28809. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  28810. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  28811. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  28812. }, {
  28813. data: {
  28814. form: __assign({}, rows[0])
  28815. }
  28816. });
  28817. };
  28818. return Controller;
  28819. }());
  28820. var controller = new Controller();
  28821. function initApiTree () {
  28822. Ext.define('com.yvan.studio.ApiGrid', {
  28823. extend: 'Ext.Panel',
  28824. xtype: 'apigrid',
  28825. controller: controller,
  28826. scope: controller,
  28827. referenceHolder: true,
  28828. layout: 'fit',
  28829. items: [
  28830. {
  28831. width: 400,
  28832. split: true,
  28833. xtype: 'yvgrid',
  28834. reference: 'roleGrid',
  28835. border: false,
  28836. pagination: false,
  28837. autoLoad: true,
  28838. remoteFilter: false,
  28839. selModel: {
  28840. selType: 'rowmodel',
  28841. mode: 'SINGLE',
  28842. },
  28843. tbar: {
  28844. xtype: 'toolbar',
  28845. items: [
  28846. {
  28847. xtype: 'button',
  28848. text: '新增',
  28849. iconCls: 'x-fa fa-plus-circle',
  28850. listeners: {},
  28851. },
  28852. {
  28853. xtype: 'button',
  28854. text: '删除',
  28855. iconCls: 'x-fa fa-trash',
  28856. bind: {
  28857. disabled: '{roleGrid.selection==null}',
  28858. },
  28859. listeners: {},
  28860. },
  28861. ],
  28862. },
  28863. dataSource: {
  28864. url: '/sys/api/Api@getApiList',
  28865. method: 'invoke',
  28866. params: {},
  28867. },
  28868. listeners: {
  28869. itemdblclick: "selectList",
  28870. },
  28871. columns: [
  28872. {
  28873. dataIndex: 'api_name',
  28874. header: '接口名称',
  28875. filter: { type: 'string' },
  28876. flex: 1,
  28877. },
  28878. ],
  28879. },
  28880. ]
  28881. });
  28882. }
  28883. var model$i = {
  28884. data: {
  28885. iframeSrc: ''
  28886. }
  28887. };
  28888. var vjson$h = {
  28889. layout: 'fit',
  28890. border: false,
  28891. iconCls: 'x-fa fa-newspaper-o',
  28892. referenceHolder: true,
  28893. items: [
  28894. {
  28895. // title: 'view.design',
  28896. xtype: 'uxiframe',
  28897. layout: 'fit',
  28898. // cls: 'module_page_iframe',
  28899. reference: 'iframe',
  28900. listeners: {
  28901. afterrender: 'scope.iframeRender'
  28902. }
  28903. },
  28904. ]
  28905. };
  28906. var Iframe = /** @class */ (function (_super) {
  28907. __extends(Iframe, _super);
  28908. function Iframe(path) {
  28909. var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this;
  28910. _this.path = "";
  28911. _this.path = path;
  28912. return _this;
  28913. }
  28914. Iframe.prototype.iframeRender = function (sender) {
  28915. var $dom = $(sender.el.dom).find('iframe');
  28916. var iframe = $dom[0];
  28917. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  28918. iframe.onload = function () {
  28919. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  28920. };
  28921. };
  28922. return Iframe;
  28923. }(Scope));
  28924. var Controller$1 = /** @class */ (function () {
  28925. function Controller() {
  28926. }
  28927. Controller.prototype.onDblClick = function (sender, record) {
  28928. var data = record.raw;
  28929. if (data.text === "运行报表") {
  28930. this.openIframe("/xxl-job/index", "运行报表");
  28931. }
  28932. else if (data.text === "任务管理") {
  28933. this.openIframe("/xxl-job/jobinfo", "任务管理");
  28934. }
  28935. else if (data.text === "调度日志") {
  28936. this.openIframe("/xxl-job/joblog", "调度日志");
  28937. }
  28938. else if (data.text === "执行器管理") {
  28939. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  28940. }
  28941. };
  28942. Controller.prototype.openIframe = function (path, title) {
  28943. var page = new Iframe(path);
  28944. page.showPage({
  28945. title: title,
  28946. id: 'xxljob__' + path.replaceAll("/", "_"),
  28947. path: 'xxljob__' + path.replaceAll("/", "_"),
  28948. }, {});
  28949. };
  28950. Controller.prototype.onLoad = function () {
  28951. var me = this;
  28952. me.getView().setRootNode({
  28953. expanded: true,
  28954. leaf: false,
  28955. children: [
  28956. { leaf: true, text: '运行报表' },
  28957. { leaf: true, text: '任务管理' },
  28958. { leaf: true, text: '调度日志' },
  28959. { leaf: true, text: '执行器管理' },
  28960. ]
  28961. });
  28962. };
  28963. return Controller;
  28964. }());
  28965. var controller$1 = new Controller$1();
  28966. function initTaskTree () {
  28967. Ext.define('com.yvan.studio.TaskTree', {
  28968. extend: 'Ext.tree.Panel',
  28969. xtype: 'tasktree',
  28970. controller: controller$1,
  28971. scope: controller$1,
  28972. reference: 'roleGrid',
  28973. tooltip: '表单定义',
  28974. iconCls: 'x-fa fa-bar-chart',
  28975. useArrows: true,
  28976. rootVisible: false,
  28977. colspan: 2,
  28978. lines: true,
  28979. multiSelect: false,
  28980. referenceHolder: true,
  28981. // openNode() {
  28982. // const selection = this.getSelection()
  28983. // const [record] = selection
  28984. // if (!record) {
  28985. // return
  28986. // }
  28987. //
  28988. // const {raw} = record;
  28989. // if (raw.type === 'Dir') {
  28990. // return
  28991. // }
  28992. // if (raw.type === "Module" && raw.module) {
  28993. // // eventBus.publish(EventType.ModuleOpen, raw)
  28994. // }
  28995. // },
  28996. listeners: {
  28997. itemdblclick: 'onDblClick',
  28998. afterrender: "onLoad",
  28999. },
  29000. });
  29001. }
  29002. var model$j = {
  29003. data: {
  29004. form: {
  29005. address: "",
  29006. level: "",
  29007. logger: "",
  29008. message: "",
  29009. nodeName: "",
  29010. serverName: "",
  29011. thread: "",
  29012. whId: "",
  29013. userId: "",
  29014. }
  29015. }
  29016. };
  29017. var vjson$i = {
  29018. title: '接口信息',
  29019. layout: 'fit',
  29020. width: 800,
  29021. height: 600,
  29022. items: [
  29023. {
  29024. xtype: 'form',
  29025. layout: {
  29026. type: 'vbox',
  29027. pack: 'start',
  29028. align: 'stretch'
  29029. },
  29030. defaults: {
  29031. border: false,
  29032. anchor: '100%',
  29033. margin: '5',
  29034. },
  29035. items: [
  29036. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  29037. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  29038. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  29039. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  29040. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  29041. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  29042. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  29043. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  29044. {
  29045. xtype: 'textareafield',
  29046. flex: 5,
  29047. fieldLabel: '响应数据',
  29048. bind: {
  29049. value: "{form.message}",
  29050. },
  29051. },
  29052. ]
  29053. }
  29054. ]
  29055. };
  29056. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  29057. __extends(ApiInfoDialog, _super);
  29058. function ApiInfoDialog() {
  29059. return _super.call(this, { model: model$j, vjson: vjson$i }) || this;
  29060. }
  29061. return ApiInfoDialog;
  29062. }(Scope));
  29063. var model$k = {
  29064. data: {
  29065. form2: {}
  29066. }
  29067. };
  29068. var vjson$j = {
  29069. title: '日志查询',
  29070. layout: 'fit',
  29071. width: "70%",
  29072. height: "80%",
  29073. items: [
  29074. {
  29075. region: 'center',
  29076. xtype: 'yvgrid',
  29077. layout: 'fit',
  29078. reference: 'grid1',
  29079. pagination: false,
  29080. autoLoad: false,
  29081. selModel: {
  29082. selType: 'rowmodel',
  29083. mode: 'SINGLE',
  29084. },
  29085. dataSource: {
  29086. method: 'invoke',
  29087. url: '/sys/api/Api@aroundLogs',
  29088. params: {
  29089. formData: '{form2}',
  29090. },
  29091. },
  29092. listeners: {
  29093. rowdblclick: 'scope.showDialog2',
  29094. },
  29095. columns: [
  29096. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29097. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29098. { dataIndex: "thread", header: "thread", width: 150 },
  29099. { dataIndex: "message", header: "message", flex: 1 },
  29100. ]
  29101. }
  29102. ]
  29103. };
  29104. var AroundLog = /** @class */ (function (_super) {
  29105. __extends(AroundLog, _super);
  29106. function AroundLog() {
  29107. return _super.call(this, { model: model$k, vjson: vjson$j }) || this;
  29108. }
  29109. AroundLog.prototype.onLoad = function () {
  29110. _super.prototype.onLoad.call(this);
  29111. this.queryLog();
  29112. };
  29113. AroundLog.prototype.queryLog = function () {
  29114. this.refs.grid1.reload();
  29115. };
  29116. AroundLog.prototype.showDialog2 = function () {
  29117. var _a, _b;
  29118. 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; });
  29119. if (!rows || rows.length <= 0)
  29120. return;
  29121. var dialog = new ApiInfoDialog$1();
  29122. dialog.showDialog(null, {}, {
  29123. data: {
  29124. form: __assign({}, rows[0])
  29125. }
  29126. });
  29127. };
  29128. return AroundLog;
  29129. }(Scope));
  29130. var model$l = {
  29131. data: {
  29132. form2: {
  29133. key: "",
  29134. start_at: "",
  29135. end_at: "",
  29136. }
  29137. }
  29138. };
  29139. var vjson$k = {
  29140. title: '日志查询',
  29141. layout: 'fit',
  29142. tbar: {
  29143. xtype: 'toolbar',
  29144. items: [
  29145. {
  29146. xtype: 'button',
  29147. text: '刷新',
  29148. listeners: {
  29149. click: 'scope.queryLog'
  29150. },
  29151. },
  29152. {
  29153. xtype: 'button',
  29154. text: '周围日志',
  29155. bind: {},
  29156. listeners: {
  29157. click: 'scope.aroundLogs'
  29158. },
  29159. },
  29160. ],
  29161. },
  29162. items: [
  29163. {
  29164. region: 'center',
  29165. xtype: 'yvgrid',
  29166. layout: 'fit',
  29167. reference: 'grid1',
  29168. pagination: true,
  29169. autoLoad: false,
  29170. selModel: {
  29171. selType: 'rowmodel',
  29172. mode: 'SINGLE',
  29173. },
  29174. dataSource: {
  29175. method: 'invoke',
  29176. url: '/sys/api/Api@queryLog',
  29177. params: {
  29178. formData: '{form2}',
  29179. path: '{form.api_url}',
  29180. },
  29181. },
  29182. listeners: {
  29183. rowdblclick: 'scope.showDialog',
  29184. },
  29185. columns: [
  29186. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29187. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29188. { dataIndex: "thread", header: "thread", width: 150 },
  29189. { dataIndex: "message", header: "message", flex: 1 },
  29190. ]
  29191. }
  29192. ]
  29193. };
  29194. var LogPage = /** @class */ (function (_super) {
  29195. __extends(LogPage, _super);
  29196. function LogPage() {
  29197. return _super.call(this, { model: model$l, vjson: vjson$k }) || this;
  29198. }
  29199. LogPage.prototype.onLoad = function () {
  29200. _super.prototype.onLoad.call(this);
  29201. this.queryLog();
  29202. };
  29203. LogPage.prototype.queryLog = function () {
  29204. this.refs.grid1.reload();
  29205. };
  29206. LogPage.prototype.showDialog = function () {
  29207. var _a, _b;
  29208. 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; });
  29209. if (!rows || rows.length <= 0)
  29210. return;
  29211. var dialog = new ApiInfoDialog$1();
  29212. dialog.showDialog(null, {}, {
  29213. data: {
  29214. form: __assign({}, rows[0])
  29215. }
  29216. });
  29217. };
  29218. LogPage.prototype.aroundLogs = function () {
  29219. var _a, _b;
  29220. 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; });
  29221. if (!rows || rows.length <= 0)
  29222. return;
  29223. var dialog = new AroundLog();
  29224. dialog.showDialog(null, {}, {
  29225. data: {
  29226. form2: __assign({}, rows[0])
  29227. }
  29228. });
  29229. };
  29230. return LogPage;
  29231. }(Scope));
  29232. var Controller$2 = /** @class */ (function () {
  29233. function Controller() {
  29234. }
  29235. Controller.prototype.queryLog = function () {
  29236. var form2 = this.getViewModel().get("form2");
  29237. var logPage = new LogPage();
  29238. logPage.showPage({}, {
  29239. data: {
  29240. form2: __assign({}, form2)
  29241. }
  29242. });
  29243. };
  29244. return Controller;
  29245. }());
  29246. var controller$2 = new Controller$2();
  29247. function initLogsTree () {
  29248. Ext.define('com.yvan.studio.LogsTree', {
  29249. extend: 'Ext.panel.Panel',
  29250. xtype: 'logstree',
  29251. controller: controller$2,
  29252. scope: controller$2,
  29253. viewModel: {
  29254. data: {
  29255. form2: {
  29256. key: "",
  29257. start_at: "",
  29258. end_at: "",
  29259. }
  29260. }
  29261. },
  29262. reference: 'logstree',
  29263. tooltip: '表单定义',
  29264. iconCls: 'x-fa fa-bar-chart',
  29265. useArrows: true,
  29266. rootVisible: false,
  29267. colspan: 2,
  29268. lines: true,
  29269. multiSelect: false,
  29270. referenceHolder: true,
  29271. items: [
  29272. {
  29273. region: 'north',
  29274. xtype: 'form',
  29275. reference: 'form2',
  29276. split: true,
  29277. items: [
  29278. {
  29279. xtype: 'textfield',
  29280. fieldLabel: '关键字',
  29281. bind: {
  29282. value: "{form2.key}"
  29283. },
  29284. },
  29285. {
  29286. xtype: 'datefield',
  29287. fieldLabel: '开始时间',
  29288. bind: {
  29289. value: "{form2.start_at}"
  29290. },
  29291. },
  29292. {
  29293. xtype: 'datefield',
  29294. fieldLabel: '结束时间',
  29295. bind: {
  29296. value: "{form2.end_at}"
  29297. },
  29298. },
  29299. ]
  29300. },
  29301. {
  29302. xtype: "cols",
  29303. items: [
  29304. {
  29305. xtype: "box",
  29306. },
  29307. {
  29308. xtype: "button",
  29309. text: '查询',
  29310. listeners: {
  29311. click: 'queryLog'
  29312. },
  29313. },
  29314. {
  29315. xtype: "box",
  29316. },
  29317. ]
  29318. },
  29319. ],
  29320. });
  29321. }
  29322. var model$m = {
  29323. data: {
  29324. // opsId: "",
  29325. // name: "",
  29326. running: false,
  29327. }
  29328. };
  29329. var vjson$l = {
  29330. bind: {
  29331. title: '运维-{name}',
  29332. },
  29333. layout: 'fit',
  29334. items: [
  29335. {
  29336. layout: 'border',
  29337. items: [
  29338. {
  29339. region: 'north',
  29340. items: [
  29341. {
  29342. xtype: 'toolbar',
  29343. border: false,
  29344. items: [
  29345. {
  29346. xtype: 'button',
  29347. text: '执行',
  29348. iconCls: 'x-fa fa-play',
  29349. bind: {
  29350. hidden: "{running}",
  29351. },
  29352. listeners: {
  29353. click: 'scope.start'
  29354. }
  29355. },
  29356. {
  29357. xtype: 'button',
  29358. text: '停止',
  29359. iconCls: 'x-fa fa-stop',
  29360. bind: {
  29361. hidden: "{!running}",
  29362. },
  29363. listeners: {
  29364. click: 'scope.stop'
  29365. }
  29366. },
  29367. ],
  29368. },
  29369. ]
  29370. },
  29371. {
  29372. region: 'center',
  29373. reference: 'terminal',
  29374. xtype: 'terminal',
  29375. },
  29376. ],
  29377. },
  29378. ],
  29379. };
  29380. var DevOpsTerminal = /** @class */ (function (_super) {
  29381. __extends(DevOpsTerminal, _super);
  29382. function DevOpsTerminal() {
  29383. var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this;
  29384. _this.websocket = undefined;
  29385. return _this;
  29386. }
  29387. DevOpsTerminal.prototype.onLoad = function () {
  29388. this.load();
  29389. };
  29390. DevOpsTerminal.prototype.onDestroy = function () {
  29391. if (this.websocket) {
  29392. this.websocket.close();
  29393. this.websocket = undefined;
  29394. }
  29395. };
  29396. DevOpsTerminal.prototype.load = function () {
  29397. var _this = this;
  29398. var opsId = this.viewModel.get('opsId');
  29399. this.setLoading(true);
  29400. devOpsById(opsId).then(function (res) {
  29401. _this.viewModel.set('devOps', res.data);
  29402. }).finally(function () {
  29403. _this.setLoading(false);
  29404. });
  29405. };
  29406. DevOpsTerminal.prototype.start = function () {
  29407. var me = this;
  29408. var running = this.viewModel.get('running');
  29409. var devOps = this.viewModel.get('devOps');
  29410. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  29411. return;
  29412. var devopsServer = "ws://122.9.140.63:9999";
  29413. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  29414. this.websocket.addEventListener('open', function () {
  29415. me.viewModel.set('running', true);
  29416. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  29417. });
  29418. this.websocket.addEventListener('message', function (event) {
  29419. me.refs.terminal.write(event.data);
  29420. });
  29421. this.websocket.addEventListener('close', function () {
  29422. me.stop();
  29423. });
  29424. this.websocket.addEventListener('error', function () {
  29425. me.stop();
  29426. });
  29427. };
  29428. DevOpsTerminal.prototype.stop = function () {
  29429. if (this.websocket) {
  29430. this.websocket.close();
  29431. this.websocket = undefined;
  29432. }
  29433. this.viewModel.set('running', false);
  29434. };
  29435. return DevOpsTerminal;
  29436. }(Scope));
  29437. var Controller$3 = /** @class */ (function () {
  29438. function Controller() {
  29439. }
  29440. Controller.prototype.onLoad = function (sender) {
  29441. this.reload();
  29442. };
  29443. Controller.prototype.reload = function () {
  29444. var me = this;
  29445. // @ts-ignore
  29446. var view = me.getView();
  29447. view.setLoading(true);
  29448. devOpsList().then(function (res) {
  29449. view.setStore(new Ext.data.Store({
  29450. fields: ['ops_id', 'host', 'name'],
  29451. data: res.data,
  29452. }));
  29453. }).finally(function () {
  29454. view.setLoading(false);
  29455. });
  29456. };
  29457. Controller.prototype.onDblClick = function (sender) {
  29458. this.devOpsTerminal();
  29459. };
  29460. Controller.prototype.devOpsTerminal = function () {
  29461. // @ts-ignore
  29462. var view = this.getView();
  29463. var _a = __read(view.getSelection(), 1), record = _a[0];
  29464. if (record) {
  29465. var name = record.get('name');
  29466. var opsId = record.get('ops_id');
  29467. var instance = new DevOpsTerminal();
  29468. instance.showPage({
  29469. id: 'ops_' + opsId,
  29470. path: 'ops_' + opsId,
  29471. }, {
  29472. data: {
  29473. opsId: opsId,
  29474. name: name,
  29475. }
  29476. });
  29477. instance.dialogSuccess = function () {
  29478. };
  29479. }
  29480. };
  29481. return Controller;
  29482. }());
  29483. var controller$3 = new Controller$3();
  29484. function initDevOpsTree () {
  29485. Ext.define('com.yvan.studio.DevOpsGrid', {
  29486. extend: 'Ext.grid.Panel',
  29487. xtype: 'devopsgrid',
  29488. controller: controller$3,
  29489. scope: controller$3,
  29490. referenceHolder: true,
  29491. tooltip: '运维',
  29492. iconCls: 'x-fa fa-terminal',
  29493. useArrows: true,
  29494. reference: 'devopsgrid',
  29495. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29496. listeners: {
  29497. afterrender: 'onLoad',
  29498. itemdblclick: 'onDblClick',
  29499. },
  29500. viewConfig: {
  29501. // listeners: {
  29502. // itemcontextmenu: 'onGridContextMenu',
  29503. // },
  29504. },
  29505. tbar: {
  29506. xtype: 'toolbar',
  29507. items: [
  29508. {
  29509. xtype: 'button',
  29510. tooltip: '刷新',
  29511. iconCls: 'x-fa fa-refresh',
  29512. listeners: {
  29513. click: 'reload'
  29514. }
  29515. },
  29516. {
  29517. xtype: 'textfield',
  29518. flex: 1,
  29519. emptyText: '搜索过滤',
  29520. enableKeyEvents: true,
  29521. listeners: {
  29522. change: {
  29523. fn: 'filterChanged',
  29524. buffer: 50
  29525. }
  29526. }
  29527. },
  29528. ]
  29529. },
  29530. columns: [
  29531. {
  29532. text: 'ID', dataIndex: 'report_id',
  29533. hidden: true,
  29534. },
  29535. {
  29536. text: '服务器',
  29537. dataIndex: 'host',
  29538. width: 100,
  29539. menuDisabled: true,
  29540. },
  29541. {
  29542. text: '操作名称',
  29543. dataIndex: 'name',
  29544. flex: 1,
  29545. menuDisabled: true,
  29546. },
  29547. ]
  29548. });
  29549. }
  29550. function initTerminal () {
  29551. Ext.define('com.yvan.studio.Terminal', {
  29552. extend: 'Ext.panel.Panel',
  29553. alias: 'widget.terminal',
  29554. xtype: 'terminal',
  29555. layout: 'fit',
  29556. border: false,
  29557. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  29558. config: {},
  29559. write: function (str) {
  29560. if (this.term) {
  29561. this.term.write(str);
  29562. }
  29563. },
  29564. initComponent: function () {
  29565. var that = this;
  29566. this.superclass.initComponent.call(this, arguments);
  29567. that.on({
  29568. resize: function () {
  29569. var _a;
  29570. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  29571. that.fitAddon.fit();
  29572. }
  29573. },
  29574. destory: function () {
  29575. if (that.term) {
  29576. that.term.dispose();
  29577. delete that.term;
  29578. }
  29579. if (that.fitAddon) {
  29580. that.fitAddon.dispose();
  29581. delete that.fitAddon;
  29582. }
  29583. },
  29584. afterrender: function (sender) {
  29585. _.defer(function () {
  29586. var $dom = $(that.el.dom).find('.terminal');
  29587. that.term = new xterm.Terminal({
  29588. // cursorBlink: false,
  29589. // cursorStyle: 'bar', // block underline bar
  29590. // enableBold: false,
  29591. // bellStyle: "sound",
  29592. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  29593. // scrollback: 10000,
  29594. // tabStopWidth: 4,
  29595. disableStdin: true,
  29596. theme: {
  29597. // foreground: "#111",
  29598. // background: "#fdfdfd",
  29599. // background: "#fafafa",
  29600. },
  29601. });
  29602. that.fitAddon = new xtermAddonFit.FitAddon();
  29603. that.term.loadAddon(that.fitAddon);
  29604. that.term.open($dom[0]);
  29605. that.fitAddon.fit();
  29606. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  29607. });
  29608. }
  29609. });
  29610. }
  29611. });
  29612. }
  29613. var vjson$m = {
  29614. title: '接口统计',
  29615. layout: 'fit',
  29616. items: [
  29617. {
  29618. title: '接口统计',
  29619. xtype: 'yvgrid',
  29620. enableLocking: false,
  29621. reference: 'grid1',
  29622. pagination: false,
  29623. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29624. tbar: {
  29625. xtype: 'form',
  29626. items: [
  29627. {
  29628. xtype: 'cols',
  29629. items: [
  29630. {
  29631. xtype: 'textfield',
  29632. fieldLabel: '搜索',
  29633. listeners: {
  29634. change: 'scope.requestFilterChange'
  29635. }
  29636. },
  29637. ]
  29638. },
  29639. ]
  29640. },
  29641. columns: [
  29642. { text: '地址', dataIndex: 'url', flex: 1 },
  29643. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  29644. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29645. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29646. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29647. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29648. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29649. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29650. ],
  29651. leadingBufferZone: 8,
  29652. trailingBufferZone: 8,
  29653. viewConfig: {
  29654. listeners: {
  29655. expandbody: 'scope.onChildExpand'
  29656. }
  29657. },
  29658. listeners: {
  29659. itemdblclick: 'scope.itemClick1'
  29660. },
  29661. plugins: {
  29662. rowwidget: {
  29663. widget: {
  29664. xtype: 'yvgrid',
  29665. hideFootbar: true,
  29666. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29667. listeners: {
  29668. itemdblclick: 'scope.itemClick1'
  29669. },
  29670. columns: [
  29671. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29672. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29673. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29674. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29675. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29676. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29677. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29678. ]
  29679. }
  29680. }
  29681. }
  29682. },
  29683. ]
  29684. };
  29685. var model$n = {
  29686. data: {
  29687. count: 0,
  29688. dataSourceName: '',
  29689. sql: "",
  29690. histogram: '',
  29691. maxCost: 0,
  29692. minCost: 0,
  29693. avgCost: '',
  29694. sumCost: 0,
  29695. histogramInfos: [
  29696. // count: 1
  29697. // gteCost: 20
  29698. // ltCost: 50
  29699. // 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"
  29700. // topN: [
  29701. // cost: 24
  29702. // occurrenceTime: "1648004895171"
  29703. // 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"
  29704. // ]
  29705. ]
  29706. }
  29707. };
  29708. var vjson$n = {
  29709. title: '性能统计详情',
  29710. height: 400,
  29711. width: 800,
  29712. modal: true,
  29713. layout: 'fit',
  29714. items: [
  29715. {
  29716. xtype: 'tabpanel',
  29717. items: [
  29718. {
  29719. title: '摘要',
  29720. key: "1",
  29721. layout: 'border',
  29722. items: [
  29723. {
  29724. region: 'north',
  29725. border: false,
  29726. defaults: {
  29727. margin: '8 0 0 0'
  29728. },
  29729. items: [
  29730. {
  29731. xtype: 'cols',
  29732. defaultType: 'displayfield',
  29733. defaults: {
  29734. labelWidth: 70,
  29735. },
  29736. items: [
  29737. {
  29738. fieldLabel: 'count',
  29739. bind: {
  29740. value: '{count}'
  29741. }
  29742. },
  29743. {
  29744. fieldLabel: 'maxCost',
  29745. bind: {
  29746. value: '{maxCost}'
  29747. }
  29748. },
  29749. {
  29750. fieldLabel: 'minCost',
  29751. bind: {
  29752. value: '{minCost}'
  29753. }
  29754. },
  29755. {
  29756. fieldLabel: 'avgCost',
  29757. bind: {
  29758. value: '{avgCost}'
  29759. }
  29760. },
  29761. {
  29762. fieldLabel: 'sumCost',
  29763. bind: {
  29764. value: '{sumCost}'
  29765. }
  29766. },
  29767. ]
  29768. },
  29769. {
  29770. xtype: 'cols',
  29771. items: [
  29772. {
  29773. flex: 5,
  29774. border: false,
  29775. items: [
  29776. {
  29777. xtype: 'segmentedbutton',
  29778. reference: 'histogram',
  29779. allowToggle: false,
  29780. border: false,
  29781. items: []
  29782. }
  29783. ]
  29784. },
  29785. ]
  29786. },
  29787. ],
  29788. },
  29789. {
  29790. region: 'center',
  29791. xtype: 'sqleditor',
  29792. reference: 'sqlEditor',
  29793. },
  29794. ]
  29795. },
  29796. {
  29797. title: '直方图',
  29798. key: "2",
  29799. }
  29800. ]
  29801. }
  29802. ]
  29803. };
  29804. var PerformDialog = /** @class */ (function (_super) {
  29805. __extends(PerformDialog, _super);
  29806. function PerformDialog() {
  29807. return _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  29808. }
  29809. PerformDialog.prototype.onLoad = function () {
  29810. var _this = this;
  29811. var sql = this.viewModel.get('sql');
  29812. var sql2 = sqlFormat.format(sql, {
  29813. indent: ' ',
  29814. uppercase: true,
  29815. });
  29816. var histogramInfos = this.viewModel.get('histogramInfos');
  29817. var vs = _$2.map(histogramInfos, function (v) {
  29818. if (v.ltCost > 2100000000) {
  29819. return {
  29820. text: "[" + v.gteCost + ", \u221E):" + v.count
  29821. };
  29822. }
  29823. return {
  29824. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  29825. };
  29826. });
  29827. this.refs.sqlEditor.setCode(sql2);
  29828. _$2.forEach(vs, function (v) {
  29829. _this.refs.histogram.add(v);
  29830. });
  29831. };
  29832. return PerformDialog;
  29833. }(Scope));
  29834. var model$o = {
  29835. data: {}
  29836. };
  29837. var PerformStats = /** @class */ (function (_super) {
  29838. __extends(PerformStats, _super);
  29839. function PerformStats() {
  29840. var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this;
  29841. _this.requestFilterChange = _.debounce(function (sender, value) {
  29842. var store = _this.refs.grid1.store;
  29843. store.clearFilter();
  29844. if (value) {
  29845. store.filterBy(function (record, id) {
  29846. var text = toString(record.get('url'));
  29847. // 用拼音筛选的方式
  29848. return text.includes(value);
  29849. });
  29850. }
  29851. }, 100);
  29852. return _this;
  29853. }
  29854. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29855. widget.setData(record.data.children);
  29856. };
  29857. PerformStats.prototype.itemClick1 = function (sender, record) {
  29858. console.log('itemClick1', record.data);
  29859. new PerformDialog().showDialog(sender, {}, {
  29860. data: record.data
  29861. });
  29862. };
  29863. PerformStats.prototype.onLoad = function () {
  29864. var _this = this;
  29865. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29866. .then(function (_a) {
  29867. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29868. var resData = reqRes.data;
  29869. var jdbcData = jdbcRes.data;
  29870. _.forEach(jdbcData, function (item) {
  29871. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29872. });
  29873. _.forEach(resData, function (item) {
  29874. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29875. if (_.isArray(item.sqls)) {
  29876. item.children = _.map(item.sqls, function (sql) {
  29877. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29878. }).filter(function (v) { return !!v; });
  29879. }
  29880. item.jdbcCount = _.size(item.children);
  29881. });
  29882. _this.refs.grid1.setData(resData);
  29883. // this.refs.grid2.setData(jdbcData)
  29884. });
  29885. };
  29886. return PerformStats;
  29887. }(Scope));
  29888. var vjson$o = {
  29889. title: '性能统计',
  29890. layout: 'fit',
  29891. items: [
  29892. {
  29893. title: '数据库统计',
  29894. xtype: 'yvgrid',
  29895. enableLocking: false,
  29896. reference: 'grid2',
  29897. pagination: false,
  29898. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29899. tbar: {
  29900. xtype: 'form',
  29901. items: [
  29902. {
  29903. xtype: 'cols',
  29904. items: [
  29905. {
  29906. fieldLabel: '搜索',
  29907. listeners: {
  29908. change: 'scope.jdbcFilterChange'
  29909. }
  29910. },
  29911. ]
  29912. },
  29913. ]
  29914. },
  29915. listeners: {
  29916. itemdblclick: 'scope.itemClick1'
  29917. },
  29918. columns: [
  29919. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29920. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29921. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29922. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29923. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29924. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29925. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29926. ]
  29927. },
  29928. ]
  29929. };
  29930. var model$p = {
  29931. data: {}
  29932. };
  29933. var PerformStats$1 = /** @class */ (function (_super) {
  29934. __extends(PerformStats, _super);
  29935. function PerformStats() {
  29936. var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this;
  29937. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  29938. var store = _this.refs.grid2.store;
  29939. store.clearFilter();
  29940. if (value) {
  29941. store.filterBy(function (record, id) {
  29942. var text = toString(record.get('sql'));
  29943. // 用拼音筛选的方式
  29944. return text.includes(value);
  29945. });
  29946. }
  29947. }, 100);
  29948. return _this;
  29949. }
  29950. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29951. widget.setData(record.data.children);
  29952. };
  29953. PerformStats.prototype.itemClick1 = function (sender, record) {
  29954. console.log('itemClick1', record.data);
  29955. new PerformDialog().showDialog(sender, {}, {
  29956. data: record.data
  29957. });
  29958. };
  29959. PerformStats.prototype.onLoad = function () {
  29960. var _this = this;
  29961. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  29962. .then(function (_a) {
  29963. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  29964. var resData = reqRes.data;
  29965. var jdbcData = jdbcRes.data;
  29966. _.forEach(jdbcData, function (item) {
  29967. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29968. });
  29969. _.forEach(resData, function (item) {
  29970. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  29971. if (_.isArray(item.sqls)) {
  29972. item.children = _.map(item.sqls, function (sql) {
  29973. return _.find(jdbcData, function (r) { return r.sql === sql; });
  29974. }).filter(function (v) { return !!v; });
  29975. }
  29976. item.jdbcCount = _.size(item.children);
  29977. });
  29978. _this.refs.grid2.setData(jdbcData);
  29979. });
  29980. };
  29981. return PerformStats;
  29982. }(Scope));
  29983. var Controller$4 = /** @class */ (function () {
  29984. function Controller() {
  29985. }
  29986. Controller.prototype.onDblClick = function (sender, record) {
  29987. var data = record.raw;
  29988. if (data.text === "接口统计") {
  29989. var page = new PerformStats();
  29990. page.showPage({
  29991. title: "接口统计",
  29992. id: '_InterfaceStatistics',
  29993. path: '_InterfaceStatistics',
  29994. }, {});
  29995. }
  29996. else if (data.text === "数据库统计") {
  29997. var page = new PerformStats$1();
  29998. page.showPage({
  29999. title: "数据库统计",
  30000. id: '_DatabaseStatistics',
  30001. path: '_DatabaseStatistics',
  30002. }, {});
  30003. }
  30004. };
  30005. Controller.prototype.onLoad = function () {
  30006. var me = this;
  30007. //@ts-ignore
  30008. var view = me.getView();
  30009. view.setRootNode({
  30010. expanded: true,
  30011. leaf: false,
  30012. children: [
  30013. { leaf: true, text: '接口统计' },
  30014. { leaf: true, text: '数据库统计' },
  30015. ]
  30016. });
  30017. };
  30018. return Controller;
  30019. }());
  30020. var controller$4 = new Controller$4();
  30021. function initMonitorTree () {
  30022. Ext.define('com.yvan.studio.MonitorTree', {
  30023. extend: 'Ext.tree.Panel',
  30024. xtype: 'monitortree',
  30025. controller: controller$4,
  30026. scope: controller$4,
  30027. reference: 'roleGrid',
  30028. tooltip: '表单定义',
  30029. iconCls: 'x-fa fa-bar-chart',
  30030. useArrows: true,
  30031. rootVisible: false,
  30032. colspan: 2,
  30033. lines: true,
  30034. multiSelect: false,
  30035. referenceHolder: true,
  30036. // openNode() {
  30037. // const selection = this.getSelection()
  30038. // const [record] = selection
  30039. // if (!record) {
  30040. // return
  30041. // }
  30042. //
  30043. // const {raw} = record;
  30044. // if (raw.type === 'Dir') {
  30045. // return
  30046. // }
  30047. // if (raw.type === "Module" && raw.module) {
  30048. // // eventBus.publish(EventType.ModuleOpen, raw)
  30049. // }
  30050. // },
  30051. listeners: {
  30052. itemdblclick: 'onDblClick',
  30053. afterrender: "onLoad",
  30054. },
  30055. });
  30056. }
  30057. var Controller$5 = /** @class */ (function () {
  30058. function Controller() {
  30059. }
  30060. return Controller;
  30061. }());
  30062. var controller$5 = new Controller$5();
  30063. function initHomeTree () {
  30064. Ext.define('com.yvan.studio.HomeTree', {
  30065. extend: 'Ext.Panel',
  30066. xtype: 'hometree',
  30067. controller: controller$5,
  30068. scope: controller$5,
  30069. referenceHolder: true,
  30070. bodyCls: 'home',
  30071. // layout: 'fit',
  30072. tbar: {
  30073. xtype: 'toolbar',
  30074. items: [
  30075. {
  30076. xtype: 'button',
  30077. iconCls: 'x-fa fa-exchange',
  30078. text: '数据结构同步',
  30079. handler: function (sender) {
  30080. handles$1.mainWindow.showDataSync(sender);
  30081. }
  30082. },
  30083. {
  30084. xtype: 'button',
  30085. iconCls: 'x-fa fa-cubes',
  30086. text: '数据域管理',
  30087. handler: function (sender) {
  30088. handles$1.mainWindow.showColumnDomain();
  30089. }
  30090. },
  30091. ],
  30092. },
  30093. // items: [
  30094. //
  30095. // ],
  30096. layout: {
  30097. type: 'vbox',
  30098. pack: 'start',
  30099. align: 'stretch',
  30100. },
  30101. items: [
  30102. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  30103. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  30104. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  30105. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  30106. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  30107. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  30108. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  30109. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  30110. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  30111. ],
  30112. });
  30113. }
  30114. var WidgetStore = /** @class */ (function (_super) {
  30115. __extends(WidgetStore, _super);
  30116. function WidgetStore() {
  30117. return _super !== null && _super.apply(this, arguments) || this;
  30118. }
  30119. WidgetStore.prototype.getCacheKey = function (param) {
  30120. return "widget_data.json";
  30121. };
  30122. /*invokeApi(param: any): Promise<any> {
  30123. return new Promise<any>(resolve => {
  30124. //@ts-ignore
  30125. require(["../../widget/all"], function (res) {
  30126. const widgetList = res.default
  30127. resolve(widgetList)
  30128. })
  30129. })
  30130. }*/
  30131. WidgetStore.prototype.invokeApi = function (param) {
  30132. return widgetListApi(param);
  30133. };
  30134. return WidgetStore;
  30135. }(CacheStore));
  30136. var instance$3 = new WidgetStore();
  30137. var WidgetGridController = /** @class */ (function () {
  30138. function WidgetGridController() {
  30139. }
  30140. WidgetGridController.prototype.onLoad = function (sender) {
  30141. var me = this;
  30142. setWidget(me);
  30143. instance$3.registe(me.reloadData.bind(this));
  30144. instance$3.reloadIfNeed(undefined);
  30145. };
  30146. WidgetGridController.prototype.widgetAdd = function (sender) {
  30147. var me = this;
  30148. var win = new Ext.Window({
  30149. autoDestroy: true,
  30150. title: "新建弹框",
  30151. width: 400,
  30152. height: 220,
  30153. resizable: true,
  30154. closable: true,
  30155. maximizable: true,
  30156. minimizable: true,
  30157. plain: true,
  30158. // constrainHeader: true,
  30159. constrain: true,
  30160. layout: 'fit',
  30161. animateTarget: sender,
  30162. buttonAlign: 'center',
  30163. items: [
  30164. {
  30165. xtype: "form",
  30166. layout: "hbox",
  30167. margin: '10px 20px',
  30168. border: 0,
  30169. items: [
  30170. {
  30171. flex: 1,
  30172. layout: 'vbox',
  30173. items: [
  30174. {
  30175. xtype: "textfield",
  30176. name: "widgetcode",
  30177. fieldLabel: "弹窗文件",
  30178. flex: 1,
  30179. allowBlank: false,
  30180. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  30181. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  30182. labelWidth: 80,
  30183. width: "100%",
  30184. },
  30185. {
  30186. xtype: "textfield",
  30187. name: "widgetname",
  30188. fieldLabel: "弹窗名称",
  30189. flex: 1,
  30190. allowBlank: false,
  30191. labelWidth: 80,
  30192. width: "100%",
  30193. },
  30194. ]
  30195. },
  30196. ]
  30197. }
  30198. ],
  30199. //窗口按钮
  30200. buttons: [
  30201. {
  30202. xtype: 'button', text: '保存', handler: function (btn) {
  30203. //窗口获取表单
  30204. var form = win.down('form');
  30205. var vaildSuccess = form.isValid();
  30206. if (!vaildSuccess) {
  30207. return;
  30208. }
  30209. var title = form.down('textfield[name="widgetname"]').getValue();
  30210. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  30211. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  30212. if (res.success) {
  30213. msg$1('添加成功');
  30214. // 添加
  30215. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  30216. me.reload();
  30217. });
  30218. win.close();
  30219. }
  30220. });
  30221. }
  30222. },
  30223. {
  30224. xtype: 'button', text: '取消', handler: function (btn) {
  30225. //窗口关闭
  30226. win.close();
  30227. }
  30228. }
  30229. ]
  30230. });
  30231. win.show();
  30232. };
  30233. WidgetGridController.prototype.widgetRemove = function (sender) {
  30234. var _this = this;
  30235. //@ts-ignore
  30236. var record = this.getView().selection.data;
  30237. if (!record) {
  30238. msg$1('请选择一行');
  30239. return;
  30240. }
  30241. var widgetPath = record.widget_path;
  30242. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  30243. if (btn === 'yes') {
  30244. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  30245. if (res.success) {
  30246. msg$1(res.msg);
  30247. _this.reload();
  30248. }
  30249. });
  30250. }
  30251. });
  30252. };
  30253. WidgetGridController.prototype.widgetEdit = function (record) {
  30254. var _this = this;
  30255. if (record) {
  30256. var widgetPath = record.widget_path;
  30257. var widgetName = record.widget_name;
  30258. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  30259. _this.reload();
  30260. });
  30261. }
  30262. };
  30263. WidgetGridController.prototype.onDestory = function (sender) {
  30264. var me = this;
  30265. setWidget(undefined);
  30266. instance$3.unregiste(me.reloadData.bind(this));
  30267. };
  30268. WidgetGridController.prototype.reloadData = function (res) {
  30269. var me = this;
  30270. //@ts-ignore
  30271. var view = me.getView();
  30272. if (typeof res === 'object') {
  30273. // const data = []
  30274. // _.forOwn(res, (v, k) => {
  30275. // data.push({
  30276. // widget_path: k,
  30277. // widget_name: v.title,
  30278. // vjson : v
  30279. // })
  30280. // })
  30281. view.setStore(new Ext.data.Store({
  30282. fields: ['widget_path', 'widget_name'],
  30283. data: res.data,
  30284. }));
  30285. }
  30286. else if (typeof res === 'boolean') {
  30287. view.setLoading(res);
  30288. }
  30289. };
  30290. WidgetGridController.prototype.reload = function () {
  30291. instance$3.reloadForce(undefined);
  30292. };
  30293. WidgetGridController.prototype.filterChanged = function (sender, value) {
  30294. //@ts-ignore
  30295. this.view.store.clearFilter();
  30296. if (value) {
  30297. //@ts-ignore
  30298. this.view.store.filterBy(function (record) {
  30299. var widget_path = record.get('widget_path');
  30300. var widget_name = record.get('widget_name');
  30301. return (window['system'].pinyinMatch(widget_name, value) ||
  30302. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30303. });
  30304. }
  30305. };
  30306. WidgetGridController.prototype.onClearClick = function () {
  30307. var _a, _b;
  30308. //@ts-ignore
  30309. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30310. };
  30311. WidgetGridController.prototype.onDblClick = function (sender, record) {
  30312. this.widgetEdit(record.data);
  30313. };
  30314. return WidgetGridController;
  30315. }());
  30316. function initWidget () {
  30317. var controller = new WidgetGridController();
  30318. Ext.define('com.yvan.studio.WidgetGrid', {
  30319. extend: 'Ext.grid.Panel',
  30320. xtype: 'widgetgrid',
  30321. controller: controller,
  30322. scope: controller,
  30323. referenceHolder: true,
  30324. tooltip: '检索窗口',
  30325. iconCls: 'x-fa fa-search',
  30326. useArrows: true,
  30327. reference: 'widgetgrid',
  30328. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30329. listeners: {
  30330. itemdblclick: 'onDblClick',
  30331. afterrender: 'onLoad',
  30332. destory: 'onDestory',
  30333. },
  30334. viewConfig: {
  30335. listeners: {
  30336. itemcontextmenu: 'onGridContextMenu',
  30337. },
  30338. },
  30339. tbar: [
  30340. {
  30341. xtype: 'button',
  30342. tooltip: '刷新',
  30343. iconCls: 'x-fa fa-refresh',
  30344. listeners: {
  30345. click: 'reload'
  30346. }
  30347. },
  30348. {
  30349. xtype: 'button',
  30350. tooltip: '添加',
  30351. iconCls: 'x-fa fa-plus-circle',
  30352. listeners: {
  30353. click: 'widgetAdd'
  30354. }
  30355. },
  30356. {
  30357. xtype: 'button',
  30358. tooltip: '删除',
  30359. iconCls: 'x-fa fa-minus-circle',
  30360. listeners: {
  30361. click: 'widgetRemove'
  30362. }
  30363. },
  30364. ],
  30365. fbar: [
  30366. {
  30367. xtype: 'textfield',
  30368. flex: 1,
  30369. reference: "txtFilter",
  30370. emptyText: '搜索过滤',
  30371. enableKeyEvents: true,
  30372. listeners: {
  30373. change: {
  30374. fn: 'filterChanged',
  30375. buffer: 50
  30376. }
  30377. }
  30378. },
  30379. ],
  30380. columns: [
  30381. {
  30382. text: '弹窗文件', dataIndex: 'widget_path',
  30383. menuDisabled: true, flex: 1,
  30384. },
  30385. {
  30386. text: '弹窗名称', dataIndex: 'widget_name',
  30387. menuDisabled: true, flex: 1,
  30388. },
  30389. ]
  30390. });
  30391. }
  30392. var WhLayoutController = /** @class */ (function () {
  30393. function WhLayoutController() {
  30394. }
  30395. WhLayoutController.prototype.onLoad = function (sender) {
  30396. var _this = this;
  30397. var me = this;
  30398. setWhLayout(me);
  30399. _$2.defer(function () {
  30400. _this.reload();
  30401. });
  30402. };
  30403. WhLayoutController.prototype.reload = function () {
  30404. //@ts-ignore
  30405. var view = this.getView();
  30406. view.setLoading(true);
  30407. loadWhLayoutAll().then(function (res) {
  30408. view.setStore(new Ext.data.Store({
  30409. fields: ['layout_code', 'layout_name'],
  30410. data: res.data,
  30411. }));
  30412. }).finally(function () {
  30413. view.setLoading(false);
  30414. });
  30415. };
  30416. WhLayoutController.prototype.add = function () {
  30417. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  30418. };
  30419. WhLayoutController.prototype.edit = function (data) {
  30420. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  30421. };
  30422. WhLayoutController.prototype.remove = function () {
  30423. var _this = this;
  30424. var _a;
  30425. //@ts-ignore
  30426. var view = this.getView();
  30427. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30428. if (!record) {
  30429. msg$1('请选择一行数据');
  30430. return;
  30431. }
  30432. var layoutCode = record.layout_code;
  30433. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  30434. if (btn === 'yes') {
  30435. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  30436. if (res.success) {
  30437. msg$1(res.msg);
  30438. _this.reload();
  30439. }
  30440. });
  30441. }
  30442. });
  30443. };
  30444. WhLayoutController.prototype.onDblClick = function () {
  30445. var _a;
  30446. //@ts-ignore
  30447. var view = this.getView();
  30448. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30449. if (!record) {
  30450. msg$1('请选择一行数据');
  30451. return;
  30452. }
  30453. this.edit(record);
  30454. };
  30455. WhLayoutController.prototype.filterChanged = function (sender, value) {
  30456. //@ts-ignore
  30457. this.view.store.clearFilter();
  30458. if (value) {
  30459. //@ts-ignore
  30460. this.view.store.filterBy(function (record) {
  30461. var widget_path = record.get('widget_path');
  30462. var widget_name = record.get('widget_name');
  30463. return (window['system'].pinyinMatch(widget_name, value) ||
  30464. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30465. });
  30466. }
  30467. };
  30468. WhLayoutController.prototype.onClearClick = function () {
  30469. var _a, _b;
  30470. //@ts-ignore
  30471. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30472. };
  30473. return WhLayoutController;
  30474. }());
  30475. function initWhLayout () {
  30476. var controller = new WhLayoutController();
  30477. Ext.define('com.yvan.studio.WhLayout', {
  30478. extend: 'Ext.grid.Panel',
  30479. xtype: 'whlayout',
  30480. alias: 'widget.whlayout',
  30481. controller: controller,
  30482. scope: controller,
  30483. referenceHolder: true,
  30484. tooltip: '检索窗口',
  30485. iconCls: 'x-fa fa-search',
  30486. useArrows: true,
  30487. reference: 'whlayout',
  30488. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30489. listeners: {
  30490. itemdblclick: 'onDblClick',
  30491. afterrender: 'onLoad',
  30492. destory: 'onDestory',
  30493. },
  30494. viewConfig: {
  30495. listeners: {
  30496. itemcontextmenu: 'onGridContextMenu',
  30497. },
  30498. },
  30499. tbar: [
  30500. {
  30501. xtype: 'button',
  30502. tooltip: '刷新',
  30503. iconCls: 'x-fa fa-refresh',
  30504. listeners: {
  30505. click: 'reload'
  30506. }
  30507. },
  30508. {
  30509. xtype: 'button',
  30510. tooltip: '添加',
  30511. iconCls: 'x-fa fa-plus-circle',
  30512. listeners: {
  30513. click: 'add'
  30514. }
  30515. },
  30516. {
  30517. xtype: 'button',
  30518. tooltip: '删除',
  30519. iconCls: 'x-fa fa-minus-circle',
  30520. listeners: {
  30521. click: 'remove'
  30522. }
  30523. },
  30524. ],
  30525. fbar: [
  30526. {
  30527. xtype: 'textfield',
  30528. flex: 1,
  30529. reference: "txtFilter",
  30530. emptyText: '搜索过滤',
  30531. enableKeyEvents: true,
  30532. listeners: {
  30533. change: {
  30534. fn: 'filterChanged',
  30535. buffer: 50
  30536. }
  30537. }
  30538. },
  30539. ],
  30540. columns: [
  30541. {
  30542. text: '图编号', dataIndex: 'layout_code',
  30543. menuDisabled: true, flex: 1,
  30544. },
  30545. {
  30546. text: '图名称', dataIndex: 'layout_name',
  30547. menuDisabled: true, flex: 1,
  30548. },
  30549. ]
  30550. });
  30551. }
  30552. var BpmnTreeController = /** @class */ (function () {
  30553. function BpmnTreeController() {
  30554. }
  30555. BpmnTreeController.prototype.onLoad = function (sender) {
  30556. this.reload();
  30557. };
  30558. BpmnTreeController.prototype.reload = function () {
  30559. var me = this;
  30560. me.getView().setLoading(true);
  30561. exporerList().then(function (res) {
  30562. // handles.mainWindow.modules = res.data
  30563. // const rootNode = modulesToTreeData(res.data)
  30564. var rootNode = res.data.tree;
  30565. me.getView().setRootNode({
  30566. expanded: true,
  30567. leaf: false,
  30568. children: rootNode
  30569. });
  30570. // const lastId = window.location.hash.substring(1);
  30571. // file.selectPath(lastId)
  30572. // if (lastId) {
  30573. // const node = getModuleById(rootNode, lastId)
  30574. // if (node) {
  30575. // showDesign(node.id, node.path, node.text, node.module)
  30576. // }
  30577. // }
  30578. // this.restoreState()
  30579. }).finally(function () {
  30580. me.getView().setLoading(false);
  30581. });
  30582. };
  30583. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  30584. var _this = this;
  30585. e.preventDefault();
  30586. var raw = node.raw;
  30587. //const me = sender.up("treepanel").scope
  30588. var option;
  30589. if (raw.exporerType === 1) ;
  30590. else if (raw.exporerType === 21) {
  30591. if (raw.type === 'Dir') {
  30592. option = {
  30593. shadow: 'frame', allowOtherMenus: true,
  30594. items: [
  30595. {
  30596. text: '添加',
  30597. iconCls: 'x-fa fa-plus-circle',
  30598. handler: function (sender) {
  30599. var dirPath = raw.dirPath;
  30600. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  30601. }
  30602. },
  30603. '-',
  30604. {
  30605. text: '新建文件夹',
  30606. iconCls: 'x-fa fa-folder-o',
  30607. handler: function (sender) {
  30608. }
  30609. }
  30610. ]
  30611. };
  30612. }
  30613. else if (raw.type === 'Model') {
  30614. option = {
  30615. shadow: 'frame', allowOtherMenus: true,
  30616. items: [
  30617. {
  30618. text: '编辑',
  30619. iconCls: 'x-fa fa-edit',
  30620. handler: function (sender) {
  30621. }
  30622. },
  30623. {
  30624. text: '删除',
  30625. iconCls: 'x-fa fa-minus-circle',
  30626. handler: function (sender) {
  30627. }
  30628. },
  30629. '-',
  30630. {
  30631. text: '注册(至菜单)',
  30632. iconCls: 'x-fa fa-sign-in',
  30633. handler: function (sender) {
  30634. }
  30635. },
  30636. {
  30637. text: '新建文件夹',
  30638. iconCls: 'x-fa fa-folder-o',
  30639. handler: function (sender) {
  30640. }
  30641. }
  30642. ]
  30643. };
  30644. }
  30645. }
  30646. else if (raw.exporerType === 22) {
  30647. if (raw.type === 'Dir') {
  30648. option = {
  30649. shadow: 'frame', allowOtherMenus: true,
  30650. items: [
  30651. {
  30652. text: '添加',
  30653. iconCls: 'x-fa fa-plus-circle',
  30654. handler: function (sender) {
  30655. var dirPath = raw.dirPath;
  30656. handles$1.mainWindow.showFormBill();
  30657. }
  30658. },
  30659. '-',
  30660. {
  30661. text: '新建文件夹',
  30662. iconCls: 'x-fa fa-folder-o',
  30663. handler: function (sender) {
  30664. }
  30665. }
  30666. ]
  30667. };
  30668. }
  30669. else if (raw.type === 'Model') {
  30670. option = {
  30671. shadow: 'frame', allowOtherMenus: true,
  30672. items: [
  30673. {
  30674. text: '编辑',
  30675. iconCls: 'x-fa fa-edit',
  30676. handler: function (sender) {
  30677. }
  30678. },
  30679. {
  30680. text: '删除',
  30681. iconCls: 'x-fa fa-minus-circle',
  30682. handler: function (sender) {
  30683. }
  30684. },
  30685. '-',
  30686. {
  30687. text: '注册(至菜单)',
  30688. iconCls: 'x-fa fa-sign-in',
  30689. handler: function (sender) {
  30690. }
  30691. },
  30692. {
  30693. text: '新建文件夹',
  30694. iconCls: 'x-fa fa-folder-o',
  30695. handler: function (sender) {
  30696. }
  30697. }
  30698. ]
  30699. };
  30700. }
  30701. }
  30702. else if (raw.exporerType === 3) ;
  30703. else if (raw.exporerType === 50) {
  30704. option = {
  30705. shadow: 'frame', allowOtherMenus: true,
  30706. items: [
  30707. {
  30708. text: '新建流程',
  30709. iconCls: 'x-fa fa-new',
  30710. handler: function (sender) {
  30711. _this.bpmnAdd(sender);
  30712. }
  30713. },
  30714. ]
  30715. };
  30716. }
  30717. else if (raw.exporerType === 51) {
  30718. option = {
  30719. shadow: 'frame', allowOtherMenus: true,
  30720. items: [
  30721. {
  30722. text: '新建流程',
  30723. iconCls: 'x-fa fa-new',
  30724. handler: function (sender) {
  30725. _this.bpmnAdd(sender);
  30726. }
  30727. },
  30728. {
  30729. text: '删除',
  30730. iconCls: 'x-fa fa-minus-circle',
  30731. handler: function (sender) {
  30732. _this.bpmnDelete(sender, raw);
  30733. }
  30734. },
  30735. ]
  30736. };
  30737. }
  30738. else {
  30739. throw Error('暂时不支持!');
  30740. }
  30741. if (option) {
  30742. var treeMenu = new Ext.menu.Menu(option);
  30743. treeMenu.showAt(e.getXY());
  30744. }
  30745. };
  30746. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  30747. var _this = this;
  30748. prompt$2('输入工作流名称').then(function (name) {
  30749. createBpmn("", name).then(function (res) {
  30750. if (res.success) {
  30751. msg$1('添加成功');
  30752. }
  30753. _this.reload();
  30754. });
  30755. });
  30756. };
  30757. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  30758. var _this = this;
  30759. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  30760. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  30761. if (res.success) {
  30762. msg$1('添加成功');
  30763. }
  30764. _this.reload();
  30765. });
  30766. });
  30767. };
  30768. BpmnTreeController.prototype.reportAdd = function (sender) {
  30769. var _this = this;
  30770. prompt$2('请输入报表名称').then(function (name) {
  30771. createReportApi(name).then(function (res) {
  30772. if (res.success) {
  30773. msg$1('添加成功');
  30774. handles$1.mainWindow.showReport(res.data, name, function () {
  30775. _this.reload();
  30776. });
  30777. }
  30778. _this.reload();
  30779. });
  30780. });
  30781. };
  30782. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  30783. if (record) {
  30784. var reportName = record.get('report_name');
  30785. var reportId = record.get('report_id');
  30786. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  30787. }
  30788. };
  30789. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  30790. var _this = this;
  30791. if (record) {
  30792. var reportName = record.get('report_name');
  30793. var reportId_1 = record.get('report_id');
  30794. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  30795. delReportApi(reportId_1).then(function (res) {
  30796. if (res.success) {
  30797. msg$1('删除成功');
  30798. _this.reload();
  30799. }
  30800. });
  30801. });
  30802. }
  30803. };
  30804. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  30805. var _this = this;
  30806. if (!record || record.type !== 'Module') {
  30807. return;
  30808. }
  30809. var reportName = record.text;
  30810. var reportId = record.target;
  30811. handles$1.mainWindow.showReport(reportId, reportName, function () {
  30812. _this.reload();
  30813. });
  30814. };
  30815. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  30816. var data = record.raw;
  30817. if (data.type !== 'Module' && data.type !== 'Dir') {
  30818. return;
  30819. }
  30820. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  30821. if (data.exporerType === 10) { // 表单
  30822. // this.reportEdit(sender, data)
  30823. handles$1.mainWindow.showReport();
  30824. }
  30825. else if (data.exporerType === 21) {
  30826. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  30827. }
  30828. else if (data.exporerType === 22) {
  30829. handles$1.mainWindow.showFormBill();
  30830. }
  30831. else if (data.exporerType === 30) {
  30832. handles$1.mainWindow.showWidgetDesign();
  30833. }
  30834. else if (data.exporerType === 51) {
  30835. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  30836. }
  30837. else {
  30838. throw Error('暂时不支持!');
  30839. }
  30840. };
  30841. return BpmnTreeController;
  30842. }());
  30843. var controller$6 = new BpmnTreeController();
  30844. function initBpmnTree () {
  30845. Ext.define('com.yvan.studio.BpmnTree', {
  30846. extend: 'Ext.tree.Panel',
  30847. //extend: 'com.yvan.studio.StateTree',
  30848. xtype: 'bpmntree',
  30849. controller: controller$6,
  30850. scope: controller$6,
  30851. tooltip: '表单定义',
  30852. iconCls: 'x-fa fa-random',
  30853. useArrows: true,
  30854. rootVisible: false,
  30855. colspan: 2,
  30856. lines: true,
  30857. multiSelect: true,
  30858. reload: function () {
  30859. this.controller.reload.call(this, arguments);
  30860. },
  30861. openNode: function () {
  30862. var selection = this.getSelection();
  30863. var _a = __read(selection, 1), record = _a[0];
  30864. if (!record) {
  30865. return;
  30866. }
  30867. var raw = record.raw;
  30868. if (raw.type === 'Dir') {
  30869. return;
  30870. }
  30871. if (raw.type === "Module" && raw.module) ;
  30872. },
  30873. listeners: {
  30874. itemdblclick: 'onDblClick',
  30875. afterrender: 'onLoad',
  30876. // itemverify() {
  30877. // this.openNode()
  30878. // },
  30879. itemcontextmenu: 'onLisenContextMenu'
  30880. },
  30881. tbar: {
  30882. xtype: 'toolbar',
  30883. items: [
  30884. {
  30885. xtype: 'button',
  30886. tooltip: '刷新',
  30887. iconCls: 'x-fa fa-refresh',
  30888. listeners: {
  30889. click: 'reload'
  30890. }
  30891. },
  30892. /*{
  30893. xtype: 'button',
  30894. tooltip: '添加',
  30895. iconCls: 'x-fa fa-plus-circle',
  30896. menu: [
  30897. {
  30898. text: '类别',
  30899. listeners: {
  30900. click: 'classAdd'
  30901. }
  30902. },
  30903. {
  30904. text: '查询',
  30905. listeners: {
  30906. click: 'reportAdd'
  30907. }
  30908. },
  30909. '-',
  30910. {
  30911. text: '单表定义',
  30912. listeners: {
  30913. click: 'singleTableAdd'
  30914. }
  30915. },
  30916. {
  30917. text: '多表定义',
  30918. listeners: {
  30919. click: 'complexTableAdd'
  30920. }
  30921. },
  30922. {
  30923. text: '查询窗口定义',
  30924. listeners: {
  30925. click: 'widgetAdd'
  30926. }
  30927. },
  30928. ],
  30929. },
  30930. {
  30931. xtype: 'button',
  30932. tooltip: '删除',
  30933. iconCls: 'x-fa fa-minus-circle',
  30934. listeners: {
  30935. click: 'reportRemove'
  30936. }
  30937. },*/
  30938. {
  30939. xtype: 'textfield',
  30940. flex: 1,
  30941. reference: "txtFilter",
  30942. emptyText: '搜索过滤',
  30943. enableKeyEvents: true,
  30944. listeners: {
  30945. change: {
  30946. fn: 'filterChanged',
  30947. buffer: 50
  30948. }
  30949. }
  30950. },
  30951. ]
  30952. },
  30953. });
  30954. }
  30955. function initToolBox () {
  30956. Ext.define('com.yvan.studio.ToolBox', {
  30957. extend: 'Ext.panel.Panel',
  30958. xtype: 'toolbox',
  30959. tooltip: '工具箱',
  30960. layout: 'fit',
  30961. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  30962. border: false,
  30963. beforeRender: function () {
  30964. console.log('beforeRender', this);
  30965. },
  30966. afterRender: function () {
  30967. var $dom = $(this.body.dom).children('div');
  30968. $dom.append(createComponent());
  30969. $dom.css("height", '100%');
  30970. // @ts-ignore
  30971. $('#_toolbox_list').find('li').each(function () {
  30972. var id = $(this).children(':first').attr('drag_id');
  30973. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  30974. setDrag(this, node);
  30975. });
  30976. }
  30977. });
  30978. }
  30979. function setDrag(el, node) {
  30980. new Ext.drag.Source({
  30981. element: el,
  30982. proxy: {
  30983. type: 'placeholder',
  30984. getElement: function (info) {
  30985. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  30986. return Ext.getBody().createChild({
  30987. html: html
  30988. });
  30989. }
  30990. },
  30991. listeners: {
  30992. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  30993. dragend: delegateDragend.bind(getDesignInstance(), node),
  30994. },
  30995. sourceVjson: node.code,
  30996. dragType: node.dragType
  30997. });
  30998. }
  30999. function createComponent() {
  31000. var template = [];
  31001. for (var i = 0; i < codeLines.length; i++) {
  31002. var item = codeLines[i];
  31003. if (!item.dragHtml) {
  31004. continue;
  31005. }
  31006. var $ele = $("<li>" + item.dragHtml + "</li>");
  31007. $ele.children(':first').attr('drag_id', item.id);
  31008. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  31009. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  31010. }
  31011. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  31012. return html;
  31013. }
  31014. var codeLines = [
  31015. {
  31016. id: '$label',
  31017. value: layoutOrXtypeNameMap.label + ' - label',
  31018. icon: "fa fa-font",
  31019. dragType: "col-item",
  31020. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31021. code: {
  31022. xtype: 'label',
  31023. text: '文本' + _$2.uniqueId('_l')
  31024. }
  31025. },
  31026. {
  31027. id: '$text',
  31028. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  31029. icon: "fa fa-edit",
  31030. dragType: "col-item",
  31031. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31032. code: {
  31033. xtype: 'textfield',
  31034. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31035. }
  31036. },
  31037. {
  31038. id: '$textarea',
  31039. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  31040. icon: "fa fa-edit",
  31041. dragType: "col-item",
  31042. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31043. code: {
  31044. xtype: 'textareafield',
  31045. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31046. }
  31047. },
  31048. {
  31049. id: '$number',
  31050. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  31051. icon: "fa fa-edit",
  31052. dragType: "col-item",
  31053. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31054. code: {
  31055. xtype: 'numberfield',
  31056. fieldLabel: '数字框' + _$2.uniqueId('_n')
  31057. }
  31058. },
  31059. {
  31060. id: '$combo',
  31061. value: layoutOrXtypeNameMap.combo + ' - combo',
  31062. icon: "fa fa-angle-double-down",
  31063. dragType: "col-item",
  31064. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31065. code: {
  31066. xtype: 'combo',
  31067. fieldLabel: '请选择',
  31068. data: [
  31069. { id: 'id1', text: '选项1' },
  31070. { id: 'id2', text: '选项2' },
  31071. { id: 'id3', text: '选项3' },
  31072. ],
  31073. }
  31074. },
  31075. {
  31076. id: '$datebox',
  31077. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  31078. icon: "fa fa-calendar",
  31079. dragType: "col-item",
  31080. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31081. code: {
  31082. xtype: "datefield",
  31083. fieldLabel: '日期',
  31084. }
  31085. },
  31086. {
  31087. id: '$searchbox',
  31088. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  31089. icon: "fa fa-search",
  31090. dragType: "col-item",
  31091. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31092. code: {
  31093. xtype: 'searchfield',
  31094. fieldLabel: '搜索框',
  31095. }
  31096. },
  31097. {
  31098. id: '$combogrid',
  31099. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  31100. icon: "fa fa-table",
  31101. dragType: "col-item",
  31102. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31103. code: {
  31104. xtype: 'combogrid',
  31105. fieldLabel: '下拉表'
  31106. }
  31107. },
  31108. {
  31109. id: '$combotree',
  31110. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  31111. icon: "fa fa-tree",
  31112. dragType: "col-item",
  31113. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31114. code: {
  31115. xtype: 'combotree',
  31116. fieldLabel: '下拉树',
  31117. displayField: 'text',
  31118. rootVisible: false
  31119. }
  31120. },
  31121. {
  31122. id: '$button',
  31123. value: layoutOrXtypeNameMap.button + ' - button',
  31124. icon: 'fa fa-sign-in',
  31125. dragType: "col-item",
  31126. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31127. code: {
  31128. text: '按钮',
  31129. iconCls: 'x-fa fa-bars',
  31130. xtype: 'button'
  31131. }
  31132. },
  31133. {
  31134. id: '$checkbox',
  31135. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  31136. icon: 'fa fa-check-square',
  31137. dragType: "col-item",
  31138. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31139. code: {
  31140. xtype: 'checkbox',
  31141. boxLabel: '勾选框',
  31142. hideLabel: true,
  31143. margin: '0 0 0 15',
  31144. flex: 0,
  31145. }
  31146. },
  31147. {
  31148. id: '$checkboxgroup',
  31149. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  31150. icon: 'fa fa-check-square',
  31151. dragType: "col-item",
  31152. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31153. code: {
  31154. xtype: 'checkboxgroup',
  31155. fieldLabel: '勾选组',
  31156. items: [
  31157. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31158. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31159. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31160. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31161. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31162. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31163. ]
  31164. }
  31165. },
  31166. {
  31167. id: '$radio',
  31168. value: layoutOrXtypeNameMap.radio + ' - radio',
  31169. icon: 'fa fa-dot-circle-o',
  31170. dragType: "col-item",
  31171. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31172. code: {
  31173. xtype: "radio",
  31174. fieldLabel: "请选择",
  31175. }
  31176. },
  31177. {
  31178. id: '$radiogroup',
  31179. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  31180. icon: 'fa fa-dot-circle-o',
  31181. dragType: "col-item",
  31182. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31183. code: {
  31184. xtype: "radiogroup",
  31185. fieldLabel: "请选择",
  31186. items: [
  31187. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31188. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31189. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31190. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31191. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31192. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31193. ]
  31194. }
  31195. },
  31196. {
  31197. id: '$cols',
  31198. value: layoutOrXtypeNameMap.cols + ' - cols',
  31199. icon: 'fa fa-list-alt',
  31200. dragType: "cols-container",
  31201. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31202. code: {
  31203. xtype: 'cols',
  31204. items: [
  31205. {
  31206. xtype: 'textfield',
  31207. fieldLabel: '输入框',
  31208. },
  31209. ],
  31210. }
  31211. },
  31212. {
  31213. id: '$container',
  31214. value: layoutOrXtypeNameMap.container + ' - container',
  31215. icon: 'fa fa-flag',
  31216. dragType: "col-item",
  31217. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31218. code: {
  31219. xtype: 'container',
  31220. border: false,
  31221. layout: 'hbox',
  31222. }
  31223. },
  31224. {
  31225. id: '$fit',
  31226. value: layoutOrXtypeNameMap.fit + ' - fit',
  31227. icon: 'fa fa-flag',
  31228. dragType: "rows-container",
  31229. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31230. code: {
  31231. border: false,
  31232. layout: 'fit',
  31233. items: [
  31234. {
  31235. xtype: 'container',
  31236. border: false,
  31237. layout: 'hbox',
  31238. }
  31239. ]
  31240. }
  31241. },
  31242. ];
  31243. // @ts-ignore
  31244. // export default ToolBoxCmp
  31245. var that = undefined;
  31246. function initPropertyDesign () {
  31247. Ext.define('com.yvan.studio.PropertyDesign', {
  31248. extend: 'Ext.panel.Panel',
  31249. xtype: 'propertydesign',
  31250. name: "PropertyDesign",
  31251. tooltip: '属性',
  31252. iconCls: 'x-fa fa-newspaper-o',
  31253. reference: 'propertygrid',
  31254. layout: 'border',
  31255. border: false,
  31256. moduleId: null,
  31257. currentComponentVJson: null,
  31258. currentComponentPropertyEditSource: null,
  31259. vjson: null,
  31260. propertyHandle: null,
  31261. moduleSubscribe: null,
  31262. items: [
  31263. new Ext.grid.property.Grid({
  31264. sortableColumns: false,
  31265. region: 'center',
  31266. listeners: {
  31267. propertychange: function (source, propName, value, oldValue, eOpts) {
  31268. value = _.trim(value);
  31269. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  31270. return item.label === propName;
  31271. });
  31272. if (a.type === 'listeners') {
  31273. if (value) {
  31274. if (that.currentComponentVJson.listeners) {
  31275. that.currentComponentVJson.listeners[propName] = value;
  31276. }
  31277. else {
  31278. var t = {};
  31279. t[propName] = value;
  31280. that.currentComponentVJson.listeners = t;
  31281. }
  31282. }
  31283. else {
  31284. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  31285. if (!value1) {
  31286. delete that.currentComponentVJson.listeners[key];
  31287. }
  31288. else if (key === propName) {
  31289. delete that.currentComponentVJson.listeners[key];
  31290. }
  31291. });
  31292. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  31293. delete that.currentComponentVJson.listeners;
  31294. }
  31295. }
  31296. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31297. vjson: that.vjson,
  31298. from: that.name,
  31299. ignoreRenderUI: true
  31300. });
  31301. }
  31302. else if (a.type === 'fix') {
  31303. if (!value) {
  31304. delete that.currentComponentVJson[propName];
  31305. }
  31306. else {
  31307. that.currentComponentVJson[propName] = value.split("\r\n");
  31308. }
  31309. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31310. vjson: that.vjson,
  31311. from: that.name,
  31312. ignoreRenderUI: true
  31313. });
  31314. }
  31315. else if (a.type === 'bind') {
  31316. var bind_1 = that.currentComponentVJson.bind;
  31317. if (typeof bind_1 === 'string' && a.id === "value") {
  31318. if (value) {
  31319. that.currentComponentVJson.bind = value;
  31320. }
  31321. else {
  31322. delete that.currentComponentVJson.bind;
  31323. }
  31324. }
  31325. else {
  31326. // 转成bind对象
  31327. if (typeof bind_1 === 'string') {
  31328. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  31329. }
  31330. if (value) {
  31331. if (bind_1) {
  31332. bind_1[a.id] = value;
  31333. }
  31334. else {
  31335. var t = {};
  31336. t[a.id] = value;
  31337. that.currentComponentVJson.bind = t;
  31338. }
  31339. }
  31340. else {
  31341. _.forOwn(bind_1, function (value1, key) {
  31342. if (!value1) {
  31343. delete bind_1[key];
  31344. }
  31345. else if (key === a.id) {
  31346. delete bind_1[key];
  31347. }
  31348. });
  31349. if (Object.keys(bind_1).length <= 0) {
  31350. delete that.currentComponentVJson.bind;
  31351. }
  31352. }
  31353. }
  31354. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31355. vjson: that.vjson,
  31356. from: that.name,
  31357. ignoreRenderUI: true
  31358. });
  31359. }
  31360. else if (a.type === 'boolean') {
  31361. if (!value) {
  31362. delete that.currentComponentVJson[propName];
  31363. }
  31364. else if (value === 'false') {
  31365. that.currentComponentVJson[propName] = false;
  31366. }
  31367. else if (value === 'true') {
  31368. that.currentComponentVJson[propName] = true;
  31369. }
  31370. else {
  31371. that.currentComponentVJson[propName] = value;
  31372. }
  31373. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31374. vjson: that.vjson,
  31375. from: that.name
  31376. });
  31377. }
  31378. else {
  31379. that.currentComponentVJson[propName] = value;
  31380. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31381. vjson: that.vjson,
  31382. from: that.name
  31383. });
  31384. }
  31385. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  31386. },
  31387. }
  31388. })
  31389. ],
  31390. listeners: {
  31391. // afterrender() {
  31392. // this.propertyHandle.setSource({
  31393. // "(name)": "My Object",
  31394. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  31395. // "Available": false, // boolean type
  31396. // "Version": .01, // decimal type
  31397. // "Description": "A test object"
  31398. // });
  31399. // }
  31400. },
  31401. initComponent: function () {
  31402. var _this = this;
  31403. this.propertyHandle = this.items[0];
  31404. setPropertyPanel(this);
  31405. that = this;
  31406. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31407. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31408. _this.setVjson(moduleId, from, ignoreRenderUI);
  31409. });
  31410. return this.superclass.initComponent.apply(this, arguments);
  31411. },
  31412. setVjson: function (moduleId, from, ignoreRenderUI) {
  31413. var _this = this;
  31414. // if (this.moduleId === null && moduleId) {
  31415. // this.moduleId = moduleId
  31416. // }
  31417. if (moduleId !== this.moduleId || from === this.name) {
  31418. return;
  31419. }
  31420. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  31421. if (!moduleObj) {
  31422. return;
  31423. }
  31424. this.vjson = moduleObj.moduleObj.vjson;
  31425. this.setPropertyAndEventSource();
  31426. if (this.componentSelectionChangeSubscribe) {
  31427. this.componentSelectionChangeSubscribe.cancel();
  31428. this.componentSelectionChangeSubscribe = null;
  31429. }
  31430. if (this.updateVjsonChangeSubscribe) {
  31431. this.updateVjsonChangeSubscribe.cancel();
  31432. this.updateVjsonChangeSubscribe = null;
  31433. }
  31434. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31435. var id = _a.id, from = _a.from;
  31436. _this.onComponentSelectionChange(id, from);
  31437. });
  31438. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  31439. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31440. _this.updateVjson(vjson, from, ignoreRenderUI);
  31441. });
  31442. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31443. this.onComponentSelectionChange(id, from);
  31444. },
  31445. updateVjson: function (vjson, from, ignoreRenderUI) {
  31446. if (!vjson || from === this.name) {
  31447. return;
  31448. }
  31449. this.vjson = vjson;
  31450. this.setPropertyAndEventSource();
  31451. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31452. this.onComponentSelectionChange(id, from);
  31453. },
  31454. onComponentSelectionChange: function (id, from) {
  31455. if (from !== this.name) {
  31456. this.currentComponentVJson = findInCode(this.vjson, id);
  31457. this.setPropertyAndEventSource();
  31458. }
  31459. },
  31460. setPropertyAndEventSource: function () {
  31461. var _this = this;
  31462. this.propertyHandle.setSource({});
  31463. if (!this.currentComponentVJson) {
  31464. return;
  31465. }
  31466. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  31467. var v = xtype;
  31468. // 选中的对象可能是组
  31469. if (!v) {
  31470. if (_.has(this.currentComponentVJson, "cols")) {
  31471. v = "cols";
  31472. }
  31473. else if (_.has(this.currentComponentVJson, "rows")) {
  31474. v = "rows";
  31475. }
  31476. }
  31477. var pd = YvanUI.PropertyDescriptionTable.get(v);
  31478. if (!pd) {
  31479. // 这个组件没有属性
  31480. this.propertyHandle.setSource({});
  31481. return;
  31482. }
  31483. var funcArr = this.getAllfuncs();
  31484. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  31485. // disabled: true,
  31486. displayField: 'name',
  31487. valueField: 'name',
  31488. store: funcArr,
  31489. }); };
  31490. // ====================== 属性
  31491. var elements = [];
  31492. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  31493. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  31494. var props = pd.getPropsByGroup(group);
  31495. if (props.length <= 0)
  31496. return; //没有这一组属性
  31497. // 显示 group 的中文名
  31498. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  31499. if (caption[i] === '绑定') {
  31500. _.each(props, function (prop) {
  31501. elements.push({
  31502. label: "_" + prop.name,
  31503. type: "bind",
  31504. id: prop.name,
  31505. desc: prop.desc,
  31506. editor: new Ext.form.field.Text()
  31507. });
  31508. });
  31509. }
  31510. else {
  31511. _.each(props, function (prop) {
  31512. if (_.isArray(prop.type)) {
  31513. elements.push({
  31514. label: prop.name,
  31515. type: "combo",
  31516. options: prop.type,
  31517. id: prop.name,
  31518. desc: prop.desc
  31519. });
  31520. return;
  31521. }
  31522. switch (prop.type) {
  31523. case 'boolean': {
  31524. elements.push({
  31525. label: prop.name,
  31526. id: prop.name,
  31527. desc: prop.desc,
  31528. type: 'boolean',
  31529. editor: new Ext.form.field.ComboBox({
  31530. displayField: 'text',
  31531. valueField: 'id',
  31532. store: new Ext.data.Store({
  31533. field: ['id', 'text'],
  31534. data: [
  31535. { id: 'true', text: 'True' },
  31536. { id: 'false', text: 'False' },
  31537. ]
  31538. })
  31539. }),
  31540. });
  31541. break;
  31542. }
  31543. case 'number': {
  31544. elements.push({
  31545. label: prop.name,
  31546. type: "number",
  31547. id: prop.name,
  31548. isNum: true,
  31549. desc: prop.desc,
  31550. editor: new Ext.form.field.Number()
  31551. });
  31552. break;
  31553. }
  31554. case 'string': {
  31555. elements.push({
  31556. label: prop.name,
  31557. type: "string",
  31558. id: prop.name,
  31559. desc: prop.desc,
  31560. editor: new Ext.form.field.Text()
  31561. });
  31562. break;
  31563. }
  31564. case 'listeners': {
  31565. elements.push({
  31566. label: prop.name,
  31567. type: "listeners",
  31568. id: prop.name,
  31569. desc: prop.desc,
  31570. editor: createFuncEditor()
  31571. });
  31572. break;
  31573. }
  31574. case 'fix': {
  31575. elements.push({
  31576. label: prop.name,
  31577. type: "fix",
  31578. id: prop.name,
  31579. desc: prop.desc,
  31580. editor: new Ext.form.field.Text()
  31581. });
  31582. break;
  31583. }
  31584. case 'object': {
  31585. break;
  31586. }
  31587. // case 'dataSource' : {
  31588. // break;
  31589. // }
  31590. case 'valid': {
  31591. break;
  31592. }
  31593. default:
  31594. elements.push({
  31595. label: prop.name,
  31596. type: prop.type,
  31597. id: prop.name,
  31598. desc: prop.desc,
  31599. editor: new Ext.form.field.Text({ disabled: true })
  31600. });
  31601. console.error('不支持的编辑类型', prop);
  31602. }
  31603. });
  31604. }
  31605. });
  31606. this.currentComponentPropertyEditSource = elements;
  31607. var panel1Source = {};
  31608. var panel1SourceConfig = {};
  31609. _.each(elements, function (item) {
  31610. var _a;
  31611. if (item.type === "listeners") {
  31612. var listeners = _this.currentComponentVJson.listeners;
  31613. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  31614. }
  31615. else if (item.type === "fix") {
  31616. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  31617. }
  31618. else if (item.type === "bind") {
  31619. var bind = _this.currentComponentVJson.bind;
  31620. if (typeof bind === 'string' && item.id === 'value') {
  31621. panel1Source[item.label] = bind;
  31622. }
  31623. else {
  31624. panel1Source[item.label] = bind ? bind[item.id] : '';
  31625. }
  31626. }
  31627. else {
  31628. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  31629. }
  31630. panel1Source[item.label] = panel1Source[item.label] || '';
  31631. panel1SourceConfig[item.label] = { editor: item.editor };
  31632. });
  31633. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  31634. },
  31635. getAllfuncs: function () {
  31636. var _a, _b;
  31637. 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;
  31638. var scopeFuncs = [];
  31639. _.forEach(arr, function (item) {
  31640. scopeFuncs.push({ name: "scope." + item.name });
  31641. });
  31642. return scopeFuncs;
  31643. }
  31644. });
  31645. }
  31646. function initViewOutlineTree () {
  31647. Ext.define('com.yvan.studio.ViewOutlineTree', {
  31648. extend: 'Ext.tree.Panel',
  31649. xtype: 'viewoutlinetree',
  31650. name: "ViewOutlineTree",
  31651. tooltip: '设计大纲',
  31652. iconCls: 'x-fa fa-list',
  31653. rootVisible: false,
  31654. useArrows: true,
  31655. allowDeselect: true,
  31656. colspan: 2,
  31657. lines: false,
  31658. reference: 'viewoutlinetree',
  31659. multiSelect: true,
  31660. _saveStateFlag: true,
  31661. keyMapEnabled: true,
  31662. moduleId: null,
  31663. vjson: null,
  31664. columns: [
  31665. {
  31666. xtype: 'treecolumn',
  31667. text: '布局',
  31668. dataIndex: 'layoutNameDesc',
  31669. flex: 2,
  31670. sortable: true
  31671. }, {
  31672. text: '组件',
  31673. dataIndex: 'xtype',
  31674. flex: 1,
  31675. sortable: true,
  31676. align: 'center',
  31677. }
  31678. ],
  31679. listeners: {
  31680. itemcontextmenu: function (sender, node, element, idx, e) {
  31681. e.preventDefault();
  31682. this.rightClickTreeNode(sender, node, element, idx, e);
  31683. },
  31684. select: function (sender, node, index, e) {
  31685. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  31686. },
  31687. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  31688. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  31689. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  31690. }
  31691. }
  31692. },
  31693. initComponent: function () {
  31694. var _this = this;
  31695. setViewoutlinetree(this);
  31696. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31697. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31698. return _this.setVjson(moduleId, from, ignoreRenderUI);
  31699. });
  31700. return this.superclass.initComponent.apply(this, arguments);
  31701. },
  31702. clear: function () {
  31703. this.setRootNode(null);
  31704. },
  31705. onChangModule: function (moduleId, oldModuleId, from) {
  31706. if (!moduleId || moduleId !== this.moduleId) {
  31707. return;
  31708. }
  31709. if (moduleStore.getModuleObject(moduleId)) {
  31710. this.setVjson(moduleId, from);
  31711. }
  31712. },
  31713. setVjson: function (moduleId, from, ignoreRenderUI) {
  31714. var _this = this;
  31715. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  31716. return;
  31717. }
  31718. this.moduleId = moduleId;
  31719. // if (from === this.name) {
  31720. // return
  31721. // }
  31722. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  31723. this.setTreeValue();
  31724. if (this.componentSelectionChangeSubscribe) {
  31725. this.componentSelectionChangeSubscribe.cancel();
  31726. this.componentSelectionChangeSubscribe = null;
  31727. }
  31728. if (this.setVjsonChangeSubscribe) {
  31729. this.setVjsonChangeSubscribe.cancel();
  31730. this.setVjsonChangeSubscribe = null;
  31731. }
  31732. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31733. var id = _a.id, from = _a.from;
  31734. return _this.onComponentSelectionChange(id, from);
  31735. });
  31736. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  31737. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31738. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  31739. });
  31740. },
  31741. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  31742. if (!vjson || from === this.name) {
  31743. return;
  31744. }
  31745. this.vjson = vjson;
  31746. this.setTreeValue();
  31747. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31748. if (id) {
  31749. this.selectPath(id);
  31750. }
  31751. },
  31752. onComponentSelectionChange: function (id, from) {
  31753. if (from !== this.name) {
  31754. if (id) {
  31755. this.selectPath(id);
  31756. }
  31757. else {
  31758. this.setTreeValue();
  31759. }
  31760. }
  31761. },
  31762. setTreeValue: function () {
  31763. var outlineVj = {};
  31764. _.forOwn(this.vjson, function (obj, key) {
  31765. if (key !== 'viewModel' && key !== 'store') {
  31766. outlineVj[key] = _.cloneDeep(obj);
  31767. }
  31768. });
  31769. getLayoutOutline(outlineVj);
  31770. this.setRootNode(outlineVj);
  31771. },
  31772. rightClickTreeNode: function (sender, node, element, idx, e) {
  31773. var raw = node.data;
  31774. var option = {};
  31775. // 右键
  31776. option = {
  31777. shadow: 'frame',
  31778. allowOtherMenus: true,
  31779. items: []
  31780. };
  31781. var switchType = raw.layoutName;
  31782. if (raw.layoutName === 'north' ||
  31783. raw.layoutName === 'south' ||
  31784. raw.layoutName === 'west' ||
  31785. raw.layoutName === 'east' ||
  31786. raw.layoutName === 'center' ||
  31787. raw.layoutName === 'tbar' ||
  31788. raw.layoutName === 'fbar') {
  31789. switchType = raw.xtype || raw.layout;
  31790. }
  31791. var itemArr = [];
  31792. var hasTbar = false, hasFbar = false, hasBody = false;
  31793. if (raw.hasOwnProperty("children")) {
  31794. _.forEach(raw.children, function (value) {
  31795. if (value.layoutName === 'tbar') {
  31796. hasTbar = true;
  31797. }
  31798. else if (value.layoutName === 'fbar') {
  31799. hasFbar = true;
  31800. }
  31801. else {
  31802. hasBody = true;
  31803. }
  31804. });
  31805. }
  31806. switch (switchType) {
  31807. case 'fit':
  31808. if (!hasTbar) {
  31809. itemArr.push('tbar');
  31810. }
  31811. if (!hasFbar) {
  31812. itemArr.push('fbar');
  31813. }
  31814. if (!hasBody) {
  31815. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31816. }
  31817. option.items = this.menuNew(itemArr, raw);
  31818. break;
  31819. case 'border':
  31820. if (!hasTbar) {
  31821. itemArr.push('tbar');
  31822. }
  31823. if (!hasFbar) {
  31824. itemArr.push('fbar');
  31825. }
  31826. itemArr.push('cnsew');
  31827. option.items = this.menuNew(itemArr, raw);
  31828. break;
  31829. // case 'tbar':
  31830. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  31831. // break;
  31832. // case 'fbar':
  31833. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  31834. // break;
  31835. case 'tabpanel':
  31836. if (!hasTbar) {
  31837. itemArr.push('tbar');
  31838. }
  31839. if (!hasFbar) {
  31840. itemArr.push('fbar');
  31841. }
  31842. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31843. option.items = this.menuNew(itemArr, raw);
  31844. break;
  31845. case 'yvgrid':
  31846. if (!hasTbar) {
  31847. itemArr.push('tbar');
  31848. }
  31849. option.items = this.menuNew(itemArr, raw);
  31850. break;
  31851. case 'tree':
  31852. if (!hasTbar) {
  31853. itemArr.push('tbar');
  31854. }
  31855. if (!hasFbar) {
  31856. itemArr.push('fbar');
  31857. }
  31858. option.items = this.menuNew(itemArr, raw);
  31859. break;
  31860. case 'fieldset':
  31861. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  31862. break;
  31863. case 'form':
  31864. if (!hasTbar) {
  31865. itemArr.push('tbar');
  31866. }
  31867. if (!hasFbar) {
  31868. itemArr.push('fbar');
  31869. }
  31870. itemArr.push('form', 'fieldset', 'cols');
  31871. option.items = this.menuNew(itemArr, raw);
  31872. break;
  31873. case 'toolbar':
  31874. itemArr.push('button', 'textfield', 'label', 'combo');
  31875. option.items = this.menuNew(itemArr, raw);
  31876. break;
  31877. // case 'fbar':
  31878. // itemArr.push('button', 'textfield', 'label', 'combo')
  31879. // option.items = this.menuNew(itemArr, raw)
  31880. // break
  31881. default:
  31882. option.items = this.menuNew(itemArr, raw);
  31883. break;
  31884. }
  31885. var treeMenu = new Ext.menu.Menu(option);
  31886. treeMenu.showAt(e.getXY());
  31887. },
  31888. newItem: function (viewType, raw, region) {
  31889. var itemVjson = {};
  31890. switch (viewType) {
  31891. case 'fit':
  31892. itemVjson.layout = 'fit';
  31893. itemVjson.items = [];
  31894. break;
  31895. case 'border':
  31896. itemVjson.layout = 'border';
  31897. itemVjson.items = [];
  31898. break;
  31899. case 'toolbar':
  31900. itemVjson.xtype = 'toolbar';
  31901. itemVjson.title = 'toolbar';
  31902. itemVjson.items = [
  31903. {
  31904. xtype: 'button',
  31905. text: 'button'
  31906. }
  31907. ];
  31908. break;
  31909. case 'tabpanel':
  31910. itemVjson.xtype = 'tabpanel';
  31911. itemVjson.layout = 'fit';
  31912. itemVjson.items = [];
  31913. break;
  31914. case 'yvgrid':
  31915. itemVjson.xtype = 'yvgrid';
  31916. itemVjson.layout = 'fit';
  31917. itemVjson.pagination = false;
  31918. itemVjson.columns = [
  31919. {
  31920. dataIndex: "skuId",
  31921. header: "SKU_ID",
  31922. },
  31923. ];
  31924. break;
  31925. case 'tree':
  31926. itemVjson.xtype = 'treepanel';
  31927. itemVjson.layout = 'fit';
  31928. break;
  31929. case 'fieldset':
  31930. case 'form':
  31931. itemVjson.xtype = viewType;
  31932. itemVjson.title = viewType;
  31933. itemVjson.items = [
  31934. {
  31935. xtype: 'cols',
  31936. items: [
  31937. {
  31938. xtype: 'textfield',
  31939. fieldLabel: '输入框'
  31940. }
  31941. ]
  31942. }
  31943. ];
  31944. break;
  31945. case 'cols':
  31946. itemVjson.xtype = 'cols';
  31947. itemVjson.items = [
  31948. {
  31949. xtype: 'textfield',
  31950. fieldLabel: '输入框'
  31951. }
  31952. ];
  31953. break;
  31954. case 'button':
  31955. itemVjson.xtype = 'button';
  31956. itemVjson.text = '按钮';
  31957. itemVjson.iconCls = 'x-fa fa-plus';
  31958. break;
  31959. case 'textfield':
  31960. itemVjson.xtype = 'textfield';
  31961. itemVjson.fieldLabel = '输入框';
  31962. break;
  31963. case 'combo':
  31964. itemVjson.xtype = 'combo';
  31965. itemVjson.fieldLabel = '下拉框';
  31966. break;
  31967. case 'label':
  31968. itemVjson.xtype = 'label';
  31969. itemVjson.text = '文本';
  31970. break;
  31971. }
  31972. var target = findInCode(this.vjson, raw.id);
  31973. if (region) {
  31974. if (region === 'tbar' || region === 'fbar') {
  31975. target[region] = itemVjson;
  31976. }
  31977. else {
  31978. itemVjson.region = region;
  31979. itemVjson.split = true;
  31980. if (region === 'north' || region === 'south') {
  31981. itemVjson.height = '30%';
  31982. itemVjson.collapsible = true;
  31983. }
  31984. else if (region === 'west' || region === 'east') {
  31985. itemVjson.width = '30%';
  31986. itemVjson.collapsible = true;
  31987. }
  31988. target.items.push(itemVjson);
  31989. }
  31990. }
  31991. else {
  31992. if (target.xtype === 'tabpanel') {
  31993. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  31994. }
  31995. target.items.push(itemVjson);
  31996. }
  31997. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  31998. },
  31999. menuNew: function (typeArr, raw, region) {
  32000. var that = this;
  32001. var reArr = [];
  32002. typeArr.forEach(function (value) {
  32003. if (value === 'cnsew') {
  32004. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  32005. }
  32006. else if (value === 'tbar' || value === 'fbar') {
  32007. reArr.push(that.menuNewTFBar(value, raw));
  32008. }
  32009. else {
  32010. reArr.push({
  32011. text: '新建' + layoutOrXtypeNameMap[value],
  32012. iconCls: 'x-fa fa-plus',
  32013. handler: function (sender) {
  32014. that.newItem(value, raw, region);
  32015. }
  32016. });
  32017. }
  32018. reArr.push("-");
  32019. });
  32020. if (region) {
  32021. reArr.pop();
  32022. return reArr;
  32023. }
  32024. reArr.push({
  32025. text: '高级属性',
  32026. iconCls: 'x-fa fa-cog',
  32027. handler: function (sender) {
  32028. var vj = findInCode(that.vjson, raw.id);
  32029. that.advancedSettingWindow(vj);
  32030. }
  32031. }, {
  32032. text: '上移',
  32033. iconCls: 'x-fa fa-trash',
  32034. handler: function (sender) {
  32035. that.moveCmp(raw.id, 'up');
  32036. }
  32037. }, {
  32038. text: '置顶',
  32039. iconCls: 'x-fa fa-trash',
  32040. handler: function (sender) {
  32041. that.moveCmp(raw.id, 'top');
  32042. }
  32043. }, {
  32044. text: '置底',
  32045. iconCls: 'x-fa fa-trash',
  32046. handler: function (sender) {
  32047. that.moveCmp(raw.id, 'bottom');
  32048. }
  32049. }, {
  32050. text: '下移',
  32051. iconCls: 'x-fa fa-trash',
  32052. handler: function (sender) {
  32053. that.moveCmp(raw.id, 'down');
  32054. }
  32055. }, {
  32056. text: '删除',
  32057. iconCls: 'x-fa fa-trash',
  32058. handler: function (sender) {
  32059. deletVjsonById(that.vjson, raw.id);
  32060. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  32061. }
  32062. });
  32063. return reArr;
  32064. },
  32065. menuNewCNSEW: function (raw) {
  32066. var that = this;
  32067. var arr = ['center', 'north', 'south', 'west', 'east'];
  32068. if (raw.hasOwnProperty("children")) {
  32069. _.forEach(raw.children, function (value) {
  32070. _.remove(arr, function (it) {
  32071. return it === value.layoutName;
  32072. });
  32073. });
  32074. }
  32075. var reArr = [];
  32076. arr.forEach(function (value) {
  32077. reArr.push({
  32078. text: layoutOrXtypeNameMap[value],
  32079. iconCls: 'x-fa fa-plus',
  32080. menu: {
  32081. showSeparator: true,
  32082. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  32083. }
  32084. });
  32085. reArr.push("-");
  32086. });
  32087. reArr.pop();
  32088. return reArr;
  32089. },
  32090. menuNewTFBar: function (barType, raw) {
  32091. var that = this;
  32092. var reObj = {
  32093. text: layoutOrXtypeNameMap[barType],
  32094. iconCls: 'x-fa fa-plus',
  32095. menu: {
  32096. showSeparator: true,
  32097. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  32098. }
  32099. };
  32100. return reObj;
  32101. },
  32102. moveCmp: function (id, moveType) {
  32103. var arr = findArrayContainer(this.vjson, id);
  32104. var index = _.findIndex(arr, function (v) { return v.id === id; });
  32105. if (index < 0) {
  32106. return;
  32107. }
  32108. switch (moveType) {
  32109. case 'up':
  32110. if (index > 0) {
  32111. var o = arr[index];
  32112. arr[index] = arr[index - 1];
  32113. arr[index - 1] = o;
  32114. }
  32115. else {
  32116. return;
  32117. }
  32118. break;
  32119. case 'down':
  32120. if (index < arr.length - 1) {
  32121. var o = arr[index];
  32122. arr[index] = arr[index + 1];
  32123. arr[index + 1] = o;
  32124. }
  32125. else {
  32126. return;
  32127. }
  32128. break;
  32129. case 'top':
  32130. if (index > 0) {
  32131. var o = arr[index];
  32132. arr[index] = arr[0];
  32133. arr[0] = o;
  32134. }
  32135. else {
  32136. return;
  32137. }
  32138. break;
  32139. case 'bottom':
  32140. if (index < arr.length - 1) {
  32141. var o = arr[index];
  32142. arr[index] = arr[arr.length - 1];
  32143. arr[arr.length - 1] = o;
  32144. }
  32145. else {
  32146. return;
  32147. }
  32148. break;
  32149. }
  32150. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32151. }
  32152. });
  32153. }
  32154. function init$2 () {
  32155. window['native'] = native;
  32156. native.init();
  32157. init();
  32158. instance.getAllDomain().finally(function () {
  32159. });
  32160. initStateTree();
  32161. initDashboard();
  32162. initFileTree();
  32163. initDbTree();
  32164. initReportGrid();
  32165. initGroovyEditor();
  32166. initJsEditor$1();
  32167. initJsonEditor$1();
  32168. initSqlEditor$1();
  32169. initTemplateEditor();
  32170. initDict$1();
  32171. initBpmnTree();
  32172. initToolBox();
  32173. initPropertyDesign();
  32174. initViewOutlineTree();
  32175. initWidget();
  32176. initWhLayout();
  32177. initApiTree();
  32178. initTaskTree();
  32179. initLogsTree();
  32180. initDevOpsTree();
  32181. initTerminal();
  32182. initMonitorTree();
  32183. initHomeTree();
  32184. }
  32185. var studio = {
  32186. init: init$2,
  32187. handles: handles$1,
  32188. Workbench: Workbench
  32189. };
  32190. exports.axios = axios;
  32191. exports.qs = Qs;
  32192. exports.lodash = _$2;
  32193. exports.jquery = $$2;
  32194. exports.moment = moment$1;
  32195. exports.recast = recast;
  32196. exports.XLSX = XLSX;
  32197. exports.echarts = echarts;
  32198. exports.Defaults = Defaults;
  32199. exports.ExcelImportDialog = ExcelImportDialog;
  32200. exports.Lib = Lib;
  32201. exports.LibParam = LibParam;
  32202. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32203. exports.ReportScope = ReportScope;
  32204. exports.SIMPLE_RE = SIMPLE_RE;
  32205. exports.Scope = Scope;
  32206. exports.ScopeEngine = ScopeEngine;
  32207. exports.SystemEventFu = SystemEventFu;
  32208. exports.ajax = ajax;
  32209. exports.baseConfigProcess = baseConfigProcess;
  32210. exports.baseConfigProcessList = baseConfigProcessList;
  32211. exports.buildPlus = buildPlus;
  32212. exports.buildReportScope = buildReportScope;
  32213. exports.calcExpress = calcExpress;
  32214. exports.calcObject = calcObject;
  32215. exports.calcObjectFlat = calcObjectFlat;
  32216. exports.clearViewModel = clearViewModel;
  32217. exports.clearViewModelByLookup = clearViewModelByLookup;
  32218. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32219. exports.clearViewModelValues = clearViewModelValues;
  32220. exports.commitMe = commitMe;
  32221. exports.confirm = confirm;
  32222. exports.createAjax = createAjax;
  32223. exports.createUUID = createUUID;
  32224. exports.deepTravJson = deepTravJson;
  32225. exports.downLoad = downLoad;
  32226. exports.evalFunction = evalFunction;
  32227. exports.extend = extend;
  32228. exports.flatRow = flatRow;
  32229. exports.getApiConvert = getApiConvert;
  32230. exports.getGridEditRows = getGridEditRows;
  32231. exports.getParentGrid = getParentGrid;
  32232. exports.getPinyin = getPinyin;
  32233. exports.getRegList = getRegList;
  32234. exports.getRegParamList = getRegParamList;
  32235. exports.getScopeOnCreate = getScopeOnCreate;
  32236. exports.init = init$1;
  32237. exports.insertGridRow = insertGridRow;
  32238. exports.invokeServer = invokeServer$1;
  32239. exports.isDesignMode = isDesignMode;
  32240. exports.isEmpty = isEmpty;
  32241. exports.json5 = dist;
  32242. exports.keywordFilter = keywordFilter;
  32243. exports.lookupFn = lookupFn;
  32244. exports.lookupScope = lookupScope;
  32245. exports.mergeViewModel = mergeViewModel;
  32246. exports.moveDownGridRow = moveDownGridRow;
  32247. exports.moveUpGridRow = moveUpGridRow;
  32248. exports.msg = msg$1;
  32249. exports.msgError = msgError;
  32250. exports.normId = normId;
  32251. exports.pinyinMatch = pinyinMatch;
  32252. exports.prompt = prompt$2;
  32253. exports.raiseClick = raiseClick;
  32254. exports.reloadGrid = reloadGrid;
  32255. exports.removeGridRow = removeGridRow;
  32256. exports.replaceNA = replaceNA;
  32257. exports.saveGridRow = saveGridRow;
  32258. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32259. exports.setComboStore = setComboStore;
  32260. exports.showErrorDialog = showErrorDialog$1;
  32261. exports.showInfoDialog = showInfoDialog;
  32262. exports.showWidget = showWidget;
  32263. exports.sqlUrlTransform = sqlUrlTransform;
  32264. exports.stopEvent = stopEvent;
  32265. exports.studio = studio;
  32266. exports.toPlainObject = toPlainObject;
  32267. exports.toString = toString;
  32268. exports.tryEnable = tryEnable;
  32269. exports.tryVarSimple = tryVarSimple;
  32270. exports.tryWriteByExpress = tryWriteByExpress;
  32271. exports.tryWriteObject = tryWriteObject;
  32272. exports.watch = watch;
  32273. Object.defineProperty(exports, '__esModule', { value: true });
  32274. });
  32275. //# sourceMappingURL=yvan-ext.js.map