yvan-ext.js 1.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748
  1. define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx', 'localforage', 'handlebars', 'xterm', 'xterm-addon-fit', 'sql-formatter', 'modeler', 'bpmn-js-properties-panel', 'echarts', 'lay-excel'], function (exports, axios, Qs, _$2, $$2, moment$1, recast, XLSX, localforage, handlebars, xterm, xtermAddonFit, sqlFormat, BpmnModeler, bpmnJsPropertiesPanel, echarts, LAY_EXCEL) { 'use strict';
  2. var axios__default = 'default' in axios ? axios['default'] : axios;
  3. Qs = Qs && Object.prototype.hasOwnProperty.call(Qs, 'default') ? Qs['default'] : Qs;
  4. _$2 = _$2 && Object.prototype.hasOwnProperty.call(_$2, 'default') ? _$2['default'] : _$2;
  5. $$2 = $$2 && Object.prototype.hasOwnProperty.call($$2, 'default') ? $$2['default'] : $$2;
  6. moment$1 = moment$1 && Object.prototype.hasOwnProperty.call(moment$1, 'default') ? moment$1['default'] : moment$1;
  7. XLSX = XLSX && Object.prototype.hasOwnProperty.call(XLSX, 'default') ? XLSX['default'] : XLSX;
  8. localforage = localforage && Object.prototype.hasOwnProperty.call(localforage, 'default') ? localforage['default'] : localforage;
  9. handlebars = handlebars && Object.prototype.hasOwnProperty.call(handlebars, 'default') ? handlebars['default'] : handlebars;
  10. sqlFormat = sqlFormat && Object.prototype.hasOwnProperty.call(sqlFormat, 'default') ? sqlFormat['default'] : sqlFormat;
  11. BpmnModeler = BpmnModeler && Object.prototype.hasOwnProperty.call(BpmnModeler, 'default') ? BpmnModeler['default'] : BpmnModeler;
  12. LAY_EXCEL = LAY_EXCEL && Object.prototype.hasOwnProperty.call(LAY_EXCEL, 'default') ? LAY_EXCEL['default'] : LAY_EXCEL;
  13. var labelWidth = 80;
  14. var windows = {
  15. modal: true,
  16. width: 900,
  17. height: 600,
  18. maximizable: true,
  19. constrain: true,
  20. shadow: false,
  21. };
  22. var date = {
  23. labelAlign: 'right',
  24. labelWidth: labelWidth,
  25. };
  26. var tagfield = {
  27. labelAlign: 'right',
  28. labelWidth: labelWidth,
  29. valueField: 'id',
  30. displayField: 'text',
  31. autoLoad: true,
  32. mode: 'local',
  33. forceSelection: true,
  34. triggerAction: 'all',
  35. enableKeyEvents: true,
  36. queryMode: 'local',
  37. filterPickList: true,
  38. };
  39. var combo = {
  40. labelAlign: 'right',
  41. labelWidth: labelWidth,
  42. valueField: 'id',
  43. displayField: 'text',
  44. autoLoad: true,
  45. mode: 'local',
  46. forceSelection: true,
  47. triggerAction: 'all',
  48. enableKeyEvents: true,
  49. typeAheadDelay: 1,
  50. queryDelay: 1,
  51. };
  52. var comboGrid = {
  53. selectOnTab: true,
  54. pickerHeight: 500,
  55. pickerWidth: 850,
  56. editEnable: null,
  57. };
  58. var comboGridPicker = {
  59. xtype: 'yvgrid',
  60. layout: 'fit',
  61. selModel: {
  62. selType: 'rowmodel',
  63. mode: 'SINGLE'
  64. },
  65. };
  66. var comboGridMulti = {
  67. selectOnTab: true,
  68. pickerHeight: 500,
  69. pickerWidth: 850,
  70. editEnable: null,
  71. splitChar: ',',
  72. displayField: 'text',
  73. valueField: 'id',
  74. autoLoad: true,
  75. };
  76. var comboGridMultiPicker = {
  77. selType: 'checkboxmodel',
  78. selModel: {
  79. type: 'checkboxmodel',
  80. checkOnly: false
  81. },
  82. };
  83. var numberfield = {
  84. labelAlign: 'right',
  85. decimalPrecision: 6,
  86. labelWidth: labelWidth,
  87. };
  88. var checkbox = {
  89. labelAlign: 'right',
  90. labelWidth: labelWidth,
  91. checkedValue: true,
  92. uncheckedValue: false,
  93. };
  94. var checkboxgroup = {
  95. labelAlign: 'right',
  96. labelWidth: labelWidth,
  97. };
  98. var radio = {
  99. labelAlign: 'right',
  100. labelWidth: labelWidth,
  101. };
  102. var radiogroup = {
  103. labelAlign: 'right',
  104. labelWidth: labelWidth,
  105. simpleValue: true,
  106. layout: 'hbox',
  107. defaults: {
  108. xtype: 'radio',
  109. name: 'type',
  110. margin: '0 15 0 0'
  111. },
  112. };
  113. var form = {
  114. margin: '5 5 0 0',
  115. border: false,
  116. defaults: {
  117. margin: '0 0 5 0',
  118. border: false,
  119. },
  120. };
  121. var column = {
  122. filter: { type: 'string' },
  123. };
  124. var grid = {
  125. border: true,
  126. columnLines: true,
  127. rowLines: true,
  128. plugins: {
  129. cellediting: {
  130. clicksToEdit: 1,
  131. },
  132. gridfilters: true
  133. },
  134. multiColumnSort: true,
  135. viewConfig: {
  136. enableTextSelection: true,
  137. sortOnClick: false,
  138. emptyText: '没有数据'
  139. },
  140. selModel: {
  141. type: 'checkboxmodel',
  142. checkOnly: false
  143. },
  144. pagination: true,
  145. pageSize: 50,
  146. pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
  147. hideFootbar: false,
  148. hideRefresh: false,
  149. hideExport: false,
  150. hideAutoSize: false,
  151. hideClearFilter: false,
  152. hideSaveGridUIConfig: false,
  153. hideClearGridUIConfig: false,
  154. autoLoad: true,
  155. remoteSort: false,
  156. remoteFilter: false,
  157. enableLocking: true,
  158. syncRowHeight: false,
  159. enableColumnMove: true,
  160. enableColumnHide: true,
  161. enableColumnResize: true,
  162. hidden: false,
  163. disabled: false,
  164. exportExcelPageSize: 100,
  165. exportExcelCurrentPage: 1,
  166. exportExcelTotal: 0,
  167. cellTip: false,
  168. };
  169. var fieldContainer = {
  170. labelAlign: 'right',
  171. labelWidth: labelWidth,
  172. layout: 'hbox',
  173. defaults: {
  174. flex: 1,
  175. }
  176. };
  177. var tree = {
  178. autoLoad: true,
  179. hideFilter: false,
  180. hideToolbar: false,
  181. hideRefresh: false,
  182. hideExpand: false,
  183. hideCollapse: false,
  184. root: [],
  185. rootVisible: false,
  186. };
  187. var search = {
  188. labelAlign: 'right',
  189. labelWidth: labelWidth,
  190. };
  191. var text = {
  192. labelAlign: 'right',
  193. labelWidth: labelWidth,
  194. msgTarget: 'qtip',
  195. };
  196. var toolbar = {
  197. overflowHandler: 'menu',
  198. };
  199. var tbfill = {};
  200. var tbseparator = {};
  201. var button = {};
  202. var fieldSet = {
  203. margin: '5 5 0 0',
  204. border: false,
  205. defaults: {
  206. margin: '0 0 5 0',
  207. border: false,
  208. },
  209. };
  210. var storeAjax = {
  211. timeout: 60000
  212. };
  213. var panel = {};
  214. var splitter = {};
  215. var maintab = {};
  216. var rows = {};
  217. var cols = {
  218. defaults: {
  219. flex: 1
  220. },
  221. };
  222. var bpmn = {
  223. hideRefresh: false,
  224. autoLoad: true,
  225. dataSource: '',
  226. bpmnConfig: {}
  227. };
  228. 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 getCurrentProject() {
  2523. // const value = sessionStorage.getItem('CurrentProject');
  2524. // if (value) {
  2525. // project = JSON.parse(value)
  2526. // if (!project.url) {
  2527. // project = undefined
  2528. // }
  2529. // }
  2530. // return project
  2531. return {
  2532. uuid: '00000000',
  2533. name: '本服项目',
  2534. url: '',
  2535. };
  2536. }
  2537. /**
  2538. * 设置当前打开的项目资料(全局)
  2539. */
  2540. function setCurrentProject(value) {
  2541. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  2542. }
  2543. var CacheStore = /** @class */ (function () {
  2544. function CacheStore() {
  2545. // 订阅
  2546. this.subscribeList = [];
  2547. this.apiResponse = undefined;
  2548. }
  2549. /**
  2550. * 订阅结果集
  2551. */
  2552. CacheStore.prototype.registe = function (fn) {
  2553. this.subscribeList.push(fn);
  2554. };
  2555. /**
  2556. * 取消订阅
  2557. */
  2558. CacheStore.prototype.unregiste = function (fn) {
  2559. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  2560. };
  2561. /**
  2562. * 尝试取数据(先读缓存)
  2563. */
  2564. CacheStore.prototype.reloadIfNeed = function (param) {
  2565. var _this = this;
  2566. if (typeof this.apiResponse === 'undefined') {
  2567. // 从未有获取过值
  2568. var cacheKey = this.getCacheKey(param);
  2569. if (cacheKey) {
  2570. // 可以从缓存读
  2571. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  2572. native.loadFile(fileName, function (res) {
  2573. if (res) {
  2574. // 缓存有值
  2575. _this.apiResponse = res;
  2576. _this.notifyRefresh();
  2577. }
  2578. else {
  2579. // 缓存没值
  2580. _this.reloadForce(param).then(function (res) {
  2581. });
  2582. }
  2583. });
  2584. }
  2585. else {
  2586. // 不能从缓存读
  2587. this.reloadForce(param).then(function (res) {
  2588. });
  2589. }
  2590. return true;
  2591. }
  2592. return false;
  2593. };
  2594. /**
  2595. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  2596. */
  2597. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  2598. var _this = this;
  2599. return new Promise(function (resolve, reject) {
  2600. if (typeof _this.apiResponse === 'undefined') {
  2601. // 从未有获取过值
  2602. var cacheKey = _this.getCacheKey(param);
  2603. if (cacheKey) {
  2604. // 可以从缓存读
  2605. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  2606. native.loadFile(fileName, function (res) {
  2607. if (res) {
  2608. // 缓存有值
  2609. _this.apiResponse = res;
  2610. _this.notifyRefresh();
  2611. resolve(_this.apiResponse);
  2612. }
  2613. else {
  2614. // 缓存没值
  2615. _this.reloadForce(param).then(function (res) {
  2616. resolve(_this.apiResponse);
  2617. });
  2618. }
  2619. });
  2620. }
  2621. else {
  2622. // 不能从缓存读
  2623. _this.reloadForce(param).then(function (res) {
  2624. resolve(_this.apiResponse);
  2625. });
  2626. }
  2627. }
  2628. else {
  2629. // 有值,获取过
  2630. resolve(_this.apiResponse);
  2631. }
  2632. });
  2633. };
  2634. /**
  2635. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  2636. */
  2637. CacheStore.prototype.reloadForce = function (param) {
  2638. var _this = this;
  2639. _$2.forEach(this.subscribeList, function (fn) {
  2640. fn(true);
  2641. });
  2642. return this.invokeApi(param)
  2643. .then(function (res) {
  2644. _this.apiResponse = res;
  2645. var cacheKey = _this.getCacheKey(param);
  2646. if (cacheKey) {
  2647. // 可以保存到缓存
  2648. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  2649. native.saveFile(fileName, res);
  2650. }
  2651. // 通知订阅者刷新
  2652. _this.notifyRefresh();
  2653. })
  2654. .finally(function () {
  2655. _$2.forEach(_this.subscribeList, function (fn) {
  2656. fn(false);
  2657. });
  2658. });
  2659. };
  2660. /**
  2661. * 通知组件,isLoading状态被更改
  2662. */
  2663. CacheStore.prototype.notifyLoading = function (isLoading) {
  2664. var _this = this;
  2665. _$2.forEach(this.subscribeList, function (fn) {
  2666. fn(_this.apiResponse);
  2667. });
  2668. };
  2669. /**
  2670. * 通知数据更改,需要刷新
  2671. */
  2672. CacheStore.prototype.notifyRefresh = function () {
  2673. var _this = this;
  2674. _$2.forEach(this.subscribeList, function (fn) {
  2675. fn(_this.apiResponse);
  2676. });
  2677. };
  2678. return CacheStore;
  2679. }());
  2680. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  2681. function createEmptyModule(path, filename) {
  2682. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  2683. }
  2684. function createFolder(parentPath, filename) {
  2685. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  2686. }
  2687. function getModuleFileContent(module) {
  2688. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  2689. }
  2690. function saveFile(fileFullPath, fileContent) {
  2691. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  2692. // @ts-ignore
  2693. system.msg("保存成功");
  2694. return res;
  2695. });
  2696. }
  2697. function getQueryDslInfo(tableName) {
  2698. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  2699. args: [
  2700. { tableName: tableName }
  2701. ]
  2702. }).catch(function (e) {
  2703. var _a, _b;
  2704. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  2705. showErrorDialog(msg);
  2706. console.error(msg, e);
  2707. });
  2708. }
  2709. function invokeServer(url, param) {
  2710. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  2711. return request.post(url, {
  2712. args: [
  2713. param
  2714. ]
  2715. }).catch(function (e) {
  2716. var _a, _b;
  2717. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  2718. showErrorDialog(msg);
  2719. console.error(msg, e);
  2720. });
  2721. }
  2722. function parseSqlApi(sql) {
  2723. return request.post(getBaseUrl() + "@parseSqlApi", {
  2724. args: [sql]
  2725. }).catch(function (e) {
  2726. var _a, _b;
  2727. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  2728. showErrorDialog(msg);
  2729. console.error(msg, e);
  2730. });
  2731. }
  2732. function saveModuleFiles(param) {
  2733. return request.post(getBaseUrl() + "@saveModuleFiles", {
  2734. args: [
  2735. param
  2736. ]
  2737. }).catch(function (e) {
  2738. var _a, _b;
  2739. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  2740. showErrorDialog(msg);
  2741. console.error(msg, e);
  2742. });
  2743. }
  2744. function createQueryDSLFile(_a) {
  2745. var schema_name = _a.schema_name, table_name = _a.table_name;
  2746. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  2747. args: [{ schema_name: schema_name, table_name: table_name }]
  2748. }).catch(function (e) {
  2749. var _a, _b;
  2750. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  2751. showErrorDialog(msg);
  2752. console.error(msg, e);
  2753. });
  2754. }
  2755. function dbToMeta(param) {
  2756. if (typeof param === 'undefined') {
  2757. param = { datasource: 'master' };
  2758. }
  2759. else if (typeof param.datasource === 'undefined') {
  2760. param.datasource = 'master';
  2761. }
  2762. return request.post(getBaseUrl() + "@dbToMeta", {
  2763. args: [
  2764. param
  2765. ]
  2766. }).catch(function (e) {
  2767. var _a, _b;
  2768. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  2769. showErrorDialog(msg);
  2770. console.error(msg, e);
  2771. });
  2772. }
  2773. function getColumnDomainApi(param) {
  2774. if (typeof param === 'undefined') {
  2775. param = { datasource: 'master' };
  2776. }
  2777. else if (typeof param.datasource === 'undefined') {
  2778. param.datasource = 'master';
  2779. }
  2780. return request.post(getBaseUrl() + "@getColumnDomain", {
  2781. args: [
  2782. param
  2783. ]
  2784. }).catch(function (e) {
  2785. var _a, _b;
  2786. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  2787. showErrorDialog(msg);
  2788. console.error(msg, e);
  2789. });
  2790. }
  2791. function getMateData(param) {
  2792. if (typeof param === 'undefined') {
  2793. param = { datasource: 'master' };
  2794. }
  2795. else if (typeof param.datasource === 'undefined') {
  2796. param.datasource = 'master';
  2797. }
  2798. return request.post(getBaseUrl() + "@getMateData", {
  2799. args: [
  2800. param
  2801. ]
  2802. }).catch(function (e) {
  2803. var _a, _b;
  2804. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  2805. showErrorDialog(msg);
  2806. console.error(msg, e);
  2807. });
  2808. }
  2809. function getMateDataByTableName(param) {
  2810. if (typeof param === 'undefined') {
  2811. param = { datasource: 'master' };
  2812. }
  2813. else if (typeof param.datasource === 'undefined') {
  2814. param.datasource = 'master';
  2815. }
  2816. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  2817. args: [
  2818. param
  2819. ]
  2820. }).catch(function (e) {
  2821. var _a, _b;
  2822. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  2823. showErrorDialog(msg);
  2824. console.error(msg, e);
  2825. });
  2826. }
  2827. function saveMetaTableChanges(param) {
  2828. if (typeof param === 'undefined') {
  2829. param = { datasource: 'master' };
  2830. }
  2831. else if (typeof param.datasource === 'undefined') {
  2832. param.datasource = 'master';
  2833. }
  2834. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  2835. args: [
  2836. param
  2837. ]
  2838. }).catch(function (e) {
  2839. var _a, _b;
  2840. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  2841. showErrorDialog(msg);
  2842. console.error(msg, e);
  2843. });
  2844. }
  2845. function getModifyTableDDL(param) {
  2846. if (typeof param === 'undefined') {
  2847. param = { datasource: 'master' };
  2848. }
  2849. else if (typeof param.datasource === 'undefined') {
  2850. param.datasource = 'master';
  2851. }
  2852. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  2853. args: [
  2854. param
  2855. ]
  2856. }).catch(function (e) {
  2857. var _a, _b;
  2858. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  2859. showErrorDialog(msg);
  2860. console.error(msg, e);
  2861. });
  2862. }
  2863. function pushToDbCommitApi(param) {
  2864. if (typeof param === 'undefined') {
  2865. param = { datasource: 'master' };
  2866. }
  2867. else if (typeof param.datasource === 'undefined') {
  2868. param.datasource = 'master';
  2869. }
  2870. return request.post(getBaseUrl() + "@pushToDbCommit", {
  2871. args: [
  2872. param
  2873. ]
  2874. }).catch(function (e) {
  2875. var _a, _b;
  2876. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  2877. showErrorDialog(msg);
  2878. console.error(msg, e);
  2879. });
  2880. }
  2881. /**
  2882. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  2883. */
  2884. function saveMetaExBuildDDL(param) {
  2885. if (typeof param === 'undefined') {
  2886. param = { datasource: 'master' };
  2887. }
  2888. else if (typeof param.datasource === 'undefined') {
  2889. param.datasource = 'master';
  2890. }
  2891. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  2892. args: [
  2893. param
  2894. ]
  2895. }).catch(function (e) {
  2896. var _a, _b;
  2897. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  2898. showErrorDialog(msg);
  2899. console.error(msg, e);
  2900. });
  2901. }
  2902. function registerResource(params) {
  2903. return request.post(getBaseUrl() + "@registerResource", {
  2904. args: [params]
  2905. }).catch(function (e) {
  2906. var _a, _b;
  2907. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  2908. showErrorDialog(msg);
  2909. console.error(msg, e);
  2910. });
  2911. }
  2912. function getMenuTree(params) {
  2913. return request.post(getBaseUrl() + "@getMenuTree", {
  2914. args: [params]
  2915. }).catch(function (e) {
  2916. var _a, _b;
  2917. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  2918. showErrorDialog(msg);
  2919. console.error(msg, e);
  2920. });
  2921. }
  2922. function moduleTree() {
  2923. return request.post(getBaseUrl() + "@moduleTree")
  2924. .catch(function (e) {
  2925. var _a, _b;
  2926. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  2927. showErrorDialog(msg);
  2928. console.error(msg, e);
  2929. });
  2930. }
  2931. function dropTableDDL(schemaName, tableName) {
  2932. return request.post(getBaseUrl() + "@dropTableDDL", {
  2933. args: [
  2934. { schemaName: schemaName, tableName: tableName },
  2935. ]
  2936. }).catch(function (e) {
  2937. var _a, _b;
  2938. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  2939. showErrorDialog(msg);
  2940. console.error(msg, e);
  2941. });
  2942. }
  2943. function renameTableDDL(schemaName, tableName, reTableName) {
  2944. return request.post(getBaseUrl() + "@renameTableDDL", {
  2945. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  2946. }).catch(function (e) {
  2947. var _a, _b;
  2948. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  2949. showErrorDialog(msg);
  2950. console.error(msg, e);
  2951. });
  2952. }
  2953. function executeModifyProcedureSQL(param) {
  2954. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  2955. args: [
  2956. param,
  2957. ]
  2958. }).catch(function (e) {
  2959. var _a, _b;
  2960. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  2961. showErrorDialog(msg);
  2962. console.error(msg, e);
  2963. });
  2964. }
  2965. function parseDynamicSqlApi(sql, dataSource) {
  2966. return request.post(getBaseUrl() + "@parseDynamicSql", {
  2967. args: [
  2968. { sql: sql, dataSource: dataSource },
  2969. ]
  2970. }).catch(function (e) {
  2971. var _a, _b;
  2972. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  2973. showErrorDialog(msg);
  2974. console.error(msg, e);
  2975. });
  2976. }
  2977. function exporerList() {
  2978. return request.post(getBaseUrl() + "@exporerList", {
  2979. args: [{}]
  2980. }).catch(function (e) {
  2981. var _a, _b;
  2982. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  2983. showErrorDialog(msg);
  2984. console.error(msg, e);
  2985. });
  2986. }
  2987. function reportListApi() {
  2988. return request.post(getBaseUrl() + "@reportList", {
  2989. args: []
  2990. }).catch(function (e) {
  2991. var _a, _b;
  2992. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  2993. showErrorDialog(msg);
  2994. console.error(msg, e);
  2995. });
  2996. }
  2997. function reportByIdApi(reportId) {
  2998. return request.post(getBaseUrl() + "@reportById", {
  2999. args: [
  3000. { reportId: reportId },
  3001. ]
  3002. }).catch(function (e) {
  3003. var _a, _b;
  3004. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  3005. showErrorDialog(msg);
  3006. console.error(msg, e);
  3007. });
  3008. }
  3009. function createReportApi(reportName) {
  3010. return request.post(getBaseUrl() + "@createReport", {
  3011. args: [
  3012. { reportName: reportName },
  3013. ]
  3014. }).catch(function (e) {
  3015. var _a, _b;
  3016. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  3017. showErrorDialog(msg);
  3018. console.error(msg, e);
  3019. });
  3020. }
  3021. function saveReportApi(param) {
  3022. return request.post(getBaseUrl() + "@saveReport", {
  3023. args: [
  3024. param,
  3025. ]
  3026. }).catch(function (e) {
  3027. var _a, _b;
  3028. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  3029. showErrorDialog(msg);
  3030. console.error(msg, e);
  3031. });
  3032. }
  3033. function delReportApi(report_id) {
  3034. return request.post(getBaseUrl() + "@delReport", {
  3035. args: [{ report_id: report_id },]
  3036. }).catch(function (e) {
  3037. var _a, _b;
  3038. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  3039. showErrorDialog(msg);
  3040. console.error(msg, e);
  3041. });
  3042. }
  3043. function getDict(param) {
  3044. if (typeof param === 'undefined') {
  3045. param = { datasource: 'master' };
  3046. }
  3047. else if (typeof param.datasource === 'undefined') {
  3048. param.datasource = 'master';
  3049. }
  3050. return request.post(getBaseUrl() + "@getDict", {
  3051. args: [
  3052. param
  3053. ]
  3054. });
  3055. }
  3056. function saveDictApi(param) {
  3057. if (typeof param === 'undefined') {
  3058. param = { datasource: 'master' };
  3059. }
  3060. else if (typeof param.datasource === 'undefined') {
  3061. param.datasource = 'master';
  3062. }
  3063. return request.post(getBaseUrl() + "@saveDict", {
  3064. args: [
  3065. param
  3066. ]
  3067. }).catch(function (e) {
  3068. var _a, _b;
  3069. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  3070. showErrorDialog(msg);
  3071. console.error(msg, e);
  3072. });
  3073. }
  3074. function saveDictItemsApi(param) {
  3075. if (typeof param === 'undefined') {
  3076. param = { datasource: 'master' };
  3077. }
  3078. else if (typeof param.datasource === 'undefined') {
  3079. param.datasource = 'master';
  3080. }
  3081. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  3082. args: [
  3083. param
  3084. ]
  3085. }).catch(function (e) {
  3086. var _a, _b;
  3087. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  3088. showErrorDialog(msg);
  3089. console.error(msg, e);
  3090. });
  3091. }
  3092. function createDictEnum(param) {
  3093. return request.post(getBaseUrl() + "@createDictEnum", {
  3094. args: [
  3095. param
  3096. ]
  3097. }).catch(function (e) {
  3098. var _a, _b;
  3099. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  3100. showErrorDialog(msg);
  3101. console.error(msg, e);
  3102. });
  3103. }
  3104. function loadSqlContentApi(url) {
  3105. return request.post(getBaseUrl() + "@loadSqlContent", {
  3106. args: [
  3107. {
  3108. url: GLOBAL_NAMESPACE_PREFIX + url,
  3109. }
  3110. ]
  3111. }).catch(function (e) {
  3112. var _a, _b;
  3113. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  3114. showErrorDialog(msg);
  3115. console.error(msg, e);
  3116. });
  3117. }
  3118. function saveSqlContentApi(url, content) {
  3119. return request.post(getBaseUrl() + "@saveSqlContent", {
  3120. args: [
  3121. {
  3122. url: GLOBAL_NAMESPACE_PREFIX + url,
  3123. content: content,
  3124. }
  3125. ]
  3126. }).catch(function (e) {
  3127. var _a, _b;
  3128. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  3129. showErrorDialog(msg);
  3130. console.error(msg, e);
  3131. });
  3132. }
  3133. function readBpmn(param) {
  3134. return request.post(getBaseUrl() + "@readBpmn", {
  3135. args: [param]
  3136. }).catch(function (e) {
  3137. var _a, _b;
  3138. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3139. showErrorDialog(msg);
  3140. console.error(msg, e);
  3141. });
  3142. }
  3143. function createBpmn(path, filename) {
  3144. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  3145. var _a, _b;
  3146. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  3147. showErrorDialog(msg);
  3148. console.error(msg, e);
  3149. });
  3150. }
  3151. function saveBpmn(fileFullPath, fileContent) {
  3152. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  3153. // @ts-ignore
  3154. system.msg("保存成功");
  3155. return res;
  3156. });
  3157. }
  3158. function deleteBpmn(path, filename) {
  3159. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  3160. var _a, _b;
  3161. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  3162. showErrorDialog(msg);
  3163. console.error(msg, e);
  3164. });
  3165. }
  3166. function createDevForm(param) {
  3167. return request.post(getBaseUrl() + "@createDevForm", {
  3168. args: [param]
  3169. }).catch(function (e) {
  3170. var _a, _b;
  3171. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3172. showErrorDialog(msg);
  3173. console.error(msg, e);
  3174. });
  3175. }
  3176. function readDevForm(param) {
  3177. return request.post(getBaseUrl() + "@readDevForm", {
  3178. args: [param]
  3179. }).catch(function (e) {
  3180. var _a, _b;
  3181. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  3182. showErrorDialog(msg);
  3183. console.error(msg, e);
  3184. });
  3185. }
  3186. function calcColumnForm(param) {
  3187. return request.post(getBaseUrl() + "@calcColumnForm", {
  3188. args: [param]
  3189. }).catch(function (e) {
  3190. var _a, _b;
  3191. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  3192. showErrorDialog(msg);
  3193. console.error(msg, e);
  3194. });
  3195. }
  3196. function widgetListApi(param) {
  3197. return request.post(getBaseUrl() + "@widgetListApi", {
  3198. args: [param]
  3199. }).catch(function (e) {
  3200. var _a, _b;
  3201. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  3202. showErrorDialog(msg);
  3203. console.error(msg, e);
  3204. });
  3205. }
  3206. function readWidget(param) {
  3207. return request.post(getBaseUrl() + "@readWidget", {
  3208. args: [param]
  3209. }).catch(function (e) {
  3210. var _a, _b;
  3211. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  3212. showErrorDialog(msg);
  3213. console.error(msg, e);
  3214. });
  3215. }
  3216. function saveWidget(param) {
  3217. return request.post(getBaseUrl() + "@saveWidget", {
  3218. args: [param]
  3219. }).catch(function (e) {
  3220. var _a, _b;
  3221. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  3222. showErrorDialog(msg);
  3223. console.error(msg, e);
  3224. });
  3225. }
  3226. function deleteWidget(param) {
  3227. return request.post(getBaseUrl() + "@deleteWidget", {
  3228. args: [param]
  3229. }).catch(function (e) {
  3230. var _a, _b;
  3231. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  3232. showErrorDialog(msg);
  3233. console.error(msg, e);
  3234. });
  3235. }
  3236. function getDataBaseNameApi() {
  3237. return request.post(getBaseUrl() + "@getDataBaseName", {
  3238. args: []
  3239. }).catch(function (e) {
  3240. var _a, _b;
  3241. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  3242. showErrorDialog(msg);
  3243. console.error(msg, e);
  3244. });
  3245. }
  3246. function getDiffDDLApi(param) {
  3247. return request.post(getBaseUrl() + "@getDiffDDL", {
  3248. args: [
  3249. param
  3250. ]
  3251. }).catch(function (e) {
  3252. var _a, _b;
  3253. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  3254. showErrorDialog(msg);
  3255. console.error(msg, e);
  3256. });
  3257. }
  3258. function dataSyncApi(param) {
  3259. return request.post(getBaseUrl() + "@dataSync", {
  3260. args: [
  3261. param
  3262. ]
  3263. }).catch(function (e) {
  3264. var _a, _b;
  3265. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  3266. showErrorDialog(msg);
  3267. console.error(msg, e);
  3268. });
  3269. }
  3270. function dataSyncInfoApi(param) {
  3271. return request.post(getBaseUrl() + "@dataSyncInfo", {
  3272. args: [
  3273. param
  3274. ]
  3275. }).catch(function (e) {
  3276. var _a, _b;
  3277. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  3278. showErrorDialog(msg);
  3279. console.error(msg, e);
  3280. });
  3281. }
  3282. function saveColumnDomain(param) {
  3283. if (typeof param === 'undefined') {
  3284. param = { datasource: 'master' };
  3285. }
  3286. else if (typeof param.datasource === 'undefined') {
  3287. param.datasource = 'master';
  3288. }
  3289. return request.post(getBaseUrl() + "@saveColumnDomain", {
  3290. args: [
  3291. param
  3292. ]
  3293. }).catch(function (e) {
  3294. var _a, _b;
  3295. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  3296. showErrorDialog('发生错误:' + msg);
  3297. console.error(msg, e);
  3298. });
  3299. }
  3300. function devOpsList() {
  3301. return request.post(getBaseUrl() + "@devOpsList", {
  3302. args: [{}]
  3303. }).catch(function (e) {
  3304. var _a, _b;
  3305. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  3306. showErrorDialog('发生错误:' + msg);
  3307. console.error(msg, e);
  3308. });
  3309. }
  3310. function devOpsById(opsId) {
  3311. return request.post(getBaseUrl() + "@devOpsById", {
  3312. args: [{ opsId: opsId }]
  3313. }).catch(function (e) {
  3314. var _a, _b;
  3315. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  3316. showErrorDialog('发生错误:' + msg);
  3317. console.error(msg, e);
  3318. });
  3319. }
  3320. function metricsRequestApi() {
  3321. return request.get("/api/metrics/request")
  3322. .catch(function (e) {
  3323. var _a, _b;
  3324. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  3325. showErrorDialog('发生错误:' + msg);
  3326. console.error(msg, e);
  3327. });
  3328. }
  3329. function metricsJdbcApi() {
  3330. return request.get("/api/metrics/jdbc")
  3331. .catch(function (e) {
  3332. var _a, _b;
  3333. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  3334. showErrorDialog('发生错误:' + msg);
  3335. console.error(msg, e);
  3336. });
  3337. }
  3338. function executeDDL(param) {
  3339. return request.post(getBaseUrl() + "@executeDDL", {
  3340. args: [
  3341. param,
  3342. ]
  3343. }).catch(function (e) {
  3344. var _a, _b;
  3345. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  3346. showErrorDialog('发生错误:' + msg);
  3347. console.error(msg, e);
  3348. });
  3349. }
  3350. function getModifyIdxDDL(param) {
  3351. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  3352. args: [
  3353. param,
  3354. ]
  3355. }).catch(function (e) {
  3356. var _a, _b;
  3357. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  3358. showErrorDialog('发生错误:' + msg);
  3359. console.error(msg, e);
  3360. });
  3361. }
  3362. function getModifyProcedureSQL(param) {
  3363. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  3364. args: [
  3365. param,
  3366. ]
  3367. }).catch(function (e) {
  3368. var _a, _b;
  3369. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  3370. showErrorDialog('发生错误:' + msg);
  3371. console.error(msg, e);
  3372. });
  3373. }
  3374. function saveWhLayout(param) {
  3375. return request.post(getLayoutUrl() + "@saveWhLayout", {
  3376. args: [
  3377. param,
  3378. ]
  3379. }).catch(function (e) {
  3380. var _a, _b;
  3381. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  3382. showErrorDialog('发生错误:' + msg);
  3383. console.error(msg, e);
  3384. });
  3385. }
  3386. function deleteWhLayout(param) {
  3387. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  3388. args: [
  3389. param,
  3390. ]
  3391. }).catch(function (e) {
  3392. var _a, _b;
  3393. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  3394. showErrorDialog('发生错误:' + msg);
  3395. console.error(msg, e);
  3396. });
  3397. }
  3398. function loadWhLayoutAll() {
  3399. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  3400. args: []
  3401. }).catch(function (e) {
  3402. var _a, _b;
  3403. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  3404. showErrorDialog('发生错误:' + msg);
  3405. console.error(msg, e);
  3406. });
  3407. }
  3408. function loadWhLayout(param) {
  3409. return request.post(getLayoutUrl() + "@loadWhLayout", {
  3410. args: [
  3411. param,
  3412. ]
  3413. }).catch(function (e) {
  3414. var _a, _b;
  3415. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  3416. showErrorDialog('发生错误:' + msg);
  3417. console.error(msg, e);
  3418. });
  3419. }
  3420. var baseUrl = "/api/com/yvan/studio/FileManager";
  3421. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  3422. function getBaseUrl() {
  3423. // return getCurrentProject().url + baseUrl
  3424. return baseUrl;
  3425. }
  3426. function getLayoutUrl() {
  3427. // return getCurrentProject().url + baseUrl
  3428. return layoutUrl;
  3429. }
  3430. var Request = /** @class */ (function () {
  3431. function Request(axiosInstance) {
  3432. this.axiosInstance = axiosInstance;
  3433. }
  3434. // 全局响应数据转换处理
  3435. Request.transformResponse = function (response) {
  3436. var _a;
  3437. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  3438. };
  3439. Request.prototype.get = function (url, config) {
  3440. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  3441. };
  3442. Request.prototype.delete = function (url, config) {
  3443. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  3444. };
  3445. Request.prototype.head = function (url, config) {
  3446. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  3447. };
  3448. Request.prototype.options = function (url, config) {
  3449. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  3450. };
  3451. Request.prototype.post = function (url, data, config) {
  3452. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3453. };
  3454. Request.prototype.put = function (url, data, config) {
  3455. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3456. };
  3457. Request.prototype.patch = function (url, data, config) {
  3458. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  3459. };
  3460. Request.prototype.request = function (config) {
  3461. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  3462. };
  3463. return Request;
  3464. }());
  3465. /** 创建一个axios实例对象 */
  3466. function axiosCreate(config) {
  3467. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  3468. }
  3469. var axiosInstance;
  3470. function init() {
  3471. axiosInstance = axiosCreate({
  3472. validateStatus: function (status) { return (status >= 200 && status < 400); },
  3473. });
  3474. request = new Request(axiosInstance);
  3475. }
  3476. var request;
  3477. // ------------------------------------------------------------------------------------------ types
  3478. /** 订阅消息key类型 */
  3479. var EventType;
  3480. (function (EventType) {
  3481. /** FileTree打开Module */
  3482. EventType["ModuleOpen"] = "ModuleOpen";
  3483. /** ModulePage 创建 */
  3484. EventType["ModulePageCreate"] = "ModulePageCreate";
  3485. /** ModuleItem内容变化 */
  3486. EventType["ModuleItemChange"] = "ModuleItemChange";
  3487. /** ModuleItem的 jsView 内容变化 */
  3488. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3489. /** 设置 vjson */
  3490. EventType["SetVjson"] = "SetVjson";
  3491. /** 更新 vjson */
  3492. EventType["UpdateVjson"] = "UpdateVjson";
  3493. /** 更新 组件vjson */
  3494. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3495. /** Component 选中内容变化 */
  3496. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3497. /** Component 选中内容变化 */
  3498. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3499. /** Component 删除事件 */
  3500. EventType["ComponentDelete"] = "ComponentDelete";
  3501. /** MainTab 选中改变事件 */
  3502. EventType["MainTabChange"] = "MainTabChange";
  3503. /** ModuleTab 选中改变事件 */
  3504. EventType["ModuleTabChange"] = "ModuleTabChange";
  3505. /** 保存事件 */
  3506. EventType["SaveCall"] = "SaveCall";
  3507. /** 撤销 */
  3508. EventType["Undo"] = "Undo";
  3509. /** 还原 */
  3510. EventType["Redo"] = "Redo";
  3511. /** 剪切 */
  3512. EventType["Cut"] = "Cut";
  3513. /** 复制 */
  3514. EventType["Copy"] = "Copy";
  3515. /** 粘贴 */
  3516. EventType["Paste"] = "Paste";
  3517. /** 全选 */
  3518. EventType["SelectAll"] = "SelectAll";
  3519. /** 读取剪切板 */
  3520. EventType["ClipboardRead"] = "ClipboardRead";
  3521. /** 检查模块更新 */
  3522. EventType["RunCheckModule"] = "RunCheckModule";
  3523. /** 停止检查模块更新 */
  3524. EventType["StopCheckModule"] = "StopCheckModule";
  3525. })(EventType || (EventType = {}));
  3526. // ------------------------------------------------------------------------------------------ impls
  3527. var EventBus = /** @class */ (function () {
  3528. function EventBus() {
  3529. /** 事件数据 */
  3530. this.store = {};
  3531. /** 事件订阅者注册表 */
  3532. this.observeStoreTable = {};
  3533. this.init();
  3534. }
  3535. EventBus.prototype.init = function () {
  3536. var _this = this;
  3537. // 更改store值就会自动publish消息 - 实现
  3538. this.store = new Proxy({}, {
  3539. get: function (target, key) {
  3540. return target[key];
  3541. },
  3542. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3543. set: function (target, key, data) {
  3544. if (noValue(key))
  3545. return false;
  3546. target[key] = data;
  3547. // 消息通知订阅者
  3548. var observerArr = _this.observeStoreTable[key];
  3549. if (noValue(observerArr) || observerArr.length <= 0)
  3550. return true;
  3551. observerArr.forEach(function (handler) {
  3552. //try {
  3553. handler(data, key);
  3554. // } catch (err) {
  3555. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3556. // }
  3557. });
  3558. return true;
  3559. },
  3560. });
  3561. };
  3562. /** 取消注册订阅者 */
  3563. EventBus.prototype.unregisterObserver = function (key, handler) {
  3564. var _this = this;
  3565. var observerArr = this.observeStoreTable[key];
  3566. if (noValue(observerArr) || observerArr.length <= 0)
  3567. return;
  3568. if (noValue(handler)) {
  3569. this.observeStoreTable[key] = [];
  3570. }
  3571. else {
  3572. observerArr.forEach(function (obsHandler, index) {
  3573. if (obsHandler !== handler)
  3574. return;
  3575. _this.observeStoreTable[key].splice(index, 1);
  3576. });
  3577. }
  3578. };
  3579. /** 注册订阅者 */
  3580. EventBus.prototype.registerObserver = function (key, handler) {
  3581. var observerArr = this.observeStoreTable[key];
  3582. if (noValue(observerArr) || observerArr.length <= 0) {
  3583. observerArr = [];
  3584. this.observeStoreTable[key] = observerArr;
  3585. }
  3586. observerArr.push(handler);
  3587. // if (noValue(key)) return;
  3588. // const sourceValue = this.store[key];
  3589. // if (noValue(sourceValue)) return;
  3590. // handler(sourceValue, key);
  3591. };
  3592. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3593. EventBus.prototype.getStore = function () {
  3594. return this.store;
  3595. };
  3596. /**
  3597. * 取消订阅
  3598. * @param key 订阅的消息key
  3599. * @param handler 指定取消的监听函数
  3600. */
  3601. EventBus.prototype.unsubscribe = function (key, handler) {
  3602. var _this = this;
  3603. if (key instanceof Array) {
  3604. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3605. }
  3606. else {
  3607. this.unregisterObserver(key, handler);
  3608. }
  3609. };
  3610. /**
  3611. * 消息订阅
  3612. * @param key 订阅的消息key
  3613. * @param handler 监听函数
  3614. */
  3615. EventBus.prototype.subscribe = function (key, handler) {
  3616. var _this = this;
  3617. var cancelSubscribe = {
  3618. key: key,
  3619. cancel: function () {
  3620. },
  3621. };
  3622. if (key instanceof Array) {
  3623. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3624. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3625. }
  3626. else {
  3627. this.registerObserver(key, handler);
  3628. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3629. }
  3630. return cancelSubscribe;
  3631. };
  3632. /**
  3633. * 消息订阅(只订阅一次)
  3634. * @param key 订阅的消息key
  3635. * @param handler 监听函数
  3636. */
  3637. EventBus.prototype.subscribeOnce = function (key, handler) {
  3638. var cancelSubscribe = this.subscribe(key, function (data) {
  3639. // try {
  3640. handler(data, key);
  3641. // } catch (err) {
  3642. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3643. // }
  3644. cancelSubscribe.cancel();
  3645. });
  3646. };
  3647. /**
  3648. * 发送消息(触发订阅监听函数)
  3649. * @param key 消息key
  3650. * @param eventData 消息值
  3651. */
  3652. EventBus.prototype.publish = function (key, eventData) {
  3653. var _this = this;
  3654. if (key instanceof Array) {
  3655. key.forEach(function (k) { return _this.store[k] = eventData; });
  3656. }
  3657. else {
  3658. this.store[key] = eventData;
  3659. }
  3660. };
  3661. return EventBus;
  3662. }());
  3663. // ------------------------------------------------------------------------------------------ use
  3664. var eventBus = new EventBus();
  3665. var idPrefix = "_ds_";
  3666. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  3667. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  3668. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  3669. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  3670. var layoutOrXtypeNameMap = {
  3671. fit: 'fit布局',
  3672. border: 'border布局',
  3673. center: '中部',
  3674. north: '上部',
  3675. south: '下部',
  3676. west: '左部',
  3677. east: '右部',
  3678. yvgrid: '表格',
  3679. tree: '树',
  3680. tabpanel: '标签页',
  3681. form: '表单',
  3682. fieldset: '字段组',
  3683. tbar: '顶部工具栏',
  3684. fbar: '底部工具栏',
  3685. toolbar: '工具栏',
  3686. cols: '列容器',
  3687. rows: '行容器',
  3688. textfield: '文本框',
  3689. textareafield: '长文本框',
  3690. numberfield: '数字框',
  3691. label: "文本",
  3692. combo: "下拉框",
  3693. combobox: "下拉框",
  3694. combotree: "下拉树",
  3695. combogrid: "下拉表",
  3696. datefield: "日期框",
  3697. searchfield: "搜索框",
  3698. button: "按钮",
  3699. checkbox: "勾选",
  3700. checkboxgroup: "勾选组",
  3701. radio: "点选",
  3702. radiogroup: "点选组",
  3703. container: "占位"
  3704. };
  3705. /**
  3706. * 从 VJSON 中找到 rows/cols 的数组
  3707. */
  3708. function findArrayContainer(vjson, id) {
  3709. var parentVJson = getSuperVjson(vjson, id);
  3710. if (_$2.isArray(parentVJson)) {
  3711. return parentVJson;
  3712. }
  3713. if (parentVJson.hasOwnProperty('items')) {
  3714. return parentVJson.items;
  3715. }
  3716. }
  3717. /**
  3718. * 根据id查找上级vjson
  3719. * @param vjson 原始 vjson 视图
  3720. * @param targetId 子元素的id
  3721. */
  3722. function getSuperVjson(vjson, targetId) {
  3723. return deepTravFindSuper(vjson, vjson, targetId);
  3724. }
  3725. /**
  3726. * 根据id查找上级vjson id
  3727. * @param vjson 原始 vjson 视图
  3728. * @param targetId 子元素的id
  3729. */
  3730. function getSuperVjsonId(vjson, targetId) {
  3731. var vj = getSuperVjson(vjson, targetId);
  3732. return vj.id;
  3733. }
  3734. function deepTravFindSuper(superVjson, vjson, targetId) {
  3735. var rObj = null;
  3736. _$2.forOwn(vjson, function (value, key) {
  3737. if (rObj) {
  3738. return;
  3739. }
  3740. if (typeof value !== "object") {
  3741. return;
  3742. }
  3743. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  3744. if (key !== 'items') {
  3745. return;
  3746. }
  3747. }
  3748. else {
  3749. // 模型、数据、数据源不扫描
  3750. if (key === 'data' ||
  3751. key === 'dataSource' ||
  3752. key === 'suggest' ||
  3753. key === 'options' ||
  3754. key === 'config' ||
  3755. key === 'columns' ||
  3756. key === 'viewModel' ||
  3757. key === 'store') {
  3758. return;
  3759. }
  3760. }
  3761. //事件不扫描
  3762. if (key === "on" && _$2.isObject(value)) {
  3763. return;
  3764. }
  3765. if (key.startsWith("on") && _$2.size(key) > 2) {
  3766. return;
  3767. }
  3768. if (value.id === targetId) {
  3769. if (_$2.isArray(vjson)) {
  3770. rObj = superVjson;
  3771. }
  3772. else {
  3773. rObj = vjson;
  3774. }
  3775. return;
  3776. }
  3777. rObj = deepTravFindSuper(vjson, value, targetId);
  3778. });
  3779. return rObj;
  3780. }
  3781. /**
  3782. * 深度遍历 vjson
  3783. * @param vjson 视图JSON
  3784. * @param resolver 分析函数
  3785. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  3786. */
  3787. function deepTravVJson(vjson, resolver, propDeep) {
  3788. if (propDeep === void 0) { propDeep = false; }
  3789. var markerList = [];
  3790. deepTrav1(vjson, resolver, markerList, propDeep);
  3791. return markerList;
  3792. }
  3793. function deepTrav1(obj, resolver, marker, propDeep) {
  3794. if (propDeep === void 0) { propDeep = false; }
  3795. var isMarker = resolver(obj);
  3796. if (marker && isMarker === true) {
  3797. marker.unshift({ id: 0, keyName: '', object: obj });
  3798. }
  3799. _$2.forOwn(obj, function (value, key) {
  3800. if (typeof value !== 'object') {
  3801. return;
  3802. }
  3803. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3804. if (key !== 'items' && key !== 'children') {
  3805. return;
  3806. }
  3807. }
  3808. else {
  3809. // 模型、数据、数据源不扫描
  3810. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  3811. return;
  3812. }
  3813. if (!propDeep &&
  3814. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  3815. key === 'listeners' || key === 'bind')) {
  3816. return;
  3817. }
  3818. }
  3819. //事件不扫描
  3820. if (key === 'on' && _$2.isObject(value)) {
  3821. return;
  3822. }
  3823. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3824. return;
  3825. }
  3826. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  3827. if (marker && isMarkerChild === true) {
  3828. isMarker = true;
  3829. marker.unshift({ id: obj.id, keyName: key, object: value });
  3830. }
  3831. });
  3832. // @ts-ignore 删除作废对象
  3833. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  3834. return isMarker;
  3835. }
  3836. /**
  3837. * 在代码中找到 reference 对应的对象
  3838. */
  3839. function findInCode(code, id) {
  3840. try {
  3841. deepTravVJson(code, function (child) {
  3842. if (child.id === id) {
  3843. throw child;
  3844. }
  3845. });
  3846. return undefined;
  3847. }
  3848. catch (err) {
  3849. return err;
  3850. }
  3851. }
  3852. function replaceVjsonById(vjson, itemVjson, itemId) {
  3853. if (!itemVjson || (!itemVjson.id && !itemId)) {
  3854. msgError('无法定位组件!');
  3855. debugger;
  3856. return;
  3857. }
  3858. var id = itemId || itemVjson.id;
  3859. deepTravVJson(vjson, function (obj) {
  3860. if (obj.id == id) {
  3861. _$2.assign(obj, itemVjson, { id: id });
  3862. }
  3863. });
  3864. }
  3865. function deepTravDeleteVjson(obj, targetId) {
  3866. var isDelete = false;
  3867. _$2.forOwn(obj, function (value, key) {
  3868. if (isDelete) {
  3869. return;
  3870. }
  3871. if (typeof value !== 'object') {
  3872. return;
  3873. }
  3874. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3875. if (key !== 'items') {
  3876. return;
  3877. }
  3878. }
  3879. else {
  3880. // 模型、数据、数据源不扫描
  3881. if (key === 'data' ||
  3882. key === 'dataSource' ||
  3883. key === 'suggest' ||
  3884. key === 'options' ||
  3885. key === 'config' ||
  3886. key === 'columns' ||
  3887. key === 'viewModel' ||
  3888. key === 'store') {
  3889. return;
  3890. }
  3891. }
  3892. //事件不扫描
  3893. if (key === 'on' && _$2.isObject(value)) {
  3894. return;
  3895. }
  3896. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3897. return;
  3898. }
  3899. if (value.id === targetId) {
  3900. isDelete = true;
  3901. /** 如果是数组的元素*/
  3902. if (_$2.isArray(obj)) {
  3903. obj.splice(key, 1);
  3904. }
  3905. else {
  3906. delete obj[key];
  3907. }
  3908. return;
  3909. }
  3910. isDelete = deepTravDeleteVjson(value, targetId);
  3911. });
  3912. return isDelete;
  3913. }
  3914. /**
  3915. * 根据id删除Vjson 会删除因删除元素造成的空对象
  3916. * @param obj 原始 vjson 视图
  3917. * @param targetId 子元素的id
  3918. */
  3919. function deletVjsonById(vjson, targetId) {
  3920. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  3921. // if (_.isArray(obj)) {
  3922. // if (obj.length <= 0) {
  3923. // let T: any = {
  3924. // view: "template",
  3925. // template: "拖动任何组件到此处",
  3926. // role: "placeholder",
  3927. // id: webix.uid()
  3928. // }
  3929. // obj.push(T);
  3930. // }
  3931. // }
  3932. return isDeleted;
  3933. }
  3934. function removeDesignProp(vjson) {
  3935. deepTravVJson(vjson, function (obj) {
  3936. if (obj.hasOwnProperty('id')) {
  3937. delete obj.id;
  3938. }
  3939. if (obj.hasOwnProperty("designMode")) {
  3940. delete obj.designMode;
  3941. }
  3942. });
  3943. if (vjson.hasOwnProperty("cls")) {
  3944. delete vjson.cls;
  3945. }
  3946. if (vjson.hasOwnProperty("viewModel")) {
  3947. delete vjson.viewModel;
  3948. }
  3949. if (vjson.hasOwnProperty("store")) {
  3950. delete vjson.store;
  3951. }
  3952. }
  3953. function getLayoutOutline(vjson) {
  3954. deepTravVJson(vjson, function (obj) {
  3955. if (!Array.isArray(obj)) {
  3956. _$2.forOwn(obj, function (value, key) {
  3957. if (key === 'id' || key === 'region' || key === 'layoutName'
  3958. || key === 'text' || key === 'fieldLabel' || key === 'title'
  3959. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  3960. if (key === 'region'
  3961. || (key === 'xtype' && !_$2.has(obj, 'region'))
  3962. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  3963. if (!_$2.has(obj, 'layoutName')) {
  3964. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  3965. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  3966. // console.log(obj.layoutName, obj.layoutNameDesc)
  3967. }
  3968. }
  3969. }
  3970. else {
  3971. if (key === 'items') {
  3972. obj.children = obj[key];
  3973. }
  3974. if (key === 'tbar') {
  3975. var t = obj[key];
  3976. t.layoutName = key;
  3977. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3978. // console.log(t.layoutName, t.layoutNameDesc)
  3979. if (_$2.has(obj, "items")) {
  3980. obj.items.splice(0, 0, t);
  3981. }
  3982. else if (_$2.has(obj, "children")) {
  3983. obj.children.splice(0, 0, t);
  3984. }
  3985. else {
  3986. obj.children = [t];
  3987. }
  3988. }
  3989. if (key === 'fbar') {
  3990. var t = obj[key];
  3991. t.layoutName = key;
  3992. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3993. // console.log(t.layoutName, t.layoutNameDesc)
  3994. if (_$2.has(obj, "items")) {
  3995. obj.items.push(t);
  3996. }
  3997. else if (_$2.has(obj, "children")) {
  3998. obj.children.push(t);
  3999. }
  4000. else {
  4001. obj.children = [t];
  4002. }
  4003. }
  4004. delete obj[key];
  4005. }
  4006. });
  4007. if (!obj.hasOwnProperty("children")) {
  4008. obj.leaf = true;
  4009. }
  4010. if (!obj.hasOwnProperty("expanded")) {
  4011. obj.expanded = true;
  4012. }
  4013. }
  4014. });
  4015. return vjson;
  4016. }
  4017. var checkFlags = {};
  4018. // ------------------------------------------------------------------------------------------ impls
  4019. function jsViewToVJson(modulePage, jsView) {
  4020. if (!jsView)
  4021. return {};
  4022. jsView = jsView.replace(/^\s*export\s+default/, "");
  4023. jsView = _$2.trim(jsView) || "{}";
  4024. try {
  4025. var json = dist.parse(jsView);
  4026. return modulePage.addViewId(json);
  4027. }
  4028. catch (e) {
  4029. //@ts-ignore
  4030. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  4031. }
  4032. }
  4033. function stringToJsonObj(jsonStr) {
  4034. if (!jsonStr)
  4035. return {};
  4036. try {
  4037. return dist.parse(jsonStr);
  4038. }
  4039. catch (e) {
  4040. return {};
  4041. }
  4042. }
  4043. /**
  4044. * 获取view.js 文件 string
  4045. */
  4046. function vjsonTojsView(vjson) {
  4047. var reVjson = _$2.cloneDeep(vjson);
  4048. removeDesignProp(reVjson);
  4049. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  4050. }
  4051. var ModuleStore = /** @class */ (function (_super) {
  4052. __extends(ModuleStore, _super);
  4053. function ModuleStore() {
  4054. var _this = _super.call(this) || this;
  4055. _this.store = {};
  4056. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  4057. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  4058. _this.addModule(id, module, modulePage);
  4059. });
  4060. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  4061. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  4062. _this.onMainTabChange(moduleId, oldModuleId, from);
  4063. });
  4064. return _this;
  4065. }
  4066. ModuleStore.prototype.getCacheKey = function (param) {
  4067. return "filetree_data.json";
  4068. };
  4069. ModuleStore.prototype.invokeApi = function (param) {
  4070. return moduleTree();
  4071. };
  4072. ModuleStore.prototype.reloadModule = function (id) {
  4073. var moduleObject = this.store[id];
  4074. if (!moduleObject)
  4075. return;
  4076. var module = moduleObject.module;
  4077. getModuleFileContent(module).then(function (_a) {
  4078. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  4079. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  4080. moduleObject.lastModifyTime = lastModifyTime;
  4081. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  4082. // 触发事件 ModuleItemChange
  4083. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  4084. moduleObject.moduleEventBus.publish(EventType.SetVjson, {
  4085. vjson: moduleObject.moduleObj.vjson,
  4086. from: "reloadModule"
  4087. });
  4088. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  4089. });
  4090. };
  4091. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  4092. var _this = this;
  4093. window['mainWindow'].setLoading(true);
  4094. getModuleFileContent(module)
  4095. .then(function (_a) {
  4096. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  4097. var moduleObject = {
  4098. id: id, module: module,
  4099. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  4100. lastModifyTime: lastModifyTime,
  4101. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  4102. modulePage: modulePage,
  4103. moduleEventBus: modulePage.moduleEventBus
  4104. };
  4105. _this.store[id] = moduleObject;
  4106. // 触发事件 ModuleItemChange
  4107. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  4108. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  4109. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  4110. })
  4111. .finally(function () {
  4112. window['mainWindow'].setLoading(false);
  4113. });
  4114. };
  4115. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  4116. if (this.store[moduleId]) {
  4117. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  4118. }
  4119. };
  4120. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  4121. var moduleObject = this.store[id];
  4122. moduleObject.fileContent.jsController = codeValue;
  4123. };
  4124. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  4125. var moduleObject = this.store[id];
  4126. moduleObject.fileContent.jsView = codeValue;
  4127. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  4128. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, {
  4129. vjson: moduleObject.moduleObj.vjson,
  4130. from: from
  4131. });
  4132. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  4133. };
  4134. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  4135. var moduleObject = this.store[id];
  4136. moduleObject.fileContent.jsModel = codeValue;
  4137. };
  4138. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  4139. var moduleObject = this.store[id];
  4140. moduleObject.fileContent.groovy = codeValue;
  4141. };
  4142. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  4143. var moduleObject = this.store[id];
  4144. moduleObject.fileContent.mybatis = codeValue;
  4145. };
  4146. ModuleStore.prototype.getModuleObject = function (id) {
  4147. return this.store[id];
  4148. };
  4149. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  4150. if (checkFlags[moduleId] === 1) {
  4151. // @ts-ignore
  4152. system.msg("正在检测文件是否有外部修改,请稍后操作");
  4153. }
  4154. eventBus.publish(EventType.StopCheckModule, {});
  4155. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  4156. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  4157. saveFile(fileFullPath, fileContent).then(function (res) {
  4158. if (res.data && res.data.lastModified) {
  4159. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  4160. }
  4161. }).finally(function () {
  4162. eventBus.publish(EventType.RunCheckModule, {});
  4163. });
  4164. };
  4165. ModuleStore.prototype.check = function (moduleId) {
  4166. {
  4167. return;
  4168. }
  4169. };
  4170. return ModuleStore;
  4171. }(CacheStore));
  4172. // ------------------------------------------------------------------------------------------ use
  4173. var moduleStore = new ModuleStore();
  4174. /**
  4175. * 调用方法
  4176. */
  4177. function invokeMethod(fn, sender, args) {
  4178. if (typeof fn === 'function') {
  4179. fn.apply.apply(fn, __spread([sender], args));
  4180. }
  4181. }
  4182. /**
  4183. * 判断事件是否为有效的输入字符
  4184. * @param e
  4185. */
  4186. function isChartEvent(e) {
  4187. if (e.key === 'Shift' ||
  4188. e.key === 'Control' ||
  4189. e.key === 'Alt' ||
  4190. e.key === 'Escape' ||
  4191. e.key === 'ArrowRight' ||
  4192. e.key === 'Tab' ||
  4193. e.key === 'ArrowLeft') {
  4194. return false;
  4195. }
  4196. if (e.keyCode >= 48 && e.keyCode <= 57) {
  4197. // 0-9
  4198. return true;
  4199. }
  4200. if (e.keyCode >= 65 && e.keyCode <= 90) {
  4201. // a-z
  4202. return true;
  4203. }
  4204. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  4205. // 小键盘 0-9
  4206. return true;
  4207. }
  4208. return false;
  4209. }
  4210. if (!window["time_offset"]) {
  4211. window["time_offset"] = 0;
  4212. }
  4213. function syncDate(date) {
  4214. if (date && date.setTime && date.getTime) {
  4215. date.setTime(date.getTime() + window["time_offset"]);
  4216. }
  4217. return date;
  4218. }
  4219. function isDesignMode(control, config) {
  4220. var _a, _b;
  4221. if (window["IS_DESIGN_MODE"]) {
  4222. return true;
  4223. }
  4224. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  4225. return true;
  4226. }
  4227. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  4228. return true;
  4229. }
  4230. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  4231. return true;
  4232. }
  4233. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  4234. return true;
  4235. }
  4236. return false;
  4237. }
  4238. function toString(value) {
  4239. if (typeof value === 'undefined' || value === null) {
  4240. return "";
  4241. }
  4242. if (typeof value === 'number' && isNaN(value)) {
  4243. return "";
  4244. }
  4245. if (value == 'N/A') {
  4246. return "";
  4247. }
  4248. return ("" + value);
  4249. }
  4250. function isEmpty(value) {
  4251. if (typeof value === 'undefined' || value === null) {
  4252. return true;
  4253. }
  4254. if (typeof value === 'number' && isNaN(value)) {
  4255. return true;
  4256. }
  4257. if (value == 'N/A') {
  4258. return true;
  4259. }
  4260. return ("" + value).trim().length <= 0;
  4261. }
  4262. function createUUID() {
  4263. //@ts-ignore
  4264. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  4265. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  4266. });
  4267. }
  4268. function getRegList() {
  4269. var regList = _$2.get(window, 'yvanLib.regList');
  4270. if (!regList) {
  4271. regList = [];
  4272. _$2.set(window, 'yvanLib.regList', regList);
  4273. }
  4274. return regList;
  4275. }
  4276. function getRegParamList(methodName) {
  4277. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  4278. if (!regParamList) {
  4279. regParamList = {};
  4280. _$2.set(window, 'yvanLib.regParamList', regParamList);
  4281. }
  4282. if (!_$2.has(regParamList, methodName)) {
  4283. regParamList[methodName] = [];
  4284. }
  4285. return regParamList[methodName];
  4286. }
  4287. /**
  4288. * 模拟点击按钮
  4289. */
  4290. function raiseClick(buttonHandle) {
  4291. if (!buttonHandle) {
  4292. return false;
  4293. }
  4294. if (buttonHandle.disabled) {
  4295. // 按钮是禁止状态
  4296. return false;
  4297. }
  4298. if (buttonHandle.hidden) {
  4299. // 按钮是隐藏状态
  4300. return false;
  4301. }
  4302. // 按钮点击
  4303. buttonHandle.click();
  4304. return true;
  4305. }
  4306. /**
  4307. * 标注系统全局函数的参数
  4308. * @param title 函数名称
  4309. * @param type 函数类型
  4310. * @param allowEmpty 可否为空
  4311. */
  4312. function LibParam(title, type, allowEmpty) {
  4313. if (allowEmpty === void 0) { allowEmpty = false; }
  4314. return function (target, methodName, paramsIndex) {
  4315. var systemFnArgs = getRegParamList(methodName);
  4316. systemFnArgs[paramsIndex] = {
  4317. type: type,
  4318. title: title,
  4319. name: methodName,
  4320. allowEmpty: allowEmpty,
  4321. };
  4322. };
  4323. }
  4324. /**
  4325. * 标注函数变成"系统全局函数"
  4326. */
  4327. function Lib(registe) {
  4328. return function (target, propertyKey, descriptor) {
  4329. var libList = getRegList();
  4330. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  4331. if (registe.type === 'system') {
  4332. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  4333. }
  4334. else if (registe.type === 'format') {
  4335. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  4336. }
  4337. return target;
  4338. };
  4339. }
  4340. /**
  4341. * 解析事件
  4342. * 'scope.私有方法名'
  4343. * 'system.系统函数名'
  4344. * 'format.格式化名'
  4345. */
  4346. function lookupFn(scope, event, errorWho) {
  4347. if (isDesignMode(scope, undefined)) {
  4348. return Ext.emptyFn;
  4349. }
  4350. if (!_$2.startsWith(event, 'scope.') &&
  4351. !_$2.startsWith(event, 'system.') &&
  4352. !_$2.startsWith(event, 'format.')) {
  4353. console.error('无法识别的事件响应类型', event);
  4354. throw new TypeError('无法识别的事件响应类型');
  4355. }
  4356. // 为 eval 准备环境
  4357. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  4358. var data = scope.viewModel.data;
  4359. var keys = [];
  4360. var values = [];
  4361. _$2.forOwn(data, function (value, key) {
  4362. var idxKey = key.indexOf('//');
  4363. if (idxKey >= 0) {
  4364. keys.push(key.substr(0, idxKey));
  4365. }
  4366. else {
  4367. keys.push(key);
  4368. }
  4369. values.push(value);
  4370. });
  4371. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  4372. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  4373. if (typeof funcResult !== 'function') {
  4374. console.error('无法识别的事件响应类型', event, func, errorWho);
  4375. throw new TypeError('无法识别的事件响应类型');
  4376. }
  4377. return funcResult;
  4378. }
  4379. /**
  4380. * 从 ext.element 获取 scope 对象
  4381. */
  4382. function lookupScope(extHandle) {
  4383. if (!extHandle) {
  4384. // @ts-ignore
  4385. return;
  4386. }
  4387. if (extHandle.isScope) {
  4388. return extHandle;
  4389. }
  4390. if (extHandle.column) {
  4391. // 列上的组件
  4392. return extHandle.column.lookupReferenceHolder().yvanScope;
  4393. }
  4394. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  4395. if (typeof extHandle.lookupViewModel === 'function') {
  4396. var vm = extHandle.lookupViewModel();
  4397. return vm.yvanScope;
  4398. }
  4399. return;
  4400. }
  4401. /**
  4402. * 全局 ajax 方法
  4403. */
  4404. var ajax = {};
  4405. /**
  4406. * 计算拼音的函数
  4407. */
  4408. var pinyinFunc = function (str) { return (str); };
  4409. exports.scopeOnLoad = null;
  4410. exports.apiConvert = undefined;
  4411. var baseConfigProcessList = [];
  4412. /**
  4413. * 在基类添加 Config 的处理方法
  4414. */
  4415. function baseConfigProcess(option) {
  4416. return function (target, propertyKey) {
  4417. baseConfigProcessList.push(target[propertyKey]);
  4418. };
  4419. }
  4420. // let designMode: boolean = false
  4421. //
  4422. // export function isDesignMode(): boolean {
  4423. // return designMode
  4424. // }
  4425. //
  4426. // export function setDesignMode(v: boolean) {
  4427. // designMode = v
  4428. // }
  4429. /**
  4430. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  4431. */
  4432. function serverInvokeUrlTransform(url, option) {
  4433. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  4434. }
  4435. /**
  4436. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  4437. */
  4438. function sqlUrlTransform(url) {
  4439. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  4440. }
  4441. /**
  4442. * YvanUI 全局扩展配置
  4443. */
  4444. function extend(option) {
  4445. if (option.ajax) {
  4446. ajax.func = option.ajax;
  4447. }
  4448. if (option.serverInvokeUrlTransform) {
  4449. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  4450. }
  4451. if (option.sqlUrlTransform) {
  4452. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  4453. }
  4454. if (option.pinyinFunction) {
  4455. pinyinFunc = option.pinyinFunction;
  4456. }
  4457. if (option.scopeOnLoad) {
  4458. exports.scopeOnLoad = option.scopeOnLoad;
  4459. }
  4460. if (option.scopeOnCreate) {
  4461. exports.scopeOnCreate = option.scopeOnCreate;
  4462. }
  4463. if (option.apiConvert) {
  4464. exports.apiConvert = option.apiConvert;
  4465. }
  4466. // if (typeof option.designMode !== 'undefined') {
  4467. // setDesignMode(option.designMode)
  4468. // }
  4469. }
  4470. function getApiConvert() {
  4471. return exports.apiConvert;
  4472. }
  4473. function getScopeOnCreate() {
  4474. return exports.scopeOnCreate;
  4475. }
  4476. function getPinyin(v) {
  4477. return pinyinFunc(v);
  4478. }
  4479. /**
  4480. * 适用于 Select / Tree 等,作筛选的通用方法.
  4481. * 1.首字母模糊匹配(不区分大小写)
  4482. * 2.标识的模糊匹配(不区分大小写)
  4483. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  4484. */
  4485. function keywordFilter(keyword, label, value) {
  4486. if (!keyword) {
  4487. return true;
  4488. }
  4489. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  4490. // const labelPy = _.toLower(getPinyin(label))
  4491. //@ts-ignore
  4492. var labelPy = _$2.toLower(getFirstPinyin2(label));
  4493. value = _$2.toLower(_$2.trim(value));
  4494. var found = 0;
  4495. _$2.some(ws, function (word) {
  4496. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  4497. found++;
  4498. return;
  4499. }
  4500. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  4501. found++;
  4502. return;
  4503. }
  4504. });
  4505. return found >= ws.length;
  4506. }
  4507. var Scope = /** @class */ (function () {
  4508. function Scope(args) {
  4509. /**
  4510. * 业务模块的唯一编号
  4511. */
  4512. this.id = _$2.uniqueId('scope_');
  4513. this.IS_DESIGN_MODE = false;
  4514. /**
  4515. * onload 运行完成之后才会设置本标记为 true
  4516. */
  4517. this.isLoadFinish = false;
  4518. this._isLoading = false;
  4519. var model = args.model, vjson = args.vjson, i18n = args.i18n;
  4520. this.model = model;
  4521. if (typeof vjson.layout === 'undefined') {
  4522. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  4523. var ret = buildPlus({ model: model, vjson: vjson });
  4524. model = ret.model;
  4525. vjson = ret.vjson;
  4526. }
  4527. this.originalVjson = _$2.cloneDeep(vjson);
  4528. this.vjson = this.originalVjson; // this.buildVjson()
  4529. var WMSTranslate = window["WMSTranslate"];
  4530. if (WMSTranslate) {
  4531. var i18nPath_1 = this.constructor.name;
  4532. if (i18n) {
  4533. WMSTranslate[i18nPath_1] = i18n;
  4534. }
  4535. this.vjson.i18nPath = i18nPath_1;
  4536. deepTravVJson(this.vjson, function (obj) {
  4537. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
  4538. return;
  4539. }
  4540. obj.i18nPath = i18nPath_1;
  4541. });
  4542. }
  4543. var extScope = getScopeOnCreate();
  4544. if (typeof extScope === 'function') {
  4545. extScope({ vjson: vjson, model: model }, this);
  4546. }
  4547. }
  4548. Scope.prototype._addWatch = function (tplExpress, fn) {
  4549. if (!this._watchList) {
  4550. this._watchList = [];
  4551. }
  4552. this._watchList.push({ watch: tplExpress, fn: fn });
  4553. };
  4554. Scope.prototype._applyWatchList = function () {
  4555. var _this = this;
  4556. _$2.forEach(this._watchList, function (item) {
  4557. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  4558. });
  4559. };
  4560. Object.defineProperty(Scope.prototype, "isScope", {
  4561. get: function () {
  4562. return true;
  4563. },
  4564. enumerable: true,
  4565. configurable: true
  4566. });
  4567. /**
  4568. * 产生一个当前模块有效的唯一id
  4569. * @param key 唯一编号
  4570. */
  4571. Scope.prototype.uid = function (key) {
  4572. return this.id + key;
  4573. };
  4574. /**
  4575. * 对话框"保存"成功.
  4576. * 关闭对话框,并响应 success 方法
  4577. * @param data 要傳回的數據(可以為空)
  4578. */
  4579. Scope.prototype.dialogSuccess = function (data) {
  4580. this._handle.fireEvent('success', this, data);
  4581. var sender = this._handle.config.animateTarget;
  4582. var scope = lookupScope(sender);
  4583. if (typeof this['success'] === 'function') {
  4584. this['success'].call(scope, sender, data);
  4585. }
  4586. this.close();
  4587. };
  4588. /**
  4589. * 设置等待状态
  4590. * @param value
  4591. * @param msg
  4592. */
  4593. Scope.prototype.setLoading = function (value) {
  4594. var _a;
  4595. var scope = this;
  4596. this._isLoading = value;
  4597. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  4598. };
  4599. Scope.prototype.getLoading = function () {
  4600. return this._isLoading;
  4601. };
  4602. /**
  4603. * 以对话框模式打开当前模块
  4604. * @param sender 发送者(按钮或Scope对象)
  4605. * @param vjsonOption 界面覆盖选项(可以为空)
  4606. * @param dataOption 数据覆盖选项(可以为空)
  4607. */
  4608. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  4609. var _a;
  4610. var that = this;
  4611. var vmodel = _$2.defaultsDeep({
  4612. //
  4613. }, dataOption, that.model);
  4614. this.viewModel = new Ext.app.ViewModel(vmodel);
  4615. this.viewModel.yvanScope = this;
  4616. this._applyWatchList();
  4617. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4618. var config = _$2.defaultsDeep({
  4619. animateTarget: sender,
  4620. viewModel: this.viewModel,
  4621. yvanScope: this,
  4622. referenceHolder: true,
  4623. }, vjsonOption, that.vjson, windows);
  4624. if (config.height === 'unset') {
  4625. delete config.height;
  4626. }
  4627. if (config.width === 'unset') {
  4628. delete config.width;
  4629. }
  4630. // const holder = sender?.lookupReferenceHolder()
  4631. // delete config.constrain
  4632. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  4633. if (topScope) {
  4634. config.constrain = true;
  4635. this.topScope = topScope;
  4636. }
  4637. var win = new Ext.Window(config);
  4638. // if (holder) {
  4639. // holder.add(win)
  4640. // }
  4641. if (topScope) {
  4642. topScope._handle.add(win);
  4643. }
  4644. win.addListener('beforerender', function (sender) {
  4645. // 记录句柄
  4646. if (sender && !that._handle) {
  4647. that._handle = sender;
  4648. }
  4649. });
  4650. win.addListener('afterrender', function (sender) {
  4651. // 调用onLoad回调
  4652. try {
  4653. that._onLoad();
  4654. }
  4655. catch (e) {
  4656. console.error('errorAt onLoad', e);
  4657. }
  4658. window['cw'] = that;
  4659. });
  4660. win.addListener('destroy', this._destroy.bind(this));
  4661. win.show();
  4662. };
  4663. /**
  4664. * 以标签模式打开当前模块
  4665. * @param vjsonOption 界面覆盖选项(可以为空)
  4666. * @param dataOption 数据覆盖选项(可以为空)
  4667. */
  4668. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  4669. var _this = this;
  4670. var that = this;
  4671. this._vjsonOption = vjsonOption;
  4672. this._dataOption = dataOption;
  4673. var vmodel = _$2.defaultsDeep({
  4674. data: {}
  4675. }, dataOption, that.model);
  4676. this.viewModel = new Ext.app.ViewModel(vmodel);
  4677. this.viewModel.yvanScope = this;
  4678. this._applyWatchList();
  4679. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4680. // 根级不能设置id
  4681. delete that.vjson.id;
  4682. var config = _$2.defaultsDeep({
  4683. viewModel: this.viewModel,
  4684. yvanScope: this,
  4685. referenceHolder: true,
  4686. }, vjsonOption, that.vjson);
  4687. var tt = Ext.getCmp('TT');
  4688. var handle = tt.addScope(this, config, function (handle) {
  4689. handle.addListener('added', function (sender) {
  4690. // 记录句柄
  4691. if (sender && !that._handle) {
  4692. that._handle = sender;
  4693. }
  4694. });
  4695. handle.addListener('afterrender', function (sender) {
  4696. // 调用onLoad回调
  4697. try {
  4698. that._onLoad();
  4699. }
  4700. catch (e) {
  4701. console.error('errorAt onLoad', e);
  4702. }
  4703. });
  4704. handle.addListener('destroy', _this._destroy.bind(_this));
  4705. });
  4706. return handle;
  4707. };
  4708. /**
  4709. * 直接渲染到元素
  4710. * @param element 渲染目标
  4711. * @param vjsonOption 界面覆盖选项(可以为空)
  4712. * @param dataOption 数据覆盖选项(可以为空)
  4713. */
  4714. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  4715. var that = this;
  4716. this._vjsonOption = vjsonOption;
  4717. this._dataOption = dataOption;
  4718. var vmodel = _$2.defaultsDeep({
  4719. data: {}
  4720. }, that.model, dataOption);
  4721. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  4722. this.viewModel = new Ext.app.ViewModel(vmodel);
  4723. this.viewModel.yvanScope = this;
  4724. this._applyWatchList();
  4725. var config = _$2.defaultsDeep({
  4726. viewModel: this.viewModel,
  4727. yvanScope: this,
  4728. referenceHolder: true,
  4729. renderTo: element,
  4730. listeners: {
  4731. afterrender: function (sender) {
  4732. var _a;
  4733. // 记录句柄
  4734. if (sender && !that._handle) {
  4735. that._handle = sender;
  4736. }
  4737. // 调用onLoad回调
  4738. that._onLoad();
  4739. // 如果vjson中配置了 afterrender ,需要恢复状态
  4740. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  4741. },
  4742. },
  4743. }, vjsonOption, that.vjson);
  4744. new Ext.container.Viewport(config);
  4745. };
  4746. Scope.prototype.showDesigner = function (designer, option) {
  4747. var that = this;
  4748. var vmodel = _$2.defaultsDeep({
  4749. data: {
  4750. IS_DESIGN_MODE: true,
  4751. }
  4752. }, that.model);
  4753. this.IS_DESIGN_MODE = true;
  4754. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  4755. this.viewModel = new Ext.app.ViewModel(vmodel);
  4756. this.viewModel.yvanScope = this;
  4757. this._applyWatchList();
  4758. var config = _$2.defaultsDeep({
  4759. viewModel: this.viewModel,
  4760. yvanScope: this,
  4761. referenceHolder: true,
  4762. listeners: {
  4763. afterrender: function (sender) {
  4764. var _a;
  4765. // 记录句柄
  4766. if (sender && !that._handle) {
  4767. that._handle = sender;
  4768. }
  4769. // 调用onLoad回调
  4770. that._onLoad();
  4771. // 如果vjson中配置了 afterrender ,需要恢复状态
  4772. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  4773. },
  4774. },
  4775. }, that.vjson);
  4776. designer.removeAll(true);
  4777. designer.add(config);
  4778. };
  4779. /**
  4780. * 关闭对话框(或标签页)
  4781. */
  4782. Scope.prototype.close = function () {
  4783. this._handle.close();
  4784. };
  4785. Object.defineProperty(Scope.prototype, "data", {
  4786. /**
  4787. * 获取 viewModel 里包含的数据(只读)
  4788. */
  4789. get: function () {
  4790. return this.viewModel.getData();
  4791. },
  4792. enumerable: true,
  4793. configurable: true
  4794. });
  4795. /**
  4796. * 设置 viewModel 中的数据
  4797. * 可以是 key, value 模式
  4798. * 也可以是 {key:value} 模式
  4799. */
  4800. Scope.prototype.set = function (path, value) {
  4801. return this.viewModel.set(path, value);
  4802. };
  4803. /**
  4804. * 寻找模块内所有的 xtype 对应的对象
  4805. * @param xtypeKey
  4806. */
  4807. Scope.prototype.down = function (xtypeKey) {
  4808. return this._handle.down(xtypeKey);
  4809. };
  4810. Object.defineProperty(Scope.prototype, "refs", {
  4811. /**
  4812. * 获取所有设置过 Reference 名称的组件
  4813. */
  4814. get: function () {
  4815. var _a, _b;
  4816. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  4817. },
  4818. enumerable: true,
  4819. configurable: true
  4820. });
  4821. Scope.prototype._destroy = function () {
  4822. var that = this;
  4823. that.onDestroy();
  4824. delete that._watchList;
  4825. delete that._handle;
  4826. this.isLoadFinish = false;
  4827. };
  4828. /**
  4829. * 私有渲染完成后的回调
  4830. */
  4831. Scope.prototype._onLoad = function () {
  4832. var _this = this;
  4833. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  4834. exports.scopeOnLoad(this);
  4835. }
  4836. this.onLoad();
  4837. _$2.defer(function () {
  4838. _this.isLoadFinish = true;
  4839. });
  4840. };
  4841. /**
  4842. * 默认 渲染完成之后调用的函数
  4843. */
  4844. Scope.prototype.onLoad = function () {
  4845. };
  4846. /**
  4847. * 组件卸载之后的回调
  4848. */
  4849. Scope.prototype.onDestroy = function () {
  4850. };
  4851. return Scope;
  4852. }());
  4853. /**
  4854. * 观察装饰器,viewModel 属性更改时触发成员方法
  4855. * @param tplExpress tpl表达式,例如 "{form.f1}"
  4856. */
  4857. function watch(tplExpress, deep) {
  4858. if (deep === void 0) { deep = false; }
  4859. return function (target, propertyKey, pd) {
  4860. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  4861. return target[propertyKey];
  4862. };
  4863. }
  4864. // 获取vjson的hash值
  4865. function getVjsonHash(str) {
  4866. var hash = 3465217896, i, ch;
  4867. for (i = str.length - 1; i >= 0; i--) {
  4868. ch = str.charCodeAt(i);
  4869. hash ^= ((hash << 5) + ch + (hash >> 2));
  4870. }
  4871. return (hash & 0x7FFFFFFF) + "";
  4872. }
  4873. function buildPlus(_a) {
  4874. var model = _a.model, vjson = _a.vjson;
  4875. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  4876. {
  4877. layout: 'border',
  4878. // tbar: vjson.action,
  4879. items: vjson.items,
  4880. },
  4881. ] });
  4882. if (_$2.isArray(vjson.action)) {
  4883. vjsonNew.items[0].tbar = vjson.action;
  4884. }
  4885. return { model: model, vjson: vjsonNew };
  4886. }
  4887. var model = {
  4888. data: {
  4889. form: {
  4890. resource_parent: '',
  4891. resource_name: '',
  4892. resource_icon: '',
  4893. scope_url: '',
  4894. scope_params: '',
  4895. resource_order: '',
  4896. permission_code: '',
  4897. },
  4898. }
  4899. };
  4900. var vjson = {
  4901. title: '注册模块',
  4902. layout: 'fit',
  4903. width: "40%",
  4904. height: "50%",
  4905. fbar: {
  4906. xtype: 'toolbar',
  4907. items: [
  4908. {
  4909. xtype: "button",
  4910. text: "确定",
  4911. iconCls: 'x-fa fa-check',
  4912. listeners: {
  4913. click: 'scope.saveNode',
  4914. }
  4915. },
  4916. {
  4917. xtype: "button",
  4918. text: "关闭",
  4919. iconCls: 'x-fa fa-times',
  4920. listeners: {
  4921. click: 'system.closeMe()',
  4922. }
  4923. },
  4924. ]
  4925. },
  4926. items: [
  4927. {
  4928. layout: 'border',
  4929. items: [
  4930. {
  4931. region: 'west',
  4932. layout: 'fit',
  4933. xtype: 'tabpanel',
  4934. reference: 'tabs',
  4935. width: "50%",
  4936. split: true,
  4937. listeners: {
  4938. tabchange: 'scope.tabchange',
  4939. },
  4940. items: [
  4941. {
  4942. region: 'center',
  4943. layout: 'fit',
  4944. title: 'PC菜单',
  4945. key: "1",
  4946. items: [
  4947. {
  4948. xtype: 'treepanel',
  4949. layout: 'fit',
  4950. region: 'west',
  4951. rootVisible: false,
  4952. useArrows: true,
  4953. reference: 'tree1',
  4954. listeners: {
  4955. itemclick: "scope.tree1NodeClick",
  4956. }
  4957. },
  4958. ]
  4959. },
  4960. {
  4961. region: 'center',
  4962. layout: 'fit',
  4963. title: 'PDA菜单',
  4964. key: "2",
  4965. items: [
  4966. {
  4967. xtype: 'treepanel',
  4968. layout: 'fit',
  4969. region: 'west',
  4970. reference: 'tree2',
  4971. rootVisible: false,
  4972. useArrows: true,
  4973. listeners: {
  4974. itemclick: "scope.tree1NodeClick",
  4975. }
  4976. },
  4977. ]
  4978. },
  4979. ]
  4980. },
  4981. {
  4982. region: 'center',
  4983. xtype: 'form',
  4984. margin: '0 0 0 0',
  4985. split: true,
  4986. width: '50%',
  4987. items: [
  4988. {
  4989. xtype: 'cols',
  4990. items: [
  4991. {
  4992. xtype: 'textfield',
  4993. fieldLabel: '上级资源ID',
  4994. bind: {
  4995. readOnly: true,
  4996. disabled: true,
  4997. value: '{form.resource_parent}'
  4998. },
  4999. },
  5000. ],
  5001. },
  5002. {
  5003. xtype: 'cols',
  5004. items: [
  5005. {
  5006. xtype: 'textfield',
  5007. fieldLabel: '资源名称',
  5008. bind: {
  5009. value: '{form.resource_name}'
  5010. },
  5011. allowBlank: false,
  5012. },
  5013. ],
  5014. },
  5015. {
  5016. xtype: 'cols',
  5017. items: [
  5018. {
  5019. xtype: 'numberfield',
  5020. fieldLabel: '资源排序',
  5021. bind: {
  5022. value: '{form.resource_order}'
  5023. },
  5024. allowBlank: false,
  5025. },
  5026. ],
  5027. },
  5028. {
  5029. xtype: 'cols',
  5030. items: [
  5031. {
  5032. xtype: 'textfield',
  5033. fieldLabel: '功能URL',
  5034. bind: {
  5035. disabled: true,
  5036. value: '{form.scope_url}'
  5037. },
  5038. },
  5039. ]
  5040. },
  5041. {
  5042. xtype: 'cols',
  5043. items: [
  5044. {
  5045. xtype: 'textfield',
  5046. fieldLabel: '权限编码',
  5047. bind: {
  5048. value: '{form.permission_code}'
  5049. }
  5050. },
  5051. ],
  5052. },
  5053. {
  5054. xtype: 'cols',
  5055. items: [
  5056. {
  5057. xtype: 'textfield',
  5058. fieldLabel: '功能参数',
  5059. bind: {
  5060. value: '{form.scope_params}'
  5061. }
  5062. },
  5063. ],
  5064. },
  5065. ],
  5066. },
  5067. ],
  5068. },
  5069. ],
  5070. referenceHolder: true,
  5071. };
  5072. var RegisterModule = /** @class */ (function (_super) {
  5073. __extends(RegisterModule, _super);
  5074. function RegisterModule() {
  5075. return _super.call(this, { model: model, vjson: vjson }) || this;
  5076. }
  5077. RegisterModule.prototype.onLoad = function () {
  5078. this.reloadTree("PC");
  5079. };
  5080. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  5081. var currTabKey = b.key;
  5082. if (currTabKey === '1') {
  5083. this.viewModel.set('form', '');
  5084. this.reloadTree("PC");
  5085. }
  5086. else {
  5087. this.viewModel.set('form', '');
  5088. this.reloadTree("PDA");
  5089. }
  5090. };
  5091. RegisterModule.prototype.reloadTree = function (type) {
  5092. var _this = this;
  5093. if ("PC" === type) {
  5094. this.setLoading(true);
  5095. getMenuTree({ type: "PC" }).then(function (res) {
  5096. if (res.success) {
  5097. _this.refs.tree1.store.setRootNode({
  5098. expanded: true,
  5099. children: res.data
  5100. });
  5101. }
  5102. }).finally(function () {
  5103. _this.setLoading(false);
  5104. });
  5105. }
  5106. else {
  5107. this.setLoading(true);
  5108. getMenuTree({ type: "PDA" }).then(function (res) {
  5109. if (res.success) {
  5110. _this.refs.tree2.store.setRoot({
  5111. expanded: true,
  5112. children: res.data
  5113. });
  5114. }
  5115. }).finally(function () {
  5116. _this.setLoading(false);
  5117. });
  5118. }
  5119. };
  5120. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  5121. var id = _$2.split(node.data.id, '_')[1];
  5122. if (!id) {
  5123. return;
  5124. }
  5125. this.viewModel.set('form.resource_parent', id);
  5126. };
  5127. RegisterModule.prototype.saveNode = function () {
  5128. var _this = this;
  5129. var tabKey = this.refs.tabs.activeTab.key;
  5130. // 检验菜单数据
  5131. var param = this.viewModel.get('form');
  5132. if (!param.resource_parent) {
  5133. msg('请选择一个父节点');
  5134. return;
  5135. }
  5136. if (!param.resource_name) {
  5137. msg('资源名称不能为空');
  5138. return;
  5139. }
  5140. if (!param.scope_url) {
  5141. msg('功能URL不能为空');
  5142. return;
  5143. }
  5144. var type;
  5145. if (tabKey === '1') {
  5146. type = 'PC';
  5147. }
  5148. else {
  5149. type = 'PDA';
  5150. }
  5151. this.setLoading(true);
  5152. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  5153. if (res.success) {
  5154. msg("注册成功");
  5155. _this.close();
  5156. }
  5157. }).finally(function () {
  5158. _this.setLoading(false);
  5159. });
  5160. };
  5161. return RegisterModule;
  5162. }(Scope));
  5163. var model$1 = {
  5164. data: {
  5165. title: "模板选择",
  5166. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  5167. moduleType: 1,
  5168. // 当前模块包路径 "com/galaxis/wms/bas/area"
  5169. packagePath: "",
  5170. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  5171. fileSavePath: "",
  5172. // 模块名称 "Dict"
  5173. moduleName: "NewModule",
  5174. // 页面标题 "字典维护"
  5175. pageTitle: "新模块",
  5176. // 单表查询
  5177. singleTable: {
  5178. sql: "select * from bas_dict",
  5179. // 新增或者删除所用的表
  5180. tableName: "",
  5181. // 是否分页查询
  5182. pagination: true,
  5183. // 是否需要删除
  5184. delete: true,
  5185. // 删除条件字段
  5186. deleteWhereColumn: "",
  5187. // 删除提示语
  5188. deleteTips: "确定要删除?",
  5189. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  5190. editType: 2,
  5191. },
  5192. singleTableView: {
  5193. tableNameList: [
  5194. // { value: "aaa"},
  5195. ],
  5196. columnList: [
  5197. // { value: "aaa"},
  5198. ],
  5199. }
  5200. }
  5201. };
  5202. var vjson$1 = {
  5203. bind: {
  5204. title: '新建模块-{title}',
  5205. },
  5206. width: "55%",
  5207. height: "60%",
  5208. minWidth: 500,
  5209. minHeight: 400,
  5210. modal: true,
  5211. frame: true,
  5212. layout: 'card',
  5213. bbar: [
  5214. '->',
  5215. {
  5216. itemId: 'card-prev',
  5217. text: '&laquo; 上一步',
  5218. disabled: true,
  5219. listeners: {
  5220. click: 'scope.showPrevious',
  5221. },
  5222. },
  5223. {
  5224. itemId: 'card-next',
  5225. text: '下一步 &raquo;',
  5226. listeners: {
  5227. click: 'scope.showNext',
  5228. },
  5229. },
  5230. {
  5231. itemId: 'card-finish',
  5232. text: '立刻执行',
  5233. iconCls: 'x-fa fa-flash',
  5234. hidden: true,
  5235. listeners: {
  5236. click: 'scope.finish',
  5237. },
  5238. },
  5239. ],
  5240. items: [
  5241. {
  5242. vtitle: '模板选择',
  5243. reference: 'templateSelection',
  5244. layout: {
  5245. type: 'hbox',
  5246. pack: 'start',
  5247. align: 'stretch'
  5248. },
  5249. listeners: {
  5250. cardEnter: 'scope.templateEnter',
  5251. cardLevel: 'scope.templateLevel'
  5252. },
  5253. items: [
  5254. {
  5255. width: 150,
  5256. xtype: 'form',
  5257. border: false,
  5258. layout: {
  5259. type: 'vbox',
  5260. align: 'stretch'
  5261. },
  5262. defaults: {
  5263. border: false,
  5264. anchor: '100%',
  5265. margin: '5',
  5266. },
  5267. items: [
  5268. {
  5269. xtype: 'radiogroup',
  5270. bind: {
  5271. value: '{moduleType}'
  5272. },
  5273. layout: 'vbox',
  5274. defaults: {
  5275. border: false,
  5276. anchor: '100%',
  5277. margin: '5',
  5278. },
  5279. items: [
  5280. { boxLabel: '单表查询', inputValue: 1 },
  5281. { boxLabel: '主/明细查询', inputValue: 2 },
  5282. { boxLabel: '树/明细查询', inputValue: 3 },
  5283. { boxLabel: '卡片表单', inputValue: 4 },
  5284. { boxLabel: '主/详情查询', inputValue: 5 },
  5285. ]
  5286. },
  5287. ]
  5288. },
  5289. {
  5290. flex: 1,
  5291. region: 'center',
  5292. xtype: "panel",
  5293. border: false,
  5294. frame: true,
  5295. padding: "4px 8px",
  5296. html: "描述...",
  5297. }
  5298. ]
  5299. },
  5300. {
  5301. vtitle: '模块名称',
  5302. reference: 'moduleName',
  5303. layout: 'fit',
  5304. listeners: {
  5305. cardEnter: 'scope.moduleEnter',
  5306. cardLevel: 'scope.moduleLevel'
  5307. },
  5308. items: [
  5309. {
  5310. xtype: 'form',
  5311. border: false,
  5312. layout: {
  5313. type: 'vbox',
  5314. align: 'stretch'
  5315. },
  5316. defaults: {
  5317. border: false,
  5318. anchor: '100%',
  5319. margin: '5',
  5320. },
  5321. items: [
  5322. {
  5323. xtype: 'textfield',
  5324. fieldLabel: '包路径',
  5325. allowBlank: false,
  5326. bind: { value: '{packagePath}' },
  5327. },
  5328. {
  5329. xtype: 'textfield',
  5330. fieldLabel: '文件路径',
  5331. allowBlank: false,
  5332. bind: { value: '{fileSavePath}' },
  5333. },
  5334. {
  5335. xtype: 'textfield',
  5336. fieldLabel: '模块名',
  5337. allowBlank: false,
  5338. bind: { value: '{moduleName}' },
  5339. },
  5340. {
  5341. xtype: 'textfield',
  5342. fieldLabel: '菜单名',
  5343. allowBlank: false,
  5344. bind: { value: '{pageTitle}' },
  5345. },
  5346. ]
  5347. },
  5348. ]
  5349. },
  5350. {
  5351. vtitle: '确认结果',
  5352. reference: 'confirmResult',
  5353. layout: 'fit',
  5354. listeners: {
  5355. cardEnter: 'scope.optionEnter',
  5356. cardLevel: 'scope.optionLevel',
  5357. },
  5358. items: [
  5359. {
  5360. xtype: 'jsoneditor',
  5361. reference: 'jsoneditor'
  5362. }
  5363. ]
  5364. },
  5365. // ---------------------------------------------------------------------------------- 单表查询
  5366. {
  5367. vtitle: '查询SQL',
  5368. reference: 'singleTable_1',
  5369. layout: 'fit',
  5370. listeners: {
  5371. cardEnter: 'scope.editorEnter',
  5372. cardLevel: 'scope.editorLevel'
  5373. },
  5374. items: [
  5375. {
  5376. xtype: 'sqleditor',
  5377. }
  5378. ],
  5379. },
  5380. {
  5381. vtitle: '字段选项',
  5382. reference: 'singleTable_2',
  5383. layout: 'fit',
  5384. listeners: {
  5385. cardEnter: 'scope.columnEnter',
  5386. cardLevel: 'scope.columnLevel',
  5387. },
  5388. items: [
  5389. {
  5390. xtype: 'yvgrid',
  5391. border: false,
  5392. selModel: {
  5393. type: 'spreadsheet',
  5394. columnSelect: true,
  5395. pruneRemoved: false,
  5396. extensible: 'y'
  5397. },
  5398. plugins: {
  5399. clipboard: true,
  5400. selectionreplicator: true
  5401. },
  5402. reference: 'grid1',
  5403. idField: 'column_name',
  5404. hideFootbar: true,
  5405. tbar: {
  5406. xtype: 'toolbar',
  5407. items: [
  5408. {
  5409. xtype: 'button',
  5410. text: '添加',
  5411. iconCls: 'x-fa fa-plus-circle',
  5412. listeners: {
  5413. click: 'scope.addField'
  5414. }
  5415. },
  5416. {
  5417. xtype: 'button',
  5418. text: '删除',
  5419. iconCls: 'x-fa fa-minus-circle',
  5420. listeners: {
  5421. click: 'scope.removeField'
  5422. }
  5423. },
  5424. {
  5425. xtype: 'button',
  5426. text: '分析SQL',
  5427. iconCls: 'x-fa fa-refresh',
  5428. listeners: {
  5429. click: 'scope.parseSQL'
  5430. }
  5431. },
  5432. ]
  5433. },
  5434. columns: [
  5435. {
  5436. text: '字段名', dataIndex: 'column_name',
  5437. sortable: false,
  5438. menuDisabled: true,
  5439. width: 150,
  5440. editor: {
  5441. allowBlank: true,
  5442. selectOnFocus: false,
  5443. }
  5444. },
  5445. {
  5446. text: '字段中文', dataIndex: 'column_comment',
  5447. width: 150,
  5448. sortable: false,
  5449. menuDisabled: true,
  5450. editor: {
  5451. allowBlank: true,
  5452. selectOnFocus: false,
  5453. }
  5454. },
  5455. {
  5456. dataIndex: "column_useto",
  5457. // fix: ['system.getDict("column_useto")'],
  5458. header: "用途",
  5459. editor: {
  5460. xtype: 'combo',
  5461. allowBlank: false,
  5462. },
  5463. },
  5464. {
  5465. text: '主键', dataIndex: 'is_primary_key',
  5466. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5467. width: 48, resizable: false,
  5468. },
  5469. {
  5470. text: '必填', dataIndex: 'not_null',
  5471. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  5472. width: 48, resizable: false,
  5473. },
  5474. {
  5475. text: '长度', dataIndex: 'column_size',
  5476. sortable: false, menuDisabled: true,
  5477. xtype: 'numbercolumn', format: '0',
  5478. editor: { allowBlank: true, selectOnFocus: true }
  5479. },
  5480. {
  5481. text: '字典', dataIndex: 'column_dict',
  5482. sortable: false, menuDisabled: true,
  5483. width: 200,
  5484. editor: {
  5485. allowBlank: true,
  5486. }
  5487. },
  5488. {
  5489. text: 'UI组件', dataIndex: 'column_ui',
  5490. sortable: false, menuDisabled: true,
  5491. // fix: ['system.getDict("column_ui")'],
  5492. width: 150,
  5493. editor: {
  5494. xtype: 'combo',
  5495. allowBlank: true,
  5496. }
  5497. },
  5498. {
  5499. dataIndex: 'data_type',
  5500. hidden: true,
  5501. },
  5502. ]
  5503. }
  5504. ],
  5505. },
  5506. {
  5507. vtitle: '其他选项',
  5508. reference: 'singleTable_3',
  5509. isEnd: true,
  5510. listeners: {
  5511. cardEnter: 'scope.extendEnter',
  5512. cardLevel: 'scope.extendLevel',
  5513. },
  5514. layout: 'fit',
  5515. items: [
  5516. {
  5517. xtype: 'form',
  5518. border: false,
  5519. layout: {
  5520. type: 'vbox',
  5521. align: 'stretch'
  5522. },
  5523. defaults: {
  5524. border: false,
  5525. anchor: '100%',
  5526. margin: '5',
  5527. },
  5528. items: [
  5529. {
  5530. xtype: 'checkbox',
  5531. fieldLabel: '需要分页',
  5532. labelWidth: 100,
  5533. bind: {
  5534. value: '{singleTable.pagination}',
  5535. },
  5536. },
  5537. {
  5538. xtype: 'combobox',
  5539. fieldLabel: '操作数据库表',
  5540. labelWidth: 100,
  5541. publishes: 'singleTable.tableName',
  5542. displayField: 'value',
  5543. valueField: 'value',
  5544. bind: {
  5545. data: '{singleTableView.tableNameList}',
  5546. value: '{singleTable.tableName}',
  5547. },
  5548. },
  5549. {
  5550. xtype: 'checkboxfield',
  5551. fieldLabel: '需要删除',
  5552. labelWidth: 100,
  5553. bind: {
  5554. value: '{singleTable.delete}',
  5555. },
  5556. },
  5557. {
  5558. xtype: 'combobox',
  5559. fieldLabel: '删除条件字段',
  5560. labelWidth: 100,
  5561. publishes: 'singleTable.deleteWhereColumn',
  5562. displayField: 'value',
  5563. valueField: 'value',
  5564. bind: {
  5565. data: '{singleTableView.columnList}',
  5566. hidden: '{!singleTable.delete}',
  5567. value: '{singleTable.deleteWhereColumn}',
  5568. },
  5569. },
  5570. {
  5571. xtype: 'textfield',
  5572. fieldLabel: '删除提示语句',
  5573. labelWidth: 100,
  5574. bind: {
  5575. hidden: '{!singleTable.delete}',
  5576. value: '{singleTable.deleteTips}',
  5577. },
  5578. },
  5579. {
  5580. fieldLabel: '新增与编辑',
  5581. labelWidth: 100,
  5582. xtype: 'radiogroup',
  5583. bind: {
  5584. value: '{singleTable.editType}'
  5585. },
  5586. layout: 'vbox',
  5587. defaults: {
  5588. border: false,
  5589. anchor: '100%',
  5590. margin: '5',
  5591. },
  5592. items: [
  5593. { boxLabel: '不要新增和编辑', inputValue: 1 },
  5594. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  5595. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  5596. ]
  5597. },
  5598. ]
  5599. }
  5600. ]
  5601. },
  5602. // ---------------------------------------------------------------------------------- 主/明细查询
  5603. {
  5604. vtitle: '主表查询SQL',
  5605. reference: 'mainDetailTable_1',
  5606. layout: 'fit',
  5607. listeners: {},
  5608. items: [],
  5609. },
  5610. {
  5611. vtitle: '主表字段选项',
  5612. reference: 'mainDetailTable_2',
  5613. layout: 'fit',
  5614. listeners: {},
  5615. items: [],
  5616. },
  5617. {
  5618. vtitle: '主表其他选项',
  5619. reference: 'mainDetailTable_3',
  5620. layout: 'fit',
  5621. listeners: {},
  5622. items: [],
  5623. },
  5624. {
  5625. vtitle: '子表查询SQL',
  5626. reference: 'mainDetailTable_4',
  5627. layout: 'fit',
  5628. listeners: {},
  5629. items: [],
  5630. },
  5631. {
  5632. vtitle: '子表字段选项',
  5633. reference: 'mainDetailTable_5',
  5634. layout: 'fit',
  5635. listeners: {},
  5636. items: [],
  5637. },
  5638. {
  5639. vtitle: '子表其他选项',
  5640. reference: 'mainDetailTable_6',
  5641. isEnd: true,
  5642. layout: 'fit',
  5643. listeners: {},
  5644. items: [],
  5645. },
  5646. // ---------------------------------------------------------------------------------- 树/明细查询
  5647. // ---------------------------------------------------------------------------------- 卡片表单
  5648. {
  5649. vtitle: '表单字段',
  5650. reference: 'cardForm_1',
  5651. layout: 'fit',
  5652. listeners: {},
  5653. items: [],
  5654. },
  5655. {
  5656. vtitle: '表单初始化',
  5657. reference: 'cardForm_2',
  5658. isEnd: true,
  5659. layout: 'fit',
  5660. listeners: {},
  5661. items: [],
  5662. },
  5663. ]
  5664. };
  5665. var DbStore = /** @class */ (function (_super) {
  5666. __extends(DbStore, _super);
  5667. function DbStore() {
  5668. return _super !== null && _super.apply(this, arguments) || this;
  5669. }
  5670. DbStore.prototype.getCacheKey = function (param) {
  5671. return "db_data.json";
  5672. };
  5673. DbStore.prototype.invokeApi = function (param) {
  5674. return getMateData(param);
  5675. };
  5676. /**
  5677. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  5678. */
  5679. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  5680. return new Promise(function (resolve, reject) {
  5681. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  5682. resolve(res1);
  5683. // TODO 好像不需要,先跳过
  5684. // reloadByTableName(schema_name, table_name).then(res2 => {
  5685. // resolve(res1)
  5686. // }).catch(e => {
  5687. // reject(e)
  5688. // })
  5689. }).catch(function (e) {
  5690. reject(e);
  5691. });
  5692. });
  5693. };
  5694. /**
  5695. * 保存元数据至表格
  5696. */
  5697. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  5698. var _this = this;
  5699. return new Promise(function (resolve, reject) {
  5700. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  5701. // 保存后重新刷新
  5702. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  5703. resolve({
  5704. data: res2,
  5705. msg: res1.msg
  5706. });
  5707. }).catch(function (e) {
  5708. reject(e);
  5709. });
  5710. }).catch(function (e) {
  5711. reject(e);
  5712. });
  5713. });
  5714. };
  5715. /**
  5716. * 预览生成的 DDL 语句
  5717. */
  5718. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  5719. return new Promise(function (resolve, reject) {
  5720. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  5721. .then(function (res) {
  5722. resolve(res);
  5723. });
  5724. });
  5725. };
  5726. /**
  5727. * 执行 DDL
  5728. */
  5729. DbStore.prototype.pushToDbCommit = function (arg) {
  5730. return new Promise(function (resolve, reject) {
  5731. pushToDbCommitApi(arg).then(function (res) {
  5732. resolve(res);
  5733. }).catch(function (e) {
  5734. reject(e);
  5735. });
  5736. });
  5737. };
  5738. /**
  5739. * 重读某一个表格的 meta 元数据
  5740. */
  5741. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  5742. var _this = this;
  5743. return new Promise(function (resolve, reject) {
  5744. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  5745. if (!res[0] || !res[0].table_list[0]) {
  5746. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  5747. return;
  5748. }
  5749. var tableRow = _this.getTableByName(schema_name, table_name);
  5750. if (!tableRow) {
  5751. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  5752. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  5753. if (!schemaRow) {
  5754. showErrorDialog$1('没有找到 schema:' + schema_name);
  5755. return;
  5756. }
  5757. schemaRow.table_list.push(res[0].table_list[0]);
  5758. }
  5759. else {
  5760. // 找到了目标表格,就吧 table 所有属性都赋值过去
  5761. Object.assign(tableRow, res[0].table_list[0]);
  5762. }
  5763. // 所有界面通知一遍刷新
  5764. _this.notifyRefresh();
  5765. resolve(res);
  5766. }).catch(function (e) {
  5767. reject(e);
  5768. });
  5769. });
  5770. };
  5771. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  5772. var result = undefined;
  5773. _$2.forEach(this.apiResponse, function (schemaRow) {
  5774. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  5775. if (tableRow) {
  5776. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  5777. if (columnRow) {
  5778. result = columnRow;
  5779. return false;
  5780. }
  5781. }
  5782. });
  5783. return result;
  5784. };
  5785. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  5786. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  5787. if (!schemaRow) {
  5788. showErrorDialog$1('没有找到 schema:' + schemaName);
  5789. return;
  5790. }
  5791. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  5792. if (!schemaRow) {
  5793. showErrorDialog$1('没有找到 table:' + tableName);
  5794. return;
  5795. }
  5796. return tableRow;
  5797. };
  5798. /**
  5799. * 添加一个新表格
  5800. */
  5801. DbStore.prototype.appendNewTable = function (tableInfo) {
  5802. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  5803. if (!schemaRow) {
  5804. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  5805. return;
  5806. }
  5807. schemaRow.table_list.push(tableInfo);
  5808. };
  5809. /**
  5810. * 从数据库结构重新生成元数据
  5811. */
  5812. DbStore.prototype.dbToMetaAndReload = function () {
  5813. var _this = this;
  5814. this.notifyLoading(true);
  5815. dbToMeta().then(function () {
  5816. _this.reloadForce(undefined);
  5817. }).catch(function (e) {
  5818. _this.notifyLoading(false);
  5819. });
  5820. };
  5821. DbStore.prototype.getSchemaDbType = function (schemaName) {
  5822. var dbType = undefined;
  5823. _$2.forEach(this.apiResponse, function (schemaRow) {
  5824. if (schemaRow.schema_name === schemaName) {
  5825. dbType = schemaRow.db_type;
  5826. return false;
  5827. }
  5828. });
  5829. return dbType;
  5830. };
  5831. return DbStore;
  5832. }(CacheStore));
  5833. function syncQueryDSL(_a) {
  5834. var schema_name = _a.schema_name, table_name = _a.table_name;
  5835. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  5836. }
  5837. var instance = new DbStore();
  5838. // // 字段域数据
  5839. // let columnDomain = undefined
  5840. // // 元数据
  5841. // let apiResponse = []
  5842. //
  5843. // // 订阅
  5844. // const subscribeList = []
  5845. // /**
  5846. // * 获取全部元数据
  5847. // */
  5848. // export function getApiResponse() {
  5849. // return apiResponse
  5850. // }
  5851. //
  5852. // export function getColumnDomain() {
  5853. // return columnDomain
  5854. // }
  5855. // window['getApiResponse'] = getApiResponse
  5856. // window['getColumnDomain'] = getColumnDomain
  5857. // window['getDbTreeStore'] = function () {
  5858. // return apiResponse
  5859. // }
  5860. //
  5861. // /**
  5862. // * 订阅结果集
  5863. // */
  5864. // export function subscribe(fn) {
  5865. // subscribeList.push(fn)
  5866. // }
  5867. //
  5868. // /**
  5869. // * 取消订阅
  5870. // */
  5871. // export function describe(fn) {
  5872. // _.remove(subscribeList, item => item === fn)
  5873. // }
  5874. //
  5875. // /**
  5876. // * 刷新,如果前端从来没有取到过结果的话
  5877. // * 如果强制刷新成功,就返回 true
  5878. // * 如果没有被强制刷新,返回 false
  5879. // */
  5880. // export function reloadIfNeed() {
  5881. // if (_.size(apiResponse) <= 0) {
  5882. // reloadForce()
  5883. // return true
  5884. // }
  5885. // return false
  5886. // }
  5887. //
  5888. // export function reloadIfNeedPromise() {
  5889. // return new Promise((resolve, reject) => {
  5890. // if (_.size(apiResponse) <= 0) {
  5891. // // 从未有获取过值
  5892. // reloadForce().then(res => {
  5893. // resolve(apiResponse)
  5894. // })
  5895. // return
  5896. // }
  5897. // resolve(apiResponse)
  5898. // return
  5899. // })
  5900. // }
  5901. //
  5902. // /**
  5903. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  5904. // */
  5905. // export function reloadForce() {
  5906. // _.forEach(subscribeList, fn => {
  5907. // fn(true)
  5908. // })
  5909. //
  5910. // return getMateData().then((content) => {
  5911. // apiResponse = content
  5912. // _.forEach(subscribeList, fn => {
  5913. // fn(apiResponse)
  5914. // })
  5915. // }).finally(() => {
  5916. // _.forEach(subscribeList, fn => {
  5917. // fn(false)
  5918. // })
  5919. // })
  5920. // }
  5921. //
  5922. // /**
  5923. // * 通知刷新元数据
  5924. // */
  5925. // export function notifyRefresh() {
  5926. // _.forEach(subscribeList, fn => {
  5927. // fn(apiResponse)
  5928. // })
  5929. // }
  5930. // export function getAllDomain() {
  5931. // return new Promise((resolve, reject) => {
  5932. // getColumnDomainApi()
  5933. // .then(res => {
  5934. // if (res.success) {
  5935. // columnDomain = res.data
  5936. // resolve(res.data)
  5937. // } else {
  5938. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  5939. // console.error('getColumnDomain', res.msg)
  5940. // }
  5941. //
  5942. // })
  5943. // .catch(e => {
  5944. // showErrorDialog('getColumnDomain error!')
  5945. // console.error('getColumnDomain', e)
  5946. // reject(e)
  5947. // })
  5948. // })
  5949. // }
  5950. // noinspection TypeScriptCheckImport
  5951. function getSingleTableData(origin) {
  5952. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  5953. var _a, _b, _c;
  5954. var data = {
  5955. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  5956. package: _$2.replace(origin.packagePath, /\//g, "."),
  5957. groovyClass: origin.moduleName,
  5958. qClass: queryDslInfo.qClass,
  5959. qClassTable: queryDslInfo.qClassTable,
  5960. queryColumns: [],
  5961. insertColumns: [],
  5962. updateColumns: [],
  5963. updateWheres: [],
  5964. deleteWheres: [],
  5965. gridColumns: [],
  5966. sql: origin.sql,
  5967. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  5968. addButton: origin.editType !== 1,
  5969. saveButton: origin.editType === 2,
  5970. deleteButton: true,
  5971. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  5972. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  5973. fileSavePath: origin.fileSavePath,
  5974. };
  5975. origin.columnList.forEach(function (column) {
  5976. 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;
  5977. var query = origin.queryColumns.indexOf(column_name) >= 0;
  5978. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  5979. var update = origin.updateColumns.indexOf(column_name) >= 0;
  5980. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  5981. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  5982. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  5983. if (query) {
  5984. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  5985. }
  5986. if (insert) {
  5987. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  5988. }
  5989. if (update) {
  5990. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  5991. }
  5992. if (grid) {
  5993. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  5994. if (column_dict) {
  5995. gridColumn.fix = { dictName: column_dict };
  5996. }
  5997. if (origin.editType == 2 && (insert || update)) {
  5998. gridColumn.editor = { xtype: column_ui, fix: undefined };
  5999. if (column_dict) {
  6000. gridColumn.editor.fix = { dictName: column_dict };
  6001. }
  6002. }
  6003. data.gridColumns.push(gridColumn);
  6004. }
  6005. if (is_primary_key) {
  6006. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  6007. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  6008. }
  6009. });
  6010. return data;
  6011. });
  6012. }
  6013. // noinspection HttpUrlsUsage
  6014. var urlPrefix = "/static/studio-template/single_table";
  6015. function generateCode(data) {
  6016. return Promise.all([
  6017. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  6018. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  6019. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  6020. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  6021. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  6022. ]).then(function (values) {
  6023. var groovy = handlebars.compile(values[0]);
  6024. var mybatis = handlebars.compile(values[1]);
  6025. var controller = handlebars.compile(values[2]);
  6026. var view = handlebars.compile(values[3]);
  6027. var model = handlebars.compile(values[4]);
  6028. var code = {
  6029. groovy: groovy(data),
  6030. mybatis: mybatis(data),
  6031. controller: controller(data),
  6032. view: view(data),
  6033. model: model(data),
  6034. };
  6035. return code;
  6036. });
  6037. }
  6038. var CreateModule = /** @class */ (function (_super) {
  6039. __extends(CreateModule, _super);
  6040. function CreateModule() {
  6041. var _this = _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  6042. _this.columns = [];
  6043. return _this;
  6044. }
  6045. CreateModule.prototype.onLoad = function () {
  6046. this.refs.grid1.setData([]);
  6047. };
  6048. CreateModule.prototype.addField = function () {
  6049. this.refs.grid1.appendEditRow({
  6050. column_name: '',
  6051. column_comment: '',
  6052. is_primary_key: false,
  6053. not_null: true,
  6054. column_domain: '',
  6055. data_type: '',
  6056. column_size: 0,
  6057. decimal_digits: 0,
  6058. default_value: '',
  6059. column_dict: '',
  6060. column_ui: '',
  6061. column_note: '',
  6062. }, 0);
  6063. };
  6064. CreateModule.prototype.removeField = function () {
  6065. var _this = this;
  6066. var rows = [];
  6067. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  6068. rows.push(r);
  6069. });
  6070. _$2.forEach(rows, function (r) {
  6071. _this.refs.grid1.getStore().remove(r);
  6072. });
  6073. };
  6074. CreateModule.prototype.parseSQL = function (sender) {
  6075. var _this = this;
  6076. var sql = this.viewModel.get('singleTable.sql');
  6077. sender.up('window').setLoading(true);
  6078. instance.reloadIfNeedPromise(undefined).then(function (res) {
  6079. parseSqlApi(sql).then(function (parseResult) {
  6080. if (!parseResult.success) {
  6081. msg(parseResult.msg);
  6082. return;
  6083. }
  6084. var tableNameList = [];
  6085. var columnList = [];
  6086. var singleTableTableName;
  6087. var singleTableDeleteWhereColumn;
  6088. _this.refs.grid1.setData([]);
  6089. var rows = _this.refs.grid1.getDataRows();
  6090. _$2.forEach(parseResult.data, function (parseRetColumn) {
  6091. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  6092. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  6093. return;
  6094. }
  6095. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  6096. tableNameList.push({ value: tableName });
  6097. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  6098. columnList.push({ value: columnName });
  6099. if (!singleTableTableName)
  6100. singleTableTableName = tableName;
  6101. if (!singleTableDeleteWhereColumn)
  6102. singleTableDeleteWhereColumn = columnName;
  6103. // 已经加过这个列了
  6104. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  6105. if (rowExists) {
  6106. return;
  6107. }
  6108. var columnRow = instance.getColumnByTableNameColumnName(tableName, columnName);
  6109. if (columnRow) {
  6110. _this.refs.grid1.appendEditRow({
  6111. table_name: tableName,
  6112. column_name: columnRow.column_name,
  6113. column_comment: columnRow.column_comment,
  6114. column_useto: 2,
  6115. is_primary_key: columnRow.is_primary_key,
  6116. not_null: columnRow.not_null,
  6117. column_size: columnRow.column_size,
  6118. column_dict: columnRow.column_dict,
  6119. column_ui: columnRow.column_ui,
  6120. data_type: columnRow.data_type,
  6121. });
  6122. if (columnRow.is_primary_key)
  6123. singleTableDeleteWhereColumn = columnName;
  6124. }
  6125. else {
  6126. _this.refs.grid1.appendEditRow({
  6127. table_name: tableName,
  6128. column_name: columnName,
  6129. column_useto: 2,
  6130. });
  6131. }
  6132. });
  6133. _this.viewModel.set("singleTableView.columnList", columnList);
  6134. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  6135. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  6136. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  6137. }).finally(function () {
  6138. sender.up('window').setLoading(false);
  6139. });
  6140. }).catch(function () {
  6141. sender.up('window').setLoading(false);
  6142. });
  6143. };
  6144. CreateModule.prototype.templateEnter = function (sender) {
  6145. };
  6146. CreateModule.prototype.templateLevel = function (sender, opt) {
  6147. if (!this.viewModel.get('moduleType')) {
  6148. msg('请选择模板类型');
  6149. opt.cancel = true;
  6150. return;
  6151. }
  6152. };
  6153. CreateModule.prototype.moduleEnter = function (sender) {
  6154. };
  6155. CreateModule.prototype.moduleLevel = function (sender, opt) {
  6156. if (!sender.down('form').isValid()) {
  6157. opt.cancel = true;
  6158. return;
  6159. }
  6160. };
  6161. CreateModule.prototype.editorEnter = function (sender) {
  6162. var editor = sender.down('sqleditor');
  6163. editor.setValue(this.viewModel.get('singleTable.sql'));
  6164. };
  6165. CreateModule.prototype.editorLevel = function (sender, opt) {
  6166. var editor = sender.down('sqleditor');
  6167. var sql = editor.getValue();
  6168. if (!sql) {
  6169. msg('查询SQL语句必填');
  6170. opt.cancel = true;
  6171. return;
  6172. }
  6173. this.viewModel.set('singleTable.sql', sql);
  6174. };
  6175. CreateModule.prototype.columnEnter = function (sender) {
  6176. };
  6177. CreateModule.prototype.columnLevel = function (sender, opt) {
  6178. };
  6179. CreateModule.prototype.extendEnter = function (sender) {
  6180. };
  6181. CreateModule.prototype.extendLevel = function (sender, opt) {
  6182. };
  6183. // 确认结果 - Enter
  6184. CreateModule.prototype.optionEnter = function (sender) {
  6185. var _this = this;
  6186. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6187. var moduleType = this.viewModel.get("moduleType");
  6188. var data = this.viewModel.getData();
  6189. var code = "";
  6190. var origin = {};
  6191. if (moduleType === 1) {
  6192. var singleTable = data.singleTable;
  6193. var editColumns = this.refs.grid1.getDataRows();
  6194. origin.moduleType = data.moduleType;
  6195. origin.packagePath = data.packagePath;
  6196. origin.fileSavePath = data.fileSavePath;
  6197. origin.moduleName = data.moduleName;
  6198. origin.pageTitle = data.pageTitle;
  6199. if (singleTable) {
  6200. origin.sql = singleTable.sql;
  6201. origin.tableName = singleTable.tableName;
  6202. origin.pagination = singleTable.pagination;
  6203. origin.delete = singleTable.delete;
  6204. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  6205. origin.deleteTips = singleTable.deleteTips;
  6206. origin.editType = singleTable.editType;
  6207. }
  6208. origin.columnList = [];
  6209. origin.queryColumns = [];
  6210. origin.insertColumns = [];
  6211. origin.updateColumns = [];
  6212. origin.gridColumns = [];
  6213. editColumns.forEach(function (column) {
  6214. var row = {
  6215. table_name: column.table_name,
  6216. column_name: column.column_name,
  6217. column_comment: column.column_comment,
  6218. is_primary_key: column.is_primary_key,
  6219. not_null: column.not_null,
  6220. column_size: column.column_size,
  6221. column_dict: column.column_dict,
  6222. column_ui: column.column_ui,
  6223. data_type: column.data_type,
  6224. column_type: column.column_type,
  6225. };
  6226. origin.columnList.push(row);
  6227. // 1:查询条件; 2:查询结果; 3:条件+结果;
  6228. var column_name = column.column_name, column_useto = column.column_useto;
  6229. switch (column_useto) {
  6230. case 1:
  6231. origin.queryColumns.push(column_name);
  6232. break;
  6233. case 2:
  6234. origin.gridColumns.push(column_name);
  6235. break;
  6236. case 3:
  6237. origin.queryColumns.push(column_name);
  6238. origin.gridColumns.push(column_name);
  6239. break;
  6240. }
  6241. origin.insertColumns.push(column_name);
  6242. origin.updateColumns.push(column_name);
  6243. });
  6244. }
  6245. this.setLoading(true);
  6246. getSingleTableData(origin).then(function (data) {
  6247. code = JSON.stringify(data, null, 4);
  6248. window['lastTemplateData'] = code;
  6249. var editor = _this.refs.jsoneditor;
  6250. editor.setCode(code);
  6251. }).finally(function () { return _this.setLoading(false); });
  6252. };
  6253. // 确认结果 - Level
  6254. CreateModule.prototype.optionLevel = function (sender, opt) {
  6255. };
  6256. // 上一步
  6257. CreateModule.prototype.showPrevious = function () {
  6258. this.doCardNavigation(false);
  6259. };
  6260. // 下一步
  6261. CreateModule.prototype.showNext = function () {
  6262. this.doCardNavigation(true, true);
  6263. };
  6264. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  6265. if (isNext === void 0) { isNext = true; }
  6266. if (isCancelable === void 0) { isCancelable = false; }
  6267. var layout = this._handle.getLayout();
  6268. var activeItem = layout.activeItem;
  6269. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  6270. if (isNext)
  6271. this.prevCard = reference;
  6272. var activeCard;
  6273. if (reference === "templateSelection") {
  6274. if (isNext) {
  6275. activeCard = this.refs['moduleName'];
  6276. }
  6277. }
  6278. else if (reference === "moduleName") {
  6279. if (isNext) {
  6280. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6281. var moduleType = this.viewModel.get("moduleType");
  6282. switch (moduleType) {
  6283. case 1:
  6284. activeCard = this.refs['singleTable_1'];
  6285. break;
  6286. case 2:
  6287. activeCard = this.refs['mainDetailTable_1'];
  6288. break;
  6289. case 3:
  6290. // activeCard =
  6291. break;
  6292. case 4:
  6293. activeCard = this.refs['cardForm_1'];
  6294. break;
  6295. }
  6296. }
  6297. else {
  6298. activeCard = this.refs['templateSelection'];
  6299. }
  6300. }
  6301. else if (reference === "confirmResult") {
  6302. if (!isNext) {
  6303. activeCard = this.refs[this.prevCard];
  6304. }
  6305. }
  6306. else {
  6307. var name = reference.split('_')[0];
  6308. var idx = parseInt(reference.split('_')[1], 10);
  6309. if (isNext) {
  6310. if (isEnd) {
  6311. activeCard = this.refs['confirmResult'];
  6312. }
  6313. else {
  6314. idx += 1;
  6315. }
  6316. }
  6317. else {
  6318. idx -= 1;
  6319. }
  6320. if (idx <= 0) {
  6321. activeCard = this.refs['moduleName'];
  6322. }
  6323. else if (!activeCard) {
  6324. activeCard = this.refs[name + "_" + idx];
  6325. }
  6326. }
  6327. // 按钮状态
  6328. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  6329. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  6330. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  6331. // 设置下一页显示
  6332. if (activeCard) {
  6333. var optCancel = { cancel: false };
  6334. // 发出 cardLevel 事件
  6335. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  6336. if (isCancelable && optCancel.cancel) {
  6337. // 取消了
  6338. return;
  6339. }
  6340. layout.setActiveItem(activeCard);
  6341. this.viewModel.set('title', layout.activeItem.vtitle);
  6342. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  6343. }
  6344. };
  6345. // 立刻执行
  6346. CreateModule.prototype.finish = function (sender) {
  6347. var _this = this;
  6348. var parent = sender.up('window');
  6349. var editor = this.refs.jsoneditor;
  6350. var data = JSON.parse(editor.getCode());
  6351. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  6352. var moduleType = this.viewModel.get("moduleType");
  6353. if (moduleType === 1) {
  6354. this.setLoading(true);
  6355. generateCode(data).then(function (code) {
  6356. console.log("===> ", code);
  6357. _this.setLoading(true);
  6358. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  6359. .then(function () {
  6360. msg("创建成功!");
  6361. parent.close();
  6362. handles$1.fileTree.reload();
  6363. }).finally(function () { return _this.setLoading(false); });
  6364. }).finally(function () { return _this.setLoading(false); });
  6365. }
  6366. };
  6367. return CreateModule;
  6368. }(Scope));
  6369. function getModuleId(path) {
  6370. var separator = "/";
  6371. var sps = path.split(separator);
  6372. var joinSps = sps.join('$');
  6373. if (!joinSps) {
  6374. return "ROOT";
  6375. }
  6376. return joinSps;
  6377. }
  6378. /**
  6379. * Module数据转换成Tree数据
  6380. */
  6381. function modulesToTreeData(modules) {
  6382. var separator = "/";
  6383. var treeNodeMap = new Map();
  6384. var root = {
  6385. type: "Dir",
  6386. path: "",
  6387. expanded: true,
  6388. leaf: false,
  6389. children: [],
  6390. };
  6391. root.id = getModuleId(root.path);
  6392. treeNodeMap.set(root.path, root);
  6393. modules.forEach(function (module) {
  6394. var _a;
  6395. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  6396. if (paths.length <= 0)
  6397. return;
  6398. var path = [];
  6399. var parent = root;
  6400. paths.forEach(function (dirName, idx) {
  6401. var parentPath = path.join(separator);
  6402. parent = treeNodeMap.get(parentPath);
  6403. path.push(dirName);
  6404. var currentPath = path.join(separator);
  6405. var child = treeNodeMap.get(currentPath);
  6406. if (child == null) {
  6407. // 获取当前path 绝对路径
  6408. var indexLength = module.absolutePath.indexOf(currentPath);
  6409. var currentAbsolutePath = "";
  6410. if (indexLength > 0) {
  6411. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  6412. }
  6413. child = {
  6414. type: "Dir",
  6415. path: currentPath,
  6416. absolutePath: currentAbsolutePath,
  6417. leaf: false,
  6418. children: [],
  6419. text: dirName
  6420. };
  6421. child.id = getModuleId(child.path);
  6422. parent.children.push(child);
  6423. treeNodeMap.set(child.path, child);
  6424. }
  6425. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  6426. var leaf = {
  6427. type: "Module",
  6428. path: module.path + separator + module.name,
  6429. absolutePath: module.absolutePath,
  6430. leaf: true,
  6431. text: module.name,
  6432. module: module,
  6433. };
  6434. leaf.id = getModuleId(leaf.path);
  6435. child.children.push(leaf);
  6436. treeNodeMap.set(leaf.path, leaf);
  6437. }
  6438. });
  6439. });
  6440. // 排序处理
  6441. treeNodeMap.forEach(function (module) {
  6442. if (module.children) {
  6443. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  6444. module.children.length = 0;
  6445. children.forEach(function (item) { return module.children.push(item); });
  6446. }
  6447. });
  6448. return root;
  6449. }
  6450. function showDialog(sender, option) {
  6451. var _a, _b;
  6452. var win = new Ext.Window({
  6453. autoDestroy: true,
  6454. title: option.title,
  6455. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  6456. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  6457. resizable: false,
  6458. closable: true,
  6459. modal: true,
  6460. maximizable: false,
  6461. minimizable: false,
  6462. // constrainHeader: true,
  6463. constrain: true,
  6464. layout: 'fit',
  6465. animateTarget: sender,
  6466. buttonAlign: 'center',
  6467. items: [
  6468. {
  6469. xtype: "form",
  6470. layout: "hbox",
  6471. margin: '10px 20px',
  6472. border: 0,
  6473. items: option.items
  6474. }
  6475. ],
  6476. //窗口按钮
  6477. fbar: [
  6478. {
  6479. xtype: 'button', text: '保存', handler: function (btn) {
  6480. //窗口获取表单
  6481. var form = win.down('form');
  6482. var vaildSuccess = form.isValid();
  6483. if (!vaildSuccess) {
  6484. return;
  6485. }
  6486. option.submitFunc(form);
  6487. }
  6488. },
  6489. {
  6490. xtype: 'button', text: '取消', handler: function (btn) {
  6491. //窗口关闭
  6492. btn.up('window').close();
  6493. }
  6494. }
  6495. ],
  6496. });
  6497. win.show();
  6498. }
  6499. function showCreateFolderWin(sender, parentPath) {
  6500. showDialog(sender, {
  6501. title: '新建文件夹',
  6502. height: 150,
  6503. items: [
  6504. {
  6505. xtype: "textfield",
  6506. name: "filename",
  6507. fieldLabel: "文件夹名称",
  6508. allowBlank: false,
  6509. selectOnFocus: true,
  6510. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  6511. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  6512. labelWidth: 80,
  6513. width: "100%",
  6514. listeners: {
  6515. afterrender: function (sender) {
  6516. _$2.defer(function () {
  6517. sender.focus();
  6518. });
  6519. }
  6520. }
  6521. },
  6522. ],
  6523. submitFunc: function (form) {
  6524. var filename = form.down('textfield[name="filename"]').getValue();
  6525. createFolder(parentPath, filename).then(function (res) {
  6526. if (res.success) {
  6527. msg$1('创建成功');
  6528. handles$1.fileTree.reload();
  6529. form.up('window').close();
  6530. }
  6531. else {
  6532. showErrorDialog$1(res.msg);
  6533. }
  6534. }).catch(function (e) {
  6535. showErrorDialog$1(e.responseJSON.msg);
  6536. });
  6537. }
  6538. });
  6539. }
  6540. function showCreateModuleCrudWin(sender, path, absolutePath) {
  6541. var dlg = new CreateModule();
  6542. dlg.showDialog(sender, {}, {
  6543. data: {
  6544. packagePath: path,
  6545. fileSavePath: absolutePath,
  6546. }
  6547. });
  6548. }
  6549. function registerModule$1(sender, path, name, icon) {
  6550. // 前缀 com/galaxis/wms 写死了
  6551. var dlg = new RegisterModule();
  6552. dlg.showDialog(sender, {}, {
  6553. data: {
  6554. form: {
  6555. scope_url: path.replace("com/galaxis/wms", "."),
  6556. resource_name: name,
  6557. resource_icon: icon,
  6558. }
  6559. }
  6560. });
  6561. }
  6562. function showCreateEmptyModule(sender, path) {
  6563. var win = new Ext.Window({
  6564. autoDestroy: true,
  6565. title: "新建空模块",
  6566. width: 400,
  6567. height: 150,
  6568. resizable: true,
  6569. closable: true,
  6570. maximizable: true,
  6571. minimizable: true,
  6572. plain: true,
  6573. // constrainHeader: true,
  6574. constrain: true,
  6575. layout: 'fit',
  6576. animateTarget: sender,
  6577. buttonAlign: 'center',
  6578. items: [
  6579. {
  6580. xtype: "form",
  6581. layout: "hbox",
  6582. margin: '10px 20px',
  6583. border: 0,
  6584. items: [
  6585. {
  6586. flex: 1,
  6587. layout: 'vbox',
  6588. items: [
  6589. {
  6590. xtype: "textfield",
  6591. name: "filename",
  6592. fieldLabel: "模块名",
  6593. flex: 1,
  6594. allowBlank: false,
  6595. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  6596. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  6597. labelWidth: 50,
  6598. width: "100%",
  6599. },
  6600. ]
  6601. },
  6602. ]
  6603. }
  6604. ],
  6605. //窗口按钮
  6606. buttons: [
  6607. {
  6608. xtype: 'button', text: '保存', handler: function (btn) {
  6609. //窗口获取表单
  6610. var form = win.down('form');
  6611. var vaildSuccess = form.isValid();
  6612. if (!vaildSuccess) {
  6613. return;
  6614. }
  6615. var filename = form.down('textfield[name="filename"]').getValue();
  6616. createEmptyModule(path, filename).then(function (res) {
  6617. if (res.success) {
  6618. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  6619. handles$1.fileTree.reload();
  6620. win.close();
  6621. }
  6622. else {
  6623. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  6624. }
  6625. }).catch(function (e) {
  6626. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  6627. });
  6628. }
  6629. },
  6630. {
  6631. xtype: 'button', text: '取消', handler: function (btn) {
  6632. //窗口关闭
  6633. win.close();
  6634. }
  6635. }
  6636. ]
  6637. });
  6638. win.show();
  6639. }
  6640. function initFileTree () {
  6641. Ext.define('com.yvan.studio.FileTree', {
  6642. extend: 'com.yvan.studio.StateTree',
  6643. xtype: 'filetree',
  6644. tooltip: '文件',
  6645. iconCls: 'x-fa fa-file',
  6646. rootVisible: false,
  6647. useArrows: true,
  6648. colspan: 2,
  6649. lines: true,
  6650. reference: 'filetree',
  6651. multiSelect: true,
  6652. getStateFilename: function () {
  6653. return getCurrentProject().uuid + "/filetree.json";
  6654. },
  6655. openNode: function () {
  6656. var selection = this.getSelection();
  6657. var _a = __read(selection, 1), record = _a[0];
  6658. if (!record) {
  6659. return;
  6660. }
  6661. var raw = record.raw;
  6662. if (raw.type === 'Dir') {
  6663. return;
  6664. }
  6665. if (raw.type === "Module" && raw.module) {
  6666. eventBus.publish(EventType.ModuleOpen, raw);
  6667. }
  6668. },
  6669. openInIdea: function () {
  6670. var _a = __read(this.getSelection(), 1), record = _a[0];
  6671. if (record) {
  6672. var data = record.data;
  6673. if (data.type === "Module") {
  6674. if (data.module.groovyFile && data.module.groovyFile.exists) {
  6675. native.openInIdea(data.module.groovyFile.absolutePath);
  6676. }
  6677. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  6678. native.openInIdea(data.module.jsControllerFile.absolutePath);
  6679. }
  6680. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  6681. native.openInIdea(data.module.jsViewFile.absolutePath);
  6682. }
  6683. return;
  6684. }
  6685. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  6686. }
  6687. },
  6688. deleteSelection: function () {
  6689. var selection = this.getSelection();
  6690. var pathList = [];
  6691. _.forEach(selection, function (item) {
  6692. if (item.data.type === "Dir") {
  6693. pathList.push({ path: item.data.path, isFolder: true });
  6694. }
  6695. else {
  6696. pathList.push({ path: item.data.path, isFolder: false });
  6697. }
  6698. });
  6699. {
  6700. return;
  6701. }
  6702. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  6703. //
  6704. // Ext.Msg.confirm('提示', title, (btn) => {
  6705. // if (btn === 'yes') {
  6706. // deleteFileOrFolder(raw.path, title, true)
  6707. // }
  6708. // })
  6709. // const title = '您确定要删除(' + raw.path + ')吗?'
  6710. // deleteFileOrFolder(raw.path, title, false)
  6711. },
  6712. listeners: {
  6713. itemverify: function () {
  6714. this.openNode();
  6715. },
  6716. afterrender: function (me) {
  6717. console.log('filetree_afterrender', 'reloadIfNeed');
  6718. moduleStore.registe(me.subscribeModule.bind(this));
  6719. moduleStore.reloadIfNeed("PC");
  6720. },
  6721. destroy: function (me) {
  6722. console.log('filetree_destroy');
  6723. moduleStore.unregiste(me.subscribeModule.bind(this));
  6724. },
  6725. itemcontextmenu: function (sender, node, element, idx, e) {
  6726. e.preventDefault();
  6727. var raw = node.raw;
  6728. var option = {};
  6729. if (raw.type === 'Dir') {
  6730. // 文件夹右键
  6731. option = {
  6732. shadow: 'frame', allowOtherMenus: true,
  6733. items: [
  6734. {
  6735. text: '新建空模块',
  6736. iconCls: 'x-fa fa-plus-circle',
  6737. handler: function (sender) {
  6738. showCreateEmptyModule(sender, raw.path);
  6739. }
  6740. },
  6741. {
  6742. text: '新建模块',
  6743. iconCls: 'x-fa fa-plus-circle',
  6744. handler: function (sender) {
  6745. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  6746. }
  6747. },
  6748. '-',
  6749. {
  6750. text: '新建文件夹',
  6751. iconCls: 'x-fa fa-folder-o',
  6752. handler: function (sender) {
  6753. var parentPath = raw.path;
  6754. showCreateFolderWin(sender, parentPath);
  6755. }
  6756. },
  6757. {
  6758. text: '复制路径',
  6759. iconCls: 'x-fa fa-external-link',
  6760. handler: function (sender) {
  6761. native.clipboardSet(raw.path);
  6762. }
  6763. },
  6764. ]
  6765. };
  6766. }
  6767. else {
  6768. // 文件右键
  6769. option = {
  6770. shadow: 'frame', allowOtherMenus: true,
  6771. items: [
  6772. // {
  6773. // text: '重命名',
  6774. // iconCls: 'x-fa fa-terminal',
  6775. // handler(sender) {
  6776. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  6777. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  6778. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  6779. // }
  6780. // },
  6781. // {
  6782. // text: '另存为',
  6783. // iconCls: 'x-fa fa-exchange',
  6784. // handler(sender) {
  6785. // console.error('没做')
  6786. // }
  6787. // },
  6788. {
  6789. text: '复制路径',
  6790. iconCls: 'x-fa fa-external-link',
  6791. handler: function (sender) {
  6792. native.clipboardSet(raw.path);
  6793. }
  6794. },
  6795. '-',
  6796. {
  6797. text: '注册模块',
  6798. iconCls: 'x-fa fa-sign-in',
  6799. handler: function (sender) {
  6800. registerModule$1(sender, raw.path);
  6801. }
  6802. },
  6803. ]
  6804. };
  6805. }
  6806. var treeMenu = new Ext.menu.Menu(option);
  6807. treeMenu.showAt(e.getXY());
  6808. },
  6809. },
  6810. tbar: [
  6811. {
  6812. xtype: 'button',
  6813. iconCls: 'x-fa fa-crosshairs',
  6814. tooltip: '选中当前打开的文件',
  6815. handler: function (sender) {
  6816. msg$1('没做');
  6817. }
  6818. },
  6819. {
  6820. xtype: 'button',
  6821. iconCls: 'x-fa fa-link',
  6822. tooltip: '在IDEA中打开',
  6823. handler: function (sender) {
  6824. var scope = sender.up("filetree");
  6825. scope.openInIdea();
  6826. }
  6827. },
  6828. {
  6829. xtype: 'button',
  6830. iconCls: 'x-fa fa-refresh',
  6831. tooltip: '刷新',
  6832. handler: function (sender) {
  6833. var scope = sender.up("filetree");
  6834. scope.reload();
  6835. }
  6836. },
  6837. {
  6838. xtype: 'button',
  6839. iconCls: 'x-fa fa-percent',
  6840. tooltip: '监控',
  6841. handler: function (sender) {
  6842. // handles.mainWindow.showPerform()
  6843. }
  6844. },
  6845. ],
  6846. initComponent: function () {
  6847. setFileTree(this);
  6848. this.superclass.initComponent.apply(this, arguments);
  6849. // super.initComponent.apply(this, arguments)
  6850. },
  6851. subscribeModule: function (res) {
  6852. if (typeof res === 'object') {
  6853. var rootNode = modulesToTreeData(res.data);
  6854. this.setRootNode(rootNode);
  6855. this.restoreState();
  6856. handles$1.mainWindow.modules = res.data;
  6857. }
  6858. else if (typeof res === 'boolean') {
  6859. this.setLoading(res);
  6860. }
  6861. },
  6862. reload: function () {
  6863. console.log('filetree_reloadForce');
  6864. moduleStore.reloadForce("PC").then(function (res) {
  6865. });
  6866. }
  6867. });
  6868. }
  6869. function initDbTree () {
  6870. var define = {
  6871. extend: 'com.yvan.studio.StateTree',
  6872. xtype: 'dbtree',
  6873. tooltip: '数据库',
  6874. iconCls: 'x-fa fa-database',
  6875. rootVisible: false,
  6876. useArrows: true,
  6877. reference: 'dbtree',
  6878. multiSelect: true,
  6879. getStateFilename: function () {
  6880. return getCurrentProject().uuid + "/dbtree.json";
  6881. },
  6882. tbar: [
  6883. {
  6884. xtype: 'button',
  6885. iconCls: 'x-fa fa-crosshairs',
  6886. tooltip: '选中当前打开的表',
  6887. handler: function (sender) {
  6888. var _a;
  6889. // 获取当前选中的活动标签 tableColumn_bas_car
  6890. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  6891. if (!locatPath) {
  6892. return;
  6893. }
  6894. handles$1.dbTree.selectPath(locatPath);
  6895. }
  6896. },
  6897. {
  6898. xtype: 'button',
  6899. iconCls: 'x-fa fa-refresh',
  6900. tooltip: '刷新',
  6901. handler: function (sender) {
  6902. handles$1.dbTree.reload();
  6903. }
  6904. },
  6905. {
  6906. xtype: 'button',
  6907. iconCls: 'x-fa fa-cloud-download',
  6908. tooltip: '重新拉取生成元数据(耗时很长!)',
  6909. handler: function (sender) {
  6910. handles$1.dbTree.dbToMetaAndReload(sender);
  6911. }
  6912. },
  6913. // {
  6914. // xtype: 'button',
  6915. // iconCls: 'x-fa fa-files-o',
  6916. // tooltip: '数据同步',
  6917. // handler(sender) {
  6918. //
  6919. // }
  6920. // },
  6921. {
  6922. xtype: 'button',
  6923. iconCls: 'x-fa fa-exchange',
  6924. tooltip: '数据结构同步',
  6925. handler: function (sender) {
  6926. // handles.mainWindow.showDataSync(sender)
  6927. }
  6928. },
  6929. {
  6930. xtype: 'button',
  6931. iconCls: 'x-fa fa-window-maximize',
  6932. tooltip: 'SQL查询分析器',
  6933. handler: function (sender) {
  6934. // handles.mainWindow.showDbCodeTemplate(sender)
  6935. }
  6936. },
  6937. {
  6938. xtype: 'button',
  6939. iconCls: 'x-fa fa-cubes',
  6940. tooltip: '数据域管理',
  6941. handler: function (sender) {
  6942. // handles.mainWindow.showColumnDomain()
  6943. }
  6944. },
  6945. {
  6946. xtype: 'button',
  6947. iconCls: 'x-fa fa-edit',
  6948. tooltip: '修改结构',
  6949. handler: function (sender) {
  6950. var tree = sender.up("treepanel");
  6951. var selection = tree.getSelection();
  6952. var _a = __read(selection, 1), node = _a[0];
  6953. if (!node) {
  6954. msg$1('请选择一个表');
  6955. return;
  6956. }
  6957. var raw = node.data.raw;
  6958. if (node.get('type') === 'table') ;
  6959. else if (node.get('type') === 'column') ;
  6960. }
  6961. },
  6962. ],
  6963. listeners: {
  6964. afterrender: function (me) {
  6965. setDbTree(this);
  6966. // 找管理器订阅刷新的事件
  6967. instance.registe(this.refreshData.bind(this));
  6968. instance.reloadIfNeed(undefined);
  6969. },
  6970. destory: function (me) {
  6971. setDbTree(undefined);
  6972. instance.unregiste(this.refreshData.bind(this));
  6973. },
  6974. itemcontextmenu: function (sender, node, element, idx, e) {
  6975. var _this = this;
  6976. e.preventDefault();
  6977. var option = {};
  6978. var raw = node.raw.raw;
  6979. if (node.get('type') === 'column') {
  6980. option = {
  6981. shadow: 'frame', allowOtherMenus: true,
  6982. items: [
  6983. {
  6984. text: '设计结构',
  6985. iconCls: 'x-fa fa-edit',
  6986. handler: function (sender) {
  6987. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  6988. }
  6989. },
  6990. ]
  6991. };
  6992. }
  6993. else if (node.get('type') === 'table') {
  6994. option = {
  6995. shadow: 'frame', allowOtherMenus: true,
  6996. items: [
  6997. {
  6998. text: '新建',
  6999. iconCls: 'x-fa fa-plus',
  7000. handler: function (sender) {
  7001. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  7002. }
  7003. },
  7004. {
  7005. text: '设计结构',
  7006. iconCls: 'x-fa fa-edit',
  7007. handler: function (sender) {
  7008. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  7009. }
  7010. },
  7011. {
  7012. text: '重命名',
  7013. iconCls: 'x-fa fa-pencil',
  7014. handler: function (sender) {
  7015. _this.renameTable(sender, node.data.raw);
  7016. }
  7017. },
  7018. '-',
  7019. {
  7020. text: '删除',
  7021. iconCls: 'x-fa fa-minus',
  7022. handler: function (sender) {
  7023. _this.removeTable(sender, node.data.raw);
  7024. }
  7025. },
  7026. ]
  7027. };
  7028. }
  7029. var treeMenu = new Ext.menu.Menu(option);
  7030. treeMenu.showAt(e.getXY());
  7031. }
  7032. },
  7033. // DbTreeStore 刷新时,会回调到这个方法
  7034. refreshData: function (isLoadingState) {
  7035. var me = this;
  7036. if (typeof isLoadingState === 'boolean') {
  7037. me.setLoading(isLoadingState);
  7038. return;
  7039. }
  7040. var rootNode = getDbTree(instance.apiResponse);
  7041. me.setRootNode(rootNode);
  7042. this.restoreState();
  7043. },
  7044. renameTable: function (sender, tableRow) {
  7045. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  7046. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  7047. if (!res.data)
  7048. return;
  7049. var window = Ext.create('Ext.window.Window', {
  7050. title: 'SQL 预览',
  7051. height: 400,
  7052. width: 600,
  7053. modal: true,
  7054. animateTarget: sender,
  7055. maximizable: true,
  7056. layout: 'fit',
  7057. items: {
  7058. xtype: 'sqleditor',
  7059. value: res.data,
  7060. },
  7061. buttons: [
  7062. {
  7063. xtype: 'button',
  7064. text: '执行',
  7065. iconCls: 'x-fa fa-save',
  7066. handler: function (sender) {
  7067. var editor = sender.up('window').down('sqleditor');
  7068. var ddl = editor.getValue();
  7069. window.setLoading(true);
  7070. instance.pushToDbCommit({
  7071. schema_name: tableRow.schema_name,
  7072. table_name: name,
  7073. old_table_name: tableRow.table_name,
  7074. ddl: ddl,
  7075. }).then(function () {
  7076. handles$1.dbTree.reload();
  7077. window.close();
  7078. }).finally(function () { return window.setLoading(false); });
  7079. },
  7080. },
  7081. {
  7082. xtype: 'button',
  7083. text: '取消',
  7084. iconCls: 'x-fa fa-times',
  7085. handler: function () {
  7086. window.close();
  7087. }
  7088. },
  7089. ]
  7090. }).show();
  7091. });
  7092. });
  7093. },
  7094. removeTable: function (sender, tableRow) {
  7095. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  7096. if (!res.data)
  7097. return;
  7098. var window = Ext.create('Ext.window.Window', {
  7099. title: 'SQL 预览',
  7100. height: 400,
  7101. width: 600,
  7102. modal: true,
  7103. animateTarget: sender,
  7104. maximizable: true,
  7105. layout: 'fit',
  7106. items: {
  7107. xtype: 'sqleditor',
  7108. value: res.data,
  7109. },
  7110. buttons: [
  7111. {
  7112. xtype: 'button',
  7113. text: '执行',
  7114. iconCls: 'x-fa fa-save',
  7115. handler: function (sender) {
  7116. var editor = sender.up('window').down('sqleditor');
  7117. var ddl = editor.getValue();
  7118. window.setLoading(true);
  7119. instance.pushToDbCommit({
  7120. schema_name: tableRow.schema_name,
  7121. table_name: tableRow.table_name,
  7122. ddl: ddl
  7123. })
  7124. .then(function () {
  7125. handles$1.dbTree.reload();
  7126. window.close();
  7127. }).finally(function () { return window.setLoading(false); });
  7128. }
  7129. },
  7130. {
  7131. xtype: 'button',
  7132. text: '取消',
  7133. iconCls: 'x-fa fa-times',
  7134. handler: function () {
  7135. window.close();
  7136. }
  7137. }
  7138. ]
  7139. }).show();
  7140. });
  7141. },
  7142. // hideHeaders: true,
  7143. // columns: [
  7144. // {
  7145. // xtype: 'treecolumn',
  7146. // text: '名称',
  7147. // dataIndex: 'text',
  7148. // flex: 2,
  7149. // }, {
  7150. // text: '描述',
  7151. // dataIndex: 'comment',
  7152. // flex: 1,
  7153. // }
  7154. // ],
  7155. reload: function () {
  7156. // 强制刷新 DbManager
  7157. instance.reloadForce(undefined);
  7158. },
  7159. dbToMetaAndReload: function () {
  7160. // 从数据库结构重新生成元数据
  7161. instance.dbToMetaAndReload();
  7162. }
  7163. };
  7164. Ext.define('com.yvan.studio.DbTree', define);
  7165. }
  7166. /**
  7167. * 将数据构建成 dbTree 需要的格式
  7168. */
  7169. function getDbTree(apiResponse) {
  7170. var rootNode = {
  7171. children: [],
  7172. expanded: true,
  7173. id: "ROOT",
  7174. leaf: false,
  7175. };
  7176. _$2.forEach(apiResponse, function (schemaRow) {
  7177. var schemaNode = {
  7178. id: 'schema$' + schemaRow.schema_name,
  7179. type: "schema",
  7180. expanded: true,
  7181. leaf: false,
  7182. iconCls: 'x-fa fa-th-large ',
  7183. text: schemaRow.schema_name,
  7184. raw: __assign({}, schemaRow),
  7185. children: [],
  7186. };
  7187. delete schemaNode.raw.table_list;
  7188. rootNode.children.push(schemaNode);
  7189. _$2.forEach(schemaRow.table_list, function (tableRow) {
  7190. var _a;
  7191. var tableNode = {
  7192. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  7193. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  7194. comment: tableRow.description,
  7195. type: "table",
  7196. iconCls: 'x-fa fa-table',
  7197. expanded: false,
  7198. leaf: false,
  7199. children: [],
  7200. raw: __assign({}, tableRow)
  7201. };
  7202. delete tableNode.raw.column_list;
  7203. schemaNode.children.push(tableNode);
  7204. _$2.forEach(tableRow.column_list, function (columnRow) {
  7205. var _a;
  7206. var iconCls = 'x-fa fa-square-o';
  7207. if (columnRow.is_primary_key) {
  7208. iconCls = 'x-fa fa-key';
  7209. }
  7210. else if (columnRow.not_null) {
  7211. iconCls = 'x-fa fa-check-square';
  7212. }
  7213. var columnNode = {
  7214. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  7215. type: "column",
  7216. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  7217. comment: columnRow.column_comment,
  7218. leaf: true,
  7219. iconCls: iconCls,
  7220. raw: __assign({}, columnRow)
  7221. };
  7222. tableNode.children.push(columnNode);
  7223. }); // column
  7224. }); // table
  7225. }); // schema
  7226. return rootNode;
  7227. }
  7228. var ReportGridController = /** @class */ (function () {
  7229. function ReportGridController() {
  7230. }
  7231. ReportGridController.prototype.onLoad = function (sender) {
  7232. this.reload();
  7233. setReport(this);
  7234. };
  7235. ReportGridController.prototype.showSingle = function (sender) {
  7236. var _this = this;
  7237. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7238. if (record) {
  7239. handles.mainWindow.showFormSingle(record.data, function () {
  7240. _this.reload();
  7241. });
  7242. }
  7243. };
  7244. ReportGridController.prototype.filterChanged = function (sender, value) {
  7245. console.log('filterChange', sender, value);
  7246. this.view.store.clearFilter();
  7247. if (value) {
  7248. this.view.store.filterBy(function (record) {
  7249. var code = _.lowerCase(record.get('report_name'));
  7250. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  7251. return (code.includes(value) ||
  7252. dict_desc_py.includes(value));
  7253. });
  7254. }
  7255. };
  7256. ReportGridController.prototype.onClearClick = function () {
  7257. var _a, _b;
  7258. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  7259. };
  7260. ReportGridController.prototype.reload = function () {
  7261. var me = this;
  7262. me.getView().setLoading(true);
  7263. reportListApi().then(function (res) {
  7264. _.forEach(res.data, function (r) {
  7265. r.report_enable = r.report_enable === 1;
  7266. });
  7267. me.getView().setStore(new Ext.data.Store({
  7268. fields: ['report_id', 'report_name', 'report_enable'],
  7269. data: res.data,
  7270. }));
  7271. }).finally(function () {
  7272. me.getView().setLoading(false);
  7273. });
  7274. };
  7275. ReportGridController.prototype.reportAdd = function () {
  7276. var _this = this;
  7277. prompt$2('请输入报表名称').then(function (name) {
  7278. createReportApi(name).then(function (res) {
  7279. if (res.success) {
  7280. msg$1('添加成功');
  7281. handles.mainWindow.showReport(res.data, name, function () {
  7282. _this.reload();
  7283. });
  7284. }
  7285. _this.reload();
  7286. });
  7287. });
  7288. };
  7289. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  7290. e.preventDefault();
  7291. var me = sender.up('grid').ownerGrid.getController();
  7292. var option = {
  7293. shadow: 'frame', allowOtherMenus: true,
  7294. items: [
  7295. {
  7296. text: '添加',
  7297. iconCls: 'x-fa fa-plus-circle',
  7298. handler: function (sender) {
  7299. me.reportAdd();
  7300. }
  7301. },
  7302. {
  7303. text: '编辑',
  7304. iconCls: 'x-fa fa-edit',
  7305. handler: function (sender) {
  7306. me.reportEdit();
  7307. }
  7308. },
  7309. {
  7310. text: '删除',
  7311. iconCls: 'x-fa fa-minus-circle',
  7312. handler: function (sender) {
  7313. me.reportRemove();
  7314. }
  7315. },
  7316. '-',
  7317. {
  7318. text: '注册(至菜单)',
  7319. iconCls: 'x-fa fa-sign-in',
  7320. handler: function (sender) {
  7321. me.reportRegiste(sender);
  7322. }
  7323. },
  7324. {
  7325. text: '卸载',
  7326. iconCls: 'x-fa fa-sign-out',
  7327. handler: function (sender) {
  7328. console.error('没做');
  7329. }
  7330. },
  7331. ]
  7332. };
  7333. var treeMenu = new Ext.menu.Menu(option);
  7334. treeMenu.showAt(e.getXY());
  7335. };
  7336. ReportGridController.prototype.reportRegiste = function (sender) {
  7337. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7338. if (record) {
  7339. var reportName = record.get('report_name');
  7340. var reportId = record.get('report_id');
  7341. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  7342. }
  7343. };
  7344. ReportGridController.prototype.reportRemove = function () {
  7345. var _this = this;
  7346. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7347. if (record) {
  7348. var reportName = record.get('report_name');
  7349. var reportId_1 = record.get('report_id');
  7350. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  7351. delReportApi(reportId_1).then(function (res) {
  7352. if (res.success) {
  7353. msg$1('删除成功');
  7354. _this.reload();
  7355. }
  7356. });
  7357. });
  7358. }
  7359. };
  7360. ReportGridController.prototype.reportEdit = function () {
  7361. var _this = this;
  7362. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  7363. if (record) {
  7364. var reportName = record.get('report_name');
  7365. var reportId = record.get('report_id');
  7366. handles.mainWindow.showReport(reportId, reportName, function () {
  7367. _this.reload();
  7368. });
  7369. }
  7370. };
  7371. ReportGridController.prototype.onDblClick = function (sender) {
  7372. this.reportEdit();
  7373. };
  7374. return ReportGridController;
  7375. }());
  7376. function initReportGrid () {
  7377. var controller = new ReportGridController();
  7378. Ext.define('com.yvan.studio.ReportGrid', {
  7379. extend: 'Ext.grid.Panel',
  7380. xtype: 'reportGrid',
  7381. controller: controller,
  7382. scope: controller,
  7383. referenceHolder: true,
  7384. tooltip: '查询报表',
  7385. iconCls: 'x-fa fa-bar-chart',
  7386. useArrows: true,
  7387. reference: 'reportgrid',
  7388. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  7389. listeners: {
  7390. itemdblclick: 'onDblClick',
  7391. afterrender: 'onLoad',
  7392. },
  7393. viewConfig: {
  7394. enableTextSelection: true,
  7395. listeners: {
  7396. itemcontextmenu: 'onGridContextMenu',
  7397. },
  7398. },
  7399. tbar: {
  7400. xtype: 'toolbar',
  7401. items: [
  7402. {
  7403. xtype: 'button',
  7404. tooltip: '测试',
  7405. iconCls: 'x-fa fa-bars',
  7406. listeners: {
  7407. click: 'showSingle'
  7408. }
  7409. },
  7410. {
  7411. xtype: 'button',
  7412. tooltip: '刷新',
  7413. iconCls: 'x-fa fa-refresh',
  7414. listeners: {
  7415. click: 'reload'
  7416. }
  7417. },
  7418. {
  7419. xtype: 'button',
  7420. tooltip: '添加',
  7421. iconCls: 'x-fa fa-plus-circle',
  7422. listeners: {
  7423. click: 'reportAdd'
  7424. }
  7425. },
  7426. {
  7427. xtype: 'button',
  7428. tooltip: '删除',
  7429. iconCls: 'x-fa fa-minus-circle',
  7430. listeners: {
  7431. click: 'reportRemove'
  7432. }
  7433. },
  7434. {
  7435. xtype: 'textfield',
  7436. flex: 1,
  7437. reference: "txtFilter",
  7438. emptyText: '搜索过滤',
  7439. enableKeyEvents: true,
  7440. listeners: {
  7441. change: {
  7442. fn: 'filterChanged',
  7443. buffer: 50
  7444. }
  7445. }
  7446. },
  7447. ]
  7448. },
  7449. columns: [
  7450. {
  7451. text: 'ID', dataIndex: 'report_id',
  7452. hidden: true,
  7453. },
  7454. {
  7455. text: '报表名称', dataIndex: 'report_name',
  7456. flex: 1,
  7457. },
  7458. ]
  7459. });
  7460. }
  7461. /** 所有变量类型 */
  7462. var TypeEnum;
  7463. (function (TypeEnum) {
  7464. TypeEnum["string"] = "string";
  7465. TypeEnum["number"] = "number";
  7466. TypeEnum["object"] = "object";
  7467. TypeEnum["array"] = "array";
  7468. TypeEnum["function"] = "function";
  7469. TypeEnum["null"] = "null";
  7470. TypeEnum["boolean"] = "boolean";
  7471. TypeEnum["symbol"] = "symbol";
  7472. TypeEnum["json"] = "json";
  7473. TypeEnum["math"] = "math";
  7474. TypeEnum["regexp"] = "regexp";
  7475. TypeEnum["date"] = "date";
  7476. TypeEnum["undefined"] = "undefined";
  7477. TypeEnum["nan"] = "nan";
  7478. TypeEnum["reactNode"] = "react_node";
  7479. })(TypeEnum || (TypeEnum = {}));
  7480. /**
  7481. * 判断对象类型
  7482. * @param object 对象
  7483. */
  7484. var variableTypeOf = function (object) {
  7485. var typeStr = Object.prototype.toString.call(object);
  7486. var typeName;
  7487. switch (("" + typeStr).toLowerCase()) {
  7488. case '[object string]':
  7489. typeName = TypeEnum.string;
  7490. break;
  7491. case '[object number]':
  7492. if (Number.isNaN(object)) {
  7493. return TypeEnum.nan;
  7494. }
  7495. typeName = TypeEnum.number;
  7496. break;
  7497. case '[object object]':
  7498. if (object.$$typeof && object.props) {
  7499. var type = variableTypeOf(object.$$typeof);
  7500. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  7501. return TypeEnum.reactNode;
  7502. }
  7503. }
  7504. typeName = TypeEnum.object;
  7505. break;
  7506. case '[object array]':
  7507. typeName = TypeEnum.array;
  7508. break;
  7509. case '[object function]':
  7510. typeName = TypeEnum.function;
  7511. break;
  7512. case '[object null]':
  7513. typeName = TypeEnum.null;
  7514. break;
  7515. case '[object boolean]':
  7516. typeName = TypeEnum.boolean;
  7517. break;
  7518. case '[object date]':
  7519. typeName = TypeEnum.date;
  7520. break;
  7521. // 不常用
  7522. case '[object symbol]':
  7523. typeName = TypeEnum.symbol;
  7524. break;
  7525. case '[object json]':
  7526. typeName = TypeEnum.json;
  7527. break;
  7528. case '[object math]':
  7529. typeName = TypeEnum.math;
  7530. break;
  7531. case '[object regexp]':
  7532. typeName = TypeEnum.regexp;
  7533. break;
  7534. // 貌似不会走的分支
  7535. case '[object undefined]':
  7536. typeName = TypeEnum.undefined;
  7537. break;
  7538. // 无法识别
  7539. default:
  7540. if (object === undefined) {
  7541. return TypeEnum.undefined;
  7542. }
  7543. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  7544. typeName = TypeEnum.object;
  7545. }
  7546. return typeName;
  7547. };
  7548. function initGroovyEditor () {
  7549. Ext.define('com.yvan.studio.GroovyEditor', {
  7550. extend: 'Ext.panel.Panel',
  7551. alias: 'widget.groovyeditor',
  7552. xtype: 'groovyeditor',
  7553. layout: 'fit',
  7554. border: false,
  7555. html: "<div class=\"editor\"/>",
  7556. config: {
  7557. value: ''
  7558. },
  7559. codeChange: undefined,
  7560. isChangeFromOuter: false,
  7561. getCode: function () {
  7562. if (this.editor) {
  7563. return this.editor.getValue();
  7564. }
  7565. else {
  7566. return this.code;
  7567. }
  7568. },
  7569. setCode: function (value) {
  7570. var _this = this;
  7571. this.code = value;
  7572. this.value = value;
  7573. _$2.defer(function () {
  7574. _this.isChangeFromOuter = true;
  7575. if (_this.editor) {
  7576. _this.editor.setValue(value);
  7577. }
  7578. });
  7579. },
  7580. applyPosition: function () {
  7581. var _this = this;
  7582. if (this.autoFocusMethod) {
  7583. if (this.editor) {
  7584. _$2.defer(function () {
  7585. if (_this.autoFocusStartLine) {
  7586. _this.editor.setPosition({
  7587. lineNumber: _this.autoFocusStartLine,
  7588. column: _this.autoFocusStartColumn
  7589. });
  7590. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7591. }
  7592. _this.editor.focus();
  7593. });
  7594. delete this.autoFocusMethod;
  7595. }
  7596. }
  7597. this.editor.layout();
  7598. },
  7599. getValue: function () {
  7600. return this.value;
  7601. },
  7602. setValue: function (value, fromEditor) {
  7603. var me = this;
  7604. if (me.value === value) {
  7605. // 值相等,不需要变化
  7606. return;
  7607. }
  7608. if (fromEditor !== true && me.editor) {
  7609. // 不是来源于编辑器的变化,才设置编辑器的值
  7610. me.editor.setValue(value);
  7611. }
  7612. // 通知mixins setValue
  7613. me.value = value;
  7614. me.fireEvent('change', value);
  7615. },
  7616. initComponent: function () {
  7617. var that = this;
  7618. this.superclass.initComponent.call(this, arguments);
  7619. that.on({
  7620. resize: function () {
  7621. if (that.editor) {
  7622. that.editor.layout();
  7623. }
  7624. },
  7625. destory: function () {
  7626. if (that.editor) {
  7627. that.editor.dispose();
  7628. delete that.editor;
  7629. }
  7630. },
  7631. afterrender: function (sender) {
  7632. var $dom = $(that.el.dom).find('.editor');
  7633. attach_3($dom[0], {
  7634. value: that.code
  7635. }).then(function (editor) {
  7636. that.editor = editor;
  7637. that.applyPosition();
  7638. that.editor.onDidChangeModelContent(function (e) {
  7639. that.fireEvent('change', that.editor, e);
  7640. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  7641. that.codeChange(that.editor.getValue(), that.name, e);
  7642. }
  7643. that.isChangeFromOuter = false;
  7644. });
  7645. });
  7646. }
  7647. });
  7648. }
  7649. });
  7650. }
  7651. function attach_3(element, opts) {
  7652. return new Promise(function (resolve) {
  7653. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  7654. enabled: false
  7655. } }));
  7656. editor.onKeyUp(function (e) {
  7657. // console.log(e)
  7658. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  7659. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  7660. }
  7661. });
  7662. resolve(editor);
  7663. });
  7664. }
  7665. function initJsEditor () {
  7666. Ext.define('com.yvan.studio.JsEditor', {
  7667. extend: 'Ext.panel.Panel',
  7668. alias: 'widget.jseditor',
  7669. xtype: 'jseditor',
  7670. layout: 'fit',
  7671. border: false,
  7672. html: "<div class=\"editor\"/>",
  7673. autoFocusMethod: true,
  7674. autoFocusStartLine: 0,
  7675. autoFocusStartColumn: 0,
  7676. codeChange: undefined,
  7677. funcArr: [],
  7678. modulePage: null,
  7679. isChangeFromOuter: false,
  7680. name: "",
  7681. /**
  7682. * 设置代码
  7683. */
  7684. setCode: function (value) {
  7685. var _this = this;
  7686. this.code = value;
  7687. _$2.defer(function () {
  7688. _this.isChangeFromOuter = true;
  7689. if (_this.editor) {
  7690. _this.editor.setValue(value);
  7691. if (_this.name === "controllerEditor") {
  7692. _this.funcArr = _this.getAllFunction();
  7693. }
  7694. }
  7695. });
  7696. },
  7697. getCode: function () {
  7698. var _a;
  7699. if (!this.editor) {
  7700. return this.code;
  7701. }
  7702. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  7703. },
  7704. applyPosition: function () {
  7705. var _this = this;
  7706. if (this.autoFocusMethod) {
  7707. if (this.editor) {
  7708. _$2.defer(function () {
  7709. if (_this.autoFocusStartLine) {
  7710. _this.editor.setPosition({
  7711. lineNumber: _this.autoFocusStartLine,
  7712. column: _this.autoFocusStartColumn
  7713. });
  7714. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7715. }
  7716. _this.editor.focus();
  7717. });
  7718. delete this.autoFocusMethod;
  7719. }
  7720. }
  7721. this.editor.layout();
  7722. },
  7723. initComponent: function () {
  7724. var that = this;
  7725. this.superclass.initComponent.apply(this, arguments);
  7726. this.on({
  7727. resize: function (sender, width, height) {
  7728. if (that.editor) {
  7729. that.editor.layout();
  7730. }
  7731. },
  7732. destory: function () {
  7733. if (that.editor) {
  7734. that.editor.dispose();
  7735. delete that.editor;
  7736. }
  7737. },
  7738. afterrender: function () {
  7739. var $dom = $(that.el.dom).find('.editor');
  7740. attach_1($dom[0], {
  7741. value: that.code
  7742. }).then(function (editor) {
  7743. that.editor = editor;
  7744. that.applyPosition();
  7745. that.editor.onDidChangeModelContent(function (e) {
  7746. that.fireEvent('change', that.editor, e);
  7747. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  7748. that.codeChange(that.editor.getValue(), that.name, e);
  7749. }
  7750. that.isChangeFromOuter = false;
  7751. });
  7752. });
  7753. }
  7754. });
  7755. },
  7756. getAllFunction: function () {
  7757. var funcArr = [];
  7758. var ast = window['YvanUI'].recast.parse(this.code);
  7759. if (ast && ast.program && ast.program.body) {
  7760. if (Array.isArray(ast.program.body)) {
  7761. for (var i = 0; i < ast.program.body.length; i++) {
  7762. var m = ast.program.body[i];
  7763. if (m.type === "ExportDefaultDeclaration") {
  7764. if (m.declaration.type === "ClassDeclaration") {
  7765. if (m.declaration.body.type === "ClassBody") {
  7766. if (Array.isArray(m.declaration.body.body)) {
  7767. for (var j = 0; j < m.declaration.body.body.length; j++) {
  7768. var ob = m.declaration.body.body[j];
  7769. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  7770. var funcItem = { name: ob.key.name, args: [] };
  7771. if (Array.isArray(ob.value.params)) {
  7772. for (var k = 0; k < ob.value.params.length; k++) {
  7773. var p = ob.value.params[k];
  7774. funcItem.args.push(p.name);
  7775. }
  7776. }
  7777. funcArr.push(funcItem);
  7778. }
  7779. }
  7780. }
  7781. }
  7782. }
  7783. }
  7784. }
  7785. }
  7786. }
  7787. return funcArr;
  7788. }
  7789. });
  7790. }
  7791. var isInited = false;
  7792. function attach_1(element, opts) {
  7793. return new Promise(function (resolve) {
  7794. var monaco = window['monaco'];
  7795. if (!isInited) {
  7796. isInited = true;
  7797. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  7798. noSemanticValidation: true,
  7799. noSyntaxValidation: false
  7800. });
  7801. // compiler options
  7802. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  7803. target: monaco.languages.typescript.ScriptTarget.ES2016,
  7804. allowNonTsExtensions: true,
  7805. });
  7806. // extra libraries
  7807. var libSource = [
  7808. 'declare class Facts {',
  7809. ' /**',
  7810. ' * Returns the next fact',
  7811. ' */',
  7812. ' static next():string',
  7813. ' static next222():string',
  7814. '}',
  7815. "\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 ",
  7816. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  7817. ].join('\n');
  7818. var libUri = 'file:///index.d.ts';
  7819. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  7820. // When resolving definitions and references, the editor will try to use created models.
  7821. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  7822. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  7823. }
  7824. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  7825. resolve(editor);
  7826. });
  7827. }
  7828. function initJsonEditor () {
  7829. Ext.define('com.yvan.studio.JsonEditor', {
  7830. extend: 'Ext.panel.Panel',
  7831. alias: 'widget.jsoneditor',
  7832. xtype: 'jsoneditor',
  7833. layout: 'fit',
  7834. border: false,
  7835. html: "<div class=\"editor\"/>",
  7836. autoFocusMethod: true,
  7837. autoFocusStartLine: 0,
  7838. autoFocusStartColumn: 0,
  7839. codeChange: undefined,
  7840. funcArr: [],
  7841. modulePage: null,
  7842. isChangeFromOuter: false,
  7843. name: "",
  7844. /**
  7845. * 设置代码
  7846. */
  7847. setCode: function (value) {
  7848. var _this = this;
  7849. this.code = value;
  7850. _$2.defer(function () {
  7851. _this.isChangeFromOuter = true;
  7852. if (_this.editor) {
  7853. _this.editor.setValue(value);
  7854. }
  7855. });
  7856. },
  7857. updateOptions: function (options) {
  7858. if (this.editor && options) {
  7859. this.editor.updateOptions(options);
  7860. }
  7861. },
  7862. setLanguage: function (lang) {
  7863. if (this.editor && lang) {
  7864. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  7865. }
  7866. },
  7867. getCode: function () {
  7868. var _a;
  7869. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  7870. },
  7871. applyPosition: function () {
  7872. var _this = this;
  7873. if (this.autoFocusMethod) {
  7874. if (this.editor) {
  7875. _$2.defer(function () {
  7876. if (_this.autoFocusStartLine) {
  7877. _this.editor.setPosition({
  7878. lineNumber: _this.autoFocusStartLine,
  7879. column: _this.autoFocusStartColumn
  7880. });
  7881. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7882. }
  7883. _this.editor.focus();
  7884. });
  7885. delete this.autoFocusMethod;
  7886. }
  7887. }
  7888. this.editor.layout();
  7889. },
  7890. initComponent: function () {
  7891. var that = this;
  7892. this.superclass.initComponent.apply(this, arguments);
  7893. this.on({
  7894. resize: function (sender, width, height) {
  7895. if (that.editor) {
  7896. that.editor.layout();
  7897. }
  7898. },
  7899. destory: function () {
  7900. if (that.editor) {
  7901. that.editor.dispose();
  7902. delete that.editor;
  7903. }
  7904. },
  7905. afterrender: function (sender) {
  7906. var $dom = $(that.el.dom).find('.editor');
  7907. attach_116($dom[0], {
  7908. value: that.code
  7909. }).then(function (editor) {
  7910. that.editor = editor;
  7911. that.applyPosition();
  7912. that.editor.onDidChangeModelContent(function (e) {
  7913. that.fireEvent('change', that.editor, e);
  7914. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  7915. that.codeChange(that.editor.getValue(), that.name, e);
  7916. }
  7917. that.isChangeFromOuter = false;
  7918. });
  7919. });
  7920. }
  7921. });
  7922. },
  7923. });
  7924. }
  7925. function attach_116(element, opts) {
  7926. return new Promise(function (resolve) {
  7927. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  7928. enabled: false
  7929. } }));
  7930. editor.onKeyUp(function (e) {
  7931. // console.log(e)
  7932. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  7933. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  7934. }
  7935. });
  7936. resolve(editor);
  7937. });
  7938. }
  7939. function initSqlEditor () {
  7940. Ext.define('com.yvan.studio.SqlEditor', {
  7941. extend: 'Ext.panel.Panel',
  7942. alias: 'widget.sqleditor',
  7943. xtype: 'sqleditor',
  7944. layout: 'fit',
  7945. border: false,
  7946. html: "<div class=\"editor\"/>",
  7947. config: {
  7948. value: ''
  7949. },
  7950. codeChange: undefined,
  7951. isChangeFromOuter: false,
  7952. setCode: function (value) {
  7953. var _this = this;
  7954. this.code = value;
  7955. this.value = value;
  7956. _$2.defer(function () {
  7957. _this.isChangeFromOuter = true;
  7958. if (_this.editor) {
  7959. _this.editor.setValue(value);
  7960. }
  7961. });
  7962. },
  7963. getCode: function () {
  7964. return this.getValue();
  7965. },
  7966. updateOptions: function (options) {
  7967. if (this.editor && options) {
  7968. this.editor.updateOptions(options);
  7969. }
  7970. },
  7971. getValue: function () {
  7972. if (!this.editor) {
  7973. return this.code;
  7974. }
  7975. return this.editor.getValue();
  7976. },
  7977. applyPosition: function () {
  7978. var _this = this;
  7979. if (this.autoFocusMethod) {
  7980. if (this.editor) {
  7981. _$2.defer(function () {
  7982. if (_this.autoFocusStartLine) {
  7983. _this.editor.setPosition({
  7984. lineNumber: _this.autoFocusStartLine,
  7985. column: _this.autoFocusStartColumn
  7986. });
  7987. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  7988. }
  7989. _this.editor.focus();
  7990. });
  7991. delete this.autoFocusMethod;
  7992. }
  7993. }
  7994. this.editor.layout();
  7995. },
  7996. setValue: function (value, fromEditor) {
  7997. this.setCode(value);
  7998. var me = this;
  7999. if (me.value === value) {
  8000. // 值相等,不需要变化
  8001. return;
  8002. }
  8003. if (fromEditor !== true && me.editor) {
  8004. // 不是来源于编辑器的变化,才设置编辑器的值
  8005. me.editor.setValue(value);
  8006. }
  8007. // 通知mixins setValue
  8008. me.value = value;
  8009. me.fireEvent('change', value);
  8010. },
  8011. initComponent: function () {
  8012. var that = this;
  8013. this.superclass.initComponent.call(this);
  8014. that.on({
  8015. resize: function () {
  8016. if (that.editor) {
  8017. that.editor.layout();
  8018. }
  8019. },
  8020. destory: function () {
  8021. if (that.editor) {
  8022. that.editor.dispose();
  8023. delete that.editor;
  8024. }
  8025. },
  8026. afterrender: function (sender) {
  8027. var $dom = $(that.el.dom).find('.editor');
  8028. attach_2($dom[0], {
  8029. value: that.code
  8030. }).then(function (editor) {
  8031. that.editor = editor;
  8032. that.applyPosition();
  8033. that.editor.onDidChangeModelContent(function (e) {
  8034. that.fireEvent('change', that.editor, e);
  8035. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  8036. that.codeChange(that.editor.getValue(), that.name, e);
  8037. }
  8038. that.isChangeFromOuter = false;
  8039. });
  8040. });
  8041. }
  8042. });
  8043. }
  8044. });
  8045. }
  8046. function attach_2(element, opts) {
  8047. return new Promise(function (resolve) {
  8048. var monaco = window['monaco'];
  8049. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  8050. enabled: false
  8051. } }));
  8052. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  8053. // const sql = editor.getValue()
  8054. // if (_.trim(sql).length > 0) {
  8055. // editor.setValue(format(sql, {
  8056. // indent: ' ',
  8057. // uppercase: true,
  8058. // }))
  8059. // }
  8060. msg$1('没做');
  8061. });
  8062. editor.onKeyUp(function (e) {
  8063. // console.log(e)
  8064. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  8065. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  8066. }
  8067. });
  8068. resolve(editor);
  8069. });
  8070. }
  8071. function initTemplateEditor () {
  8072. Ext.define('com.yvan.studio.TemplateEditor', {
  8073. extend: 'Ext.panel.Panel',
  8074. alias: 'widget.templateeditor',
  8075. xtype: 'templateeditor',
  8076. layout: 'fit',
  8077. border: false,
  8078. html: "<div class=\"editor\"/>",
  8079. autoFocusMethod: true,
  8080. autoFocusStartLine: 0,
  8081. autoFocusStartColumn: 0,
  8082. codeChange: undefined,
  8083. funcArr: [],
  8084. modulePage: null,
  8085. isChangeFromOuter: false,
  8086. name: "",
  8087. /**
  8088. * 设置代码
  8089. */
  8090. setCode: function (value) {
  8091. var _this = this;
  8092. this.code = value;
  8093. _$2.defer(function () {
  8094. _this.isChangeFromOuter = true;
  8095. if (_this.editor) {
  8096. _this.editor.setValue(value);
  8097. }
  8098. });
  8099. },
  8100. getCode: function () {
  8101. var _a;
  8102. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  8103. },
  8104. applyPosition: function () {
  8105. var _this = this;
  8106. if (this.autoFocusMethod) {
  8107. if (this.editor) {
  8108. _$2.defer(function () {
  8109. if (_this.autoFocusStartLine) {
  8110. _this.editor.setPosition({
  8111. lineNumber: _this.autoFocusStartLine,
  8112. column: _this.autoFocusStartColumn
  8113. });
  8114. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  8115. }
  8116. _this.editor.focus();
  8117. });
  8118. delete this.autoFocusMethod;
  8119. }
  8120. }
  8121. this.editor.layout();
  8122. },
  8123. initComponent: function () {
  8124. var that = this;
  8125. this.superclass.initComponent.apply(this, arguments);
  8126. this.on({
  8127. resize: function (sender, width, height) {
  8128. if (that.editor) {
  8129. that.editor.layout();
  8130. }
  8131. },
  8132. destory: function () {
  8133. if (that.editor) {
  8134. that.editor.dispose();
  8135. delete that.editor;
  8136. }
  8137. },
  8138. afterrender: function (sender) {
  8139. var $dom = $(that.el.dom).find('.editor');
  8140. attach_117($dom[0], {
  8141. value: that.code
  8142. }).then(function (editor) {
  8143. that.editor = editor;
  8144. that.applyPosition();
  8145. that.editor.onDidChangeModelContent(function (e) {
  8146. that.fireEvent('change', that.editor, e);
  8147. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  8148. that.codeChange(that.editor.getValue(), that.name, e);
  8149. }
  8150. that.isChangeFromOuter = false;
  8151. });
  8152. });
  8153. }
  8154. });
  8155. },
  8156. });
  8157. }
  8158. function attach_117(element, opts) {
  8159. return new Promise(function (resolve) {
  8160. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  8161. enabled: false
  8162. } }));
  8163. editor.onKeyUp(function (e) {
  8164. // console.log(e)
  8165. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  8166. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  8167. }
  8168. });
  8169. resolve(editor);
  8170. });
  8171. }
  8172. var DictStore = /** @class */ (function (_super) {
  8173. __extends(DictStore, _super);
  8174. function DictStore() {
  8175. return _super !== null && _super.apply(this, arguments) || this;
  8176. }
  8177. DictStore.prototype.getCacheKey = function (param) {
  8178. return "dict_data.json";
  8179. };
  8180. DictStore.prototype.invokeApi = function (param) {
  8181. return getDict(param);
  8182. };
  8183. DictStore.prototype.getDicts = function () {
  8184. return this.apiResponse.data.dict;
  8185. };
  8186. DictStore.prototype.getDictCodes = function () {
  8187. return new Promise(function (resolve) {
  8188. // reloadIfNeedPromise().then(() => {
  8189. // const result = []
  8190. // _.forEach(this.getDicts(), dictRow => {
  8191. // result.push({
  8192. // id: dictRow.dict_code,
  8193. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  8194. // })
  8195. // })
  8196. // resolve(result)
  8197. // })
  8198. });
  8199. };
  8200. DictStore.prototype.saveDict = function (param) {
  8201. return saveDictApi(param);
  8202. };
  8203. DictStore.prototype.saveDictItems = function (param) {
  8204. return saveDictItemsApi(param);
  8205. };
  8206. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  8207. var results = [];
  8208. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  8209. if (dictItemRow.dict_code === dict_code) {
  8210. results.push(_$2.clone(dictItemRow));
  8211. }
  8212. });
  8213. return results;
  8214. };
  8215. return DictStore;
  8216. }(CacheStore));
  8217. var instance$1 = new DictStore();
  8218. var DictTreeController = /** @class */ (function () {
  8219. function DictTreeController() {
  8220. this._saveStateFlag = true;
  8221. }
  8222. DictTreeController.prototype.dictSave = function () {
  8223. var _this = this;
  8224. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  8225. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  8226. if (err) {
  8227. // 如果有异常就不保存
  8228. return;
  8229. }
  8230. // 进行业务上的逻辑校验,比如说必填校验等等
  8231. var hasError = false;
  8232. _$2.forEach(rows, function (row, i) {
  8233. if (isEmpty(row.dict_code)) {
  8234. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  8235. hasError = true;
  8236. return false;
  8237. }
  8238. });
  8239. if (hasError) {
  8240. return;
  8241. }
  8242. // 设置当前界面为 "保存中..." 状态
  8243. this.view.setLoading(true);
  8244. instance$1.saveDict({
  8245. newRows: newRows,
  8246. modifyRows: modifyRows,
  8247. removeRecords: removeRecords,
  8248. }).then(function (res) {
  8249. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  8250. msg$1(res.msg);
  8251. _this.reload();
  8252. }).finally(function () {
  8253. // 无论正常异常,关闭 "保存中..." 状态
  8254. _this.view.setLoading(false);
  8255. });
  8256. };
  8257. DictTreeController.prototype.dictItemSave = function () {
  8258. var _this = this;
  8259. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8260. var currentDictCode = undefined;
  8261. if (record) {
  8262. currentDictCode = record.get('dict_code');
  8263. }
  8264. if (!currentDictCode) {
  8265. msg$1('请选择一个字典');
  8266. return;
  8267. }
  8268. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  8269. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  8270. if (err) {
  8271. // 如果有异常就不保存
  8272. return;
  8273. }
  8274. // 进行业务上的逻辑校验,比如说必填校验等等
  8275. var hasError = false;
  8276. _$2.forEach(rows, function (row, i) {
  8277. if (!row.dict_value && row.dict_value !== 0) {
  8278. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  8279. hasError = true;
  8280. return false;
  8281. }
  8282. });
  8283. if (hasError) {
  8284. return;
  8285. }
  8286. // 设置当前界面为 "保存中..." 状态
  8287. this.view.setLoading(true);
  8288. instance$1.saveDictItems({
  8289. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  8290. newRows: newRows,
  8291. modifyRows: modifyRows,
  8292. removeRecords: removeRecords,
  8293. dict_code: currentDictCode
  8294. }).then(function (res) {
  8295. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  8296. msg$1(res.msg);
  8297. _this.reload();
  8298. }).finally(function () {
  8299. // 无论正常异常,关闭 "保存中..." 状态
  8300. _this.view.setLoading(false);
  8301. });
  8302. };
  8303. DictTreeController.prototype.createDictEnum = function () {
  8304. var _this = this;
  8305. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8306. var currentDictCode = undefined;
  8307. if (record) {
  8308. currentDictCode = record.get('dict_code');
  8309. }
  8310. if (!currentDictCode) {
  8311. msg$1('请选择一个字典');
  8312. return;
  8313. }
  8314. // 设置当前界面为 "保存中..." 状态
  8315. this.view.setLoading(true);
  8316. createDictEnum({ dictCode: currentDictCode })
  8317. .then(function () { return _this.reload(); })
  8318. .finally(function () { return _this.view.setLoading(false); });
  8319. };
  8320. DictTreeController.prototype.onLoad = function () {
  8321. setDictTree(this);
  8322. this.grid1 = this.view.lookupReference('grid1');
  8323. this.grid2 = this.view.lookupReference('grid2');
  8324. this.grid1.setData([]);
  8325. this.grid2.setData([]);
  8326. // this.grid1.columns[0].hide()
  8327. this.grid2.columns[0].hide();
  8328. // 找管理器订阅刷新的事件
  8329. instance$1.registe(this.refreshData.bind(this));
  8330. // 非强制性刷新 DbManager
  8331. instance$1.reloadIfNeed(undefined);
  8332. };
  8333. DictTreeController.prototype.onDestory = function () {
  8334. instance$1.unregiste(this.refreshData.bind(this));
  8335. };
  8336. // dictStore 刷新时,会回调到这个方法
  8337. DictTreeController.prototype.refreshData = function (isLoadingState) {
  8338. var me = this;
  8339. if (typeof isLoadingState === 'boolean') {
  8340. me.view.setLoading(isLoadingState);
  8341. return;
  8342. }
  8343. this.grid1.setData(instance$1.getDicts());
  8344. this.restoreState();
  8345. };
  8346. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  8347. var _this = this;
  8348. _$2.defer(function () {
  8349. _this.saveState();
  8350. });
  8351. if (!record) {
  8352. this.grid2.setData([]);
  8353. return;
  8354. }
  8355. var dict_code = record.get('dict_code');
  8356. var data = instance$1.getDictItemByDictcode(dict_code);
  8357. this.grid2.setData(data);
  8358. };
  8359. DictTreeController.prototype.reload = function () {
  8360. var _this = this;
  8361. // 强制刷新 DbManager
  8362. instance$1.reloadForce(undefined).then(function (res) {
  8363. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  8364. });
  8365. };
  8366. DictTreeController.prototype.dictAdd = function () {
  8367. this.grid1.appendEditRow({
  8368. _createFlag: true,
  8369. dict_code: '',
  8370. dict_desc: '',
  8371. }, 0);
  8372. };
  8373. DictTreeController.prototype.dictRemove = function () {
  8374. this.grid1.removeEditRow();
  8375. };
  8376. DictTreeController.prototype.dictItemAdd = function () {
  8377. var _a, _b;
  8378. 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;
  8379. if (!dict_code) {
  8380. msg$1('请先保存字典');
  8381. return;
  8382. }
  8383. this.grid2.appendEditRow({
  8384. dict_code: dict_code,
  8385. dict_text: '',
  8386. dict_value: '',
  8387. }, 0);
  8388. };
  8389. DictTreeController.prototype.dictItemRemove = function () {
  8390. var _this = this;
  8391. var rows = [];
  8392. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  8393. rows.push(r);
  8394. });
  8395. _$2.forEach(rows, function (r) {
  8396. _this.grid2.getStore().remove(r);
  8397. });
  8398. };
  8399. DictTreeController.prototype.clearSearch1 = function () {
  8400. this.grid1.store.clearFilter();
  8401. };
  8402. DictTreeController.prototype.search1 = function (sender) {
  8403. this.grid1.store.clearFilter();
  8404. this.getViewModel().set('grid1.selection', null);
  8405. this.grid1.fireEvent('itemselect');
  8406. var value = _$2.lowerCase(sender.getRawValue()).trim();
  8407. if (!value) {
  8408. return;
  8409. }
  8410. this.grid1.store.filterBy(function (record) {
  8411. if (record.get('_createFlag')) {
  8412. return true;
  8413. }
  8414. var dict_code = _$2.lowerCase(record.get('dict_code'));
  8415. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  8416. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  8417. return (dict_code.includes(value) ||
  8418. dict_desc.includes(value) ||
  8419. dict_desc_py.includes(value));
  8420. });
  8421. };
  8422. DictTreeController.prototype.clearSearch2 = function () {
  8423. this.grid2.store.clearFilter();
  8424. };
  8425. DictTreeController.prototype.search2 = function (sender) {
  8426. this.grid2.store.clearFilter();
  8427. var value = _$2.lowerCase(sender.getRawValue()).trim();
  8428. if (!value) {
  8429. return;
  8430. }
  8431. this.grid2.store.filterBy(function (record) {
  8432. var dict_text = _$2.lowerCase(record.get('dict_text'));
  8433. var dict_value = _$2.lowerCase(record.get('dict_value'));
  8434. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  8435. return (dict_text.includes(value) ||
  8436. dict_value === value ||
  8437. dict_text_py.includes(value));
  8438. });
  8439. };
  8440. DictTreeController.prototype.getStateFilename = function () {
  8441. return getCurrentProject().uuid + "/dicttree.json";
  8442. };
  8443. DictTreeController.prototype.restoreState = function () {
  8444. var _this = this;
  8445. var grid = this.grid1;
  8446. native.loadFile(this.getStateFilename(), function (content) {
  8447. if (!content)
  8448. return;
  8449. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  8450. _this._saveStateFlag = false;
  8451. if (selection) {
  8452. var idx = grid.store.findExact('dict_code', selection);
  8453. if (idx >= 0) {
  8454. var record = grid.store.getAt(idx);
  8455. if (record) {
  8456. grid.setSelection([record]);
  8457. }
  8458. }
  8459. }
  8460. if (scrollPosition && scrollSize) {
  8461. var size = grid.scrollable.getSize();
  8462. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  8463. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  8464. }
  8465. }
  8466. setTimeout(function () {
  8467. _this._saveStateFlag = true;
  8468. }, 200);
  8469. });
  8470. };
  8471. DictTreeController.prototype.saveState = function () {
  8472. if (!this._saveStateFlag) {
  8473. return;
  8474. }
  8475. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  8476. var selection = undefined;
  8477. if (record) {
  8478. selection = record.get('dict_code');
  8479. }
  8480. var scrollPosition = this.grid1.scrollable.position;
  8481. var scrollSize = this.grid1.scrollable.getSize();
  8482. native.saveFile(this.getStateFilename(), {
  8483. selection: selection,
  8484. scrollPosition: scrollPosition,
  8485. scrollSize: scrollSize
  8486. });
  8487. };
  8488. return DictTreeController;
  8489. }());
  8490. function initDict () {
  8491. var controller = new DictTreeController();
  8492. Ext.define('com.yvan.studio.DictTree', {
  8493. extend: 'Ext.panel.Panel',
  8494. xtype: 'dicttree',
  8495. controller: controller,
  8496. scope: controller,
  8497. referenceHolder: true,
  8498. tooltip: '字典',
  8499. iconCls: 'x-fa fa-book',
  8500. rootVisible: false,
  8501. useArrows: true,
  8502. reference: 'dicttree',
  8503. layout: 'border',
  8504. listeners: {
  8505. afterrender: 'onLoad',
  8506. destory: 'onDestory',
  8507. },
  8508. items: [
  8509. {
  8510. region: 'center',
  8511. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  8512. _mode: 'select',
  8513. tbar: [
  8514. {
  8515. xtype: 'button',
  8516. tooltip: '刷新',
  8517. iconCls: 'x-fa fa-refresh',
  8518. listeners: {
  8519. click: 'reload'
  8520. }
  8521. },
  8522. {
  8523. xtype: 'button',
  8524. tooltip: '添加',
  8525. iconCls: 'x-fa fa-plus-circle',
  8526. listeners: {
  8527. click: 'dictAdd'
  8528. }
  8529. },
  8530. {
  8531. xtype: 'button',
  8532. tooltip: '删除',
  8533. iconCls: 'x-fa fa-minus-circle',
  8534. bind: {
  8535. disabled: '{!grid1.selection}'
  8536. },
  8537. listeners: {
  8538. click: 'dictRemove'
  8539. }
  8540. },
  8541. {
  8542. xtype: 'button',
  8543. tooltip: '保存',
  8544. iconCls: 'x-fa fa-save',
  8545. bind: {
  8546. disabled: '{!grid1.ischanged}'
  8547. },
  8548. listeners: {
  8549. click: 'dictSave'
  8550. }
  8551. },
  8552. {
  8553. xtype: 'textfield',
  8554. hideClear: true,
  8555. triggers: {
  8556. clear: {
  8557. cls: 'x-form-clear-trigger',
  8558. handler: 'clearSearch1'
  8559. },
  8560. },
  8561. flex: 1,
  8562. emptyText: '搜索过滤',
  8563. enableKeyEvents: true,
  8564. listeners: {
  8565. keyup: {
  8566. fn: 'search1',
  8567. buffer: 50
  8568. }
  8569. }
  8570. },
  8571. ],
  8572. listeners: {
  8573. itemselect: 'grid1Selected',
  8574. },
  8575. idField: 'dict_code',
  8576. columns: [
  8577. {
  8578. text: '字典编号', dataIndex: 'dict_code',
  8579. menuDisabled: true, flex: 1,
  8580. editor: {
  8581. allowBlank: true,
  8582. selectOnFocus: false
  8583. }
  8584. },
  8585. {
  8586. text: '中文描述', dataIndex: 'dict_desc',
  8587. menuDisabled: true, flex: 1,
  8588. editor: {
  8589. allowBlank: true,
  8590. selectOnFocus: false
  8591. }
  8592. },
  8593. ]
  8594. },
  8595. {
  8596. region: 'south', height: '50%',
  8597. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  8598. split: true,
  8599. _mode: 'edit1',
  8600. listeners: {},
  8601. tbar: [
  8602. {
  8603. xtype: 'button',
  8604. tooltip: '添加',
  8605. iconCls: 'x-fa fa-plus-circle',
  8606. bind: {
  8607. disabled: '{!grid1.selection}'
  8608. },
  8609. listeners: {
  8610. click: 'dictItemAdd'
  8611. }
  8612. },
  8613. {
  8614. xtype: 'button',
  8615. tooltip: '删除',
  8616. iconCls: 'x-fa fa-minus-circle',
  8617. bind: {
  8618. disabled: '{!grid1.selection}'
  8619. },
  8620. listeners: {
  8621. click: 'dictItemRemove'
  8622. }
  8623. },
  8624. {
  8625. xtype: 'button',
  8626. tooltip: '保存',
  8627. iconCls: 'x-fa fa-save',
  8628. bind: {
  8629. disabled: '{!grid2.ischanged}'
  8630. },
  8631. listeners: {
  8632. click: 'dictItemSave'
  8633. }
  8634. },
  8635. {
  8636. xtype: 'button',
  8637. tooltip: '刷新代码',
  8638. iconCls: 'x-fa fa-code',
  8639. bind: {
  8640. disabled: '{!grid1.selection}'
  8641. },
  8642. listeners: {
  8643. click: 'createDictEnum'
  8644. }
  8645. },
  8646. ],
  8647. columns: [
  8648. {
  8649. text: '字典项', dataIndex: 'dict_text',
  8650. menuDisabled: true, flex: 1,
  8651. editor: {
  8652. allowBlank: true,
  8653. selectOnFocus: false
  8654. }
  8655. },
  8656. {
  8657. text: '字典值', dataIndex: 'dict_value',
  8658. menuDisabled: true, flex: 1,
  8659. dataType: 'int',
  8660. editor: {
  8661. xtype: 'numberfield',
  8662. allowBlank: true,
  8663. selectOnFocus: false
  8664. }
  8665. },
  8666. {
  8667. text: '激活', dataIndex: 'is_enable',
  8668. xtype: 'checkcolumn', menuDisabled: true,
  8669. },
  8670. {
  8671. text: '变量名', dataIndex: 'var_name',
  8672. menuDisabled: true, flex: 1,
  8673. editor: {
  8674. allowBlank: true,
  8675. selectOnFocus: false
  8676. }
  8677. },
  8678. ]
  8679. }
  8680. ]
  8681. });
  8682. }
  8683. var model$2 = {
  8684. data: {
  8685. form: {
  8686. path: "",
  8687. requestBody: "",
  8688. responseBody: "",
  8689. }
  8690. }
  8691. };
  8692. var vjson$2 = {
  8693. title: '接口信息',
  8694. layout: 'fit',
  8695. width: 800,
  8696. height: 500,
  8697. items: [
  8698. {
  8699. xtype: 'form',
  8700. layout: {
  8701. type: 'vbox',
  8702. pack: 'start',
  8703. align: 'stretch'
  8704. },
  8705. defaults: {
  8706. border: false,
  8707. anchor: '100%',
  8708. margin: '5',
  8709. },
  8710. items: [
  8711. {
  8712. xtype: 'textfield',
  8713. fieldLabel: '接口路径',
  8714. bind: {
  8715. value: "{form.path}",
  8716. },
  8717. },
  8718. {
  8719. xtype: 'textareafield',
  8720. // height: 150,
  8721. flex: 2,
  8722. fieldLabel: '请求数据',
  8723. bind: {
  8724. value: "{form.requestBody}",
  8725. },
  8726. },
  8727. {
  8728. xtype: 'textareafield',
  8729. // height: 150,
  8730. flex: 5,
  8731. fieldLabel: '响应数据',
  8732. bind: {
  8733. value: "{form.responseBody}",
  8734. },
  8735. },
  8736. ]
  8737. }
  8738. ]
  8739. };
  8740. var ApiInfoDialog = /** @class */ (function (_super) {
  8741. __extends(ApiInfoDialog, _super);
  8742. function ApiInfoDialog() {
  8743. return _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  8744. }
  8745. return ApiInfoDialog;
  8746. }(Scope));
  8747. var model$3 = {
  8748. data: {
  8749. query: {
  8750. role_id: '',
  8751. resource_id: '',
  8752. },
  8753. form: {},
  8754. form2: {
  8755. key: "",
  8756. start_at: "",
  8757. end_at: "",
  8758. }
  8759. }
  8760. };
  8761. var vjson$3 = {
  8762. title: '接口信息',
  8763. layout: 'fit',
  8764. items: [
  8765. {
  8766. layout: 'border',
  8767. border: false,
  8768. items: [
  8769. {
  8770. region: 'center',
  8771. layout: 'border',
  8772. items: [
  8773. {
  8774. region: 'north',
  8775. bind: {
  8776. title: '{form.title}',
  8777. },
  8778. xtype: 'form',
  8779. scrollable: true,
  8780. layout: {
  8781. type: 'vbox',
  8782. pack: 'start',
  8783. align: 'stretch'
  8784. },
  8785. defaults: {
  8786. border: false,
  8787. anchor: '100%',
  8788. margin: '5',
  8789. },
  8790. tbar: {
  8791. xtype: 'toolbar',
  8792. items: [
  8793. {
  8794. xtype: 'button',
  8795. text: '查询',
  8796. iconCls: 'x-fa fa-search',
  8797. listeners: {
  8798. click: 'scope.requestLogs'
  8799. },
  8800. },
  8801. {
  8802. xtype: 'button',
  8803. text: '保存',
  8804. iconCls: 'x-fa fa-save',
  8805. listeners: {},
  8806. },
  8807. {
  8808. xtype: 'button',
  8809. text: '禁用',
  8810. iconCls: 'x-fa fa-stop-circle',
  8811. bind: {},
  8812. listeners: {},
  8813. },
  8814. {
  8815. xtype: 'button',
  8816. text: '启用',
  8817. iconCls: 'x-fa fa-play-circle',
  8818. bind: {},
  8819. listeners: {},
  8820. },
  8821. ],
  8822. },
  8823. items: [
  8824. {
  8825. xtype: 'cols',
  8826. defaults: { labelWidth: 120 },
  8827. items: [
  8828. {
  8829. xtype: 'textfield',
  8830. fieldLabel: 'URL',
  8831. bind: {
  8832. value: '{form.api_url}',
  8833. },
  8834. readOnly: true,
  8835. },
  8836. {
  8837. xtype: 'textfield',
  8838. fieldLabel: '名称',
  8839. bind: {
  8840. value: '{form.api_name}',
  8841. },
  8842. readOnly: true,
  8843. },
  8844. ],
  8845. },
  8846. {
  8847. xtype: 'cols',
  8848. defaults: { labelWidth: 120 },
  8849. items: [
  8850. {
  8851. xtype: 'textfield',
  8852. fieldLabel: '实现类',
  8853. bind: {
  8854. value: '{form.api_class}',
  8855. },
  8856. readOnly: true,
  8857. },
  8858. {
  8859. border: false,
  8860. flex: 1
  8861. },
  8862. ]
  8863. },
  8864. {
  8865. xtype: 'cols',
  8866. defaults: { labelWidth: 120 },
  8867. items: [
  8868. {
  8869. xtype: 'textfield',
  8870. fieldLabel: '超时时间',
  8871. bind: {
  8872. value: '{form.timeout}',
  8873. },
  8874. readOnly: true,
  8875. },
  8876. {
  8877. border: false,
  8878. flex: 1
  8879. },
  8880. ]
  8881. },
  8882. {
  8883. xtype: 'cols',
  8884. defaults: { labelWidth: 120 },
  8885. items: [
  8886. {
  8887. xtype: 'textfield',
  8888. fieldLabel: 'Remote IP',
  8889. bind: {
  8890. value: '{form.remote_ip}',
  8891. },
  8892. readOnly: true,
  8893. },
  8894. {
  8895. border: false,
  8896. flex: 1
  8897. },
  8898. ]
  8899. },
  8900. {
  8901. xtype: 'cols',
  8902. defaults: { labelWidth: 120 },
  8903. items: [
  8904. {
  8905. xtype: 'textfield',
  8906. fieldLabel: '解析表单',
  8907. bind: {
  8908. value: '{form.chandi}',
  8909. },
  8910. readOnly: true,
  8911. },
  8912. {
  8913. border: false,
  8914. flex: 1
  8915. },
  8916. ]
  8917. },
  8918. ],
  8919. },
  8920. {
  8921. region: 'center',
  8922. // title: 'Request',
  8923. layout: 'border',
  8924. items: [
  8925. {
  8926. region: 'north',
  8927. xtype: 'form',
  8928. reference: 'form2',
  8929. split: true,
  8930. items: [
  8931. {
  8932. xtype: 'cols',
  8933. width: 700,
  8934. items: [
  8935. {
  8936. xtype: 'textfield',
  8937. fieldLabel: '关键字',
  8938. bind: {
  8939. value: "{form2.key}"
  8940. },
  8941. },
  8942. {
  8943. xtype: 'datefield',
  8944. fieldLabel: '开始时间',
  8945. bind: {
  8946. value: "{form2.start_at}"
  8947. },
  8948. },
  8949. {
  8950. xtype: 'datefield',
  8951. fieldLabel: '结束时间',
  8952. bind: {
  8953. value: "{form2.end_at}"
  8954. },
  8955. },
  8956. ]
  8957. }
  8958. ]
  8959. },
  8960. {
  8961. region: 'center',
  8962. xtype: 'yvgrid',
  8963. layout: 'fit',
  8964. reference: 'grid1',
  8965. pagination: true,
  8966. autoLoad: false,
  8967. selModel: {
  8968. selType: 'rowmodel',
  8969. mode: 'SINGLE',
  8970. },
  8971. dataSource: {
  8972. method: 'invoke',
  8973. url: '/sys/api/Api@requestLogs',
  8974. params: {
  8975. formData: '{form2}',
  8976. path: '{form.api_url}',
  8977. },
  8978. },
  8979. listeners: {
  8980. rowdblclick: 'scope.showDialog',
  8981. },
  8982. columns: [
  8983. { dataIndex: "@timestamp", header: "时间", width: 150 },
  8984. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  8985. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  8986. { dataIndex: "size", header: "大小", width: 80 },
  8987. { dataIndex: "path", header: "path", flex: 1 },
  8988. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  8989. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  8990. ]
  8991. }
  8992. ]
  8993. },
  8994. ],
  8995. },
  8996. ],
  8997. },
  8998. ],
  8999. referenceHolder: true,
  9000. };
  9001. var Api = /** @class */ (function (_super) {
  9002. __extends(Api, _super);
  9003. function Api() {
  9004. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  9005. }
  9006. Api.prototype.onLoad = function () {
  9007. _super.prototype.onLoad.call(this);
  9008. this.requestLogs();
  9009. };
  9010. Api.prototype.selectList = function (sender, selected, eOpts) {
  9011. this.viewModel.set("form", selected.data);
  9012. if (selected.data.api_type === '1') {
  9013. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  9014. }
  9015. else {
  9016. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  9017. }
  9018. };
  9019. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  9020. var sel = [];
  9021. _$2.forEach(records, function (item) {
  9022. if (item.data.flg === 'Y') {
  9023. sel.push(item);
  9024. }
  9025. });
  9026. this.refs.methodGrid.selModel.select(sel);
  9027. };
  9028. Api.prototype.saveAll = function () {
  9029. var _this = this;
  9030. var _a, _b, _c;
  9031. var role_id = this.viewModel.get("query.role_id");
  9032. if (!role_id) {
  9033. msg$1("请先选择一个角色");
  9034. return;
  9035. }
  9036. var wh_id = this.viewModel.get("form.wh_id");
  9037. if (!wh_id) {
  9038. msg$1("请先选择一个仓库");
  9039. return;
  9040. }
  9041. var menus = this.refs.theTree.getChecked();
  9042. var rowsMenus = [];
  9043. _$2.forEach(menus, function (m) {
  9044. if (m.data.resource_id) {
  9045. rowsMenus.push(m.data.resource_id);
  9046. }
  9047. });
  9048. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  9049. 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; });
  9050. _$2.remove(mm, function (x) {
  9051. return methodsArry.includes(x.resource_id);
  9052. });
  9053. var rowsBtn = [];
  9054. _$2.forEach(mm, function (m) {
  9055. rowsBtn.push({ resource_id: m.resource_id });
  9056. });
  9057. this.setLoading(true);
  9058. invokeServer$1('/sys/role/Role@saveAll', {
  9059. wh_id: wh_id,
  9060. role_id: role_id,
  9061. rowsMenus: rowsMenus,
  9062. rowsBtn: rowsBtn,
  9063. }).then(function (res) {
  9064. msg$1(res.msg);
  9065. if (res.success) {
  9066. _this.reloadTree();
  9067. // this.viewModel.set('query.role_id', '')
  9068. _this.viewModel.set('query.resource_id', '');
  9069. _this.refs.methodGrid.reload();
  9070. }
  9071. }).finally(function () {
  9072. _this.setLoading(false);
  9073. });
  9074. };
  9075. Api.prototype.editRoleSuccess = function (sender, data) {
  9076. if (data.success) {
  9077. this.refs.roleGrid.reload();
  9078. this.viewModel.set("query.JIAOS_ID", "");
  9079. this.reloadTree();
  9080. this.viewModel.set("query.CAID_ID", "");
  9081. this.refs.methodGrid.reload();
  9082. }
  9083. };
  9084. Api.prototype.deleteRole = function (sender) {
  9085. var _this = this;
  9086. var role_id = this.viewModel.get("query.role_id");
  9087. if (!role_id) {
  9088. msg$1("请先选择一个角色");
  9089. return;
  9090. }
  9091. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  9092. if (btn === 'yes') {
  9093. invokeServer$1('/sys/role/Role@deleteRole', {
  9094. role_id: role_id,
  9095. wh_id: window['whId']
  9096. }).then(function (res) {
  9097. msg$1(res.msg);
  9098. if (res.success) {
  9099. _this.refs.roleGrid.reload();
  9100. _this.viewModel.set("query.role_id", "");
  9101. _this.reloadTree();
  9102. _this.refs.methodGrid.reload();
  9103. }
  9104. });
  9105. }
  9106. });
  9107. };
  9108. Api.prototype.reloadTree = function () {
  9109. showErrorDialog$1('reloadTree 不存在');
  9110. };
  9111. Api.prototype.whChange = function (sender, value) {
  9112. this.viewModel.set("form.wh_id", value);
  9113. this.reloadTree();
  9114. this.refs.methodGrid.reload();
  9115. };
  9116. Api.prototype.requestLogs = function () {
  9117. var path = this.viewModel.get("form.api_url");
  9118. if (!path)
  9119. return;
  9120. this.refs.grid1.reload();
  9121. };
  9122. Api.prototype.showDialog = function (sender) {
  9123. var _a, _b;
  9124. 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; });
  9125. if (!rows || rows.length <= 0)
  9126. return;
  9127. var dialog = new ApiInfoDialog();
  9128. dialog.showDialog(null, {}, {
  9129. data: {
  9130. form: __assign({}, rows[0])
  9131. }
  9132. });
  9133. };
  9134. return Api;
  9135. }(Scope));
  9136. var Controller = /** @class */ (function () {
  9137. function Controller() {
  9138. }
  9139. Controller.prototype.selectList = function (sender, selected, eOpts) {
  9140. var _a, _b, _c, _d, _e, _f, _g, _h;
  9141. // @ts-ignore
  9142. 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; });
  9143. if (!rows || rows.length <= 0)
  9144. return;
  9145. var apiPage = new Api();
  9146. apiPage.showPage({
  9147. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  9148. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  9149. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  9150. }, {
  9151. data: {
  9152. form: __assign({}, rows[0])
  9153. }
  9154. });
  9155. };
  9156. return Controller;
  9157. }());
  9158. var controller = new Controller();
  9159. function initApiTree () {
  9160. Ext.define('com.yvan.studio.ApiGrid', {
  9161. extend: 'Ext.Panel',
  9162. xtype: 'apigrid',
  9163. controller: controller,
  9164. scope: controller,
  9165. referenceHolder: true,
  9166. layout: 'fit',
  9167. items: [
  9168. {
  9169. width: 400,
  9170. split: true,
  9171. xtype: 'yvgrid',
  9172. reference: 'roleGrid',
  9173. border: false,
  9174. pagination: false,
  9175. autoLoad: true,
  9176. remoteFilter: false,
  9177. selModel: {
  9178. selType: 'rowmodel',
  9179. mode: 'SINGLE',
  9180. },
  9181. tbar: {
  9182. xtype: 'toolbar',
  9183. items: [
  9184. {
  9185. xtype: 'button',
  9186. text: '新增',
  9187. iconCls: 'x-fa fa-plus-circle',
  9188. listeners: {},
  9189. },
  9190. {
  9191. xtype: 'button',
  9192. text: '删除',
  9193. iconCls: 'x-fa fa-trash',
  9194. bind: {
  9195. disabled: '{roleGrid.selection==null}',
  9196. },
  9197. listeners: {},
  9198. },
  9199. ],
  9200. },
  9201. dataSource: {
  9202. url: '/sys/api/Api@getApiList',
  9203. method: 'invoke',
  9204. params: {},
  9205. },
  9206. listeners: {
  9207. itemdblclick: "selectList",
  9208. },
  9209. columns: [
  9210. {
  9211. dataIndex: 'api_name',
  9212. header: '接口名称',
  9213. filter: { type: 'string' },
  9214. flex: 1,
  9215. },
  9216. ],
  9217. },
  9218. ]
  9219. });
  9220. }
  9221. var model$4 = {
  9222. data: {
  9223. iframeSrc: ''
  9224. }
  9225. };
  9226. var vjson$4 = {
  9227. layout: 'fit',
  9228. border: false,
  9229. iconCls: 'x-fa fa-newspaper-o',
  9230. referenceHolder: true,
  9231. items: [
  9232. {
  9233. // title: 'view.design',
  9234. xtype: 'uxiframe',
  9235. layout: 'fit',
  9236. // cls: 'module_page_iframe',
  9237. reference: 'iframe',
  9238. listeners: {
  9239. afterrender: 'scope.iframeRender'
  9240. }
  9241. },
  9242. ]
  9243. };
  9244. var Iframe = /** @class */ (function (_super) {
  9245. __extends(Iframe, _super);
  9246. function Iframe(path) {
  9247. var _this = _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  9248. _this.path = "";
  9249. _this.path = path;
  9250. return _this;
  9251. }
  9252. Iframe.prototype.iframeRender = function (sender) {
  9253. var $dom = $(sender.el.dom).find('iframe');
  9254. var iframe = $dom[0];
  9255. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  9256. iframe.onload = function () {
  9257. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  9258. };
  9259. };
  9260. return Iframe;
  9261. }(Scope));
  9262. var Controller$1 = /** @class */ (function () {
  9263. function Controller() {
  9264. }
  9265. Controller.prototype.onDblClick = function (sender, record) {
  9266. var data = record.raw;
  9267. if (data.text === "运行报表") {
  9268. this.openIframe("/xxl-job/index", "运行报表");
  9269. }
  9270. else if (data.text === "任务管理") {
  9271. this.openIframe("/xxl-job/jobinfo", "任务管理");
  9272. }
  9273. else if (data.text === "调度日志") {
  9274. this.openIframe("/xxl-job/joblog", "调度日志");
  9275. }
  9276. else if (data.text === "执行器管理") {
  9277. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  9278. }
  9279. };
  9280. Controller.prototype.openIframe = function (path, title) {
  9281. var page = new Iframe(path);
  9282. page.showPage({
  9283. title: title,
  9284. id: 'xxljob__' + path.replaceAll("/", "_"),
  9285. path: 'xxljob__' + path.replaceAll("/", "_"),
  9286. }, {});
  9287. };
  9288. Controller.prototype.onLoad = function () {
  9289. var me = this;
  9290. me.getView().setRootNode({
  9291. expanded: true,
  9292. leaf: false,
  9293. children: [
  9294. { leaf: true, text: '运行报表' },
  9295. { leaf: true, text: '任务管理' },
  9296. { leaf: true, text: '调度日志' },
  9297. { leaf: true, text: '执行器管理' },
  9298. ]
  9299. });
  9300. };
  9301. return Controller;
  9302. }());
  9303. var controller$1 = new Controller$1();
  9304. function initTaskTree () {
  9305. Ext.define('com.yvan.studio.TaskTree', {
  9306. extend: 'Ext.tree.Panel',
  9307. xtype: 'tasktree',
  9308. controller: controller$1,
  9309. scope: controller$1,
  9310. reference: 'roleGrid',
  9311. tooltip: '表单定义',
  9312. iconCls: 'x-fa fa-bar-chart',
  9313. useArrows: true,
  9314. rootVisible: false,
  9315. colspan: 2,
  9316. lines: true,
  9317. multiSelect: false,
  9318. referenceHolder: true,
  9319. // openNode() {
  9320. // const selection = this.getSelection()
  9321. // const [record] = selection
  9322. // if (!record) {
  9323. // return
  9324. // }
  9325. //
  9326. // const {raw} = record;
  9327. // if (raw.type === 'Dir') {
  9328. // return
  9329. // }
  9330. // if (raw.type === "Module" && raw.module) {
  9331. // // eventBus.publish(EventType.ModuleOpen, raw)
  9332. // }
  9333. // },
  9334. listeners: {
  9335. itemdblclick: 'onDblClick',
  9336. afterrender: "onLoad",
  9337. },
  9338. });
  9339. }
  9340. var model$5 = {
  9341. data: {
  9342. form: {
  9343. address: "",
  9344. level: "",
  9345. logger: "",
  9346. message: "",
  9347. nodeName: "",
  9348. serverName: "",
  9349. thread: "",
  9350. whId: "",
  9351. userId: "",
  9352. }
  9353. }
  9354. };
  9355. var vjson$5 = {
  9356. title: '接口信息',
  9357. layout: 'fit',
  9358. width: 800,
  9359. height: 600,
  9360. items: [
  9361. {
  9362. xtype: 'form',
  9363. layout: {
  9364. type: 'vbox',
  9365. pack: 'start',
  9366. align: 'stretch'
  9367. },
  9368. defaults: {
  9369. border: false,
  9370. anchor: '100%',
  9371. margin: '5',
  9372. },
  9373. items: [
  9374. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  9375. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  9376. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  9377. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  9378. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  9379. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  9380. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  9381. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  9382. {
  9383. xtype: 'textareafield',
  9384. flex: 5,
  9385. fieldLabel: '响应数据',
  9386. bind: {
  9387. value: "{form.message}",
  9388. },
  9389. },
  9390. ]
  9391. }
  9392. ]
  9393. };
  9394. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  9395. __extends(ApiInfoDialog, _super);
  9396. function ApiInfoDialog() {
  9397. return _super.call(this, { model: model$5, vjson: vjson$5 }) || this;
  9398. }
  9399. return ApiInfoDialog;
  9400. }(Scope));
  9401. var model$6 = {
  9402. data: {
  9403. form2: {}
  9404. }
  9405. };
  9406. var vjson$6 = {
  9407. title: '日志查询',
  9408. layout: 'fit',
  9409. width: "70%",
  9410. height: "80%",
  9411. items: [
  9412. {
  9413. region: 'center',
  9414. xtype: 'yvgrid',
  9415. layout: 'fit',
  9416. reference: 'grid1',
  9417. pagination: false,
  9418. autoLoad: false,
  9419. selModel: {
  9420. selType: 'rowmodel',
  9421. mode: 'SINGLE',
  9422. },
  9423. dataSource: {
  9424. method: 'invoke',
  9425. url: '/sys/api/Api@aroundLogs',
  9426. params: {
  9427. formData: '{form2}',
  9428. },
  9429. },
  9430. listeners: {
  9431. rowdblclick: 'scope.showDialog2',
  9432. },
  9433. columns: [
  9434. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9435. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  9436. { dataIndex: "thread", header: "thread", width: 150 },
  9437. { dataIndex: "message", header: "message", flex: 1 },
  9438. ]
  9439. }
  9440. ]
  9441. };
  9442. var AroundLog = /** @class */ (function (_super) {
  9443. __extends(AroundLog, _super);
  9444. function AroundLog() {
  9445. return _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  9446. }
  9447. AroundLog.prototype.onLoad = function () {
  9448. _super.prototype.onLoad.call(this);
  9449. this.queryLog();
  9450. };
  9451. AroundLog.prototype.queryLog = function () {
  9452. this.refs.grid1.reload();
  9453. };
  9454. AroundLog.prototype.showDialog2 = function () {
  9455. var _a, _b;
  9456. 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; });
  9457. if (!rows || rows.length <= 0)
  9458. return;
  9459. var dialog = new ApiInfoDialog$1();
  9460. dialog.showDialog(null, {}, {
  9461. data: {
  9462. form: __assign({}, rows[0])
  9463. }
  9464. });
  9465. };
  9466. return AroundLog;
  9467. }(Scope));
  9468. var model$7 = {
  9469. data: {
  9470. form2: {
  9471. key: "",
  9472. start_at: "",
  9473. end_at: "",
  9474. }
  9475. }
  9476. };
  9477. var vjson$7 = {
  9478. title: '日志查询',
  9479. layout: 'fit',
  9480. tbar: {
  9481. xtype: 'toolbar',
  9482. items: [
  9483. {
  9484. xtype: 'button',
  9485. text: '刷新',
  9486. listeners: {
  9487. click: 'scope.queryLog'
  9488. },
  9489. },
  9490. {
  9491. xtype: 'button',
  9492. text: '周围日志',
  9493. bind: {},
  9494. listeners: {
  9495. click: 'scope.aroundLogs'
  9496. },
  9497. },
  9498. ],
  9499. },
  9500. items: [
  9501. {
  9502. region: 'center',
  9503. xtype: 'yvgrid',
  9504. layout: 'fit',
  9505. reference: 'grid1',
  9506. pagination: true,
  9507. autoLoad: false,
  9508. selModel: {
  9509. selType: 'rowmodel',
  9510. mode: 'SINGLE',
  9511. },
  9512. dataSource: {
  9513. method: 'invoke',
  9514. url: '/sys/api/Api@queryLog',
  9515. params: {
  9516. formData: '{form2}',
  9517. path: '{form.api_url}',
  9518. },
  9519. },
  9520. listeners: {
  9521. rowdblclick: 'scope.showDialog',
  9522. },
  9523. columns: [
  9524. { dataIndex: "@timestamp", header: "时间", width: 150 },
  9525. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  9526. { dataIndex: "thread", header: "thread", width: 150 },
  9527. { dataIndex: "message", header: "message", flex: 1 },
  9528. ]
  9529. }
  9530. ]
  9531. };
  9532. var LogPage = /** @class */ (function (_super) {
  9533. __extends(LogPage, _super);
  9534. function LogPage() {
  9535. return _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  9536. }
  9537. LogPage.prototype.onLoad = function () {
  9538. _super.prototype.onLoad.call(this);
  9539. this.queryLog();
  9540. };
  9541. LogPage.prototype.queryLog = function () {
  9542. this.refs.grid1.reload();
  9543. };
  9544. LogPage.prototype.showDialog = function () {
  9545. var _a, _b;
  9546. 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; });
  9547. if (!rows || rows.length <= 0)
  9548. return;
  9549. var dialog = new ApiInfoDialog$1();
  9550. dialog.showDialog(null, {}, {
  9551. data: {
  9552. form: __assign({}, rows[0])
  9553. }
  9554. });
  9555. };
  9556. LogPage.prototype.aroundLogs = function () {
  9557. var _a, _b;
  9558. 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; });
  9559. if (!rows || rows.length <= 0)
  9560. return;
  9561. var dialog = new AroundLog();
  9562. dialog.showDialog(null, {}, {
  9563. data: {
  9564. form2: __assign({}, rows[0])
  9565. }
  9566. });
  9567. };
  9568. return LogPage;
  9569. }(Scope));
  9570. var Controller$2 = /** @class */ (function () {
  9571. function Controller() {
  9572. }
  9573. Controller.prototype.queryLog = function () {
  9574. var form2 = this.getViewModel().get("form2");
  9575. var logPage = new LogPage();
  9576. logPage.showPage({}, {
  9577. data: {
  9578. form2: __assign({}, form2)
  9579. }
  9580. });
  9581. };
  9582. return Controller;
  9583. }());
  9584. var controller$2 = new Controller$2();
  9585. function initLogsTree () {
  9586. Ext.define('com.yvan.studio.LogsTree', {
  9587. extend: 'Ext.panel.Panel',
  9588. xtype: 'logstree',
  9589. controller: controller$2,
  9590. scope: controller$2,
  9591. viewModel: {
  9592. data: {
  9593. form2: {
  9594. key: "",
  9595. start_at: "",
  9596. end_at: "",
  9597. }
  9598. }
  9599. },
  9600. reference: 'logstree',
  9601. tooltip: '表单定义',
  9602. iconCls: 'x-fa fa-bar-chart',
  9603. useArrows: true,
  9604. rootVisible: false,
  9605. colspan: 2,
  9606. lines: true,
  9607. multiSelect: false,
  9608. referenceHolder: true,
  9609. items: [
  9610. {
  9611. region: 'north',
  9612. xtype: 'form',
  9613. reference: 'form2',
  9614. split: true,
  9615. items: [
  9616. {
  9617. xtype: 'textfield',
  9618. fieldLabel: '关键字',
  9619. bind: {
  9620. value: "{form2.key}"
  9621. },
  9622. },
  9623. {
  9624. xtype: 'datefield',
  9625. fieldLabel: '开始时间',
  9626. bind: {
  9627. value: "{form2.start_at}"
  9628. },
  9629. },
  9630. {
  9631. xtype: 'datefield',
  9632. fieldLabel: '结束时间',
  9633. bind: {
  9634. value: "{form2.end_at}"
  9635. },
  9636. },
  9637. ]
  9638. },
  9639. {
  9640. xtype: "cols",
  9641. items: [
  9642. {
  9643. xtype: "box",
  9644. },
  9645. {
  9646. xtype: "button",
  9647. text: '查询',
  9648. listeners: {
  9649. click: 'queryLog'
  9650. },
  9651. },
  9652. {
  9653. xtype: "box",
  9654. },
  9655. ]
  9656. },
  9657. ],
  9658. });
  9659. }
  9660. var model$8 = {
  9661. data: {
  9662. // opsId: "",
  9663. // name: "",
  9664. running: false,
  9665. }
  9666. };
  9667. var vjson$8 = {
  9668. bind: {
  9669. title: '运维-{name}',
  9670. },
  9671. layout: 'fit',
  9672. items: [
  9673. {
  9674. layout: 'border',
  9675. items: [
  9676. {
  9677. region: 'north',
  9678. items: [
  9679. {
  9680. xtype: 'toolbar',
  9681. border: false,
  9682. items: [
  9683. {
  9684. xtype: 'button',
  9685. text: '执行',
  9686. iconCls: 'x-fa fa-play',
  9687. bind: {
  9688. hidden: "{running}",
  9689. },
  9690. listeners: {
  9691. click: 'scope.start'
  9692. }
  9693. },
  9694. {
  9695. xtype: 'button',
  9696. text: '停止',
  9697. iconCls: 'x-fa fa-stop',
  9698. bind: {
  9699. hidden: "{!running}",
  9700. },
  9701. listeners: {
  9702. click: 'scope.stop'
  9703. }
  9704. },
  9705. ],
  9706. },
  9707. ]
  9708. },
  9709. {
  9710. region: 'center',
  9711. reference: 'terminal',
  9712. xtype: 'terminal',
  9713. },
  9714. ],
  9715. },
  9716. ],
  9717. };
  9718. var DevOpsTerminal = /** @class */ (function (_super) {
  9719. __extends(DevOpsTerminal, _super);
  9720. function DevOpsTerminal() {
  9721. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  9722. _this.websocket = undefined;
  9723. return _this;
  9724. }
  9725. DevOpsTerminal.prototype.onLoad = function () {
  9726. this.load();
  9727. };
  9728. DevOpsTerminal.prototype.onDestroy = function () {
  9729. if (this.websocket) {
  9730. this.websocket.close();
  9731. this.websocket = undefined;
  9732. }
  9733. };
  9734. DevOpsTerminal.prototype.load = function () {
  9735. var _this = this;
  9736. var opsId = this.viewModel.get('opsId');
  9737. this.setLoading(true);
  9738. devOpsById(opsId).then(function (res) {
  9739. _this.viewModel.set('devOps', res.data);
  9740. }).finally(function () {
  9741. _this.setLoading(false);
  9742. });
  9743. };
  9744. DevOpsTerminal.prototype.start = function () {
  9745. var me = this;
  9746. var running = this.viewModel.get('running');
  9747. var devOps = this.viewModel.get('devOps');
  9748. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  9749. return;
  9750. var devopsServer = "ws://122.9.140.63:9999";
  9751. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  9752. this.websocket.addEventListener('open', function () {
  9753. me.viewModel.set('running', true);
  9754. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  9755. });
  9756. this.websocket.addEventListener('message', function (event) {
  9757. me.refs.terminal.write(event.data);
  9758. });
  9759. this.websocket.addEventListener('close', function () {
  9760. me.stop();
  9761. });
  9762. this.websocket.addEventListener('error', function () {
  9763. me.stop();
  9764. });
  9765. };
  9766. DevOpsTerminal.prototype.stop = function () {
  9767. if (this.websocket) {
  9768. this.websocket.close();
  9769. this.websocket = undefined;
  9770. }
  9771. this.viewModel.set('running', false);
  9772. };
  9773. return DevOpsTerminal;
  9774. }(Scope));
  9775. var Controller$3 = /** @class */ (function () {
  9776. function Controller() {
  9777. }
  9778. Controller.prototype.onLoad = function (sender) {
  9779. this.reload();
  9780. };
  9781. Controller.prototype.reload = function () {
  9782. var me = this;
  9783. // @ts-ignore
  9784. var view = me.getView();
  9785. view.setLoading(true);
  9786. devOpsList().then(function (res) {
  9787. view.setStore(new Ext.data.Store({
  9788. fields: ['ops_id', 'host', 'name'],
  9789. data: res.data,
  9790. }));
  9791. }).finally(function () {
  9792. view.setLoading(false);
  9793. });
  9794. };
  9795. Controller.prototype.onDblClick = function (sender) {
  9796. this.devOpsTerminal();
  9797. };
  9798. Controller.prototype.devOpsTerminal = function () {
  9799. // @ts-ignore
  9800. var view = this.getView();
  9801. var _a = __read(view.getSelection(), 1), record = _a[0];
  9802. if (record) {
  9803. var name = record.get('name');
  9804. var opsId = record.get('ops_id');
  9805. var instance = new DevOpsTerminal();
  9806. instance.showPage({
  9807. id: 'ops_' + opsId,
  9808. path: 'ops_' + opsId,
  9809. }, {
  9810. data: {
  9811. opsId: opsId,
  9812. name: name,
  9813. }
  9814. });
  9815. instance.dialogSuccess = function () {
  9816. };
  9817. }
  9818. };
  9819. return Controller;
  9820. }());
  9821. var controller$3 = new Controller$3();
  9822. function initDevOpsTree () {
  9823. Ext.define('com.yvan.studio.DevOpsGrid', {
  9824. extend: 'Ext.grid.Panel',
  9825. xtype: 'devopsgrid',
  9826. controller: controller$3,
  9827. scope: controller$3,
  9828. referenceHolder: true,
  9829. tooltip: '运维',
  9830. iconCls: 'x-fa fa-terminal',
  9831. useArrows: true,
  9832. reference: 'devopsgrid',
  9833. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  9834. listeners: {
  9835. afterrender: 'onLoad',
  9836. itemdblclick: 'onDblClick',
  9837. },
  9838. viewConfig: {
  9839. // listeners: {
  9840. // itemcontextmenu: 'onGridContextMenu',
  9841. // },
  9842. },
  9843. tbar: {
  9844. xtype: 'toolbar',
  9845. items: [
  9846. {
  9847. xtype: 'button',
  9848. tooltip: '刷新',
  9849. iconCls: 'x-fa fa-refresh',
  9850. listeners: {
  9851. click: 'reload'
  9852. }
  9853. },
  9854. {
  9855. xtype: 'textfield',
  9856. flex: 1,
  9857. emptyText: '搜索过滤',
  9858. enableKeyEvents: true,
  9859. listeners: {
  9860. change: {
  9861. fn: 'filterChanged',
  9862. buffer: 50
  9863. }
  9864. }
  9865. },
  9866. ]
  9867. },
  9868. columns: [
  9869. {
  9870. text: 'ID', dataIndex: 'report_id',
  9871. hidden: true,
  9872. },
  9873. {
  9874. text: '服务器',
  9875. dataIndex: 'host',
  9876. width: 100,
  9877. menuDisabled: true,
  9878. },
  9879. {
  9880. text: '操作名称',
  9881. dataIndex: 'name',
  9882. flex: 1,
  9883. menuDisabled: true,
  9884. },
  9885. ]
  9886. });
  9887. }
  9888. function initTerminal () {
  9889. Ext.define('com.yvan.studio.Terminal', {
  9890. extend: 'Ext.panel.Panel',
  9891. alias: 'widget.terminal',
  9892. xtype: 'terminal',
  9893. layout: 'fit',
  9894. border: false,
  9895. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  9896. config: {},
  9897. write: function (str) {
  9898. if (this.term) {
  9899. this.term.write(str);
  9900. }
  9901. },
  9902. initComponent: function () {
  9903. var that = this;
  9904. this.superclass.initComponent.call(this, arguments);
  9905. that.on({
  9906. resize: function () {
  9907. var _a;
  9908. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  9909. that.fitAddon.fit();
  9910. }
  9911. },
  9912. destory: function () {
  9913. if (that.term) {
  9914. that.term.dispose();
  9915. delete that.term;
  9916. }
  9917. if (that.fitAddon) {
  9918. that.fitAddon.dispose();
  9919. delete that.fitAddon;
  9920. }
  9921. },
  9922. afterrender: function (sender) {
  9923. _.defer(function () {
  9924. var $dom = $(that.el.dom).find('.terminal');
  9925. that.term = new xterm.Terminal({
  9926. // cursorBlink: false,
  9927. // cursorStyle: 'bar', // block underline bar
  9928. // enableBold: false,
  9929. // bellStyle: "sound",
  9930. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  9931. // scrollback: 10000,
  9932. // tabStopWidth: 4,
  9933. disableStdin: true,
  9934. theme: {
  9935. // foreground: "#111",
  9936. // background: "#fdfdfd",
  9937. // background: "#fafafa",
  9938. },
  9939. });
  9940. that.fitAddon = new xtermAddonFit.FitAddon();
  9941. that.term.loadAddon(that.fitAddon);
  9942. that.term.open($dom[0]);
  9943. that.fitAddon.fit();
  9944. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  9945. });
  9946. }
  9947. });
  9948. }
  9949. });
  9950. }
  9951. var vjson$9 = {
  9952. title: '接口统计',
  9953. layout: 'fit',
  9954. items: [
  9955. {
  9956. title: '接口统计',
  9957. xtype: 'yvgrid',
  9958. enableLocking: false,
  9959. reference: 'grid1',
  9960. pagination: false,
  9961. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  9962. tbar: {
  9963. xtype: 'form',
  9964. items: [
  9965. {
  9966. xtype: 'cols',
  9967. items: [
  9968. {
  9969. xtype: 'textfield',
  9970. fieldLabel: '搜索',
  9971. listeners: {
  9972. change: 'scope.requestFilterChange'
  9973. }
  9974. },
  9975. ]
  9976. },
  9977. ]
  9978. },
  9979. columns: [
  9980. { text: '地址', dataIndex: 'url', flex: 1 },
  9981. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  9982. { text: '次数', dataIndex: 'count', dataType: 'number' },
  9983. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  9984. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  9985. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  9986. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  9987. { text: '直方图', dataIndex: 'histogram', width: 180 },
  9988. ],
  9989. leadingBufferZone: 8,
  9990. trailingBufferZone: 8,
  9991. viewConfig: {
  9992. listeners: {
  9993. expandbody: 'scope.onChildExpand'
  9994. }
  9995. },
  9996. listeners: {
  9997. itemdblclick: 'scope.itemClick1'
  9998. },
  9999. plugins: {
  10000. rowwidget: {
  10001. widget: {
  10002. xtype: 'yvgrid',
  10003. hideFootbar: true,
  10004. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10005. listeners: {
  10006. itemdblclick: 'scope.itemClick1'
  10007. },
  10008. columns: [
  10009. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  10010. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10011. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10012. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10013. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10014. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10015. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10016. ]
  10017. }
  10018. }
  10019. }
  10020. },
  10021. ]
  10022. };
  10023. var model$9 = {
  10024. data: {
  10025. count: 0,
  10026. dataSourceName: '',
  10027. sql: "",
  10028. histogram: '',
  10029. maxCost: 0,
  10030. minCost: 0,
  10031. avgCost: '',
  10032. sumCost: 0,
  10033. histogramInfos: [
  10034. // count: 1
  10035. // gteCost: 20
  10036. // ltCost: 50
  10037. // 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"
  10038. // topN: [
  10039. // cost: 24
  10040. // occurrenceTime: "1648004895171"
  10041. // 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"
  10042. // ]
  10043. ]
  10044. }
  10045. };
  10046. var vjson$a = {
  10047. title: '性能统计详情',
  10048. height: 400,
  10049. width: 800,
  10050. modal: true,
  10051. layout: 'fit',
  10052. items: [
  10053. {
  10054. xtype: 'tabpanel',
  10055. items: [
  10056. {
  10057. title: '摘要',
  10058. key: "1",
  10059. layout: 'border',
  10060. items: [
  10061. {
  10062. region: 'north',
  10063. border: false,
  10064. defaults: {
  10065. margin: '8 0 0 0'
  10066. },
  10067. items: [
  10068. {
  10069. xtype: 'cols',
  10070. defaultType: 'displayfield',
  10071. defaults: {
  10072. labelWidth: 70,
  10073. },
  10074. items: [
  10075. {
  10076. fieldLabel: 'count',
  10077. bind: {
  10078. value: '{count}'
  10079. }
  10080. },
  10081. {
  10082. fieldLabel: 'maxCost',
  10083. bind: {
  10084. value: '{maxCost}'
  10085. }
  10086. },
  10087. {
  10088. fieldLabel: 'minCost',
  10089. bind: {
  10090. value: '{minCost}'
  10091. }
  10092. },
  10093. {
  10094. fieldLabel: 'avgCost',
  10095. bind: {
  10096. value: '{avgCost}'
  10097. }
  10098. },
  10099. {
  10100. fieldLabel: 'sumCost',
  10101. bind: {
  10102. value: '{sumCost}'
  10103. }
  10104. },
  10105. ]
  10106. },
  10107. {
  10108. xtype: 'cols',
  10109. items: [
  10110. {
  10111. flex: 5,
  10112. border: false,
  10113. items: [
  10114. {
  10115. xtype: 'segmentedbutton',
  10116. reference: 'histogram',
  10117. allowToggle: false,
  10118. border: false,
  10119. items: []
  10120. }
  10121. ]
  10122. },
  10123. ]
  10124. },
  10125. ],
  10126. },
  10127. {
  10128. region: 'center',
  10129. xtype: 'sqleditor',
  10130. reference: 'sqlEditor',
  10131. },
  10132. ]
  10133. },
  10134. {
  10135. title: '直方图',
  10136. key: "2",
  10137. }
  10138. ]
  10139. }
  10140. ]
  10141. };
  10142. var PerformDialog = /** @class */ (function (_super) {
  10143. __extends(PerformDialog, _super);
  10144. function PerformDialog() {
  10145. return _super.call(this, { model: model$9, vjson: vjson$a }) || this;
  10146. }
  10147. PerformDialog.prototype.onLoad = function () {
  10148. var _this = this;
  10149. var sql = this.viewModel.get('sql');
  10150. var sql2 = sqlFormat.format(sql, {
  10151. indent: ' ',
  10152. uppercase: true,
  10153. });
  10154. var histogramInfos = this.viewModel.get('histogramInfos');
  10155. var vs = _$2.map(histogramInfos, function (v) {
  10156. if (v.ltCost > 2100000000) {
  10157. return {
  10158. text: "[" + v.gteCost + ", \u221E):" + v.count
  10159. };
  10160. }
  10161. return {
  10162. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  10163. };
  10164. });
  10165. this.refs.sqlEditor.setCode(sql2);
  10166. _$2.forEach(vs, function (v) {
  10167. _this.refs.histogram.add(v);
  10168. });
  10169. };
  10170. return PerformDialog;
  10171. }(Scope));
  10172. var model$a = {
  10173. data: {}
  10174. };
  10175. var PerformStats = /** @class */ (function (_super) {
  10176. __extends(PerformStats, _super);
  10177. function PerformStats() {
  10178. var _this = _super.call(this, { model: model$a, vjson: vjson$9 }) || this;
  10179. _this.requestFilterChange = _.debounce(function (sender, value) {
  10180. var store = _this.refs.grid1.store;
  10181. store.clearFilter();
  10182. if (value) {
  10183. store.filterBy(function (record, id) {
  10184. var text = toString(record.get('url'));
  10185. // 用拼音筛选的方式
  10186. return text.includes(value);
  10187. });
  10188. }
  10189. }, 100);
  10190. return _this;
  10191. }
  10192. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  10193. widget.setData(record.data.children);
  10194. };
  10195. PerformStats.prototype.itemClick1 = function (sender, record) {
  10196. console.log('itemClick1', record.data);
  10197. new PerformDialog().showDialog(sender, {}, {
  10198. data: record.data
  10199. });
  10200. };
  10201. PerformStats.prototype.onLoad = function () {
  10202. var _this = this;
  10203. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  10204. .then(function (_a) {
  10205. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  10206. var resData = reqRes.data;
  10207. var jdbcData = jdbcRes.data;
  10208. _.forEach(jdbcData, function (item) {
  10209. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10210. });
  10211. _.forEach(resData, function (item) {
  10212. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10213. if (_.isArray(item.sqls)) {
  10214. item.children = _.map(item.sqls, function (sql) {
  10215. return _.find(jdbcData, function (r) { return r.sql === sql; });
  10216. }).filter(function (v) { return !!v; });
  10217. }
  10218. item.jdbcCount = _.size(item.children);
  10219. });
  10220. _this.refs.grid1.setData(resData);
  10221. // this.refs.grid2.setData(jdbcData)
  10222. });
  10223. };
  10224. return PerformStats;
  10225. }(Scope));
  10226. var vjson$b = {
  10227. title: '性能统计',
  10228. layout: 'fit',
  10229. items: [
  10230. {
  10231. title: '数据库统计',
  10232. xtype: 'yvgrid',
  10233. enableLocking: false,
  10234. reference: 'grid2',
  10235. pagination: false,
  10236. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10237. tbar: {
  10238. xtype: 'form',
  10239. items: [
  10240. {
  10241. xtype: 'cols',
  10242. items: [
  10243. {
  10244. fieldLabel: '搜索',
  10245. listeners: {
  10246. change: 'scope.jdbcFilterChange'
  10247. }
  10248. },
  10249. ]
  10250. },
  10251. ]
  10252. },
  10253. listeners: {
  10254. itemdblclick: 'scope.itemClick1'
  10255. },
  10256. columns: [
  10257. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  10258. { text: '次数', dataIndex: 'count', dataType: 'number' },
  10259. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  10260. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  10261. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  10262. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  10263. { text: '直方图', dataIndex: 'histogram', width: 180 },
  10264. ]
  10265. },
  10266. ]
  10267. };
  10268. var model$b = {
  10269. data: {}
  10270. };
  10271. var PerformStats$1 = /** @class */ (function (_super) {
  10272. __extends(PerformStats, _super);
  10273. function PerformStats() {
  10274. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  10275. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  10276. var store = _this.refs.grid2.store;
  10277. store.clearFilter();
  10278. if (value) {
  10279. store.filterBy(function (record, id) {
  10280. var text = toString(record.get('sql'));
  10281. // 用拼音筛选的方式
  10282. return text.includes(value);
  10283. });
  10284. }
  10285. }, 100);
  10286. return _this;
  10287. }
  10288. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  10289. widget.setData(record.data.children);
  10290. };
  10291. PerformStats.prototype.itemClick1 = function (sender, record) {
  10292. console.log('itemClick1', record.data);
  10293. new PerformDialog().showDialog(sender, {}, {
  10294. data: record.data
  10295. });
  10296. };
  10297. PerformStats.prototype.onLoad = function () {
  10298. var _this = this;
  10299. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  10300. .then(function (_a) {
  10301. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  10302. var resData = reqRes.data;
  10303. var jdbcData = jdbcRes.data;
  10304. _.forEach(jdbcData, function (item) {
  10305. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10306. });
  10307. _.forEach(resData, function (item) {
  10308. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  10309. if (_.isArray(item.sqls)) {
  10310. item.children = _.map(item.sqls, function (sql) {
  10311. return _.find(jdbcData, function (r) { return r.sql === sql; });
  10312. }).filter(function (v) { return !!v; });
  10313. }
  10314. item.jdbcCount = _.size(item.children);
  10315. });
  10316. _this.refs.grid2.setData(jdbcData);
  10317. });
  10318. };
  10319. return PerformStats;
  10320. }(Scope));
  10321. var Controller$4 = /** @class */ (function () {
  10322. function Controller() {
  10323. }
  10324. Controller.prototype.onDblClick = function (sender, record) {
  10325. var data = record.raw;
  10326. if (data.text === "接口统计") {
  10327. var page = new PerformStats();
  10328. page.showPage({
  10329. title: "接口统计",
  10330. id: '_InterfaceStatistics',
  10331. path: '_InterfaceStatistics',
  10332. }, {});
  10333. }
  10334. else if (data.text === "数据库统计") {
  10335. var page = new PerformStats$1();
  10336. page.showPage({
  10337. title: "数据库统计",
  10338. id: '_DatabaseStatistics',
  10339. path: '_DatabaseStatistics',
  10340. }, {});
  10341. }
  10342. };
  10343. Controller.prototype.onLoad = function () {
  10344. var me = this;
  10345. //@ts-ignore
  10346. var view = me.getView();
  10347. view.setRootNode({
  10348. expanded: true,
  10349. leaf: false,
  10350. children: [
  10351. { leaf: true, text: '接口统计' },
  10352. { leaf: true, text: '数据库统计' },
  10353. ]
  10354. });
  10355. };
  10356. return Controller;
  10357. }());
  10358. var controller$4 = new Controller$4();
  10359. function initMonitorTree () {
  10360. Ext.define('com.yvan.studio.MonitorTree', {
  10361. extend: 'Ext.tree.Panel',
  10362. xtype: 'monitortree',
  10363. controller: controller$4,
  10364. scope: controller$4,
  10365. reference: 'roleGrid',
  10366. tooltip: '表单定义',
  10367. iconCls: 'x-fa fa-bar-chart',
  10368. useArrows: true,
  10369. rootVisible: false,
  10370. colspan: 2,
  10371. lines: true,
  10372. multiSelect: false,
  10373. referenceHolder: true,
  10374. // openNode() {
  10375. // const selection = this.getSelection()
  10376. // const [record] = selection
  10377. // if (!record) {
  10378. // return
  10379. // }
  10380. //
  10381. // const {raw} = record;
  10382. // if (raw.type === 'Dir') {
  10383. // return
  10384. // }
  10385. // if (raw.type === "Module" && raw.module) {
  10386. // // eventBus.publish(EventType.ModuleOpen, raw)
  10387. // }
  10388. // },
  10389. listeners: {
  10390. itemdblclick: 'onDblClick',
  10391. afterrender: "onLoad",
  10392. },
  10393. });
  10394. }
  10395. var Controller$5 = /** @class */ (function () {
  10396. function Controller() {
  10397. }
  10398. return Controller;
  10399. }());
  10400. var controller$5 = new Controller$5();
  10401. function initHomeTree () {
  10402. Ext.define('com.yvan.studio.HomeTree', {
  10403. extend: 'Ext.Panel',
  10404. xtype: 'hometree',
  10405. controller: controller$5,
  10406. scope: controller$5,
  10407. referenceHolder: true,
  10408. bodyCls: 'home',
  10409. // layout: 'fit',
  10410. tbar: {
  10411. xtype: 'toolbar',
  10412. items: [
  10413. {
  10414. xtype: 'button',
  10415. iconCls: 'x-fa fa-exchange',
  10416. text: '数据结构同步',
  10417. handler: function (sender) {
  10418. handles$1.mainWindow.showDataSync(sender);
  10419. }
  10420. },
  10421. {
  10422. xtype: 'button',
  10423. iconCls: 'x-fa fa-cubes',
  10424. text: '数据域管理',
  10425. handler: function (sender) {
  10426. handles$1.mainWindow.showColumnDomain();
  10427. }
  10428. },
  10429. ],
  10430. },
  10431. // items: [
  10432. //
  10433. // ],
  10434. layout: {
  10435. type: 'vbox',
  10436. pack: 'start',
  10437. align: 'stretch',
  10438. },
  10439. items: [
  10440. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  10441. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  10442. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  10443. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  10444. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  10445. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  10446. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  10447. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  10448. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  10449. ],
  10450. });
  10451. }
  10452. var WidgetStore = /** @class */ (function (_super) {
  10453. __extends(WidgetStore, _super);
  10454. function WidgetStore() {
  10455. return _super !== null && _super.apply(this, arguments) || this;
  10456. }
  10457. WidgetStore.prototype.getCacheKey = function (param) {
  10458. return "widget_data.json";
  10459. };
  10460. /*invokeApi(param: any): Promise<any> {
  10461. return new Promise<any>(resolve => {
  10462. //@ts-ignore
  10463. require(["../../widget/all"], function (res) {
  10464. const widgetList = res.default
  10465. resolve(widgetList)
  10466. })
  10467. })
  10468. }*/
  10469. WidgetStore.prototype.invokeApi = function (param) {
  10470. return widgetListApi(param);
  10471. };
  10472. return WidgetStore;
  10473. }(CacheStore));
  10474. var instance$2 = new WidgetStore();
  10475. var WidgetGridController = /** @class */ (function () {
  10476. function WidgetGridController() {
  10477. }
  10478. WidgetGridController.prototype.onLoad = function (sender) {
  10479. var me = this;
  10480. setWidget(me);
  10481. instance$2.registe(me.reloadData.bind(this));
  10482. instance$2.reloadIfNeed(undefined);
  10483. };
  10484. WidgetGridController.prototype.widgetAdd = function (sender) {
  10485. var me = this;
  10486. var win = new Ext.Window({
  10487. autoDestroy: true,
  10488. title: "新建弹框",
  10489. width: 400,
  10490. height: 220,
  10491. resizable: true,
  10492. closable: true,
  10493. maximizable: true,
  10494. minimizable: true,
  10495. plain: true,
  10496. // constrainHeader: true,
  10497. constrain: true,
  10498. layout: 'fit',
  10499. animateTarget: sender,
  10500. buttonAlign: 'center',
  10501. items: [
  10502. {
  10503. xtype: "form",
  10504. layout: "hbox",
  10505. margin: '10px 20px',
  10506. border: 0,
  10507. items: [
  10508. {
  10509. flex: 1,
  10510. layout: 'vbox',
  10511. items: [
  10512. {
  10513. xtype: "textfield",
  10514. name: "widgetcode",
  10515. fieldLabel: "弹窗文件",
  10516. flex: 1,
  10517. allowBlank: false,
  10518. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  10519. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  10520. labelWidth: 80,
  10521. width: "100%",
  10522. },
  10523. {
  10524. xtype: "textfield",
  10525. name: "widgetname",
  10526. fieldLabel: "弹窗名称",
  10527. flex: 1,
  10528. allowBlank: false,
  10529. labelWidth: 80,
  10530. width: "100%",
  10531. },
  10532. ]
  10533. },
  10534. ]
  10535. }
  10536. ],
  10537. //窗口按钮
  10538. buttons: [
  10539. {
  10540. xtype: 'button', text: '保存', handler: function (btn) {
  10541. //窗口获取表单
  10542. var form = win.down('form');
  10543. var vaildSuccess = form.isValid();
  10544. if (!vaildSuccess) {
  10545. return;
  10546. }
  10547. var title = form.down('textfield[name="widgetname"]').getValue();
  10548. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  10549. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  10550. if (res.success) {
  10551. msg$1('添加成功');
  10552. // 添加
  10553. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  10554. me.reload();
  10555. });
  10556. win.close();
  10557. }
  10558. });
  10559. }
  10560. },
  10561. {
  10562. xtype: 'button', text: '取消', handler: function (btn) {
  10563. //窗口关闭
  10564. win.close();
  10565. }
  10566. }
  10567. ]
  10568. });
  10569. win.show();
  10570. };
  10571. WidgetGridController.prototype.widgetRemove = function (sender) {
  10572. var _this = this;
  10573. //@ts-ignore
  10574. var record = this.getView().selection.data;
  10575. if (!record) {
  10576. msg$1('请选择一行');
  10577. return;
  10578. }
  10579. var widgetPath = record.widget_path;
  10580. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  10581. if (btn === 'yes') {
  10582. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  10583. if (res.success) {
  10584. msg$1(res.msg);
  10585. _this.reload();
  10586. }
  10587. });
  10588. }
  10589. });
  10590. };
  10591. WidgetGridController.prototype.widgetEdit = function (record) {
  10592. var _this = this;
  10593. if (record) {
  10594. var widgetPath = record.widget_path;
  10595. var widgetName = record.widget_name;
  10596. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  10597. _this.reload();
  10598. });
  10599. }
  10600. };
  10601. WidgetGridController.prototype.onDestory = function (sender) {
  10602. var me = this;
  10603. setWidget(undefined);
  10604. instance$2.unregiste(me.reloadData.bind(this));
  10605. };
  10606. WidgetGridController.prototype.reloadData = function (res) {
  10607. var me = this;
  10608. //@ts-ignore
  10609. var view = me.getView();
  10610. if (typeof res === 'object') {
  10611. // const data = []
  10612. // _.forOwn(res, (v, k) => {
  10613. // data.push({
  10614. // widget_path: k,
  10615. // widget_name: v.title,
  10616. // vjson : v
  10617. // })
  10618. // })
  10619. view.setStore(new Ext.data.Store({
  10620. fields: ['widget_path', 'widget_name'],
  10621. data: res.data,
  10622. }));
  10623. }
  10624. else if (typeof res === 'boolean') {
  10625. view.setLoading(res);
  10626. }
  10627. };
  10628. WidgetGridController.prototype.reload = function () {
  10629. instance$2.reloadForce(undefined);
  10630. };
  10631. WidgetGridController.prototype.filterChanged = function (sender, value) {
  10632. //@ts-ignore
  10633. this.view.store.clearFilter();
  10634. if (value) {
  10635. //@ts-ignore
  10636. this.view.store.filterBy(function (record) {
  10637. var widget_path = record.get('widget_path');
  10638. var widget_name = record.get('widget_name');
  10639. return (window['system'].pinyinMatch(widget_name, value) ||
  10640. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  10641. });
  10642. }
  10643. };
  10644. WidgetGridController.prototype.onClearClick = function () {
  10645. var _a, _b;
  10646. //@ts-ignore
  10647. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  10648. };
  10649. WidgetGridController.prototype.onDblClick = function (sender, record) {
  10650. this.widgetEdit(record.data);
  10651. };
  10652. return WidgetGridController;
  10653. }());
  10654. function initWidget () {
  10655. var controller = new WidgetGridController();
  10656. Ext.define('com.yvan.studio.WidgetGrid', {
  10657. extend: 'Ext.grid.Panel',
  10658. xtype: 'widgetgrid',
  10659. controller: controller,
  10660. scope: controller,
  10661. referenceHolder: true,
  10662. tooltip: '检索窗口',
  10663. iconCls: 'x-fa fa-search',
  10664. useArrows: true,
  10665. reference: 'widgetgrid',
  10666. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10667. listeners: {
  10668. itemdblclick: 'onDblClick',
  10669. afterrender: 'onLoad',
  10670. destory: 'onDestory',
  10671. },
  10672. viewConfig: {
  10673. listeners: {
  10674. itemcontextmenu: 'onGridContextMenu',
  10675. },
  10676. },
  10677. tbar: [
  10678. {
  10679. xtype: 'button',
  10680. tooltip: '刷新',
  10681. iconCls: 'x-fa fa-refresh',
  10682. listeners: {
  10683. click: 'reload'
  10684. }
  10685. },
  10686. {
  10687. xtype: 'button',
  10688. tooltip: '添加',
  10689. iconCls: 'x-fa fa-plus-circle',
  10690. listeners: {
  10691. click: 'widgetAdd'
  10692. }
  10693. },
  10694. {
  10695. xtype: 'button',
  10696. tooltip: '删除',
  10697. iconCls: 'x-fa fa-minus-circle',
  10698. listeners: {
  10699. click: 'widgetRemove'
  10700. }
  10701. },
  10702. ],
  10703. fbar: [
  10704. {
  10705. xtype: 'textfield',
  10706. flex: 1,
  10707. reference: "txtFilter",
  10708. emptyText: '搜索过滤',
  10709. enableKeyEvents: true,
  10710. listeners: {
  10711. change: {
  10712. fn: 'filterChanged',
  10713. buffer: 50
  10714. }
  10715. }
  10716. },
  10717. ],
  10718. columns: [
  10719. {
  10720. text: '弹窗文件', dataIndex: 'widget_path',
  10721. menuDisabled: true, flex: 1,
  10722. },
  10723. {
  10724. text: '弹窗名称', dataIndex: 'widget_name',
  10725. menuDisabled: true, flex: 1,
  10726. },
  10727. ]
  10728. });
  10729. }
  10730. var WhLayoutController = /** @class */ (function () {
  10731. function WhLayoutController() {
  10732. }
  10733. WhLayoutController.prototype.onLoad = function (sender) {
  10734. var _this = this;
  10735. var me = this;
  10736. setWhLayout(me);
  10737. _$2.defer(function () {
  10738. _this.reload();
  10739. });
  10740. };
  10741. WhLayoutController.prototype.reload = function () {
  10742. //@ts-ignore
  10743. var view = this.getView();
  10744. view.setLoading(true);
  10745. loadWhLayoutAll().then(function (res) {
  10746. view.setStore(new Ext.data.Store({
  10747. fields: ['layout_code', 'layout_name'],
  10748. data: res.data,
  10749. }));
  10750. }).finally(function () {
  10751. view.setLoading(false);
  10752. });
  10753. };
  10754. WhLayoutController.prototype.add = function () {
  10755. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  10756. };
  10757. WhLayoutController.prototype.edit = function (data) {
  10758. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  10759. };
  10760. WhLayoutController.prototype.remove = function () {
  10761. var _this = this;
  10762. var _a;
  10763. //@ts-ignore
  10764. var view = this.getView();
  10765. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  10766. if (!record) {
  10767. msg$1('请选择一行数据');
  10768. return;
  10769. }
  10770. var layoutCode = record.layout_code;
  10771. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  10772. if (btn === 'yes') {
  10773. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  10774. if (res.success) {
  10775. msg$1(res.msg);
  10776. _this.reload();
  10777. }
  10778. });
  10779. }
  10780. });
  10781. };
  10782. WhLayoutController.prototype.onDblClick = function () {
  10783. var _a;
  10784. //@ts-ignore
  10785. var view = this.getView();
  10786. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  10787. if (!record) {
  10788. msg$1('请选择一行数据');
  10789. return;
  10790. }
  10791. this.edit(record);
  10792. };
  10793. WhLayoutController.prototype.filterChanged = function (sender, value) {
  10794. //@ts-ignore
  10795. this.view.store.clearFilter();
  10796. if (value) {
  10797. //@ts-ignore
  10798. this.view.store.filterBy(function (record) {
  10799. var widget_path = record.get('widget_path');
  10800. var widget_name = record.get('widget_name');
  10801. return (window['system'].pinyinMatch(widget_name, value) ||
  10802. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  10803. });
  10804. }
  10805. };
  10806. WhLayoutController.prototype.onClearClick = function () {
  10807. var _a, _b;
  10808. //@ts-ignore
  10809. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  10810. };
  10811. return WhLayoutController;
  10812. }());
  10813. function initWhLayout () {
  10814. var controller = new WhLayoutController();
  10815. Ext.define('com.yvan.studio.WhLayout', {
  10816. extend: 'Ext.grid.Panel',
  10817. xtype: 'whlayout',
  10818. alias: 'widget.whlayout',
  10819. controller: controller,
  10820. scope: controller,
  10821. referenceHolder: true,
  10822. tooltip: '检索窗口',
  10823. iconCls: 'x-fa fa-search',
  10824. useArrows: true,
  10825. reference: 'whlayout',
  10826. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  10827. listeners: {
  10828. itemdblclick: 'onDblClick',
  10829. afterrender: 'onLoad',
  10830. destory: 'onDestory',
  10831. },
  10832. viewConfig: {
  10833. listeners: {
  10834. itemcontextmenu: 'onGridContextMenu',
  10835. },
  10836. },
  10837. tbar: [
  10838. {
  10839. xtype: 'button',
  10840. tooltip: '刷新',
  10841. iconCls: 'x-fa fa-refresh',
  10842. listeners: {
  10843. click: 'reload'
  10844. }
  10845. },
  10846. {
  10847. xtype: 'button',
  10848. tooltip: '添加',
  10849. iconCls: 'x-fa fa-plus-circle',
  10850. listeners: {
  10851. click: 'add'
  10852. }
  10853. },
  10854. {
  10855. xtype: 'button',
  10856. tooltip: '删除',
  10857. iconCls: 'x-fa fa-minus-circle',
  10858. listeners: {
  10859. click: 'remove'
  10860. }
  10861. },
  10862. ],
  10863. fbar: [
  10864. {
  10865. xtype: 'textfield',
  10866. flex: 1,
  10867. reference: "txtFilter",
  10868. emptyText: '搜索过滤',
  10869. enableKeyEvents: true,
  10870. listeners: {
  10871. change: {
  10872. fn: 'filterChanged',
  10873. buffer: 50
  10874. }
  10875. }
  10876. },
  10877. ],
  10878. columns: [
  10879. {
  10880. text: '图编号', dataIndex: 'layout_code',
  10881. menuDisabled: true, flex: 1,
  10882. },
  10883. {
  10884. text: '图名称', dataIndex: 'layout_name',
  10885. menuDisabled: true, flex: 1,
  10886. },
  10887. ]
  10888. });
  10889. }
  10890. var BpmnTreeController = /** @class */ (function () {
  10891. function BpmnTreeController() {
  10892. }
  10893. BpmnTreeController.prototype.onLoad = function (sender) {
  10894. this.reload();
  10895. };
  10896. BpmnTreeController.prototype.reload = function () {
  10897. var me = this;
  10898. me.getView().setLoading(true);
  10899. exporerList().then(function (res) {
  10900. // handles.mainWindow.modules = res.data
  10901. // const rootNode = modulesToTreeData(res.data)
  10902. var rootNode = res.data.tree;
  10903. me.getView().setRootNode({
  10904. expanded: true,
  10905. leaf: false,
  10906. children: rootNode
  10907. });
  10908. // const lastId = window.location.hash.substring(1);
  10909. // file.selectPath(lastId)
  10910. // if (lastId) {
  10911. // const node = getModuleById(rootNode, lastId)
  10912. // if (node) {
  10913. // showDesign(node.id, node.path, node.text, node.module)
  10914. // }
  10915. // }
  10916. // this.restoreState()
  10917. }).finally(function () {
  10918. me.getView().setLoading(false);
  10919. });
  10920. };
  10921. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  10922. var _this = this;
  10923. e.preventDefault();
  10924. var raw = node.raw;
  10925. //const me = sender.up("treepanel").scope
  10926. var option;
  10927. if (raw.exporerType === 1) ;
  10928. else if (raw.exporerType === 21) {
  10929. if (raw.type === 'Dir') {
  10930. option = {
  10931. shadow: 'frame', allowOtherMenus: true,
  10932. items: [
  10933. {
  10934. text: '添加',
  10935. iconCls: 'x-fa fa-plus-circle',
  10936. handler: function (sender) {
  10937. var dirPath = raw.dirPath;
  10938. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  10939. }
  10940. },
  10941. '-',
  10942. {
  10943. text: '新建文件夹',
  10944. iconCls: 'x-fa fa-folder-o',
  10945. handler: function (sender) {
  10946. }
  10947. }
  10948. ]
  10949. };
  10950. }
  10951. else if (raw.type === 'Model') {
  10952. option = {
  10953. shadow: 'frame', allowOtherMenus: true,
  10954. items: [
  10955. {
  10956. text: '编辑',
  10957. iconCls: 'x-fa fa-edit',
  10958. handler: function (sender) {
  10959. }
  10960. },
  10961. {
  10962. text: '删除',
  10963. iconCls: 'x-fa fa-minus-circle',
  10964. handler: function (sender) {
  10965. }
  10966. },
  10967. '-',
  10968. {
  10969. text: '注册(至菜单)',
  10970. iconCls: 'x-fa fa-sign-in',
  10971. handler: function (sender) {
  10972. }
  10973. },
  10974. {
  10975. text: '新建文件夹',
  10976. iconCls: 'x-fa fa-folder-o',
  10977. handler: function (sender) {
  10978. }
  10979. }
  10980. ]
  10981. };
  10982. }
  10983. }
  10984. else if (raw.exporerType === 22) {
  10985. if (raw.type === 'Dir') {
  10986. option = {
  10987. shadow: 'frame', allowOtherMenus: true,
  10988. items: [
  10989. {
  10990. text: '添加',
  10991. iconCls: 'x-fa fa-plus-circle',
  10992. handler: function (sender) {
  10993. var dirPath = raw.dirPath;
  10994. handles$1.mainWindow.showFormBill();
  10995. }
  10996. },
  10997. '-',
  10998. {
  10999. text: '新建文件夹',
  11000. iconCls: 'x-fa fa-folder-o',
  11001. handler: function (sender) {
  11002. }
  11003. }
  11004. ]
  11005. };
  11006. }
  11007. else if (raw.type === 'Model') {
  11008. option = {
  11009. shadow: 'frame', allowOtherMenus: true,
  11010. items: [
  11011. {
  11012. text: '编辑',
  11013. iconCls: 'x-fa fa-edit',
  11014. handler: function (sender) {
  11015. }
  11016. },
  11017. {
  11018. text: '删除',
  11019. iconCls: 'x-fa fa-minus-circle',
  11020. handler: function (sender) {
  11021. }
  11022. },
  11023. '-',
  11024. {
  11025. text: '注册(至菜单)',
  11026. iconCls: 'x-fa fa-sign-in',
  11027. handler: function (sender) {
  11028. }
  11029. },
  11030. {
  11031. text: '新建文件夹',
  11032. iconCls: 'x-fa fa-folder-o',
  11033. handler: function (sender) {
  11034. }
  11035. }
  11036. ]
  11037. };
  11038. }
  11039. }
  11040. else if (raw.exporerType === 3) ;
  11041. else if (raw.exporerType === 50) {
  11042. option = {
  11043. shadow: 'frame', allowOtherMenus: true,
  11044. items: [
  11045. {
  11046. text: '新建流程',
  11047. iconCls: 'x-fa fa-new',
  11048. handler: function (sender) {
  11049. _this.bpmnAdd(sender);
  11050. }
  11051. },
  11052. ]
  11053. };
  11054. }
  11055. else if (raw.exporerType === 51) {
  11056. option = {
  11057. shadow: 'frame', allowOtherMenus: true,
  11058. items: [
  11059. {
  11060. text: '新建流程',
  11061. iconCls: 'x-fa fa-new',
  11062. handler: function (sender) {
  11063. _this.bpmnAdd(sender);
  11064. }
  11065. },
  11066. {
  11067. text: '删除',
  11068. iconCls: 'x-fa fa-minus-circle',
  11069. handler: function (sender) {
  11070. _this.bpmnDelete(sender, raw);
  11071. }
  11072. },
  11073. ]
  11074. };
  11075. }
  11076. else {
  11077. throw Error('暂时不支持!');
  11078. }
  11079. if (option) {
  11080. var treeMenu = new Ext.menu.Menu(option);
  11081. treeMenu.showAt(e.getXY());
  11082. }
  11083. };
  11084. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  11085. var _this = this;
  11086. prompt$2('输入工作流名称').then(function (name) {
  11087. createBpmn("", name).then(function (res) {
  11088. if (res.success) {
  11089. msg$1('添加成功');
  11090. }
  11091. _this.reload();
  11092. });
  11093. });
  11094. };
  11095. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  11096. var _this = this;
  11097. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  11098. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  11099. if (res.success) {
  11100. msg$1('添加成功');
  11101. }
  11102. _this.reload();
  11103. });
  11104. });
  11105. };
  11106. BpmnTreeController.prototype.reportAdd = function (sender) {
  11107. var _this = this;
  11108. prompt$2('请输入报表名称').then(function (name) {
  11109. createReportApi(name).then(function (res) {
  11110. if (res.success) {
  11111. msg$1('添加成功');
  11112. handles$1.mainWindow.showReport(res.data, name, function () {
  11113. _this.reload();
  11114. });
  11115. }
  11116. _this.reload();
  11117. });
  11118. });
  11119. };
  11120. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  11121. if (record) {
  11122. var reportName = record.get('report_name');
  11123. var reportId = record.get('report_id');
  11124. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  11125. }
  11126. };
  11127. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  11128. var _this = this;
  11129. if (record) {
  11130. var reportName = record.get('report_name');
  11131. var reportId_1 = record.get('report_id');
  11132. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  11133. delReportApi(reportId_1).then(function (res) {
  11134. if (res.success) {
  11135. msg$1('删除成功');
  11136. _this.reload();
  11137. }
  11138. });
  11139. });
  11140. }
  11141. };
  11142. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  11143. var _this = this;
  11144. if (!record || record.type !== 'Module') {
  11145. return;
  11146. }
  11147. var reportName = record.text;
  11148. var reportId = record.target;
  11149. handles$1.mainWindow.showReport(reportId, reportName, function () {
  11150. _this.reload();
  11151. });
  11152. };
  11153. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  11154. var data = record.raw;
  11155. if (data.type !== 'Module' && data.type !== 'Dir') {
  11156. return;
  11157. }
  11158. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  11159. if (data.exporerType === 10) { // 表单
  11160. // this.reportEdit(sender, data)
  11161. handles$1.mainWindow.showReport();
  11162. }
  11163. else if (data.exporerType === 21) {
  11164. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  11165. }
  11166. else if (data.exporerType === 22) {
  11167. handles$1.mainWindow.showFormBill();
  11168. }
  11169. else if (data.exporerType === 30) {
  11170. handles$1.mainWindow.showWidgetDesign();
  11171. }
  11172. else if (data.exporerType === 51) {
  11173. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  11174. }
  11175. else {
  11176. throw Error('暂时不支持!');
  11177. }
  11178. };
  11179. return BpmnTreeController;
  11180. }());
  11181. var controller$6 = new BpmnTreeController();
  11182. function initBpmnTree () {
  11183. Ext.define('com.yvan.studio.BpmnTree', {
  11184. extend: 'Ext.tree.Panel',
  11185. //extend: 'com.yvan.studio.StateTree',
  11186. xtype: 'bpmntree',
  11187. controller: controller$6,
  11188. scope: controller$6,
  11189. tooltip: '表单定义',
  11190. iconCls: 'x-fa fa-random',
  11191. useArrows: true,
  11192. rootVisible: false,
  11193. colspan: 2,
  11194. lines: true,
  11195. multiSelect: true,
  11196. reload: function () {
  11197. this.controller.reload.call(this, arguments);
  11198. },
  11199. openNode: function () {
  11200. var selection = this.getSelection();
  11201. var _a = __read(selection, 1), record = _a[0];
  11202. if (!record) {
  11203. return;
  11204. }
  11205. var raw = record.raw;
  11206. if (raw.type === 'Dir') {
  11207. return;
  11208. }
  11209. if (raw.type === "Module" && raw.module) ;
  11210. },
  11211. listeners: {
  11212. itemdblclick: 'onDblClick',
  11213. afterrender: 'onLoad',
  11214. // itemverify() {
  11215. // this.openNode()
  11216. // },
  11217. itemcontextmenu: 'onLisenContextMenu'
  11218. },
  11219. tbar: {
  11220. xtype: 'toolbar',
  11221. items: [
  11222. {
  11223. xtype: 'button',
  11224. tooltip: '刷新',
  11225. iconCls: 'x-fa fa-refresh',
  11226. listeners: {
  11227. click: 'reload'
  11228. }
  11229. },
  11230. /*{
  11231. xtype: 'button',
  11232. tooltip: '添加',
  11233. iconCls: 'x-fa fa-plus-circle',
  11234. menu: [
  11235. {
  11236. text: '类别',
  11237. listeners: {
  11238. click: 'classAdd'
  11239. }
  11240. },
  11241. {
  11242. text: '查询',
  11243. listeners: {
  11244. click: 'reportAdd'
  11245. }
  11246. },
  11247. '-',
  11248. {
  11249. text: '单表定义',
  11250. listeners: {
  11251. click: 'singleTableAdd'
  11252. }
  11253. },
  11254. {
  11255. text: '多表定义',
  11256. listeners: {
  11257. click: 'complexTableAdd'
  11258. }
  11259. },
  11260. {
  11261. text: '查询窗口定义',
  11262. listeners: {
  11263. click: 'widgetAdd'
  11264. }
  11265. },
  11266. ],
  11267. },
  11268. {
  11269. xtype: 'button',
  11270. tooltip: '删除',
  11271. iconCls: 'x-fa fa-minus-circle',
  11272. listeners: {
  11273. click: 'reportRemove'
  11274. }
  11275. },*/
  11276. {
  11277. xtype: 'textfield',
  11278. flex: 1,
  11279. reference: "txtFilter",
  11280. emptyText: '搜索过滤',
  11281. enableKeyEvents: true,
  11282. listeners: {
  11283. change: {
  11284. fn: 'filterChanged',
  11285. buffer: 50
  11286. }
  11287. }
  11288. },
  11289. ]
  11290. },
  11291. });
  11292. }
  11293. // export const idPrefix = "_ds_"
  11294. var _designInstance;
  11295. function setDesignInstance(instance) {
  11296. _designInstance = instance;
  11297. }
  11298. function getDesignInstance() {
  11299. return _designInstance;
  11300. }
  11301. function delegateDragmove(node, source, info) {
  11302. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  11303. //@ts-ignore
  11304. _designInstance.dragmove(node, source, info);
  11305. }
  11306. }
  11307. function delegateDragend(node, source, info) {
  11308. if (_designInstance && typeof _designInstance.dragend === 'function') {
  11309. //@ts-ignore
  11310. _designInstance.dragend(node, source, info);
  11311. }
  11312. }
  11313. function initToolBox () {
  11314. Ext.define('com.yvan.studio.ToolBox', {
  11315. extend: 'Ext.panel.Panel',
  11316. xtype: 'toolbox',
  11317. tooltip: '工具箱',
  11318. layout: 'fit',
  11319. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  11320. border: false,
  11321. beforeRender: function () {
  11322. console.log('beforeRender', this);
  11323. },
  11324. afterRender: function () {
  11325. var $dom = $(this.body.dom).children('div');
  11326. $dom.append(createComponent());
  11327. $dom.css("height", '100%');
  11328. // @ts-ignore
  11329. $('#_toolbox_list').find('li').each(function () {
  11330. var id = $(this).children(':first').attr('drag_id');
  11331. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  11332. setDrag(this, node);
  11333. });
  11334. }
  11335. });
  11336. }
  11337. function setDrag(el, node) {
  11338. new Ext.drag.Source({
  11339. element: el,
  11340. proxy: {
  11341. type: 'placeholder',
  11342. getElement: function (info) {
  11343. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  11344. return Ext.getBody().createChild({
  11345. html: html
  11346. });
  11347. }
  11348. },
  11349. listeners: {
  11350. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  11351. dragend: delegateDragend.bind(getDesignInstance(), node),
  11352. },
  11353. sourceVjson: node.code,
  11354. dragType: node.dragType
  11355. });
  11356. }
  11357. function createComponent() {
  11358. var template = [];
  11359. for (var i = 0; i < codeLines.length; i++) {
  11360. var item = codeLines[i];
  11361. if (!item.dragHtml) {
  11362. continue;
  11363. }
  11364. var $ele = $("<li>" + item.dragHtml + "</li>");
  11365. $ele.children(':first').attr('drag_id', item.id);
  11366. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  11367. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  11368. }
  11369. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  11370. return html;
  11371. }
  11372. var codeLines = [
  11373. {
  11374. id: '$label',
  11375. value: layoutOrXtypeNameMap.label + ' - label',
  11376. icon: "fa fa-font",
  11377. dragType: "col-item",
  11378. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11379. code: {
  11380. xtype: 'label',
  11381. text: '文本' + _$2.uniqueId('_l')
  11382. }
  11383. },
  11384. {
  11385. id: '$text',
  11386. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  11387. icon: "fa fa-edit",
  11388. dragType: "col-item",
  11389. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11390. code: {
  11391. xtype: 'textfield',
  11392. fieldLabel: '输入框' + _$2.uniqueId('_e')
  11393. }
  11394. },
  11395. {
  11396. id: '$textarea',
  11397. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  11398. icon: "fa fa-edit",
  11399. dragType: "col-item",
  11400. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11401. code: {
  11402. xtype: 'textareafield',
  11403. fieldLabel: '输入框' + _$2.uniqueId('_e')
  11404. }
  11405. },
  11406. {
  11407. id: '$number',
  11408. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  11409. icon: "fa fa-edit",
  11410. dragType: "col-item",
  11411. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11412. code: {
  11413. xtype: 'numberfield',
  11414. fieldLabel: '数字框' + _$2.uniqueId('_n')
  11415. }
  11416. },
  11417. {
  11418. id: '$combo',
  11419. value: layoutOrXtypeNameMap.combo + ' - combo',
  11420. icon: "fa fa-angle-double-down",
  11421. dragType: "col-item",
  11422. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11423. code: {
  11424. xtype: 'combo',
  11425. fieldLabel: '请选择',
  11426. data: [
  11427. { id: 'id1', text: '选项1' },
  11428. { id: 'id2', text: '选项2' },
  11429. { id: 'id3', text: '选项3' },
  11430. ],
  11431. }
  11432. },
  11433. {
  11434. id: '$datebox',
  11435. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  11436. icon: "fa fa-calendar",
  11437. dragType: "col-item",
  11438. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11439. code: {
  11440. xtype: "datefield",
  11441. fieldLabel: '日期',
  11442. }
  11443. },
  11444. {
  11445. id: '$searchbox',
  11446. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  11447. icon: "fa fa-search",
  11448. dragType: "col-item",
  11449. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11450. code: {
  11451. xtype: 'searchfield',
  11452. fieldLabel: '搜索框',
  11453. }
  11454. },
  11455. {
  11456. id: '$combogrid',
  11457. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  11458. icon: "fa fa-table",
  11459. dragType: "col-item",
  11460. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11461. code: {
  11462. xtype: 'combogrid',
  11463. fieldLabel: '下拉表'
  11464. }
  11465. },
  11466. {
  11467. id: '$combotree',
  11468. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  11469. icon: "fa fa-tree",
  11470. dragType: "col-item",
  11471. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11472. code: {
  11473. xtype: 'combotree',
  11474. fieldLabel: '下拉树',
  11475. displayField: 'text',
  11476. rootVisible: false
  11477. }
  11478. },
  11479. {
  11480. id: '$button',
  11481. value: layoutOrXtypeNameMap.button + ' - button',
  11482. icon: 'fa fa-sign-in',
  11483. dragType: "col-item",
  11484. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11485. code: {
  11486. text: '按钮',
  11487. iconCls: 'x-fa fa-bars',
  11488. xtype: 'button'
  11489. }
  11490. },
  11491. {
  11492. id: '$checkbox',
  11493. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  11494. icon: 'fa fa-check-square',
  11495. dragType: "col-item",
  11496. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11497. code: {
  11498. xtype: 'checkbox',
  11499. boxLabel: '勾选框',
  11500. hideLabel: true,
  11501. margin: '0 0 0 15',
  11502. flex: 0,
  11503. }
  11504. },
  11505. {
  11506. id: '$checkboxgroup',
  11507. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  11508. icon: 'fa fa-check-square',
  11509. dragType: "col-item",
  11510. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11511. code: {
  11512. xtype: 'checkboxgroup',
  11513. fieldLabel: '勾选组',
  11514. items: [
  11515. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  11516. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  11517. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  11518. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  11519. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  11520. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  11521. ]
  11522. }
  11523. },
  11524. {
  11525. id: '$radio',
  11526. value: layoutOrXtypeNameMap.radio + ' - radio',
  11527. icon: 'fa fa-dot-circle-o',
  11528. dragType: "col-item",
  11529. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11530. code: {
  11531. xtype: "radio",
  11532. fieldLabel: "请选择",
  11533. }
  11534. },
  11535. {
  11536. id: '$radiogroup',
  11537. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  11538. icon: 'fa fa-dot-circle-o',
  11539. dragType: "col-item",
  11540. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11541. code: {
  11542. xtype: "radiogroup",
  11543. fieldLabel: "请选择",
  11544. items: [
  11545. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  11546. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  11547. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  11548. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  11549. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  11550. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  11551. ]
  11552. }
  11553. },
  11554. {
  11555. id: '$cols',
  11556. value: layoutOrXtypeNameMap.cols + ' - cols',
  11557. icon: 'fa fa-list-alt',
  11558. dragType: "cols-container",
  11559. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11560. code: {
  11561. xtype: 'cols',
  11562. items: [
  11563. {
  11564. xtype: 'textfield',
  11565. fieldLabel: '输入框',
  11566. },
  11567. ],
  11568. }
  11569. },
  11570. {
  11571. id: '$container',
  11572. value: layoutOrXtypeNameMap.container + ' - container',
  11573. icon: 'fa fa-flag',
  11574. dragType: "col-item",
  11575. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11576. code: {
  11577. xtype: 'container',
  11578. border: false,
  11579. layout: 'hbox',
  11580. }
  11581. },
  11582. {
  11583. id: '$fit',
  11584. value: layoutOrXtypeNameMap.fit + ' - fit',
  11585. icon: 'fa fa-flag',
  11586. dragType: "rows-container",
  11587. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  11588. code: {
  11589. border: false,
  11590. layout: 'fit',
  11591. items: [
  11592. {
  11593. xtype: 'container',
  11594. border: false,
  11595. layout: 'hbox',
  11596. }
  11597. ]
  11598. }
  11599. },
  11600. ];
  11601. // @ts-ignore
  11602. // export default ToolBoxCmp
  11603. var that = undefined;
  11604. function initPropertyDesign () {
  11605. Ext.define('com.yvan.studio.PropertyDesign', {
  11606. extend: 'Ext.panel.Panel',
  11607. xtype: 'propertydesign',
  11608. name: "PropertyDesign",
  11609. tooltip: '属性',
  11610. iconCls: 'x-fa fa-newspaper-o',
  11611. reference: 'propertygrid',
  11612. layout: 'border',
  11613. border: false,
  11614. moduleId: null,
  11615. currentComponentVJson: null,
  11616. currentComponentPropertyEditSource: null,
  11617. vjson: null,
  11618. propertyHandle: null,
  11619. moduleSubscribe: null,
  11620. items: [
  11621. new Ext.grid.property.Grid({
  11622. sortableColumns: false,
  11623. region: 'center',
  11624. listeners: {
  11625. propertychange: function (source, propName, value, oldValue, eOpts) {
  11626. value = _.trim(value);
  11627. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  11628. return item.label === propName;
  11629. });
  11630. if (a.type === 'listeners') {
  11631. if (value) {
  11632. if (that.currentComponentVJson.listeners) {
  11633. that.currentComponentVJson.listeners[propName] = value;
  11634. }
  11635. else {
  11636. var t = {};
  11637. t[propName] = value;
  11638. that.currentComponentVJson.listeners = t;
  11639. }
  11640. }
  11641. else {
  11642. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  11643. if (!value1) {
  11644. delete that.currentComponentVJson.listeners[key];
  11645. }
  11646. else if (key === propName) {
  11647. delete that.currentComponentVJson.listeners[key];
  11648. }
  11649. });
  11650. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  11651. delete that.currentComponentVJson.listeners;
  11652. }
  11653. }
  11654. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11655. vjson: that.vjson,
  11656. from: that.name,
  11657. ignoreRenderUI: true
  11658. });
  11659. }
  11660. else if (a.type === 'fix') {
  11661. if (!value) {
  11662. delete that.currentComponentVJson[propName];
  11663. }
  11664. else {
  11665. that.currentComponentVJson[propName] = value.split("\r\n");
  11666. }
  11667. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11668. vjson: that.vjson,
  11669. from: that.name,
  11670. ignoreRenderUI: true
  11671. });
  11672. }
  11673. else if (a.type === 'bind') {
  11674. var bind_1 = that.currentComponentVJson.bind;
  11675. if (typeof bind_1 === 'string' && a.id === "value") {
  11676. if (value) {
  11677. that.currentComponentVJson.bind = value;
  11678. }
  11679. else {
  11680. delete that.currentComponentVJson.bind;
  11681. }
  11682. }
  11683. else {
  11684. // 转成bind对象
  11685. if (typeof bind_1 === 'string') {
  11686. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  11687. }
  11688. if (value) {
  11689. if (bind_1) {
  11690. bind_1[a.id] = value;
  11691. }
  11692. else {
  11693. var t = {};
  11694. t[a.id] = value;
  11695. that.currentComponentVJson.bind = t;
  11696. }
  11697. }
  11698. else {
  11699. _.forOwn(bind_1, function (value1, key) {
  11700. if (!value1) {
  11701. delete bind_1[key];
  11702. }
  11703. else if (key === a.id) {
  11704. delete bind_1[key];
  11705. }
  11706. });
  11707. if (Object.keys(bind_1).length <= 0) {
  11708. delete that.currentComponentVJson.bind;
  11709. }
  11710. }
  11711. }
  11712. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11713. vjson: that.vjson,
  11714. from: that.name,
  11715. ignoreRenderUI: true
  11716. });
  11717. }
  11718. else if (a.type === 'boolean') {
  11719. if (!value) {
  11720. delete that.currentComponentVJson[propName];
  11721. }
  11722. else if (value === 'false') {
  11723. that.currentComponentVJson[propName] = false;
  11724. }
  11725. else if (value === 'true') {
  11726. that.currentComponentVJson[propName] = true;
  11727. }
  11728. else {
  11729. that.currentComponentVJson[propName] = value;
  11730. }
  11731. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11732. vjson: that.vjson,
  11733. from: that.name
  11734. });
  11735. }
  11736. else {
  11737. that.currentComponentVJson[propName] = value;
  11738. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  11739. vjson: that.vjson,
  11740. from: that.name
  11741. });
  11742. }
  11743. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  11744. },
  11745. }
  11746. })
  11747. ],
  11748. listeners: {
  11749. // afterrender() {
  11750. // this.propertyHandle.setSource({
  11751. // "(name)": "My Object",
  11752. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  11753. // "Available": false, // boolean type
  11754. // "Version": .01, // decimal type
  11755. // "Description": "A test object"
  11756. // });
  11757. // }
  11758. },
  11759. initComponent: function () {
  11760. var _this = this;
  11761. this.propertyHandle = this.items[0];
  11762. setPropertyPanel(this);
  11763. that = this;
  11764. eventBus.subscribe(EventType.SetVjson, function (_a) {
  11765. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11766. _this.setVjson(moduleId, from, ignoreRenderUI);
  11767. });
  11768. return this.superclass.initComponent.apply(this, arguments);
  11769. },
  11770. setVjson: function (moduleId, from, ignoreRenderUI) {
  11771. var _this = this;
  11772. // if (this.moduleId === null && moduleId) {
  11773. // this.moduleId = moduleId
  11774. // }
  11775. if (moduleId !== this.moduleId || from === this.name) {
  11776. return;
  11777. }
  11778. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  11779. if (!moduleObj) {
  11780. return;
  11781. }
  11782. this.vjson = moduleObj.moduleObj.vjson;
  11783. this.setPropertyAndEventSource();
  11784. if (this.componentSelectionChangeSubscribe) {
  11785. this.componentSelectionChangeSubscribe.cancel();
  11786. this.componentSelectionChangeSubscribe = null;
  11787. }
  11788. if (this.updateVjsonChangeSubscribe) {
  11789. this.updateVjsonChangeSubscribe.cancel();
  11790. this.updateVjsonChangeSubscribe = null;
  11791. }
  11792. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11793. var id = _a.id, from = _a.from;
  11794. _this.onComponentSelectionChange(id, from);
  11795. });
  11796. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11797. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11798. _this.updateVjson(vjson, from, ignoreRenderUI);
  11799. });
  11800. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  11801. this.onComponentSelectionChange(id, from);
  11802. },
  11803. updateVjson: function (vjson, from, ignoreRenderUI) {
  11804. if (!vjson || from === this.name) {
  11805. return;
  11806. }
  11807. this.vjson = vjson;
  11808. this.setPropertyAndEventSource();
  11809. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  11810. this.onComponentSelectionChange(id, from);
  11811. },
  11812. onComponentSelectionChange: function (id, from) {
  11813. if (from !== this.name) {
  11814. this.currentComponentVJson = findInCode(this.vjson, id);
  11815. this.setPropertyAndEventSource();
  11816. }
  11817. },
  11818. setPropertyAndEventSource: function () {
  11819. var _this = this;
  11820. this.propertyHandle.setSource({});
  11821. if (!this.currentComponentVJson) {
  11822. return;
  11823. }
  11824. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  11825. var v = xtype;
  11826. // 选中的对象可能是组
  11827. if (!v) {
  11828. if (_.has(this.currentComponentVJson, "cols")) {
  11829. v = "cols";
  11830. }
  11831. else if (_.has(this.currentComponentVJson, "rows")) {
  11832. v = "rows";
  11833. }
  11834. }
  11835. var pd = YvanUI.PropertyDescriptionTable.get(v);
  11836. if (!pd) {
  11837. // 这个组件没有属性
  11838. this.propertyHandle.setSource({});
  11839. return;
  11840. }
  11841. var funcArr = this.getAllfuncs();
  11842. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  11843. // disabled: true,
  11844. displayField: 'name',
  11845. valueField: 'name',
  11846. store: funcArr,
  11847. }); };
  11848. // ====================== 属性
  11849. var elements = [];
  11850. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  11851. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  11852. var props = pd.getPropsByGroup(group);
  11853. if (props.length <= 0)
  11854. return; //没有这一组属性
  11855. // 显示 group 的中文名
  11856. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  11857. if (caption[i] === '绑定') {
  11858. _.each(props, function (prop) {
  11859. elements.push({
  11860. label: "_" + prop.name,
  11861. type: "bind",
  11862. id: prop.name,
  11863. desc: prop.desc,
  11864. editor: new Ext.form.field.Text()
  11865. });
  11866. });
  11867. }
  11868. else {
  11869. _.each(props, function (prop) {
  11870. if (_.isArray(prop.type)) {
  11871. elements.push({
  11872. label: prop.name,
  11873. type: "combo",
  11874. options: prop.type,
  11875. id: prop.name,
  11876. desc: prop.desc
  11877. });
  11878. return;
  11879. }
  11880. switch (prop.type) {
  11881. case 'boolean': {
  11882. elements.push({
  11883. label: prop.name,
  11884. id: prop.name,
  11885. desc: prop.desc,
  11886. type: 'boolean',
  11887. editor: new Ext.form.field.ComboBox({
  11888. displayField: 'text',
  11889. valueField: 'id',
  11890. store: new Ext.data.Store({
  11891. field: ['id', 'text'],
  11892. data: [
  11893. { id: 'true', text: 'True' },
  11894. { id: 'false', text: 'False' },
  11895. ]
  11896. })
  11897. }),
  11898. });
  11899. break;
  11900. }
  11901. case 'number': {
  11902. elements.push({
  11903. label: prop.name,
  11904. type: "number",
  11905. id: prop.name,
  11906. isNum: true,
  11907. desc: prop.desc,
  11908. editor: new Ext.form.field.Number()
  11909. });
  11910. break;
  11911. }
  11912. case 'string': {
  11913. elements.push({
  11914. label: prop.name,
  11915. type: "string",
  11916. id: prop.name,
  11917. desc: prop.desc,
  11918. editor: new Ext.form.field.Text()
  11919. });
  11920. break;
  11921. }
  11922. case 'listeners': {
  11923. elements.push({
  11924. label: prop.name,
  11925. type: "listeners",
  11926. id: prop.name,
  11927. desc: prop.desc,
  11928. editor: createFuncEditor()
  11929. });
  11930. break;
  11931. }
  11932. case 'fix': {
  11933. elements.push({
  11934. label: prop.name,
  11935. type: "fix",
  11936. id: prop.name,
  11937. desc: prop.desc,
  11938. editor: new Ext.form.field.Text()
  11939. });
  11940. break;
  11941. }
  11942. case 'object': {
  11943. break;
  11944. }
  11945. // case 'dataSource' : {
  11946. // break;
  11947. // }
  11948. case 'valid': {
  11949. break;
  11950. }
  11951. default:
  11952. elements.push({
  11953. label: prop.name,
  11954. type: prop.type,
  11955. id: prop.name,
  11956. desc: prop.desc,
  11957. editor: new Ext.form.field.Text({ disabled: true })
  11958. });
  11959. console.error('不支持的编辑类型', prop);
  11960. }
  11961. });
  11962. }
  11963. });
  11964. this.currentComponentPropertyEditSource = elements;
  11965. var panel1Source = {};
  11966. var panel1SourceConfig = {};
  11967. _.each(elements, function (item) {
  11968. var _a;
  11969. if (item.type === "listeners") {
  11970. var listeners = _this.currentComponentVJson.listeners;
  11971. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  11972. }
  11973. else if (item.type === "fix") {
  11974. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  11975. }
  11976. else if (item.type === "bind") {
  11977. var bind = _this.currentComponentVJson.bind;
  11978. if (typeof bind === 'string' && item.id === 'value') {
  11979. panel1Source[item.label] = bind;
  11980. }
  11981. else {
  11982. panel1Source[item.label] = bind ? bind[item.id] : '';
  11983. }
  11984. }
  11985. else {
  11986. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  11987. }
  11988. panel1Source[item.label] = panel1Source[item.label] || '';
  11989. panel1SourceConfig[item.label] = { editor: item.editor };
  11990. });
  11991. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  11992. },
  11993. getAllfuncs: function () {
  11994. var _a, _b;
  11995. 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;
  11996. var scopeFuncs = [];
  11997. _.forEach(arr, function (item) {
  11998. scopeFuncs.push({ name: "scope." + item.name });
  11999. });
  12000. return scopeFuncs;
  12001. }
  12002. });
  12003. }
  12004. function initViewOutlineTree () {
  12005. Ext.define('com.yvan.studio.ViewOutlineTree', {
  12006. extend: 'Ext.tree.Panel',
  12007. xtype: 'viewoutlinetree',
  12008. name: "ViewOutlineTree",
  12009. tooltip: '设计大纲',
  12010. iconCls: 'x-fa fa-list',
  12011. rootVisible: false,
  12012. useArrows: true,
  12013. allowDeselect: true,
  12014. colspan: 2,
  12015. lines: false,
  12016. reference: 'viewoutlinetree',
  12017. multiSelect: true,
  12018. _saveStateFlag: true,
  12019. keyMapEnabled: true,
  12020. moduleId: null,
  12021. vjson: null,
  12022. columns: [
  12023. {
  12024. xtype: 'treecolumn',
  12025. text: '布局',
  12026. dataIndex: 'layoutNameDesc',
  12027. flex: 2,
  12028. sortable: true
  12029. }, {
  12030. text: '组件',
  12031. dataIndex: 'xtype',
  12032. flex: 1,
  12033. sortable: true,
  12034. align: 'center',
  12035. }
  12036. ],
  12037. listeners: {
  12038. itemcontextmenu: function (sender, node, element, idx, e) {
  12039. e.preventDefault();
  12040. this.rightClickTreeNode(sender, node, element, idx, e);
  12041. },
  12042. select: function (sender, node, index, e) {
  12043. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  12044. },
  12045. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  12046. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  12047. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  12048. }
  12049. }
  12050. },
  12051. initComponent: function () {
  12052. var _this = this;
  12053. setViewoutlinetree(this);
  12054. eventBus.subscribe(EventType.SetVjson, function (_a) {
  12055. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  12056. return _this.setVjson(moduleId, from, ignoreRenderUI);
  12057. });
  12058. return this.superclass.initComponent.apply(this, arguments);
  12059. },
  12060. clear: function () {
  12061. this.setRootNode(null);
  12062. },
  12063. onChangModule: function (moduleId, oldModuleId, from) {
  12064. if (!moduleId || moduleId !== this.moduleId) {
  12065. return;
  12066. }
  12067. if (moduleStore.getModuleObject(moduleId)) {
  12068. this.setVjson(moduleId, from);
  12069. }
  12070. },
  12071. setVjson: function (moduleId, from, ignoreRenderUI) {
  12072. var _this = this;
  12073. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  12074. return;
  12075. }
  12076. this.moduleId = moduleId;
  12077. // if (from === this.name) {
  12078. // return
  12079. // }
  12080. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  12081. this.setTreeValue();
  12082. if (this.componentSelectionChangeSubscribe) {
  12083. this.componentSelectionChangeSubscribe.cancel();
  12084. this.componentSelectionChangeSubscribe = null;
  12085. }
  12086. if (this.setVjsonChangeSubscribe) {
  12087. this.setVjsonChangeSubscribe.cancel();
  12088. this.setVjsonChangeSubscribe = null;
  12089. }
  12090. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  12091. var id = _a.id, from = _a.from;
  12092. return _this.onComponentSelectionChange(id, from);
  12093. });
  12094. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  12095. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  12096. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  12097. });
  12098. },
  12099. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  12100. if (!vjson || from === this.name) {
  12101. return;
  12102. }
  12103. this.vjson = vjson;
  12104. this.setTreeValue();
  12105. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  12106. if (id) {
  12107. this.selectPath(id);
  12108. }
  12109. },
  12110. onComponentSelectionChange: function (id, from) {
  12111. if (from !== this.name) {
  12112. if (id) {
  12113. this.selectPath(id);
  12114. }
  12115. else {
  12116. this.setTreeValue();
  12117. }
  12118. }
  12119. },
  12120. setTreeValue: function () {
  12121. var outlineVj = {};
  12122. _.forOwn(this.vjson, function (obj, key) {
  12123. if (key !== 'viewModel' && key !== 'store') {
  12124. outlineVj[key] = _.cloneDeep(obj);
  12125. }
  12126. });
  12127. getLayoutOutline(outlineVj);
  12128. this.setRootNode(outlineVj);
  12129. },
  12130. rightClickTreeNode: function (sender, node, element, idx, e) {
  12131. var raw = node.data;
  12132. var option = {};
  12133. // 右键
  12134. option = {
  12135. shadow: 'frame',
  12136. allowOtherMenus: true,
  12137. items: []
  12138. };
  12139. var switchType = raw.layoutName;
  12140. if (raw.layoutName === 'north' ||
  12141. raw.layoutName === 'south' ||
  12142. raw.layoutName === 'west' ||
  12143. raw.layoutName === 'east' ||
  12144. raw.layoutName === 'center' ||
  12145. raw.layoutName === 'tbar' ||
  12146. raw.layoutName === 'fbar') {
  12147. switchType = raw.xtype || raw.layout;
  12148. }
  12149. var itemArr = [];
  12150. var hasTbar = false, hasFbar = false, hasBody = false;
  12151. if (raw.hasOwnProperty("children")) {
  12152. _.forEach(raw.children, function (value) {
  12153. if (value.layoutName === 'tbar') {
  12154. hasTbar = true;
  12155. }
  12156. else if (value.layoutName === 'fbar') {
  12157. hasFbar = true;
  12158. }
  12159. else {
  12160. hasBody = true;
  12161. }
  12162. });
  12163. }
  12164. switch (switchType) {
  12165. case 'fit':
  12166. if (!hasTbar) {
  12167. itemArr.push('tbar');
  12168. }
  12169. if (!hasFbar) {
  12170. itemArr.push('fbar');
  12171. }
  12172. if (!hasBody) {
  12173. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  12174. }
  12175. option.items = this.menuNew(itemArr, raw);
  12176. break;
  12177. case 'border':
  12178. if (!hasTbar) {
  12179. itemArr.push('tbar');
  12180. }
  12181. if (!hasFbar) {
  12182. itemArr.push('fbar');
  12183. }
  12184. itemArr.push('cnsew');
  12185. option.items = this.menuNew(itemArr, raw);
  12186. break;
  12187. // case 'tbar':
  12188. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  12189. // break;
  12190. // case 'fbar':
  12191. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  12192. // break;
  12193. case 'tabpanel':
  12194. if (!hasTbar) {
  12195. itemArr.push('tbar');
  12196. }
  12197. if (!hasFbar) {
  12198. itemArr.push('fbar');
  12199. }
  12200. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  12201. option.items = this.menuNew(itemArr, raw);
  12202. break;
  12203. case 'yvgrid':
  12204. if (!hasTbar) {
  12205. itemArr.push('tbar');
  12206. }
  12207. option.items = this.menuNew(itemArr, raw);
  12208. break;
  12209. case 'tree':
  12210. if (!hasTbar) {
  12211. itemArr.push('tbar');
  12212. }
  12213. if (!hasFbar) {
  12214. itemArr.push('fbar');
  12215. }
  12216. option.items = this.menuNew(itemArr, raw);
  12217. break;
  12218. case 'fieldset':
  12219. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  12220. break;
  12221. case 'form':
  12222. if (!hasTbar) {
  12223. itemArr.push('tbar');
  12224. }
  12225. if (!hasFbar) {
  12226. itemArr.push('fbar');
  12227. }
  12228. itemArr.push('form', 'fieldset', 'cols');
  12229. option.items = this.menuNew(itemArr, raw);
  12230. break;
  12231. case 'toolbar':
  12232. itemArr.push('button', 'textfield', 'label', 'combo');
  12233. option.items = this.menuNew(itemArr, raw);
  12234. break;
  12235. // case 'fbar':
  12236. // itemArr.push('button', 'textfield', 'label', 'combo')
  12237. // option.items = this.menuNew(itemArr, raw)
  12238. // break
  12239. default:
  12240. option.items = this.menuNew(itemArr, raw);
  12241. break;
  12242. }
  12243. var treeMenu = new Ext.menu.Menu(option);
  12244. treeMenu.showAt(e.getXY());
  12245. },
  12246. newItem: function (viewType, raw, region) {
  12247. var itemVjson = {};
  12248. switch (viewType) {
  12249. case 'fit':
  12250. itemVjson.layout = 'fit';
  12251. itemVjson.items = [];
  12252. break;
  12253. case 'border':
  12254. itemVjson.layout = 'border';
  12255. itemVjson.items = [];
  12256. break;
  12257. case 'toolbar':
  12258. itemVjson.xtype = 'toolbar';
  12259. itemVjson.title = 'toolbar';
  12260. itemVjson.items = [
  12261. {
  12262. xtype: 'button',
  12263. text: 'button'
  12264. }
  12265. ];
  12266. break;
  12267. case 'tabpanel':
  12268. itemVjson.xtype = 'tabpanel';
  12269. itemVjson.layout = 'fit';
  12270. itemVjson.items = [];
  12271. break;
  12272. case 'yvgrid':
  12273. itemVjson.xtype = 'yvgrid';
  12274. itemVjson.layout = 'fit';
  12275. itemVjson.pagination = false;
  12276. itemVjson.columns = [
  12277. {
  12278. dataIndex: "skuId",
  12279. header: "SKU_ID",
  12280. },
  12281. ];
  12282. break;
  12283. case 'tree':
  12284. itemVjson.xtype = 'treepanel';
  12285. itemVjson.layout = 'fit';
  12286. break;
  12287. case 'fieldset':
  12288. case 'form':
  12289. itemVjson.xtype = viewType;
  12290. itemVjson.title = viewType;
  12291. itemVjson.items = [
  12292. {
  12293. xtype: 'cols',
  12294. items: [
  12295. {
  12296. xtype: 'textfield',
  12297. fieldLabel: '输入框'
  12298. }
  12299. ]
  12300. }
  12301. ];
  12302. break;
  12303. case 'cols':
  12304. itemVjson.xtype = 'cols';
  12305. itemVjson.items = [
  12306. {
  12307. xtype: 'textfield',
  12308. fieldLabel: '输入框'
  12309. }
  12310. ];
  12311. break;
  12312. case 'button':
  12313. itemVjson.xtype = 'button';
  12314. itemVjson.text = '按钮';
  12315. itemVjson.iconCls = 'x-fa fa-plus';
  12316. break;
  12317. case 'textfield':
  12318. itemVjson.xtype = 'textfield';
  12319. itemVjson.fieldLabel = '输入框';
  12320. break;
  12321. case 'combo':
  12322. itemVjson.xtype = 'combo';
  12323. itemVjson.fieldLabel = '下拉框';
  12324. break;
  12325. case 'label':
  12326. itemVjson.xtype = 'label';
  12327. itemVjson.text = '文本';
  12328. break;
  12329. }
  12330. var target = findInCode(this.vjson, raw.id);
  12331. if (region) {
  12332. if (region === 'tbar' || region === 'fbar') {
  12333. target[region] = itemVjson;
  12334. }
  12335. else {
  12336. itemVjson.region = region;
  12337. itemVjson.split = true;
  12338. if (region === 'north' || region === 'south') {
  12339. itemVjson.height = '30%';
  12340. itemVjson.collapsible = true;
  12341. }
  12342. else if (region === 'west' || region === 'east') {
  12343. itemVjson.width = '30%';
  12344. itemVjson.collapsible = true;
  12345. }
  12346. target.items.push(itemVjson);
  12347. }
  12348. }
  12349. else {
  12350. if (target.xtype === 'tabpanel') {
  12351. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  12352. }
  12353. target.items.push(itemVjson);
  12354. }
  12355. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  12356. },
  12357. menuNew: function (typeArr, raw, region) {
  12358. var that = this;
  12359. var reArr = [];
  12360. typeArr.forEach(function (value) {
  12361. if (value === 'cnsew') {
  12362. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  12363. }
  12364. else if (value === 'tbar' || value === 'fbar') {
  12365. reArr.push(that.menuNewTFBar(value, raw));
  12366. }
  12367. else {
  12368. reArr.push({
  12369. text: '新建' + layoutOrXtypeNameMap[value],
  12370. iconCls: 'x-fa fa-plus',
  12371. handler: function (sender) {
  12372. that.newItem(value, raw, region);
  12373. }
  12374. });
  12375. }
  12376. reArr.push("-");
  12377. });
  12378. if (region) {
  12379. reArr.pop();
  12380. return reArr;
  12381. }
  12382. reArr.push({
  12383. text: '高级属性',
  12384. iconCls: 'x-fa fa-cog',
  12385. handler: function (sender) {
  12386. var vj = findInCode(that.vjson, raw.id);
  12387. that.advancedSettingWindow(vj);
  12388. }
  12389. }, {
  12390. text: '上移',
  12391. iconCls: 'x-fa fa-trash',
  12392. handler: function (sender) {
  12393. that.moveCmp(raw.id, 'up');
  12394. }
  12395. }, {
  12396. text: '置顶',
  12397. iconCls: 'x-fa fa-trash',
  12398. handler: function (sender) {
  12399. that.moveCmp(raw.id, 'top');
  12400. }
  12401. }, {
  12402. text: '置底',
  12403. iconCls: 'x-fa fa-trash',
  12404. handler: function (sender) {
  12405. that.moveCmp(raw.id, 'bottom');
  12406. }
  12407. }, {
  12408. text: '下移',
  12409. iconCls: 'x-fa fa-trash',
  12410. handler: function (sender) {
  12411. that.moveCmp(raw.id, 'down');
  12412. }
  12413. }, {
  12414. text: '删除',
  12415. iconCls: 'x-fa fa-trash',
  12416. handler: function (sender) {
  12417. deletVjsonById(that.vjson, raw.id);
  12418. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  12419. }
  12420. });
  12421. return reArr;
  12422. },
  12423. menuNewCNSEW: function (raw) {
  12424. var that = this;
  12425. var arr = ['center', 'north', 'south', 'west', 'east'];
  12426. if (raw.hasOwnProperty("children")) {
  12427. _.forEach(raw.children, function (value) {
  12428. _.remove(arr, function (it) {
  12429. return it === value.layoutName;
  12430. });
  12431. });
  12432. }
  12433. var reArr = [];
  12434. arr.forEach(function (value) {
  12435. reArr.push({
  12436. text: layoutOrXtypeNameMap[value],
  12437. iconCls: 'x-fa fa-plus',
  12438. menu: {
  12439. showSeparator: true,
  12440. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  12441. }
  12442. });
  12443. reArr.push("-");
  12444. });
  12445. reArr.pop();
  12446. return reArr;
  12447. },
  12448. menuNewTFBar: function (barType, raw) {
  12449. var that = this;
  12450. var reObj = {
  12451. text: layoutOrXtypeNameMap[barType],
  12452. iconCls: 'x-fa fa-plus',
  12453. menu: {
  12454. showSeparator: true,
  12455. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  12456. }
  12457. };
  12458. return reObj;
  12459. },
  12460. moveCmp: function (id, moveType) {
  12461. var arr = findArrayContainer(this.vjson, id);
  12462. var index = _.findIndex(arr, function (v) { return v.id === id; });
  12463. if (index < 0) {
  12464. return;
  12465. }
  12466. switch (moveType) {
  12467. case 'up':
  12468. if (index > 0) {
  12469. var o = arr[index];
  12470. arr[index] = arr[index - 1];
  12471. arr[index - 1] = o;
  12472. }
  12473. else {
  12474. return;
  12475. }
  12476. break;
  12477. case 'down':
  12478. if (index < arr.length - 1) {
  12479. var o = arr[index];
  12480. arr[index] = arr[index + 1];
  12481. arr[index + 1] = o;
  12482. }
  12483. else {
  12484. return;
  12485. }
  12486. break;
  12487. case 'top':
  12488. if (index > 0) {
  12489. var o = arr[index];
  12490. arr[index] = arr[0];
  12491. arr[0] = o;
  12492. }
  12493. else {
  12494. return;
  12495. }
  12496. break;
  12497. case 'bottom':
  12498. if (index < arr.length - 1) {
  12499. var o = arr[index];
  12500. arr[index] = arr[arr.length - 1];
  12501. arr[arr.length - 1] = o;
  12502. }
  12503. else {
  12504. return;
  12505. }
  12506. break;
  12507. }
  12508. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  12509. }
  12510. });
  12511. }
  12512. // 字段域数据
  12513. var columnDomain = undefined;
  12514. var DomainStore = /** @class */ (function (_super) {
  12515. __extends(DomainStore, _super);
  12516. function DomainStore() {
  12517. return _super !== null && _super.apply(this, arguments) || this;
  12518. }
  12519. DomainStore.prototype.getCacheKey = function (param) {
  12520. return "domain_data.json";
  12521. };
  12522. DomainStore.prototype.invokeApi = function (param) {
  12523. return getColumnDomainApi();
  12524. };
  12525. /**
  12526. * 设置全局可访问的 字段域数据
  12527. */
  12528. DomainStore.prototype.getColumnDomainComboData = function () {
  12529. var _this = this;
  12530. return new Promise(function (resolve) {
  12531. _this.reloadIfNeedPromise(undefined).then(function (res) {
  12532. resolve(_this.apiResponse.data.map(function (v) {
  12533. return { id: v.domain_id, text: v.domain_name };
  12534. }));
  12535. });
  12536. });
  12537. };
  12538. /**
  12539. * 设置全局可访问的 字段域数据
  12540. */
  12541. DomainStore.prototype.getColumnDomainById = function (value) {
  12542. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  12543. };
  12544. DomainStore.prototype.getAllDomain = function () {
  12545. return new Promise(function (resolve, reject) {
  12546. getColumnDomainApi()
  12547. .then(function (res) {
  12548. if (res.success) {
  12549. if (res.success) {
  12550. var tt = _$2.map(res.data, function (row) {
  12551. return {
  12552. text: row.domain_name,
  12553. id: row.domain_id,
  12554. };
  12555. });
  12556. _$2.set(window, 'DICT_CACHE.column_domain', tt);
  12557. }
  12558. columnDomain = res.data;
  12559. resolve(res.data);
  12560. }
  12561. else {
  12562. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  12563. console.error('getColumnDomain', res.msg);
  12564. }
  12565. })
  12566. .catch(function (e) {
  12567. window['showErrorDialog']('getColumnDomain error!');
  12568. console.error('getColumnDomain', e);
  12569. reject(e);
  12570. });
  12571. });
  12572. };
  12573. return DomainStore;
  12574. }(CacheStore));
  12575. var instance$3 = new DomainStore();
  12576. function init$1 () {
  12577. window['native'] = native;
  12578. native.init();
  12579. init();
  12580. instance$3.getAllDomain().finally(function () {
  12581. });
  12582. initStateTree();
  12583. initDashboard();
  12584. initFileTree();
  12585. initDbTree();
  12586. initReportGrid();
  12587. initGroovyEditor();
  12588. initJsEditor();
  12589. initJsonEditor();
  12590. initSqlEditor();
  12591. initTemplateEditor();
  12592. initDict();
  12593. initBpmnTree();
  12594. initToolBox();
  12595. initPropertyDesign();
  12596. initViewOutlineTree();
  12597. initWidget();
  12598. initWhLayout();
  12599. initApiTree();
  12600. initTaskTree();
  12601. initLogsTree();
  12602. initDevOpsTree();
  12603. initTerminal();
  12604. initMonitorTree();
  12605. initHomeTree();
  12606. }
  12607. var model$c = {
  12608. data: {
  12609. leftTabTitle: ''
  12610. }
  12611. };
  12612. var vjson$c = {
  12613. frame: false,
  12614. layout: 'border',
  12615. width: '100%',
  12616. height: '100%',
  12617. border: false,
  12618. defaults: {
  12619. border: false
  12620. },
  12621. items: [
  12622. {
  12623. region: 'north',
  12624. height: 60,
  12625. cls: 'main-header',
  12626. reference: 'mainTop',
  12627. layout: 'hbox',
  12628. items: [
  12629. {
  12630. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  12631. flex: 1,
  12632. border: false
  12633. },
  12634. {
  12635. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  12636. menu: [
  12637. {
  12638. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  12639. reference: 'commonSetting'
  12640. },
  12641. {
  12642. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  12643. listeners: {
  12644. // click: 'scope.ready_api_click'
  12645. }
  12646. },
  12647. ]
  12648. },
  12649. {
  12650. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  12651. cls: 'header-menu',
  12652. menu: [
  12653. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  12654. ]
  12655. },
  12656. ]
  12657. },
  12658. {
  12659. region: 'west',
  12660. bind: {
  12661. title: '{leftTabTitle}',
  12662. },
  12663. titleAlign: 'center',
  12664. border: true, split: true, width: 340, collapsible: true,
  12665. reference: 'leftTab',
  12666. xtype: 'tabpanel',
  12667. tabPosition: 'left',
  12668. tabRotation: 0,
  12669. tabBar: {
  12670. border: false
  12671. },
  12672. listeners: {
  12673. tabchange: 'scope.leftTabChange',
  12674. },
  12675. items: [
  12676. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  12677. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  12678. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  12679. // {tooltip: '表单转换', iconCls: 'x-fa fa-exchange',},
  12680. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  12681. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  12682. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  12683. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  12684. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  12685. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  12686. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  12687. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  12688. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  12689. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  12690. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  12691. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  12692. ]
  12693. },
  12694. {
  12695. region: 'east',
  12696. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  12697. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  12698. },
  12699. {
  12700. region: 'center',
  12701. split: true, border: true,
  12702. xtype: 'maintab', reference: 'tt', id: 'TT',
  12703. plain: true,
  12704. listeners: {
  12705. restorypage: 'scope.openScope',
  12706. tabchange: 'scope.tabchange'
  12707. },
  12708. items: []
  12709. },
  12710. ],
  12711. };
  12712. var model$d = {
  12713. data: {
  12714. dataSync_isStart: false,
  12715. dataSync: {
  12716. skipError: false,
  12717. clearData: false,
  12718. tables: []
  12719. },
  12720. dataSyncResult: {
  12721. jobId: ''
  12722. },
  12723. dataSource1: '',
  12724. dataSource2: '',
  12725. schema1: '',
  12726. schema2: '',
  12727. hasDiff: false,
  12728. }
  12729. };
  12730. var vjson$d = {
  12731. title: '数据库同步',
  12732. layout: 'fit',
  12733. items: [
  12734. {
  12735. reference: 'wizard1',
  12736. layout: 'card',
  12737. items: [
  12738. {
  12739. reference: 'first',
  12740. layout: 'fit',
  12741. bbar: [
  12742. '->',
  12743. {
  12744. xtype: 'button',
  12745. iconCls: 'x-fa fa-road',
  12746. text: '结构同步 &raquo;',
  12747. bind: {
  12748. disabled: '{!hasDiff}'
  12749. },
  12750. listeners: {
  12751. click: 'scope.structCopyTo',
  12752. }
  12753. },
  12754. {
  12755. xtype: 'button',
  12756. iconCls: 'x-fa fa-files-o',
  12757. text: '数据同步 &raquo;',
  12758. bind: {
  12759. disabled: '{!hasDiff}'
  12760. },
  12761. listeners: {
  12762. click: 'scope.dataCopyTo',
  12763. }
  12764. },
  12765. {
  12766. xtype: 'button',
  12767. iconCls: 'x-fa fa-sort-alpha-desc',
  12768. text: '索引同步 &raquo;',
  12769. bind: {
  12770. disabled: '{!hasDiff}'
  12771. },
  12772. listeners: {
  12773. click: 'scope.indexCopyTo',
  12774. }
  12775. },
  12776. {
  12777. xtype: 'button',
  12778. iconCls: 'x-fa fa-product-hunt',
  12779. text: '存储过程同步 &raquo;',
  12780. bind: {
  12781. disabled: '{!hasDiff}'
  12782. },
  12783. listeners: {
  12784. click: 'scope.procedureCopyTo',
  12785. }
  12786. },
  12787. ],
  12788. items: [
  12789. {
  12790. title: '数据库对比',
  12791. reference: 'grid1',
  12792. xtype: 'yvgrid',
  12793. pagination: false,
  12794. border: false,
  12795. cellTip: true,
  12796. selModel: {
  12797. type: 'checkboxmodel',
  12798. mode: 'MULTI',
  12799. },
  12800. tbar: {
  12801. xtype: 'toolbar',
  12802. items: [
  12803. {
  12804. xtype: 'combo',
  12805. fieldLabel: '源数据库',
  12806. bind: {
  12807. value: '{dataSource1}'
  12808. },
  12809. dataSource: 'scope.getDataBaseName'
  12810. },
  12811. {
  12812. xtype: 'combo',
  12813. fieldLabel: '目标数据库',
  12814. bind: {
  12815. value: '{dataSource2}'
  12816. },
  12817. dataSource: 'scope.getDataBaseName'
  12818. },
  12819. {
  12820. xtype: 'button',
  12821. iconCls: 'x-fa fa-flash',
  12822. text: '对比',
  12823. bind: {
  12824. disabled: '{!dataSource1 || !dataSource2}'
  12825. },
  12826. listeners: {
  12827. click: 'scope.diff',
  12828. }
  12829. },
  12830. {
  12831. xtype: 'button',
  12832. iconCls: 'x-fa fa-cloud-download',
  12833. text: '重新拉取结构(耗时!)',
  12834. bind: {
  12835. disabled: '{!dataSource1 || !dataSource2}'
  12836. },
  12837. listeners: {
  12838. click: 'scope.dbToMeta',
  12839. }
  12840. },
  12841. ]
  12842. },
  12843. columns: [
  12844. {
  12845. dataIndex: 'table_name1',
  12846. header: '源表',
  12847. width: 300,
  12848. },
  12849. {
  12850. dataIndex: 'table_name2',
  12851. header: '目标表',
  12852. width: 300,
  12853. },
  12854. {
  12855. dataIndex: 'diff',
  12856. header: '对比结果',
  12857. width: 100,
  12858. },
  12859. {
  12860. xtype: 'actioncolumn',
  12861. width: 30,
  12862. sortable: false,
  12863. menuDisabled: true,
  12864. items: [
  12865. {
  12866. iconCls: 'x-fa fa-bars',
  12867. text: '打开',
  12868. handler: 'scope.showDetail',
  12869. }
  12870. ]
  12871. },
  12872. {
  12873. dataIndex: 'remark',
  12874. header: '详情',
  12875. width: 200,
  12876. sortable: true,
  12877. },
  12878. ],
  12879. },
  12880. ]
  12881. },
  12882. {
  12883. reference: 'ddl',
  12884. layout: {
  12885. type: 'vbox',
  12886. pack: 'start',
  12887. align: 'stretch'
  12888. },
  12889. items: [
  12890. {
  12891. xtype: 'sqleditor',
  12892. reference: 'ddleditor',
  12893. flex: 1,
  12894. },
  12895. {
  12896. xtype: 'toolbar',
  12897. items: [
  12898. '->',
  12899. {
  12900. xtype: 'button',
  12901. text: '&laquo; 上一步',
  12902. listeners: {
  12903. click: 'scope.back'
  12904. }
  12905. },
  12906. {
  12907. xtype: 'button',
  12908. iconCls: 'x-fa fa-flash',
  12909. text: '执行',
  12910. listeners: {
  12911. click: 'scope.executeDDL'
  12912. }
  12913. },
  12914. ]
  12915. }
  12916. ]
  12917. },
  12918. {
  12919. reference: 'ddl_idx',
  12920. layout: {
  12921. type: 'vbox',
  12922. pack: 'start',
  12923. align: 'stretch'
  12924. },
  12925. items: [
  12926. {
  12927. xtype: 'sqleditor',
  12928. reference: 'ddleditor_idx',
  12929. flex: 1,
  12930. },
  12931. {
  12932. xtype: 'toolbar',
  12933. items: [
  12934. '->',
  12935. {
  12936. xtype: 'button',
  12937. text: '&laquo; 上一步',
  12938. listeners: {
  12939. click: 'scope.back'
  12940. }
  12941. },
  12942. {
  12943. xtype: 'button',
  12944. iconCls: 'x-fa fa-flash',
  12945. text: '执行',
  12946. listeners: {
  12947. click: 'scope.executeDDLIdx'
  12948. }
  12949. },
  12950. ]
  12951. }
  12952. ]
  12953. },
  12954. {
  12955. reference: 'ddl_procedure',
  12956. layout: {
  12957. type: 'vbox',
  12958. pack: 'start',
  12959. align: 'stretch'
  12960. },
  12961. items: [
  12962. {
  12963. xtype: 'sqleditor',
  12964. reference: 'ddleditor_procedure',
  12965. flex: 1,
  12966. },
  12967. {
  12968. xtype: 'toolbar',
  12969. items: [
  12970. '->',
  12971. {
  12972. xtype: 'button',
  12973. text: '&laquo; 上一步',
  12974. listeners: {
  12975. click: 'scope.back'
  12976. }
  12977. },
  12978. {
  12979. xtype: 'button',
  12980. iconCls: 'x-fa fa-flash',
  12981. text: '执行',
  12982. listeners: {
  12983. click: 'scope.executeProcedureSQL'
  12984. }
  12985. },
  12986. ]
  12987. }
  12988. ]
  12989. },
  12990. {
  12991. reference: 'datacopy',
  12992. xtype: 'yvgrid',
  12993. pagination: false,
  12994. tbar: {
  12995. xtype: 'toolbar',
  12996. items: [
  12997. {
  12998. xtype: 'checkbox',
  12999. fieldLabel: '忽略错误',
  13000. bind: {
  13001. value: '{dataSync.skipError}'
  13002. },
  13003. },
  13004. {
  13005. xtype: 'checkbox',
  13006. fieldLabel: '清空数据',
  13007. bind: {
  13008. value: '{dataSync.clearData}'
  13009. },
  13010. },
  13011. {
  13012. xtype: 'button',
  13013. iconCls: 'x-fa fa-play-circle',
  13014. text: '开始',
  13015. bind: {
  13016. disabled: '{dataSync_isStart}'
  13017. },
  13018. listeners: { click: 'scope.dataSync_start' }
  13019. },
  13020. {
  13021. xtype: 'button',
  13022. iconCls: 'x-fa fa-stop-circle',
  13023. text: '停止',
  13024. bind: {
  13025. disabled: '{!dataSync_isStart}'
  13026. },
  13027. listeners: { click: 'scope.dataSync_stop' }
  13028. },
  13029. ]
  13030. },
  13031. columns: [
  13032. {
  13033. dataIndex: 'tableName', header: '表名',
  13034. width: 300,
  13035. },
  13036. {
  13037. dataIndex: 'dataCount', header: '总记录数',
  13038. width: 150,
  13039. },
  13040. {
  13041. dataIndex: 'currentIdx', header: '当前记录数',
  13042. width: 150,
  13043. },
  13044. {
  13045. dataIndex: 'syncCount', header: '同步数',
  13046. width: 150,
  13047. },
  13048. {
  13049. dataIndex: 'deleteCount', header: '删除',
  13050. width: 150,
  13051. },
  13052. {
  13053. dataIndex: 'syncProgress', header: '进度',
  13054. width: 150, dataType: 'int', formatter: 'percentRenderer'
  13055. },
  13056. ]
  13057. }
  13058. ]
  13059. }
  13060. ]
  13061. };
  13062. /**
  13063. * 对比两个列 是否存在不一致
  13064. */
  13065. function compareColumn(t1, c1, t2, c2) {
  13066. if (typeof c2 === 'undefined') {
  13067. return 'column_name';
  13068. }
  13069. if (c1.column_name !== c2.column_name) {
  13070. return 'column_name';
  13071. }
  13072. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  13073. return 'default_value';
  13074. }
  13075. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  13076. return 'column_comment';
  13077. }
  13078. if (c1.is_primary_key !== c2.is_primary_key) {
  13079. return 'is_primary_key';
  13080. }
  13081. if (c1.not_null !== c2.not_null) {
  13082. return 'not_null';
  13083. }
  13084. var symbol1 = getDataTypeSymbol(t1, c1);
  13085. var symbol2 = getDataTypeSymbol(t2, c2);
  13086. if (symbol1 !== symbol2) {
  13087. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  13088. return 'data_type';
  13089. }
  13090. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  13091. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  13092. // 只关注长度
  13093. if (c1.column_size != c2.column_size) {
  13094. return 'column_size';
  13095. }
  13096. }
  13097. else {
  13098. // 其他情况,长度和精度都要关注
  13099. if (c1.column_size != c2.column_size) {
  13100. return 'column_size';
  13101. }
  13102. if (c1.decimal_digits !== c2.decimal_digits) {
  13103. return 'decimal_digits';
  13104. }
  13105. }
  13106. }
  13107. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  13108. var symbol1 = getDataTypeSymbol(tableInfo, column);
  13109. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  13110. if (symbol1 !== symbol2) {
  13111. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  13112. return 'data_type';
  13113. }
  13114. if (is_fix_size) {
  13115. // 字段域吧大小限制住了
  13116. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  13117. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  13118. // 只关注长度
  13119. if (column.column_size != domain.column_size) {
  13120. return 'column_size';
  13121. }
  13122. }
  13123. else {
  13124. // 其他情况,长度和精度都要关注
  13125. if (column.column_size != domain.column_size) {
  13126. return 'column_size';
  13127. }
  13128. if (column.decimal_digits !== domain.decimal_digits) {
  13129. return 'decimal_digits';
  13130. }
  13131. }
  13132. }
  13133. }
  13134. function checkColumn(table, col) {
  13135. if (isEmpty(col.column_name)) {
  13136. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  13137. }
  13138. if (isKeyword(col.column_name)) {
  13139. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  13140. }
  13141. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  13142. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  13143. }
  13144. return undefined;
  13145. }
  13146. function applyDomain(dbType, domain) {
  13147. var editRow = {
  13148. data_type: domain[dbType + '_datatype'],
  13149. };
  13150. domain = _$2.cloneDeep(domain);
  13151. if (!editRow.data_type) {
  13152. throw Error('字段域没有定义数据类型!');
  13153. }
  13154. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  13155. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  13156. if (match) {
  13157. // 类型里面包含括号
  13158. var sz = parseInt(match[2]);
  13159. if (isNaN(sz)) {
  13160. throw Error('字段域的定义错误:' + editRow.data_type);
  13161. }
  13162. domain.is_fix_size = true;
  13163. editRow.data_type = match[1];
  13164. domain.column_size = sz;
  13165. domain.decimal_digits = 0;
  13166. }
  13167. else {
  13168. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  13169. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  13170. if (match2) {
  13171. // 类型里面包含括号
  13172. var sz = parseInt(match2[2]);
  13173. if (isNaN(sz)) {
  13174. throw Error('字段域的定义错误:' + editRow.data_type);
  13175. }
  13176. var dg = parseInt(match2[3]);
  13177. if (isNaN(dg)) {
  13178. throw Error('字段域的定义错误:' + editRow.data_type);
  13179. }
  13180. domain.is_fix_size = true;
  13181. editRow.data_type = match[1];
  13182. domain.column_size = sz;
  13183. domain.decimal_digits = dg;
  13184. }
  13185. }
  13186. if (domain.domain_column_ui) {
  13187. _$2.extend(editRow, {
  13188. column_ui: domain.domain_column_ui,
  13189. });
  13190. }
  13191. if (domain.domain_column_dict) {
  13192. _$2.extend(editRow, {
  13193. column_dict: domain.domain_column_dict,
  13194. });
  13195. }
  13196. if (domain.is_fix_size) {
  13197. _$2.extend(editRow, {
  13198. column_size: domain.column_size,
  13199. decimal_digits: domain.decimal_digits
  13200. });
  13201. }
  13202. if (domain.is_fix_default_value) {
  13203. _$2.extend(editRow, {
  13204. default_value: domain.default_value,
  13205. });
  13206. }
  13207. return editRow;
  13208. }
  13209. /**
  13210. * 获取字段类型代号(用于做跨数据库数据类型对比)
  13211. */
  13212. function getDataTypeSymbol(table, col) {
  13213. if (table.db_type === 'oracle') {
  13214. switch (col.data_type) {
  13215. case 'number':
  13216. if (col.column_size <= 10 && !col.decimal_digits) {
  13217. return 'integer';
  13218. }
  13219. else if (col.column_size <= 19 && !col.decimal_digits) {
  13220. return 'long';
  13221. }
  13222. return 'bigdecimal';
  13223. case 'char':
  13224. if (col.column_size > 3000) {
  13225. return 'clob';
  13226. }
  13227. return 'char';
  13228. case 'integer':
  13229. return 'integer';
  13230. case 'varchar':
  13231. case 'varchar2':
  13232. if (col.column_size > 3000) {
  13233. return 'clob';
  13234. }
  13235. return 'varchar';
  13236. case 'clob':
  13237. return 'clob';
  13238. case 'blob':
  13239. return 'blob';
  13240. case 'date':
  13241. case 'timestamp':
  13242. case 'timestamp(6)':
  13243. case 'timestamp with local time zone':
  13244. case 'timestamp(6) with local time zone':
  13245. case 'timestamp(6) with time zone':
  13246. return 'timestamp';
  13247. }
  13248. return "undefined";
  13249. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  13250. }
  13251. if (table.db_type === 'pgsql') {
  13252. switch (col.data_type) {
  13253. case 'int4':
  13254. return 'integer';
  13255. case 'int8':
  13256. return 'long';
  13257. case 'char':
  13258. return 'char';
  13259. case 'varchar':
  13260. case 'varchar2':
  13261. if (col.column_size > 3000) {
  13262. return 'clob';
  13263. }
  13264. return 'varchar';
  13265. case 'numeric':
  13266. if (col.column_size <= 10 && !col.decimal_digits) {
  13267. return 'integer';
  13268. }
  13269. else if (col.column_size <= 19 && !col.decimal_digits) {
  13270. return 'long';
  13271. }
  13272. return 'bigdecimal';
  13273. case 'timestamp':
  13274. case 'timestamptz':
  13275. return 'timestamp';
  13276. case 'bytea':
  13277. return 'blob';
  13278. }
  13279. return "undefined";
  13280. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  13281. }
  13282. throw Error('未知数据库类型:' + table.db_type);
  13283. }
  13284. /**
  13285. * 判断对象名称是不是数据库关键字(保留字)
  13286. */
  13287. function isKeyword(word) {
  13288. if (!word || typeof word !== 'string') {
  13289. return false;
  13290. }
  13291. var kk = ['access',
  13292. 'add',
  13293. 'all',
  13294. 'alter',
  13295. 'and',
  13296. 'any',
  13297. 'as',
  13298. 'asc',
  13299. 'audit',
  13300. 'between',
  13301. 'by',
  13302. 'char',
  13303. 'check',
  13304. 'cluster',
  13305. 'column',
  13306. 'comment',
  13307. 'compress',
  13308. 'connect',
  13309. 'create',
  13310. 'current',
  13311. 'date',
  13312. 'decimal',
  13313. 'default',
  13314. 'delete',
  13315. 'desc',
  13316. 'distinct',
  13317. 'drop',
  13318. 'else',
  13319. 'exclusive',
  13320. 'exists',
  13321. 'file',
  13322. 'float',
  13323. 'for',
  13324. 'from',
  13325. 'grant',
  13326. 'group',
  13327. 'having',
  13328. 'identified',
  13329. 'immediate',
  13330. 'in',
  13331. 'increment',
  13332. 'index',
  13333. 'initial',
  13334. 'insert',
  13335. 'integer',
  13336. 'intersect',
  13337. 'into',
  13338. 'is',
  13339. 'level',
  13340. 'like',
  13341. 'lock',
  13342. 'long',
  13343. 'maxextents',
  13344. 'minus',
  13345. 'mlslabel',
  13346. 'mode',
  13347. 'modify',
  13348. 'noaudit',
  13349. 'nocompress',
  13350. 'not',
  13351. 'nowait',
  13352. 'null',
  13353. 'number',
  13354. 'of',
  13355. 'offline',
  13356. 'on',
  13357. 'online',
  13358. 'option',
  13359. 'or',
  13360. 'order',
  13361. 'p',
  13362. 'ctfree',
  13363. 'prior',
  13364. 'privileges',
  13365. 'public',
  13366. 'raw',
  13367. 'rename',
  13368. 'resource',
  13369. 'revoke',
  13370. 'row',
  13371. 'rowid',
  13372. 'rownum',
  13373. 'rows',
  13374. 'select',
  13375. 'session',
  13376. 'set',
  13377. 'share',
  13378. 'size',
  13379. 'smallint',
  13380. 'start',
  13381. 'successful',
  13382. 'synonym',
  13383. 'sysdate',
  13384. 'table',
  13385. 'then',
  13386. 'to',
  13387. 'trigger',
  13388. 'uid',
  13389. 'union',
  13390. 'unique',
  13391. 'update',
  13392. 'user',
  13393. 'validate',
  13394. 'values',
  13395. 'varchar',
  13396. 'varchar2',
  13397. 'view',
  13398. 'whenever',
  13399. 'where',
  13400. 'with'];
  13401. return _$2.includes(kk, word.toLowerCase());
  13402. }
  13403. var DbSync = /** @class */ (function (_super) {
  13404. __extends(DbSync, _super);
  13405. function DbSync() {
  13406. return _super.call(this, { model: model$d, vjson: vjson$d }) || this;
  13407. }
  13408. DbSync.prototype.onLoad = function () {
  13409. };
  13410. DbSync.prototype.getDataBaseName = function (sender, _a) {
  13411. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  13412. getDataBaseNameApi().then(function (res) {
  13413. successCallback(res.data.map(function (name) {
  13414. return {
  13415. id: name, text: name
  13416. };
  13417. }));
  13418. });
  13419. };
  13420. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  13421. showInfoDialog(record.get('remark'));
  13422. };
  13423. DbSync.prototype.diff = function () {
  13424. var _this = this;
  13425. var promise1 = getMateData({
  13426. datasource: this.viewModel.get('dataSource1')
  13427. });
  13428. var promise2 = getMateData({
  13429. datasource: this.viewModel.get('dataSource2')
  13430. });
  13431. this.viewModel.set('schema1', '');
  13432. this.viewModel.set('schema2', '');
  13433. this.refs.grid1.setLoading(true);
  13434. Promise.all([promise1, promise2]).then(function (_a) {
  13435. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  13436. var rows = [];
  13437. if (_$2.size(res1) > 0) {
  13438. // res1 起码有一个 schema
  13439. _this.viewModel.set('schema1', res1[0].schema_name);
  13440. _this.viewModel.set('schema2', res2[0].schema_name);
  13441. if (!_this.viewModel.get('schema1')) {
  13442. msg$1('datasource1 最起码需要一张表');
  13443. return;
  13444. }
  13445. if (!_this.viewModel.get('schema2')) {
  13446. msg$1('datasource2 最起码需要一张表');
  13447. return;
  13448. }
  13449. _$2.forEach(res1[0].table_list, function (table1) {
  13450. var _a;
  13451. 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; });
  13452. if (table1.schema_name) {
  13453. _this.viewModel.set('schema1', table1.schema_name);
  13454. }
  13455. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  13456. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  13457. }
  13458. var row = {
  13459. table_name1: table1.table_name,
  13460. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  13461. table_info: table1
  13462. };
  13463. if (!table2) {
  13464. row.diff = '不一致';
  13465. row.remark = '目标表缺失';
  13466. }
  13467. else if (table1.column_list.length !== table2.column_list.length) {
  13468. row.diff = '不一致';
  13469. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  13470. }
  13471. else {
  13472. row.diff = '一致';
  13473. var remark_1 = [];
  13474. _$2.forEach(table1.column_list, function (col1) {
  13475. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  13476. if (!col2) {
  13477. row.diff = '不一致';
  13478. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  13479. }
  13480. else {
  13481. var colDiff = compareColumn(table1, col1, table2, col2);
  13482. if (colDiff) {
  13483. row.diff = '不一致';
  13484. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  13485. }
  13486. }
  13487. });
  13488. row.remark = remark_1.join('\n');
  13489. }
  13490. rows.push(row);
  13491. });
  13492. }
  13493. _this.refs.grid1.setData(rows);
  13494. _this.viewModel.set('hasDiff', true);
  13495. }).finally(function () {
  13496. _this.refs.grid1.setLoading(false);
  13497. });
  13498. };
  13499. DbSync.prototype.structCopyTo = function () {
  13500. var _this = this;
  13501. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13502. msg$1('选择数据源!');
  13503. return;
  13504. }
  13505. var recordList = this.refs.grid1.getSelection();
  13506. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13507. if (_$2.size(tableNameList) <= 0) {
  13508. msg$1('请选择要同步的表');
  13509. return;
  13510. }
  13511. var error = undefined;
  13512. _$2.forEach(tableNameList, function (tableInfo) {
  13513. _$2.forEach(tableInfo.column_list, function (col) {
  13514. error = checkColumn(tableInfo, col);
  13515. return false;
  13516. });
  13517. if (error) {
  13518. return false;
  13519. }
  13520. });
  13521. if (error) {
  13522. msg$1(error);
  13523. return;
  13524. }
  13525. var schema1 = this.viewModel.get('schema1');
  13526. var schema2 = this.viewModel.get('schema2');
  13527. if (!schema1 || !schema2) {
  13528. msg$1('无法识别 schema 名称');
  13529. return;
  13530. }
  13531. this.refs.grid1.setLoading(true);
  13532. getDiffDDLApi({
  13533. datasource1: this.viewModel.get('dataSource1'),
  13534. datasource2: this.viewModel.get('dataSource2'),
  13535. schema1: this.viewModel.get('schema1'),
  13536. schema2: this.viewModel.get('schema2'),
  13537. tables: tableNameList,
  13538. }).then(function (res) {
  13539. if (res.success) {
  13540. _this.refs.ddleditor.setCode(res.data);
  13541. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  13542. }
  13543. }).finally(function () {
  13544. _this.refs.grid1.setLoading(false);
  13545. });
  13546. };
  13547. DbSync.prototype.indexCopyTo = function () {
  13548. var _this = this;
  13549. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13550. msg$1('选择数据源!');
  13551. return;
  13552. }
  13553. var recordList = this.refs.grid1.getSelection();
  13554. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13555. if (_$2.size(tableNameList) <= 0) {
  13556. msg$1('请选择要同步的表');
  13557. return;
  13558. }
  13559. var schema1 = this.viewModel.get('schema1');
  13560. var schema2 = this.viewModel.get('schema2');
  13561. if (!schema1 || !schema2) {
  13562. msg$1('无法识别 schema 名称');
  13563. return;
  13564. }
  13565. this.refs.grid1.setLoading(true);
  13566. getModifyIdxDDL({
  13567. datasource1: this.viewModel.get('dataSource1'),
  13568. datasource2: this.viewModel.get('dataSource2'),
  13569. schema1: this.viewModel.get('schema1'),
  13570. schema2: this.viewModel.get('schema2'),
  13571. tables: tableNameList,
  13572. }).then(function (res) {
  13573. if (res.success) {
  13574. _this.refs.ddleditor_idx.setCode(res.data);
  13575. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  13576. }
  13577. }).finally(function () {
  13578. _this.refs.grid1.setLoading(false);
  13579. });
  13580. };
  13581. DbSync.prototype.procedureCopyTo = function () {
  13582. var _this = this;
  13583. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13584. msg$1('选择数据源!');
  13585. return;
  13586. }
  13587. var schema1 = this.viewModel.get('schema1');
  13588. var schema2 = this.viewModel.get('schema2');
  13589. if (!schema1 || !schema2) {
  13590. msg$1('无法识别 schema 名称');
  13591. return;
  13592. }
  13593. this.refs.grid1.setLoading(true);
  13594. getModifyProcedureSQL({
  13595. datasource1: this.viewModel.get('dataSource1'),
  13596. datasource2: this.viewModel.get('dataSource2'),
  13597. schema1: this.viewModel.get('schema1'),
  13598. schema2: this.viewModel.get('schema2'),
  13599. }).then(function (res) {
  13600. if (res.success) {
  13601. _this.refs.ddleditor_procedure.setCode(res.data);
  13602. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  13603. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  13604. }
  13605. }).finally(function () {
  13606. _this.refs.grid1.setLoading(false);
  13607. });
  13608. };
  13609. DbSync.prototype.dataSync_start = function () {
  13610. var _this = this;
  13611. this.viewModel.set('dataSync_isStart', true);
  13612. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  13613. this.refs.datacopy.setLoading(true);
  13614. dataSyncApi(dataSync)
  13615. .then(function (res) {
  13616. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  13617. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  13618. })
  13619. .finally(function () {
  13620. _this.refs.datacopy.setLoading(false);
  13621. });
  13622. };
  13623. DbSync.prototype.dataSync_process = function () {
  13624. var _this = this;
  13625. var jobId = this.viewModel.get('dataSyncResult.jobId');
  13626. dataSyncInfoApi({ jobId: jobId })
  13627. .then(function (res) {
  13628. if (_$2.isArray(res.tableSyncInfos)) {
  13629. var scrollPosition = _this.refs.datacopy.scrollable.position;
  13630. _this.refs.datacopy.setData(res.tableSyncInfos);
  13631. try {
  13632. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  13633. }
  13634. catch (e) {
  13635. }
  13636. }
  13637. if (res.endTime) {
  13638. // 已经结束
  13639. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  13640. if (res.success) {
  13641. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  13642. }
  13643. else {
  13644. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  13645. }
  13646. _this.dataSync_stop();
  13647. }
  13648. })
  13649. .catch(function (e) {
  13650. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  13651. console.error(e);
  13652. // this.dataSync_stop()
  13653. })
  13654. .finally(function () {
  13655. _this.refs.datacopy.setLoading(false);
  13656. });
  13657. };
  13658. DbSync.prototype.dataSync_stop = function () {
  13659. this.viewModel.set('dataSync_isStart', false);
  13660. clearInterval(this.dataSyncInterval);
  13661. delete this.dataSyncInterval;
  13662. };
  13663. DbSync.prototype.dataCopyTo = function () {
  13664. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  13665. msg$1('选择数据源!');
  13666. return;
  13667. }
  13668. var recordList = this.refs.grid1.getSelection();
  13669. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  13670. if (_$2.size(tableNameList) <= 0) {
  13671. msg$1('请选择要同步的表');
  13672. return;
  13673. }
  13674. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  13675. this.viewModel.set('dataSync.tables', tableNameList);
  13676. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  13677. };
  13678. DbSync.prototype.next = function () {
  13679. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  13680. };
  13681. DbSync.prototype.back = function () {
  13682. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  13683. };
  13684. DbSync.prototype.dbToMeta = function () {
  13685. var _this = this;
  13686. var dataSource1 = this.viewModel.get('dataSource1');
  13687. var dataSource2 = this.viewModel.get('dataSource2');
  13688. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  13689. var promise1 = dbToMeta({ datasource: dataSource1 });
  13690. var promise2 = dbToMeta({ datasource: dataSource2 });
  13691. _this.refs.grid1.setLoading(true);
  13692. Promise.all([promise1, promise2]).then(function (_a) {
  13693. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  13694. _this.diff();
  13695. }).catch(function (res) {
  13696. _this.refs.grid1.setLoading(false);
  13697. showErrorDialog$1(res);
  13698. });
  13699. });
  13700. };
  13701. DbSync.prototype.executeDDL = function () {
  13702. var _this = this;
  13703. var code = this.refs.ddleditor.getValue();
  13704. var dataSource2 = this.viewModel.get('dataSource2');
  13705. var target_schema_name = this.viewModel.get('schema2');
  13706. var recordList = this.refs.grid1.getSelection();
  13707. var table_infos = _$2.map(recordList, function (r) {
  13708. return r.get('table_info');
  13709. });
  13710. this.setLoading(true);
  13711. pushToDbCommitApi({
  13712. datasource: dataSource2,
  13713. ddl: code,
  13714. table_infos: table_infos,
  13715. target_schema_name: target_schema_name,
  13716. }).then(function (res) {
  13717. if (res === null || res === void 0 ? void 0 : res.success) {
  13718. msg$1('执行成功');
  13719. _this.back();
  13720. _this.diff();
  13721. return;
  13722. }
  13723. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13724. }).finally(function () {
  13725. _this.setLoading(false);
  13726. });
  13727. };
  13728. DbSync.prototype.executeDDLIdx = function () {
  13729. var _this = this;
  13730. var code = this.refs.ddleditor_idx.getValue();
  13731. var dataSource2 = this.viewModel.get('dataSource2');
  13732. this.setLoading(true);
  13733. executeDDL({
  13734. datasource: dataSource2,
  13735. ddl: code,
  13736. }).then(function (res) {
  13737. if (res === null || res === void 0 ? void 0 : res.success) {
  13738. msg$1('执行成功');
  13739. _this.back();
  13740. return;
  13741. }
  13742. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13743. }).finally(function () {
  13744. _this.setLoading(false);
  13745. });
  13746. };
  13747. DbSync.prototype.executeProcedureSQL = function () {
  13748. var _this = this;
  13749. this.setLoading(true);
  13750. executeModifyProcedureSQL({
  13751. datasource1: this.viewModel.get('dataSource1'),
  13752. datasource2: this.viewModel.get('dataSource2'),
  13753. schema1: this.viewModel.get('schema1'),
  13754. schema2: this.viewModel.get('schema2'),
  13755. }).then(function (res) {
  13756. if (res === null || res === void 0 ? void 0 : res.success) {
  13757. msg$1('执行成功');
  13758. _this.back();
  13759. return;
  13760. }
  13761. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  13762. }).finally(function () {
  13763. _this.setLoading(false);
  13764. });
  13765. };
  13766. return DbSync;
  13767. }(Scope));
  13768. var model$e = {
  13769. data: {}
  13770. };
  13771. var vjson$e = {
  13772. title: '示例代码',
  13773. layout: 'fit',
  13774. items: [
  13775. {
  13776. layout: 'border',
  13777. items: [
  13778. {
  13779. region: 'north',
  13780. split: true,
  13781. height: 200,
  13782. title: '表格数据',
  13783. reference: 'dataeditor',
  13784. xtype: 'jsoneditor',
  13785. listeners: {
  13786. change: 'scope.dataChanged'
  13787. },
  13788. },
  13789. {
  13790. region: 'west',
  13791. split: true,
  13792. width: 230,
  13793. title: '模板',
  13794. reference: 'tree1',
  13795. xtype: 'treepanel',
  13796. rootVisible: false,
  13797. useArrows: true,
  13798. colspan: 2,
  13799. lines: true,
  13800. multiSelect: false,
  13801. listeners: {
  13802. itemclick: 'scope.templateChange',
  13803. },
  13804. },
  13805. {
  13806. region: 'center',
  13807. title: '参考代码',
  13808. reference: 'preview',
  13809. xtype: 'jsoneditor',
  13810. },
  13811. ]
  13812. }
  13813. ]
  13814. };
  13815. var rootNode = {
  13816. id: 'ROOT',
  13817. type: "ROOT",
  13818. path: "",
  13819. expanded: true,
  13820. leaf: false,
  13821. children: [
  13822. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  13823. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  13824. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  13825. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  13826. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  13827. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  13828. ],
  13829. };
  13830. var TemplateDev = /** @class */ (function (_super) {
  13831. __extends(TemplateDev, _super);
  13832. function TemplateDev() {
  13833. var _this = _super.call(this, { model: model$e, vjson: vjson$e }) || this;
  13834. _this.dataChanged = _$2.debounce(function () {
  13835. var me = _this;
  13836. if (me.refs.tree1.selection) {
  13837. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  13838. }
  13839. }, 50);
  13840. return _this;
  13841. }
  13842. TemplateDev.prototype.onDestroy = function () {
  13843. setDbCode(undefined);
  13844. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  13845. };
  13846. TemplateDev.prototype.onLoad = function () {
  13847. setDbCode(this);
  13848. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  13849. this.refs.tree1.setRootNode(rootNode);
  13850. getColumnDomainApi({}).then(function (_a) {
  13851. var data = _a.data;
  13852. return window['dev_column_domain'] = data;
  13853. });
  13854. };
  13855. TemplateDev.prototype.dbTreeNodeChange = function () {
  13856. var me = handles$1.dbcode;
  13857. var tables = [];
  13858. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  13859. var raw = _$2.cloneDeep(r.get('raw'));
  13860. raw.id = r.get('id');
  13861. if (r.get('type') === 'table') {
  13862. tables.push(raw);
  13863. return;
  13864. }
  13865. if (r.get('type') === 'column') {
  13866. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  13867. if (!tableInfo) {
  13868. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  13869. tables.push(tableInfo);
  13870. }
  13871. if (!tableInfo.column_list) {
  13872. tableInfo.column_list = [raw];
  13873. }
  13874. else {
  13875. tableInfo.column_list.push(raw);
  13876. }
  13877. }
  13878. });
  13879. // 对于没有选择列的表格,默认加上所有列
  13880. _$2.forEach(tables, function (tableInfo) {
  13881. if (typeof tableInfo.column_list === 'undefined') {
  13882. tableInfo.column_list = [];
  13883. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  13884. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  13885. });
  13886. }
  13887. });
  13888. var code = JSON.stringify(tables, null, ' ');
  13889. me.refs.dataeditor.setCode(code);
  13890. };
  13891. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  13892. var url = record.data.url;
  13893. var rd = _$2.uniqueId('db_code_request');
  13894. if (url) {
  13895. var data = void 0;
  13896. try {
  13897. data = JSON.parse(this.refs.dataeditor.getCode());
  13898. }
  13899. catch (e) {
  13900. return;
  13901. }
  13902. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  13903. // if (typeof node.default === "function") {
  13904. // const v = toString(node.default(data))
  13905. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  13906. // this.refs.preview.setLanguage("plaintext")
  13907. // this.refs.preview.setCode(v)
  13908. // }
  13909. // })
  13910. showErrorDialog$1('没做这里');
  13911. }
  13912. };
  13913. return TemplateDev;
  13914. }(Scope));
  13915. var model$f = {
  13916. data: {
  13917. hasChanged: false,
  13918. }
  13919. };
  13920. var vjson$f = {
  13921. bind: {
  13922. title: '字段域{grid1.ischanged?" *":""}',
  13923. },
  13924. layout: 'fit',
  13925. items: [
  13926. {
  13927. layout: 'border',
  13928. items: [
  13929. {
  13930. region: 'center',
  13931. xtype: 'yvgrid',
  13932. selModel: {
  13933. type: 'spreadsheet',
  13934. columnSelect: true,
  13935. pruneRemoved: false,
  13936. extensible: 'y'
  13937. },
  13938. plugins: {
  13939. clipboard: true,
  13940. selectionreplicator: true
  13941. },
  13942. reference: 'grid1',
  13943. pagination: false,
  13944. tbar: {
  13945. xtype: 'toolbar',
  13946. items: [
  13947. {
  13948. xtype: 'button',
  13949. text: '添加',
  13950. iconCls: 'x-fa fa-plus-circle',
  13951. listeners: {
  13952. click: 'scope.addField'
  13953. }
  13954. },
  13955. {
  13956. xtype: 'button',
  13957. text: '删除',
  13958. iconCls: 'x-fa fa-minus-circle',
  13959. listeners: {
  13960. click: 'scope.removeField'
  13961. }
  13962. },
  13963. {
  13964. xtype: 'button',
  13965. text: '保存',
  13966. iconCls: 'x-fa fa-save',
  13967. bind: {
  13968. disabled: '{!grid1.ischanged}'
  13969. },
  13970. listeners: {
  13971. click: 'scope.save'
  13972. }
  13973. },
  13974. ]
  13975. },
  13976. listeners: {
  13977. editfinish: 'scope.gridEditFinish',
  13978. },
  13979. columns: [
  13980. {
  13981. text: '字段域名称', dataIndex: 'domain_name',
  13982. sortable: false,
  13983. menuDisabled: true,
  13984. locked: true,
  13985. editor: {
  13986. selectOnFocus: true
  13987. }
  13988. },
  13989. {
  13990. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  13991. sortable: false, menuDisabled: true,
  13992. editor: {
  13993. selectOnFocus: true
  13994. }
  13995. },
  13996. {
  13997. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  13998. sortable: false, menuDisabled: true,
  13999. editor: {
  14000. selectOnFocus: true
  14001. }
  14002. },
  14003. {
  14004. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  14005. sortable: false, menuDisabled: true,
  14006. editor: {
  14007. selectOnFocus: true
  14008. }
  14009. },
  14010. {
  14011. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  14012. sortable: false, menuDisabled: true,
  14013. editor: {
  14014. selectOnFocus: true
  14015. }
  14016. },
  14017. {
  14018. text: 'Java类型', dataIndex: 'java_datatype',
  14019. sortable: false, menuDisabled: true,
  14020. editor: {
  14021. selectOnFocus: true
  14022. }
  14023. },
  14024. {
  14025. text: '固定长度', dataIndex: 'is_fix_size',
  14026. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  14027. width: 88, resizable: false,
  14028. },
  14029. {
  14030. text: '长度', dataIndex: 'column_size',
  14031. sortable: false, menuDisabled: true, dataType: 'int',
  14032. xtype: 'numbercolumn', format: '0',
  14033. editor: { selectOnFocus: true }
  14034. },
  14035. {
  14036. text: '小数位', dataIndex: 'decimal_digits',
  14037. sortable: false, menuDisabled: true, dataType: 'int',
  14038. xtype: 'numbercolumn', format: '0',
  14039. editor: { selectOnFocus: true }
  14040. },
  14041. {
  14042. text: '字典', dataIndex: 'domain_column_dict',
  14043. sortable: false, menuDisabled: true,
  14044. // fix: ['system.getDict("DICT")'],
  14045. width: 200,
  14046. editor: {
  14047. xtype: 'combo',
  14048. listConfig: {
  14049. minWidth: 350
  14050. },
  14051. }
  14052. },
  14053. {
  14054. text: '固定默认值', dataIndex: 'is_fix_default_value',
  14055. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  14056. width: 88, resizable: false,
  14057. },
  14058. {
  14059. text: '默认值', dataIndex: 'default_value',
  14060. sortable: false, menuDisabled: true,
  14061. editor: {
  14062. selectOnFocus: true
  14063. }
  14064. },
  14065. {
  14066. text: 'UI建议', dataIndex: 'domain_column_ui',
  14067. sortable: false, menuDisabled: true,
  14068. // fix: ['system.getDict("column_ui")'],
  14069. editor: {
  14070. xtype: 'combo',
  14071. allowBlank: true,
  14072. listConfig: {
  14073. minWidth: 200
  14074. },
  14075. }
  14076. },
  14077. {
  14078. text: '详细描述', dataIndex: 'domain_note',
  14079. sortable: false, menuDisabled: true,
  14080. editor: {}
  14081. },
  14082. {
  14083. text: '责任人', dataIndex: 'domain_person',
  14084. sortable: false, menuDisabled: true,
  14085. editor: {
  14086. selectOnFocus: true
  14087. }
  14088. },
  14089. {
  14090. text: '版本', dataIndex: 'domain_version',
  14091. sortable: false, menuDisabled: true,
  14092. editor: {
  14093. selectOnFocus: true
  14094. }
  14095. },
  14096. ]
  14097. }
  14098. ]
  14099. },
  14100. ]
  14101. };
  14102. var DbDomain = /** @class */ (function (_super) {
  14103. __extends(DbDomain, _super);
  14104. function DbDomain() {
  14105. return _super.call(this, { model: model$f, vjson: vjson$f }) || this;
  14106. }
  14107. DbDomain.prototype.onLoad = function () {
  14108. var _this = this;
  14109. instance$3.getAllDomain().then(function (data) {
  14110. _this.refs.grid1.setData(data);
  14111. });
  14112. };
  14113. DbDomain.prototype.gridEditFinish = function () {
  14114. this.viewModel.set('hasChanged', true);
  14115. };
  14116. DbDomain.prototype.addField = function () {
  14117. this.refs.grid1.appendEditRow({
  14118. domainName: '',
  14119. pgSqlDataType: '',
  14120. mysqlDataType: '',
  14121. oracleDataType: '',
  14122. sqlserverDataType: '',
  14123. javaDataType: '',
  14124. isFixSize: true,
  14125. size: '',
  14126. decimalDigits: '',
  14127. isFixDefaultValue: false,
  14128. defaultValue: null,
  14129. domainColumnDict: '',
  14130. domainColumnUI: '',
  14131. note: '',
  14132. domainPerson: '',
  14133. domainVersion: '',
  14134. }, 0);
  14135. };
  14136. DbDomain.prototype.removeField = function () {
  14137. var _this = this;
  14138. var rows = [];
  14139. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  14140. rows.push(r);
  14141. });
  14142. _.forEach(rows, function (r) {
  14143. _this.refs.grid1.getStore().remove(r);
  14144. });
  14145. };
  14146. DbDomain.prototype.save = function () {
  14147. var _this = this;
  14148. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  14149. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  14150. if (err) {
  14151. // 如果有异常就不保存
  14152. return;
  14153. }
  14154. // 进行业务上的逻辑校验,比如说必填校验等等
  14155. var hasError = false;
  14156. _.forEach(rows, function (row, i) {
  14157. if (isEmpty(row.domain_name)) {
  14158. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  14159. hasError = true;
  14160. return false;
  14161. }
  14162. if (isEmpty(row.pgsql_datatype) ||
  14163. isEmpty(row.mysql_datatype) ||
  14164. isEmpty(row.oracle_datatype) ||
  14165. isEmpty(row.sqlserver_datatype)) {
  14166. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  14167. hasError = true;
  14168. return false;
  14169. }
  14170. });
  14171. if (hasError) {
  14172. return;
  14173. }
  14174. // 设置当前界面为 "保存中..." 状态
  14175. this.setLoading(true);
  14176. saveColumnDomain({
  14177. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  14178. newRows: newRows,
  14179. modifyRows: modifyRows,
  14180. removeRecords: removeRecords,
  14181. }).then(function (res) {
  14182. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  14183. system.msg(res.msg);
  14184. instance$3.reloadForce({}).then(function () {
  14185. instance$3.getAllDomain().then(function (data) {
  14186. _this.refs.grid1.setData(data);
  14187. });
  14188. }).finally(function () {
  14189. // 无论正常异常,关闭 "保存中..." 状态
  14190. _this.setLoading(false);
  14191. });
  14192. }).catch(function (e) {
  14193. // 无论正常异常,关闭 "保存中..." 状态
  14194. _this.setLoading(false);
  14195. });
  14196. };
  14197. return DbDomain;
  14198. }(Scope));
  14199. var model$g = {
  14200. data: {
  14201. report_id: '',
  14202. report_name: '',
  14203. report_enable: false,
  14204. report: {
  14205. dataSource: '',
  14206. grid: {
  14207. pagination: true,
  14208. },
  14209. query: [],
  14210. columns: [],
  14211. summary: [],
  14212. },
  14213. querySql: '',
  14214. summarySql: '',
  14215. createAt: '',
  14216. createBy: '',
  14217. updateAt: '',
  14218. updateBy: '',
  14219. }
  14220. };
  14221. var vjson$g = {
  14222. bind: {
  14223. title: '报表-{report_name}',
  14224. },
  14225. layout: 'fit',
  14226. items: [
  14227. {
  14228. layout: 'border',
  14229. items: [
  14230. {
  14231. region: 'north',
  14232. items: [
  14233. {
  14234. xtype: 'toolbar',
  14235. border: false,
  14236. items: [
  14237. {
  14238. xtype: 'button',
  14239. text: '刷新',
  14240. iconCls: 'x-fa fa-refresh',
  14241. listeners: {
  14242. click: 'scope.load'
  14243. }
  14244. },
  14245. {
  14246. xtype: 'button',
  14247. text: '保存',
  14248. iconCls: 'x-fa fa-save',
  14249. listeners: {
  14250. click: 'scope.save'
  14251. }
  14252. },
  14253. {
  14254. xtype: 'button',
  14255. text: '预览',
  14256. iconCls: 'x-fa fa-play-circle-o',
  14257. listeners: {
  14258. click: 'scope.preview'
  14259. }
  14260. },
  14261. {
  14262. xtype: 'textfield',
  14263. fieldLabel: '报表名称',
  14264. flex: 1,
  14265. bind: {
  14266. value: '{report_name}'
  14267. }
  14268. },
  14269. {
  14270. xtype: 'checkbox',
  14271. fieldLabel: '启用报表',
  14272. checkedValue: 1,
  14273. uncheckedValue: 0,
  14274. bind: {
  14275. value: '{report_enable}'
  14276. }
  14277. },
  14278. {
  14279. xtype: 'checkbox',
  14280. fieldLabel: '启用分页',
  14281. bind: {
  14282. value: '{report.grid.pagination}'
  14283. }
  14284. },
  14285. {
  14286. xtype: 'textfield',
  14287. fieldLabel: '数据源',
  14288. flex: 1,
  14289. bind: {
  14290. value: '{report.dataSource}'
  14291. }
  14292. },
  14293. ]
  14294. }
  14295. ]
  14296. },
  14297. {
  14298. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  14299. items: [
  14300. {
  14301. title: 'SQL和查询条件',
  14302. layout: 'border',
  14303. border: false,
  14304. items: [
  14305. {
  14306. region: 'north',
  14307. height: 200,
  14308. border: false,
  14309. split: true,
  14310. xtype: 'yvgrid',
  14311. reference: 'gridCondition',
  14312. pagination: false,
  14313. hideFootbar: true,
  14314. plugins: {
  14315. clipboard: true,
  14316. selectionreplicator: true
  14317. },
  14318. selModel: {
  14319. type: 'spreadsheet',
  14320. columnSelect: false,
  14321. pruneRemoved: false,
  14322. extensible: 'y'
  14323. },
  14324. tbar: {
  14325. xtype: 'toolbar',
  14326. border: false,
  14327. items: [
  14328. {
  14329. xtype: 'button',
  14330. text: '添加条件',
  14331. iconCls: 'x-fa fa-plus-circle',
  14332. listeners: {
  14333. click: 'scope.addCondition'
  14334. }
  14335. },
  14336. {
  14337. xtype: 'button',
  14338. text: '删除条件',
  14339. iconCls: 'x-fa fa-minus-circle',
  14340. listeners: {
  14341. click: 'scope.removeCondition'
  14342. }
  14343. },
  14344. '-',
  14345. {
  14346. xtype: 'button',
  14347. text: '自动分析条件变量',
  14348. iconCls: 'x-fa fa-code-fork',
  14349. listeners: {
  14350. click: 'scope.calcCondition'
  14351. }
  14352. },
  14353. {
  14354. xtype: 'button',
  14355. text: '上移',
  14356. iconCls: 'x-fa fa-arrow-up',
  14357. listeners: {
  14358. click: 'scope.moveUp'
  14359. }
  14360. },
  14361. {
  14362. xtype: 'button',
  14363. text: '下移',
  14364. iconCls: 'x-fa fa-arrow-down',
  14365. listeners: {
  14366. click: 'scope.moveDown'
  14367. }
  14368. },
  14369. ]
  14370. },
  14371. columns: [
  14372. {
  14373. text: '条件变量',
  14374. dataIndex: 'conditionFieldBind',
  14375. width: 140,
  14376. sortable: false,
  14377. menuDisabled: true,
  14378. editor: {
  14379. selectOnFocus: true
  14380. },
  14381. },
  14382. {
  14383. text: '中文标题',
  14384. dataIndex: 'conditionFieldLabel',
  14385. width: 120,
  14386. sortable: false,
  14387. menuDisabled: true,
  14388. editor: {
  14389. selectOnFocus: true
  14390. },
  14391. },
  14392. {
  14393. text: '编辑类型',
  14394. dataIndex: 'conditionFieldXtype',
  14395. width: 80,
  14396. sortable: false,
  14397. menuDisabled: true,
  14398. editor: {
  14399. xtype: 'combo',
  14400. typeAhead: true,
  14401. triggerAction: 'all',
  14402. selectOnFocus: true,
  14403. store: [
  14404. ['textfield', 'textfield'],
  14405. ['combo', 'combo'],
  14406. ['datefield', 'datefield'],
  14407. ['datetimefield', 'datetimefield'],
  14408. ['numberfield', 'numberfield'],
  14409. ['multiplesearch', 'multiplesearch'],
  14410. ]
  14411. }
  14412. },
  14413. {
  14414. text: '权重',
  14415. dataIndex: 'conditionFieldFlex',
  14416. align: 'right',
  14417. width: 60,
  14418. sortable: false,
  14419. menuDisabled: true,
  14420. editor: {
  14421. xtype: 'numberfield',
  14422. selectOnFocus: false,
  14423. minValue: 0,
  14424. maxValue: 10
  14425. },
  14426. },
  14427. {
  14428. text: '字典',
  14429. dataIndex: 'conditionFieldDict',
  14430. width: 160,
  14431. sortable: false,
  14432. menuDisabled: true,
  14433. editor: {
  14434. selectOnFocus: false
  14435. },
  14436. },
  14437. {
  14438. xtype: 'checkcolumn',
  14439. dataIndex: "conditionFieldWrap", header: "换行",
  14440. width: 65,
  14441. sortable: false,
  14442. menuDisabled: true,
  14443. },
  14444. {
  14445. text: '扩展参数',
  14446. dataIndex: 'conditionFieldExtend',
  14447. sortable: false,
  14448. menuDisabled: true,
  14449. editor: {
  14450. selectOnFocus: false
  14451. },
  14452. },
  14453. ]
  14454. },
  14455. {
  14456. region: 'center',
  14457. xtype: 'sqleditor',
  14458. layout: 'fit',
  14459. reference: 'sqlEditor',
  14460. split: true,
  14461. },
  14462. ]
  14463. },
  14464. {
  14465. title: '查询结果字段',
  14466. xtype: 'yvgrid',
  14467. reference: 'gridColumn',
  14468. pagination: false,
  14469. hideFootbar: true,
  14470. border: false,
  14471. plugins: {
  14472. clipboard: true,
  14473. selectionreplicator: true
  14474. },
  14475. selModel: {
  14476. type: 'spreadsheet',
  14477. columnSelect: false,
  14478. pruneRemoved: false,
  14479. extensible: 'y'
  14480. },
  14481. tbar: {
  14482. xtype: 'toolbar',
  14483. items: [
  14484. {
  14485. xtype: 'button',
  14486. text: '添加',
  14487. iconCls: 'x-fa fa-plus-circle',
  14488. listeners: {
  14489. click: 'scope.addColumn'
  14490. }
  14491. },
  14492. {
  14493. xtype: 'button',
  14494. text: '删除',
  14495. iconCls: 'x-fa fa-minus-circle',
  14496. listeners: {
  14497. click: 'scope.removeColumn'
  14498. }
  14499. },
  14500. '-',
  14501. {
  14502. xtype: 'button',
  14503. text: '自动分析',
  14504. iconCls: 'x-fa fa-code-fork',
  14505. listeners: {
  14506. click: 'scope.calcColumn'
  14507. }
  14508. },
  14509. {
  14510. xtype: 'button',
  14511. text: '上移',
  14512. iconCls: 'x-fa fa-arrow-up',
  14513. listeners: {
  14514. click: 'scope.moveUp'
  14515. }
  14516. },
  14517. {
  14518. xtype: 'button',
  14519. text: '下移',
  14520. iconCls: 'x-fa fa-arrow-down',
  14521. listeners: {
  14522. click: 'scope.moveDown'
  14523. }
  14524. },
  14525. ]
  14526. },
  14527. columns: [
  14528. { xtype: 'rownumberer' },
  14529. {
  14530. text: '字段',
  14531. dataIndex: 'dataIndex',
  14532. width: 140,
  14533. sortable: false,
  14534. menuDisabled: true,
  14535. editor: {
  14536. selectOnFocus: true
  14537. },
  14538. },
  14539. {
  14540. text: '标题',
  14541. dataIndex: 'header',
  14542. width: 120,
  14543. sortable: false,
  14544. menuDisabled: true,
  14545. editor: {
  14546. selectOnFocus: true
  14547. },
  14548. },
  14549. {
  14550. text: '显示类型',
  14551. dataIndex: 'xtype',
  14552. width: 90,
  14553. sortable: false,
  14554. menuDisabled: true,
  14555. editor: {
  14556. xtype: 'combo',
  14557. typeAhead: true,
  14558. triggerAction: 'all',
  14559. selectOnFocus: true,
  14560. store: [
  14561. ['', ''],
  14562. ['rownum', 'rownum'],
  14563. ['button', 'button'],
  14564. ['checkbox', 'checkbox'],
  14565. ['progres', 'progres'],
  14566. ]
  14567. }
  14568. },
  14569. {
  14570. text: '数据类型',
  14571. dataIndex: 'dataType',
  14572. width: 90,
  14573. sortable: false,
  14574. menuDisabled: true,
  14575. editor: {
  14576. xtype: 'combo',
  14577. typeAhead: true,
  14578. triggerAction: 'all',
  14579. selectOnFocus: true,
  14580. store: [
  14581. ['', ''],
  14582. ['string', 'string'],
  14583. ['number', 'number'],
  14584. ['date', 'date'],
  14585. ]
  14586. }
  14587. },
  14588. {
  14589. text: '宽度',
  14590. dataIndex: 'width',
  14591. align: 'right',
  14592. width: 60,
  14593. sortable: false,
  14594. menuDisabled: true,
  14595. editor: {
  14596. xtype: 'numberfield',
  14597. selectOnFocus: true,
  14598. minValue: 0,
  14599. maxValue: 1000
  14600. },
  14601. },
  14602. {
  14603. text: '权重',
  14604. dataIndex: 'flex',
  14605. align: 'right',
  14606. width: 60,
  14607. sortable: false,
  14608. menuDisabled: true,
  14609. editor: {
  14610. xtype: 'numberfield',
  14611. selectOnFocus: true,
  14612. minValue: 0,
  14613. maxValue: 10
  14614. },
  14615. },
  14616. {
  14617. text: '字典',
  14618. dataIndex: 'dict',
  14619. sortable: false,
  14620. menuDisabled: true,
  14621. width: 120,
  14622. editor: {
  14623. selectOnFocus: true,
  14624. },
  14625. },
  14626. {
  14627. text: '对齐',
  14628. dataIndex: 'align',
  14629. width: 60,
  14630. sortable: false,
  14631. menuDisabled: true,
  14632. editor: {
  14633. xtype: 'combo',
  14634. typeAhead: true,
  14635. triggerAction: 'all',
  14636. selectOnFocus: false,
  14637. store: [
  14638. ['', ''],
  14639. ['start', 'start'],
  14640. ['center', 'center'],
  14641. ['end', 'end'],
  14642. ]
  14643. },
  14644. },
  14645. {
  14646. text: '过滤',
  14647. dataIndex: 'filterable',
  14648. xtype: 'checkcolumn',
  14649. width: 50,
  14650. resizable: false,
  14651. sortable: false,
  14652. menuDisabled: true,
  14653. },
  14654. {
  14655. text: '隐藏',
  14656. dataIndex: 'hidden',
  14657. xtype: 'checkcolumn',
  14658. width: 50,
  14659. resizable: false,
  14660. sortable: false,
  14661. menuDisabled: true,
  14662. },
  14663. {
  14664. text: '排序',
  14665. dataIndex: 'sortable',
  14666. xtype: 'checkcolumn',
  14667. width: 50,
  14668. resizable: false,
  14669. sortable: false,
  14670. menuDisabled: true,
  14671. },
  14672. {
  14673. text: '扩展参数',
  14674. dataIndex: 'fieldExtend',
  14675. sortable: false,
  14676. menuDisabled: true,
  14677. editor: {
  14678. selectOnFocus: false
  14679. },
  14680. },
  14681. ],
  14682. },
  14683. {
  14684. title: '汇总和汇总逻辑',
  14685. layout: 'border',
  14686. border: false,
  14687. items: [
  14688. {
  14689. xtype: 'yvgrid', region: 'north', layout: 'fit',
  14690. reference: 'gridSum',
  14691. pagination: false,
  14692. hideFootbar: true,
  14693. height: 200,
  14694. split: true,
  14695. border: false,
  14696. plugins: {
  14697. clipboard: true,
  14698. selectionreplicator: true
  14699. },
  14700. selModel: {
  14701. type: 'spreadsheet',
  14702. columnSelect: false,
  14703. pruneRemoved: false,
  14704. extensible: 'y'
  14705. },
  14706. tbar: {
  14707. xtype: 'toolbar',
  14708. border: false,
  14709. items: [
  14710. {
  14711. xtype: 'button',
  14712. text: '添加',
  14713. iconCls: 'x-fa fa-plus-circle',
  14714. listeners: {
  14715. click: 'scope.addSum'
  14716. }
  14717. },
  14718. {
  14719. xtype: 'button',
  14720. text: '删除',
  14721. iconCls: 'x-fa fa-minus-circle',
  14722. listeners: {
  14723. click: 'scope.removeSum'
  14724. }
  14725. },
  14726. '-',
  14727. {
  14728. xtype: 'button',
  14729. text: '自动分析',
  14730. iconCls: 'x-fa fa-code-fork',
  14731. listeners: {
  14732. click: 'scope.calcSum'
  14733. }
  14734. },
  14735. {
  14736. xtype: 'button',
  14737. text: '上移',
  14738. iconCls: 'x-fa fa-arrow-up',
  14739. listeners: {
  14740. click: 'scope.moveUp'
  14741. }
  14742. },
  14743. {
  14744. xtype: 'button',
  14745. text: '下移',
  14746. iconCls: 'x-fa fa-arrow-down',
  14747. listeners: {
  14748. click: 'scope.moveDown'
  14749. }
  14750. },
  14751. ]
  14752. },
  14753. columns: [
  14754. {
  14755. text: '字段名',
  14756. dataIndex: 'sumFieldBind',
  14757. width: 140,
  14758. sortable: false,
  14759. menuDisabled: true,
  14760. editor: {
  14761. selectOnFocus: true
  14762. },
  14763. },
  14764. {
  14765. text: '标题',
  14766. dataIndex: 'sumFieldLabel',
  14767. width: 120,
  14768. sortable: false,
  14769. menuDisabled: true,
  14770. editor: {
  14771. selectOnFocus: true
  14772. },
  14773. },
  14774. {
  14775. text: '权重',
  14776. dataIndex: 'sumFieldFlex',
  14777. align: 'right',
  14778. width: 60,
  14779. sortable: false,
  14780. menuDisabled: true,
  14781. editor: {
  14782. xtype: 'numberfield',
  14783. selectOnFocus: false,
  14784. allowBlank: true,
  14785. minValue: 0,
  14786. maxValue: 10
  14787. },
  14788. },
  14789. {
  14790. xtype: 'checkcolumn',
  14791. dataIndex: "sumFieldWrap", header: "换行",
  14792. sortable: false,
  14793. menuDisabled: true,
  14794. width: 65,
  14795. },
  14796. {
  14797. text: '扩展参数',
  14798. dataIndex: 'sumFieldExtend',
  14799. sortable: false,
  14800. menuDisabled: true,
  14801. editor: {
  14802. selectOnFocus: false
  14803. },
  14804. },
  14805. ]
  14806. },
  14807. {
  14808. region: 'center',
  14809. xtype: 'sqleditor',
  14810. layout: 'fit',
  14811. reference: 'sqlSumEditor',
  14812. },
  14813. ]
  14814. },
  14815. ]
  14816. }
  14817. ]
  14818. }
  14819. ]
  14820. }; //
  14821. //
  14822. var PROJECT_DICT_CACHE = {};
  14823. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  14824. /**
  14825. *项目运行时构建
  14826. **/
  14827. function createRuntime() {
  14828. {
  14829. // 已经构建过了
  14830. return new Promise(function (resolve) {
  14831. resolve();
  14832. });
  14833. }
  14834. }
  14835. function ReportRunner(reportId, setLoadingFn) {
  14836. return new Promise(function (resolve) {
  14837. setLoadingFn(true);
  14838. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  14839. // const {model, vjson, report} = buildVjson(res.data)
  14840. // const ret = new ReportScope({model, vjson})
  14841. // ret.report_id = reportId
  14842. // ret.report = report
  14843. // resolve(ret)
  14844. var _b = __read(_a, 1), res = _b[0];
  14845. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  14846. resolve(ret);
  14847. }).finally(function () {
  14848. setLoadingFn(false);
  14849. });
  14850. });
  14851. }
  14852. //gridCondition
  14853. //gridColumn
  14854. //gridSum
  14855. //sqlSumEditor
  14856. //sqlEditor
  14857. var ReportDesign = /** @class */ (function (_super) {
  14858. __extends(ReportDesign, _super);
  14859. function ReportDesign() {
  14860. return _super.call(this, { model: model$g, vjson: vjson$g }) || this;
  14861. }
  14862. ReportDesign.prototype.onLoad = function () {
  14863. this.load();
  14864. };
  14865. ReportDesign.prototype.save = function (sender) {
  14866. var _this = this;
  14867. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  14868. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  14869. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  14870. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  14871. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  14872. var report = this.viewModel.get('report');
  14873. var data = {
  14874. report_id: this.viewModel.get('report_id'),
  14875. report_name: this.viewModel.get('report_name'),
  14876. report_enable: this.viewModel.get('report_enable'),
  14877. query_sql: this.viewModel.get('querySql'),
  14878. summary_sql: this.viewModel.get('summarySql'),
  14879. report: json5.stringify(report, null, ' '),
  14880. };
  14881. sender.setLoading(true);
  14882. saveReportApi(data).then(function (res) {
  14883. if (res.success) {
  14884. msg$1('保存成功');
  14885. _this.dialogSuccess(data);
  14886. _this.load();
  14887. }
  14888. }).finally(function () {
  14889. sender.setLoading(false);
  14890. });
  14891. };
  14892. ReportDesign.prototype.preview = function (sender) {
  14893. var reportId = this.viewModel.get('report_id');
  14894. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  14895. handles.mainWindow.showReportPreview(reportId, scope);
  14896. });
  14897. };
  14898. ReportDesign.prototype.load = function () {
  14899. var _this = this;
  14900. var reportId = this.viewModel.get('report_id');
  14901. this.setLoading(true);
  14902. reportByIdApi(reportId).then(function (res) {
  14903. 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;
  14904. if (report) {
  14905. report = json5.parse(report);
  14906. }
  14907. else {
  14908. report = {};
  14909. }
  14910. _this.viewModel.set('report_enable', report_enable);
  14911. _this.viewModel.set('report_name', report_name);
  14912. _this.viewModel.set('querySql', query_sql || '');
  14913. _this.viewModel.set('summarySql', summary_sql || '');
  14914. system.mergeViewModel(_this.viewModel, 'report', report, false);
  14915. var query = _this.viewModel.get('report.query') || [];
  14916. var columns = _this.viewModel.get('report.columns') || [];
  14917. var summary = _this.viewModel.get('report.summary') || [];
  14918. var querySql = _this.viewModel.get('querySql');
  14919. var summarySql = _this.viewModel.get('summarySql');
  14920. _this.refs.gridCondition.setData(query);
  14921. _this.refs.gridColumn.setData(columns);
  14922. _this.refs.gridSum.setData(summary);
  14923. _this.refs.sqlEditor.setCode(querySql);
  14924. _this.refs.sqlSumEditor.setCode(summarySql);
  14925. }).finally(function () {
  14926. _this.setLoading(false);
  14927. });
  14928. };
  14929. ReportDesign.prototype.addCondition = function () {
  14930. this.refs.gridCondition.appendEditRow({
  14931. conditionFieldBind: '',
  14932. conditionFieldLabel: '',
  14933. conditionFieldXtype: 'textfield',
  14934. conditionFieldFlex: 1,
  14935. conditionFieldDict: '',
  14936. conditionFieldWrap: false,
  14937. conditionFieldExtend: '{}',
  14938. }, 'conditionFieldBind');
  14939. };
  14940. ReportDesign.prototype.removeCondition = function () {
  14941. var _this = this;
  14942. var rows = [];
  14943. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  14944. rows.push(r);
  14945. });
  14946. _.forEach(rows, function (r) {
  14947. _this.refs.gridCondition.getStore().remove(r);
  14948. });
  14949. };
  14950. ReportDesign.prototype.moveUp = function (sender) {
  14951. var grid = sender.up('grid');
  14952. grid.rowMoveUp();
  14953. };
  14954. ReportDesign.prototype.moveDown = function (sender) {
  14955. var grid = sender.up('grid');
  14956. grid.rowMoveDown();
  14957. };
  14958. ReportDesign.prototype.calcCondition = function () {
  14959. var _this = this;
  14960. var sql = this.refs.sqlEditor.getCode();
  14961. var re = sql.matchAll(/#{(.+?)}/gi);
  14962. var rows = this.refs.gridCondition.getDataRows();
  14963. this.refs.gridCondition.setLoading(true);
  14964. Promise.all([
  14965. parseDynamicSqlApi(sql),
  14966. instance.reloadIfNeedPromise(),
  14967. ]).then(function (_a) {
  14968. var e_1, _b;
  14969. var _c = __read(_a, 1), res1 = _c[0];
  14970. if (res1.success) {
  14971. var tables_1 = [];
  14972. _.forEach(res1.data, function (parseItem) {
  14973. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  14974. if (tableName && !_.includes(tables_1, tableName)) {
  14975. tables_1.push(tableName);
  14976. }
  14977. });
  14978. var _loop_1 = function (m) {
  14979. var e_2, _a;
  14980. var columnName = m[1];
  14981. // 没有这个列才添加
  14982. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  14983. var meta = undefined;
  14984. try {
  14985. 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()) {
  14986. var tableName = tables_2_1.value;
  14987. meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  14988. if (meta) {
  14989. break;
  14990. }
  14991. }
  14992. }
  14993. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  14994. finally {
  14995. try {
  14996. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  14997. }
  14998. finally { if (e_2) throw e_2.error; }
  14999. }
  15000. if (meta) {
  15001. // 找到元数据
  15002. var r = {
  15003. conditionFieldBind: meta.column_name,
  15004. conditionFieldLabel: meta.column_comment,
  15005. conditionFieldXtype: 'textfield',
  15006. conditionFieldFlex: 1,
  15007. conditionFieldDict: '',
  15008. conditionFieldWrap: false,
  15009. conditionFieldExtend: '{}',
  15010. };
  15011. if (meta.column_ui === 'combo' && meta.column_dict) {
  15012. r.conditionFieldXtype = 'combo';
  15013. r.conditionFieldDict = meta.column_dict;
  15014. }
  15015. else if (meta.column_ui === "checkbox") {
  15016. r.conditionFieldXtype = 'checkbox';
  15017. }
  15018. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  15019. r.conditionFieldXtype = 'numberfield';
  15020. }
  15021. _this.refs.gridCondition.appendEditRow(r);
  15022. }
  15023. else {
  15024. // 没找到元数据,直接添加
  15025. _this.refs.gridCondition.appendEditRow({
  15026. conditionFieldBind: columnName,
  15027. conditionFieldLabel: '',
  15028. conditionFieldXtype: 'textfield',
  15029. conditionFieldFlex: 1,
  15030. conditionFieldDict: '',
  15031. conditionFieldWrap: false,
  15032. conditionFieldExtend: '{}',
  15033. });
  15034. }
  15035. }
  15036. };
  15037. try {
  15038. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  15039. var m = re_1_1.value;
  15040. _loop_1(m);
  15041. }
  15042. }
  15043. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  15044. finally {
  15045. try {
  15046. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  15047. }
  15048. finally { if (e_1) throw e_1.error; }
  15049. }
  15050. }
  15051. }).finally(function () {
  15052. _this.refs.gridCondition.setLoading(false);
  15053. });
  15054. };
  15055. ReportDesign.prototype.addColumn = function () {
  15056. this.refs.gridColumn.appendEditRow({
  15057. dataIndex: '',
  15058. header: '',
  15059. xtype: '',
  15060. dataType: '',
  15061. width: '',
  15062. dict: '',
  15063. align: '',
  15064. filterable: true,
  15065. hidden: false,
  15066. sortable: true,
  15067. fieldExtend: '{}',
  15068. }, 'header');
  15069. };
  15070. ReportDesign.prototype.removeColumn = function () {
  15071. var _this = this;
  15072. var rows = [];
  15073. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  15074. rows.push(r);
  15075. });
  15076. _.forEach(rows, function (r) {
  15077. _this.refs.gridColumn.getStore().remove(r);
  15078. });
  15079. };
  15080. ReportDesign.prototype.calcColumn = function () {
  15081. var _this = this;
  15082. var sql = this.refs.sqlEditor.getCode();
  15083. this.refs.gridColumn.setLoading(true);
  15084. var rows = this.refs.gridColumn.getDataRows();
  15085. Promise.all([
  15086. parseDynamicSqlApi(sql),
  15087. instance.reloadIfNeedPromise(),
  15088. ]).then(function (_a) {
  15089. var _b = __read(_a, 1), res1 = _b[0];
  15090. if (res1.success) {
  15091. _.forEach(res1.data, function (parseItem) {
  15092. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  15093. // 是否找到重复字段
  15094. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  15095. if (exists) {
  15096. if ((columnTypeName || "").toLowerCase() === "number") {
  15097. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  15098. if (record) {
  15099. record.set("dataType", "number");
  15100. record.set("align", "end");
  15101. }
  15102. }
  15103. return;
  15104. }
  15105. if (tableName) {
  15106. // 解出表格名和字段名
  15107. var meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  15108. if (meta) {
  15109. // 找到了元数据
  15110. var r = {
  15111. dataIndex: meta.column_name,
  15112. header: meta.column_comment,
  15113. xtype: '',
  15114. dataType: '',
  15115. width: '',
  15116. dict: '',
  15117. align: '',
  15118. filterable: true,
  15119. hidden: false,
  15120. sortable: true,
  15121. fieldExtend: '{}',
  15122. };
  15123. if (meta.column_ui === 'combo' && meta.column_dict) {
  15124. r.dict = meta.column_dict;
  15125. }
  15126. else if (meta.column_ui === "checkbox") {
  15127. r.xtype = 'checkbox';
  15128. }
  15129. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  15130. r.dataType = meta.data_type;
  15131. r.align = 'end';
  15132. }
  15133. if ((columnTypeName || "").toLowerCase() === "number") {
  15134. r.dataType = "number";
  15135. r.align = 'end';
  15136. }
  15137. _this.refs.gridColumn.appendEditRow(r);
  15138. return;
  15139. }
  15140. }
  15141. if (columnName) {
  15142. // 解出字段名
  15143. var r = {
  15144. dataIndex: columnName,
  15145. header: columnName,
  15146. xtype: '',
  15147. dataType: '',
  15148. width: '',
  15149. dict: '',
  15150. align: '',
  15151. filterable: true,
  15152. hidden: false,
  15153. sortable: true,
  15154. fieldExtend: '{}',
  15155. };
  15156. if ((columnTypeName || "").toLowerCase() === "number") {
  15157. r.dataType = "number";
  15158. r.align = 'end';
  15159. }
  15160. _this.refs.gridColumn.appendEditRow(r);
  15161. }
  15162. });
  15163. }
  15164. }).finally(function () {
  15165. _this.refs.gridColumn.setLoading(false);
  15166. });
  15167. };
  15168. ReportDesign.prototype.addSum = function () {
  15169. this.refs.gridSum.appendEditRow({
  15170. sumFieldBind: '',
  15171. sumFieldLabel: '',
  15172. sumFieldFlex: 1,
  15173. sumFieldWrap: false,
  15174. sumFieldExtend: '{}',
  15175. }, 'sumFieldBind');
  15176. };
  15177. ReportDesign.prototype.removeSum = function () {
  15178. var _this = this;
  15179. var rows = [];
  15180. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  15181. rows.push(r);
  15182. });
  15183. _.forEach(rows, function (r) {
  15184. _this.refs.gridSum.getStore().remove(r);
  15185. });
  15186. };
  15187. ReportDesign.prototype.calcSum = function () {
  15188. var _this = this;
  15189. var sql = this.refs.sqlSumEditor.getCode();
  15190. var rows = this.refs.gridSum.getDataRows();
  15191. this.refs.gridSum.setLoading(true);
  15192. parseDynamicSqlApi(sql).then(function (res1) {
  15193. if (res1.success) {
  15194. _.forEach(res1.data, function (parseItem) {
  15195. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  15196. // 是否找到重复字段
  15197. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  15198. return;
  15199. }
  15200. if (columnName) {
  15201. // 解出字段名
  15202. _this.refs.gridSum.appendEditRow({
  15203. sumFieldBind: columnName,
  15204. sumFieldLabel: columnName,
  15205. sumFieldFlex: 1,
  15206. sumFieldWrap: false,
  15207. sumFieldExtend: '{}',
  15208. });
  15209. }
  15210. });
  15211. }
  15212. }).finally(function () {
  15213. _this.refs.gridSum.setLoading(false);
  15214. });
  15215. };
  15216. Object.defineProperty(ReportDesign.prototype, "reportId", {
  15217. get: function () {
  15218. return this.viewModel.get('report_id');
  15219. },
  15220. enumerable: true,
  15221. configurable: true
  15222. });
  15223. return ReportDesign;
  15224. }(Scope));
  15225. var model$h = {
  15226. data: {
  15227. originalTableInfo: {
  15228. table_name: '',
  15229. description: '',
  15230. },
  15231. hasChanged: false,
  15232. schema_name: undefined,
  15233. table_name: undefined,
  15234. column_name: undefined,
  15235. tableInfo: {
  15236. schema_name: '',
  15237. table_name: '',
  15238. description: '',
  15239. biz_category: '',
  15240. note: '',
  15241. archive_enable: false,
  15242. archive_cron: '',
  15243. archive_condition: '',
  15244. column_list: []
  15245. },
  15246. },
  15247. formulas: {
  15248. shouldSave: function (get) {
  15249. // console.log("-->", get('grid1.ischanged'))
  15250. return get('grid1.ischanged')
  15251. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  15252. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  15253. },
  15254. },
  15255. };
  15256. var vjson$h = {
  15257. bind: {
  15258. title: '{tableName}{shouldSave?" *":""}',
  15259. },
  15260. layout: 'fit',
  15261. items: [
  15262. {
  15263. layout: 'border',
  15264. tbar: {
  15265. xtype: 'toolbar',
  15266. items: [
  15267. // {
  15268. // xtype: 'button',
  15269. // text: '拉取库结构',
  15270. // iconCls: 'x-fa fa-cloud-download',
  15271. // listeners: {
  15272. // click: 'scope.pullFromDb'
  15273. // }
  15274. // },
  15275. {
  15276. xtype: 'button',
  15277. text: '保存至数据库',
  15278. iconCls: 'x-fa fa-save',
  15279. bind: {
  15280. disabled: '{!shouldSave}'
  15281. },
  15282. listeners: {
  15283. click: 'scope.pushToDb'
  15284. }
  15285. },
  15286. '-',
  15287. {
  15288. xtype: 'button',
  15289. text: '刷新 QueryDSL',
  15290. iconCls: 'x-fa fa-refresh',
  15291. listeners: {
  15292. click: 'scope.syncQueryDSL'
  15293. }
  15294. },
  15295. {
  15296. xtype: 'button',
  15297. text: '生成 DDL',
  15298. iconCls: 'x-fa fa-file-text',
  15299. listeners: {
  15300. click: 'scope.buildDDL'
  15301. }
  15302. }
  15303. ]
  15304. },
  15305. items: [
  15306. {
  15307. region: 'center',
  15308. xtype: 'tabpanel',
  15309. items: [
  15310. {
  15311. title: '字段',
  15312. xtype: 'yvgrid',
  15313. selModel: {
  15314. type: 'spreadsheet',
  15315. columnSelect: true,
  15316. pruneRemoved: false,
  15317. extensible: 'y'
  15318. },
  15319. enableLocking: false,
  15320. idField: 'column_name',
  15321. plugins: {
  15322. clipboard: true,
  15323. selectionreplicator: true
  15324. },
  15325. reference: 'grid1',
  15326. pagination: false,
  15327. // hideFootbar: true,
  15328. tbar: {
  15329. xtype: 'form',
  15330. items: [
  15331. {
  15332. xtype: 'cols',
  15333. items: [
  15334. {
  15335. xtype: 'textfield',
  15336. fieldLabel: '表格名',
  15337. reference: 'text_table_name',
  15338. readOnly: true,
  15339. bind: {
  15340. value: '{tableInfo.table_name}'
  15341. }
  15342. },
  15343. {
  15344. xtype: 'textfield',
  15345. fieldLabel: '描述',
  15346. // readOnly: true,
  15347. bind: {
  15348. value: '{tableInfo.description}'
  15349. }
  15350. },
  15351. ]
  15352. },
  15353. {
  15354. xtype: 'toolbar',
  15355. items: [
  15356. {
  15357. xtype: 'button',
  15358. text: '添加',
  15359. iconCls: 'x-fa fa-plus-circle',
  15360. listeners: {
  15361. click: 'scope.addField'
  15362. }
  15363. },
  15364. {
  15365. xtype: 'button',
  15366. text: '删除',
  15367. iconCls: 'x-fa fa-minus-circle',
  15368. listeners: {
  15369. click: 'scope.removeField'
  15370. }
  15371. },
  15372. ]
  15373. },
  15374. ]
  15375. },
  15376. listeners: {
  15377. editbefore: 'scope.gridEditBefore'
  15378. },
  15379. columns: [
  15380. {
  15381. text: '字段名', dataIndex: 'column_name',
  15382. sortable: false,
  15383. menuDisabled: true,
  15384. width: 120,
  15385. editor: {
  15386. allowBlank: true,
  15387. selectOnFocus: false
  15388. }
  15389. },
  15390. {
  15391. text: '字段中文', dataIndex: 'column_comment',
  15392. width: 130,
  15393. sortable: false,
  15394. menuDisabled: true,
  15395. editor: {
  15396. allowBlank: true,
  15397. selectOnFocus: false
  15398. }
  15399. },
  15400. {
  15401. text: '主键', dataIndex: 'is_primary_key',
  15402. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  15403. width: 48, resizable: false,
  15404. },
  15405. {
  15406. text: '必填', dataIndex: 'not_null',
  15407. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  15408. width: 48, resizable: false,
  15409. },
  15410. {
  15411. text: '字段域', dataIndex: 'column_domain',
  15412. sortable: false, menuDisabled: true,
  15413. width: 148,
  15414. dict: 'column_domain',
  15415. editor: {
  15416. xtype: 'combo',
  15417. allowBlank: true,
  15418. selectOnFocus: true,
  15419. // fix: ['system.getDict("column_domain")'],
  15420. dict: 'column_domain',
  15421. listConfig: {
  15422. minWidth: 200
  15423. },
  15424. listeners: {
  15425. change: 'scope.columnDomainChange',
  15426. }
  15427. }
  15428. },
  15429. {
  15430. text: '数据类型', dataIndex: 'data_type',
  15431. sortable: false, menuDisabled: true,
  15432. editor: { allowBlank: true, selectOnFocus: true }
  15433. },
  15434. {
  15435. text: '长度', dataIndex: 'column_size',
  15436. sortable: false, menuDisabled: true,
  15437. xtype: 'numbercolumn', format: '0',
  15438. editor: { allowBlank: true, selectOnFocus: true }
  15439. },
  15440. {
  15441. text: '小数位', dataIndex: 'decimal_digits',
  15442. sortable: false, menuDisabled: true,
  15443. xtype: 'numbercolumn', format: '0',
  15444. editor: { allowBlank: true, selectOnFocus: true }
  15445. },
  15446. {
  15447. text: '默认值', dataIndex: 'default_value',
  15448. sortable: false, menuDisabled: true,
  15449. editor: { allowBlank: true, selectOnFocus: true }
  15450. },
  15451. {
  15452. text: '字典', dataIndex: 'column_dict',
  15453. sortable: false, menuDisabled: true,
  15454. // fix: ['system.getDict("DICT")'],
  15455. width: 200,
  15456. editor: {
  15457. xtype: 'combo',
  15458. allowBlank: true,
  15459. listConfig: {
  15460. minWidth: 350
  15461. },
  15462. }
  15463. },
  15464. {
  15465. text: 'UI建议', dataIndex: 'column_ui',
  15466. sortable: false, menuDisabled: true,
  15467. // fix: ['system.getDict("column_ui")'],
  15468. editor: {
  15469. xtype: 'combo',
  15470. allowBlank: true,
  15471. listConfig: {
  15472. minWidth: 200
  15473. },
  15474. }
  15475. },
  15476. {
  15477. text: '详细描述', dataIndex: 'column_note',
  15478. sortable: false, menuDisabled: true,
  15479. editor: { allowBlank: true, }
  15480. },
  15481. ]
  15482. },
  15483. {
  15484. title: '高级属性',
  15485. xtype: 'form',
  15486. items: [
  15487. // {
  15488. // xtype: 'textfield',
  15489. // fieldLabel: '表格名',
  15490. // bind: {
  15491. // value: '{tableName}'
  15492. // }
  15493. // },
  15494. // {
  15495. // xtype: 'textfield',
  15496. // fieldLabel: '中文含义',
  15497. // bind: {
  15498. // value: '{tableInfo.description}'
  15499. // }
  15500. // },
  15501. {
  15502. xtype: 'combo',
  15503. fieldLabel: '业务类型',
  15504. bind: {
  15505. value: '{tableInfo.biz_category}'
  15506. },
  15507. store: [
  15508. '基础资料',
  15509. '系统',
  15510. '账目与库存',
  15511. '单据',
  15512. '指令',
  15513. '规则与流程',
  15514. '开发辅助',
  15515. ]
  15516. },
  15517. {
  15518. xtype: 'textfield',
  15519. fieldLabel: '详细描述',
  15520. bind: {
  15521. value: '{tableInfo.note}'
  15522. },
  15523. },
  15524. {
  15525. xtype: 'checkbox',
  15526. fieldLabel: '允许归档',
  15527. bind: "{tableInfo.archive_enable}",
  15528. },
  15529. {
  15530. xtype: 'textfield',
  15531. fieldLabel: '归档周期',
  15532. bind: {
  15533. value: '{tableInfo.archive_cron}',
  15534. hidden: '{!tableInfo.archive_enable}',
  15535. }
  15536. },
  15537. {
  15538. xtype: 'textfield',
  15539. fieldLabel: '归档条件',
  15540. bind: {
  15541. value: '{tableInfo.archive_condition}',
  15542. hidden: '{!tableInfo.archive_enable}',
  15543. }
  15544. },
  15545. ]
  15546. },
  15547. ]
  15548. }
  15549. ]
  15550. },
  15551. ]
  15552. };
  15553. var DbColumn = /** @class */ (function (_super) {
  15554. __extends(DbColumn, _super);
  15555. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  15556. var _this = _super.call(this, {
  15557. model: getModel(model$h, schemaName, tableName, columnName, isCreateTable),
  15558. vjson: vjson$h
  15559. }) || this;
  15560. _this.isCreate = false;
  15561. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  15562. return _this;
  15563. }
  15564. DbColumn.prototype.onLoad = function () {
  15565. var _this = this;
  15566. var _a, _b, _c, _d, _e, _f, _g, _h;
  15567. console.log('me', this);
  15568. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  15569. this.refs.grid1.autoSizeColumns();
  15570. // this.refs.grid1.columns[0].hide()
  15571. // 自动定位到选定的列
  15572. if (this.viewModel.get('column_name')) {
  15573. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  15574. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  15575. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  15576. return;
  15577. }
  15578. }
  15579. }
  15580. instance$3.getColumnDomainComboData().then(function () {
  15581. _this.checkDomain();
  15582. });
  15583. 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 : "");
  15584. 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 : "");
  15585. if (this.isCreate)
  15586. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  15587. };
  15588. DbColumn.prototype.checkDomain = function () {
  15589. // 走查一遍 domain
  15590. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  15591. var dbType = this.viewModel.get('tableInfo.db_type');
  15592. var diffColumnName = [];
  15593. var tableInfo = this.viewModel.get('tableInfo');
  15594. this.refs.grid1.store.data.items.forEach(function (record) {
  15595. var data = record.data;
  15596. var column_domain = data.column_domain;
  15597. var domain = instance$3.getColumnDomainById(column_domain);
  15598. if (!domain) {
  15599. // 没有找到 domain
  15600. return;
  15601. }
  15602. var editRow = applyDomain(dbType, domain);
  15603. // 字段跟领域做对比
  15604. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  15605. if (typeof compareResult === 'string') {
  15606. // 不一样的情况下,要改成一致
  15607. _$2.forOwn(editRow, function (value, key) {
  15608. // 改成与 domain 一致
  15609. record.set(key, value);
  15610. });
  15611. diffColumnName.push(data.column_name + '.' + compareResult);
  15612. }
  15613. });
  15614. if (diffColumnName.length > 0) {
  15615. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  15616. }
  15617. };
  15618. DbColumn.prototype.addField = function () {
  15619. this.refs.grid1.appendEditRow({
  15620. column_name: '',
  15621. column_comment: '',
  15622. is_primary_key: false,
  15623. not_null: true,
  15624. column_domain: '',
  15625. data_type: '',
  15626. column_size: 0,
  15627. decimal_digits: 0,
  15628. default_value: '',
  15629. column_dict: '',
  15630. column_ui: '',
  15631. column_note: '',
  15632. }, 'column_name');
  15633. };
  15634. DbColumn.prototype.removeField = function () {
  15635. var _this = this;
  15636. var rows = [];
  15637. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  15638. rows.push(r);
  15639. });
  15640. _$2.forEach(rows, function (r) {
  15641. _this.refs.grid1.getStore().remove(r);
  15642. });
  15643. };
  15644. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  15645. instance$3.getColumnDomainComboData().then(function (data) {
  15646. editor.cmp.columns[5].getEditor().setStore({ data: data });
  15647. });
  15648. // 被字段域锁定的内容,不允许修改
  15649. var record = context.record, field = context.field;
  15650. var domainId = record.get('column_domain');
  15651. if (!domainId) {
  15652. return;
  15653. }
  15654. var domain = instance$3.getColumnDomainById(domainId);
  15655. if (!domain) {
  15656. msg$1('没有找到字段域' + domainId);
  15657. return;
  15658. }
  15659. if (field === "data_type") {
  15660. // 字段类型不允许修改
  15661. context.cancel = true;
  15662. return;
  15663. }
  15664. if (domain.is_fix_size &&
  15665. (field === "column_size" ||
  15666. field === "decimal_digits")) {
  15667. // 锁定长度的情况下,大小不允许修改
  15668. context.cancel = true;
  15669. return;
  15670. }
  15671. if (domain.is_fix_default_value && field === "default_value") {
  15672. // 锁定默认值的情况下,默认值不允许修改
  15673. context.cancel = true;
  15674. return;
  15675. }
  15676. };
  15677. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  15678. if (!newValue) {
  15679. return;
  15680. }
  15681. var grid = editor.up('grid').ownerGrid;
  15682. var domain = instance$3.getColumnDomainById(newValue);
  15683. if (!domain) {
  15684. msg$1('没有找到 domain:' + newValue);
  15685. return;
  15686. }
  15687. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  15688. var dbType = this.viewModel.get('tableInfo.db_type');
  15689. var editRow = applyDomain(dbType, domain);
  15690. grid.setEditRow(editRow);
  15691. };
  15692. DbColumn.prototype.pullFromDb = function () {
  15693. };
  15694. DbColumn.prototype.pushToDb = function (sender) {
  15695. var _this = this;
  15696. // 设置当前界面为 "保存中..." 状态
  15697. var me = this;
  15698. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  15699. this.viewModel.set('tableInfo.table_name', table_name);
  15700. this.viewModel.set('tableInfo.schema_name', schema_name);
  15701. var tableInfo = this.viewModel.get('tableInfo');
  15702. var column_list = this.refs.grid1.getDataRows();
  15703. var hasError = false;
  15704. if (column_list.length <= 0) {
  15705. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  15706. hasError = true;
  15707. }
  15708. var columnNameExistsCheck = {};
  15709. _$2.forEach(column_list, function (row, i) {
  15710. var checkResult = checkColumn(tableInfo, row);
  15711. if (typeof checkResult !== 'undefined') {
  15712. msg$1(checkResult);
  15713. hasError = true;
  15714. _this.refs.grid1.beginEdit(i, 'column_name');
  15715. return false;
  15716. }
  15717. if (!row.column_domain || row.column_domain === '0') {
  15718. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  15719. hasError = true;
  15720. _this.refs.grid1.beginEdit(i, 'column_domain');
  15721. return false;
  15722. }
  15723. if (isEmpty(row.data_type)) {
  15724. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  15725. hasError = true;
  15726. _this.refs.grid1.beginEdit(i, 'data_type');
  15727. return false;
  15728. }
  15729. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  15730. // 列名已存在
  15731. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  15732. hasError = true;
  15733. _this.refs.grid1.beginEdit(i, 'column_name');
  15734. return false;
  15735. }
  15736. columnNameExistsCheck[row.column_name] = true;
  15737. });
  15738. if (hasError)
  15739. return;
  15740. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  15741. me.setLoading(true);
  15742. instance.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  15743. .then(function (res) {
  15744. var _a;
  15745. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  15746. // 返回 DDL 就要显示出来
  15747. var window_1 = Ext.create('Ext.window.Window', {
  15748. title: 'SQL 预览',
  15749. height: 400,
  15750. width: 600,
  15751. modal: true,
  15752. animateTarget: sender,
  15753. maximizable: true,
  15754. layout: 'fit',
  15755. items: {
  15756. xtype: 'sqleditor',
  15757. value: res.data.ddl
  15758. },
  15759. buttons: [
  15760. {
  15761. xtype: 'button',
  15762. text: '执行',
  15763. iconCls: 'x-fa fa-save',
  15764. handler: function (sender) {
  15765. var editor = sender.up('window').down('sqleditor');
  15766. var ddl = editor.getValue();
  15767. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  15768. }
  15769. },
  15770. {
  15771. xtype: 'button',
  15772. text: '取消',
  15773. iconCls: 'x-fa fa-times',
  15774. handler: function () {
  15775. window_1.close();
  15776. }
  15777. }
  15778. ]
  15779. }).show();
  15780. return;
  15781. }
  15782. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  15783. var tableRow = instance.getTableByName(schema_name, table_name);
  15784. if (!tableRow) {
  15785. // throw Error('没有找到 table', schemaName, tableName, columnName)
  15786. console.log('这是一个新 table');
  15787. instance.appendNewTable(tableInfo);
  15788. }
  15789. _this.viewModel.set('schema_name', schema_name);
  15790. _this.viewModel.set('table_name', table_name);
  15791. _this.viewModel.set('tableInfo', tableInfo);
  15792. _this.refs.grid1.setData(tableInfo.column_list);
  15793. if (tableRow)
  15794. Object.assign(tableRow, tableInfo);
  15795. msg$1('保存成功');
  15796. _this.viewModel.set('hasChanged', false);
  15797. })
  15798. .finally(function () {
  15799. me.setLoading(false);
  15800. });
  15801. };
  15802. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  15803. var _this = this;
  15804. window.setLoading(true);
  15805. instance.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  15806. .then(function (res) {
  15807. var _a, _b, _c, _d;
  15808. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  15809. // 保存成功就提示一下,并重新载入数据
  15810. msg$1(res.msg);
  15811. instance.reloadForce(undefined);
  15812. var tableRow = instance.getTableByName(schema_name, table_name);
  15813. if (!tableRow) {
  15814. // throw Error('没有找到 table', schemaName, tableName, columnName)
  15815. console.log('这是一个新 table');
  15816. instance.appendNewTable(tableInfo);
  15817. }
  15818. _this.viewModel.set('schema_name', schema_name);
  15819. _this.viewModel.set('table_name', table_name);
  15820. _this.viewModel.set('tableInfo', tableInfo);
  15821. _this.refs.grid1.setData(tableInfo.column_list);
  15822. if (tableRow)
  15823. Object.assign(tableRow, tableInfo);
  15824. instance.notifyRefresh();
  15825. window.close();
  15826. _this.viewModel.set('hasChanged', false);
  15827. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  15828. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  15829. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  15830. })
  15831. .finally(function () {
  15832. // 无论正常异常,关闭 "保存中..." 状态
  15833. window.setLoading(false);
  15834. });
  15835. };
  15836. DbColumn.prototype.syncQueryDSL = function () {
  15837. var _this = this;
  15838. var tableInfo = this.viewModel.get("tableInfo");
  15839. this.setLoading(true);
  15840. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  15841. .then(function () {
  15842. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  15843. })
  15844. .finally(function () {
  15845. _this.setLoading(false);
  15846. });
  15847. };
  15848. DbColumn.prototype.buildDDL = function () {
  15849. };
  15850. return DbColumn;
  15851. }(Scope));
  15852. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  15853. model.data.schema_name = schemaName;
  15854. model.data.table_name = tableName;
  15855. model.data.column_name = columnName;
  15856. if (isCreateTable) {
  15857. var dbType = instance.getSchemaDbType(schemaName);
  15858. if (!dbType) {
  15859. throw Error('无法识别数据库类型' + schemaName);
  15860. }
  15861. model.data.tableInfo.schema_name = model.data.schema_name;
  15862. model.data.tableInfo.table_name = model.data.table_name;
  15863. model.data.tableInfo.db_type = dbType;
  15864. model.data.tableInfo.column_list = [];
  15865. model.data.tableInfo.is_create = true;
  15866. return model;
  15867. }
  15868. var tableRow = instance.getTableByName(schemaName, tableName);
  15869. if (!tableRow) {
  15870. throw Error('没有找到 table' + schemaName + tableName + columnName);
  15871. }
  15872. model.data.tableInfo = _$2.cloneDeep(tableRow);
  15873. model.data.tableInfo.is_create = false;
  15874. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  15875. return model;
  15876. }
  15877. var model$i = {
  15878. data: {
  15879. id: '',
  15880. path: '',
  15881. form: {
  15882. title: '',
  15883. sqlId: '',
  15884. }
  15885. }
  15886. };
  15887. var vjson$i = {
  15888. bind: {
  15889. title: '{title}',
  15890. },
  15891. layout: 'fit',
  15892. items: [
  15893. {
  15894. layout: 'border',
  15895. items: [
  15896. {
  15897. region: 'center',
  15898. layout: 'border',
  15899. items: [
  15900. {
  15901. region: 'north',
  15902. items: [
  15903. {
  15904. xtype: 'toolbar',
  15905. border: false,
  15906. items: [
  15907. {
  15908. xtype: 'button',
  15909. text: '刷新',
  15910. iconCls: 'x-fa fa-refresh',
  15911. listeners: {
  15912. click: 'scope.load'
  15913. }
  15914. },
  15915. {
  15916. xtype: 'button',
  15917. text: '保存',
  15918. iconCls: 'x-fa fa-save',
  15919. listeners: {
  15920. click: 'scope.widgetSave'
  15921. }
  15922. },
  15923. {
  15924. xtype: 'button',
  15925. text: '预览',
  15926. iconCls: 'x-fa fa-play-circle-o',
  15927. listeners: {
  15928. //click: 'scope.preview'
  15929. }
  15930. },
  15931. {
  15932. xtype: 'textfield',
  15933. fieldLabel: '弹窗文件',
  15934. reference: "wPath",
  15935. labelWidth: 80,
  15936. //width: 200,
  15937. bind: {
  15938. value: '{widgetPath}',
  15939. },
  15940. readOnly: true,
  15941. },
  15942. {
  15943. xtype: 'textfield',
  15944. fieldLabel: '弹窗名称',
  15945. reference: "wTitle",
  15946. labelWidth: 80,
  15947. //width: 200,
  15948. bind: {
  15949. value: '{form.title}',
  15950. },
  15951. readOnly: true,
  15952. },
  15953. {
  15954. xtype: 'textfield',
  15955. fieldLabel: 'sqlId',
  15956. bind: {
  15957. value: '{form.sqlId}',
  15958. },
  15959. readOnly: true,
  15960. },
  15961. ]
  15962. },
  15963. ]
  15964. },
  15965. {
  15966. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  15967. items: [
  15968. {
  15969. title: "SQL和条件",
  15970. layout: 'border',
  15971. border: false,
  15972. items: [
  15973. {
  15974. region: 'north',
  15975. height: 200,
  15976. xtype: 'yvgrid',
  15977. reference: "grid2",
  15978. split: true,
  15979. selModel: {
  15980. selType: 'rowmodel',
  15981. mode: 'SINGLE',
  15982. },
  15983. store: {},
  15984. pagination: false,
  15985. hideFootbar: true,
  15986. tbar: {
  15987. xtype: 'toolbar',
  15988. items: [
  15989. {
  15990. xtype: 'button',
  15991. text: '添加',
  15992. iconCls: 'x-fa fa-plus-circle',
  15993. listeners: {}
  15994. },
  15995. {
  15996. xtype: 'button',
  15997. text: '删除',
  15998. iconCls: 'x-fa fa-minus-circle',
  15999. listeners: {
  16000. click: 'scope.delCondition'
  16001. }
  16002. },
  16003. '-',
  16004. {
  16005. xtype: 'button',
  16006. text: '上移',
  16007. iconCls: 'x-fa fa-refresh',
  16008. listeners: {
  16009. //click: 'scope.saveAll'
  16010. }
  16011. },
  16012. {
  16013. xtype: 'button',
  16014. text: '下移',
  16015. iconCls: 'x-fa fa-refresh',
  16016. listeners: {
  16017. //click: 'scope.saveAll'
  16018. }
  16019. },
  16020. '-',
  16021. {
  16022. xtype: 'button',
  16023. text: '自动分析',
  16024. iconCls: 'x-fa fa-refresh',
  16025. listeners: {
  16026. click: 'scope.calcCondition'
  16027. }
  16028. },
  16029. ]
  16030. },
  16031. columns: [
  16032. {
  16033. text: '条件变量',
  16034. dataIndex: 'conditionFieldBind',
  16035. width: 140,
  16036. sortable: false,
  16037. menuDisabled: true,
  16038. editor: {
  16039. selectOnFocus: true
  16040. },
  16041. },
  16042. {
  16043. text: '中文标题',
  16044. dataIndex: 'conditionFieldLabel',
  16045. width: 120,
  16046. sortable: false,
  16047. menuDisabled: true,
  16048. editor: {
  16049. selectOnFocus: true
  16050. },
  16051. },
  16052. {
  16053. text: '编辑类型',
  16054. dataIndex: 'xtype',
  16055. sortable: false,
  16056. menuDisabled: true,
  16057. editor: {
  16058. xtype: 'combo',
  16059. typeAhead: true,
  16060. triggerAction: 'all',
  16061. selectOnFocus: true,
  16062. store: [
  16063. ['textfield', 'textfield'],
  16064. ['combo', 'combo'],
  16065. ['datefield', 'datefield'],
  16066. ['datetimefield', 'datetimefield'],
  16067. ['numberfield', 'numberfield'],
  16068. ['multiplesearch', 'multiplesearch'],
  16069. ]
  16070. }
  16071. },
  16072. {
  16073. text: '权重',
  16074. dataIndex: 'conditionFieldFlex',
  16075. align: 'right',
  16076. sortable: false,
  16077. menuDisabled: true,
  16078. editor: {
  16079. xtype: 'numberfield',
  16080. selectOnFocus: false,
  16081. minValue: 0,
  16082. maxValue: 10
  16083. },
  16084. },
  16085. {
  16086. text: '字典',
  16087. dataIndex: 'conditionFieldDict',
  16088. width: 160,
  16089. sortable: false,
  16090. menuDisabled: true,
  16091. editor: {
  16092. selectOnFocus: false
  16093. },
  16094. },
  16095. {
  16096. xtype: 'checkcolumn',
  16097. dataIndex: "conditionFieldWrap", header: "换行",
  16098. width: 65,
  16099. sortable: false,
  16100. menuDisabled: true,
  16101. },
  16102. ]
  16103. },
  16104. {
  16105. region: 'center',
  16106. xtype: 'sqleditor',
  16107. layout: 'fit',
  16108. reference: 'sqlEditor',
  16109. split: true,
  16110. bind: {
  16111. value: "{form.sql}"
  16112. },
  16113. },
  16114. ]
  16115. },
  16116. {
  16117. title: "结果字段定义",
  16118. border: false,
  16119. xtype: 'yvgrid',
  16120. reference: "grid3",
  16121. selModel: {
  16122. selType: 'rowmodel',
  16123. mode: 'SINGLE',
  16124. },
  16125. store: {},
  16126. pagination: false,
  16127. hideFootbar: true,
  16128. tbar: {
  16129. xtype: 'toolbar',
  16130. items: [
  16131. {
  16132. xtype: 'button',
  16133. text: '添加',
  16134. iconCls: 'x-fa fa-plus-circle',
  16135. listeners: {}
  16136. },
  16137. {
  16138. xtype: 'button',
  16139. text: '删除',
  16140. iconCls: 'x-fa fa-minus-circle',
  16141. listeners: {
  16142. click: 'scope.delColumn'
  16143. }
  16144. },
  16145. '-',
  16146. {
  16147. xtype: 'button',
  16148. text: '上移',
  16149. iconCls: 'x-fa fa-refresh',
  16150. listeners: {
  16151. //click: 'scope.saveAll'
  16152. }
  16153. },
  16154. {
  16155. xtype: 'button',
  16156. text: '下移',
  16157. iconCls: 'x-fa fa-refresh',
  16158. listeners: {
  16159. //click: 'scope.saveAll'
  16160. }
  16161. },
  16162. '-',
  16163. {
  16164. xtype: 'button',
  16165. text: '自动分析',
  16166. iconCls: 'x-fa fa-refresh',
  16167. listeners: {
  16168. click: 'scope.calcColumn'
  16169. }
  16170. },
  16171. ]
  16172. },
  16173. columns: [
  16174. { xtype: 'rownumberer' },
  16175. {
  16176. text: '字段',
  16177. dataIndex: 'dataIndex',
  16178. width: 140,
  16179. sortable: false,
  16180. menuDisabled: true,
  16181. editor: {
  16182. selectOnFocus: true
  16183. },
  16184. },
  16185. {
  16186. text: '标题',
  16187. dataIndex: 'header',
  16188. width: 120,
  16189. sortable: false,
  16190. menuDisabled: true,
  16191. editor: {
  16192. selectOnFocus: true
  16193. },
  16194. },
  16195. {
  16196. text: '显示类型',
  16197. dataIndex: 'xtype',
  16198. width: 90,
  16199. sortable: false,
  16200. menuDisabled: true,
  16201. editor: {
  16202. xtype: 'combo',
  16203. typeAhead: true,
  16204. triggerAction: 'all',
  16205. selectOnFocus: true,
  16206. store: [
  16207. ['', ''],
  16208. ['rownum', 'rownum'],
  16209. ['button', 'button'],
  16210. ['checkbox', 'checkbox'],
  16211. ['progres', 'progres'],
  16212. ]
  16213. }
  16214. },
  16215. {
  16216. text: '数据类型',
  16217. dataIndex: 'dataType',
  16218. width: 90,
  16219. sortable: false,
  16220. menuDisabled: true,
  16221. editor: {
  16222. xtype: 'combo',
  16223. typeAhead: true,
  16224. triggerAction: 'all',
  16225. selectOnFocus: true,
  16226. store: [
  16227. ['', ''],
  16228. ['string', 'string'],
  16229. ['number', 'number'],
  16230. ['date', 'date'],
  16231. ]
  16232. }
  16233. },
  16234. {
  16235. text: '数据字典',
  16236. dataIndex: 'dict',
  16237. sortable: false,
  16238. menuDisabled: true,
  16239. width: 120,
  16240. editor: {
  16241. selectOnFocus: true,
  16242. },
  16243. },
  16244. ],
  16245. },
  16246. ]
  16247. },
  16248. ]
  16249. },
  16250. ]
  16251. }
  16252. ]
  16253. }; //
  16254. //
  16255. var WidgetDesign = /** @class */ (function (_super) {
  16256. __extends(WidgetDesign, _super);
  16257. function WidgetDesign(widgetPath, widgetName) {
  16258. var _this = _super.call(this, { model: model$i, vjson: vjson$i }) || this;
  16259. _this.widgetPath = widgetPath;
  16260. _this.widgetName = widgetName;
  16261. return _this;
  16262. }
  16263. WidgetDesign.prototype.onLoad = function () {
  16264. if (this.widgetPath) {
  16265. this.loadForm(this.widgetPath);
  16266. this.viewModel.set("widgetPath", this.widgetPath);
  16267. this.refs.wTitle.setReadOnly(true);
  16268. this.refs.wPath.setReadOnly(true);
  16269. }
  16270. else {
  16271. this.refs.wTitle.setReadOnly(false);
  16272. this.refs.wPath.setReadOnly(false);
  16273. }
  16274. };
  16275. WidgetDesign.prototype.load = function () {
  16276. var widgetPath = this.viewModel.get("widgetPath");
  16277. if (widgetPath) {
  16278. this.loadForm(widgetPath);
  16279. }
  16280. };
  16281. WidgetDesign.prototype.loadForm = function (widgetPath) {
  16282. var _this = this;
  16283. var me = this;
  16284. me.setLoading(true);
  16285. readWidget({ widgetPath: widgetPath }).then(function (res) {
  16286. msg$1(res.msg);
  16287. if (res.success) {
  16288. _this.viewModel.set("widgetPath", widgetPath);
  16289. me.refs.grid3.getStore().removeAll();
  16290. if (res.data.form.columns) {
  16291. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  16292. }
  16293. _this.viewModel.set("form.title", res.data.form.title);
  16294. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  16295. // set sql
  16296. _this.refs.sqlEditor.setCode(res.data.sql);
  16297. }
  16298. }).finally(function () {
  16299. me.setLoading(false);
  16300. });
  16301. };
  16302. WidgetDesign.prototype.widgetAdd = function (sender) {
  16303. var _this = this;
  16304. var title = this.viewModel.get("form.title");
  16305. if (title) {
  16306. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  16307. if (btn == 'yes') {
  16308. alert(1);
  16309. }
  16310. else {
  16311. alert(2);
  16312. }
  16313. });
  16314. }
  16315. else {
  16316. var me_1 = this;
  16317. var win_1 = new Ext.Window({
  16318. autoDestroy: true,
  16319. title: "新建弹框",
  16320. width: 400,
  16321. height: 220,
  16322. resizable: true,
  16323. closable: true,
  16324. maximizable: true,
  16325. minimizable: true,
  16326. plain: true,
  16327. // constrainHeader: true,
  16328. constrain: true,
  16329. layout: 'fit',
  16330. animateTarget: sender,
  16331. buttonAlign: 'center',
  16332. items: [
  16333. {
  16334. xtype: "form",
  16335. layout: "hbox",
  16336. margin: '10px 20px',
  16337. border: 0,
  16338. items: [
  16339. {
  16340. flex: 1,
  16341. layout: 'vbox',
  16342. items: [
  16343. {
  16344. xtype: "textfield",
  16345. name: "widgetcode",
  16346. fieldLabel: "弹框编号",
  16347. flex: 1,
  16348. allowBlank: false,
  16349. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  16350. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  16351. labelWidth: 50,
  16352. width: "100%",
  16353. },
  16354. {
  16355. xtype: "textfield",
  16356. name: "widgetname",
  16357. fieldLabel: "弹框名称",
  16358. flex: 1,
  16359. allowBlank: false,
  16360. labelWidth: 50,
  16361. width: "100%",
  16362. },
  16363. ]
  16364. },
  16365. ]
  16366. }
  16367. ],
  16368. //窗口按钮
  16369. buttons: [
  16370. {
  16371. xtype: 'button', text: '保存', handler: function (btn) {
  16372. //窗口获取表单
  16373. var form = win_1.down('form');
  16374. var vaildSuccess = form.isValid();
  16375. if (!vaildSuccess) {
  16376. return;
  16377. }
  16378. var title = form.down('textfield[name="widgetname"]').getValue();
  16379. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  16380. me_1.viewModel.set("form.title", title);
  16381. me_1.viewModel.set("widgetPath", widgetPath);
  16382. var formdata = _this.viewModel.get("form");
  16383. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  16384. if (res.success) {
  16385. msg$1('添加成功');
  16386. }
  16387. me_1.loadForm(widgetPath);
  16388. win_1.close();
  16389. });
  16390. }
  16391. },
  16392. {
  16393. xtype: 'button', text: '取消', handler: function (btn) {
  16394. //窗口关闭
  16395. win_1.close();
  16396. }
  16397. }
  16398. ]
  16399. });
  16400. win_1.show();
  16401. }
  16402. };
  16403. WidgetDesign.prototype.widgetSave = function () {
  16404. var _this = this;
  16405. var _a, _b;
  16406. var widgetPath = this.viewModel.get("widgetPath");
  16407. if (!widgetPath) {
  16408. msg$1("请选择或添加弹框后再保存!");
  16409. return;
  16410. }
  16411. var title = this.viewModel.get("form.title");
  16412. if (!title) {
  16413. msg$1("请选择或添加弹框后再保存!");
  16414. return;
  16415. }
  16416. // 获取条件
  16417. 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) {
  16418. delete r.id;
  16419. return r;
  16420. });
  16421. this.viewModel.set("form.conditions", conditions);
  16422. // 获取查询列
  16423. 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) {
  16424. delete r.id;
  16425. if (r.dict) {
  16426. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  16427. }
  16428. return r;
  16429. });
  16430. this.viewModel.set("form.columns", columns);
  16431. // sql
  16432. var sql = this.refs.sqlEditor.getCode();
  16433. this.viewModel.set("form.sql", sql);
  16434. var form = this.viewModel.get("form");
  16435. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  16436. msg$1(res.msg);
  16437. if (res.success) {
  16438. msg$1('保存成功');
  16439. _this.loadForm(widgetPath);
  16440. }
  16441. }).catch(function (res) {
  16442. });
  16443. };
  16444. WidgetDesign.prototype.delCondition = function () {
  16445. var _a;
  16446. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  16447. };
  16448. WidgetDesign.prototype.delColumn = function () {
  16449. var _a;
  16450. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  16451. };
  16452. WidgetDesign.prototype.calcCondition = function () {
  16453. var _this = this;
  16454. var sql = this.refs.sqlEditor.getCode();
  16455. var re = sql.matchAll(/#{(.+?)}/gi);
  16456. var rows = this.refs.grid2.getDataRows();
  16457. this.refs.grid2.setLoading(true);
  16458. parseDynamicSqlApi(sql).then(function (res) {
  16459. var e_1, _a;
  16460. if (res.success) {
  16461. var tables_1 = [];
  16462. _.forEach(res.data, function (parseItem) {
  16463. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  16464. if (tableName && !_.includes(tables_1, tableName)) {
  16465. tables_1.push(tableName);
  16466. }
  16467. });
  16468. var _loop_1 = function (m) {
  16469. var e_2, _a;
  16470. var columnName = m[1];
  16471. // 没有这个列才添加
  16472. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  16473. var meta = undefined;
  16474. try {
  16475. 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()) {
  16476. var tableName = tables_2_1.value;
  16477. meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  16478. if (meta) {
  16479. break;
  16480. }
  16481. }
  16482. }
  16483. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  16484. finally {
  16485. try {
  16486. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  16487. }
  16488. finally { if (e_2) throw e_2.error; }
  16489. }
  16490. if (meta) {
  16491. // 没找到元数据,直接添加
  16492. _this.refs.grid2.appendEditRow({
  16493. conditionFieldBind: columnName,
  16494. conditionFieldLabel: meta.column_comment,
  16495. conditionFieldXtype: 'textfield',
  16496. conditionFieldFlex: 1,
  16497. conditionFieldDict: '',
  16498. conditionFieldWrap: false,
  16499. });
  16500. }
  16501. else {
  16502. _this.refs.grid2.appendEditRow({
  16503. conditionFieldBind: columnName,
  16504. conditionFieldLabel: '',
  16505. conditionFieldXtype: 'textfield',
  16506. conditionFieldFlex: 1,
  16507. conditionFieldDict: '',
  16508. conditionFieldWrap: false,
  16509. });
  16510. }
  16511. }
  16512. };
  16513. try {
  16514. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  16515. var m = re_1_1.value;
  16516. _loop_1(m);
  16517. }
  16518. }
  16519. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  16520. finally {
  16521. try {
  16522. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  16523. }
  16524. finally { if (e_1) throw e_1.error; }
  16525. }
  16526. }
  16527. }).finally(function () {
  16528. _this.refs.grid2.setLoading(false);
  16529. });
  16530. };
  16531. WidgetDesign.prototype.calcColumn = function () {
  16532. var _this = this;
  16533. var sql = this.refs.sqlEditor.getCode();
  16534. var rows = this.refs.grid3.getDataRows();
  16535. this.refs.grid3.setLoading(true);
  16536. parseDynamicSqlApi(sql).then(function (res) {
  16537. _.forEach(res.data, function (parseItem) {
  16538. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  16539. // 是否找到重复字段
  16540. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  16541. if (exists) {
  16542. return;
  16543. }
  16544. if (tableName) {
  16545. // 解出表格名和字段名
  16546. var meta = instance.getColumnByTableNameColumnName(tableName, columnName);
  16547. if (meta) {
  16548. // 找到了元数据
  16549. var r = {
  16550. dataIndex: meta.column_name,
  16551. header: meta.column_comment,
  16552. xtype: '',
  16553. dataType: 'string',
  16554. dict: '',
  16555. };
  16556. if (meta.column_ui === 'combo' && meta.column_dict) {
  16557. r.dict = meta.column_dict;
  16558. }
  16559. else if (meta.column_ui === "checkbox") {
  16560. r.xtype = 'checkbox';
  16561. }
  16562. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  16563. r.dataType = meta.data_type;
  16564. }
  16565. _this.refs.grid3.appendEditRow(r);
  16566. return;
  16567. }
  16568. }
  16569. if (columnName) {
  16570. // 解出字段名
  16571. var r = {
  16572. dataIndex: columnName,
  16573. header: columnName,
  16574. xtype: '',
  16575. dataType: 'string',
  16576. dict: '',
  16577. };
  16578. _this.refs.grid3.appendEditRow(r);
  16579. }
  16580. });
  16581. }).finally(function () {
  16582. _this.refs.grid3.setLoading(false);
  16583. });
  16584. };
  16585. return WidgetDesign;
  16586. }(Scope));
  16587. var model$j = {
  16588. data: {
  16589. // spreadsheet: false,
  16590. // multSelect: false,
  16591. // showCheckColumn: false,
  16592. // checkColumncheckOnly: false,
  16593. // disableSelection: false,
  16594. vjson: {
  16595. reference: '',
  16596. pagination: false,
  16597. pageSize: false,
  16598. pageSizeOption: false,
  16599. hideFootbar: false,
  16600. hideRefresh: false,
  16601. hideExport: false,
  16602. hideAutoSize: false,
  16603. hideClearFilter: false,
  16604. hideSaveGridUIConfig: false,
  16605. hideClearGridUIConfig: false,
  16606. selectMode: '',
  16607. cellediting_clicksToEdit: 1,
  16608. columnLines: false,
  16609. rowLines: false,
  16610. border: false,
  16611. autoLoad: false,
  16612. remoteSort: false,
  16613. remoteFilter: false,
  16614. enableLocking: false,
  16615. enableColumnHide: false,
  16616. enableColumnMove: false,
  16617. gridfilters: false,
  16618. enableColumnResize: false,
  16619. sortOnClick: false,
  16620. hidden: false,
  16621. cls: '',
  16622. dataSource: {
  16623. url: '',
  16624. params: {
  16625. formData: '{form}',
  16626. },
  16627. },
  16628. listeners: {
  16629. beforeselect: '',
  16630. selectionchange: '',
  16631. itemclick: '',
  16632. itemdblclick: '',
  16633. cellClick: '',
  16634. celldblclick: '',
  16635. afterrender: '',
  16636. destory: '',
  16637. }
  16638. },
  16639. }
  16640. };
  16641. var vjson$j = {
  16642. title: '表格-高级',
  16643. height: 450,
  16644. width: 970,
  16645. layout: 'fit',
  16646. modal: true,
  16647. items: [
  16648. {
  16649. xtype: 'tabpanel',
  16650. items: [
  16651. {
  16652. title: '属性',
  16653. xtype: 'form',
  16654. scrollable: true,
  16655. items: [
  16656. {
  16657. xtype: 'cols',
  16658. items: [
  16659. {
  16660. xtype: 'textfield',
  16661. fieldLabel: '引用名',
  16662. tooltip: 'reference',
  16663. bind: '{vjson.reference}',
  16664. },
  16665. ]
  16666. },
  16667. {
  16668. xtype: 'cols',
  16669. border: false,
  16670. items: [
  16671. // 允许分页、页大小、页大小选项
  16672. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  16673. // 多选、显示勾选、自动勾选、
  16674. // 单击编辑、列分割线、行分割线、边框
  16675. // 数据源自动加载、后端排序、后端过滤
  16676. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  16677. {
  16678. xtype: 'checkbox',
  16679. fieldLabel: '允许分页',
  16680. bind: {
  16681. value: "{vjson.pagination}"
  16682. }
  16683. },
  16684. {
  16685. xtype: 'numberfield',
  16686. fieldLabel: '页大小',
  16687. bind: '{vjson.pageSize}',
  16688. },
  16689. {
  16690. xtype: 'textfield',
  16691. fieldLabel: '页大小选项',
  16692. flex: 2,
  16693. bind: '{vjson.pageSizeOption}',
  16694. },
  16695. ]
  16696. },
  16697. {
  16698. layout: 'hbox',
  16699. border: false,
  16700. items: [
  16701. {
  16702. xtype: 'combo',
  16703. fieldLabel: '选择模式',
  16704. flex: 4,
  16705. data: [
  16706. { id: 'spreadsheet', text: 'Excel模式' },
  16707. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  16708. { id: 'checkColumn', text: '勾选框' },
  16709. { id: 'row_mulity', text: '行选择-允许多选' },
  16710. { id: 'row_single', text: '行选择-单选' },
  16711. { id: 'disableSelection', text: '禁用' },
  16712. ],
  16713. bind: {
  16714. value: '{vjson.selectMode}'
  16715. }
  16716. }
  16717. ]
  16718. },
  16719. {
  16720. layout: 'hbox',
  16721. border: false,
  16722. defaults: {
  16723. xtype: 'checkbox',
  16724. margin: '0 15 0 0',
  16725. },
  16726. items: [
  16727. {
  16728. xtype: 'container',
  16729. margin: '3',
  16730. border: false,
  16731. width: 80,
  16732. },
  16733. {
  16734. boxLabel: '隐藏底部',
  16735. bind: {
  16736. value: "{vjson.hideFootbar}"
  16737. }
  16738. },
  16739. {
  16740. boxLabel: '隐藏刷新',
  16741. bind: {
  16742. value: "{vjson.hideRefresh}"
  16743. }
  16744. },
  16745. {
  16746. boxLabel: '隐藏导出',
  16747. bind: {
  16748. value: "{vjson.hideExport}"
  16749. }
  16750. },
  16751. {
  16752. boxLabel: '隐藏自动调宽',
  16753. bind: {
  16754. value: "{vjson.hideAutoSize}"
  16755. }
  16756. },
  16757. {
  16758. boxLabel: '隐藏清空筛选',
  16759. bind: {
  16760. value: "{vjson.hideClearFilter}"
  16761. }
  16762. },
  16763. {
  16764. boxLabel: '隐藏保存布局',
  16765. bind: {
  16766. value: "{vjson.hideSaveGridUIConfig}"
  16767. }
  16768. },
  16769. {
  16770. boxLabel: '隐藏重置布局',
  16771. bind: {
  16772. value: "{vjson.hideClearGridUIConfig}"
  16773. }
  16774. },
  16775. ]
  16776. },
  16777. {
  16778. layout: 'hbox',
  16779. border: false,
  16780. defaults: {
  16781. xtype: 'checkbox',
  16782. margin: '0 15 0 0',
  16783. },
  16784. items: [
  16785. {
  16786. xtype: 'container',
  16787. margin: '3',
  16788. border: false,
  16789. width: 80
  16790. },
  16791. {
  16792. boxLabel: '单击编辑',
  16793. bind: {
  16794. value: "{vjson.cellediting_clicksToEdit}"
  16795. }
  16796. },
  16797. {
  16798. boxLabel: '列分隔线',
  16799. bind: {
  16800. value: "{vjson.columnLines}"
  16801. }
  16802. },
  16803. {
  16804. boxLabel: '行分隔线',
  16805. bind: {
  16806. value: "{vjson.rowLines}"
  16807. }
  16808. },
  16809. {
  16810. boxLabel: '边框',
  16811. bind: {
  16812. value: "{vjson.border}"
  16813. }
  16814. },
  16815. ]
  16816. },
  16817. {
  16818. layout: 'hbox',
  16819. border: false,
  16820. defaults: {
  16821. xtype: 'checkbox',
  16822. margin: '0 15 0 0',
  16823. },
  16824. items: [
  16825. {
  16826. xtype: 'container',
  16827. margin: '3',
  16828. border: false,
  16829. width: 80
  16830. },
  16831. {
  16832. boxLabel: '数据源自动加载',
  16833. bind: {
  16834. value: "{vjson.autoLoad}"
  16835. }
  16836. },
  16837. {
  16838. boxLabel: '后端排序',
  16839. bind: {
  16840. value: "{vjson.remoteSort}"
  16841. }
  16842. },
  16843. {
  16844. boxLabel: '后端过滤',
  16845. bind: {
  16846. value: "{vjson.remoteFilter}"
  16847. }
  16848. },
  16849. ]
  16850. },
  16851. {
  16852. layout: 'hbox',
  16853. border: false,
  16854. defaults: {
  16855. xtype: 'checkbox',
  16856. margin: '0 15 0 0',
  16857. },
  16858. items: [
  16859. {
  16860. xtype: 'container',
  16861. margin: '3',
  16862. border: false,
  16863. width: 80
  16864. },
  16865. {
  16866. boxLabel: '自定义锁定',
  16867. bind: {
  16868. value: "{vjson.enableLocking}"
  16869. }
  16870. },
  16871. {
  16872. boxLabel: '自定义隐藏',
  16873. bind: {
  16874. value: "{vjson.enableColumnHide}"
  16875. }
  16876. },
  16877. {
  16878. boxLabel: '用户拖拽字段',
  16879. bind: {
  16880. value: "{vjson.enableColumnMove}"
  16881. }
  16882. },
  16883. {
  16884. boxLabel: '自定义筛选',
  16885. bind: {
  16886. value: "{vjson.gridfilters}"
  16887. }
  16888. },
  16889. {
  16890. boxLabel: '用户拖拽字段宽度',
  16891. bind: {
  16892. value: "{vjson.enableColumnResize}"
  16893. }
  16894. },
  16895. {
  16896. boxLabel: '点击列头排序',
  16897. bind: {
  16898. value: "{vjson.sortOnClick}"
  16899. }
  16900. },
  16901. {
  16902. xtype: 'checkbox',
  16903. boxLabel: '隐藏',
  16904. bind: {
  16905. value: "{vjson.hidden}"
  16906. }
  16907. },
  16908. ]
  16909. },
  16910. {
  16911. xtype: 'cols',
  16912. items: [
  16913. {
  16914. xtype: 'textfield',
  16915. fieldLabel: '样式',
  16916. bind: '{vjson.cls}',
  16917. flex: 4
  16918. },
  16919. ]
  16920. },
  16921. ]
  16922. },
  16923. {
  16924. title: '字段',
  16925. xtype: 'yvgrid',
  16926. reference: 'grid1',
  16927. pagination: false,
  16928. hideFootbar: true,
  16929. plugins: {
  16930. clipboard: true,
  16931. selectionreplicator: true
  16932. },
  16933. selModel: {
  16934. type: 'spreadsheet',
  16935. columnSelect: true,
  16936. pruneRemoved: false,
  16937. extensible: 'y'
  16938. },
  16939. listeners: {
  16940. editfinish: 'scope.gridEditFinish',
  16941. },
  16942. tbar: {
  16943. xtype: 'toolbar',
  16944. items: [
  16945. {
  16946. xtype: 'button',
  16947. text: '添加',
  16948. iconCls: 'x-fa fa-plus-circle',
  16949. listeners: {
  16950. click: 'scope.addColumn'
  16951. }
  16952. },
  16953. {
  16954. xtype: 'button',
  16955. text: '删除',
  16956. iconCls: 'x-fa fa-minus-circle',
  16957. listeners: {
  16958. click: 'scope.removeColumn'
  16959. }
  16960. },
  16961. '-',
  16962. {
  16963. xtype: 'button',
  16964. text: '自动分析',
  16965. iconCls: 'x-fa fa-code-fork',
  16966. listeners: {
  16967. click: 'scope.calcColumn'
  16968. }
  16969. },
  16970. {
  16971. xtype: 'button',
  16972. text: '上移',
  16973. iconCls: 'x-fa fa-arrow-up',
  16974. listeners: {
  16975. click: 'scope.moveUp'
  16976. }
  16977. },
  16978. {
  16979. xtype: 'button',
  16980. text: '下移',
  16981. iconCls: 'x-fa fa-arrow-down',
  16982. listeners: {
  16983. click: 'scope.moveDown'
  16984. }
  16985. },
  16986. ]
  16987. },
  16988. columns: [
  16989. { xtype: 'rownumberer' },
  16990. {
  16991. text: '字段',
  16992. dataIndex: 'dataIndex',
  16993. width: 140,
  16994. sortable: false,
  16995. menuDisabled: true,
  16996. editor: {
  16997. selectOnFocus: true,
  16998. },
  16999. },
  17000. {
  17001. text: '标题',
  17002. dataIndex: 'header',
  17003. width: 120,
  17004. sortable: false,
  17005. menuDisabled: true,
  17006. editor: {
  17007. selectOnFocus: true,
  17008. },
  17009. },
  17010. {
  17011. text: '类型',
  17012. dataIndex: 'xtype',
  17013. width: 100,
  17014. sortable: false,
  17015. menuDisabled: true,
  17016. editor: {
  17017. xtype: 'combo',
  17018. typeAhead: true,
  17019. triggerAction: 'all',
  17020. selectOnFocus: false,
  17021. listConfig: {
  17022. minWidth: 200
  17023. },
  17024. store: [
  17025. ['', '默认'],
  17026. ['rownum', 'rownum'],
  17027. ['checkcolumn', 'checkcolumn'],
  17028. ]
  17029. },
  17030. },
  17031. {
  17032. text: '数据类型',
  17033. dataIndex: 'dataType',
  17034. width: 100,
  17035. sortable: false,
  17036. menuDisabled: true,
  17037. editor: {
  17038. xtype: 'combo',
  17039. selectOnFocus: true,
  17040. listConfig: {
  17041. minWidth: 200
  17042. },
  17043. store: [
  17044. ['', '默认'],
  17045. ['string', 'string'],
  17046. ['number', 'number'],
  17047. ['date', 'date'],
  17048. ]
  17049. },
  17050. },
  17051. {
  17052. text: '编辑模式',
  17053. dataIndex: 'editor',
  17054. width: 100,
  17055. sortable: false,
  17056. menuDisabled: true,
  17057. editor: {
  17058. xtype: 'combo',
  17059. selectOnFocus: true,
  17060. listConfig: {
  17061. minWidth: 200
  17062. },
  17063. store: [
  17064. ['', ''],
  17065. ['textfield', 'textfield'],
  17066. ['numberfield', 'numberfield'],
  17067. ['combo', 'combo'],
  17068. ['combogrid', 'combogrid'],
  17069. ['datefield', 'datefield'],
  17070. ]
  17071. },
  17072. },
  17073. {
  17074. text: '宽度',
  17075. dataIndex: 'width',
  17076. align: 'right',
  17077. width: 100,
  17078. sortable: false,
  17079. menuDisabled: true,
  17080. editor: {
  17081. xtype: 'numberfield',
  17082. selectOnFocus: true,
  17083. minValue: 0,
  17084. maxValue: 1000
  17085. },
  17086. },
  17087. {
  17088. text: '权重',
  17089. dataIndex: 'flex',
  17090. align: 'right',
  17091. width: 90,
  17092. sortable: false,
  17093. menuDisabled: true,
  17094. editor: {
  17095. xtype: 'numberfield',
  17096. selectOnFocus: true,
  17097. minValue: 0,
  17098. maxValue: 10
  17099. },
  17100. },
  17101. {
  17102. text: '字典',
  17103. dataIndex: 'dict',
  17104. sortable: false,
  17105. menuDisabled: true,
  17106. width: 210,
  17107. editor: {
  17108. selectOnFocus: true,
  17109. },
  17110. },
  17111. {
  17112. text: '对齐',
  17113. dataIndex: 'align',
  17114. width: 90,
  17115. sortable: false,
  17116. menuDisabled: true,
  17117. editor: {
  17118. xtype: 'combo',
  17119. selectOnFocus: true,
  17120. listConfig: {
  17121. minWidth: 120
  17122. },
  17123. store: [
  17124. ['start', 'start'],
  17125. ['center', 'center'],
  17126. ['end', 'end'],
  17127. ]
  17128. },
  17129. },
  17130. {
  17131. text: '必填',
  17132. dataIndex: 'notAllowBlank',
  17133. width: 50,
  17134. resizable: false,
  17135. sortable: false,
  17136. menuDisabled: true,
  17137. xtype: 'checkcolumn',
  17138. },
  17139. {
  17140. text: '禁用',
  17141. dataIndex: 'disabled',
  17142. width: 50,
  17143. resizable: false,
  17144. sortable: false,
  17145. menuDisabled: true,
  17146. xtype: 'checkcolumn',
  17147. },
  17148. {
  17149. text: '禁菜',
  17150. dataIndex: 'menuDisabled',
  17151. width: 50,
  17152. resizable: false,
  17153. sortable: false,
  17154. menuDisabled: true,
  17155. xtype: 'checkcolumn',
  17156. },
  17157. {
  17158. text: '过滤',
  17159. dataIndex: 'filterable',
  17160. xtype: 'checkcolumn',
  17161. width: 50,
  17162. resizable: false,
  17163. sortable: false,
  17164. menuDisabled: true,
  17165. },
  17166. {
  17167. text: '隐藏',
  17168. dataIndex: 'hidden',
  17169. xtype: 'checkcolumn',
  17170. width: 50,
  17171. resizable: false,
  17172. sortable: false,
  17173. menuDisabled: true,
  17174. },
  17175. {
  17176. text: '可隐',
  17177. dataIndex: 'hideable',
  17178. xtype: 'checkcolumn',
  17179. width: 50,
  17180. resizable: false,
  17181. sortable: false,
  17182. menuDisabled: true,
  17183. },
  17184. {
  17185. text: '调宽',
  17186. dataIndex: 'resizable',
  17187. xtype: 'checkcolumn',
  17188. width: 50,
  17189. resizable: false,
  17190. sortable: false,
  17191. menuDisabled: true,
  17192. },
  17193. {
  17194. text: '排序',
  17195. dataIndex: 'sortable',
  17196. xtype: 'checkcolumn',
  17197. width: 50,
  17198. resizable: false,
  17199. sortable: false,
  17200. menuDisabled: true,
  17201. },
  17202. {
  17203. text: '适宽',
  17204. dataIndex: 'autoSize',
  17205. xtype: 'checkcolumn',
  17206. width: 50,
  17207. resizable: false,
  17208. sortable: false,
  17209. menuDisabled: true,
  17210. },
  17211. ],
  17212. },
  17213. {
  17214. title: '数据源',
  17215. layout: 'border',
  17216. listeners: {
  17217. activate: 'scope.dataSourceActivate'
  17218. },
  17219. items: [
  17220. {
  17221. region: 'north',
  17222. xtype: 'toolbar',
  17223. border: false,
  17224. items: [
  17225. {
  17226. xtype: 'textfield',
  17227. fieldLabel: '数据源',
  17228. flex: 1,
  17229. bind: {
  17230. value: '{vjson.dataSource.url}'
  17231. }
  17232. },
  17233. {
  17234. xtype: 'button',
  17235. text: '保存',
  17236. iconCls: 'x-fa fa-save',
  17237. listeners: {
  17238. click: 'scope.dataSourceSave'
  17239. }
  17240. },
  17241. {
  17242. xtype: 'button',
  17243. text: '读取',
  17244. iconCls: 'x-fa fa-folder-open',
  17245. listeners: {
  17246. click: 'scope.reloadSqlContent'
  17247. }
  17248. },
  17249. ]
  17250. },
  17251. {
  17252. region: 'center',
  17253. xtype: 'sqleditor',
  17254. layout: 'fit',
  17255. reference: 'sqlEditor',
  17256. },
  17257. {
  17258. region: 'south',
  17259. xtype: 'jsoneditor',
  17260. height: 200,
  17261. split: true,
  17262. collapsible: true,
  17263. title: '参数',
  17264. reference: 'sqlParams',
  17265. }
  17266. ]
  17267. },
  17268. {
  17269. title: '事件',
  17270. xtype: 'form',
  17271. scrollable: true,
  17272. margin: '10',
  17273. defaults: {
  17274. width: '100%',
  17275. labelAlign: 'top',
  17276. },
  17277. items: [
  17278. {
  17279. xtype: 'textfield',
  17280. fieldLabel: '选中前触发 beforeSelect',
  17281. bind: {
  17282. value: '{vjson.listeners.beforeselect}'
  17283. },
  17284. },
  17285. {
  17286. xtype: 'textfield',
  17287. fieldLabel: '选择范围改变 selectionChange',
  17288. bind: {
  17289. value: '{vjson.listeners.selectionchange}'
  17290. },
  17291. },
  17292. {
  17293. xtype: 'textfield',
  17294. fieldLabel: '行点击 itemClick',
  17295. bind: {
  17296. value: '{vjson.listeners.itemclick}'
  17297. },
  17298. },
  17299. {
  17300. xtype: 'textfield',
  17301. fieldLabel: '行双击 itemDblClick',
  17302. bind: {
  17303. value: '{vjson.listeners.itemdblclick}'
  17304. },
  17305. },
  17306. {
  17307. xtype: 'textfield',
  17308. fieldLabel: '单元格点击 cellClick',
  17309. bind: {
  17310. value: '{vjson.listeners.cellClick}'
  17311. },
  17312. },
  17313. {
  17314. xtype: 'textfield',
  17315. fieldLabel: '单元格双击 cellDblClick',
  17316. bind: {
  17317. value: '{vjson.listeners.celldblclick}'
  17318. },
  17319. },
  17320. {
  17321. xtype: 'textfield',
  17322. fieldLabel: '渲染后触发 afterrender',
  17323. bind: {
  17324. value: '{vjson.listeners.afterrender}'
  17325. },
  17326. },
  17327. {
  17328. xtype: 'textfield',
  17329. fieldLabel: '销毁后触发 destory',
  17330. bind: {
  17331. value: '{vjson.listeners.destory}'
  17332. },
  17333. },
  17334. ]
  17335. },
  17336. ],
  17337. }
  17338. ],
  17339. fbar: [
  17340. {
  17341. text: '应用', iconCls: 'x-fa fa-save',
  17342. listeners: {
  17343. click: 'scope.save'
  17344. }
  17345. },
  17346. '-',
  17347. {
  17348. text: '确定', iconCls: 'x-fa fa-check-circle',
  17349. listeners: {
  17350. click: 'scope.saveClose'
  17351. }
  17352. },
  17353. {
  17354. text: '取消', iconCls: 'x-fa fa-times-circle',
  17355. listeners: {
  17356. click: 'system.closeMe()'
  17357. }
  17358. },
  17359. ]
  17360. };
  17361. var VjsonExchange = /** @class */ (function () {
  17362. function VjsonExchange(vjson) {
  17363. this.pendingSet = true;
  17364. this.vjsonOrigin = _$2.cloneDeep(vjson);
  17365. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  17366. }
  17367. /**
  17368. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  17369. * @param propName
  17370. * @param value
  17371. */
  17372. VjsonExchange.prototype.setPropValue = function (propName, value) {
  17373. if (this.pendingSet) {
  17374. return;
  17375. }
  17376. // selectMode
  17377. // pageSizeOption
  17378. // cellediting_clicksToEdit
  17379. msg$1('' + propName + '=' + value);
  17380. _$2.set(this.vjson, propName, value);
  17381. };
  17382. /**
  17383. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  17384. */
  17385. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  17386. var _a, _b, _c;
  17387. if (this.pendingSet) {
  17388. return;
  17389. }
  17390. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  17391. // 如果不使用默认属性,就直接设定 undefined
  17392. var vs = {
  17393. dataIndex: undefined,
  17394. header: undefined,
  17395. xtype: '',
  17396. width: undefined,
  17397. flex: undefined,
  17398. align: 'start',
  17399. editor: undefined,
  17400. dataType: 'string',
  17401. dict: undefined,
  17402. disabled: false,
  17403. menuDisabled: false,
  17404. notAllowBlank: false,
  17405. filterable: true,
  17406. hidden: false,
  17407. hideable: true,
  17408. resizable: true,
  17409. sortable: true,
  17410. autoSize: true,
  17411. };
  17412. var raw = record.get('raw');
  17413. if (raw === undefined || raw == null) {
  17414. raw = {};
  17415. record.set('raw', raw);
  17416. }
  17417. var setRaw = function (propName, value) {
  17418. if (typeof value === 'undefined' || value == null) {
  17419. msg$1("delete columns[" + rowIdx + "]." + propName);
  17420. delete raw[propName];
  17421. return;
  17422. }
  17423. var defaultValue = vs[propName];
  17424. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  17425. // 要设的值,与默认值相同,就直接删除这个属性
  17426. msg$1("delete columns[" + rowIdx + "]." + propName);
  17427. delete raw[propName];
  17428. return;
  17429. }
  17430. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  17431. _$2.set(raw, propName, value);
  17432. };
  17433. if (!vs.hasOwnProperty(propName)) {
  17434. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  17435. return;
  17436. }
  17437. else if (propName === 'dict') {
  17438. if (value) {
  17439. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  17440. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  17441. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  17442. }
  17443. }
  17444. else {
  17445. setRaw('fix', undefined);
  17446. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  17447. msg$1("delete columns[" + rowIdx + "].editor.fix");
  17448. delete raw.editor.fix;
  17449. }
  17450. }
  17451. }
  17452. else if (propName === 'xtype') {
  17453. if (!value) {
  17454. setRaw('xtype', undefined);
  17455. }
  17456. else {
  17457. setRaw('xtype', value);
  17458. }
  17459. }
  17460. else if (propName === 'notAllowBlank') {
  17461. setRaw('editor.allowBlank', !value);
  17462. }
  17463. else if (propName === 'editor') {
  17464. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  17465. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  17466. value = undefined;
  17467. }
  17468. // editor.xtype
  17469. if (!value) {
  17470. // 不需要编辑器
  17471. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  17472. msg$1("delete columns[" + rowIdx + "].editor");
  17473. delete raw.editor;
  17474. record.set('notAllowBlank', false);
  17475. }
  17476. }
  17477. else {
  17478. setRaw('editor.xtype', value);
  17479. var dict = record.get('dict');
  17480. if (value === 'combo' && dict) {
  17481. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  17482. }
  17483. }
  17484. }
  17485. else if (propName === 'width') {
  17486. var width = value;
  17487. var flex = record.get('flex');
  17488. if (!width && !flex) {
  17489. setRaw('width', undefined);
  17490. setRaw('flex', undefined);
  17491. record.set('flex', undefined);
  17492. record.set('width', undefined);
  17493. return;
  17494. }
  17495. else if (!!width) {
  17496. setRaw('flex', undefined);
  17497. record.set('flex', undefined);
  17498. setRaw('width', width);
  17499. return;
  17500. }
  17501. }
  17502. else if (propName === 'flex') {
  17503. var width = record.get('width');
  17504. var flex = value;
  17505. if (!width && !flex) {
  17506. setRaw('width', undefined);
  17507. setRaw('flex', undefined);
  17508. record.set('flex', undefined);
  17509. record.set('width', undefined);
  17510. return;
  17511. }
  17512. else if (!!flex) {
  17513. setRaw('width', undefined);
  17514. record.set('width', undefined);
  17515. setRaw('flex', flex);
  17516. return;
  17517. }
  17518. }
  17519. else {
  17520. // 其他属性,作为同名属性,与 raw 同步
  17521. setRaw(propName, value);
  17522. }
  17523. };
  17524. /**
  17525. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  17526. */
  17527. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  17528. var _this = this;
  17529. var vs = [
  17530. 'reference', 'pagination', 'pageSize',
  17531. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  17532. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  17533. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  17534. 'listeners.beforeselect',
  17535. 'listeners.selectionchange',
  17536. 'listeners.itemclick',
  17537. 'listeners.itemdblclick',
  17538. 'listeners.cellClick',
  17539. 'listeners.celldblclick',
  17540. 'listeners.afterrender',
  17541. 'listeners.destory',
  17542. ];
  17543. _$2.forEach(vs, function (v) {
  17544. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  17545. });
  17546. };
  17547. VjsonExchange.prototype.bindChangeProp = function (propName) {
  17548. var me = this;
  17549. return function (value) {
  17550. me.setPropValue(propName, value);
  17551. };
  17552. };
  17553. VjsonExchange.prototype.parseModel = function () {
  17554. var _this = this;
  17555. 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;
  17556. //@ts-ignore
  17557. var df = YvanUI.Defaults.grid;
  17558. var vjson = _$2.assign({}, df, this.vjson);
  17559. var model = {
  17560. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  17561. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  17562. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  17563. pageSizeOption: '["20", "50", "100", "200", "300"]',
  17564. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  17565. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  17566. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  17567. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  17568. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  17569. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  17570. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  17571. selectMode: 'spreadsheet',
  17572. cellediting_clicksToEdit: true,
  17573. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  17574. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  17575. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  17576. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  17577. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  17578. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  17579. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  17580. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  17581. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  17582. gridfilters: true,
  17583. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  17584. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  17585. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  17586. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  17587. columns: [],
  17588. listeners: {
  17589. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  17590. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  17591. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  17592. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  17593. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  17594. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  17595. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  17596. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  17597. }
  17598. };
  17599. if (_$2.isArray(this.vjson.pageSizeOption)) {
  17600. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  17601. }
  17602. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  17603. if (_$2.get(vjson, 'disableSelection') == true) {
  17604. model.selectMode = 'disableSelection';
  17605. }
  17606. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  17607. model.selectMode = 'spreadsheet';
  17608. }
  17609. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  17610. model.selectMode = 'onlyCheckColumn';
  17611. }
  17612. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  17613. model.selectMode = 'checkColumn';
  17614. }
  17615. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  17616. model.selectMode = 'row_mulity';
  17617. }
  17618. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  17619. model.selectMode = 'row_single';
  17620. }
  17621. else {
  17622. model.selectMode = 'row_single';
  17623. }
  17624. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  17625. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  17626. model.dataSource = {
  17627. url: _$2.get(vjson, 'dataSource.url'),
  17628. //@ts-ignore
  17629. params: _$2.get(vjson, 'dataSource.params')
  17630. };
  17631. }
  17632. _$2.forEach(vjson.columns, function (column) {
  17633. model.columns.push(_this.parseColumn(column));
  17634. });
  17635. return model;
  17636. };
  17637. VjsonExchange.prototype.parseColumn = function (column) {
  17638. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  17639. var model = {
  17640. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  17641. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  17642. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  17643. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  17644. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  17645. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  17646. editor: '',
  17647. editParam: '',
  17648. dict: '',
  17649. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  17650. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  17651. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  17652. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  17653. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  17654. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  17655. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  17656. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  17657. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  17658. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  17659. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  17660. raw: _$2.cloneDeep(column),
  17661. };
  17662. // width / flex 只能留一个属性, 或者全不留
  17663. if (model.width <= 0 && model.flex <= 0) {
  17664. delete model.width;
  17665. delete model.flex;
  17666. }
  17667. else if (model.width > 0) {
  17668. delete model.flex;
  17669. }
  17670. else {
  17671. delete model.width;
  17672. }
  17673. // editor
  17674. if (_$2.isObject(_$2.get(column, 'editor'))) {
  17675. model.editor = _$2.get(column, 'editor.xtype');
  17676. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  17677. if (!model.editor) {
  17678. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  17679. model.editor = 'textfield';
  17680. }
  17681. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  17682. msg$1('不可识别的 editor.xtype=' + model.editor);
  17683. console.error('不可识别的 editor.xtype', column);
  17684. }
  17685. if (_$2.get(column, 'editor.allowBlank') === false) {
  17686. model.notAllowBlank = true;
  17687. }
  17688. }
  17689. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  17690. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  17691. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  17692. if (match && match[1]) {
  17693. model.dict = match[1];
  17694. }
  17695. }
  17696. return model;
  17697. };
  17698. return VjsonExchange;
  17699. }());
  17700. //
  17701. var YvgridDesign = /** @class */ (function (_super) {
  17702. __extends(YvgridDesign, _super);
  17703. function YvgridDesign(moduleId) {
  17704. var _this = _super.call(this, { model: model$j, vjson: vjson$j }) || this;
  17705. _this.moduleId = '';
  17706. _this.name = 'YvgridDesign';
  17707. _this.dataSourceIsActived = false;
  17708. _this.setModuleId(moduleId);
  17709. return _this;
  17710. }
  17711. YvgridDesign.prototype.setModuleId = function (moduleId) {
  17712. var _this = this;
  17713. this.moduleId = moduleId;
  17714. if (this.componentSelectionChangeSubscribe) {
  17715. this.componentSelectionChangeSubscribe.cancel();
  17716. this.componentSelectionChangeSubscribe = null;
  17717. }
  17718. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  17719. var id = _a.id, from = _a.from;
  17720. _this.onComponentSelectionChange(id, from);
  17721. });
  17722. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  17723. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  17724. if (vj.xtype !== 'yvgrid') {
  17725. throw Error('非 yvgrid 组件');
  17726. }
  17727. this.vjsonExchange = new VjsonExchange(vj);
  17728. };
  17729. YvgridDesign.prototype.onLoad = function () {
  17730. var _this = this;
  17731. var model = this.vjsonExchange.parseModel();
  17732. this.vjsonExchange.pendingSet = true;
  17733. mergeViewModel(this.viewModel, "vjson", model, false);
  17734. this.refs.grid1.setData(model.columns);
  17735. this.vjsonExchange.attachViewModel(this.viewModel);
  17736. _$2.defer(function () {
  17737. _this.vjsonExchange.pendingSet = false;
  17738. });
  17739. };
  17740. YvgridDesign.prototype.moveUp = function (sender) {
  17741. var grid = sender.up('grid');
  17742. grid.rowMoveUp();
  17743. };
  17744. YvgridDesign.prototype.moveDown = function (sender) {
  17745. var grid = sender.up('grid');
  17746. grid.rowMoveDown();
  17747. };
  17748. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  17749. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  17750. };
  17751. YvgridDesign.prototype.reloadSqlContent = function () {
  17752. var _this = this;
  17753. var url = this.viewModel.get('vjson.dataSource.url');
  17754. if (url) {
  17755. loadSqlContentApi(url).then(function (res) {
  17756. _this.refs.sqlEditor.setCode('');
  17757. if (res.success) {
  17758. _this.refs.sqlEditor.setCode(res.data.content);
  17759. }
  17760. }).catch(function () {
  17761. _this.refs.sqlEditor.setCode('');
  17762. });
  17763. }
  17764. };
  17765. YvgridDesign.prototype.dataSourceSave = function () {
  17766. var url = this.viewModel.get('vjson.dataSource.url');
  17767. if (!url) {
  17768. msg$1('必须填写 groovy/SQL 模块路径');
  17769. return;
  17770. }
  17771. var content = this.refs.sqlEditor.getCode();
  17772. saveSqlContentApi(url, content).then(function (res) {
  17773. if (res.success) {
  17774. msg$1('保存成功');
  17775. }
  17776. else {
  17777. msg$1(res.msg);
  17778. }
  17779. });
  17780. };
  17781. YvgridDesign.prototype.dataSourceActivate = function () {
  17782. if (!this.dataSourceIsActived) {
  17783. // 激活
  17784. this.reloadSqlContent();
  17785. var params = this.viewModel.get('vjson.dataSource.params');
  17786. if (_$2.isObject(params)) {
  17787. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  17788. }
  17789. this.dataSourceIsActived = true;
  17790. }
  17791. };
  17792. // 外部控件选择发生改变
  17793. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  17794. if (!id || from === this.name) {
  17795. return;
  17796. }
  17797. this.setVjson(id);
  17798. };
  17799. YvgridDesign.prototype.setVjson = function (id) {
  17800. // 找到对应的组件 判断是不是表格
  17801. };
  17802. YvgridDesign.prototype.save = function () {
  17803. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  17804. if (this.dataSourceIsActived) {
  17805. var url = this.viewModel.get('vjson.dataSource.url');
  17806. // 解析 params
  17807. var paramsString = this.refs.sqlParams.getCode('');
  17808. var params = undefined;
  17809. if (paramsString) {
  17810. try {
  17811. params = window['YvanUI'].json5.parse(paramsString);
  17812. }
  17813. catch (e) {
  17814. msg$1('dataSource.params 格式非法,请检查');
  17815. return;
  17816. }
  17817. }
  17818. if (typeof params === 'undefined') {
  17819. params = this.viewModel.get('vjson.dataSource.params');
  17820. }
  17821. if (url) {
  17822. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  17823. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  17824. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  17825. }
  17826. else {
  17827. delete this.vjsonExchange.vjson['dataSource'];
  17828. }
  17829. }
  17830. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  17831. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  17832. from: this.name,
  17833. ignoreRenderUI: false
  17834. });
  17835. };
  17836. YvgridDesign.prototype.saveClose = function () {
  17837. this.save();
  17838. this.close();
  17839. };
  17840. YvgridDesign.prototype.addColumn = function () {
  17841. this.refs.grid1.appendEditRow({
  17842. dataIndex: '',
  17843. header: '',
  17844. xtype: '',
  17845. width: 80,
  17846. align: '',
  17847. editor: '',
  17848. editParam: '',
  17849. dict: '',
  17850. disabled: false,
  17851. notAllowBlank: false,
  17852. menuDisabled: false,
  17853. filterable: false,
  17854. hidden: false,
  17855. hideable: true,
  17856. resizable: true,
  17857. sortable: true,
  17858. locked: false,
  17859. lockable: false,
  17860. autoSize: true,
  17861. raw: undefined,
  17862. }, 'header');
  17863. };
  17864. YvgridDesign.prototype.removeColumn = function () {
  17865. var _this = this;
  17866. var rows = [];
  17867. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  17868. rows.push(r);
  17869. });
  17870. _$2.forEach(rows, function (r) {
  17871. _this.refs.grid1.getStore().remove(r);
  17872. });
  17873. };
  17874. YvgridDesign.prototype.calcColumn = function () {
  17875. msg$1('暂未实现');
  17876. };
  17877. YvgridDesign.prototype.onDestroy = function () {
  17878. if (this.componentSelectionChangeSubscribe) {
  17879. this.componentSelectionChangeSubscribe.cancel();
  17880. this.componentSelectionChangeSubscribe = null;
  17881. }
  17882. };
  17883. return YvgridDesign;
  17884. }(Scope));
  17885. var YvanUI$1 = window['YvanUI'];
  17886. var _$1 = window["_"];
  17887. var Ext$1 = window['Ext'];
  17888. var $$1 = window["$"];
  17889. var historySize = 100;
  17890. var ViewDesign = /** @class */ (function () {
  17891. function ViewDesign(moduleId, reference) {
  17892. var _this = this;
  17893. this.name = "ViewDesign";
  17894. this.expandedVjsonObjArray = [];
  17895. // 编辑历史
  17896. this.undoVjsonList = [];
  17897. // 撤销历史
  17898. this.redoVjsonList = [];
  17899. // 订阅事件列表
  17900. this.subscribeList = [];
  17901. // private getOuterCopyValueTimer: any = null
  17902. /**
  17903. * 唯一编号
  17904. */
  17905. this.id = _$1.uniqueId("_dv");
  17906. this.moduleId = moduleId;
  17907. this.moduleObject = moduleStore.getModuleObject(moduleId);
  17908. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  17909. this.designReference = reference;
  17910. this.designElement = reference.ariaEl.dom;
  17911. this.$overlay.appendTo(this.designElement);
  17912. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  17913. // 添加到撤销
  17914. this.lastVjson = _$1.cloneDeep(this.vjson);
  17915. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  17916. event.stopPropagation();
  17917. event.preventDefault();
  17918. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  17919. });
  17920. this.$overlay.on('click', '.studio_mask', function (event) {
  17921. event.stopPropagation();
  17922. event.preventDefault();
  17923. _this.clearSelection();
  17924. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  17925. _$1.defer(function () {
  17926. _this.$overlay.focus();
  17927. });
  17928. });
  17929. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  17930. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  17931. this.$overlay.on('copy', this.onCopy.bind(this));
  17932. this.$overlay.on('paste', this.onPaste.bind(this));
  17933. this.$overlay.on('focus', this.onfocus.bind(this));
  17934. // this.$overlay.on('mouseenter', ()=>{
  17935. // clearTimeout(this.getOuterCopyValueTimer);
  17936. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  17937. // })
  17938. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  17939. _this.onMousemove(event);
  17940. }, 300, { maxWait: 500 }).bind(this));
  17941. window.addEventListener('message', this.onMessageEvent.bind(this));
  17942. this.subscribe();
  17943. setDesignInstance(this);
  17944. }
  17945. // todo ======== 方法 ==========
  17946. ViewDesign.prototype.subscribe = function () {
  17947. var _this = this;
  17948. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  17949. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  17950. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  17951. _this.setVjson(vjson, from, ignoreRenderUI);
  17952. }));
  17953. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  17954. var id = _a.id, from = _a.from;
  17955. _this.onComponentSelectionChange(id, from);
  17956. }));
  17957. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  17958. var id = _a.id, from = _a.from;
  17959. _this.onComponentDelete(id, from);
  17960. }));
  17961. };
  17962. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  17963. if (vjson === void 0) { vjson = this.vjson; }
  17964. if (from === void 0) { from = this.name; }
  17965. this.vjson = vjson;
  17966. if (from !== "undo" && from !== "redo") {
  17967. if (this.undoVjsonList.length >= 100) {
  17968. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  17969. }
  17970. this.undoVjsonList.push(this.lastVjson);
  17971. }
  17972. this.lastVjson = _$1.cloneDeep(vjson);
  17973. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  17974. };
  17975. /**
  17976. * 覆盖层点击事件
  17977. */
  17978. ViewDesign.prototype.overlayClickFunction = function (event) {
  17979. if (!event.altKey && !event.shiftKey) {
  17980. var target = this.findElByXY(event.clientX, event.clientY);
  17981. if (target) {
  17982. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  17983. var extHandle = Ext$1.get(target).component;
  17984. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  17985. rect.x = position.x;
  17986. rect.y = position.y;
  17987. this.clearSelection();
  17988. this.appendMaskbox(rect, extHandle.id);
  17989. }
  17990. }
  17991. };
  17992. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  17993. if (dragType === void 0) { dragType = ""; }
  17994. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  17995. var ele = document.elementsFromPoint(x, y);
  17996. if (ele.length <= 1) {
  17997. return;
  17998. }
  17999. var target = null;
  18000. for (var i = 0; i < ele.length; i++) {
  18001. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  18002. 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) {
  18003. switch (dragType) {
  18004. case "cols-container":
  18005. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  18006. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  18007. target = ele[i];
  18008. }
  18009. break;
  18010. case "col-item":
  18011. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  18012. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  18013. target = ele[i];
  18014. }
  18015. break;
  18016. case "rows-container":
  18017. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  18018. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  18019. target = ele[i];
  18020. }
  18021. break;
  18022. case "row-item":
  18023. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  18024. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  18025. target = ele[i];
  18026. }
  18027. break;
  18028. default:
  18029. target = ele[i];
  18030. break;
  18031. }
  18032. if (target) {
  18033. break;
  18034. }
  18035. }
  18036. }
  18037. return target;
  18038. };
  18039. /**
  18040. * 清空选择项
  18041. */
  18042. ViewDesign.prototype.clearSelection = function () {
  18043. // $(this.designElement).removeClass('selected');
  18044. // // $(this.designElement).find('.selected').removeClass('selected')
  18045. // $(this.designElement).find('.ds_mask')
  18046. // .not('.mask_not_hide')
  18047. // .remove();
  18048. $$1('.studio_mask').remove();
  18049. // $(this.designElement).find('.selected').each(function () {
  18050. // $(this).removeClass('selected');
  18051. // // const extHandle = Ext.get(this).component
  18052. // // if (extHandle) {
  18053. // // extHandle.removeCls('selected')
  18054. // // }
  18055. // })
  18056. };
  18057. /**
  18058. * 添加遮罩层
  18059. */
  18060. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  18061. var that = this;
  18062. if (vjsonId) {
  18063. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  18064. }
  18065. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  18066. // return item === cj.xtype
  18067. // }) >= 0
  18068. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18069. 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>");
  18070. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  18071. this.$mask.css({
  18072. position: 'absolute',
  18073. top: top, left: left, width: width, height: height,
  18074. border: '2px dashed #1890ff',
  18075. zIndex: 100,
  18076. });
  18077. this.$mask.appendTo(this.$overlay);
  18078. this.$mask.on("click", ".ds_del", function (e) {
  18079. e.stopPropagation();
  18080. e.preventDefault();
  18081. that.deleteComponent(vjsonId);
  18082. });
  18083. // 点击选中父级
  18084. this.$mask.on('click', '.ds_parent', function (e) {
  18085. e.stopPropagation();
  18086. e.preventDefault();
  18087. that.selectParent(vjsonId);
  18088. });
  18089. var sel = document.getElementById(vjsonId);
  18090. var sVjosn = findInCode(this.vjson, vjsonId);
  18091. // 限制可以拖动的组件
  18092. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  18093. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  18094. this.dragSource = new Ext$1.drag.Source({
  18095. element: this.$mask[0],
  18096. constrain: this.$overlay[0],
  18097. listeners: {
  18098. dragmove: this.dragmove.bind(that, this.vjson),
  18099. dragend: this.dragend.bind(that, this.vjson)
  18100. },
  18101. startRect: rect,
  18102. sourceVjson: findInCode(this.vjson, vjsonId),
  18103. sourceVjsonId: vjsonId,
  18104. dragType: dragType
  18105. });
  18106. }
  18107. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  18108. };
  18109. /**
  18110. * 选中某个选项
  18111. */
  18112. ViewDesign.prototype.setSelection = function (id) {
  18113. var _a, _b;
  18114. if (!this.designElement) {
  18115. return;
  18116. }
  18117. // 清空选中内容
  18118. this.clearSelection();
  18119. if (!id) {
  18120. return;
  18121. }
  18122. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  18123. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18124. rect.x = position.x;
  18125. rect.y = position.y;
  18126. this.appendMaskbox(rect, id);
  18127. };
  18128. /**
  18129. * 删除组件
  18130. * @param id
  18131. */
  18132. ViewDesign.prototype.deleteComponent = function (id) {
  18133. deletVjsonById(this.vjson, id);
  18134. this.moduleObject.modulePage.currentComponentSelectId = null;
  18135. this.setVjson();
  18136. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  18137. this.clearSelection();
  18138. };
  18139. ViewDesign.prototype.selectParent = function (id) {
  18140. var pid = getSuperVjsonId(this.vjson, id);
  18141. this.moduleObject.modulePage.currentComponentSelectId = pid;
  18142. this.setSelection(pid);
  18143. };
  18144. // todo ====== 拖拽事件 ======
  18145. ViewDesign.prototype.dragmove = function (node, source, info) {
  18146. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  18147. if (!target) {
  18148. return;
  18149. }
  18150. var rect = target.getBoundingClientRect();
  18151. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  18152. var extHandle = Ext$1.get(target).component;
  18153. if (!extHandle) {
  18154. return;
  18155. }
  18156. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  18157. rect.x = position.x;
  18158. rect.y = position.y;
  18159. this.appendDirection(rect, extHandle.id, direction);
  18160. };
  18161. ViewDesign.prototype.dragend = function (node, source, info) {
  18162. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  18163. if (!target) {
  18164. return;
  18165. }
  18166. var rect = target.getBoundingClientRect();
  18167. var extHandle = Ext$1.get(target).component;
  18168. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  18169. if (!extHandle) {
  18170. return;
  18171. }
  18172. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  18173. this.removeDirection();
  18174. };
  18175. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  18176. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18177. var cv = findInCode(this.vjson, vjsonId);
  18178. if (this.$direction) {
  18179. $$1('#direction' + this.id).remove();
  18180. }
  18181. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  18182. //
  18183. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  18184. if (direction) {
  18185. if (direction === "top") {
  18186. // direction = 'center'
  18187. height = height / 4;
  18188. }
  18189. else if (direction === "bottom") {
  18190. // direction = 'center'
  18191. top = top + height / 4 * 3;
  18192. height = height / 4;
  18193. }
  18194. else if (direction === "left") {
  18195. width = width / 4;
  18196. }
  18197. else if (direction === "right") {
  18198. left = left + width / 4 * 3;
  18199. width = width / 4;
  18200. }
  18201. this.$direction = $$1("<div id='direction" + this.id + "'>");
  18202. this.$direction.css({
  18203. position: 'absolute',
  18204. top: top, left: left, width: width, height: height,
  18205. // border: '2px dashed #1890ff',
  18206. background: 'rgba(40,224,218,0.75)',
  18207. zIndex: 100,
  18208. });
  18209. this.$direction.appendTo(this.$overlay);
  18210. // }
  18211. }
  18212. };
  18213. ViewDesign.prototype.removeDirection = function () {
  18214. if (this.$direction) {
  18215. this.$direction.remove();
  18216. this.$direction = null;
  18217. }
  18218. };
  18219. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  18220. var arrS;
  18221. if (sourceVjId) {
  18222. arrS = findArrayContainer(this.vjson, sourceVjId);
  18223. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  18224. var indexS = _$1.findIndex(arrS, function (v) {
  18225. return v.id === sourceVjId;
  18226. });
  18227. if (indexS < 0) {
  18228. return;
  18229. }
  18230. }
  18231. delete sourceVjson.id;
  18232. var vjsonT = findInCode(this.vjson, targetVjId);
  18233. var arrT = findArrayContainer(this.vjson, targetVjId);
  18234. var indexT = _$1.findIndex(arrT, function (v) {
  18235. return v.id === targetVjId;
  18236. });
  18237. if (indexT < 0) {
  18238. return;
  18239. }
  18240. switch (direction) {
  18241. case 'top':
  18242. case 'left':
  18243. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18244. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18245. vjsonT.items.splice(0, 0, sourceVjson);
  18246. }
  18247. else {
  18248. arrT.splice(indexT, 0, sourceVjson);
  18249. }
  18250. break;
  18251. case 'bottom':
  18252. case 'right':
  18253. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18254. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18255. vjsonT.items.push(sourceVjson);
  18256. }
  18257. else {
  18258. arrT.splice(indexT + 1, 0, sourceVjson);
  18259. }
  18260. break;
  18261. case 'center':
  18262. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  18263. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  18264. vjsonT.items.push(sourceVjson);
  18265. }
  18266. else {
  18267. arrT.splice(indexT, 1, sourceVjson);
  18268. }
  18269. break;
  18270. }
  18271. if (sourceVjId) {
  18272. deletVjsonById(this.vjson, sourceVjId);
  18273. sourceVjson.id = sourceVjId;
  18274. }
  18275. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  18276. };
  18277. // todo ======== 事件 ==========
  18278. // 接收 postMessage 事件分发
  18279. ViewDesign.prototype.onMessageEvent = function (event) {
  18280. var _a, _b;
  18281. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  18282. if (fucName && typeof this[fucName] === 'function') {
  18283. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  18284. }
  18285. };
  18286. // 接收外部选中组件事件
  18287. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  18288. if (from !== this.name) {
  18289. this.setSelection(id);
  18290. }
  18291. };
  18292. // 接收外部组件删除事件
  18293. ViewDesign.prototype.onComponentDelete = function (id, from) {
  18294. if (from !== this.name) {
  18295. this.deleteComponent(id);
  18296. }
  18297. };
  18298. // 组件被选中
  18299. ViewDesign.prototype.onComponentSelect = function (args) {
  18300. if (args[2] != this.moduleId) {
  18301. return;
  18302. }
  18303. if (args[0]) {
  18304. var rect = args[0];
  18305. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  18306. rect.x = position.x;
  18307. rect.y = position.y;
  18308. this.clearSelection();
  18309. this.appendMaskbox(rect, args[1]);
  18310. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  18311. }
  18312. };
  18313. ViewDesign.prototype.onComponentInfo = function (_a) {
  18314. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  18315. if (moduleId != this.moduleId) {
  18316. return;
  18317. }
  18318. if (rect) {
  18319. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  18320. rect.x = position.x;
  18321. rect.y = position.y;
  18322. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  18323. var cv_1 = findInCode(this.vjson, vjsonId);
  18324. if (this.$direction) {
  18325. $$1('#direction' + this.id).remove();
  18326. }
  18327. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  18328. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  18329. if (direction) {
  18330. if (direction === "top") {
  18331. direction = 'center';
  18332. //height = height/3
  18333. }
  18334. else if (direction === "bottom") {
  18335. direction = 'center';
  18336. // top=top+height/3*2
  18337. // height = height/3
  18338. }
  18339. else if (direction === "left") {
  18340. width = width / 3;
  18341. }
  18342. else if (direction === "right") {
  18343. left = left + width / 3 * 2;
  18344. width = width / 3;
  18345. }
  18346. this.$direction = $$1("<div id='direction" + this.id + "'>");
  18347. this.$direction.css({
  18348. position: 'absolute',
  18349. top: top, left: left, width: width, height: height,
  18350. // border: '2px dashed #1890ff',
  18351. background: 'rgba(74,106,201,0.42)',
  18352. zIndex: 100,
  18353. });
  18354. this.$direction.appendTo(this.$overlay);
  18355. }
  18356. }
  18357. console.log("direction", direction);
  18358. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  18359. // rect.x = position.x
  18360. // rect.y = position.y
  18361. // this.clearSelection()
  18362. // this.appendMaskbox(rect, args[1])
  18363. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  18364. }
  18365. };
  18366. ViewDesign.prototype.onUndo = function () {
  18367. if (this.undoVjsonList.length > 0) {
  18368. if (this.redoVjsonList.length >= 100) {
  18369. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  18370. }
  18371. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  18372. this.vjson = this.undoVjsonList.pop();
  18373. // this.setVjson(this.vjson, "", false, "undo")
  18374. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  18375. }
  18376. };
  18377. ViewDesign.prototype.onRedo = function () {
  18378. if (this.redoVjsonList.length > 0) {
  18379. if (this.undoVjsonList.length >= 100) {
  18380. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  18381. }
  18382. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  18383. this.vjson = this.redoVjsonList.pop();
  18384. // this.setVjson(this.vjson, "", false, "redo")
  18385. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  18386. }
  18387. };
  18388. ViewDesign.prototype.onKeyPress = function (event) {
  18389. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  18390. // if (this.backStep()) {
  18391. // event.stopPropagation()
  18392. // event.preventDefault()
  18393. // return
  18394. // }
  18395. // }
  18396. //
  18397. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  18398. // if (this.recoverStep()) {
  18399. // event.stopPropagation()
  18400. // event.preventDefault()
  18401. // return
  18402. // }
  18403. // }
  18404. // if (event.key === 'ArrowUp') {
  18405. // if (this.selectParent()) {
  18406. // event.stopPropagation()
  18407. // event.preventDefault()
  18408. // return;
  18409. // }
  18410. // }
  18411. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  18412. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  18413. event.stopPropagation();
  18414. event.preventDefault();
  18415. return;
  18416. }
  18417. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  18418. // if (this.copyView()) {
  18419. // event.stopPropagation()
  18420. // event.preventDefault()
  18421. // return;
  18422. // }
  18423. // }
  18424. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  18425. // if (this.copyView(true)) {
  18426. // event.stopPropagation()
  18427. // event.preventDefault()
  18428. // return;
  18429. // }
  18430. // }
  18431. //
  18432. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  18433. // if (this.selectRoot()) {
  18434. // event.stopPropagation()
  18435. // event.preventDefault()
  18436. // return;
  18437. // }
  18438. //
  18439. };
  18440. ViewDesign.prototype.onCopy = function (event) {
  18441. if (this.moduleObject.modulePage.currentComponentSelectId) {
  18442. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  18443. if (copyVjson) {
  18444. removeDesignProp(copyVjson);
  18445. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  18446. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  18447. }
  18448. }
  18449. };
  18450. ViewDesign.prototype.onPaste = function (event) {
  18451. debugger;
  18452. };
  18453. ViewDesign.prototype.onfocus = function () {
  18454. console.log("getCopy");
  18455. console.log("document.activeElement", document.activeElement.id);
  18456. // clearTimeout(this.getOuterCopyValueTimer);
  18457. // native.clipboardRead()
  18458. };
  18459. ViewDesign.prototype.onMousemove = function (event) {
  18460. var _a;
  18461. if (document.activeElement.id === this.$overlay[0].id) {
  18462. // console.log(event.clientX, event.clientY)
  18463. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  18464. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  18465. // this.iframeWindow.postMessage({
  18466. // method: 'overlayGetInfo',
  18467. // args: [position, this.moduleId]
  18468. // }, '*')
  18469. }
  18470. }
  18471. };
  18472. ViewDesign.prototype.onDestroy = function () {
  18473. window.removeEventListener('message', this.onMessageEvent.bind(this));
  18474. for (var i = 0; i < this.subscribeList.length; i++) {
  18475. this.subscribeList[i].cancel();
  18476. }
  18477. };
  18478. // todo ======== 工具方法 ==========
  18479. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  18480. if (relative === void 0) { relative = null; }
  18481. if (from === "main" && to === "overlay") {
  18482. var overlayRect = this.$overlay[0].getBoundingClientRect();
  18483. var x = overlayRect.x;
  18484. var y = overlayRect.y;
  18485. if (relative) {
  18486. var relativeRect = relative.getBoundingClientRect();
  18487. console.log("main->", relativeRect.x, relativeRect.y);
  18488. x = x - relativeRect.x;
  18489. y = y - relativeRect.y;
  18490. }
  18491. pos.x = pos.x - x;
  18492. pos.y = pos.y - y;
  18493. }
  18494. else if (from === "overlay" && to === "main") {
  18495. var overlayRect = this.$overlay[0].getBoundingClientRect();
  18496. var x = overlayRect.x;
  18497. var y = overlayRect.y;
  18498. if (relative) {
  18499. var relativeRect = relative.getBoundingClientRect();
  18500. console.log("iframe->", relativeRect.x, relativeRect.y);
  18501. x = x - relativeRect.x;
  18502. y = y - relativeRect.y;
  18503. }
  18504. pos.x = pos.x + x;
  18505. pos.y = pos.y + y;
  18506. }
  18507. return pos;
  18508. };
  18509. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  18510. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  18511. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  18512. return "center";
  18513. }
  18514. // col-item 只能放左右
  18515. if (dragType === "col-item" || dragType === "") {
  18516. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  18517. if (x > rect.x && x < rect.x + rect.width / 3) {
  18518. return "left";
  18519. }
  18520. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  18521. return "right";
  18522. }
  18523. }
  18524. }
  18525. // cols-container 只能放上下
  18526. if (dragType === "cols-container" || dragType === "") {
  18527. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  18528. if (y > rect.y && y < rect.y + rect.height / 3) {
  18529. return "top";
  18530. }
  18531. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  18532. return "bottom";
  18533. }
  18534. }
  18535. }
  18536. return "";
  18537. };
  18538. return ViewDesign;
  18539. }());
  18540. //
  18541. var model$k = {
  18542. data: {
  18543. iframeSrc: ''
  18544. }
  18545. };
  18546. var vjson$k = {
  18547. layout: 'fit',
  18548. border: false,
  18549. iconCls: 'x-fa fa-newspaper-o',
  18550. referenceHolder: true,
  18551. items: [
  18552. {
  18553. layout: 'border',
  18554. border: false,
  18555. items: [
  18556. {
  18557. region: 'center',
  18558. xtype: 'tabpanel',
  18559. border: false,
  18560. tabPosition: 'bottom',
  18561. reference: 'tabPanel',
  18562. listeners: {
  18563. tabchange: 'scope.tabchange'
  18564. },
  18565. defaults: {
  18566. border: false,
  18567. },
  18568. items: [
  18569. {
  18570. title: 'controller.js',
  18571. xtype: 'jseditor',
  18572. reference: 'controllerEditor',
  18573. },
  18574. {
  18575. title: 'view.design',
  18576. xtype: 'designer',
  18577. reference: 'designer',
  18578. listeners: {
  18579. afterrender: 'scope.previewRender'
  18580. },
  18581. },
  18582. {
  18583. title: 'view.js',
  18584. xtype: 'jseditor',
  18585. reference: 'viewEditor',
  18586. },
  18587. {
  18588. title: 'model.js',
  18589. xtype: 'jseditor',
  18590. reference: 'modelEditor',
  18591. },
  18592. {
  18593. title: 'groovy',
  18594. xtype: 'groovyeditor',
  18595. reference: 'groovyEditor',
  18596. },
  18597. {
  18598. title: 'SQL',
  18599. xtype: 'sqleditor',
  18600. reference: 'sqlEditor',
  18601. }
  18602. ]
  18603. }
  18604. ]
  18605. }
  18606. ]
  18607. };
  18608. var ModulePage = /** @class */ (function (_super) {
  18609. __extends(ModulePage, _super);
  18610. function ModulePage(moduleId, module) {
  18611. var _this = _super.call(this, { model: model$k, vjson: vjson$k }) || this;
  18612. _this.name = "ModulePage";
  18613. _this.viewDesign = null;
  18614. _this.maxViewId = 0;
  18615. _this.moduleEventBus = new EventBus();
  18616. _this.codeChange = _$2.debounce(function (code, from, e) {
  18617. try {
  18618. switch (from) {
  18619. case _this.refs.controllerEditor.name:
  18620. moduleStore.updateJsController(_this.moduleId, code, from);
  18621. break;
  18622. case _this.refs.viewEditor.name:
  18623. moduleStore.updateJsView(_this.moduleId, code, from);
  18624. break;
  18625. case _this.refs.modelEditor.name:
  18626. moduleStore.updateJsModel(_this.moduleId, code, from);
  18627. break;
  18628. case _this.refs.groovyEditor.name:
  18629. moduleStore.updateGroovy(_this.moduleId, code, from);
  18630. break;
  18631. case _this.refs.sqlEditor.name:
  18632. moduleStore.updateMybatis(_this.moduleId, code, from);
  18633. break;
  18634. }
  18635. }
  18636. catch (e) {
  18637. }
  18638. }, 500, { maxWait: 10000 });
  18639. _this.moduleId = moduleId;
  18640. _this.module = module;
  18641. _this.cancelSubscribe = [];
  18642. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  18643. _this.initEditor(moduleItem);
  18644. }));
  18645. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  18646. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18647. _this.previewReRender();
  18648. }));
  18649. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  18650. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18651. _this.updateVjson(vjson, from, ignoreRenderUI);
  18652. }));
  18653. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  18654. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  18655. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  18656. }));
  18657. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  18658. var id = _a.id, from = _a.from;
  18659. _this.onComponentSelectionChange(id, from);
  18660. }));
  18661. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  18662. _this.onUndo();
  18663. }));
  18664. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  18665. _this.onRedo();
  18666. }));
  18667. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  18668. _this.currentCopyVjson = stringToJsonObj(value);
  18669. }));
  18670. return _this;
  18671. }
  18672. ModulePage.prototype.onLoad = function () {
  18673. var _this = this;
  18674. // this.refs.preview.src = href
  18675. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  18676. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  18677. _this.saveCall();
  18678. }));
  18679. this.activeEditor = this.refs.controllerEditor;
  18680. this.refs.controllerEditor.modulePage = this;
  18681. this.refs.viewEditor.modulePage = this;
  18682. this.refs.modelEditor.modulePage = this;
  18683. this.refs.groovyEditor.modulePage = this;
  18684. this.refs.sqlEditor.modulePage = this;
  18685. this.refs.controllerEditor.name = "controllerEditor";
  18686. this.refs.viewEditor.name = "viewEditor";
  18687. this.refs.modelEditor.name = "modelEditor";
  18688. this.refs.groovyEditor.name = "groovyEditor";
  18689. this.refs.sqlEditor.name = "sqlEditor";
  18690. this.refs.controllerEditor.codeChange = this.codeChange;
  18691. this.refs.viewEditor.codeChange = this.codeChange;
  18692. this.refs.modelEditor.codeChange = this.codeChange;
  18693. this.refs.groovyEditor.codeChange = this.codeChange;
  18694. this.refs.sqlEditor.codeChange = this.codeChange;
  18695. };
  18696. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  18697. if (!cmpVjson || from === this.name) {
  18698. return;
  18699. }
  18700. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  18701. replaceVjsonById(vj, cmpVjson);
  18702. this.updateVjson(vj, from, ignoreRenderUI);
  18703. };
  18704. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  18705. var _this = this;
  18706. var _a, _b;
  18707. if (!vjson || from === this.name) {
  18708. return;
  18709. }
  18710. this.addViewId(vjson);
  18711. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  18712. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  18713. (_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);
  18714. this.previewReRender();
  18715. _$2.defer(function () {
  18716. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  18717. });
  18718. };
  18719. ModulePage.prototype.previewRender = function (sender) {
  18720. var _this = this;
  18721. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  18722. if (!this.designScope) {
  18723. this.designScope = new Scope({
  18724. vjson: vjson,
  18725. model: {
  18726. data: {}
  18727. }
  18728. });
  18729. }
  18730. else {
  18731. this.designScope.vjson = vjson;
  18732. }
  18733. this.designScope.showDesigner(sender, {
  18734. moduleId: this.moduleId,
  18735. });
  18736. if (this.viewDesign) {
  18737. return;
  18738. }
  18739. _$2.defer(function () {
  18740. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  18741. handles$1.mainWindow.setLoading(false);
  18742. });
  18743. };
  18744. ModulePage.prototype.previewReRender = function () {
  18745. var designer = this.refs.designer;
  18746. this.previewRender(designer);
  18747. };
  18748. ModulePage.prototype.initEditor = function (moduleItem) {
  18749. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  18750. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  18751. return;
  18752. (_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);
  18753. (_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);
  18754. (_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);
  18755. (_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);
  18756. (_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);
  18757. };
  18758. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  18759. this.currentComponentSelectId = id;
  18760. };
  18761. ModulePage.prototype.onUndo = function () {
  18762. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  18763. this.viewDesign.onUndo();
  18764. }
  18765. };
  18766. ModulePage.prototype.onRedo = function () {
  18767. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  18768. this.viewDesign.onRedo();
  18769. }
  18770. };
  18771. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  18772. this.activeEditor = newCard;
  18773. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  18774. };
  18775. ModulePage.prototype.saveCall = function () {
  18776. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  18777. moduleStore.saveFile(this.moduleId, "jsView");
  18778. }
  18779. else if (this.activeEditor === this.refs.controllerEditor) {
  18780. moduleStore.saveFile(this.moduleId, "jsController");
  18781. }
  18782. else if (this.activeEditor === this.refs.modelEditor) {
  18783. moduleStore.saveFile(this.moduleId, "jsModel");
  18784. }
  18785. else if (this.activeEditor === this.refs.groovyEditor) {
  18786. moduleStore.saveFile(this.moduleId, "groovy");
  18787. }
  18788. else if (this.activeEditor === this.refs.sqlEditor) {
  18789. moduleStore.saveFile(this.moduleId, "mybatis");
  18790. }
  18791. };
  18792. ModulePage.prototype.check = function () {
  18793. moduleStore.check(this.moduleId);
  18794. };
  18795. /**
  18796. * 为vjson添加id
  18797. * @param vjson
  18798. * @param isAll
  18799. */
  18800. ModulePage.prototype.addViewId = function (vjson, isAll) {
  18801. var _this = this;
  18802. if (isAll === void 0) { isAll = false; }
  18803. var maxIdTag = 0;
  18804. // 先提取当前的最大id
  18805. deepTravVJson(vjson, function (obj) {
  18806. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  18807. return;
  18808. }
  18809. if (obj.id && obj.id.indexOf(idPrefix)) {
  18810. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  18811. if (sutr.length > 0) {
  18812. var tid = sutr.replace(idPrefix, "");
  18813. var idNum = parseInt(tid);
  18814. if (idNum && maxIdTag < idNum) {
  18815. maxIdTag = idNum;
  18816. }
  18817. }
  18818. }
  18819. });
  18820. // 标记最大的id号,避免重复
  18821. this.maxViewId = maxIdTag;
  18822. deepTravVJson(vjson, function (obj) {
  18823. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  18824. return;
  18825. }
  18826. if (!obj.hasOwnProperty('id')) {
  18827. obj.id = _this.createViewId();
  18828. }
  18829. if (!obj.hasOwnProperty('designMode')) {
  18830. obj.designMode = true;
  18831. }
  18832. // if (obj.xtype == "tabview" && obj.activeTab) {
  18833. // // 设置默认的选项
  18834. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  18835. // if (typeof obj.activeTab === 'number') {
  18836. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  18837. // } else if (typeof obj.activeTab === 'string') {
  18838. // this._tabViewSelect[obj.id] = obj.activeTab
  18839. // }
  18840. //
  18841. // }
  18842. // }
  18843. if (isAll && obj.hasOwnProperty("view")) ;
  18844. });
  18845. return vjson;
  18846. };
  18847. /**
  18848. * 为组件创建 ID
  18849. */
  18850. ModulePage.prototype.createViewId = function () {
  18851. this.maxViewId++;
  18852. return this.id + idPrefix + this.maxViewId;
  18853. };
  18854. ModulePage.prototype.onDestroy = function () {
  18855. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  18856. this.cancelSubscribe[i].cancel();
  18857. }
  18858. _super.prototype.onDestroy.call(this);
  18859. };
  18860. return ModulePage;
  18861. }(Scope));
  18862. var camundaModdleDescriptor = {
  18863. "name": "Camunda",
  18864. "uri": "http://camunda.org/schema/1.0/bpmn",
  18865. "prefix": "camunda",
  18866. "xml": {
  18867. "tagAlias": "lowerCase"
  18868. },
  18869. "associations": [],
  18870. "types": [
  18871. {
  18872. "name": "Definitions",
  18873. "isAbstract": true,
  18874. "extends": [
  18875. "bpmn:Definitions"
  18876. ],
  18877. "properties": [
  18878. {
  18879. "name": "diagramRelationId",
  18880. "isAttr": true,
  18881. "type": "String"
  18882. }
  18883. ]
  18884. },
  18885. {
  18886. "name": "InOutBinding",
  18887. "superClass": [
  18888. "Element"
  18889. ],
  18890. "isAbstract": true,
  18891. "properties": [
  18892. {
  18893. "name": "source",
  18894. "isAttr": true,
  18895. "type": "String"
  18896. },
  18897. {
  18898. "name": "sourceExpression",
  18899. "isAttr": true,
  18900. "type": "String"
  18901. },
  18902. {
  18903. "name": "target",
  18904. "isAttr": true,
  18905. "type": "String"
  18906. },
  18907. {
  18908. "name": "businessKey",
  18909. "isAttr": true,
  18910. "type": "String"
  18911. },
  18912. {
  18913. "name": "local",
  18914. "isAttr": true,
  18915. "type": "Boolean",
  18916. "default": false
  18917. },
  18918. {
  18919. "name": "variables",
  18920. "isAttr": true,
  18921. "type": "String"
  18922. }
  18923. ]
  18924. },
  18925. {
  18926. "name": "In",
  18927. "superClass": [
  18928. "InOutBinding"
  18929. ],
  18930. "meta": {
  18931. "allowedIn": [
  18932. "bpmn:CallActivity",
  18933. "bpmn:SignalEventDefinition"
  18934. ]
  18935. }
  18936. },
  18937. {
  18938. "name": "Out",
  18939. "superClass": [
  18940. "InOutBinding"
  18941. ],
  18942. "meta": {
  18943. "allowedIn": [
  18944. "bpmn:CallActivity"
  18945. ]
  18946. }
  18947. },
  18948. {
  18949. "name": "AsyncCapable",
  18950. "isAbstract": true,
  18951. "extends": [
  18952. "bpmn:Activity",
  18953. "bpmn:Gateway",
  18954. "bpmn:Event"
  18955. ],
  18956. "properties": [
  18957. {
  18958. "name": "async",
  18959. "isAttr": true,
  18960. "type": "Boolean",
  18961. "default": false
  18962. },
  18963. {
  18964. "name": "asyncBefore",
  18965. "isAttr": true,
  18966. "type": "Boolean",
  18967. "default": false
  18968. },
  18969. {
  18970. "name": "asyncAfter",
  18971. "isAttr": true,
  18972. "type": "Boolean",
  18973. "default": false
  18974. },
  18975. {
  18976. "name": "exclusive",
  18977. "isAttr": true,
  18978. "type": "Boolean",
  18979. "default": true
  18980. }
  18981. ]
  18982. },
  18983. {
  18984. "name": "JobPriorized",
  18985. "isAbstract": true,
  18986. "extends": [
  18987. "bpmn:Process",
  18988. "camunda:AsyncCapable"
  18989. ],
  18990. "properties": [
  18991. {
  18992. "name": "jobPriority",
  18993. "isAttr": true,
  18994. "type": "String"
  18995. }
  18996. ]
  18997. },
  18998. {
  18999. "name": "SignalEventDefinitionExtension",
  19000. "isAbstract": true,
  19001. "extends": [
  19002. "bpmn:SignalEventDefinition"
  19003. ],
  19004. "properties": [
  19005. {
  19006. "name": "async",
  19007. "isAttr": true,
  19008. "type": "Boolean",
  19009. "default": false
  19010. }
  19011. ]
  19012. },
  19013. {
  19014. "name": "ErrorEventDefinitionExtension",
  19015. "isAbstract": true,
  19016. "extends": [
  19017. "bpmn:ErrorEventDefinition"
  19018. ],
  19019. "properties": [
  19020. {
  19021. "name": "errorCodeVariable",
  19022. "isAttr": true,
  19023. "type": "String"
  19024. },
  19025. {
  19026. "name": "errorMessageVariable",
  19027. "isAttr": true,
  19028. "type": "String"
  19029. }
  19030. ]
  19031. },
  19032. {
  19033. "name": "ErrorEventDefinition",
  19034. "superClass": [
  19035. "bpmn:ErrorEventDefinition",
  19036. "Element"
  19037. ],
  19038. "properties": [
  19039. {
  19040. "name": "expression",
  19041. "isAttr": true,
  19042. "type": "String"
  19043. }
  19044. ],
  19045. "meta": {
  19046. "allowedIn": ["bpmn:ServiceTask"]
  19047. }
  19048. },
  19049. {
  19050. "name": "Error",
  19051. "isAbstract": true,
  19052. "extends": [
  19053. "bpmn:Error"
  19054. ],
  19055. "properties": [
  19056. {
  19057. "name": "camunda:errorMessage",
  19058. "isAttr": true,
  19059. "type": "String"
  19060. }
  19061. ]
  19062. },
  19063. {
  19064. "name": "PotentialStarter",
  19065. "superClass": [
  19066. "Element"
  19067. ],
  19068. "properties": [
  19069. {
  19070. "name": "resourceAssignmentExpression",
  19071. "type": "bpmn:ResourceAssignmentExpression"
  19072. }
  19073. ]
  19074. },
  19075. {
  19076. "name": "FormSupported",
  19077. "isAbstract": true,
  19078. "extends": [
  19079. "bpmn:StartEvent",
  19080. "bpmn:UserTask"
  19081. ],
  19082. "properties": [
  19083. {
  19084. "name": "formHandlerClass",
  19085. "isAttr": true,
  19086. "type": "String"
  19087. },
  19088. {
  19089. "name": "formKey",
  19090. "isAttr": true,
  19091. "type": "String"
  19092. },
  19093. {
  19094. "name": "formRef",
  19095. "isAttr": true,
  19096. "type": "String"
  19097. },
  19098. {
  19099. "name": "formRefBinding",
  19100. "isAttr": true,
  19101. "type": "String"
  19102. },
  19103. {
  19104. "name": "formRefVersion",
  19105. "isAttr": true,
  19106. "type": "String"
  19107. }
  19108. ]
  19109. },
  19110. {
  19111. "name": "TemplateSupported",
  19112. "isAbstract": true,
  19113. "extends": [
  19114. "bpmn:Collaboration",
  19115. "bpmn:Process",
  19116. "bpmn:FlowElement"
  19117. ],
  19118. "properties": [
  19119. {
  19120. "name": "modelerTemplate",
  19121. "isAttr": true,
  19122. "type": "String"
  19123. },
  19124. {
  19125. "name": "modelerTemplateVersion",
  19126. "isAttr": true,
  19127. "type": "Integer"
  19128. }
  19129. ]
  19130. },
  19131. {
  19132. "name": "Initiator",
  19133. "isAbstract": true,
  19134. "extends": ["bpmn:StartEvent"],
  19135. "properties": [
  19136. {
  19137. "name": "initiator",
  19138. "isAttr": true,
  19139. "type": "String"
  19140. }
  19141. ]
  19142. },
  19143. {
  19144. "name": "ScriptTask",
  19145. "isAbstract": true,
  19146. "extends": [
  19147. "bpmn:ScriptTask"
  19148. ],
  19149. "properties": [
  19150. {
  19151. "name": "resultVariable",
  19152. "isAttr": true,
  19153. "type": "String"
  19154. },
  19155. {
  19156. "name": "resource",
  19157. "isAttr": true,
  19158. "type": "String"
  19159. }
  19160. ]
  19161. },
  19162. {
  19163. "name": "Process",
  19164. "isAbstract": true,
  19165. "extends": [
  19166. "bpmn:Process"
  19167. ],
  19168. "properties": [
  19169. {
  19170. "name": "candidateStarterGroups",
  19171. "isAttr": true,
  19172. "type": "String"
  19173. },
  19174. {
  19175. "name": "candidateStarterUsers",
  19176. "isAttr": true,
  19177. "type": "String"
  19178. },
  19179. {
  19180. "name": "versionTag",
  19181. "isAttr": true,
  19182. "type": "String"
  19183. },
  19184. {
  19185. "name": "historyTimeToLive",
  19186. "isAttr": true,
  19187. "type": "String"
  19188. },
  19189. {
  19190. "name": "isStartableInTasklist",
  19191. "isAttr": true,
  19192. "type": "Boolean",
  19193. "default": true
  19194. }
  19195. ]
  19196. },
  19197. {
  19198. "name": "EscalationEventDefinitionExtension",
  19199. "isAbstract": true,
  19200. "extends": [
  19201. "bpmn:EscalationEventDefinition"
  19202. ],
  19203. "properties": [
  19204. {
  19205. "name": "escalationCodeVariable",
  19206. "isAttr": true,
  19207. "type": "String"
  19208. }
  19209. ]
  19210. },
  19211. {
  19212. "name": "FormalExpression",
  19213. "isAbstract": true,
  19214. "extends": [
  19215. "bpmn:FormalExpression"
  19216. ],
  19217. "properties": [
  19218. {
  19219. "name": "resource",
  19220. "isAttr": true,
  19221. "type": "String"
  19222. }
  19223. ]
  19224. },
  19225. {
  19226. "name": "Assignable",
  19227. "extends": ["bpmn:UserTask"],
  19228. "properties": [
  19229. {
  19230. "name": "assignee",
  19231. "isAttr": true,
  19232. "type": "String"
  19233. },
  19234. {
  19235. "name": "candidateUsers",
  19236. "isAttr": true,
  19237. "type": "String"
  19238. },
  19239. {
  19240. "name": "candidateGroups",
  19241. "isAttr": true,
  19242. "type": "String"
  19243. },
  19244. {
  19245. "name": "dueDate",
  19246. "isAttr": true,
  19247. "type": "String"
  19248. },
  19249. {
  19250. "name": "followUpDate",
  19251. "isAttr": true,
  19252. "type": "String"
  19253. },
  19254. {
  19255. "name": "priority",
  19256. "isAttr": true,
  19257. "type": "String"
  19258. }
  19259. ]
  19260. },
  19261. {
  19262. "name": "CallActivity",
  19263. "extends": ["bpmn:CallActivity"],
  19264. "properties": [
  19265. {
  19266. "name": "calledElementBinding",
  19267. "isAttr": true,
  19268. "type": "String",
  19269. "default": "latest"
  19270. },
  19271. {
  19272. "name": "calledElementVersion",
  19273. "isAttr": true,
  19274. "type": "String"
  19275. },
  19276. {
  19277. "name": "calledElementVersionTag",
  19278. "isAttr": true,
  19279. "type": "String"
  19280. },
  19281. {
  19282. "name": "calledElementTenantId",
  19283. "isAttr": true,
  19284. "type": "String"
  19285. },
  19286. {
  19287. "name": "caseRef",
  19288. "isAttr": true,
  19289. "type": "String"
  19290. },
  19291. {
  19292. "name": "caseBinding",
  19293. "isAttr": true,
  19294. "type": "String",
  19295. "default": "latest"
  19296. },
  19297. {
  19298. "name": "caseVersion",
  19299. "isAttr": true,
  19300. "type": "String"
  19301. },
  19302. {
  19303. "name": "caseTenantId",
  19304. "isAttr": true,
  19305. "type": "String"
  19306. },
  19307. {
  19308. "name": "variableMappingClass",
  19309. "isAttr": true,
  19310. "type": "String"
  19311. },
  19312. {
  19313. "name": "variableMappingDelegateExpression",
  19314. "isAttr": true,
  19315. "type": "String"
  19316. }
  19317. ]
  19318. },
  19319. {
  19320. "name": "ServiceTaskLike",
  19321. "extends": [
  19322. "bpmn:ServiceTask",
  19323. "bpmn:BusinessRuleTask",
  19324. "bpmn:SendTask",
  19325. "bpmn:MessageEventDefinition"
  19326. ],
  19327. "properties": [
  19328. {
  19329. "name": "expression",
  19330. "isAttr": true,
  19331. "type": "String"
  19332. },
  19333. {
  19334. "name": "class",
  19335. "isAttr": true,
  19336. "type": "String"
  19337. },
  19338. {
  19339. "name": "delegateExpression",
  19340. "isAttr": true,
  19341. "type": "String"
  19342. },
  19343. {
  19344. "name": "resultVariable",
  19345. "isAttr": true,
  19346. "type": "String"
  19347. }
  19348. ]
  19349. },
  19350. {
  19351. "name": "DmnCapable",
  19352. "extends": [
  19353. "bpmn:BusinessRuleTask"
  19354. ],
  19355. "properties": [
  19356. {
  19357. "name": "decisionRef",
  19358. "isAttr": true,
  19359. "type": "String"
  19360. },
  19361. {
  19362. "name": "decisionRefBinding",
  19363. "isAttr": true,
  19364. "type": "String",
  19365. "default": "latest"
  19366. },
  19367. {
  19368. "name": "decisionRefVersion",
  19369. "isAttr": true,
  19370. "type": "String"
  19371. },
  19372. {
  19373. "name": "mapDecisionResult",
  19374. "isAttr": true,
  19375. "type": "String",
  19376. "default": "resultList"
  19377. },
  19378. {
  19379. "name": "decisionRefTenantId",
  19380. "isAttr": true,
  19381. "type": "String"
  19382. }
  19383. ]
  19384. },
  19385. {
  19386. "name": "ExternalCapable",
  19387. "extends": [
  19388. "camunda:ServiceTaskLike"
  19389. ],
  19390. "properties": [
  19391. {
  19392. "name": "type",
  19393. "isAttr": true,
  19394. "type": "String"
  19395. },
  19396. {
  19397. "name": "topic",
  19398. "isAttr": true,
  19399. "type": "String"
  19400. }
  19401. ]
  19402. },
  19403. {
  19404. "name": "TaskPriorized",
  19405. "extends": [
  19406. "bpmn:Process",
  19407. "camunda:ExternalCapable"
  19408. ],
  19409. "properties": [
  19410. {
  19411. "name": "taskPriority",
  19412. "isAttr": true,
  19413. "type": "String"
  19414. }
  19415. ]
  19416. },
  19417. {
  19418. "name": "Properties",
  19419. "superClass": [
  19420. "Element"
  19421. ],
  19422. "meta": {
  19423. "allowedIn": ["*"]
  19424. },
  19425. "properties": [
  19426. {
  19427. "name": "values",
  19428. "type": "Property",
  19429. "isMany": true
  19430. }
  19431. ]
  19432. },
  19433. {
  19434. "name": "Property",
  19435. "superClass": [
  19436. "Element"
  19437. ],
  19438. "properties": [
  19439. {
  19440. "name": "id",
  19441. "type": "String",
  19442. "isAttr": true
  19443. },
  19444. {
  19445. "name": "name",
  19446. "type": "String",
  19447. "isAttr": true
  19448. },
  19449. {
  19450. "name": "value",
  19451. "type": "String",
  19452. "isAttr": true
  19453. }
  19454. ]
  19455. },
  19456. {
  19457. "name": "Connector",
  19458. "superClass": [
  19459. "Element"
  19460. ],
  19461. "meta": {
  19462. "allowedIn": [
  19463. "camunda:ServiceTaskLike"
  19464. ]
  19465. },
  19466. "properties": [
  19467. {
  19468. "name": "inputOutput",
  19469. "type": "InputOutput"
  19470. },
  19471. {
  19472. "name": "connectorId",
  19473. "type": "String"
  19474. }
  19475. ]
  19476. },
  19477. {
  19478. "name": "InputOutput",
  19479. "superClass": [
  19480. "Element"
  19481. ],
  19482. "meta": {
  19483. "allowedIn": [
  19484. "bpmn:FlowNode",
  19485. "camunda:Connector"
  19486. ]
  19487. },
  19488. "properties": [
  19489. {
  19490. "name": "inputOutput",
  19491. "type": "InputOutput"
  19492. },
  19493. {
  19494. "name": "connectorId",
  19495. "type": "String"
  19496. },
  19497. {
  19498. "name": "inputParameters",
  19499. "isMany": true,
  19500. "type": "InputParameter"
  19501. },
  19502. {
  19503. "name": "outputParameters",
  19504. "isMany": true,
  19505. "type": "OutputParameter"
  19506. }
  19507. ]
  19508. },
  19509. {
  19510. "name": "InputOutputParameter",
  19511. "properties": [
  19512. {
  19513. "name": "name",
  19514. "isAttr": true,
  19515. "type": "String"
  19516. },
  19517. {
  19518. "name": "value",
  19519. "isBody": true,
  19520. "type": "String"
  19521. },
  19522. {
  19523. "name": "definition",
  19524. "type": "InputOutputParameterDefinition"
  19525. }
  19526. ]
  19527. },
  19528. {
  19529. "name": "InputOutputParameterDefinition",
  19530. "isAbstract": true
  19531. },
  19532. {
  19533. "name": "List",
  19534. "superClass": ["InputOutputParameterDefinition"],
  19535. "properties": [
  19536. {
  19537. "name": "items",
  19538. "isMany": true,
  19539. "type": "InputOutputParameterDefinition"
  19540. }
  19541. ]
  19542. },
  19543. {
  19544. "name": "Map",
  19545. "superClass": ["InputOutputParameterDefinition"],
  19546. "properties": [
  19547. {
  19548. "name": "entries",
  19549. "isMany": true,
  19550. "type": "Entry"
  19551. }
  19552. ]
  19553. },
  19554. {
  19555. "name": "Entry",
  19556. "properties": [
  19557. {
  19558. "name": "key",
  19559. "isAttr": true,
  19560. "type": "String"
  19561. },
  19562. {
  19563. "name": "value",
  19564. "isBody": true,
  19565. "type": "String"
  19566. },
  19567. {
  19568. "name": "definition",
  19569. "type": "InputOutputParameterDefinition"
  19570. }
  19571. ]
  19572. },
  19573. {
  19574. "name": "Value",
  19575. "superClass": [
  19576. "InputOutputParameterDefinition"
  19577. ],
  19578. "properties": [
  19579. {
  19580. "name": "id",
  19581. "isAttr": true,
  19582. "type": "String"
  19583. },
  19584. {
  19585. "name": "name",
  19586. "isAttr": true,
  19587. "type": "String"
  19588. },
  19589. {
  19590. "name": "value",
  19591. "isBody": true,
  19592. "type": "String"
  19593. }
  19594. ]
  19595. },
  19596. {
  19597. "name": "Script",
  19598. "superClass": ["InputOutputParameterDefinition"],
  19599. "properties": [
  19600. {
  19601. "name": "scriptFormat",
  19602. "isAttr": true,
  19603. "type": "String"
  19604. },
  19605. {
  19606. "name": "resource",
  19607. "isAttr": true,
  19608. "type": "String"
  19609. },
  19610. {
  19611. "name": "value",
  19612. "isBody": true,
  19613. "type": "String"
  19614. }
  19615. ]
  19616. },
  19617. {
  19618. "name": "Field",
  19619. "superClass": ["Element"],
  19620. "meta": {
  19621. "allowedIn": [
  19622. "camunda:ServiceTaskLike",
  19623. "camunda:ExecutionListener",
  19624. "camunda:TaskListener"
  19625. ]
  19626. },
  19627. "properties": [
  19628. {
  19629. "name": "name",
  19630. "isAttr": true,
  19631. "type": "String"
  19632. },
  19633. {
  19634. "name": "expression",
  19635. "type": "String"
  19636. },
  19637. {
  19638. "name": "stringValue",
  19639. "isAttr": true,
  19640. "type": "String"
  19641. },
  19642. {
  19643. "name": "string",
  19644. "type": "String"
  19645. }
  19646. ]
  19647. },
  19648. {
  19649. "name": "InputParameter",
  19650. "superClass": ["InputOutputParameter"]
  19651. },
  19652. {
  19653. "name": "OutputParameter",
  19654. "superClass": ["InputOutputParameter"]
  19655. },
  19656. {
  19657. "name": "Collectable",
  19658. "isAbstract": true,
  19659. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  19660. "superClass": ["camunda:AsyncCapable"],
  19661. "properties": [
  19662. {
  19663. "name": "collection",
  19664. "isAttr": true,
  19665. "type": "String"
  19666. },
  19667. {
  19668. "name": "elementVariable",
  19669. "isAttr": true,
  19670. "type": "String"
  19671. }
  19672. ]
  19673. },
  19674. {
  19675. "name": "FailedJobRetryTimeCycle",
  19676. "superClass": ["Element"],
  19677. "meta": {
  19678. "allowedIn": [
  19679. "camunda:AsyncCapable",
  19680. "bpmn:MultiInstanceLoopCharacteristics"
  19681. ]
  19682. },
  19683. "properties": [
  19684. {
  19685. "name": "body",
  19686. "isBody": true,
  19687. "type": "String"
  19688. }
  19689. ]
  19690. },
  19691. {
  19692. "name": "ExecutionListener",
  19693. "superClass": ["Element"],
  19694. "meta": {
  19695. "allowedIn": [
  19696. "bpmn:Task",
  19697. "bpmn:ServiceTask",
  19698. "bpmn:UserTask",
  19699. "bpmn:BusinessRuleTask",
  19700. "bpmn:ScriptTask",
  19701. "bpmn:ReceiveTask",
  19702. "bpmn:ManualTask",
  19703. "bpmn:ExclusiveGateway",
  19704. "bpmn:SequenceFlow",
  19705. "bpmn:ParallelGateway",
  19706. "bpmn:InclusiveGateway",
  19707. "bpmn:EventBasedGateway",
  19708. "bpmn:StartEvent",
  19709. "bpmn:IntermediateCatchEvent",
  19710. "bpmn:IntermediateThrowEvent",
  19711. "bpmn:EndEvent",
  19712. "bpmn:BoundaryEvent",
  19713. "bpmn:CallActivity",
  19714. "bpmn:SubProcess",
  19715. "bpmn:Process"
  19716. ]
  19717. },
  19718. "properties": [
  19719. {
  19720. "name": "expression",
  19721. "isAttr": true,
  19722. "type": "String"
  19723. },
  19724. {
  19725. "name": "class",
  19726. "isAttr": true,
  19727. "type": "String"
  19728. },
  19729. {
  19730. "name": "delegateExpression",
  19731. "isAttr": true,
  19732. "type": "String"
  19733. },
  19734. {
  19735. "name": "event",
  19736. "isAttr": true,
  19737. "type": "String"
  19738. },
  19739. {
  19740. "name": "script",
  19741. "type": "Script"
  19742. },
  19743. {
  19744. "name": "fields",
  19745. "type": "Field",
  19746. "isMany": true
  19747. }
  19748. ]
  19749. },
  19750. {
  19751. "name": "TaskListener",
  19752. "superClass": ["Element"],
  19753. "meta": {
  19754. "allowedIn": [
  19755. "bpmn:UserTask"
  19756. ]
  19757. },
  19758. "properties": [
  19759. {
  19760. "name": "expression",
  19761. "isAttr": true,
  19762. "type": "String"
  19763. },
  19764. {
  19765. "name": "class",
  19766. "isAttr": true,
  19767. "type": "String"
  19768. },
  19769. {
  19770. "name": "delegateExpression",
  19771. "isAttr": true,
  19772. "type": "String"
  19773. },
  19774. {
  19775. "name": "event",
  19776. "isAttr": true,
  19777. "type": "String"
  19778. },
  19779. {
  19780. "name": "script",
  19781. "type": "Script"
  19782. },
  19783. {
  19784. "name": "fields",
  19785. "type": "Field",
  19786. "isMany": true
  19787. },
  19788. {
  19789. "name": "id",
  19790. "type": "String",
  19791. "isAttr": true
  19792. },
  19793. {
  19794. "name": "eventDefinitions",
  19795. "type": "bpmn:TimerEventDefinition",
  19796. "isMany": true
  19797. }
  19798. ]
  19799. },
  19800. {
  19801. "name": "FormProperty",
  19802. "superClass": ["Element"],
  19803. "meta": {
  19804. "allowedIn": [
  19805. "bpmn:StartEvent",
  19806. "bpmn:UserTask"
  19807. ]
  19808. },
  19809. "properties": [
  19810. {
  19811. "name": "id",
  19812. "type": "String",
  19813. "isAttr": true
  19814. },
  19815. {
  19816. "name": "name",
  19817. "type": "String",
  19818. "isAttr": true
  19819. },
  19820. {
  19821. "name": "type",
  19822. "type": "String",
  19823. "isAttr": true
  19824. },
  19825. {
  19826. "name": "required",
  19827. "type": "String",
  19828. "isAttr": true
  19829. },
  19830. {
  19831. "name": "readable",
  19832. "type": "String",
  19833. "isAttr": true
  19834. },
  19835. {
  19836. "name": "writable",
  19837. "type": "String",
  19838. "isAttr": true
  19839. },
  19840. {
  19841. "name": "variable",
  19842. "type": "String",
  19843. "isAttr": true
  19844. },
  19845. {
  19846. "name": "expression",
  19847. "type": "String",
  19848. "isAttr": true
  19849. },
  19850. {
  19851. "name": "datePattern",
  19852. "type": "String",
  19853. "isAttr": true
  19854. },
  19855. {
  19856. "name": "default",
  19857. "type": "String",
  19858. "isAttr": true
  19859. },
  19860. {
  19861. "name": "values",
  19862. "type": "Value",
  19863. "isMany": true
  19864. }
  19865. ]
  19866. },
  19867. {
  19868. "name": "FormData",
  19869. "superClass": ["Element"],
  19870. "meta": {
  19871. "allowedIn": [
  19872. "bpmn:StartEvent",
  19873. "bpmn:UserTask"
  19874. ]
  19875. },
  19876. "properties": [
  19877. {
  19878. "name": "fields",
  19879. "type": "FormField",
  19880. "isMany": true
  19881. },
  19882. {
  19883. "name": "businessKey",
  19884. "type": "String",
  19885. "isAttr": true
  19886. }
  19887. ]
  19888. },
  19889. {
  19890. "name": "FormField",
  19891. "superClass": ["Element"],
  19892. "properties": [
  19893. {
  19894. "name": "id",
  19895. "type": "String",
  19896. "isAttr": true
  19897. },
  19898. {
  19899. "name": "label",
  19900. "type": "String",
  19901. "isAttr": true
  19902. },
  19903. {
  19904. "name": "type",
  19905. "type": "String",
  19906. "isAttr": true
  19907. },
  19908. {
  19909. "name": "datePattern",
  19910. "type": "String",
  19911. "isAttr": true
  19912. },
  19913. {
  19914. "name": "defaultValue",
  19915. "type": "String",
  19916. "isAttr": true
  19917. },
  19918. {
  19919. "name": "properties",
  19920. "type": "Properties"
  19921. },
  19922. {
  19923. "name": "validation",
  19924. "type": "Validation"
  19925. },
  19926. {
  19927. "name": "values",
  19928. "type": "Value",
  19929. "isMany": true
  19930. }
  19931. ]
  19932. },
  19933. {
  19934. "name": "Validation",
  19935. "superClass": ["Element"],
  19936. "properties": [
  19937. {
  19938. "name": "constraints",
  19939. "type": "Constraint",
  19940. "isMany": true
  19941. }
  19942. ]
  19943. },
  19944. {
  19945. "name": "Constraint",
  19946. "superClass": ["Element"],
  19947. "properties": [
  19948. {
  19949. "name": "name",
  19950. "type": "String",
  19951. "isAttr": true
  19952. },
  19953. {
  19954. "name": "config",
  19955. "type": "String",
  19956. "isAttr": true
  19957. }
  19958. ]
  19959. },
  19960. {
  19961. "name": "ConditionalEventDefinitionExtension",
  19962. "isAbstract": true,
  19963. "extends": [
  19964. "bpmn:ConditionalEventDefinition"
  19965. ],
  19966. "properties": [
  19967. {
  19968. "name": "variableName",
  19969. "isAttr": true,
  19970. "type": "String"
  19971. },
  19972. {
  19973. "name": "variableEvents",
  19974. "isAttr": true,
  19975. "type": "String"
  19976. }
  19977. ]
  19978. }
  19979. ],
  19980. "emumerations": []
  19981. };
  19982. /**
  19983. * This is a sample file that should be replaced with the actual translation.
  19984. *
  19985. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  19986. * translations and labels to translate.
  19987. */
  19988. var translations = {
  19989. // Labels
  19990. 'Activate the global connect tool': '激活全局连接工具',
  19991. 'Append {type}': '追加 {type}',
  19992. 'Append EndEvent': '追加 结束事件 ',
  19993. 'Append Task': '追加 任务',
  19994. 'Append Gateway': '追加 网关',
  19995. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  19996. 'Add Lane above': '在上面添加道',
  19997. 'Divide into two Lanes': '分割成两个道',
  19998. 'Divide into three Lanes': '分割成三个道',
  19999. 'Add Lane below': '在下面添加道',
  20000. 'Append compensation activity': '追加补偿活动',
  20001. 'Change type': '修改类型',
  20002. 'Connect using Association': '使用关联连接',
  20003. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  20004. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  20005. 'Remove': '移除',
  20006. 'Activate the hand tool': '激活抓手工具',
  20007. 'Activate the lasso tool': '激活套索工具',
  20008. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  20009. 'Create expanded SubProcess': '创建扩展子过程',
  20010. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  20011. 'Create Pool/Participant': '创建池/参与者',
  20012. 'Parallel Multi Instance': '并行多重事件',
  20013. 'Sequential Multi Instance': '时序多重事件',
  20014. 'DataObjectReference': '数据对象参考',
  20015. 'DataStoreReference': '数据存储参考',
  20016. 'Loop': '循环',
  20017. 'Ad-hoc': '即席',
  20018. 'Create {type}': '创建 {type}',
  20019. 'Create Task': '创建任务',
  20020. 'Create StartEvent': '创建开始事件',
  20021. 'Create EndEvent': '创建结束事件',
  20022. 'Create Group': '创建组',
  20023. 'Task': '任务',
  20024. 'Send Task': '发送任务',
  20025. 'Receive Task': '接收任务',
  20026. 'User Task': '用户任务',
  20027. 'Manual Task': '手工任务',
  20028. 'Business Rule Task': '业务规则任务',
  20029. 'Service Task': '服务任务',
  20030. 'Script Task': '脚本任务',
  20031. 'Call Activity': '调用活动',
  20032. 'Sub Process (collapsed)': '子流程(折叠的)',
  20033. 'Sub Process (expanded)': '子流程(展开的)',
  20034. 'Start Event': '开始事件',
  20035. 'StartEvent': '开始事件',
  20036. 'Intermediate Throw Event': '中间事件',
  20037. 'End Event': '结束事件',
  20038. 'EndEvent': '结束事件',
  20039. 'Create Gateway': '创建网关',
  20040. 'GateWay': '网关',
  20041. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  20042. 'Message Start Event': '消息开始事件',
  20043. 'Timer Start Event': '定时开始事件',
  20044. 'Conditional Start Event': '条件开始事件',
  20045. 'Signal Start Event': '信号开始事件',
  20046. 'Error Start Event': '错误开始事件',
  20047. 'Escalation Start Event': '升级开始事件',
  20048. 'Compensation Start Event': '补偿开始事件',
  20049. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  20050. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  20051. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  20052. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  20053. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  20054. 'Message Intermediate Catch Event': '消息中间捕获事件',
  20055. 'Message Intermediate Throw Event': '消息中间抛出事件',
  20056. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  20057. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  20058. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  20059. 'Link Intermediate Catch Event': '链接中间捕获事件',
  20060. 'Link Intermediate Throw Event': '链接中间抛出事件',
  20061. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  20062. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  20063. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  20064. 'Message End Event': '消息结束事件',
  20065. 'Escalation End Event': '定时结束事件',
  20066. 'Error End Event': '错误结束事件',
  20067. 'Cancel End Event': '取消结束事件',
  20068. 'Compensation End Event': '补偿结束事件',
  20069. 'Signal End Event': '信号结束事件',
  20070. 'Terminate End Event': '终止结束事件',
  20071. 'Message Boundary Event': '消息边界事件',
  20072. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  20073. 'Timer Boundary Event': '定时边界事件',
  20074. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  20075. 'Escalation Boundary Event': '升级边界事件',
  20076. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  20077. 'Conditional Boundary Event': '条件边界事件',
  20078. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  20079. 'Error Boundary Event': '错误边界事件',
  20080. 'Cancel Boundary Event': '取消边界事件',
  20081. 'Signal Boundary Event': '信号边界事件',
  20082. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  20083. 'Compensation Boundary Event': '补偿边界事件',
  20084. 'Exclusive Gateway': '互斥网关',
  20085. 'Parallel Gateway': '并行网关',
  20086. 'Inclusive Gateway': '相容网关',
  20087. 'Complex Gateway': '复杂网关',
  20088. 'Event based Gateway': '事件网关',
  20089. 'Transaction': '转运',
  20090. 'Sub Process': '子流程',
  20091. 'Event Sub Process': '事件子流程',
  20092. 'Collapsed Pool': '折叠池',
  20093. 'Expanded Pool': '展开池',
  20094. // Errors
  20095. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  20096. 'no shape type specified': '没有指定的形状类型',
  20097. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  20098. 'out of bounds release': 'out of bounds release',
  20099. 'more than {count} child lanes': '子道大于{count} ',
  20100. 'element required': '元素不能为空',
  20101. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  20102. 'no diagram to display': '没有可展示的流程图',
  20103. 'no process or collaboration to display': '没有可展示的流程/协作',
  20104. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  20105. 'already rendered {element}': '{element} 已被渲染',
  20106. 'failed to import {element}': '导入{element}失败',
  20107. // 属性面板的参数
  20108. 'Id': '编号',
  20109. 'Name': '名称',
  20110. 'General': '常规',
  20111. 'Details': '详情',
  20112. 'Message Name': '消息名称',
  20113. 'Message': '消息',
  20114. 'Initiator': '创建者',
  20115. 'Asynchronous Continuations': '持续异步',
  20116. 'Asynchronous Before': '异步前',
  20117. 'Asynchronous After': '异步后',
  20118. 'Job Configuration': '工作配置',
  20119. 'Exclusive': '排除',
  20120. 'Job Priority': '工作优先级',
  20121. 'Retry Time Cycle': '重试时间周期',
  20122. 'Documentation': '文档',
  20123. 'Element Documentation': '元素文档',
  20124. 'History Configuration': '历史配置',
  20125. 'History Time To Live': '历史的生存时间',
  20126. 'Forms': '表单',
  20127. 'Form Key': '表单key',
  20128. 'Form Fields': '表单字段',
  20129. 'Business Key': '业务key',
  20130. 'Form Field': '表单字段',
  20131. 'ID': '编号',
  20132. 'Type': '类型',
  20133. 'Label': '名称',
  20134. 'Default Value': '默认值',
  20135. 'Validation': '校验',
  20136. 'Add Constraint': '添加约束',
  20137. 'Config': '配置',
  20138. 'Properties': '属性',
  20139. 'Add Property': '添加属性',
  20140. 'Value': '值',
  20141. 'Add': '添加',
  20142. 'Values': '值',
  20143. 'Add Value': '添加值',
  20144. 'Listeners': '监听器',
  20145. 'Execution Listener': '执行监听',
  20146. 'Event Type': '事件类型',
  20147. 'Listener Type': '监听器类型',
  20148. 'Java Class': 'Java类',
  20149. 'Expression': '表达式',
  20150. 'Must provide a value': '必须提供一个值',
  20151. 'Delegate Expression': '代理表达式',
  20152. 'Script': '脚本',
  20153. 'Script Format': '脚本格式',
  20154. 'Script Type': '脚本类型',
  20155. 'Inline Script': '内联脚本',
  20156. 'External Script': '外部脚本',
  20157. 'Resource': '资源',
  20158. 'Field Injection': '字段注入',
  20159. 'Extensions': '扩展',
  20160. 'Input/Output': '输入/输出',
  20161. 'Input Parameters': '输入参数',
  20162. 'Output Parameters': '输出参数',
  20163. 'Parameters': '参数',
  20164. 'Output Parameter': '输出参数',
  20165. 'Timer Definition Type': '定时器定义类型',
  20166. 'Timer Definition': '定时器定义',
  20167. 'Date': '日期',
  20168. 'Duration': '持续',
  20169. 'Cycle': '循环',
  20170. 'Signal': '信号',
  20171. 'Signal Name': '信号名称',
  20172. 'Escalation': '升级',
  20173. 'Error': '错误',
  20174. 'Link Name': '链接名称',
  20175. 'Condition': '条件名称',
  20176. 'Variable Name': '变量名称',
  20177. 'Variable Event': '变量事件',
  20178. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  20179. 'Wait for Completion': '等待完成',
  20180. 'Activity Ref': '活动参考',
  20181. 'Version Tag': '版本标签',
  20182. 'Executable': '可执行文件',
  20183. 'External Task Configuration': '扩展任务配置',
  20184. 'Task Priority': '任务优先级',
  20185. 'External': '外部',
  20186. 'Connector': '连接器',
  20187. 'Must configure Connector': '必须配置连接器',
  20188. 'Connector Id': '连接器编号',
  20189. 'Implementation': '实现方式',
  20190. 'Field Injections': '字段注入',
  20191. 'Fields': '字段',
  20192. 'Result Variable': '结果变量',
  20193. 'Topic': '主题',
  20194. 'Configure Connector': '配置连接器',
  20195. 'Input Parameter': '输入参数',
  20196. 'Assignee': '代理人',
  20197. 'Candidate Users': '候选用户',
  20198. 'Candidate Groups': '候选组',
  20199. 'Due Date': '到期时间',
  20200. 'Follow Up Date': '跟踪日期',
  20201. 'Priority': '优先级',
  20202. // eslint-disable-next-line no-template-curly-in-string
  20203. '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',
  20204. // eslint-disable-next-line no-template-curly-in-string
  20205. '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',
  20206. 'Variables': '变量',
  20207. 'Candidate Starter Configuration': '候选开始配置',
  20208. 'Task Listener': '任务监听器',
  20209. 'Candidate Starter Groups': '候选开始组',
  20210. 'Candidate Starter Users': '候选开始用户',
  20211. 'Tasklist Configuration': '任务列表配置',
  20212. 'Startable': '启动',
  20213. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  20214. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  20215. 'This maps to the process definition key.': '这会映射为流程定义的键',
  20216. 'CallActivity Type': '调用活动类型',
  20217. 'Condition Type': '条件类型',
  20218. 'Create UserTask': '创建用户任务',
  20219. 'Create CallActivity': '创建调用活动',
  20220. 'Called Element': '调用元素',
  20221. 'Create DataObjectReference': '创建数据对象引用',
  20222. 'Create DataStoreReference': '创建数据存储引用',
  20223. 'Multi Instance': '多实例',
  20224. 'Loop Cardinality': '实例数量',
  20225. Collection: '任务参与人列表',
  20226. 'Element Variable': '元素变量',
  20227. 'Completion Condition': '完成条件'
  20228. };
  20229. function customTranslate(template, replacements) {
  20230. replacements = replacements || {};
  20231. // Translate
  20232. template = translations[template] || template;
  20233. // Replace
  20234. return template.replace(/{([^}]+)}/g, function (_, key) {
  20235. return replacements[key] || '{' + key + '}';
  20236. });
  20237. }
  20238. var vjson$l = {
  20239. title: '导入流程',
  20240. layout: 'fit',
  20241. width: 400,
  20242. height: 400,
  20243. items: [
  20244. {
  20245. layout: 'border',
  20246. items: [
  20247. {
  20248. xtype: 'form',
  20249. items: [
  20250. // {
  20251. // xtype: 'cols',
  20252. // items: [
  20253. // {
  20254. // xtype: 'textfield',
  20255. // allowBlank: false,
  20256. // fieldLabel: '流程名称',
  20257. // bind: '{name}'
  20258. // },
  20259. // ],
  20260. // },
  20261. {
  20262. xtype: 'cols',
  20263. items: [
  20264. {
  20265. xtype: 'filefield',
  20266. name: 'deployFile',
  20267. fieldLabel: '文件名称',
  20268. // labelWidth: '100%',
  20269. msgTarget: 'side',
  20270. reference: 'MOBANB_FILE',
  20271. fileUpload: true,
  20272. allowBlank: false,
  20273. // flex: 1,
  20274. // width: '100%',
  20275. buttonText: '请选择文件位置',
  20276. listeners: {
  20277. change: 'scope.fileChange'
  20278. }
  20279. // bind: '{FILE}'
  20280. },
  20281. ]
  20282. }
  20283. ],
  20284. region: 'center',
  20285. split: true,
  20286. },
  20287. ],
  20288. },
  20289. ],
  20290. fbar: {
  20291. xtype: 'toolbar',
  20292. items: [
  20293. {
  20294. xtype: 'button',
  20295. text: '保存',
  20296. iconCls: 'x-fa fa-save',
  20297. listeners: {
  20298. click: 'scope.save',
  20299. },
  20300. }
  20301. ],
  20302. },
  20303. };
  20304. var model$l = {
  20305. data: {
  20306. name: '',
  20307. file_content: ''
  20308. }
  20309. };
  20310. var ImportBpmn = /** @class */ (function (_super) {
  20311. __extends(ImportBpmn, _super);
  20312. function ImportBpmn() {
  20313. return _super.call(this, { model: model$l, vjson: vjson$l }) || this;
  20314. }
  20315. ImportBpmn.prototype.onLoad = function () {
  20316. };
  20317. ImportBpmn.prototype.save = function (sender) {
  20318. if (this.data.file_content) {
  20319. this.dialogSuccess(this.data);
  20320. }
  20321. else {
  20322. Ext.Msg.alert('提示', "请先上传文件");
  20323. }
  20324. };
  20325. ImportBpmn.prototype.fileChange = function (e) {
  20326. var _this = this;
  20327. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  20328. var file = e.fileInputEl.dom.files[0]; //获取文件
  20329. var reader = new FileReader();
  20330. reader.readAsText(file, "UTF-8");
  20331. reader.onload = function () {
  20332. _this.data.file_content = reader.result;
  20333. };
  20334. };
  20335. return ImportBpmn;
  20336. }(Scope));
  20337. var model$m = {
  20338. data: {
  20339. form_id: '',
  20340. form_name: '',
  20341. save_dir_path: '',
  20342. absolute_path: '',
  20343. form: {
  20344. id: '',
  20345. code: '',
  20346. name: '',
  20347. table: '',
  20348. controller: '',
  20349. groovy: '',
  20350. fields: [],
  20351. buttons: [],
  20352. },
  20353. }
  20354. };
  20355. var vjson$m = {
  20356. title: '配置适配策略',
  20357. layout: 'fit',
  20358. items: [
  20359. {
  20360. layout: 'border',
  20361. items: [
  20362. {
  20363. region: 'center',
  20364. xtype: 'yvgrid',
  20365. pagination: false,
  20366. hideFootbar: true,
  20367. plugins: {
  20368. clipboard: true,
  20369. selectionreplicator: true
  20370. },
  20371. tbar: {
  20372. xtype: 'toolbar',
  20373. items: [
  20374. {
  20375. xtype: 'button',
  20376. text: '添加策略',
  20377. iconCls: 'x-fa fa-plus-circle',
  20378. listeners: {
  20379. click: 'scope.addStrategy'
  20380. }
  20381. },
  20382. {
  20383. xtype: 'button',
  20384. text: '删除',
  20385. iconCls: 'x-fa fa-minus-circle',
  20386. listeners: {}
  20387. },
  20388. '-',
  20389. {
  20390. xtype: 'button',
  20391. text: '上移',
  20392. iconCls: 'x-fa fa-arrow-up',
  20393. listeners: {}
  20394. },
  20395. {
  20396. xtype: 'button',
  20397. text: '下移',
  20398. iconCls: 'x-fa fa-arrow-down',
  20399. listeners: {}
  20400. },
  20401. ]
  20402. },
  20403. columns: [
  20404. { xtype: 'rownumberer' },
  20405. {
  20406. header: '优先级',
  20407. dataIndex: 'priority',
  20408. width: 140,
  20409. sortable: false,
  20410. menuDisabled: true,
  20411. editor: {
  20412. selectOnFocus: true
  20413. },
  20414. },
  20415. {
  20416. header: '策略编号',
  20417. dataIndex: 'strategy_code',
  20418. width: 140,
  20419. sortable: false,
  20420. menuDisabled: true,
  20421. editor: {
  20422. selectOnFocus: true
  20423. },
  20424. },
  20425. {
  20426. header: '策略名称',
  20427. dataIndex: 'strategy_name',
  20428. width: 140,
  20429. sortable: false,
  20430. menuDisabled: true,
  20431. editor: {
  20432. selectOnFocus: true
  20433. },
  20434. },
  20435. {
  20436. header: "条件表达式",
  20437. dataIndex: "strategy_exp",
  20438. },
  20439. ],
  20440. },
  20441. {
  20442. title: '适配条件',
  20443. region: 'south',
  20444. height: '50%',
  20445. xtype: 'form',
  20446. items: [
  20447. {
  20448. xtype: 'cols',
  20449. items: [
  20450. {
  20451. xtype: 'rows',
  20452. items: [
  20453. {
  20454. xtype: 'textfield',
  20455. fieldLabel: "仓库",
  20456. },
  20457. {
  20458. xtype: 'textfield',
  20459. fieldLabel: "货主",
  20460. },
  20461. {
  20462. xtype: 'textfield',
  20463. fieldLabel: "项目",
  20464. },
  20465. {
  20466. xtype: 'textfield',
  20467. fieldLabel: "行政区划",
  20468. },
  20469. {
  20470. xtype: 'textfield',
  20471. fieldLabel: "客户",
  20472. },
  20473. {
  20474. xtype: 'textfield',
  20475. fieldLabel: "商品",
  20476. }
  20477. ]
  20478. },
  20479. {
  20480. xtype: 'rows',
  20481. margin: '8 0 0 10',
  20482. items: [
  20483. {
  20484. xtype: 'label',
  20485. html: '自定义表达式',
  20486. },
  20487. {
  20488. xtype: 'textarea',
  20489. }
  20490. ]
  20491. }
  20492. ]
  20493. }
  20494. ]
  20495. }
  20496. ]
  20497. }
  20498. ]
  20499. };
  20500. //
  20501. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  20502. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  20503. // import ReportRunner from "./ReportRunner";
  20504. var ConfigStrategy = /** @class */ (function (_super) {
  20505. __extends(ConfigStrategy, _super);
  20506. function ConfigStrategy() {
  20507. return _super.call(this, { model: model$m, vjson: vjson$m }) || this;
  20508. }
  20509. ConfigStrategy.prototype.onLoad = function () {
  20510. this.load();
  20511. };
  20512. ConfigStrategy.prototype.load = function () {
  20513. var _this = this;
  20514. var form_id = this.viewModel.get("form_id");
  20515. var absolute_path = this.viewModel.get("absolute_path");
  20516. var save_dir_path = this.viewModel.get("save_dir_path");
  20517. if (absolute_path && form_id) {
  20518. this.setLoading(true);
  20519. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  20520. if (res.success) {
  20521. // 基础属性
  20522. _this.viewModel.set('form', res.data.form);
  20523. // 字段定义
  20524. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  20525. // 按钮
  20526. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  20527. }
  20528. }).finally(function () {
  20529. _this.setLoading(false);
  20530. });
  20531. }
  20532. };
  20533. ConfigStrategy.prototype.saveAll = function () {
  20534. var _this = this;
  20535. var save_dir_path = this.viewModel.get("save_dir_path");
  20536. if (!save_dir_path) {
  20537. msg("save_dir_path error");
  20538. return;
  20539. }
  20540. var form_id = this.viewModel.get("form_id");
  20541. var absolute_path = this.viewModel.get("absolute_path");
  20542. // 表格校验
  20543. if (!this.refs.form1.isValid()) {
  20544. msg("请检查表单必填项!");
  20545. return;
  20546. }
  20547. // 字段数据
  20548. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  20549. delete item.id;
  20550. if (item.hide) {
  20551. delete item.hide_text;
  20552. }
  20553. else {
  20554. item.hide = item.hide_text;
  20555. delete item.hide_text;
  20556. }
  20557. if (item.readonly) {
  20558. delete item.readonly_text;
  20559. }
  20560. else {
  20561. item.readonly = item.readonly_text;
  20562. delete item.readonly_text;
  20563. }
  20564. if (item.disabled) {
  20565. delete item.disabled_text;
  20566. }
  20567. else {
  20568. item.disabled = item.disabled_text;
  20569. delete item.disabled_text;
  20570. }
  20571. if (item.required) {
  20572. delete item.required_text;
  20573. }
  20574. else {
  20575. item.required = item.required_text;
  20576. delete item.required_text;
  20577. }
  20578. return item;
  20579. });
  20580. this.viewModel.set("form.fields", gridColumnRows);
  20581. // 按钮数据
  20582. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  20583. delete item.id;
  20584. return item;
  20585. });
  20586. this.viewModel.set("form.buttons", gridBtnRows);
  20587. // 查询条件
  20588. // 策略
  20589. var form = this.viewModel.get("form");
  20590. this.setLoading(true);
  20591. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  20592. if (res.success) {
  20593. msg('保存成功');
  20594. handles$1.mainWindow.refs['exporerTree'].reload();
  20595. }
  20596. }).finally(function () {
  20597. _this.setLoading(false);
  20598. });
  20599. };
  20600. ConfigStrategy.prototype.addColumn = function () {
  20601. this.refs.gridColumn.getStore().add({});
  20602. };
  20603. ConfigStrategy.prototype.removeColumn = function () {
  20604. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  20605. };
  20606. ConfigStrategy.prototype.calcColumn = function (sender) {
  20607. var _this = this;
  20608. var table = this.viewModel.get("form.table");
  20609. if (!table) {
  20610. msg("表名不存在!");
  20611. return;
  20612. }
  20613. this.setLoading(true);
  20614. calcColumnForm({ table: table }).then(function (res) {
  20615. if (res.success) {
  20616. msg(res.msg);
  20617. if (res.data.columns.length > 0) {
  20618. _$2.forEach(res.data.columns, function (it) {
  20619. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  20620. });
  20621. }
  20622. }
  20623. }).finally(function () {
  20624. _this.setLoading(false);
  20625. });
  20626. };
  20627. ConfigStrategy.prototype.addButton = function () {
  20628. this.refs.gridButton.getStore().add({});
  20629. };
  20630. ConfigStrategy.prototype.moveUp = function (sender) {
  20631. var grid = sender.up('grid');
  20632. grid.rowMoveUp();
  20633. };
  20634. ConfigStrategy.prototype.moveDown = function (sender) {
  20635. var grid = sender.up('grid');
  20636. grid.rowMoveDown();
  20637. };
  20638. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  20639. var win = new Ext.Window({
  20640. autoDestroy: true,
  20641. title: "添加(编辑)策略",
  20642. width: 400,
  20643. height: 300,
  20644. resizable: true,
  20645. closable: true,
  20646. maximizable: true,
  20647. minimizable: true,
  20648. plain: true,
  20649. // constrainHeader: true,
  20650. constrain: true,
  20651. layout: 'fit',
  20652. animateTarget: sender,
  20653. buttonAlign: 'center',
  20654. items: [
  20655. {
  20656. xtype: "form",
  20657. layout: "hbox",
  20658. margin: '10px 20px',
  20659. border: 0,
  20660. items: [
  20661. {
  20662. flex: 1,
  20663. layout: 'vbox',
  20664. items: [
  20665. {
  20666. xtype: "numberfield",
  20667. fieldLabel: "优先级",
  20668. flex: 1,
  20669. allowBlank: false,
  20670. labelWidth: 50,
  20671. width: "100%",
  20672. },
  20673. {
  20674. xtype: "textfield",
  20675. fieldLabel: "策略名称",
  20676. flex: 1,
  20677. allowBlank: false,
  20678. labelWidth: 50,
  20679. width: "100%",
  20680. },
  20681. {
  20682. xtype: "textfield",
  20683. fieldLabel: "策略编号",
  20684. flex: 1,
  20685. allowBlank: false,
  20686. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  20687. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  20688. labelWidth: 50,
  20689. width: "100%",
  20690. },
  20691. {
  20692. xtype: "textfield",
  20693. fieldLabel: "仓库ID",
  20694. flex: 1,
  20695. allowBlank: false,
  20696. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  20697. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  20698. labelWidth: 50,
  20699. width: "100%",
  20700. },
  20701. ]
  20702. },
  20703. ]
  20704. }
  20705. ],
  20706. //窗口按钮
  20707. buttons: [
  20708. {
  20709. xtype: 'button', text: '保存', handler: function (btn) {
  20710. //窗口获取表单
  20711. var form = win.down('form');
  20712. var vaildSuccess = form.isValid();
  20713. if (!vaildSuccess) {
  20714. return;
  20715. }
  20716. var filename = form.down('textfield[name="filename"]').getValue();
  20717. }
  20718. },
  20719. {
  20720. xtype: 'button', text: '取消', handler: function (btn) {
  20721. //窗口关闭
  20722. win.close();
  20723. }
  20724. }
  20725. ]
  20726. });
  20727. win.show();
  20728. };
  20729. return ConfigStrategy;
  20730. }(Scope));
  20731. var buildVjson = function () {
  20732. return {
  20733. bind: {
  20734. title: '流程编辑-{text}',
  20735. },
  20736. layout: 'fit',
  20737. items: [{
  20738. layout: 'border',
  20739. tbar: {
  20740. xtype: 'toolbar',
  20741. items: [
  20742. {
  20743. xtype: 'button',
  20744. text: '撤销',
  20745. listeners: {
  20746. click: "scope.undo"
  20747. }
  20748. },
  20749. {
  20750. xtype: 'button',
  20751. text: '还原',
  20752. listeners: {
  20753. click: "scope.redo"
  20754. }
  20755. },
  20756. {
  20757. xtype: 'button',
  20758. text: '保存',
  20759. listeners: {
  20760. click: "scope.save"
  20761. }
  20762. },
  20763. {
  20764. xtype: 'button',
  20765. text: '导入BPM',
  20766. listeners: {
  20767. click: "scope.importBpm"
  20768. }
  20769. },
  20770. {
  20771. xtype: 'button',
  20772. text: '配置适配策略',
  20773. listeners: {
  20774. click: "scope.configStrategy"
  20775. }
  20776. },
  20777. {
  20778. fieldLabel: '选择配置分支',
  20779. xtype: 'combogrid',
  20780. },
  20781. ]
  20782. },
  20783. items: [
  20784. {
  20785. xtype: "panel",
  20786. region: 'center',
  20787. reference: "bpmn_view",
  20788. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  20789. },
  20790. {
  20791. split: true,
  20792. xtype: "panel",
  20793. region: 'east',
  20794. width: '30%',
  20795. reference: "bpmn_properties",
  20796. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  20797. }
  20798. ],
  20799. }],
  20800. listeners: {
  20801. afterrender: 'scope.onViewRender'
  20802. }
  20803. };
  20804. };
  20805. var BpmnDesign = /** @class */ (function (_super) {
  20806. __extends(BpmnDesign, _super);
  20807. function BpmnDesign() {
  20808. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  20809. _this.bpmnModeler = null;
  20810. _this.bpmnModelerName = "";
  20811. return _this;
  20812. }
  20813. BpmnDesign.prototype.onLoad = function () {
  20814. var _this = this;
  20815. _super.prototype.onLoad.call(this);
  20816. this.setLoading(true);
  20817. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  20818. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  20819. if (res && res.success && res.data && res.data.bpmn) {
  20820. var diagramXML = res.data.bpmn;
  20821. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  20822. var elements = _this.bpmnModeler._definitions.rootElements;
  20823. if (Array.isArray(elements) && elements.length > 0) {
  20824. elements[0].name = _this.bpmnModelerName;
  20825. }
  20826. }).catch(function (err) {
  20827. msgError(err);
  20828. });
  20829. }
  20830. else {
  20831. msgError(res.msg);
  20832. }
  20833. }).finally(function () {
  20834. _this.setLoading(false);
  20835. });
  20836. };
  20837. BpmnDesign.prototype.onViewRender = function (sender) {
  20838. var customTranslateModule = {
  20839. translate: ['value', customTranslate]
  20840. };
  20841. this.bpmnModeler = new BpmnModeler({
  20842. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  20843. propertiesPanel: {
  20844. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  20845. },
  20846. additionalModules: [
  20847. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  20848. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  20849. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  20850. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  20851. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  20852. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  20853. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  20854. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  20855. customTranslateModule,
  20856. ],
  20857. moddleExtensions: {
  20858. camunda: camundaModdleDescriptor
  20859. },
  20860. keyboard: { bindTo: document } // 使用键盘快捷键
  20861. });
  20862. };
  20863. //开启快捷键
  20864. //modeler.get('keyboard').bind(document);
  20865. //关闭快捷键
  20866. //modeler.get('keyboard').unbind();
  20867. BpmnDesign.prototype.undo = function (sender) {
  20868. this.bpmnModeler.get('commandStack').undo();
  20869. };
  20870. BpmnDesign.prototype.redo = function (sender) {
  20871. this.bpmnModeler.get('commandStack').redo();
  20872. };
  20873. BpmnDesign.prototype.save = function (sender) {
  20874. var _this = this;
  20875. this.setLoading(true);
  20876. this.bpmnModeler.saveXML().then(function (resBpm) {
  20877. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  20878. if (res.success) {
  20879. msg$1("保存成功");
  20880. }
  20881. else {
  20882. msgError(res.msg);
  20883. }
  20884. }).catch(function (e) {
  20885. var _a, _b;
  20886. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  20887. msgError(msg);
  20888. }).finally(function () {
  20889. _this.setLoading(false);
  20890. });
  20891. }).catch(function (e) {
  20892. msgError(e);
  20893. _this.setLoading(false);
  20894. });
  20895. };
  20896. BpmnDesign.prototype.importBpm = function (sender) {
  20897. var _this = this;
  20898. var dlg = new ImportBpmn();
  20899. //@ts-ignore
  20900. dlg.success = function (sen, data) {
  20901. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  20902. var elements = _this.bpmnModeler._definitions.rootElements;
  20903. if (Array.isArray(elements) && elements.length > 0) {
  20904. elements[0].name = _this.bpmnModelerName;
  20905. }
  20906. }).catch(function (err) {
  20907. msgError(err);
  20908. });
  20909. };
  20910. dlg.showDialog(sender, {}, {});
  20911. // this.bpmnModeler.importXML()
  20912. };
  20913. BpmnDesign.prototype.configStrategy = function (sender) {
  20914. var configStrategy = new ConfigStrategy();
  20915. configStrategy.showDialog(sender, {}, {});
  20916. };
  20917. return BpmnDesign;
  20918. }(Scope));
  20919. var model$n = {
  20920. data: {
  20921. id: '',
  20922. path: '',
  20923. form: {
  20924. title: '',
  20925. sqlId: '',
  20926. }
  20927. }
  20928. };
  20929. var vjson$n = {
  20930. bind: {
  20931. title: '{title}',
  20932. },
  20933. layout: 'fit',
  20934. items: [
  20935. {
  20936. layout: 'border',
  20937. items: [
  20938. {
  20939. region: 'center',
  20940. reference: 'editor',
  20941. border: true,
  20942. // html: '<div class="geEditor"></div>',
  20943. // listeners: {
  20944. // afterrender: 'scope.editorInit'
  20945. // }
  20946. html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
  20947. listeners: {
  20948. afterrender: 'scope.iframeRender'
  20949. }
  20950. },
  20951. ]
  20952. }
  20953. ]
  20954. }; //
  20955. //
  20956. var WidgetDesign$1 = /** @class */ (function (_super) {
  20957. __extends(WidgetDesign, _super);
  20958. function WidgetDesign(layoutCode, layoutName) {
  20959. var _this = _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  20960. _this.layoutCode = layoutCode;
  20961. _this.layoutName = layoutName;
  20962. return _this;
  20963. }
  20964. WidgetDesign.prototype.onLoad = function () {
  20965. this.viewModel.set('layoutCode', this.layoutCode);
  20966. this.viewModel.set('layoutName', this.layoutName);
  20967. if (this.layoutCode) {
  20968. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  20969. }
  20970. else {
  20971. this.viewModel.set('title', '新建图纸');
  20972. }
  20973. };
  20974. WidgetDesign.prototype.reload = function () {
  20975. var _this = this;
  20976. this.setLoading(true);
  20977. loadWhLayout({
  20978. layoutCode: this.layoutCode,
  20979. layoutName: this.layoutName,
  20980. }).then(function (res) {
  20981. if (res.success) {
  20982. var xml = res.data.layoutContent;
  20983. var doc = _this.mxUtils.parseXml(xml);
  20984. var graph = _this.editorUi.editor.graph;
  20985. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  20986. }
  20987. }).finally(function () {
  20988. _this.setLoading(false);
  20989. });
  20990. };
  20991. WidgetDesign.prototype.editorInit = function (sender) {
  20992. var that = this;
  20993. var dom = $(sender.el.dom).find('.geEditor')[0];
  20994. //@ts-ignore
  20995. require(['mxgraph'], function () {
  20996. var editorUiInit = EditorUi.prototype.init;
  20997. EditorUi.prototype.init = function () {
  20998. editorUiInit.apply(this, arguments);
  20999. this.actions.get('save').funct = that.onFileSave.bind(that);
  21000. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  21001. this.actions.get('open').visible = false;
  21002. this.actions.get('new').visible = false;
  21003. this.actions.get('preview').visible = false;
  21004. this.actions.get('print').visible = false;
  21005. this.actions.get('pageSetup').visible = false;
  21006. this.actions.get('help').visible = false;
  21007. this.actions.get('export').visible = false;
  21008. this.actions.get('about').visible = false;
  21009. this.menus.menus.help.setEnabled(false);
  21010. that.editorUi = this;
  21011. if (that.layoutCode) {
  21012. that.reload();
  21013. }
  21014. };
  21015. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  21016. var mxLanguage = 'zh';
  21017. mxResources.loadDefaultBundle = false;
  21018. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  21019. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  21020. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  21021. // Fixes possible asynchronous requests
  21022. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  21023. // Adds bundle text to resources
  21024. mxResources.parse(xhr[0].getText());
  21025. // Configures the default graph theme
  21026. var themes = new Object();
  21027. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  21028. // Main
  21029. new EditorUi(new Editor(false, themes), dom);
  21030. }, function () {
  21031. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  21032. });
  21033. });
  21034. };
  21035. WidgetDesign.prototype.iframeRender = function (sender) {
  21036. var that = this;
  21037. var iframe = $(sender.el.dom).find('iframe')[0];
  21038. iframe.contentWindow['designer'] = that;
  21039. iframe.contentWindow['editorInitFn'] = function (editorUi) {
  21040. editorUi.actions.get('save').funct = that.onFileSave.bind(that);
  21041. editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  21042. editorUi.actions.get('open').visible = false;
  21043. editorUi.actions.get('new').visible = false;
  21044. editorUi.actions.get('preview').visible = false;
  21045. editorUi.actions.get('print').visible = false;
  21046. editorUi.actions.get('pageSetup').visible = false;
  21047. editorUi.actions.get('help').visible = false;
  21048. editorUi.actions.get('export').visible = false;
  21049. editorUi.actions.get('about').visible = false;
  21050. editorUi.menus.menus.help.setEnabled(false);
  21051. that.editorUi = editorUi;
  21052. that.mxUtils = iframe.contentWindow['mxUtils'];
  21053. if (that.layoutCode) {
  21054. that.reload();
  21055. }
  21056. };
  21057. };
  21058. WidgetDesign.prototype.onDestroy = function () {
  21059. var _a;
  21060. try {
  21061. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  21062. }
  21063. catch (e) {
  21064. }
  21065. };
  21066. WidgetDesign.prototype.onFileSaveAs = function () {
  21067. var _this = this;
  21068. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  21069. .then(function (_a) {
  21070. var code = _a.code, name = _a.name;
  21071. _this.layoutCode = code;
  21072. _this.layoutName = name;
  21073. _this.onSave();
  21074. });
  21075. };
  21076. WidgetDesign.prototype.onSave = function () {
  21077. var _this = this;
  21078. var layoutContent = this.editorUi.getEditBlankXml();
  21079. var layoutCode = this.layoutCode;
  21080. var layoutName = this.layoutName;
  21081. if (!layoutCode || !layoutName) {
  21082. msg$1('图形编号和图形名称必填');
  21083. return;
  21084. }
  21085. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  21086. this.setLoading(true);
  21087. saveWhLayout({
  21088. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  21089. }).then(function (res) {
  21090. msg$1(res.msg);
  21091. handles$1.whLayout.reload();
  21092. }).finally(function () {
  21093. _this.setLoading(false);
  21094. });
  21095. };
  21096. WidgetDesign.prototype.onFileSave = function () {
  21097. if (!this.layoutCode || !this.layoutName) {
  21098. this.onFileSaveAs();
  21099. }
  21100. else {
  21101. this.onSave();
  21102. }
  21103. };
  21104. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  21105. var code = _a.code, name = _a.name;
  21106. return new Promise(function (resolve, reject) {
  21107. var viewModel = new Ext.app.ViewModel({
  21108. data: {
  21109. code: code !== null && code !== void 0 ? code : '',
  21110. name: name !== null && name !== void 0 ? name : '',
  21111. }
  21112. });
  21113. var dlg = Ext.create('Ext.window.Window', {
  21114. title: '保存',
  21115. viewModel: viewModel,
  21116. layout: {
  21117. type: "vbox",
  21118. pack: "start",
  21119. align: "stretch"
  21120. },
  21121. items: [
  21122. {
  21123. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  21124. bind: '{code}'
  21125. },
  21126. {
  21127. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  21128. bind: '{name}'
  21129. }
  21130. ],
  21131. fbar: [
  21132. {
  21133. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  21134. click: function () {
  21135. var code = viewModel.get('code');
  21136. var name = viewModel.get('name');
  21137. resolve({ code: code, name: name });
  21138. dlg.close();
  21139. }
  21140. }
  21141. },
  21142. {
  21143. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  21144. click: function () {
  21145. dlg.close();
  21146. }
  21147. }
  21148. },
  21149. ]
  21150. });
  21151. dlg.show();
  21152. });
  21153. };
  21154. return WidgetDesign;
  21155. }(Scope));
  21156. // init()
  21157. var Workbench = /** @class */ (function (_super) {
  21158. __extends(Workbench, _super);
  21159. // activeModulePage: ModulePage = null
  21160. function Workbench() {
  21161. var _this = _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  21162. _this.name = "MainWindow";
  21163. _this.modules = [];
  21164. _this.yvgridDesign = null;
  21165. return _this;
  21166. }
  21167. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  21168. if (newCard) {
  21169. this.viewModel.set('leftTabTitle', newCard.tooltip);
  21170. }
  21171. else {
  21172. this.viewModel.set('leftTabTitle', '未选中');
  21173. }
  21174. };
  21175. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  21176. get: function () {
  21177. var _a;
  21178. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  21179. },
  21180. enumerable: true,
  21181. configurable: true
  21182. });
  21183. Workbench.prototype.documentKeydown = function (event) {
  21184. if (event.ctrlKey || event.metaKey) {
  21185. if (event.key.toLowerCase() === 's') {
  21186. eventBus.publish(EventType.SaveCall, {});
  21187. event.stopPropagation();
  21188. event.preventDefault();
  21189. }
  21190. else if (event.key.toLowerCase() === 'z') {
  21191. if (event.shiftKey) {
  21192. eventBus.publish(EventType.Redo, {});
  21193. event.stopPropagation();
  21194. event.preventDefault();
  21195. }
  21196. else {
  21197. eventBus.publish(EventType.Undo, {});
  21198. event.stopPropagation();
  21199. event.preventDefault();
  21200. }
  21201. }
  21202. }
  21203. };
  21204. Workbench.prototype.onLoad = function () {
  21205. var _this = this;
  21206. window["tt"] = this.refs['tt'];
  21207. window["vm"] = this.viewModel;
  21208. $('#loading').remove();
  21209. setMainWindow(this);
  21210. setStatusbar(this.down('statusbar'));
  21211. document.addEventListener('keydown', this.documentKeydown.bind(this));
  21212. var currentProject = getCurrentProject();
  21213. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  21214. // handles.fileTree.reload()
  21215. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  21216. _this.showModule(rawData);
  21217. });
  21218. eventBus.subscribe(EventType.Undo, function () {
  21219. _this.onUndo();
  21220. });
  21221. eventBus.subscribe(EventType.Redo, function () {
  21222. _this.onRedo();
  21223. });
  21224. eventBus.subscribe(EventType.Cut, function (_a) {
  21225. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21226. _this.onCut(a, b, c, d);
  21227. });
  21228. eventBus.subscribe(EventType.Copy, function (_a) {
  21229. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21230. _this.onCopy(a, b, c, d);
  21231. });
  21232. eventBus.subscribe(EventType.Paste, function (_a) {
  21233. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  21234. _this.onPaste(a, b, c, d);
  21235. });
  21236. eventBus.subscribe(EventType.SelectAll, function () {
  21237. _this.onSelectAll();
  21238. });
  21239. eventBus.subscribe(EventType.SelectAll, function () {
  21240. _this.onSelectAll();
  21241. });
  21242. eventBus.subscribe(EventType.RunCheckModule, function () {
  21243. _this.runCheckModule();
  21244. });
  21245. eventBus.subscribe(EventType.StopCheckModule, function () {
  21246. _this.stopCheckModule();
  21247. });
  21248. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  21249. _this.onCompoentContextMenu(args);
  21250. });
  21251. this.runCheckModule();
  21252. };
  21253. Workbench.prototype.onCompoentContextMenu = function (args) {
  21254. var _this = this;
  21255. if (!this.yvgridDesign) {
  21256. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  21257. this.yvgridDesign.showDialog(null, {}, {});
  21258. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  21259. this.yvgridDesign.onDestroy = function () {
  21260. fn_1();
  21261. _this.yvgridDesign = null;
  21262. };
  21263. }
  21264. };
  21265. Workbench.prototype.runCheckModule = function () {
  21266. var _this = this;
  21267. if (this.checkTimer) {
  21268. return;
  21269. }
  21270. this.checkTimer = setInterval(function () {
  21271. var _a;
  21272. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  21273. _this.activeModulePage.check();
  21274. }
  21275. }, 5000);
  21276. };
  21277. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  21278. var dlg = new WidgetDesign(widgetPath, widgetName);
  21279. dlg.showPage({
  21280. id: 'widget_' + widgetPath,
  21281. path: 'widget_' + widgetPath,
  21282. }, {
  21283. data: {
  21284. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  21285. }
  21286. });
  21287. dlg.dialogSuccess = successCallback;
  21288. };
  21289. Workbench.prototype.stopCheckModule = function () {
  21290. clearInterval(this.checkTimer);
  21291. this.checkTimer = null;
  21292. };
  21293. Workbench.prototype.showDataSync = function () {
  21294. var ins = new DbSync();
  21295. ins.showPage({
  21296. id: 'db_sync__',
  21297. path: 'db_sync__',
  21298. }, {
  21299. data: {}
  21300. });
  21301. };
  21302. /**
  21303. * 打开一个项目
  21304. */
  21305. Workbench.prototype.openProject = function (project) {
  21306. setCurrentProject(project);
  21307. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  21308. handles$1.fileTree.reload();
  21309. };
  21310. /**
  21311. * 打开模板开发面板
  21312. */
  21313. Workbench.prototype.showTemplateDev = function () {
  21314. var ins = new TemplateDev();
  21315. ins.showPage({
  21316. id: 'template_dev__',
  21317. path: 'template_dev__',
  21318. }, {
  21319. data: {}
  21320. });
  21321. };
  21322. Workbench.prototype.openScope = function () {
  21323. };
  21324. /**
  21325. * 显示字段域管理器
  21326. */
  21327. Workbench.prototype.showColumnDomain = function () {
  21328. var instance = new DbDomain();
  21329. instance.showPage({
  21330. id: 'domain__',
  21331. path: 'domain__',
  21332. }, {
  21333. data: {}
  21334. });
  21335. };
  21336. /**
  21337. * 显示性能统计
  21338. */
  21339. Workbench.prototype.showPerform = function () {
  21340. // const instance = new PerformStats()
  21341. // instance.showPage({
  21342. // id: 'perform__',
  21343. // path: 'perform__',
  21344. //
  21345. // }, {
  21346. // data: {}
  21347. // })
  21348. };
  21349. /**
  21350. * 显示数据库代码模板库
  21351. */
  21352. Workbench.prototype.showDbCodeTemplate = function () {
  21353. // const instance = new DbCodeTemplate()
  21354. // instance.showPage({
  21355. // id: 'dbcode__',
  21356. // path: 'dbcode__',
  21357. //
  21358. // }, {
  21359. // data: {}
  21360. // })
  21361. };
  21362. /**
  21363. * 显示数据库代码模板库
  21364. */
  21365. Workbench.prototype.showReport = function (report_id, report_name, success) {
  21366. var instance = new ReportDesign();
  21367. instance.showPage({
  21368. id: 'report_' + report_id,
  21369. path: 'report_' + report_id,
  21370. }, {
  21371. data: {
  21372. report_id: report_id,
  21373. report_name: report_name,
  21374. }
  21375. });
  21376. instance.dialogSuccess = success;
  21377. };
  21378. /**
  21379. * 显示报表
  21380. */
  21381. Workbench.prototype.showReportPreview = function (report_id, instance) {
  21382. instance.showPage({
  21383. id: 'REPORT__' + report_id,
  21384. path: 'REPORT__' + report_id,
  21385. }, {
  21386. data: {
  21387. report_id: report_id,
  21388. }
  21389. });
  21390. var reportName = instance.viewModel.get('report_name');
  21391. instance.viewModel.set('report_name', '[预览]-' + reportName);
  21392. };
  21393. /**
  21394. * 显示运维页面
  21395. */
  21396. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  21397. // const instance = new DevOpsTerminal()
  21398. // instance.showPage({
  21399. // id: 'ops_' + opsId,
  21400. // path: 'ops_' + opsId,
  21401. //
  21402. // }, {
  21403. // data: {
  21404. // opsId: opsId,
  21405. // name: name,
  21406. // }
  21407. // })
  21408. // instance.dialogSuccess = success
  21409. };
  21410. /**
  21411. * 显示表结构
  21412. * tableName 为空的情况就是新建表,否则就是要编辑的表
  21413. * columnName 可以为空
  21414. */
  21415. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  21416. var id = 'tableColumn_' + tableName;
  21417. var isCreateTable = false;
  21418. // /ROOT/schema$public/schema$public$bas_location_group_rel
  21419. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  21420. if (!tableName) {
  21421. id = _$2.uniqueId('new_table');
  21422. tableName = id;
  21423. isCreateTable = true;
  21424. }
  21425. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  21426. instance.showPage({
  21427. id: id,
  21428. path: id,
  21429. locatPath: locatPath
  21430. }, {
  21431. data: {
  21432. tableName: tableName,
  21433. columnName: columnName
  21434. }
  21435. });
  21436. };
  21437. /**
  21438. * 打开某个模块
  21439. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  21440. */
  21441. Workbench.prototype.showModule = function (rawData) {
  21442. var id = rawData.id, path = rawData.path;
  21443. var separator = '/';
  21444. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  21445. var module = this.modules[idx];
  21446. var pageId = path.replaceAll('/', '_');
  21447. console.log('open module', module);
  21448. var instance = new ModulePage(id, module);
  21449. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  21450. instance.showPage({
  21451. id: 'module_' + pageId,
  21452. path: path,
  21453. title: module.name
  21454. }, {
  21455. data: {}
  21456. });
  21457. };
  21458. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  21459. var bpmnDesign = new BpmnDesign();
  21460. bpmnDesign.showPage({}, {
  21461. data: {
  21462. absolutePath: absolutePath,
  21463. id: id,
  21464. text: text
  21465. }
  21466. });
  21467. };
  21468. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  21469. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  21470. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  21471. layoutDesign.showPage({
  21472. id: id,
  21473. path: id,
  21474. }, {
  21475. data: {}
  21476. });
  21477. };
  21478. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  21479. var _a;
  21480. // this.activeModulePage = newCard.yvanScope
  21481. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  21482. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  21483. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  21484. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  21485. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  21486. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  21487. eventBus.publish(EventType.MainTabChange, {
  21488. moduleId: newCard.yvanScope.moduleId,
  21489. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  21490. from: this.name
  21491. });
  21492. };
  21493. Workbench.prototype.onUndo = function () {
  21494. var _a;
  21495. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  21496. };
  21497. Workbench.prototype.onRedo = function () {
  21498. var _a;
  21499. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  21500. };
  21501. Workbench.prototype.onCut = function (a, b, c, d) {
  21502. var _a;
  21503. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  21504. };
  21505. Workbench.prototype.onCopy = function (a, b, c, d) {
  21506. var _a;
  21507. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  21508. };
  21509. Workbench.prototype.onPaste = function (a, b, c, d) {
  21510. var _a;
  21511. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  21512. };
  21513. Workbench.prototype.onSelectAll = function () {
  21514. var _a;
  21515. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  21516. };
  21517. return Workbench;
  21518. }(Scope));
  21519. (function (FuncDomain) {
  21520. FuncDomain["SCOPE"] = "scope";
  21521. FuncDomain["SYSTEM"] = "system";
  21522. })(exports.FuncDomain || (exports.FuncDomain = {}));
  21523. (function (BizMode) {
  21524. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  21525. BizMode[BizMode["query"] = 1] = "query";
  21526. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  21527. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  21528. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  21529. })(exports.BizMode || (exports.BizMode = {}));
  21530. (function (BizFormat) {
  21531. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  21532. BizFormat[BizFormat["button"] = 1] = "button";
  21533. BizFormat[BizFormat["progress"] = 2] = "progress";
  21534. BizFormat[BizFormat["date"] = 3] = "date";
  21535. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  21536. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  21537. })(exports.BizFormat || (exports.BizFormat = {}));
  21538. (function (BizUnique) {
  21539. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  21540. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  21541. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  21542. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  21543. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  21544. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  21545. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  21546. })(exports.BizUnique || (exports.BizUnique = {}));
  21547. var ScopeEngine = /** @class */ (function () {
  21548. function ScopeEngine() {
  21549. }
  21550. ScopeEngine.getBizFile = function (director) {
  21551. return new Promise(function (resolve, reject) {
  21552. debugger;
  21553. });
  21554. };
  21555. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  21556. return new Promise(function (resolve, reject) {
  21557. var requireArr = [];
  21558. var requireKeyArr = [];
  21559. _$2.forOwn(billFile.domains, function (v, k) {
  21560. requireArr.push(v.domain);
  21561. requireKeyArr.push(k);
  21562. if (v.layout) {
  21563. requireArr.push(v.layout);
  21564. requireKeyArr.push(k + "_layout");
  21565. }
  21566. });
  21567. requireArr.push(billFile.layout);
  21568. requireKeyArr.push("layout");
  21569. requireArr.push(billFile.converter);
  21570. requireKeyArr.push("converter");
  21571. // @ts-ignore
  21572. require(requireArr, function () {
  21573. var requireReArr = [];
  21574. for (var _i = 0; _i < arguments.length; _i++) {
  21575. requireReArr[_i] = arguments[_i];
  21576. }
  21577. if (requireReArr.length <= 0) {
  21578. reject(new Error("没有加载到相关的文件!"));
  21579. }
  21580. var domains = {};
  21581. for (var i = 0; i < requireReArr.length - 2; i++) {
  21582. if (requireKeyArr[i].endsWith("_layout")) {
  21583. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  21584. domains[key_d].layout = requireReArr[i].default;
  21585. }
  21586. else {
  21587. domains[requireKeyArr[i]] = requireReArr[i].default;
  21588. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  21589. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  21590. }
  21591. }
  21592. var bizFile = {
  21593. bill: billFile,
  21594. domains: domains,
  21595. layout: requireReArr[requireReArr.length - 2].default,
  21596. converter: requireReArr[requireReArr.length - 1].default,
  21597. };
  21598. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  21599. scope.billSetting = bizFile;
  21600. resolve(scope);
  21601. });
  21602. });
  21603. };
  21604. ScopeEngine.buildScopeFromPath = function (path) {
  21605. return new Promise(function (resolve, reject) {
  21606. // @ts-ignore
  21607. require([path], function (bill) {
  21608. bill = bill.default;
  21609. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  21610. resolve(scope);
  21611. }).catch(function (e) {
  21612. reject(e);
  21613. });
  21614. });
  21615. });
  21616. };
  21617. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  21618. var controller = {};
  21619. var vjson = {
  21620. layout: 'fit',
  21621. title: bizFile.bill.name,
  21622. items: []
  21623. };
  21624. var model = {};
  21625. if (bizFile.layout.layout === "fit") {
  21626. vjson.items = bizFile.layout.items;
  21627. }
  21628. else if (bizFile.layout.layout === "border") {
  21629. vjson.items = [bizFile.layout];
  21630. }
  21631. var domainsVjson = {};
  21632. _$2.forOwn(bizFile.domains, function (v, k) {
  21633. var domainVjson = null;
  21634. var buttons = bizFile.domains[k].buttons;
  21635. if (bizFile.bill.domains[k].mode === "form") {
  21636. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  21637. if (Array.isArray(buttons) && buttons.length > 0) {
  21638. if (bizFile.bill.domains[k].type === "header") {
  21639. vjson.tbar = {
  21640. xtype: 'toolbar',
  21641. items: ScopeEngine.buildButton(controller, buttons)
  21642. };
  21643. }
  21644. else {
  21645. domainVjson.items.push({
  21646. xtype: "cols",
  21647. items: ScopeEngine.buildButton(controller, buttons)
  21648. });
  21649. }
  21650. }
  21651. }
  21652. else if (bizFile.bill.domains[k].mode === "table") {
  21653. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  21654. if (Array.isArray(buttons) && buttons.length > 0) {
  21655. if (bizFile.bill.domains[k].type === "header") {
  21656. vjson.tbar = {
  21657. xtype: 'toolbar',
  21658. items: ScopeEngine.buildButton(controller, buttons)
  21659. };
  21660. }
  21661. else {
  21662. domainVjson.tbar = {
  21663. xtype: 'toolbar',
  21664. items: ScopeEngine.buildButton(controller, buttons)
  21665. };
  21666. }
  21667. }
  21668. }
  21669. if (domainVjson) {
  21670. domainsVjson[k] = domainVjson;
  21671. }
  21672. });
  21673. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  21674. var scope = new Scope({ model: model, vjson: vjson });
  21675. scope['bill_define'] = bizFile;
  21676. _$2.merge(scope, controller);
  21677. console.log('bill_define', vjson, scope, scope['bill_define']);
  21678. return scope;
  21679. };
  21680. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  21681. var fieldGroups = {};
  21682. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  21683. var field = bizFile.domains[domainKey].fields[i];
  21684. var item = { sort: field.form_sort };
  21685. item.xtype = field.xtype;
  21686. item.fieldLabel = field.column_desc;
  21687. item.bind = {
  21688. value: "{" + domainKey + "." + field.column_name + "}",
  21689. };
  21690. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  21691. // if (field.disabled !== "true" && field.disabled !== "false") {
  21692. // item.bind.disabled = eval(field.disabled)
  21693. // } else {
  21694. // item.disabled = (field.disabled === "true")
  21695. // }
  21696. // if (field.readonly !== "true" && field.readonly !== "false") {
  21697. // item.bind.disabled = eval(field.readonly)
  21698. // } else {
  21699. // item.readonly = (field.readonly === "true")
  21700. // }
  21701. // if (field.required !== "true" && field.required !== "false") {
  21702. // item.bind.required = eval(field.required)
  21703. // } else {
  21704. // item.required = (field.required === "true")
  21705. // }
  21706. // if (field.hide !== "true" && field.hide !== "false") {
  21707. // item.bind.hidden = eval(field.hide)
  21708. // } else {
  21709. // item.hidden = (field.hide === "true")
  21710. // }
  21711. // item.flex = field.
  21712. if (field.dict) {
  21713. item.fix = eval(field.dict);
  21714. }
  21715. // _.set(formModel, "", "")
  21716. item.field = field;
  21717. if (field.form_group) {
  21718. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  21719. fieldGroups[field.form_group] = [item];
  21720. }
  21721. else {
  21722. fieldGroups[field.form_group].push(item);
  21723. }
  21724. }
  21725. }
  21726. var formVjson = {
  21727. xtype: "form",
  21728. title: bizFile.domains[domainKey].name,
  21729. items: []
  21730. };
  21731. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  21732. var items = ScopeEngine.buildFieldSet(fieldGroup);
  21733. if (items) {
  21734. var fieldsetVjson = {
  21735. xtype: "fieldset",
  21736. title: k,
  21737. items: items
  21738. };
  21739. formVjson.items.push(fieldsetVjson);
  21740. }
  21741. });
  21742. return formVjson;
  21743. };
  21744. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  21745. // const vjson = { xtype: "grid", items: []}
  21746. var gridVjson = {
  21747. xtype: "yvgrid",
  21748. columns: [],
  21749. split: true,
  21750. reference: domainKey,
  21751. listeners: {
  21752. itemdblclick: function () {
  21753. },
  21754. },
  21755. };
  21756. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  21757. var field = bizFile.domains[domainKey].fields[i];
  21758. gridVjson.columns.push({
  21759. dataIndex: field.column_name,
  21760. header: field.column_desc,
  21761. });
  21762. }
  21763. return gridVjson;
  21764. };
  21765. ScopeEngine.buildFieldSet = function (fieldGroup) {
  21766. var colGroups = [{
  21767. xtype: "cols",
  21768. items: []
  21769. }];
  21770. var colGroup = colGroups[0];
  21771. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  21772. for (var i = 0; i < fieldGroup.length; i++) {
  21773. var field = fieldGroup[i];
  21774. if (field.field.form_newline === "true") {
  21775. if (colGroup.items.length > 0) {
  21776. colGroup = {
  21777. xtype: "cols",
  21778. items: [field]
  21779. };
  21780. colGroups.push(colGroup);
  21781. }
  21782. }
  21783. else {
  21784. colGroup.items.push(field);
  21785. }
  21786. delete field.field;
  21787. }
  21788. return colGroups;
  21789. };
  21790. ScopeEngine.buildButton = function (controller, buttons) {
  21791. var buttonsVjson = [];
  21792. var _loop_1 = function (i) {
  21793. var item = buttons[i];
  21794. var button = {
  21795. xtype: "button",
  21796. text: item.btn_name,
  21797. iconCls: item.icon
  21798. };
  21799. if (item.hidden === "true" || item.hidden === "false") {
  21800. button.hidden = (item.hidden === "true");
  21801. }
  21802. if (item.listeners) {
  21803. var listeners_1 = {};
  21804. _$2.forOwn(item.listeners, function (v, k) {
  21805. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  21806. listeners_1[k] = v;
  21807. }
  21808. else {
  21809. try {
  21810. listeners_1[k] = eval(v);
  21811. }
  21812. catch (e) {
  21813. throw e;
  21814. }
  21815. }
  21816. });
  21817. button.listeners = listeners_1;
  21818. }
  21819. buttonsVjson.push(button);
  21820. };
  21821. for (var i = 0; i < buttons.length; i++) {
  21822. _loop_1(i);
  21823. }
  21824. return buttonsVjson;
  21825. };
  21826. ScopeEngine.buildListeners = function (controller, item) {
  21827. if (!item.hasOwnProperty("listeners")) {
  21828. return;
  21829. }
  21830. _$2.forOwn(item.listeners, function (v, k) {
  21831. if (v && typeof v === "string") {
  21832. if (v.indexOf(".") > -1) {
  21833. var strArr = v.split(".");
  21834. if (strArr.length != 2) {
  21835. console.error(item.listeners, "语法解析错误,请检查!");
  21836. }
  21837. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  21838. switch (funcDomain) {
  21839. case exports.FuncDomain.SCOPE:
  21840. controller[k] = findCustFunc(item, k);
  21841. break;
  21842. case exports.FuncDomain.SYSTEM:
  21843. break;
  21844. default:
  21845. throw new Error("错误的函数域定义");
  21846. }
  21847. }
  21848. else {
  21849. var func = eval(v);
  21850. if (typeof func === 'function') {
  21851. controller[k] = func;
  21852. }
  21853. throw new Error("解析自定义函数出错");
  21854. }
  21855. }
  21856. });
  21857. var findCustFunc = function (item, funcName) {
  21858. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  21859. throw new Error("没有找到相关的函数定义");
  21860. }
  21861. var func = eval(item[funcName]);
  21862. if (typeof func === 'function') {
  21863. return func;
  21864. }
  21865. throw new Error("解析自定义函数出错");
  21866. };
  21867. };
  21868. /**
  21869. * 只检索 items 的模式,深度遍历 vjson
  21870. */
  21871. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  21872. if (Array.isArray(vjson)) {
  21873. for (var i = 0; i < vjson.length; i++) {
  21874. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  21875. }
  21876. }
  21877. else {
  21878. _$2.forOwn(vjson, function (v, k) {
  21879. if (k !== "domain") {
  21880. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  21881. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  21882. }
  21883. }
  21884. else {
  21885. delete vjson.domain;
  21886. _$2.merge(vjson, domainsVjson[v]);
  21887. }
  21888. });
  21889. }
  21890. };
  21891. return ScopeEngine;
  21892. }());
  21893. function initComponent () {
  21894. var ct = Ext.Component.prototype.constructor;
  21895. Ext.Component.override({
  21896. constructor: function (config) {
  21897. var _a, _b;
  21898. if (!isDesignMode(this, config)) {
  21899. var me_1 = this;
  21900. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  21901. _$2.each(baseConfigProcessList, function (process) {
  21902. process.call(me_1, me_1, config);
  21903. });
  21904. }
  21905. if (config) {
  21906. if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
  21907. config.i18nPath = config.$initParent.i18nPath;
  21908. }
  21909. if ((_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.setTitle) {
  21910. var setTitle_1 = config.$initParent.setTitle;
  21911. var handel_1 = config.$initParent;
  21912. config.$initParent.setTitle = function (title) {
  21913. var t = { title: title };
  21914. var WMSTranslate = window["WMSTranslate"];
  21915. if (WMSTranslate) {
  21916. if (typeof window['viewTranslate'] === 'function') {
  21917. window['viewTranslate'](t, title, "title");
  21918. }
  21919. }
  21920. setTitle_1.call(handel_1, t.title);
  21921. }.bind(config.$initParent);
  21922. }
  21923. var WMSTranslate = window["WMSTranslate"];
  21924. if (WMSTranslate) {
  21925. if (typeof window['viewTranslate'] === 'function') {
  21926. window['viewTranslate'](config, config.text, "text");
  21927. window['viewTranslate'](config, config.title, "title");
  21928. window['viewTranslate'](config, config.header, "header");
  21929. window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
  21930. window['viewTranslate'](config, config.emptyText, "emptyText");
  21931. }
  21932. }
  21933. }
  21934. ct.call(this, config);
  21935. }
  21936. });
  21937. var _initComponent = Ext.picker.Date.prototype.initComponent;
  21938. Ext.picker.Date.override({
  21939. initComponent: function () {
  21940. var me = this;
  21941. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  21942. _initComponent.call(me);
  21943. },
  21944. selectToday: function () {
  21945. var me = this, btn = me.todayBtn, handler = me.handler;
  21946. if (btn && !btn.disabled) {
  21947. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  21948. me.fireEvent('select', me, me.value);
  21949. if (handler) {
  21950. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  21951. }
  21952. me.onSelect();
  21953. }
  21954. return me;
  21955. },
  21956. });
  21957. }
  21958. function initMainTab () {
  21959. Ext.define('Yvan.MainTab', {
  21960. extend: 'Ext.tab.Panel',
  21961. xtype: 'maintab',
  21962. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  21963. closeTabText: '关闭',
  21964. closeOthersTabsText: '关闭其他',
  21965. closeAllTabsText: '关闭所有'
  21966. }),
  21967. constructor: function (config) {
  21968. var me = this;
  21969. var newConfig = _$2.defaultsDeep({
  21970. // 强制属性
  21971. }, config);
  21972. this.superclass.constructor.call(me, newConfig);
  21973. },
  21974. initComponent: function () {
  21975. var me = this;
  21976. this.on({
  21977. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  21978. _$2.defer(function () {
  21979. me.changeHash(newCard.id);
  21980. window['cp'] = newCard.yvanScope;
  21981. });
  21982. $$2(window).trigger('tabChange', {
  21983. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  21984. });
  21985. },
  21986. afterrender: function () {
  21987. _$2.defer(function () {
  21988. me.tryRestoryPage();
  21989. });
  21990. }
  21991. });
  21992. this.superclass.initComponent.call(me);
  21993. },
  21994. tryRestoryPage: function () {
  21995. var me = this;
  21996. var hash = '' + window.location.hash;
  21997. if (hash && hash.indexOf('page=') > 0) {
  21998. if (hash.startsWith('#')) {
  21999. hash = hash.substr(1);
  22000. }
  22001. if (hash) {
  22002. var page = Qs.parse(hash).page;
  22003. if (page) {
  22004. // this.openScope(page)
  22005. me.fireEvent('restorypage', page);
  22006. }
  22007. }
  22008. }
  22009. },
  22010. changeHash: function (id) {
  22011. window.location.hash = Qs.stringify({ page: id });
  22012. },
  22013. /**
  22014. * 添加一个业务模块实例到选项卡
  22015. * @param scopeInstance 业务对象实例
  22016. * @param config ExtJS配置对象
  22017. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  22018. */
  22019. addScope: function (scopeInstance, config, panelInitCallback) {
  22020. scopeInstance.topScope = scopeInstance;
  22021. var me = this;
  22022. if (config.path) {
  22023. for (var i = 0; i < this.items.items.length; i++) {
  22024. // 找到当前 tabs 里有没有已经打开过
  22025. var tab = this.items.items[i];
  22026. if (_$2.isEqual(tab.path, config.path)) {
  22027. // 激活
  22028. this.setActiveTab(tab);
  22029. return tab;
  22030. }
  22031. }
  22032. }
  22033. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  22034. if (typeof panelInitCallback === 'function') {
  22035. panelInitCallback(newPanel);
  22036. }
  22037. // 添加业务模块
  22038. var newTab = this.add(newPanel);
  22039. this.setActiveTab(newTab);
  22040. newTab.on({
  22041. destroy: function (sender) {
  22042. me.changeHash('');
  22043. delete window['cp'];
  22044. }
  22045. });
  22046. return newTab;
  22047. }
  22048. });
  22049. }
  22050. /**
  22051. * 构建所有组件的公共属性
  22052. * @param config 原始config
  22053. * @param dragType 组件模式
  22054. * 不填,代表不能在设计时被拖拽
  22055. * row-container 是一个rows容器
  22056. * col-container 是一个cols容器
  22057. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  22058. * row-item rows中的一行,比如 tree / grid / panel 等等
  22059. */
  22060. function baseConfig(config, dragType) {
  22061. // if (isDesignMode(config, undefined) && dragType) {
  22062. if (typeof config === 'object') {
  22063. var cc = '';
  22064. switch (dragType) {
  22065. case "cols-container":
  22066. cc = 'design_cols_container';
  22067. break;
  22068. case "col-item":
  22069. cc = 'design_col_item';
  22070. break;
  22071. case "rows-container":
  22072. cc = 'design_rows_container';
  22073. break;
  22074. case "row-item":
  22075. cc = 'design_row_item';
  22076. break;
  22077. }
  22078. if (typeof config.cls === 'string') {
  22079. _$2.extend(config, {
  22080. cls: [config.cls, 'yvan_design', cc]
  22081. });
  22082. }
  22083. else if (_$2.isArray(config.cls)) {
  22084. _$2.extend(config, {
  22085. cls: __spread(config.cls, ['yvan_design', cc])
  22086. });
  22087. }
  22088. else {
  22089. _$2.extend(config, {
  22090. cls: ['yvan_design', cc]
  22091. });
  22092. }
  22093. }
  22094. return config;
  22095. }
  22096. function initPanel () {
  22097. /**
  22098. *
  22099. */
  22100. var ct = Ext.panel.Panel.prototype.constructor;
  22101. Ext.panel.Panel.override({
  22102. constructor: function (config) {
  22103. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  22104. ct.call(this, newConfig);
  22105. }
  22106. });
  22107. var ss = Ext.form.FieldContainer.prototype;
  22108. Ext.form.FieldContainer.override({
  22109. config: __assign({}, fieldContainer)
  22110. });
  22111. }
  22112. function initGridColumn () {
  22113. var ct = Ext.grid.column.Column.prototype.constructor;
  22114. Ext.grid.column.Column.override({
  22115. constructor: function (config) {
  22116. var scope = lookupScope(config.$initParent.$initParent);
  22117. var newConfig = _$2.defaults({}, config, column);
  22118. if (typeof newConfig.summaryRenderer === 'string') {
  22119. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  22120. if (typeof newConfig.summaryRenderer === 'function') {
  22121. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  22122. }
  22123. }
  22124. if (config.formatter === 'datetime') {
  22125. newConfig.fix = ['system.formatDate()'];
  22126. delete newConfig.formatter;
  22127. }
  22128. // 在 grid.constructor 已经转换过了
  22129. // if (typeof newConfig.renderer === 'string') {
  22130. // newConfig.renderer = lookupFn(scope, config.renderer)
  22131. // if (typeof newConfig.renderer === 'function') {
  22132. // newConfig.renderer = newConfig.renderer.bind(scope)
  22133. // }
  22134. // }
  22135. ct.call(this, newConfig);
  22136. }
  22137. });
  22138. var ctAction = Ext.grid.column.Action.prototype.constructor;
  22139. Ext.grid.column.Action.override({
  22140. constructor: function (config) {
  22141. var scope = lookupScope(config.$initParent.$initParent);
  22142. _$2.forEach(config.items, function (item) {
  22143. if (typeof item.handler === 'string') {
  22144. item.handler = lookupFn(scope, item.handler);
  22145. if (typeof item.handler === 'function') {
  22146. item.handler = item.handler.bind(scope);
  22147. }
  22148. }
  22149. });
  22150. ctAction.call(this, config);
  22151. }
  22152. });
  22153. var ck = Ext.grid.column.Check.prototype.constructor;
  22154. Ext.grid.column.Check.override({
  22155. constructor: function (config) {
  22156. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  22157. var grid = sender.view.grid.ownerGrid;
  22158. var column = grid.getColumns()[sender.fullColumnIndex];
  22159. var context = {
  22160. event: e,
  22161. column: column,
  22162. field: sender.dataIndex,
  22163. value: checked,
  22164. record: record,
  22165. rowIdx: rowIndex
  22166. };
  22167. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  22168. });
  22169. ck.call(this, config);
  22170. }
  22171. });
  22172. // 227573
  22173. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  22174. // Ext.define('Yvan.ColumnOverride', {
  22175. // override: 'Ext.grid.column.Column',
  22176. //
  22177. // config: {
  22178. // enableSortOnClick: false,
  22179. // },
  22180. //
  22181. // // /**@Overrides*/
  22182. // onTitleElClick: function (e, t, sortOnClick) {
  22183. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  22184. // if (!$(e.target).is('.x-column-header-trigger')) {
  22185. // // 不是点击菜单的情况下,让列自适应宽度
  22186. // this.autoSize()
  22187. // }
  22188. // return onTitleElClick.call(this, e, t, false)
  22189. // }
  22190. // });
  22191. }
  22192. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  22193. /**
  22194. * 判断目标字符串与关键字是否重叠
  22195. * @param target 目标字符串
  22196. * @param keyword 搜索关键字
  22197. */
  22198. function pinyinMatch(target, keyword) {
  22199. if (typeof target != 'string' || typeof keyword != 'string') {
  22200. return false;
  22201. }
  22202. if (!keyword || !target) {
  22203. return false;
  22204. }
  22205. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  22206. keyword = _$2.toLower(keyword);
  22207. var pos1 = _$2.toLower(target).indexOf(keyword);
  22208. if (pos1 >= 0) {
  22209. return true;
  22210. }
  22211. var len = _$2.intersection(keyword.split('')).length;
  22212. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  22213. return true;
  22214. }
  22215. return false;
  22216. }
  22217. /**
  22218. * 对某个表达式进行求值
  22219. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  22220. *
  22221. * @example
  22222. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  22223. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  22224. *
  22225. * @param data 数据环境对象
  22226. * @param express 表达式对象
  22227. */
  22228. function calcExpress(data, express) {
  22229. var result = express;
  22230. if (SIMPLE_RE.test(express)) {
  22231. // '{foo}' 简单表达式
  22232. var path = express.substring(1, express.length - 1);
  22233. var ret = _$2.get(data, path);
  22234. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  22235. }
  22236. while (true) {
  22237. var mlist = result.match(/{(.*?)}/);
  22238. if (!mlist) {
  22239. break;
  22240. }
  22241. var pathC = mlist[0]; // {query.a}
  22242. var path = mlist[1]; // query.a
  22243. var value = _$2.get(data, path);
  22244. result = result.replaceAll(pathC, value || '');
  22245. }
  22246. return result;
  22247. }
  22248. /**
  22249. * 对个对象进行表达式求值,不用回调
  22250. * @example
  22251. * 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}'] })
  22252. *
  22253. * {
  22254. * a: '{query.a}',
  22255. * b: {
  22256. * b1: '{query.b1}',
  22257. * b2: '{query.b2}',
  22258. * },
  22259. * c: 'aa',
  22260. * d: [
  22261. * '{query.d1}',
  22262. * '{query.d2}'
  22263. * ]
  22264. * }
  22265. *
  22266. * 计算结果为
  22267. * {
  22268. * a: 'aValue',
  22269. * b: {
  22270. * b1: 'b1Value',
  22271. * b2: 'b2Value'
  22272. * },
  22273. * c: 'aa'
  22274. * d: [
  22275. * '1',
  22276. * '2'
  22277. * ]
  22278. * }
  22279. *
  22280. * @param data
  22281. * @param paramObject
  22282. */
  22283. function calcObjectFlat(data, paramObject) {
  22284. var result = _$2.cloneDeep(paramObject);
  22285. if (typeof paramObject === 'string') {
  22286. return calcExpress(data, paramObject);
  22287. }
  22288. var trav = function (param) {
  22289. _$2.forOwn(param, function (value, key) {
  22290. if (_$2.isPlainObject(value)) {
  22291. // 深度递归,对子对象进行求解
  22292. trav(value);
  22293. }
  22294. else if (_$2.isString(value)) {
  22295. // 字符串直接用 calcExpress 表达式求解
  22296. param[key] = calcExpress(data, param[key]);
  22297. }
  22298. else if (_$2.isArray(value)) {
  22299. // 数组求解
  22300. _$2.each(value, function (v, idx) {
  22301. value[idx] = calcExpress(data, v);
  22302. });
  22303. }
  22304. });
  22305. };
  22306. trav(result);
  22307. return result;
  22308. }
  22309. /**
  22310. * 合併 data 到當前的 ViewModel 對象
  22311. */
  22312. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  22313. var newRow = {};
  22314. if (isFlat == false) {
  22315. newRow = data;
  22316. }
  22317. else {
  22318. flatObject(newRow, '', data);
  22319. }
  22320. if (!propertyName) {
  22321. _$2.forOwn(newRow, function (value, key) {
  22322. viewModel.set(key, value);
  22323. });
  22324. }
  22325. else {
  22326. _$2.forOwn(newRow, function (value, key) {
  22327. viewModel.set(propertyName + "." + key, value);
  22328. });
  22329. }
  22330. }
  22331. /**
  22332. * 转换内联结构的行,到平面结构
  22333. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  22334. *
  22335. * @param array
  22336. * @param flatOption
  22337. * @return {[]}
  22338. */
  22339. function flatRow(array) {
  22340. var ret = [];
  22341. _$2.forEach(array, function (row) {
  22342. var newRow = {};
  22343. flatObject(newRow, '', row);
  22344. ret.push(newRow);
  22345. });
  22346. return ret;
  22347. }
  22348. function flatObject(parentObj, parentProp, obj) {
  22349. _$2.forOwn(obj, function (value, key) {
  22350. var fullKey = parentProp ? parentProp + '_' + key : key;
  22351. if (_$2.isArray(value)) {
  22352. parentObj[fullKey] = _$2.map(value, function (row) {
  22353. var newRow = {};
  22354. flatObject(newRow, '', row);
  22355. return newRow;
  22356. });
  22357. }
  22358. else {
  22359. if (typeof value === 'object') {
  22360. flatObject(parentObj, fullKey, value);
  22361. }
  22362. else {
  22363. parentObj[fullKey] = value;
  22364. }
  22365. }
  22366. });
  22367. }
  22368. /**
  22369. * 替换内部结构中,所有 N/A
  22370. */
  22371. function replaceNA(obj) {
  22372. if (obj === 'N/A') {
  22373. return '';
  22374. }
  22375. if (_$2.isArray(obj)) {
  22376. _$2.forEach(obj, function (value, idx) {
  22377. if (value === 'N/A') {
  22378. obj[idx] = '';
  22379. }
  22380. else {
  22381. if (typeof value === "string" && /^-?\d*\.\d+$/.test(value)) {
  22382. var count = 0;
  22383. for (var i = value.length - 1; i > 0; i--) {
  22384. if (value[i] === "0" || value[i] === ".") {
  22385. count++;
  22386. }
  22387. else {
  22388. break;
  22389. }
  22390. }
  22391. obj[idx] = value.substr(0, value.length - count);
  22392. }
  22393. else {
  22394. replaceNA(value);
  22395. }
  22396. }
  22397. });
  22398. }
  22399. else if (_$2.isPlainObject(obj)) {
  22400. _$2.forOwn(obj, function (value, key) {
  22401. if (value === 'N/A') {
  22402. obj[key] = '';
  22403. }
  22404. else {
  22405. if (typeof value === "string" && /^-?\d*\.\d+$/.test(value)) {
  22406. var count = 0;
  22407. for (var i = value.length - 1; i > 0; i--) {
  22408. if (value[i] === "0" || value[i] === ".") {
  22409. count++;
  22410. }
  22411. else {
  22412. break;
  22413. }
  22414. }
  22415. obj[key] = value.substr(0, value.length - count);
  22416. }
  22417. else {
  22418. replaceNA(value);
  22419. }
  22420. }
  22421. });
  22422. }
  22423. }
  22424. function deepTravJson(obj, resolver) {
  22425. if (_$2.isArray(obj)) {
  22426. _$2.forEach(obj, function (value, idx) {
  22427. if (typeof value === 'string') {
  22428. resolver(obj, value, idx);
  22429. }
  22430. else {
  22431. deepTravJson(value, resolver);
  22432. }
  22433. });
  22434. }
  22435. else if (_$2.isPlainObject(obj)) {
  22436. _$2.forOwn(obj, function (value, key) {
  22437. if (typeof value === 'string') {
  22438. resolver(obj, value, key);
  22439. }
  22440. else {
  22441. deepTravJson(value, resolver);
  22442. }
  22443. });
  22444. }
  22445. }
  22446. /**
  22447. * 根据表达式进入写值
  22448. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  22449. * express="test-{query.a}" 写值就会失败
  22450. *
  22451. * @example
  22452. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  22453. * 写值成功
  22454. *
  22455. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  22456. * 写值失败
  22457. *
  22458. * @param viewModel VM对象
  22459. * @param express 表达式对象
  22460. * @param value 目标值
  22461. */
  22462. function tryWriteByExpress(viewModel, express, value) {
  22463. if (SIMPLE_RE.test(express)) {
  22464. // '{foo}' 简单表达式
  22465. express = express.substring(1, express.length - 1);
  22466. viewModel.set(express, value);
  22467. }
  22468. }
  22469. /**
  22470. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  22471. * @example
  22472. * 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]})
  22473. *
  22474. * expressObject:
  22475. * {
  22476. * a: '{query.a}',
  22477. * b: {
  22478. * b1: '{query.b1}',
  22479. * b2: '{query.b2}',
  22480. * },
  22481. * c: 'aa',
  22482. * d: [
  22483. * '{query.a}',
  22484. * '{query.b2}'
  22485. * ]
  22486. * }
  22487. *
  22488. * valueObject:
  22489. * {
  22490. * a: 'aValue',
  22491. * b: {
  22492. * b1: 'b1Value',
  22493. * b2: 'b2Value'
  22494. * },
  22495. * c: 'aa'
  22496. * c: [
  22497. * 'aValue',
  22498. * 'b2Value'
  22499. * ]
  22500. * }
  22501. *
  22502. * 系统会尝试回写
  22503. * viewModel.set('query.a', 'aValue')
  22504. * viewModel.set('query.b1', 'b1Value')
  22505. * viewModel.set('query.b2', 'b2Value')
  22506. *
  22507. * @param expressObject 含表达式的对象
  22508. * @param valueObject 表达式计算完成之后的结果对象
  22509. * @param writeFn 写入的方法 (path, value)=>void
  22510. */
  22511. function tryWriteObject(expressObject, valueObject, writeFn) {
  22512. var trav = function (pathPrefix) {
  22513. var parent = expressObject;
  22514. if (_$2.size(pathPrefix) > 1) {
  22515. parent = _$2.get(parent, pathPrefix.substring(1));
  22516. }
  22517. _$2.forOwn(parent, function (value, key) {
  22518. if (_$2.isPlainObject(value)) {
  22519. // 深度递归,对子对象进行求解
  22520. trav(pathPrefix + "." + key);
  22521. }
  22522. else if (_$2.isString(value)) {
  22523. // 字符串直接用 calcExpress 表达式求解
  22524. if (SIMPLE_RE.test(value)) {
  22525. // If we have '{foo}' alone it is a literal 简单表达式
  22526. var targetPath = value.substring(1, value.length - 1);
  22527. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  22528. if (!writeFn) {
  22529. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  22530. }
  22531. else {
  22532. writeFn(targetPath, targetValue);
  22533. }
  22534. }
  22535. }
  22536. else if (_$2.isArray(value)) {
  22537. _$2.each(value, function (v, idx) {
  22538. if (SIMPLE_RE.test(v)) {
  22539. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  22540. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  22541. if (!writeFn) {
  22542. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  22543. }
  22544. else {
  22545. writeFn(targetPath, targetValue);
  22546. }
  22547. }
  22548. });
  22549. }
  22550. });
  22551. };
  22552. trav("");
  22553. }
  22554. /**
  22555. * 尝试去掉变量两边括号
  22556. * {a} => a
  22557. * a => a
  22558. */
  22559. function tryVarSimple(value) {
  22560. if (SIMPLE_RE.test(value)) {
  22561. // If we have '{foo}' alone it is a literal 简单表达式
  22562. return value.substring(1, value.length - 1);
  22563. }
  22564. return value;
  22565. }
  22566. /**
  22567. * 对多个表达式进行求值. 异步回调的方式返回
  22568. * {
  22569. * a: 1,
  22570. * b: '{someBind}',
  22571. * c: ['a', 'b', 'c'],
  22572. * d: ['a', 'b', '{someBind}'],
  22573. * e: {
  22574. * y: 1,
  22575. * z: 2
  22576. * },
  22577. * f: {
  22578. * y: 1,
  22579. * z: '{someBind}'
  22580. * }
  22581. * }
  22582. *
  22583. * // Will produce
  22584. * {
  22585. * b: value,
  22586. * d: ['a', 'b', value],
  22587. * f: {
  22588. * y: 1,
  22589. * z: value
  22590. * }
  22591. * }
  22592. * @param viewModel scope.viewModel对象
  22593. * @param paramObject 求值对象
  22594. */
  22595. function calcObject(viewModel, paramObject) {
  22596. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  22597. return new Promise(function (resolve) {
  22598. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  22599. schedule.destroy();
  22600. // 从 Ext.data.Model 对象转换为 js-object 对象
  22601. ret = toPlainObject(ret);
  22602. resolve(ret);
  22603. }, viewModel, { single: true });
  22604. });
  22605. }
  22606. /**
  22607. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  22608. * @param config 组件构造函数传入的 config 配置文件
  22609. */
  22610. function getParentGrid(config) {
  22611. var _a;
  22612. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  22613. }
  22614. /**
  22615. * 解析
  22616. * {
  22617. * condition: "{skuId}",
  22618. * errorMsg: "无法编辑",
  22619. * notice: 'msg'
  22620. * }
  22621. */
  22622. function tryEnable(data, enableSetting) {
  22623. if (!enableSetting) {
  22624. // 没有这一段配置,可以编辑
  22625. return true;
  22626. }
  22627. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  22628. if (!evalFunction(data, condition)) {
  22629. // 没有达成 condition 条件
  22630. // 计算 msg 消息内容
  22631. var msgContent = calcExpress(data, errorMsg);
  22632. if (msgContent) {
  22633. if (!notice || notice === 'msg') {
  22634. // 进行提示
  22635. msg$1(msgContent);
  22636. }
  22637. }
  22638. return false;
  22639. }
  22640. return true;
  22641. }
  22642. /**
  22643. * 动态的为 combo 或 columns.combo 设置下拉框的值
  22644. * @param sender 目标对象
  22645. * @param config 目标对象的配置(在构造函数之前也可以)
  22646. * @param getDictFn 获取字典的方法
  22647. * @param bizKey 传入字典的参数
  22648. * @param multiValueSeparator 多个字典值的分割符号
  22649. */
  22650. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  22651. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  22652. // sender 和 config为空的时候获取值、
  22653. if (_$2.isArray(getDictFn)) {
  22654. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  22655. var realArray_1 = getDictFn;
  22656. getDictFn = function () {
  22657. return realArray_1;
  22658. };
  22659. }
  22660. if (!sender) {
  22661. return new Promise(function (resolve, reject) {
  22662. getDictFn(bizKey, function (r) {
  22663. resolve({ config: config, r: r });
  22664. });
  22665. });
  22666. }
  22667. if (sender.xtype === 'combotree') {
  22668. getDictFn(bizKey, function (r) {
  22669. if (sender.store) {
  22670. // 异步回传
  22671. sender.setStore(new Ext.data.TreeStore({ root: r }));
  22672. }
  22673. else {
  22674. // 同步回传
  22675. config.store = new Ext.data.TreeStore({ root: r });
  22676. }
  22677. });
  22678. return;
  22679. }
  22680. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  22681. getDictFn(bizKey, function (r) {
  22682. var _a, _b;
  22683. if (sender.store) {
  22684. // 异步回传
  22685. sender.setStore(new Ext.data.Store(r));
  22686. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  22687. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  22688. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  22689. if (typeof realValue !== 'undefined') {
  22690. sender.setValue(realValue);
  22691. }
  22692. }
  22693. else {
  22694. // 同步回传
  22695. config.store = new Ext.data.Store(r);
  22696. }
  22697. });
  22698. return;
  22699. }
  22700. else if (sender.xtype === 'gridcolumn') {
  22701. var grid = getParentGrid(config);
  22702. var editor_1 = config.editor, renderer = config.renderer;
  22703. getDictFn(bizKey, function (r) {
  22704. if (sender.store) {
  22705. // 已经渲染出来了, 用方法进行修改
  22706. var editor_2 = sender.getEditor();
  22707. if (editor_2 && editor_2.xtype === 'combo') {
  22708. var valueField_1 = r.field[0];
  22709. var displayField_1 = r.field[1];
  22710. editor_2.valueField = valueField_1;
  22711. editor_2.setDisplayField(displayField_1);
  22712. editor_2.setStore(new Ext.data.Store(r));
  22713. }
  22714. if (!sender.disableListFilter) {
  22715. sender.setFilter({
  22716. type: 'list',
  22717. options: _$2.map(r.data, function (r) { return ({
  22718. id: '' + r.id,
  22719. text: r.text,
  22720. }); })
  22721. });
  22722. }
  22723. }
  22724. else {
  22725. // 没有渲染之前,修改 config 即可
  22726. if (editor_1 && editor_1.xtype === 'combo') {
  22727. // 带编辑模式
  22728. editor_1.store = new Ext.data.Store(r);
  22729. }
  22730. if (!sender.disableListFilter) {
  22731. config.filter = {
  22732. type: 'list',
  22733. options: _$2.map(r.data, function (r) { return ({
  22734. id: '' + r.id,
  22735. text: r.text,
  22736. }); })
  22737. };
  22738. }
  22739. }
  22740. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  22741. var renderer = function (value, metaData) {
  22742. if (metaData === void 0) { metaData = false; }
  22743. if (!value && value != 0) {
  22744. return '';
  22745. }
  22746. var valueField = r.field[metaData === true ? 1 : 0];
  22747. var displayField = r.field[metaData === true ? 0 : 1];
  22748. var separator = multiValueSeparator;
  22749. if (separator) {
  22750. var arr = value.split(separator);
  22751. var displayValue_1 = "";
  22752. var _loop_1 = function (i) {
  22753. var itv = arr[i];
  22754. if (i > 0) {
  22755. displayValue_1 += separator;
  22756. }
  22757. _$2.each(r.data, function (row) {
  22758. // 从 valueField 找到要显示的 displayField
  22759. if (row[valueField] == itv) {
  22760. displayValue_1 += row[displayField];
  22761. return false;
  22762. }
  22763. else {
  22764. if (i >= r.data.length - 1) {
  22765. displayValue_1 += itv;
  22766. }
  22767. }
  22768. });
  22769. };
  22770. for (var i = 0; i < arr.length; i++) {
  22771. _loop_1(i);
  22772. }
  22773. return displayValue_1;
  22774. }
  22775. _$2.each(r.data, function (row) {
  22776. // 从 valueField 找到要显示的 displayField
  22777. if (row[valueField] == value) {
  22778. value = row[displayField];
  22779. return false;
  22780. }
  22781. });
  22782. return value;
  22783. };
  22784. var dictForExcel = {};
  22785. var valueField = r.field[0];
  22786. var displayField = r.field[1];
  22787. _$2.each(r.data, function (row) {
  22788. // 从 valueField 找到要显示的 displayField
  22789. var key = row[valueField];
  22790. if (key != '' && typeof key != "undefined" && key != null) {
  22791. dictForExcel[key] = row[displayField];
  22792. }
  22793. });
  22794. if (sender.rendered) {
  22795. // 已经渲染出来了, 对列进行渲染
  22796. sender.renderer = renderer;
  22797. sender.dictForExcel = dictForExcel;
  22798. sender.getView().refresh();
  22799. }
  22800. else {
  22801. sender.renderer = renderer;
  22802. sender.dictForExcel = dictForExcel;
  22803. config.renderer = renderer;
  22804. config.dictForExcel = dictForExcel;
  22805. }
  22806. });
  22807. return;
  22808. }
  22809. throw new TypeError("无法识别的组件类型");
  22810. }
  22811. /**
  22812. * 调用服务器 Ajax
  22813. */
  22814. function invokeServer$1(url) {
  22815. var args = [];
  22816. for (var _i = 1; _i < arguments.length; _i++) {
  22817. args[_i - 1] = arguments[_i];
  22818. }
  22819. // @ts-ignore
  22820. return ajax.func({
  22821. url: url,
  22822. method: 'invoke',
  22823. args: args
  22824. });
  22825. }
  22826. function clearViewModelValues(viewModel, propertyName) {
  22827. if (!propertyName) {
  22828. var dd_1 = viewModel.getData();
  22829. _$2.forOwn(dd_1, function (value, key) {
  22830. viewModel.set(key, '');
  22831. });
  22832. return;
  22833. }
  22834. var dd = _$2.get(viewModel.getData(), propertyName);
  22835. _$2.forOwn(dd, function (value, key) {
  22836. viewModel.set(propertyName + '.' + key, '');
  22837. });
  22838. }
  22839. function reloadGrid(scope, gridRefName) {
  22840. var _a;
  22841. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  22842. }
  22843. /**
  22844. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  22845. */
  22846. function toPlainObject(obj) {
  22847. if (obj.isModel) {
  22848. obj = obj.data;
  22849. }
  22850. _$2.forOwn(obj, function (v, k) {
  22851. // Ext.data.Model.constructor
  22852. if (!v) {
  22853. return;
  22854. }
  22855. if (v.isModel) {
  22856. v = v.data;
  22857. }
  22858. if (typeof v === 'object') {
  22859. obj[k] = toPlainObject(v);
  22860. }
  22861. else {
  22862. obj[k] = v;
  22863. }
  22864. });
  22865. return obj;
  22866. }
  22867. function confirm(msg, sender) {
  22868. return new Promise(function (resolve) {
  22869. var _a, _b;
  22870. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  22871. var t = { msg: msg };
  22872. var WMSTranslate = window["WMSTranslate"];
  22873. if (WMSTranslate) {
  22874. if (typeof window['viewTranslate'] === 'function') {
  22875. window['viewTranslate'](t, msg, "msg");
  22876. }
  22877. }
  22878. var config = {
  22879. title: '请确认',
  22880. modal: true,
  22881. animateTarget: sender,
  22882. // resizable: false,
  22883. // constrainHeader: true,
  22884. // constrain: true,
  22885. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  22886. layout: {
  22887. type: 'hbox',
  22888. pack: 'start',
  22889. align: 'stretch'
  22890. },
  22891. items: [
  22892. {
  22893. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  22894. border: false,
  22895. },
  22896. {
  22897. flex: 1,
  22898. border: false,
  22899. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
  22900. }
  22901. ],
  22902. buttons: [
  22903. {
  22904. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  22905. handler: function () {
  22906. resolve();
  22907. win.close();
  22908. }
  22909. },
  22910. {
  22911. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  22912. handler: function () {
  22913. win.close();
  22914. }
  22915. }
  22916. ],
  22917. keyMapEnabled: true,
  22918. keyMap: {
  22919. ENTER: function () {
  22920. resolve();
  22921. win.close();
  22922. }
  22923. }
  22924. };
  22925. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  22926. config.constrain = true;
  22927. }
  22928. var win = new Ext.Window(config);
  22929. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  22930. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  22931. }
  22932. win.show();
  22933. });
  22934. }
  22935. /**
  22936. * 任何符号字符串都替换成下换线
  22937. */
  22938. function normId(value) {
  22939. return _$2.replace(value, /[^\w]/g, '_');
  22940. }
  22941. /**
  22942. *
  22943. * @param sender
  22944. * @param propertyName
  22945. * @param gridRefName
  22946. */
  22947. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  22948. var _a, _b;
  22949. var scope = lookupScope(sender);
  22950. clearViewModelValues(scope.viewModel, propertyName);
  22951. if (!gridRefName) {
  22952. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  22953. }
  22954. else {
  22955. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  22956. }
  22957. }
  22958. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  22959. if ([10, 13, 20, 40].includes(event.keyCode)) {
  22960. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  22961. var value = _$2.trim(sender.rawValue);
  22962. raiseClick(eOpts.handle);
  22963. }
  22964. }, 150);
  22965. function saveGridRow(grid1) {
  22966. var _a;
  22967. var config = grid1.config;
  22968. var scope = lookupScope(grid1);
  22969. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  22970. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  22971. // "表格保存"的相关配置
  22972. var dbSaveConfig = {
  22973. columns: [],
  22974. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  22975. saveRowValues: saveRowValues,
  22976. path: scope.originalVjson.__custom_path,
  22977. };
  22978. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  22979. if (err) {
  22980. // 如果有异常就不保存
  22981. return;
  22982. }
  22983. // 构建"表格保存"的相关配置
  22984. for (var i = 0; i < config.columns.length; i++) {
  22985. var c = config.columns[i];
  22986. var v = {
  22987. dataIndex: c.dataIndex,
  22988. header: c.header,
  22989. dbColumn: c.dbColumn,
  22990. serverCreateValue: c.serverCreateValue,
  22991. dbIsDeleteKey: c.dbIsDeleteKey,
  22992. dbIsUpdateKey: c.dbIsUpdateKey,
  22993. dbUpdateEnable: c.dbUpdateEnable,
  22994. serverValueConvert: c.dbUpdateEnable,
  22995. };
  22996. if (c.editor) {
  22997. v.editor = {
  22998. xtype: c.editor.xtype,
  22999. required: c.editor.required,
  23000. };
  23001. }
  23002. dbSaveConfig.columns.push(v);
  23003. }
  23004. // 进行业务上的逻辑校验
  23005. var hasError = false;
  23006. _$2.forEach(rows, function (row, i) {
  23007. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  23008. var c = config.columns[i_1];
  23009. var value = row[c.dataIndex];
  23010. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  23011. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  23012. hasError = true;
  23013. return false;
  23014. }
  23015. if (c.xtype === 'checkcolumn') {
  23016. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  23017. row[c.dataIndex] = c.uncheckedValue;
  23018. }
  23019. if (value === true && typeof c.checkedValue !== 'undefined') {
  23020. row[c.dataIndex] = c.checkedValue;
  23021. }
  23022. }
  23023. }
  23024. });
  23025. if (hasError) {
  23026. return;
  23027. }
  23028. // 设置当前界面为 "保存中..." 状态
  23029. grid1.setLoading(true);
  23030. invokeServer$1('/Dev@batchSave', {
  23031. newRows: newRows,
  23032. modifyRows: modifyRows,
  23033. removeRecords: removeRecords,
  23034. config: dbSaveConfig,
  23035. }).then(function (res) {
  23036. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  23037. msg$1(res.msg);
  23038. grid1.reload();
  23039. }).catch(function (e) {
  23040. console.error(e);
  23041. showErrorDialog$1(_$2.toString(e));
  23042. }).finally(function () {
  23043. // 无论正常异常,关闭 "保存中..." 状态
  23044. grid1.setLoading(false);
  23045. });
  23046. }
  23047. function insertGridRow(grid1) {
  23048. var config = grid1.config;
  23049. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  23050. var insertRow = {};
  23051. _$2.forEach(config.columns, function (c) {
  23052. var fn = c.createValue;
  23053. if (_$2.startsWith(fn, 'scope.') ||
  23054. _$2.startsWith(fn, 'system.')) {
  23055. var scope = lookupScope(grid1);
  23056. var fn2 = lookupFn(scope, fn, c);
  23057. if (_$2.isFunction(fn2)) {
  23058. var newValue = fn2();
  23059. if (!_$2.isUndefined(newValue)) {
  23060. insertRow[c.dataIndex] = newValue;
  23061. }
  23062. }
  23063. }
  23064. else if (_$2.isString(fn) && fn) {
  23065. insertRow[c.dataIndex] = fn;
  23066. }
  23067. });
  23068. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  23069. }
  23070. function commitMe(sender) {
  23071. var window = sender.up('window');
  23072. var scope = lookupScope(sender);
  23073. if (typeof scope['commit'] === 'function') {
  23074. scope['commit']().then(function (res) {
  23075. window.close();
  23076. });
  23077. }
  23078. }
  23079. function removeGridRow(grid1) {
  23080. var _a;
  23081. var config = grid1.config;
  23082. var rows = [];
  23083. if (grid1.selModel.selType === "rowmodel") {
  23084. rows.push(grid1.selection);
  23085. }
  23086. else {
  23087. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  23088. rows.push(r);
  23089. });
  23090. }
  23091. if (rows.length > 1) {
  23092. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  23093. if (_$2.isUndefined(batchRemoveConfirm)) {
  23094. //不需要提示
  23095. _$2.forEach(rows, function (r) {
  23096. grid1.getStore().remove(r);
  23097. });
  23098. }
  23099. else {
  23100. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  23101. confirm(tip).then(function () {
  23102. _$2.forEach(rows, function (r) {
  23103. grid1.getStore().remove(r);
  23104. });
  23105. });
  23106. }
  23107. }
  23108. else if (rows.length === 1) {
  23109. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  23110. if (_$2.isUndefined(singleRemoveConfirm)) {
  23111. //不需要提示
  23112. grid1.getStore().remove(rows[0]);
  23113. }
  23114. else {
  23115. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  23116. _$2.forEach(config.columns, function (c) {
  23117. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  23118. });
  23119. confirm(tip_1).then(function () {
  23120. grid1.getStore().remove(rows[0]);
  23121. });
  23122. }
  23123. }
  23124. else {
  23125. msg$1('请选择要删除的数据!');
  23126. }
  23127. }
  23128. function moveUpGridRow(grid) {
  23129. grid.rowMoveUp();
  23130. }
  23131. function moveDownGridRow(grid) {
  23132. grid.rowMoveDown();
  23133. }
  23134. var SystemEventFu = /** @class */ (function () {
  23135. function SystemEventFu() {
  23136. }
  23137. SystemEventFu.prototype.moveUpGridRow = function () {
  23138. return function (sender) {
  23139. var grid1 = sender.up('yvgrid');
  23140. moveUpGridRow(grid1);
  23141. };
  23142. };
  23143. SystemEventFu.prototype.commitMe = function () {
  23144. return function (sender) {
  23145. commitMe(sender);
  23146. };
  23147. };
  23148. SystemEventFu.prototype.moveDownGridRow = function () {
  23149. return function (sender) {
  23150. var grid1 = sender.up('yvgrid');
  23151. moveDownGridRow(grid1);
  23152. };
  23153. };
  23154. SystemEventFu.prototype.saveGridRow = function () {
  23155. return function (sender) {
  23156. var grid1 = sender.up('yvgrid');
  23157. saveGridRow(grid1);
  23158. };
  23159. };
  23160. SystemEventFu.prototype.insertGridRow = function () {
  23161. return function (sender) {
  23162. var grid1 = sender.up('yvgrid');
  23163. insertGridRow(grid1);
  23164. };
  23165. };
  23166. SystemEventFu.prototype.removeGridRow = function () {
  23167. return function (sender) {
  23168. var grid1 = sender.up('yvgrid');
  23169. removeGridRow(grid1);
  23170. };
  23171. };
  23172. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  23173. return function (sender, config) {
  23174. if (!config.listeners) {
  23175. config.listeners = {};
  23176. }
  23177. config.listeners.afterrender = function (sender) {
  23178. var scope = lookupScope(sender);
  23179. // $(sender.el.dom).on('keydown', (e) => {
  23180. // const xtype = Ext.fly(e.target).component.xtype
  23181. // if (xtype === 'textfield' && e.keyCode === 13) {
  23182. // Ext.defer(() => {
  23183. // raiseClick(scope.refs[btnReferenceName])
  23184. // })
  23185. // e.preventDefault()
  23186. // e.stopPropagation()
  23187. // return false
  23188. // }
  23189. // })
  23190. $(sender.el.dom).on('keyup', function (e) {
  23191. var tt = Ext.fly(e.target).component;
  23192. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  23193. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  23194. ![10, 13, 20, 40].includes(e.keyCode)) {
  23195. return;
  23196. }
  23197. e.preventDefault();
  23198. e.stopPropagation();
  23199. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  23200. return;
  23201. });
  23202. };
  23203. };
  23204. };
  23205. SystemEventFu.prototype.confirm = function (text, fn) {
  23206. return function (sender) {
  23207. var scope = lookupScope(sender);
  23208. var msg = calcExpress(scope.viewModel.data, text);
  23209. confirm(msg, sender).then(function () {
  23210. fn.call(scope, sender);
  23211. });
  23212. };
  23213. };
  23214. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  23215. return function (sender) {
  23216. var scope = lookupScope(sender);
  23217. var grid = scope.refs[gridRefName];
  23218. if (grid) {
  23219. var records = grid.getSelectionModel().getLastSelected();
  23220. grid.store.remove(records);
  23221. }
  23222. };
  23223. };
  23224. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  23225. //可以是 scope.XX / system.XX / string / lookup表达式
  23226. writeTarget) {
  23227. return function (sender) {
  23228. if (!invokeUrl) {
  23229. return;
  23230. }
  23231. var scope = lookupScope(sender);
  23232. scope.setLoading(true);
  23233. var data = scope.viewModel.data;
  23234. if (invokeParam) {
  23235. data = calcObjectFlat(data, invokeParam);
  23236. }
  23237. invokeServer$1(invokeUrl, data).then(function (res) {
  23238. if (res.success) {
  23239. if (typeof writeTarget === "string") {
  23240. _$2.forOwn(res.data, function (v, k) {
  23241. scope.viewModel.set(writeTarget + "." + k, v);
  23242. });
  23243. }
  23244. else if (typeof writeTarget === 'function') {
  23245. writeTarget.call(scope, res.data);
  23246. }
  23247. else if (typeof writeTarget === 'object') {
  23248. var ret = calcObjectFlat(res.data, writeTarget);
  23249. _$2.forOwn(ret, function (v, k) {
  23250. scope.viewModel.set(k, v);
  23251. });
  23252. }
  23253. }
  23254. else {
  23255. showErrorDialog$1(res.msg || '未知错误', sender);
  23256. }
  23257. }).catch(function (e) {
  23258. var _a, _b;
  23259. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23260. showErrorDialog$1(msg || e.toString(), sender);
  23261. }).finally(function () {
  23262. scope.setLoading(false);
  23263. });
  23264. };
  23265. };
  23266. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  23267. return function (sender) {
  23268. var scope = lookupScope(sender);
  23269. scope.setLoading(true);
  23270. var data = scope.viewModel.data;
  23271. if (arg0) {
  23272. data = calcObjectFlat(data, arg0);
  23273. }
  23274. invokeServer$1(groovyUrl, data).then(function (res) {
  23275. if (res.success) {
  23276. if (res.msg) {
  23277. msg(res.msg);
  23278. }
  23279. if (typeof successCallback === 'function') {
  23280. successCallback.call(scope, sender, res.data);
  23281. }
  23282. }
  23283. else {
  23284. showErrorDialog$1(res.msg || '未知错误', sender);
  23285. }
  23286. }).catch(function (e) {
  23287. var _a, _b;
  23288. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23289. showErrorDialog$1(msg || e.toString(), sender);
  23290. }).finally(function () {
  23291. scope.setLoading(false);
  23292. });
  23293. };
  23294. };
  23295. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  23296. return function (sender) {
  23297. var scope = lookupScope(sender);
  23298. var form = scope.down('form');
  23299. if (form) {
  23300. // 如果下级有表单,就做表单校验
  23301. var valid = form.isValid();
  23302. if (!valid) {
  23303. return;
  23304. }
  23305. }
  23306. scope.setLoading(true);
  23307. var data = scope.viewModel.data;
  23308. if (arg0) {
  23309. data = calcObjectFlat(data, arg0);
  23310. }
  23311. invokeServer$1(groovyUrl, data).then(function (res) {
  23312. if (res.success) {
  23313. if (res.msg) {
  23314. msg(res.msg);
  23315. }
  23316. scope.dialogSuccess(res);
  23317. }
  23318. else {
  23319. showErrorDialog$1(res.msg || '未知错误', sender);
  23320. }
  23321. }).catch(function (e) {
  23322. var _a, _b;
  23323. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23324. showErrorDialog$1(msg || e.toString(), sender);
  23325. }).finally(function () {
  23326. scope.setLoading(false);
  23327. });
  23328. };
  23329. };
  23330. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  23331. return function (sender) {
  23332. var scope = lookupScope(sender);
  23333. if (lookupObject) {
  23334. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  23335. }
  23336. else {
  23337. scope.dialogSuccess();
  23338. }
  23339. };
  23340. };
  23341. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  23342. return function (sender) {
  23343. var scope = lookupScope(sender);
  23344. clearViewModelValues(scope.viewModel, propertyName);
  23345. };
  23346. };
  23347. SystemEventFu.prototype.getGrid = function (url) {
  23348. return function (sender, config) {
  23349. if (config.xtype == "combogridmulti") {
  23350. // @ts-ignore
  23351. require([url], function (grid) {
  23352. _$2.forOwn(grid.default, function (v, k) {
  23353. sender[k] = v;
  23354. sender.config[k] = v;
  23355. if (sender.rendered) {
  23356. // 已经渲染出来了,重新调用 reload 强制刷新
  23357. sender.reload();
  23358. }
  23359. });
  23360. });
  23361. }
  23362. else {
  23363. // @ts-ignore
  23364. require([url], function (grid) {
  23365. sender.grid = grid.default;
  23366. config.grid = grid.default;
  23367. });
  23368. }
  23369. };
  23370. };
  23371. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  23372. return function (sender) {
  23373. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  23374. };
  23375. };
  23376. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  23377. return function (sender) {
  23378. var _a, _b;
  23379. var scope = lookupScope(sender);
  23380. if (!gridRefName) {
  23381. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  23382. }
  23383. else {
  23384. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  23385. }
  23386. };
  23387. };
  23388. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  23389. return function (sender) {
  23390. var scope = lookupScope(sender);
  23391. var data = scope.viewModel.data;
  23392. var param = calcObjectFlat(data, lookupForData);
  23393. // @ts-ignore
  23394. require([url], function (module) {
  23395. var ScopeClass = module.default;
  23396. var scope = new ScopeClass();
  23397. scope.success = successCallback;
  23398. scope.showDialog(sender, {}, { data: param });
  23399. });
  23400. };
  23401. };
  23402. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  23403. return function (sender, queryValue) {
  23404. showWidget(widgetUrl, lookup, sender, queryValue);
  23405. };
  23406. };
  23407. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  23408. return function (sender) {
  23409. clearViewModelByLookup(sender, lookup);
  23410. };
  23411. };
  23412. SystemEventFu.prototype.closeMe = function (callBack) {
  23413. return function (sender) {
  23414. var scope = lookupScope(sender);
  23415. scope.close();
  23416. if (callBack) {
  23417. callBack.call(sender);
  23418. }
  23419. };
  23420. };
  23421. // 未完成
  23422. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  23423. return function (sender) {
  23424. var scope = lookupScope(sender);
  23425. var data = scope.viewModel.data;
  23426. var billSetting = scope.billSetting;
  23427. var param = calcObjectFlat(data, lookupForData);
  23428. return new Promise(function (resolve, reject) {
  23429. var sf = function (scope) {
  23430. scope.success = function (dlgScope, dlgSender, reData) {
  23431. };
  23432. scope.showDialog(sender, {}, { data: param });
  23433. };
  23434. // @ts-ignore
  23435. require([url], function (module) {
  23436. // 业务描述文件
  23437. if (url.endsWith(".bill")) {
  23438. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  23439. sf(scope);
  23440. });
  23441. }
  23442. else { //原生yvanui文件
  23443. var ScopeClass = module.default;
  23444. var scope_1 = new ScopeClass();
  23445. sf(scope_1);
  23446. }
  23447. });
  23448. });
  23449. };
  23450. };
  23451. __decorate([
  23452. Lib({
  23453. title: '为某个表格,上移行',
  23454. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23455. }),
  23456. __metadata("design:type", Function),
  23457. __metadata("design:paramtypes", []),
  23458. __metadata("design:returntype", void 0)
  23459. ], SystemEventFu.prototype, "moveUpGridRow", null);
  23460. __decorate([
  23461. Lib({
  23462. title: '为某个表格,上移行',
  23463. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23464. }),
  23465. __metadata("design:type", Function),
  23466. __metadata("design:paramtypes", []),
  23467. __metadata("design:returntype", void 0)
  23468. ], SystemEventFu.prototype, "commitMe", null);
  23469. __decorate([
  23470. Lib({
  23471. title: '为某个表格,下移行',
  23472. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23473. }),
  23474. __metadata("design:type", Function),
  23475. __metadata("design:paramtypes", []),
  23476. __metadata("design:returntype", void 0)
  23477. ], SystemEventFu.prototype, "moveDownGridRow", null);
  23478. __decorate([
  23479. Lib({
  23480. title: '为某个表格,批量保存至数据库',
  23481. author: '罗一帆',
  23482. createAt: '2022-07-19',
  23483. updateAt: '2022-07-19',
  23484. type: 'system',
  23485. category: '表格',
  23486. }),
  23487. __metadata("design:type", Function),
  23488. __metadata("design:paramtypes", []),
  23489. __metadata("design:returntype", void 0)
  23490. ], SystemEventFu.prototype, "saveGridRow", null);
  23491. __decorate([
  23492. Lib({
  23493. title: '为某个表格插入数据行',
  23494. author: '罗一帆',
  23495. createAt: '2022-07-19',
  23496. updateAt: '2022-07-19',
  23497. type: 'system',
  23498. category: '表格',
  23499. }),
  23500. __metadata("design:type", Function),
  23501. __metadata("design:paramtypes", []),
  23502. __metadata("design:returntype", void 0)
  23503. ], SystemEventFu.prototype, "insertGridRow", null);
  23504. __decorate([
  23505. Lib({
  23506. title: '为某个表格删除所选数据行',
  23507. author: '罗一帆',
  23508. createAt: '2022-07-19',
  23509. updateAt: '2022-07-19',
  23510. type: 'system',
  23511. category: '表格',
  23512. }),
  23513. __metadata("design:type", Function),
  23514. __metadata("design:paramtypes", []),
  23515. __metadata("design:returntype", void 0)
  23516. ], SystemEventFu.prototype, "removeGridRow", null);
  23517. __decorate([
  23518. Lib({
  23519. title: '按下回车键之后默认是否按下某个按钮',
  23520. author: '罗一帆',
  23521. createAt: '2021-07-02',
  23522. updateAt: '2021-07-02',
  23523. type: 'system',
  23524. category: '字典',
  23525. }),
  23526. __metadata("design:type", Function),
  23527. __metadata("design:paramtypes", [Object]),
  23528. __metadata("design:returntype", void 0)
  23529. ], SystemEventFu.prototype, "enterToClick", null);
  23530. __decorate([
  23531. Lib({
  23532. title: '弹出确认对话框,回答 YES 之后调用某方法',
  23533. author: '罗一帆',
  23534. createAt: '2021-07-06',
  23535. updateAt: '2021-07-06',
  23536. type: 'system',
  23537. category: '对话框',
  23538. }),
  23539. __param(0, LibParam('对话框的确认文字', 'string')),
  23540. __param(1, LibParam('确认之后的调用的方法', 'event')),
  23541. __metadata("design:type", Function),
  23542. __metadata("design:paramtypes", [Object, Object]),
  23543. __metadata("design:returntype", void 0)
  23544. ], SystemEventFu.prototype, "confirm", null);
  23545. __decorate([
  23546. Lib({
  23547. title: '删除表格当前的选中行(前端删除)',
  23548. author: '罗一帆',
  23549. createAt: '2021-07-08',
  23550. updateAt: '2021-07-08',
  23551. type: 'system',
  23552. category: '表格',
  23553. }),
  23554. __param(0, LibParam('表格引用名', 'refs')),
  23555. __metadata("design:type", Function),
  23556. __metadata("design:paramtypes", [Object]),
  23557. __metadata("design:returntype", void 0)
  23558. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  23559. __decorate([
  23560. Lib({
  23561. title: '查询表单,如果 url 为空值,就取消查询',
  23562. author: '罗一帆',
  23563. createAt: '2021-07-06',
  23564. updateAt: '2021-07-06',
  23565. type: 'system',
  23566. category: '表单',
  23567. }),
  23568. __param(0, LibParam('后端服务路径', 'string')),
  23569. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  23570. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  23571. __metadata("design:type", Function),
  23572. __metadata("design:paramtypes", [String, Object, Object]),
  23573. __metadata("design:returntype", void 0)
  23574. ], SystemEventFu.prototype, "loadForm", null);
  23575. __decorate([
  23576. Lib({
  23577. title: '提交(不做校验、不关闭窗体)',
  23578. author: '罗一帆',
  23579. createAt: '2021-07-02',
  23580. updateAt: '2021-07-02',
  23581. type: 'system',
  23582. category: '表单',
  23583. }),
  23584. __param(0, LibParam('后端服务路径', 'string')),
  23585. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  23586. __param(2, LibParam('提交成功后的回调', 'event', true)),
  23587. __metadata("design:type", Function),
  23588. __metadata("design:paramtypes", [String, Object, Object]),
  23589. __metadata("design:returntype", void 0)
  23590. ], SystemEventFu.prototype, "commit", null);
  23591. __decorate([
  23592. Lib({
  23593. title: '提交表单',
  23594. author: '罗一帆',
  23595. createAt: '2021-07-02',
  23596. updateAt: '2021-07-02',
  23597. type: 'system',
  23598. category: '表单',
  23599. }),
  23600. __param(0, LibParam('后端服务路径', 'string')),
  23601. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  23602. __metadata("design:type", Function),
  23603. __metadata("design:paramtypes", [String, Object]),
  23604. __metadata("design:returntype", void 0)
  23605. ], SystemEventFu.prototype, "formCommit", null);
  23606. __decorate([
  23607. Lib({
  23608. title: '对话框成功回调',
  23609. author: '罗一帆',
  23610. createAt: '2021-07-02',
  23611. updateAt: '2021-07-02',
  23612. type: 'system',
  23613. category: '对话框',
  23614. }),
  23615. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  23616. __metadata("design:type", Function),
  23617. __metadata("design:paramtypes", [Object]),
  23618. __metadata("design:returntype", void 0)
  23619. ], SystemEventFu.prototype, "dialogSuccess", null);
  23620. __decorate([
  23621. Lib({
  23622. title: '清空 viewModel 某个属性',
  23623. author: '罗一帆',
  23624. createAt: '2021-07-02',
  23625. updateAt: '2021-07-02',
  23626. type: 'system',
  23627. category: '表单',
  23628. }),
  23629. __param(0, LibParam('属性路径', 'viewModel', true)),
  23630. __metadata("design:type", Function),
  23631. __metadata("design:paramtypes", [String]),
  23632. __metadata("design:returntype", void 0)
  23633. ], SystemEventFu.prototype, "clearViewModelValues", null);
  23634. __decorate([
  23635. Lib({
  23636. title: '从其他资源获取表格设置',
  23637. author: '罗一帆',
  23638. createAt: '2021-07-02',
  23639. updateAt: '2021-07-02',
  23640. type: 'system',
  23641. category: '表单',
  23642. }),
  23643. __param(0, LibParam('定义文件', 'module')),
  23644. __metadata("design:type", Function),
  23645. __metadata("design:paramtypes", [Object]),
  23646. __metadata("design:returntype", void 0)
  23647. ], SystemEventFu.prototype, "getGrid", null);
  23648. __decorate([
  23649. Lib({
  23650. title: '清空 viewModel 某个属性,并刷新表格',
  23651. author: '罗一帆',
  23652. createAt: '2021-07-02',
  23653. updateAt: '2021-07-02',
  23654. type: 'system',
  23655. category: '表单',
  23656. }),
  23657. __param(0, LibParam('清空的属性', 'viewModel')),
  23658. __param(1, LibParam('要刷新的表格', 'refs', true)),
  23659. __metadata("design:type", Function),
  23660. __metadata("design:paramtypes", [String, String]),
  23661. __metadata("design:returntype", void 0)
  23662. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  23663. __decorate([
  23664. Lib({
  23665. title: '刷新表格',
  23666. author: '罗一帆',
  23667. createAt: '2021-07-02',
  23668. updateAt: '2021-07-02',
  23669. type: 'system',
  23670. category: '表单',
  23671. }),
  23672. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  23673. __metadata("design:type", Function),
  23674. __metadata("design:paramtypes", [String]),
  23675. __metadata("design:returntype", void 0)
  23676. ], SystemEventFu.prototype, "reloadGrid", null);
  23677. __decorate([
  23678. Lib({
  23679. title: '显示对话框',
  23680. author: '罗一帆',
  23681. createAt: '2021-07-02',
  23682. updateAt: '2021-07-02',
  23683. type: 'system',
  23684. category: '对话框',
  23685. }),
  23686. __param(0, LibParam('业务模块名', 'module')),
  23687. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  23688. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  23689. __metadata("design:type", Function),
  23690. __metadata("design:paramtypes", [String, Object, Object]),
  23691. __metadata("design:returntype", void 0)
  23692. ], SystemEventFu.prototype, "showDialog", null);
  23693. __decorate([
  23694. Lib({
  23695. title: '弹出查找框(不借助 search)',
  23696. author: '罗一帆',
  23697. createAt: '2021-07-02',
  23698. updateAt: '2021-07-02',
  23699. type: 'system',
  23700. category: '对话框',
  23701. }),
  23702. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  23703. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  23704. __metadata("design:type", Function),
  23705. __metadata("design:paramtypes", [Object, Object]),
  23706. __metadata("design:returntype", void 0)
  23707. ], SystemEventFu.prototype, "showWidget", null);
  23708. __decorate([
  23709. Lib({
  23710. title: '根据 lookup 清空 viewModel',
  23711. author: '罗一帆',
  23712. createAt: '2021-07-05',
  23713. updateAt: '2021-07-05',
  23714. type: 'system',
  23715. category: '表单',
  23716. }),
  23717. __param(0, LibParam('设值表达式', 'lookup')),
  23718. __metadata("design:type", Function),
  23719. __metadata("design:paramtypes", [Object]),
  23720. __metadata("design:returntype", void 0)
  23721. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  23722. __decorate([
  23723. Lib({
  23724. title: '关闭对话框',
  23725. author: '罗一帆',
  23726. createAt: '2021-07-05',
  23727. updateAt: '2021-07-05',
  23728. type: 'system',
  23729. category: '对话框',
  23730. }),
  23731. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  23732. __metadata("design:type", Function),
  23733. __metadata("design:paramtypes", [Object]),
  23734. __metadata("design:returntype", void 0)
  23735. ], SystemEventFu.prototype, "closeMe", null);
  23736. __decorate([
  23737. Lib({
  23738. title: '打开对话框并返回数据',
  23739. author: '余亮',
  23740. createAt: '2022-07-07',
  23741. updateAt: '2022-07-07',
  23742. type: 'system',
  23743. category: '对话框',
  23744. }),
  23745. __param(0, LibParam('业务模块名', 'module')),
  23746. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  23747. __param(2, LibParam('结果映射关系', 'string', true)),
  23748. __metadata("design:type", Function),
  23749. __metadata("design:paramtypes", [String, Object, Object]),
  23750. __metadata("design:returntype", void 0)
  23751. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  23752. return SystemEventFu;
  23753. }());
  23754. /**
  23755. * 清空 viewmodel 里下属的所有属性
  23756. * @param viewModel VM对象
  23757. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  23758. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  23759. */
  23760. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  23761. var data = viewModel.data;
  23762. if (propertyKey) {
  23763. data = _$2.get(data, propertyKey);
  23764. }
  23765. _$2.forOwn(data, function (value, key) {
  23766. var targetKey = propertyKey ? propertyKey + "." + key : key;
  23767. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  23768. return;
  23769. }
  23770. viewModel.set(targetKey, '');
  23771. });
  23772. }
  23773. function clearViewModelByLookup(sender, lookup) {
  23774. if (_$2.isPlainObject(lookup)) {
  23775. var parentScope_1 = lookupScope(sender);
  23776. _$2.forOwn(lookup, function (value, key) {
  23777. if (SIMPLE_RE.test(value)) {
  23778. // '{foo}' 简单表达式
  23779. var path = value.substring(1, value.length - 1);
  23780. if (path !== 'queryValue') {
  23781. parentScope_1.viewModel.set(path, '');
  23782. }
  23783. }
  23784. });
  23785. }
  23786. }
  23787. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  23788. if (vjson === void 0) { vjson = {}; }
  23789. var parentScope = lookupScope(sender);
  23790. var me = sender;
  23791. // @ts-ignore
  23792. require([widgetUrl], function (widgetScope) {
  23793. var WidgetScopeClass = widgetScope.default;
  23794. widgetScope = new WidgetScopeClass();
  23795. // 传递进 widget.model 的数据
  23796. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  23797. widgetScope.parentScope = parentScope;
  23798. widgetScope.searchWidgetSuccess = function (data) {
  23799. if (typeof lookup === 'string') {
  23800. // lookup 是字符串的情况下,就是取某个列作为 value 值
  23801. me.setValue(data[lookup]);
  23802. return;
  23803. }
  23804. /**
  23805. * lookup: {
  23806. * // 扩展到 viewModel 的值做更改
  23807. * WH_CODE: "{queryValue}",
  23808. * WH_NAME: "{query.WH_NAME}",
  23809. * }
  23810. */
  23811. if (_$2.isPlainObject(lookup)) {
  23812. var parentScope_2 = lookupScope(sender);
  23813. tryWriteObject(lookup, data, function (path, value) {
  23814. if (path === 'queryValue') {
  23815. me.setValue(value);
  23816. }
  23817. else {
  23818. parentScope_2.viewModel.set(path, value);
  23819. }
  23820. });
  23821. }
  23822. return true;
  23823. };
  23824. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  23825. });
  23826. }
  23827. /**
  23828. * 停止事件的默认行为
  23829. * @param e
  23830. */
  23831. function stopEvent(e) {
  23832. e.preventDefault();
  23833. e.stopPropagation();
  23834. // @ts-ignore
  23835. window.event.cancelBubble = true;
  23836. e.returnValue = false;
  23837. e.cancelBubble = true;
  23838. }
  23839. /**
  23840. * 屏幕中央显示一个黑框提示
  23841. */
  23842. function msg$1(content) {
  23843. msg(content);
  23844. }
  23845. /**
  23846. * 错误对话框的强提醒
  23847. */
  23848. function showErrorDialog$1(msg, sender) {
  23849. showErrorDialog(msg, sender);
  23850. }
  23851. /**
  23852. * 错误对话框的强提醒
  23853. */
  23854. function showInfoDialog(msg, sender) {
  23855. showInfoDialogSimple(msg, sender);
  23856. }
  23857. /**
  23858. * 错误对话框的强提醒
  23859. */
  23860. function prompt$2(message, defaultValue, multiLine) {
  23861. if (defaultValue === void 0) { defaultValue = ""; }
  23862. if (multiLine === void 0) { multiLine = false; }
  23863. return prompt$1(message, defaultValue, multiLine);
  23864. }
  23865. /**
  23866. * 用于计算 express 表达式
  23867. */
  23868. function evalFunction(data, express) {
  23869. var keys = [];
  23870. var values = [];
  23871. _$2.forOwn(data, function (value, key) {
  23872. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  23873. if (match) {
  23874. key = key.substring(0, match.index);
  23875. }
  23876. keys.push(key);
  23877. values.push(value);
  23878. });
  23879. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  23880. try {
  23881. return func.apply(void 0, __spread(values));
  23882. }
  23883. catch (e) {
  23884. return;
  23885. }
  23886. }
  23887. /**
  23888. * 获取表格编辑的行数据
  23889. */
  23890. function getGridEditRows(grid) {
  23891. return grid.getGridEditRows();
  23892. }
  23893. var SystemLib = /*#__PURE__*/Object.freeze({
  23894. __proto__: null,
  23895. SIMPLE_RE: SIMPLE_RE,
  23896. pinyinMatch: pinyinMatch,
  23897. calcExpress: calcExpress,
  23898. calcObjectFlat: calcObjectFlat,
  23899. mergeViewModel: mergeViewModel,
  23900. flatRow: flatRow,
  23901. replaceNA: replaceNA,
  23902. deepTravJson: deepTravJson,
  23903. tryWriteByExpress: tryWriteByExpress,
  23904. tryWriteObject: tryWriteObject,
  23905. tryVarSimple: tryVarSimple,
  23906. calcObject: calcObject,
  23907. getParentGrid: getParentGrid,
  23908. tryEnable: tryEnable,
  23909. setComboStore: setComboStore,
  23910. invokeServer: invokeServer$1,
  23911. clearViewModelValues: clearViewModelValues,
  23912. reloadGrid: reloadGrid,
  23913. toPlainObject: toPlainObject,
  23914. confirm: confirm,
  23915. normId: normId,
  23916. clearViewModelReloadGrid: clearViewModelReloadGrid,
  23917. saveGridRow: saveGridRow,
  23918. insertGridRow: insertGridRow,
  23919. commitMe: commitMe,
  23920. removeGridRow: removeGridRow,
  23921. moveUpGridRow: moveUpGridRow,
  23922. moveDownGridRow: moveDownGridRow,
  23923. SystemEventFu: SystemEventFu,
  23924. clearViewModel: clearViewModel,
  23925. clearViewModelByLookup: clearViewModelByLookup,
  23926. showWidget: showWidget,
  23927. stopEvent: stopEvent,
  23928. msg: msg$1,
  23929. showErrorDialog: showErrorDialog$1,
  23930. showInfoDialog: showInfoDialog,
  23931. prompt: prompt$2,
  23932. evalFunction: evalFunction,
  23933. getGridEditRows: getGridEditRows
  23934. });
  23935. function initTree () {
  23936. Ext.define('Yvan.Tree', {
  23937. extend: 'Ext.tree.Panel',
  23938. alias: 'widget.yvtree',
  23939. xtype: 'yvtree',
  23940. constructor: function (config) {
  23941. var newConfig = _$2.defaultsDeep({
  23942. // 强制性属性
  23943. }, baseConfig(config, 'row-item'), config, tree);
  23944. _$2.assign(newConfig, {
  23945. tbar: [
  23946. {
  23947. xtype: 'textfield',
  23948. // triggerCls: 'x-form-clear-trigger',
  23949. flex: 1,
  23950. emptyText: '搜索过滤',
  23951. enableKeyEvents: true,
  23952. listeners: {
  23953. change: function (sender) {
  23954. var tree = sender.up("treepanel");
  23955. tree.filterByText(this.getRawValue());
  23956. },
  23957. keyup: function (sender, e) {
  23958. var tree = sender.up("treepanel");
  23959. if (e.ESC === e.getKey()) {
  23960. sender.setValue('');
  23961. tree.filterByText('');
  23962. }
  23963. }
  23964. }
  23965. },
  23966. ],
  23967. });
  23968. if (!newConfig.hideRefresh) {
  23969. newConfig.tbar.push({
  23970. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  23971. listeners: {
  23972. click: function (sender) {
  23973. var scope = sender.up("yvtree");
  23974. scope.reload();
  23975. }
  23976. }
  23977. });
  23978. }
  23979. if (!newConfig.hideExpand) {
  23980. newConfig.tbar.push({
  23981. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  23982. listeners: {
  23983. click: function (sender) {
  23984. var scope = sender.up("yvtree");
  23985. scope.expandAll();
  23986. }
  23987. }
  23988. });
  23989. }
  23990. if (!newConfig.hideCollapse) {
  23991. newConfig.tbar.push({
  23992. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  23993. listeners: {
  23994. click: function (sender) {
  23995. var scope = sender.up("yvtree");
  23996. scope.collapseAll();
  23997. }
  23998. }
  23999. });
  24000. }
  24001. this.superclass.constructor.call(this, newConfig);
  24002. },
  24003. /**
  24004. * 在根节点上增加一个节点,会触发 addNode 事件
  24005. * @param props
  24006. */
  24007. addRoot: function (props) {
  24008. var me = this;
  24009. var tableNode = me.getRootNode();
  24010. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  24011. if (_$2.isFunction(props)) {
  24012. props = props.call(this, parent);
  24013. }
  24014. _$2.forOwn(props, function (value, key) {
  24015. fieldNode.set(key, value);
  24016. });
  24017. var node = tableNode.appendChild(fieldNode);
  24018. me.ensureVisible(node);
  24019. me.setSelection(node);
  24020. me.fireEvent('addNode', me, {
  24021. parent: tableNode,
  24022. node: node,
  24023. });
  24024. },
  24025. addLast: function (props) {
  24026. var me = this;
  24027. var sel = me.selModel.getSelection();
  24028. if (!sel || sel.length <= 0) {
  24029. msg('请选择一个要添加的同级节点路径');
  24030. return;
  24031. }
  24032. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  24033. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  24034. if (_$2.isFunction(props)) {
  24035. props = props.call(this, parent);
  24036. }
  24037. _$2.forOwn(props, function (value, key) {
  24038. fieldNode.set(key, value);
  24039. });
  24040. var node = parent.appendChild(fieldNode);
  24041. me.ensureVisible(node);
  24042. me.setSelection(node);
  24043. me.fireEvent('addNode', me, {
  24044. parent: parent,
  24045. node: node,
  24046. });
  24047. },
  24048. addChildren: function (props) {
  24049. var me = this;
  24050. var sel = me.selModel.getSelection();
  24051. if (!sel || sel.length <= 0) {
  24052. msg('请选择一个要添加子节点的路径');
  24053. return;
  24054. }
  24055. var parent = sel[0];
  24056. if (_$2.isFunction(props)) {
  24057. props = props.call(this, parent);
  24058. }
  24059. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  24060. _$2.forOwn(props, function (value, key) {
  24061. fieldNode.set(key, value);
  24062. });
  24063. var node = parent.appendChild(fieldNode);
  24064. parent.expand();
  24065. me.ensureVisible(node);
  24066. me.setSelection(node);
  24067. me.fireEvent('addNode', me, {
  24068. parent: parent,
  24069. node: node,
  24070. });
  24071. },
  24072. initComponent: function () {
  24073. var me = this;
  24074. var config = me.config;
  24075. var scope = lookupScope(this);
  24076. if (!isDesignMode(scope, config)) {
  24077. // 转换 dataSource 属性
  24078. convertDataSource(me, scope, config);
  24079. }
  24080. this.superclass.initComponent.call(this);
  24081. this.on({
  24082. afterrender: function (sender) {
  24083. var me = this;
  24084. var config = this.config;
  24085. var dataSource = config.dataSource;
  24086. if (config.autoLoad) {
  24087. if (config.dataSourceCallbackFn) {
  24088. me.reload();
  24089. }
  24090. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  24091. me.reload();
  24092. }
  24093. }
  24094. }
  24095. });
  24096. },
  24097. _setDataReal: function (value) {
  24098. var me = this;
  24099. // me.setStore(new Ext.data.TreeStore({
  24100. // root: {
  24101. // expanded: true,
  24102. // // children: value
  24103. // children: [
  24104. // {
  24105. // id: '1', text: 'A',
  24106. // children: [
  24107. // {id: '1', text: 'A',},
  24108. // {id: '2', text: 'B'},
  24109. // ]
  24110. // },
  24111. // {id: '2', text: 'B'},
  24112. // ]
  24113. // }
  24114. // }))
  24115. me.store.setRoot({
  24116. expanded: true,
  24117. children: value
  24118. });
  24119. // me.store = new Ext.data.TreeStore({
  24120. // root: {
  24121. // expanded: true,
  24122. // // children: value
  24123. // children: [
  24124. // {
  24125. // id: '1', text: 'A',
  24126. // children: [
  24127. // {id: '1', text: 'A',},
  24128. // {id: '2', text: 'B'},
  24129. // ]
  24130. // },
  24131. // {id: '2', text: 'B'},
  24132. // ]
  24133. // }
  24134. // })
  24135. },
  24136. /**
  24137. * 重新载入数据(重新计算参数)
  24138. */
  24139. reload: function (reloadParams) {
  24140. if (reloadParams === void 0) { reloadParams = {}; }
  24141. var me = this;
  24142. var config = me.config;
  24143. if (config.dataSourceCallbackFn) {
  24144. // 函数请求刷新
  24145. var scope_1 = lookupScope(this);
  24146. // me.setLoading(true)
  24147. config.dataSourceCallbackFn.call(scope_1, me, {
  24148. successCallback: function (value) {
  24149. me._setDataReal(value);
  24150. // me.setLoading(false)
  24151. me.fireEvent('dataLoadComplete', me, true, value);
  24152. },
  24153. failCallback: function (error) {
  24154. // me.setLoading(false)
  24155. me.fireEvent('dataLoadComplete', me, false, error);
  24156. }
  24157. });
  24158. return;
  24159. }
  24160. var scope = lookupScope(me);
  24161. var dataSource = config.dataSource;
  24162. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  24163. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  24164. me.setLoading(true);
  24165. invokeServer$1(dataSource.url, params)
  24166. .then(function (res) {
  24167. me._setDataReal(res.data);
  24168. me.fireEvent('dataLoadComplete', me, res);
  24169. })
  24170. .finally(function () {
  24171. me.setLoading(false);
  24172. });
  24173. }
  24174. },
  24175. filterByText: function (text) {
  24176. this._filterText = text;
  24177. this._filterBy(this, text, 'text');
  24178. },
  24179. _filterBy: _$2.debounce(function (me, text, by) {
  24180. var view = me.getView();
  24181. me.store.clearFilter();
  24182. if (!me._filterText) {
  24183. // 没有筛选内容,还原状态
  24184. var selections = me.getSelection();
  24185. var selectionPaths_1 = [];
  24186. _$2.forEach(me.getSelection(), function (item) {
  24187. selectionPaths_1.push(item.getPath());
  24188. });
  24189. me.collapseAll();
  24190. _$2.forEach(selectionPaths_1, function (path) {
  24191. me.expandPath(path);
  24192. });
  24193. me.setSelection(selections);
  24194. return;
  24195. }
  24196. // 递归查找所有需要可见的节点 id 数组
  24197. var nodesAndParents = [];
  24198. var expandPaths = [];
  24199. me.getRootNode().cascadeBy(function (tree, view) {
  24200. var currNode = this;
  24201. currNode.collapse();
  24202. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  24203. // 展开到匹配的路径
  24204. // me.expandPath(currNode.getPath());
  24205. expandPaths.push(currNode.getPath());
  24206. // 沿途父节点全部设定为可见
  24207. while (currNode.parentNode) {
  24208. nodesAndParents.push(currNode.id);
  24209. currNode = currNode.parentNode;
  24210. }
  24211. }
  24212. }, null, [me, view]);
  24213. me.store.filterBy(function (r) {
  24214. return Ext.Array.contains(nodesAndParents, r.get('id'));
  24215. });
  24216. _$2.forEach(expandPaths, function (path) {
  24217. me.expandPath(path);
  24218. });
  24219. }, 1000),
  24220. });
  24221. }
  24222. function convertDataSource(sender, scope, newConfig) {
  24223. if (typeof newConfig.store !== 'undefined') {
  24224. // 有 store 属性的情况下,不做任何事
  24225. return;
  24226. }
  24227. if (typeof newConfig.dataSource === 'undefined') {
  24228. // 没有定义 dataSource 的情况下,不做任何事
  24229. return;
  24230. }
  24231. var dataSource = newConfig.dataSource;
  24232. if (typeof dataSource === 'string') {
  24233. // dataSource 是字符串的情况下,找到成员函数
  24234. dataSource = lookupFn(scope, dataSource);
  24235. }
  24236. if (typeof dataSource === 'function') {
  24237. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  24238. newConfig.store = new Ext.data.TreeStore({
  24239. root: {
  24240. expanded: true,
  24241. children: []
  24242. }
  24243. });
  24244. newConfig.dataSourceCallbackFn = dataSource;
  24245. return;
  24246. }
  24247. // throw new TypeError('无法识别的调用方法')
  24248. }
  24249. /**
  24250. * 构建一个 grid 支持的 dataSource
  24251. */
  24252. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  24253. if (reloadParams === void 0) { reloadParams = {}; }
  24254. if (isExcelExport === void 0) { isExcelExport = false; }
  24255. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  24256. var _a;
  24257. var me = grid;
  24258. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  24259. var storeOption = {};
  24260. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  24261. if (dataSource.sqlId) {
  24262. dataSource.method = 'invoke';
  24263. dataSource.url = '/Dev@executeSQL';
  24264. if (_$2.startsWith(dataSource.sqlId, '@')) {
  24265. // sqlId 是 @ 开头,代表直接带中文名
  24266. var scope_1 = lookupScope(grid);
  24267. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  24268. params.sqlId = dataSource.sqlId.substring(1);
  24269. }
  24270. else {
  24271. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  24272. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  24273. params.path = path;
  24274. params.sqlId = sqlId;
  24275. }
  24276. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  24277. }
  24278. var fields_1 = [];
  24279. _$2.forEach(grid.columns, function (col) {
  24280. var c = {};
  24281. if (col.dataIndex) {
  24282. c.name = col.dataIndex;
  24283. fields_1.push(c);
  24284. }
  24285. if (col.dataType) {
  24286. c.type = col.dataType;
  24287. }
  24288. });
  24289. // 默认支持 gridInvoke
  24290. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  24291. //@ts-ignore
  24292. storeOption = {
  24293. fields: fields_1,
  24294. remoteSort: config.remoteSort,
  24295. remoteFilter: config.remoteFilter,
  24296. autoLoad: true,
  24297. pageSize: me.store.pageSize || config.pageSize,
  24298. proxy: {
  24299. type: 'jsonAjax',
  24300. $owner: me,
  24301. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  24302. extraParams: extraParams,
  24303. reader: {
  24304. type: 'json',
  24305. rootProperty: 'data',
  24306. totalProperty: 'pagination.total',
  24307. successProperty: 'success',
  24308. messageProperty: 'msg',
  24309. transform: function (data) {
  24310. if (typeof window['ajaxProcess'] === 'function') {
  24311. window['ajaxProcess'](data);
  24312. }
  24313. if (typeof window['apiTranslate'] === 'function') {
  24314. window['apiTranslate'](data, dataSource.url);
  24315. }
  24316. if (typeof grid._transform === 'function') {
  24317. // 系统转换函数
  24318. grid._transform(data.data);
  24319. }
  24320. if (grid.dataTransform) {
  24321. if (typeof grid.dataTransform === 'string') {
  24322. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  24323. }
  24324. return grid.dataTransform.call(scope, grid, data);
  24325. }
  24326. return data;
  24327. }
  24328. }
  24329. },
  24330. listeners: {
  24331. load: function (store, records, successful, operation) {
  24332. var _a, _b, _c;
  24333. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  24334. if (rep.pagination) {
  24335. grid.dbInfo = rep.pagination.dbInfo;
  24336. grid.exportDataSql = rep.pagination.exportDataSql;
  24337. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  24338. }
  24339. 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;
  24340. if (isExcelExport) {
  24341. if (typeof excelExportCallBack === 'function') {
  24342. excelExportCallBack(rep);
  24343. }
  24344. else if (excelExportCallBack) {
  24345. console.error("导出回调方法错误!");
  24346. }
  24347. me.fireEvent('excelDataLoadComplete', me, successful, records);
  24348. }
  24349. else {
  24350. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  24351. // 自动选中第一行
  24352. var data = grid.getStore().data;
  24353. if (data.length > 0) {
  24354. grid.setSelection(data.items[0]);
  24355. }
  24356. }
  24357. me.fireEvent('dataLoadComplete', me, successful, records);
  24358. }
  24359. }
  24360. }
  24361. };
  24362. }
  24363. else if (exports.apiConvert) {
  24364. // 外部扩展的 apiConvert
  24365. //@ts-ignore
  24366. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack);
  24367. }
  24368. else {
  24369. throw new TypeError("不支持的 API 请求方式");
  24370. }
  24371. if (isExcelExport) {
  24372. var excelStore = new Ext.data.Store(storeOption);
  24373. excelStore.load();
  24374. }
  24375. else {
  24376. if (me.groupField) {
  24377. console.log('groupField', storeOption.groupField);
  24378. storeOption.groupField = me.groupField;
  24379. }
  24380. me.setStore(new Ext.data.Store(storeOption));
  24381. }
  24382. }
  24383. function initStores () {
  24384. Ext.define('Yvan.JsonAjaxProxy', {
  24385. extend: 'Ext.data.proxy.Ajax',
  24386. alias: 'proxy.jsonAjax',
  24387. actionMethods: {
  24388. create: "POST",
  24389. read: "POST",
  24390. update: "POST",
  24391. destroy: "POST"
  24392. },
  24393. timeout: storeAjax.timeout,
  24394. buildRequest: function (operation) {
  24395. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  24396. var me = this;
  24397. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  24398. var scope = lookupScope($owner);
  24399. var gridParam = me.getParams(operation);
  24400. var customParam = {};
  24401. // 提取 srot 元素
  24402. if (gridParam.sort) {
  24403. var sort = JSON.parse(gridParam.sort);
  24404. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  24405. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  24406. customParam.sortModel = [];
  24407. _$2.forEach(sort, function (s) {
  24408. customParam.sortModel.push({
  24409. colId: s.property,
  24410. sort: _$2.toLower(s.direction)
  24411. });
  24412. });
  24413. delete gridParam.sort;
  24414. }
  24415. // 提取筛选元素
  24416. if (gridParam.filter) {
  24417. var filter = JSON.parse(gridParam.filter);
  24418. console.log('gridParam.filter', gridParam.filter);
  24419. // "[{"operator":"like","value":"1","property":"id"}]"
  24420. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  24421. customParam.filterModel = {};
  24422. _$2.forEach(filter, function (s) {
  24423. var newFilterItem = {};
  24424. if (s.operator === 'like') {
  24425. newFilterItem.filterType = 'text';
  24426. newFilterItem.type = 'contains';
  24427. newFilterItem.filter = s.value;
  24428. }
  24429. else {
  24430. // 无法识别的筛选类型
  24431. newFilterItem.filterType = 'dict';
  24432. newFilterItem.type = 'in';
  24433. newFilterItem.filter = s.value;
  24434. }
  24435. customParam.filterModel[s.property] = newFilterItem;
  24436. });
  24437. delete gridParam.filter;
  24438. }
  24439. // 被 grid.constructor 作为方法存在
  24440. var extraParams = _$2.cloneDeep(me.getExtraParams());
  24441. var params = _$2.defaultsDeep(gridParam, extraParams);
  24442. // var request = this.superclass.buildRequest.apply(this, arguments);
  24443. var request = new Ext.data.Request({
  24444. params: {},
  24445. action: operation.getAction(),
  24446. records: operation.getRecords(),
  24447. url: me.buildUrl(),
  24448. jsonData: __assign({ args: [
  24449. params
  24450. ] }, customParam),
  24451. proxy: me
  24452. });
  24453. operation.setRequest(request);
  24454. return request;
  24455. },
  24456. afterRequest: function (req, res) {
  24457. // Extend.afterExtRequest(req, res)
  24458. }
  24459. });
  24460. Ext.define('Ext.ux.data.MyReader', {
  24461. extend: 'Ext.data.reader.Json',
  24462. xtype: 'yvgridreader',
  24463. useSimpleAccessors: false,
  24464. });
  24465. }
  24466. function initBehaviorEdit(config) {
  24467. var _a, _b, _c;
  24468. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  24469. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  24470. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  24471. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  24472. if (dbTableName) {
  24473. // 生成增删查改
  24474. var tbar = [
  24475. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  24476. click: 'system.saveGridRow()'
  24477. }, bind: {
  24478. disabled: '{!' + config.reference + '.ischanged}'
  24479. } }, saveButtonConfig),
  24480. '-',
  24481. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  24482. click: 'system.insertGridRow()'
  24483. } }, addButtonConfig),
  24484. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  24485. click: 'system.removeGridRow()'
  24486. } }, deleteButtonConfig),
  24487. ];
  24488. if (_$2.isArray(config.tbar)) {
  24489. config.tbar = __spread(tbar, [
  24490. '-'
  24491. ], config.tbar);
  24492. }
  24493. else if (_$2.isPlainObject(config.tbar)) {
  24494. config.tbar = {
  24495. border: false,
  24496. layout: {
  24497. type: 'vbox',
  24498. align: 'stretch'
  24499. },
  24500. items: [
  24501. {
  24502. xtype: 'toolbar',
  24503. border: false,
  24504. items: tbar
  24505. },
  24506. config.tbar,
  24507. ]
  24508. };
  24509. }
  24510. else if (_$2.isUndefined(config.tbar)) {
  24511. config.tbar = tbar;
  24512. }
  24513. else {
  24514. console.error("can't build tbar property!", config.tbar);
  24515. }
  24516. }
  24517. }
  24518. function initGridDialog(config) {
  24519. var detailDialog = _$2.get(config, 'detailDialog');
  24520. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  24521. if (_$2.isPlainObject(detailDialog)) {
  24522. var tbar = [
  24523. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  24524. click: 'system.showGridRowDetail()',
  24525. }, bind: {
  24526. disabled: '{!' + config.reference + '.selection}'
  24527. } }, detailButtonConfig)
  24528. ];
  24529. if (_$2.isArray(config.tbar)) {
  24530. config.tbar = __spread(config.tbar, [
  24531. '-'
  24532. ], tbar);
  24533. }
  24534. else if (_$2.isPlainObject(config.tbar)) {
  24535. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  24536. config.tbar.items = __spread(config.tbar.items);
  24537. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  24538. if (!toolbar) {
  24539. config.tbar.items = __spread(config.tbar.items, [
  24540. {
  24541. xtype: 'toolbar',
  24542. border: false,
  24543. items: tbar
  24544. },
  24545. ]);
  24546. }
  24547. else {
  24548. toolbar.items = __spread(toolbar.items, [
  24549. '-'
  24550. ], tbar);
  24551. }
  24552. }
  24553. else {
  24554. config.tbar = {
  24555. border: false,
  24556. layout: {
  24557. type: 'vbox',
  24558. align: 'stretch'
  24559. },
  24560. items: [
  24561. {
  24562. xtype: 'toolbar',
  24563. border: false,
  24564. items: tbar
  24565. },
  24566. config.tbar,
  24567. ]
  24568. };
  24569. }
  24570. }
  24571. else if (_$2.isUndefined(config.tbar)) {
  24572. config.tbar = tbar;
  24573. }
  24574. else {
  24575. console.error("can't build tbar property!", config.tbar);
  24576. }
  24577. }
  24578. }
  24579. var SystemEventFu$1 = /** @class */ (function () {
  24580. function SystemEventFu() {
  24581. }
  24582. SystemEventFu.prototype.showGridRowDetail = function () {
  24583. return function (sender) {
  24584. var grid1 = sender.up('yvgrid');
  24585. showGridRowDetail(grid1);
  24586. };
  24587. };
  24588. __decorate([
  24589. Lib({
  24590. title: '为某个表格所选数据行, 显示其对话框',
  24591. author: '罗一帆',
  24592. createAt: '2022-07-27',
  24593. updateAt: '2022-07-27',
  24594. type: 'system',
  24595. category: '表格',
  24596. }),
  24597. __metadata("design:type", Function),
  24598. __metadata("design:paramtypes", []),
  24599. __metadata("design:returntype", void 0)
  24600. ], SystemEventFu.prototype, "showGridRowDetail", null);
  24601. return SystemEventFu;
  24602. }());
  24603. function showGridRowDetail(grid1, isEdit) {
  24604. if (isEdit === void 0) { isEdit = true; }
  24605. var _a, _b, _c;
  24606. if (!grid1.selection) {
  24607. msg$1('请选中要展示的数据行!');
  24608. return;
  24609. }
  24610. var record = grid1.selection;
  24611. if (_$2.isArray(record)) {
  24612. record = record[0];
  24613. }
  24614. if (!record) {
  24615. msg$1('请选中要展示的数据行!');
  24616. return;
  24617. }
  24618. var config = grid1._originVJson;
  24619. var detailDialog = config.detailDialog;
  24620. var vjson = {};
  24621. var parentScope = lookupScope(grid1);
  24622. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  24623. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  24624. _$2.defaultsDeep(vjson, {
  24625. // 强制属性
  24626. layout: 'fit',
  24627. __custom_path: __custom_path,
  24628. __custom_version: __custom_version,
  24629. fbar: __spread([
  24630. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  24631. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  24632. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  24633. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  24634. }, detailDialog, {
  24635. // 默认属性
  24636. width: 800,
  24637. height: 450,
  24638. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  24639. });
  24640. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  24641. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  24642. vjson.items.push(tabpanel);
  24643. if (tabpanel) {
  24644. // 有多个选项卡,按每个选项卡进行过滤
  24645. _$2.forEach(tabpanel.items, function (tab) {
  24646. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  24647. if (tabColumns.length > 0) {
  24648. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  24649. _$2.extend(tab, tabVjson);
  24650. }
  24651. });
  24652. }
  24653. }
  24654. else {
  24655. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  24656. }
  24657. var model = {
  24658. data: {
  24659. _edit: isEdit,
  24660. _editType: isEdit ? '编辑' : '添加',
  24661. }
  24662. };
  24663. _$2.forOwn(record.data, function (value, key) {
  24664. if (key === 'id') {
  24665. // 忽略 ID 属性
  24666. return;
  24667. }
  24668. if (_$2.startsWith(key, '_')) {
  24669. // 忽略 _ 开头的所有属性
  24670. return;
  24671. }
  24672. model.data[key] = value;
  24673. });
  24674. console.log(vjson);
  24675. var scope = new Scope({ vjson: vjson, model: model, });
  24676. //@ts-ignore
  24677. scope.commit = function () {
  24678. return new Promise(function (resolve) {
  24679. _$2.forOwn(scope.viewModel.data, function (value, key) {
  24680. if (_$2.startsWith(key, '_')) {
  24681. // _origin 等属性可以被忽略
  24682. return;
  24683. }
  24684. if (key === 'id') {
  24685. // id 属性被忽略
  24686. return;
  24687. }
  24688. record.set(key, value);
  24689. });
  24690. resolve();
  24691. });
  24692. };
  24693. scope.showDialog(grid1, {}, {});
  24694. }
  24695. function buildForm(columns, tabpanel, detailDialog) {
  24696. var vjson = __assign({ border: false, layout: {
  24697. type: 'vbox',
  24698. pack: 'start',
  24699. align: 'stretch'
  24700. }, defaults: {
  24701. border: false,
  24702. anchor: '100%',
  24703. margin: '5',
  24704. }, scrollable: true, items: [] }, detailDialog.form);
  24705. var emptyFieldset = [];
  24706. var fieldsetList = [];
  24707. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  24708. _$2.forEach(columns, function (c) {
  24709. var fieldset = _$2.get(c, 'form.fieldset');
  24710. if (fieldset) {
  24711. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  24712. if (idx < 0) {
  24713. fieldsetList.push({
  24714. fieldset: fieldset,
  24715. columns: [c]
  24716. });
  24717. }
  24718. else {
  24719. fieldsetList[idx].columns.push(c);
  24720. }
  24721. }
  24722. else {
  24723. emptyFieldset.push(c);
  24724. }
  24725. });
  24726. _$2.forEach(fieldsetList, function (fs) {
  24727. var fieldSetVjson = {
  24728. xtype: 'fieldset',
  24729. title: fs.fieldset,
  24730. items: []
  24731. };
  24732. buildFieldItems(fieldSetVjson.items, fs.columns);
  24733. vjson.items.push(fieldSetVjson);
  24734. });
  24735. buildFieldItems(vjson.items, emptyFieldset);
  24736. return vjson;
  24737. }
  24738. // 构建字段组
  24739. function buildFieldItems(items, columns) {
  24740. var _a, _b, _c, _d, _e;
  24741. var row = {
  24742. xtype: 'cols',
  24743. items: []
  24744. };
  24745. for (var i = 0; i < columns.length; i++) {
  24746. var column = columns[i];
  24747. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  24748. delete row.xtype;
  24749. row.layout = column.form.rowlayout;
  24750. }
  24751. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  24752. row.items.push({ border: false, flex: column.form.prefix });
  24753. }
  24754. var fieldVjson = buildField(column, row.items.length);
  24755. if (!fieldVjson) {
  24756. continue;
  24757. }
  24758. row.items.push(fieldVjson);
  24759. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  24760. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  24761. }
  24762. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  24763. items.push(row);
  24764. row = {
  24765. xtype: 'cols',
  24766. items: []
  24767. };
  24768. }
  24769. }
  24770. if (row.items.length > 0) {
  24771. items.push(row);
  24772. }
  24773. }
  24774. // 构建字段
  24775. function buildField(column, colIdx) {
  24776. var ret;
  24777. if (column.xtype === 'checkcolumn') {
  24778. ret = _$2.defaultsDeep({
  24779. xtype: 'checkbox',
  24780. uncheckedValue: column.uncheckedValue,
  24781. checkedValue: column.checkedValue,
  24782. boxLabel: column.header,
  24783. bind: {
  24784. value: '{' + column.dataIndex + '}'
  24785. }
  24786. }, column.form);
  24787. if (colIdx == 0) {
  24788. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  24789. ret.margin = '0 0 0 85';
  24790. }
  24791. }
  24792. else {
  24793. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  24794. fieldLabel: column.header,
  24795. bind: {
  24796. value: '{' + column.dataIndex + '}'
  24797. },
  24798. });
  24799. }
  24800. if (!ret.xtype) {
  24801. return;
  24802. }
  24803. if (!ret.dict && ret.xtype === 'combo') {
  24804. ret.dict = column.dict;
  24805. }
  24806. // 删除辅助属性
  24807. delete ret.order;
  24808. delete ret.wrap;
  24809. return ret;
  24810. }
  24811. var model$o = {
  24812. data: {}
  24813. };
  24814. var vjson$o = {
  24815. title: '自定义表格属性',
  24816. layout: 'fit',
  24817. width: 980,
  24818. height: 500,
  24819. fbar: [
  24820. {
  24821. xtype: "button",
  24822. text: "保存",
  24823. iconCls: 'x-fa fa-save',
  24824. listeners: {
  24825. click: 'scope.commit',
  24826. }
  24827. },
  24828. {
  24829. xtype: "button",
  24830. text: "关闭",
  24831. iconCls: 'x-fa fa-times',
  24832. listeners: {
  24833. click: 'system.closeMe()',
  24834. }
  24835. },
  24836. ],
  24837. items: [
  24838. {
  24839. region: 'center',
  24840. xtype: 'tabpanel',
  24841. items: [
  24842. {
  24843. title: '基本信息', reference: 'basic',
  24844. layout: {
  24845. type: 'vbox',
  24846. pack: 'start',
  24847. align: 'stretch'
  24848. },
  24849. defaults: {
  24850. border: false,
  24851. anchor: '100%',
  24852. margin: '5',
  24853. },
  24854. scrollable: true,
  24855. items: [
  24856. {
  24857. xtype: 'cols',
  24858. items: [
  24859. {
  24860. fieldLabel: '路径',
  24861. bind: { value: '{__custom_path}' },
  24862. xtype: 'textfield',
  24863. flex: 2,
  24864. },
  24865. {
  24866. fieldLabel: '版本',
  24867. bind: { value: '{__custom_version}' },
  24868. xtype: 'textfield',
  24869. },
  24870. ]
  24871. },
  24872. {
  24873. xtype: 'cols',
  24874. items: [
  24875. {
  24876. fieldLabel: '配置点',
  24877. bind: { value: '{__custom_point}' },
  24878. xtype: 'textfield',
  24879. },
  24880. {
  24881. fieldLabel: 'reference',
  24882. bind: { value: '{reference}' },
  24883. xtype: 'textfield',
  24884. },
  24885. {
  24886. fieldLabel: '编辑模式',
  24887. bind: { value: '{_mode}' },
  24888. xtype: 'combo',
  24889. dict: 'GRID_MODE',
  24890. },
  24891. ]
  24892. },
  24893. {
  24894. layout: 'hbox',
  24895. defaults: {
  24896. margin: '0 0 0 15',
  24897. },
  24898. items: [
  24899. {
  24900. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  24901. bind: {
  24902. value: "{hideFootbar}"
  24903. }
  24904. },
  24905. {
  24906. boxLabel: '隐藏刷新', xtype: 'checkbox',
  24907. bind: {
  24908. value: "{hideRefresh}"
  24909. }
  24910. },
  24911. {
  24912. boxLabel: '隐藏导出', xtype: 'checkbox',
  24913. bind: {
  24914. value: "{hideExport}"
  24915. }
  24916. },
  24917. {
  24918. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  24919. bind: {
  24920. value: "{hideAutoSize}"
  24921. }
  24922. },
  24923. {
  24924. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  24925. bind: {
  24926. value: "{hideClearFilter}"
  24927. }
  24928. },
  24929. {
  24930. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  24931. bind: {
  24932. value: "{hideSaveGridUIConfig}"
  24933. }
  24934. },
  24935. {
  24936. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  24937. bind: {
  24938. value: "{hideClearGridUIConfig}"
  24939. }
  24940. },
  24941. ]
  24942. },
  24943. {
  24944. layout: 'hbox',
  24945. defaults: {
  24946. margin: '0 0 0 15',
  24947. },
  24948. items: [
  24949. {
  24950. boxLabel: '自动载入数据源', xtype: 'checkbox',
  24951. bind: { value: '{autoLoad}' },
  24952. margin: '0 0 0 85',
  24953. },
  24954. {
  24955. boxLabel: '分页模式', xtype: 'checkbox',
  24956. bind: { value: '{pagination}' },
  24957. },
  24958. {
  24959. boxLabel: '显示行序号', xtype: 'checkbox',
  24960. bind: { value: '{show_rownum}' },
  24961. },
  24962. {
  24963. boxLabel: '后端排序', xtype: 'checkbox',
  24964. bind: {
  24965. value: "{remoteSort}"
  24966. }
  24967. },
  24968. {
  24969. boxLabel: '后端过滤', xtype: 'checkbox',
  24970. bind: {
  24971. value: "{remoteFilter}"
  24972. }
  24973. },
  24974. {
  24975. boxLabel: '隐藏', xtype: 'checkbox',
  24976. bind: {
  24977. value: "{hidden}"
  24978. }
  24979. },
  24980. ]
  24981. },
  24982. {
  24983. layout: 'hbox',
  24984. defaults: {
  24985. margin: '0 0 0 15',
  24986. },
  24987. items: [
  24988. {
  24989. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  24990. bind: {
  24991. value: "{enableColumnHide}"
  24992. }
  24993. },
  24994. {
  24995. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  24996. bind: {
  24997. value: "{enableColumnMove}"
  24998. }
  24999. },
  25000. {
  25001. boxLabel: '自定义筛选', xtype: 'checkbox',
  25002. bind: {
  25003. value: "{gridfilters}"
  25004. }
  25005. },
  25006. {
  25007. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  25008. bind: {
  25009. value: "{enableColumnResize}"
  25010. }
  25011. },
  25012. {
  25013. boxLabel: '点击列头排序', xtype: 'checkbox',
  25014. bind: {
  25015. value: "{sortOnClick}"
  25016. }
  25017. },
  25018. ]
  25019. },
  25020. {
  25021. xtype: 'cols',
  25022. items: [
  25023. {
  25024. fieldLabel: 'dbTableName',
  25025. labelWidth: 110,
  25026. bind: { value: '{behavior.dbTableName}' },
  25027. xtype: 'textfield',
  25028. },
  25029. {
  25030. fieldLabel: 'theid',
  25031. bind: { value: '{theid}' },
  25032. xtype: 'textfield',
  25033. },
  25034. {
  25035. fieldLabel: '添加行聚焦',
  25036. bind: { value: '{behavior.focusColumnAfterInsert}' },
  25037. xtype: 'textfield',
  25038. },
  25039. ]
  25040. },
  25041. {
  25042. xtype: 'cols',
  25043. items: [
  25044. {
  25045. fieldLabel: '批量删除提示',
  25046. labelWidth: 110,
  25047. bind: { value: '{behavior.batchRemoveConfirm}' },
  25048. xtype: 'textfield',
  25049. },
  25050. {
  25051. fieldLabel: '删除提示',
  25052. bind: { value: '{behavior.singleRemoveConfirm}' },
  25053. xtype: 'textfield',
  25054. },
  25055. {
  25056. fieldLabel: '触发刷新',
  25057. labelWidth: 110,
  25058. bind: { value: '{behavior.selectToReload}' },
  25059. xtype: 'textfield',
  25060. },
  25061. ]
  25062. },
  25063. ]
  25064. },
  25065. {
  25066. title: '字段', reference: 'grid1',
  25067. xtype: 'yvgrid',
  25068. pagination: false,
  25069. _mode: 'edit',
  25070. listeners: {
  25071. buttonclick: 'scope.grid1Buttonclick',
  25072. },
  25073. hideFootbar: true,
  25074. tbar: [
  25075. {
  25076. xtype: 'button',
  25077. text: '添加',
  25078. iconCls: 'x-fa fa-plus-circle',
  25079. listeners: {
  25080. click: 'scope.addField'
  25081. }
  25082. },
  25083. {
  25084. xtype: 'button',
  25085. text: '删除',
  25086. iconCls: 'x-fa fa-minus-circle',
  25087. listeners: {
  25088. click: 'scope.removeField'
  25089. }
  25090. },
  25091. '-',
  25092. {
  25093. xtype: 'button',
  25094. text: '自动分析',
  25095. iconCls: 'x-fa fa-code-fork',
  25096. listeners: {
  25097. click: 'scope.calcField'
  25098. }
  25099. },
  25100. {
  25101. xtype: 'button',
  25102. text: '上移',
  25103. iconCls: 'x-fa fa-arrow-up',
  25104. listeners: {
  25105. click: 'scope.moveUp'
  25106. }
  25107. },
  25108. {
  25109. xtype: 'button',
  25110. text: '下移',
  25111. iconCls: 'x-fa fa-arrow-down',
  25112. listeners: {
  25113. click: 'scope.moveDown'
  25114. }
  25115. },
  25116. ],
  25117. store: {},
  25118. columns: [
  25119. {
  25120. dataIndex: 'dataIndex', header: "字段名", width: 140,
  25121. editor: { xtype: 'textfield' }
  25122. },
  25123. {
  25124. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  25125. editor: { xtype: 'textfield' }
  25126. },
  25127. {
  25128. dataIndex: 'header', header: '中文', width: 140,
  25129. editor: { xtype: 'textfield' }
  25130. },
  25131. {
  25132. dataIndex: 'dict', header: '字典', width: 110,
  25133. editor: { xtype: 'combogrid' }
  25134. },
  25135. {
  25136. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  25137. editor: { xtype: 'combogrid' }, hidden: true,
  25138. },
  25139. {
  25140. dataIndex: 'width', header: '宽度', width: 80,
  25141. editor: { xtype: 'numberfield' }, hidden: true,
  25142. },
  25143. {
  25144. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  25145. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  25146. },
  25147. {
  25148. dataIndex: 'serverCreateValue', header: '服务端创建值',
  25149. editor: { xtype: 'textfield' },
  25150. },
  25151. {
  25152. dataIndex: 'createValue', text: '客户端新创建值',
  25153. editor: { xtype: 'textfield' },
  25154. },
  25155. {
  25156. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  25157. resizable: false, sortable: false, menuDisabled: true,
  25158. checkedValue: true, uncheckedValue: false,
  25159. },
  25160. {
  25161. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  25162. resizable: false, sortable: false, menuDisabled: true,
  25163. checkedValue: true, uncheckedValue: false,
  25164. },
  25165. {
  25166. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  25167. resizable: false, sortable: false, menuDisabled: true,
  25168. checkedValue: true, uncheckedValue: false,
  25169. },
  25170. {
  25171. dataIndex: 'formatter', header: '格式化', width: 110,
  25172. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  25173. },
  25174. {
  25175. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  25176. resizable: false, sortable: false, menuDisabled: true,
  25177. checkedValue: true, uncheckedValue: false, hidden: true,
  25178. },
  25179. {
  25180. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  25181. resizable: false, sortable: false, menuDisabled: true,
  25182. hidden: true,
  25183. },
  25184. {
  25185. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  25186. resizable: false, sortable: false, menuDisabled: true,
  25187. checkedValue: true, uncheckedValue: false, hidden: true,
  25188. },
  25189. {
  25190. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  25191. resizable: false, sortable: false, menuDisabled: true,
  25192. },
  25193. {
  25194. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  25195. resizable: false, sortable: false, menuDisabled: true,
  25196. checkedValue: true, uncheckedValue: false, hidden: true,
  25197. },
  25198. {
  25199. dataIndex: 'form_order', text: '对话框序号',
  25200. editor: { xtype: 'numberfield' },
  25201. },
  25202. {
  25203. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  25204. resizable: false, sortable: false, menuDisabled: true,
  25205. checkedValue: true, uncheckedValue: false,
  25206. },
  25207. {
  25208. dataIndex: 'form_xtype', text: '对话框编辑器',
  25209. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  25210. },
  25211. {
  25212. dataIndex: 'form_fieldset', text: '对话框字段组',
  25213. editor: { xtype: 'textfield' }, hidden: true,
  25214. },
  25215. {
  25216. dataIndex: 'form_tab', text: '对话框选项卡',
  25217. editor: { xtype: 'textfield' }, hidden: true,
  25218. },
  25219. {
  25220. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  25221. resizable: false, sortable: false, menuDisabled: true,
  25222. checkedValue: true, uncheckedValue: false, hidden: true,
  25223. },
  25224. ],
  25225. },
  25226. {
  25227. title: 'SQL和查询条件', reference: 'sql',
  25228. layout: 'border',
  25229. border: false,
  25230. items: [
  25231. {
  25232. region: 'north',
  25233. height: 200,
  25234. border: false,
  25235. split: true,
  25236. xtype: 'yvgrid',
  25237. reference: 'gridCondition',
  25238. pagination: false,
  25239. hideFootbar: true,
  25240. _mode: 'edit',
  25241. listeners: {
  25242. buttonclick: 'scope.conditionButtonclick',
  25243. },
  25244. store: {},
  25245. tbar: {
  25246. xtype: 'toolbar',
  25247. border: false,
  25248. items: [
  25249. {
  25250. xtype: 'button',
  25251. text: '添加条件',
  25252. iconCls: 'x-fa fa-plus-circle',
  25253. listeners: {
  25254. click: 'scope.addCondition'
  25255. }
  25256. },
  25257. {
  25258. xtype: 'button',
  25259. text: '删除条件',
  25260. iconCls: 'x-fa fa-minus-circle',
  25261. listeners: {
  25262. click: 'scope.removeCondition'
  25263. }
  25264. },
  25265. '-',
  25266. {
  25267. xtype: 'button',
  25268. text: '自动分析条件变量',
  25269. iconCls: 'x-fa fa-code-fork',
  25270. listeners: {
  25271. click: 'scope.calcCondition'
  25272. }
  25273. },
  25274. {
  25275. xtype: 'button',
  25276. text: '上移',
  25277. iconCls: 'x-fa fa-arrow-up',
  25278. listeners: {
  25279. click: 'scope.moveUpCondition'
  25280. }
  25281. },
  25282. {
  25283. xtype: 'button',
  25284. text: '下移',
  25285. iconCls: 'x-fa fa-arrow-down',
  25286. listeners: {
  25287. click: 'scope.moveDownCondition'
  25288. }
  25289. },
  25290. ]
  25291. },
  25292. columns: [
  25293. {
  25294. text: '条件变量',
  25295. dataIndex: 'param_name',
  25296. width: 140,
  25297. sortable: false,
  25298. menuDisabled: true,
  25299. editor: {
  25300. selectOnFocus: true
  25301. },
  25302. },
  25303. {
  25304. text: '中文标题',
  25305. dataIndex: 'fieldLabel',
  25306. width: 120,
  25307. sortable: false,
  25308. menuDisabled: true,
  25309. editor: {
  25310. selectOnFocus: true
  25311. },
  25312. },
  25313. {
  25314. text: '编辑类型',
  25315. dataIndex: 'xtype',
  25316. width: 80,
  25317. sortable: false,
  25318. menuDisabled: true,
  25319. editor: {
  25320. xtype: 'combo',
  25321. typeAhead: true,
  25322. triggerAction: 'all',
  25323. selectOnFocus: true,
  25324. store: [
  25325. ['textfield', 'textfield'],
  25326. ['combo', 'combo'],
  25327. ['datefield', 'datefield'],
  25328. ['datetimefield', 'datetimefield'],
  25329. ['numberfield', 'numberfield'],
  25330. ['multiplesearch', 'multiplesearch'],
  25331. ]
  25332. }
  25333. },
  25334. {
  25335. text: '权重',
  25336. dataIndex: 'conditionFieldFlex',
  25337. align: 'right',
  25338. width: 60,
  25339. sortable: false,
  25340. menuDisabled: true,
  25341. editor: {
  25342. xtype: 'numberfield',
  25343. selectOnFocus: false,
  25344. minValue: 0,
  25345. maxValue: 10
  25346. },
  25347. },
  25348. {
  25349. text: '字典',
  25350. dataIndex: 'conditionFieldDict',
  25351. width: 160,
  25352. sortable: false,
  25353. menuDisabled: true,
  25354. editor: {
  25355. selectOnFocus: false
  25356. },
  25357. },
  25358. {
  25359. xtype: 'checkcolumn',
  25360. dataIndex: "conditionFieldWrap", header: "换行",
  25361. width: 65,
  25362. sortable: false,
  25363. menuDisabled: true,
  25364. },
  25365. {
  25366. text: '扩展参数',
  25367. dataIndex: 'conditionFieldExtend',
  25368. sortable: false,
  25369. menuDisabled: true,
  25370. editor: {
  25371. selectOnFocus: false
  25372. },
  25373. },
  25374. ]
  25375. },
  25376. {
  25377. region: 'center',
  25378. xtype: 'sqleditor',
  25379. layout: 'fit',
  25380. reference: 'sqlEditor',
  25381. split: true,
  25382. },
  25383. ]
  25384. },
  25385. {
  25386. title: '详情对话框',
  25387. layout: {
  25388. type: 'vbox',
  25389. pack: 'start',
  25390. align: 'stretch'
  25391. },
  25392. defaults: {
  25393. border: false,
  25394. anchor: '100%',
  25395. margin: '5',
  25396. },
  25397. scrollable: true,
  25398. items: [
  25399. {
  25400. xtype: 'cols',
  25401. items: [
  25402. {
  25403. fieldLabel: '对话框标题',
  25404. bind: { value: '{detailDialog.title}' },
  25405. xtype: 'textfield',
  25406. flex: 2,
  25407. },
  25408. {
  25409. fieldLabel: '宽度',
  25410. bind: { value: '{detailDialog.width}' },
  25411. xtype: 'numberfield',
  25412. },
  25413. {
  25414. fieldLabel: '高度',
  25415. bind: { value: '{detailDialog.height}' },
  25416. xtype: 'numberfield',
  25417. },
  25418. ]
  25419. },
  25420. ]
  25421. },
  25422. {
  25423. title: '界面源码',
  25424. xtype: 'jseditor',
  25425. reference: 'jseditor'
  25426. }
  25427. ]
  25428. }
  25429. ]
  25430. };
  25431. var GridColumnCustom = /** @class */ (function (_super) {
  25432. __extends(GridColumnCustom, _super);
  25433. function GridColumnCustom() {
  25434. return _super.call(this, { model: model$o, vjson: vjson$o }) || this;
  25435. }
  25436. GridColumnCustom.prototype.commit = function () {
  25437. };
  25438. GridColumnCustom.prototype.grid1Buttonclick = function () {
  25439. };
  25440. GridColumnCustom.prototype.conditionButtonclick = function () {
  25441. };
  25442. GridColumnCustom.prototype.addField = function () {
  25443. };
  25444. GridColumnCustom.prototype.removeField = function () {
  25445. };
  25446. GridColumnCustom.prototype.calcField = function () {
  25447. };
  25448. GridColumnCustom.prototype.moveUp = function () {
  25449. };
  25450. GridColumnCustom.prototype.moveDown = function () {
  25451. };
  25452. GridColumnCustom.prototype.addCondition = function () {
  25453. };
  25454. GridColumnCustom.prototype.removeCondition = function () {
  25455. };
  25456. GridColumnCustom.prototype.calcCondition = function () {
  25457. };
  25458. GridColumnCustom.prototype.moveUpCondition = function () {
  25459. };
  25460. GridColumnCustom.prototype.moveDownCondition = function () {
  25461. };
  25462. return GridColumnCustom;
  25463. }(Scope));
  25464. function initGridCode(grid, newConfig, buttons) {
  25465. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  25466. buttons.push({
  25467. xtype: 'button',
  25468. tooltip: '定义表格属性',
  25469. iconCls: 'x-fa fa-codepen',
  25470. handler: function (btn) {
  25471. var customWindow = new GridColumnCustom();
  25472. customWindow.showDialog(btn, {}, {});
  25473. }
  25474. });
  25475. buttons.push({
  25476. xtype: 'button',
  25477. tooltip: '定义表格数据源',
  25478. iconCls: 'x-fa fa-database',
  25479. handler: function () {
  25480. // showCustomGridDataSource(grid)
  25481. }
  25482. });
  25483. }
  25484. }
  25485. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  25486. var hexToString = function (hex) {
  25487. var arr = hex.split("");
  25488. var out = "";
  25489. for (var i = 0; i < arr.length / 2; i++) {
  25490. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  25491. // @ts-ignore
  25492. var charValue = String.fromCharCode(tmp);
  25493. out += charValue;
  25494. }
  25495. return out;
  25496. };
  25497. var defaultGrid = grid;
  25498. function initGrid () {
  25499. Ext.define('Yvan.Grid', {
  25500. extend: 'Ext.grid.Panel',
  25501. xtype: 'yvgrid',
  25502. __suspendReload: false,
  25503. _originVJson: {},
  25504. constructor: function (config) {
  25505. var _this = this;
  25506. var _a, _b, _c, _d, _e, _f;
  25507. var me = this;
  25508. var dataSource = config.dataSource;
  25509. 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);
  25510. me._originVJson = config;
  25511. if (!isDesignMode(scope, config)) {
  25512. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  25513. if (Array.isArray(config.columns) && config.columns.length > 0) {
  25514. var cacheData = this.getColumnConfigCache();
  25515. if (Array.isArray(cacheData) && cacheData.length > 0) {
  25516. var newColumns = [];
  25517. for (var j = 0; j < cacheData.length; j++) {
  25518. var itData = cacheData[j];
  25519. for (var i = 0; i < config.columns.length; i++) {
  25520. var column = config.columns[i];
  25521. if (itData.dataIndex === column.dataIndex) {
  25522. if (itData.width) {
  25523. column.width = itData.width;
  25524. }
  25525. column.hidden = itData.hidden;
  25526. column.locked = itData.locked;
  25527. newColumns.push(column);
  25528. break;
  25529. }
  25530. }
  25531. }
  25532. config.columns = newColumns;
  25533. }
  25534. }
  25535. }
  25536. var newConfig = _$2.defaultsDeep({
  25537. // 强制性属性 bug.
  25538. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  25539. // enableLocking: false,
  25540. // syncRowHeight: false,
  25541. }, baseConfig(config, 'row-item'), config, grid);
  25542. // 在面板上的组件
  25543. // const scope = newConfig.$initParent?.yvanScope ||
  25544. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  25545. // config.$vmParent?.yvanScope ||
  25546. // newConfig.$vmParent?._parent?.yvanScope;
  25547. var buttons = [];
  25548. var getRowClass = newConfig.getRowClass;
  25549. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  25550. _$2.startsWith(getRowClass, "system."))) {
  25551. var fn = lookupFn(scope, getRowClass);
  25552. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  25553. }
  25554. if (!newConfig.hideExport) {
  25555. buttons.push({
  25556. xtype: 'button',
  25557. tooltip: '导出Excel',
  25558. iconCls: 'x-fa fa-download',
  25559. listeners: {
  25560. click: this.exportExcel
  25561. },
  25562. });
  25563. }
  25564. if (!newConfig.hideAutoSize) {
  25565. buttons.push({
  25566. xtype: 'button',
  25567. iconCls: 'x-fa fa-text-width',
  25568. tooltip: '自适应宽度',
  25569. listeners: {
  25570. click: this.autoSizeColumns
  25571. }
  25572. });
  25573. }
  25574. if (!newConfig.hideClearFilter) {
  25575. buttons.push({
  25576. xtype: 'button',
  25577. tooltip: '清空筛选',
  25578. iconCls: 'x-fa fa-filter',
  25579. handler: this.clearFilter
  25580. });
  25581. }
  25582. if (!newConfig.hideSaveGridUIConfig) {
  25583. buttons.push({
  25584. xtype: 'button',
  25585. tooltip: '保存布局',
  25586. iconCls: 'x-fa fa-cogs',
  25587. handler: this.saveGridUIConfig
  25588. });
  25589. }
  25590. if (!newConfig.hideClearGridUIConfig) {
  25591. buttons.push({
  25592. xtype: 'button',
  25593. tooltip: '还原布局',
  25594. iconCls: 'x-fa fa-reply-all',
  25595. handler: this.clearGridUIConfig
  25596. });
  25597. }
  25598. initGridCode(me, newConfig, buttons);
  25599. if (!newConfig.hideFootbar) {
  25600. if (newConfig.pagination) {
  25601. newConfig.bbar = new Ext.PagingToolbar({
  25602. // pageSize: newConfig.pageSize, 这个值是无效的
  25603. displayInfo: true,
  25604. store: this.store,
  25605. emptyMsg: '没有记录',
  25606. cls: 'grid-bbar',
  25607. items: __spread([
  25608. {
  25609. xtype: 'combobox',
  25610. tooltip: '分页',
  25611. queryMode: 'local',
  25612. editable: false,
  25613. allowBlank: true,
  25614. labelAlign: 'right',
  25615. width: 90,
  25616. // labelWidth: 30,
  25617. listConfig: {
  25618. minWidth: null
  25619. },
  25620. value: 50,
  25621. valueField: undefined,
  25622. displayField: undefined,
  25623. hideClear: true,
  25624. store: newConfig.pageSizeOption,
  25625. listeners: {
  25626. change: function (sender, nv, ov) {
  25627. _this.store.pageSize = nv;
  25628. _this.store.loadPage(1);
  25629. }
  25630. }
  25631. }
  25632. ], buttons),
  25633. doRefresh: function () {
  25634. me.reload();
  25635. }
  25636. });
  25637. }
  25638. else {
  25639. newConfig.bbar = {
  25640. xtype: 'toolbar', overflowHandler: 'menu',
  25641. cls: 'grid-bbar',
  25642. items: __spread([
  25643. {
  25644. xtype: 'button',
  25645. tooltip: '刷新',
  25646. iconCls: 'x-fa fa-refresh',
  25647. handler: function () {
  25648. _this.reload();
  25649. }
  25650. },
  25651. '-'
  25652. ], buttons)
  25653. };
  25654. if (newConfig.hideRefresh) {
  25655. newConfig.bbar.items.splice(0, 1);
  25656. }
  25657. }
  25658. }
  25659. if (_$2.isArray(newConfig.condition)) {
  25660. // 带查询条件
  25661. var conditionRows_1 = [];
  25662. var newRow_1 = false;
  25663. var currentRow_1 = { xtype: 'cols', items: [], };
  25664. conditionRows_1.push(currentRow_1);
  25665. _$2.forEach(newConfig.condition, function (item) {
  25666. var _a;
  25667. if (newRow_1) {
  25668. currentRow_1 = { xtype: 'cols', items: [], };
  25669. conditionRows_1.push(currentRow_1);
  25670. }
  25671. var vj = _$2.cloneDeep(item);
  25672. if (vj.xtype) {
  25673. if (item.xtype === 'combo' && item.dict) {
  25674. vj.fix = ['system.getDict("' + item.dict + '")'];
  25675. }
  25676. if (item.xtype === 'datetimefield') {
  25677. _$2.defer(function () {
  25678. //@ts-ignore
  25679. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  25680. });
  25681. }
  25682. else if (item.xtype === 'datefield') {
  25683. _$2.defer(function () {
  25684. //@ts-ignore
  25685. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  25686. });
  25687. }
  25688. else {
  25689. scope.viewModel.set(item.param_name, '');
  25690. }
  25691. }
  25692. else {
  25693. // 没有组件类型,是个空占位符
  25694. vj.border = false;
  25695. }
  25696. if (item.param_name) {
  25697. vj.bind = {
  25698. value: '{' + item.param_name + '}'
  25699. };
  25700. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  25701. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  25702. }
  25703. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  25704. currentRow_1.items.push(vj);
  25705. });
  25706. newConfig.tbar = {
  25707. xtype: 'form',
  25708. border: false,
  25709. items: conditionRows_1,
  25710. defaults: {
  25711. margin: '8 0 8 0'
  25712. },
  25713. };
  25714. console.log('newConfig', newConfig);
  25715. }
  25716. _$2.each(newConfig.columns, function (c) {
  25717. var renderer = c.renderer, formatter = c.formatter;
  25718. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  25719. _$2.startsWith(renderer, "system."))) {
  25720. if (newConfig.$initParent) {
  25721. if (scope) {
  25722. var rendererFn = lookupFn(scope, renderer);
  25723. c.renderer = rendererFn.bind(scope);
  25724. }
  25725. }
  25726. }
  25727. if (c.dict) {
  25728. c.fix = ['system.getDict("' + c.dict + '")'];
  25729. if (c.editor && c.editor.xtype === 'combo') {
  25730. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  25731. c.editor.typeAhead = true;
  25732. c.editor.triggerAction = 'all';
  25733. c.editor.selectOnFocus = false;
  25734. c.editor.listConfig = {
  25735. minWidth: 200
  25736. };
  25737. }
  25738. }
  25739. if (formatter === 'button') {
  25740. c.tdCls = 'td-btn';
  25741. if (!c.listeners) {
  25742. c.listeners = {};
  25743. }
  25744. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  25745. if ($(event.target).is('input')) {
  25746. me.fireEvent('buttonclick', me, this, record);
  25747. }
  25748. };
  25749. }
  25750. else if (formatter === 'percentRenderer') {
  25751. c.tdCls = 'td-percent';
  25752. }
  25753. });
  25754. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  25755. // 强制为编辑模式
  25756. newConfig.selModel = {
  25757. type: 'spreadsheet',
  25758. columnSelect: true,
  25759. pruneRemoved: false,
  25760. extensible: 'y'
  25761. };
  25762. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  25763. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  25764. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  25765. }
  25766. else {
  25767. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  25768. }
  25769. }
  25770. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  25771. // 强制为勾选模式
  25772. newConfig.selModel = {
  25773. type: 'checkboxmodel',
  25774. mode: 'MULTI',
  25775. };
  25776. }
  25777. else if (newConfig._mode === 'checkonly') {
  25778. newConfig.selModel = {
  25779. type: 'checkboxmodel',
  25780. mode: 'MULTI',
  25781. checkOnly: true,
  25782. };
  25783. }
  25784. else if (newConfig._mode === 'select') {
  25785. // 强制为选择模式
  25786. newConfig.selModel = {
  25787. selType: 'rowmodel',
  25788. mode: 'SINGLE',
  25789. };
  25790. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  25791. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  25792. }
  25793. }
  25794. initBehaviorEdit(newConfig);
  25795. initGridDialog(newConfig);
  25796. this.superclass.constructor.call(this, newConfig);
  25797. this.store.pageSize = newConfig.pageSize;
  25798. },
  25799. setData: function (value) {
  25800. var me = this;
  25801. me._setDataReal(value);
  25802. },
  25803. /**
  25804. * 添加行,并进入编辑状态
  25805. * @param record 新行的属性集
  25806. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  25807. */
  25808. appendEditRow: function (record, editRowCol) {
  25809. var records = this.getStore().add(record);
  25810. var recNew = records[0];
  25811. this.setSelection(records);
  25812. if (typeof editRowCol === 'string' && editRowCol) {
  25813. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  25814. }
  25815. if (typeof editRowCol === 'number') {
  25816. var ce = this.findPlugin('cellediting');
  25817. this.editingPlugin = ce;
  25818. ce.startEdit(recNew, editRowCol);
  25819. }
  25820. },
  25821. beginEdit: function (record, editRowCol) {
  25822. if (typeof record === 'number') {
  25823. record = this.store.data.getAt(record);
  25824. }
  25825. if (record.isEntity === true) {
  25826. this.setSelection([record]);
  25827. if (typeof editRowCol === 'string' && editRowCol) {
  25828. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  25829. }
  25830. if (typeof editRowCol === 'number') {
  25831. var ce = this.findPlugin('cellediting');
  25832. this.editingPlugin = ce;
  25833. ce.startEdit(record, editRowCol);
  25834. }
  25835. }
  25836. },
  25837. /**
  25838. * 移除行
  25839. * @param record 如果记录传空,就是当前选中的行
  25840. */
  25841. removeEditRow: function (record) {
  25842. if (!record) {
  25843. record = this.selection;
  25844. }
  25845. if (!record) {
  25846. msg('请选中要删除的行');
  25847. return;
  25848. }
  25849. this.getStore().remove(record);
  25850. },
  25851. /**
  25852. * 获取全部原始数据
  25853. */
  25854. getDataRows: function () {
  25855. return this.getStore().data.items.map(function (r) { return r.data; });
  25856. },
  25857. /**
  25858. * 获取全部原始数据, 不带 id/ 不带 origin
  25859. */
  25860. getDataRowsOnlyData: function () {
  25861. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  25862. delete r.id;
  25863. delete r._origin;
  25864. return r;
  25865. });
  25866. },
  25867. rowMoveUp: function () {
  25868. var grid = this;
  25869. if (!grid.selection) {
  25870. msg('无法对多行进行移动');
  25871. return;
  25872. }
  25873. var record = grid.selection;
  25874. if (_$2.isArray(record)) {
  25875. record = record[0];
  25876. }
  25877. if (!record) {
  25878. msg('无法对多行进行移动');
  25879. return;
  25880. }
  25881. // const records = grid.selModel.getSelection()
  25882. // if (records.length !== 1) {
  25883. // msg('无法对多行进行移动')
  25884. // return
  25885. // }
  25886. //
  25887. // const [record] = records
  25888. var index = grid.store.indexOf(record);
  25889. if (index > 0) {
  25890. grid.store.removeAt(index);
  25891. grid.store.insert(index - 1, record);
  25892. grid.getView().refresh();
  25893. grid.selModel.select([record]);
  25894. }
  25895. },
  25896. rowMoveDown: function () {
  25897. var grid = this;
  25898. // const records = grid.selModel.getSelection()
  25899. // if (records.length !== 1) {
  25900. // msg('无法对多行进行移动')
  25901. // return
  25902. // }
  25903. if (!grid.selection) {
  25904. msg('无法对多行进行移动');
  25905. return;
  25906. }
  25907. var record = grid.selection;
  25908. if (_$2.isArray(record)) {
  25909. record = record[0];
  25910. }
  25911. if (!record) {
  25912. msg('无法对多行进行移动');
  25913. return;
  25914. }
  25915. var index = grid.store.indexOf(record);
  25916. if (index < grid.store.getCount() - 1) {
  25917. grid.store.removeAt(index);
  25918. grid.store.insert(index + 1, record);
  25919. grid.getView().refresh();
  25920. grid.selModel.select([record]);
  25921. }
  25922. },
  25923. getEditRecord: function () {
  25924. var _a, _b;
  25925. var me = this;
  25926. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  25927. 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;
  25928. var record;
  25929. if (typeof rowIdx === 'undefined') {
  25930. record = me.getSelectionModel().getLastSelected();
  25931. }
  25932. else {
  25933. record = me.store.getAt(rowIdx);
  25934. }
  25935. return record;
  25936. },
  25937. getEditRow: function () {
  25938. var _a;
  25939. var me = this;
  25940. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  25941. },
  25942. setEditRow: function (rowValues) {
  25943. var me = this;
  25944. var record = me.getEditRecord();
  25945. if (record) {
  25946. _$2.forOwn(rowValues, function (v, k) {
  25947. record.set(k, v);
  25948. });
  25949. }
  25950. },
  25951. _transform: function (data) {
  25952. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  25953. _$2.forEach(data, function (row) {
  25954. row._origin = _$2.clone(row);
  25955. });
  25956. },
  25957. _setDataReal: function (value) {
  25958. var me = this;
  25959. this._transform(value);
  25960. var storeOpt = {
  25961. fields: getFileds(this),
  25962. data: value,
  25963. };
  25964. if (this.groupField) {
  25965. storeOpt.groupField = this.groupField;
  25966. }
  25967. var store = new Ext.data.Store(storeOpt);
  25968. me.setStore(store);
  25969. },
  25970. setStore: function (store) {
  25971. var me = this;
  25972. if (_$2.isArray(store)) {
  25973. var value = store;
  25974. this._transform(value);
  25975. var storeOpt = {
  25976. fields: getFileds(this),
  25977. data: value,
  25978. };
  25979. if (this.groupField) {
  25980. storeOpt.groupField = this.groupField;
  25981. }
  25982. store = new Ext.data.Store(storeOpt);
  25983. }
  25984. me.superclass.setStore.call(this, store);
  25985. var reference = this.reference;
  25986. if (reference) {
  25987. var scope = lookupScope(this);
  25988. scope.viewModel.set(reference + '.ischanged', false);
  25989. scope.viewModel.set(reference + '.theid', null);
  25990. scope.viewModel.set(reference + '.theid2', null);
  25991. scope.viewModel.set(reference + '.theid3', null);
  25992. }
  25993. if (store) {
  25994. store.on({
  25995. add: function (store, records, index, eOpts) {
  25996. me._raiseChange(store, 'add');
  25997. },
  25998. remove: function (store, records, index, isMove, eOpts) {
  25999. me._raiseChange(store, 'remove');
  26000. },
  26001. datachanged: function (sender, opt) {
  26002. me._raiseChange(store, 'datachanged');
  26003. }
  26004. });
  26005. }
  26006. },
  26007. _raiseChange: function (store, type) {
  26008. var _a, _b;
  26009. var reference = this.reference;
  26010. if (reference && store) {
  26011. var ischanged = false;
  26012. if (store.getModifiedRecords().length > 0 ||
  26013. store.getNewRecords().length > 0 ||
  26014. store.getRemovedRecords().length > 0) {
  26015. ischanged = true;
  26016. }
  26017. else {
  26018. ischanged = false;
  26019. }
  26020. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  26021. }
  26022. },
  26023. /**
  26024. * 轻量级刷新
  26025. */
  26026. refreshData: function () {
  26027. var store = this.getStore();
  26028. if (store) {
  26029. store.reload();
  26030. }
  26031. },
  26032. /**
  26033. * 为表格强制设置焦点
  26034. * @param seq 顺序号
  26035. */
  26036. focusRow: function (seq) {
  26037. this.setSelection(this.store.getAt(seq));
  26038. this.getView().focusRow(seq);
  26039. },
  26040. /**
  26041. * 重新载入数据(重新计算参数)
  26042. */
  26043. reload: function (reloadParams) {
  26044. if (reloadParams === void 0) { reloadParams = {}; }
  26045. var me = this;
  26046. var config = me.config;
  26047. if (config.dataSourceCallbackFn) {
  26048. // 函数请求刷新
  26049. var scope_1 = lookupScope(this);
  26050. _$2.defer(function () {
  26051. me.setLoading(true);
  26052. });
  26053. config.dataSourceCallbackFn.call(scope_1, me, {
  26054. successCallback: function (value) {
  26055. me._setDataReal(value);
  26056. _$2.defer(function () {
  26057. me.setLoading(false);
  26058. });
  26059. // 自动选中第一行
  26060. var data = me.getStore().data;
  26061. if (data.length > 0) {
  26062. me.setSelection(data.items[0]);
  26063. }
  26064. me.fireEvent('dataLoadComplete', me, true, value);
  26065. },
  26066. failCallback: function (error) {
  26067. _$2.defer(function () {
  26068. me.setLoading(false);
  26069. });
  26070. me.fireEvent('dataLoadComplete', me, false, error);
  26071. }
  26072. });
  26073. return;
  26074. }
  26075. // if (this.store) {
  26076. // this.store.reload({aaaa: 1, bbbb: 2})
  26077. // }
  26078. var dataSource = config.dataSource;
  26079. var scope = lookupScope(me);
  26080. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  26081. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  26082. }
  26083. },
  26084. exportCurrentExcelClick: function () {
  26085. var _a;
  26086. var me = this;
  26087. var config = me.config;
  26088. var scope = lookupScope(me);
  26089. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26090. if (excelFileName.endsWith(".xlsx")) {
  26091. excelFileName = excelFileName.split(".xlsx")[0];
  26092. }
  26093. excelFileName += ".xlsx";
  26094. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  26095. var excelData = me.makeExcelData(rowsAll);
  26096. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  26097. },
  26098. /**
  26099. * excel 导出
  26100. * excelExportParams 导出参数
  26101. * isContinue 是否继续导出
  26102. */
  26103. exportExcelClick: function (excelExportParams, isContinue) {
  26104. if (isContinue === void 0) { isContinue = false; }
  26105. var me = this;
  26106. var config = me.config;
  26107. excelExportParams.isExcelExport = true;
  26108. var scope = lookupScope(me);
  26109. var dataSource = config.dataSource;
  26110. var ep = function () {
  26111. scope.setLoading(true);
  26112. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  26113. var _a, _b, _c, _d;
  26114. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || me.exportExcelCurrentPage || 1;
  26115. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  26116. 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;
  26117. me.exportExcelCurrentPage = page;
  26118. me.exportExcelPageSize = size;
  26119. me.exportExcelTotal = total;
  26120. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26121. if (excelFileName.endsWith(".xlsx")) {
  26122. excelFileName = excelFileName.split(".xlsx")[0];
  26123. }
  26124. var pageExcelData = me.makeExcelData(responseData.data);
  26125. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  26126. excelFileName += ".xlsx";
  26127. LAY_EXCEL.exportExcel(pageExcelData, excelFileName, 'xlsx');
  26128. scope.setLoading(false);
  26129. if (page < total / size) {
  26130. page++;
  26131. me.exportExcelCurrentPage = page;
  26132. if (isContinue === true) {
  26133. excelExportParams.exportExcelCurrentPage = page;
  26134. ep();
  26135. }
  26136. }
  26137. });
  26138. };
  26139. ep();
  26140. },
  26141. exportBigExcelClick: function () {
  26142. var _a;
  26143. var me = this;
  26144. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  26145. showErrorDialog('当前表格不支持大批量导出');
  26146. return;
  26147. }
  26148. var config = me.config;
  26149. var scope = lookupScope(me);
  26150. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26151. var head = [];
  26152. var dict = {};
  26153. _$2.forEach(me.columns, function (column) {
  26154. if (column.isHidden())
  26155. return;
  26156. if (!column.dataIndex)
  26157. return;
  26158. if (!column.text)
  26159. return;
  26160. head.push({ field: column.dataIndex, name: column.text });
  26161. if (column.dictForExcel) {
  26162. dict[column.dataIndex] = column.dictForExcel;
  26163. }
  26164. });
  26165. // 判断是否需要解密
  26166. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  26167. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  26168. me.dbInfo.password = hexToString(me.dbInfo.password);
  26169. me.dbInfo.username = hexToString(me.dbInfo.username);
  26170. }
  26171. scope.setLoading(true);
  26172. Ext.Ajax.request({
  26173. timeout: 15000,
  26174. url: window["EXPORT_DATA_HOST"],
  26175. method: "POST",
  26176. jsonData: {
  26177. file: excelFileName,
  26178. dbInfo: me.dbInfo,
  26179. exportDataSql: me.exportDataSql,
  26180. exportDataSqlParams: me.exportDataSqlParams,
  26181. head: head,
  26182. dict: dict,
  26183. },
  26184. }).then(function () {
  26185. scope.setLoading(false);
  26186. msg('请求成功');
  26187. }).catch(function () {
  26188. scope.setLoading(false);
  26189. showErrorDialog('请求失败,请确认是否已安装客户端');
  26190. });
  26191. },
  26192. makeExcelData: function (jsonData) {
  26193. var me = this;
  26194. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  26195. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  26196. return;
  26197. }
  26198. var data = [];
  26199. // 获取表格的列定义
  26200. var headerTextArr = [];
  26201. var headers = [];
  26202. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  26203. var header = me.headerCt.getGridColumns()[i];
  26204. if (!header.isHidden()) {
  26205. var textStr = _$2.trim(header.text);
  26206. var dataIndexStr = _$2.trim(header.dataIndex);
  26207. if (dataIndexStr) {
  26208. if (textStr === '') {
  26209. headerTextArr.push(dataIndexStr);
  26210. }
  26211. else {
  26212. headerTextArr.push(textStr);
  26213. }
  26214. headers.push(header);
  26215. }
  26216. }
  26217. }
  26218. if (headers.length === 0) {
  26219. return;
  26220. }
  26221. data.push(headerTextArr);
  26222. for (var i = 0; i < jsonData.length; i++) {
  26223. var dataRow = jsonData[i];
  26224. var row = [];
  26225. for (var j = 0; j < headers.length; j++) {
  26226. var key = headers[j].dataIndex;
  26227. var value = dataRow[key];
  26228. if (!value && value !== 0) {
  26229. value = '';
  26230. }
  26231. var oValue = value;
  26232. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  26233. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  26234. try {
  26235. value = headers[j].renderer(value);
  26236. if (!value && value !== 0) {
  26237. value = oValue;
  26238. }
  26239. }
  26240. catch (e) {
  26241. value = oValue;
  26242. }
  26243. }
  26244. row.push(value);
  26245. }
  26246. data.push(row);
  26247. }
  26248. return data;
  26249. },
  26250. initComponent: function () {
  26251. var _this = this;
  26252. var _a;
  26253. var me = this;
  26254. var config = me.config;
  26255. var scope = lookupScope(this);
  26256. if (isDesignMode(scope, config)) {
  26257. this.superclass.initComponent.call(this);
  26258. return;
  26259. }
  26260. // 转换 dataSource 属性
  26261. convertDataSource$1(me, scope, config);
  26262. this.on({
  26263. afterrender: function (sender) {
  26264. var me = this;
  26265. var config = this.config;
  26266. var dataSource = config.dataSource;
  26267. if (config.autoLoad) {
  26268. if (config.dataSourceCallbackFn) {
  26269. me.reload();
  26270. }
  26271. else if (_$2.isPlainObject(dataSource)) {
  26272. me.reload();
  26273. }
  26274. }
  26275. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  26276. var vm = this.lookupViewModel();
  26277. this.contextMenu = this.add(new Ext.menu.Menu({
  26278. viewModel: vm,
  26279. items: _$2.map(config.tbar, function (item) {
  26280. var menuItem = __assign({}, item);
  26281. if (menuItem.xtype === 'button') {
  26282. delete menuItem.xtype;
  26283. }
  26284. return menuItem;
  26285. })
  26286. }));
  26287. }
  26288. else if (_$2.isPlainObject(config.contextMenu)) {
  26289. this.contextMenu = this.add(config.contextMenu);
  26290. }
  26291. var $dom = $(sender.el.dom);
  26292. $dom.on('keydown', function (e) {
  26293. me.fireEvent('keydown', me, e);
  26294. }).on('keyup', function (e) {
  26295. me.fireEvent('keyup', me, e);
  26296. });
  26297. // 默认显示提示
  26298. if (this.cellTip) {
  26299. this.tip = Ext.create('Ext.tip.ToolTip', {
  26300. target: this.el,
  26301. delegate: '.x-grid-cell-inner',
  26302. trackMouse: true,
  26303. ancor: 'top',
  26304. style: 'background-color: #0D6EFD;',
  26305. listeners: {
  26306. beforeshow: function (tip) {
  26307. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  26308. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  26309. return false;
  26310. }
  26311. tip.update(tipText);
  26312. }
  26313. }
  26314. });
  26315. }
  26316. },
  26317. itemcontextmenu: function (view, rec, node, index, e) {
  26318. if (this.contextMenu) {
  26319. e.stopEvent();
  26320. this.contextMenu.show().setLocalXY(e.getXY());
  26321. return false;
  26322. }
  26323. },
  26324. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  26325. // this.setColumnConfigCache()
  26326. // },
  26327. // columnhide(sender, column, eOpts) {
  26328. // this.setColumnConfigCache()
  26329. // },
  26330. // columnshow(sender, column, eOpts) {
  26331. // this.setColumnConfigCache()
  26332. // },
  26333. // columnresize(sender, column, width, eOpts) {
  26334. // this.setColumnConfigCache()
  26335. // },
  26336. destory: function () {
  26337. },
  26338. selectionchange: function (sender, param) {
  26339. var record = undefined;
  26340. if (_$2.isArray(param)) {
  26341. record = param[0];
  26342. }
  26343. else if (_$2.isObject(param)) {
  26344. record = _$2.get(param, 'endCell.record');
  26345. }
  26346. itemselectFun(this, sender, record);
  26347. },
  26348. itemclick: function (sender, record) {
  26349. itemselectFun(this, sender, record);
  26350. },
  26351. show: function (sender) {
  26352. if (sender.__suspendReload) {
  26353. sender.__suspendReload = false;
  26354. sender.reload();
  26355. }
  26356. }
  26357. });
  26358. _$2.defer(function () {
  26359. var ce = _this.findPlugin('cellediting');
  26360. ce.on({
  26361. beforeedit: function (editor, context, eOpts) {
  26362. me.fireEvent('editbefore', me, editor, context, eOpts);
  26363. },
  26364. canceledit: function (editor, context, eOpts) {
  26365. me.fireEvent('editcancel', me, editor, context, eOpts);
  26366. },
  26367. edit: function (editor, context, eOpts) {
  26368. me.fireEvent('editfinish', me, editor, context, eOpts);
  26369. },
  26370. validateedit: function (editor, context, eOpts) {
  26371. me.fireEvent('editvalidate', me, editor, context, eOpts);
  26372. },
  26373. });
  26374. });
  26375. var itemselectFun = _$2.debounce(function (me, sender, record) {
  26376. var reference = me.reference;
  26377. var scope = lookupScope(me);
  26378. var theid = _$2.get(config, 'behavior.theid');
  26379. if (theid && reference) {
  26380. if (!record) {
  26381. scope.viewModel.set(reference + '.theid', null);
  26382. }
  26383. else {
  26384. scope.viewModel.set(reference + '.theid', record.get(theid));
  26385. }
  26386. }
  26387. var theid2 = _$2.get(config, 'behavior.theid2');
  26388. if (theid2 && reference) {
  26389. if (!record) {
  26390. scope.viewModel.set(reference + '.theid2', null);
  26391. }
  26392. else {
  26393. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  26394. }
  26395. }
  26396. var theid3 = _$2.get(config, 'behavior.theid3');
  26397. if (theid3 && reference) {
  26398. if (!record) {
  26399. scope.viewModel.set(reference + '.theid3', null);
  26400. }
  26401. else {
  26402. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  26403. }
  26404. }
  26405. me.fireEvent('itemselect', sender, record);
  26406. }, 50);
  26407. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  26408. // 为 stores.proxy.buildRequest 做准备
  26409. this.store.proxy.$owner = this;
  26410. }
  26411. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  26412. if (selectToReload) {
  26413. // 点击后触发某个目标表格刷新
  26414. this.on({
  26415. itemselect: function (sender) {
  26416. if (_$2.isArray(selectToReload)) {
  26417. _$2.forEach(selectToReload, function (ref) {
  26418. if (ref) {
  26419. var ctlTarget = scope.refs[ref];
  26420. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  26421. if (ctlTarget.isVisible()) {
  26422. ctlTarget.reload();
  26423. }
  26424. else {
  26425. ctlTarget.__suspendReload = true;
  26426. }
  26427. }
  26428. }
  26429. });
  26430. }
  26431. else if (_$2.isString(selectToReload)) {
  26432. var ctlTarget = scope.refs[selectToReload];
  26433. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  26434. ctlTarget.reload();
  26435. }
  26436. }
  26437. }
  26438. });
  26439. }
  26440. this.superclass.initComponent.call(this);
  26441. },
  26442. // 生成列自定义的缓存key
  26443. makeColumnConfigCacheKey: function (config) {
  26444. var _a, _b, _c, _d, _e, _f;
  26445. 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);
  26446. var key = "gridColumnCache-" + scope.scopeKey + "-";
  26447. if (config.reference) {
  26448. key += config.reference;
  26449. }
  26450. else {
  26451. var subKey = "";
  26452. for (var i = 0; i < config.columns.length; i++) {
  26453. var column = config.columns[i];
  26454. if (column.dataIndex) {
  26455. subKey += column.dataIndex;
  26456. }
  26457. }
  26458. key += subKey;
  26459. }
  26460. return key;
  26461. },
  26462. getColumnConfigCache: function () {
  26463. var key = this.columnConfigCacheKey;
  26464. var dataStr = localStorage.getItem(key);
  26465. if (dataStr) {
  26466. return JSON.parse(dataStr);
  26467. }
  26468. return "";
  26469. },
  26470. setColumnConfigCache: function () {
  26471. var key = this.columnConfigCacheKey;
  26472. var cacheData = [];
  26473. var columns = this.headerCt.getGridColumns();
  26474. var index = 0;
  26475. for (var i = 0; i < columns.length; i++) {
  26476. var column = columns[i];
  26477. if (column.dataIndex) {
  26478. cacheData.push({
  26479. dataIndex: column.dataIndex,
  26480. width: column.width,
  26481. hidden: column.hidden,
  26482. locked: column.locked,
  26483. index: index
  26484. });
  26485. index++;
  26486. }
  26487. }
  26488. localStorage.setItem(key, JSON.stringify(cacheData));
  26489. },
  26490. autoSizeColumns: function (sender) {
  26491. var grid = sender ? sender.up('grid') : this;
  26492. // const columns = grid.columns;
  26493. // for (let i = 0; i < columns.length; i++) {
  26494. // const column = columns[i];
  26495. // grid.getView().autoSizeColumn(column);
  26496. // column.setWidth(column.getWidth() + 5);
  26497. // }
  26498. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  26499. grid.headerCt.getGridColumns()[i].autoSize(i);
  26500. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  26501. }
  26502. },
  26503. clearFilter: function (sender) {
  26504. var grid = sender.up('grid');
  26505. grid.filters.clearFilters();
  26506. grid.getStore().sorters.removeAll();
  26507. // grid.getStore().reload()
  26508. },
  26509. saveGridUIConfig: function (sender) {
  26510. var grid = sender.up('grid');
  26511. grid.setColumnConfigCache();
  26512. msg('保存设置成功!');
  26513. },
  26514. clearGridUIConfig: function (sender) {
  26515. var grid = sender.up('grid');
  26516. var key = grid.columnConfigCacheKey;
  26517. localStorage.setItem(key, "");
  26518. msg('清空设置成功,重新打开后生效!');
  26519. },
  26520. setLoading: function (value) {
  26521. if (value) {
  26522. this.mask('读取中');
  26523. }
  26524. else {
  26525. this.unmask();
  26526. }
  26527. },
  26528. exportExcel: function (sender) {
  26529. var _a, _b;
  26530. var rect = sender.btnEl.dom.getBoundingClientRect();
  26531. var scope = lookupScope(this);
  26532. var grid = sender.up('grid');
  26533. var menuItems = [];
  26534. var topOffset = 0;
  26535. 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)) {
  26536. menuItems.push({
  26537. text: '大批量导出 (需要客户端支持!)',
  26538. iconCls: 'x-fa fa-download',
  26539. listeners: {
  26540. click: function (sender, value) {
  26541. // @ts-ignore
  26542. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  26543. .then(function (res) {
  26544. grid.exportBigExcelClick();
  26545. });
  26546. }
  26547. }
  26548. });
  26549. menuItems.push('-');
  26550. topOffset += 30;
  26551. }
  26552. menuItems.push({
  26553. text: '导出当前数据',
  26554. iconCls: 'x-fa fa-download',
  26555. listeners: {
  26556. click: function (sender, value) {
  26557. grid.exportCurrentExcelClick();
  26558. }
  26559. }
  26560. });
  26561. topOffset += 30;
  26562. if (grid === null || grid === void 0 ? void 0 : grid.dataSource) {
  26563. menuItems.push({
  26564. xtype: "textfield",
  26565. fieldLabel: '当前导出页',
  26566. maskRe: /[0-9]/,
  26567. value: grid.exportExcelCurrentPage,
  26568. listeners: {
  26569. render: function (sender) {
  26570. grid.exportExcelCurrentPageCmp = sender;
  26571. },
  26572. change: function (sender, value) {
  26573. var v = parseInt(value);
  26574. if (isNaN(v) || v === 0) {
  26575. window['system'].msg("页码不能为0");
  26576. v = 1;
  26577. sender.setValue(v);
  26578. }
  26579. var size = parseInt(grid.exportExcelPageSize);
  26580. var total = parseInt(grid.exportExcelTotal);
  26581. if (v > total / size) {
  26582. v = parseInt(total / size + "");
  26583. }
  26584. grid.exportExcelCurrentPage = v + "";
  26585. }
  26586. }
  26587. }, {
  26588. xtype: "textfield",
  26589. fieldLabel: '导出页大小',
  26590. maskRe: /[0-9]/,
  26591. value: grid.exportExcelPageSize,
  26592. listeners: {
  26593. render: function (sender) {
  26594. grid.exportExcelPageSizeCmp = sender;
  26595. },
  26596. change: function (sender, value) {
  26597. var v = parseInt(value);
  26598. if (isNaN(v) || v === 0) {
  26599. window['system'].msg("导出页大小不能为0");
  26600. v = defaultGrid.exportExcelPageSize;
  26601. sender.setValue(v);
  26602. }
  26603. if (v > 10000) {
  26604. window['system'].msg("导出页大小不能大于10000");
  26605. v = 10000;
  26606. sender.setValue(v);
  26607. }
  26608. var page = parseInt(grid.exportExcelCurrentPage);
  26609. var total = parseInt(grid.exportExcelTotal);
  26610. if (page > total / v) {
  26611. page = parseInt(total / v + "") + 1;
  26612. grid.exportExcelCurrentPageCmp.setValue(page);
  26613. }
  26614. grid.exportExcelPageSize = v + "";
  26615. }
  26616. }
  26617. }, {
  26618. xtype: "textfield",
  26619. fieldLabel: '总条数',
  26620. value: grid.exportExcelTotal,
  26621. readOnly: true
  26622. }, {
  26623. text: '导出',
  26624. iconCls: 'x-fa fa-download',
  26625. listeners: {
  26626. click: function (sender, value) {
  26627. grid.exportExcelClick({
  26628. exportExcelPageSize: grid.exportExcelPageSize,
  26629. exportExcelCurrentPage: grid.exportExcelCurrentPage
  26630. });
  26631. }
  26632. }
  26633. }, {
  26634. text: '连续导出',
  26635. iconCls: 'x-fa fa-download',
  26636. listeners: {
  26637. click: function (sender, value) {
  26638. grid.exportExcelClick({
  26639. exportExcelPageSize: grid.exportExcelPageSize,
  26640. exportExcelCurrentPage: grid.exportExcelCurrentPage
  26641. }, true);
  26642. }
  26643. }
  26644. });
  26645. topOffset += 150;
  26646. }
  26647. var treeMenu = new Ext.menu.Menu({
  26648. xtype: 'menu',
  26649. floated: false,
  26650. width: 300,
  26651. docked: 'left',
  26652. items: menuItems
  26653. });
  26654. treeMenu.showAt(rect.left, rect.top - topOffset);
  26655. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  26656. // grid.headerCt.getGridColumns()[i].autoSize(i);
  26657. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  26658. // }
  26659. },
  26660. /**
  26661. * 获取表格编辑的行数据
  26662. */
  26663. getGridEditRows: function () {
  26664. var grid = this;
  26665. var store = grid.getStore();
  26666. var rows = [];
  26667. var modifyRows = [];
  26668. var newRows = [];
  26669. var err = "";
  26670. var records = store.getModifiedRecords();
  26671. var newRecords = store.getNewRecords();
  26672. var removeRecords = [];
  26673. _$2.forEach(store.getRemovedRecords(), function (row) {
  26674. removeRecords.push(row.data);
  26675. });
  26676. _$2.forEach(records, function (record) {
  26677. var colums = grid.columns;
  26678. var errFunc = undefined;
  26679. _$2.forEach(colums, function (col) {
  26680. var name = col.dataIndex;
  26681. var value = record.data[name];
  26682. var colIndex = col.getIndex(); //获得列号
  26683. var rowIndex = store.indexOfId(record.id); //获得行号
  26684. var editor = col.getEditor(); //使用的编辑器
  26685. var tmpErrFunc = function () {
  26686. var text = col.text || col.name;
  26687. msg(text + ' 校验失败, 请确保输入的数据正确');
  26688. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  26689. };
  26690. if (editor && !editor.allowBlank && isEmpty(value)) {
  26691. errFunc = tmpErrFunc;
  26692. return false;
  26693. }
  26694. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  26695. errFunc = tmpErrFunc;
  26696. return false;
  26697. }
  26698. });
  26699. if (typeof errFunc === 'function') {
  26700. err = "1";
  26701. _$2.remove(rows, function (n) {
  26702. return true;
  26703. });
  26704. //@ts-ignore
  26705. errFunc();
  26706. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  26707. return false;
  26708. }
  26709. else {
  26710. if (_$2.findIndex(newRecords, function (item) {
  26711. return item === record;
  26712. }) >= 0) {
  26713. newRows.push(record.data);
  26714. }
  26715. else {
  26716. modifyRows.push(record.data);
  26717. }
  26718. rows.push(record.data);
  26719. }
  26720. });
  26721. return {
  26722. rows: rows,
  26723. newRows: newRows,
  26724. modifyRows: modifyRows,
  26725. removeRecords: removeRecords,
  26726. err: err
  26727. };
  26728. }
  26729. // reload() {
  26730. // dataSourceReload(this)
  26731. // },
  26732. });
  26733. }
  26734. /**
  26735. * 获取 columns 中所有的 dataIndex
  26736. */
  26737. function getFileds(newConfig) {
  26738. var fields = [];
  26739. _$2.forEach(newConfig.columns, function (c) {
  26740. if (c.dataIndex) {
  26741. fields.push(c.dataIndex);
  26742. }
  26743. });
  26744. return fields;
  26745. }
  26746. function convertDataSource$1(sender, scope, newConfig) {
  26747. if (typeof newConfig.store !== 'undefined') {
  26748. // 有 store 属性的情况下,不做任何事
  26749. return;
  26750. }
  26751. if (typeof newConfig.dataSource === 'undefined') {
  26752. // 没有定义 dataSource 的情况下,不做任何事
  26753. return;
  26754. }
  26755. if (_$2.isArray(newConfig.data)) {
  26756. // 有 data 属性赋值的情况下
  26757. newConfig.store = {
  26758. fields: getFileds(newConfig),
  26759. data: newConfig.data
  26760. };
  26761. delete newConfig.data;
  26762. return;
  26763. }
  26764. var dataSource = newConfig.dataSource;
  26765. if (typeof dataSource === 'string') {
  26766. // dataSource 是字符串的情况下,找到成员函数
  26767. dataSource = lookupFn(scope, dataSource);
  26768. }
  26769. if (typeof dataSource === 'function') {
  26770. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  26771. newConfig.store = new Ext.data.Store({
  26772. fields: getFileds(newConfig),
  26773. // data: [],
  26774. autoLoad: true,
  26775. proxy: {
  26776. type: 'memory',
  26777. data: [],
  26778. }
  26779. });
  26780. newConfig.dataSourceCallbackFn = dataSource;
  26781. return;
  26782. }
  26783. // throw new TypeError('无法识别的调用方法')
  26784. }
  26785. function initTextfield () {
  26786. var cc = Ext.form.field.Text.prototype.constructor;
  26787. var initComponent = Ext.form.field.Text.prototype.initComponent;
  26788. Ext.form.field.Text.override({
  26789. constructor: function (config) {
  26790. var newConfig = _$2.defaultsDeep({
  26791. // 强制属性
  26792. triggers: {
  26793. clear: {
  26794. weight: -1,
  26795. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  26796. hidden: true,
  26797. handler: 'onClearClick',
  26798. },
  26799. }
  26800. }, baseConfig(config, 'col-item'), config, text);
  26801. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  26802. newConfig.enableKeyEvents = true;
  26803. }
  26804. cc.call(this, newConfig);
  26805. },
  26806. /**
  26807. * 清空所有值
  26808. */
  26809. onClearClick: function (sender, e) {
  26810. var me = this;
  26811. me.setValue('');
  26812. },
  26813. /**
  26814. * 尝试获取下一个要获取焦点的控件
  26815. */
  26816. _raiseNextFocus: function (sender) {
  26817. var config = sender.config;
  26818. var scope = lookupScope(sender);
  26819. if (typeof config.nextFocus === 'function') {
  26820. config.nextFocus(sender);
  26821. }
  26822. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  26823. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  26824. var fn = lookupFn(scope, config.nextFocus);
  26825. if (typeof fn === 'function') {
  26826. var nextCtlReference = fn(sender);
  26827. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  26828. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  26829. if (ctl) {
  26830. if (typeof ctl.focus2 === 'function') {
  26831. ctl.focus2();
  26832. }
  26833. else {
  26834. ctl.focus();
  26835. }
  26836. }
  26837. }
  26838. }
  26839. }
  26840. else {
  26841. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  26842. if (ctl) {
  26843. if (typeof ctl.focus2 === 'function') {
  26844. ctl.focus2();
  26845. }
  26846. else {
  26847. ctl.focus();
  26848. }
  26849. }
  26850. }
  26851. }
  26852. },
  26853. initComponent: function () {
  26854. /**
  26855. * 改变必填项之前加星号
  26856. */
  26857. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  26858. // this.beforeLabelTextTpl = [
  26859. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  26860. // ];
  26861. this.afterLabelTextTpl = [
  26862. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  26863. ];
  26864. }
  26865. var me = this;
  26866. this.on({
  26867. change: function (sender, newVal) {
  26868. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  26869. if (hideTrigger || disabled || readOnly || hideClear) {
  26870. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  26871. return;
  26872. }
  26873. var value = newVal;
  26874. if (value) {
  26875. me.getTrigger('clear').show();
  26876. me.updateLayout();
  26877. }
  26878. else {
  26879. me.getTrigger('clear').hide();
  26880. me.updateLayout();
  26881. }
  26882. },
  26883. afterrender: function (sender) {
  26884. var _this = this;
  26885. var _a;
  26886. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  26887. sender.inputEl.dom.setAttribute('spellcheck', "false");
  26888. $$2(sender.inputEl.dom).on('click', function (e) {
  26889. sender.fireEvent('click', _this, e);
  26890. });
  26891. $$2(sender.inputEl.dom).on('keydown', function (e) {
  26892. var _a, _b, _c, _d;
  26893. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  26894. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  26895. if (sender.isExpanded === true) {
  26896. // 弹开下拉框的基础上,不干预上下选择
  26897. return;
  26898. }
  26899. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  26900. var grid = sender.ownerCt.up('grid');
  26901. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  26902. if (editingPlugin) {
  26903. 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;
  26904. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  26905. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  26906. // editingPlugin
  26907. var targetRecord = void 0;
  26908. if (e.code === 'ArrowDown') {
  26909. targetRecord = grid.store.data.getAt(rowIdx + 1);
  26910. }
  26911. else {
  26912. targetRecord = grid.store.data.getAt(rowIdx - 1);
  26913. }
  26914. if (targetRecord) {
  26915. grid.setSelection([targetRecord]);
  26916. editingPlugin.startEdit(targetRecord, column);
  26917. }
  26918. e.stopPropagation();
  26919. e.preventDefault();
  26920. }
  26921. }
  26922. }
  26923. }
  26924. });
  26925. }
  26926. var config = sender.config;
  26927. if (config.ff && config.ff > 0) {
  26928. setTimeout(function () {
  26929. if (typeof sender.focus2 === 'function') {
  26930. sender.focus2();
  26931. }
  26932. else {
  26933. sender.focus();
  26934. }
  26935. }, config.ff);
  26936. }
  26937. }
  26938. });
  26939. var config = this.config;
  26940. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  26941. this.on({
  26942. keyup: function (sender, e) {
  26943. if ([10, 13, 20, 40].includes(e.keyCode)) {
  26944. sender._raiseNextFocus(sender);
  26945. }
  26946. }
  26947. });
  26948. }
  26949. var that = this;
  26950. this.on({
  26951. keyup: function (sender, e, eOpts) {
  26952. if (![10, 13, 20, 40].includes(e.keyCode)) {
  26953. return;
  26954. }
  26955. that.keydown_fun_item(sender, e, eOpts);
  26956. }
  26957. });
  26958. initComponent.call(this);
  26959. },
  26960. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  26961. var that = sender;
  26962. if ([10, 13, 20, 40].includes(event.keyCode)) {
  26963. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  26964. var value = _$2.trim(sender.rawValue);
  26965. var r = that.fireEvent('scancode', that, value, event);
  26966. if (r === 'OK') {
  26967. // 停止事件的默认处理程序,停止事件的冒泡
  26968. // event.stopEvent();
  26969. event.preventDefault();
  26970. event.stopPropagation();
  26971. }
  26972. }
  26973. }, 100)
  26974. });
  26975. }
  26976. function initTbFill () {
  26977. /**
  26978. *
  26979. */
  26980. var ct = Ext.toolbar.Fill.prototype.constructor;
  26981. Ext.toolbar.Fill.override({
  26982. constructor: function (config) {
  26983. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  26984. ct.call(this, newConfig);
  26985. }
  26986. });
  26987. }
  26988. function initTbSeparator () {
  26989. /**
  26990. *
  26991. */
  26992. var ct = Ext.toolbar.Separator.prototype.constructor;
  26993. Ext.toolbar.Separator.override({
  26994. constructor: function (config) {
  26995. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  26996. ct.call(this, newConfig);
  26997. }
  26998. });
  26999. }
  27000. function initToolbar () {
  27001. /**
  27002. *
  27003. */
  27004. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  27005. Ext.toolbar.Toolbar.override({
  27006. constructor: function (config) {
  27007. var newConfig = _$2.defaultsDeep({
  27008. // 强制性属性
  27009. }, baseConfig(config, 'cols-container'), config, toolbar);
  27010. ct.call(this, newConfig);
  27011. }
  27012. });
  27013. initTbFill();
  27014. initTbSeparator();
  27015. }
  27016. function initSplitter () {
  27017. var ct = Ext.resizer.Splitter.prototype.constructor;
  27018. Ext.resizer.Splitter.override({
  27019. constructor: function (config) {
  27020. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  27021. ct.call(this, newConfig);
  27022. }
  27023. });
  27024. }
  27025. /**
  27026. * 通用 dataSource 解析,
  27027. * Tree/Combo/Grid/PageList ... 都会从这里解析
  27028. */
  27029. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  27030. var config = ctl.config;
  27031. return new Promise(function (resolve, reject) {
  27032. if (!config.dataSource) {
  27033. // 没有设置数据源,直接置空
  27034. return Promise.resolve();
  27035. }
  27036. var option = {
  27037. extraParam: extraParam,
  27038. _successCb: _successCb,
  27039. successCallback: function (value) {
  27040. if (typeof successCallback === "function") {
  27041. successCallback(value);
  27042. }
  27043. else {
  27044. ctl.setData(value);
  27045. }
  27046. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  27047. ctl.setLoading(false);
  27048. resolve(value);
  27049. },
  27050. failCallback: function (error) {
  27051. if (typeof failCallback === "function") {
  27052. failCallback(error);
  27053. }
  27054. ctl.fireEvent('dataLoadComplete', ctl, false);
  27055. ctl.setLoading(false);
  27056. reject(error);
  27057. }
  27058. };
  27059. // 请求前要求确认一下
  27060. var isCanceled = false;
  27061. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  27062. isCanceled = true;
  27063. } }, option));
  27064. if (!isCanceled) {
  27065. // 请求没有被取消
  27066. // 调用异步接口返回 Promise
  27067. return _innerReload(ctl, option);
  27068. }
  27069. return reject();
  27070. });
  27071. }
  27072. function _innerReload(ctl, option) {
  27073. var config = ctl.config;
  27074. ctl.setLoading(true);
  27075. var scope = lookupScope(ctl);
  27076. var dataSource = config.dataSource;
  27077. if (typeof dataSource == 'string') {
  27078. dataSource = lookupFn(scope, config.dataSource);
  27079. }
  27080. if (typeof dataSource === 'function') {
  27081. // @ts-ignore
  27082. dataSource.call(scope, ctl, option);
  27083. return;
  27084. }
  27085. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  27086. if (!ajax.func) {
  27087. console.error("没有配置 ajax");
  27088. return;
  27089. }
  27090. var params_1 = {};
  27091. var sortModel = null;
  27092. var filterModel = null;
  27093. if (option.extraParam && option.extraParam.filterModel) {
  27094. filterModel = option.extraParam.filterModel;
  27095. }
  27096. if (option.extraParam && option.extraParam.sortModel) {
  27097. sortModel = option.extraParam.sortModel;
  27098. }
  27099. _$2.forOwn(option.extraParam, function (v, key) {
  27100. if (key != "filterModel" && key != "sortModel") {
  27101. if (typeof v === 'function') {
  27102. params_1[key] = v();
  27103. }
  27104. else {
  27105. params_1[key] = v;
  27106. }
  27107. }
  27108. });
  27109. var ds = dataSource;
  27110. _$2.forOwn(ds.params, function (v, key) {
  27111. if (typeof v === 'function') {
  27112. params_1[key] = v();
  27113. }
  27114. else {
  27115. params_1[key] = v;
  27116. }
  27117. });
  27118. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  27119. // @ts-ignore
  27120. ajax.func({
  27121. method: dataSource.method,
  27122. url: ds.url,
  27123. data: params_1,
  27124. filterModel: filterModel,
  27125. sortModel: sortModel,
  27126. }).then(function (res) {
  27127. if (res.success) {
  27128. option.successCallback(res.data);
  27129. }
  27130. else {
  27131. option.failCallback(res.msg);
  27132. }
  27133. }).catch(function (e) {
  27134. option.failCallback(e);
  27135. });
  27136. }
  27137. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  27138. var ds_1 = ctl.dataSource;
  27139. // @ts-ignore
  27140. Extend.ajax.func({
  27141. url: ds_1.sqlId,
  27142. data: params_1,
  27143. db: ds_1.db,
  27144. method: 'sql',
  27145. filterModel: filterModel,
  27146. sortModel: sortModel,
  27147. }).then(function (res) {
  27148. if (res.success) {
  27149. option.successCallback(res.data);
  27150. }
  27151. else {
  27152. option.failCallback(res.msg);
  27153. }
  27154. }).catch(function (e) {
  27155. option.failCallback(e);
  27156. }).finally(function () {
  27157. ctl.loading = false;
  27158. });
  27159. return;
  27160. }
  27161. else {
  27162. console.error("非法的 dataSource", ctl.dataSource);
  27163. debugger;
  27164. throw new Error("非法的 dataSource");
  27165. }
  27166. }
  27167. }
  27168. function initCombo () {
  27169. var cc = Ext.form.field.ComboBox.prototype.constructor;
  27170. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  27171. Ext.form.field.ComboBox.override({
  27172. constructor: function (config) {
  27173. var newConfig = _$2.defaultsDeep({
  27174. // 强制性属性
  27175. }, baseConfig(config, 'col-item'), config, combo);
  27176. if (typeof config.dict === 'string') {
  27177. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  27178. }
  27179. else if (typeof newConfig.store == 'undefined') {
  27180. if (_$2.isArray(newConfig.data)) {
  27181. // ExtJS 无法直接接受数组模式
  27182. newConfig.store = {
  27183. fields: [newConfig.valueField, newConfig.displayField],
  27184. data: newConfig.data
  27185. };
  27186. delete newConfig.data;
  27187. }
  27188. else if (typeof newConfig.data !== 'object') {
  27189. newConfig.store = {
  27190. fields: [newConfig.valueField, newConfig.displayField],
  27191. data: []
  27192. };
  27193. delete newConfig.data;
  27194. }
  27195. }
  27196. cc.call(this, newConfig);
  27197. },
  27198. setDict: function (bizKey) {
  27199. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  27200. this.dict = bizKey;
  27201. },
  27202. getDict: function () {
  27203. return this.dict;
  27204. },
  27205. setData: function (value) {
  27206. if (!value) {
  27207. return;
  27208. }
  27209. var config = value.config;
  27210. if (!this.store) {
  27211. this.store = new Ext.data.Store({
  27212. fields: [config.valueField, config.displayField],
  27213. data: value
  27214. });
  27215. }
  27216. else {
  27217. this.store.getProxy().setData(value);
  27218. this.store.load();
  27219. }
  27220. },
  27221. setLoading: function (value) {
  27222. if (value) {
  27223. if (!this.loadMask) {
  27224. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  27225. }
  27226. }
  27227. else {
  27228. if (this.loadMask) {
  27229. this.loadMask.destroy();
  27230. delete this.loadMask;
  27231. }
  27232. }
  27233. },
  27234. reload: function () {
  27235. dataSourceReload(this);
  27236. },
  27237. initComponent: function () {
  27238. var that = this;
  27239. var toggle = function (e) {
  27240. var readOnly = that.readOnly, disabled = that.disabled;
  27241. if (readOnly || disabled) {
  27242. return;
  27243. }
  27244. if ($(e.target).is('.x-form-trigger')) {
  27245. return;
  27246. }
  27247. // 点击后下拉
  27248. if (that.isExpanded) {
  27249. that.collapse();
  27250. }
  27251. else {
  27252. that.expand();
  27253. that.doQuery(that.allQuery, true);
  27254. }
  27255. };
  27256. this.on({
  27257. afterrender: function (sender) {
  27258. var config = this.config;
  27259. if (config.dataSource && config.autoLoad) {
  27260. dataSourceReload(this);
  27261. }
  27262. // 点击后下拉
  27263. $(this.el.dom).on('click', toggle.bind(this));
  27264. },
  27265. focusenter: function (sender, event, opt) {
  27266. var _a;
  27267. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27268. // 表格内编辑框,获取焦点后自动弹开
  27269. toggle.call(this, event);
  27270. }
  27271. },
  27272. destory: function () {
  27273. $(this.el.dom).off('click', toggle.bind(this));
  27274. },
  27275. beforequery: function (context) {
  27276. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  27277. // console.log('beforequery', query)
  27278. if (!forceAll && query) {
  27279. combo.store.clearFilter();
  27280. combo.store.filterBy(function (record, id) {
  27281. var text = record.get(combo.displayField);
  27282. // 用拼音筛选的方式
  27283. return keywordFilter(query, text, id);
  27284. });
  27285. combo.expand();
  27286. return false;
  27287. }
  27288. combo.store.clearFilter();
  27289. combo.expand();
  27290. return false;
  27291. },
  27292. });
  27293. initComponent.call(this);
  27294. },
  27295. focus2: function () {
  27296. this.focus();
  27297. var that = this;
  27298. _$2.defer(function () {
  27299. if (that.isExpanded) {
  27300. that.collapse();
  27301. }
  27302. else {
  27303. that.expand();
  27304. that.doQuery(that.allQuery, true);
  27305. }
  27306. });
  27307. }
  27308. });
  27309. }
  27310. /**
  27311. xtype: 'tagfield',
  27312. displayField: 'show',
  27313. valueField: 'id',
  27314. queryMode: 'local',
  27315. filterPickList: true,
  27316. store: {
  27317. fields: ['id', 'show'],
  27318. data: [
  27319. {id: 0, show: 'Battlestar Galactica'},
  27320. {id: 1, show: 'Doctor Who'},
  27321. {id: 2, show: 'Farscape'},
  27322. {id: 3, show: 'Firefly'},
  27323. {id: 4, show: 'Star Trek'},
  27324. {id: 5, show: 'Star Wars: Christmas Special'}
  27325. ]
  27326. }
  27327. */
  27328. function initTag () {
  27329. var cc = Ext.form.field.Tag.prototype.constructor;
  27330. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  27331. Ext.form.field.Tag.override({
  27332. constructor: function (config) {
  27333. var newConfig = _$2.defaultsDeep({
  27334. // 强制性属性
  27335. }, baseConfig(config, 'col-item'), config, tagfield);
  27336. if (typeof config.dict === 'string') {
  27337. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  27338. }
  27339. else if (typeof newConfig.store == 'undefined') {
  27340. if (_$2.isArray(newConfig.data)) {
  27341. // ExtJS 无法直接接受数组模式
  27342. newConfig.store = {
  27343. fields: [newConfig.valueField, newConfig.displayField],
  27344. data: newConfig.data
  27345. };
  27346. delete newConfig.data;
  27347. }
  27348. else if (typeof newConfig.data !== 'object') {
  27349. newConfig.store = {
  27350. fields: [newConfig.valueField, newConfig.displayField],
  27351. data: []
  27352. };
  27353. delete newConfig.data;
  27354. }
  27355. }
  27356. cc.call(this, newConfig);
  27357. },
  27358. setDict: function (bizKey) {
  27359. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  27360. this.dict = bizKey;
  27361. },
  27362. getDict: function () {
  27363. return this.dict;
  27364. },
  27365. setData: function (value) {
  27366. if (!value) {
  27367. return;
  27368. }
  27369. var config = value.config;
  27370. if (!this.store) {
  27371. this.store = new Ext.data.Store({
  27372. fields: [config.valueField, config.displayField],
  27373. data: value
  27374. });
  27375. }
  27376. else {
  27377. this.store.getProxy().setData(value);
  27378. this.store.load();
  27379. }
  27380. },
  27381. setLoading: function (value) {
  27382. if (value) {
  27383. if (!this.loadMask) {
  27384. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  27385. }
  27386. }
  27387. else {
  27388. if (this.loadMask) {
  27389. this.loadMask.destroy();
  27390. delete this.loadMask;
  27391. }
  27392. }
  27393. },
  27394. reload: function () {
  27395. dataSourceReload(this);
  27396. },
  27397. initComponent: function () {
  27398. var that = this;
  27399. var toggle = function (e) {
  27400. var readOnly = that.readOnly, disabled = that.disabled;
  27401. if (readOnly || disabled) {
  27402. return;
  27403. }
  27404. if ($(e.target).is('.x-form-trigger')) {
  27405. return;
  27406. }
  27407. // 点击后下拉
  27408. if (that.isExpanded) {
  27409. that.collapse();
  27410. }
  27411. else {
  27412. that.expand();
  27413. that.doQuery(that.allQuery, true);
  27414. }
  27415. };
  27416. this.on({
  27417. afterrender: function (sender) {
  27418. var config = this.config;
  27419. if (config.dataSource && config.autoLoad) {
  27420. dataSourceReload(this);
  27421. }
  27422. // 点击后下拉
  27423. $(this.el.dom).on('click', toggle.bind(this));
  27424. },
  27425. focusenter: function (sender, event, opt) {
  27426. var _a;
  27427. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27428. // 表格内编辑框,获取焦点后自动弹开
  27429. toggle.call(this, event);
  27430. }
  27431. },
  27432. destory: function () {
  27433. $(this.el.dom).off('click', toggle.bind(this));
  27434. },
  27435. });
  27436. initComponent.call(this);
  27437. },
  27438. focus2: function () {
  27439. this.focus();
  27440. var that = this;
  27441. _$2.defer(function () {
  27442. if (that.isExpanded) {
  27443. that.collapse();
  27444. }
  27445. else {
  27446. that.expand();
  27447. that.doQuery(that.allQuery, true);
  27448. }
  27449. });
  27450. }
  27451. });
  27452. }
  27453. function initComboGridMulti () {
  27454. Ext.define('Yvan.LocalComboGrid', {
  27455. extend: 'Ext.form.field.Picker',
  27456. // extend: 'Yvan.PickerAlignCenter',
  27457. xtype: 'combogridmulti',
  27458. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  27459. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  27460. editable: false,
  27461. initComponent: function () {
  27462. this.on({
  27463. afterrender: function () {
  27464. var config = this.config;
  27465. if (config.dataSource && config.autoLoad) {
  27466. dataSourceReload(this);
  27467. }
  27468. },
  27469. });
  27470. this.superclass.initComponent.apply(this, arguments);
  27471. },
  27472. setStore: function (store) {
  27473. this.store = store;
  27474. var me = this;
  27475. if (me.store) {
  27476. if (me.picker) {
  27477. me.picker.setStore(store);
  27478. if (me.isExpanded) {
  27479. me.collapse();
  27480. delete me.picker;
  27481. me.expand();
  27482. }
  27483. }
  27484. this.onLoad();
  27485. me.mon(me.store, {
  27486. scope: me,
  27487. load: me.onLoad,
  27488. update: me.onUpdate
  27489. });
  27490. }
  27491. },
  27492. reload: function () {
  27493. dataSourceReload(this);
  27494. },
  27495. setData: function (value) {
  27496. var me = this;
  27497. var config = me.config;
  27498. if (!value) {
  27499. return;
  27500. }
  27501. if (!this.store) {
  27502. this.store = new Ext.data.Store({
  27503. fields: [config.valueField, config.displayField],
  27504. data: value
  27505. });
  27506. }
  27507. else {
  27508. this.store.getProxy().setData(value);
  27509. this.store.load();
  27510. }
  27511. this.onLoad();
  27512. },
  27513. createPicker: function () {
  27514. var me = this;
  27515. 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: {
  27516. scope: me,
  27517. selectionchange: me.onSelectionChange,
  27518. itemkeydown: me.onPickerKeyDown
  27519. } })), view = picker.getView();
  27520. if (Ext.isIE9 && Ext.isStrict) {
  27521. view.on({
  27522. scope: me,
  27523. highlightitem: me.repaintPickerView,
  27524. unhighlightitem: me.repaintPickerView,
  27525. afteritemexpand: me.repaintPickerView,
  27526. afteritemcollapse: me.repaintPickerView
  27527. });
  27528. }
  27529. return picker;
  27530. },
  27531. repaintPickerView: function () {
  27532. var style = this.picker.getView().getEl().dom.style;
  27533. style.display = style.display;
  27534. },
  27535. onSelectionChange: function (view, record, node, rowIndex, e) {
  27536. this.selectItem(view, record);
  27537. },
  27538. onPickerKeyDown: function (treeView, record, item, index, e) {
  27539. var key = e.getKey();
  27540. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  27541. this.selectItem(treeView, record);
  27542. }
  27543. },
  27544. selectItem: function (sender, record) {
  27545. var me = this;
  27546. var ids = [];
  27547. _$2.forEach(me.picker.getSelection(), function (record) {
  27548. ids.push(record.get(me.valueField));
  27549. });
  27550. me.fireEvent('select', me, record);
  27551. me.setValue(ids.join(me.splitChar));
  27552. // me.collapse();
  27553. },
  27554. onExpand: function () {
  27555. var me = this;
  27556. var picker = this.picker;
  27557. var value = this.value;
  27558. if (!me.store) {
  27559. msg('正在初始化数据,请稍后');
  27560. me.collapse();
  27561. return;
  27562. }
  27563. var vs = _$2.split(value, me.splitChar);
  27564. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  27565. picker.setSelection(records);
  27566. },
  27567. setValue: function (value) {
  27568. var me = this;
  27569. console.log('setValue', value);
  27570. me.value = value;
  27571. if (!me.store || me.store.loading) {
  27572. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  27573. return me.mixins.field.setValue.call(me, value);
  27574. // return me;
  27575. }
  27576. var vs = _$2.split(value, me.splitChar);
  27577. var displayValues = [];
  27578. _$2.forEach(vs, function (v) {
  27579. var _a;
  27580. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  27581. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  27582. if (dv) {
  27583. displayValues.push(dv);
  27584. }
  27585. else {
  27586. displayValues.push(v);
  27587. }
  27588. });
  27589. // set the raw value to the record's display field if a record was found
  27590. me.setRawValue(displayValues.join(me.splitChar));
  27591. return me.mixins.field.setValue.call(me, value);
  27592. },
  27593. getSubmitValue: function () {
  27594. return this.value;
  27595. },
  27596. getValue: function () {
  27597. return this.value;
  27598. },
  27599. onLoad: function () {
  27600. var value = this.value;
  27601. if (value) {
  27602. this.setValue(value);
  27603. }
  27604. },
  27605. onUpdate: function (store, rec, type, modifiedFieldNames) {
  27606. var display = this.displayField;
  27607. var me = this;
  27608. if (type === 'edit' && modifiedFieldNames &&
  27609. Ext.Array.contains(modifiedFieldNames, display) &&
  27610. this.value === rec.getId()) {
  27611. me.mixins.field.setValue.call(me, this.value);
  27612. this.setRawValue(rec.get(display));
  27613. }
  27614. }
  27615. });
  27616. }
  27617. function initSearch () {
  27618. Ext.define('Yvan.Search', {
  27619. extend: 'Ext.form.field.Text',
  27620. alias: 'widget.searchfield',
  27621. xtype: 'searchfield',
  27622. constructor: function (config) {
  27623. var self = this;
  27624. var newConfig = _$2.defaultsDeep({
  27625. // 强制性属性
  27626. triggers: {
  27627. clear: {
  27628. weight: 0,
  27629. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  27630. hidden: true,
  27631. handler: 'onClearClick',
  27632. },
  27633. search: {
  27634. weight: 1,
  27635. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  27636. handler: 'onSearchClick'
  27637. },
  27638. },
  27639. listeners: {
  27640. blur: function (sender, e) {
  27641. this.revertOnblur();
  27642. },
  27643. specialkey: function (sender, e) {
  27644. var _a;
  27645. var me = this;
  27646. if (e.getKey() === e.ENTER) {
  27647. me.onSearchClick(sender, {}, e);
  27648. return;
  27649. }
  27650. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27651. },
  27652. afterrender: function (sender, e) {
  27653. var _a;
  27654. this.replaceRawInputEvent();
  27655. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27656. }
  27657. },
  27658. }, baseConfig(config, 'col-item'), config, search);
  27659. this.superclass.constructor.call(self, newConfig);
  27660. },
  27661. revertOnblur: function () {
  27662. this.setRawValue(this.lastValue);
  27663. },
  27664. onSearchClick: function (sender, vv, e) {
  27665. var me = this;
  27666. var config = me.config;
  27667. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  27668. if (e) {
  27669. e.preventDefault();
  27670. e.stopPropagation();
  27671. }
  27672. this.fireEvent('search', sender, e);
  27673. if (!widget) {
  27674. return;
  27675. }
  27676. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  27677. },
  27678. replaceRawInputEvent: function () {
  27679. var me = this;
  27680. var $dom = $(me.inputEl.dom);
  27681. $dom.on('input', function (e) {
  27682. stopEvent(e);
  27683. // console.log('has input', e)
  27684. });
  27685. $dom.on('keyup', function (e) {
  27686. if (e.key === "Enter") {
  27687. me.onSearchClick(me, {}, e);
  27688. return;
  27689. }
  27690. stopEvent(e);
  27691. });
  27692. $dom.on('change', function (e) {
  27693. stopEvent(e);
  27694. });
  27695. },
  27696. onChange: function (newVal, oldVal) {
  27697. var me = this;
  27698. var value = newVal;
  27699. if (value) {
  27700. me.getTrigger('clear').show();
  27701. me.updateLayout();
  27702. }
  27703. else {
  27704. me.getTrigger('clear').hide();
  27705. me.updateLayout();
  27706. }
  27707. },
  27708. /**
  27709. * 清空所有值
  27710. */
  27711. onClearClick: function (sender, e) {
  27712. var me = this;
  27713. var config = me.config;
  27714. var lookup = config.lookup;
  27715. me.setValue('');
  27716. clearViewModelByLookup(sender, lookup);
  27717. }
  27718. });
  27719. }
  27720. function initMultipleSearch () {
  27721. Ext.define('Yvan.MultipleSearch', {
  27722. extend: 'Ext.form.field.Text',
  27723. xtype: 'multiplesearch',
  27724. bindTargert: '',
  27725. constructor: function (config) {
  27726. var _a, _b, _c, _d;
  27727. var self = this;
  27728. var newConfig = _$2.defaultsDeep({
  27729. // 强制性属性
  27730. triggers: {
  27731. clear: {
  27732. weight: 0,
  27733. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  27734. hidden: true,
  27735. handler: 'onClearClick',
  27736. }
  27737. },
  27738. transformRawValue: function (o) {
  27739. return o;
  27740. },
  27741. listeners: {
  27742. specialkey: function (sender, e) {
  27743. var me = this;
  27744. if (e.getKey() === e.ENTER) {
  27745. me.fireEvent('search', me, e);
  27746. }
  27747. },
  27748. afterrender: function (sender, e) {
  27749. var _a;
  27750. this.replaceRawInputEvent();
  27751. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27752. }
  27753. },
  27754. }, baseConfig(config, 'col-item'), config, search);
  27755. this.superclass.constructor.call(self, newConfig);
  27756. 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 : '';
  27757. vv = _$2.replace(vv, "{", "");
  27758. vv = _$2.replace(vv, "}", "");
  27759. this.bindTargert = vv;
  27760. this.bindTargert = _$2.trim(this.bindTargert);
  27761. },
  27762. setBindValue: function (arrValue) {
  27763. if (this.bindTargert) {
  27764. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  27765. }
  27766. },
  27767. replaceRawInputEvent: function () {
  27768. var me = this;
  27769. var $dom = $(me.inputEl.dom);
  27770. $dom.on('input', function (e) {
  27771. var _a, _b, _c, _d, _e, _f;
  27772. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  27773. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  27774. if (!a.endsWith(",") && a.length > 0) {
  27775. e.currentTarget.value = a + ",";
  27776. }
  27777. else {
  27778. e.currentTarget.value = a;
  27779. }
  27780. }
  27781. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  27782. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  27783. _$2.remove(arr, function (it) {
  27784. return !it;
  27785. });
  27786. me.setBindValue(arr);
  27787. stopEvent(e);
  27788. });
  27789. $dom.on('keyup', function (e) {
  27790. me.fireEvent('keyup', me, e);
  27791. // invokeMethod(me.config.listeners?.keyup, me, e)
  27792. stopEvent(e);
  27793. });
  27794. $dom.on('keydown', function (e) {
  27795. me.fireEvent('keydown', me, e);
  27796. // invokeMethod(me.config.listeners?.keydown, me, e)
  27797. //stopEvent(e)
  27798. });
  27799. $dom.on('change', function (e) {
  27800. stopEvent(e);
  27801. });
  27802. $dom.on('paste', function (e) {
  27803. var _a;
  27804. // @ts-ignore
  27805. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  27806. var text = clipdata.getData("text/plain");
  27807. var spliter = ',';
  27808. text = text.replaceAll("\r", "");
  27809. text = text.replaceAll("\n", spliter);
  27810. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  27811. var arr = text.split(spliter);
  27812. if (arr && Array.isArray(arr)) {
  27813. for (var i = 0; i < arr.length; i++) {
  27814. arr[i] = _$2.trim(arr[i]);
  27815. }
  27816. }
  27817. _$2.remove(arr, function (it) {
  27818. return !it;
  27819. });
  27820. me.setBindValue(arr);
  27821. stopEvent(e);
  27822. });
  27823. },
  27824. onChange: function (newVal, oldVal) {
  27825. var me = this;
  27826. var value = newVal;
  27827. if (value) {
  27828. me.getTrigger('clear').show();
  27829. me.updateLayout();
  27830. }
  27831. else {
  27832. me.getTrigger('clear').hide();
  27833. me.updateLayout();
  27834. }
  27835. },
  27836. /**
  27837. * 清空所有值
  27838. */
  27839. onClearClick: function (sender, e) {
  27840. var me = this;
  27841. var config = me.config;
  27842. var lookup = config.lookup;
  27843. me.setValue('');
  27844. clearViewModelByLookup(sender, lookup);
  27845. }
  27846. });
  27847. }
  27848. function initDate () {
  27849. var cc = Ext.form.field.Date.prototype.constructor;
  27850. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  27851. Ext.form.field.Date.override({
  27852. format: 'Y-m-d',
  27853. altFormats: 'Y-m-d',
  27854. constructor: function (config) {
  27855. var newConfig = _$2.defaultsDeep({
  27856. // 强制属性
  27857. }, baseConfig(config, 'col-item'), config, date);
  27858. cc.call(this, newConfig);
  27859. },
  27860. getValue: function () {
  27861. var ov = getValue.call(this);
  27862. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  27863. // console.log('cc:', nv, ov)
  27864. return nv;
  27865. },
  27866. // focus2() {
  27867. // const that = this
  27868. // if (that.isExpanded) {
  27869. // that.collapse()
  27870. //
  27871. // } else {
  27872. // that.expand();
  27873. // }
  27874. // _.defer(() => {
  27875. // that.focus()
  27876. // })
  27877. // },
  27878. initComponent: function () {
  27879. this.on({
  27880. afterrender: function () {
  27881. var config = this.config;
  27882. // 日期框,不要默认弹出
  27883. // $(this.el.dom).on('click', toggle.bind(this))
  27884. },
  27885. destory: function () {
  27886. // 日期框,不要默认弹出
  27887. // $(this.el.dom).off('click', toggle.bind(this))
  27888. },
  27889. change: {
  27890. fn: function (sender) {
  27891. if (sender.format === 'Y-m-d') {
  27892. // 年月日格式
  27893. var value = sender.getRawValue();
  27894. if (/^\d{8}$/.test(value)) {
  27895. // 8位数字,自动转换为 YYYY-MM-DD
  27896. var newValue = [
  27897. value.substr(0, 4),
  27898. value.substr(4, 2),
  27899. value.substr(6, 2)
  27900. ].join('-');
  27901. sender.setValue(newValue);
  27902. }
  27903. }
  27904. },
  27905. }
  27906. // focus: {
  27907. // // 获得焦点后自动下拉
  27908. // fn(sender) {
  27909. // sender.expand();
  27910. // this.doQuery(this.allQuery, true);
  27911. // },
  27912. // },
  27913. });
  27914. initComponent.call(this);
  27915. },
  27916. createInitialDate: function (value) {
  27917. var minValue = this.minValue, maxValue = this.maxValue;
  27918. value = value || syncDate(new Date());
  27919. if (minValue && minValue > value) {
  27920. value = minValue;
  27921. }
  27922. else if (maxValue && maxValue < value) {
  27923. value = maxValue;
  27924. }
  27925. return value;
  27926. },
  27927. });
  27928. }
  27929. function initDateTimePicker () {
  27930. Ext.define('Yvan.DateTimePicker', {
  27931. extend: 'Ext.picker.Date',
  27932. alias: 'datetimepicker',
  27933. alternateClassName: 'Ext.DateTimePicker',
  27934. renderTpl: [
  27935. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  27936. '<div class="{baseCls}-header">',
  27937. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  27938. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  27939. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  27940. '</div>',
  27941. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  27942. '<thead>',
  27943. '<tr role="row">',
  27944. '<tpl for="dayNames">',
  27945. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  27946. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  27947. '</th>',
  27948. '</tpl>',
  27949. '</tr>',
  27950. '</thead>',
  27951. '<tbody>',
  27952. '<tr role="row">',
  27953. '<tpl for="days">',
  27954. '{#:this.isEndOfWeek}',
  27955. '<td role="gridcell">',
  27956. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  27957. '</td>',
  27958. '</tpl>',
  27959. '</tr>',
  27960. '</tbody>',
  27961. '</table>',
  27962. '<tpl if="showToday">',
  27963. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  27964. '</tpl>',
  27965. // These elements are used with Assistive Technologies such as screen readers
  27966. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  27967. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  27968. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  27969. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  27970. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  27971. '</div>',
  27972. {
  27973. firstInitial: function (value) {
  27974. return Ext.picker.Date.prototype.getDayInitial(value);
  27975. },
  27976. isEndOfWeek: function (value) {
  27977. // convert from 1 based index to 0 based
  27978. // by decrementing value once.
  27979. value--;
  27980. // eslint-disable-next-line vars-on-top
  27981. var end = value % 7 === 0 && value !== 0;
  27982. return end ? '</tr><tr role="row">' : '';
  27983. },
  27984. renderTodayBtn: function (values, out) {
  27985. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  27986. },
  27987. renderMonthBtn: function (values, out) {
  27988. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  27989. }
  27990. }
  27991. ],
  27992. beforeRender: function () {
  27993. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  27994. this.superclass.beforeRender.call(this);
  27995. function handleInput(extHandle, $input) {
  27996. var $dom = $(extHandle.el.dom);
  27997. // const $up = $dom.find('.x-form-spinner-up')
  27998. // const $down = $dom.find('.x-form-spinner-down')
  27999. // debugger
  28000. // $up.on('mousedown', () => {
  28001. // debugger
  28002. // });
  28003. // $up.on('click', () => {
  28004. // debugger
  28005. // });
  28006. extHandle.on('click', function (sender) {
  28007. var hideBak = me.hide;
  28008. me.hide = Ext.emptyFn;
  28009. extHandle.focus();
  28010. me.hide = hideBak;
  28011. });
  28012. var changeValue = function (delta) {
  28013. if (_$2.trim(extHandle.getValue()) === '') {
  28014. extHandle.setValue(extHandle.minValue);
  28015. }
  28016. else {
  28017. var v = parseInt('' + extHandle.getValue());
  28018. if (v + delta > extHandle.maxValue) {
  28019. extHandle.setValue(extHandle.minValue);
  28020. }
  28021. else if (v + delta < extHandle.minValue) {
  28022. extHandle.setValue(extHandle.maxValue);
  28023. }
  28024. else {
  28025. extHandle.setValue(v + delta);
  28026. }
  28027. }
  28028. };
  28029. $input.on('mousewheel', function (e) {
  28030. e.stopPropagation();
  28031. var event = e.originalEvent;
  28032. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  28033. // if (event.wheelDelta) {
  28034. // delta = event.wheelDelta / 120;
  28035. // } else if (event.detail) {
  28036. // delta = -event.detail / 3;
  28037. // }
  28038. var zoomSize = Math.ceil(eventDelta / 120);
  28039. changeValue(zoomSize);
  28040. // console.log('delta', delta)
  28041. // $input.focus()
  28042. });
  28043. }
  28044. me.input1 = Ext.create('Ext.form.field.Number', {
  28045. minValue: 0,
  28046. maxValue: 23,
  28047. flex: 1,
  28048. enableKeyEvents: true,
  28049. fieldLabel: '时',
  28050. labelWidth: 20,
  28051. hideLabel: true,
  28052. spinDownEnabled: false,
  28053. spinUpEnabled: false,
  28054. style: {
  28055. marginLeft: '5px',
  28056. },
  28057. listeners: {
  28058. afterrender: function (sender) {
  28059. var $input = $(sender.inputEl.dom);
  28060. handleInput(me.input1, $input);
  28061. },
  28062. change: function (sender, e) {
  28063. if (me.getValue()) {
  28064. me.value.setHours(sender.getValue());
  28065. }
  28066. },
  28067. }
  28068. });
  28069. me.input2 = Ext.create('Ext.form.field.Number', {
  28070. minValue: 0,
  28071. maxValue: 59,
  28072. flex: 1,
  28073. enableKeyEvents: true,
  28074. fieldLabel: ' ',
  28075. hideLabel: false,
  28076. labelWidth: 8,
  28077. spinDownEnabled: false,
  28078. spinUpEnabled: false,
  28079. listeners: {
  28080. afterrender: function (sender) {
  28081. var $input = $(sender.inputEl.dom);
  28082. handleInput(me.input2, $input);
  28083. },
  28084. change: function (sender, e) {
  28085. if (me.getValue()) {
  28086. me.value.setMinutes(sender.getValue());
  28087. }
  28088. },
  28089. }
  28090. });
  28091. me.input3 = Ext.create('Ext.form.field.Number', {
  28092. minValue: 0,
  28093. maxValue: 59,
  28094. flex: 1,
  28095. enableKeyEvents: true,
  28096. fieldLabel: ' ',
  28097. hideLabel: false,
  28098. labelWidth: 8,
  28099. spinDownEnabled: false,
  28100. spinUpEnabled: false,
  28101. style: {
  28102. marginRight: '5px',
  28103. },
  28104. listeners: {
  28105. afterrender: function (sender) {
  28106. var $input = $(sender.inputEl.dom);
  28107. handleInput(me.input3, $input);
  28108. },
  28109. change: function (sender, e) {
  28110. if (me.getValue()) {
  28111. me.value.setSeconds(sender.getValue());
  28112. }
  28113. },
  28114. }
  28115. });
  28116. me.confirmBtn = new Ext.button.Button({
  28117. text: '确认',
  28118. handler: me.confirmClick,
  28119. scope: me
  28120. });
  28121. me.tdBtn = new Ext.button.Button({
  28122. text: '现在',
  28123. handler: me.selectToday,
  28124. scope: me
  28125. });
  28126. me.todayBtn = Ext.create('Ext.container.Container', {
  28127. layout: 'anchor', border: false,
  28128. defaults: {
  28129. border: false, anchor: '100%',
  28130. margin: '0 0 5 0',
  28131. },
  28132. items: [
  28133. {
  28134. layout: 'hbox',
  28135. items: [
  28136. me.input1,
  28137. me.input2,
  28138. me.input3,
  28139. ]
  28140. },
  28141. {
  28142. layout: 'hbox',
  28143. items: [
  28144. me.confirmBtn,
  28145. me.tdBtn,
  28146. ]
  28147. }
  28148. ]
  28149. });
  28150. },
  28151. // finishRenderChildren() {
  28152. // var me = this;
  28153. //
  28154. // this.superclass.finishRenderChildren.call(this);
  28155. // //*
  28156. // me.input1.finishRender();
  28157. // me.input2.finishRender();
  28158. // me.input3.finishRender();
  28159. // //
  28160. // me.tdBtn.finishRender();
  28161. // me.confirmBtn.finishRender();
  28162. // },
  28163. setValue: function (value) {
  28164. //this.value = Ext.Date.clearTime(value, true);
  28165. this.value = value;
  28166. this.input1.setValue(this.value.getHours());
  28167. this.input2.setValue(this.value.getMinutes());
  28168. this.input3.setValue(this.value.getSeconds());
  28169. return this.update(this.value);
  28170. },
  28171. selectDate: function (value) {
  28172. if (this.showTime) {
  28173. value.setHours(this.input1.getValue());
  28174. value.setMinutes(this.input2.getValue());
  28175. value.setSeconds(this.input3.getValue());
  28176. }
  28177. this.value = value;
  28178. return this.update(this.value);
  28179. },
  28180. setDisabledStatus: function (disabled) {
  28181. var me = this;
  28182. debugger;
  28183. // me.callParent();
  28184. if (me.showTime) {
  28185. me.confirmBtn.setDisabled(disabled);
  28186. }
  28187. if (me.isShowFooter()) {
  28188. me.footerContainer.setDisabled(disabled);
  28189. }
  28190. },
  28191. handleDateClick: function (e, t) {
  28192. var me = this, handler = me.handler;
  28193. // e.stopEvent();
  28194. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  28195. me.doCancelFocus = me.focusOnSelect === false;
  28196. me.selectDate(new Date(t.dateValue));
  28197. delete me.doCancelFocus;
  28198. /* 有时间输入时单击事件不退出选择,只移动光标 */
  28199. if (me.showTime) {
  28200. return;
  28201. }
  28202. me.fireEvent('select', me, me.value);
  28203. if (handler) {
  28204. handler.call(me.scope || me, me, me.value);
  28205. }
  28206. me.onSelect();
  28207. }
  28208. },
  28209. selectToday: function () {
  28210. var me = this, btn = me.todayBtn, handler = me.handler;
  28211. if (btn && !btn.disabled) {
  28212. me.value = syncDate(new Date());
  28213. me.update(me.value);
  28214. me.fireEvent('select', me, me.value);
  28215. if (handler) {
  28216. handler.call(me.scope || me, me, me.value);
  28217. }
  28218. me.onSelect();
  28219. me.hide();
  28220. }
  28221. return me;
  28222. },
  28223. confirmClick: function () {
  28224. var me = this, btn = me.confirmBtn, handler = me.handler;
  28225. if (btn && !btn.disabled) {
  28226. me.fireEvent('select', me, me.value);
  28227. if (handler) {
  28228. handler.call(me.scope || me, me, me.value);
  28229. }
  28230. me.onSelect();
  28231. me.hide();
  28232. }
  28233. return me;
  28234. },
  28235. selectedUpdate: function (date) {
  28236. var me = this,
  28237. //t = date.getTime(),
  28238. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  28239. cells.removeCls(cls);
  28240. for (c = 0; c < cLen; c++) {
  28241. cell = Ext.fly(cellItems[c]);
  28242. if (cell.dom.firstChild.dateValue == t) {
  28243. me.fireEvent('highlightitem', me, cell);
  28244. cell.addCls(cls);
  28245. if (me.isVisible() && !me.doCancelFocus) {
  28246. Ext.fly(cell.dom.firstChild).focus(50);
  28247. }
  28248. break;
  28249. }
  28250. }
  28251. },
  28252. // private, inherit docs
  28253. beforeDestroy: function () {
  28254. var me = this;
  28255. if (me.rendered) {
  28256. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  28257. }
  28258. me.superclass.beforeDestroy.call(this);
  28259. }
  28260. });
  28261. }
  28262. function initDateTime () {
  28263. Ext.define('Yvan.DateTimeField', {
  28264. extend: 'Ext.form.field.Date',
  28265. xtype: 'datetimefield',
  28266. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  28267. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  28268. showTime: true,
  28269. format: "Y-m-d H:i:s",
  28270. constructor: function (config) {
  28271. var newConfig = _$2.defaultsDeep({
  28272. // 强制属性
  28273. }, baseConfig(config, 'col-item'), config, date);
  28274. this.superclass.constructor.call(this, newConfig);
  28275. },
  28276. initComponent: function () {
  28277. this.superclass.initComponent.call(this);
  28278. var setInitValue = function () {
  28279. var value = this.getRawValue();
  28280. if (!value) {
  28281. // 没填内容的时候,自动设置当前时间
  28282. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  28283. }
  28284. };
  28285. this.on({
  28286. afterrender: function () {
  28287. var config = this.config;
  28288. // 日期框,不要默认弹出
  28289. $(this.el.dom).on('click', setInitValue.bind(this));
  28290. },
  28291. destory: function () {
  28292. // 日期框,不要默认弹出
  28293. $(this.el.dom).off('click', setInitValue.bind(this));
  28294. },
  28295. change: {
  28296. fn: function (sender) {
  28297. if (sender.format === "Y-m-d H:i:s") {
  28298. // 年月日格式
  28299. var value = sender.getRawValue();
  28300. if (/^\d{14}$/.test(value)) {
  28301. // 8位数字,自动转换为 YYYY-MM-DD
  28302. var newValue = [
  28303. value.substr(0, 4),
  28304. '-',
  28305. value.substr(4, 2),
  28306. '-',
  28307. value.substr(6, 2),
  28308. ' ',
  28309. value.substr(8, 2),
  28310. ':',
  28311. value.substr(10, 2),
  28312. ':',
  28313. value.substr(12, 2)
  28314. ].join('');
  28315. sender.setValue(newValue);
  28316. }
  28317. }
  28318. },
  28319. }
  28320. });
  28321. },
  28322. getValue: function () {
  28323. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  28324. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  28325. // console.log('cc:', nv, ov)
  28326. return nv;
  28327. },
  28328. onExpand: function () {
  28329. var strValue = this.getValue();
  28330. var value;
  28331. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  28332. 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)));
  28333. }
  28334. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  28335. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  28336. }
  28337. else {
  28338. value = syncDate(new Date());
  28339. }
  28340. this.picker.setValue(value);
  28341. },
  28342. createPicker: function () {
  28343. var me = this, format = Ext.String.format;
  28344. //@ts-ignore
  28345. return new Yvan.DateTimePicker({
  28346. pickerField: me,
  28347. ownerCt: me.ownerCt,
  28348. renderTo: document.body,
  28349. floating: true,
  28350. hidden: true,
  28351. focusOnShow: true,
  28352. minDate: me.minValue,
  28353. maxDate: me.maxValue,
  28354. disabledDatesRE: me.disabledDatesRE,
  28355. disabledDatesText: me.disabledDatesText,
  28356. disabledDays: me.disabledDays,
  28357. disabledDaysText: me.disabledDaysText,
  28358. format: me.format,
  28359. showToday: me.showToday,
  28360. showTime: me.showTime,
  28361. startDay: me.startDay,
  28362. minText: format(me.minText, me.formatDate(me.minValue)),
  28363. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  28364. listeners: {
  28365. scope: me,
  28366. select: me.onSelect
  28367. },
  28368. keyNavConfig: {
  28369. esc: function () {
  28370. me.collapse();
  28371. }
  28372. }
  28373. });
  28374. },
  28375. });
  28376. }
  28377. function initNumber () {
  28378. var cc = Ext.form.field.Number.prototype.constructor;
  28379. var initComponent = Ext.form.field.Number.prototype.initComponent;
  28380. Ext.form.field.Number.override({
  28381. constructor: function (config) {
  28382. var newConfig = _$2.defaultsDeep({
  28383. // 强制属性
  28384. }, baseConfig(config, 'col-item'), config, numberfield);
  28385. cc.call(this, newConfig);
  28386. },
  28387. initComponent: function () {
  28388. this.on({
  28389. afterrender: function (sender) {
  28390. var _this = this;
  28391. var _a;
  28392. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  28393. sender.inputEl.dom.setAttribute('spellcheck', "false");
  28394. $$2(sender.inputEl.dom).on('click', function (e) {
  28395. sender.fireEvent('click', _this, e);
  28396. });
  28397. }
  28398. }
  28399. });
  28400. initComponent.call(this);
  28401. },
  28402. });
  28403. }
  28404. function initCheckbox () {
  28405. var cc = Ext.form.field.Checkbox.prototype.constructor;
  28406. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  28407. Ext.form.field.Checkbox.override({
  28408. constructor: function (config) {
  28409. var newConfig = _$2.defaultsDeep({
  28410. // 强制属性
  28411. }, baseConfig(config, 'col-item'), config, checkbox);
  28412. cc.call(this, newConfig);
  28413. },
  28414. getValue: function () {
  28415. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  28416. var ov = getValue.call(this);
  28417. // const ov = this.getRawValue()
  28418. return (ov ? checkedValue : uncheckedValue);
  28419. },
  28420. setValue: function (nv) {
  28421. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  28422. var value;
  28423. if (nv === checkedValue) {
  28424. value = true;
  28425. }
  28426. else if (nv === uncheckedValue) {
  28427. value = false;
  28428. }
  28429. else {
  28430. value = !!nv;
  28431. }
  28432. // me.setRawValue(value)
  28433. // me.checked = value
  28434. // return me.mixins.field.setValue.call(me, value);
  28435. setValue.call(this, value);
  28436. },
  28437. updateCheckedCls: function (checked) {
  28438. var me = this;
  28439. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  28440. checked = checked != null ? checked : me.getValue();
  28441. if (checked === uncheckedValue) {
  28442. checked = false;
  28443. }
  28444. else if (checked === checkedValue) {
  28445. checked = true;
  28446. }
  28447. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  28448. },
  28449. initComponent: function () {
  28450. initComponent.call(this);
  28451. },
  28452. });
  28453. }
  28454. function initCheckboxGroup () {
  28455. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  28456. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  28457. Ext.form.CheckboxGroup.override({
  28458. constructor: function (config) {
  28459. var newConfig = _$2.defaultsDeep({
  28460. // 强制属性
  28461. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  28462. cc.call(this, newConfig);
  28463. },
  28464. initComponent: function () {
  28465. initComponent.call(this);
  28466. },
  28467. });
  28468. }
  28469. function initRadio () {
  28470. var cc = Ext.form.field.Radio.prototype.constructor;
  28471. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  28472. Ext.form.field.Radio.override({
  28473. constructor: function (config) {
  28474. var newConfig = _$2.defaultsDeep({
  28475. // 强制属性
  28476. }, baseConfig(config, 'col-item'), config, radio);
  28477. cc.call(this, newConfig);
  28478. },
  28479. initComponent: function () {
  28480. initComponent.call(this);
  28481. },
  28482. });
  28483. }
  28484. function initRadioGroup () {
  28485. var cc = Ext.form.RadioGroup.prototype.constructor;
  28486. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  28487. Ext.form.RadioGroup.override({
  28488. constructor: function (config) {
  28489. var newConfig = _$2.defaultsDeep({
  28490. // 强制属性
  28491. }, baseConfig(config, 'col-item'), config, radiogroup);
  28492. cc.call(this, newConfig);
  28493. },
  28494. initComponent: function () {
  28495. initComponent.call(this);
  28496. },
  28497. });
  28498. }
  28499. function initFieldset () {
  28500. /**
  28501. *
  28502. */
  28503. var ct = Ext.form.FieldSet.prototype.constructor;
  28504. Ext.form.FieldSet.override({
  28505. constructor: function (config) {
  28506. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  28507. ct.call(this, newConfig);
  28508. }
  28509. });
  28510. }
  28511. function initCombotree () {
  28512. Ext.define('Yvan.ComboTree', {
  28513. extend: 'Ext.form.field.Picker',
  28514. xtype: 'combotree',
  28515. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  28516. config: {
  28517. store: null,
  28518. displayField: null,
  28519. columns: null,
  28520. selectOnTab: true,
  28521. maxPickerHeight: 300,
  28522. minPickerHeight: 100,
  28523. minPickerWidth: 350,
  28524. rootVisible: true,
  28525. },
  28526. editable: false,
  28527. setStore: function (store) {
  28528. this.store = store;
  28529. var me = this;
  28530. if (me.store) {
  28531. if (me.picker) {
  28532. me.picker.setStore(store);
  28533. if (me.isExpanded) {
  28534. me.collapse();
  28535. delete me.picker;
  28536. me.expand();
  28537. }
  28538. }
  28539. this.onLoad();
  28540. me.mon(me.store, {
  28541. scope: me,
  28542. load: me.onLoad,
  28543. update: me.onUpdate
  28544. });
  28545. }
  28546. },
  28547. createPicker: function () {
  28548. var me = this;
  28549. var picker = new Ext.tree.Panel({
  28550. border: false,
  28551. baseCls: Ext.baseCSSPrefix + 'boundlist',
  28552. shrinkWrapDock: 2,
  28553. store: me.store,
  28554. floating: true,
  28555. rootVisible: me.rootVisible,
  28556. displayField: me.displayField,
  28557. columns: me.columns,
  28558. minHeight: me.minPickerHeight,
  28559. maxHeight: me.maxPickerHeight,
  28560. minWidth: me.minPickerWidth,
  28561. manageHeight: false,
  28562. shadow: false,
  28563. scrollable: true,
  28564. // modal: true,
  28565. // constrain: true,
  28566. // constrainTo: topScope._handle.el.dom,
  28567. // renderTo: topScope._handle.el.dom,
  28568. // alignTarget: topScope._handle,
  28569. listeners: {
  28570. scope: me,
  28571. itemclick: me.onItemClick,
  28572. itemkeydown: me.onPickerKeyDown
  28573. }
  28574. }), view = picker.getView();
  28575. if (Ext.isIE9 && Ext.isStrict) {
  28576. view.on({
  28577. scope: me,
  28578. highlightitem: me.repaintPickerView,
  28579. unhighlightitem: me.repaintPickerView,
  28580. afteritemexpand: me.repaintPickerView,
  28581. afteritemcollapse: me.repaintPickerView
  28582. });
  28583. }
  28584. return picker;
  28585. },
  28586. repaintPickerView: function () {
  28587. var style = this.picker.getView().getEl().dom.style;
  28588. style.display = style.display;
  28589. },
  28590. onItemClick: function (view, record, node, rowIndex, e) {
  28591. this.selectItem(view, record);
  28592. },
  28593. onPickerKeyDown: function (treeView, record, item, index, e) {
  28594. var key = e.getKey();
  28595. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  28596. this.selectItem(treeView, record);
  28597. }
  28598. },
  28599. selectItem: function (sender, record) {
  28600. var me = this;
  28601. me.setValue(record.getId());
  28602. me.fireEvent('select', me, record);
  28603. me.collapse();
  28604. },
  28605. onExpand: function () {
  28606. var picker = this.picker;
  28607. var store = picker.store;
  28608. var value = this.value;
  28609. var node;
  28610. if (value) {
  28611. node = store.getNodeById(value);
  28612. }
  28613. if (!node) {
  28614. node = store.getRoot();
  28615. }
  28616. picker.ensureVisible(node, {
  28617. select: true,
  28618. focus: true
  28619. });
  28620. },
  28621. setValue: function (value) {
  28622. var me = this;
  28623. console.log('setValue', value);
  28624. me.value = value;
  28625. if (!me.store || me.store.loading) {
  28626. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  28627. return me.mixins.field.setValue.call(me, value);
  28628. // return me;
  28629. }
  28630. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  28631. if (value === undefined) {
  28632. record = me.store.getRoot();
  28633. console.log('setValue', record.getId());
  28634. me.value = record.getId();
  28635. return me.mixins.field.setValue.call(me, value);
  28636. }
  28637. else {
  28638. record = me.store.getNodeById(value);
  28639. }
  28640. // set the raw value to the record's display field if a record was found
  28641. me.setRawValue(record ? record.get(me.displayField) : '');
  28642. return me.mixins.field.setValue.call(me, value);
  28643. },
  28644. getSubmitValue: function () {
  28645. return this.value;
  28646. },
  28647. getValue: function () {
  28648. return this.value;
  28649. },
  28650. onLoad: function () {
  28651. var value = this.value;
  28652. if (value) {
  28653. this.setValue(value);
  28654. }
  28655. },
  28656. onUpdate: function (store, rec, type, modifiedFieldNames) {
  28657. var display = this.displayField;
  28658. var me = this;
  28659. if (type === 'edit' && modifiedFieldNames &&
  28660. Ext.Array.contains(modifiedFieldNames, display) &&
  28661. this.value === rec.getId()) {
  28662. me.mixins.field.setValue.call(me, this.value);
  28663. this.setRawValue(rec.get(display));
  28664. }
  28665. }
  28666. });
  28667. }
  28668. function initPickerPlus () {
  28669. Ext.define('Yvan.PickerAlignCenter', {
  28670. extend: 'Ext.form.field.Picker',
  28671. /**
  28672. * Performs the alignment on the picker using the class defaults
  28673. * @private
  28674. */
  28675. doAlign: function () {
  28676. // 不要挪动就好
  28677. },
  28678. });
  28679. }
  28680. function initCombogrid () {
  28681. Ext.define('Yvan.ComboGrid', {
  28682. extend: 'Ext.form.field.Picker',
  28683. // extend: 'Yvan.PickerAlignCenter',
  28684. xtype: 'combogrid',
  28685. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  28686. triggers: {
  28687. clear: {
  28688. weight: 0,
  28689. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  28690. hidden: true,
  28691. handler: 'onClearClick',
  28692. },
  28693. },
  28694. config: __assign({}, comboGrid),
  28695. editable: true,
  28696. _superBlur: false,
  28697. allowCustomInput: false,
  28698. pressEnterPopup: true,
  28699. initComponent: function () {
  28700. var that = this;
  28701. var scope = lookupScope(that);
  28702. var config = that.config;
  28703. if (isDesignMode(scope, config)) {
  28704. this.superclass.initComponent.call(this, arguments);
  28705. return;
  28706. }
  28707. this.on({
  28708. blur: function (sender, e) {
  28709. if (this._superBlur) {
  28710. // 挂起时不恢复内容
  28711. return;
  28712. }
  28713. // 离开焦点时,恢复原来的值
  28714. sender.setRawValue(sender.value);
  28715. },
  28716. afterrender: function (sender) {
  28717. var $dom = $(sender.inputEl.dom);
  28718. that.scope = lookupScope(sender);
  28719. if (sender.column) {
  28720. // 列模式,拦截 keydown
  28721. $dom.on('keydown', function (e) {
  28722. if (isChartEvent(e) && !that.tryEnable()) {
  28723. // 没有达成 editEnable 条件,不用响应
  28724. stopEvent(e);
  28725. return;
  28726. }
  28727. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  28728. stopEvent(e);
  28729. that.onTriggerClick(that, that.getPickerTrigger(), e);
  28730. return;
  28731. }
  28732. });
  28733. }
  28734. else {
  28735. // 常规模式,拦截 keyup
  28736. $dom.on('keyup', function (e) {
  28737. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  28738. return;
  28739. }
  28740. if (isChartEvent(e) && !that.tryEnable()) {
  28741. // 没有达成 editEnable 条件,不用响应
  28742. stopEvent(e);
  28743. return;
  28744. }
  28745. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  28746. stopEvent(e);
  28747. that.onTriggerClick(that, that.getPickerTrigger(), e);
  28748. return;
  28749. }
  28750. if (!that.allowCustomInput) {
  28751. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  28752. stopEvent(e);
  28753. }
  28754. });
  28755. $dom.on('change', function (e) {
  28756. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  28757. // if (that.isExpanded) {
  28758. // that.filterChange(that, e.target.value)
  28759. // }
  28760. stopEvent(e);
  28761. });
  28762. }
  28763. $dom.on('input', function (e) {
  28764. stopEvent(e);
  28765. });
  28766. },
  28767. });
  28768. this.superclass.initComponent.apply(this, arguments);
  28769. },
  28770. createPicker: function () {
  28771. var me = this;
  28772. var cfg = {
  28773. layout: 'fit',
  28774. border: 0,
  28775. // border: 5,
  28776. style: {
  28777. // borderColor: 'black',
  28778. // borderWidth: '5px',
  28779. // borderStyle: 'solid',
  28780. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  28781. },
  28782. shadow: 'side',
  28783. shadowOffset: 100,
  28784. baseCls: Ext.baseCSSPrefix + 'boundlist',
  28785. shrinkWrapDock: 2,
  28786. floating: true,
  28787. width: me.pickerWidth,
  28788. height: me.pickerHeight,
  28789. minWidth: me.pickerWidth,
  28790. minHeight: me.pickerHeight,
  28791. maxWidth: me.pickerWidth,
  28792. maxHeight: me.pickerHeight,
  28793. items: [
  28794. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  28795. xtype: 'toolbar',
  28796. items: [
  28797. { xtype: 'textfield', fieldLabel: '筛选' },
  28798. {
  28799. xtype: 'button',
  28800. text: '查询',
  28801. iconCls: 'x-fa fa-search',
  28802. cssType: 'primary',
  28803. listeners: {
  28804. click: function () {
  28805. me.reloadGrid();
  28806. }
  28807. }
  28808. },
  28809. ]
  28810. }, autoLoad: false, listeners: {
  28811. afterrender: function (grid) {
  28812. me.grid = grid;
  28813. grid.focus();
  28814. grid.on({
  28815. rowdblclick: function (sender, row) {
  28816. me.selectItem(row);
  28817. },
  28818. dataLoadComplete: function (sender) {
  28819. _$2.defer(function () {
  28820. me.setFocus();
  28821. });
  28822. },
  28823. keydown: function (sender, e) {
  28824. if (me.column) {
  28825. // 列模式,拦截 keydown
  28826. me.processKey(e);
  28827. }
  28828. },
  28829. keyup: function (sender, e) {
  28830. if (!me.column) {
  28831. // 常规模式,拦截 keyup
  28832. me.processKey(e);
  28833. }
  28834. }
  28835. });
  28836. },
  28837. } })
  28838. ]
  28839. };
  28840. // @ts-ignore
  28841. var picker = new Ext.container.Container(cfg);
  28842. return picker;
  28843. },
  28844. setFocus: function () {
  28845. if (this.grid.store.getCount() > 0) {
  28846. this.grid.focusRow(0);
  28847. }
  28848. },
  28849. processKey: function (e) {
  28850. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  28851. this.selectItem(this.grid.selection);
  28852. stopEvent(e);
  28853. }
  28854. else if (e.key === 'Escape') {
  28855. this.collapse();
  28856. }
  28857. },
  28858. repaintPickerView: function () {
  28859. var style = this.picker.getView().getEl().dom.style;
  28860. style.display = style.display;
  28861. },
  28862. onItemClick: function (view, record, node, rowIndex, e) {
  28863. this.selectItem(record);
  28864. },
  28865. onPickerKeyDown: function (treeView, record, item, index, e) {
  28866. var key = e.getKey();
  28867. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  28868. this.selectItem(record);
  28869. }
  28870. },
  28871. filterChange: _$2.debounce(function (sender, value) {
  28872. sender.onExpand();
  28873. }, 1000),
  28874. selectItem: function (record) {
  28875. var me = this;
  28876. var lookup = this.lookup;
  28877. var scope = lookupScope(this);
  28878. me.fireEvent('select', me, record);
  28879. if (record.isModel) {
  28880. record = record.data;
  28881. }
  28882. tryWriteObject(lookup, record, function (path, value) {
  28883. me._lookupSet(path, value);
  28884. });
  28885. // lookup
  28886. // fromColumn: 'toTarget'
  28887. // fromColumn: 'toTarget'
  28888. // fromColumn: 'toTarget'
  28889. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  28890. var value = _$2.get(record, fromColumn);
  28891. me._lookupSet(toTarget, value);
  28892. });
  28893. // 选定之后不能做清空
  28894. // const {lookupClearOnChange} = me
  28895. // if (_.isArray(lookupClearOnChange)) {
  28896. // _.each(lookupClearOnChange, item => {
  28897. // me._lookupSet(item, '')
  28898. // })
  28899. // }
  28900. me.collapse();
  28901. // 触发 _raiseNextFocus
  28902. me._raiseNextFocus(me);
  28903. },
  28904. onExpand: function () {
  28905. // 展开时,根据 lookup 带入查询参数
  28906. var expressData = this.getExpressData();
  28907. var txtField = this.grid.down('toolbar').down('textfield');
  28908. txtField.setValue(expressData.queryValue);
  28909. this.reloadGrid();
  28910. },
  28911. reloadGrid: function () {
  28912. // 展开时,根据 lookup 带入查询参数
  28913. var expressData = this.getExpressData();
  28914. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  28915. var txtField = this.grid.down('toolbar').down('textfield');
  28916. // 每个 combogrid 默认带上 __queryValue 属性
  28917. reloadParam["__queryValue"] = txtField.getValue();
  28918. this.grid.reload(reloadParam);
  28919. },
  28920. onTriggerClick: function (sender) {
  28921. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  28922. if (!grid) {
  28923. msg('正在初始化,请稍后');
  28924. return;
  28925. }
  28926. if (!this.tryEnable()) {
  28927. // 没有达成 editEnable 条件,不用弹出
  28928. return;
  28929. }
  28930. if (isExpanded || readOnly || disabled) {
  28931. // 已弹出、只读、禁用状态下,不允许弹出
  28932. return;
  28933. }
  28934. this._superBlur = true;
  28935. this.superclass.onTriggerClick.apply(this, arguments);
  28936. this._superBlur = false;
  28937. },
  28938. onCollapse: function () {
  28939. // 每次收回时,删除下拉组件
  28940. // delete this.picker
  28941. },
  28942. /**
  28943. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  28944. */
  28945. setValue: function (value) {
  28946. var me = this;
  28947. // 设值用户看到的表面内容
  28948. this.setRawValue(value);
  28949. // 设值 setValue 调用链,正常触发 change 事件等
  28950. return me.mixins.field.setValue.call(me, value);
  28951. },
  28952. _lookupSet: function (path, value) {
  28953. var me = this;
  28954. path = tryVarSimple(path);
  28955. if (me.column) {
  28956. // 判断写入目标,是否与自己绑定的属性相等
  28957. if (path === 'queryValue' || me.column.dataIndex === path) {
  28958. me.setValue(value);
  28959. }
  28960. // 列模式下,写当前编辑行
  28961. var parentRecord = me._lookupEditorRecord();
  28962. if (parentRecord) {
  28963. // Ext.data.Record / Ext.data.Model
  28964. parentRecord.set(path, value);
  28965. }
  28966. else {
  28967. debugger;
  28968. }
  28969. }
  28970. else {
  28971. // 常规模式下,写 viewModel
  28972. me.scope.viewModel.set(path, value);
  28973. }
  28974. },
  28975. _lookupGrid: function () {
  28976. return this.column.up('grid');
  28977. },
  28978. _lookupEditorRecord: function () {
  28979. var _a, _b, _c, _d;
  28980. // parentGrid.getSelectionModel().getLastSelected()
  28981. var grid = this._lookupGrid();
  28982. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  28983. if (!editingPlugin) {
  28984. return grid.getSelectionModel().getLastSelected();
  28985. }
  28986. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  28987. if (_$2.isNumber(rowIdx)) {
  28988. return grid.store.getAt(rowIdx);
  28989. }
  28990. else {
  28991. return grid.getSelectionModel().getLastSelected();
  28992. }
  28993. },
  28994. onChange: function (newVal, oldVal) {
  28995. var me = this;
  28996. var value = newVal;
  28997. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  28998. if (hideTrigger || disabled || readOnly || hideClear) {
  28999. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  29000. return;
  29001. }
  29002. if (value) {
  29003. me.getTrigger('clear').show();
  29004. me.updateLayout();
  29005. }
  29006. else {
  29007. me.getTrigger('clear').hide();
  29008. me.updateLayout();
  29009. }
  29010. },
  29011. /**
  29012. * 得到能用于 express 表达式计算的上下文数据
  29013. */
  29014. getExpressData: function () {
  29015. var queryValue = this.getRawValue();
  29016. if (!queryValue) {
  29017. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  29018. queryValue = this.getPicker().down('textfield').getRawValue();
  29019. }
  29020. if (this.column) {
  29021. // 列模式, 准备好判断 editEnable 表达式用的数据
  29022. var parentRecord = this._lookupEditorRecord();
  29023. if (!parentRecord) {
  29024. debugger;
  29025. }
  29026. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  29027. }
  29028. else {
  29029. // 编辑模式,准备好判断用的数据
  29030. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  29031. }
  29032. },
  29033. tryEnable: function () {
  29034. return tryEnable(this.getExpressData(), this.editEnable);
  29035. },
  29036. /**
  29037. * 清空所有值
  29038. */
  29039. onClearClick: function (sender, e) {
  29040. var me = this;
  29041. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  29042. me.fireEvent('clear', sender, e);
  29043. me.setValue('');
  29044. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  29045. me._lookupSet(toTarget, '');
  29046. });
  29047. _$2.each(lookupClearOnChange, function (item) {
  29048. me._lookupSet(item, '');
  29049. });
  29050. }
  29051. });
  29052. }
  29053. function initContainer () {
  29054. var cc = Ext.container.Container.prototype.constructor;
  29055. //const {initComponent} = Ext.container.Container.prototype
  29056. Ext.container.Container.override({
  29057. constructor: function (config) {
  29058. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  29059. cc.call(this, newConfig);
  29060. },
  29061. });
  29062. }
  29063. function initRows () {
  29064. Ext.define('Yvan.Rows', {
  29065. extend: 'Ext.container.Container',
  29066. xtype: 'rows',
  29067. constructor: function (config) {
  29068. var self = this;
  29069. var newConfig = _$2.defaultsDeep({
  29070. // 强制性属性
  29071. layout: 'anchor', border: false,
  29072. defaults: {
  29073. border: false, anchor: '100%',
  29074. margin: '0 0 5 0',
  29075. },
  29076. }, baseConfig(config, 'rows-container'), config, rows);
  29077. this.superclass.constructor.call(self, newConfig);
  29078. },
  29079. });
  29080. }
  29081. function initForm () {
  29082. var ct = Ext.form.Panel.prototype.constructor;
  29083. Ext.form.Panel.override({
  29084. constructor: function (config) {
  29085. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  29086. ct.call(this, newConfig);
  29087. }
  29088. });
  29089. }
  29090. function initCols () {
  29091. Ext.define('Yvan.Cols', {
  29092. extend: 'Ext.container.Container',
  29093. xtype: 'cols',
  29094. constructor: function (config) {
  29095. var self = this;
  29096. var newConfig = _$2.defaultsDeep({
  29097. // 强制性属性
  29098. layout: 'hbox',
  29099. minHeight: config.designMode ? 32 : 0
  29100. }, baseConfig(config, 'cols-container'), config, cols);
  29101. this.superclass.constructor.call(self, newConfig);
  29102. },
  29103. });
  29104. }
  29105. function initButton () {
  29106. /**
  29107. *
  29108. */
  29109. var ct = Ext.button.Button.prototype.constructor;
  29110. Ext.button.Button.override({
  29111. constructor: function (config) {
  29112. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  29113. ct.call(this, newConfig);
  29114. },
  29115. setLoading: function (value) {
  29116. if (value) {
  29117. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  29118. this._originIconCls = this.iconCls;
  29119. }
  29120. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  29121. this.setDisabled(true);
  29122. }
  29123. else {
  29124. this.setIconCls(this._originIconCls);
  29125. this.setDisabled(false);
  29126. }
  29127. }
  29128. });
  29129. }
  29130. function initIframe () {
  29131. Ext.define('Ext.ux.IFrame', {
  29132. extend: 'Ext.Component',
  29133. alias: 'widget.uxiframe',
  29134. loadMask: 'Loading...',
  29135. src: 'about:blank',
  29136. renderTpl: [
  29137. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  29138. ],
  29139. childEls: ['iframeEl'],
  29140. initComponent: function () {
  29141. this.superclass.initComponent.call(this);
  29142. this.superclass.initEvents.call(this);
  29143. this.frameName = this.frameName || this.id + '-frame';
  29144. },
  29145. initEvents: function () {
  29146. var me = this;
  29147. this.superclass.initEvents.call(this);
  29148. me.iframeEl.on('load', me.onLoad, me);
  29149. },
  29150. initRenderData: function () {
  29151. return Ext.apply(this.superclass.initRenderData.call(this), {
  29152. src: this.src,
  29153. frameName: this.frameName
  29154. });
  29155. },
  29156. getBody: function () {
  29157. var doc = this.getDoc();
  29158. return doc.body || doc.documentElement;
  29159. },
  29160. getDoc: function () {
  29161. try {
  29162. return this.getWin().document;
  29163. }
  29164. catch (ex) {
  29165. return null;
  29166. }
  29167. },
  29168. getWin: function () {
  29169. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  29170. return win;
  29171. },
  29172. getFrame: function () {
  29173. var me = this;
  29174. return me.iframeEl.dom;
  29175. },
  29176. onLoad: function () {
  29177. var me = this, doc = me.getDoc();
  29178. if (doc) {
  29179. this.el.unmask();
  29180. this.fireEvent('load', this);
  29181. }
  29182. else if (me.src) {
  29183. this.el.unmask();
  29184. this.fireEvent('error', this);
  29185. }
  29186. },
  29187. load: function (src) {
  29188. var me = this, text = me.loadMask, frame = me.getFrame();
  29189. if (me.fireEvent('beforeload', me, src) !== false) {
  29190. if (text && me.el) {
  29191. me.el.mask(text);
  29192. }
  29193. frame.src = me.src = (src || me.src);
  29194. }
  29195. }
  29196. });
  29197. }
  29198. /**
  29199. * 属性:
  29200. * - autoLoad: true
  29201. * - dataSource: ''
  29202. * 方法:
  29203. * - handleZoomBig
  29204. * - handleZoomSmall
  29205. * - handleZoomReset
  29206. * - openDiagram
  29207. * - getBpmn
  29208. * - getBpmnCanvas
  29209. * - getBpmnOverlays
  29210. * - getBpmnZoomScroll
  29211. * 事件:
  29212. * - initFinish
  29213. * - failed
  29214. * - success
  29215. * - itemHover
  29216. * - itemOut
  29217. * - itemClick
  29218. * - itemDblclick
  29219. * - itemMousedown
  29220. * - itemMouseup
  29221. */
  29222. function initBpmn () {
  29223. Ext.define('Yvan.Bpmn', {
  29224. // extend: 'Ext.container.Container',
  29225. extend: 'Ext.panel.Panel',
  29226. alias: 'widget.bpmn',
  29227. xtype: 'bpmn',
  29228. constructor: function (config) {
  29229. var self = this;
  29230. var newConfig = _$2.defaultsDeep({
  29231. // 强制性属性
  29232. }, baseConfig(config, 'row-item'), config, bpmn);
  29233. if (!newConfig.hideToolbar) {
  29234. newConfig.tbar = [];
  29235. newConfig.tbar.push({
  29236. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  29237. listeners: {
  29238. click: function (sender) {
  29239. self.reload();
  29240. }
  29241. }
  29242. });
  29243. newConfig.tbar.push({
  29244. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  29245. listeners: {
  29246. click: function (sender) {
  29247. self.handleZoomBig();
  29248. }
  29249. },
  29250. });
  29251. newConfig.tbar.push({
  29252. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  29253. listeners: {
  29254. click: function (sender) {
  29255. self.handleZoomSmall();
  29256. }
  29257. },
  29258. });
  29259. newConfig.tbar.push({
  29260. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  29261. listeners: {
  29262. click: function (sender) {
  29263. self.handleZoomReset();
  29264. }
  29265. },
  29266. });
  29267. }
  29268. this.superclass.constructor.call(self, newConfig);
  29269. },
  29270. initComponent: function () {
  29271. var _this = this;
  29272. var me = this;
  29273. var config = me.config;
  29274. var scope = lookupScope(this);
  29275. if (!isDesignMode(scope, config)) {
  29276. //@ts-ignore
  29277. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  29278. console.log('BpNavigated', me, BpNavigated);
  29279. var dom = me.el.dom;
  29280. var $dom = $(dom);
  29281. var $container = $dom.find('.x-autocontainer-innerCt');
  29282. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  29283. _this._bpmn = bpmn;
  29284. if (_this.autoLoad) {
  29285. _this.reload();
  29286. }
  29287. _this.fireEvent('initFinish', _this);
  29288. var eventBus = bpmn.get('eventBus');
  29289. eventBus.on('element.hover', function (e) {
  29290. // this.fireEvent('itemHover', this, e);
  29291. });
  29292. eventBus.on('element.out', function (e) {
  29293. _this.fireEvent('itemOut', _this, e);
  29294. });
  29295. eventBus.on('element.click', function (e) {
  29296. _this.fireEvent('itemClick', _this, e);
  29297. });
  29298. eventBus.on('element.dblclick', function (e) {
  29299. _this.fireEvent('itemDblclick', _this, e);
  29300. });
  29301. eventBus.on('element.mousedown', function (e) {
  29302. _this.fireEvent('itemMousedown', _this, e);
  29303. });
  29304. eventBus.on('element.mouseup', function (e) {
  29305. _this.fireEvent('itemMouseup', _this, e);
  29306. });
  29307. });
  29308. }
  29309. this.superclass.initComponent.call(this);
  29310. this.on({
  29311. afterrender: function (sender) {
  29312. }
  29313. });
  29314. },
  29315. /**
  29316. * 重新载入
  29317. */
  29318. reload: function () {
  29319. var _this = this;
  29320. var _a;
  29321. if (typeof this.dataSource === 'string' && this.dataSource) {
  29322. var scope = lookupScope(this);
  29323. var fn = lookupFn(scope, this.dataSource);
  29324. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  29325. _this.openDiagram(res.data);
  29326. });
  29327. }
  29328. },
  29329. /**
  29330. * 获取bpmn
  29331. */
  29332. getBpmn: function () {
  29333. return this._bpmn;
  29334. },
  29335. getBpmnCanvas: function () {
  29336. var _a;
  29337. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  29338. },
  29339. getBpmnOverlays: function () {
  29340. var _a;
  29341. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  29342. },
  29343. getBpmnZoomScroll: function () {
  29344. var _a;
  29345. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  29346. },
  29347. handleZoomBig: function () {
  29348. var _a;
  29349. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  29350. },
  29351. handleZoomSmall: function () {
  29352. var _a;
  29353. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  29354. },
  29355. handleZoomReset: function () {
  29356. var _a;
  29357. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  29358. },
  29359. openDiagram: function (diagram) {
  29360. var _this = this;
  29361. if (!this.getBpmn()) {
  29362. return;
  29363. }
  29364. this.getBpmn().importXML(diagram, function (err) {
  29365. if (err) {
  29366. // YvEventDispatch(this.onFailed, this, undefined);
  29367. _this.fireEvent('failed', _this, err);
  29368. return console.error('could not import BPMN 2.0 diagram', err);
  29369. }
  29370. // zoom to fit full viewport
  29371. _this.getBpmnCanvas().zoom('fit-viewport');
  29372. _this.fireEvent('success', _this);
  29373. });
  29374. },
  29375. });
  29376. }
  29377. function initSqlComplex () {
  29378. Ext.define('Yvan.SqlComplex', {
  29379. extend: 'Ext.panel.Panel',
  29380. xtype: 'sqlcomplex',
  29381. alias: 'widget.sqlcomplex',
  29382. getSqlExpress: function () {
  29383. },
  29384. constructor: function (config) {
  29385. var reference = config.reference;
  29386. var me = this;
  29387. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  29388. {
  29389. region: 'west',
  29390. width: 280,
  29391. border: false,
  29392. split: true,
  29393. reference: reference + '_tree',
  29394. xtype: 'yvtree',
  29395. hideRefresh: true,
  29396. hideExpand: true,
  29397. hideCollapse: true,
  29398. listeners: {
  29399. itemdblclick: function (sender, record, item, index, e) {
  29400. var field = record.get('field');
  29401. var defaultValue = record.get('defaultValue');
  29402. if (!field) {
  29403. return;
  29404. }
  29405. var tabExpress = me.down('tabpanel');
  29406. var sqleditor = me.down('sqleditor');
  29407. var expressGrid = me.down('yvgrid');
  29408. if (tabExpress.getActiveTab().key !== 'grid') {
  29409. // SQL 模式
  29410. sqleditor.insertText(field + '=');
  29411. }
  29412. else {
  29413. // 表格模式
  29414. expressGrid.appendEditRow({
  29415. field: field,
  29416. operator: '=',
  29417. value: defaultValue,
  29418. remark: '',
  29419. });
  29420. _$2.defer(function () {
  29421. gridChanged(me, expressGrid);
  29422. });
  29423. }
  29424. }
  29425. },
  29426. },
  29427. {
  29428. region: 'center',
  29429. xtype: 'tabpanel',
  29430. reference: reference + '_tab',
  29431. tabPosition: 'bottom',
  29432. listeners: {
  29433. afterrender: function (sender) {
  29434. var scope = lookupScope(me);
  29435. var value = scope.viewModel.get(me.config.bindValue);
  29436. // sql 转换为 grid
  29437. try {
  29438. var list_1 = parseSqlToGrid(value);
  29439. _$2.defer(function () {
  29440. var grid = me.down('yvgrid');
  29441. grid.setData(list_1);
  29442. });
  29443. }
  29444. catch (e) {
  29445. console.error(e);
  29446. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  29447. var tabSql = sender.down('sqleditor');
  29448. sender.setActiveTab(tabSql);
  29449. }
  29450. },
  29451. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  29452. var scope = lookupScope(me);
  29453. var value = scope.viewModel.get(me.config.bindValue);
  29454. if (newCard.key === 'grid') {
  29455. // sql 转换为 grid
  29456. try {
  29457. var list_2 = parseSqlToGrid(value);
  29458. _$2.defer(function () {
  29459. var grid = me.down('yvgrid');
  29460. grid.setData(list_2);
  29461. });
  29462. return true;
  29463. }
  29464. catch (e) {
  29465. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  29466. console.error(e);
  29467. return false;
  29468. }
  29469. }
  29470. else if (newCard.key === 'sql') {
  29471. // grid 转换为 sql
  29472. _$2.defer(function () {
  29473. var editor = me.down('sqleditor');
  29474. editor.setValue(value);
  29475. });
  29476. return true;
  29477. }
  29478. }
  29479. },
  29480. items: [
  29481. {
  29482. title: '表格模式',
  29483. key: 'grid',
  29484. xtype: 'yvgrid',
  29485. _mode: 'select',
  29486. reference: reference + '_grid',
  29487. hideFootbar: true,
  29488. pagination: false,
  29489. tbar: [
  29490. {
  29491. xtype: 'button',
  29492. text: '删除',
  29493. iconCls: 'x-fa fa-minus-circle',
  29494. cls: 'ext-btn-danger',
  29495. bind: {
  29496. disabled: '{!' + reference + '_grid.selection}',
  29497. },
  29498. listeners: {
  29499. click: function (sender) {
  29500. var grid = sender.up('yvgrid');
  29501. removeGridRow(grid);
  29502. gridChanged(me, grid);
  29503. }
  29504. },
  29505. },
  29506. ],
  29507. store: {},
  29508. listeners: {
  29509. editfinish: function (sender) {
  29510. gridChanged(me, sender);
  29511. },
  29512. },
  29513. columns: [
  29514. {
  29515. dataIndex: 'field',
  29516. header: '字段', sortable: false, menuDisabled: true,
  29517. width: 190,
  29518. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  29519. var column = context.column;
  29520. var propertyConfig = me.config.propertyConfig;
  29521. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  29522. var field = record.get('field');
  29523. if (field) {
  29524. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  29525. if (idx >= 0) {
  29526. var meta = propertyConfig[idx];
  29527. return meta.text;
  29528. }
  29529. }
  29530. return value;
  29531. }
  29532. },
  29533. {
  29534. dataIndex: 'operator',
  29535. header: '运算符', sortable: false, menuDisabled: true,
  29536. dict: 'operator',
  29537. width: 65,
  29538. editor: { xtype: 'combo' },
  29539. },
  29540. {
  29541. dataIndex: 'value',
  29542. header: '值', sortable: false, menuDisabled: true,
  29543. flex: 1,
  29544. getEditor: function (record) {
  29545. var column = this;
  29546. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  29547. var propertyConfig = me.config.propertyConfig;
  29548. var field = record.get('field');
  29549. if (!field) {
  29550. // 没有填 propertyName
  29551. return;
  29552. }
  29553. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  29554. if (idx < 0) {
  29555. console.error('没有找到 field=' + field + ". propertyConfig");
  29556. return;
  29557. }
  29558. var meta = propertyConfig[idx];
  29559. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  29560. return new Ext.grid.CellEditor({
  29561. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  29562. });
  29563. }
  29564. return new Ext.grid.CellEditor({
  29565. field: __assign({ dict: meta.dict }, meta.editor)
  29566. });
  29567. },
  29568. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  29569. var column = context.column;
  29570. var grid = _$2.get(view, 'ownerGrid');
  29571. var propertyConfig = me.config.propertyConfig;
  29572. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  29573. var field = record.get('field');
  29574. if (field) {
  29575. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  29576. if (idx >= 0) {
  29577. var meta = propertyConfig[idx];
  29578. var dictName = _$2.get(meta, 'dict');
  29579. if (dictName && window['DICT_CACHE'][dictName]) {
  29580. var dict_1 = window['DICT_CACHE'][dictName];
  29581. var valueText_1 = [];
  29582. _$2.forEach(_$2.split(valueList, ','), function (value) {
  29583. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  29584. if (idxKv >= 0) {
  29585. valueText_1.push(dict_1[idxKv].text);
  29586. }
  29587. else {
  29588. valueText_1.push(value);
  29589. }
  29590. });
  29591. return valueText_1.join(',');
  29592. }
  29593. }
  29594. }
  29595. return valueList;
  29596. },
  29597. },
  29598. ]
  29599. },
  29600. {
  29601. title: 'SQL模式',
  29602. key: 'sql',
  29603. xtype: 'sqleditor',
  29604. reference: reference + '_sql',
  29605. listeners: {
  29606. change: function (sender) {
  29607. var scope = lookupScope(me);
  29608. // 保存 editor 写入的值
  29609. scope.viewModel.set(me.config.bindValue, sender.getValue());
  29610. }
  29611. }
  29612. },
  29613. ]
  29614. }
  29615. ] });
  29616. this.superclass.constructor.call(this, newConfig);
  29617. },
  29618. initComponent: function () {
  29619. // 货位条件树
  29620. var me = this;
  29621. me.superclass.initComponent.apply(this, arguments);
  29622. var tree = this.down('yvtree');
  29623. var config = me.config;
  29624. tree.setRootNode(buildConfigTree(config.propertyConfig));
  29625. },
  29626. });
  29627. function gridChanged(me, grid) {
  29628. var data = grid.getDataRows();
  29629. var propertyConfig = me.config.propertyConfig;
  29630. var bindValue = me.config.bindValue;
  29631. var scope = lookupScope(me);
  29632. var sql = parseGridToSql(data);
  29633. scope.viewModel.set(bindValue, sql);
  29634. }
  29635. /**
  29636. * 用于从 propertyConfig 解析出树形结构
  29637. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  29638. * ->
  29639. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  29640. */
  29641. function buildConfigTree(propertyConfig) {
  29642. var root = {
  29643. expanded: true,
  29644. leaf: false,
  29645. children: []
  29646. };
  29647. var categoryObj = {};
  29648. var cfgList = propertyConfig;
  29649. _$2.forEach(cfgList, function (cfg) {
  29650. var cateNode = categoryObj[cfg.category];
  29651. if (!cateNode) {
  29652. cateNode = {
  29653. text: cfg.category, expanded: true, leaf: false,
  29654. children: []
  29655. };
  29656. categoryObj[cfg.category] = cateNode;
  29657. root.children.push(cateNode);
  29658. }
  29659. cateNode.children.push({
  29660. text: cfg.text,
  29661. field: cfg.field,
  29662. operator: cfg.operator,
  29663. defaultValue: cfg.defaultValue,
  29664. leaf: true,
  29665. });
  29666. });
  29667. return root;
  29668. }
  29669. /**
  29670. * 将表格变成 SQL where语句 [
  29671. * {field: 'f1', value: 1, operator: '='}
  29672. * {field: 'f2', value: 2, operator: '='}
  29673. * {field: 'f3', value: '3', operator: '>='}
  29674. * {field: 'f4', value: 4, operator: '='}
  29675. * ]
  29676. * ->
  29677. * f1=v1 and f2=v2
  29678. */
  29679. function parseGridToSql(list) {
  29680. var sqls = [];
  29681. _$2.forEach(list, function (i) {
  29682. var _a;
  29683. if (i.operator === 'in') {
  29684. sqls.push(i.field + ' in (' + (i.value) + ')');
  29685. }
  29686. else if (i.operator === 'notIn') {
  29687. sqls.push(i.field + ' not in (' + (i.value) + ')');
  29688. }
  29689. else {
  29690. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  29691. }
  29692. });
  29693. return sqls.join(' AND ');
  29694. }
  29695. /**
  29696. * 将 SQL 语句的 where 片段变成表格
  29697. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  29698. * @return [
  29699. {field: 'f1', value: 1, operator: '='}
  29700. {field: 'f2', value: 2, operator: '='}
  29701. {field: 'f3', value: '3', operator: '>='}
  29702. {field: 'f4', value: 4, operator: '='}
  29703. ]
  29704. */
  29705. function parseSqlToGrid(sql) {
  29706. if (!sql || !_$2.trim(sql)) {
  29707. return [];
  29708. }
  29709. var parser = new window['NodeSQLParser'].Parser();
  29710. var ast = parser.astify('select * from dual where ' + sql);
  29711. var ret = [];
  29712. exp(ast.where, ret);
  29713. return ret;
  29714. }
  29715. function exp(ast, ret) {
  29716. if (ast.type === 'binary_expr') {
  29717. if (_$2.toUpper(ast.operator) === 'AND') {
  29718. if (ast.left.type === 'binary_expr') {
  29719. exp(ast.left, ret);
  29720. }
  29721. if (ast.right.type === 'binary_expr') {
  29722. exp(ast.right, ret);
  29723. }
  29724. }
  29725. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  29726. if (ast.left.type === 'column_ref') {
  29727. if (ast.right.type === 'number' ||
  29728. ast.right.type === 'single_quote_string' ||
  29729. ast.right.type === 'double_quote_string') {
  29730. // 具体值相等
  29731. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  29732. }
  29733. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  29734. && ast.right.type === 'expr_list') {
  29735. // in / not in
  29736. var valueList_1 = [];
  29737. _$2.forEach(ast.right.value, function (item) {
  29738. valueList_1.push(item.value);
  29739. });
  29740. var operator = void 0;
  29741. if (_$2.toUpper(ast.operator) === 'IN') {
  29742. operator = 'in';
  29743. }
  29744. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  29745. operator = 'notIn';
  29746. }
  29747. ret.push({
  29748. field: ast.left.column, value: valueList_1.join(','),
  29749. operator: operator
  29750. });
  29751. }
  29752. else {
  29753. throw new Error('ast.right must is value.');
  29754. }
  29755. }
  29756. else {
  29757. throw new Error('ast.left must is column_ref.');
  29758. }
  29759. }
  29760. else {
  29761. // 必须用 AND 条件符匹配
  29762. throw new Error('ast.operator must is "AND / =".');
  29763. }
  29764. }
  29765. else {
  29766. throw new Error('ast.type must is "binary_expr".');
  29767. }
  29768. }
  29769. /**
  29770. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  29771. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  29772. {
  29773. type: 'binary_expr',
  29774. operator: 'AND',
  29775. left: {
  29776. type: 'binary_expr',
  29777. operator: 'AND',
  29778. left: {
  29779. type: 'binary_expr',
  29780. operator: 'AND',
  29781. left: {
  29782. type: 'binary_expr',
  29783. operator: 'AND',
  29784. left: {
  29785. type: 'binary_expr',
  29786. operator: '=',
  29787. left: {
  29788. type: 'column_ref',
  29789. table: null,
  29790. column: 'f1'
  29791. },
  29792. right: {
  29793. type: 'number',
  29794. value: 1
  29795. }
  29796. },
  29797. right: {
  29798. type: 'binary_expr',
  29799. operator: '=',
  29800. left: {
  29801. type: 'column_ref',
  29802. table: null,
  29803. column: 'f2'
  29804. },
  29805. right: {
  29806. type: 'number',
  29807. value: 2
  29808. }
  29809. }
  29810. },
  29811. right: {
  29812. type: 'binary_expr',
  29813. operator: '=',
  29814. left: {
  29815. type: 'column_ref',
  29816. table: null,
  29817. column: 'f3'
  29818. },
  29819. right: {
  29820. type: 'single_quote_string',
  29821. value: '3'
  29822. }
  29823. }
  29824. },
  29825. right: {
  29826. type: 'binary_expr',
  29827. operator: '>=',
  29828. left: {
  29829. type: 'column_ref',
  29830. table: null,
  29831. column: 'f4'
  29832. },
  29833. right: {
  29834. type: 'number',
  29835. value: 4
  29836. }
  29837. }
  29838. },
  29839. right: {
  29840. type: 'binary_expr',
  29841. operator: '<',
  29842. left: {
  29843. type: 'column_ref',
  29844. table: null,
  29845. column: 'f4'
  29846. },
  29847. right: {
  29848. type: 'number',
  29849. value: 3
  29850. }
  29851. }
  29852. }
  29853. * */
  29854. }
  29855. function initParamComplex () {
  29856. Ext.define('Yvan.ParamComplex', {
  29857. extend: 'Ext.panel.Panel',
  29858. xtype: 'paramcomplex',
  29859. alias: 'widget.paramcomplex',
  29860. getSqlExpress: function () {
  29861. },
  29862. constructor: function (config) {
  29863. var reference = config.reference;
  29864. var me = this;
  29865. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  29866. {
  29867. region: 'west',
  29868. width: 280,
  29869. border: false,
  29870. split: true,
  29871. reference: reference + '_tree',
  29872. xtype: 'yvtree',
  29873. hideRefresh: true,
  29874. hideExpand: true,
  29875. hideCollapse: true,
  29876. listeners: {
  29877. itemdblclick: function (sender, record, item, index, e) {
  29878. var field = record.get('field');
  29879. var defaultValue = record.get('defaultValue');
  29880. if (!field) {
  29881. return;
  29882. }
  29883. var tabExpress = me.down('tabpanel');
  29884. var sqleditor = me.down('sqleditor');
  29885. var expressGrid = me.down('yvgrid');
  29886. if (tabExpress.getActiveTab().key !== 'grid') {
  29887. // SQL 模式
  29888. sqleditor.insertText(field + '=');
  29889. }
  29890. else {
  29891. // 表格模式
  29892. expressGrid.appendEditRow({
  29893. field: field,
  29894. operator: '=',
  29895. value: defaultValue,
  29896. remark: '',
  29897. });
  29898. _$2.defer(function () {
  29899. gridChanged(me, expressGrid);
  29900. });
  29901. }
  29902. }
  29903. },
  29904. },
  29905. {
  29906. region: 'center',
  29907. xtype: 'tabpanel',
  29908. reference: reference + '_tab',
  29909. tabPosition: 'bottom',
  29910. listeners: {
  29911. afterrender: function (sender) {
  29912. var scope = lookupScope(me);
  29913. var value = scope.viewModel.get(me.config.bindValue);
  29914. // sql 转换为 grid
  29915. try {
  29916. var list_1 = parseParamToGrid(value);
  29917. _$2.defer(function () {
  29918. var grid = me.down('yvgrid');
  29919. grid.setData(list_1);
  29920. });
  29921. }
  29922. catch (e) {
  29923. console.error(e);
  29924. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  29925. var tabSql = sender.down('sqleditor');
  29926. sender.setActiveTab(tabSql);
  29927. }
  29928. },
  29929. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  29930. var scope = lookupScope(me);
  29931. var value = scope.viewModel.get(me.config.bindValue);
  29932. if (newCard.key === 'grid') {
  29933. // sql 转换为 grid
  29934. try {
  29935. var list_2 = parseParamToGrid(value);
  29936. _$2.defer(function () {
  29937. var grid = me.down('yvgrid');
  29938. grid.setData(list_2);
  29939. });
  29940. return true;
  29941. }
  29942. catch (e) {
  29943. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  29944. console.error(e);
  29945. return false;
  29946. }
  29947. }
  29948. else if (newCard.key === 'sql') {
  29949. // grid 转换为 sql
  29950. _$2.defer(function () {
  29951. var editor = me.down('sqleditor');
  29952. editor.setValue(value);
  29953. });
  29954. return true;
  29955. }
  29956. }
  29957. },
  29958. items: [
  29959. {
  29960. title: '表格模式',
  29961. key: 'grid',
  29962. xtype: 'yvgrid',
  29963. _mode: 'select',
  29964. reference: reference + '_grid',
  29965. hideFootbar: true,
  29966. pagination: false,
  29967. tbar: [
  29968. {
  29969. xtype: 'button',
  29970. text: '删除',
  29971. iconCls: 'x-fa fa-minus-circle',
  29972. cls: 'ext-btn-danger',
  29973. bind: {
  29974. disabled: '{!' + reference + '_grid.selection}',
  29975. },
  29976. listeners: {
  29977. click: function (sender) {
  29978. var grid = sender.up('yvgrid');
  29979. removeGridRow(grid);
  29980. gridChanged(me, grid);
  29981. }
  29982. },
  29983. },
  29984. ],
  29985. store: {},
  29986. listeners: {
  29987. editfinish: function (sender) {
  29988. gridChanged(me, sender);
  29989. },
  29990. },
  29991. columns: [
  29992. {
  29993. dataIndex: 'field',
  29994. header: '字段', sortable: false, menuDisabled: true,
  29995. width: 190,
  29996. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  29997. var column = context.column;
  29998. var propertyConfig = me.config.propertyConfig;
  29999. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  30000. var field = record.get('field');
  30001. if (field) {
  30002. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  30003. if (idx >= 0) {
  30004. var meta = propertyConfig[idx];
  30005. return meta.text;
  30006. }
  30007. }
  30008. return value;
  30009. }
  30010. },
  30011. {
  30012. dataIndex: 'value',
  30013. header: '值', sortable: false, menuDisabled: true,
  30014. flex: 1,
  30015. getEditor: function (record) {
  30016. var column = this;
  30017. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  30018. var propertyConfig = me.config.propertyConfig;
  30019. var field = record.get('field');
  30020. if (!field) {
  30021. // 没有填 propertyName
  30022. return;
  30023. }
  30024. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  30025. if (idx < 0) {
  30026. console.error('没有找到 field=' + field + ". propertyConfig");
  30027. return;
  30028. }
  30029. var meta = propertyConfig[idx];
  30030. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  30031. return new Ext.grid.CellEditor({
  30032. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  30033. });
  30034. }
  30035. return new Ext.grid.CellEditor({
  30036. field: __assign({ dict: meta.dict }, meta.editor)
  30037. });
  30038. },
  30039. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  30040. var column = context.column;
  30041. var grid = _$2.get(view, 'ownerGrid');
  30042. var propertyConfig = me.config.propertyConfig;
  30043. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  30044. var field = record.get('field');
  30045. if (field) {
  30046. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  30047. if (idx >= 0) {
  30048. var meta = propertyConfig[idx];
  30049. var dictName = _$2.get(meta, 'dict');
  30050. if (dictName && window['DICT_CACHE'][dictName]) {
  30051. var dict_1 = window['DICT_CACHE'][dictName];
  30052. var valueText_1 = [];
  30053. _$2.forEach(_$2.split(valueList, ','), function (value) {
  30054. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  30055. if (idxKv >= 0) {
  30056. valueText_1.push(dict_1[idxKv].text);
  30057. }
  30058. else {
  30059. valueText_1.push(value);
  30060. }
  30061. });
  30062. return valueText_1.join(',');
  30063. }
  30064. }
  30065. }
  30066. return valueList;
  30067. },
  30068. },
  30069. ]
  30070. },
  30071. {
  30072. title: '文本模式',
  30073. key: 'sql',
  30074. xtype: 'sqleditor',
  30075. reference: reference + '_sql',
  30076. listeners: {
  30077. change: function (sender) {
  30078. var scope = lookupScope(me);
  30079. // 保存 editor 写入的值
  30080. scope.viewModel.set(me.config.bindValue, sender.getValue());
  30081. }
  30082. }
  30083. },
  30084. ]
  30085. }
  30086. ] });
  30087. this.superclass.constructor.call(this, newConfig);
  30088. },
  30089. initComponent: function () {
  30090. // 货位条件树
  30091. var me = this;
  30092. me.superclass.initComponent.apply(this, arguments);
  30093. var tree = this.down('yvtree');
  30094. var config = me.config;
  30095. tree.setRootNode(buildConfigTree(config.propertyConfig));
  30096. },
  30097. });
  30098. function gridChanged(me, grid) {
  30099. var data = grid.getDataRows();
  30100. var propertyConfig = me.config.propertyConfig;
  30101. var bindValue = me.config.bindValue;
  30102. var scope = lookupScope(me);
  30103. var sql = parseGridToParam(data);
  30104. scope.viewModel.set(bindValue, sql);
  30105. }
  30106. /**
  30107. * 用于从 propertyConfig 解析出树形结构
  30108. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  30109. * ->
  30110. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  30111. */
  30112. function buildConfigTree(propertyConfig) {
  30113. var root = {
  30114. expanded: true,
  30115. leaf: false,
  30116. children: []
  30117. };
  30118. var categoryObj = {};
  30119. var cfgList = propertyConfig;
  30120. _$2.forEach(cfgList, function (cfg) {
  30121. var cateNode = categoryObj[cfg.category];
  30122. if (!cateNode) {
  30123. cateNode = {
  30124. text: cfg.category, expanded: true, leaf: false,
  30125. children: []
  30126. };
  30127. categoryObj[cfg.category] = cateNode;
  30128. root.children.push(cateNode);
  30129. }
  30130. cateNode.children.push({
  30131. text: cfg.text,
  30132. field: cfg.field,
  30133. operator: cfg.operator,
  30134. defaultValue: cfg.defaultValue,
  30135. leaf: true,
  30136. });
  30137. });
  30138. return root;
  30139. }
  30140. /**
  30141. * 将表格变成参数语句 [
  30142. * {field: 'f1', value: 1}
  30143. * {field: 'f2', value: 2}
  30144. * {field: 'f3', value: '3'}
  30145. * {field: 'f4', value: 4}
  30146. * ]
  30147. * ->
  30148. * f1=v1, f2=v2
  30149. */
  30150. function parseGridToParam(list) {
  30151. var sqls = [];
  30152. _$2.forEach(list, function (i) {
  30153. sqls.push(i.field + '=' + (i.value));
  30154. });
  30155. return sqls.join('; ');
  30156. }
  30157. /**
  30158. * 将 分号分割的的参数设置 变成表格
  30159. * @param param a=1; b=2; c='3'
  30160. * @return [
  30161. {field: 'a', value: 1}
  30162. {field: 'b', value: 2}
  30163. {field: 'c', value: '3'}
  30164. ]
  30165. */
  30166. function parseParamToGrid(param) {
  30167. if (!param || !_$2.trim(param)) {
  30168. return [];
  30169. }
  30170. var ret = [];
  30171. var sp = _$2.split(param, ';');
  30172. _$2.forEach(sp, function (v) {
  30173. var vi = _$2.indexOf(v, '=');
  30174. var field = _$2.trim(v.substr(0, vi));
  30175. var value = eval(v.substr(vi + 1));
  30176. ret.push({ field: field, value: value });
  30177. });
  30178. return ret;
  30179. }
  30180. }
  30181. function initSqlEditor$1 () {
  30182. Ext.define('com.yvan.studio.SqlEditor', {
  30183. extend: 'Ext.panel.Panel',
  30184. alias: 'widget.sqleditor',
  30185. xtype: 'sqleditor',
  30186. layout: 'fit',
  30187. border: false,
  30188. html: "<div class=\"editor\"/>",
  30189. config: {
  30190. value: ''
  30191. },
  30192. codeChange: undefined,
  30193. isChangeFromOuter: false,
  30194. setCode: function (value) {
  30195. var _this = this;
  30196. this.code = value;
  30197. this.value = value;
  30198. _$2.defer(function () {
  30199. _this.isChangeFromOuter = true;
  30200. if (_this.editor) {
  30201. _this.editor.setValue(value);
  30202. }
  30203. });
  30204. },
  30205. getCode: function () {
  30206. return this.getValue();
  30207. },
  30208. updateOptions: function (options) {
  30209. if (this.editor && options) {
  30210. this.editor.updateOptions(options);
  30211. }
  30212. },
  30213. getValue: function () {
  30214. if (!this.editor) {
  30215. return this.code;
  30216. }
  30217. return this.editor.getValue();
  30218. },
  30219. applyPosition: function () {
  30220. var _this = this;
  30221. if (this.autoFocusMethod) {
  30222. if (this.editor) {
  30223. _$2.defer(function () {
  30224. if (_this.autoFocusStartLine) {
  30225. _this.editor.setPosition({
  30226. lineNumber: _this.autoFocusStartLine,
  30227. column: _this.autoFocusStartColumn
  30228. });
  30229. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30230. }
  30231. _this.editor.focus();
  30232. });
  30233. delete this.autoFocusMethod;
  30234. }
  30235. }
  30236. this.editor.layout();
  30237. },
  30238. insertText: function (text) {
  30239. var editor = this.editor;
  30240. var position = editor.getPosition();
  30241. editor.executeEdits('', [
  30242. {
  30243. range: {
  30244. startLineNumber: position.lineNumber,
  30245. startColumn: position.column,
  30246. endLineNumber: position.lineNumber,
  30247. endColumn: position.column
  30248. },
  30249. text: text
  30250. }
  30251. ]);
  30252. },
  30253. setValue: function (value, fromEditor) {
  30254. this.setCode(value);
  30255. var me = this;
  30256. if (me.value === value) {
  30257. // 值相等,不需要变化
  30258. return;
  30259. }
  30260. if (fromEditor !== true && me.editor) {
  30261. // 不是来源于编辑器的变化,才设置编辑器的值
  30262. me.editor.setValue(value);
  30263. }
  30264. // 通知mixins setValue
  30265. me.value = value;
  30266. me.fireEvent('change', value);
  30267. },
  30268. initComponent: function () {
  30269. var that = this;
  30270. this.superclass.initComponent.call(this);
  30271. that.on({
  30272. resize: function () {
  30273. if (that.editor) {
  30274. that.editor.layout();
  30275. }
  30276. },
  30277. destory: function () {
  30278. if (that.editor) {
  30279. that.editor.dispose();
  30280. delete that.editor;
  30281. }
  30282. },
  30283. afterrender: function (sender) {
  30284. var $dom = $(that.el.dom).find('.editor');
  30285. attach_2($dom[0], {
  30286. value: that.code
  30287. }).then(function (editor) {
  30288. that.editor = editor;
  30289. that.applyPosition();
  30290. that.editor.onDidChangeModelContent(function (e) {
  30291. that.fireEvent('change', that.editor, e);
  30292. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30293. that.codeChange(that.editor.getValue(), that.name, e);
  30294. }
  30295. that.isChangeFromOuter = false;
  30296. });
  30297. });
  30298. }
  30299. });
  30300. }
  30301. });
  30302. function attach_2(element, opts) {
  30303. if (!window['monaco']) {
  30304. return;
  30305. }
  30306. var monaco = window['monaco'];
  30307. return new Promise(function (resolve) {
  30308. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  30309. enabled: false
  30310. } }));
  30311. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  30312. // const sql = editor.getValue()
  30313. // if (_.trim(sql).length > 0) {
  30314. // editor.setValue(format(sql, {
  30315. // indent: ' ',
  30316. // uppercase: true,
  30317. // }))
  30318. // }
  30319. // })
  30320. editor.onKeyUp(function (e) {
  30321. // console.log(e)
  30322. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  30323. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  30324. }
  30325. });
  30326. resolve(editor);
  30327. });
  30328. }
  30329. }
  30330. function initJsonEditor$1 () {
  30331. Ext.define('com.yvan.studio.JsonEditor', {
  30332. extend: 'Ext.panel.Panel',
  30333. alias: 'widget.jsoneditor',
  30334. xtype: 'jsoneditor',
  30335. layout: 'fit',
  30336. border: false,
  30337. html: "<div class=\"editor\"/>",
  30338. autoFocusMethod: true,
  30339. autoFocusStartLine: 0,
  30340. autoFocusStartColumn: 0,
  30341. codeChange: undefined,
  30342. funcArr: [],
  30343. modulePage: null,
  30344. isChangeFromOuter: false,
  30345. name: "",
  30346. /**
  30347. * 设置代码
  30348. */
  30349. setCode: function (value) {
  30350. var _this = this;
  30351. this.code = value;
  30352. _$2.defer(function () {
  30353. _this.isChangeFromOuter = true;
  30354. if (_this.editor) {
  30355. _this.editor.setValue(value);
  30356. }
  30357. });
  30358. },
  30359. updateOptions: function (options) {
  30360. if (this.editor && options) {
  30361. this.editor.updateOptions(options);
  30362. }
  30363. },
  30364. setLanguage: function (lang) {
  30365. if (!window['monaco']) {
  30366. return;
  30367. }
  30368. var monaco = window['monaco'];
  30369. if (this.editor && lang) {
  30370. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  30371. }
  30372. },
  30373. getCode: function () {
  30374. var _a;
  30375. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  30376. },
  30377. applyPosition: function () {
  30378. var _this = this;
  30379. if (this.autoFocusMethod) {
  30380. if (this.editor) {
  30381. _$2.defer(function () {
  30382. if (_this.autoFocusStartLine) {
  30383. _this.editor.setPosition({
  30384. lineNumber: _this.autoFocusStartLine,
  30385. column: _this.autoFocusStartColumn
  30386. });
  30387. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30388. }
  30389. _this.editor.focus();
  30390. });
  30391. delete this.autoFocusMethod;
  30392. }
  30393. }
  30394. this.editor.layout();
  30395. },
  30396. initComponent: function () {
  30397. var that = this;
  30398. this.superclass.initComponent.apply(this, arguments);
  30399. this.on({
  30400. resize: function (sender, width, height) {
  30401. if (that.editor) {
  30402. that.editor.layout();
  30403. }
  30404. },
  30405. destory: function () {
  30406. if (that.editor) {
  30407. that.editor.dispose();
  30408. delete that.editor;
  30409. }
  30410. },
  30411. afterrender: function (sender) {
  30412. var $dom = $(that.el.dom).find('.editor');
  30413. attach_116($dom[0], {
  30414. value: that.code
  30415. }).then(function (editor) {
  30416. that.editor = editor;
  30417. that.applyPosition();
  30418. that.editor.onDidChangeModelContent(function (e) {
  30419. that.fireEvent('change', that.editor, e);
  30420. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30421. that.codeChange(that.editor.getValue(), that.name, e);
  30422. }
  30423. that.isChangeFromOuter = false;
  30424. });
  30425. });
  30426. }
  30427. });
  30428. },
  30429. });
  30430. function attach_116(element, opts) {
  30431. if (!window['monaco']) {
  30432. return;
  30433. }
  30434. var monaco = window['monaco'];
  30435. return new Promise(function (resolve) {
  30436. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  30437. enabled: false
  30438. } }));
  30439. editor.onKeyUp(function (e) {
  30440. // console.log(e)
  30441. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  30442. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  30443. }
  30444. });
  30445. resolve(editor);
  30446. });
  30447. }
  30448. }
  30449. function initJsEditor$1 () {
  30450. Ext.define('com.yvan.studio.JsEditor', {
  30451. extend: 'Ext.panel.Panel',
  30452. alias: 'widget.jseditor',
  30453. xtype: 'jseditor',
  30454. layout: 'fit',
  30455. border: false,
  30456. html: "<div class=\"editor\"/>",
  30457. autoFocusMethod: true,
  30458. autoFocusStartLine: 0,
  30459. autoFocusStartColumn: 0,
  30460. codeChange: undefined,
  30461. funcArr: [],
  30462. modulePage: null,
  30463. isChangeFromOuter: false,
  30464. name: "",
  30465. /**
  30466. * 设置代码
  30467. */
  30468. setCode: function (value) {
  30469. var _this = this;
  30470. this.code = value;
  30471. _$2.defer(function () {
  30472. _this.isChangeFromOuter = true;
  30473. if (_this.editor) {
  30474. _this.editor.setValue(value);
  30475. if (_this.name === "controllerEditor") {
  30476. _this.funcArr = _this.getAllFunction();
  30477. }
  30478. }
  30479. });
  30480. },
  30481. getCode: function () {
  30482. var _a;
  30483. if (!this.editor) {
  30484. return this.code;
  30485. }
  30486. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  30487. },
  30488. applyPosition: function () {
  30489. var _this = this;
  30490. if (this.autoFocusMethod) {
  30491. if (this.editor) {
  30492. _$2.defer(function () {
  30493. if (_this.autoFocusStartLine) {
  30494. _this.editor.setPosition({
  30495. lineNumber: _this.autoFocusStartLine,
  30496. column: _this.autoFocusStartColumn
  30497. });
  30498. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30499. }
  30500. _this.editor.focus();
  30501. });
  30502. delete this.autoFocusMethod;
  30503. }
  30504. }
  30505. this.editor.layout();
  30506. },
  30507. initComponent: function () {
  30508. var that = this;
  30509. this.superclass.initComponent.apply(this, arguments);
  30510. this.on({
  30511. resize: function (sender, width, height) {
  30512. if (that.editor) {
  30513. that.editor.layout();
  30514. }
  30515. },
  30516. destory: function () {
  30517. if (that.editor) {
  30518. that.editor.dispose();
  30519. delete that.editor;
  30520. }
  30521. },
  30522. afterrender: function () {
  30523. var $dom = $(that.el.dom).find('.editor');
  30524. attach_1($dom[0], {
  30525. value: that.code
  30526. }).then(function (editor) {
  30527. that.editor = editor;
  30528. that.applyPosition();
  30529. that.editor.onDidChangeModelContent(function (e) {
  30530. that.fireEvent('change', that.editor, e);
  30531. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30532. that.codeChange(that.editor.getValue(), that.name, e);
  30533. }
  30534. that.isChangeFromOuter = false;
  30535. });
  30536. });
  30537. }
  30538. });
  30539. },
  30540. getAllFunction: function () {
  30541. var funcArr = [];
  30542. var ast = window['YvanUI'].recast.parse(this.code);
  30543. if (ast && ast.program && ast.program.body) {
  30544. if (Array.isArray(ast.program.body)) {
  30545. for (var i = 0; i < ast.program.body.length; i++) {
  30546. var m = ast.program.body[i];
  30547. if (m.type === "ExportDefaultDeclaration") {
  30548. if (m.declaration.type === "ClassDeclaration") {
  30549. if (m.declaration.body.type === "ClassBody") {
  30550. if (Array.isArray(m.declaration.body.body)) {
  30551. for (var j = 0; j < m.declaration.body.body.length; j++) {
  30552. var ob = m.declaration.body.body[j];
  30553. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  30554. var funcItem = { name: ob.key.name, args: [] };
  30555. if (Array.isArray(ob.value.params)) {
  30556. for (var k = 0; k < ob.value.params.length; k++) {
  30557. var p = ob.value.params[k];
  30558. funcItem.args.push(p.name);
  30559. }
  30560. }
  30561. funcArr.push(funcItem);
  30562. }
  30563. }
  30564. }
  30565. }
  30566. }
  30567. }
  30568. }
  30569. }
  30570. }
  30571. return funcArr;
  30572. }
  30573. });
  30574. var isInited = false;
  30575. function attach_1(element, opts) {
  30576. if (!window['monaco']) {
  30577. return;
  30578. }
  30579. var monaco = window['monaco'];
  30580. return new Promise(function (resolve) {
  30581. if (!isInited) {
  30582. isInited = true;
  30583. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  30584. noSemanticValidation: true,
  30585. noSyntaxValidation: false
  30586. });
  30587. // compiler options
  30588. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  30589. target: monaco.languages.typescript.ScriptTarget.ES2016,
  30590. allowNonTsExtensions: true,
  30591. });
  30592. // extra libraries
  30593. var libSource = [
  30594. 'declare class Facts {',
  30595. ' /**',
  30596. ' * Returns the next fact',
  30597. ' */',
  30598. ' static next():string',
  30599. ' static next222():string',
  30600. '}',
  30601. "\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 ",
  30602. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  30603. ].join('\n');
  30604. var libUri = 'file:///index.d.ts';
  30605. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  30606. // When resolving definitions and references, the editor will try to use created models.
  30607. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  30608. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  30609. }
  30610. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  30611. resolve(editor);
  30612. });
  30613. }
  30614. }
  30615. function initClipboard () {
  30616. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  30617. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  30618. Ext.grid.plugin.Clipboard.override({
  30619. getCellData: function (format, erase) {
  30620. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  30621. if (selection) {
  30622. selection.eachCell(function (cellContext) {
  30623. column = cellContext.column;
  30624. view = cellContext.column.getView();
  30625. record = cellContext.record;
  30626. // Do not copy the check column or row numberer column
  30627. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  30628. return;
  30629. }
  30630. if (lastRecord !== record) {
  30631. lastRecord = record;
  30632. ret.push(row = []);
  30633. }
  30634. dataIndex = column.dataIndex;
  30635. // 记录原始数据
  30636. var rData = record.data[dataIndex];
  30637. if (isRaw) {
  30638. data = record.data[dataIndex];
  30639. }
  30640. else {
  30641. // Try to access the view node.
  30642. viewNode = view.all.item(cellContext.rowIdx);
  30643. // If we could not, it's because it's outside of the rendered block -
  30644. // recreate it.
  30645. if (!viewNode) {
  30646. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  30647. }
  30648. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  30649. data = cell.innerHTML;
  30650. if (isText) {
  30651. data = Ext.util.Format.stripTags(data);
  30652. }
  30653. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  30654. data = data || rData;
  30655. }
  30656. row.push(data);
  30657. if (erase && dataIndex) {
  30658. record.set(dataIndex, null);
  30659. }
  30660. });
  30661. }
  30662. // See decode() comment below
  30663. return Ext.util.TSV.encode(ret, undefined, null);
  30664. },
  30665. getCells: function (format, erase) {
  30666. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  30667. if (selection) {
  30668. selection.eachCell(function (cellContext) {
  30669. record = cellContext.record;
  30670. if (lastRecord !== record) {
  30671. lastRecord = record;
  30672. ret.push(row = {
  30673. model: record.self,
  30674. fields: []
  30675. });
  30676. }
  30677. dataIndex = cellContext.column.dataIndex;
  30678. row.fields.push({
  30679. name: dataIndex,
  30680. value: record.data[dataIndex]
  30681. });
  30682. if (erase && dataIndex) {
  30683. record.set(dataIndex, null);
  30684. }
  30685. });
  30686. }
  30687. return ret;
  30688. },
  30689. getTextData: function (format, erase) {
  30690. return this.getCellData(format, erase);
  30691. },
  30692. putCellData: function (data, format) {
  30693. var _a;
  30694. 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 = {};
  30695. // If the view is not focused, use the first cell of the selection as the destination.
  30696. if (!destination && selected) {
  30697. selected.eachCell(function (c) {
  30698. destination = c;
  30699. return false;
  30700. });
  30701. }
  30702. if (destination) {
  30703. // Create a new Context based upon the outermost View.
  30704. // NavigationModel works on local views.
  30705. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  30706. // At that point, we can use navModel.getPosition()
  30707. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  30708. }
  30709. else {
  30710. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  30711. }
  30712. destinationStartColumn = destination.colIdx;
  30713. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  30714. row = values[sourceRowIdx];
  30715. // Collect new values in dataObject
  30716. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  30717. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  30718. continue;
  30719. }
  30720. dataIndex = destination.column.dataIndex;
  30721. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  30722. if (dataIndex) {
  30723. switch (format) {
  30724. // Raw field values
  30725. case 'raw':
  30726. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  30727. break;
  30728. // Textual data with HTML tags stripped
  30729. case 'text':
  30730. {
  30731. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  30732. // 获取字典原始的value
  30733. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  30734. }
  30735. else {
  30736. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  30737. }
  30738. break;
  30739. }
  30740. }
  30741. }
  30742. // If we are at the end of the destination row, break the column loop.
  30743. if (destination.colIdx === maxColIdx) {
  30744. break;
  30745. }
  30746. destination.setColumn(destination.colIdx + 1);
  30747. }
  30748. // Update the record in one go.
  30749. destination.record.set(dataObject);
  30750. // If we are at the end of the destination store, break the row loop.
  30751. if (destination.rowIdx === maxRowIdx) {
  30752. break;
  30753. }
  30754. // Jump to next row in destination
  30755. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  30756. }
  30757. },
  30758. putTextData: function (data, format) {
  30759. var _a, _b, _c;
  30760. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  30761. // 根据复制的行数自动添加新的行
  30762. 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;
  30763. if (selected.startCell.rowIdx + values.length >= dataLength) {
  30764. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  30765. this.cmp.getStore().add({});
  30766. }
  30767. }
  30768. this.putCellData(data, format);
  30769. },
  30770. });
  30771. }
  30772. function initDict$1 () {
  30773. var DICT_CACHE = window['DICT_CACHE'];
  30774. if (!DICT_CACHE) {
  30775. DICT_CACHE = {};
  30776. window['DICT_CACHE'] = DICT_CACHE;
  30777. }
  30778. DICT_CACHE.XTYPE = [
  30779. { id: 'datefield', text: '日期' },
  30780. { id: 'datetimefield', text: '日期时间' },
  30781. { id: 'textfield', text: '文本' },
  30782. { id: 'numberfield', text: '数字' },
  30783. { id: 'combo', text: '下拉框' },
  30784. ];
  30785. DICT_CACHE.operator = [
  30786. { id: '=', text: '=' },
  30787. { id: '>', text: '>' },
  30788. { id: '<', text: '<' },
  30789. { id: '>=', text: '>=' },
  30790. { id: '<=', text: '<=' },
  30791. { id: 'in', text: 'in' },
  30792. { id: 'notIn', text: 'notIn' },
  30793. ];
  30794. DICT_CACHE.GRID_MODE = [
  30795. { id: 'edit1', text: '单机编辑模式' },
  30796. { id: 'edit2', text: '双击编辑模式' },
  30797. { id: 'checkbox', text: '勾选' },
  30798. { id: 'checkonly', text: '只勾选' },
  30799. { id: 'select', text: '行选择模式' },
  30800. ];
  30801. DICT_CACHE.BOTH_SELECT = [
  30802. { id: 'N/A', text: '<无>' },
  30803. { id: 'textfield', text: '文本' },
  30804. { id: 'numberfield', text: '数字框' },
  30805. { id: 'datefield', text: '日期' },
  30806. { id: 'datetimefield', text: '日期时间' },
  30807. { id: 'combo', text: '下拉框' },
  30808. { id: 'combogrid', text: '下拉表' },
  30809. { id: 'checkbox', text: '勾选' },
  30810. ];
  30811. DICT_CACHE.ROW_LAYOUT = [
  30812. { id: 'flex', text: '按权重摆放' },
  30813. { id: 'hbox', text: '按宽度摆放' },
  30814. ];
  30815. DICT_CACHE.GRID_XTYPE = [
  30816. { id: 'N/A', text: '<无>' },
  30817. { id: 'textfield', text: '文本-textfield' },
  30818. { id: 'numberfield', text: '数字框-numberfield' },
  30819. { id: 'datefield', text: '日期-datefield' },
  30820. { id: 'datetimefield', text: '日期时间-datetimefield' },
  30821. { id: 'combo', text: '下拉框-combo' },
  30822. { id: 'combogrid', text: '下拉表-combogrid' },
  30823. { id: 'checkbox', text: '勾选-checkbox' },
  30824. ];
  30825. DICT_CACHE.FORM_XTYPE = [
  30826. { id: 'N/A', text: '<无>' },
  30827. { id: 'textfield', text: '文本-textfield' },
  30828. { id: 'numberfield', text: '数字框-numberfield' },
  30829. { id: 'datefield', text: '日期-datefield' },
  30830. { id: 'datetimefield', text: '日期时间-datetimefield' },
  30831. { id: 'combo', text: '下拉框-combo' },
  30832. { id: 'combogrid', text: '下拉表-combogrid' },
  30833. { id: 'checkbox', text: '勾选-checkbox' },
  30834. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  30835. ];
  30836. DICT_CACHE.GRID_FORMATTER = [
  30837. { id: 'N/A', text: '默认' },
  30838. { id: 'rownum', text: '序号-rownum' },
  30839. { id: 'button', text: '按钮-button' },
  30840. { id: 'checkbox', text: '勾选-checkbox' },
  30841. { id: 'progres', text: '进度条-progres' },
  30842. ];
  30843. }
  30844. function initDesigner () {
  30845. Ext.define('com.yvan.studio.designer', {
  30846. extend: 'Ext.panel.Panel',
  30847. alias: 'widget.designer',
  30848. xtype: 'designer',
  30849. layout: 'fit',
  30850. items: [],
  30851. constructor: function (config) {
  30852. var self = this;
  30853. var newConfig = _$2.defaultsDeep({
  30854. // 强制性属性
  30855. }, config);
  30856. this.superclass.constructor.call(self, newConfig);
  30857. },
  30858. initComponent: function () {
  30859. var me = this;
  30860. me.on({
  30861. afterrender: function () {
  30862. }
  30863. });
  30864. this.superclass.initComponent.call(me);
  30865. }
  30866. });
  30867. }
  30868. var FixClass = /** @class */ (function () {
  30869. function FixClass() {
  30870. }
  30871. FixClass.prototype.fix = function (me, config) {
  30872. var _this = this;
  30873. if (isDesignMode(me, config)) {
  30874. return;
  30875. }
  30876. if (!config) {
  30877. return;
  30878. }
  30879. var fix = config.fix;
  30880. if (!fix) {
  30881. return;
  30882. }
  30883. delete config.fix;
  30884. // 这里有个 bug
  30885. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  30886. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  30887. var scope;
  30888. if (config.$initParent) {
  30889. // 在面板上的组件
  30890. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  30891. }
  30892. else if (config.column) {
  30893. // 在列上的组件
  30894. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  30895. }
  30896. if (_$2.isArray(fix)) {
  30897. _$2.each(fix, function (f) {
  30898. var fn = lookupFn(scope, f);
  30899. fn.call(_this, me, config);
  30900. });
  30901. }
  30902. else if (_$2.isString(fix)) {
  30903. var fn = lookupFn(scope, fix);
  30904. fn.call(this, me, config);
  30905. }
  30906. };
  30907. __decorate([
  30908. baseConfigProcess(),
  30909. __metadata("design:type", Function),
  30910. __metadata("design:paramtypes", [Object, Object]),
  30911. __metadata("design:returntype", void 0)
  30912. ], FixClass.prototype, "fix", null);
  30913. return FixClass;
  30914. }());
  30915. function init$2() {
  30916. // 引入 filters 过滤插件
  30917. Ext.require([
  30918. 'Ext.grid.filters.Filters'
  30919. ]);
  30920. // 启用 tooltip 快捷提示
  30921. Ext.QuickTips.init();
  30922. // 定义日期格式化方法
  30923. if (Ext.util && Ext.util.Format) {
  30924. Ext.apply(Ext.util.Format, {
  30925. dateFormat: 'Y-m-d'
  30926. });
  30927. }
  30928. Ext.form.field.Display.override({
  30929. cls: 'yvan-display-field',
  30930. labelAlign: 'right'
  30931. });
  30932. Ext.define("Ext.locale.zh_CN.picker.Date", {
  30933. override: "Ext.picker.Date",
  30934. format: "Y-m-d",
  30935. });
  30936. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  30937. override: "Ext.form.field.Date",
  30938. format: "Y-m-d",
  30939. });
  30940. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  30941. override: "Ext.grid.PropertyColumnModel",
  30942. format: "Y-m-d",
  30943. });
  30944. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  30945. override: "Ext.view.AbstractView",
  30946. loadingText: "读取中..."
  30947. });
  30948. Ext.LoadMask.prototype.msg = '请稍后...';
  30949. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  30950. override: "Ext.grid.header.Container",
  30951. sortClearText: '不排序',
  30952. sortAscText: "正序",
  30953. sortDescText: "倒序",
  30954. lockText: "锁定列",
  30955. unlockText: "解除锁定",
  30956. columnsText: "字段隐藏"
  30957. });
  30958. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  30959. override: "Ext.grid.filters.filter.Date",
  30960. fields: {
  30961. lt: { text: '之前' },
  30962. gt: { text: '之后' },
  30963. eq: { text: '相等' },
  30964. },
  30965. // Defaults to Ext.Date.defaultFormat
  30966. dateFormat: null
  30967. });
  30968. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  30969. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  30970. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  30971. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  30972. override: "Ext.grid.locking.Lockable",
  30973. lockText: "锁定",
  30974. unlockText: '解锁',
  30975. });
  30976. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  30977. override: "Ext.grid.filters.Filters",
  30978. menuFilterText: "过滤"
  30979. });
  30980. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  30981. override: "Ext.grid.filters.filter.Boolean",
  30982. yesText: "已钩选",
  30983. noText: "未勾选"
  30984. });
  30985. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  30986. override: "Ext.grid.filters.filter.String",
  30987. emptyText: "输入过滤文本..."
  30988. });
  30989. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  30990. override: "Ext.grid.filters.filter.Number",
  30991. emptyText: "输入数字..."
  30992. });
  30993. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  30994. override: "Ext.PagingToolbar",
  30995. beforePageText: "第",
  30996. // update
  30997. afterPageText: "/ {0} 页",
  30998. // update
  30999. firstText: "第一页",
  31000. prevText: "上一页",
  31001. // update
  31002. nextText: "下一页",
  31003. lastText: "最后页",
  31004. refreshText: "刷新",
  31005. displayMsg: "总共 {2} 条",
  31006. // update
  31007. emptyMsg: '没有数据'
  31008. });
  31009. /**
  31010. * 改变事件的获取方式.
  31011. * 具体见: ext-all-debug.js:23216 addListener
  31012. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  31013. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  31014. */
  31015. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  31016. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  31017. if (typeof fn === 'string' &&
  31018. (_$2.startsWith(fn, 'scope.') ||
  31019. _$2.startsWith(fn, 'system.') ||
  31020. _$2.startsWith(fn, 'format.'))) {
  31021. scope = lookupScope(this);
  31022. if (isDesignMode(scope, undefined)) {
  31023. fn = Ext.emptyFn;
  31024. }
  31025. else {
  31026. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  31027. // const vm = this.lookupViewModel()
  31028. // if (vm && vm.yvanScope) {
  31029. // scope = vm.yvanScope
  31030. // fn = scope[fn.substr('scope.'.length)]
  31031. // }
  31032. fn = lookupFn(scope, fn, this);
  31033. }
  31034. }
  31035. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  31036. };
  31037. // 将 SystemLib 扩展到 window.system 下
  31038. if (!window['system']) {
  31039. window['system'] = {};
  31040. }
  31041. _$2.extend(window['system'], SystemLib);
  31042. _$2.extend(window['system'], {
  31043. showGridRowDetail: showGridRowDetail
  31044. });
  31045. Ext.apply(Ext.util.Format, {
  31046. // 百分比
  31047. percentRenderer: function (v, rd, model) {
  31048. if (!v) {
  31049. v = 0;
  31050. }
  31051. if (typeof v === 'string') {
  31052. v = parseInt(v);
  31053. }
  31054. var valueString = v.toFixed(2);
  31055. var valueFixed = v > 100 ? 100 : v;
  31056. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  31057. var cls = '';
  31058. if (v < 90) {
  31059. cls = 'danger';
  31060. }
  31061. else if (v < 100) {
  31062. cls = 'warning';
  31063. }
  31064. else {
  31065. cls = 'success';
  31066. }
  31067. return Ext.String
  31068. .format(
  31069. // '<div>'
  31070. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  31071. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  31072. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  31073. // + '</div></div>', valueString, valueFixed, cls);
  31074. '<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(
  31075. // '<div>'
  31076. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  31077. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  31078. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  31079. // + '</div></div>', v, valueFixed, valueString);
  31080. },
  31081. //button
  31082. button: function (v, rd, model) {
  31083. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  31084. }
  31085. });
  31086. initComponent();
  31087. initPanel();
  31088. initGridColumn();
  31089. initTree();
  31090. initGrid();
  31091. initMainTab();
  31092. initTextfield();
  31093. initCombo();
  31094. initTag();
  31095. initContainer();
  31096. initRows();
  31097. initCols();
  31098. initForm();
  31099. initToolbar();
  31100. initSplitter();
  31101. initButton();
  31102. initStores();
  31103. initSearch();
  31104. initMultipleSearch();
  31105. initDate();
  31106. initDateTimePicker();
  31107. initDateTime();
  31108. initNumber();
  31109. initCheckbox();
  31110. initCheckboxGroup();
  31111. initRadio();
  31112. initRadioGroup();
  31113. initFieldset();
  31114. initCombotree();
  31115. initPickerPlus();
  31116. initCombogrid();
  31117. initComboGridMulti();
  31118. initIframe();
  31119. initBpmn();
  31120. initSqlEditor$1();
  31121. initJsonEditor$1();
  31122. initJsEditor$1();
  31123. initClipboard();
  31124. initSqlComplex();
  31125. initParamComplex();
  31126. initDict$1();
  31127. initDesigner();
  31128. }
  31129. /**
  31130. * 创建一个 Ajax 客户端
  31131. */
  31132. function createAjax(createOption) {
  31133. if (createOption.baseUrl) {
  31134. axios__default.defaults.baseURL = createOption.baseUrl;
  31135. axios__default.defaults.timeout = createOption.timeout;
  31136. storeAjax.timeout = createOption.timeout;
  31137. axios__default.defaults.timeoutErrorMessage = '网络超时';
  31138. }
  31139. return function (option) {
  31140. //@ts-ignore
  31141. option.method = (option.method || 'get').toLocaleLowerCase();
  31142. //@ts-ignore
  31143. var ax = __assign({}, option);
  31144. switch (option.method) {
  31145. case 'get':
  31146. ax.method = 'GET';
  31147. ax.params = option.param;
  31148. ax.headers = __assign({}, option.headers);
  31149. break;
  31150. case 'post':
  31151. ax.method = 'POST';
  31152. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  31153. ax.params = option.param;
  31154. ax.data = Qs.stringify(option.data);
  31155. break;
  31156. case 'put':
  31157. case 'patch':
  31158. case 'delete':
  31159. ax.method = option.method;
  31160. ax.headers = option.headers;
  31161. ax.params = option.param;
  31162. ax.data = Qs.stringify(option.data);
  31163. break;
  31164. case 'download':
  31165. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  31166. return new Promise(function (resolver, reject) {
  31167. });
  31168. case "invoke":
  31169. ax.url = serverInvokeUrlTransform(option.url, option);
  31170. ax.method = 'POST';
  31171. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31172. if (typeof option.args === 'object') {
  31173. ax.data = JSON.stringify({
  31174. args: option.args,
  31175. });
  31176. }
  31177. else {
  31178. ax.data = JSON.stringify({
  31179. args: [
  31180. __assign(__assign({}, option.data), option.param)
  31181. ],
  31182. filterModel: option.filterModel,
  31183. sortModel: option.sortModel
  31184. });
  31185. }
  31186. break;
  31187. case 'post-json':
  31188. ax.method = 'POST';
  31189. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31190. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  31191. break;
  31192. case 'post-file':
  31193. //TODO 刘壮. 上传文件
  31194. var forms = new FormData();
  31195. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  31196. _$2.forOwn(option.data, function (value, key) {
  31197. if (key === 'files') {
  31198. var i_1 = 0;
  31199. _$2.each(value, function (f) {
  31200. // @ts-ignore
  31201. forms.append('file' + (++i_1), f);
  31202. });
  31203. }
  31204. else {
  31205. forms.append(key, value);
  31206. }
  31207. });
  31208. ax.data = forms;
  31209. ax.method = 'POST';
  31210. break;
  31211. case "sql":
  31212. ax.url = sqlUrlTransform(option.url);
  31213. ax.method = 'POST';
  31214. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31215. ax.data = JSON.stringify({
  31216. args: [option.data],
  31217. db: option.db,
  31218. filterModel: option.filterModel,
  31219. sortModel: option.sortModel
  31220. });
  31221. break;
  31222. default:
  31223. throw new Error('not implements');
  31224. }
  31225. return new Promise(function (resolver, reject) {
  31226. axios__default(ax).then(function (resolverRaw) {
  31227. var apiResult = {
  31228. rawData: resolverRaw.data,
  31229. status: resolverRaw.status,
  31230. success: (resolverRaw.data && resolverRaw.data.success),
  31231. data: resolverRaw.data.data,
  31232. pagination: resolverRaw.data.pagination,
  31233. msg: (resolverRaw.data.msg),
  31234. errors: resolverRaw.data.errors,
  31235. headers: resolverRaw.headers
  31236. };
  31237. if (typeof window['apiTranslate'] === 'function') {
  31238. window['apiTranslate'](apiResult.rawData, option.url);
  31239. }
  31240. resolver(apiResult);
  31241. }).catch(function (reason) {
  31242. reject(reason);
  31243. });
  31244. });
  31245. };
  31246. }
  31247. function downLoad(downLoadUrl, filename, data, header, isJson) {
  31248. if (isJson === void 0) { isJson = false; }
  31249. var YvanUI = _$2.get(window, 'YvanUI');
  31250. YvanUI.loading();
  31251. var createObjectURL = function (object) {
  31252. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  31253. };
  31254. // const formData = new FormData();
  31255. // _.forOwn(data, (v, k) => {
  31256. // formData.append(k, v);
  31257. // });
  31258. var formData = '';
  31259. var xhr = new XMLHttpRequest();
  31260. xhr.open('POST', downLoadUrl);
  31261. xhr.responseType = 'blob';
  31262. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  31263. if (isJson) {
  31264. formData = data ? JSON.stringify(data) : '';
  31265. xhr.setRequestHeader('Content-Type', 'application/json');
  31266. }
  31267. else {
  31268. formData = data ? Qs.stringify(data) : '';
  31269. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  31270. }
  31271. //
  31272. if (header) {
  31273. _$2.forOwn(header, function (v, k) {
  31274. xhr.setRequestHeader(k, v);
  31275. });
  31276. }
  31277. xhr.onload = function (e) {
  31278. if (this.status === 200) {
  31279. var blob = this.response;
  31280. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  31281. navigator.msSaveBlob(blob, filename);
  31282. YvanUI.clearLoading();
  31283. }
  31284. else {
  31285. var a = document.createElement('a');
  31286. var url = createObjectURL(blob);
  31287. a.href = url;
  31288. a.download = filename;
  31289. document.append(a);
  31290. a.click();
  31291. a.remove();
  31292. window.URL.revokeObjectURL(url);
  31293. YvanUI.clearLoading();
  31294. }
  31295. }
  31296. };
  31297. xhr.send(formData);
  31298. }
  31299. function readExcel(file) {
  31300. return new Promise(function (resolve, reject) {
  31301. if (!file) {
  31302. reject("文件读取失败!!!");
  31303. return;
  31304. }
  31305. var reader = new FileReader();
  31306. reader.onload = function (e) {
  31307. if (e.target) {
  31308. var data = e.target.result;
  31309. var workbook = XLSX.read(data, { type: 'binary' });
  31310. resolve(workbook);
  31311. }
  31312. else {
  31313. reject("文件读取失败!!!");
  31314. }
  31315. };
  31316. try {
  31317. reader.readAsBinaryString(file);
  31318. }
  31319. catch (e) {
  31320. reject(e);
  31321. }
  31322. });
  31323. }
  31324. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  31325. if (dataStartRow === void 0) { dataStartRow = 2; }
  31326. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  31327. if (rowValidate === void 0) { rowValidate = undefined; }
  31328. if (otherValidate === void 0) { otherValidate = undefined; }
  31329. if (fieldValidate === void 0) { fieldValidate = undefined; }
  31330. return new Promise(function (resolve, reject) {
  31331. var promiseArr = [];
  31332. for (var i = 0; i < columnsSet.length; i++) {
  31333. var fix = columnsSet[i].fix;
  31334. if (_$2.isArray(fix) && fix.length > 0) {
  31335. var ss = fix[0].toLowerCase();
  31336. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  31337. columnsSet[i].importFormatter = function (vdata) {
  31338. // @ts-ignore
  31339. return window.moment(vdata.ov) - 0;
  31340. };
  31341. }
  31342. else {
  31343. var fn = lookupFn(topScope, fix[0]);
  31344. promiseArr.push(fn(null, columnsSet[i]));
  31345. delete columnsSet[i].fix;
  31346. }
  31347. }
  31348. else if (_$2.isString(fix)) {
  31349. var ss = fix.toLowerCase();
  31350. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  31351. columnsSet[i].importFormatter = function (vdata) {
  31352. // @ts-ignore
  31353. return window.moment(vdata.ov) - 0;
  31354. };
  31355. }
  31356. else {
  31357. var fn = lookupFn(topScope, fix);
  31358. promiseArr.push(fn(null, columnsSet[i]));
  31359. delete columnsSet[i].fix;
  31360. }
  31361. }
  31362. }
  31363. var read = function () {
  31364. readExcel(file).then(function (workbook) {
  31365. var sheetNames = workbook.SheetNames; // 工作表名称集合
  31366. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  31367. var titleRowValue = [];
  31368. var titleRowKey = [];
  31369. var needLoop = false; // 是否需要迭代
  31370. var columns = [];
  31371. if (worksheet && worksheet["!ref"]) {
  31372. var t = worksheet["!ref"];
  31373. var tempArr = t.split(':');
  31374. if (tempArr.length >= 2) {
  31375. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  31376. // 选取title的行,删除之前的行
  31377. if (titleRowNumber > firstRowNumber) {
  31378. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  31379. for (var key in worksheet) {
  31380. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  31381. delete worksheet[key];
  31382. }
  31383. }
  31384. }
  31385. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  31386. firstRowNumber = titleRowNumber + '';
  31387. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  31388. }
  31389. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  31390. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  31391. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  31392. for (var key in worksheet) {
  31393. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  31394. titleRowKey.push(key);
  31395. titleRowValue.push(worksheet[key].v);
  31396. }
  31397. }
  31398. if (columnsSet && columnsSet.length > 0) {
  31399. var length = columnsSet.length;
  31400. length = length <= titleRowKey.length ? length : titleRowKey.length;
  31401. for (var i = 0; i < length; i++) {
  31402. var vk = titleRowKey[i];
  31403. var item = columnsSet[i];
  31404. var column = {};
  31405. if (typeof item === 'string') {
  31406. column.dataIndex = item;
  31407. column.header = worksheet[vk].v;
  31408. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  31409. }
  31410. else if (typeof item.dataIndex === "string") {
  31411. column.dataIndex = item.dataIndex;
  31412. column.header = worksheet[vk].v;
  31413. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  31414. if (typeof item.validate === "function") {
  31415. column.validate = item.validate;
  31416. needLoop = true;
  31417. }
  31418. if (typeof item.importFormatter === "function") {
  31419. column.importFormatter = item.importFormatter;
  31420. needLoop = true;
  31421. }
  31422. if ((item.data instanceof Array && item.data.length > 0)
  31423. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  31424. column.data = item.data;
  31425. needLoop = true;
  31426. }
  31427. }
  31428. columns.push(column);
  31429. }
  31430. }
  31431. }
  31432. }
  31433. if (fieldValidate && typeof fieldValidate === "function") {
  31434. if (fieldValidate(columns, titleRowValue) !== true) {
  31435. reject("fields validate error");
  31436. return;
  31437. }
  31438. }
  31439. var allData = XLSX.utils.sheet_to_json(worksheet);
  31440. var okData = [], errorData = [], errorMsgData = [];
  31441. var needItemLoop = needLoop;
  31442. if (rowValidate && typeof rowValidate === "function") {
  31443. needLoop = true;
  31444. }
  31445. if (needLoop === true) {
  31446. for (var index = 0; index < allData.length; index++) {
  31447. var row = allData[index];
  31448. var rowNumber = dataStartRow + index;
  31449. row.__importID__ = rowNumber;
  31450. var isRowOk = true;
  31451. if (needItemLoop) {
  31452. var _loop_1 = function (num) {
  31453. var column = columns[num];
  31454. var ov = row[column.dataIndex];
  31455. var nv = ov;
  31456. var hasError = false;
  31457. var rowNumber_1 = dataStartRow + index;
  31458. var ei = {
  31459. errorId: rowNumber_1 + '_' + column.dataIndex,
  31460. importID: rowNumber_1,
  31461. dataIndex: column.dataIndex,
  31462. header: column.header,
  31463. value: ov,
  31464. errormessage: ""
  31465. };
  31466. // 格式化
  31467. if (column.data instanceof Array) {
  31468. nv = undefined;
  31469. ei.errormessage = "字典匹配失败";
  31470. _$2.forEach(column.data, function (v, index) {
  31471. if (v.text === ov) {
  31472. nv = v.id;
  31473. return;
  31474. }
  31475. });
  31476. }
  31477. else if (_$2.isPlainObject(column.data)) {
  31478. nv = undefined;
  31479. ei.errormessage = "字典匹配失败";
  31480. _$2.forEach(column.data, function (value, key) {
  31481. if (value === ov) {
  31482. nv = key;
  31483. return;
  31484. }
  31485. });
  31486. }
  31487. if (typeof column.importFormatter === 'function') {
  31488. var vdata = {
  31489. column: column,
  31490. ov: ov,
  31491. nv: nv,
  31492. rowIndex: index,
  31493. data: row,
  31494. rowDatas: allData
  31495. };
  31496. nv = undefined;
  31497. ei.errormessage = "格式化失败";
  31498. nv = column.importFormatter(vdata);
  31499. }
  31500. if (!nv && nv != 0) {
  31501. hasError = true;
  31502. }
  31503. else {
  31504. row[column.dataIndex] = nv;
  31505. ei.errormessage = "";
  31506. }
  31507. // 校验
  31508. if (typeof column.validate === 'function') {
  31509. var vdata = {
  31510. column: column,
  31511. ov: ov,
  31512. nv: nv,
  31513. rowIndex: index,
  31514. data: row,
  31515. rowDatas: allData
  31516. };
  31517. var errormessage = column.validate(vdata);
  31518. if (errormessage === true) ;
  31519. else {
  31520. hasError = true;
  31521. ei.errormessage = ei.errormessage + "/" + errormessage;
  31522. }
  31523. }
  31524. if (hasError === true) {
  31525. isRowOk = false;
  31526. errorMsgData.push(ei);
  31527. }
  31528. };
  31529. for (var num = 0; num < columns.length; num++) {
  31530. _loop_1(num);
  31531. }
  31532. }
  31533. if (rowValidate && typeof rowValidate === "function") {
  31534. var errormessage = rowValidate({
  31535. columns: columns,
  31536. data: row,
  31537. rowIndex: index,
  31538. rowDatas: allData
  31539. });
  31540. if (errormessage === true) ;
  31541. else {
  31542. isRowOk = false;
  31543. var ei = {
  31544. errorId: rowNumber + '',
  31545. dataIndex: "row",
  31546. header: "数据行",
  31547. value: "当前行的数据",
  31548. importID: rowNumber,
  31549. errormessage: errormessage
  31550. };
  31551. errorMsgData.push(ei);
  31552. }
  31553. }
  31554. row.__hasError__ = !isRowOk;
  31555. if (isRowOk === true) {
  31556. okData.push(row);
  31557. }
  31558. else {
  31559. errorData.push(row);
  31560. }
  31561. }
  31562. }
  31563. else {
  31564. // 添加数据的唯一标识
  31565. for (var index = 0; index < allData.length; index++) {
  31566. var row = allData[index];
  31567. var rowNumber = dataStartRow + index;
  31568. row.__importID__ = rowNumber;
  31569. row.__hasError__ = false;
  31570. }
  31571. okData = allData;
  31572. }
  31573. if (otherValidate && typeof otherValidate === "function") {
  31574. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  31575. }
  31576. else {
  31577. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  31578. }
  31579. // clearLoading()
  31580. }).catch(function (e) {
  31581. reject(e);
  31582. });
  31583. };
  31584. if (promiseArr.length > 0) {
  31585. Promise.all(promiseArr).then(function (resArr) {
  31586. for (var i = 0; i < resArr.length; i++) {
  31587. var tmp = resArr[i];
  31588. tmp.config.data = [];
  31589. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  31590. if (tmp.r.field.length > 1) {
  31591. var keyKey = tmp.r.field[0];
  31592. var valueKey = tmp.r.field[1];
  31593. for (var j = 0; j < tmp.r.data.length; j++) {
  31594. var it = tmp.r.data[j];
  31595. var newIt = {};
  31596. newIt.id = it[keyKey];
  31597. newIt.text = it[valueKey];
  31598. tmp.config.data.push(newIt);
  31599. }
  31600. }
  31601. }
  31602. }
  31603. read();
  31604. });
  31605. }
  31606. else {
  31607. setTimeout(read, 50);
  31608. }
  31609. });
  31610. }
  31611. var ExcelImportDialog = /** @class */ (function (_super) {
  31612. __extends(ExcelImportDialog, _super);
  31613. function ExcelImportDialog(option) {
  31614. var _this = this;
  31615. var vjson = vjsonFunc(option);
  31616. _this = _super.call(this, { model: model$p, vjson: vjson }) || this;
  31617. _this.importExcelOption = option;
  31618. return _this;
  31619. }
  31620. ExcelImportDialog.prototype.onLoad = function () {
  31621. _super.prototype.onLoad.call(this);
  31622. };
  31623. ExcelImportDialog.prototype.fileChange = function (sender) {
  31624. var _this = this;
  31625. var file = sender.fileInputEl.dom.files[0];
  31626. // const senderScope = lookupScope(sender)
  31627. var topScope = this.topScope;
  31628. var rowValidate = this.importExcelOption.rowValidate;
  31629. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  31630. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  31631. }
  31632. var afterClientValidate = this.importExcelOption.afterClientValidate;
  31633. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  31634. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  31635. }
  31636. var fieldValidate = this.importExcelOption.fieldValidate;
  31637. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  31638. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  31639. }
  31640. this.setLoading(true);
  31641. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  31642. _this.importData = res;
  31643. _this.refs.dataGrid.setData(res.allData);
  31644. _this.viewModel.set("dataCount", res.allData.length);
  31645. _this.refs.errGrid.setData(res.errorMsgData);
  31646. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  31647. }).catch(function (e) {
  31648. _this.importData = null;
  31649. _this.refs.dataGrid.setData();
  31650. _this.refs.errGrid.setData();
  31651. msg(e.toString());
  31652. }).finally(function () {
  31653. _this.setLoading(false);
  31654. });
  31655. };
  31656. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  31657. if (record.get('__hasError__')) {
  31658. return "x-grid-record-bg-red";
  31659. }
  31660. };
  31661. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  31662. return "x-grid-record-bg-red";
  31663. };
  31664. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  31665. var _a;
  31666. var id = record.data.__importID__;
  31667. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  31668. var selectRecord = null;
  31669. var dataIndex = -1;
  31670. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  31671. for (var i = 0; i < rows.length; i++) {
  31672. if (rows[i].importID === id) {
  31673. selectRecord = this.refs.errGrid.getStore().getAt(i);
  31674. dataIndex = i;
  31675. }
  31676. if (rows[i].errorId === id + "_" + subId) {
  31677. selectRecord = this.refs.errGrid.getStore().getAt(i);
  31678. dataIndex = i;
  31679. break;
  31680. }
  31681. }
  31682. if (selectRecord) {
  31683. this.refs.errGrid.ensureVisible(selectRecord);
  31684. this.refs.errGrid.selModel.select(dataIndex);
  31685. // this.refs.errGrid.reload()
  31686. }
  31687. };
  31688. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  31689. var _a;
  31690. var id = record.data.importID;
  31691. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  31692. var selectRecord = null;
  31693. var dataIndex = -1;
  31694. for (var i = 0; i < rows.length; i++) {
  31695. if (rows[i].__importID__ === id) {
  31696. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  31697. dataIndex = i;
  31698. break;
  31699. }
  31700. }
  31701. if (selectRecord) {
  31702. this.refs.dataGrid.ensureVisible(selectRecord);
  31703. this.refs.dataGrid.selModel.select(dataIndex);
  31704. // this.refs.dataGrid.reload()
  31705. }
  31706. };
  31707. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  31708. this.viewModel.set("dataType", newValue);
  31709. if (this.importData) {
  31710. this.refs.dataGrid.setData(this.importData[newValue]);
  31711. this.viewModel.set("dataCount", this.importData[newValue].length);
  31712. }
  31713. };
  31714. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  31715. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  31716. window.location.href = this.importExcelOption.dowLoadUrl;
  31717. return;
  31718. }
  31719. var xt = [];
  31720. _$2.forEach(this.importExcelOption.columns, function (v) {
  31721. xt.push(v.header);
  31722. });
  31723. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  31724. if (filename.endsWith(".xlsx")) {
  31725. filename = filename.split(".xlsx")[0];
  31726. }
  31727. filename = filename + ".xlsx";
  31728. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  31729. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  31730. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  31731. XLSX.writeFile(wb, filename); //导出Excel
  31732. };
  31733. ExcelImportDialog.prototype.getData = function (sender) {
  31734. _$2.each(this.importData.okData, function (item) {
  31735. delete item.id;
  31736. delete item.__hasError__;
  31737. delete item.__importID__;
  31738. delete item._origin;
  31739. });
  31740. _$2.each(this.importData.allData, function (item) {
  31741. delete item.id;
  31742. delete item.__hasError__;
  31743. delete item.__importID__;
  31744. delete item._origin;
  31745. });
  31746. _$2.each(this.importData.errorData, function (item) {
  31747. delete item.id;
  31748. delete item.__hasError__;
  31749. delete item.__importID__;
  31750. delete item._origin;
  31751. });
  31752. this.dialogSuccess(this.importData);
  31753. };
  31754. return ExcelImportDialog;
  31755. }(Scope));
  31756. var model$p = {
  31757. data: {
  31758. dataType: "all",
  31759. errMsgCount: 0,
  31760. dataCount: 0
  31761. }
  31762. };
  31763. var vjsonFunc = function (option) {
  31764. return {
  31765. title: option.title || 'excel导入',
  31766. layout: 'fit',
  31767. items: [
  31768. {
  31769. layout: 'border',
  31770. tbar: {
  31771. xtype: "form",
  31772. items: [
  31773. {
  31774. xtype: "cols",
  31775. items: [
  31776. {
  31777. xtype: "filefield",
  31778. fieldLabel: 'excel文件',
  31779. buttonText: '请选择excel文件',
  31780. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  31781. flex: 3,
  31782. listeners: {
  31783. change: "scope.fileChange"
  31784. }
  31785. }, {
  31786. xtype: "button",
  31787. iconCls: "x-fa fa-download",
  31788. text: "下载模版",
  31789. listeners: {
  31790. click: "scope.downloadTemplate"
  31791. }
  31792. }, {
  31793. xtype: 'container',
  31794. border: false,
  31795. layout: 'hbox',
  31796. }, {
  31797. xtype: "button",
  31798. iconCls: "x-fa fa-upload",
  31799. text: option.tQButtonText || "提取数据",
  31800. listeners: {
  31801. click: "scope.getData"
  31802. }
  31803. }
  31804. ]
  31805. },
  31806. ]
  31807. },
  31808. items: [
  31809. {
  31810. tbar: {
  31811. xtype: "toolbar",
  31812. title: "导入的数据",
  31813. items: [{
  31814. xtype: 'label',
  31815. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  31816. }, {
  31817. xtype: 'radiogroup',
  31818. items: [
  31819. {
  31820. boxLabel: '所有数据',
  31821. checked: true,
  31822. inputValue: 'allData',
  31823. }, {
  31824. boxLabel: '正确数据',
  31825. inputValue: 'okData',
  31826. }, {
  31827. boxLabel: '错误数据',
  31828. inputValue: 'errorData',
  31829. }
  31830. ],
  31831. listeners: {
  31832. change: 'scope.filterData',
  31833. },
  31834. }, {
  31835. xtype: "textfield",
  31836. readOnly: true,
  31837. fieldLabel: "条目数",
  31838. bind: "{dataCount}"
  31839. }]
  31840. },
  31841. xtype: 'yvgrid',
  31842. reference: 'dataGrid',
  31843. layout: 'fit',
  31844. pagination: false,
  31845. // pageSize: 50,
  31846. getRowClass: 'scope.getDataGridRowRecord',
  31847. columns: option.columns,
  31848. region: 'center',
  31849. split: true,
  31850. listeners: {
  31851. cellclick: "scope.dataGridClick",
  31852. },
  31853. selModel: {
  31854. // type: 'rowmodel',
  31855. mode: 'SINGLE',
  31856. },
  31857. }, {
  31858. tbar: {
  31859. xtype: "toolbar", items: [
  31860. {
  31861. xtype: 'label',
  31862. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  31863. }, {
  31864. xtype: "textfield",
  31865. readOnly: true,
  31866. fieldLabel: "条目数",
  31867. bind: "{errMsgCount}"
  31868. }
  31869. ]
  31870. },
  31871. xtype: 'yvgrid',
  31872. reference: 'errGrid',
  31873. layout: 'fit',
  31874. pagination: false,
  31875. getRowClass: 'scope.getErrGridRowRecord',
  31876. height: "40%",
  31877. columns: [
  31878. { dataIndex: "errorId", header: "ID", hidden: true },
  31879. { dataIndex: "importID", header: "行号", width: 80 },
  31880. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  31881. { dataIndex: "value", header: "值", width: 120 },
  31882. { dataIndex: "header", header: "字段名", width: 120 },
  31883. { dataIndex: "dataIndex", header: "字段", width: 120 }
  31884. ],
  31885. region: 'south',
  31886. split: true,
  31887. listeners: {
  31888. itemclick: "scope.errGridClick"
  31889. },
  31890. selModel: {
  31891. // type: 'rowmodel',
  31892. mode: 'SINGLE',
  31893. },
  31894. },
  31895. ],
  31896. },
  31897. ],
  31898. referenceHolder: true,
  31899. };
  31900. };
  31901. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  31902. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  31903. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  31904. ret.report_id = reportId;
  31905. ret.report = report;
  31906. return ret;
  31907. }
  31908. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  31909. var e_1, _a, e_2, _b;
  31910. var model = {
  31911. data: {
  31912. report_name: config.report_name,
  31913. query: {},
  31914. sum: {},
  31915. }
  31916. };
  31917. var json5 = window['YvanUI'].json5;
  31918. var report = config.report ? json5.parse(config.report) : {};
  31919. var conditionRows = [];
  31920. var sumRows = [];
  31921. model.data.has_sum = _$2.size(report.summary) > 0;
  31922. // query 查询条件
  31923. var newRow = false;
  31924. var currentRow = { xtype: 'cols', items: [], };
  31925. conditionRows.push(currentRow);
  31926. _$2.forEach(report.query, function (item) {
  31927. if (newRow) {
  31928. currentRow = { xtype: 'cols', items: [], };
  31929. conditionRows.push(currentRow);
  31930. }
  31931. var vj = json5.parse(item.conditionFieldExtend);
  31932. if (item.conditionFieldXtype) {
  31933. vj.xtype = item.conditionFieldXtype;
  31934. if (item.conditionFieldXtype === 'combo') {
  31935. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  31936. }
  31937. if (item.conditionFieldXtype === 'datetimefield') {
  31938. //@ts-ignore
  31939. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  31940. }
  31941. else if (item.conditionFieldXtype === 'datefield') {
  31942. //@ts-ignore
  31943. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  31944. }
  31945. else {
  31946. model.data.query[item.conditionFieldBind] = '';
  31947. }
  31948. }
  31949. else {
  31950. // 没有组件类型,是个空占位符
  31951. vj.border = false;
  31952. }
  31953. if (item.conditionFieldBind) {
  31954. vj.bind = {
  31955. value: '{query.' + item.conditionFieldBind + '}'
  31956. };
  31957. }
  31958. if (item.conditionFieldFlex) {
  31959. vj.flex = item.conditionFieldFlex;
  31960. }
  31961. if (item.conditionFieldXtype) {
  31962. vj.fieldLabel = item.conditionFieldLabel;
  31963. }
  31964. if (item.fieldLabel) {
  31965. vj.fieldLabel = item.fieldLabel;
  31966. }
  31967. newRow = item.conditionFieldWrap || false;
  31968. currentRow.items.push(vj);
  31969. });
  31970. if (currentRow) {
  31971. currentRow.margin = '10 0 10 0';
  31972. }
  31973. // sum 汇总条件
  31974. newRow = true;
  31975. try {
  31976. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  31977. var item = _d.value;
  31978. if (newRow) {
  31979. currentRow = {
  31980. xtype: 'cols',
  31981. defaultType: 'displayfield',
  31982. defaults: {
  31983. labelWidth: 70,
  31984. },
  31985. items: []
  31986. };
  31987. sumRows.push(currentRow);
  31988. }
  31989. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  31990. if (item.sumFieldBind) {
  31991. vj.bind = '{sum.' + item.sumFieldBind + '}';
  31992. model.data.sum[item.sumFieldBind] = '';
  31993. }
  31994. else {
  31995. // 没有组件类型,是个空占位符
  31996. vj.border = false;
  31997. }
  31998. if (item.sumFieldFlex) {
  31999. vj.flex = item.sumFieldFlex;
  32000. }
  32001. if (item.sumFieldLabel) {
  32002. vj.fieldLabel = item.sumFieldLabel;
  32003. }
  32004. // sumFieldBind: "zs"
  32005. // sumFieldExtend: "{}"
  32006. // sumFieldFlex: 1
  32007. // sumFieldLabel: "总数"
  32008. // sumFieldWrap: false
  32009. newRow = item.sumFieldWrap || false;
  32010. currentRow.items.push(vj);
  32011. }
  32012. }
  32013. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  32014. finally {
  32015. try {
  32016. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  32017. }
  32018. finally { if (e_1) throw e_1.error; }
  32019. }
  32020. if (currentRow) {
  32021. currentRow.margin = '10 0 10 0';
  32022. }
  32023. // column 结果字段
  32024. var columns = [];
  32025. try {
  32026. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  32027. var item = _f.value;
  32028. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  32029. if (item.xtype) {
  32030. if (item.xtype == 'checkbox') {
  32031. vj.xtype = 'checkcolumn';
  32032. vj.disabled = true;
  32033. }
  32034. else {
  32035. vj.xtype = item.xtype;
  32036. }
  32037. }
  32038. if (item.dataType) {
  32039. vj.dataType = item.dataType;
  32040. }
  32041. if (item.align) {
  32042. vj.align = item.align;
  32043. }
  32044. if (item.width) {
  32045. vj.width = item.width;
  32046. }
  32047. if (item.dict) {
  32048. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  32049. }
  32050. columns.push(vj);
  32051. }
  32052. }
  32053. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  32054. finally {
  32055. try {
  32056. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  32057. }
  32058. finally { if (e_2) throw e_2.error; }
  32059. }
  32060. var vjson = {
  32061. bind: {
  32062. title: '{report_name}',
  32063. },
  32064. layout: 'fit',
  32065. referenceHolder: true,
  32066. items: [
  32067. {
  32068. layout: 'border',
  32069. border: false,
  32070. items: [
  32071. {
  32072. region: 'north',
  32073. border: false,
  32074. tbar: {
  32075. xtype: 'toolbar',
  32076. border: false,
  32077. items: [
  32078. {
  32079. xtype: 'button',
  32080. text: '查询',
  32081. reference: 'btnSearch',
  32082. iconCls: 'x-fa fa-search',
  32083. listeners: {
  32084. click: 'scope.reload',
  32085. },
  32086. },
  32087. {
  32088. xtype: 'button',
  32089. text: '关闭',
  32090. iconCls: 'x-fa fa-times',
  32091. listeners: {
  32092. click: 'system.closeMe()',
  32093. },
  32094. },
  32095. ],
  32096. },
  32097. defaults: {
  32098. margin: '8 0 0 0'
  32099. },
  32100. items: __spread(conditionRows, sumRows),
  32101. fix: ['system.enterToClick("btnSearch")'],
  32102. },
  32103. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  32104. method: 'invoke',
  32105. url: '/report/Report@execute',
  32106. params: {
  32107. dataSource: report.dataSource,
  32108. pagination: report.grid.pagination || true,
  32109. report_id: config.report_id,
  32110. query: '{query}',
  32111. },
  32112. }, columns: columns }, report.grid),
  32113. ],
  32114. },
  32115. ],
  32116. };
  32117. return { model: model, vjson: vjson, report: report };
  32118. }
  32119. var ReportScope = /** @class */ (function (_super) {
  32120. __extends(ReportScope, _super);
  32121. function ReportScope(_a, invokeServerFn) {
  32122. var model = _a.model, vjson = _a.vjson;
  32123. var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this;
  32124. _this.invokeServerFn = invokeServerFn;
  32125. return _this;
  32126. }
  32127. ReportScope.prototype.onLoad = function () {
  32128. // this.reload()
  32129. };
  32130. ReportScope.prototype.reload = function () {
  32131. var _this = this;
  32132. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  32133. if (this.viewModel.get('has_sum')) {
  32134. this.invokeServerFn('/report/Report@executeSum', {
  32135. dataSource: this.report.dataSource,
  32136. report_id: this.report_id,
  32137. query: this.viewModel.get('query'),
  32138. }).then(function (res) {
  32139. if (!res.success) {
  32140. showErrorDialog$1(res.msg);
  32141. }
  32142. else {
  32143. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  32144. }
  32145. });
  32146. }
  32147. this.refs.grid1.reload();
  32148. };
  32149. return ReportScope;
  32150. }(Scope));
  32151. var studio = {
  32152. init: init$1,
  32153. handles: handles$1,
  32154. Workbench: Workbench
  32155. };
  32156. exports.axios = axios;
  32157. exports.qs = Qs;
  32158. exports.lodash = _$2;
  32159. exports.jquery = $$2;
  32160. exports.moment = moment$1;
  32161. exports.recast = recast;
  32162. exports.XLSX = XLSX;
  32163. exports.echarts = echarts;
  32164. exports.Defaults = Defaults;
  32165. exports.ExcelImportDialog = ExcelImportDialog;
  32166. exports.Lib = Lib;
  32167. exports.LibParam = LibParam;
  32168. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32169. exports.ReportScope = ReportScope;
  32170. exports.SIMPLE_RE = SIMPLE_RE;
  32171. exports.Scope = Scope;
  32172. exports.ScopeEngine = ScopeEngine;
  32173. exports.SystemEventFu = SystemEventFu;
  32174. exports.ajax = ajax;
  32175. exports.baseConfigProcess = baseConfigProcess;
  32176. exports.baseConfigProcessList = baseConfigProcessList;
  32177. exports.buildPlus = buildPlus;
  32178. exports.buildReportScope = buildReportScope;
  32179. exports.calcExpress = calcExpress;
  32180. exports.calcObject = calcObject;
  32181. exports.calcObjectFlat = calcObjectFlat;
  32182. exports.clearViewModel = clearViewModel;
  32183. exports.clearViewModelByLookup = clearViewModelByLookup;
  32184. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32185. exports.clearViewModelValues = clearViewModelValues;
  32186. exports.commitMe = commitMe;
  32187. exports.confirm = confirm;
  32188. exports.createAjax = createAjax;
  32189. exports.createUUID = createUUID;
  32190. exports.deepTravJson = deepTravJson;
  32191. exports.downLoad = downLoad;
  32192. exports.evalFunction = evalFunction;
  32193. exports.extend = extend;
  32194. exports.flatRow = flatRow;
  32195. exports.getApiConvert = getApiConvert;
  32196. exports.getGridEditRows = getGridEditRows;
  32197. exports.getParentGrid = getParentGrid;
  32198. exports.getPinyin = getPinyin;
  32199. exports.getRegList = getRegList;
  32200. exports.getRegParamList = getRegParamList;
  32201. exports.getScopeOnCreate = getScopeOnCreate;
  32202. exports.init = init$2;
  32203. exports.insertGridRow = insertGridRow;
  32204. exports.invokeServer = invokeServer$1;
  32205. exports.isDesignMode = isDesignMode;
  32206. exports.isEmpty = isEmpty;
  32207. exports.json5 = dist;
  32208. exports.keywordFilter = keywordFilter;
  32209. exports.lookupFn = lookupFn;
  32210. exports.lookupScope = lookupScope;
  32211. exports.mergeViewModel = mergeViewModel;
  32212. exports.moveDownGridRow = moveDownGridRow;
  32213. exports.moveUpGridRow = moveUpGridRow;
  32214. exports.msg = msg$1;
  32215. exports.msgError = msgError;
  32216. exports.normId = normId;
  32217. exports.pinyinMatch = pinyinMatch;
  32218. exports.prompt = prompt$2;
  32219. exports.raiseClick = raiseClick;
  32220. exports.reloadGrid = reloadGrid;
  32221. exports.removeGridRow = removeGridRow;
  32222. exports.replaceNA = replaceNA;
  32223. exports.saveGridRow = saveGridRow;
  32224. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32225. exports.setComboStore = setComboStore;
  32226. exports.showErrorDialog = showErrorDialog$1;
  32227. exports.showInfoDialog = showInfoDialog;
  32228. exports.showWidget = showWidget;
  32229. exports.sqlUrlTransform = sqlUrlTransform;
  32230. exports.stopEvent = stopEvent;
  32231. exports.studio = studio;
  32232. exports.toPlainObject = toPlainObject;
  32233. exports.toString = toString;
  32234. exports.tryEnable = tryEnable;
  32235. exports.tryVarSimple = tryVarSimple;
  32236. exports.tryWriteByExpress = tryWriteByExpress;
  32237. exports.tryWriteObject = tryWriteObject;
  32238. exports.watch = watch;
  32239. Object.defineProperty(exports, '__esModule', { value: true });
  32240. });
  32241. //# sourceMappingURL=yvan-ext.js.map