yvan-ext.js 1.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756
  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") {
  22385. count++;
  22386. }
  22387. else if (value[i] === ".") {
  22388. count++;
  22389. break;
  22390. }
  22391. else {
  22392. break;
  22393. }
  22394. }
  22395. obj[idx] = value.substr(0, value.length - count);
  22396. }
  22397. else {
  22398. replaceNA(value);
  22399. }
  22400. }
  22401. });
  22402. }
  22403. else if (_$2.isPlainObject(obj)) {
  22404. _$2.forOwn(obj, function (value, key) {
  22405. if (value === 'N/A') {
  22406. obj[key] = '';
  22407. }
  22408. else {
  22409. if (typeof value === "string" && /^-?\d*\.\d+$/.test(value)) {
  22410. var count = 0;
  22411. for (var i = value.length - 1; i > 0; i--) {
  22412. if (value[i] === "0") {
  22413. count++;
  22414. }
  22415. else if (value[i] === ".") {
  22416. count++;
  22417. break;
  22418. }
  22419. else {
  22420. break;
  22421. }
  22422. }
  22423. obj[key] = value.substr(0, value.length - count);
  22424. }
  22425. else {
  22426. replaceNA(value);
  22427. }
  22428. }
  22429. });
  22430. }
  22431. }
  22432. function deepTravJson(obj, resolver) {
  22433. if (_$2.isArray(obj)) {
  22434. _$2.forEach(obj, function (value, idx) {
  22435. if (typeof value === 'string') {
  22436. resolver(obj, value, idx);
  22437. }
  22438. else {
  22439. deepTravJson(value, resolver);
  22440. }
  22441. });
  22442. }
  22443. else if (_$2.isPlainObject(obj)) {
  22444. _$2.forOwn(obj, function (value, key) {
  22445. if (typeof value === 'string') {
  22446. resolver(obj, value, key);
  22447. }
  22448. else {
  22449. deepTravJson(value, resolver);
  22450. }
  22451. });
  22452. }
  22453. }
  22454. /**
  22455. * 根据表达式进入写值
  22456. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  22457. * express="test-{query.a}" 写值就会失败
  22458. *
  22459. * @example
  22460. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  22461. * 写值成功
  22462. *
  22463. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  22464. * 写值失败
  22465. *
  22466. * @param viewModel VM对象
  22467. * @param express 表达式对象
  22468. * @param value 目标值
  22469. */
  22470. function tryWriteByExpress(viewModel, express, value) {
  22471. if (SIMPLE_RE.test(express)) {
  22472. // '{foo}' 简单表达式
  22473. express = express.substring(1, express.length - 1);
  22474. viewModel.set(express, value);
  22475. }
  22476. }
  22477. /**
  22478. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  22479. * @example
  22480. * 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]})
  22481. *
  22482. * expressObject:
  22483. * {
  22484. * a: '{query.a}',
  22485. * b: {
  22486. * b1: '{query.b1}',
  22487. * b2: '{query.b2}',
  22488. * },
  22489. * c: 'aa',
  22490. * d: [
  22491. * '{query.a}',
  22492. * '{query.b2}'
  22493. * ]
  22494. * }
  22495. *
  22496. * valueObject:
  22497. * {
  22498. * a: 'aValue',
  22499. * b: {
  22500. * b1: 'b1Value',
  22501. * b2: 'b2Value'
  22502. * },
  22503. * c: 'aa'
  22504. * c: [
  22505. * 'aValue',
  22506. * 'b2Value'
  22507. * ]
  22508. * }
  22509. *
  22510. * 系统会尝试回写
  22511. * viewModel.set('query.a', 'aValue')
  22512. * viewModel.set('query.b1', 'b1Value')
  22513. * viewModel.set('query.b2', 'b2Value')
  22514. *
  22515. * @param expressObject 含表达式的对象
  22516. * @param valueObject 表达式计算完成之后的结果对象
  22517. * @param writeFn 写入的方法 (path, value)=>void
  22518. */
  22519. function tryWriteObject(expressObject, valueObject, writeFn) {
  22520. var trav = function (pathPrefix) {
  22521. var parent = expressObject;
  22522. if (_$2.size(pathPrefix) > 1) {
  22523. parent = _$2.get(parent, pathPrefix.substring(1));
  22524. }
  22525. _$2.forOwn(parent, function (value, key) {
  22526. if (_$2.isPlainObject(value)) {
  22527. // 深度递归,对子对象进行求解
  22528. trav(pathPrefix + "." + key);
  22529. }
  22530. else if (_$2.isString(value)) {
  22531. // 字符串直接用 calcExpress 表达式求解
  22532. if (SIMPLE_RE.test(value)) {
  22533. // If we have '{foo}' alone it is a literal 简单表达式
  22534. var targetPath = value.substring(1, value.length - 1);
  22535. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  22536. if (!writeFn) {
  22537. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  22538. }
  22539. else {
  22540. writeFn(targetPath, targetValue);
  22541. }
  22542. }
  22543. }
  22544. else if (_$2.isArray(value)) {
  22545. _$2.each(value, function (v, idx) {
  22546. if (SIMPLE_RE.test(v)) {
  22547. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  22548. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  22549. if (!writeFn) {
  22550. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  22551. }
  22552. else {
  22553. writeFn(targetPath, targetValue);
  22554. }
  22555. }
  22556. });
  22557. }
  22558. });
  22559. };
  22560. trav("");
  22561. }
  22562. /**
  22563. * 尝试去掉变量两边括号
  22564. * {a} => a
  22565. * a => a
  22566. */
  22567. function tryVarSimple(value) {
  22568. if (SIMPLE_RE.test(value)) {
  22569. // If we have '{foo}' alone it is a literal 简单表达式
  22570. return value.substring(1, value.length - 1);
  22571. }
  22572. return value;
  22573. }
  22574. /**
  22575. * 对多个表达式进行求值. 异步回调的方式返回
  22576. * {
  22577. * a: 1,
  22578. * b: '{someBind}',
  22579. * c: ['a', 'b', 'c'],
  22580. * d: ['a', 'b', '{someBind}'],
  22581. * e: {
  22582. * y: 1,
  22583. * z: 2
  22584. * },
  22585. * f: {
  22586. * y: 1,
  22587. * z: '{someBind}'
  22588. * }
  22589. * }
  22590. *
  22591. * // Will produce
  22592. * {
  22593. * b: value,
  22594. * d: ['a', 'b', value],
  22595. * f: {
  22596. * y: 1,
  22597. * z: value
  22598. * }
  22599. * }
  22600. * @param viewModel scope.viewModel对象
  22601. * @param paramObject 求值对象
  22602. */
  22603. function calcObject(viewModel, paramObject) {
  22604. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  22605. return new Promise(function (resolve) {
  22606. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  22607. schedule.destroy();
  22608. // 从 Ext.data.Model 对象转换为 js-object 对象
  22609. ret = toPlainObject(ret);
  22610. resolve(ret);
  22611. }, viewModel, { single: true });
  22612. });
  22613. }
  22614. /**
  22615. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  22616. * @param config 组件构造函数传入的 config 配置文件
  22617. */
  22618. function getParentGrid(config) {
  22619. var _a;
  22620. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  22621. }
  22622. /**
  22623. * 解析
  22624. * {
  22625. * condition: "{skuId}",
  22626. * errorMsg: "无法编辑",
  22627. * notice: 'msg'
  22628. * }
  22629. */
  22630. function tryEnable(data, enableSetting) {
  22631. if (!enableSetting) {
  22632. // 没有这一段配置,可以编辑
  22633. return true;
  22634. }
  22635. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  22636. if (!evalFunction(data, condition)) {
  22637. // 没有达成 condition 条件
  22638. // 计算 msg 消息内容
  22639. var msgContent = calcExpress(data, errorMsg);
  22640. if (msgContent) {
  22641. if (!notice || notice === 'msg') {
  22642. // 进行提示
  22643. msg$1(msgContent);
  22644. }
  22645. }
  22646. return false;
  22647. }
  22648. return true;
  22649. }
  22650. /**
  22651. * 动态的为 combo 或 columns.combo 设置下拉框的值
  22652. * @param sender 目标对象
  22653. * @param config 目标对象的配置(在构造函数之前也可以)
  22654. * @param getDictFn 获取字典的方法
  22655. * @param bizKey 传入字典的参数
  22656. * @param multiValueSeparator 多个字典值的分割符号
  22657. */
  22658. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  22659. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  22660. // sender 和 config为空的时候获取值、
  22661. if (_$2.isArray(getDictFn)) {
  22662. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  22663. var realArray_1 = getDictFn;
  22664. getDictFn = function () {
  22665. return realArray_1;
  22666. };
  22667. }
  22668. if (!sender) {
  22669. return new Promise(function (resolve, reject) {
  22670. getDictFn(bizKey, function (r) {
  22671. resolve({ config: config, r: r });
  22672. });
  22673. });
  22674. }
  22675. if (sender.xtype === 'combotree') {
  22676. getDictFn(bizKey, function (r) {
  22677. if (sender.store) {
  22678. // 异步回传
  22679. sender.setStore(new Ext.data.TreeStore({ root: r }));
  22680. }
  22681. else {
  22682. // 同步回传
  22683. config.store = new Ext.data.TreeStore({ root: r });
  22684. }
  22685. });
  22686. return;
  22687. }
  22688. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  22689. getDictFn(bizKey, function (r) {
  22690. var _a, _b;
  22691. if (sender.store) {
  22692. // 异步回传
  22693. sender.setStore(new Ext.data.Store(r));
  22694. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  22695. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  22696. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  22697. if (typeof realValue !== 'undefined') {
  22698. sender.setValue(realValue);
  22699. }
  22700. }
  22701. else {
  22702. // 同步回传
  22703. config.store = new Ext.data.Store(r);
  22704. }
  22705. });
  22706. return;
  22707. }
  22708. else if (sender.xtype === 'gridcolumn') {
  22709. var grid = getParentGrid(config);
  22710. var editor_1 = config.editor, renderer = config.renderer;
  22711. getDictFn(bizKey, function (r) {
  22712. if (sender.store) {
  22713. // 已经渲染出来了, 用方法进行修改
  22714. var editor_2 = sender.getEditor();
  22715. if (editor_2 && editor_2.xtype === 'combo') {
  22716. var valueField_1 = r.field[0];
  22717. var displayField_1 = r.field[1];
  22718. editor_2.valueField = valueField_1;
  22719. editor_2.setDisplayField(displayField_1);
  22720. editor_2.setStore(new Ext.data.Store(r));
  22721. }
  22722. if (!sender.disableListFilter) {
  22723. sender.setFilter({
  22724. type: 'list',
  22725. options: _$2.map(r.data, function (r) { return ({
  22726. id: '' + r.id,
  22727. text: r.text,
  22728. }); })
  22729. });
  22730. }
  22731. }
  22732. else {
  22733. // 没有渲染之前,修改 config 即可
  22734. if (editor_1 && editor_1.xtype === 'combo') {
  22735. // 带编辑模式
  22736. editor_1.store = new Ext.data.Store(r);
  22737. }
  22738. if (!sender.disableListFilter) {
  22739. config.filter = {
  22740. type: 'list',
  22741. options: _$2.map(r.data, function (r) { return ({
  22742. id: '' + r.id,
  22743. text: r.text,
  22744. }); })
  22745. };
  22746. }
  22747. }
  22748. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  22749. var renderer = function (value, metaData) {
  22750. if (metaData === void 0) { metaData = false; }
  22751. if (!value && value != 0) {
  22752. return '';
  22753. }
  22754. var valueField = r.field[metaData === true ? 1 : 0];
  22755. var displayField = r.field[metaData === true ? 0 : 1];
  22756. var separator = multiValueSeparator;
  22757. if (separator) {
  22758. var arr = value.split(separator);
  22759. var displayValue_1 = "";
  22760. var _loop_1 = function (i) {
  22761. var itv = arr[i];
  22762. if (i > 0) {
  22763. displayValue_1 += separator;
  22764. }
  22765. _$2.each(r.data, function (row) {
  22766. // 从 valueField 找到要显示的 displayField
  22767. if (row[valueField] == itv) {
  22768. displayValue_1 += row[displayField];
  22769. return false;
  22770. }
  22771. else {
  22772. if (i >= r.data.length - 1) {
  22773. displayValue_1 += itv;
  22774. }
  22775. }
  22776. });
  22777. };
  22778. for (var i = 0; i < arr.length; i++) {
  22779. _loop_1(i);
  22780. }
  22781. return displayValue_1;
  22782. }
  22783. _$2.each(r.data, function (row) {
  22784. // 从 valueField 找到要显示的 displayField
  22785. if (row[valueField] == value) {
  22786. value = row[displayField];
  22787. return false;
  22788. }
  22789. });
  22790. return value;
  22791. };
  22792. var dictForExcel = {};
  22793. var valueField = r.field[0];
  22794. var displayField = r.field[1];
  22795. _$2.each(r.data, function (row) {
  22796. // 从 valueField 找到要显示的 displayField
  22797. var key = row[valueField];
  22798. if (key != '' && typeof key != "undefined" && key != null) {
  22799. dictForExcel[key] = row[displayField];
  22800. }
  22801. });
  22802. if (sender.rendered) {
  22803. // 已经渲染出来了, 对列进行渲染
  22804. sender.renderer = renderer;
  22805. sender.dictForExcel = dictForExcel;
  22806. sender.getView().refresh();
  22807. }
  22808. else {
  22809. sender.renderer = renderer;
  22810. sender.dictForExcel = dictForExcel;
  22811. config.renderer = renderer;
  22812. config.dictForExcel = dictForExcel;
  22813. }
  22814. });
  22815. return;
  22816. }
  22817. throw new TypeError("无法识别的组件类型");
  22818. }
  22819. /**
  22820. * 调用服务器 Ajax
  22821. */
  22822. function invokeServer$1(url) {
  22823. var args = [];
  22824. for (var _i = 1; _i < arguments.length; _i++) {
  22825. args[_i - 1] = arguments[_i];
  22826. }
  22827. // @ts-ignore
  22828. return ajax.func({
  22829. url: url,
  22830. method: 'invoke',
  22831. args: args
  22832. });
  22833. }
  22834. function clearViewModelValues(viewModel, propertyName) {
  22835. if (!propertyName) {
  22836. var dd_1 = viewModel.getData();
  22837. _$2.forOwn(dd_1, function (value, key) {
  22838. viewModel.set(key, '');
  22839. });
  22840. return;
  22841. }
  22842. var dd = _$2.get(viewModel.getData(), propertyName);
  22843. _$2.forOwn(dd, function (value, key) {
  22844. viewModel.set(propertyName + '.' + key, '');
  22845. });
  22846. }
  22847. function reloadGrid(scope, gridRefName) {
  22848. var _a;
  22849. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  22850. }
  22851. /**
  22852. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  22853. */
  22854. function toPlainObject(obj) {
  22855. if (obj.isModel) {
  22856. obj = obj.data;
  22857. }
  22858. _$2.forOwn(obj, function (v, k) {
  22859. // Ext.data.Model.constructor
  22860. if (!v) {
  22861. return;
  22862. }
  22863. if (v.isModel) {
  22864. v = v.data;
  22865. }
  22866. if (typeof v === 'object') {
  22867. obj[k] = toPlainObject(v);
  22868. }
  22869. else {
  22870. obj[k] = v;
  22871. }
  22872. });
  22873. return obj;
  22874. }
  22875. function confirm(msg, sender) {
  22876. return new Promise(function (resolve) {
  22877. var _a, _b;
  22878. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  22879. var t = { msg: msg };
  22880. var WMSTranslate = window["WMSTranslate"];
  22881. if (WMSTranslate) {
  22882. if (typeof window['viewTranslate'] === 'function') {
  22883. window['viewTranslate'](t, msg, "msg");
  22884. }
  22885. }
  22886. var config = {
  22887. title: '请确认',
  22888. modal: true,
  22889. animateTarget: sender,
  22890. // resizable: false,
  22891. // constrainHeader: true,
  22892. // constrain: true,
  22893. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  22894. layout: {
  22895. type: 'hbox',
  22896. pack: 'start',
  22897. align: 'stretch'
  22898. },
  22899. items: [
  22900. {
  22901. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  22902. border: false,
  22903. },
  22904. {
  22905. flex: 1,
  22906. border: false,
  22907. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
  22908. }
  22909. ],
  22910. buttons: [
  22911. {
  22912. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  22913. handler: function () {
  22914. resolve();
  22915. win.close();
  22916. }
  22917. },
  22918. {
  22919. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  22920. handler: function () {
  22921. win.close();
  22922. }
  22923. }
  22924. ],
  22925. keyMapEnabled: true,
  22926. keyMap: {
  22927. ENTER: function () {
  22928. resolve();
  22929. win.close();
  22930. }
  22931. }
  22932. };
  22933. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  22934. config.constrain = true;
  22935. }
  22936. var win = new Ext.Window(config);
  22937. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  22938. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  22939. }
  22940. win.show();
  22941. });
  22942. }
  22943. /**
  22944. * 任何符号字符串都替换成下换线
  22945. */
  22946. function normId(value) {
  22947. return _$2.replace(value, /[^\w]/g, '_');
  22948. }
  22949. /**
  22950. *
  22951. * @param sender
  22952. * @param propertyName
  22953. * @param gridRefName
  22954. */
  22955. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  22956. var _a, _b;
  22957. var scope = lookupScope(sender);
  22958. clearViewModelValues(scope.viewModel, propertyName);
  22959. if (!gridRefName) {
  22960. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  22961. }
  22962. else {
  22963. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  22964. }
  22965. }
  22966. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  22967. if ([10, 13, 20, 40].includes(event.keyCode)) {
  22968. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  22969. var value = _$2.trim(sender.rawValue);
  22970. raiseClick(eOpts.handle);
  22971. }
  22972. }, 150);
  22973. function saveGridRow(grid1) {
  22974. var _a;
  22975. var config = grid1.config;
  22976. var scope = lookupScope(grid1);
  22977. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  22978. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  22979. // "表格保存"的相关配置
  22980. var dbSaveConfig = {
  22981. columns: [],
  22982. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  22983. saveRowValues: saveRowValues,
  22984. path: scope.originalVjson.__custom_path,
  22985. };
  22986. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  22987. if (err) {
  22988. // 如果有异常就不保存
  22989. return;
  22990. }
  22991. // 构建"表格保存"的相关配置
  22992. for (var i = 0; i < config.columns.length; i++) {
  22993. var c = config.columns[i];
  22994. var v = {
  22995. dataIndex: c.dataIndex,
  22996. header: c.header,
  22997. dbColumn: c.dbColumn,
  22998. serverCreateValue: c.serverCreateValue,
  22999. dbIsDeleteKey: c.dbIsDeleteKey,
  23000. dbIsUpdateKey: c.dbIsUpdateKey,
  23001. dbUpdateEnable: c.dbUpdateEnable,
  23002. serverValueConvert: c.dbUpdateEnable,
  23003. };
  23004. if (c.editor) {
  23005. v.editor = {
  23006. xtype: c.editor.xtype,
  23007. required: c.editor.required,
  23008. };
  23009. }
  23010. dbSaveConfig.columns.push(v);
  23011. }
  23012. // 进行业务上的逻辑校验
  23013. var hasError = false;
  23014. _$2.forEach(rows, function (row, i) {
  23015. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  23016. var c = config.columns[i_1];
  23017. var value = row[c.dataIndex];
  23018. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  23019. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  23020. hasError = true;
  23021. return false;
  23022. }
  23023. if (c.xtype === 'checkcolumn') {
  23024. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  23025. row[c.dataIndex] = c.uncheckedValue;
  23026. }
  23027. if (value === true && typeof c.checkedValue !== 'undefined') {
  23028. row[c.dataIndex] = c.checkedValue;
  23029. }
  23030. }
  23031. }
  23032. });
  23033. if (hasError) {
  23034. return;
  23035. }
  23036. // 设置当前界面为 "保存中..." 状态
  23037. grid1.setLoading(true);
  23038. invokeServer$1('/Dev@batchSave', {
  23039. newRows: newRows,
  23040. modifyRows: modifyRows,
  23041. removeRecords: removeRecords,
  23042. config: dbSaveConfig,
  23043. }).then(function (res) {
  23044. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  23045. msg$1(res.msg);
  23046. grid1.reload();
  23047. }).catch(function (e) {
  23048. console.error(e);
  23049. showErrorDialog$1(_$2.toString(e));
  23050. }).finally(function () {
  23051. // 无论正常异常,关闭 "保存中..." 状态
  23052. grid1.setLoading(false);
  23053. });
  23054. }
  23055. function insertGridRow(grid1) {
  23056. var config = grid1.config;
  23057. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  23058. var insertRow = {};
  23059. _$2.forEach(config.columns, function (c) {
  23060. var fn = c.createValue;
  23061. if (_$2.startsWith(fn, 'scope.') ||
  23062. _$2.startsWith(fn, 'system.')) {
  23063. var scope = lookupScope(grid1);
  23064. var fn2 = lookupFn(scope, fn, c);
  23065. if (_$2.isFunction(fn2)) {
  23066. var newValue = fn2();
  23067. if (!_$2.isUndefined(newValue)) {
  23068. insertRow[c.dataIndex] = newValue;
  23069. }
  23070. }
  23071. }
  23072. else if (_$2.isString(fn) && fn) {
  23073. insertRow[c.dataIndex] = fn;
  23074. }
  23075. });
  23076. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  23077. }
  23078. function commitMe(sender) {
  23079. var window = sender.up('window');
  23080. var scope = lookupScope(sender);
  23081. if (typeof scope['commit'] === 'function') {
  23082. scope['commit']().then(function (res) {
  23083. window.close();
  23084. });
  23085. }
  23086. }
  23087. function removeGridRow(grid1) {
  23088. var _a;
  23089. var config = grid1.config;
  23090. var rows = [];
  23091. if (grid1.selModel.selType === "rowmodel") {
  23092. rows.push(grid1.selection);
  23093. }
  23094. else {
  23095. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  23096. rows.push(r);
  23097. });
  23098. }
  23099. if (rows.length > 1) {
  23100. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  23101. if (_$2.isUndefined(batchRemoveConfirm)) {
  23102. //不需要提示
  23103. _$2.forEach(rows, function (r) {
  23104. grid1.getStore().remove(r);
  23105. });
  23106. }
  23107. else {
  23108. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  23109. confirm(tip).then(function () {
  23110. _$2.forEach(rows, function (r) {
  23111. grid1.getStore().remove(r);
  23112. });
  23113. });
  23114. }
  23115. }
  23116. else if (rows.length === 1) {
  23117. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  23118. if (_$2.isUndefined(singleRemoveConfirm)) {
  23119. //不需要提示
  23120. grid1.getStore().remove(rows[0]);
  23121. }
  23122. else {
  23123. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  23124. _$2.forEach(config.columns, function (c) {
  23125. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  23126. });
  23127. confirm(tip_1).then(function () {
  23128. grid1.getStore().remove(rows[0]);
  23129. });
  23130. }
  23131. }
  23132. else {
  23133. msg$1('请选择要删除的数据!');
  23134. }
  23135. }
  23136. function moveUpGridRow(grid) {
  23137. grid.rowMoveUp();
  23138. }
  23139. function moveDownGridRow(grid) {
  23140. grid.rowMoveDown();
  23141. }
  23142. var SystemEventFu = /** @class */ (function () {
  23143. function SystemEventFu() {
  23144. }
  23145. SystemEventFu.prototype.moveUpGridRow = function () {
  23146. return function (sender) {
  23147. var grid1 = sender.up('yvgrid');
  23148. moveUpGridRow(grid1);
  23149. };
  23150. };
  23151. SystemEventFu.prototype.commitMe = function () {
  23152. return function (sender) {
  23153. commitMe(sender);
  23154. };
  23155. };
  23156. SystemEventFu.prototype.moveDownGridRow = function () {
  23157. return function (sender) {
  23158. var grid1 = sender.up('yvgrid');
  23159. moveDownGridRow(grid1);
  23160. };
  23161. };
  23162. SystemEventFu.prototype.saveGridRow = function () {
  23163. return function (sender) {
  23164. var grid1 = sender.up('yvgrid');
  23165. saveGridRow(grid1);
  23166. };
  23167. };
  23168. SystemEventFu.prototype.insertGridRow = function () {
  23169. return function (sender) {
  23170. var grid1 = sender.up('yvgrid');
  23171. insertGridRow(grid1);
  23172. };
  23173. };
  23174. SystemEventFu.prototype.removeGridRow = function () {
  23175. return function (sender) {
  23176. var grid1 = sender.up('yvgrid');
  23177. removeGridRow(grid1);
  23178. };
  23179. };
  23180. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  23181. return function (sender, config) {
  23182. if (!config.listeners) {
  23183. config.listeners = {};
  23184. }
  23185. config.listeners.afterrender = function (sender) {
  23186. var scope = lookupScope(sender);
  23187. // $(sender.el.dom).on('keydown', (e) => {
  23188. // const xtype = Ext.fly(e.target).component.xtype
  23189. // if (xtype === 'textfield' && e.keyCode === 13) {
  23190. // Ext.defer(() => {
  23191. // raiseClick(scope.refs[btnReferenceName])
  23192. // })
  23193. // e.preventDefault()
  23194. // e.stopPropagation()
  23195. // return false
  23196. // }
  23197. // })
  23198. $(sender.el.dom).on('keyup', function (e) {
  23199. var tt = Ext.fly(e.target).component;
  23200. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  23201. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  23202. ![10, 13, 20, 40].includes(e.keyCode)) {
  23203. return;
  23204. }
  23205. e.preventDefault();
  23206. e.stopPropagation();
  23207. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  23208. return;
  23209. });
  23210. };
  23211. };
  23212. };
  23213. SystemEventFu.prototype.confirm = function (text, fn) {
  23214. return function (sender) {
  23215. var scope = lookupScope(sender);
  23216. var msg = calcExpress(scope.viewModel.data, text);
  23217. confirm(msg, sender).then(function () {
  23218. fn.call(scope, sender);
  23219. });
  23220. };
  23221. };
  23222. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  23223. return function (sender) {
  23224. var scope = lookupScope(sender);
  23225. var grid = scope.refs[gridRefName];
  23226. if (grid) {
  23227. var records = grid.getSelectionModel().getLastSelected();
  23228. grid.store.remove(records);
  23229. }
  23230. };
  23231. };
  23232. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  23233. //可以是 scope.XX / system.XX / string / lookup表达式
  23234. writeTarget) {
  23235. return function (sender) {
  23236. if (!invokeUrl) {
  23237. return;
  23238. }
  23239. var scope = lookupScope(sender);
  23240. scope.setLoading(true);
  23241. var data = scope.viewModel.data;
  23242. if (invokeParam) {
  23243. data = calcObjectFlat(data, invokeParam);
  23244. }
  23245. invokeServer$1(invokeUrl, data).then(function (res) {
  23246. if (res.success) {
  23247. if (typeof writeTarget === "string") {
  23248. _$2.forOwn(res.data, function (v, k) {
  23249. scope.viewModel.set(writeTarget + "." + k, v);
  23250. });
  23251. }
  23252. else if (typeof writeTarget === 'function') {
  23253. writeTarget.call(scope, res.data);
  23254. }
  23255. else if (typeof writeTarget === 'object') {
  23256. var ret = calcObjectFlat(res.data, writeTarget);
  23257. _$2.forOwn(ret, function (v, k) {
  23258. scope.viewModel.set(k, v);
  23259. });
  23260. }
  23261. }
  23262. else {
  23263. showErrorDialog$1(res.msg || '未知错误', sender);
  23264. }
  23265. }).catch(function (e) {
  23266. var _a, _b;
  23267. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23268. showErrorDialog$1(msg || e.toString(), sender);
  23269. }).finally(function () {
  23270. scope.setLoading(false);
  23271. });
  23272. };
  23273. };
  23274. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  23275. return function (sender) {
  23276. var scope = lookupScope(sender);
  23277. scope.setLoading(true);
  23278. var data = scope.viewModel.data;
  23279. if (arg0) {
  23280. data = calcObjectFlat(data, arg0);
  23281. }
  23282. invokeServer$1(groovyUrl, data).then(function (res) {
  23283. if (res.success) {
  23284. if (res.msg) {
  23285. msg(res.msg);
  23286. }
  23287. if (typeof successCallback === 'function') {
  23288. successCallback.call(scope, sender, res.data);
  23289. }
  23290. }
  23291. else {
  23292. showErrorDialog$1(res.msg || '未知错误', sender);
  23293. }
  23294. }).catch(function (e) {
  23295. var _a, _b;
  23296. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23297. showErrorDialog$1(msg || e.toString(), sender);
  23298. }).finally(function () {
  23299. scope.setLoading(false);
  23300. });
  23301. };
  23302. };
  23303. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  23304. return function (sender) {
  23305. var scope = lookupScope(sender);
  23306. var form = scope.down('form');
  23307. if (form) {
  23308. // 如果下级有表单,就做表单校验
  23309. var valid = form.isValid();
  23310. if (!valid) {
  23311. return;
  23312. }
  23313. }
  23314. scope.setLoading(true);
  23315. var data = scope.viewModel.data;
  23316. if (arg0) {
  23317. data = calcObjectFlat(data, arg0);
  23318. }
  23319. invokeServer$1(groovyUrl, data).then(function (res) {
  23320. if (res.success) {
  23321. if (res.msg) {
  23322. msg(res.msg);
  23323. }
  23324. scope.dialogSuccess(res);
  23325. }
  23326. else {
  23327. showErrorDialog$1(res.msg || '未知错误', sender);
  23328. }
  23329. }).catch(function (e) {
  23330. var _a, _b;
  23331. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  23332. showErrorDialog$1(msg || e.toString(), sender);
  23333. }).finally(function () {
  23334. scope.setLoading(false);
  23335. });
  23336. };
  23337. };
  23338. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  23339. return function (sender) {
  23340. var scope = lookupScope(sender);
  23341. if (lookupObject) {
  23342. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  23343. }
  23344. else {
  23345. scope.dialogSuccess();
  23346. }
  23347. };
  23348. };
  23349. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  23350. return function (sender) {
  23351. var scope = lookupScope(sender);
  23352. clearViewModelValues(scope.viewModel, propertyName);
  23353. };
  23354. };
  23355. SystemEventFu.prototype.getGrid = function (url) {
  23356. return function (sender, config) {
  23357. if (config.xtype == "combogridmulti") {
  23358. // @ts-ignore
  23359. require([url], function (grid) {
  23360. _$2.forOwn(grid.default, function (v, k) {
  23361. sender[k] = v;
  23362. sender.config[k] = v;
  23363. if (sender.rendered) {
  23364. // 已经渲染出来了,重新调用 reload 强制刷新
  23365. sender.reload();
  23366. }
  23367. });
  23368. });
  23369. }
  23370. else {
  23371. // @ts-ignore
  23372. require([url], function (grid) {
  23373. sender.grid = grid.default;
  23374. config.grid = grid.default;
  23375. });
  23376. }
  23377. };
  23378. };
  23379. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  23380. return function (sender) {
  23381. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  23382. };
  23383. };
  23384. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  23385. return function (sender) {
  23386. var _a, _b;
  23387. var scope = lookupScope(sender);
  23388. if (!gridRefName) {
  23389. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  23390. }
  23391. else {
  23392. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  23393. }
  23394. };
  23395. };
  23396. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  23397. return function (sender) {
  23398. var scope = lookupScope(sender);
  23399. var data = scope.viewModel.data;
  23400. var param = calcObjectFlat(data, lookupForData);
  23401. // @ts-ignore
  23402. require([url], function (module) {
  23403. var ScopeClass = module.default;
  23404. var scope = new ScopeClass();
  23405. scope.success = successCallback;
  23406. scope.showDialog(sender, {}, { data: param });
  23407. });
  23408. };
  23409. };
  23410. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  23411. return function (sender, queryValue) {
  23412. showWidget(widgetUrl, lookup, sender, queryValue);
  23413. };
  23414. };
  23415. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  23416. return function (sender) {
  23417. clearViewModelByLookup(sender, lookup);
  23418. };
  23419. };
  23420. SystemEventFu.prototype.closeMe = function (callBack) {
  23421. return function (sender) {
  23422. var scope = lookupScope(sender);
  23423. scope.close();
  23424. if (callBack) {
  23425. callBack.call(sender);
  23426. }
  23427. };
  23428. };
  23429. // 未完成
  23430. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  23431. return function (sender) {
  23432. var scope = lookupScope(sender);
  23433. var data = scope.viewModel.data;
  23434. var billSetting = scope.billSetting;
  23435. var param = calcObjectFlat(data, lookupForData);
  23436. return new Promise(function (resolve, reject) {
  23437. var sf = function (scope) {
  23438. scope.success = function (dlgScope, dlgSender, reData) {
  23439. };
  23440. scope.showDialog(sender, {}, { data: param });
  23441. };
  23442. // @ts-ignore
  23443. require([url], function (module) {
  23444. // 业务描述文件
  23445. if (url.endsWith(".bill")) {
  23446. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  23447. sf(scope);
  23448. });
  23449. }
  23450. else { //原生yvanui文件
  23451. var ScopeClass = module.default;
  23452. var scope_1 = new ScopeClass();
  23453. sf(scope_1);
  23454. }
  23455. });
  23456. });
  23457. };
  23458. };
  23459. __decorate([
  23460. Lib({
  23461. title: '为某个表格,上移行',
  23462. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23463. }),
  23464. __metadata("design:type", Function),
  23465. __metadata("design:paramtypes", []),
  23466. __metadata("design:returntype", void 0)
  23467. ], SystemEventFu.prototype, "moveUpGridRow", null);
  23468. __decorate([
  23469. Lib({
  23470. title: '为某个表格,上移行',
  23471. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23472. }),
  23473. __metadata("design:type", Function),
  23474. __metadata("design:paramtypes", []),
  23475. __metadata("design:returntype", void 0)
  23476. ], SystemEventFu.prototype, "commitMe", null);
  23477. __decorate([
  23478. Lib({
  23479. title: '为某个表格,下移行',
  23480. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  23481. }),
  23482. __metadata("design:type", Function),
  23483. __metadata("design:paramtypes", []),
  23484. __metadata("design:returntype", void 0)
  23485. ], SystemEventFu.prototype, "moveDownGridRow", null);
  23486. __decorate([
  23487. Lib({
  23488. title: '为某个表格,批量保存至数据库',
  23489. author: '罗一帆',
  23490. createAt: '2022-07-19',
  23491. updateAt: '2022-07-19',
  23492. type: 'system',
  23493. category: '表格',
  23494. }),
  23495. __metadata("design:type", Function),
  23496. __metadata("design:paramtypes", []),
  23497. __metadata("design:returntype", void 0)
  23498. ], SystemEventFu.prototype, "saveGridRow", null);
  23499. __decorate([
  23500. Lib({
  23501. title: '为某个表格插入数据行',
  23502. author: '罗一帆',
  23503. createAt: '2022-07-19',
  23504. updateAt: '2022-07-19',
  23505. type: 'system',
  23506. category: '表格',
  23507. }),
  23508. __metadata("design:type", Function),
  23509. __metadata("design:paramtypes", []),
  23510. __metadata("design:returntype", void 0)
  23511. ], SystemEventFu.prototype, "insertGridRow", null);
  23512. __decorate([
  23513. Lib({
  23514. title: '为某个表格删除所选数据行',
  23515. author: '罗一帆',
  23516. createAt: '2022-07-19',
  23517. updateAt: '2022-07-19',
  23518. type: 'system',
  23519. category: '表格',
  23520. }),
  23521. __metadata("design:type", Function),
  23522. __metadata("design:paramtypes", []),
  23523. __metadata("design:returntype", void 0)
  23524. ], SystemEventFu.prototype, "removeGridRow", null);
  23525. __decorate([
  23526. Lib({
  23527. title: '按下回车键之后默认是否按下某个按钮',
  23528. author: '罗一帆',
  23529. createAt: '2021-07-02',
  23530. updateAt: '2021-07-02',
  23531. type: 'system',
  23532. category: '字典',
  23533. }),
  23534. __metadata("design:type", Function),
  23535. __metadata("design:paramtypes", [Object]),
  23536. __metadata("design:returntype", void 0)
  23537. ], SystemEventFu.prototype, "enterToClick", null);
  23538. __decorate([
  23539. Lib({
  23540. title: '弹出确认对话框,回答 YES 之后调用某方法',
  23541. author: '罗一帆',
  23542. createAt: '2021-07-06',
  23543. updateAt: '2021-07-06',
  23544. type: 'system',
  23545. category: '对话框',
  23546. }),
  23547. __param(0, LibParam('对话框的确认文字', 'string')),
  23548. __param(1, LibParam('确认之后的调用的方法', 'event')),
  23549. __metadata("design:type", Function),
  23550. __metadata("design:paramtypes", [Object, Object]),
  23551. __metadata("design:returntype", void 0)
  23552. ], SystemEventFu.prototype, "confirm", null);
  23553. __decorate([
  23554. Lib({
  23555. title: '删除表格当前的选中行(前端删除)',
  23556. author: '罗一帆',
  23557. createAt: '2021-07-08',
  23558. updateAt: '2021-07-08',
  23559. type: 'system',
  23560. category: '表格',
  23561. }),
  23562. __param(0, LibParam('表格引用名', 'refs')),
  23563. __metadata("design:type", Function),
  23564. __metadata("design:paramtypes", [Object]),
  23565. __metadata("design:returntype", void 0)
  23566. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  23567. __decorate([
  23568. Lib({
  23569. title: '查询表单,如果 url 为空值,就取消查询',
  23570. author: '罗一帆',
  23571. createAt: '2021-07-06',
  23572. updateAt: '2021-07-06',
  23573. type: 'system',
  23574. category: '表单',
  23575. }),
  23576. __param(0, LibParam('后端服务路径', 'string')),
  23577. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  23578. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  23579. __metadata("design:type", Function),
  23580. __metadata("design:paramtypes", [String, Object, Object]),
  23581. __metadata("design:returntype", void 0)
  23582. ], SystemEventFu.prototype, "loadForm", null);
  23583. __decorate([
  23584. Lib({
  23585. title: '提交(不做校验、不关闭窗体)',
  23586. author: '罗一帆',
  23587. createAt: '2021-07-02',
  23588. updateAt: '2021-07-02',
  23589. type: 'system',
  23590. category: '表单',
  23591. }),
  23592. __param(0, LibParam('后端服务路径', 'string')),
  23593. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  23594. __param(2, LibParam('提交成功后的回调', 'event', true)),
  23595. __metadata("design:type", Function),
  23596. __metadata("design:paramtypes", [String, Object, Object]),
  23597. __metadata("design:returntype", void 0)
  23598. ], SystemEventFu.prototype, "commit", null);
  23599. __decorate([
  23600. Lib({
  23601. title: '提交表单',
  23602. author: '罗一帆',
  23603. createAt: '2021-07-02',
  23604. updateAt: '2021-07-02',
  23605. type: 'system',
  23606. category: '表单',
  23607. }),
  23608. __param(0, LibParam('后端服务路径', 'string')),
  23609. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  23610. __metadata("design:type", Function),
  23611. __metadata("design:paramtypes", [String, Object]),
  23612. __metadata("design:returntype", void 0)
  23613. ], SystemEventFu.prototype, "formCommit", null);
  23614. __decorate([
  23615. Lib({
  23616. title: '对话框成功回调',
  23617. author: '罗一帆',
  23618. createAt: '2021-07-02',
  23619. updateAt: '2021-07-02',
  23620. type: 'system',
  23621. category: '对话框',
  23622. }),
  23623. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  23624. __metadata("design:type", Function),
  23625. __metadata("design:paramtypes", [Object]),
  23626. __metadata("design:returntype", void 0)
  23627. ], SystemEventFu.prototype, "dialogSuccess", null);
  23628. __decorate([
  23629. Lib({
  23630. title: '清空 viewModel 某个属性',
  23631. author: '罗一帆',
  23632. createAt: '2021-07-02',
  23633. updateAt: '2021-07-02',
  23634. type: 'system',
  23635. category: '表单',
  23636. }),
  23637. __param(0, LibParam('属性路径', 'viewModel', true)),
  23638. __metadata("design:type", Function),
  23639. __metadata("design:paramtypes", [String]),
  23640. __metadata("design:returntype", void 0)
  23641. ], SystemEventFu.prototype, "clearViewModelValues", null);
  23642. __decorate([
  23643. Lib({
  23644. title: '从其他资源获取表格设置',
  23645. author: '罗一帆',
  23646. createAt: '2021-07-02',
  23647. updateAt: '2021-07-02',
  23648. type: 'system',
  23649. category: '表单',
  23650. }),
  23651. __param(0, LibParam('定义文件', 'module')),
  23652. __metadata("design:type", Function),
  23653. __metadata("design:paramtypes", [Object]),
  23654. __metadata("design:returntype", void 0)
  23655. ], SystemEventFu.prototype, "getGrid", null);
  23656. __decorate([
  23657. Lib({
  23658. title: '清空 viewModel 某个属性,并刷新表格',
  23659. author: '罗一帆',
  23660. createAt: '2021-07-02',
  23661. updateAt: '2021-07-02',
  23662. type: 'system',
  23663. category: '表单',
  23664. }),
  23665. __param(0, LibParam('清空的属性', 'viewModel')),
  23666. __param(1, LibParam('要刷新的表格', 'refs', true)),
  23667. __metadata("design:type", Function),
  23668. __metadata("design:paramtypes", [String, String]),
  23669. __metadata("design:returntype", void 0)
  23670. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  23671. __decorate([
  23672. Lib({
  23673. title: '刷新表格',
  23674. author: '罗一帆',
  23675. createAt: '2021-07-02',
  23676. updateAt: '2021-07-02',
  23677. type: 'system',
  23678. category: '表单',
  23679. }),
  23680. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  23681. __metadata("design:type", Function),
  23682. __metadata("design:paramtypes", [String]),
  23683. __metadata("design:returntype", void 0)
  23684. ], SystemEventFu.prototype, "reloadGrid", null);
  23685. __decorate([
  23686. Lib({
  23687. title: '显示对话框',
  23688. author: '罗一帆',
  23689. createAt: '2021-07-02',
  23690. updateAt: '2021-07-02',
  23691. type: 'system',
  23692. category: '对话框',
  23693. }),
  23694. __param(0, LibParam('业务模块名', 'module')),
  23695. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  23696. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  23697. __metadata("design:type", Function),
  23698. __metadata("design:paramtypes", [String, Object, Object]),
  23699. __metadata("design:returntype", void 0)
  23700. ], SystemEventFu.prototype, "showDialog", null);
  23701. __decorate([
  23702. Lib({
  23703. title: '弹出查找框(不借助 search)',
  23704. author: '罗一帆',
  23705. createAt: '2021-07-02',
  23706. updateAt: '2021-07-02',
  23707. type: 'system',
  23708. category: '对话框',
  23709. }),
  23710. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  23711. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  23712. __metadata("design:type", Function),
  23713. __metadata("design:paramtypes", [Object, Object]),
  23714. __metadata("design:returntype", void 0)
  23715. ], SystemEventFu.prototype, "showWidget", null);
  23716. __decorate([
  23717. Lib({
  23718. title: '根据 lookup 清空 viewModel',
  23719. author: '罗一帆',
  23720. createAt: '2021-07-05',
  23721. updateAt: '2021-07-05',
  23722. type: 'system',
  23723. category: '表单',
  23724. }),
  23725. __param(0, LibParam('设值表达式', 'lookup')),
  23726. __metadata("design:type", Function),
  23727. __metadata("design:paramtypes", [Object]),
  23728. __metadata("design:returntype", void 0)
  23729. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  23730. __decorate([
  23731. Lib({
  23732. title: '关闭对话框',
  23733. author: '罗一帆',
  23734. createAt: '2021-07-05',
  23735. updateAt: '2021-07-05',
  23736. type: 'system',
  23737. category: '对话框',
  23738. }),
  23739. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  23740. __metadata("design:type", Function),
  23741. __metadata("design:paramtypes", [Object]),
  23742. __metadata("design:returntype", void 0)
  23743. ], SystemEventFu.prototype, "closeMe", null);
  23744. __decorate([
  23745. Lib({
  23746. title: '打开对话框并返回数据',
  23747. author: '余亮',
  23748. createAt: '2022-07-07',
  23749. updateAt: '2022-07-07',
  23750. type: 'system',
  23751. category: '对话框',
  23752. }),
  23753. __param(0, LibParam('业务模块名', 'module')),
  23754. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  23755. __param(2, LibParam('结果映射关系', 'string', true)),
  23756. __metadata("design:type", Function),
  23757. __metadata("design:paramtypes", [String, Object, Object]),
  23758. __metadata("design:returntype", void 0)
  23759. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  23760. return SystemEventFu;
  23761. }());
  23762. /**
  23763. * 清空 viewmodel 里下属的所有属性
  23764. * @param viewModel VM对象
  23765. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  23766. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  23767. */
  23768. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  23769. var data = viewModel.data;
  23770. if (propertyKey) {
  23771. data = _$2.get(data, propertyKey);
  23772. }
  23773. _$2.forOwn(data, function (value, key) {
  23774. var targetKey = propertyKey ? propertyKey + "." + key : key;
  23775. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  23776. return;
  23777. }
  23778. viewModel.set(targetKey, '');
  23779. });
  23780. }
  23781. function clearViewModelByLookup(sender, lookup) {
  23782. if (_$2.isPlainObject(lookup)) {
  23783. var parentScope_1 = lookupScope(sender);
  23784. _$2.forOwn(lookup, function (value, key) {
  23785. if (SIMPLE_RE.test(value)) {
  23786. // '{foo}' 简单表达式
  23787. var path = value.substring(1, value.length - 1);
  23788. if (path !== 'queryValue') {
  23789. parentScope_1.viewModel.set(path, '');
  23790. }
  23791. }
  23792. });
  23793. }
  23794. }
  23795. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  23796. if (vjson === void 0) { vjson = {}; }
  23797. var parentScope = lookupScope(sender);
  23798. var me = sender;
  23799. // @ts-ignore
  23800. require([widgetUrl], function (widgetScope) {
  23801. var WidgetScopeClass = widgetScope.default;
  23802. widgetScope = new WidgetScopeClass();
  23803. // 传递进 widget.model 的数据
  23804. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  23805. widgetScope.parentScope = parentScope;
  23806. widgetScope.searchWidgetSuccess = function (data) {
  23807. if (typeof lookup === 'string') {
  23808. // lookup 是字符串的情况下,就是取某个列作为 value 值
  23809. me.setValue(data[lookup]);
  23810. return;
  23811. }
  23812. /**
  23813. * lookup: {
  23814. * // 扩展到 viewModel 的值做更改
  23815. * WH_CODE: "{queryValue}",
  23816. * WH_NAME: "{query.WH_NAME}",
  23817. * }
  23818. */
  23819. if (_$2.isPlainObject(lookup)) {
  23820. var parentScope_2 = lookupScope(sender);
  23821. tryWriteObject(lookup, data, function (path, value) {
  23822. if (path === 'queryValue') {
  23823. me.setValue(value);
  23824. }
  23825. else {
  23826. parentScope_2.viewModel.set(path, value);
  23827. }
  23828. });
  23829. }
  23830. return true;
  23831. };
  23832. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  23833. });
  23834. }
  23835. /**
  23836. * 停止事件的默认行为
  23837. * @param e
  23838. */
  23839. function stopEvent(e) {
  23840. e.preventDefault();
  23841. e.stopPropagation();
  23842. // @ts-ignore
  23843. window.event.cancelBubble = true;
  23844. e.returnValue = false;
  23845. e.cancelBubble = true;
  23846. }
  23847. /**
  23848. * 屏幕中央显示一个黑框提示
  23849. */
  23850. function msg$1(content) {
  23851. msg(content);
  23852. }
  23853. /**
  23854. * 错误对话框的强提醒
  23855. */
  23856. function showErrorDialog$1(msg, sender) {
  23857. showErrorDialog(msg, sender);
  23858. }
  23859. /**
  23860. * 错误对话框的强提醒
  23861. */
  23862. function showInfoDialog(msg, sender) {
  23863. showInfoDialogSimple(msg, sender);
  23864. }
  23865. /**
  23866. * 错误对话框的强提醒
  23867. */
  23868. function prompt$2(message, defaultValue, multiLine) {
  23869. if (defaultValue === void 0) { defaultValue = ""; }
  23870. if (multiLine === void 0) { multiLine = false; }
  23871. return prompt$1(message, defaultValue, multiLine);
  23872. }
  23873. /**
  23874. * 用于计算 express 表达式
  23875. */
  23876. function evalFunction(data, express) {
  23877. var keys = [];
  23878. var values = [];
  23879. _$2.forOwn(data, function (value, key) {
  23880. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  23881. if (match) {
  23882. key = key.substring(0, match.index);
  23883. }
  23884. keys.push(key);
  23885. values.push(value);
  23886. });
  23887. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  23888. try {
  23889. return func.apply(void 0, __spread(values));
  23890. }
  23891. catch (e) {
  23892. return;
  23893. }
  23894. }
  23895. /**
  23896. * 获取表格编辑的行数据
  23897. */
  23898. function getGridEditRows(grid) {
  23899. return grid.getGridEditRows();
  23900. }
  23901. var SystemLib = /*#__PURE__*/Object.freeze({
  23902. __proto__: null,
  23903. SIMPLE_RE: SIMPLE_RE,
  23904. pinyinMatch: pinyinMatch,
  23905. calcExpress: calcExpress,
  23906. calcObjectFlat: calcObjectFlat,
  23907. mergeViewModel: mergeViewModel,
  23908. flatRow: flatRow,
  23909. replaceNA: replaceNA,
  23910. deepTravJson: deepTravJson,
  23911. tryWriteByExpress: tryWriteByExpress,
  23912. tryWriteObject: tryWriteObject,
  23913. tryVarSimple: tryVarSimple,
  23914. calcObject: calcObject,
  23915. getParentGrid: getParentGrid,
  23916. tryEnable: tryEnable,
  23917. setComboStore: setComboStore,
  23918. invokeServer: invokeServer$1,
  23919. clearViewModelValues: clearViewModelValues,
  23920. reloadGrid: reloadGrid,
  23921. toPlainObject: toPlainObject,
  23922. confirm: confirm,
  23923. normId: normId,
  23924. clearViewModelReloadGrid: clearViewModelReloadGrid,
  23925. saveGridRow: saveGridRow,
  23926. insertGridRow: insertGridRow,
  23927. commitMe: commitMe,
  23928. removeGridRow: removeGridRow,
  23929. moveUpGridRow: moveUpGridRow,
  23930. moveDownGridRow: moveDownGridRow,
  23931. SystemEventFu: SystemEventFu,
  23932. clearViewModel: clearViewModel,
  23933. clearViewModelByLookup: clearViewModelByLookup,
  23934. showWidget: showWidget,
  23935. stopEvent: stopEvent,
  23936. msg: msg$1,
  23937. showErrorDialog: showErrorDialog$1,
  23938. showInfoDialog: showInfoDialog,
  23939. prompt: prompt$2,
  23940. evalFunction: evalFunction,
  23941. getGridEditRows: getGridEditRows
  23942. });
  23943. function initTree () {
  23944. Ext.define('Yvan.Tree', {
  23945. extend: 'Ext.tree.Panel',
  23946. alias: 'widget.yvtree',
  23947. xtype: 'yvtree',
  23948. constructor: function (config) {
  23949. var newConfig = _$2.defaultsDeep({
  23950. // 强制性属性
  23951. }, baseConfig(config, 'row-item'), config, tree);
  23952. _$2.assign(newConfig, {
  23953. tbar: [
  23954. {
  23955. xtype: 'textfield',
  23956. // triggerCls: 'x-form-clear-trigger',
  23957. flex: 1,
  23958. emptyText: '搜索过滤',
  23959. enableKeyEvents: true,
  23960. listeners: {
  23961. change: function (sender) {
  23962. var tree = sender.up("treepanel");
  23963. tree.filterByText(this.getRawValue());
  23964. },
  23965. keyup: function (sender, e) {
  23966. var tree = sender.up("treepanel");
  23967. if (e.ESC === e.getKey()) {
  23968. sender.setValue('');
  23969. tree.filterByText('');
  23970. }
  23971. }
  23972. }
  23973. },
  23974. ],
  23975. });
  23976. if (!newConfig.hideRefresh) {
  23977. newConfig.tbar.push({
  23978. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  23979. listeners: {
  23980. click: function (sender) {
  23981. var scope = sender.up("yvtree");
  23982. scope.reload();
  23983. }
  23984. }
  23985. });
  23986. }
  23987. if (!newConfig.hideExpand) {
  23988. newConfig.tbar.push({
  23989. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  23990. listeners: {
  23991. click: function (sender) {
  23992. var scope = sender.up("yvtree");
  23993. scope.expandAll();
  23994. }
  23995. }
  23996. });
  23997. }
  23998. if (!newConfig.hideCollapse) {
  23999. newConfig.tbar.push({
  24000. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  24001. listeners: {
  24002. click: function (sender) {
  24003. var scope = sender.up("yvtree");
  24004. scope.collapseAll();
  24005. }
  24006. }
  24007. });
  24008. }
  24009. this.superclass.constructor.call(this, newConfig);
  24010. },
  24011. /**
  24012. * 在根节点上增加一个节点,会触发 addNode 事件
  24013. * @param props
  24014. */
  24015. addRoot: function (props) {
  24016. var me = this;
  24017. var tableNode = me.getRootNode();
  24018. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  24019. if (_$2.isFunction(props)) {
  24020. props = props.call(this, parent);
  24021. }
  24022. _$2.forOwn(props, function (value, key) {
  24023. fieldNode.set(key, value);
  24024. });
  24025. var node = tableNode.appendChild(fieldNode);
  24026. me.ensureVisible(node);
  24027. me.setSelection(node);
  24028. me.fireEvent('addNode', me, {
  24029. parent: tableNode,
  24030. node: node,
  24031. });
  24032. },
  24033. addLast: function (props) {
  24034. var me = this;
  24035. var sel = me.selModel.getSelection();
  24036. if (!sel || sel.length <= 0) {
  24037. msg('请选择一个要添加的同级节点路径');
  24038. return;
  24039. }
  24040. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  24041. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  24042. if (_$2.isFunction(props)) {
  24043. props = props.call(this, parent);
  24044. }
  24045. _$2.forOwn(props, function (value, key) {
  24046. fieldNode.set(key, value);
  24047. });
  24048. var node = parent.appendChild(fieldNode);
  24049. me.ensureVisible(node);
  24050. me.setSelection(node);
  24051. me.fireEvent('addNode', me, {
  24052. parent: parent,
  24053. node: node,
  24054. });
  24055. },
  24056. addChildren: function (props) {
  24057. var me = this;
  24058. var sel = me.selModel.getSelection();
  24059. if (!sel || sel.length <= 0) {
  24060. msg('请选择一个要添加子节点的路径');
  24061. return;
  24062. }
  24063. var parent = sel[0];
  24064. if (_$2.isFunction(props)) {
  24065. props = props.call(this, parent);
  24066. }
  24067. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  24068. _$2.forOwn(props, function (value, key) {
  24069. fieldNode.set(key, value);
  24070. });
  24071. var node = parent.appendChild(fieldNode);
  24072. parent.expand();
  24073. me.ensureVisible(node);
  24074. me.setSelection(node);
  24075. me.fireEvent('addNode', me, {
  24076. parent: parent,
  24077. node: node,
  24078. });
  24079. },
  24080. initComponent: function () {
  24081. var me = this;
  24082. var config = me.config;
  24083. var scope = lookupScope(this);
  24084. if (!isDesignMode(scope, config)) {
  24085. // 转换 dataSource 属性
  24086. convertDataSource(me, scope, config);
  24087. }
  24088. this.superclass.initComponent.call(this);
  24089. this.on({
  24090. afterrender: function (sender) {
  24091. var me = this;
  24092. var config = this.config;
  24093. var dataSource = config.dataSource;
  24094. if (config.autoLoad) {
  24095. if (config.dataSourceCallbackFn) {
  24096. me.reload();
  24097. }
  24098. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  24099. me.reload();
  24100. }
  24101. }
  24102. }
  24103. });
  24104. },
  24105. _setDataReal: function (value) {
  24106. var me = this;
  24107. // me.setStore(new Ext.data.TreeStore({
  24108. // root: {
  24109. // expanded: true,
  24110. // // children: value
  24111. // children: [
  24112. // {
  24113. // id: '1', text: 'A',
  24114. // children: [
  24115. // {id: '1', text: 'A',},
  24116. // {id: '2', text: 'B'},
  24117. // ]
  24118. // },
  24119. // {id: '2', text: 'B'},
  24120. // ]
  24121. // }
  24122. // }))
  24123. me.store.setRoot({
  24124. expanded: true,
  24125. children: value
  24126. });
  24127. // me.store = new Ext.data.TreeStore({
  24128. // root: {
  24129. // expanded: true,
  24130. // // children: value
  24131. // children: [
  24132. // {
  24133. // id: '1', text: 'A',
  24134. // children: [
  24135. // {id: '1', text: 'A',},
  24136. // {id: '2', text: 'B'},
  24137. // ]
  24138. // },
  24139. // {id: '2', text: 'B'},
  24140. // ]
  24141. // }
  24142. // })
  24143. },
  24144. /**
  24145. * 重新载入数据(重新计算参数)
  24146. */
  24147. reload: function (reloadParams) {
  24148. if (reloadParams === void 0) { reloadParams = {}; }
  24149. var me = this;
  24150. var config = me.config;
  24151. if (config.dataSourceCallbackFn) {
  24152. // 函数请求刷新
  24153. var scope_1 = lookupScope(this);
  24154. // me.setLoading(true)
  24155. config.dataSourceCallbackFn.call(scope_1, me, {
  24156. successCallback: function (value) {
  24157. me._setDataReal(value);
  24158. // me.setLoading(false)
  24159. me.fireEvent('dataLoadComplete', me, true, value);
  24160. },
  24161. failCallback: function (error) {
  24162. // me.setLoading(false)
  24163. me.fireEvent('dataLoadComplete', me, false, error);
  24164. }
  24165. });
  24166. return;
  24167. }
  24168. var scope = lookupScope(me);
  24169. var dataSource = config.dataSource;
  24170. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  24171. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  24172. me.setLoading(true);
  24173. invokeServer$1(dataSource.url, params)
  24174. .then(function (res) {
  24175. me._setDataReal(res.data);
  24176. me.fireEvent('dataLoadComplete', me, res);
  24177. })
  24178. .finally(function () {
  24179. me.setLoading(false);
  24180. });
  24181. }
  24182. },
  24183. filterByText: function (text) {
  24184. this._filterText = text;
  24185. this._filterBy(this, text, 'text');
  24186. },
  24187. _filterBy: _$2.debounce(function (me, text, by) {
  24188. var view = me.getView();
  24189. me.store.clearFilter();
  24190. if (!me._filterText) {
  24191. // 没有筛选内容,还原状态
  24192. var selections = me.getSelection();
  24193. var selectionPaths_1 = [];
  24194. _$2.forEach(me.getSelection(), function (item) {
  24195. selectionPaths_1.push(item.getPath());
  24196. });
  24197. me.collapseAll();
  24198. _$2.forEach(selectionPaths_1, function (path) {
  24199. me.expandPath(path);
  24200. });
  24201. me.setSelection(selections);
  24202. return;
  24203. }
  24204. // 递归查找所有需要可见的节点 id 数组
  24205. var nodesAndParents = [];
  24206. var expandPaths = [];
  24207. me.getRootNode().cascadeBy(function (tree, view) {
  24208. var currNode = this;
  24209. currNode.collapse();
  24210. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  24211. // 展开到匹配的路径
  24212. // me.expandPath(currNode.getPath());
  24213. expandPaths.push(currNode.getPath());
  24214. // 沿途父节点全部设定为可见
  24215. while (currNode.parentNode) {
  24216. nodesAndParents.push(currNode.id);
  24217. currNode = currNode.parentNode;
  24218. }
  24219. }
  24220. }, null, [me, view]);
  24221. me.store.filterBy(function (r) {
  24222. return Ext.Array.contains(nodesAndParents, r.get('id'));
  24223. });
  24224. _$2.forEach(expandPaths, function (path) {
  24225. me.expandPath(path);
  24226. });
  24227. }, 1000),
  24228. });
  24229. }
  24230. function convertDataSource(sender, scope, newConfig) {
  24231. if (typeof newConfig.store !== 'undefined') {
  24232. // 有 store 属性的情况下,不做任何事
  24233. return;
  24234. }
  24235. if (typeof newConfig.dataSource === 'undefined') {
  24236. // 没有定义 dataSource 的情况下,不做任何事
  24237. return;
  24238. }
  24239. var dataSource = newConfig.dataSource;
  24240. if (typeof dataSource === 'string') {
  24241. // dataSource 是字符串的情况下,找到成员函数
  24242. dataSource = lookupFn(scope, dataSource);
  24243. }
  24244. if (typeof dataSource === 'function') {
  24245. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  24246. newConfig.store = new Ext.data.TreeStore({
  24247. root: {
  24248. expanded: true,
  24249. children: []
  24250. }
  24251. });
  24252. newConfig.dataSourceCallbackFn = dataSource;
  24253. return;
  24254. }
  24255. // throw new TypeError('无法识别的调用方法')
  24256. }
  24257. /**
  24258. * 构建一个 grid 支持的 dataSource
  24259. */
  24260. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  24261. if (reloadParams === void 0) { reloadParams = {}; }
  24262. if (isExcelExport === void 0) { isExcelExport = false; }
  24263. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  24264. var _a;
  24265. var me = grid;
  24266. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  24267. var storeOption = {};
  24268. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  24269. if (dataSource.sqlId) {
  24270. dataSource.method = 'invoke';
  24271. dataSource.url = '/Dev@executeSQL';
  24272. if (_$2.startsWith(dataSource.sqlId, '@')) {
  24273. // sqlId 是 @ 开头,代表直接带中文名
  24274. var scope_1 = lookupScope(grid);
  24275. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  24276. params.sqlId = dataSource.sqlId.substring(1);
  24277. }
  24278. else {
  24279. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  24280. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  24281. params.path = path;
  24282. params.sqlId = sqlId;
  24283. }
  24284. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  24285. }
  24286. var fields_1 = [];
  24287. _$2.forEach(grid.columns, function (col) {
  24288. var c = {};
  24289. if (col.dataIndex) {
  24290. c.name = col.dataIndex;
  24291. fields_1.push(c);
  24292. }
  24293. if (col.dataType) {
  24294. c.type = col.dataType;
  24295. }
  24296. });
  24297. // 默认支持 gridInvoke
  24298. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  24299. //@ts-ignore
  24300. storeOption = {
  24301. fields: fields_1,
  24302. remoteSort: config.remoteSort,
  24303. remoteFilter: config.remoteFilter,
  24304. autoLoad: true,
  24305. pageSize: me.store.pageSize || config.pageSize,
  24306. proxy: {
  24307. type: 'jsonAjax',
  24308. $owner: me,
  24309. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  24310. extraParams: extraParams,
  24311. reader: {
  24312. type: 'json',
  24313. rootProperty: 'data',
  24314. totalProperty: 'pagination.total',
  24315. successProperty: 'success',
  24316. messageProperty: 'msg',
  24317. transform: function (data) {
  24318. if (typeof window['ajaxProcess'] === 'function') {
  24319. window['ajaxProcess'](data);
  24320. }
  24321. if (typeof window['apiTranslate'] === 'function') {
  24322. window['apiTranslate'](data, dataSource.url);
  24323. }
  24324. if (typeof grid._transform === 'function') {
  24325. // 系统转换函数
  24326. grid._transform(data.data);
  24327. }
  24328. if (grid.dataTransform) {
  24329. if (typeof grid.dataTransform === 'string') {
  24330. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  24331. }
  24332. return grid.dataTransform.call(scope, grid, data);
  24333. }
  24334. return data;
  24335. }
  24336. }
  24337. },
  24338. listeners: {
  24339. load: function (store, records, successful, operation) {
  24340. var _a, _b, _c;
  24341. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  24342. if (rep.pagination) {
  24343. grid.dbInfo = rep.pagination.dbInfo;
  24344. grid.exportDataSql = rep.pagination.exportDataSql;
  24345. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  24346. }
  24347. 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;
  24348. if (isExcelExport) {
  24349. if (typeof excelExportCallBack === 'function') {
  24350. excelExportCallBack(rep);
  24351. }
  24352. else if (excelExportCallBack) {
  24353. console.error("导出回调方法错误!");
  24354. }
  24355. me.fireEvent('excelDataLoadComplete', me, successful, records);
  24356. }
  24357. else {
  24358. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  24359. // 自动选中第一行
  24360. var data = grid.getStore().data;
  24361. if (data.length > 0) {
  24362. grid.setSelection(data.items[0]);
  24363. }
  24364. }
  24365. me.fireEvent('dataLoadComplete', me, successful, records);
  24366. }
  24367. }
  24368. }
  24369. };
  24370. }
  24371. else if (exports.apiConvert) {
  24372. // 外部扩展的 apiConvert
  24373. //@ts-ignore
  24374. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack);
  24375. }
  24376. else {
  24377. throw new TypeError("不支持的 API 请求方式");
  24378. }
  24379. if (isExcelExport) {
  24380. var excelStore = new Ext.data.Store(storeOption);
  24381. excelStore.load();
  24382. }
  24383. else {
  24384. if (me.groupField) {
  24385. console.log('groupField', storeOption.groupField);
  24386. storeOption.groupField = me.groupField;
  24387. }
  24388. me.setStore(new Ext.data.Store(storeOption));
  24389. }
  24390. }
  24391. function initStores () {
  24392. Ext.define('Yvan.JsonAjaxProxy', {
  24393. extend: 'Ext.data.proxy.Ajax',
  24394. alias: 'proxy.jsonAjax',
  24395. actionMethods: {
  24396. create: "POST",
  24397. read: "POST",
  24398. update: "POST",
  24399. destroy: "POST"
  24400. },
  24401. timeout: storeAjax.timeout,
  24402. buildRequest: function (operation) {
  24403. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  24404. var me = this;
  24405. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  24406. var scope = lookupScope($owner);
  24407. var gridParam = me.getParams(operation);
  24408. var customParam = {};
  24409. // 提取 srot 元素
  24410. if (gridParam.sort) {
  24411. var sort = JSON.parse(gridParam.sort);
  24412. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  24413. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  24414. customParam.sortModel = [];
  24415. _$2.forEach(sort, function (s) {
  24416. customParam.sortModel.push({
  24417. colId: s.property,
  24418. sort: _$2.toLower(s.direction)
  24419. });
  24420. });
  24421. delete gridParam.sort;
  24422. }
  24423. // 提取筛选元素
  24424. if (gridParam.filter) {
  24425. var filter = JSON.parse(gridParam.filter);
  24426. console.log('gridParam.filter', gridParam.filter);
  24427. // "[{"operator":"like","value":"1","property":"id"}]"
  24428. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  24429. customParam.filterModel = {};
  24430. _$2.forEach(filter, function (s) {
  24431. var newFilterItem = {};
  24432. if (s.operator === 'like') {
  24433. newFilterItem.filterType = 'text';
  24434. newFilterItem.type = 'contains';
  24435. newFilterItem.filter = s.value;
  24436. }
  24437. else {
  24438. // 无法识别的筛选类型
  24439. newFilterItem.filterType = 'dict';
  24440. newFilterItem.type = 'in';
  24441. newFilterItem.filter = s.value;
  24442. }
  24443. customParam.filterModel[s.property] = newFilterItem;
  24444. });
  24445. delete gridParam.filter;
  24446. }
  24447. // 被 grid.constructor 作为方法存在
  24448. var extraParams = _$2.cloneDeep(me.getExtraParams());
  24449. var params = _$2.defaultsDeep(gridParam, extraParams);
  24450. // var request = this.superclass.buildRequest.apply(this, arguments);
  24451. var request = new Ext.data.Request({
  24452. params: {},
  24453. action: operation.getAction(),
  24454. records: operation.getRecords(),
  24455. url: me.buildUrl(),
  24456. jsonData: __assign({ args: [
  24457. params
  24458. ] }, customParam),
  24459. proxy: me
  24460. });
  24461. operation.setRequest(request);
  24462. return request;
  24463. },
  24464. afterRequest: function (req, res) {
  24465. // Extend.afterExtRequest(req, res)
  24466. }
  24467. });
  24468. Ext.define('Ext.ux.data.MyReader', {
  24469. extend: 'Ext.data.reader.Json',
  24470. xtype: 'yvgridreader',
  24471. useSimpleAccessors: false,
  24472. });
  24473. }
  24474. function initBehaviorEdit(config) {
  24475. var _a, _b, _c;
  24476. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  24477. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  24478. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  24479. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  24480. if (dbTableName) {
  24481. // 生成增删查改
  24482. var tbar = [
  24483. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  24484. click: 'system.saveGridRow()'
  24485. }, bind: {
  24486. disabled: '{!' + config.reference + '.ischanged}'
  24487. } }, saveButtonConfig),
  24488. '-',
  24489. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  24490. click: 'system.insertGridRow()'
  24491. } }, addButtonConfig),
  24492. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  24493. click: 'system.removeGridRow()'
  24494. } }, deleteButtonConfig),
  24495. ];
  24496. if (_$2.isArray(config.tbar)) {
  24497. config.tbar = __spread(tbar, [
  24498. '-'
  24499. ], config.tbar);
  24500. }
  24501. else if (_$2.isPlainObject(config.tbar)) {
  24502. config.tbar = {
  24503. border: false,
  24504. layout: {
  24505. type: 'vbox',
  24506. align: 'stretch'
  24507. },
  24508. items: [
  24509. {
  24510. xtype: 'toolbar',
  24511. border: false,
  24512. items: tbar
  24513. },
  24514. config.tbar,
  24515. ]
  24516. };
  24517. }
  24518. else if (_$2.isUndefined(config.tbar)) {
  24519. config.tbar = tbar;
  24520. }
  24521. else {
  24522. console.error("can't build tbar property!", config.tbar);
  24523. }
  24524. }
  24525. }
  24526. function initGridDialog(config) {
  24527. var detailDialog = _$2.get(config, 'detailDialog');
  24528. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  24529. if (_$2.isPlainObject(detailDialog)) {
  24530. var tbar = [
  24531. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  24532. click: 'system.showGridRowDetail()',
  24533. }, bind: {
  24534. disabled: '{!' + config.reference + '.selection}'
  24535. } }, detailButtonConfig)
  24536. ];
  24537. if (_$2.isArray(config.tbar)) {
  24538. config.tbar = __spread(config.tbar, [
  24539. '-'
  24540. ], tbar);
  24541. }
  24542. else if (_$2.isPlainObject(config.tbar)) {
  24543. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  24544. config.tbar.items = __spread(config.tbar.items);
  24545. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  24546. if (!toolbar) {
  24547. config.tbar.items = __spread(config.tbar.items, [
  24548. {
  24549. xtype: 'toolbar',
  24550. border: false,
  24551. items: tbar
  24552. },
  24553. ]);
  24554. }
  24555. else {
  24556. toolbar.items = __spread(toolbar.items, [
  24557. '-'
  24558. ], tbar);
  24559. }
  24560. }
  24561. else {
  24562. config.tbar = {
  24563. border: false,
  24564. layout: {
  24565. type: 'vbox',
  24566. align: 'stretch'
  24567. },
  24568. items: [
  24569. {
  24570. xtype: 'toolbar',
  24571. border: false,
  24572. items: tbar
  24573. },
  24574. config.tbar,
  24575. ]
  24576. };
  24577. }
  24578. }
  24579. else if (_$2.isUndefined(config.tbar)) {
  24580. config.tbar = tbar;
  24581. }
  24582. else {
  24583. console.error("can't build tbar property!", config.tbar);
  24584. }
  24585. }
  24586. }
  24587. var SystemEventFu$1 = /** @class */ (function () {
  24588. function SystemEventFu() {
  24589. }
  24590. SystemEventFu.prototype.showGridRowDetail = function () {
  24591. return function (sender) {
  24592. var grid1 = sender.up('yvgrid');
  24593. showGridRowDetail(grid1);
  24594. };
  24595. };
  24596. __decorate([
  24597. Lib({
  24598. title: '为某个表格所选数据行, 显示其对话框',
  24599. author: '罗一帆',
  24600. createAt: '2022-07-27',
  24601. updateAt: '2022-07-27',
  24602. type: 'system',
  24603. category: '表格',
  24604. }),
  24605. __metadata("design:type", Function),
  24606. __metadata("design:paramtypes", []),
  24607. __metadata("design:returntype", void 0)
  24608. ], SystemEventFu.prototype, "showGridRowDetail", null);
  24609. return SystemEventFu;
  24610. }());
  24611. function showGridRowDetail(grid1, isEdit) {
  24612. if (isEdit === void 0) { isEdit = true; }
  24613. var _a, _b, _c;
  24614. if (!grid1.selection) {
  24615. msg$1('请选中要展示的数据行!');
  24616. return;
  24617. }
  24618. var record = grid1.selection;
  24619. if (_$2.isArray(record)) {
  24620. record = record[0];
  24621. }
  24622. if (!record) {
  24623. msg$1('请选中要展示的数据行!');
  24624. return;
  24625. }
  24626. var config = grid1._originVJson;
  24627. var detailDialog = config.detailDialog;
  24628. var vjson = {};
  24629. var parentScope = lookupScope(grid1);
  24630. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  24631. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  24632. _$2.defaultsDeep(vjson, {
  24633. // 强制属性
  24634. layout: 'fit',
  24635. __custom_path: __custom_path,
  24636. __custom_version: __custom_version,
  24637. fbar: __spread([
  24638. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  24639. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  24640. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  24641. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  24642. }, detailDialog, {
  24643. // 默认属性
  24644. width: 800,
  24645. height: 450,
  24646. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  24647. });
  24648. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  24649. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  24650. vjson.items.push(tabpanel);
  24651. if (tabpanel) {
  24652. // 有多个选项卡,按每个选项卡进行过滤
  24653. _$2.forEach(tabpanel.items, function (tab) {
  24654. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  24655. if (tabColumns.length > 0) {
  24656. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  24657. _$2.extend(tab, tabVjson);
  24658. }
  24659. });
  24660. }
  24661. }
  24662. else {
  24663. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  24664. }
  24665. var model = {
  24666. data: {
  24667. _edit: isEdit,
  24668. _editType: isEdit ? '编辑' : '添加',
  24669. }
  24670. };
  24671. _$2.forOwn(record.data, function (value, key) {
  24672. if (key === 'id') {
  24673. // 忽略 ID 属性
  24674. return;
  24675. }
  24676. if (_$2.startsWith(key, '_')) {
  24677. // 忽略 _ 开头的所有属性
  24678. return;
  24679. }
  24680. model.data[key] = value;
  24681. });
  24682. console.log(vjson);
  24683. var scope = new Scope({ vjson: vjson, model: model, });
  24684. //@ts-ignore
  24685. scope.commit = function () {
  24686. return new Promise(function (resolve) {
  24687. _$2.forOwn(scope.viewModel.data, function (value, key) {
  24688. if (_$2.startsWith(key, '_')) {
  24689. // _origin 等属性可以被忽略
  24690. return;
  24691. }
  24692. if (key === 'id') {
  24693. // id 属性被忽略
  24694. return;
  24695. }
  24696. record.set(key, value);
  24697. });
  24698. resolve();
  24699. });
  24700. };
  24701. scope.showDialog(grid1, {}, {});
  24702. }
  24703. function buildForm(columns, tabpanel, detailDialog) {
  24704. var vjson = __assign({ border: false, layout: {
  24705. type: 'vbox',
  24706. pack: 'start',
  24707. align: 'stretch'
  24708. }, defaults: {
  24709. border: false,
  24710. anchor: '100%',
  24711. margin: '5',
  24712. }, scrollable: true, items: [] }, detailDialog.form);
  24713. var emptyFieldset = [];
  24714. var fieldsetList = [];
  24715. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  24716. _$2.forEach(columns, function (c) {
  24717. var fieldset = _$2.get(c, 'form.fieldset');
  24718. if (fieldset) {
  24719. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  24720. if (idx < 0) {
  24721. fieldsetList.push({
  24722. fieldset: fieldset,
  24723. columns: [c]
  24724. });
  24725. }
  24726. else {
  24727. fieldsetList[idx].columns.push(c);
  24728. }
  24729. }
  24730. else {
  24731. emptyFieldset.push(c);
  24732. }
  24733. });
  24734. _$2.forEach(fieldsetList, function (fs) {
  24735. var fieldSetVjson = {
  24736. xtype: 'fieldset',
  24737. title: fs.fieldset,
  24738. items: []
  24739. };
  24740. buildFieldItems(fieldSetVjson.items, fs.columns);
  24741. vjson.items.push(fieldSetVjson);
  24742. });
  24743. buildFieldItems(vjson.items, emptyFieldset);
  24744. return vjson;
  24745. }
  24746. // 构建字段组
  24747. function buildFieldItems(items, columns) {
  24748. var _a, _b, _c, _d, _e;
  24749. var row = {
  24750. xtype: 'cols',
  24751. items: []
  24752. };
  24753. for (var i = 0; i < columns.length; i++) {
  24754. var column = columns[i];
  24755. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  24756. delete row.xtype;
  24757. row.layout = column.form.rowlayout;
  24758. }
  24759. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  24760. row.items.push({ border: false, flex: column.form.prefix });
  24761. }
  24762. var fieldVjson = buildField(column, row.items.length);
  24763. if (!fieldVjson) {
  24764. continue;
  24765. }
  24766. row.items.push(fieldVjson);
  24767. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  24768. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  24769. }
  24770. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  24771. items.push(row);
  24772. row = {
  24773. xtype: 'cols',
  24774. items: []
  24775. };
  24776. }
  24777. }
  24778. if (row.items.length > 0) {
  24779. items.push(row);
  24780. }
  24781. }
  24782. // 构建字段
  24783. function buildField(column, colIdx) {
  24784. var ret;
  24785. if (column.xtype === 'checkcolumn') {
  24786. ret = _$2.defaultsDeep({
  24787. xtype: 'checkbox',
  24788. uncheckedValue: column.uncheckedValue,
  24789. checkedValue: column.checkedValue,
  24790. boxLabel: column.header,
  24791. bind: {
  24792. value: '{' + column.dataIndex + '}'
  24793. }
  24794. }, column.form);
  24795. if (colIdx == 0) {
  24796. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  24797. ret.margin = '0 0 0 85';
  24798. }
  24799. }
  24800. else {
  24801. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  24802. fieldLabel: column.header,
  24803. bind: {
  24804. value: '{' + column.dataIndex + '}'
  24805. },
  24806. });
  24807. }
  24808. if (!ret.xtype) {
  24809. return;
  24810. }
  24811. if (!ret.dict && ret.xtype === 'combo') {
  24812. ret.dict = column.dict;
  24813. }
  24814. // 删除辅助属性
  24815. delete ret.order;
  24816. delete ret.wrap;
  24817. return ret;
  24818. }
  24819. var model$o = {
  24820. data: {}
  24821. };
  24822. var vjson$o = {
  24823. title: '自定义表格属性',
  24824. layout: 'fit',
  24825. width: 980,
  24826. height: 500,
  24827. fbar: [
  24828. {
  24829. xtype: "button",
  24830. text: "保存",
  24831. iconCls: 'x-fa fa-save',
  24832. listeners: {
  24833. click: 'scope.commit',
  24834. }
  24835. },
  24836. {
  24837. xtype: "button",
  24838. text: "关闭",
  24839. iconCls: 'x-fa fa-times',
  24840. listeners: {
  24841. click: 'system.closeMe()',
  24842. }
  24843. },
  24844. ],
  24845. items: [
  24846. {
  24847. region: 'center',
  24848. xtype: 'tabpanel',
  24849. items: [
  24850. {
  24851. title: '基本信息', reference: 'basic',
  24852. layout: {
  24853. type: 'vbox',
  24854. pack: 'start',
  24855. align: 'stretch'
  24856. },
  24857. defaults: {
  24858. border: false,
  24859. anchor: '100%',
  24860. margin: '5',
  24861. },
  24862. scrollable: true,
  24863. items: [
  24864. {
  24865. xtype: 'cols',
  24866. items: [
  24867. {
  24868. fieldLabel: '路径',
  24869. bind: { value: '{__custom_path}' },
  24870. xtype: 'textfield',
  24871. flex: 2,
  24872. },
  24873. {
  24874. fieldLabel: '版本',
  24875. bind: { value: '{__custom_version}' },
  24876. xtype: 'textfield',
  24877. },
  24878. ]
  24879. },
  24880. {
  24881. xtype: 'cols',
  24882. items: [
  24883. {
  24884. fieldLabel: '配置点',
  24885. bind: { value: '{__custom_point}' },
  24886. xtype: 'textfield',
  24887. },
  24888. {
  24889. fieldLabel: 'reference',
  24890. bind: { value: '{reference}' },
  24891. xtype: 'textfield',
  24892. },
  24893. {
  24894. fieldLabel: '编辑模式',
  24895. bind: { value: '{_mode}' },
  24896. xtype: 'combo',
  24897. dict: 'GRID_MODE',
  24898. },
  24899. ]
  24900. },
  24901. {
  24902. layout: 'hbox',
  24903. defaults: {
  24904. margin: '0 0 0 15',
  24905. },
  24906. items: [
  24907. {
  24908. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  24909. bind: {
  24910. value: "{hideFootbar}"
  24911. }
  24912. },
  24913. {
  24914. boxLabel: '隐藏刷新', xtype: 'checkbox',
  24915. bind: {
  24916. value: "{hideRefresh}"
  24917. }
  24918. },
  24919. {
  24920. boxLabel: '隐藏导出', xtype: 'checkbox',
  24921. bind: {
  24922. value: "{hideExport}"
  24923. }
  24924. },
  24925. {
  24926. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  24927. bind: {
  24928. value: "{hideAutoSize}"
  24929. }
  24930. },
  24931. {
  24932. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  24933. bind: {
  24934. value: "{hideClearFilter}"
  24935. }
  24936. },
  24937. {
  24938. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  24939. bind: {
  24940. value: "{hideSaveGridUIConfig}"
  24941. }
  24942. },
  24943. {
  24944. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  24945. bind: {
  24946. value: "{hideClearGridUIConfig}"
  24947. }
  24948. },
  24949. ]
  24950. },
  24951. {
  24952. layout: 'hbox',
  24953. defaults: {
  24954. margin: '0 0 0 15',
  24955. },
  24956. items: [
  24957. {
  24958. boxLabel: '自动载入数据源', xtype: 'checkbox',
  24959. bind: { value: '{autoLoad}' },
  24960. margin: '0 0 0 85',
  24961. },
  24962. {
  24963. boxLabel: '分页模式', xtype: 'checkbox',
  24964. bind: { value: '{pagination}' },
  24965. },
  24966. {
  24967. boxLabel: '显示行序号', xtype: 'checkbox',
  24968. bind: { value: '{show_rownum}' },
  24969. },
  24970. {
  24971. boxLabel: '后端排序', xtype: 'checkbox',
  24972. bind: {
  24973. value: "{remoteSort}"
  24974. }
  24975. },
  24976. {
  24977. boxLabel: '后端过滤', xtype: 'checkbox',
  24978. bind: {
  24979. value: "{remoteFilter}"
  24980. }
  24981. },
  24982. {
  24983. boxLabel: '隐藏', xtype: 'checkbox',
  24984. bind: {
  24985. value: "{hidden}"
  24986. }
  24987. },
  24988. ]
  24989. },
  24990. {
  24991. layout: 'hbox',
  24992. defaults: {
  24993. margin: '0 0 0 15',
  24994. },
  24995. items: [
  24996. {
  24997. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  24998. bind: {
  24999. value: "{enableColumnHide}"
  25000. }
  25001. },
  25002. {
  25003. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  25004. bind: {
  25005. value: "{enableColumnMove}"
  25006. }
  25007. },
  25008. {
  25009. boxLabel: '自定义筛选', xtype: 'checkbox',
  25010. bind: {
  25011. value: "{gridfilters}"
  25012. }
  25013. },
  25014. {
  25015. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  25016. bind: {
  25017. value: "{enableColumnResize}"
  25018. }
  25019. },
  25020. {
  25021. boxLabel: '点击列头排序', xtype: 'checkbox',
  25022. bind: {
  25023. value: "{sortOnClick}"
  25024. }
  25025. },
  25026. ]
  25027. },
  25028. {
  25029. xtype: 'cols',
  25030. items: [
  25031. {
  25032. fieldLabel: 'dbTableName',
  25033. labelWidth: 110,
  25034. bind: { value: '{behavior.dbTableName}' },
  25035. xtype: 'textfield',
  25036. },
  25037. {
  25038. fieldLabel: 'theid',
  25039. bind: { value: '{theid}' },
  25040. xtype: 'textfield',
  25041. },
  25042. {
  25043. fieldLabel: '添加行聚焦',
  25044. bind: { value: '{behavior.focusColumnAfterInsert}' },
  25045. xtype: 'textfield',
  25046. },
  25047. ]
  25048. },
  25049. {
  25050. xtype: 'cols',
  25051. items: [
  25052. {
  25053. fieldLabel: '批量删除提示',
  25054. labelWidth: 110,
  25055. bind: { value: '{behavior.batchRemoveConfirm}' },
  25056. xtype: 'textfield',
  25057. },
  25058. {
  25059. fieldLabel: '删除提示',
  25060. bind: { value: '{behavior.singleRemoveConfirm}' },
  25061. xtype: 'textfield',
  25062. },
  25063. {
  25064. fieldLabel: '触发刷新',
  25065. labelWidth: 110,
  25066. bind: { value: '{behavior.selectToReload}' },
  25067. xtype: 'textfield',
  25068. },
  25069. ]
  25070. },
  25071. ]
  25072. },
  25073. {
  25074. title: '字段', reference: 'grid1',
  25075. xtype: 'yvgrid',
  25076. pagination: false,
  25077. _mode: 'edit',
  25078. listeners: {
  25079. buttonclick: 'scope.grid1Buttonclick',
  25080. },
  25081. hideFootbar: true,
  25082. tbar: [
  25083. {
  25084. xtype: 'button',
  25085. text: '添加',
  25086. iconCls: 'x-fa fa-plus-circle',
  25087. listeners: {
  25088. click: 'scope.addField'
  25089. }
  25090. },
  25091. {
  25092. xtype: 'button',
  25093. text: '删除',
  25094. iconCls: 'x-fa fa-minus-circle',
  25095. listeners: {
  25096. click: 'scope.removeField'
  25097. }
  25098. },
  25099. '-',
  25100. {
  25101. xtype: 'button',
  25102. text: '自动分析',
  25103. iconCls: 'x-fa fa-code-fork',
  25104. listeners: {
  25105. click: 'scope.calcField'
  25106. }
  25107. },
  25108. {
  25109. xtype: 'button',
  25110. text: '上移',
  25111. iconCls: 'x-fa fa-arrow-up',
  25112. listeners: {
  25113. click: 'scope.moveUp'
  25114. }
  25115. },
  25116. {
  25117. xtype: 'button',
  25118. text: '下移',
  25119. iconCls: 'x-fa fa-arrow-down',
  25120. listeners: {
  25121. click: 'scope.moveDown'
  25122. }
  25123. },
  25124. ],
  25125. store: {},
  25126. columns: [
  25127. {
  25128. dataIndex: 'dataIndex', header: "字段名", width: 140,
  25129. editor: { xtype: 'textfield' }
  25130. },
  25131. {
  25132. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  25133. editor: { xtype: 'textfield' }
  25134. },
  25135. {
  25136. dataIndex: 'header', header: '中文', width: 140,
  25137. editor: { xtype: 'textfield' }
  25138. },
  25139. {
  25140. dataIndex: 'dict', header: '字典', width: 110,
  25141. editor: { xtype: 'combogrid' }
  25142. },
  25143. {
  25144. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  25145. editor: { xtype: 'combogrid' }, hidden: true,
  25146. },
  25147. {
  25148. dataIndex: 'width', header: '宽度', width: 80,
  25149. editor: { xtype: 'numberfield' }, hidden: true,
  25150. },
  25151. {
  25152. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  25153. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  25154. },
  25155. {
  25156. dataIndex: 'serverCreateValue', header: '服务端创建值',
  25157. editor: { xtype: 'textfield' },
  25158. },
  25159. {
  25160. dataIndex: 'createValue', text: '客户端新创建值',
  25161. editor: { xtype: 'textfield' },
  25162. },
  25163. {
  25164. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  25165. resizable: false, sortable: false, menuDisabled: true,
  25166. checkedValue: true, uncheckedValue: false,
  25167. },
  25168. {
  25169. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  25170. resizable: false, sortable: false, menuDisabled: true,
  25171. checkedValue: true, uncheckedValue: false,
  25172. },
  25173. {
  25174. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  25175. resizable: false, sortable: false, menuDisabled: true,
  25176. checkedValue: true, uncheckedValue: false,
  25177. },
  25178. {
  25179. dataIndex: 'formatter', header: '格式化', width: 110,
  25180. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  25181. },
  25182. {
  25183. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  25184. resizable: false, sortable: false, menuDisabled: true,
  25185. checkedValue: true, uncheckedValue: false, hidden: true,
  25186. },
  25187. {
  25188. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  25189. resizable: false, sortable: false, menuDisabled: true,
  25190. hidden: true,
  25191. },
  25192. {
  25193. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  25194. resizable: false, sortable: false, menuDisabled: true,
  25195. checkedValue: true, uncheckedValue: false, hidden: true,
  25196. },
  25197. {
  25198. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  25199. resizable: false, sortable: false, menuDisabled: true,
  25200. },
  25201. {
  25202. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  25203. resizable: false, sortable: false, menuDisabled: true,
  25204. checkedValue: true, uncheckedValue: false, hidden: true,
  25205. },
  25206. {
  25207. dataIndex: 'form_order', text: '对话框序号',
  25208. editor: { xtype: 'numberfield' },
  25209. },
  25210. {
  25211. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  25212. resizable: false, sortable: false, menuDisabled: true,
  25213. checkedValue: true, uncheckedValue: false,
  25214. },
  25215. {
  25216. dataIndex: 'form_xtype', text: '对话框编辑器',
  25217. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  25218. },
  25219. {
  25220. dataIndex: 'form_fieldset', text: '对话框字段组',
  25221. editor: { xtype: 'textfield' }, hidden: true,
  25222. },
  25223. {
  25224. dataIndex: 'form_tab', text: '对话框选项卡',
  25225. editor: { xtype: 'textfield' }, hidden: true,
  25226. },
  25227. {
  25228. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  25229. resizable: false, sortable: false, menuDisabled: true,
  25230. checkedValue: true, uncheckedValue: false, hidden: true,
  25231. },
  25232. ],
  25233. },
  25234. {
  25235. title: 'SQL和查询条件', reference: 'sql',
  25236. layout: 'border',
  25237. border: false,
  25238. items: [
  25239. {
  25240. region: 'north',
  25241. height: 200,
  25242. border: false,
  25243. split: true,
  25244. xtype: 'yvgrid',
  25245. reference: 'gridCondition',
  25246. pagination: false,
  25247. hideFootbar: true,
  25248. _mode: 'edit',
  25249. listeners: {
  25250. buttonclick: 'scope.conditionButtonclick',
  25251. },
  25252. store: {},
  25253. tbar: {
  25254. xtype: 'toolbar',
  25255. border: false,
  25256. items: [
  25257. {
  25258. xtype: 'button',
  25259. text: '添加条件',
  25260. iconCls: 'x-fa fa-plus-circle',
  25261. listeners: {
  25262. click: 'scope.addCondition'
  25263. }
  25264. },
  25265. {
  25266. xtype: 'button',
  25267. text: '删除条件',
  25268. iconCls: 'x-fa fa-minus-circle',
  25269. listeners: {
  25270. click: 'scope.removeCondition'
  25271. }
  25272. },
  25273. '-',
  25274. {
  25275. xtype: 'button',
  25276. text: '自动分析条件变量',
  25277. iconCls: 'x-fa fa-code-fork',
  25278. listeners: {
  25279. click: 'scope.calcCondition'
  25280. }
  25281. },
  25282. {
  25283. xtype: 'button',
  25284. text: '上移',
  25285. iconCls: 'x-fa fa-arrow-up',
  25286. listeners: {
  25287. click: 'scope.moveUpCondition'
  25288. }
  25289. },
  25290. {
  25291. xtype: 'button',
  25292. text: '下移',
  25293. iconCls: 'x-fa fa-arrow-down',
  25294. listeners: {
  25295. click: 'scope.moveDownCondition'
  25296. }
  25297. },
  25298. ]
  25299. },
  25300. columns: [
  25301. {
  25302. text: '条件变量',
  25303. dataIndex: 'param_name',
  25304. width: 140,
  25305. sortable: false,
  25306. menuDisabled: true,
  25307. editor: {
  25308. selectOnFocus: true
  25309. },
  25310. },
  25311. {
  25312. text: '中文标题',
  25313. dataIndex: 'fieldLabel',
  25314. width: 120,
  25315. sortable: false,
  25316. menuDisabled: true,
  25317. editor: {
  25318. selectOnFocus: true
  25319. },
  25320. },
  25321. {
  25322. text: '编辑类型',
  25323. dataIndex: 'xtype',
  25324. width: 80,
  25325. sortable: false,
  25326. menuDisabled: true,
  25327. editor: {
  25328. xtype: 'combo',
  25329. typeAhead: true,
  25330. triggerAction: 'all',
  25331. selectOnFocus: true,
  25332. store: [
  25333. ['textfield', 'textfield'],
  25334. ['combo', 'combo'],
  25335. ['datefield', 'datefield'],
  25336. ['datetimefield', 'datetimefield'],
  25337. ['numberfield', 'numberfield'],
  25338. ['multiplesearch', 'multiplesearch'],
  25339. ]
  25340. }
  25341. },
  25342. {
  25343. text: '权重',
  25344. dataIndex: 'conditionFieldFlex',
  25345. align: 'right',
  25346. width: 60,
  25347. sortable: false,
  25348. menuDisabled: true,
  25349. editor: {
  25350. xtype: 'numberfield',
  25351. selectOnFocus: false,
  25352. minValue: 0,
  25353. maxValue: 10
  25354. },
  25355. },
  25356. {
  25357. text: '字典',
  25358. dataIndex: 'conditionFieldDict',
  25359. width: 160,
  25360. sortable: false,
  25361. menuDisabled: true,
  25362. editor: {
  25363. selectOnFocus: false
  25364. },
  25365. },
  25366. {
  25367. xtype: 'checkcolumn',
  25368. dataIndex: "conditionFieldWrap", header: "换行",
  25369. width: 65,
  25370. sortable: false,
  25371. menuDisabled: true,
  25372. },
  25373. {
  25374. text: '扩展参数',
  25375. dataIndex: 'conditionFieldExtend',
  25376. sortable: false,
  25377. menuDisabled: true,
  25378. editor: {
  25379. selectOnFocus: false
  25380. },
  25381. },
  25382. ]
  25383. },
  25384. {
  25385. region: 'center',
  25386. xtype: 'sqleditor',
  25387. layout: 'fit',
  25388. reference: 'sqlEditor',
  25389. split: true,
  25390. },
  25391. ]
  25392. },
  25393. {
  25394. title: '详情对话框',
  25395. layout: {
  25396. type: 'vbox',
  25397. pack: 'start',
  25398. align: 'stretch'
  25399. },
  25400. defaults: {
  25401. border: false,
  25402. anchor: '100%',
  25403. margin: '5',
  25404. },
  25405. scrollable: true,
  25406. items: [
  25407. {
  25408. xtype: 'cols',
  25409. items: [
  25410. {
  25411. fieldLabel: '对话框标题',
  25412. bind: { value: '{detailDialog.title}' },
  25413. xtype: 'textfield',
  25414. flex: 2,
  25415. },
  25416. {
  25417. fieldLabel: '宽度',
  25418. bind: { value: '{detailDialog.width}' },
  25419. xtype: 'numberfield',
  25420. },
  25421. {
  25422. fieldLabel: '高度',
  25423. bind: { value: '{detailDialog.height}' },
  25424. xtype: 'numberfield',
  25425. },
  25426. ]
  25427. },
  25428. ]
  25429. },
  25430. {
  25431. title: '界面源码',
  25432. xtype: 'jseditor',
  25433. reference: 'jseditor'
  25434. }
  25435. ]
  25436. }
  25437. ]
  25438. };
  25439. var GridColumnCustom = /** @class */ (function (_super) {
  25440. __extends(GridColumnCustom, _super);
  25441. function GridColumnCustom() {
  25442. return _super.call(this, { model: model$o, vjson: vjson$o }) || this;
  25443. }
  25444. GridColumnCustom.prototype.commit = function () {
  25445. };
  25446. GridColumnCustom.prototype.grid1Buttonclick = function () {
  25447. };
  25448. GridColumnCustom.prototype.conditionButtonclick = function () {
  25449. };
  25450. GridColumnCustom.prototype.addField = function () {
  25451. };
  25452. GridColumnCustom.prototype.removeField = function () {
  25453. };
  25454. GridColumnCustom.prototype.calcField = function () {
  25455. };
  25456. GridColumnCustom.prototype.moveUp = function () {
  25457. };
  25458. GridColumnCustom.prototype.moveDown = function () {
  25459. };
  25460. GridColumnCustom.prototype.addCondition = function () {
  25461. };
  25462. GridColumnCustom.prototype.removeCondition = function () {
  25463. };
  25464. GridColumnCustom.prototype.calcCondition = function () {
  25465. };
  25466. GridColumnCustom.prototype.moveUpCondition = function () {
  25467. };
  25468. GridColumnCustom.prototype.moveDownCondition = function () {
  25469. };
  25470. return GridColumnCustom;
  25471. }(Scope));
  25472. function initGridCode(grid, newConfig, buttons) {
  25473. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  25474. buttons.push({
  25475. xtype: 'button',
  25476. tooltip: '定义表格属性',
  25477. iconCls: 'x-fa fa-codepen',
  25478. handler: function (btn) {
  25479. var customWindow = new GridColumnCustom();
  25480. customWindow.showDialog(btn, {}, {});
  25481. }
  25482. });
  25483. buttons.push({
  25484. xtype: 'button',
  25485. tooltip: '定义表格数据源',
  25486. iconCls: 'x-fa fa-database',
  25487. handler: function () {
  25488. // showCustomGridDataSource(grid)
  25489. }
  25490. });
  25491. }
  25492. }
  25493. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  25494. var hexToString = function (hex) {
  25495. var arr = hex.split("");
  25496. var out = "";
  25497. for (var i = 0; i < arr.length / 2; i++) {
  25498. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  25499. // @ts-ignore
  25500. var charValue = String.fromCharCode(tmp);
  25501. out += charValue;
  25502. }
  25503. return out;
  25504. };
  25505. var defaultGrid = grid;
  25506. function initGrid () {
  25507. Ext.define('Yvan.Grid', {
  25508. extend: 'Ext.grid.Panel',
  25509. xtype: 'yvgrid',
  25510. __suspendReload: false,
  25511. _originVJson: {},
  25512. constructor: function (config) {
  25513. var _this = this;
  25514. var _a, _b, _c, _d, _e, _f;
  25515. var me = this;
  25516. var dataSource = config.dataSource;
  25517. 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);
  25518. me._originVJson = config;
  25519. if (!isDesignMode(scope, config)) {
  25520. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  25521. if (Array.isArray(config.columns) && config.columns.length > 0) {
  25522. var cacheData = this.getColumnConfigCache();
  25523. if (Array.isArray(cacheData) && cacheData.length > 0) {
  25524. var newColumns = [];
  25525. for (var j = 0; j < cacheData.length; j++) {
  25526. var itData = cacheData[j];
  25527. for (var i = 0; i < config.columns.length; i++) {
  25528. var column = config.columns[i];
  25529. if (itData.dataIndex === column.dataIndex) {
  25530. if (itData.width) {
  25531. column.width = itData.width;
  25532. }
  25533. column.hidden = itData.hidden;
  25534. column.locked = itData.locked;
  25535. newColumns.push(column);
  25536. break;
  25537. }
  25538. }
  25539. }
  25540. config.columns = newColumns;
  25541. }
  25542. }
  25543. }
  25544. var newConfig = _$2.defaultsDeep({
  25545. // 强制性属性 bug.
  25546. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  25547. // enableLocking: false,
  25548. // syncRowHeight: false,
  25549. }, baseConfig(config, 'row-item'), config, grid);
  25550. // 在面板上的组件
  25551. // const scope = newConfig.$initParent?.yvanScope ||
  25552. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  25553. // config.$vmParent?.yvanScope ||
  25554. // newConfig.$vmParent?._parent?.yvanScope;
  25555. var buttons = [];
  25556. var getRowClass = newConfig.getRowClass;
  25557. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  25558. _$2.startsWith(getRowClass, "system."))) {
  25559. var fn = lookupFn(scope, getRowClass);
  25560. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  25561. }
  25562. if (!newConfig.hideExport) {
  25563. buttons.push({
  25564. xtype: 'button',
  25565. tooltip: '导出Excel',
  25566. iconCls: 'x-fa fa-download',
  25567. listeners: {
  25568. click: this.exportExcel
  25569. },
  25570. });
  25571. }
  25572. if (!newConfig.hideAutoSize) {
  25573. buttons.push({
  25574. xtype: 'button',
  25575. iconCls: 'x-fa fa-text-width',
  25576. tooltip: '自适应宽度',
  25577. listeners: {
  25578. click: this.autoSizeColumns
  25579. }
  25580. });
  25581. }
  25582. if (!newConfig.hideClearFilter) {
  25583. buttons.push({
  25584. xtype: 'button',
  25585. tooltip: '清空筛选',
  25586. iconCls: 'x-fa fa-filter',
  25587. handler: this.clearFilter
  25588. });
  25589. }
  25590. if (!newConfig.hideSaveGridUIConfig) {
  25591. buttons.push({
  25592. xtype: 'button',
  25593. tooltip: '保存布局',
  25594. iconCls: 'x-fa fa-cogs',
  25595. handler: this.saveGridUIConfig
  25596. });
  25597. }
  25598. if (!newConfig.hideClearGridUIConfig) {
  25599. buttons.push({
  25600. xtype: 'button',
  25601. tooltip: '还原布局',
  25602. iconCls: 'x-fa fa-reply-all',
  25603. handler: this.clearGridUIConfig
  25604. });
  25605. }
  25606. initGridCode(me, newConfig, buttons);
  25607. if (!newConfig.hideFootbar) {
  25608. if (newConfig.pagination) {
  25609. newConfig.bbar = new Ext.PagingToolbar({
  25610. // pageSize: newConfig.pageSize, 这个值是无效的
  25611. displayInfo: true,
  25612. store: this.store,
  25613. emptyMsg: '没有记录',
  25614. cls: 'grid-bbar',
  25615. items: __spread([
  25616. {
  25617. xtype: 'combobox',
  25618. tooltip: '分页',
  25619. queryMode: 'local',
  25620. editable: false,
  25621. allowBlank: true,
  25622. labelAlign: 'right',
  25623. width: 90,
  25624. // labelWidth: 30,
  25625. listConfig: {
  25626. minWidth: null
  25627. },
  25628. value: 50,
  25629. valueField: undefined,
  25630. displayField: undefined,
  25631. hideClear: true,
  25632. store: newConfig.pageSizeOption,
  25633. listeners: {
  25634. change: function (sender, nv, ov) {
  25635. _this.store.pageSize = nv;
  25636. _this.store.loadPage(1);
  25637. }
  25638. }
  25639. }
  25640. ], buttons),
  25641. doRefresh: function () {
  25642. me.reload();
  25643. }
  25644. });
  25645. }
  25646. else {
  25647. newConfig.bbar = {
  25648. xtype: 'toolbar', overflowHandler: 'menu',
  25649. cls: 'grid-bbar',
  25650. items: __spread([
  25651. {
  25652. xtype: 'button',
  25653. tooltip: '刷新',
  25654. iconCls: 'x-fa fa-refresh',
  25655. handler: function () {
  25656. _this.reload();
  25657. }
  25658. },
  25659. '-'
  25660. ], buttons)
  25661. };
  25662. if (newConfig.hideRefresh) {
  25663. newConfig.bbar.items.splice(0, 1);
  25664. }
  25665. }
  25666. }
  25667. if (_$2.isArray(newConfig.condition)) {
  25668. // 带查询条件
  25669. var conditionRows_1 = [];
  25670. var newRow_1 = false;
  25671. var currentRow_1 = { xtype: 'cols', items: [], };
  25672. conditionRows_1.push(currentRow_1);
  25673. _$2.forEach(newConfig.condition, function (item) {
  25674. var _a;
  25675. if (newRow_1) {
  25676. currentRow_1 = { xtype: 'cols', items: [], };
  25677. conditionRows_1.push(currentRow_1);
  25678. }
  25679. var vj = _$2.cloneDeep(item);
  25680. if (vj.xtype) {
  25681. if (item.xtype === 'combo' && item.dict) {
  25682. vj.fix = ['system.getDict("' + item.dict + '")'];
  25683. }
  25684. if (item.xtype === 'datetimefield') {
  25685. _$2.defer(function () {
  25686. //@ts-ignore
  25687. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  25688. });
  25689. }
  25690. else if (item.xtype === 'datefield') {
  25691. _$2.defer(function () {
  25692. //@ts-ignore
  25693. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  25694. });
  25695. }
  25696. else {
  25697. scope.viewModel.set(item.param_name, '');
  25698. }
  25699. }
  25700. else {
  25701. // 没有组件类型,是个空占位符
  25702. vj.border = false;
  25703. }
  25704. if (item.param_name) {
  25705. vj.bind = {
  25706. value: '{' + item.param_name + '}'
  25707. };
  25708. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  25709. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  25710. }
  25711. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  25712. currentRow_1.items.push(vj);
  25713. });
  25714. newConfig.tbar = {
  25715. xtype: 'form',
  25716. border: false,
  25717. items: conditionRows_1,
  25718. defaults: {
  25719. margin: '8 0 8 0'
  25720. },
  25721. };
  25722. console.log('newConfig', newConfig);
  25723. }
  25724. _$2.each(newConfig.columns, function (c) {
  25725. var renderer = c.renderer, formatter = c.formatter;
  25726. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  25727. _$2.startsWith(renderer, "system."))) {
  25728. if (newConfig.$initParent) {
  25729. if (scope) {
  25730. var rendererFn = lookupFn(scope, renderer);
  25731. c.renderer = rendererFn.bind(scope);
  25732. }
  25733. }
  25734. }
  25735. if (c.dict) {
  25736. c.fix = ['system.getDict("' + c.dict + '")'];
  25737. if (c.editor && c.editor.xtype === 'combo') {
  25738. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  25739. c.editor.typeAhead = true;
  25740. c.editor.triggerAction = 'all';
  25741. c.editor.selectOnFocus = false;
  25742. c.editor.listConfig = {
  25743. minWidth: 200
  25744. };
  25745. }
  25746. }
  25747. if (formatter === 'button') {
  25748. c.tdCls = 'td-btn';
  25749. if (!c.listeners) {
  25750. c.listeners = {};
  25751. }
  25752. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  25753. if ($(event.target).is('input')) {
  25754. me.fireEvent('buttonclick', me, this, record);
  25755. }
  25756. };
  25757. }
  25758. else if (formatter === 'percentRenderer') {
  25759. c.tdCls = 'td-percent';
  25760. }
  25761. });
  25762. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  25763. // 强制为编辑模式
  25764. newConfig.selModel = {
  25765. type: 'spreadsheet',
  25766. columnSelect: true,
  25767. pruneRemoved: false,
  25768. extensible: 'y'
  25769. };
  25770. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  25771. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  25772. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  25773. }
  25774. else {
  25775. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  25776. }
  25777. }
  25778. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  25779. // 强制为勾选模式
  25780. newConfig.selModel = {
  25781. type: 'checkboxmodel',
  25782. mode: 'MULTI',
  25783. };
  25784. }
  25785. else if (newConfig._mode === 'checkonly') {
  25786. newConfig.selModel = {
  25787. type: 'checkboxmodel',
  25788. mode: 'MULTI',
  25789. checkOnly: true,
  25790. };
  25791. }
  25792. else if (newConfig._mode === 'select') {
  25793. // 强制为选择模式
  25794. newConfig.selModel = {
  25795. selType: 'rowmodel',
  25796. mode: 'SINGLE',
  25797. };
  25798. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  25799. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  25800. }
  25801. }
  25802. initBehaviorEdit(newConfig);
  25803. initGridDialog(newConfig);
  25804. this.superclass.constructor.call(this, newConfig);
  25805. this.store.pageSize = newConfig.pageSize;
  25806. },
  25807. setData: function (value) {
  25808. var me = this;
  25809. me._setDataReal(value);
  25810. },
  25811. /**
  25812. * 添加行,并进入编辑状态
  25813. * @param record 新行的属性集
  25814. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  25815. */
  25816. appendEditRow: function (record, editRowCol) {
  25817. var records = this.getStore().add(record);
  25818. var recNew = records[0];
  25819. this.setSelection(records);
  25820. if (typeof editRowCol === 'string' && editRowCol) {
  25821. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  25822. }
  25823. if (typeof editRowCol === 'number') {
  25824. var ce = this.findPlugin('cellediting');
  25825. this.editingPlugin = ce;
  25826. ce.startEdit(recNew, editRowCol);
  25827. }
  25828. },
  25829. beginEdit: function (record, editRowCol) {
  25830. if (typeof record === 'number') {
  25831. record = this.store.data.getAt(record);
  25832. }
  25833. if (record.isEntity === true) {
  25834. this.setSelection([record]);
  25835. if (typeof editRowCol === 'string' && editRowCol) {
  25836. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  25837. }
  25838. if (typeof editRowCol === 'number') {
  25839. var ce = this.findPlugin('cellediting');
  25840. this.editingPlugin = ce;
  25841. ce.startEdit(record, editRowCol);
  25842. }
  25843. }
  25844. },
  25845. /**
  25846. * 移除行
  25847. * @param record 如果记录传空,就是当前选中的行
  25848. */
  25849. removeEditRow: function (record) {
  25850. if (!record) {
  25851. record = this.selection;
  25852. }
  25853. if (!record) {
  25854. msg('请选中要删除的行');
  25855. return;
  25856. }
  25857. this.getStore().remove(record);
  25858. },
  25859. /**
  25860. * 获取全部原始数据
  25861. */
  25862. getDataRows: function () {
  25863. return this.getStore().data.items.map(function (r) { return r.data; });
  25864. },
  25865. /**
  25866. * 获取全部原始数据, 不带 id/ 不带 origin
  25867. */
  25868. getDataRowsOnlyData: function () {
  25869. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  25870. delete r.id;
  25871. delete r._origin;
  25872. return r;
  25873. });
  25874. },
  25875. rowMoveUp: function () {
  25876. var grid = this;
  25877. if (!grid.selection) {
  25878. msg('无法对多行进行移动');
  25879. return;
  25880. }
  25881. var record = grid.selection;
  25882. if (_$2.isArray(record)) {
  25883. record = record[0];
  25884. }
  25885. if (!record) {
  25886. msg('无法对多行进行移动');
  25887. return;
  25888. }
  25889. // const records = grid.selModel.getSelection()
  25890. // if (records.length !== 1) {
  25891. // msg('无法对多行进行移动')
  25892. // return
  25893. // }
  25894. //
  25895. // const [record] = records
  25896. var index = grid.store.indexOf(record);
  25897. if (index > 0) {
  25898. grid.store.removeAt(index);
  25899. grid.store.insert(index - 1, record);
  25900. grid.getView().refresh();
  25901. grid.selModel.select([record]);
  25902. }
  25903. },
  25904. rowMoveDown: function () {
  25905. var grid = this;
  25906. // const records = grid.selModel.getSelection()
  25907. // if (records.length !== 1) {
  25908. // msg('无法对多行进行移动')
  25909. // return
  25910. // }
  25911. if (!grid.selection) {
  25912. msg('无法对多行进行移动');
  25913. return;
  25914. }
  25915. var record = grid.selection;
  25916. if (_$2.isArray(record)) {
  25917. record = record[0];
  25918. }
  25919. if (!record) {
  25920. msg('无法对多行进行移动');
  25921. return;
  25922. }
  25923. var index = grid.store.indexOf(record);
  25924. if (index < grid.store.getCount() - 1) {
  25925. grid.store.removeAt(index);
  25926. grid.store.insert(index + 1, record);
  25927. grid.getView().refresh();
  25928. grid.selModel.select([record]);
  25929. }
  25930. },
  25931. getEditRecord: function () {
  25932. var _a, _b;
  25933. var me = this;
  25934. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  25935. 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;
  25936. var record;
  25937. if (typeof rowIdx === 'undefined') {
  25938. record = me.getSelectionModel().getLastSelected();
  25939. }
  25940. else {
  25941. record = me.store.getAt(rowIdx);
  25942. }
  25943. return record;
  25944. },
  25945. getEditRow: function () {
  25946. var _a;
  25947. var me = this;
  25948. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  25949. },
  25950. setEditRow: function (rowValues) {
  25951. var me = this;
  25952. var record = me.getEditRecord();
  25953. if (record) {
  25954. _$2.forOwn(rowValues, function (v, k) {
  25955. record.set(k, v);
  25956. });
  25957. }
  25958. },
  25959. _transform: function (data) {
  25960. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  25961. _$2.forEach(data, function (row) {
  25962. row._origin = _$2.clone(row);
  25963. });
  25964. },
  25965. _setDataReal: function (value) {
  25966. var me = this;
  25967. this._transform(value);
  25968. var storeOpt = {
  25969. fields: getFileds(this),
  25970. data: value,
  25971. };
  25972. if (this.groupField) {
  25973. storeOpt.groupField = this.groupField;
  25974. }
  25975. var store = new Ext.data.Store(storeOpt);
  25976. me.setStore(store);
  25977. },
  25978. setStore: function (store) {
  25979. var me = this;
  25980. if (_$2.isArray(store)) {
  25981. var value = store;
  25982. this._transform(value);
  25983. var storeOpt = {
  25984. fields: getFileds(this),
  25985. data: value,
  25986. };
  25987. if (this.groupField) {
  25988. storeOpt.groupField = this.groupField;
  25989. }
  25990. store = new Ext.data.Store(storeOpt);
  25991. }
  25992. me.superclass.setStore.call(this, store);
  25993. var reference = this.reference;
  25994. if (reference) {
  25995. var scope = lookupScope(this);
  25996. scope.viewModel.set(reference + '.ischanged', false);
  25997. scope.viewModel.set(reference + '.theid', null);
  25998. scope.viewModel.set(reference + '.theid2', null);
  25999. scope.viewModel.set(reference + '.theid3', null);
  26000. }
  26001. if (store) {
  26002. store.on({
  26003. add: function (store, records, index, eOpts) {
  26004. me._raiseChange(store, 'add');
  26005. },
  26006. remove: function (store, records, index, isMove, eOpts) {
  26007. me._raiseChange(store, 'remove');
  26008. },
  26009. datachanged: function (sender, opt) {
  26010. me._raiseChange(store, 'datachanged');
  26011. }
  26012. });
  26013. }
  26014. },
  26015. _raiseChange: function (store, type) {
  26016. var _a, _b;
  26017. var reference = this.reference;
  26018. if (reference && store) {
  26019. var ischanged = false;
  26020. if (store.getModifiedRecords().length > 0 ||
  26021. store.getNewRecords().length > 0 ||
  26022. store.getRemovedRecords().length > 0) {
  26023. ischanged = true;
  26024. }
  26025. else {
  26026. ischanged = false;
  26027. }
  26028. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  26029. }
  26030. },
  26031. /**
  26032. * 轻量级刷新
  26033. */
  26034. refreshData: function () {
  26035. var store = this.getStore();
  26036. if (store) {
  26037. store.reload();
  26038. }
  26039. },
  26040. /**
  26041. * 为表格强制设置焦点
  26042. * @param seq 顺序号
  26043. */
  26044. focusRow: function (seq) {
  26045. this.setSelection(this.store.getAt(seq));
  26046. this.getView().focusRow(seq);
  26047. },
  26048. /**
  26049. * 重新载入数据(重新计算参数)
  26050. */
  26051. reload: function (reloadParams) {
  26052. if (reloadParams === void 0) { reloadParams = {}; }
  26053. var me = this;
  26054. var config = me.config;
  26055. if (config.dataSourceCallbackFn) {
  26056. // 函数请求刷新
  26057. var scope_1 = lookupScope(this);
  26058. _$2.defer(function () {
  26059. me.setLoading(true);
  26060. });
  26061. config.dataSourceCallbackFn.call(scope_1, me, {
  26062. successCallback: function (value) {
  26063. me._setDataReal(value);
  26064. _$2.defer(function () {
  26065. me.setLoading(false);
  26066. });
  26067. // 自动选中第一行
  26068. var data = me.getStore().data;
  26069. if (data.length > 0) {
  26070. me.setSelection(data.items[0]);
  26071. }
  26072. me.fireEvent('dataLoadComplete', me, true, value);
  26073. },
  26074. failCallback: function (error) {
  26075. _$2.defer(function () {
  26076. me.setLoading(false);
  26077. });
  26078. me.fireEvent('dataLoadComplete', me, false, error);
  26079. }
  26080. });
  26081. return;
  26082. }
  26083. // if (this.store) {
  26084. // this.store.reload({aaaa: 1, bbbb: 2})
  26085. // }
  26086. var dataSource = config.dataSource;
  26087. var scope = lookupScope(me);
  26088. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  26089. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  26090. }
  26091. },
  26092. exportCurrentExcelClick: function () {
  26093. var _a;
  26094. var me = this;
  26095. var config = me.config;
  26096. var scope = lookupScope(me);
  26097. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26098. if (excelFileName.endsWith(".xlsx")) {
  26099. excelFileName = excelFileName.split(".xlsx")[0];
  26100. }
  26101. excelFileName += ".xlsx";
  26102. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  26103. var excelData = me.makeExcelData(rowsAll);
  26104. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  26105. },
  26106. /**
  26107. * excel 导出
  26108. * excelExportParams 导出参数
  26109. * isContinue 是否继续导出
  26110. */
  26111. exportExcelClick: function (excelExportParams, isContinue) {
  26112. if (isContinue === void 0) { isContinue = false; }
  26113. var me = this;
  26114. var config = me.config;
  26115. excelExportParams.isExcelExport = true;
  26116. var scope = lookupScope(me);
  26117. var dataSource = config.dataSource;
  26118. var ep = function () {
  26119. scope.setLoading(true);
  26120. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  26121. var _a, _b, _c, _d;
  26122. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || me.exportExcelCurrentPage || 1;
  26123. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  26124. 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;
  26125. me.exportExcelCurrentPage = page;
  26126. me.exportExcelPageSize = size;
  26127. me.exportExcelTotal = total;
  26128. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26129. if (excelFileName.endsWith(".xlsx")) {
  26130. excelFileName = excelFileName.split(".xlsx")[0];
  26131. }
  26132. var pageExcelData = me.makeExcelData(responseData.data);
  26133. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  26134. excelFileName += ".xlsx";
  26135. LAY_EXCEL.exportExcel(pageExcelData, excelFileName, 'xlsx');
  26136. scope.setLoading(false);
  26137. if (page < total / size) {
  26138. page++;
  26139. me.exportExcelCurrentPage = page;
  26140. if (isContinue === true) {
  26141. excelExportParams.exportExcelCurrentPage = page;
  26142. ep();
  26143. }
  26144. }
  26145. });
  26146. };
  26147. ep();
  26148. },
  26149. exportBigExcelClick: function () {
  26150. var _a;
  26151. var me = this;
  26152. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  26153. showErrorDialog('当前表格不支持大批量导出');
  26154. return;
  26155. }
  26156. var config = me.config;
  26157. var scope = lookupScope(me);
  26158. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  26159. var head = [];
  26160. var dict = {};
  26161. _$2.forEach(me.columns, function (column) {
  26162. if (column.isHidden())
  26163. return;
  26164. if (!column.dataIndex)
  26165. return;
  26166. if (!column.text)
  26167. return;
  26168. head.push({ field: column.dataIndex, name: column.text });
  26169. if (column.dictForExcel) {
  26170. dict[column.dataIndex] = column.dictForExcel;
  26171. }
  26172. });
  26173. // 判断是否需要解密
  26174. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  26175. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  26176. me.dbInfo.password = hexToString(me.dbInfo.password);
  26177. me.dbInfo.username = hexToString(me.dbInfo.username);
  26178. }
  26179. scope.setLoading(true);
  26180. Ext.Ajax.request({
  26181. timeout: 15000,
  26182. url: window["EXPORT_DATA_HOST"],
  26183. method: "POST",
  26184. jsonData: {
  26185. file: excelFileName,
  26186. dbInfo: me.dbInfo,
  26187. exportDataSql: me.exportDataSql,
  26188. exportDataSqlParams: me.exportDataSqlParams,
  26189. head: head,
  26190. dict: dict,
  26191. },
  26192. }).then(function () {
  26193. scope.setLoading(false);
  26194. msg('请求成功');
  26195. }).catch(function () {
  26196. scope.setLoading(false);
  26197. showErrorDialog('请求失败,请确认是否已安装客户端');
  26198. });
  26199. },
  26200. makeExcelData: function (jsonData) {
  26201. var me = this;
  26202. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  26203. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  26204. return;
  26205. }
  26206. var data = [];
  26207. // 获取表格的列定义
  26208. var headerTextArr = [];
  26209. var headers = [];
  26210. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  26211. var header = me.headerCt.getGridColumns()[i];
  26212. if (!header.isHidden()) {
  26213. var textStr = _$2.trim(header.text);
  26214. var dataIndexStr = _$2.trim(header.dataIndex);
  26215. if (dataIndexStr) {
  26216. if (textStr === '') {
  26217. headerTextArr.push(dataIndexStr);
  26218. }
  26219. else {
  26220. headerTextArr.push(textStr);
  26221. }
  26222. headers.push(header);
  26223. }
  26224. }
  26225. }
  26226. if (headers.length === 0) {
  26227. return;
  26228. }
  26229. data.push(headerTextArr);
  26230. for (var i = 0; i < jsonData.length; i++) {
  26231. var dataRow = jsonData[i];
  26232. var row = [];
  26233. for (var j = 0; j < headers.length; j++) {
  26234. var key = headers[j].dataIndex;
  26235. var value = dataRow[key];
  26236. if (!value && value !== 0) {
  26237. value = '';
  26238. }
  26239. var oValue = value;
  26240. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  26241. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  26242. try {
  26243. value = headers[j].renderer(value);
  26244. if (!value && value !== 0) {
  26245. value = oValue;
  26246. }
  26247. }
  26248. catch (e) {
  26249. value = oValue;
  26250. }
  26251. }
  26252. row.push(value);
  26253. }
  26254. data.push(row);
  26255. }
  26256. return data;
  26257. },
  26258. initComponent: function () {
  26259. var _this = this;
  26260. var _a;
  26261. var me = this;
  26262. var config = me.config;
  26263. var scope = lookupScope(this);
  26264. if (isDesignMode(scope, config)) {
  26265. this.superclass.initComponent.call(this);
  26266. return;
  26267. }
  26268. // 转换 dataSource 属性
  26269. convertDataSource$1(me, scope, config);
  26270. this.on({
  26271. afterrender: function (sender) {
  26272. var me = this;
  26273. var config = this.config;
  26274. var dataSource = config.dataSource;
  26275. if (config.autoLoad) {
  26276. if (config.dataSourceCallbackFn) {
  26277. me.reload();
  26278. }
  26279. else if (_$2.isPlainObject(dataSource)) {
  26280. me.reload();
  26281. }
  26282. }
  26283. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  26284. var vm = this.lookupViewModel();
  26285. this.contextMenu = this.add(new Ext.menu.Menu({
  26286. viewModel: vm,
  26287. items: _$2.map(config.tbar, function (item) {
  26288. var menuItem = __assign({}, item);
  26289. if (menuItem.xtype === 'button') {
  26290. delete menuItem.xtype;
  26291. }
  26292. return menuItem;
  26293. })
  26294. }));
  26295. }
  26296. else if (_$2.isPlainObject(config.contextMenu)) {
  26297. this.contextMenu = this.add(config.contextMenu);
  26298. }
  26299. var $dom = $(sender.el.dom);
  26300. $dom.on('keydown', function (e) {
  26301. me.fireEvent('keydown', me, e);
  26302. }).on('keyup', function (e) {
  26303. me.fireEvent('keyup', me, e);
  26304. });
  26305. // 默认显示提示
  26306. if (this.cellTip) {
  26307. this.tip = Ext.create('Ext.tip.ToolTip', {
  26308. target: this.el,
  26309. delegate: '.x-grid-cell-inner',
  26310. trackMouse: true,
  26311. ancor: 'top',
  26312. style: 'background-color: #0D6EFD;',
  26313. listeners: {
  26314. beforeshow: function (tip) {
  26315. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  26316. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  26317. return false;
  26318. }
  26319. tip.update(tipText);
  26320. }
  26321. }
  26322. });
  26323. }
  26324. },
  26325. itemcontextmenu: function (view, rec, node, index, e) {
  26326. if (this.contextMenu) {
  26327. e.stopEvent();
  26328. this.contextMenu.show().setLocalXY(e.getXY());
  26329. return false;
  26330. }
  26331. },
  26332. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  26333. // this.setColumnConfigCache()
  26334. // },
  26335. // columnhide(sender, column, eOpts) {
  26336. // this.setColumnConfigCache()
  26337. // },
  26338. // columnshow(sender, column, eOpts) {
  26339. // this.setColumnConfigCache()
  26340. // },
  26341. // columnresize(sender, column, width, eOpts) {
  26342. // this.setColumnConfigCache()
  26343. // },
  26344. destory: function () {
  26345. },
  26346. selectionchange: function (sender, param) {
  26347. var record = undefined;
  26348. if (_$2.isArray(param)) {
  26349. record = param[0];
  26350. }
  26351. else if (_$2.isObject(param)) {
  26352. record = _$2.get(param, 'endCell.record');
  26353. }
  26354. itemselectFun(this, sender, record);
  26355. },
  26356. itemclick: function (sender, record) {
  26357. itemselectFun(this, sender, record);
  26358. },
  26359. show: function (sender) {
  26360. if (sender.__suspendReload) {
  26361. sender.__suspendReload = false;
  26362. sender.reload();
  26363. }
  26364. }
  26365. });
  26366. _$2.defer(function () {
  26367. var ce = _this.findPlugin('cellediting');
  26368. ce.on({
  26369. beforeedit: function (editor, context, eOpts) {
  26370. me.fireEvent('editbefore', me, editor, context, eOpts);
  26371. },
  26372. canceledit: function (editor, context, eOpts) {
  26373. me.fireEvent('editcancel', me, editor, context, eOpts);
  26374. },
  26375. edit: function (editor, context, eOpts) {
  26376. me.fireEvent('editfinish', me, editor, context, eOpts);
  26377. },
  26378. validateedit: function (editor, context, eOpts) {
  26379. me.fireEvent('editvalidate', me, editor, context, eOpts);
  26380. },
  26381. });
  26382. });
  26383. var itemselectFun = _$2.debounce(function (me, sender, record) {
  26384. var reference = me.reference;
  26385. var scope = lookupScope(me);
  26386. var theid = _$2.get(config, 'behavior.theid');
  26387. if (theid && reference) {
  26388. if (!record) {
  26389. scope.viewModel.set(reference + '.theid', null);
  26390. }
  26391. else {
  26392. scope.viewModel.set(reference + '.theid', record.get(theid));
  26393. }
  26394. }
  26395. var theid2 = _$2.get(config, 'behavior.theid2');
  26396. if (theid2 && reference) {
  26397. if (!record) {
  26398. scope.viewModel.set(reference + '.theid2', null);
  26399. }
  26400. else {
  26401. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  26402. }
  26403. }
  26404. var theid3 = _$2.get(config, 'behavior.theid3');
  26405. if (theid3 && reference) {
  26406. if (!record) {
  26407. scope.viewModel.set(reference + '.theid3', null);
  26408. }
  26409. else {
  26410. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  26411. }
  26412. }
  26413. me.fireEvent('itemselect', sender, record);
  26414. }, 50);
  26415. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  26416. // 为 stores.proxy.buildRequest 做准备
  26417. this.store.proxy.$owner = this;
  26418. }
  26419. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  26420. if (selectToReload) {
  26421. // 点击后触发某个目标表格刷新
  26422. this.on({
  26423. itemselect: function (sender) {
  26424. if (_$2.isArray(selectToReload)) {
  26425. _$2.forEach(selectToReload, function (ref) {
  26426. if (ref) {
  26427. var ctlTarget = scope.refs[ref];
  26428. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  26429. if (ctlTarget.isVisible()) {
  26430. ctlTarget.reload();
  26431. }
  26432. else {
  26433. ctlTarget.__suspendReload = true;
  26434. }
  26435. }
  26436. }
  26437. });
  26438. }
  26439. else if (_$2.isString(selectToReload)) {
  26440. var ctlTarget = scope.refs[selectToReload];
  26441. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  26442. ctlTarget.reload();
  26443. }
  26444. }
  26445. }
  26446. });
  26447. }
  26448. this.superclass.initComponent.call(this);
  26449. },
  26450. // 生成列自定义的缓存key
  26451. makeColumnConfigCacheKey: function (config) {
  26452. var _a, _b, _c, _d, _e, _f;
  26453. 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);
  26454. var key = "gridColumnCache-" + scope.scopeKey + "-";
  26455. if (config.reference) {
  26456. key += config.reference;
  26457. }
  26458. else {
  26459. var subKey = "";
  26460. for (var i = 0; i < config.columns.length; i++) {
  26461. var column = config.columns[i];
  26462. if (column.dataIndex) {
  26463. subKey += column.dataIndex;
  26464. }
  26465. }
  26466. key += subKey;
  26467. }
  26468. return key;
  26469. },
  26470. getColumnConfigCache: function () {
  26471. var key = this.columnConfigCacheKey;
  26472. var dataStr = localStorage.getItem(key);
  26473. if (dataStr) {
  26474. return JSON.parse(dataStr);
  26475. }
  26476. return "";
  26477. },
  26478. setColumnConfigCache: function () {
  26479. var key = this.columnConfigCacheKey;
  26480. var cacheData = [];
  26481. var columns = this.headerCt.getGridColumns();
  26482. var index = 0;
  26483. for (var i = 0; i < columns.length; i++) {
  26484. var column = columns[i];
  26485. if (column.dataIndex) {
  26486. cacheData.push({
  26487. dataIndex: column.dataIndex,
  26488. width: column.width,
  26489. hidden: column.hidden,
  26490. locked: column.locked,
  26491. index: index
  26492. });
  26493. index++;
  26494. }
  26495. }
  26496. localStorage.setItem(key, JSON.stringify(cacheData));
  26497. },
  26498. autoSizeColumns: function (sender) {
  26499. var grid = sender ? sender.up('grid') : this;
  26500. // const columns = grid.columns;
  26501. // for (let i = 0; i < columns.length; i++) {
  26502. // const column = columns[i];
  26503. // grid.getView().autoSizeColumn(column);
  26504. // column.setWidth(column.getWidth() + 5);
  26505. // }
  26506. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  26507. grid.headerCt.getGridColumns()[i].autoSize(i);
  26508. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  26509. }
  26510. },
  26511. clearFilter: function (sender) {
  26512. var grid = sender.up('grid');
  26513. grid.filters.clearFilters();
  26514. grid.getStore().sorters.removeAll();
  26515. // grid.getStore().reload()
  26516. },
  26517. saveGridUIConfig: function (sender) {
  26518. var grid = sender.up('grid');
  26519. grid.setColumnConfigCache();
  26520. msg('保存设置成功!');
  26521. },
  26522. clearGridUIConfig: function (sender) {
  26523. var grid = sender.up('grid');
  26524. var key = grid.columnConfigCacheKey;
  26525. localStorage.setItem(key, "");
  26526. msg('清空设置成功,重新打开后生效!');
  26527. },
  26528. setLoading: function (value) {
  26529. if (value) {
  26530. this.mask('读取中');
  26531. }
  26532. else {
  26533. this.unmask();
  26534. }
  26535. },
  26536. exportExcel: function (sender) {
  26537. var _a, _b;
  26538. var rect = sender.btnEl.dom.getBoundingClientRect();
  26539. var scope = lookupScope(this);
  26540. var grid = sender.up('grid');
  26541. var menuItems = [];
  26542. var topOffset = 0;
  26543. 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)) {
  26544. menuItems.push({
  26545. text: '大批量导出 (需要客户端支持!)',
  26546. iconCls: 'x-fa fa-download',
  26547. listeners: {
  26548. click: function (sender, value) {
  26549. // @ts-ignore
  26550. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  26551. .then(function (res) {
  26552. grid.exportBigExcelClick();
  26553. });
  26554. }
  26555. }
  26556. });
  26557. menuItems.push('-');
  26558. topOffset += 30;
  26559. }
  26560. menuItems.push({
  26561. text: '导出当前数据',
  26562. iconCls: 'x-fa fa-download',
  26563. listeners: {
  26564. click: function (sender, value) {
  26565. grid.exportCurrentExcelClick();
  26566. }
  26567. }
  26568. });
  26569. topOffset += 30;
  26570. if (grid === null || grid === void 0 ? void 0 : grid.dataSource) {
  26571. menuItems.push({
  26572. xtype: "textfield",
  26573. fieldLabel: '当前导出页',
  26574. maskRe: /[0-9]/,
  26575. value: grid.exportExcelCurrentPage,
  26576. listeners: {
  26577. render: function (sender) {
  26578. grid.exportExcelCurrentPageCmp = sender;
  26579. },
  26580. change: function (sender, value) {
  26581. var v = parseInt(value);
  26582. if (isNaN(v) || v === 0) {
  26583. window['system'].msg("页码不能为0");
  26584. v = 1;
  26585. sender.setValue(v);
  26586. }
  26587. var size = parseInt(grid.exportExcelPageSize);
  26588. var total = parseInt(grid.exportExcelTotal);
  26589. if (v > total / size) {
  26590. v = parseInt(total / size + "");
  26591. }
  26592. grid.exportExcelCurrentPage = v + "";
  26593. }
  26594. }
  26595. }, {
  26596. xtype: "textfield",
  26597. fieldLabel: '导出页大小',
  26598. maskRe: /[0-9]/,
  26599. value: grid.exportExcelPageSize,
  26600. listeners: {
  26601. render: function (sender) {
  26602. grid.exportExcelPageSizeCmp = sender;
  26603. },
  26604. change: function (sender, value) {
  26605. var v = parseInt(value);
  26606. if (isNaN(v) || v === 0) {
  26607. window['system'].msg("导出页大小不能为0");
  26608. v = defaultGrid.exportExcelPageSize;
  26609. sender.setValue(v);
  26610. }
  26611. if (v > 10000) {
  26612. window['system'].msg("导出页大小不能大于10000");
  26613. v = 10000;
  26614. sender.setValue(v);
  26615. }
  26616. var page = parseInt(grid.exportExcelCurrentPage);
  26617. var total = parseInt(grid.exportExcelTotal);
  26618. if (page > total / v) {
  26619. page = parseInt(total / v + "") + 1;
  26620. grid.exportExcelCurrentPageCmp.setValue(page);
  26621. }
  26622. grid.exportExcelPageSize = v + "";
  26623. }
  26624. }
  26625. }, {
  26626. xtype: "textfield",
  26627. fieldLabel: '总条数',
  26628. value: grid.exportExcelTotal,
  26629. readOnly: true
  26630. }, {
  26631. text: '导出',
  26632. iconCls: 'x-fa fa-download',
  26633. listeners: {
  26634. click: function (sender, value) {
  26635. grid.exportExcelClick({
  26636. exportExcelPageSize: grid.exportExcelPageSize,
  26637. exportExcelCurrentPage: grid.exportExcelCurrentPage
  26638. });
  26639. }
  26640. }
  26641. }, {
  26642. text: '连续导出',
  26643. iconCls: 'x-fa fa-download',
  26644. listeners: {
  26645. click: function (sender, value) {
  26646. grid.exportExcelClick({
  26647. exportExcelPageSize: grid.exportExcelPageSize,
  26648. exportExcelCurrentPage: grid.exportExcelCurrentPage
  26649. }, true);
  26650. }
  26651. }
  26652. });
  26653. topOffset += 150;
  26654. }
  26655. var treeMenu = new Ext.menu.Menu({
  26656. xtype: 'menu',
  26657. floated: false,
  26658. width: 300,
  26659. docked: 'left',
  26660. items: menuItems
  26661. });
  26662. treeMenu.showAt(rect.left, rect.top - topOffset);
  26663. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  26664. // grid.headerCt.getGridColumns()[i].autoSize(i);
  26665. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  26666. // }
  26667. },
  26668. /**
  26669. * 获取表格编辑的行数据
  26670. */
  26671. getGridEditRows: function () {
  26672. var grid = this;
  26673. var store = grid.getStore();
  26674. var rows = [];
  26675. var modifyRows = [];
  26676. var newRows = [];
  26677. var err = "";
  26678. var records = store.getModifiedRecords();
  26679. var newRecords = store.getNewRecords();
  26680. var removeRecords = [];
  26681. _$2.forEach(store.getRemovedRecords(), function (row) {
  26682. removeRecords.push(row.data);
  26683. });
  26684. _$2.forEach(records, function (record) {
  26685. var colums = grid.columns;
  26686. var errFunc = undefined;
  26687. _$2.forEach(colums, function (col) {
  26688. var name = col.dataIndex;
  26689. var value = record.data[name];
  26690. var colIndex = col.getIndex(); //获得列号
  26691. var rowIndex = store.indexOfId(record.id); //获得行号
  26692. var editor = col.getEditor(); //使用的编辑器
  26693. var tmpErrFunc = function () {
  26694. var text = col.text || col.name;
  26695. msg(text + ' 校验失败, 请确保输入的数据正确');
  26696. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  26697. };
  26698. if (editor && !editor.allowBlank && isEmpty(value)) {
  26699. errFunc = tmpErrFunc;
  26700. return false;
  26701. }
  26702. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  26703. errFunc = tmpErrFunc;
  26704. return false;
  26705. }
  26706. });
  26707. if (typeof errFunc === 'function') {
  26708. err = "1";
  26709. _$2.remove(rows, function (n) {
  26710. return true;
  26711. });
  26712. //@ts-ignore
  26713. errFunc();
  26714. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  26715. return false;
  26716. }
  26717. else {
  26718. if (_$2.findIndex(newRecords, function (item) {
  26719. return item === record;
  26720. }) >= 0) {
  26721. newRows.push(record.data);
  26722. }
  26723. else {
  26724. modifyRows.push(record.data);
  26725. }
  26726. rows.push(record.data);
  26727. }
  26728. });
  26729. return {
  26730. rows: rows,
  26731. newRows: newRows,
  26732. modifyRows: modifyRows,
  26733. removeRecords: removeRecords,
  26734. err: err
  26735. };
  26736. }
  26737. // reload() {
  26738. // dataSourceReload(this)
  26739. // },
  26740. });
  26741. }
  26742. /**
  26743. * 获取 columns 中所有的 dataIndex
  26744. */
  26745. function getFileds(newConfig) {
  26746. var fields = [];
  26747. _$2.forEach(newConfig.columns, function (c) {
  26748. if (c.dataIndex) {
  26749. fields.push(c.dataIndex);
  26750. }
  26751. });
  26752. return fields;
  26753. }
  26754. function convertDataSource$1(sender, scope, newConfig) {
  26755. if (typeof newConfig.store !== 'undefined') {
  26756. // 有 store 属性的情况下,不做任何事
  26757. return;
  26758. }
  26759. if (typeof newConfig.dataSource === 'undefined') {
  26760. // 没有定义 dataSource 的情况下,不做任何事
  26761. return;
  26762. }
  26763. if (_$2.isArray(newConfig.data)) {
  26764. // 有 data 属性赋值的情况下
  26765. newConfig.store = {
  26766. fields: getFileds(newConfig),
  26767. data: newConfig.data
  26768. };
  26769. delete newConfig.data;
  26770. return;
  26771. }
  26772. var dataSource = newConfig.dataSource;
  26773. if (typeof dataSource === 'string') {
  26774. // dataSource 是字符串的情况下,找到成员函数
  26775. dataSource = lookupFn(scope, dataSource);
  26776. }
  26777. if (typeof dataSource === 'function') {
  26778. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  26779. newConfig.store = new Ext.data.Store({
  26780. fields: getFileds(newConfig),
  26781. // data: [],
  26782. autoLoad: true,
  26783. proxy: {
  26784. type: 'memory',
  26785. data: [],
  26786. }
  26787. });
  26788. newConfig.dataSourceCallbackFn = dataSource;
  26789. return;
  26790. }
  26791. // throw new TypeError('无法识别的调用方法')
  26792. }
  26793. function initTextfield () {
  26794. var cc = Ext.form.field.Text.prototype.constructor;
  26795. var initComponent = Ext.form.field.Text.prototype.initComponent;
  26796. Ext.form.field.Text.override({
  26797. constructor: function (config) {
  26798. var newConfig = _$2.defaultsDeep({
  26799. // 强制属性
  26800. triggers: {
  26801. clear: {
  26802. weight: -1,
  26803. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  26804. hidden: true,
  26805. handler: 'onClearClick',
  26806. },
  26807. }
  26808. }, baseConfig(config, 'col-item'), config, text);
  26809. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  26810. newConfig.enableKeyEvents = true;
  26811. }
  26812. cc.call(this, newConfig);
  26813. },
  26814. /**
  26815. * 清空所有值
  26816. */
  26817. onClearClick: function (sender, e) {
  26818. var me = this;
  26819. me.setValue('');
  26820. },
  26821. /**
  26822. * 尝试获取下一个要获取焦点的控件
  26823. */
  26824. _raiseNextFocus: function (sender) {
  26825. var config = sender.config;
  26826. var scope = lookupScope(sender);
  26827. if (typeof config.nextFocus === 'function') {
  26828. config.nextFocus(sender);
  26829. }
  26830. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  26831. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  26832. var fn = lookupFn(scope, config.nextFocus);
  26833. if (typeof fn === 'function') {
  26834. var nextCtlReference = fn(sender);
  26835. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  26836. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  26837. if (ctl) {
  26838. if (typeof ctl.focus2 === 'function') {
  26839. ctl.focus2();
  26840. }
  26841. else {
  26842. ctl.focus();
  26843. }
  26844. }
  26845. }
  26846. }
  26847. }
  26848. else {
  26849. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  26850. if (ctl) {
  26851. if (typeof ctl.focus2 === 'function') {
  26852. ctl.focus2();
  26853. }
  26854. else {
  26855. ctl.focus();
  26856. }
  26857. }
  26858. }
  26859. }
  26860. },
  26861. initComponent: function () {
  26862. /**
  26863. * 改变必填项之前加星号
  26864. */
  26865. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  26866. // this.beforeLabelTextTpl = [
  26867. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  26868. // ];
  26869. this.afterLabelTextTpl = [
  26870. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  26871. ];
  26872. }
  26873. var me = this;
  26874. this.on({
  26875. change: function (sender, newVal) {
  26876. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  26877. if (hideTrigger || disabled || readOnly || hideClear) {
  26878. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  26879. return;
  26880. }
  26881. var value = newVal;
  26882. if (value) {
  26883. me.getTrigger('clear').show();
  26884. me.updateLayout();
  26885. }
  26886. else {
  26887. me.getTrigger('clear').hide();
  26888. me.updateLayout();
  26889. }
  26890. },
  26891. afterrender: function (sender) {
  26892. var _this = this;
  26893. var _a;
  26894. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  26895. sender.inputEl.dom.setAttribute('spellcheck', "false");
  26896. $$2(sender.inputEl.dom).on('click', function (e) {
  26897. sender.fireEvent('click', _this, e);
  26898. });
  26899. $$2(sender.inputEl.dom).on('keydown', function (e) {
  26900. var _a, _b, _c, _d;
  26901. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  26902. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  26903. if (sender.isExpanded === true) {
  26904. // 弹开下拉框的基础上,不干预上下选择
  26905. return;
  26906. }
  26907. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  26908. var grid = sender.ownerCt.up('grid');
  26909. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  26910. if (editingPlugin) {
  26911. 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;
  26912. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  26913. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  26914. // editingPlugin
  26915. var targetRecord = void 0;
  26916. if (e.code === 'ArrowDown') {
  26917. targetRecord = grid.store.data.getAt(rowIdx + 1);
  26918. }
  26919. else {
  26920. targetRecord = grid.store.data.getAt(rowIdx - 1);
  26921. }
  26922. if (targetRecord) {
  26923. grid.setSelection([targetRecord]);
  26924. editingPlugin.startEdit(targetRecord, column);
  26925. }
  26926. e.stopPropagation();
  26927. e.preventDefault();
  26928. }
  26929. }
  26930. }
  26931. }
  26932. });
  26933. }
  26934. var config = sender.config;
  26935. if (config.ff && config.ff > 0) {
  26936. setTimeout(function () {
  26937. if (typeof sender.focus2 === 'function') {
  26938. sender.focus2();
  26939. }
  26940. else {
  26941. sender.focus();
  26942. }
  26943. }, config.ff);
  26944. }
  26945. }
  26946. });
  26947. var config = this.config;
  26948. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  26949. this.on({
  26950. keyup: function (sender, e) {
  26951. if ([10, 13, 20, 40].includes(e.keyCode)) {
  26952. sender._raiseNextFocus(sender);
  26953. }
  26954. }
  26955. });
  26956. }
  26957. var that = this;
  26958. this.on({
  26959. keyup: function (sender, e, eOpts) {
  26960. if (![10, 13, 20, 40].includes(e.keyCode)) {
  26961. return;
  26962. }
  26963. that.keydown_fun_item(sender, e, eOpts);
  26964. }
  26965. });
  26966. initComponent.call(this);
  26967. },
  26968. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  26969. var that = sender;
  26970. if ([10, 13, 20, 40].includes(event.keyCode)) {
  26971. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  26972. var value = _$2.trim(sender.rawValue);
  26973. var r = that.fireEvent('scancode', that, value, event);
  26974. if (r === 'OK') {
  26975. // 停止事件的默认处理程序,停止事件的冒泡
  26976. // event.stopEvent();
  26977. event.preventDefault();
  26978. event.stopPropagation();
  26979. }
  26980. }
  26981. }, 100)
  26982. });
  26983. }
  26984. function initTbFill () {
  26985. /**
  26986. *
  26987. */
  26988. var ct = Ext.toolbar.Fill.prototype.constructor;
  26989. Ext.toolbar.Fill.override({
  26990. constructor: function (config) {
  26991. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  26992. ct.call(this, newConfig);
  26993. }
  26994. });
  26995. }
  26996. function initTbSeparator () {
  26997. /**
  26998. *
  26999. */
  27000. var ct = Ext.toolbar.Separator.prototype.constructor;
  27001. Ext.toolbar.Separator.override({
  27002. constructor: function (config) {
  27003. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  27004. ct.call(this, newConfig);
  27005. }
  27006. });
  27007. }
  27008. function initToolbar () {
  27009. /**
  27010. *
  27011. */
  27012. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  27013. Ext.toolbar.Toolbar.override({
  27014. constructor: function (config) {
  27015. var newConfig = _$2.defaultsDeep({
  27016. // 强制性属性
  27017. }, baseConfig(config, 'cols-container'), config, toolbar);
  27018. ct.call(this, newConfig);
  27019. }
  27020. });
  27021. initTbFill();
  27022. initTbSeparator();
  27023. }
  27024. function initSplitter () {
  27025. var ct = Ext.resizer.Splitter.prototype.constructor;
  27026. Ext.resizer.Splitter.override({
  27027. constructor: function (config) {
  27028. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  27029. ct.call(this, newConfig);
  27030. }
  27031. });
  27032. }
  27033. /**
  27034. * 通用 dataSource 解析,
  27035. * Tree/Combo/Grid/PageList ... 都会从这里解析
  27036. */
  27037. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  27038. var config = ctl.config;
  27039. return new Promise(function (resolve, reject) {
  27040. if (!config.dataSource) {
  27041. // 没有设置数据源,直接置空
  27042. return Promise.resolve();
  27043. }
  27044. var option = {
  27045. extraParam: extraParam,
  27046. _successCb: _successCb,
  27047. successCallback: function (value) {
  27048. if (typeof successCallback === "function") {
  27049. successCallback(value);
  27050. }
  27051. else {
  27052. ctl.setData(value);
  27053. }
  27054. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  27055. ctl.setLoading(false);
  27056. resolve(value);
  27057. },
  27058. failCallback: function (error) {
  27059. if (typeof failCallback === "function") {
  27060. failCallback(error);
  27061. }
  27062. ctl.fireEvent('dataLoadComplete', ctl, false);
  27063. ctl.setLoading(false);
  27064. reject(error);
  27065. }
  27066. };
  27067. // 请求前要求确认一下
  27068. var isCanceled = false;
  27069. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  27070. isCanceled = true;
  27071. } }, option));
  27072. if (!isCanceled) {
  27073. // 请求没有被取消
  27074. // 调用异步接口返回 Promise
  27075. return _innerReload(ctl, option);
  27076. }
  27077. return reject();
  27078. });
  27079. }
  27080. function _innerReload(ctl, option) {
  27081. var config = ctl.config;
  27082. ctl.setLoading(true);
  27083. var scope = lookupScope(ctl);
  27084. var dataSource = config.dataSource;
  27085. if (typeof dataSource == 'string') {
  27086. dataSource = lookupFn(scope, config.dataSource);
  27087. }
  27088. if (typeof dataSource === 'function') {
  27089. // @ts-ignore
  27090. dataSource.call(scope, ctl, option);
  27091. return;
  27092. }
  27093. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  27094. if (!ajax.func) {
  27095. console.error("没有配置 ajax");
  27096. return;
  27097. }
  27098. var params_1 = {};
  27099. var sortModel = null;
  27100. var filterModel = null;
  27101. if (option.extraParam && option.extraParam.filterModel) {
  27102. filterModel = option.extraParam.filterModel;
  27103. }
  27104. if (option.extraParam && option.extraParam.sortModel) {
  27105. sortModel = option.extraParam.sortModel;
  27106. }
  27107. _$2.forOwn(option.extraParam, function (v, key) {
  27108. if (key != "filterModel" && key != "sortModel") {
  27109. if (typeof v === 'function') {
  27110. params_1[key] = v();
  27111. }
  27112. else {
  27113. params_1[key] = v;
  27114. }
  27115. }
  27116. });
  27117. var ds = dataSource;
  27118. _$2.forOwn(ds.params, function (v, key) {
  27119. if (typeof v === 'function') {
  27120. params_1[key] = v();
  27121. }
  27122. else {
  27123. params_1[key] = v;
  27124. }
  27125. });
  27126. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  27127. // @ts-ignore
  27128. ajax.func({
  27129. method: dataSource.method,
  27130. url: ds.url,
  27131. data: params_1,
  27132. filterModel: filterModel,
  27133. sortModel: sortModel,
  27134. }).then(function (res) {
  27135. if (res.success) {
  27136. option.successCallback(res.data);
  27137. }
  27138. else {
  27139. option.failCallback(res.msg);
  27140. }
  27141. }).catch(function (e) {
  27142. option.failCallback(e);
  27143. });
  27144. }
  27145. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  27146. var ds_1 = ctl.dataSource;
  27147. // @ts-ignore
  27148. Extend.ajax.func({
  27149. url: ds_1.sqlId,
  27150. data: params_1,
  27151. db: ds_1.db,
  27152. method: 'sql',
  27153. filterModel: filterModel,
  27154. sortModel: sortModel,
  27155. }).then(function (res) {
  27156. if (res.success) {
  27157. option.successCallback(res.data);
  27158. }
  27159. else {
  27160. option.failCallback(res.msg);
  27161. }
  27162. }).catch(function (e) {
  27163. option.failCallback(e);
  27164. }).finally(function () {
  27165. ctl.loading = false;
  27166. });
  27167. return;
  27168. }
  27169. else {
  27170. console.error("非法的 dataSource", ctl.dataSource);
  27171. debugger;
  27172. throw new Error("非法的 dataSource");
  27173. }
  27174. }
  27175. }
  27176. function initCombo () {
  27177. var cc = Ext.form.field.ComboBox.prototype.constructor;
  27178. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  27179. Ext.form.field.ComboBox.override({
  27180. constructor: function (config) {
  27181. var newConfig = _$2.defaultsDeep({
  27182. // 强制性属性
  27183. }, baseConfig(config, 'col-item'), config, combo);
  27184. if (typeof config.dict === 'string') {
  27185. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  27186. }
  27187. else if (typeof newConfig.store == 'undefined') {
  27188. if (_$2.isArray(newConfig.data)) {
  27189. // ExtJS 无法直接接受数组模式
  27190. newConfig.store = {
  27191. fields: [newConfig.valueField, newConfig.displayField],
  27192. data: newConfig.data
  27193. };
  27194. delete newConfig.data;
  27195. }
  27196. else if (typeof newConfig.data !== 'object') {
  27197. newConfig.store = {
  27198. fields: [newConfig.valueField, newConfig.displayField],
  27199. data: []
  27200. };
  27201. delete newConfig.data;
  27202. }
  27203. }
  27204. cc.call(this, newConfig);
  27205. },
  27206. setDict: function (bizKey) {
  27207. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  27208. this.dict = bizKey;
  27209. },
  27210. getDict: function () {
  27211. return this.dict;
  27212. },
  27213. setData: function (value) {
  27214. if (!value) {
  27215. return;
  27216. }
  27217. var config = value.config;
  27218. if (!this.store) {
  27219. this.store = new Ext.data.Store({
  27220. fields: [config.valueField, config.displayField],
  27221. data: value
  27222. });
  27223. }
  27224. else {
  27225. this.store.getProxy().setData(value);
  27226. this.store.load();
  27227. }
  27228. },
  27229. setLoading: function (value) {
  27230. if (value) {
  27231. if (!this.loadMask) {
  27232. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  27233. }
  27234. }
  27235. else {
  27236. if (this.loadMask) {
  27237. this.loadMask.destroy();
  27238. delete this.loadMask;
  27239. }
  27240. }
  27241. },
  27242. reload: function () {
  27243. dataSourceReload(this);
  27244. },
  27245. initComponent: function () {
  27246. var that = this;
  27247. var toggle = function (e) {
  27248. var readOnly = that.readOnly, disabled = that.disabled;
  27249. if (readOnly || disabled) {
  27250. return;
  27251. }
  27252. if ($(e.target).is('.x-form-trigger')) {
  27253. return;
  27254. }
  27255. // 点击后下拉
  27256. if (that.isExpanded) {
  27257. that.collapse();
  27258. }
  27259. else {
  27260. that.expand();
  27261. that.doQuery(that.allQuery, true);
  27262. }
  27263. };
  27264. this.on({
  27265. afterrender: function (sender) {
  27266. var config = this.config;
  27267. if (config.dataSource && config.autoLoad) {
  27268. dataSourceReload(this);
  27269. }
  27270. // 点击后下拉
  27271. $(this.el.dom).on('click', toggle.bind(this));
  27272. },
  27273. focusenter: function (sender, event, opt) {
  27274. var _a;
  27275. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27276. // 表格内编辑框,获取焦点后自动弹开
  27277. toggle.call(this, event);
  27278. }
  27279. },
  27280. destory: function () {
  27281. $(this.el.dom).off('click', toggle.bind(this));
  27282. },
  27283. beforequery: function (context) {
  27284. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  27285. // console.log('beforequery', query)
  27286. if (!forceAll && query) {
  27287. combo.store.clearFilter();
  27288. combo.store.filterBy(function (record, id) {
  27289. var text = record.get(combo.displayField);
  27290. // 用拼音筛选的方式
  27291. return keywordFilter(query, text, id);
  27292. });
  27293. combo.expand();
  27294. return false;
  27295. }
  27296. combo.store.clearFilter();
  27297. combo.expand();
  27298. return false;
  27299. },
  27300. });
  27301. initComponent.call(this);
  27302. },
  27303. focus2: function () {
  27304. this.focus();
  27305. var that = this;
  27306. _$2.defer(function () {
  27307. if (that.isExpanded) {
  27308. that.collapse();
  27309. }
  27310. else {
  27311. that.expand();
  27312. that.doQuery(that.allQuery, true);
  27313. }
  27314. });
  27315. }
  27316. });
  27317. }
  27318. /**
  27319. xtype: 'tagfield',
  27320. displayField: 'show',
  27321. valueField: 'id',
  27322. queryMode: 'local',
  27323. filterPickList: true,
  27324. store: {
  27325. fields: ['id', 'show'],
  27326. data: [
  27327. {id: 0, show: 'Battlestar Galactica'},
  27328. {id: 1, show: 'Doctor Who'},
  27329. {id: 2, show: 'Farscape'},
  27330. {id: 3, show: 'Firefly'},
  27331. {id: 4, show: 'Star Trek'},
  27332. {id: 5, show: 'Star Wars: Christmas Special'}
  27333. ]
  27334. }
  27335. */
  27336. function initTag () {
  27337. var cc = Ext.form.field.Tag.prototype.constructor;
  27338. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  27339. Ext.form.field.Tag.override({
  27340. constructor: function (config) {
  27341. var newConfig = _$2.defaultsDeep({
  27342. // 强制性属性
  27343. }, baseConfig(config, 'col-item'), config, tagfield);
  27344. if (typeof config.dict === 'string') {
  27345. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  27346. }
  27347. else if (typeof newConfig.store == 'undefined') {
  27348. if (_$2.isArray(newConfig.data)) {
  27349. // ExtJS 无法直接接受数组模式
  27350. newConfig.store = {
  27351. fields: [newConfig.valueField, newConfig.displayField],
  27352. data: newConfig.data
  27353. };
  27354. delete newConfig.data;
  27355. }
  27356. else if (typeof newConfig.data !== 'object') {
  27357. newConfig.store = {
  27358. fields: [newConfig.valueField, newConfig.displayField],
  27359. data: []
  27360. };
  27361. delete newConfig.data;
  27362. }
  27363. }
  27364. cc.call(this, newConfig);
  27365. },
  27366. setDict: function (bizKey) {
  27367. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  27368. this.dict = bizKey;
  27369. },
  27370. getDict: function () {
  27371. return this.dict;
  27372. },
  27373. setData: function (value) {
  27374. if (!value) {
  27375. return;
  27376. }
  27377. var config = value.config;
  27378. if (!this.store) {
  27379. this.store = new Ext.data.Store({
  27380. fields: [config.valueField, config.displayField],
  27381. data: value
  27382. });
  27383. }
  27384. else {
  27385. this.store.getProxy().setData(value);
  27386. this.store.load();
  27387. }
  27388. },
  27389. setLoading: function (value) {
  27390. if (value) {
  27391. if (!this.loadMask) {
  27392. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  27393. }
  27394. }
  27395. else {
  27396. if (this.loadMask) {
  27397. this.loadMask.destroy();
  27398. delete this.loadMask;
  27399. }
  27400. }
  27401. },
  27402. reload: function () {
  27403. dataSourceReload(this);
  27404. },
  27405. initComponent: function () {
  27406. var that = this;
  27407. var toggle = function (e) {
  27408. var readOnly = that.readOnly, disabled = that.disabled;
  27409. if (readOnly || disabled) {
  27410. return;
  27411. }
  27412. if ($(e.target).is('.x-form-trigger')) {
  27413. return;
  27414. }
  27415. // 点击后下拉
  27416. if (that.isExpanded) {
  27417. that.collapse();
  27418. }
  27419. else {
  27420. that.expand();
  27421. that.doQuery(that.allQuery, true);
  27422. }
  27423. };
  27424. this.on({
  27425. afterrender: function (sender) {
  27426. var config = this.config;
  27427. if (config.dataSource && config.autoLoad) {
  27428. dataSourceReload(this);
  27429. }
  27430. // 点击后下拉
  27431. $(this.el.dom).on('click', toggle.bind(this));
  27432. },
  27433. focusenter: function (sender, event, opt) {
  27434. var _a;
  27435. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  27436. // 表格内编辑框,获取焦点后自动弹开
  27437. toggle.call(this, event);
  27438. }
  27439. },
  27440. destory: function () {
  27441. $(this.el.dom).off('click', toggle.bind(this));
  27442. },
  27443. });
  27444. initComponent.call(this);
  27445. },
  27446. focus2: function () {
  27447. this.focus();
  27448. var that = this;
  27449. _$2.defer(function () {
  27450. if (that.isExpanded) {
  27451. that.collapse();
  27452. }
  27453. else {
  27454. that.expand();
  27455. that.doQuery(that.allQuery, true);
  27456. }
  27457. });
  27458. }
  27459. });
  27460. }
  27461. function initComboGridMulti () {
  27462. Ext.define('Yvan.LocalComboGrid', {
  27463. extend: 'Ext.form.field.Picker',
  27464. // extend: 'Yvan.PickerAlignCenter',
  27465. xtype: 'combogridmulti',
  27466. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  27467. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  27468. editable: false,
  27469. initComponent: function () {
  27470. this.on({
  27471. afterrender: function () {
  27472. var config = this.config;
  27473. if (config.dataSource && config.autoLoad) {
  27474. dataSourceReload(this);
  27475. }
  27476. },
  27477. });
  27478. this.superclass.initComponent.apply(this, arguments);
  27479. },
  27480. setStore: function (store) {
  27481. this.store = store;
  27482. var me = this;
  27483. if (me.store) {
  27484. if (me.picker) {
  27485. me.picker.setStore(store);
  27486. if (me.isExpanded) {
  27487. me.collapse();
  27488. delete me.picker;
  27489. me.expand();
  27490. }
  27491. }
  27492. this.onLoad();
  27493. me.mon(me.store, {
  27494. scope: me,
  27495. load: me.onLoad,
  27496. update: me.onUpdate
  27497. });
  27498. }
  27499. },
  27500. reload: function () {
  27501. dataSourceReload(this);
  27502. },
  27503. setData: function (value) {
  27504. var me = this;
  27505. var config = me.config;
  27506. if (!value) {
  27507. return;
  27508. }
  27509. if (!this.store) {
  27510. this.store = new Ext.data.Store({
  27511. fields: [config.valueField, config.displayField],
  27512. data: value
  27513. });
  27514. }
  27515. else {
  27516. this.store.getProxy().setData(value);
  27517. this.store.load();
  27518. }
  27519. this.onLoad();
  27520. },
  27521. createPicker: function () {
  27522. var me = this;
  27523. 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: {
  27524. scope: me,
  27525. selectionchange: me.onSelectionChange,
  27526. itemkeydown: me.onPickerKeyDown
  27527. } })), view = picker.getView();
  27528. if (Ext.isIE9 && Ext.isStrict) {
  27529. view.on({
  27530. scope: me,
  27531. highlightitem: me.repaintPickerView,
  27532. unhighlightitem: me.repaintPickerView,
  27533. afteritemexpand: me.repaintPickerView,
  27534. afteritemcollapse: me.repaintPickerView
  27535. });
  27536. }
  27537. return picker;
  27538. },
  27539. repaintPickerView: function () {
  27540. var style = this.picker.getView().getEl().dom.style;
  27541. style.display = style.display;
  27542. },
  27543. onSelectionChange: function (view, record, node, rowIndex, e) {
  27544. this.selectItem(view, record);
  27545. },
  27546. onPickerKeyDown: function (treeView, record, item, index, e) {
  27547. var key = e.getKey();
  27548. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  27549. this.selectItem(treeView, record);
  27550. }
  27551. },
  27552. selectItem: function (sender, record) {
  27553. var me = this;
  27554. var ids = [];
  27555. _$2.forEach(me.picker.getSelection(), function (record) {
  27556. ids.push(record.get(me.valueField));
  27557. });
  27558. me.fireEvent('select', me, record);
  27559. me.setValue(ids.join(me.splitChar));
  27560. // me.collapse();
  27561. },
  27562. onExpand: function () {
  27563. var me = this;
  27564. var picker = this.picker;
  27565. var value = this.value;
  27566. if (!me.store) {
  27567. msg('正在初始化数据,请稍后');
  27568. me.collapse();
  27569. return;
  27570. }
  27571. var vs = _$2.split(value, me.splitChar);
  27572. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  27573. picker.setSelection(records);
  27574. },
  27575. setValue: function (value) {
  27576. var me = this;
  27577. console.log('setValue', value);
  27578. me.value = value;
  27579. if (!me.store || me.store.loading) {
  27580. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  27581. return me.mixins.field.setValue.call(me, value);
  27582. // return me;
  27583. }
  27584. var vs = _$2.split(value, me.splitChar);
  27585. var displayValues = [];
  27586. _$2.forEach(vs, function (v) {
  27587. var _a;
  27588. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  27589. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  27590. if (dv) {
  27591. displayValues.push(dv);
  27592. }
  27593. else {
  27594. displayValues.push(v);
  27595. }
  27596. });
  27597. // set the raw value to the record's display field if a record was found
  27598. me.setRawValue(displayValues.join(me.splitChar));
  27599. return me.mixins.field.setValue.call(me, value);
  27600. },
  27601. getSubmitValue: function () {
  27602. return this.value;
  27603. },
  27604. getValue: function () {
  27605. return this.value;
  27606. },
  27607. onLoad: function () {
  27608. var value = this.value;
  27609. if (value) {
  27610. this.setValue(value);
  27611. }
  27612. },
  27613. onUpdate: function (store, rec, type, modifiedFieldNames) {
  27614. var display = this.displayField;
  27615. var me = this;
  27616. if (type === 'edit' && modifiedFieldNames &&
  27617. Ext.Array.contains(modifiedFieldNames, display) &&
  27618. this.value === rec.getId()) {
  27619. me.mixins.field.setValue.call(me, this.value);
  27620. this.setRawValue(rec.get(display));
  27621. }
  27622. }
  27623. });
  27624. }
  27625. function initSearch () {
  27626. Ext.define('Yvan.Search', {
  27627. extend: 'Ext.form.field.Text',
  27628. alias: 'widget.searchfield',
  27629. xtype: 'searchfield',
  27630. constructor: function (config) {
  27631. var self = this;
  27632. var newConfig = _$2.defaultsDeep({
  27633. // 强制性属性
  27634. triggers: {
  27635. clear: {
  27636. weight: 0,
  27637. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  27638. hidden: true,
  27639. handler: 'onClearClick',
  27640. },
  27641. search: {
  27642. weight: 1,
  27643. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  27644. handler: 'onSearchClick'
  27645. },
  27646. },
  27647. listeners: {
  27648. blur: function (sender, e) {
  27649. this.revertOnblur();
  27650. },
  27651. specialkey: function (sender, e) {
  27652. var _a;
  27653. var me = this;
  27654. if (e.getKey() === e.ENTER) {
  27655. me.onSearchClick(sender, {}, e);
  27656. return;
  27657. }
  27658. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27659. },
  27660. afterrender: function (sender, e) {
  27661. var _a;
  27662. this.replaceRawInputEvent();
  27663. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27664. }
  27665. },
  27666. }, baseConfig(config, 'col-item'), config, search);
  27667. this.superclass.constructor.call(self, newConfig);
  27668. },
  27669. revertOnblur: function () {
  27670. this.setRawValue(this.lastValue);
  27671. },
  27672. onSearchClick: function (sender, vv, e) {
  27673. var me = this;
  27674. var config = me.config;
  27675. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  27676. if (e) {
  27677. e.preventDefault();
  27678. e.stopPropagation();
  27679. }
  27680. this.fireEvent('search', sender, e);
  27681. if (!widget) {
  27682. return;
  27683. }
  27684. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  27685. },
  27686. replaceRawInputEvent: function () {
  27687. var me = this;
  27688. var $dom = $(me.inputEl.dom);
  27689. $dom.on('input', function (e) {
  27690. stopEvent(e);
  27691. // console.log('has input', e)
  27692. });
  27693. $dom.on('keyup', function (e) {
  27694. if (e.key === "Enter") {
  27695. me.onSearchClick(me, {}, e);
  27696. return;
  27697. }
  27698. stopEvent(e);
  27699. });
  27700. $dom.on('change', function (e) {
  27701. stopEvent(e);
  27702. });
  27703. },
  27704. onChange: function (newVal, oldVal) {
  27705. var me = this;
  27706. var value = newVal;
  27707. if (value) {
  27708. me.getTrigger('clear').show();
  27709. me.updateLayout();
  27710. }
  27711. else {
  27712. me.getTrigger('clear').hide();
  27713. me.updateLayout();
  27714. }
  27715. },
  27716. /**
  27717. * 清空所有值
  27718. */
  27719. onClearClick: function (sender, e) {
  27720. var me = this;
  27721. var config = me.config;
  27722. var lookup = config.lookup;
  27723. me.setValue('');
  27724. clearViewModelByLookup(sender, lookup);
  27725. }
  27726. });
  27727. }
  27728. function initMultipleSearch () {
  27729. Ext.define('Yvan.MultipleSearch', {
  27730. extend: 'Ext.form.field.Text',
  27731. xtype: 'multiplesearch',
  27732. bindTargert: '',
  27733. constructor: function (config) {
  27734. var _a, _b, _c, _d;
  27735. var self = this;
  27736. var newConfig = _$2.defaultsDeep({
  27737. // 强制性属性
  27738. triggers: {
  27739. clear: {
  27740. weight: 0,
  27741. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  27742. hidden: true,
  27743. handler: 'onClearClick',
  27744. }
  27745. },
  27746. transformRawValue: function (o) {
  27747. return o;
  27748. },
  27749. listeners: {
  27750. specialkey: function (sender, e) {
  27751. var me = this;
  27752. if (e.getKey() === e.ENTER) {
  27753. me.fireEvent('search', me, e);
  27754. }
  27755. },
  27756. afterrender: function (sender, e) {
  27757. var _a;
  27758. this.replaceRawInputEvent();
  27759. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  27760. }
  27761. },
  27762. }, baseConfig(config, 'col-item'), config, search);
  27763. this.superclass.constructor.call(self, newConfig);
  27764. 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 : '';
  27765. vv = _$2.replace(vv, "{", "");
  27766. vv = _$2.replace(vv, "}", "");
  27767. this.bindTargert = vv;
  27768. this.bindTargert = _$2.trim(this.bindTargert);
  27769. },
  27770. setBindValue: function (arrValue) {
  27771. if (this.bindTargert) {
  27772. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  27773. }
  27774. },
  27775. replaceRawInputEvent: function () {
  27776. var me = this;
  27777. var $dom = $(me.inputEl.dom);
  27778. $dom.on('input', function (e) {
  27779. var _a, _b, _c, _d, _e, _f;
  27780. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  27781. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  27782. if (!a.endsWith(",") && a.length > 0) {
  27783. e.currentTarget.value = a + ",";
  27784. }
  27785. else {
  27786. e.currentTarget.value = a;
  27787. }
  27788. }
  27789. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  27790. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  27791. _$2.remove(arr, function (it) {
  27792. return !it;
  27793. });
  27794. me.setBindValue(arr);
  27795. stopEvent(e);
  27796. });
  27797. $dom.on('keyup', function (e) {
  27798. me.fireEvent('keyup', me, e);
  27799. // invokeMethod(me.config.listeners?.keyup, me, e)
  27800. stopEvent(e);
  27801. });
  27802. $dom.on('keydown', function (e) {
  27803. me.fireEvent('keydown', me, e);
  27804. // invokeMethod(me.config.listeners?.keydown, me, e)
  27805. //stopEvent(e)
  27806. });
  27807. $dom.on('change', function (e) {
  27808. stopEvent(e);
  27809. });
  27810. $dom.on('paste', function (e) {
  27811. var _a;
  27812. // @ts-ignore
  27813. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  27814. var text = clipdata.getData("text/plain");
  27815. var spliter = ',';
  27816. text = text.replaceAll("\r", "");
  27817. text = text.replaceAll("\n", spliter);
  27818. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  27819. var arr = text.split(spliter);
  27820. if (arr && Array.isArray(arr)) {
  27821. for (var i = 0; i < arr.length; i++) {
  27822. arr[i] = _$2.trim(arr[i]);
  27823. }
  27824. }
  27825. _$2.remove(arr, function (it) {
  27826. return !it;
  27827. });
  27828. me.setBindValue(arr);
  27829. stopEvent(e);
  27830. });
  27831. },
  27832. onChange: function (newVal, oldVal) {
  27833. var me = this;
  27834. var value = newVal;
  27835. if (value) {
  27836. me.getTrigger('clear').show();
  27837. me.updateLayout();
  27838. }
  27839. else {
  27840. me.getTrigger('clear').hide();
  27841. me.updateLayout();
  27842. }
  27843. },
  27844. /**
  27845. * 清空所有值
  27846. */
  27847. onClearClick: function (sender, e) {
  27848. var me = this;
  27849. var config = me.config;
  27850. var lookup = config.lookup;
  27851. me.setValue('');
  27852. clearViewModelByLookup(sender, lookup);
  27853. }
  27854. });
  27855. }
  27856. function initDate () {
  27857. var cc = Ext.form.field.Date.prototype.constructor;
  27858. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  27859. Ext.form.field.Date.override({
  27860. format: 'Y-m-d',
  27861. altFormats: 'Y-m-d',
  27862. constructor: function (config) {
  27863. var newConfig = _$2.defaultsDeep({
  27864. // 强制属性
  27865. }, baseConfig(config, 'col-item'), config, date);
  27866. cc.call(this, newConfig);
  27867. },
  27868. getValue: function () {
  27869. var ov = getValue.call(this);
  27870. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  27871. // console.log('cc:', nv, ov)
  27872. return nv;
  27873. },
  27874. // focus2() {
  27875. // const that = this
  27876. // if (that.isExpanded) {
  27877. // that.collapse()
  27878. //
  27879. // } else {
  27880. // that.expand();
  27881. // }
  27882. // _.defer(() => {
  27883. // that.focus()
  27884. // })
  27885. // },
  27886. initComponent: function () {
  27887. this.on({
  27888. afterrender: function () {
  27889. var config = this.config;
  27890. // 日期框,不要默认弹出
  27891. // $(this.el.dom).on('click', toggle.bind(this))
  27892. },
  27893. destory: function () {
  27894. // 日期框,不要默认弹出
  27895. // $(this.el.dom).off('click', toggle.bind(this))
  27896. },
  27897. change: {
  27898. fn: function (sender) {
  27899. if (sender.format === 'Y-m-d') {
  27900. // 年月日格式
  27901. var value = sender.getRawValue();
  27902. if (/^\d{8}$/.test(value)) {
  27903. // 8位数字,自动转换为 YYYY-MM-DD
  27904. var newValue = [
  27905. value.substr(0, 4),
  27906. value.substr(4, 2),
  27907. value.substr(6, 2)
  27908. ].join('-');
  27909. sender.setValue(newValue);
  27910. }
  27911. }
  27912. },
  27913. }
  27914. // focus: {
  27915. // // 获得焦点后自动下拉
  27916. // fn(sender) {
  27917. // sender.expand();
  27918. // this.doQuery(this.allQuery, true);
  27919. // },
  27920. // },
  27921. });
  27922. initComponent.call(this);
  27923. },
  27924. createInitialDate: function (value) {
  27925. var minValue = this.minValue, maxValue = this.maxValue;
  27926. value = value || syncDate(new Date());
  27927. if (minValue && minValue > value) {
  27928. value = minValue;
  27929. }
  27930. else if (maxValue && maxValue < value) {
  27931. value = maxValue;
  27932. }
  27933. return value;
  27934. },
  27935. });
  27936. }
  27937. function initDateTimePicker () {
  27938. Ext.define('Yvan.DateTimePicker', {
  27939. extend: 'Ext.picker.Date',
  27940. alias: 'datetimepicker',
  27941. alternateClassName: 'Ext.DateTimePicker',
  27942. renderTpl: [
  27943. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  27944. '<div class="{baseCls}-header">',
  27945. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  27946. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  27947. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  27948. '</div>',
  27949. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  27950. '<thead>',
  27951. '<tr role="row">',
  27952. '<tpl for="dayNames">',
  27953. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  27954. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  27955. '</th>',
  27956. '</tpl>',
  27957. '</tr>',
  27958. '</thead>',
  27959. '<tbody>',
  27960. '<tr role="row">',
  27961. '<tpl for="days">',
  27962. '{#:this.isEndOfWeek}',
  27963. '<td role="gridcell">',
  27964. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  27965. '</td>',
  27966. '</tpl>',
  27967. '</tr>',
  27968. '</tbody>',
  27969. '</table>',
  27970. '<tpl if="showToday">',
  27971. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  27972. '</tpl>',
  27973. // These elements are used with Assistive Technologies such as screen readers
  27974. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  27975. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  27976. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  27977. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  27978. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  27979. '</div>',
  27980. {
  27981. firstInitial: function (value) {
  27982. return Ext.picker.Date.prototype.getDayInitial(value);
  27983. },
  27984. isEndOfWeek: function (value) {
  27985. // convert from 1 based index to 0 based
  27986. // by decrementing value once.
  27987. value--;
  27988. // eslint-disable-next-line vars-on-top
  27989. var end = value % 7 === 0 && value !== 0;
  27990. return end ? '</tr><tr role="row">' : '';
  27991. },
  27992. renderTodayBtn: function (values, out) {
  27993. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  27994. },
  27995. renderMonthBtn: function (values, out) {
  27996. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  27997. }
  27998. }
  27999. ],
  28000. beforeRender: function () {
  28001. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  28002. this.superclass.beforeRender.call(this);
  28003. function handleInput(extHandle, $input) {
  28004. var $dom = $(extHandle.el.dom);
  28005. // const $up = $dom.find('.x-form-spinner-up')
  28006. // const $down = $dom.find('.x-form-spinner-down')
  28007. // debugger
  28008. // $up.on('mousedown', () => {
  28009. // debugger
  28010. // });
  28011. // $up.on('click', () => {
  28012. // debugger
  28013. // });
  28014. extHandle.on('click', function (sender) {
  28015. var hideBak = me.hide;
  28016. me.hide = Ext.emptyFn;
  28017. extHandle.focus();
  28018. me.hide = hideBak;
  28019. });
  28020. var changeValue = function (delta) {
  28021. if (_$2.trim(extHandle.getValue()) === '') {
  28022. extHandle.setValue(extHandle.minValue);
  28023. }
  28024. else {
  28025. var v = parseInt('' + extHandle.getValue());
  28026. if (v + delta > extHandle.maxValue) {
  28027. extHandle.setValue(extHandle.minValue);
  28028. }
  28029. else if (v + delta < extHandle.minValue) {
  28030. extHandle.setValue(extHandle.maxValue);
  28031. }
  28032. else {
  28033. extHandle.setValue(v + delta);
  28034. }
  28035. }
  28036. };
  28037. $input.on('mousewheel', function (e) {
  28038. e.stopPropagation();
  28039. var event = e.originalEvent;
  28040. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  28041. // if (event.wheelDelta) {
  28042. // delta = event.wheelDelta / 120;
  28043. // } else if (event.detail) {
  28044. // delta = -event.detail / 3;
  28045. // }
  28046. var zoomSize = Math.ceil(eventDelta / 120);
  28047. changeValue(zoomSize);
  28048. // console.log('delta', delta)
  28049. // $input.focus()
  28050. });
  28051. }
  28052. me.input1 = Ext.create('Ext.form.field.Number', {
  28053. minValue: 0,
  28054. maxValue: 23,
  28055. flex: 1,
  28056. enableKeyEvents: true,
  28057. fieldLabel: '时',
  28058. labelWidth: 20,
  28059. hideLabel: true,
  28060. spinDownEnabled: false,
  28061. spinUpEnabled: false,
  28062. style: {
  28063. marginLeft: '5px',
  28064. },
  28065. listeners: {
  28066. afterrender: function (sender) {
  28067. var $input = $(sender.inputEl.dom);
  28068. handleInput(me.input1, $input);
  28069. },
  28070. change: function (sender, e) {
  28071. if (me.getValue()) {
  28072. me.value.setHours(sender.getValue());
  28073. }
  28074. },
  28075. }
  28076. });
  28077. me.input2 = Ext.create('Ext.form.field.Number', {
  28078. minValue: 0,
  28079. maxValue: 59,
  28080. flex: 1,
  28081. enableKeyEvents: true,
  28082. fieldLabel: ' ',
  28083. hideLabel: false,
  28084. labelWidth: 8,
  28085. spinDownEnabled: false,
  28086. spinUpEnabled: false,
  28087. listeners: {
  28088. afterrender: function (sender) {
  28089. var $input = $(sender.inputEl.dom);
  28090. handleInput(me.input2, $input);
  28091. },
  28092. change: function (sender, e) {
  28093. if (me.getValue()) {
  28094. me.value.setMinutes(sender.getValue());
  28095. }
  28096. },
  28097. }
  28098. });
  28099. me.input3 = Ext.create('Ext.form.field.Number', {
  28100. minValue: 0,
  28101. maxValue: 59,
  28102. flex: 1,
  28103. enableKeyEvents: true,
  28104. fieldLabel: ' ',
  28105. hideLabel: false,
  28106. labelWidth: 8,
  28107. spinDownEnabled: false,
  28108. spinUpEnabled: false,
  28109. style: {
  28110. marginRight: '5px',
  28111. },
  28112. listeners: {
  28113. afterrender: function (sender) {
  28114. var $input = $(sender.inputEl.dom);
  28115. handleInput(me.input3, $input);
  28116. },
  28117. change: function (sender, e) {
  28118. if (me.getValue()) {
  28119. me.value.setSeconds(sender.getValue());
  28120. }
  28121. },
  28122. }
  28123. });
  28124. me.confirmBtn = new Ext.button.Button({
  28125. text: '确认',
  28126. handler: me.confirmClick,
  28127. scope: me
  28128. });
  28129. me.tdBtn = new Ext.button.Button({
  28130. text: '现在',
  28131. handler: me.selectToday,
  28132. scope: me
  28133. });
  28134. me.todayBtn = Ext.create('Ext.container.Container', {
  28135. layout: 'anchor', border: false,
  28136. defaults: {
  28137. border: false, anchor: '100%',
  28138. margin: '0 0 5 0',
  28139. },
  28140. items: [
  28141. {
  28142. layout: 'hbox',
  28143. items: [
  28144. me.input1,
  28145. me.input2,
  28146. me.input3,
  28147. ]
  28148. },
  28149. {
  28150. layout: 'hbox',
  28151. items: [
  28152. me.confirmBtn,
  28153. me.tdBtn,
  28154. ]
  28155. }
  28156. ]
  28157. });
  28158. },
  28159. // finishRenderChildren() {
  28160. // var me = this;
  28161. //
  28162. // this.superclass.finishRenderChildren.call(this);
  28163. // //*
  28164. // me.input1.finishRender();
  28165. // me.input2.finishRender();
  28166. // me.input3.finishRender();
  28167. // //
  28168. // me.tdBtn.finishRender();
  28169. // me.confirmBtn.finishRender();
  28170. // },
  28171. setValue: function (value) {
  28172. //this.value = Ext.Date.clearTime(value, true);
  28173. this.value = value;
  28174. this.input1.setValue(this.value.getHours());
  28175. this.input2.setValue(this.value.getMinutes());
  28176. this.input3.setValue(this.value.getSeconds());
  28177. return this.update(this.value);
  28178. },
  28179. selectDate: function (value) {
  28180. if (this.showTime) {
  28181. value.setHours(this.input1.getValue());
  28182. value.setMinutes(this.input2.getValue());
  28183. value.setSeconds(this.input3.getValue());
  28184. }
  28185. this.value = value;
  28186. return this.update(this.value);
  28187. },
  28188. setDisabledStatus: function (disabled) {
  28189. var me = this;
  28190. debugger;
  28191. // me.callParent();
  28192. if (me.showTime) {
  28193. me.confirmBtn.setDisabled(disabled);
  28194. }
  28195. if (me.isShowFooter()) {
  28196. me.footerContainer.setDisabled(disabled);
  28197. }
  28198. },
  28199. handleDateClick: function (e, t) {
  28200. var me = this, handler = me.handler;
  28201. // e.stopEvent();
  28202. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  28203. me.doCancelFocus = me.focusOnSelect === false;
  28204. me.selectDate(new Date(t.dateValue));
  28205. delete me.doCancelFocus;
  28206. /* 有时间输入时单击事件不退出选择,只移动光标 */
  28207. if (me.showTime) {
  28208. return;
  28209. }
  28210. me.fireEvent('select', me, me.value);
  28211. if (handler) {
  28212. handler.call(me.scope || me, me, me.value);
  28213. }
  28214. me.onSelect();
  28215. }
  28216. },
  28217. selectToday: function () {
  28218. var me = this, btn = me.todayBtn, handler = me.handler;
  28219. if (btn && !btn.disabled) {
  28220. me.value = syncDate(new Date());
  28221. me.update(me.value);
  28222. me.fireEvent('select', me, me.value);
  28223. if (handler) {
  28224. handler.call(me.scope || me, me, me.value);
  28225. }
  28226. me.onSelect();
  28227. me.hide();
  28228. }
  28229. return me;
  28230. },
  28231. confirmClick: function () {
  28232. var me = this, btn = me.confirmBtn, handler = me.handler;
  28233. if (btn && !btn.disabled) {
  28234. me.fireEvent('select', me, me.value);
  28235. if (handler) {
  28236. handler.call(me.scope || me, me, me.value);
  28237. }
  28238. me.onSelect();
  28239. me.hide();
  28240. }
  28241. return me;
  28242. },
  28243. selectedUpdate: function (date) {
  28244. var me = this,
  28245. //t = date.getTime(),
  28246. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  28247. cells.removeCls(cls);
  28248. for (c = 0; c < cLen; c++) {
  28249. cell = Ext.fly(cellItems[c]);
  28250. if (cell.dom.firstChild.dateValue == t) {
  28251. me.fireEvent('highlightitem', me, cell);
  28252. cell.addCls(cls);
  28253. if (me.isVisible() && !me.doCancelFocus) {
  28254. Ext.fly(cell.dom.firstChild).focus(50);
  28255. }
  28256. break;
  28257. }
  28258. }
  28259. },
  28260. // private, inherit docs
  28261. beforeDestroy: function () {
  28262. var me = this;
  28263. if (me.rendered) {
  28264. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  28265. }
  28266. me.superclass.beforeDestroy.call(this);
  28267. }
  28268. });
  28269. }
  28270. function initDateTime () {
  28271. Ext.define('Yvan.DateTimeField', {
  28272. extend: 'Ext.form.field.Date',
  28273. xtype: 'datetimefield',
  28274. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  28275. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  28276. showTime: true,
  28277. format: "Y-m-d H:i:s",
  28278. constructor: function (config) {
  28279. var newConfig = _$2.defaultsDeep({
  28280. // 强制属性
  28281. }, baseConfig(config, 'col-item'), config, date);
  28282. this.superclass.constructor.call(this, newConfig);
  28283. },
  28284. initComponent: function () {
  28285. this.superclass.initComponent.call(this);
  28286. var setInitValue = function () {
  28287. var value = this.getRawValue();
  28288. if (!value) {
  28289. // 没填内容的时候,自动设置当前时间
  28290. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  28291. }
  28292. };
  28293. this.on({
  28294. afterrender: function () {
  28295. var config = this.config;
  28296. // 日期框,不要默认弹出
  28297. $(this.el.dom).on('click', setInitValue.bind(this));
  28298. },
  28299. destory: function () {
  28300. // 日期框,不要默认弹出
  28301. $(this.el.dom).off('click', setInitValue.bind(this));
  28302. },
  28303. change: {
  28304. fn: function (sender) {
  28305. if (sender.format === "Y-m-d H:i:s") {
  28306. // 年月日格式
  28307. var value = sender.getRawValue();
  28308. if (/^\d{14}$/.test(value)) {
  28309. // 8位数字,自动转换为 YYYY-MM-DD
  28310. var newValue = [
  28311. value.substr(0, 4),
  28312. '-',
  28313. value.substr(4, 2),
  28314. '-',
  28315. value.substr(6, 2),
  28316. ' ',
  28317. value.substr(8, 2),
  28318. ':',
  28319. value.substr(10, 2),
  28320. ':',
  28321. value.substr(12, 2)
  28322. ].join('');
  28323. sender.setValue(newValue);
  28324. }
  28325. }
  28326. },
  28327. }
  28328. });
  28329. },
  28330. getValue: function () {
  28331. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  28332. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  28333. // console.log('cc:', nv, ov)
  28334. return nv;
  28335. },
  28336. onExpand: function () {
  28337. var strValue = this.getValue();
  28338. var value;
  28339. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  28340. 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)));
  28341. }
  28342. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  28343. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  28344. }
  28345. else {
  28346. value = syncDate(new Date());
  28347. }
  28348. this.picker.setValue(value);
  28349. },
  28350. createPicker: function () {
  28351. var me = this, format = Ext.String.format;
  28352. //@ts-ignore
  28353. return new Yvan.DateTimePicker({
  28354. pickerField: me,
  28355. ownerCt: me.ownerCt,
  28356. renderTo: document.body,
  28357. floating: true,
  28358. hidden: true,
  28359. focusOnShow: true,
  28360. minDate: me.minValue,
  28361. maxDate: me.maxValue,
  28362. disabledDatesRE: me.disabledDatesRE,
  28363. disabledDatesText: me.disabledDatesText,
  28364. disabledDays: me.disabledDays,
  28365. disabledDaysText: me.disabledDaysText,
  28366. format: me.format,
  28367. showToday: me.showToday,
  28368. showTime: me.showTime,
  28369. startDay: me.startDay,
  28370. minText: format(me.minText, me.formatDate(me.minValue)),
  28371. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  28372. listeners: {
  28373. scope: me,
  28374. select: me.onSelect
  28375. },
  28376. keyNavConfig: {
  28377. esc: function () {
  28378. me.collapse();
  28379. }
  28380. }
  28381. });
  28382. },
  28383. });
  28384. }
  28385. function initNumber () {
  28386. var cc = Ext.form.field.Number.prototype.constructor;
  28387. var initComponent = Ext.form.field.Number.prototype.initComponent;
  28388. Ext.form.field.Number.override({
  28389. constructor: function (config) {
  28390. var newConfig = _$2.defaultsDeep({
  28391. // 强制属性
  28392. }, baseConfig(config, 'col-item'), config, numberfield);
  28393. cc.call(this, newConfig);
  28394. },
  28395. initComponent: function () {
  28396. this.on({
  28397. afterrender: function (sender) {
  28398. var _this = this;
  28399. var _a;
  28400. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  28401. sender.inputEl.dom.setAttribute('spellcheck', "false");
  28402. $$2(sender.inputEl.dom).on('click', function (e) {
  28403. sender.fireEvent('click', _this, e);
  28404. });
  28405. }
  28406. }
  28407. });
  28408. initComponent.call(this);
  28409. },
  28410. });
  28411. }
  28412. function initCheckbox () {
  28413. var cc = Ext.form.field.Checkbox.prototype.constructor;
  28414. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  28415. Ext.form.field.Checkbox.override({
  28416. constructor: function (config) {
  28417. var newConfig = _$2.defaultsDeep({
  28418. // 强制属性
  28419. }, baseConfig(config, 'col-item'), config, checkbox);
  28420. cc.call(this, newConfig);
  28421. },
  28422. getValue: function () {
  28423. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  28424. var ov = getValue.call(this);
  28425. // const ov = this.getRawValue()
  28426. return (ov ? checkedValue : uncheckedValue);
  28427. },
  28428. setValue: function (nv) {
  28429. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  28430. var value;
  28431. if (nv === checkedValue) {
  28432. value = true;
  28433. }
  28434. else if (nv === uncheckedValue) {
  28435. value = false;
  28436. }
  28437. else {
  28438. value = !!nv;
  28439. }
  28440. // me.setRawValue(value)
  28441. // me.checked = value
  28442. // return me.mixins.field.setValue.call(me, value);
  28443. setValue.call(this, value);
  28444. },
  28445. updateCheckedCls: function (checked) {
  28446. var me = this;
  28447. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  28448. checked = checked != null ? checked : me.getValue();
  28449. if (checked === uncheckedValue) {
  28450. checked = false;
  28451. }
  28452. else if (checked === checkedValue) {
  28453. checked = true;
  28454. }
  28455. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  28456. },
  28457. initComponent: function () {
  28458. initComponent.call(this);
  28459. },
  28460. });
  28461. }
  28462. function initCheckboxGroup () {
  28463. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  28464. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  28465. Ext.form.CheckboxGroup.override({
  28466. constructor: function (config) {
  28467. var newConfig = _$2.defaultsDeep({
  28468. // 强制属性
  28469. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  28470. cc.call(this, newConfig);
  28471. },
  28472. initComponent: function () {
  28473. initComponent.call(this);
  28474. },
  28475. });
  28476. }
  28477. function initRadio () {
  28478. var cc = Ext.form.field.Radio.prototype.constructor;
  28479. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  28480. Ext.form.field.Radio.override({
  28481. constructor: function (config) {
  28482. var newConfig = _$2.defaultsDeep({
  28483. // 强制属性
  28484. }, baseConfig(config, 'col-item'), config, radio);
  28485. cc.call(this, newConfig);
  28486. },
  28487. initComponent: function () {
  28488. initComponent.call(this);
  28489. },
  28490. });
  28491. }
  28492. function initRadioGroup () {
  28493. var cc = Ext.form.RadioGroup.prototype.constructor;
  28494. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  28495. Ext.form.RadioGroup.override({
  28496. constructor: function (config) {
  28497. var newConfig = _$2.defaultsDeep({
  28498. // 强制属性
  28499. }, baseConfig(config, 'col-item'), config, radiogroup);
  28500. cc.call(this, newConfig);
  28501. },
  28502. initComponent: function () {
  28503. initComponent.call(this);
  28504. },
  28505. });
  28506. }
  28507. function initFieldset () {
  28508. /**
  28509. *
  28510. */
  28511. var ct = Ext.form.FieldSet.prototype.constructor;
  28512. Ext.form.FieldSet.override({
  28513. constructor: function (config) {
  28514. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  28515. ct.call(this, newConfig);
  28516. }
  28517. });
  28518. }
  28519. function initCombotree () {
  28520. Ext.define('Yvan.ComboTree', {
  28521. extend: 'Ext.form.field.Picker',
  28522. xtype: 'combotree',
  28523. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  28524. config: {
  28525. store: null,
  28526. displayField: null,
  28527. columns: null,
  28528. selectOnTab: true,
  28529. maxPickerHeight: 300,
  28530. minPickerHeight: 100,
  28531. minPickerWidth: 350,
  28532. rootVisible: true,
  28533. },
  28534. editable: false,
  28535. setStore: function (store) {
  28536. this.store = store;
  28537. var me = this;
  28538. if (me.store) {
  28539. if (me.picker) {
  28540. me.picker.setStore(store);
  28541. if (me.isExpanded) {
  28542. me.collapse();
  28543. delete me.picker;
  28544. me.expand();
  28545. }
  28546. }
  28547. this.onLoad();
  28548. me.mon(me.store, {
  28549. scope: me,
  28550. load: me.onLoad,
  28551. update: me.onUpdate
  28552. });
  28553. }
  28554. },
  28555. createPicker: function () {
  28556. var me = this;
  28557. var picker = new Ext.tree.Panel({
  28558. border: false,
  28559. baseCls: Ext.baseCSSPrefix + 'boundlist',
  28560. shrinkWrapDock: 2,
  28561. store: me.store,
  28562. floating: true,
  28563. rootVisible: me.rootVisible,
  28564. displayField: me.displayField,
  28565. columns: me.columns,
  28566. minHeight: me.minPickerHeight,
  28567. maxHeight: me.maxPickerHeight,
  28568. minWidth: me.minPickerWidth,
  28569. manageHeight: false,
  28570. shadow: false,
  28571. scrollable: true,
  28572. // modal: true,
  28573. // constrain: true,
  28574. // constrainTo: topScope._handle.el.dom,
  28575. // renderTo: topScope._handle.el.dom,
  28576. // alignTarget: topScope._handle,
  28577. listeners: {
  28578. scope: me,
  28579. itemclick: me.onItemClick,
  28580. itemkeydown: me.onPickerKeyDown
  28581. }
  28582. }), view = picker.getView();
  28583. if (Ext.isIE9 && Ext.isStrict) {
  28584. view.on({
  28585. scope: me,
  28586. highlightitem: me.repaintPickerView,
  28587. unhighlightitem: me.repaintPickerView,
  28588. afteritemexpand: me.repaintPickerView,
  28589. afteritemcollapse: me.repaintPickerView
  28590. });
  28591. }
  28592. return picker;
  28593. },
  28594. repaintPickerView: function () {
  28595. var style = this.picker.getView().getEl().dom.style;
  28596. style.display = style.display;
  28597. },
  28598. onItemClick: function (view, record, node, rowIndex, e) {
  28599. this.selectItem(view, record);
  28600. },
  28601. onPickerKeyDown: function (treeView, record, item, index, e) {
  28602. var key = e.getKey();
  28603. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  28604. this.selectItem(treeView, record);
  28605. }
  28606. },
  28607. selectItem: function (sender, record) {
  28608. var me = this;
  28609. me.setValue(record.getId());
  28610. me.fireEvent('select', me, record);
  28611. me.collapse();
  28612. },
  28613. onExpand: function () {
  28614. var picker = this.picker;
  28615. var store = picker.store;
  28616. var value = this.value;
  28617. var node;
  28618. if (value) {
  28619. node = store.getNodeById(value);
  28620. }
  28621. if (!node) {
  28622. node = store.getRoot();
  28623. }
  28624. picker.ensureVisible(node, {
  28625. select: true,
  28626. focus: true
  28627. });
  28628. },
  28629. setValue: function (value) {
  28630. var me = this;
  28631. console.log('setValue', value);
  28632. me.value = value;
  28633. if (!me.store || me.store.loading) {
  28634. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  28635. return me.mixins.field.setValue.call(me, value);
  28636. // return me;
  28637. }
  28638. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  28639. if (value === undefined) {
  28640. record = me.store.getRoot();
  28641. console.log('setValue', record.getId());
  28642. me.value = record.getId();
  28643. return me.mixins.field.setValue.call(me, value);
  28644. }
  28645. else {
  28646. record = me.store.getNodeById(value);
  28647. }
  28648. // set the raw value to the record's display field if a record was found
  28649. me.setRawValue(record ? record.get(me.displayField) : '');
  28650. return me.mixins.field.setValue.call(me, value);
  28651. },
  28652. getSubmitValue: function () {
  28653. return this.value;
  28654. },
  28655. getValue: function () {
  28656. return this.value;
  28657. },
  28658. onLoad: function () {
  28659. var value = this.value;
  28660. if (value) {
  28661. this.setValue(value);
  28662. }
  28663. },
  28664. onUpdate: function (store, rec, type, modifiedFieldNames) {
  28665. var display = this.displayField;
  28666. var me = this;
  28667. if (type === 'edit' && modifiedFieldNames &&
  28668. Ext.Array.contains(modifiedFieldNames, display) &&
  28669. this.value === rec.getId()) {
  28670. me.mixins.field.setValue.call(me, this.value);
  28671. this.setRawValue(rec.get(display));
  28672. }
  28673. }
  28674. });
  28675. }
  28676. function initPickerPlus () {
  28677. Ext.define('Yvan.PickerAlignCenter', {
  28678. extend: 'Ext.form.field.Picker',
  28679. /**
  28680. * Performs the alignment on the picker using the class defaults
  28681. * @private
  28682. */
  28683. doAlign: function () {
  28684. // 不要挪动就好
  28685. },
  28686. });
  28687. }
  28688. function initCombogrid () {
  28689. Ext.define('Yvan.ComboGrid', {
  28690. extend: 'Ext.form.field.Picker',
  28691. // extend: 'Yvan.PickerAlignCenter',
  28692. xtype: 'combogrid',
  28693. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  28694. triggers: {
  28695. clear: {
  28696. weight: 0,
  28697. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  28698. hidden: true,
  28699. handler: 'onClearClick',
  28700. },
  28701. },
  28702. config: __assign({}, comboGrid),
  28703. editable: true,
  28704. _superBlur: false,
  28705. allowCustomInput: false,
  28706. pressEnterPopup: true,
  28707. initComponent: function () {
  28708. var that = this;
  28709. var scope = lookupScope(that);
  28710. var config = that.config;
  28711. if (isDesignMode(scope, config)) {
  28712. this.superclass.initComponent.call(this, arguments);
  28713. return;
  28714. }
  28715. this.on({
  28716. blur: function (sender, e) {
  28717. if (this._superBlur) {
  28718. // 挂起时不恢复内容
  28719. return;
  28720. }
  28721. // 离开焦点时,恢复原来的值
  28722. sender.setRawValue(sender.value);
  28723. },
  28724. afterrender: function (sender) {
  28725. var $dom = $(sender.inputEl.dom);
  28726. that.scope = lookupScope(sender);
  28727. if (sender.column) {
  28728. // 列模式,拦截 keydown
  28729. $dom.on('keydown', function (e) {
  28730. if (isChartEvent(e) && !that.tryEnable()) {
  28731. // 没有达成 editEnable 条件,不用响应
  28732. stopEvent(e);
  28733. return;
  28734. }
  28735. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  28736. stopEvent(e);
  28737. that.onTriggerClick(that, that.getPickerTrigger(), e);
  28738. return;
  28739. }
  28740. });
  28741. }
  28742. else {
  28743. // 常规模式,拦截 keyup
  28744. $dom.on('keyup', function (e) {
  28745. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  28746. return;
  28747. }
  28748. if (isChartEvent(e) && !that.tryEnable()) {
  28749. // 没有达成 editEnable 条件,不用响应
  28750. stopEvent(e);
  28751. return;
  28752. }
  28753. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  28754. stopEvent(e);
  28755. that.onTriggerClick(that, that.getPickerTrigger(), e);
  28756. return;
  28757. }
  28758. if (!that.allowCustomInput) {
  28759. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  28760. stopEvent(e);
  28761. }
  28762. });
  28763. $dom.on('change', function (e) {
  28764. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  28765. // if (that.isExpanded) {
  28766. // that.filterChange(that, e.target.value)
  28767. // }
  28768. stopEvent(e);
  28769. });
  28770. }
  28771. $dom.on('input', function (e) {
  28772. stopEvent(e);
  28773. });
  28774. },
  28775. });
  28776. this.superclass.initComponent.apply(this, arguments);
  28777. },
  28778. createPicker: function () {
  28779. var me = this;
  28780. var cfg = {
  28781. layout: 'fit',
  28782. border: 0,
  28783. // border: 5,
  28784. style: {
  28785. // borderColor: 'black',
  28786. // borderWidth: '5px',
  28787. // borderStyle: 'solid',
  28788. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  28789. },
  28790. shadow: 'side',
  28791. shadowOffset: 100,
  28792. baseCls: Ext.baseCSSPrefix + 'boundlist',
  28793. shrinkWrapDock: 2,
  28794. floating: true,
  28795. width: me.pickerWidth,
  28796. height: me.pickerHeight,
  28797. minWidth: me.pickerWidth,
  28798. minHeight: me.pickerHeight,
  28799. maxWidth: me.pickerWidth,
  28800. maxHeight: me.pickerHeight,
  28801. items: [
  28802. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  28803. xtype: 'toolbar',
  28804. items: [
  28805. { xtype: 'textfield', fieldLabel: '筛选' },
  28806. {
  28807. xtype: 'button',
  28808. text: '查询',
  28809. iconCls: 'x-fa fa-search',
  28810. cssType: 'primary',
  28811. listeners: {
  28812. click: function () {
  28813. me.reloadGrid();
  28814. }
  28815. }
  28816. },
  28817. ]
  28818. }, autoLoad: false, listeners: {
  28819. afterrender: function (grid) {
  28820. me.grid = grid;
  28821. grid.focus();
  28822. grid.on({
  28823. rowdblclick: function (sender, row) {
  28824. me.selectItem(row);
  28825. },
  28826. dataLoadComplete: function (sender) {
  28827. _$2.defer(function () {
  28828. me.setFocus();
  28829. });
  28830. },
  28831. keydown: function (sender, e) {
  28832. if (me.column) {
  28833. // 列模式,拦截 keydown
  28834. me.processKey(e);
  28835. }
  28836. },
  28837. keyup: function (sender, e) {
  28838. if (!me.column) {
  28839. // 常规模式,拦截 keyup
  28840. me.processKey(e);
  28841. }
  28842. }
  28843. });
  28844. },
  28845. } })
  28846. ]
  28847. };
  28848. // @ts-ignore
  28849. var picker = new Ext.container.Container(cfg);
  28850. return picker;
  28851. },
  28852. setFocus: function () {
  28853. if (this.grid.store.getCount() > 0) {
  28854. this.grid.focusRow(0);
  28855. }
  28856. },
  28857. processKey: function (e) {
  28858. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  28859. this.selectItem(this.grid.selection);
  28860. stopEvent(e);
  28861. }
  28862. else if (e.key === 'Escape') {
  28863. this.collapse();
  28864. }
  28865. },
  28866. repaintPickerView: function () {
  28867. var style = this.picker.getView().getEl().dom.style;
  28868. style.display = style.display;
  28869. },
  28870. onItemClick: function (view, record, node, rowIndex, e) {
  28871. this.selectItem(record);
  28872. },
  28873. onPickerKeyDown: function (treeView, record, item, index, e) {
  28874. var key = e.getKey();
  28875. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  28876. this.selectItem(record);
  28877. }
  28878. },
  28879. filterChange: _$2.debounce(function (sender, value) {
  28880. sender.onExpand();
  28881. }, 1000),
  28882. selectItem: function (record) {
  28883. var me = this;
  28884. var lookup = this.lookup;
  28885. var scope = lookupScope(this);
  28886. me.fireEvent('select', me, record);
  28887. if (record.isModel) {
  28888. record = record.data;
  28889. }
  28890. tryWriteObject(lookup, record, function (path, value) {
  28891. me._lookupSet(path, value);
  28892. });
  28893. // lookup
  28894. // fromColumn: 'toTarget'
  28895. // fromColumn: 'toTarget'
  28896. // fromColumn: 'toTarget'
  28897. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  28898. var value = _$2.get(record, fromColumn);
  28899. me._lookupSet(toTarget, value);
  28900. });
  28901. // 选定之后不能做清空
  28902. // const {lookupClearOnChange} = me
  28903. // if (_.isArray(lookupClearOnChange)) {
  28904. // _.each(lookupClearOnChange, item => {
  28905. // me._lookupSet(item, '')
  28906. // })
  28907. // }
  28908. me.collapse();
  28909. // 触发 _raiseNextFocus
  28910. me._raiseNextFocus(me);
  28911. },
  28912. onExpand: function () {
  28913. // 展开时,根据 lookup 带入查询参数
  28914. var expressData = this.getExpressData();
  28915. var txtField = this.grid.down('toolbar').down('textfield');
  28916. txtField.setValue(expressData.queryValue);
  28917. this.reloadGrid();
  28918. },
  28919. reloadGrid: function () {
  28920. // 展开时,根据 lookup 带入查询参数
  28921. var expressData = this.getExpressData();
  28922. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  28923. var txtField = this.grid.down('toolbar').down('textfield');
  28924. // 每个 combogrid 默认带上 __queryValue 属性
  28925. reloadParam["__queryValue"] = txtField.getValue();
  28926. this.grid.reload(reloadParam);
  28927. },
  28928. onTriggerClick: function (sender) {
  28929. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  28930. if (!grid) {
  28931. msg('正在初始化,请稍后');
  28932. return;
  28933. }
  28934. if (!this.tryEnable()) {
  28935. // 没有达成 editEnable 条件,不用弹出
  28936. return;
  28937. }
  28938. if (isExpanded || readOnly || disabled) {
  28939. // 已弹出、只读、禁用状态下,不允许弹出
  28940. return;
  28941. }
  28942. this._superBlur = true;
  28943. this.superclass.onTriggerClick.apply(this, arguments);
  28944. this._superBlur = false;
  28945. },
  28946. onCollapse: function () {
  28947. // 每次收回时,删除下拉组件
  28948. // delete this.picker
  28949. },
  28950. /**
  28951. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  28952. */
  28953. setValue: function (value) {
  28954. var me = this;
  28955. // 设值用户看到的表面内容
  28956. this.setRawValue(value);
  28957. // 设值 setValue 调用链,正常触发 change 事件等
  28958. return me.mixins.field.setValue.call(me, value);
  28959. },
  28960. _lookupSet: function (path, value) {
  28961. var me = this;
  28962. path = tryVarSimple(path);
  28963. if (me.column) {
  28964. // 判断写入目标,是否与自己绑定的属性相等
  28965. if (path === 'queryValue' || me.column.dataIndex === path) {
  28966. me.setValue(value);
  28967. }
  28968. // 列模式下,写当前编辑行
  28969. var parentRecord = me._lookupEditorRecord();
  28970. if (parentRecord) {
  28971. // Ext.data.Record / Ext.data.Model
  28972. parentRecord.set(path, value);
  28973. }
  28974. else {
  28975. debugger;
  28976. }
  28977. }
  28978. else {
  28979. // 常规模式下,写 viewModel
  28980. me.scope.viewModel.set(path, value);
  28981. }
  28982. },
  28983. _lookupGrid: function () {
  28984. return this.column.up('grid');
  28985. },
  28986. _lookupEditorRecord: function () {
  28987. var _a, _b, _c, _d;
  28988. // parentGrid.getSelectionModel().getLastSelected()
  28989. var grid = this._lookupGrid();
  28990. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  28991. if (!editingPlugin) {
  28992. return grid.getSelectionModel().getLastSelected();
  28993. }
  28994. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  28995. if (_$2.isNumber(rowIdx)) {
  28996. return grid.store.getAt(rowIdx);
  28997. }
  28998. else {
  28999. return grid.getSelectionModel().getLastSelected();
  29000. }
  29001. },
  29002. onChange: function (newVal, oldVal) {
  29003. var me = this;
  29004. var value = newVal;
  29005. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  29006. if (hideTrigger || disabled || readOnly || hideClear) {
  29007. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  29008. return;
  29009. }
  29010. if (value) {
  29011. me.getTrigger('clear').show();
  29012. me.updateLayout();
  29013. }
  29014. else {
  29015. me.getTrigger('clear').hide();
  29016. me.updateLayout();
  29017. }
  29018. },
  29019. /**
  29020. * 得到能用于 express 表达式计算的上下文数据
  29021. */
  29022. getExpressData: function () {
  29023. var queryValue = this.getRawValue();
  29024. if (!queryValue) {
  29025. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  29026. queryValue = this.getPicker().down('textfield').getRawValue();
  29027. }
  29028. if (this.column) {
  29029. // 列模式, 准备好判断 editEnable 表达式用的数据
  29030. var parentRecord = this._lookupEditorRecord();
  29031. if (!parentRecord) {
  29032. debugger;
  29033. }
  29034. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  29035. }
  29036. else {
  29037. // 编辑模式,准备好判断用的数据
  29038. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  29039. }
  29040. },
  29041. tryEnable: function () {
  29042. return tryEnable(this.getExpressData(), this.editEnable);
  29043. },
  29044. /**
  29045. * 清空所有值
  29046. */
  29047. onClearClick: function (sender, e) {
  29048. var me = this;
  29049. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  29050. me.fireEvent('clear', sender, e);
  29051. me.setValue('');
  29052. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  29053. me._lookupSet(toTarget, '');
  29054. });
  29055. _$2.each(lookupClearOnChange, function (item) {
  29056. me._lookupSet(item, '');
  29057. });
  29058. }
  29059. });
  29060. }
  29061. function initContainer () {
  29062. var cc = Ext.container.Container.prototype.constructor;
  29063. //const {initComponent} = Ext.container.Container.prototype
  29064. Ext.container.Container.override({
  29065. constructor: function (config) {
  29066. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  29067. cc.call(this, newConfig);
  29068. },
  29069. });
  29070. }
  29071. function initRows () {
  29072. Ext.define('Yvan.Rows', {
  29073. extend: 'Ext.container.Container',
  29074. xtype: 'rows',
  29075. constructor: function (config) {
  29076. var self = this;
  29077. var newConfig = _$2.defaultsDeep({
  29078. // 强制性属性
  29079. layout: 'anchor', border: false,
  29080. defaults: {
  29081. border: false, anchor: '100%',
  29082. margin: '0 0 5 0',
  29083. },
  29084. }, baseConfig(config, 'rows-container'), config, rows);
  29085. this.superclass.constructor.call(self, newConfig);
  29086. },
  29087. });
  29088. }
  29089. function initForm () {
  29090. var ct = Ext.form.Panel.prototype.constructor;
  29091. Ext.form.Panel.override({
  29092. constructor: function (config) {
  29093. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  29094. ct.call(this, newConfig);
  29095. }
  29096. });
  29097. }
  29098. function initCols () {
  29099. Ext.define('Yvan.Cols', {
  29100. extend: 'Ext.container.Container',
  29101. xtype: 'cols',
  29102. constructor: function (config) {
  29103. var self = this;
  29104. var newConfig = _$2.defaultsDeep({
  29105. // 强制性属性
  29106. layout: 'hbox',
  29107. minHeight: config.designMode ? 32 : 0
  29108. }, baseConfig(config, 'cols-container'), config, cols);
  29109. this.superclass.constructor.call(self, newConfig);
  29110. },
  29111. });
  29112. }
  29113. function initButton () {
  29114. /**
  29115. *
  29116. */
  29117. var ct = Ext.button.Button.prototype.constructor;
  29118. Ext.button.Button.override({
  29119. constructor: function (config) {
  29120. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  29121. ct.call(this, newConfig);
  29122. },
  29123. setLoading: function (value) {
  29124. if (value) {
  29125. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  29126. this._originIconCls = this.iconCls;
  29127. }
  29128. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  29129. this.setDisabled(true);
  29130. }
  29131. else {
  29132. this.setIconCls(this._originIconCls);
  29133. this.setDisabled(false);
  29134. }
  29135. }
  29136. });
  29137. }
  29138. function initIframe () {
  29139. Ext.define('Ext.ux.IFrame', {
  29140. extend: 'Ext.Component',
  29141. alias: 'widget.uxiframe',
  29142. loadMask: 'Loading...',
  29143. src: 'about:blank',
  29144. renderTpl: [
  29145. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  29146. ],
  29147. childEls: ['iframeEl'],
  29148. initComponent: function () {
  29149. this.superclass.initComponent.call(this);
  29150. this.superclass.initEvents.call(this);
  29151. this.frameName = this.frameName || this.id + '-frame';
  29152. },
  29153. initEvents: function () {
  29154. var me = this;
  29155. this.superclass.initEvents.call(this);
  29156. me.iframeEl.on('load', me.onLoad, me);
  29157. },
  29158. initRenderData: function () {
  29159. return Ext.apply(this.superclass.initRenderData.call(this), {
  29160. src: this.src,
  29161. frameName: this.frameName
  29162. });
  29163. },
  29164. getBody: function () {
  29165. var doc = this.getDoc();
  29166. return doc.body || doc.documentElement;
  29167. },
  29168. getDoc: function () {
  29169. try {
  29170. return this.getWin().document;
  29171. }
  29172. catch (ex) {
  29173. return null;
  29174. }
  29175. },
  29176. getWin: function () {
  29177. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  29178. return win;
  29179. },
  29180. getFrame: function () {
  29181. var me = this;
  29182. return me.iframeEl.dom;
  29183. },
  29184. onLoad: function () {
  29185. var me = this, doc = me.getDoc();
  29186. if (doc) {
  29187. this.el.unmask();
  29188. this.fireEvent('load', this);
  29189. }
  29190. else if (me.src) {
  29191. this.el.unmask();
  29192. this.fireEvent('error', this);
  29193. }
  29194. },
  29195. load: function (src) {
  29196. var me = this, text = me.loadMask, frame = me.getFrame();
  29197. if (me.fireEvent('beforeload', me, src) !== false) {
  29198. if (text && me.el) {
  29199. me.el.mask(text);
  29200. }
  29201. frame.src = me.src = (src || me.src);
  29202. }
  29203. }
  29204. });
  29205. }
  29206. /**
  29207. * 属性:
  29208. * - autoLoad: true
  29209. * - dataSource: ''
  29210. * 方法:
  29211. * - handleZoomBig
  29212. * - handleZoomSmall
  29213. * - handleZoomReset
  29214. * - openDiagram
  29215. * - getBpmn
  29216. * - getBpmnCanvas
  29217. * - getBpmnOverlays
  29218. * - getBpmnZoomScroll
  29219. * 事件:
  29220. * - initFinish
  29221. * - failed
  29222. * - success
  29223. * - itemHover
  29224. * - itemOut
  29225. * - itemClick
  29226. * - itemDblclick
  29227. * - itemMousedown
  29228. * - itemMouseup
  29229. */
  29230. function initBpmn () {
  29231. Ext.define('Yvan.Bpmn', {
  29232. // extend: 'Ext.container.Container',
  29233. extend: 'Ext.panel.Panel',
  29234. alias: 'widget.bpmn',
  29235. xtype: 'bpmn',
  29236. constructor: function (config) {
  29237. var self = this;
  29238. var newConfig = _$2.defaultsDeep({
  29239. // 强制性属性
  29240. }, baseConfig(config, 'row-item'), config, bpmn);
  29241. if (!newConfig.hideToolbar) {
  29242. newConfig.tbar = [];
  29243. newConfig.tbar.push({
  29244. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  29245. listeners: {
  29246. click: function (sender) {
  29247. self.reload();
  29248. }
  29249. }
  29250. });
  29251. newConfig.tbar.push({
  29252. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  29253. listeners: {
  29254. click: function (sender) {
  29255. self.handleZoomBig();
  29256. }
  29257. },
  29258. });
  29259. newConfig.tbar.push({
  29260. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  29261. listeners: {
  29262. click: function (sender) {
  29263. self.handleZoomSmall();
  29264. }
  29265. },
  29266. });
  29267. newConfig.tbar.push({
  29268. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  29269. listeners: {
  29270. click: function (sender) {
  29271. self.handleZoomReset();
  29272. }
  29273. },
  29274. });
  29275. }
  29276. this.superclass.constructor.call(self, newConfig);
  29277. },
  29278. initComponent: function () {
  29279. var _this = this;
  29280. var me = this;
  29281. var config = me.config;
  29282. var scope = lookupScope(this);
  29283. if (!isDesignMode(scope, config)) {
  29284. //@ts-ignore
  29285. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  29286. console.log('BpNavigated', me, BpNavigated);
  29287. var dom = me.el.dom;
  29288. var $dom = $(dom);
  29289. var $container = $dom.find('.x-autocontainer-innerCt');
  29290. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  29291. _this._bpmn = bpmn;
  29292. if (_this.autoLoad) {
  29293. _this.reload();
  29294. }
  29295. _this.fireEvent('initFinish', _this);
  29296. var eventBus = bpmn.get('eventBus');
  29297. eventBus.on('element.hover', function (e) {
  29298. // this.fireEvent('itemHover', this, e);
  29299. });
  29300. eventBus.on('element.out', function (e) {
  29301. _this.fireEvent('itemOut', _this, e);
  29302. });
  29303. eventBus.on('element.click', function (e) {
  29304. _this.fireEvent('itemClick', _this, e);
  29305. });
  29306. eventBus.on('element.dblclick', function (e) {
  29307. _this.fireEvent('itemDblclick', _this, e);
  29308. });
  29309. eventBus.on('element.mousedown', function (e) {
  29310. _this.fireEvent('itemMousedown', _this, e);
  29311. });
  29312. eventBus.on('element.mouseup', function (e) {
  29313. _this.fireEvent('itemMouseup', _this, e);
  29314. });
  29315. });
  29316. }
  29317. this.superclass.initComponent.call(this);
  29318. this.on({
  29319. afterrender: function (sender) {
  29320. }
  29321. });
  29322. },
  29323. /**
  29324. * 重新载入
  29325. */
  29326. reload: function () {
  29327. var _this = this;
  29328. var _a;
  29329. if (typeof this.dataSource === 'string' && this.dataSource) {
  29330. var scope = lookupScope(this);
  29331. var fn = lookupFn(scope, this.dataSource);
  29332. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  29333. _this.openDiagram(res.data);
  29334. });
  29335. }
  29336. },
  29337. /**
  29338. * 获取bpmn
  29339. */
  29340. getBpmn: function () {
  29341. return this._bpmn;
  29342. },
  29343. getBpmnCanvas: function () {
  29344. var _a;
  29345. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  29346. },
  29347. getBpmnOverlays: function () {
  29348. var _a;
  29349. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  29350. },
  29351. getBpmnZoomScroll: function () {
  29352. var _a;
  29353. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  29354. },
  29355. handleZoomBig: function () {
  29356. var _a;
  29357. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  29358. },
  29359. handleZoomSmall: function () {
  29360. var _a;
  29361. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  29362. },
  29363. handleZoomReset: function () {
  29364. var _a;
  29365. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  29366. },
  29367. openDiagram: function (diagram) {
  29368. var _this = this;
  29369. if (!this.getBpmn()) {
  29370. return;
  29371. }
  29372. this.getBpmn().importXML(diagram, function (err) {
  29373. if (err) {
  29374. // YvEventDispatch(this.onFailed, this, undefined);
  29375. _this.fireEvent('failed', _this, err);
  29376. return console.error('could not import BPMN 2.0 diagram', err);
  29377. }
  29378. // zoom to fit full viewport
  29379. _this.getBpmnCanvas().zoom('fit-viewport');
  29380. _this.fireEvent('success', _this);
  29381. });
  29382. },
  29383. });
  29384. }
  29385. function initSqlComplex () {
  29386. Ext.define('Yvan.SqlComplex', {
  29387. extend: 'Ext.panel.Panel',
  29388. xtype: 'sqlcomplex',
  29389. alias: 'widget.sqlcomplex',
  29390. getSqlExpress: function () {
  29391. },
  29392. constructor: function (config) {
  29393. var reference = config.reference;
  29394. var me = this;
  29395. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  29396. {
  29397. region: 'west',
  29398. width: 280,
  29399. border: false,
  29400. split: true,
  29401. reference: reference + '_tree',
  29402. xtype: 'yvtree',
  29403. hideRefresh: true,
  29404. hideExpand: true,
  29405. hideCollapse: true,
  29406. listeners: {
  29407. itemdblclick: function (sender, record, item, index, e) {
  29408. var field = record.get('field');
  29409. var defaultValue = record.get('defaultValue');
  29410. if (!field) {
  29411. return;
  29412. }
  29413. var tabExpress = me.down('tabpanel');
  29414. var sqleditor = me.down('sqleditor');
  29415. var expressGrid = me.down('yvgrid');
  29416. if (tabExpress.getActiveTab().key !== 'grid') {
  29417. // SQL 模式
  29418. sqleditor.insertText(field + '=');
  29419. }
  29420. else {
  29421. // 表格模式
  29422. expressGrid.appendEditRow({
  29423. field: field,
  29424. operator: '=',
  29425. value: defaultValue,
  29426. remark: '',
  29427. });
  29428. _$2.defer(function () {
  29429. gridChanged(me, expressGrid);
  29430. });
  29431. }
  29432. }
  29433. },
  29434. },
  29435. {
  29436. region: 'center',
  29437. xtype: 'tabpanel',
  29438. reference: reference + '_tab',
  29439. tabPosition: 'bottom',
  29440. listeners: {
  29441. afterrender: function (sender) {
  29442. var scope = lookupScope(me);
  29443. var value = scope.viewModel.get(me.config.bindValue);
  29444. // sql 转换为 grid
  29445. try {
  29446. var list_1 = parseSqlToGrid(value);
  29447. _$2.defer(function () {
  29448. var grid = me.down('yvgrid');
  29449. grid.setData(list_1);
  29450. });
  29451. }
  29452. catch (e) {
  29453. console.error(e);
  29454. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  29455. var tabSql = sender.down('sqleditor');
  29456. sender.setActiveTab(tabSql);
  29457. }
  29458. },
  29459. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  29460. var scope = lookupScope(me);
  29461. var value = scope.viewModel.get(me.config.bindValue);
  29462. if (newCard.key === 'grid') {
  29463. // sql 转换为 grid
  29464. try {
  29465. var list_2 = parseSqlToGrid(value);
  29466. _$2.defer(function () {
  29467. var grid = me.down('yvgrid');
  29468. grid.setData(list_2);
  29469. });
  29470. return true;
  29471. }
  29472. catch (e) {
  29473. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  29474. console.error(e);
  29475. return false;
  29476. }
  29477. }
  29478. else if (newCard.key === 'sql') {
  29479. // grid 转换为 sql
  29480. _$2.defer(function () {
  29481. var editor = me.down('sqleditor');
  29482. editor.setValue(value);
  29483. });
  29484. return true;
  29485. }
  29486. }
  29487. },
  29488. items: [
  29489. {
  29490. title: '表格模式',
  29491. key: 'grid',
  29492. xtype: 'yvgrid',
  29493. _mode: 'select',
  29494. reference: reference + '_grid',
  29495. hideFootbar: true,
  29496. pagination: false,
  29497. tbar: [
  29498. {
  29499. xtype: 'button',
  29500. text: '删除',
  29501. iconCls: 'x-fa fa-minus-circle',
  29502. cls: 'ext-btn-danger',
  29503. bind: {
  29504. disabled: '{!' + reference + '_grid.selection}',
  29505. },
  29506. listeners: {
  29507. click: function (sender) {
  29508. var grid = sender.up('yvgrid');
  29509. removeGridRow(grid);
  29510. gridChanged(me, grid);
  29511. }
  29512. },
  29513. },
  29514. ],
  29515. store: {},
  29516. listeners: {
  29517. editfinish: function (sender) {
  29518. gridChanged(me, sender);
  29519. },
  29520. },
  29521. columns: [
  29522. {
  29523. dataIndex: 'field',
  29524. header: '字段', sortable: false, menuDisabled: true,
  29525. width: 190,
  29526. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  29527. var column = context.column;
  29528. var propertyConfig = me.config.propertyConfig;
  29529. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  29530. var field = record.get('field');
  29531. if (field) {
  29532. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  29533. if (idx >= 0) {
  29534. var meta = propertyConfig[idx];
  29535. return meta.text;
  29536. }
  29537. }
  29538. return value;
  29539. }
  29540. },
  29541. {
  29542. dataIndex: 'operator',
  29543. header: '运算符', sortable: false, menuDisabled: true,
  29544. dict: 'operator',
  29545. width: 65,
  29546. editor: { xtype: 'combo' },
  29547. },
  29548. {
  29549. dataIndex: 'value',
  29550. header: '值', sortable: false, menuDisabled: true,
  29551. flex: 1,
  29552. getEditor: function (record) {
  29553. var column = this;
  29554. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  29555. var propertyConfig = me.config.propertyConfig;
  29556. var field = record.get('field');
  29557. if (!field) {
  29558. // 没有填 propertyName
  29559. return;
  29560. }
  29561. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  29562. if (idx < 0) {
  29563. console.error('没有找到 field=' + field + ". propertyConfig");
  29564. return;
  29565. }
  29566. var meta = propertyConfig[idx];
  29567. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  29568. return new Ext.grid.CellEditor({
  29569. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  29570. });
  29571. }
  29572. return new Ext.grid.CellEditor({
  29573. field: __assign({ dict: meta.dict }, meta.editor)
  29574. });
  29575. },
  29576. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  29577. var column = context.column;
  29578. var grid = _$2.get(view, 'ownerGrid');
  29579. var propertyConfig = me.config.propertyConfig;
  29580. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  29581. var field = record.get('field');
  29582. if (field) {
  29583. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  29584. if (idx >= 0) {
  29585. var meta = propertyConfig[idx];
  29586. var dictName = _$2.get(meta, 'dict');
  29587. if (dictName && window['DICT_CACHE'][dictName]) {
  29588. var dict_1 = window['DICT_CACHE'][dictName];
  29589. var valueText_1 = [];
  29590. _$2.forEach(_$2.split(valueList, ','), function (value) {
  29591. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  29592. if (idxKv >= 0) {
  29593. valueText_1.push(dict_1[idxKv].text);
  29594. }
  29595. else {
  29596. valueText_1.push(value);
  29597. }
  29598. });
  29599. return valueText_1.join(',');
  29600. }
  29601. }
  29602. }
  29603. return valueList;
  29604. },
  29605. },
  29606. ]
  29607. },
  29608. {
  29609. title: 'SQL模式',
  29610. key: 'sql',
  29611. xtype: 'sqleditor',
  29612. reference: reference + '_sql',
  29613. listeners: {
  29614. change: function (sender) {
  29615. var scope = lookupScope(me);
  29616. // 保存 editor 写入的值
  29617. scope.viewModel.set(me.config.bindValue, sender.getValue());
  29618. }
  29619. }
  29620. },
  29621. ]
  29622. }
  29623. ] });
  29624. this.superclass.constructor.call(this, newConfig);
  29625. },
  29626. initComponent: function () {
  29627. // 货位条件树
  29628. var me = this;
  29629. me.superclass.initComponent.apply(this, arguments);
  29630. var tree = this.down('yvtree');
  29631. var config = me.config;
  29632. tree.setRootNode(buildConfigTree(config.propertyConfig));
  29633. },
  29634. });
  29635. function gridChanged(me, grid) {
  29636. var data = grid.getDataRows();
  29637. var propertyConfig = me.config.propertyConfig;
  29638. var bindValue = me.config.bindValue;
  29639. var scope = lookupScope(me);
  29640. var sql = parseGridToSql(data);
  29641. scope.viewModel.set(bindValue, sql);
  29642. }
  29643. /**
  29644. * 用于从 propertyConfig 解析出树形结构
  29645. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  29646. * ->
  29647. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  29648. */
  29649. function buildConfigTree(propertyConfig) {
  29650. var root = {
  29651. expanded: true,
  29652. leaf: false,
  29653. children: []
  29654. };
  29655. var categoryObj = {};
  29656. var cfgList = propertyConfig;
  29657. _$2.forEach(cfgList, function (cfg) {
  29658. var cateNode = categoryObj[cfg.category];
  29659. if (!cateNode) {
  29660. cateNode = {
  29661. text: cfg.category, expanded: true, leaf: false,
  29662. children: []
  29663. };
  29664. categoryObj[cfg.category] = cateNode;
  29665. root.children.push(cateNode);
  29666. }
  29667. cateNode.children.push({
  29668. text: cfg.text,
  29669. field: cfg.field,
  29670. operator: cfg.operator,
  29671. defaultValue: cfg.defaultValue,
  29672. leaf: true,
  29673. });
  29674. });
  29675. return root;
  29676. }
  29677. /**
  29678. * 将表格变成 SQL where语句 [
  29679. * {field: 'f1', value: 1, operator: '='}
  29680. * {field: 'f2', value: 2, operator: '='}
  29681. * {field: 'f3', value: '3', operator: '>='}
  29682. * {field: 'f4', value: 4, operator: '='}
  29683. * ]
  29684. * ->
  29685. * f1=v1 and f2=v2
  29686. */
  29687. function parseGridToSql(list) {
  29688. var sqls = [];
  29689. _$2.forEach(list, function (i) {
  29690. var _a;
  29691. if (i.operator === 'in') {
  29692. sqls.push(i.field + ' in (' + (i.value) + ')');
  29693. }
  29694. else if (i.operator === 'notIn') {
  29695. sqls.push(i.field + ' not in (' + (i.value) + ')');
  29696. }
  29697. else {
  29698. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  29699. }
  29700. });
  29701. return sqls.join(' AND ');
  29702. }
  29703. /**
  29704. * 将 SQL 语句的 where 片段变成表格
  29705. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  29706. * @return [
  29707. {field: 'f1', value: 1, operator: '='}
  29708. {field: 'f2', value: 2, operator: '='}
  29709. {field: 'f3', value: '3', operator: '>='}
  29710. {field: 'f4', value: 4, operator: '='}
  29711. ]
  29712. */
  29713. function parseSqlToGrid(sql) {
  29714. if (!sql || !_$2.trim(sql)) {
  29715. return [];
  29716. }
  29717. var parser = new window['NodeSQLParser'].Parser();
  29718. var ast = parser.astify('select * from dual where ' + sql);
  29719. var ret = [];
  29720. exp(ast.where, ret);
  29721. return ret;
  29722. }
  29723. function exp(ast, ret) {
  29724. if (ast.type === 'binary_expr') {
  29725. if (_$2.toUpper(ast.operator) === 'AND') {
  29726. if (ast.left.type === 'binary_expr') {
  29727. exp(ast.left, ret);
  29728. }
  29729. if (ast.right.type === 'binary_expr') {
  29730. exp(ast.right, ret);
  29731. }
  29732. }
  29733. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  29734. if (ast.left.type === 'column_ref') {
  29735. if (ast.right.type === 'number' ||
  29736. ast.right.type === 'single_quote_string' ||
  29737. ast.right.type === 'double_quote_string') {
  29738. // 具体值相等
  29739. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  29740. }
  29741. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  29742. && ast.right.type === 'expr_list') {
  29743. // in / not in
  29744. var valueList_1 = [];
  29745. _$2.forEach(ast.right.value, function (item) {
  29746. valueList_1.push(item.value);
  29747. });
  29748. var operator = void 0;
  29749. if (_$2.toUpper(ast.operator) === 'IN') {
  29750. operator = 'in';
  29751. }
  29752. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  29753. operator = 'notIn';
  29754. }
  29755. ret.push({
  29756. field: ast.left.column, value: valueList_1.join(','),
  29757. operator: operator
  29758. });
  29759. }
  29760. else {
  29761. throw new Error('ast.right must is value.');
  29762. }
  29763. }
  29764. else {
  29765. throw new Error('ast.left must is column_ref.');
  29766. }
  29767. }
  29768. else {
  29769. // 必须用 AND 条件符匹配
  29770. throw new Error('ast.operator must is "AND / =".');
  29771. }
  29772. }
  29773. else {
  29774. throw new Error('ast.type must is "binary_expr".');
  29775. }
  29776. }
  29777. /**
  29778. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  29779. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  29780. {
  29781. type: 'binary_expr',
  29782. operator: 'AND',
  29783. left: {
  29784. type: 'binary_expr',
  29785. operator: 'AND',
  29786. left: {
  29787. type: 'binary_expr',
  29788. operator: 'AND',
  29789. left: {
  29790. type: 'binary_expr',
  29791. operator: 'AND',
  29792. left: {
  29793. type: 'binary_expr',
  29794. operator: '=',
  29795. left: {
  29796. type: 'column_ref',
  29797. table: null,
  29798. column: 'f1'
  29799. },
  29800. right: {
  29801. type: 'number',
  29802. value: 1
  29803. }
  29804. },
  29805. right: {
  29806. type: 'binary_expr',
  29807. operator: '=',
  29808. left: {
  29809. type: 'column_ref',
  29810. table: null,
  29811. column: 'f2'
  29812. },
  29813. right: {
  29814. type: 'number',
  29815. value: 2
  29816. }
  29817. }
  29818. },
  29819. right: {
  29820. type: 'binary_expr',
  29821. operator: '=',
  29822. left: {
  29823. type: 'column_ref',
  29824. table: null,
  29825. column: 'f3'
  29826. },
  29827. right: {
  29828. type: 'single_quote_string',
  29829. value: '3'
  29830. }
  29831. }
  29832. },
  29833. right: {
  29834. type: 'binary_expr',
  29835. operator: '>=',
  29836. left: {
  29837. type: 'column_ref',
  29838. table: null,
  29839. column: 'f4'
  29840. },
  29841. right: {
  29842. type: 'number',
  29843. value: 4
  29844. }
  29845. }
  29846. },
  29847. right: {
  29848. type: 'binary_expr',
  29849. operator: '<',
  29850. left: {
  29851. type: 'column_ref',
  29852. table: null,
  29853. column: 'f4'
  29854. },
  29855. right: {
  29856. type: 'number',
  29857. value: 3
  29858. }
  29859. }
  29860. }
  29861. * */
  29862. }
  29863. function initParamComplex () {
  29864. Ext.define('Yvan.ParamComplex', {
  29865. extend: 'Ext.panel.Panel',
  29866. xtype: 'paramcomplex',
  29867. alias: 'widget.paramcomplex',
  29868. getSqlExpress: function () {
  29869. },
  29870. constructor: function (config) {
  29871. var reference = config.reference;
  29872. var me = this;
  29873. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  29874. {
  29875. region: 'west',
  29876. width: 280,
  29877. border: false,
  29878. split: true,
  29879. reference: reference + '_tree',
  29880. xtype: 'yvtree',
  29881. hideRefresh: true,
  29882. hideExpand: true,
  29883. hideCollapse: true,
  29884. listeners: {
  29885. itemdblclick: function (sender, record, item, index, e) {
  29886. var field = record.get('field');
  29887. var defaultValue = record.get('defaultValue');
  29888. if (!field) {
  29889. return;
  29890. }
  29891. var tabExpress = me.down('tabpanel');
  29892. var sqleditor = me.down('sqleditor');
  29893. var expressGrid = me.down('yvgrid');
  29894. if (tabExpress.getActiveTab().key !== 'grid') {
  29895. // SQL 模式
  29896. sqleditor.insertText(field + '=');
  29897. }
  29898. else {
  29899. // 表格模式
  29900. expressGrid.appendEditRow({
  29901. field: field,
  29902. operator: '=',
  29903. value: defaultValue,
  29904. remark: '',
  29905. });
  29906. _$2.defer(function () {
  29907. gridChanged(me, expressGrid);
  29908. });
  29909. }
  29910. }
  29911. },
  29912. },
  29913. {
  29914. region: 'center',
  29915. xtype: 'tabpanel',
  29916. reference: reference + '_tab',
  29917. tabPosition: 'bottom',
  29918. listeners: {
  29919. afterrender: function (sender) {
  29920. var scope = lookupScope(me);
  29921. var value = scope.viewModel.get(me.config.bindValue);
  29922. // sql 转换为 grid
  29923. try {
  29924. var list_1 = parseParamToGrid(value);
  29925. _$2.defer(function () {
  29926. var grid = me.down('yvgrid');
  29927. grid.setData(list_1);
  29928. });
  29929. }
  29930. catch (e) {
  29931. console.error(e);
  29932. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  29933. var tabSql = sender.down('sqleditor');
  29934. sender.setActiveTab(tabSql);
  29935. }
  29936. },
  29937. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  29938. var scope = lookupScope(me);
  29939. var value = scope.viewModel.get(me.config.bindValue);
  29940. if (newCard.key === 'grid') {
  29941. // sql 转换为 grid
  29942. try {
  29943. var list_2 = parseParamToGrid(value);
  29944. _$2.defer(function () {
  29945. var grid = me.down('yvgrid');
  29946. grid.setData(list_2);
  29947. });
  29948. return true;
  29949. }
  29950. catch (e) {
  29951. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  29952. console.error(e);
  29953. return false;
  29954. }
  29955. }
  29956. else if (newCard.key === 'sql') {
  29957. // grid 转换为 sql
  29958. _$2.defer(function () {
  29959. var editor = me.down('sqleditor');
  29960. editor.setValue(value);
  29961. });
  29962. return true;
  29963. }
  29964. }
  29965. },
  29966. items: [
  29967. {
  29968. title: '表格模式',
  29969. key: 'grid',
  29970. xtype: 'yvgrid',
  29971. _mode: 'select',
  29972. reference: reference + '_grid',
  29973. hideFootbar: true,
  29974. pagination: false,
  29975. tbar: [
  29976. {
  29977. xtype: 'button',
  29978. text: '删除',
  29979. iconCls: 'x-fa fa-minus-circle',
  29980. cls: 'ext-btn-danger',
  29981. bind: {
  29982. disabled: '{!' + reference + '_grid.selection}',
  29983. },
  29984. listeners: {
  29985. click: function (sender) {
  29986. var grid = sender.up('yvgrid');
  29987. removeGridRow(grid);
  29988. gridChanged(me, grid);
  29989. }
  29990. },
  29991. },
  29992. ],
  29993. store: {},
  29994. listeners: {
  29995. editfinish: function (sender) {
  29996. gridChanged(me, sender);
  29997. },
  29998. },
  29999. columns: [
  30000. {
  30001. dataIndex: 'field',
  30002. header: '字段', sortable: false, menuDisabled: true,
  30003. width: 190,
  30004. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  30005. var column = context.column;
  30006. var propertyConfig = me.config.propertyConfig;
  30007. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  30008. var field = record.get('field');
  30009. if (field) {
  30010. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  30011. if (idx >= 0) {
  30012. var meta = propertyConfig[idx];
  30013. return meta.text;
  30014. }
  30015. }
  30016. return value;
  30017. }
  30018. },
  30019. {
  30020. dataIndex: 'value',
  30021. header: '值', sortable: false, menuDisabled: true,
  30022. flex: 1,
  30023. getEditor: function (record) {
  30024. var column = this;
  30025. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  30026. var propertyConfig = me.config.propertyConfig;
  30027. var field = record.get('field');
  30028. if (!field) {
  30029. // 没有填 propertyName
  30030. return;
  30031. }
  30032. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  30033. if (idx < 0) {
  30034. console.error('没有找到 field=' + field + ". propertyConfig");
  30035. return;
  30036. }
  30037. var meta = propertyConfig[idx];
  30038. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  30039. return new Ext.grid.CellEditor({
  30040. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  30041. });
  30042. }
  30043. return new Ext.grid.CellEditor({
  30044. field: __assign({ dict: meta.dict }, meta.editor)
  30045. });
  30046. },
  30047. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  30048. var column = context.column;
  30049. var grid = _$2.get(view, 'ownerGrid');
  30050. var propertyConfig = me.config.propertyConfig;
  30051. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  30052. var field = record.get('field');
  30053. if (field) {
  30054. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  30055. if (idx >= 0) {
  30056. var meta = propertyConfig[idx];
  30057. var dictName = _$2.get(meta, 'dict');
  30058. if (dictName && window['DICT_CACHE'][dictName]) {
  30059. var dict_1 = window['DICT_CACHE'][dictName];
  30060. var valueText_1 = [];
  30061. _$2.forEach(_$2.split(valueList, ','), function (value) {
  30062. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  30063. if (idxKv >= 0) {
  30064. valueText_1.push(dict_1[idxKv].text);
  30065. }
  30066. else {
  30067. valueText_1.push(value);
  30068. }
  30069. });
  30070. return valueText_1.join(',');
  30071. }
  30072. }
  30073. }
  30074. return valueList;
  30075. },
  30076. },
  30077. ]
  30078. },
  30079. {
  30080. title: '文本模式',
  30081. key: 'sql',
  30082. xtype: 'sqleditor',
  30083. reference: reference + '_sql',
  30084. listeners: {
  30085. change: function (sender) {
  30086. var scope = lookupScope(me);
  30087. // 保存 editor 写入的值
  30088. scope.viewModel.set(me.config.bindValue, sender.getValue());
  30089. }
  30090. }
  30091. },
  30092. ]
  30093. }
  30094. ] });
  30095. this.superclass.constructor.call(this, newConfig);
  30096. },
  30097. initComponent: function () {
  30098. // 货位条件树
  30099. var me = this;
  30100. me.superclass.initComponent.apply(this, arguments);
  30101. var tree = this.down('yvtree');
  30102. var config = me.config;
  30103. tree.setRootNode(buildConfigTree(config.propertyConfig));
  30104. },
  30105. });
  30106. function gridChanged(me, grid) {
  30107. var data = grid.getDataRows();
  30108. var propertyConfig = me.config.propertyConfig;
  30109. var bindValue = me.config.bindValue;
  30110. var scope = lookupScope(me);
  30111. var sql = parseGridToParam(data);
  30112. scope.viewModel.set(bindValue, sql);
  30113. }
  30114. /**
  30115. * 用于从 propertyConfig 解析出树形结构
  30116. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  30117. * ->
  30118. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  30119. */
  30120. function buildConfigTree(propertyConfig) {
  30121. var root = {
  30122. expanded: true,
  30123. leaf: false,
  30124. children: []
  30125. };
  30126. var categoryObj = {};
  30127. var cfgList = propertyConfig;
  30128. _$2.forEach(cfgList, function (cfg) {
  30129. var cateNode = categoryObj[cfg.category];
  30130. if (!cateNode) {
  30131. cateNode = {
  30132. text: cfg.category, expanded: true, leaf: false,
  30133. children: []
  30134. };
  30135. categoryObj[cfg.category] = cateNode;
  30136. root.children.push(cateNode);
  30137. }
  30138. cateNode.children.push({
  30139. text: cfg.text,
  30140. field: cfg.field,
  30141. operator: cfg.operator,
  30142. defaultValue: cfg.defaultValue,
  30143. leaf: true,
  30144. });
  30145. });
  30146. return root;
  30147. }
  30148. /**
  30149. * 将表格变成参数语句 [
  30150. * {field: 'f1', value: 1}
  30151. * {field: 'f2', value: 2}
  30152. * {field: 'f3', value: '3'}
  30153. * {field: 'f4', value: 4}
  30154. * ]
  30155. * ->
  30156. * f1=v1, f2=v2
  30157. */
  30158. function parseGridToParam(list) {
  30159. var sqls = [];
  30160. _$2.forEach(list, function (i) {
  30161. sqls.push(i.field + '=' + (i.value));
  30162. });
  30163. return sqls.join('; ');
  30164. }
  30165. /**
  30166. * 将 分号分割的的参数设置 变成表格
  30167. * @param param a=1; b=2; c='3'
  30168. * @return [
  30169. {field: 'a', value: 1}
  30170. {field: 'b', value: 2}
  30171. {field: 'c', value: '3'}
  30172. ]
  30173. */
  30174. function parseParamToGrid(param) {
  30175. if (!param || !_$2.trim(param)) {
  30176. return [];
  30177. }
  30178. var ret = [];
  30179. var sp = _$2.split(param, ';');
  30180. _$2.forEach(sp, function (v) {
  30181. var vi = _$2.indexOf(v, '=');
  30182. var field = _$2.trim(v.substr(0, vi));
  30183. var value = eval(v.substr(vi + 1));
  30184. ret.push({ field: field, value: value });
  30185. });
  30186. return ret;
  30187. }
  30188. }
  30189. function initSqlEditor$1 () {
  30190. Ext.define('com.yvan.studio.SqlEditor', {
  30191. extend: 'Ext.panel.Panel',
  30192. alias: 'widget.sqleditor',
  30193. xtype: 'sqleditor',
  30194. layout: 'fit',
  30195. border: false,
  30196. html: "<div class=\"editor\"/>",
  30197. config: {
  30198. value: ''
  30199. },
  30200. codeChange: undefined,
  30201. isChangeFromOuter: false,
  30202. setCode: function (value) {
  30203. var _this = this;
  30204. this.code = value;
  30205. this.value = value;
  30206. _$2.defer(function () {
  30207. _this.isChangeFromOuter = true;
  30208. if (_this.editor) {
  30209. _this.editor.setValue(value);
  30210. }
  30211. });
  30212. },
  30213. getCode: function () {
  30214. return this.getValue();
  30215. },
  30216. updateOptions: function (options) {
  30217. if (this.editor && options) {
  30218. this.editor.updateOptions(options);
  30219. }
  30220. },
  30221. getValue: function () {
  30222. if (!this.editor) {
  30223. return this.code;
  30224. }
  30225. return this.editor.getValue();
  30226. },
  30227. applyPosition: function () {
  30228. var _this = this;
  30229. if (this.autoFocusMethod) {
  30230. if (this.editor) {
  30231. _$2.defer(function () {
  30232. if (_this.autoFocusStartLine) {
  30233. _this.editor.setPosition({
  30234. lineNumber: _this.autoFocusStartLine,
  30235. column: _this.autoFocusStartColumn
  30236. });
  30237. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30238. }
  30239. _this.editor.focus();
  30240. });
  30241. delete this.autoFocusMethod;
  30242. }
  30243. }
  30244. this.editor.layout();
  30245. },
  30246. insertText: function (text) {
  30247. var editor = this.editor;
  30248. var position = editor.getPosition();
  30249. editor.executeEdits('', [
  30250. {
  30251. range: {
  30252. startLineNumber: position.lineNumber,
  30253. startColumn: position.column,
  30254. endLineNumber: position.lineNumber,
  30255. endColumn: position.column
  30256. },
  30257. text: text
  30258. }
  30259. ]);
  30260. },
  30261. setValue: function (value, fromEditor) {
  30262. this.setCode(value);
  30263. var me = this;
  30264. if (me.value === value) {
  30265. // 值相等,不需要变化
  30266. return;
  30267. }
  30268. if (fromEditor !== true && me.editor) {
  30269. // 不是来源于编辑器的变化,才设置编辑器的值
  30270. me.editor.setValue(value);
  30271. }
  30272. // 通知mixins setValue
  30273. me.value = value;
  30274. me.fireEvent('change', value);
  30275. },
  30276. initComponent: function () {
  30277. var that = this;
  30278. this.superclass.initComponent.call(this);
  30279. that.on({
  30280. resize: function () {
  30281. if (that.editor) {
  30282. that.editor.layout();
  30283. }
  30284. },
  30285. destory: function () {
  30286. if (that.editor) {
  30287. that.editor.dispose();
  30288. delete that.editor;
  30289. }
  30290. },
  30291. afterrender: function (sender) {
  30292. var $dom = $(that.el.dom).find('.editor');
  30293. attach_2($dom[0], {
  30294. value: that.code
  30295. }).then(function (editor) {
  30296. that.editor = editor;
  30297. that.applyPosition();
  30298. that.editor.onDidChangeModelContent(function (e) {
  30299. that.fireEvent('change', that.editor, e);
  30300. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30301. that.codeChange(that.editor.getValue(), that.name, e);
  30302. }
  30303. that.isChangeFromOuter = false;
  30304. });
  30305. });
  30306. }
  30307. });
  30308. }
  30309. });
  30310. function attach_2(element, opts) {
  30311. if (!window['monaco']) {
  30312. return;
  30313. }
  30314. var monaco = window['monaco'];
  30315. return new Promise(function (resolve) {
  30316. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  30317. enabled: false
  30318. } }));
  30319. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  30320. // const sql = editor.getValue()
  30321. // if (_.trim(sql).length > 0) {
  30322. // editor.setValue(format(sql, {
  30323. // indent: ' ',
  30324. // uppercase: true,
  30325. // }))
  30326. // }
  30327. // })
  30328. editor.onKeyUp(function (e) {
  30329. // console.log(e)
  30330. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  30331. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  30332. }
  30333. });
  30334. resolve(editor);
  30335. });
  30336. }
  30337. }
  30338. function initJsonEditor$1 () {
  30339. Ext.define('com.yvan.studio.JsonEditor', {
  30340. extend: 'Ext.panel.Panel',
  30341. alias: 'widget.jsoneditor',
  30342. xtype: 'jsoneditor',
  30343. layout: 'fit',
  30344. border: false,
  30345. html: "<div class=\"editor\"/>",
  30346. autoFocusMethod: true,
  30347. autoFocusStartLine: 0,
  30348. autoFocusStartColumn: 0,
  30349. codeChange: undefined,
  30350. funcArr: [],
  30351. modulePage: null,
  30352. isChangeFromOuter: false,
  30353. name: "",
  30354. /**
  30355. * 设置代码
  30356. */
  30357. setCode: function (value) {
  30358. var _this = this;
  30359. this.code = value;
  30360. _$2.defer(function () {
  30361. _this.isChangeFromOuter = true;
  30362. if (_this.editor) {
  30363. _this.editor.setValue(value);
  30364. }
  30365. });
  30366. },
  30367. updateOptions: function (options) {
  30368. if (this.editor && options) {
  30369. this.editor.updateOptions(options);
  30370. }
  30371. },
  30372. setLanguage: function (lang) {
  30373. if (!window['monaco']) {
  30374. return;
  30375. }
  30376. var monaco = window['monaco'];
  30377. if (this.editor && lang) {
  30378. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  30379. }
  30380. },
  30381. getCode: function () {
  30382. var _a;
  30383. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  30384. },
  30385. applyPosition: function () {
  30386. var _this = this;
  30387. if (this.autoFocusMethod) {
  30388. if (this.editor) {
  30389. _$2.defer(function () {
  30390. if (_this.autoFocusStartLine) {
  30391. _this.editor.setPosition({
  30392. lineNumber: _this.autoFocusStartLine,
  30393. column: _this.autoFocusStartColumn
  30394. });
  30395. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30396. }
  30397. _this.editor.focus();
  30398. });
  30399. delete this.autoFocusMethod;
  30400. }
  30401. }
  30402. this.editor.layout();
  30403. },
  30404. initComponent: function () {
  30405. var that = this;
  30406. this.superclass.initComponent.apply(this, arguments);
  30407. this.on({
  30408. resize: function (sender, width, height) {
  30409. if (that.editor) {
  30410. that.editor.layout();
  30411. }
  30412. },
  30413. destory: function () {
  30414. if (that.editor) {
  30415. that.editor.dispose();
  30416. delete that.editor;
  30417. }
  30418. },
  30419. afterrender: function (sender) {
  30420. var $dom = $(that.el.dom).find('.editor');
  30421. attach_116($dom[0], {
  30422. value: that.code
  30423. }).then(function (editor) {
  30424. that.editor = editor;
  30425. that.applyPosition();
  30426. that.editor.onDidChangeModelContent(function (e) {
  30427. that.fireEvent('change', that.editor, e);
  30428. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30429. that.codeChange(that.editor.getValue(), that.name, e);
  30430. }
  30431. that.isChangeFromOuter = false;
  30432. });
  30433. });
  30434. }
  30435. });
  30436. },
  30437. });
  30438. function attach_116(element, opts) {
  30439. if (!window['monaco']) {
  30440. return;
  30441. }
  30442. var monaco = window['monaco'];
  30443. return new Promise(function (resolve) {
  30444. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  30445. enabled: false
  30446. } }));
  30447. editor.onKeyUp(function (e) {
  30448. // console.log(e)
  30449. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  30450. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  30451. }
  30452. });
  30453. resolve(editor);
  30454. });
  30455. }
  30456. }
  30457. function initJsEditor$1 () {
  30458. Ext.define('com.yvan.studio.JsEditor', {
  30459. extend: 'Ext.panel.Panel',
  30460. alias: 'widget.jseditor',
  30461. xtype: 'jseditor',
  30462. layout: 'fit',
  30463. border: false,
  30464. html: "<div class=\"editor\"/>",
  30465. autoFocusMethod: true,
  30466. autoFocusStartLine: 0,
  30467. autoFocusStartColumn: 0,
  30468. codeChange: undefined,
  30469. funcArr: [],
  30470. modulePage: null,
  30471. isChangeFromOuter: false,
  30472. name: "",
  30473. /**
  30474. * 设置代码
  30475. */
  30476. setCode: function (value) {
  30477. var _this = this;
  30478. this.code = value;
  30479. _$2.defer(function () {
  30480. _this.isChangeFromOuter = true;
  30481. if (_this.editor) {
  30482. _this.editor.setValue(value);
  30483. if (_this.name === "controllerEditor") {
  30484. _this.funcArr = _this.getAllFunction();
  30485. }
  30486. }
  30487. });
  30488. },
  30489. getCode: function () {
  30490. var _a;
  30491. if (!this.editor) {
  30492. return this.code;
  30493. }
  30494. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  30495. },
  30496. applyPosition: function () {
  30497. var _this = this;
  30498. if (this.autoFocusMethod) {
  30499. if (this.editor) {
  30500. _$2.defer(function () {
  30501. if (_this.autoFocusStartLine) {
  30502. _this.editor.setPosition({
  30503. lineNumber: _this.autoFocusStartLine,
  30504. column: _this.autoFocusStartColumn
  30505. });
  30506. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  30507. }
  30508. _this.editor.focus();
  30509. });
  30510. delete this.autoFocusMethod;
  30511. }
  30512. }
  30513. this.editor.layout();
  30514. },
  30515. initComponent: function () {
  30516. var that = this;
  30517. this.superclass.initComponent.apply(this, arguments);
  30518. this.on({
  30519. resize: function (sender, width, height) {
  30520. if (that.editor) {
  30521. that.editor.layout();
  30522. }
  30523. },
  30524. destory: function () {
  30525. if (that.editor) {
  30526. that.editor.dispose();
  30527. delete that.editor;
  30528. }
  30529. },
  30530. afterrender: function () {
  30531. var $dom = $(that.el.dom).find('.editor');
  30532. attach_1($dom[0], {
  30533. value: that.code
  30534. }).then(function (editor) {
  30535. that.editor = editor;
  30536. that.applyPosition();
  30537. that.editor.onDidChangeModelContent(function (e) {
  30538. that.fireEvent('change', that.editor, e);
  30539. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  30540. that.codeChange(that.editor.getValue(), that.name, e);
  30541. }
  30542. that.isChangeFromOuter = false;
  30543. });
  30544. });
  30545. }
  30546. });
  30547. },
  30548. getAllFunction: function () {
  30549. var funcArr = [];
  30550. var ast = window['YvanUI'].recast.parse(this.code);
  30551. if (ast && ast.program && ast.program.body) {
  30552. if (Array.isArray(ast.program.body)) {
  30553. for (var i = 0; i < ast.program.body.length; i++) {
  30554. var m = ast.program.body[i];
  30555. if (m.type === "ExportDefaultDeclaration") {
  30556. if (m.declaration.type === "ClassDeclaration") {
  30557. if (m.declaration.body.type === "ClassBody") {
  30558. if (Array.isArray(m.declaration.body.body)) {
  30559. for (var j = 0; j < m.declaration.body.body.length; j++) {
  30560. var ob = m.declaration.body.body[j];
  30561. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  30562. var funcItem = { name: ob.key.name, args: [] };
  30563. if (Array.isArray(ob.value.params)) {
  30564. for (var k = 0; k < ob.value.params.length; k++) {
  30565. var p = ob.value.params[k];
  30566. funcItem.args.push(p.name);
  30567. }
  30568. }
  30569. funcArr.push(funcItem);
  30570. }
  30571. }
  30572. }
  30573. }
  30574. }
  30575. }
  30576. }
  30577. }
  30578. }
  30579. return funcArr;
  30580. }
  30581. });
  30582. var isInited = false;
  30583. function attach_1(element, opts) {
  30584. if (!window['monaco']) {
  30585. return;
  30586. }
  30587. var monaco = window['monaco'];
  30588. return new Promise(function (resolve) {
  30589. if (!isInited) {
  30590. isInited = true;
  30591. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  30592. noSemanticValidation: true,
  30593. noSyntaxValidation: false
  30594. });
  30595. // compiler options
  30596. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  30597. target: monaco.languages.typescript.ScriptTarget.ES2016,
  30598. allowNonTsExtensions: true,
  30599. });
  30600. // extra libraries
  30601. var libSource = [
  30602. 'declare class Facts {',
  30603. ' /**',
  30604. ' * Returns the next fact',
  30605. ' */',
  30606. ' static next():string',
  30607. ' static next222():string',
  30608. '}',
  30609. "\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 ",
  30610. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  30611. ].join('\n');
  30612. var libUri = 'file:///index.d.ts';
  30613. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  30614. // When resolving definitions and references, the editor will try to use created models.
  30615. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  30616. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  30617. }
  30618. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  30619. resolve(editor);
  30620. });
  30621. }
  30622. }
  30623. function initClipboard () {
  30624. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  30625. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  30626. Ext.grid.plugin.Clipboard.override({
  30627. getCellData: function (format, erase) {
  30628. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  30629. if (selection) {
  30630. selection.eachCell(function (cellContext) {
  30631. column = cellContext.column;
  30632. view = cellContext.column.getView();
  30633. record = cellContext.record;
  30634. // Do not copy the check column or row numberer column
  30635. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  30636. return;
  30637. }
  30638. if (lastRecord !== record) {
  30639. lastRecord = record;
  30640. ret.push(row = []);
  30641. }
  30642. dataIndex = column.dataIndex;
  30643. // 记录原始数据
  30644. var rData = record.data[dataIndex];
  30645. if (isRaw) {
  30646. data = record.data[dataIndex];
  30647. }
  30648. else {
  30649. // Try to access the view node.
  30650. viewNode = view.all.item(cellContext.rowIdx);
  30651. // If we could not, it's because it's outside of the rendered block -
  30652. // recreate it.
  30653. if (!viewNode) {
  30654. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  30655. }
  30656. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  30657. data = cell.innerHTML;
  30658. if (isText) {
  30659. data = Ext.util.Format.stripTags(data);
  30660. }
  30661. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  30662. data = data || rData;
  30663. }
  30664. row.push(data);
  30665. if (erase && dataIndex) {
  30666. record.set(dataIndex, null);
  30667. }
  30668. });
  30669. }
  30670. // See decode() comment below
  30671. return Ext.util.TSV.encode(ret, undefined, null);
  30672. },
  30673. getCells: function (format, erase) {
  30674. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  30675. if (selection) {
  30676. selection.eachCell(function (cellContext) {
  30677. record = cellContext.record;
  30678. if (lastRecord !== record) {
  30679. lastRecord = record;
  30680. ret.push(row = {
  30681. model: record.self,
  30682. fields: []
  30683. });
  30684. }
  30685. dataIndex = cellContext.column.dataIndex;
  30686. row.fields.push({
  30687. name: dataIndex,
  30688. value: record.data[dataIndex]
  30689. });
  30690. if (erase && dataIndex) {
  30691. record.set(dataIndex, null);
  30692. }
  30693. });
  30694. }
  30695. return ret;
  30696. },
  30697. getTextData: function (format, erase) {
  30698. return this.getCellData(format, erase);
  30699. },
  30700. putCellData: function (data, format) {
  30701. var _a;
  30702. 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 = {};
  30703. // If the view is not focused, use the first cell of the selection as the destination.
  30704. if (!destination && selected) {
  30705. selected.eachCell(function (c) {
  30706. destination = c;
  30707. return false;
  30708. });
  30709. }
  30710. if (destination) {
  30711. // Create a new Context based upon the outermost View.
  30712. // NavigationModel works on local views.
  30713. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  30714. // At that point, we can use navModel.getPosition()
  30715. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  30716. }
  30717. else {
  30718. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  30719. }
  30720. destinationStartColumn = destination.colIdx;
  30721. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  30722. row = values[sourceRowIdx];
  30723. // Collect new values in dataObject
  30724. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  30725. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  30726. continue;
  30727. }
  30728. dataIndex = destination.column.dataIndex;
  30729. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  30730. if (dataIndex) {
  30731. switch (format) {
  30732. // Raw field values
  30733. case 'raw':
  30734. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  30735. break;
  30736. // Textual data with HTML tags stripped
  30737. case 'text':
  30738. {
  30739. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  30740. // 获取字典原始的value
  30741. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  30742. }
  30743. else {
  30744. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  30745. }
  30746. break;
  30747. }
  30748. }
  30749. }
  30750. // If we are at the end of the destination row, break the column loop.
  30751. if (destination.colIdx === maxColIdx) {
  30752. break;
  30753. }
  30754. destination.setColumn(destination.colIdx + 1);
  30755. }
  30756. // Update the record in one go.
  30757. destination.record.set(dataObject);
  30758. // If we are at the end of the destination store, break the row loop.
  30759. if (destination.rowIdx === maxRowIdx) {
  30760. break;
  30761. }
  30762. // Jump to next row in destination
  30763. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  30764. }
  30765. },
  30766. putTextData: function (data, format) {
  30767. var _a, _b, _c;
  30768. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  30769. // 根据复制的行数自动添加新的行
  30770. 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;
  30771. if (selected.startCell.rowIdx + values.length >= dataLength) {
  30772. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  30773. this.cmp.getStore().add({});
  30774. }
  30775. }
  30776. this.putCellData(data, format);
  30777. },
  30778. });
  30779. }
  30780. function initDict$1 () {
  30781. var DICT_CACHE = window['DICT_CACHE'];
  30782. if (!DICT_CACHE) {
  30783. DICT_CACHE = {};
  30784. window['DICT_CACHE'] = DICT_CACHE;
  30785. }
  30786. DICT_CACHE.XTYPE = [
  30787. { id: 'datefield', text: '日期' },
  30788. { id: 'datetimefield', text: '日期时间' },
  30789. { id: 'textfield', text: '文本' },
  30790. { id: 'numberfield', text: '数字' },
  30791. { id: 'combo', text: '下拉框' },
  30792. ];
  30793. DICT_CACHE.operator = [
  30794. { id: '=', text: '=' },
  30795. { id: '>', text: '>' },
  30796. { id: '<', text: '<' },
  30797. { id: '>=', text: '>=' },
  30798. { id: '<=', text: '<=' },
  30799. { id: 'in', text: 'in' },
  30800. { id: 'notIn', text: 'notIn' },
  30801. ];
  30802. DICT_CACHE.GRID_MODE = [
  30803. { id: 'edit1', text: '单机编辑模式' },
  30804. { id: 'edit2', text: '双击编辑模式' },
  30805. { id: 'checkbox', text: '勾选' },
  30806. { id: 'checkonly', text: '只勾选' },
  30807. { id: 'select', text: '行选择模式' },
  30808. ];
  30809. DICT_CACHE.BOTH_SELECT = [
  30810. { id: 'N/A', text: '<无>' },
  30811. { id: 'textfield', text: '文本' },
  30812. { id: 'numberfield', text: '数字框' },
  30813. { id: 'datefield', text: '日期' },
  30814. { id: 'datetimefield', text: '日期时间' },
  30815. { id: 'combo', text: '下拉框' },
  30816. { id: 'combogrid', text: '下拉表' },
  30817. { id: 'checkbox', text: '勾选' },
  30818. ];
  30819. DICT_CACHE.ROW_LAYOUT = [
  30820. { id: 'flex', text: '按权重摆放' },
  30821. { id: 'hbox', text: '按宽度摆放' },
  30822. ];
  30823. DICT_CACHE.GRID_XTYPE = [
  30824. { id: 'N/A', text: '<无>' },
  30825. { id: 'textfield', text: '文本-textfield' },
  30826. { id: 'numberfield', text: '数字框-numberfield' },
  30827. { id: 'datefield', text: '日期-datefield' },
  30828. { id: 'datetimefield', text: '日期时间-datetimefield' },
  30829. { id: 'combo', text: '下拉框-combo' },
  30830. { id: 'combogrid', text: '下拉表-combogrid' },
  30831. { id: 'checkbox', text: '勾选-checkbox' },
  30832. ];
  30833. DICT_CACHE.FORM_XTYPE = [
  30834. { id: 'N/A', text: '<无>' },
  30835. { id: 'textfield', text: '文本-textfield' },
  30836. { id: 'numberfield', text: '数字框-numberfield' },
  30837. { id: 'datefield', text: '日期-datefield' },
  30838. { id: 'datetimefield', text: '日期时间-datetimefield' },
  30839. { id: 'combo', text: '下拉框-combo' },
  30840. { id: 'combogrid', text: '下拉表-combogrid' },
  30841. { id: 'checkbox', text: '勾选-checkbox' },
  30842. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  30843. ];
  30844. DICT_CACHE.GRID_FORMATTER = [
  30845. { id: 'N/A', text: '默认' },
  30846. { id: 'rownum', text: '序号-rownum' },
  30847. { id: 'button', text: '按钮-button' },
  30848. { id: 'checkbox', text: '勾选-checkbox' },
  30849. { id: 'progres', text: '进度条-progres' },
  30850. ];
  30851. }
  30852. function initDesigner () {
  30853. Ext.define('com.yvan.studio.designer', {
  30854. extend: 'Ext.panel.Panel',
  30855. alias: 'widget.designer',
  30856. xtype: 'designer',
  30857. layout: 'fit',
  30858. items: [],
  30859. constructor: function (config) {
  30860. var self = this;
  30861. var newConfig = _$2.defaultsDeep({
  30862. // 强制性属性
  30863. }, config);
  30864. this.superclass.constructor.call(self, newConfig);
  30865. },
  30866. initComponent: function () {
  30867. var me = this;
  30868. me.on({
  30869. afterrender: function () {
  30870. }
  30871. });
  30872. this.superclass.initComponent.call(me);
  30873. }
  30874. });
  30875. }
  30876. var FixClass = /** @class */ (function () {
  30877. function FixClass() {
  30878. }
  30879. FixClass.prototype.fix = function (me, config) {
  30880. var _this = this;
  30881. if (isDesignMode(me, config)) {
  30882. return;
  30883. }
  30884. if (!config) {
  30885. return;
  30886. }
  30887. var fix = config.fix;
  30888. if (!fix) {
  30889. return;
  30890. }
  30891. delete config.fix;
  30892. // 这里有个 bug
  30893. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  30894. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  30895. var scope;
  30896. if (config.$initParent) {
  30897. // 在面板上的组件
  30898. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  30899. }
  30900. else if (config.column) {
  30901. // 在列上的组件
  30902. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  30903. }
  30904. if (_$2.isArray(fix)) {
  30905. _$2.each(fix, function (f) {
  30906. var fn = lookupFn(scope, f);
  30907. fn.call(_this, me, config);
  30908. });
  30909. }
  30910. else if (_$2.isString(fix)) {
  30911. var fn = lookupFn(scope, fix);
  30912. fn.call(this, me, config);
  30913. }
  30914. };
  30915. __decorate([
  30916. baseConfigProcess(),
  30917. __metadata("design:type", Function),
  30918. __metadata("design:paramtypes", [Object, Object]),
  30919. __metadata("design:returntype", void 0)
  30920. ], FixClass.prototype, "fix", null);
  30921. return FixClass;
  30922. }());
  30923. function init$2() {
  30924. // 引入 filters 过滤插件
  30925. Ext.require([
  30926. 'Ext.grid.filters.Filters'
  30927. ]);
  30928. // 启用 tooltip 快捷提示
  30929. Ext.QuickTips.init();
  30930. // 定义日期格式化方法
  30931. if (Ext.util && Ext.util.Format) {
  30932. Ext.apply(Ext.util.Format, {
  30933. dateFormat: 'Y-m-d'
  30934. });
  30935. }
  30936. Ext.form.field.Display.override({
  30937. cls: 'yvan-display-field',
  30938. labelAlign: 'right'
  30939. });
  30940. Ext.define("Ext.locale.zh_CN.picker.Date", {
  30941. override: "Ext.picker.Date",
  30942. format: "Y-m-d",
  30943. });
  30944. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  30945. override: "Ext.form.field.Date",
  30946. format: "Y-m-d",
  30947. });
  30948. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  30949. override: "Ext.grid.PropertyColumnModel",
  30950. format: "Y-m-d",
  30951. });
  30952. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  30953. override: "Ext.view.AbstractView",
  30954. loadingText: "读取中..."
  30955. });
  30956. Ext.LoadMask.prototype.msg = '请稍后...';
  30957. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  30958. override: "Ext.grid.header.Container",
  30959. sortClearText: '不排序',
  30960. sortAscText: "正序",
  30961. sortDescText: "倒序",
  30962. lockText: "锁定列",
  30963. unlockText: "解除锁定",
  30964. columnsText: "字段隐藏"
  30965. });
  30966. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  30967. override: "Ext.grid.filters.filter.Date",
  30968. fields: {
  30969. lt: { text: '之前' },
  30970. gt: { text: '之后' },
  30971. eq: { text: '相等' },
  30972. },
  30973. // Defaults to Ext.Date.defaultFormat
  30974. dateFormat: null
  30975. });
  30976. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  30977. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  30978. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  30979. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  30980. override: "Ext.grid.locking.Lockable",
  30981. lockText: "锁定",
  30982. unlockText: '解锁',
  30983. });
  30984. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  30985. override: "Ext.grid.filters.Filters",
  30986. menuFilterText: "过滤"
  30987. });
  30988. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  30989. override: "Ext.grid.filters.filter.Boolean",
  30990. yesText: "已钩选",
  30991. noText: "未勾选"
  30992. });
  30993. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  30994. override: "Ext.grid.filters.filter.String",
  30995. emptyText: "输入过滤文本..."
  30996. });
  30997. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  30998. override: "Ext.grid.filters.filter.Number",
  30999. emptyText: "输入数字..."
  31000. });
  31001. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  31002. override: "Ext.PagingToolbar",
  31003. beforePageText: "第",
  31004. // update
  31005. afterPageText: "/ {0} 页",
  31006. // update
  31007. firstText: "第一页",
  31008. prevText: "上一页",
  31009. // update
  31010. nextText: "下一页",
  31011. lastText: "最后页",
  31012. refreshText: "刷新",
  31013. displayMsg: "总共 {2} 条",
  31014. // update
  31015. emptyMsg: '没有数据'
  31016. });
  31017. /**
  31018. * 改变事件的获取方式.
  31019. * 具体见: ext-all-debug.js:23216 addListener
  31020. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  31021. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  31022. */
  31023. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  31024. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  31025. if (typeof fn === 'string' &&
  31026. (_$2.startsWith(fn, 'scope.') ||
  31027. _$2.startsWith(fn, 'system.') ||
  31028. _$2.startsWith(fn, 'format.'))) {
  31029. scope = lookupScope(this);
  31030. if (isDesignMode(scope, undefined)) {
  31031. fn = Ext.emptyFn;
  31032. }
  31033. else {
  31034. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  31035. // const vm = this.lookupViewModel()
  31036. // if (vm && vm.yvanScope) {
  31037. // scope = vm.yvanScope
  31038. // fn = scope[fn.substr('scope.'.length)]
  31039. // }
  31040. fn = lookupFn(scope, fn, this);
  31041. }
  31042. }
  31043. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  31044. };
  31045. // 将 SystemLib 扩展到 window.system 下
  31046. if (!window['system']) {
  31047. window['system'] = {};
  31048. }
  31049. _$2.extend(window['system'], SystemLib);
  31050. _$2.extend(window['system'], {
  31051. showGridRowDetail: showGridRowDetail
  31052. });
  31053. Ext.apply(Ext.util.Format, {
  31054. // 百分比
  31055. percentRenderer: function (v, rd, model) {
  31056. if (!v) {
  31057. v = 0;
  31058. }
  31059. if (typeof v === 'string') {
  31060. v = parseInt(v);
  31061. }
  31062. var valueString = v.toFixed(2);
  31063. var valueFixed = v > 100 ? 100 : v;
  31064. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  31065. var cls = '';
  31066. if (v < 90) {
  31067. cls = 'danger';
  31068. }
  31069. else if (v < 100) {
  31070. cls = 'warning';
  31071. }
  31072. else {
  31073. cls = 'success';
  31074. }
  31075. return Ext.String
  31076. .format(
  31077. // '<div>'
  31078. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  31079. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  31080. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  31081. // + '</div></div>', valueString, valueFixed, cls);
  31082. '<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(
  31083. // '<div>'
  31084. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  31085. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  31086. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  31087. // + '</div></div>', v, valueFixed, valueString);
  31088. },
  31089. //button
  31090. button: function (v, rd, model) {
  31091. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  31092. }
  31093. });
  31094. initComponent();
  31095. initPanel();
  31096. initGridColumn();
  31097. initTree();
  31098. initGrid();
  31099. initMainTab();
  31100. initTextfield();
  31101. initCombo();
  31102. initTag();
  31103. initContainer();
  31104. initRows();
  31105. initCols();
  31106. initForm();
  31107. initToolbar();
  31108. initSplitter();
  31109. initButton();
  31110. initStores();
  31111. initSearch();
  31112. initMultipleSearch();
  31113. initDate();
  31114. initDateTimePicker();
  31115. initDateTime();
  31116. initNumber();
  31117. initCheckbox();
  31118. initCheckboxGroup();
  31119. initRadio();
  31120. initRadioGroup();
  31121. initFieldset();
  31122. initCombotree();
  31123. initPickerPlus();
  31124. initCombogrid();
  31125. initComboGridMulti();
  31126. initIframe();
  31127. initBpmn();
  31128. initSqlEditor$1();
  31129. initJsonEditor$1();
  31130. initJsEditor$1();
  31131. initClipboard();
  31132. initSqlComplex();
  31133. initParamComplex();
  31134. initDict$1();
  31135. initDesigner();
  31136. }
  31137. /**
  31138. * 创建一个 Ajax 客户端
  31139. */
  31140. function createAjax(createOption) {
  31141. if (createOption.baseUrl) {
  31142. axios__default.defaults.baseURL = createOption.baseUrl;
  31143. axios__default.defaults.timeout = createOption.timeout;
  31144. storeAjax.timeout = createOption.timeout;
  31145. axios__default.defaults.timeoutErrorMessage = '网络超时';
  31146. }
  31147. return function (option) {
  31148. //@ts-ignore
  31149. option.method = (option.method || 'get').toLocaleLowerCase();
  31150. //@ts-ignore
  31151. var ax = __assign({}, option);
  31152. switch (option.method) {
  31153. case 'get':
  31154. ax.method = 'GET';
  31155. ax.params = option.param;
  31156. ax.headers = __assign({}, option.headers);
  31157. break;
  31158. case 'post':
  31159. ax.method = 'POST';
  31160. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  31161. ax.params = option.param;
  31162. ax.data = Qs.stringify(option.data);
  31163. break;
  31164. case 'put':
  31165. case 'patch':
  31166. case 'delete':
  31167. ax.method = option.method;
  31168. ax.headers = option.headers;
  31169. ax.params = option.param;
  31170. ax.data = Qs.stringify(option.data);
  31171. break;
  31172. case 'download':
  31173. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  31174. return new Promise(function (resolver, reject) {
  31175. });
  31176. case "invoke":
  31177. ax.url = serverInvokeUrlTransform(option.url, option);
  31178. ax.method = 'POST';
  31179. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31180. if (typeof option.args === 'object') {
  31181. ax.data = JSON.stringify({
  31182. args: option.args,
  31183. });
  31184. }
  31185. else {
  31186. ax.data = JSON.stringify({
  31187. args: [
  31188. __assign(__assign({}, option.data), option.param)
  31189. ],
  31190. filterModel: option.filterModel,
  31191. sortModel: option.sortModel
  31192. });
  31193. }
  31194. break;
  31195. case 'post-json':
  31196. ax.method = 'POST';
  31197. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31198. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  31199. break;
  31200. case 'post-file':
  31201. //TODO 刘壮. 上传文件
  31202. var forms = new FormData();
  31203. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  31204. _$2.forOwn(option.data, function (value, key) {
  31205. if (key === 'files') {
  31206. var i_1 = 0;
  31207. _$2.each(value, function (f) {
  31208. // @ts-ignore
  31209. forms.append('file' + (++i_1), f);
  31210. });
  31211. }
  31212. else {
  31213. forms.append(key, value);
  31214. }
  31215. });
  31216. ax.data = forms;
  31217. ax.method = 'POST';
  31218. break;
  31219. case "sql":
  31220. ax.url = sqlUrlTransform(option.url);
  31221. ax.method = 'POST';
  31222. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  31223. ax.data = JSON.stringify({
  31224. args: [option.data],
  31225. db: option.db,
  31226. filterModel: option.filterModel,
  31227. sortModel: option.sortModel
  31228. });
  31229. break;
  31230. default:
  31231. throw new Error('not implements');
  31232. }
  31233. return new Promise(function (resolver, reject) {
  31234. axios__default(ax).then(function (resolverRaw) {
  31235. var apiResult = {
  31236. rawData: resolverRaw.data,
  31237. status: resolverRaw.status,
  31238. success: (resolverRaw.data && resolverRaw.data.success),
  31239. data: resolverRaw.data.data,
  31240. pagination: resolverRaw.data.pagination,
  31241. msg: (resolverRaw.data.msg),
  31242. errors: resolverRaw.data.errors,
  31243. headers: resolverRaw.headers
  31244. };
  31245. if (typeof window['apiTranslate'] === 'function') {
  31246. window['apiTranslate'](apiResult.rawData, option.url);
  31247. }
  31248. resolver(apiResult);
  31249. }).catch(function (reason) {
  31250. reject(reason);
  31251. });
  31252. });
  31253. };
  31254. }
  31255. function downLoad(downLoadUrl, filename, data, header, isJson) {
  31256. if (isJson === void 0) { isJson = false; }
  31257. var YvanUI = _$2.get(window, 'YvanUI');
  31258. YvanUI.loading();
  31259. var createObjectURL = function (object) {
  31260. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  31261. };
  31262. // const formData = new FormData();
  31263. // _.forOwn(data, (v, k) => {
  31264. // formData.append(k, v);
  31265. // });
  31266. var formData = '';
  31267. var xhr = new XMLHttpRequest();
  31268. xhr.open('POST', downLoadUrl);
  31269. xhr.responseType = 'blob';
  31270. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  31271. if (isJson) {
  31272. formData = data ? JSON.stringify(data) : '';
  31273. xhr.setRequestHeader('Content-Type', 'application/json');
  31274. }
  31275. else {
  31276. formData = data ? Qs.stringify(data) : '';
  31277. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  31278. }
  31279. //
  31280. if (header) {
  31281. _$2.forOwn(header, function (v, k) {
  31282. xhr.setRequestHeader(k, v);
  31283. });
  31284. }
  31285. xhr.onload = function (e) {
  31286. if (this.status === 200) {
  31287. var blob = this.response;
  31288. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  31289. navigator.msSaveBlob(blob, filename);
  31290. YvanUI.clearLoading();
  31291. }
  31292. else {
  31293. var a = document.createElement('a');
  31294. var url = createObjectURL(blob);
  31295. a.href = url;
  31296. a.download = filename;
  31297. document.append(a);
  31298. a.click();
  31299. a.remove();
  31300. window.URL.revokeObjectURL(url);
  31301. YvanUI.clearLoading();
  31302. }
  31303. }
  31304. };
  31305. xhr.send(formData);
  31306. }
  31307. function readExcel(file) {
  31308. return new Promise(function (resolve, reject) {
  31309. if (!file) {
  31310. reject("文件读取失败!!!");
  31311. return;
  31312. }
  31313. var reader = new FileReader();
  31314. reader.onload = function (e) {
  31315. if (e.target) {
  31316. var data = e.target.result;
  31317. var workbook = XLSX.read(data, { type: 'binary' });
  31318. resolve(workbook);
  31319. }
  31320. else {
  31321. reject("文件读取失败!!!");
  31322. }
  31323. };
  31324. try {
  31325. reader.readAsBinaryString(file);
  31326. }
  31327. catch (e) {
  31328. reject(e);
  31329. }
  31330. });
  31331. }
  31332. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  31333. if (dataStartRow === void 0) { dataStartRow = 2; }
  31334. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  31335. if (rowValidate === void 0) { rowValidate = undefined; }
  31336. if (otherValidate === void 0) { otherValidate = undefined; }
  31337. if (fieldValidate === void 0) { fieldValidate = undefined; }
  31338. return new Promise(function (resolve, reject) {
  31339. var promiseArr = [];
  31340. for (var i = 0; i < columnsSet.length; i++) {
  31341. var fix = columnsSet[i].fix;
  31342. if (_$2.isArray(fix) && fix.length > 0) {
  31343. var ss = fix[0].toLowerCase();
  31344. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  31345. columnsSet[i].importFormatter = function (vdata) {
  31346. // @ts-ignore
  31347. return window.moment(vdata.ov) - 0;
  31348. };
  31349. }
  31350. else {
  31351. var fn = lookupFn(topScope, fix[0]);
  31352. promiseArr.push(fn(null, columnsSet[i]));
  31353. delete columnsSet[i].fix;
  31354. }
  31355. }
  31356. else if (_$2.isString(fix)) {
  31357. var ss = fix.toLowerCase();
  31358. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  31359. columnsSet[i].importFormatter = function (vdata) {
  31360. // @ts-ignore
  31361. return window.moment(vdata.ov) - 0;
  31362. };
  31363. }
  31364. else {
  31365. var fn = lookupFn(topScope, fix);
  31366. promiseArr.push(fn(null, columnsSet[i]));
  31367. delete columnsSet[i].fix;
  31368. }
  31369. }
  31370. }
  31371. var read = function () {
  31372. readExcel(file).then(function (workbook) {
  31373. var sheetNames = workbook.SheetNames; // 工作表名称集合
  31374. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  31375. var titleRowValue = [];
  31376. var titleRowKey = [];
  31377. var needLoop = false; // 是否需要迭代
  31378. var columns = [];
  31379. if (worksheet && worksheet["!ref"]) {
  31380. var t = worksheet["!ref"];
  31381. var tempArr = t.split(':');
  31382. if (tempArr.length >= 2) {
  31383. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  31384. // 选取title的行,删除之前的行
  31385. if (titleRowNumber > firstRowNumber) {
  31386. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  31387. for (var key in worksheet) {
  31388. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  31389. delete worksheet[key];
  31390. }
  31391. }
  31392. }
  31393. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  31394. firstRowNumber = titleRowNumber + '';
  31395. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  31396. }
  31397. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  31398. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  31399. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  31400. for (var key in worksheet) {
  31401. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  31402. titleRowKey.push(key);
  31403. titleRowValue.push(worksheet[key].v);
  31404. }
  31405. }
  31406. if (columnsSet && columnsSet.length > 0) {
  31407. var length = columnsSet.length;
  31408. length = length <= titleRowKey.length ? length : titleRowKey.length;
  31409. for (var i = 0; i < length; i++) {
  31410. var vk = titleRowKey[i];
  31411. var item = columnsSet[i];
  31412. var column = {};
  31413. if (typeof item === 'string') {
  31414. column.dataIndex = item;
  31415. column.header = worksheet[vk].v;
  31416. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  31417. }
  31418. else if (typeof item.dataIndex === "string") {
  31419. column.dataIndex = item.dataIndex;
  31420. column.header = worksheet[vk].v;
  31421. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  31422. if (typeof item.validate === "function") {
  31423. column.validate = item.validate;
  31424. needLoop = true;
  31425. }
  31426. if (typeof item.importFormatter === "function") {
  31427. column.importFormatter = item.importFormatter;
  31428. needLoop = true;
  31429. }
  31430. if ((item.data instanceof Array && item.data.length > 0)
  31431. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  31432. column.data = item.data;
  31433. needLoop = true;
  31434. }
  31435. }
  31436. columns.push(column);
  31437. }
  31438. }
  31439. }
  31440. }
  31441. if (fieldValidate && typeof fieldValidate === "function") {
  31442. if (fieldValidate(columns, titleRowValue) !== true) {
  31443. reject("fields validate error");
  31444. return;
  31445. }
  31446. }
  31447. var allData = XLSX.utils.sheet_to_json(worksheet);
  31448. var okData = [], errorData = [], errorMsgData = [];
  31449. var needItemLoop = needLoop;
  31450. if (rowValidate && typeof rowValidate === "function") {
  31451. needLoop = true;
  31452. }
  31453. if (needLoop === true) {
  31454. for (var index = 0; index < allData.length; index++) {
  31455. var row = allData[index];
  31456. var rowNumber = dataStartRow + index;
  31457. row.__importID__ = rowNumber;
  31458. var isRowOk = true;
  31459. if (needItemLoop) {
  31460. var _loop_1 = function (num) {
  31461. var column = columns[num];
  31462. var ov = row[column.dataIndex];
  31463. var nv = ov;
  31464. var hasError = false;
  31465. var rowNumber_1 = dataStartRow + index;
  31466. var ei = {
  31467. errorId: rowNumber_1 + '_' + column.dataIndex,
  31468. importID: rowNumber_1,
  31469. dataIndex: column.dataIndex,
  31470. header: column.header,
  31471. value: ov,
  31472. errormessage: ""
  31473. };
  31474. // 格式化
  31475. if (column.data instanceof Array) {
  31476. nv = undefined;
  31477. ei.errormessage = "字典匹配失败";
  31478. _$2.forEach(column.data, function (v, index) {
  31479. if (v.text === ov) {
  31480. nv = v.id;
  31481. return;
  31482. }
  31483. });
  31484. }
  31485. else if (_$2.isPlainObject(column.data)) {
  31486. nv = undefined;
  31487. ei.errormessage = "字典匹配失败";
  31488. _$2.forEach(column.data, function (value, key) {
  31489. if (value === ov) {
  31490. nv = key;
  31491. return;
  31492. }
  31493. });
  31494. }
  31495. if (typeof column.importFormatter === 'function') {
  31496. var vdata = {
  31497. column: column,
  31498. ov: ov,
  31499. nv: nv,
  31500. rowIndex: index,
  31501. data: row,
  31502. rowDatas: allData
  31503. };
  31504. nv = undefined;
  31505. ei.errormessage = "格式化失败";
  31506. nv = column.importFormatter(vdata);
  31507. }
  31508. if (!nv && nv != 0) {
  31509. hasError = true;
  31510. }
  31511. else {
  31512. row[column.dataIndex] = nv;
  31513. ei.errormessage = "";
  31514. }
  31515. // 校验
  31516. if (typeof column.validate === 'function') {
  31517. var vdata = {
  31518. column: column,
  31519. ov: ov,
  31520. nv: nv,
  31521. rowIndex: index,
  31522. data: row,
  31523. rowDatas: allData
  31524. };
  31525. var errormessage = column.validate(vdata);
  31526. if (errormessage === true) ;
  31527. else {
  31528. hasError = true;
  31529. ei.errormessage = ei.errormessage + "/" + errormessage;
  31530. }
  31531. }
  31532. if (hasError === true) {
  31533. isRowOk = false;
  31534. errorMsgData.push(ei);
  31535. }
  31536. };
  31537. for (var num = 0; num < columns.length; num++) {
  31538. _loop_1(num);
  31539. }
  31540. }
  31541. if (rowValidate && typeof rowValidate === "function") {
  31542. var errormessage = rowValidate({
  31543. columns: columns,
  31544. data: row,
  31545. rowIndex: index,
  31546. rowDatas: allData
  31547. });
  31548. if (errormessage === true) ;
  31549. else {
  31550. isRowOk = false;
  31551. var ei = {
  31552. errorId: rowNumber + '',
  31553. dataIndex: "row",
  31554. header: "数据行",
  31555. value: "当前行的数据",
  31556. importID: rowNumber,
  31557. errormessage: errormessage
  31558. };
  31559. errorMsgData.push(ei);
  31560. }
  31561. }
  31562. row.__hasError__ = !isRowOk;
  31563. if (isRowOk === true) {
  31564. okData.push(row);
  31565. }
  31566. else {
  31567. errorData.push(row);
  31568. }
  31569. }
  31570. }
  31571. else {
  31572. // 添加数据的唯一标识
  31573. for (var index = 0; index < allData.length; index++) {
  31574. var row = allData[index];
  31575. var rowNumber = dataStartRow + index;
  31576. row.__importID__ = rowNumber;
  31577. row.__hasError__ = false;
  31578. }
  31579. okData = allData;
  31580. }
  31581. if (otherValidate && typeof otherValidate === "function") {
  31582. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  31583. }
  31584. else {
  31585. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  31586. }
  31587. // clearLoading()
  31588. }).catch(function (e) {
  31589. reject(e);
  31590. });
  31591. };
  31592. if (promiseArr.length > 0) {
  31593. Promise.all(promiseArr).then(function (resArr) {
  31594. for (var i = 0; i < resArr.length; i++) {
  31595. var tmp = resArr[i];
  31596. tmp.config.data = [];
  31597. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  31598. if (tmp.r.field.length > 1) {
  31599. var keyKey = tmp.r.field[0];
  31600. var valueKey = tmp.r.field[1];
  31601. for (var j = 0; j < tmp.r.data.length; j++) {
  31602. var it = tmp.r.data[j];
  31603. var newIt = {};
  31604. newIt.id = it[keyKey];
  31605. newIt.text = it[valueKey];
  31606. tmp.config.data.push(newIt);
  31607. }
  31608. }
  31609. }
  31610. }
  31611. read();
  31612. });
  31613. }
  31614. else {
  31615. setTimeout(read, 50);
  31616. }
  31617. });
  31618. }
  31619. var ExcelImportDialog = /** @class */ (function (_super) {
  31620. __extends(ExcelImportDialog, _super);
  31621. function ExcelImportDialog(option) {
  31622. var _this = this;
  31623. var vjson = vjsonFunc(option);
  31624. _this = _super.call(this, { model: model$p, vjson: vjson }) || this;
  31625. _this.importExcelOption = option;
  31626. return _this;
  31627. }
  31628. ExcelImportDialog.prototype.onLoad = function () {
  31629. _super.prototype.onLoad.call(this);
  31630. };
  31631. ExcelImportDialog.prototype.fileChange = function (sender) {
  31632. var _this = this;
  31633. var file = sender.fileInputEl.dom.files[0];
  31634. // const senderScope = lookupScope(sender)
  31635. var topScope = this.topScope;
  31636. var rowValidate = this.importExcelOption.rowValidate;
  31637. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  31638. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  31639. }
  31640. var afterClientValidate = this.importExcelOption.afterClientValidate;
  31641. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  31642. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  31643. }
  31644. var fieldValidate = this.importExcelOption.fieldValidate;
  31645. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  31646. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  31647. }
  31648. this.setLoading(true);
  31649. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  31650. _this.importData = res;
  31651. _this.refs.dataGrid.setData(res.allData);
  31652. _this.viewModel.set("dataCount", res.allData.length);
  31653. _this.refs.errGrid.setData(res.errorMsgData);
  31654. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  31655. }).catch(function (e) {
  31656. _this.importData = null;
  31657. _this.refs.dataGrid.setData();
  31658. _this.refs.errGrid.setData();
  31659. msg(e.toString());
  31660. }).finally(function () {
  31661. _this.setLoading(false);
  31662. });
  31663. };
  31664. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  31665. if (record.get('__hasError__')) {
  31666. return "x-grid-record-bg-red";
  31667. }
  31668. };
  31669. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  31670. return "x-grid-record-bg-red";
  31671. };
  31672. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  31673. var _a;
  31674. var id = record.data.__importID__;
  31675. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  31676. var selectRecord = null;
  31677. var dataIndex = -1;
  31678. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  31679. for (var i = 0; i < rows.length; i++) {
  31680. if (rows[i].importID === id) {
  31681. selectRecord = this.refs.errGrid.getStore().getAt(i);
  31682. dataIndex = i;
  31683. }
  31684. if (rows[i].errorId === id + "_" + subId) {
  31685. selectRecord = this.refs.errGrid.getStore().getAt(i);
  31686. dataIndex = i;
  31687. break;
  31688. }
  31689. }
  31690. if (selectRecord) {
  31691. this.refs.errGrid.ensureVisible(selectRecord);
  31692. this.refs.errGrid.selModel.select(dataIndex);
  31693. // this.refs.errGrid.reload()
  31694. }
  31695. };
  31696. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  31697. var _a;
  31698. var id = record.data.importID;
  31699. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  31700. var selectRecord = null;
  31701. var dataIndex = -1;
  31702. for (var i = 0; i < rows.length; i++) {
  31703. if (rows[i].__importID__ === id) {
  31704. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  31705. dataIndex = i;
  31706. break;
  31707. }
  31708. }
  31709. if (selectRecord) {
  31710. this.refs.dataGrid.ensureVisible(selectRecord);
  31711. this.refs.dataGrid.selModel.select(dataIndex);
  31712. // this.refs.dataGrid.reload()
  31713. }
  31714. };
  31715. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  31716. this.viewModel.set("dataType", newValue);
  31717. if (this.importData) {
  31718. this.refs.dataGrid.setData(this.importData[newValue]);
  31719. this.viewModel.set("dataCount", this.importData[newValue].length);
  31720. }
  31721. };
  31722. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  31723. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  31724. window.location.href = this.importExcelOption.dowLoadUrl;
  31725. return;
  31726. }
  31727. var xt = [];
  31728. _$2.forEach(this.importExcelOption.columns, function (v) {
  31729. xt.push(v.header);
  31730. });
  31731. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  31732. if (filename.endsWith(".xlsx")) {
  31733. filename = filename.split(".xlsx")[0];
  31734. }
  31735. filename = filename + ".xlsx";
  31736. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  31737. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  31738. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  31739. XLSX.writeFile(wb, filename); //导出Excel
  31740. };
  31741. ExcelImportDialog.prototype.getData = function (sender) {
  31742. _$2.each(this.importData.okData, function (item) {
  31743. delete item.id;
  31744. delete item.__hasError__;
  31745. delete item.__importID__;
  31746. delete item._origin;
  31747. });
  31748. _$2.each(this.importData.allData, function (item) {
  31749. delete item.id;
  31750. delete item.__hasError__;
  31751. delete item.__importID__;
  31752. delete item._origin;
  31753. });
  31754. _$2.each(this.importData.errorData, function (item) {
  31755. delete item.id;
  31756. delete item.__hasError__;
  31757. delete item.__importID__;
  31758. delete item._origin;
  31759. });
  31760. this.dialogSuccess(this.importData);
  31761. };
  31762. return ExcelImportDialog;
  31763. }(Scope));
  31764. var model$p = {
  31765. data: {
  31766. dataType: "all",
  31767. errMsgCount: 0,
  31768. dataCount: 0
  31769. }
  31770. };
  31771. var vjsonFunc = function (option) {
  31772. return {
  31773. title: option.title || 'excel导入',
  31774. layout: 'fit',
  31775. items: [
  31776. {
  31777. layout: 'border',
  31778. tbar: {
  31779. xtype: "form",
  31780. items: [
  31781. {
  31782. xtype: "cols",
  31783. items: [
  31784. {
  31785. xtype: "filefield",
  31786. fieldLabel: 'excel文件',
  31787. buttonText: '请选择excel文件',
  31788. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  31789. flex: 3,
  31790. listeners: {
  31791. change: "scope.fileChange"
  31792. }
  31793. }, {
  31794. xtype: "button",
  31795. iconCls: "x-fa fa-download",
  31796. text: "下载模版",
  31797. listeners: {
  31798. click: "scope.downloadTemplate"
  31799. }
  31800. }, {
  31801. xtype: 'container',
  31802. border: false,
  31803. layout: 'hbox',
  31804. }, {
  31805. xtype: "button",
  31806. iconCls: "x-fa fa-upload",
  31807. text: option.tQButtonText || "提取数据",
  31808. listeners: {
  31809. click: "scope.getData"
  31810. }
  31811. }
  31812. ]
  31813. },
  31814. ]
  31815. },
  31816. items: [
  31817. {
  31818. tbar: {
  31819. xtype: "toolbar",
  31820. title: "导入的数据",
  31821. items: [{
  31822. xtype: 'label',
  31823. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  31824. }, {
  31825. xtype: 'radiogroup',
  31826. items: [
  31827. {
  31828. boxLabel: '所有数据',
  31829. checked: true,
  31830. inputValue: 'allData',
  31831. }, {
  31832. boxLabel: '正确数据',
  31833. inputValue: 'okData',
  31834. }, {
  31835. boxLabel: '错误数据',
  31836. inputValue: 'errorData',
  31837. }
  31838. ],
  31839. listeners: {
  31840. change: 'scope.filterData',
  31841. },
  31842. }, {
  31843. xtype: "textfield",
  31844. readOnly: true,
  31845. fieldLabel: "条目数",
  31846. bind: "{dataCount}"
  31847. }]
  31848. },
  31849. xtype: 'yvgrid',
  31850. reference: 'dataGrid',
  31851. layout: 'fit',
  31852. pagination: false,
  31853. // pageSize: 50,
  31854. getRowClass: 'scope.getDataGridRowRecord',
  31855. columns: option.columns,
  31856. region: 'center',
  31857. split: true,
  31858. listeners: {
  31859. cellclick: "scope.dataGridClick",
  31860. },
  31861. selModel: {
  31862. // type: 'rowmodel',
  31863. mode: 'SINGLE',
  31864. },
  31865. }, {
  31866. tbar: {
  31867. xtype: "toolbar", items: [
  31868. {
  31869. xtype: 'label',
  31870. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  31871. }, {
  31872. xtype: "textfield",
  31873. readOnly: true,
  31874. fieldLabel: "条目数",
  31875. bind: "{errMsgCount}"
  31876. }
  31877. ]
  31878. },
  31879. xtype: 'yvgrid',
  31880. reference: 'errGrid',
  31881. layout: 'fit',
  31882. pagination: false,
  31883. getRowClass: 'scope.getErrGridRowRecord',
  31884. height: "40%",
  31885. columns: [
  31886. { dataIndex: "errorId", header: "ID", hidden: true },
  31887. { dataIndex: "importID", header: "行号", width: 80 },
  31888. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  31889. { dataIndex: "value", header: "值", width: 120 },
  31890. { dataIndex: "header", header: "字段名", width: 120 },
  31891. { dataIndex: "dataIndex", header: "字段", width: 120 }
  31892. ],
  31893. region: 'south',
  31894. split: true,
  31895. listeners: {
  31896. itemclick: "scope.errGridClick"
  31897. },
  31898. selModel: {
  31899. // type: 'rowmodel',
  31900. mode: 'SINGLE',
  31901. },
  31902. },
  31903. ],
  31904. },
  31905. ],
  31906. referenceHolder: true,
  31907. };
  31908. };
  31909. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  31910. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  31911. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  31912. ret.report_id = reportId;
  31913. ret.report = report;
  31914. return ret;
  31915. }
  31916. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  31917. var e_1, _a, e_2, _b;
  31918. var model = {
  31919. data: {
  31920. report_name: config.report_name,
  31921. query: {},
  31922. sum: {},
  31923. }
  31924. };
  31925. var json5 = window['YvanUI'].json5;
  31926. var report = config.report ? json5.parse(config.report) : {};
  31927. var conditionRows = [];
  31928. var sumRows = [];
  31929. model.data.has_sum = _$2.size(report.summary) > 0;
  31930. // query 查询条件
  31931. var newRow = false;
  31932. var currentRow = { xtype: 'cols', items: [], };
  31933. conditionRows.push(currentRow);
  31934. _$2.forEach(report.query, function (item) {
  31935. if (newRow) {
  31936. currentRow = { xtype: 'cols', items: [], };
  31937. conditionRows.push(currentRow);
  31938. }
  31939. var vj = json5.parse(item.conditionFieldExtend);
  31940. if (item.conditionFieldXtype) {
  31941. vj.xtype = item.conditionFieldXtype;
  31942. if (item.conditionFieldXtype === 'combo') {
  31943. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  31944. }
  31945. if (item.conditionFieldXtype === 'datetimefield') {
  31946. //@ts-ignore
  31947. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  31948. }
  31949. else if (item.conditionFieldXtype === 'datefield') {
  31950. //@ts-ignore
  31951. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  31952. }
  31953. else {
  31954. model.data.query[item.conditionFieldBind] = '';
  31955. }
  31956. }
  31957. else {
  31958. // 没有组件类型,是个空占位符
  31959. vj.border = false;
  31960. }
  31961. if (item.conditionFieldBind) {
  31962. vj.bind = {
  31963. value: '{query.' + item.conditionFieldBind + '}'
  31964. };
  31965. }
  31966. if (item.conditionFieldFlex) {
  31967. vj.flex = item.conditionFieldFlex;
  31968. }
  31969. if (item.conditionFieldXtype) {
  31970. vj.fieldLabel = item.conditionFieldLabel;
  31971. }
  31972. if (item.fieldLabel) {
  31973. vj.fieldLabel = item.fieldLabel;
  31974. }
  31975. newRow = item.conditionFieldWrap || false;
  31976. currentRow.items.push(vj);
  31977. });
  31978. if (currentRow) {
  31979. currentRow.margin = '10 0 10 0';
  31980. }
  31981. // sum 汇总条件
  31982. newRow = true;
  31983. try {
  31984. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  31985. var item = _d.value;
  31986. if (newRow) {
  31987. currentRow = {
  31988. xtype: 'cols',
  31989. defaultType: 'displayfield',
  31990. defaults: {
  31991. labelWidth: 70,
  31992. },
  31993. items: []
  31994. };
  31995. sumRows.push(currentRow);
  31996. }
  31997. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  31998. if (item.sumFieldBind) {
  31999. vj.bind = '{sum.' + item.sumFieldBind + '}';
  32000. model.data.sum[item.sumFieldBind] = '';
  32001. }
  32002. else {
  32003. // 没有组件类型,是个空占位符
  32004. vj.border = false;
  32005. }
  32006. if (item.sumFieldFlex) {
  32007. vj.flex = item.sumFieldFlex;
  32008. }
  32009. if (item.sumFieldLabel) {
  32010. vj.fieldLabel = item.sumFieldLabel;
  32011. }
  32012. // sumFieldBind: "zs"
  32013. // sumFieldExtend: "{}"
  32014. // sumFieldFlex: 1
  32015. // sumFieldLabel: "总数"
  32016. // sumFieldWrap: false
  32017. newRow = item.sumFieldWrap || false;
  32018. currentRow.items.push(vj);
  32019. }
  32020. }
  32021. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  32022. finally {
  32023. try {
  32024. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  32025. }
  32026. finally { if (e_1) throw e_1.error; }
  32027. }
  32028. if (currentRow) {
  32029. currentRow.margin = '10 0 10 0';
  32030. }
  32031. // column 结果字段
  32032. var columns = [];
  32033. try {
  32034. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  32035. var item = _f.value;
  32036. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  32037. if (item.xtype) {
  32038. if (item.xtype == 'checkbox') {
  32039. vj.xtype = 'checkcolumn';
  32040. vj.disabled = true;
  32041. }
  32042. else {
  32043. vj.xtype = item.xtype;
  32044. }
  32045. }
  32046. if (item.dataType) {
  32047. vj.dataType = item.dataType;
  32048. }
  32049. if (item.align) {
  32050. vj.align = item.align;
  32051. }
  32052. if (item.width) {
  32053. vj.width = item.width;
  32054. }
  32055. if (item.dict) {
  32056. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  32057. }
  32058. columns.push(vj);
  32059. }
  32060. }
  32061. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  32062. finally {
  32063. try {
  32064. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  32065. }
  32066. finally { if (e_2) throw e_2.error; }
  32067. }
  32068. var vjson = {
  32069. bind: {
  32070. title: '{report_name}',
  32071. },
  32072. layout: 'fit',
  32073. referenceHolder: true,
  32074. items: [
  32075. {
  32076. layout: 'border',
  32077. border: false,
  32078. items: [
  32079. {
  32080. region: 'north',
  32081. border: false,
  32082. tbar: {
  32083. xtype: 'toolbar',
  32084. border: false,
  32085. items: [
  32086. {
  32087. xtype: 'button',
  32088. text: '查询',
  32089. reference: 'btnSearch',
  32090. iconCls: 'x-fa fa-search',
  32091. listeners: {
  32092. click: 'scope.reload',
  32093. },
  32094. },
  32095. {
  32096. xtype: 'button',
  32097. text: '关闭',
  32098. iconCls: 'x-fa fa-times',
  32099. listeners: {
  32100. click: 'system.closeMe()',
  32101. },
  32102. },
  32103. ],
  32104. },
  32105. defaults: {
  32106. margin: '8 0 0 0'
  32107. },
  32108. items: __spread(conditionRows, sumRows),
  32109. fix: ['system.enterToClick("btnSearch")'],
  32110. },
  32111. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  32112. method: 'invoke',
  32113. url: '/report/Report@execute',
  32114. params: {
  32115. dataSource: report.dataSource,
  32116. pagination: report.grid.pagination || true,
  32117. report_id: config.report_id,
  32118. query: '{query}',
  32119. },
  32120. }, columns: columns }, report.grid),
  32121. ],
  32122. },
  32123. ],
  32124. };
  32125. return { model: model, vjson: vjson, report: report };
  32126. }
  32127. var ReportScope = /** @class */ (function (_super) {
  32128. __extends(ReportScope, _super);
  32129. function ReportScope(_a, invokeServerFn) {
  32130. var model = _a.model, vjson = _a.vjson;
  32131. var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this;
  32132. _this.invokeServerFn = invokeServerFn;
  32133. return _this;
  32134. }
  32135. ReportScope.prototype.onLoad = function () {
  32136. // this.reload()
  32137. };
  32138. ReportScope.prototype.reload = function () {
  32139. var _this = this;
  32140. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  32141. if (this.viewModel.get('has_sum')) {
  32142. this.invokeServerFn('/report/Report@executeSum', {
  32143. dataSource: this.report.dataSource,
  32144. report_id: this.report_id,
  32145. query: this.viewModel.get('query'),
  32146. }).then(function (res) {
  32147. if (!res.success) {
  32148. showErrorDialog$1(res.msg);
  32149. }
  32150. else {
  32151. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  32152. }
  32153. });
  32154. }
  32155. this.refs.grid1.reload();
  32156. };
  32157. return ReportScope;
  32158. }(Scope));
  32159. var studio = {
  32160. init: init$1,
  32161. handles: handles$1,
  32162. Workbench: Workbench
  32163. };
  32164. exports.axios = axios;
  32165. exports.qs = Qs;
  32166. exports.lodash = _$2;
  32167. exports.jquery = $$2;
  32168. exports.moment = moment$1;
  32169. exports.recast = recast;
  32170. exports.XLSX = XLSX;
  32171. exports.echarts = echarts;
  32172. exports.Defaults = Defaults;
  32173. exports.ExcelImportDialog = ExcelImportDialog;
  32174. exports.Lib = Lib;
  32175. exports.LibParam = LibParam;
  32176. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32177. exports.ReportScope = ReportScope;
  32178. exports.SIMPLE_RE = SIMPLE_RE;
  32179. exports.Scope = Scope;
  32180. exports.ScopeEngine = ScopeEngine;
  32181. exports.SystemEventFu = SystemEventFu;
  32182. exports.ajax = ajax;
  32183. exports.baseConfigProcess = baseConfigProcess;
  32184. exports.baseConfigProcessList = baseConfigProcessList;
  32185. exports.buildPlus = buildPlus;
  32186. exports.buildReportScope = buildReportScope;
  32187. exports.calcExpress = calcExpress;
  32188. exports.calcObject = calcObject;
  32189. exports.calcObjectFlat = calcObjectFlat;
  32190. exports.clearViewModel = clearViewModel;
  32191. exports.clearViewModelByLookup = clearViewModelByLookup;
  32192. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32193. exports.clearViewModelValues = clearViewModelValues;
  32194. exports.commitMe = commitMe;
  32195. exports.confirm = confirm;
  32196. exports.createAjax = createAjax;
  32197. exports.createUUID = createUUID;
  32198. exports.deepTravJson = deepTravJson;
  32199. exports.downLoad = downLoad;
  32200. exports.evalFunction = evalFunction;
  32201. exports.extend = extend;
  32202. exports.flatRow = flatRow;
  32203. exports.getApiConvert = getApiConvert;
  32204. exports.getGridEditRows = getGridEditRows;
  32205. exports.getParentGrid = getParentGrid;
  32206. exports.getPinyin = getPinyin;
  32207. exports.getRegList = getRegList;
  32208. exports.getRegParamList = getRegParamList;
  32209. exports.getScopeOnCreate = getScopeOnCreate;
  32210. exports.init = init$2;
  32211. exports.insertGridRow = insertGridRow;
  32212. exports.invokeServer = invokeServer$1;
  32213. exports.isDesignMode = isDesignMode;
  32214. exports.isEmpty = isEmpty;
  32215. exports.json5 = dist;
  32216. exports.keywordFilter = keywordFilter;
  32217. exports.lookupFn = lookupFn;
  32218. exports.lookupScope = lookupScope;
  32219. exports.mergeViewModel = mergeViewModel;
  32220. exports.moveDownGridRow = moveDownGridRow;
  32221. exports.moveUpGridRow = moveUpGridRow;
  32222. exports.msg = msg$1;
  32223. exports.msgError = msgError;
  32224. exports.normId = normId;
  32225. exports.pinyinMatch = pinyinMatch;
  32226. exports.prompt = prompt$2;
  32227. exports.raiseClick = raiseClick;
  32228. exports.reloadGrid = reloadGrid;
  32229. exports.removeGridRow = removeGridRow;
  32230. exports.replaceNA = replaceNA;
  32231. exports.saveGridRow = saveGridRow;
  32232. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32233. exports.setComboStore = setComboStore;
  32234. exports.showErrorDialog = showErrorDialog$1;
  32235. exports.showInfoDialog = showInfoDialog;
  32236. exports.showWidget = showWidget;
  32237. exports.sqlUrlTransform = sqlUrlTransform;
  32238. exports.stopEvent = stopEvent;
  32239. exports.studio = studio;
  32240. exports.toPlainObject = toPlainObject;
  32241. exports.toString = toString;
  32242. exports.tryEnable = tryEnable;
  32243. exports.tryVarSimple = tryVarSimple;
  32244. exports.tryWriteByExpress = tryWriteByExpress;
  32245. exports.tryWriteObject = tryWriteObject;
  32246. exports.watch = watch;
  32247. Object.defineProperty(exports, '__esModule', { value: true });
  32248. });
  32249. //# sourceMappingURL=yvan-ext.js.map