yvan-ext.js 1.3 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922
  1. define(['exports', 'axios', 'qs', 'lodash', 'jquery', 'moment', 'recast', 'xlsx', 'localforage', 'modeler', 'bpmn-js-properties-panel', 'echarts', 'lay-excel', 'handlebars', 'xterm', 'xterm-addon-fit', 'sql-formatter'], function (exports, axios, Qs, _$2, $$2, moment$1, recast, XLSX, localforage, BpmnModeler, bpmnJsPropertiesPanel, echarts, LAY_EXCEL, handlebars, xterm, xtermAddonFit, sqlFormat) { 'use strict';
  2. var axios__default = 'default' in axios ? axios['default'] : axios;
  3. Qs = Qs && Object.prototype.hasOwnProperty.call(Qs, 'default') ? Qs['default'] : Qs;
  4. _$2 = _$2 && Object.prototype.hasOwnProperty.call(_$2, 'default') ? _$2['default'] : _$2;
  5. $$2 = $$2 && Object.prototype.hasOwnProperty.call($$2, 'default') ? $$2['default'] : $$2;
  6. moment$1 = moment$1 && Object.prototype.hasOwnProperty.call(moment$1, 'default') ? moment$1['default'] : moment$1;
  7. XLSX = XLSX && Object.prototype.hasOwnProperty.call(XLSX, 'default') ? XLSX['default'] : XLSX;
  8. localforage = localforage && Object.prototype.hasOwnProperty.call(localforage, 'default') ? localforage['default'] : localforage;
  9. BpmnModeler = BpmnModeler && Object.prototype.hasOwnProperty.call(BpmnModeler, 'default') ? BpmnModeler['default'] : BpmnModeler;
  10. LAY_EXCEL = LAY_EXCEL && Object.prototype.hasOwnProperty.call(LAY_EXCEL, 'default') ? LAY_EXCEL['default'] : LAY_EXCEL;
  11. handlebars = handlebars && Object.prototype.hasOwnProperty.call(handlebars, 'default') ? handlebars['default'] : handlebars;
  12. sqlFormat = sqlFormat && Object.prototype.hasOwnProperty.call(sqlFormat, 'default') ? sqlFormat['default'] : sqlFormat;
  13. var labelWidth = 80;
  14. var windows = {
  15. modal: true,
  16. width: 900,
  17. height: 600,
  18. maximizable: true,
  19. constrain: true,
  20. shadow: false,
  21. };
  22. var date = {
  23. labelAlign: 'right',
  24. labelWidth: labelWidth,
  25. };
  26. var tagfield = {
  27. labelAlign: 'right',
  28. labelWidth: labelWidth,
  29. valueField: 'id',
  30. displayField: 'text',
  31. autoLoad: true,
  32. mode: 'local',
  33. forceSelection: true,
  34. triggerAction: 'all',
  35. enableKeyEvents: true,
  36. queryMode: 'local',
  37. filterPickList: true,
  38. };
  39. var combo = {
  40. labelAlign: 'right',
  41. labelWidth: labelWidth,
  42. valueField: 'id',
  43. displayField: 'text',
  44. autoLoad: true,
  45. mode: 'local',
  46. forceSelection: true,
  47. triggerAction: 'all',
  48. enableKeyEvents: true,
  49. typeAheadDelay: 1,
  50. queryDelay: 1,
  51. };
  52. var comboGrid = {
  53. selectOnTab: true,
  54. pickerHeight: 500,
  55. pickerWidth: 850,
  56. editEnable: null,
  57. };
  58. var comboGridPicker = {
  59. xtype: 'yvgrid',
  60. layout: 'fit',
  61. selModel: {
  62. selType: 'rowmodel',
  63. mode: 'SINGLE'
  64. },
  65. };
  66. var comboGridMulti = {
  67. selectOnTab: true,
  68. pickerHeight: 500,
  69. pickerWidth: 850,
  70. editEnable: null,
  71. splitChar: ',',
  72. displayField: 'text',
  73. valueField: 'id',
  74. autoLoad: true,
  75. };
  76. var comboGridMultiPicker = {
  77. selType: 'checkboxmodel',
  78. selModel: {
  79. type: 'checkboxmodel',
  80. checkOnly: false
  81. },
  82. };
  83. var numberfield = {
  84. labelAlign: 'right',
  85. decimalPrecision: 6,
  86. labelWidth: labelWidth,
  87. };
  88. var checkbox = {
  89. labelAlign: 'right',
  90. labelWidth: labelWidth,
  91. checkedValue: true,
  92. uncheckedValue: false,
  93. };
  94. var checkboxgroup = {
  95. labelAlign: 'right',
  96. labelWidth: labelWidth,
  97. };
  98. var radio = {
  99. labelAlign: 'right',
  100. labelWidth: labelWidth,
  101. };
  102. var radiogroup = {
  103. labelAlign: 'right',
  104. labelWidth: labelWidth,
  105. simpleValue: true,
  106. layout: 'hbox',
  107. defaults: {
  108. xtype: 'radio',
  109. name: 'type',
  110. margin: '0 15 0 0'
  111. },
  112. };
  113. var form = {
  114. margin: '5 5 0 0',
  115. border: false,
  116. defaults: {
  117. margin: '0 0 5 0',
  118. border: false,
  119. },
  120. };
  121. var column = {
  122. filter: { type: 'string' },
  123. };
  124. var grid = {
  125. border: true,
  126. columnLines: true,
  127. rowLines: true,
  128. plugins: {
  129. cellediting: {
  130. clicksToEdit: 1,
  131. },
  132. gridfilters: true
  133. },
  134. multiColumnSort: true,
  135. viewConfig: {
  136. enableTextSelection: true,
  137. sortOnClick: false,
  138. emptyText: '没有数据'
  139. },
  140. selModel: {
  141. type: 'checkboxmodel',
  142. checkOnly: false
  143. },
  144. pagination: true,
  145. pageSize: 50,
  146. pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
  147. hideFootbar: false,
  148. hideRefresh: false,
  149. hideExport: false,
  150. hideAutoSize: false,
  151. hideClearFilter: false,
  152. hideSaveGridUIConfig: false,
  153. hideClearGridUIConfig: false,
  154. autoLoad: true,
  155. remoteSort: false,
  156. remoteFilter: false,
  157. enableLocking: true,
  158. syncRowHeight: false,
  159. enableColumnMove: true,
  160. enableColumnHide: true,
  161. enableColumnResize: true,
  162. hidden: false,
  163. disabled: false,
  164. exportExcelPageSize: 1000,
  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 __awaiter(thisArg, _arguments, P, generator) {
  1717. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  1718. return new (P || (P = Promise))(function (resolve, reject) {
  1719. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  1720. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  1721. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  1722. step((generator = generator.apply(thisArg, _arguments || [])).next());
  1723. });
  1724. }
  1725. function __generator(thisArg, body) {
  1726. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  1727. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  1728. function verb(n) { return function (v) { return step([n, v]); }; }
  1729. function step(op) {
  1730. if (f) throw new TypeError("Generator is already executing.");
  1731. while (_) try {
  1732. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  1733. if (y = 0, t) op = [op[0] & 2, t.value];
  1734. switch (op[0]) {
  1735. case 0: case 1: t = op; break;
  1736. case 4: _.label++; return { value: op[1], done: false };
  1737. case 5: _.label++; y = op[1]; op = [0]; continue;
  1738. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  1739. default:
  1740. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  1741. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  1742. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  1743. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  1744. if (t[2]) _.ops.pop();
  1745. _.trys.pop(); continue;
  1746. }
  1747. op = body.call(thisArg, _);
  1748. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  1749. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  1750. }
  1751. }
  1752. function __values(o) {
  1753. var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
  1754. if (m) return m.call(o);
  1755. if (o && typeof o.length === "number") return {
  1756. next: function () {
  1757. if (o && i >= o.length) o = void 0;
  1758. return { value: o && o[i++], done: !o };
  1759. }
  1760. };
  1761. throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
  1762. }
  1763. function __read(o, n) {
  1764. var m = typeof Symbol === "function" && o[Symbol.iterator];
  1765. if (!m) return o;
  1766. var i = m.call(o), r, ar = [], e;
  1767. try {
  1768. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  1769. }
  1770. catch (error) { e = { error: error }; }
  1771. finally {
  1772. try {
  1773. if (r && !r.done && (m = i["return"])) m.call(i);
  1774. }
  1775. finally { if (e) throw e.error; }
  1776. }
  1777. return ar;
  1778. }
  1779. function __spread() {
  1780. for (var ar = [], i = 0; i < arguments.length; i++)
  1781. ar = ar.concat(__read(arguments[i]));
  1782. return ar;
  1783. }
  1784. var PropertyDescription = /** @class */ (function () {
  1785. function PropertyDescription() {
  1786. var _this = this;
  1787. var args = [];
  1788. for (var _i = 0; _i < arguments.length; _i++) {
  1789. args[_i] = arguments[_i];
  1790. }
  1791. this.propertyes = {
  1792. props: [],
  1793. events: []
  1794. };
  1795. _$2.each(args, function (arg) {
  1796. _this.merge(arg);
  1797. });
  1798. }
  1799. PropertyDescription.prototype.merge = function (pd) {
  1800. this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
  1801. if (pd.events) {
  1802. if (this.propertyes.events) {
  1803. this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
  1804. }
  1805. else {
  1806. this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
  1807. }
  1808. }
  1809. };
  1810. /**
  1811. * 根据分组名 获取属性定义
  1812. */
  1813. PropertyDescription.prototype.getPropsByGroup = function (name) {
  1814. return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
  1815. };
  1816. /**
  1817. * 获取全部事件
  1818. */
  1819. PropertyDescription.prototype.getEvents = function () {
  1820. return this.propertyes.events;
  1821. };
  1822. return PropertyDescription;
  1823. }());
  1824. var PropertyDescriptionTable = new Map();
  1825. var width = {
  1826. name: 'width',
  1827. default: '',
  1828. group: 'common',
  1829. desc: '宽',
  1830. type: 'string'
  1831. };
  1832. var height = {
  1833. name: 'height',
  1834. default: '',
  1835. group: 'common',
  1836. desc: '高',
  1837. type: 'string'
  1838. };
  1839. var fieldLabel = {
  1840. name: 'fieldLabel',
  1841. default: '',
  1842. group: 'common',
  1843. desc: '文本描述',
  1844. type: 'string',
  1845. expr: true,
  1846. };
  1847. var text$1 = {
  1848. name: 'text',
  1849. default: '',
  1850. group: 'common',
  1851. desc: '文本描述',
  1852. type: 'string',
  1853. expr: true,
  1854. };
  1855. var iconCls = {
  1856. name: 'iconCls',
  1857. default: '',
  1858. group: 'common',
  1859. desc: '图标',
  1860. type: 'string',
  1861. expr: true,
  1862. };
  1863. var disabled = {
  1864. name: 'disabled',
  1865. default: false,
  1866. group: 'common',
  1867. desc: '禁用',
  1868. type: 'boolean',
  1869. expr: true,
  1870. };
  1871. var value = {
  1872. name: 'value',
  1873. default: '',
  1874. group: 'common',
  1875. desc: '字段值',
  1876. type: 'string',
  1877. expr: true,
  1878. };
  1879. var template = {
  1880. name: 'template',
  1881. default: '',
  1882. group: 'common',
  1883. desc: 'HTML内容',
  1884. type: 'string',
  1885. expr: true,
  1886. };
  1887. var reference = {
  1888. name: 'reference',
  1889. default: '',
  1890. group: 'common',
  1891. desc: '组件句柄',
  1892. type: 'string',
  1893. expr: true,
  1894. };
  1895. var tooltip = {
  1896. name: 'tooltip',
  1897. default: '',
  1898. group: 'common',
  1899. desc: '悬停提示',
  1900. type: 'string'
  1901. };
  1902. // =============事件 ==============
  1903. var click = {
  1904. name: 'click',
  1905. default: '',
  1906. group: 'listeners',
  1907. desc: '点击事件',
  1908. eventParamter: [
  1909. 'sender',
  1910. 'e: any'
  1911. ],
  1912. type: 'listeners'
  1913. };
  1914. var change = {
  1915. name: 'change',
  1916. default: '',
  1917. group: 'listeners',
  1918. desc: 'value change事件',
  1919. eventParamter: [
  1920. 'sender',
  1921. 'e: any'
  1922. ],
  1923. type: 'listeners'
  1924. };
  1925. var keyup = {
  1926. name: 'keyup',
  1927. default: '',
  1928. group: 'listeners',
  1929. desc: '键盘按键抬起事件',
  1930. eventParamter: [
  1931. 'sender',
  1932. 'e'
  1933. ],
  1934. type: 'listeners'
  1935. };
  1936. var afterrender = {
  1937. name: 'afterrender',
  1938. default: '',
  1939. group: 'listeners',
  1940. desc: '控件渲染后触发',
  1941. eventParamter: [
  1942. 'sender',
  1943. 'e'
  1944. ],
  1945. type: 'listeners'
  1946. };
  1947. // =============特性 ==============
  1948. var fix = {
  1949. name: 'fix',
  1950. default: '',
  1951. group: 'fix',
  1952. desc: '特性',
  1953. type: 'fix',
  1954. expr: true,
  1955. };
  1956. PropertyDescriptionTable.set('cols', new PropertyDescription({
  1957. props: [
  1958. height
  1959. ]
  1960. }));
  1961. PropertyDescriptionTable.set('layout', new PropertyDescription({
  1962. props: [
  1963. {
  1964. name: 'borderless',
  1965. default: true,
  1966. group: 'css',
  1967. desc: '有无边框',
  1968. type: 'boolean'
  1969. },
  1970. {
  1971. name: 'type',
  1972. default: '',
  1973. group: 'css',
  1974. desc: '布局类型',
  1975. type: ['line', 'clean', 'wide', 'space', 'form']
  1976. },
  1977. {
  1978. name: '_designMode',
  1979. default: 'module',
  1980. group: 'common',
  1981. desc: '设计类型',
  1982. type: ['none', 'module', 'scroll-module']
  1983. }
  1984. ]
  1985. }));
  1986. var YvBase = {
  1987. props: [
  1988. width, height, reference, afterrender, fix
  1989. ],
  1990. events: [
  1991. // {name: 'onRender', desc: '第一次控件被渲染时触发'}
  1992. ]
  1993. };
  1994. PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, {
  1995. props: [
  1996. template
  1997. ]
  1998. }));
  1999. PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, {
  2000. props: [
  2001. {
  2002. name: 'label',
  2003. default: '',
  2004. group: 'common',
  2005. desc: '字段组标题',
  2006. type: 'string'
  2007. }
  2008. ]
  2009. }));
  2010. PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, {
  2011. props: [
  2012. {
  2013. name: 'src',
  2014. default: '',
  2015. group: 'common',
  2016. desc: '地址路径',
  2017. type: 'string'
  2018. }
  2019. ]
  2020. }));
  2021. PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, {
  2022. props: [
  2023. width, height,
  2024. {
  2025. name: 'value',
  2026. default: '上传',
  2027. group: 'common',
  2028. desc: '文本描述',
  2029. type: 'string'
  2030. },
  2031. {
  2032. name: 'upload',
  2033. default: '/upload',
  2034. group: 'common',
  2035. desc: '上传地址',
  2036. type: 'string'
  2037. },
  2038. ],
  2039. events: [
  2040. { name: 'onFileUpload', desc: '文件上传成功结束时触发' },
  2041. { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' },
  2042. ]
  2043. }));
  2044. PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, {
  2045. props: [
  2046. value,
  2047. {
  2048. name: 'imgWidth',
  2049. default: '',
  2050. group: 'common',
  2051. desc: '图片宽',
  2052. type: 'string'
  2053. },
  2054. {
  2055. name: 'imgHeight',
  2056. default: '',
  2057. group: 'common',
  2058. desc: '图片高',
  2059. type: 'string'
  2060. }
  2061. ]
  2062. }));
  2063. PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, {
  2064. props: [
  2065. value,
  2066. {
  2067. name: 'imgWidth',
  2068. default: '',
  2069. group: 'common',
  2070. desc: '图片宽',
  2071. type: 'string'
  2072. },
  2073. {
  2074. name: 'imgHeight',
  2075. default: '',
  2076. group: 'common',
  2077. desc: '图片高',
  2078. type: 'string'
  2079. }
  2080. ]
  2081. }));
  2082. PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, {
  2083. props: [text$1, disabled, height, width, iconCls, click, afterrender],
  2084. }));
  2085. PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, {
  2086. props: [
  2087. fieldLabel, value, disabled,
  2088. tooltip, width, height
  2089. ],
  2090. }));
  2091. PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, {
  2092. props: [
  2093. fieldLabel, value, disabled,
  2094. tooltip, width, height, keyup, afterrender, change
  2095. ],
  2096. }));
  2097. PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, {
  2098. props: [
  2099. fieldLabel, value, disabled,
  2100. tooltip, width, height, keyup, afterrender, change
  2101. ],
  2102. }));
  2103. PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, {
  2104. props: [
  2105. fieldLabel, value, disabled,
  2106. tooltip, width, height, keyup, afterrender, change
  2107. ],
  2108. }));
  2109. PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, {
  2110. props: [
  2111. fieldLabel, value, disabled,
  2112. tooltip, width, height, keyup, afterrender, change
  2113. ],
  2114. }));
  2115. PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, {
  2116. props: [
  2117. fieldLabel, value, disabled,
  2118. tooltip, width, height, keyup, afterrender, change
  2119. ],
  2120. }));
  2121. PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, {
  2122. props: [
  2123. fieldLabel, value, disabled,
  2124. tooltip, width, height, keyup, afterrender, change
  2125. ],
  2126. }));
  2127. PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, {
  2128. props: [
  2129. fieldLabel, value, disabled,
  2130. tooltip, width, height, keyup, afterrender, change
  2131. ],
  2132. }));
  2133. PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, {
  2134. props: [
  2135. fieldLabel, value, disabled,
  2136. tooltip, width, height, keyup, afterrender, change
  2137. ],
  2138. }));
  2139. PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, {
  2140. props: [
  2141. fieldLabel, value, disabled,
  2142. tooltip, width, height
  2143. ],
  2144. }));
  2145. PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, {
  2146. props: [
  2147. fieldLabel, value, disabled,
  2148. tooltip, width, height, keyup, afterrender, change
  2149. ],
  2150. }));
  2151. PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, {
  2152. props: [
  2153. fieldLabel, value, disabled,
  2154. tooltip, width, height, keyup, afterrender, change
  2155. ],
  2156. }));
  2157. PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, {
  2158. props: [
  2159. fieldLabel, value, disabled,
  2160. tooltip, width, height, keyup, afterrender, change
  2161. ],
  2162. }));
  2163. PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, {
  2164. props: [
  2165. fieldLabel, value, disabled,
  2166. tooltip, width, height, afterrender, change
  2167. ],
  2168. }));
  2169. /**
  2170. * 弹出输入框,输入文字
  2171. * @param message 提示文字
  2172. * @param defaultValue 默认值
  2173. * @param multiLine 是否多行输入
  2174. */
  2175. function prompt$1(message, defaultValue, multiLine) {
  2176. if (defaultValue === void 0) { defaultValue = ""; }
  2177. if (multiLine === void 0) { multiLine = false; }
  2178. return new Promise(function (resolve) {
  2179. Ext.MessageBox.prompt('请输入', message, function (button, value) {
  2180. if (button === 'ok') {
  2181. resolve(value);
  2182. }
  2183. }, null, multiLine, defaultValue);
  2184. });
  2185. }
  2186. /**
  2187. * 显示错误异常信息
  2188. * @param msg 错误内容
  2189. * @param sender 发送者按钮(可以为空)
  2190. */
  2191. function showErrorDialog(msg, sender) {
  2192. console.error(msg);
  2193. Ext.MessageBox.show({
  2194. title: '错误',
  2195. msg: msg,
  2196. buttons: Ext.MessageBox.OK,
  2197. animateTarget: sender,
  2198. icon: 'error',
  2199. cls: 'show-icon-messagebox',
  2200. });
  2201. }
  2202. /**
  2203. * 显示错误异常信息
  2204. * @param msg 错误内容
  2205. * @param sender 发送者按钮(可以为空)
  2206. */
  2207. function showInfoDialogSimple(msg, sender) {
  2208. console.info(msg);
  2209. Ext.MessageBox.show({
  2210. title: '提示',
  2211. msg: msg,
  2212. buttons: Ext.MessageBox.OK,
  2213. animateTarget: sender,
  2214. icon: 'info',
  2215. cls: 'show-icon-messagebox',
  2216. });
  2217. }
  2218. function msgError(msg, sender) {
  2219. showErrorDialog(msg, sender);
  2220. }
  2221. /**
  2222. * 中间灰底白字提示
  2223. */
  2224. function msg(message) {
  2225. console.log(message);
  2226. var t = { message: message };
  2227. var WMSTranslate = window["WMSTranslate"];
  2228. if (WMSTranslate) {
  2229. if (typeof window['viewTranslate'] === 'function') {
  2230. window['viewTranslate'](t, message, "message");
  2231. }
  2232. }
  2233. var $body = $$2('body');
  2234. $body.find('[xtype=tooltip]').remove();
  2235. var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
  2236. ' <div class="yvan-msg-content">' +
  2237. _$2.escape(t.message) +
  2238. '</div></div>');
  2239. $body.append($w);
  2240. var iframeWidth = $w.parent().width();
  2241. var iframeHeight = $w.parent().height();
  2242. var windowWidth = $w.width();
  2243. var windowHeight = $w.height();
  2244. var setWidth = (iframeWidth - windowWidth) / 2;
  2245. var setHeight = (iframeHeight - windowHeight) / 2;
  2246. if (iframeHeight < windowHeight || setHeight < 0) {
  2247. setHeight = 0;
  2248. }
  2249. if (iframeWidth < windowWidth || setWidth < 0) {
  2250. setWidth = 0;
  2251. }
  2252. $w.css({ left: setWidth, top: setHeight });
  2253. setTimeout(function () {
  2254. $w.remove();
  2255. }, 3000);
  2256. }
  2257. localforage.config({
  2258. name: "studio",
  2259. storeName: "item",
  2260. });
  2261. function getItem(key, callback) {
  2262. localforage.getItem(key).then(function (value) {
  2263. if (callback) {
  2264. callback(value);
  2265. }
  2266. });
  2267. }
  2268. function setItem(key, value, callback) {
  2269. localforage.setItem(key, value).then(function (val) {
  2270. if (callback) {
  2271. callback();
  2272. }
  2273. });
  2274. }
  2275. var native = {
  2276. /**
  2277. * 读取文件
  2278. */
  2279. loadFile: function (fileName, callback) {
  2280. console.log('loadFile', fileName);
  2281. getItem('NATIVE_' + fileName, callback);
  2282. },
  2283. /**
  2284. * 保存文件
  2285. */
  2286. saveFile: function (fileName, content) {
  2287. console.log('saveFile', fileName, content);
  2288. setItem('NATIVE_' + fileName, content);
  2289. },
  2290. openInIdea: function (path) {
  2291. msg(path);
  2292. },
  2293. /**
  2294. * 初始化 native 工具类
  2295. */
  2296. init: function () {
  2297. var ClipboardJS = window['ClipboardJS'];
  2298. if (!ClipboardJS) {
  2299. msg('没有引入 ClipboardJS');
  2300. return;
  2301. }
  2302. $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
  2303. var clipboard = new ClipboardJS('.__btnClipboard');
  2304. },
  2305. /**
  2306. * 设置剪切板
  2307. */
  2308. clipboardSet: function (c) {
  2309. var $btn = $('.__btnClipboard');
  2310. $btn.attr('data-clipboard-text', c);
  2311. $btn.trigger("click");
  2312. },
  2313. };
  2314. /**
  2315. * 判断变量是否有值 value === null || value === undefined
  2316. * @param value 目标变量
  2317. */
  2318. var noValue = function (value) {
  2319. return value === null || value === undefined;
  2320. };
  2321. function initStateTree () {
  2322. Ext.define('com.yvan.studio.StateTree', {
  2323. extend: 'Ext.tree.Panel',
  2324. _saveStateFlag: true,
  2325. _filterText: '',
  2326. fbar: [
  2327. {
  2328. xtype: 'textfield',
  2329. flex: 1,
  2330. emptyText: '搜索过滤',
  2331. enableKeyEvents: true,
  2332. listeners: {
  2333. change: function (sender) {
  2334. var tree = sender.up("treepanel");
  2335. tree.filterByText(this.getRawValue());
  2336. },
  2337. keyup: function (sender, e) {
  2338. var tree = sender.up("treepanel");
  2339. if (e.ESC === e.getKey()) {
  2340. sender.setValue('');
  2341. tree.filterByText('');
  2342. }
  2343. }
  2344. }
  2345. },
  2346. ],
  2347. getStateFilename: function () {
  2348. throw Error('没有实现这个函数');
  2349. },
  2350. initComponent: function () {
  2351. var me = this;
  2352. this.on({
  2353. afterrender: function () {
  2354. var _this = this;
  2355. // 回车后打开节点
  2356. $(me.el.dom).keydown(function (event) {
  2357. if (event.keyCode === 13) {
  2358. event.preventDefault();
  2359. _this.fireEvent('itemverify');
  2360. return;
  2361. }
  2362. });
  2363. },
  2364. afteritemexpand: {
  2365. fn: function (node, index, item, eOpts) {
  2366. this.saveState();
  2367. },
  2368. buffer: 100,
  2369. },
  2370. afteritemcollapse: {
  2371. fn: function (node, index, item, eOpts) {
  2372. this.saveState();
  2373. },
  2374. buffer: 100,
  2375. },
  2376. itemdblclick: function (sender, record) {
  2377. this.fireEvent('itemverify');
  2378. },
  2379. itemclick: {
  2380. fn: function (node, index, item, eOpts) {
  2381. this.saveState();
  2382. },
  2383. buffer: 100,
  2384. }
  2385. });
  2386. this.superclass.superclass.initComponent.apply(this, arguments);
  2387. },
  2388. restoreState: function () {
  2389. var _this = this;
  2390. native.loadFile(this.getStateFilename(), function (content) {
  2391. if (!content)
  2392. return;
  2393. var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  2394. _this._saveStateFlag = false;
  2395. if (_.isArray(expands)) {
  2396. _.forEach(expands, function (p) {
  2397. _this.expandPath(p);
  2398. });
  2399. }
  2400. if (_.isArray(selections) && selections[0]) {
  2401. try {
  2402. _this.selectPath(selections[0]);
  2403. }
  2404. catch (e) {
  2405. }
  2406. }
  2407. if (scrollPosition && scrollSize) {
  2408. var size = _this.scrollable.getSize();
  2409. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  2410. try {
  2411. _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  2412. }
  2413. catch (e) {
  2414. }
  2415. }
  2416. }
  2417. setTimeout(function () {
  2418. _this._saveStateFlag = true;
  2419. }, 200);
  2420. });
  2421. },
  2422. saveState: function () {
  2423. if (!this._saveStateFlag) {
  2424. return;
  2425. }
  2426. if (this._filterText) {
  2427. // 有筛选,不保存展开状态
  2428. return;
  2429. }
  2430. var expands = [];
  2431. var selections = [];
  2432. var selection = this.getSelection();
  2433. _.forEach(selection, function (item) {
  2434. selections.push(item.getPath());
  2435. });
  2436. var data = this.getStore().data;
  2437. _.forEach(data.items, function (item) {
  2438. if (item.data.expanded === true) {
  2439. expands.push(item.getPath());
  2440. }
  2441. });
  2442. var scrollPosition = this.scrollable.position;
  2443. var scrollSize = this.scrollable.getSize();
  2444. native.saveFile(this.getStateFilename(), {
  2445. selections: selections,
  2446. expands: expands,
  2447. scrollPosition: scrollPosition,
  2448. scrollSize: scrollSize
  2449. });
  2450. },
  2451. filterByText: function (text) {
  2452. this._filterText = text;
  2453. this._filterBy(this, text, 'text');
  2454. },
  2455. _filterBy: _.debounce(function (me, text, by) {
  2456. var view = me.getView();
  2457. me.store.clearFilter();
  2458. if (!me._filterText) {
  2459. // 没有筛选内容,还原状态
  2460. var selections = me.getSelection();
  2461. var selectionPaths_1 = [];
  2462. _.forEach(me.getSelection(), function (item) {
  2463. selectionPaths_1.push(item.getPath());
  2464. });
  2465. me.collapseAll();
  2466. me.restoreState();
  2467. _.forEach(selectionPaths_1, function (path) {
  2468. me.expandPath(path);
  2469. });
  2470. me.setSelection(selections);
  2471. return;
  2472. }
  2473. // 递归查找所有需要可见的节点 id 数组
  2474. var nodesAndParents = [];
  2475. var expandPaths = [];
  2476. me.getRootNode().cascadeBy(function (tree, view) {
  2477. var currNode = this;
  2478. currNode.collapse();
  2479. if (currNode && currNode.data[by] &&
  2480. currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
  2481. // 展开到匹配的路径
  2482. // me.expandPath(currNode.getPath());
  2483. expandPaths.push(currNode.getPath());
  2484. // 沿途父节点全部设定为可见
  2485. while (currNode.parentNode) {
  2486. nodesAndParents.push(currNode.id);
  2487. currNode = currNode.parentNode;
  2488. }
  2489. }
  2490. }, null, [me, view]);
  2491. me.store.filterBy(function (r) {
  2492. return Ext.Array.contains(nodesAndParents, r.get('id'));
  2493. });
  2494. _.forEach(expandPaths, function (path) {
  2495. me.expandPath(path);
  2496. });
  2497. }, 1000),
  2498. });
  2499. }
  2500. function initDashboard () {
  2501. Ext.define('com.yvan.studio.Dashboard', {
  2502. extend: 'Ext.panel.Panel',
  2503. alias: 'widget.dashboard',
  2504. xtype: 'dashboard',
  2505. html: ''
  2506. });
  2507. }
  2508. var handles$1 = {
  2509. mainWindow: undefined,
  2510. fileTree: undefined,
  2511. dbTree: undefined,
  2512. viewoutlinetree: undefined,
  2513. statusbar: undefined,
  2514. dictTree: undefined,
  2515. property: undefined,
  2516. dbcode: undefined,
  2517. report: undefined,
  2518. widget: undefined,
  2519. whLayout: undefined,
  2520. };
  2521. window['handles'] = handles$1;
  2522. function setDictTree(value) {
  2523. handles$1.dictTree = value;
  2524. }
  2525. function setMainWindow(value) {
  2526. handles$1.mainWindow = value;
  2527. }
  2528. function setReport(value) {
  2529. handles$1.report = value;
  2530. }
  2531. function setStatusbar(statusbar) {
  2532. handles$1.statusbar = statusbar;
  2533. }
  2534. function setFileTree(value) {
  2535. handles$1.fileTree = value;
  2536. }
  2537. function setDbTree(value) {
  2538. handles$1.dbTree = value;
  2539. }
  2540. function setWidget(value) {
  2541. handles$1.widget = value;
  2542. }
  2543. function setWhLayout(value) {
  2544. handles$1.whLayout = value;
  2545. }
  2546. function setViewoutlinetree(value) {
  2547. handles$1.viewoutlinetree = value;
  2548. }
  2549. function setPropertyPanel(value) {
  2550. handles$1.property = value;
  2551. }
  2552. function setDbCode(value) {
  2553. handles$1.dbcode = value;
  2554. }
  2555. /**
  2556. * 调用方法
  2557. */
  2558. function invokeMethod(fn, sender, args) {
  2559. if (typeof fn === 'function') {
  2560. fn.apply.apply(fn, __spread([sender], args));
  2561. }
  2562. }
  2563. /**
  2564. * 判断事件是否为有效的输入字符
  2565. * @param e
  2566. */
  2567. function isChartEvent(e) {
  2568. if (e.key === 'Shift' ||
  2569. e.key === 'Control' ||
  2570. e.key === 'Alt' ||
  2571. e.key === 'Escape' ||
  2572. e.key === 'ArrowRight' ||
  2573. e.key === 'Tab' ||
  2574. e.key === 'ArrowLeft') {
  2575. return false;
  2576. }
  2577. if (e.keyCode >= 48 && e.keyCode <= 57) {
  2578. // 0-9
  2579. return true;
  2580. }
  2581. if (e.keyCode >= 65 && e.keyCode <= 90) {
  2582. // a-z
  2583. return true;
  2584. }
  2585. if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
  2586. // 小键盘 0-9
  2587. return true;
  2588. }
  2589. return false;
  2590. }
  2591. if (!window["time_offset"]) {
  2592. window["time_offset"] = 0;
  2593. }
  2594. function syncDate(date) {
  2595. if (date && date.setTime && date.getTime) {
  2596. date.setTime(date.getTime() + window["time_offset"]);
  2597. }
  2598. return date;
  2599. }
  2600. function isDesignMode(control, config) {
  2601. var _a, _b;
  2602. if (window["IS_DESIGN_MODE"]) {
  2603. return true;
  2604. }
  2605. if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
  2606. return true;
  2607. }
  2608. if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
  2609. return true;
  2610. }
  2611. if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
  2612. return true;
  2613. }
  2614. if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
  2615. return true;
  2616. }
  2617. return false;
  2618. }
  2619. function toString(value) {
  2620. if (typeof value === 'undefined' || value === null) {
  2621. return "";
  2622. }
  2623. if (typeof value === 'number' && isNaN(value)) {
  2624. return "";
  2625. }
  2626. if (value == 'N/A') {
  2627. return "";
  2628. }
  2629. return ("" + value);
  2630. }
  2631. function isEmpty(value) {
  2632. if (typeof value === 'undefined' || value === null) {
  2633. return true;
  2634. }
  2635. if (typeof value === 'number' && isNaN(value)) {
  2636. return true;
  2637. }
  2638. if (value == 'N/A') {
  2639. return true;
  2640. }
  2641. return ("" + value).trim().length <= 0;
  2642. }
  2643. function createUUID() {
  2644. //@ts-ignore
  2645. return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
  2646. return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
  2647. });
  2648. }
  2649. function getRegList() {
  2650. var regList = _$2.get(window, 'yvanLib.regList');
  2651. if (!regList) {
  2652. regList = [];
  2653. _$2.set(window, 'yvanLib.regList', regList);
  2654. }
  2655. return regList;
  2656. }
  2657. function getRegParamList(methodName) {
  2658. var regParamList = _$2.get(window, 'yvanLib.regParamList');
  2659. if (!regParamList) {
  2660. regParamList = {};
  2661. _$2.set(window, 'yvanLib.regParamList', regParamList);
  2662. }
  2663. if (!_$2.has(regParamList, methodName)) {
  2664. regParamList[methodName] = [];
  2665. }
  2666. return regParamList[methodName];
  2667. }
  2668. /**
  2669. * 模拟点击按钮
  2670. */
  2671. function raiseClick(buttonHandle) {
  2672. if (!buttonHandle) {
  2673. return false;
  2674. }
  2675. if (buttonHandle.disabled) {
  2676. // 按钮是禁止状态
  2677. return false;
  2678. }
  2679. if (buttonHandle.hidden) {
  2680. // 按钮是隐藏状态
  2681. return false;
  2682. }
  2683. // 按钮点击
  2684. buttonHandle.click();
  2685. return true;
  2686. }
  2687. /**
  2688. * 标注系统全局函数的参数
  2689. * @param title 函数名称
  2690. * @param type 函数类型
  2691. * @param allowEmpty 可否为空
  2692. */
  2693. function LibParam(title, type, allowEmpty) {
  2694. if (allowEmpty === void 0) { allowEmpty = false; }
  2695. return function (target, methodName, paramsIndex) {
  2696. var systemFnArgs = getRegParamList(methodName);
  2697. systemFnArgs[paramsIndex] = {
  2698. type: type,
  2699. title: title,
  2700. name: methodName,
  2701. allowEmpty: allowEmpty,
  2702. };
  2703. };
  2704. }
  2705. /**
  2706. * 标注函数变成"系统全局函数"
  2707. */
  2708. function Lib(registe) {
  2709. return function (target, propertyKey, descriptor) {
  2710. var libList = getRegList();
  2711. libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
  2712. if (registe.type === 'system') {
  2713. _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
  2714. }
  2715. else if (registe.type === 'format') {
  2716. _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
  2717. }
  2718. return target;
  2719. };
  2720. }
  2721. /**
  2722. * 解析事件
  2723. * 'scope.私有方法名'
  2724. * 'system.系统函数名'
  2725. * 'format.格式化名'
  2726. */
  2727. function lookupFn(scope, event, errorWho) {
  2728. if (isDesignMode(scope, undefined)) {
  2729. return Ext.emptyFn;
  2730. }
  2731. if (!_$2.startsWith(event, 'scope.') &&
  2732. !_$2.startsWith(event, 'system.') &&
  2733. !_$2.startsWith(event, 'format.')) {
  2734. console.error('无法识别的事件响应类型', event);
  2735. throw new TypeError('无法识别的事件响应类型');
  2736. }
  2737. // 为 eval 准备环境
  2738. var _a = window['yvanLib'], system = _a.system, format = _a.format;
  2739. var data = scope.viewModel.data;
  2740. var keys = [];
  2741. var values = [];
  2742. _$2.forOwn(data, function (value, key) {
  2743. var idxKey = key.indexOf('//');
  2744. if (idxKey >= 0) {
  2745. keys.push(key.substr(0, idxKey));
  2746. }
  2747. else {
  2748. keys.push(key);
  2749. }
  2750. values.push(value);
  2751. });
  2752. var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
  2753. var funcResult = func.apply(void 0, __spread([scope, system, format], values));
  2754. if (typeof funcResult !== 'function') {
  2755. console.error('无法识别的事件响应类型', event, func, errorWho);
  2756. throw new TypeError('无法识别的事件响应类型');
  2757. }
  2758. return funcResult;
  2759. }
  2760. /**
  2761. * 从 ext.element 获取 scope 对象
  2762. */
  2763. function lookupScope(extHandle) {
  2764. if (!extHandle) {
  2765. // @ts-ignore
  2766. return;
  2767. }
  2768. if (extHandle.isScope) {
  2769. return extHandle;
  2770. }
  2771. if (extHandle.column) {
  2772. // 列上的组件
  2773. return extHandle.column.lookupReferenceHolder().yvanScope;
  2774. }
  2775. if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
  2776. if (typeof extHandle.lookupViewModel === 'function') {
  2777. var vm = extHandle.lookupViewModel();
  2778. return vm.yvanScope;
  2779. }
  2780. return;
  2781. }
  2782. /**
  2783. * 全局 ajax 方法
  2784. */
  2785. var ajax = {};
  2786. /**
  2787. * 计算拼音的函数
  2788. */
  2789. var pinyinFunc = function (str) { return (str); };
  2790. exports.scopeOnLoad = null;
  2791. exports.apiConvert = undefined;
  2792. var baseConfigProcessList = [];
  2793. /**
  2794. * 在基类添加 Config 的处理方法
  2795. */
  2796. function baseConfigProcess(option) {
  2797. return function (target, propertyKey) {
  2798. baseConfigProcessList.push(target[propertyKey]);
  2799. };
  2800. }
  2801. // let designMode: boolean = false
  2802. //
  2803. // export function isDesignMode(): boolean {
  2804. // return designMode
  2805. // }
  2806. //
  2807. // export function setDesignMode(v: boolean) {
  2808. // designMode = v
  2809. // }
  2810. /**
  2811. * 将业务定义的 url 转换为调用服务端 groovy 的 url
  2812. */
  2813. function serverInvokeUrlTransform(url, option) {
  2814. return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
  2815. }
  2816. /**
  2817. * 将业务定义的 url 转换为调用服务端 sql 的 Url
  2818. */
  2819. function sqlUrlTransform(url) {
  2820. return _$2.get(window, '_YvanUI_sqlPrefix')(url);
  2821. }
  2822. /**
  2823. * YvanUI 全局扩展配置
  2824. */
  2825. function extend(option) {
  2826. if (option.ajax) {
  2827. ajax.func = option.ajax;
  2828. }
  2829. if (option.serverInvokeUrlTransform) {
  2830. _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
  2831. }
  2832. if (option.sqlUrlTransform) {
  2833. _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
  2834. }
  2835. if (option.pinyinFunction) {
  2836. pinyinFunc = option.pinyinFunction;
  2837. }
  2838. if (option.scopeOnLoad) {
  2839. exports.scopeOnLoad = option.scopeOnLoad;
  2840. }
  2841. if (option.scopeOnCreate) {
  2842. exports.scopeOnCreate = option.scopeOnCreate;
  2843. }
  2844. if (option.apiConvert) {
  2845. exports.apiConvert = option.apiConvert;
  2846. }
  2847. // if (typeof option.designMode !== 'undefined') {
  2848. // setDesignMode(option.designMode)
  2849. // }
  2850. }
  2851. function getApiConvert() {
  2852. return exports.apiConvert;
  2853. }
  2854. function getScopeOnCreate() {
  2855. return exports.scopeOnCreate;
  2856. }
  2857. function getPinyin(v) {
  2858. return pinyinFunc(v);
  2859. }
  2860. /**
  2861. * 适用于 Select / Tree 等,作筛选的通用方法.
  2862. * 1.首字母模糊匹配(不区分大小写)
  2863. * 2.标识的模糊匹配(不区分大小写)
  2864. * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
  2865. */
  2866. function keywordFilter(keyword, label, value) {
  2867. if (!keyword) {
  2868. return true;
  2869. }
  2870. var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
  2871. // const labelPy = _.toLower(getPinyin(label))
  2872. //@ts-ignore
  2873. var labelPy = _$2.toLower(getFirstPinyin2(label));
  2874. value = _$2.toLower(_$2.trim(value));
  2875. var found = 0;
  2876. _$2.some(ws, function (word) {
  2877. if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
  2878. found++;
  2879. return;
  2880. }
  2881. if (value && value.indexOf(word.toLowerCase()) >= 0) {
  2882. found++;
  2883. return;
  2884. }
  2885. });
  2886. return found >= ws.length;
  2887. }
  2888. var idPrefix = "_ds_";
  2889. var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
  2890. var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
  2891. var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
  2892. var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
  2893. var layoutOrXtypeNameMap = {
  2894. fit: 'fit布局',
  2895. border: 'border布局',
  2896. center: '中部',
  2897. north: '上部',
  2898. south: '下部',
  2899. west: '左部',
  2900. east: '右部',
  2901. yvgrid: '表格',
  2902. tree: '树',
  2903. tabpanel: '标签页',
  2904. form: '表单',
  2905. fieldset: '字段组',
  2906. tbar: '顶部工具栏',
  2907. fbar: '底部工具栏',
  2908. toolbar: '工具栏',
  2909. cols: '列容器',
  2910. rows: '行容器',
  2911. textfield: '文本框',
  2912. textareafield: '长文本框',
  2913. numberfield: '数字框',
  2914. label: "文本",
  2915. combo: "下拉框",
  2916. combobox: "下拉框",
  2917. combotree: "下拉树",
  2918. combogrid: "下拉表",
  2919. datefield: "日期框",
  2920. searchfield: "搜索框",
  2921. button: "按钮",
  2922. checkbox: "勾选",
  2923. checkboxgroup: "勾选组",
  2924. radio: "点选",
  2925. radiogroup: "点选组",
  2926. container: "占位"
  2927. };
  2928. /**
  2929. * 从 VJSON 中找到 rows/cols 的数组
  2930. */
  2931. function findArrayContainer(vjson, id) {
  2932. var parentVJson = getSuperVjson(vjson, id);
  2933. if (_$2.isArray(parentVJson)) {
  2934. return parentVJson;
  2935. }
  2936. if (parentVJson.hasOwnProperty('items')) {
  2937. return parentVJson.items;
  2938. }
  2939. }
  2940. /**
  2941. * 根据id查找上级vjson
  2942. * @param vjson 原始 vjson 视图
  2943. * @param targetId 子元素的id
  2944. */
  2945. function getSuperVjson(vjson, targetId) {
  2946. return deepTravFindSuper(vjson, vjson, targetId);
  2947. }
  2948. /**
  2949. * 根据id查找上级vjson id
  2950. * @param vjson 原始 vjson 视图
  2951. * @param targetId 子元素的id
  2952. */
  2953. function getSuperVjsonId(vjson, targetId) {
  2954. var vj = getSuperVjson(vjson, targetId);
  2955. return vj.id;
  2956. }
  2957. function deepTravFindSuper(superVjson, vjson, targetId) {
  2958. var rObj = null;
  2959. _$2.forOwn(vjson, function (value, key) {
  2960. if (rObj) {
  2961. return;
  2962. }
  2963. if (typeof value !== "object") {
  2964. return;
  2965. }
  2966. if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
  2967. if (key !== 'items') {
  2968. return;
  2969. }
  2970. }
  2971. else {
  2972. // 模型、数据、数据源不扫描
  2973. if (key === 'data' ||
  2974. key === 'dataSource' ||
  2975. key === 'suggest' ||
  2976. key === 'options' ||
  2977. key === 'config' ||
  2978. key === 'columns' ||
  2979. key === 'viewModel' ||
  2980. key === 'store') {
  2981. return;
  2982. }
  2983. }
  2984. //事件不扫描
  2985. if (key === "on" && _$2.isObject(value)) {
  2986. return;
  2987. }
  2988. if (key.startsWith("on") && _$2.size(key) > 2) {
  2989. return;
  2990. }
  2991. if (value.id === targetId) {
  2992. if (_$2.isArray(vjson)) {
  2993. rObj = superVjson;
  2994. }
  2995. else {
  2996. rObj = vjson;
  2997. }
  2998. return;
  2999. }
  3000. rObj = deepTravFindSuper(vjson, value, targetId);
  3001. });
  3002. return rObj;
  3003. }
  3004. /**
  3005. * 深度遍历 vjson
  3006. * @param vjson 视图JSON
  3007. * @param resolver 分析函数
  3008. * @return 记录 resolver 方法返回 true 时,对象的访问路径
  3009. */
  3010. function deepTravVJson(vjson, resolver, propDeep) {
  3011. if (propDeep === void 0) { propDeep = false; }
  3012. var markerList = [];
  3013. deepTrav1(vjson, resolver, markerList, propDeep);
  3014. return markerList;
  3015. }
  3016. function deepTrav1(obj, resolver, marker, propDeep) {
  3017. if (propDeep === void 0) { propDeep = false; }
  3018. var isMarker = resolver(obj);
  3019. if (marker && isMarker === true) {
  3020. marker.unshift({ id: 0, keyName: '', object: obj });
  3021. }
  3022. _$2.forOwn(obj, function (value, key) {
  3023. if (typeof value !== 'object') {
  3024. return;
  3025. }
  3026. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3027. if (key !== 'items' && key !== 'children') {
  3028. return;
  3029. }
  3030. }
  3031. else {
  3032. // 模型、数据、数据源不扫描
  3033. if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
  3034. return;
  3035. }
  3036. if (!propDeep &&
  3037. (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
  3038. key === 'listeners' || key === 'bind')) {
  3039. return;
  3040. }
  3041. }
  3042. //事件不扫描
  3043. if (key === 'on' && _$2.isObject(value)) {
  3044. return;
  3045. }
  3046. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3047. return;
  3048. }
  3049. var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
  3050. if (marker && isMarkerChild === true) {
  3051. isMarker = true;
  3052. marker.unshift({ id: obj.id, keyName: key, object: value });
  3053. }
  3054. });
  3055. // @ts-ignore 删除作废对象
  3056. _$2.remove(obj, function (v) { return v && v.isFiltered; });
  3057. return isMarker;
  3058. }
  3059. /**
  3060. * 在代码中找到 reference 对应的对象
  3061. */
  3062. function findInCode(code, id) {
  3063. try {
  3064. deepTravVJson(code, function (child) {
  3065. if (child.id === id) {
  3066. throw child;
  3067. }
  3068. });
  3069. return undefined;
  3070. }
  3071. catch (err) {
  3072. return err;
  3073. }
  3074. }
  3075. function replaceVjsonById(vjson, itemVjson, itemId) {
  3076. if (!itemVjson || (!itemVjson.id && !itemId)) {
  3077. msgError('无法定位组件!');
  3078. debugger;
  3079. return;
  3080. }
  3081. var id = itemId || itemVjson.id;
  3082. deepTravVJson(vjson, function (obj) {
  3083. if (obj.id == id) {
  3084. _$2.assign(obj, itemVjson, { id: id });
  3085. }
  3086. });
  3087. }
  3088. function deepTravDeleteVjson(obj, targetId) {
  3089. var isDelete = false;
  3090. _$2.forOwn(obj, function (value, key) {
  3091. if (isDelete) {
  3092. return;
  3093. }
  3094. if (typeof value !== 'object') {
  3095. return;
  3096. }
  3097. if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
  3098. if (key !== 'items') {
  3099. return;
  3100. }
  3101. }
  3102. else {
  3103. // 模型、数据、数据源不扫描
  3104. if (key === 'data' ||
  3105. key === 'dataSource' ||
  3106. key === 'suggest' ||
  3107. key === 'options' ||
  3108. key === 'config' ||
  3109. key === 'columns' ||
  3110. key === 'viewModel' ||
  3111. key === 'store') {
  3112. return;
  3113. }
  3114. }
  3115. //事件不扫描
  3116. if (key === 'on' && _$2.isObject(value)) {
  3117. return;
  3118. }
  3119. if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
  3120. return;
  3121. }
  3122. if (value.id === targetId) {
  3123. isDelete = true;
  3124. /** 如果是数组的元素*/
  3125. if (_$2.isArray(obj)) {
  3126. obj.splice(key, 1);
  3127. }
  3128. else {
  3129. delete obj[key];
  3130. }
  3131. return;
  3132. }
  3133. isDelete = deepTravDeleteVjson(value, targetId);
  3134. });
  3135. return isDelete;
  3136. }
  3137. /**
  3138. * 根据id删除Vjson 会删除因删除元素造成的空对象
  3139. * @param obj 原始 vjson 视图
  3140. * @param targetId 子元素的id
  3141. */
  3142. function deletVjsonById(vjson, targetId) {
  3143. var isDeleted = deepTravDeleteVjson(vjson, targetId);
  3144. // if (_.isArray(obj)) {
  3145. // if (obj.length <= 0) {
  3146. // let T: any = {
  3147. // view: "template",
  3148. // template: "拖动任何组件到此处",
  3149. // role: "placeholder",
  3150. // id: webix.uid()
  3151. // }
  3152. // obj.push(T);
  3153. // }
  3154. // }
  3155. return isDeleted;
  3156. }
  3157. function removeDesignProp(vjson) {
  3158. deepTravVJson(vjson, function (obj) {
  3159. if (obj.hasOwnProperty('id')) {
  3160. delete obj.id;
  3161. }
  3162. if (obj.hasOwnProperty("designMode")) {
  3163. delete obj.designMode;
  3164. }
  3165. });
  3166. if (vjson.hasOwnProperty("cls")) {
  3167. delete vjson.cls;
  3168. }
  3169. if (vjson.hasOwnProperty("viewModel")) {
  3170. delete vjson.viewModel;
  3171. }
  3172. if (vjson.hasOwnProperty("store")) {
  3173. delete vjson.store;
  3174. }
  3175. }
  3176. function getLayoutOutline(vjson) {
  3177. deepTravVJson(vjson, function (obj) {
  3178. if (!Array.isArray(obj)) {
  3179. _$2.forOwn(obj, function (value, key) {
  3180. if (key === 'id' || key === 'region' || key === 'layoutName'
  3181. || key === 'text' || key === 'fieldLabel' || key === 'title'
  3182. || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
  3183. if (key === 'region'
  3184. || (key === 'xtype' && !_$2.has(obj, 'region'))
  3185. || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
  3186. if (!_$2.has(obj, 'layoutName')) {
  3187. obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
  3188. obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
  3189. // console.log(obj.layoutName, obj.layoutNameDesc)
  3190. }
  3191. }
  3192. }
  3193. else {
  3194. if (key === 'items') {
  3195. obj.children = obj[key];
  3196. }
  3197. if (key === 'tbar') {
  3198. var t = obj[key];
  3199. t.layoutName = key;
  3200. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3201. // console.log(t.layoutName, t.layoutNameDesc)
  3202. if (_$2.has(obj, "items")) {
  3203. obj.items.splice(0, 0, t);
  3204. }
  3205. else if (_$2.has(obj, "children")) {
  3206. obj.children.splice(0, 0, t);
  3207. }
  3208. else {
  3209. obj.children = [t];
  3210. }
  3211. }
  3212. if (key === 'fbar') {
  3213. var t = obj[key];
  3214. t.layoutName = key;
  3215. t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
  3216. // console.log(t.layoutName, t.layoutNameDesc)
  3217. if (_$2.has(obj, "items")) {
  3218. obj.items.push(t);
  3219. }
  3220. else if (_$2.has(obj, "children")) {
  3221. obj.children.push(t);
  3222. }
  3223. else {
  3224. obj.children = [t];
  3225. }
  3226. }
  3227. delete obj[key];
  3228. }
  3229. });
  3230. if (!obj.hasOwnProperty("children")) {
  3231. obj.leaf = true;
  3232. }
  3233. if (!obj.hasOwnProperty("expanded")) {
  3234. obj.expanded = true;
  3235. }
  3236. }
  3237. });
  3238. return vjson;
  3239. }
  3240. var Scope = /** @class */ (function () {
  3241. function Scope(args) {
  3242. /**
  3243. * 业务模块的唯一编号
  3244. */
  3245. this.id = _$2.uniqueId('scope_');
  3246. this.IS_DESIGN_MODE = false;
  3247. /**
  3248. * onload 运行完成之后才会设置本标记为 true
  3249. */
  3250. this.isLoadFinish = false;
  3251. this._isLoading = false;
  3252. var model = args.model, vjson = args.vjson, i18n = args.i18n;
  3253. this.model = model;
  3254. if (typeof vjson.layout === 'undefined') {
  3255. // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
  3256. var ret = buildPlus({ model: model, vjson: vjson });
  3257. model = ret.model;
  3258. vjson = ret.vjson;
  3259. }
  3260. this.originalVjson = _$2.cloneDeep(vjson);
  3261. this.vjson = this.originalVjson; // this.buildVjson()
  3262. var WMSTranslate = window["WMSTranslate"];
  3263. if (WMSTranslate) {
  3264. var i18nPath_1 = this.constructor.name;
  3265. if (i18n) {
  3266. WMSTranslate[i18nPath_1] = i18n;
  3267. }
  3268. this.vjson.i18nPath = i18nPath_1;
  3269. deepTravVJson(this.vjson, function (obj) {
  3270. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
  3271. return;
  3272. }
  3273. obj.i18nPath = i18nPath_1;
  3274. });
  3275. }
  3276. var extScope = getScopeOnCreate();
  3277. if (typeof extScope === 'function') {
  3278. extScope({ vjson: vjson, model: model }, this);
  3279. }
  3280. }
  3281. Scope.prototype._addWatch = function (tplExpress, fn) {
  3282. if (!this._watchList) {
  3283. this._watchList = [];
  3284. }
  3285. this._watchList.push({ watch: tplExpress, fn: fn });
  3286. };
  3287. Scope.prototype._applyWatchList = function () {
  3288. var _this = this;
  3289. _$2.forEach(this._watchList, function (item) {
  3290. _this.viewModel.bind(item.watch, item.fn.bind(_this));
  3291. });
  3292. };
  3293. Object.defineProperty(Scope.prototype, "isScope", {
  3294. get: function () {
  3295. return true;
  3296. },
  3297. enumerable: true,
  3298. configurable: true
  3299. });
  3300. /**
  3301. * 产生一个当前模块有效的唯一id
  3302. * @param key 唯一编号
  3303. */
  3304. Scope.prototype.uid = function (key) {
  3305. return this.id + key;
  3306. };
  3307. /**
  3308. * 对话框"保存"成功.
  3309. * 关闭对话框,并响应 success 方法
  3310. * @param data 要傳回的數據(可以為空)
  3311. */
  3312. Scope.prototype.dialogSuccess = function (data) {
  3313. this._handle.fireEvent('success', this, data);
  3314. var sender = this._handle.config.animateTarget;
  3315. var scope = lookupScope(sender);
  3316. if (typeof this['success'] === 'function') {
  3317. this['success'].call(scope, sender, data);
  3318. }
  3319. this.close();
  3320. };
  3321. /**
  3322. * 设置等待状态
  3323. * @param value
  3324. * @param msg
  3325. */
  3326. Scope.prototype.setLoading = function (value) {
  3327. var _a;
  3328. var scope = this;
  3329. this._isLoading = value;
  3330. (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
  3331. };
  3332. Scope.prototype.getLoading = function () {
  3333. return this._isLoading;
  3334. };
  3335. /**
  3336. * 以对话框模式打开当前模块
  3337. * @param sender 发送者(按钮或Scope对象)
  3338. * @param vjsonOption 界面覆盖选项(可以为空)
  3339. * @param dataOption 数据覆盖选项(可以为空)
  3340. */
  3341. Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
  3342. var _a;
  3343. var that = this;
  3344. var vmodel = _$2.defaultsDeep({
  3345. //
  3346. }, dataOption, that.model);
  3347. this.viewModel = new Ext.app.ViewModel(vmodel);
  3348. this.viewModel.yvanScope = this;
  3349. this._applyWatchList();
  3350. this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3351. var config = _$2.defaultsDeep({
  3352. animateTarget: sender,
  3353. viewModel: this.viewModel,
  3354. yvanScope: this,
  3355. referenceHolder: true,
  3356. }, vjsonOption, that.vjson, windows);
  3357. if (config.height === 'unset') {
  3358. delete config.height;
  3359. }
  3360. if (config.width === 'unset') {
  3361. delete config.width;
  3362. }
  3363. // const holder = sender?.lookupReferenceHolder()
  3364. // delete config.constrain
  3365. var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  3366. if (topScope) {
  3367. config.constrain = true;
  3368. this.topScope = topScope;
  3369. }
  3370. var win = new Ext.Window(config);
  3371. // if (holder) {
  3372. // holder.add(win)
  3373. // }
  3374. if (topScope) {
  3375. topScope._handle.add(win);
  3376. }
  3377. win.addListener('beforerender', function (sender) {
  3378. // 记录句柄
  3379. if (sender && !that._handle) {
  3380. that._handle = sender;
  3381. }
  3382. });
  3383. win.addListener('afterrender', function (sender) {
  3384. // 调用onLoad回调
  3385. try {
  3386. that._onLoad();
  3387. }
  3388. catch (e) {
  3389. console.error('errorAt onLoad', e);
  3390. }
  3391. window['cw'] = that;
  3392. });
  3393. win.addListener('destroy', this._destroy.bind(this));
  3394. win.show();
  3395. };
  3396. /**
  3397. * 以标签模式打开当前模块
  3398. * @param vjsonOption 界面覆盖选项(可以为空)
  3399. * @param dataOption 数据覆盖选项(可以为空)
  3400. */
  3401. Scope.prototype.showPage = function (vjsonOption, dataOption) {
  3402. var _this = this;
  3403. var that = this;
  3404. this._vjsonOption = vjsonOption;
  3405. this._dataOption = dataOption;
  3406. var vmodel = _$2.defaultsDeep({
  3407. data: {}
  3408. }, dataOption, that.model);
  3409. this.viewModel = new Ext.app.ViewModel(vmodel);
  3410. this.viewModel.yvanScope = this;
  3411. this._applyWatchList();
  3412. this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3413. // 根级不能设置id
  3414. delete that.vjson.id;
  3415. var config = _$2.defaultsDeep({
  3416. viewModel: this.viewModel,
  3417. yvanScope: this,
  3418. referenceHolder: true,
  3419. }, vjsonOption, that.vjson);
  3420. var tt = Ext.getCmp('TT');
  3421. var handle = tt.addScope(this, config, function (handle) {
  3422. handle.addListener('added', function (sender) {
  3423. // 记录句柄
  3424. if (sender && !that._handle) {
  3425. that._handle = sender;
  3426. }
  3427. });
  3428. handle.addListener('afterrender', function (sender) {
  3429. // 调用onLoad回调
  3430. try {
  3431. that._onLoad();
  3432. }
  3433. catch (e) {
  3434. console.error('errorAt onLoad', e);
  3435. }
  3436. });
  3437. handle.addListener('destroy', _this._destroy.bind(_this));
  3438. });
  3439. return handle;
  3440. };
  3441. /**
  3442. * 直接渲染到元素
  3443. * @param element 渲染目标
  3444. * @param vjsonOption 界面覆盖选项(可以为空)
  3445. * @param dataOption 数据覆盖选项(可以为空)
  3446. */
  3447. Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
  3448. var that = this;
  3449. this._vjsonOption = vjsonOption;
  3450. this._dataOption = dataOption;
  3451. var vmodel = _$2.defaultsDeep({
  3452. data: {}
  3453. }, that.model, dataOption);
  3454. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
  3455. this.viewModel = new Ext.app.ViewModel(vmodel);
  3456. this.viewModel.yvanScope = this;
  3457. this._applyWatchList();
  3458. var config = _$2.defaultsDeep({
  3459. viewModel: this.viewModel,
  3460. yvanScope: this,
  3461. referenceHolder: true,
  3462. renderTo: element,
  3463. listeners: {
  3464. afterrender: function (sender) {
  3465. var _a;
  3466. // 记录句柄
  3467. if (sender && !that._handle) {
  3468. that._handle = sender;
  3469. }
  3470. // 调用onLoad回调
  3471. that._onLoad();
  3472. // 如果vjson中配置了 afterrender ,需要恢复状态
  3473. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3474. },
  3475. },
  3476. }, vjsonOption, that.vjson);
  3477. new Ext.container.Viewport(config);
  3478. };
  3479. Scope.prototype.showDesigner = function (designer, option) {
  3480. var that = this;
  3481. var vmodel = _$2.defaultsDeep({
  3482. data: {
  3483. IS_DESIGN_MODE: true,
  3484. }
  3485. }, that.model);
  3486. this.IS_DESIGN_MODE = true;
  3487. this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
  3488. this.viewModel = new Ext.app.ViewModel(vmodel);
  3489. this.viewModel.yvanScope = this;
  3490. this._applyWatchList();
  3491. var config = _$2.defaultsDeep({
  3492. viewModel: this.viewModel,
  3493. yvanScope: this,
  3494. referenceHolder: true,
  3495. listeners: {
  3496. afterrender: function (sender) {
  3497. var _a;
  3498. // 记录句柄
  3499. if (sender && !that._handle) {
  3500. that._handle = sender;
  3501. }
  3502. // 调用onLoad回调
  3503. that._onLoad();
  3504. // 如果vjson中配置了 afterrender ,需要恢复状态
  3505. invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
  3506. },
  3507. },
  3508. }, that.vjson);
  3509. designer.removeAll(true);
  3510. designer.add(config);
  3511. };
  3512. /**
  3513. * 关闭对话框(或标签页)
  3514. */
  3515. Scope.prototype.close = function () {
  3516. this._handle.close();
  3517. };
  3518. Object.defineProperty(Scope.prototype, "data", {
  3519. /**
  3520. * 获取 viewModel 里包含的数据(只读)
  3521. */
  3522. get: function () {
  3523. return this.viewModel.getData();
  3524. },
  3525. enumerable: true,
  3526. configurable: true
  3527. });
  3528. /**
  3529. * 设置 viewModel 中的数据
  3530. * 可以是 key, value 模式
  3531. * 也可以是 {key:value} 模式
  3532. */
  3533. Scope.prototype.set = function (path, value) {
  3534. return this.viewModel.set(path, value);
  3535. };
  3536. /**
  3537. * 寻找模块内所有的 xtype 对应的对象
  3538. * @param xtypeKey
  3539. */
  3540. Scope.prototype.down = function (xtypeKey) {
  3541. return this._handle.down(xtypeKey);
  3542. };
  3543. Object.defineProperty(Scope.prototype, "refs", {
  3544. /**
  3545. * 获取所有设置过 Reference 名称的组件
  3546. */
  3547. get: function () {
  3548. var _a, _b;
  3549. return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
  3550. },
  3551. enumerable: true,
  3552. configurable: true
  3553. });
  3554. Scope.prototype._destroy = function () {
  3555. var that = this;
  3556. that.onDestroy();
  3557. delete that._watchList;
  3558. delete that._handle;
  3559. this.isLoadFinish = false;
  3560. };
  3561. /**
  3562. * 私有渲染完成后的回调
  3563. */
  3564. Scope.prototype._onLoad = function () {
  3565. var _this = this;
  3566. if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
  3567. exports.scopeOnLoad(this);
  3568. }
  3569. this.onLoad();
  3570. _$2.defer(function () {
  3571. _this.isLoadFinish = true;
  3572. });
  3573. };
  3574. /**
  3575. * 默认 渲染完成之后调用的函数
  3576. */
  3577. Scope.prototype.onLoad = function () {
  3578. };
  3579. /**
  3580. * 组件卸载之后的回调
  3581. */
  3582. Scope.prototype.onDestroy = function () {
  3583. };
  3584. return Scope;
  3585. }());
  3586. /**
  3587. * 观察装饰器,viewModel 属性更改时触发成员方法
  3588. * @param tplExpress tpl表达式,例如 "{form.f1}"
  3589. */
  3590. function watch(tplExpress, deep) {
  3591. if (deep === void 0) { deep = false; }
  3592. return function (target, propertyKey, pd) {
  3593. target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
  3594. return target[propertyKey];
  3595. };
  3596. }
  3597. // 获取vjson的hash值
  3598. function getVjsonHash(str) {
  3599. var hash = 3465217896, i, ch;
  3600. for (i = str.length - 1; i >= 0; i--) {
  3601. ch = str.charCodeAt(i);
  3602. hash ^= ((hash << 5) + ch + (hash >> 2));
  3603. }
  3604. return (hash & 0x7FFFFFFF) + "";
  3605. }
  3606. function buildPlus(_a) {
  3607. var model = _a.model, vjson = _a.vjson;
  3608. var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
  3609. {
  3610. layout: 'border',
  3611. // tbar: vjson.action,
  3612. items: vjson.items,
  3613. },
  3614. ] });
  3615. if (_$2.isArray(vjson.action)) {
  3616. vjsonNew.items[0].tbar = vjson.action;
  3617. }
  3618. return { model: model, vjson: vjsonNew };
  3619. }
  3620. var model = {
  3621. data: {
  3622. leftTabTitle: ''
  3623. }
  3624. };
  3625. var vjson = {
  3626. frame: false,
  3627. layout: 'border',
  3628. width: '100%',
  3629. height: '100%',
  3630. border: false,
  3631. defaults: {
  3632. border: false
  3633. },
  3634. items: [
  3635. {
  3636. region: 'north',
  3637. height: 60,
  3638. cls: 'main-header',
  3639. reference: 'mainTop',
  3640. layout: 'hbox',
  3641. items: [
  3642. {
  3643. html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
  3644. flex: 1,
  3645. border: false
  3646. },
  3647. {
  3648. xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
  3649. menu: [
  3650. {
  3651. text: '通用数据设置', iconCls: 'x-fa fa-cog',
  3652. reference: 'commonSetting'
  3653. },
  3654. {
  3655. text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
  3656. listeners: {
  3657. // click: 'scope.ready_api_click'
  3658. }
  3659. },
  3660. ]
  3661. },
  3662. {
  3663. xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
  3664. cls: 'header-menu',
  3665. menu: [
  3666. { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
  3667. ]
  3668. },
  3669. ]
  3670. },
  3671. {
  3672. region: 'west',
  3673. bind: {
  3674. title: '{leftTabTitle}',
  3675. },
  3676. titleAlign: 'center',
  3677. border: true, split: true, width: 340, collapsible: true,
  3678. reference: 'leftTab',
  3679. xtype: 'tabpanel',
  3680. tabPosition: 'left',
  3681. tabRotation: 0,
  3682. tabBar: {
  3683. border: false
  3684. },
  3685. listeners: {
  3686. tabchange: 'scope.leftTabChange',
  3687. },
  3688. items: [
  3689. { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
  3690. { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
  3691. { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
  3692. // {tooltip: '表单转换', iconCls: 'x-fa fa-exchange',},
  3693. { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
  3694. { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
  3695. { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
  3696. { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
  3697. { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
  3698. { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
  3699. { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
  3700. { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
  3701. { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
  3702. { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
  3703. { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
  3704. { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
  3705. ]
  3706. },
  3707. {
  3708. region: 'east',
  3709. border: true, split: true, width: 340, collapsible: true, collapsed: true,
  3710. title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
  3711. },
  3712. {
  3713. region: 'center',
  3714. split: true, border: true,
  3715. xtype: 'maintab', reference: 'tt', id: 'TT',
  3716. plain: true,
  3717. listeners: {
  3718. restorypage: 'scope.openScope',
  3719. tabchange: 'scope.tabchange'
  3720. },
  3721. items: []
  3722. },
  3723. ],
  3724. };
  3725. /**
  3726. * 获取当前打开的项目资料
  3727. */
  3728. function getCurrentProject() {
  3729. // const value = sessionStorage.getItem('CurrentProject');
  3730. // if (value) {
  3731. // project = JSON.parse(value)
  3732. // if (!project.url) {
  3733. // project = undefined
  3734. // }
  3735. // }
  3736. // return project
  3737. return {
  3738. uuid: '00000000',
  3739. name: '本服项目',
  3740. url: '',
  3741. };
  3742. }
  3743. /**
  3744. * 设置当前打开的项目资料(全局)
  3745. */
  3746. function setCurrentProject(value) {
  3747. sessionStorage.setItem('CurrentProject', JSON.stringify(value));
  3748. }
  3749. // ------------------------------------------------------------------------------------------ types
  3750. /** 订阅消息key类型 */
  3751. var EventType;
  3752. (function (EventType) {
  3753. /** FileTree打开Module */
  3754. EventType["ModuleOpen"] = "ModuleOpen";
  3755. /** ModulePage 创建 */
  3756. EventType["ModulePageCreate"] = "ModulePageCreate";
  3757. /** ModuleItem内容变化 */
  3758. EventType["ModuleItemChange"] = "ModuleItemChange";
  3759. /** ModuleItem的 jsView 内容变化 */
  3760. EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
  3761. /** 设置 vjson */
  3762. EventType["SetVjson"] = "SetVjson";
  3763. /** 更新 vjson */
  3764. EventType["UpdateVjson"] = "UpdateVjson";
  3765. /** 更新 组件vjson */
  3766. EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
  3767. /** Component 选中内容变化 */
  3768. EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
  3769. /** Component 选中内容变化 */
  3770. EventType["ComponentContextmenu"] = "ComponentContextmenu";
  3771. /** Component 删除事件 */
  3772. EventType["ComponentDelete"] = "ComponentDelete";
  3773. /** MainTab 选中改变事件 */
  3774. EventType["MainTabChange"] = "MainTabChange";
  3775. /** ModuleTab 选中改变事件 */
  3776. EventType["ModuleTabChange"] = "ModuleTabChange";
  3777. /** 保存事件 */
  3778. EventType["SaveCall"] = "SaveCall";
  3779. /** 撤销 */
  3780. EventType["Undo"] = "Undo";
  3781. /** 还原 */
  3782. EventType["Redo"] = "Redo";
  3783. /** 剪切 */
  3784. EventType["Cut"] = "Cut";
  3785. /** 复制 */
  3786. EventType["Copy"] = "Copy";
  3787. /** 粘贴 */
  3788. EventType["Paste"] = "Paste";
  3789. /** 全选 */
  3790. EventType["SelectAll"] = "SelectAll";
  3791. /** 读取剪切板 */
  3792. EventType["ClipboardRead"] = "ClipboardRead";
  3793. /** 检查模块更新 */
  3794. EventType["RunCheckModule"] = "RunCheckModule";
  3795. /** 停止检查模块更新 */
  3796. EventType["StopCheckModule"] = "StopCheckModule";
  3797. })(EventType || (EventType = {}));
  3798. // ------------------------------------------------------------------------------------------ impls
  3799. var EventBus = /** @class */ (function () {
  3800. function EventBus() {
  3801. /** 事件数据 */
  3802. this.store = {};
  3803. /** 事件订阅者注册表 */
  3804. this.observeStoreTable = {};
  3805. this.init();
  3806. }
  3807. EventBus.prototype.init = function () {
  3808. var _this = this;
  3809. // 更改store值就会自动publish消息 - 实现
  3810. this.store = new Proxy({}, {
  3811. get: function (target, key) {
  3812. return target[key];
  3813. },
  3814. // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
  3815. set: function (target, key, data) {
  3816. if (noValue(key))
  3817. return false;
  3818. target[key] = data;
  3819. // 消息通知订阅者
  3820. var observerArr = _this.observeStoreTable[key];
  3821. if (noValue(observerArr) || observerArr.length <= 0)
  3822. return true;
  3823. observerArr.forEach(function (handler) {
  3824. //try {
  3825. handler(data, key);
  3826. // } catch (err) {
  3827. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3828. // }
  3829. });
  3830. return true;
  3831. },
  3832. });
  3833. };
  3834. /** 取消注册订阅者 */
  3835. EventBus.prototype.unregisterObserver = function (key, handler) {
  3836. var _this = this;
  3837. var observerArr = this.observeStoreTable[key];
  3838. if (noValue(observerArr) || observerArr.length <= 0)
  3839. return;
  3840. if (noValue(handler)) {
  3841. this.observeStoreTable[key] = [];
  3842. }
  3843. else {
  3844. observerArr.forEach(function (obsHandler, index) {
  3845. if (obsHandler !== handler)
  3846. return;
  3847. _this.observeStoreTable[key].splice(index, 1);
  3848. });
  3849. }
  3850. };
  3851. /** 注册订阅者 */
  3852. EventBus.prototype.registerObserver = function (key, handler) {
  3853. var observerArr = this.observeStoreTable[key];
  3854. if (noValue(observerArr) || observerArr.length <= 0) {
  3855. observerArr = [];
  3856. this.observeStoreTable[key] = observerArr;
  3857. }
  3858. observerArr.push(handler);
  3859. // if (noValue(key)) return;
  3860. // const sourceValue = this.store[key];
  3861. // if (noValue(sourceValue)) return;
  3862. // handler(sourceValue, key);
  3863. };
  3864. /** 获取存储对象,修改这个对象属性即可publish消息 */
  3865. EventBus.prototype.getStore = function () {
  3866. return this.store;
  3867. };
  3868. /**
  3869. * 取消订阅
  3870. * @param key 订阅的消息key
  3871. * @param handler 指定取消的监听函数
  3872. */
  3873. EventBus.prototype.unsubscribe = function (key, handler) {
  3874. var _this = this;
  3875. if (key instanceof Array) {
  3876. key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
  3877. }
  3878. else {
  3879. this.unregisterObserver(key, handler);
  3880. }
  3881. };
  3882. /**
  3883. * 消息订阅
  3884. * @param key 订阅的消息key
  3885. * @param handler 监听函数
  3886. */
  3887. EventBus.prototype.subscribe = function (key, handler) {
  3888. var _this = this;
  3889. var cancelSubscribe = {
  3890. key: key,
  3891. cancel: function () {
  3892. },
  3893. };
  3894. if (key instanceof Array) {
  3895. key.forEach(function (k) { return _this.registerObserver(k, handler); });
  3896. cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
  3897. }
  3898. else {
  3899. this.registerObserver(key, handler);
  3900. cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
  3901. }
  3902. return cancelSubscribe;
  3903. };
  3904. /**
  3905. * 消息订阅(只订阅一次)
  3906. * @param key 订阅的消息key
  3907. * @param handler 监听函数
  3908. */
  3909. EventBus.prototype.subscribeOnce = function (key, handler) {
  3910. var cancelSubscribe = this.subscribe(key, function (data) {
  3911. // try {
  3912. handler(data, key);
  3913. // } catch (err) {
  3914. // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
  3915. // }
  3916. cancelSubscribe.cancel();
  3917. });
  3918. };
  3919. /**
  3920. * 发送消息(触发订阅监听函数)
  3921. * @param key 消息key
  3922. * @param eventData 消息值
  3923. */
  3924. EventBus.prototype.publish = function (key, eventData) {
  3925. var _this = this;
  3926. if (key instanceof Array) {
  3927. key.forEach(function (k) { return _this.store[k] = eventData; });
  3928. }
  3929. else {
  3930. this.store[key] = eventData;
  3931. }
  3932. };
  3933. return EventBus;
  3934. }());
  3935. // ------------------------------------------------------------------------------------------ use
  3936. var eventBus = new EventBus();
  3937. var model$1 = {
  3938. data: {
  3939. dataSync_isStart: false,
  3940. dataSync: {
  3941. skipError: false,
  3942. clearData: false,
  3943. tables: []
  3944. },
  3945. dataSyncResult: {
  3946. jobId: ''
  3947. },
  3948. dataSource1: '',
  3949. dataSource2: '',
  3950. schema1: '',
  3951. schema2: '',
  3952. hasDiff: false,
  3953. }
  3954. };
  3955. var vjson$1 = {
  3956. title: '数据库同步',
  3957. layout: 'fit',
  3958. items: [
  3959. {
  3960. reference: 'wizard1',
  3961. layout: 'card',
  3962. items: [
  3963. {
  3964. reference: 'first',
  3965. layout: 'fit',
  3966. bbar: [
  3967. '->',
  3968. {
  3969. xtype: 'button',
  3970. iconCls: 'x-fa fa-road',
  3971. text: '结构同步 &raquo;',
  3972. bind: {
  3973. disabled: '{!hasDiff}'
  3974. },
  3975. listeners: {
  3976. click: 'scope.structCopyTo',
  3977. }
  3978. },
  3979. {
  3980. xtype: 'button',
  3981. iconCls: 'x-fa fa-files-o',
  3982. text: '数据同步 &raquo;',
  3983. bind: {
  3984. disabled: '{!hasDiff}'
  3985. },
  3986. listeners: {
  3987. click: 'scope.dataCopyTo',
  3988. }
  3989. },
  3990. {
  3991. xtype: 'button',
  3992. iconCls: 'x-fa fa-sort-alpha-desc',
  3993. text: '索引同步 &raquo;',
  3994. bind: {
  3995. disabled: '{!hasDiff}'
  3996. },
  3997. listeners: {
  3998. click: 'scope.indexCopyTo',
  3999. }
  4000. },
  4001. {
  4002. xtype: 'button',
  4003. iconCls: 'x-fa fa-product-hunt',
  4004. text: '存储过程同步 &raquo;',
  4005. bind: {
  4006. disabled: '{!hasDiff}'
  4007. },
  4008. listeners: {
  4009. click: 'scope.procedureCopyTo',
  4010. }
  4011. },
  4012. ],
  4013. items: [
  4014. {
  4015. title: '数据库对比',
  4016. reference: 'grid1',
  4017. xtype: 'yvgrid',
  4018. pagination: false,
  4019. border: false,
  4020. cellTip: true,
  4021. selModel: {
  4022. type: 'checkboxmodel',
  4023. mode: 'MULTI',
  4024. },
  4025. tbar: {
  4026. xtype: 'toolbar',
  4027. items: [
  4028. {
  4029. xtype: 'combo',
  4030. fieldLabel: '源数据库',
  4031. bind: {
  4032. value: '{dataSource1}'
  4033. },
  4034. dataSource: 'scope.getDataBaseName'
  4035. },
  4036. {
  4037. xtype: 'combo',
  4038. fieldLabel: '目标数据库',
  4039. bind: {
  4040. value: '{dataSource2}'
  4041. },
  4042. dataSource: 'scope.getDataBaseName'
  4043. },
  4044. {
  4045. xtype: 'button',
  4046. iconCls: 'x-fa fa-flash',
  4047. text: '对比',
  4048. bind: {
  4049. disabled: '{!dataSource1 || !dataSource2}'
  4050. },
  4051. listeners: {
  4052. click: 'scope.diff',
  4053. }
  4054. },
  4055. {
  4056. xtype: 'button',
  4057. iconCls: 'x-fa fa-cloud-download',
  4058. text: '重新拉取结构(耗时!)',
  4059. bind: {
  4060. disabled: '{!dataSource1 || !dataSource2}'
  4061. },
  4062. listeners: {
  4063. click: 'scope.dbToMeta',
  4064. }
  4065. },
  4066. ]
  4067. },
  4068. columns: [
  4069. {
  4070. dataIndex: 'table_name1',
  4071. header: '源表',
  4072. width: 300,
  4073. },
  4074. {
  4075. dataIndex: 'table_name2',
  4076. header: '目标表',
  4077. width: 300,
  4078. },
  4079. {
  4080. dataIndex: 'diff',
  4081. header: '对比结果',
  4082. width: 100,
  4083. },
  4084. {
  4085. xtype: 'actioncolumn',
  4086. width: 30,
  4087. sortable: false,
  4088. menuDisabled: true,
  4089. items: [
  4090. {
  4091. iconCls: 'x-fa fa-bars',
  4092. text: '打开',
  4093. handler: 'scope.showDetail',
  4094. }
  4095. ]
  4096. },
  4097. {
  4098. dataIndex: 'remark',
  4099. header: '详情',
  4100. width: 200,
  4101. sortable: true,
  4102. },
  4103. ],
  4104. },
  4105. ]
  4106. },
  4107. {
  4108. reference: 'ddl',
  4109. layout: {
  4110. type: 'vbox',
  4111. pack: 'start',
  4112. align: 'stretch'
  4113. },
  4114. items: [
  4115. {
  4116. xtype: 'sqleditor',
  4117. reference: 'ddleditor',
  4118. flex: 1,
  4119. },
  4120. {
  4121. xtype: 'toolbar',
  4122. items: [
  4123. '->',
  4124. {
  4125. xtype: 'button',
  4126. text: '&laquo; 上一步',
  4127. listeners: {
  4128. click: 'scope.back'
  4129. }
  4130. },
  4131. {
  4132. xtype: 'button',
  4133. iconCls: 'x-fa fa-flash',
  4134. text: '执行',
  4135. listeners: {
  4136. click: 'scope.executeDDL'
  4137. }
  4138. },
  4139. ]
  4140. }
  4141. ]
  4142. },
  4143. {
  4144. reference: 'ddl_idx',
  4145. layout: {
  4146. type: 'vbox',
  4147. pack: 'start',
  4148. align: 'stretch'
  4149. },
  4150. items: [
  4151. {
  4152. xtype: 'sqleditor',
  4153. reference: 'ddleditor_idx',
  4154. flex: 1,
  4155. },
  4156. {
  4157. xtype: 'toolbar',
  4158. items: [
  4159. '->',
  4160. {
  4161. xtype: 'button',
  4162. text: '&laquo; 上一步',
  4163. listeners: {
  4164. click: 'scope.back'
  4165. }
  4166. },
  4167. {
  4168. xtype: 'button',
  4169. iconCls: 'x-fa fa-flash',
  4170. text: '执行',
  4171. listeners: {
  4172. click: 'scope.executeDDLIdx'
  4173. }
  4174. },
  4175. ]
  4176. }
  4177. ]
  4178. },
  4179. {
  4180. reference: 'ddl_procedure',
  4181. layout: {
  4182. type: 'vbox',
  4183. pack: 'start',
  4184. align: 'stretch'
  4185. },
  4186. items: [
  4187. {
  4188. xtype: 'sqleditor',
  4189. reference: 'ddleditor_procedure',
  4190. flex: 1,
  4191. },
  4192. {
  4193. xtype: 'toolbar',
  4194. items: [
  4195. '->',
  4196. {
  4197. xtype: 'button',
  4198. text: '&laquo; 上一步',
  4199. listeners: {
  4200. click: 'scope.back'
  4201. }
  4202. },
  4203. {
  4204. xtype: 'button',
  4205. iconCls: 'x-fa fa-flash',
  4206. text: '执行',
  4207. listeners: {
  4208. click: 'scope.executeProcedureSQL'
  4209. }
  4210. },
  4211. ]
  4212. }
  4213. ]
  4214. },
  4215. {
  4216. reference: 'datacopy',
  4217. xtype: 'yvgrid',
  4218. pagination: false,
  4219. tbar: {
  4220. xtype: 'toolbar',
  4221. items: [
  4222. {
  4223. xtype: 'checkbox',
  4224. fieldLabel: '忽略错误',
  4225. bind: {
  4226. value: '{dataSync.skipError}'
  4227. },
  4228. },
  4229. {
  4230. xtype: 'checkbox',
  4231. fieldLabel: '清空数据',
  4232. bind: {
  4233. value: '{dataSync.clearData}'
  4234. },
  4235. },
  4236. {
  4237. xtype: 'button',
  4238. iconCls: 'x-fa fa-play-circle',
  4239. text: '开始',
  4240. bind: {
  4241. disabled: '{dataSync_isStart}'
  4242. },
  4243. listeners: { click: 'scope.dataSync_start' }
  4244. },
  4245. {
  4246. xtype: 'button',
  4247. iconCls: 'x-fa fa-stop-circle',
  4248. text: '停止',
  4249. bind: {
  4250. disabled: '{!dataSync_isStart}'
  4251. },
  4252. listeners: { click: 'scope.dataSync_stop' }
  4253. },
  4254. ]
  4255. },
  4256. columns: [
  4257. {
  4258. dataIndex: 'tableName', header: '表名',
  4259. width: 300,
  4260. },
  4261. {
  4262. dataIndex: 'dataCount', header: '总记录数',
  4263. width: 150,
  4264. },
  4265. {
  4266. dataIndex: 'currentIdx', header: '当前记录数',
  4267. width: 150,
  4268. },
  4269. {
  4270. dataIndex: 'syncCount', header: '同步数',
  4271. width: 150,
  4272. },
  4273. {
  4274. dataIndex: 'deleteCount', header: '删除',
  4275. width: 150,
  4276. },
  4277. {
  4278. dataIndex: 'syncProgress', header: '进度',
  4279. width: 150, dataType: 'int', formatter: 'percentRenderer'
  4280. },
  4281. ]
  4282. }
  4283. ]
  4284. }
  4285. ]
  4286. };
  4287. var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
  4288. function createEmptyModule(path, filename) {
  4289. return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
  4290. }
  4291. function createFolder(parentPath, filename) {
  4292. return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
  4293. }
  4294. function getModuleFileContent(module) {
  4295. return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
  4296. }
  4297. function saveFile(fileFullPath, fileContent) {
  4298. return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4299. // @ts-ignore
  4300. system.msg("保存成功");
  4301. return res;
  4302. });
  4303. }
  4304. function getQueryDslInfo(tableName) {
  4305. return request.post(getBaseUrl() + "@getQueryDslInfo", {
  4306. args: [
  4307. { tableName: tableName }
  4308. ]
  4309. }).catch(function (e) {
  4310. var _a, _b;
  4311. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
  4312. showErrorDialog(msg);
  4313. console.error(msg, e);
  4314. });
  4315. }
  4316. function invokeServer(url, param) {
  4317. url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
  4318. return request.post(url, {
  4319. args: [
  4320. param
  4321. ]
  4322. }).catch(function (e) {
  4323. var _a, _b;
  4324. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
  4325. showErrorDialog(msg);
  4326. console.error(msg, e);
  4327. });
  4328. }
  4329. function parseSqlApi(sql) {
  4330. return request.post(getBaseUrl() + "@parseSqlApi", {
  4331. args: [sql]
  4332. }).catch(function (e) {
  4333. var _a, _b;
  4334. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
  4335. showErrorDialog(msg);
  4336. console.error(msg, e);
  4337. });
  4338. }
  4339. function saveModuleFiles(param) {
  4340. return request.post(getBaseUrl() + "@saveModuleFiles", {
  4341. args: [
  4342. param
  4343. ]
  4344. }).catch(function (e) {
  4345. var _a, _b;
  4346. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
  4347. showErrorDialog(msg);
  4348. console.error(msg, e);
  4349. });
  4350. }
  4351. function createQueryDSLFile(_a) {
  4352. var schema_name = _a.schema_name, table_name = _a.table_name;
  4353. return request.post(getBaseUrl() + "@createQueryDSLFile", {
  4354. args: [{ schema_name: schema_name, table_name: table_name }]
  4355. }).catch(function (e) {
  4356. var _a, _b;
  4357. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
  4358. showErrorDialog(msg);
  4359. console.error(msg, e);
  4360. });
  4361. }
  4362. function dbToMeta(param) {
  4363. if (typeof param === 'undefined') {
  4364. param = { datasource: 'master' };
  4365. }
  4366. else if (typeof param.datasource === 'undefined') {
  4367. param.datasource = 'master';
  4368. }
  4369. return request.post(getBaseUrl() + "@dbToMeta", {
  4370. args: [
  4371. param
  4372. ]
  4373. }).catch(function (e) {
  4374. var _a, _b;
  4375. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
  4376. showErrorDialog(msg);
  4377. console.error(msg, e);
  4378. });
  4379. }
  4380. function getColumnDomainApi(param) {
  4381. if (typeof param === 'undefined') {
  4382. param = { datasource: 'master' };
  4383. }
  4384. else if (typeof param.datasource === 'undefined') {
  4385. param.datasource = 'master';
  4386. }
  4387. return request.post(getBaseUrl() + "@getColumnDomain", {
  4388. args: [
  4389. param
  4390. ]
  4391. }).catch(function (e) {
  4392. var _a, _b;
  4393. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
  4394. showErrorDialog(msg);
  4395. console.error(msg, e);
  4396. });
  4397. }
  4398. function getMateData(param) {
  4399. if (typeof param === 'undefined') {
  4400. param = { datasource: 'master' };
  4401. }
  4402. else if (typeof param.datasource === 'undefined') {
  4403. param.datasource = 'master';
  4404. }
  4405. return request.post(getBaseUrl() + "@getMateData", {
  4406. args: [
  4407. param
  4408. ]
  4409. }).catch(function (e) {
  4410. var _a, _b;
  4411. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
  4412. showErrorDialog(msg);
  4413. console.error(msg, e);
  4414. });
  4415. }
  4416. function getMateDataByTableName(param) {
  4417. if (typeof param === 'undefined') {
  4418. param = { datasource: 'master' };
  4419. }
  4420. else if (typeof param.datasource === 'undefined') {
  4421. param.datasource = 'master';
  4422. }
  4423. return request.post(getBaseUrl() + "@getMateDataByTableName", {
  4424. args: [
  4425. param
  4426. ]
  4427. }).catch(function (e) {
  4428. var _a, _b;
  4429. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
  4430. showErrorDialog(msg);
  4431. console.error(msg, e);
  4432. });
  4433. }
  4434. function saveMetaTableChanges(param) {
  4435. if (typeof param === 'undefined') {
  4436. param = { datasource: 'master' };
  4437. }
  4438. else if (typeof param.datasource === 'undefined') {
  4439. param.datasource = 'master';
  4440. }
  4441. return request.post(getBaseUrl() + "@saveMetaTableChanges", {
  4442. args: [
  4443. param
  4444. ]
  4445. }).catch(function (e) {
  4446. var _a, _b;
  4447. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
  4448. showErrorDialog(msg);
  4449. console.error(msg, e);
  4450. });
  4451. }
  4452. function getModifyTableDDL(param) {
  4453. if (typeof param === 'undefined') {
  4454. param = { datasource: 'master' };
  4455. }
  4456. else if (typeof param.datasource === 'undefined') {
  4457. param.datasource = 'master';
  4458. }
  4459. return request.post(getBaseUrl() + "@getModifyTableDDL", {
  4460. args: [
  4461. param
  4462. ]
  4463. }).catch(function (e) {
  4464. var _a, _b;
  4465. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
  4466. showErrorDialog(msg);
  4467. console.error(msg, e);
  4468. });
  4469. }
  4470. function pushToDbCommitApi(param) {
  4471. if (typeof param === 'undefined') {
  4472. param = { datasource: 'master' };
  4473. }
  4474. else if (typeof param.datasource === 'undefined') {
  4475. param.datasource = 'master';
  4476. }
  4477. return request.post(getBaseUrl() + "@pushToDbCommit", {
  4478. args: [
  4479. param
  4480. ]
  4481. }).catch(function (e) {
  4482. var _a, _b;
  4483. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
  4484. showErrorDialog(msg);
  4485. console.error(msg, e);
  4486. });
  4487. }
  4488. /**
  4489. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  4490. */
  4491. function saveMetaExBuildDDL(param) {
  4492. if (typeof param === 'undefined') {
  4493. param = { datasource: 'master' };
  4494. }
  4495. else if (typeof param.datasource === 'undefined') {
  4496. param.datasource = 'master';
  4497. }
  4498. return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
  4499. args: [
  4500. param
  4501. ]
  4502. }).catch(function (e) {
  4503. var _a, _b;
  4504. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
  4505. showErrorDialog(msg);
  4506. console.error(msg, e);
  4507. });
  4508. }
  4509. function registerResource(params) {
  4510. return request.post(getBaseUrl() + "@registerResource", {
  4511. args: [params]
  4512. }).catch(function (e) {
  4513. var _a, _b;
  4514. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
  4515. showErrorDialog(msg);
  4516. console.error(msg, e);
  4517. });
  4518. }
  4519. function getMenuTree(params) {
  4520. return request.post(getBaseUrl() + "@getMenuTree", {
  4521. args: [params]
  4522. }).catch(function (e) {
  4523. var _a, _b;
  4524. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4525. showErrorDialog(msg);
  4526. console.error(msg, e);
  4527. });
  4528. }
  4529. function moduleTree() {
  4530. return request.post(getBaseUrl() + "@moduleTree")
  4531. .catch(function (e) {
  4532. var _a, _b;
  4533. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
  4534. showErrorDialog(msg);
  4535. console.error(msg, e);
  4536. });
  4537. }
  4538. function dropTableDDL(schemaName, tableName) {
  4539. return request.post(getBaseUrl() + "@dropTableDDL", {
  4540. args: [
  4541. { schemaName: schemaName, tableName: tableName },
  4542. ]
  4543. }).catch(function (e) {
  4544. var _a, _b;
  4545. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
  4546. showErrorDialog(msg);
  4547. console.error(msg, e);
  4548. });
  4549. }
  4550. function renameTableDDL(schemaName, tableName, reTableName) {
  4551. return request.post(getBaseUrl() + "@renameTableDDL", {
  4552. args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
  4553. }).catch(function (e) {
  4554. var _a, _b;
  4555. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
  4556. showErrorDialog(msg);
  4557. console.error(msg, e);
  4558. });
  4559. }
  4560. function executeModifyProcedureSQL(param) {
  4561. return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
  4562. args: [
  4563. param,
  4564. ]
  4565. }).catch(function (e) {
  4566. var _a, _b;
  4567. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4568. showErrorDialog(msg);
  4569. console.error(msg, e);
  4570. });
  4571. }
  4572. function parseDynamicSqlApi(sql, dataSource) {
  4573. return request.post(getBaseUrl() + "@parseDynamicSql", {
  4574. args: [
  4575. { sql: sql, dataSource: dataSource },
  4576. ]
  4577. }).catch(function (e) {
  4578. var _a, _b;
  4579. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
  4580. showErrorDialog(msg);
  4581. console.error(msg, e);
  4582. });
  4583. }
  4584. function exporerList() {
  4585. return request.post(getBaseUrl() + "@exporerList", {
  4586. args: [{}]
  4587. }).catch(function (e) {
  4588. var _a, _b;
  4589. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4590. showErrorDialog(msg);
  4591. console.error(msg, e);
  4592. });
  4593. }
  4594. function reportListApi() {
  4595. return request.post(getBaseUrl() + "@reportList", {
  4596. args: []
  4597. }).catch(function (e) {
  4598. var _a, _b;
  4599. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
  4600. showErrorDialog(msg);
  4601. console.error(msg, e);
  4602. });
  4603. }
  4604. function reportByIdApi(reportId) {
  4605. return request.post(getBaseUrl() + "@reportById", {
  4606. args: [
  4607. { reportId: reportId },
  4608. ]
  4609. }).catch(function (e) {
  4610. var _a, _b;
  4611. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
  4612. showErrorDialog(msg);
  4613. console.error(msg, e);
  4614. });
  4615. }
  4616. function createReportApi(reportName) {
  4617. return request.post(getBaseUrl() + "@createReport", {
  4618. args: [
  4619. { reportName: reportName },
  4620. ]
  4621. }).catch(function (e) {
  4622. var _a, _b;
  4623. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
  4624. showErrorDialog(msg);
  4625. console.error(msg, e);
  4626. });
  4627. }
  4628. function saveReportApi(param) {
  4629. return request.post(getBaseUrl() + "@saveReport", {
  4630. args: [
  4631. param,
  4632. ]
  4633. }).catch(function (e) {
  4634. var _a, _b;
  4635. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
  4636. showErrorDialog(msg);
  4637. console.error(msg, e);
  4638. });
  4639. }
  4640. function delReportApi(report_id) {
  4641. return request.post(getBaseUrl() + "@delReport", {
  4642. args: [{ report_id: report_id },]
  4643. }).catch(function (e) {
  4644. var _a, _b;
  4645. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
  4646. showErrorDialog(msg);
  4647. console.error(msg, e);
  4648. });
  4649. }
  4650. function getDict(param) {
  4651. if (typeof param === 'undefined') {
  4652. param = { datasource: 'master' };
  4653. }
  4654. else if (typeof param.datasource === 'undefined') {
  4655. param.datasource = 'master';
  4656. }
  4657. return request.post(getBaseUrl() + "@getDict", {
  4658. args: [
  4659. param
  4660. ]
  4661. });
  4662. }
  4663. function saveDictApi(param) {
  4664. if (typeof param === 'undefined') {
  4665. param = { datasource: 'master' };
  4666. }
  4667. else if (typeof param.datasource === 'undefined') {
  4668. param.datasource = 'master';
  4669. }
  4670. return request.post(getBaseUrl() + "@saveDict", {
  4671. args: [
  4672. param
  4673. ]
  4674. }).catch(function (e) {
  4675. var _a, _b;
  4676. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
  4677. showErrorDialog(msg);
  4678. console.error(msg, e);
  4679. });
  4680. }
  4681. function saveDictItemsApi(param) {
  4682. if (typeof param === 'undefined') {
  4683. param = { datasource: 'master' };
  4684. }
  4685. else if (typeof param.datasource === 'undefined') {
  4686. param.datasource = 'master';
  4687. }
  4688. return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
  4689. args: [
  4690. param
  4691. ]
  4692. }).catch(function (e) {
  4693. var _a, _b;
  4694. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
  4695. showErrorDialog(msg);
  4696. console.error(msg, e);
  4697. });
  4698. }
  4699. function createDictEnum(param) {
  4700. return request.post(getBaseUrl() + "@createDictEnum", {
  4701. args: [
  4702. param
  4703. ]
  4704. }).catch(function (e) {
  4705. var _a, _b;
  4706. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
  4707. showErrorDialog(msg);
  4708. console.error(msg, e);
  4709. });
  4710. }
  4711. function loadSqlContentApi(url) {
  4712. return request.post(getBaseUrl() + "@loadSqlContent", {
  4713. args: [
  4714. {
  4715. url: GLOBAL_NAMESPACE_PREFIX + url,
  4716. }
  4717. ]
  4718. }).catch(function (e) {
  4719. var _a, _b;
  4720. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
  4721. showErrorDialog(msg);
  4722. console.error(msg, e);
  4723. });
  4724. }
  4725. function saveSqlContentApi(url, content) {
  4726. return request.post(getBaseUrl() + "@saveSqlContent", {
  4727. args: [
  4728. {
  4729. url: GLOBAL_NAMESPACE_PREFIX + url,
  4730. content: content,
  4731. }
  4732. ]
  4733. }).catch(function (e) {
  4734. var _a, _b;
  4735. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
  4736. showErrorDialog(msg);
  4737. console.error(msg, e);
  4738. });
  4739. }
  4740. function readBpmn(param) {
  4741. return request.post(getBaseUrl() + "@readBpmn", {
  4742. args: [param]
  4743. }).catch(function (e) {
  4744. var _a, _b;
  4745. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4746. showErrorDialog(msg);
  4747. console.error(msg, e);
  4748. });
  4749. }
  4750. function createBpmn(path, filename) {
  4751. return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4752. var _a, _b;
  4753. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
  4754. showErrorDialog(msg);
  4755. console.error(msg, e);
  4756. });
  4757. }
  4758. function saveBpmn(fileFullPath, fileContent) {
  4759. return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
  4760. // @ts-ignore
  4761. system.msg("保存成功");
  4762. return res;
  4763. });
  4764. }
  4765. function deleteBpmn(path, filename) {
  4766. return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
  4767. var _a, _b;
  4768. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
  4769. showErrorDialog(msg);
  4770. console.error(msg, e);
  4771. });
  4772. }
  4773. function createDevForm(param) {
  4774. return request.post(getBaseUrl() + "@createDevForm", {
  4775. args: [param]
  4776. }).catch(function (e) {
  4777. var _a, _b;
  4778. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4779. showErrorDialog(msg);
  4780. console.error(msg, e);
  4781. });
  4782. }
  4783. function readDevForm(param) {
  4784. return request.post(getBaseUrl() + "@readDevForm", {
  4785. args: [param]
  4786. }).catch(function (e) {
  4787. var _a, _b;
  4788. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
  4789. showErrorDialog(msg);
  4790. console.error(msg, e);
  4791. });
  4792. }
  4793. function calcColumnForm(param) {
  4794. return request.post(getBaseUrl() + "@calcColumnForm", {
  4795. args: [param]
  4796. }).catch(function (e) {
  4797. var _a, _b;
  4798. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
  4799. showErrorDialog(msg);
  4800. console.error(msg, e);
  4801. });
  4802. }
  4803. function widgetListApi(param) {
  4804. return request.post(getBaseUrl() + "@widgetListApi", {
  4805. args: [param]
  4806. }).catch(function (e) {
  4807. var _a, _b;
  4808. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
  4809. showErrorDialog(msg);
  4810. console.error(msg, e);
  4811. });
  4812. }
  4813. function readWidget(param) {
  4814. return request.post(getBaseUrl() + "@readWidget", {
  4815. args: [param]
  4816. }).catch(function (e) {
  4817. var _a, _b;
  4818. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4819. showErrorDialog(msg);
  4820. console.error(msg, e);
  4821. });
  4822. }
  4823. function saveWidget(param) {
  4824. return request.post(getBaseUrl() + "@saveWidget", {
  4825. args: [param]
  4826. }).catch(function (e) {
  4827. var _a, _b;
  4828. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
  4829. showErrorDialog(msg);
  4830. console.error(msg, e);
  4831. });
  4832. }
  4833. function deleteWidget(param) {
  4834. return request.post(getBaseUrl() + "@deleteWidget", {
  4835. args: [param]
  4836. }).catch(function (e) {
  4837. var _a, _b;
  4838. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
  4839. showErrorDialog(msg);
  4840. console.error(msg, e);
  4841. });
  4842. }
  4843. function getDataBaseNameApi() {
  4844. return request.post(getBaseUrl() + "@getDataBaseName", {
  4845. args: []
  4846. }).catch(function (e) {
  4847. var _a, _b;
  4848. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
  4849. showErrorDialog(msg);
  4850. console.error(msg, e);
  4851. });
  4852. }
  4853. function getDiffDDLApi(param) {
  4854. return request.post(getBaseUrl() + "@getDiffDDL", {
  4855. args: [
  4856. param
  4857. ]
  4858. }).catch(function (e) {
  4859. var _a, _b;
  4860. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
  4861. showErrorDialog(msg);
  4862. console.error(msg, e);
  4863. });
  4864. }
  4865. function dataSyncApi(param) {
  4866. return request.post(getBaseUrl() + "@dataSync", {
  4867. args: [
  4868. param
  4869. ]
  4870. }).catch(function (e) {
  4871. var _a, _b;
  4872. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
  4873. showErrorDialog(msg);
  4874. console.error(msg, e);
  4875. });
  4876. }
  4877. function dataSyncInfoApi(param) {
  4878. return request.post(getBaseUrl() + "@dataSyncInfo", {
  4879. args: [
  4880. param
  4881. ]
  4882. }).catch(function (e) {
  4883. var _a, _b;
  4884. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
  4885. showErrorDialog(msg);
  4886. console.error(msg, e);
  4887. });
  4888. }
  4889. function saveColumnDomain(param) {
  4890. if (typeof param === 'undefined') {
  4891. param = { datasource: 'master' };
  4892. }
  4893. else if (typeof param.datasource === 'undefined') {
  4894. param.datasource = 'master';
  4895. }
  4896. return request.post(getBaseUrl() + "@saveColumnDomain", {
  4897. args: [
  4898. param
  4899. ]
  4900. }).catch(function (e) {
  4901. var _a, _b;
  4902. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
  4903. showErrorDialog('发生错误:' + msg);
  4904. console.error(msg, e);
  4905. });
  4906. }
  4907. function devOpsList() {
  4908. return request.post(getBaseUrl() + "@devOpsList", {
  4909. args: [{}]
  4910. }).catch(function (e) {
  4911. var _a, _b;
  4912. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
  4913. showErrorDialog('发生错误:' + msg);
  4914. console.error(msg, e);
  4915. });
  4916. }
  4917. function devOpsById(opsId) {
  4918. return request.post(getBaseUrl() + "@devOpsById", {
  4919. args: [{ opsId: opsId }]
  4920. }).catch(function (e) {
  4921. var _a, _b;
  4922. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
  4923. showErrorDialog('发生错误:' + msg);
  4924. console.error(msg, e);
  4925. });
  4926. }
  4927. function metricsRequestApi() {
  4928. return request.get("/api/metrics/request")
  4929. .catch(function (e) {
  4930. var _a, _b;
  4931. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
  4932. showErrorDialog('发生错误:' + msg);
  4933. console.error(msg, e);
  4934. });
  4935. }
  4936. function metricsJdbcApi() {
  4937. return request.get("/api/metrics/jdbc")
  4938. .catch(function (e) {
  4939. var _a, _b;
  4940. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
  4941. showErrorDialog('发生错误:' + msg);
  4942. console.error(msg, e);
  4943. });
  4944. }
  4945. function executeDDL(param) {
  4946. return request.post(getBaseUrl() + "@executeDDL", {
  4947. args: [
  4948. param,
  4949. ]
  4950. }).catch(function (e) {
  4951. var _a, _b;
  4952. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
  4953. showErrorDialog('发生错误:' + msg);
  4954. console.error(msg, e);
  4955. });
  4956. }
  4957. function getModifyIdxDDL(param) {
  4958. return request.post(getBaseUrl() + "@getModifyIdxDDL", {
  4959. args: [
  4960. param,
  4961. ]
  4962. }).catch(function (e) {
  4963. var _a, _b;
  4964. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
  4965. showErrorDialog('发生错误:' + msg);
  4966. console.error(msg, e);
  4967. });
  4968. }
  4969. function getModifyProcedureSQL(param) {
  4970. return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
  4971. args: [
  4972. param,
  4973. ]
  4974. }).catch(function (e) {
  4975. var _a, _b;
  4976. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
  4977. showErrorDialog('发生错误:' + msg);
  4978. console.error(msg, e);
  4979. });
  4980. }
  4981. function saveWhLayout(param) {
  4982. return request.post(getLayoutUrl() + "@saveWhLayout", {
  4983. args: [
  4984. param,
  4985. ]
  4986. }).catch(function (e) {
  4987. var _a, _b;
  4988. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
  4989. showErrorDialog('发生错误:' + msg);
  4990. console.error(msg, e);
  4991. });
  4992. }
  4993. function deleteWhLayout(param) {
  4994. return request.post(getLayoutUrl() + "@deleteWhLayout", {
  4995. args: [
  4996. param,
  4997. ]
  4998. }).catch(function (e) {
  4999. var _a, _b;
  5000. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
  5001. showErrorDialog('发生错误:' + msg);
  5002. console.error(msg, e);
  5003. });
  5004. }
  5005. function loadWhLayoutAll() {
  5006. return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
  5007. args: []
  5008. }).catch(function (e) {
  5009. var _a, _b;
  5010. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
  5011. showErrorDialog('发生错误:' + msg);
  5012. console.error(msg, e);
  5013. });
  5014. }
  5015. function loadWhLayout(param) {
  5016. return request.post(getLayoutUrl() + "@loadWhLayout", {
  5017. args: [
  5018. param,
  5019. ]
  5020. }).catch(function (e) {
  5021. var _a, _b;
  5022. var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
  5023. showErrorDialog('发生错误:' + msg);
  5024. console.error(msg, e);
  5025. });
  5026. }
  5027. var baseUrl = "/api/com/yvan/studio/FileManager";
  5028. var layoutUrl = "/api/com/yvan/studio/LayoutManager";
  5029. function getBaseUrl() {
  5030. // return getCurrentProject().url + baseUrl
  5031. return baseUrl;
  5032. }
  5033. function getLayoutUrl() {
  5034. // return getCurrentProject().url + baseUrl
  5035. return layoutUrl;
  5036. }
  5037. var Request = /** @class */ (function () {
  5038. function Request(axiosInstance) {
  5039. this.axiosInstance = axiosInstance;
  5040. }
  5041. // 全局响应数据转换处理
  5042. Request.transformResponse = function (response) {
  5043. var _a;
  5044. return (_a = response.data) !== null && _a !== void 0 ? _a : null;
  5045. };
  5046. Request.prototype.get = function (url, config) {
  5047. return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
  5048. };
  5049. Request.prototype.delete = function (url, config) {
  5050. return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
  5051. };
  5052. Request.prototype.head = function (url, config) {
  5053. return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
  5054. };
  5055. Request.prototype.options = function (url, config) {
  5056. return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
  5057. };
  5058. Request.prototype.post = function (url, data, config) {
  5059. return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5060. };
  5061. Request.prototype.put = function (url, data, config) {
  5062. return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5063. };
  5064. Request.prototype.patch = function (url, data, config) {
  5065. return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
  5066. };
  5067. Request.prototype.request = function (config) {
  5068. return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
  5069. };
  5070. return Request;
  5071. }());
  5072. /** 创建一个axios实例对象 */
  5073. function axiosCreate(config) {
  5074. return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
  5075. }
  5076. var axiosInstance;
  5077. function init() {
  5078. axiosInstance = axiosCreate({
  5079. validateStatus: function (status) { return (status >= 200 && status < 400); },
  5080. });
  5081. request = new Request(axiosInstance);
  5082. }
  5083. var request;
  5084. /**
  5085. * 对比两个列 是否存在不一致
  5086. */
  5087. function compareColumn(t1, c1, t2, c2) {
  5088. if (typeof c2 === 'undefined') {
  5089. return 'column_name';
  5090. }
  5091. if (c1.column_name !== c2.column_name) {
  5092. return 'column_name';
  5093. }
  5094. if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
  5095. return 'default_value';
  5096. }
  5097. if (toString(c1.column_comment) !== toString(c2.column_comment)) {
  5098. return 'column_comment';
  5099. }
  5100. if (c1.is_primary_key !== c2.is_primary_key) {
  5101. return 'is_primary_key';
  5102. }
  5103. if (c1.not_null !== c2.not_null) {
  5104. return 'not_null';
  5105. }
  5106. var symbol1 = getDataTypeSymbol(t1, c1);
  5107. var symbol2 = getDataTypeSymbol(t2, c2);
  5108. if (symbol1 !== symbol2) {
  5109. console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5110. return 'data_type';
  5111. }
  5112. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5113. else if (!_$2.includes(['char', 'varchar'], symbol1)) {
  5114. // 只关注长度
  5115. if (c1.column_size != c2.column_size) {
  5116. return 'column_size';
  5117. }
  5118. }
  5119. else {
  5120. // 其他情况,长度和精度都要关注
  5121. if (c1.column_size != c2.column_size) {
  5122. return 'column_size';
  5123. }
  5124. if (c1.decimal_digits !== c2.decimal_digits) {
  5125. return 'decimal_digits';
  5126. }
  5127. }
  5128. }
  5129. function compareDomainApply(tableInfo, column, domain, is_fix_size) {
  5130. var symbol1 = getDataTypeSymbol(tableInfo, column);
  5131. var symbol2 = getDataTypeSymbol(tableInfo, domain);
  5132. if (symbol1 !== symbol2) {
  5133. console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
  5134. return 'data_type';
  5135. }
  5136. if (is_fix_size) {
  5137. // 字段域吧大小限制住了
  5138. if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
  5139. else if (_$2.includes(['char', 'varchar'], symbol1)) {
  5140. // 只关注长度
  5141. if (column.column_size != domain.column_size) {
  5142. return 'column_size';
  5143. }
  5144. }
  5145. else {
  5146. // 其他情况,长度和精度都要关注
  5147. if (column.column_size != domain.column_size) {
  5148. return 'column_size';
  5149. }
  5150. if (column.decimal_digits !== domain.decimal_digits) {
  5151. return 'decimal_digits';
  5152. }
  5153. }
  5154. }
  5155. }
  5156. function checkColumn(table, col) {
  5157. if (isEmpty(col.column_name)) {
  5158. return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
  5159. }
  5160. if (isKeyword(col.column_name)) {
  5161. return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
  5162. }
  5163. if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
  5164. return "\u5B57\u6BB5\u540D\u975E\u6CD5";
  5165. }
  5166. return undefined;
  5167. }
  5168. function applyDomain(dbType, domain) {
  5169. var editRow = {
  5170. data_type: domain[dbType + '_datatype'],
  5171. };
  5172. domain = _$2.cloneDeep(domain);
  5173. if (!editRow.data_type) {
  5174. throw Error('字段域没有定义数据类型!');
  5175. }
  5176. // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
  5177. var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
  5178. if (match) {
  5179. // 类型里面包含括号
  5180. var sz = parseInt(match[2]);
  5181. if (isNaN(sz)) {
  5182. throw Error('字段域的定义错误:' + editRow.data_type);
  5183. }
  5184. domain.is_fix_size = true;
  5185. editRow.data_type = match[1];
  5186. domain.column_size = sz;
  5187. domain.decimal_digits = 0;
  5188. }
  5189. else {
  5190. // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
  5191. var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
  5192. if (match2) {
  5193. // 类型里面包含括号
  5194. var sz = parseInt(match2[2]);
  5195. if (isNaN(sz)) {
  5196. throw Error('字段域的定义错误:' + editRow.data_type);
  5197. }
  5198. var dg = parseInt(match2[3]);
  5199. if (isNaN(dg)) {
  5200. throw Error('字段域的定义错误:' + editRow.data_type);
  5201. }
  5202. domain.is_fix_size = true;
  5203. editRow.data_type = match[1];
  5204. domain.column_size = sz;
  5205. domain.decimal_digits = dg;
  5206. }
  5207. }
  5208. if (domain.domain_column_ui) {
  5209. _$2.extend(editRow, {
  5210. column_ui: domain.domain_column_ui,
  5211. });
  5212. }
  5213. if (domain.domain_column_dict) {
  5214. _$2.extend(editRow, {
  5215. column_dict: domain.domain_column_dict,
  5216. });
  5217. }
  5218. if (domain.is_fix_size) {
  5219. _$2.extend(editRow, {
  5220. column_size: domain.column_size,
  5221. decimal_digits: domain.decimal_digits
  5222. });
  5223. }
  5224. if (domain.is_fix_default_value) {
  5225. _$2.extend(editRow, {
  5226. default_value: domain.default_value,
  5227. });
  5228. }
  5229. return editRow;
  5230. }
  5231. /**
  5232. * 获取字段类型代号(用于做跨数据库数据类型对比)
  5233. */
  5234. function getDataTypeSymbol(table, col) {
  5235. if (table.db_type === 'oracle') {
  5236. switch (col.data_type) {
  5237. case 'number':
  5238. if (col.column_size <= 10 && !col.decimal_digits) {
  5239. return 'integer';
  5240. }
  5241. else if (col.column_size <= 19 && !col.decimal_digits) {
  5242. return 'long';
  5243. }
  5244. return 'bigdecimal';
  5245. case 'char':
  5246. if (col.column_size > 3000) {
  5247. return 'clob';
  5248. }
  5249. return 'char';
  5250. case 'integer':
  5251. return 'integer';
  5252. case 'varchar':
  5253. case 'varchar2':
  5254. if (col.column_size > 3000) {
  5255. return 'clob';
  5256. }
  5257. return 'varchar';
  5258. case 'clob':
  5259. return 'clob';
  5260. case 'blob':
  5261. return 'blob';
  5262. case 'date':
  5263. case 'timestamp':
  5264. case 'timestamp(6)':
  5265. case 'timestamp with local time zone':
  5266. case 'timestamp(6) with local time zone':
  5267. case 'timestamp(6) with time zone':
  5268. return 'timestamp';
  5269. }
  5270. return "undefined";
  5271. // throw Error('未知 Oracle 数据类型:' + col.data_type)
  5272. }
  5273. if (table.db_type === 'pgsql') {
  5274. switch (col.data_type) {
  5275. case 'int4':
  5276. return 'integer';
  5277. case 'int8':
  5278. return 'long';
  5279. case 'char':
  5280. return 'char';
  5281. case 'varchar':
  5282. case 'varchar2':
  5283. if (col.column_size > 3000) {
  5284. return 'clob';
  5285. }
  5286. return 'varchar';
  5287. case 'numeric':
  5288. if (col.column_size <= 10 && !col.decimal_digits) {
  5289. return 'integer';
  5290. }
  5291. else if (col.column_size <= 19 && !col.decimal_digits) {
  5292. return 'long';
  5293. }
  5294. return 'bigdecimal';
  5295. case 'timestamp':
  5296. case 'timestamptz':
  5297. return 'timestamp';
  5298. case 'bytea':
  5299. return 'blob';
  5300. }
  5301. return "undefined";
  5302. // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
  5303. }
  5304. throw Error('未知数据库类型:' + table.db_type);
  5305. }
  5306. /**
  5307. * 判断对象名称是不是数据库关键字(保留字)
  5308. */
  5309. function isKeyword(word) {
  5310. if (!word || typeof word !== 'string') {
  5311. return false;
  5312. }
  5313. var kk = ['access',
  5314. 'add',
  5315. 'all',
  5316. 'alter',
  5317. 'and',
  5318. 'any',
  5319. 'as',
  5320. 'asc',
  5321. 'audit',
  5322. 'between',
  5323. 'by',
  5324. 'char',
  5325. 'check',
  5326. 'cluster',
  5327. 'column',
  5328. 'comment',
  5329. 'compress',
  5330. 'connect',
  5331. 'create',
  5332. 'current',
  5333. 'date',
  5334. 'decimal',
  5335. 'default',
  5336. 'delete',
  5337. 'desc',
  5338. 'distinct',
  5339. 'drop',
  5340. 'else',
  5341. 'exclusive',
  5342. 'exists',
  5343. 'file',
  5344. 'float',
  5345. 'for',
  5346. 'from',
  5347. 'grant',
  5348. 'group',
  5349. 'having',
  5350. 'identified',
  5351. 'immediate',
  5352. 'in',
  5353. 'increment',
  5354. 'index',
  5355. 'initial',
  5356. 'insert',
  5357. 'integer',
  5358. 'intersect',
  5359. 'into',
  5360. 'is',
  5361. 'level',
  5362. 'like',
  5363. 'lock',
  5364. 'long',
  5365. 'maxextents',
  5366. 'minus',
  5367. 'mlslabel',
  5368. 'mode',
  5369. 'modify',
  5370. 'noaudit',
  5371. 'nocompress',
  5372. 'not',
  5373. 'nowait',
  5374. 'null',
  5375. 'number',
  5376. 'of',
  5377. 'offline',
  5378. 'on',
  5379. 'online',
  5380. 'option',
  5381. 'or',
  5382. 'order',
  5383. 'p',
  5384. 'ctfree',
  5385. 'prior',
  5386. 'privileges',
  5387. 'public',
  5388. 'raw',
  5389. 'rename',
  5390. 'resource',
  5391. 'revoke',
  5392. 'row',
  5393. 'rowid',
  5394. 'rownum',
  5395. 'rows',
  5396. 'select',
  5397. 'session',
  5398. 'set',
  5399. 'share',
  5400. 'size',
  5401. 'smallint',
  5402. 'start',
  5403. 'successful',
  5404. 'synonym',
  5405. 'sysdate',
  5406. 'table',
  5407. 'then',
  5408. 'to',
  5409. 'trigger',
  5410. 'uid',
  5411. 'union',
  5412. 'unique',
  5413. 'update',
  5414. 'user',
  5415. 'validate',
  5416. 'values',
  5417. 'varchar',
  5418. 'varchar2',
  5419. 'view',
  5420. 'whenever',
  5421. 'where',
  5422. 'with'];
  5423. return _$2.includes(kk, word.toLowerCase());
  5424. }
  5425. var DbSync = /** @class */ (function (_super) {
  5426. __extends(DbSync, _super);
  5427. function DbSync() {
  5428. return _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
  5429. }
  5430. DbSync.prototype.onLoad = function () {
  5431. };
  5432. DbSync.prototype.getDataBaseName = function (sender, _a) {
  5433. var successCallback = _a.successCallback, failCallback = _a.failCallback;
  5434. getDataBaseNameApi().then(function (res) {
  5435. successCallback(res.data.map(function (name) {
  5436. return {
  5437. id: name, text: name
  5438. };
  5439. }));
  5440. });
  5441. };
  5442. DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
  5443. showInfoDialog(record.get('remark'));
  5444. };
  5445. DbSync.prototype.diff = function () {
  5446. var _this = this;
  5447. var promise1 = getMateData({
  5448. datasource: this.viewModel.get('dataSource1')
  5449. });
  5450. var promise2 = getMateData({
  5451. datasource: this.viewModel.get('dataSource2')
  5452. });
  5453. this.viewModel.set('schema1', '');
  5454. this.viewModel.set('schema2', '');
  5455. this.refs.grid1.setLoading(true);
  5456. Promise.all([promise1, promise2]).then(function (_a) {
  5457. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5458. var rows = [];
  5459. if (_$2.size(res1) > 0) {
  5460. // res1 起码有一个 schema
  5461. _this.viewModel.set('schema1', res1[0].schema_name);
  5462. _this.viewModel.set('schema2', res2[0].schema_name);
  5463. if (!_this.viewModel.get('schema1')) {
  5464. msg$1('datasource1 最起码需要一张表');
  5465. return;
  5466. }
  5467. if (!_this.viewModel.get('schema2')) {
  5468. msg$1('datasource2 最起码需要一张表');
  5469. return;
  5470. }
  5471. _$2.forEach(res1[0].table_list, function (table1) {
  5472. var _a;
  5473. 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; });
  5474. if (table1.schema_name) {
  5475. _this.viewModel.set('schema1', table1.schema_name);
  5476. }
  5477. if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
  5478. _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
  5479. }
  5480. var row = {
  5481. table_name1: table1.table_name,
  5482. table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
  5483. table_info: table1
  5484. };
  5485. if (!table2) {
  5486. row.diff = '不一致';
  5487. row.remark = '目标表缺失';
  5488. }
  5489. else if (table1.column_list.length !== table2.column_list.length) {
  5490. row.diff = '不一致';
  5491. row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
  5492. }
  5493. else {
  5494. row.diff = '一致';
  5495. var remark_1 = [];
  5496. _$2.forEach(table1.column_list, function (col1) {
  5497. var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
  5498. if (!col2) {
  5499. row.diff = '不一致';
  5500. remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
  5501. }
  5502. else {
  5503. var colDiff = compareColumn(table1, col1, table2, col2);
  5504. if (colDiff) {
  5505. row.diff = '不一致';
  5506. remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
  5507. }
  5508. }
  5509. });
  5510. row.remark = remark_1.join('\n');
  5511. }
  5512. rows.push(row);
  5513. });
  5514. }
  5515. _this.refs.grid1.setData(rows);
  5516. _this.viewModel.set('hasDiff', true);
  5517. }).finally(function () {
  5518. _this.refs.grid1.setLoading(false);
  5519. });
  5520. };
  5521. DbSync.prototype.structCopyTo = function () {
  5522. var _this = this;
  5523. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5524. msg$1('选择数据源!');
  5525. return;
  5526. }
  5527. var recordList = this.refs.grid1.getSelection();
  5528. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5529. if (_$2.size(tableNameList) <= 0) {
  5530. msg$1('请选择要同步的表');
  5531. return;
  5532. }
  5533. var error = undefined;
  5534. _$2.forEach(tableNameList, function (tableInfo) {
  5535. _$2.forEach(tableInfo.column_list, function (col) {
  5536. error = checkColumn(tableInfo, col);
  5537. return false;
  5538. });
  5539. if (error) {
  5540. return false;
  5541. }
  5542. });
  5543. if (error) {
  5544. msg$1(error);
  5545. return;
  5546. }
  5547. var schema1 = this.viewModel.get('schema1');
  5548. var schema2 = this.viewModel.get('schema2');
  5549. if (!schema1 || !schema2) {
  5550. msg$1('无法识别 schema 名称');
  5551. return;
  5552. }
  5553. this.refs.grid1.setLoading(true);
  5554. getDiffDDLApi({
  5555. datasource1: this.viewModel.get('dataSource1'),
  5556. datasource2: this.viewModel.get('dataSource2'),
  5557. schema1: this.viewModel.get('schema1'),
  5558. schema2: this.viewModel.get('schema2'),
  5559. tables: tableNameList,
  5560. }).then(function (res) {
  5561. if (res.success) {
  5562. _this.refs.ddleditor.setCode(res.data);
  5563. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
  5564. }
  5565. }).finally(function () {
  5566. _this.refs.grid1.setLoading(false);
  5567. });
  5568. };
  5569. DbSync.prototype.indexCopyTo = function () {
  5570. var _this = this;
  5571. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5572. msg$1('选择数据源!');
  5573. return;
  5574. }
  5575. var recordList = this.refs.grid1.getSelection();
  5576. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5577. if (_$2.size(tableNameList) <= 0) {
  5578. msg$1('请选择要同步的表');
  5579. return;
  5580. }
  5581. var schema1 = this.viewModel.get('schema1');
  5582. var schema2 = this.viewModel.get('schema2');
  5583. if (!schema1 || !schema2) {
  5584. msg$1('无法识别 schema 名称');
  5585. return;
  5586. }
  5587. this.refs.grid1.setLoading(true);
  5588. getModifyIdxDDL({
  5589. datasource1: this.viewModel.get('dataSource1'),
  5590. datasource2: this.viewModel.get('dataSource2'),
  5591. schema1: this.viewModel.get('schema1'),
  5592. schema2: this.viewModel.get('schema2'),
  5593. tables: tableNameList,
  5594. }).then(function (res) {
  5595. if (res.success) {
  5596. _this.refs.ddleditor_idx.setCode(res.data);
  5597. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
  5598. }
  5599. }).finally(function () {
  5600. _this.refs.grid1.setLoading(false);
  5601. });
  5602. };
  5603. DbSync.prototype.procedureCopyTo = function () {
  5604. var _this = this;
  5605. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5606. msg$1('选择数据源!');
  5607. return;
  5608. }
  5609. var schema1 = this.viewModel.get('schema1');
  5610. var schema2 = this.viewModel.get('schema2');
  5611. if (!schema1 || !schema2) {
  5612. msg$1('无法识别 schema 名称');
  5613. return;
  5614. }
  5615. this.refs.grid1.setLoading(true);
  5616. getModifyProcedureSQL({
  5617. datasource1: this.viewModel.get('dataSource1'),
  5618. datasource2: this.viewModel.get('dataSource2'),
  5619. schema1: this.viewModel.get('schema1'),
  5620. schema2: this.viewModel.get('schema2'),
  5621. }).then(function (res) {
  5622. if (res.success) {
  5623. _this.refs.ddleditor_procedure.setCode(res.data);
  5624. _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
  5625. _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
  5626. }
  5627. }).finally(function () {
  5628. _this.refs.grid1.setLoading(false);
  5629. });
  5630. };
  5631. DbSync.prototype.dataSync_start = function () {
  5632. var _this = this;
  5633. this.viewModel.set('dataSync_isStart', true);
  5634. var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
  5635. this.refs.datacopy.setLoading(true);
  5636. dataSyncApi(dataSync)
  5637. .then(function (res) {
  5638. mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
  5639. _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
  5640. })
  5641. .finally(function () {
  5642. _this.refs.datacopy.setLoading(false);
  5643. });
  5644. };
  5645. DbSync.prototype.dataSync_process = function () {
  5646. var _this = this;
  5647. var jobId = this.viewModel.get('dataSyncResult.jobId');
  5648. dataSyncInfoApi({ jobId: jobId })
  5649. .then(function (res) {
  5650. if (_$2.isArray(res.tableSyncInfos)) {
  5651. var scrollPosition = _this.refs.datacopy.scrollable.position;
  5652. _this.refs.datacopy.setData(res.tableSyncInfos);
  5653. try {
  5654. _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  5655. }
  5656. catch (e) {
  5657. }
  5658. }
  5659. if (res.endTime) {
  5660. // 已经结束
  5661. var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
  5662. if (res.success) {
  5663. showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5664. }
  5665. else {
  5666. showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
  5667. }
  5668. _this.dataSync_stop();
  5669. }
  5670. })
  5671. .catch(function (e) {
  5672. showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
  5673. console.error(e);
  5674. // this.dataSync_stop()
  5675. })
  5676. .finally(function () {
  5677. _this.refs.datacopy.setLoading(false);
  5678. });
  5679. };
  5680. DbSync.prototype.dataSync_stop = function () {
  5681. this.viewModel.set('dataSync_isStart', false);
  5682. clearInterval(this.dataSyncInterval);
  5683. delete this.dataSyncInterval;
  5684. };
  5685. DbSync.prototype.dataCopyTo = function () {
  5686. if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
  5687. msg$1('选择数据源!');
  5688. return;
  5689. }
  5690. var recordList = this.refs.grid1.getSelection();
  5691. var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
  5692. if (_$2.size(tableNameList) <= 0) {
  5693. msg$1('请选择要同步的表');
  5694. return;
  5695. }
  5696. var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
  5697. this.viewModel.set('dataSync.tables', tableNameList);
  5698. this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
  5699. };
  5700. DbSync.prototype.next = function () {
  5701. this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
  5702. };
  5703. DbSync.prototype.back = function () {
  5704. this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
  5705. };
  5706. DbSync.prototype.dbToMeta = function () {
  5707. var _this = this;
  5708. var dataSource1 = this.viewModel.get('dataSource1');
  5709. var dataSource2 = this.viewModel.get('dataSource2');
  5710. confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
  5711. var promise1 = dbToMeta({ datasource: dataSource1 });
  5712. var promise2 = dbToMeta({ datasource: dataSource2 });
  5713. _this.refs.grid1.setLoading(true);
  5714. Promise.all([promise1, promise2]).then(function (_a) {
  5715. var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
  5716. _this.diff();
  5717. }).catch(function (res) {
  5718. _this.refs.grid1.setLoading(false);
  5719. showErrorDialog$1(res);
  5720. });
  5721. });
  5722. };
  5723. DbSync.prototype.executeDDL = function () {
  5724. var _this = this;
  5725. var code = this.refs.ddleditor.getValue();
  5726. var dataSource2 = this.viewModel.get('dataSource2');
  5727. var target_schema_name = this.viewModel.get('schema2');
  5728. var recordList = this.refs.grid1.getSelection();
  5729. var table_infos = _$2.map(recordList, function (r) {
  5730. return r.get('table_info');
  5731. });
  5732. this.setLoading(true);
  5733. pushToDbCommitApi({
  5734. datasource: dataSource2,
  5735. ddl: code,
  5736. table_infos: table_infos,
  5737. target_schema_name: target_schema_name,
  5738. }).then(function (res) {
  5739. if (res === null || res === void 0 ? void 0 : res.success) {
  5740. msg$1('执行成功');
  5741. _this.back();
  5742. _this.diff();
  5743. return;
  5744. }
  5745. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5746. }).finally(function () {
  5747. _this.setLoading(false);
  5748. });
  5749. };
  5750. DbSync.prototype.executeDDLIdx = function () {
  5751. var _this = this;
  5752. var code = this.refs.ddleditor_idx.getValue();
  5753. var dataSource2 = this.viewModel.get('dataSource2');
  5754. this.setLoading(true);
  5755. executeDDL({
  5756. datasource: dataSource2,
  5757. ddl: code,
  5758. }).then(function (res) {
  5759. if (res === null || res === void 0 ? void 0 : res.success) {
  5760. msg$1('执行成功');
  5761. _this.back();
  5762. return;
  5763. }
  5764. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5765. }).finally(function () {
  5766. _this.setLoading(false);
  5767. });
  5768. };
  5769. DbSync.prototype.executeProcedureSQL = function () {
  5770. var _this = this;
  5771. this.setLoading(true);
  5772. executeModifyProcedureSQL({
  5773. datasource1: this.viewModel.get('dataSource1'),
  5774. datasource2: this.viewModel.get('dataSource2'),
  5775. schema1: this.viewModel.get('schema1'),
  5776. schema2: this.viewModel.get('schema2'),
  5777. }).then(function (res) {
  5778. if (res === null || res === void 0 ? void 0 : res.success) {
  5779. msg$1('执行成功');
  5780. _this.back();
  5781. return;
  5782. }
  5783. showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
  5784. }).finally(function () {
  5785. _this.setLoading(false);
  5786. });
  5787. };
  5788. return DbSync;
  5789. }(Scope));
  5790. var model$2 = {
  5791. data: {}
  5792. };
  5793. var vjson$2 = {
  5794. title: '示例代码',
  5795. layout: 'fit',
  5796. items: [
  5797. {
  5798. layout: 'border',
  5799. items: [
  5800. {
  5801. region: 'north',
  5802. split: true,
  5803. height: 200,
  5804. title: '表格数据',
  5805. reference: 'dataeditor',
  5806. xtype: 'jsoneditor',
  5807. listeners: {
  5808. change: 'scope.dataChanged'
  5809. },
  5810. },
  5811. {
  5812. region: 'west',
  5813. split: true,
  5814. width: 230,
  5815. title: '模板',
  5816. reference: 'tree1',
  5817. xtype: 'treepanel',
  5818. rootVisible: false,
  5819. useArrows: true,
  5820. colspan: 2,
  5821. lines: true,
  5822. multiSelect: false,
  5823. listeners: {
  5824. itemclick: 'scope.templateChange',
  5825. },
  5826. },
  5827. {
  5828. region: 'center',
  5829. title: '参考代码',
  5830. reference: 'preview',
  5831. xtype: 'jsoneditor',
  5832. },
  5833. ]
  5834. }
  5835. ]
  5836. };
  5837. var rootNode = {
  5838. id: 'ROOT',
  5839. type: "ROOT",
  5840. path: "",
  5841. expanded: true,
  5842. leaf: false,
  5843. children: [
  5844. { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
  5845. { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
  5846. { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
  5847. { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
  5848. { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
  5849. { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
  5850. ],
  5851. };
  5852. var TemplateDev = /** @class */ (function (_super) {
  5853. __extends(TemplateDev, _super);
  5854. function TemplateDev() {
  5855. var _this = _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
  5856. _this.dataChanged = _$2.debounce(function () {
  5857. var me = _this;
  5858. if (me.refs.tree1.selection) {
  5859. me.templateChange(me.refs.tree1, me.refs.tree1.selection);
  5860. }
  5861. }, 50);
  5862. return _this;
  5863. }
  5864. TemplateDev.prototype.onDestroy = function () {
  5865. setDbCode(undefined);
  5866. handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
  5867. };
  5868. TemplateDev.prototype.onLoad = function () {
  5869. setDbCode(this);
  5870. handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
  5871. this.refs.tree1.setRootNode(rootNode);
  5872. getColumnDomainApi({}).then(function (_a) {
  5873. var data = _a.data;
  5874. return window['dev_column_domain'] = data;
  5875. });
  5876. };
  5877. TemplateDev.prototype.dbTreeNodeChange = function () {
  5878. var me = handles$1.dbcode;
  5879. var tables = [];
  5880. _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
  5881. var raw = _$2.cloneDeep(r.get('raw'));
  5882. raw.id = r.get('id');
  5883. if (r.get('type') === 'table') {
  5884. tables.push(raw);
  5885. return;
  5886. }
  5887. if (r.get('type') === 'column') {
  5888. var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
  5889. if (!tableInfo) {
  5890. tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
  5891. tables.push(tableInfo);
  5892. }
  5893. if (!tableInfo.column_list) {
  5894. tableInfo.column_list = [raw];
  5895. }
  5896. else {
  5897. tableInfo.column_list.push(raw);
  5898. }
  5899. }
  5900. });
  5901. // 对于没有选择列的表格,默认加上所有列
  5902. _$2.forEach(tables, function (tableInfo) {
  5903. if (typeof tableInfo.column_list === 'undefined') {
  5904. tableInfo.column_list = [];
  5905. handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
  5906. tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
  5907. });
  5908. }
  5909. });
  5910. var code = JSON.stringify(tables, null, ' ');
  5911. me.refs.dataeditor.setCode(code);
  5912. };
  5913. TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
  5914. var url = record.data.url;
  5915. var rd = _$2.uniqueId('db_code_request');
  5916. if (url) {
  5917. var data = void 0;
  5918. try {
  5919. data = JSON.parse(this.refs.dataeditor.getCode());
  5920. }
  5921. catch (e) {
  5922. return;
  5923. }
  5924. // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
  5925. // if (typeof node.default === "function") {
  5926. // const v = toString(node.default(data))
  5927. // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
  5928. // this.refs.preview.setLanguage("plaintext")
  5929. // this.refs.preview.setCode(v)
  5930. // }
  5931. // })
  5932. showErrorDialog$1('没做这里');
  5933. }
  5934. };
  5935. return TemplateDev;
  5936. }(Scope));
  5937. var model$3 = {
  5938. data: {
  5939. hasChanged: false,
  5940. }
  5941. };
  5942. var vjson$3 = {
  5943. bind: {
  5944. title: '字段域{grid1.ischanged?" *":""}',
  5945. },
  5946. layout: 'fit',
  5947. items: [
  5948. {
  5949. layout: 'border',
  5950. items: [
  5951. {
  5952. region: 'center',
  5953. xtype: 'yvgrid',
  5954. selModel: {
  5955. type: 'spreadsheet',
  5956. columnSelect: true,
  5957. pruneRemoved: false,
  5958. extensible: 'y'
  5959. },
  5960. plugins: {
  5961. clipboard: true,
  5962. selectionreplicator: true
  5963. },
  5964. reference: 'grid1',
  5965. pagination: false,
  5966. tbar: {
  5967. xtype: 'toolbar',
  5968. items: [
  5969. {
  5970. xtype: 'button',
  5971. text: '添加',
  5972. iconCls: 'x-fa fa-plus-circle',
  5973. listeners: {
  5974. click: 'scope.addField'
  5975. }
  5976. },
  5977. {
  5978. xtype: 'button',
  5979. text: '删除',
  5980. iconCls: 'x-fa fa-minus-circle',
  5981. listeners: {
  5982. click: 'scope.removeField'
  5983. }
  5984. },
  5985. {
  5986. xtype: 'button',
  5987. text: '保存',
  5988. iconCls: 'x-fa fa-save',
  5989. bind: {
  5990. disabled: '{!grid1.ischanged}'
  5991. },
  5992. listeners: {
  5993. click: 'scope.save'
  5994. }
  5995. },
  5996. ]
  5997. },
  5998. listeners: {
  5999. editfinish: 'scope.gridEditFinish',
  6000. },
  6001. columns: [
  6002. {
  6003. text: '字段域名称', dataIndex: 'domain_name',
  6004. sortable: false,
  6005. menuDisabled: true,
  6006. locked: true,
  6007. editor: {
  6008. selectOnFocus: true
  6009. }
  6010. },
  6011. {
  6012. text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
  6013. sortable: false, menuDisabled: true,
  6014. editor: {
  6015. selectOnFocus: true
  6016. }
  6017. },
  6018. {
  6019. text: 'MySQL类型', dataIndex: 'mysql_datatype',
  6020. sortable: false, menuDisabled: true,
  6021. editor: {
  6022. selectOnFocus: true
  6023. }
  6024. },
  6025. {
  6026. text: 'Oracle类型', dataIndex: 'oracle_datatype',
  6027. sortable: false, menuDisabled: true,
  6028. editor: {
  6029. selectOnFocus: true
  6030. }
  6031. },
  6032. {
  6033. text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
  6034. sortable: false, menuDisabled: true,
  6035. editor: {
  6036. selectOnFocus: true
  6037. }
  6038. },
  6039. {
  6040. text: 'Java类型', dataIndex: 'java_datatype',
  6041. sortable: false, menuDisabled: true,
  6042. editor: {
  6043. selectOnFocus: true
  6044. }
  6045. },
  6046. {
  6047. text: '固定长度', dataIndex: 'is_fix_size',
  6048. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6049. width: 88, resizable: false,
  6050. },
  6051. {
  6052. text: '长度', dataIndex: 'column_size',
  6053. sortable: false, menuDisabled: true, dataType: 'int',
  6054. xtype: 'numbercolumn', format: '0',
  6055. editor: { selectOnFocus: true }
  6056. },
  6057. {
  6058. text: '小数位', dataIndex: 'decimal_digits',
  6059. sortable: false, menuDisabled: true, dataType: 'int',
  6060. xtype: 'numbercolumn', format: '0',
  6061. editor: { selectOnFocus: true }
  6062. },
  6063. {
  6064. text: '字典', dataIndex: 'domain_column_dict',
  6065. sortable: false, menuDisabled: true,
  6066. // fix: ['system.getDict("DICT")'],
  6067. width: 200,
  6068. editor: {
  6069. xtype: 'combo',
  6070. listConfig: {
  6071. minWidth: 350
  6072. },
  6073. }
  6074. },
  6075. {
  6076. text: '固定默认值', dataIndex: 'is_fix_default_value',
  6077. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  6078. width: 88, resizable: false,
  6079. },
  6080. {
  6081. text: '默认值', dataIndex: 'default_value',
  6082. sortable: false, menuDisabled: true,
  6083. editor: {
  6084. selectOnFocus: true
  6085. }
  6086. },
  6087. {
  6088. text: 'UI建议', dataIndex: 'domain_column_ui',
  6089. sortable: false, menuDisabled: true,
  6090. // fix: ['system.getDict("column_ui")'],
  6091. editor: {
  6092. xtype: 'combo',
  6093. allowBlank: true,
  6094. listConfig: {
  6095. minWidth: 200
  6096. },
  6097. }
  6098. },
  6099. {
  6100. text: '详细描述', dataIndex: 'domain_note',
  6101. sortable: false, menuDisabled: true,
  6102. editor: {}
  6103. },
  6104. {
  6105. text: '责任人', dataIndex: 'domain_person',
  6106. sortable: false, menuDisabled: true,
  6107. editor: {
  6108. selectOnFocus: true
  6109. }
  6110. },
  6111. {
  6112. text: '版本', dataIndex: 'domain_version',
  6113. sortable: false, menuDisabled: true,
  6114. editor: {
  6115. selectOnFocus: true
  6116. }
  6117. },
  6118. ]
  6119. }
  6120. ]
  6121. },
  6122. ]
  6123. };
  6124. var CacheStore = /** @class */ (function () {
  6125. function CacheStore() {
  6126. // 订阅
  6127. this.subscribeList = [];
  6128. this.apiResponse = undefined;
  6129. }
  6130. /**
  6131. * 订阅结果集
  6132. */
  6133. CacheStore.prototype.registe = function (fn) {
  6134. this.subscribeList.push(fn);
  6135. };
  6136. /**
  6137. * 取消订阅
  6138. */
  6139. CacheStore.prototype.unregiste = function (fn) {
  6140. _$2.remove(this.subscribeList, function (item) { return item === fn; });
  6141. };
  6142. /**
  6143. * 尝试取数据(先读缓存)
  6144. */
  6145. CacheStore.prototype.reloadIfNeed = function (param) {
  6146. var _this = this;
  6147. if (typeof this.apiResponse === 'undefined') {
  6148. // 从未有获取过值
  6149. var cacheKey = this.getCacheKey(param);
  6150. if (cacheKey) {
  6151. // 可以从缓存读
  6152. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6153. native.loadFile(fileName, function (res) {
  6154. if (res) {
  6155. // 缓存有值
  6156. _this.apiResponse = res;
  6157. _this.notifyRefresh();
  6158. }
  6159. else {
  6160. // 缓存没值
  6161. _this.reloadForce(param).then(function (res) {
  6162. });
  6163. }
  6164. });
  6165. }
  6166. else {
  6167. // 不能从缓存读
  6168. this.reloadForce(param).then(function (res) {
  6169. });
  6170. }
  6171. return true;
  6172. }
  6173. return false;
  6174. };
  6175. /**
  6176. * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
  6177. */
  6178. CacheStore.prototype.reloadIfNeedPromise = function (param) {
  6179. var _this = this;
  6180. return new Promise(function (resolve, reject) {
  6181. if (typeof _this.apiResponse === 'undefined') {
  6182. // 从未有获取过值
  6183. var cacheKey = _this.getCacheKey(param);
  6184. if (cacheKey) {
  6185. // 可以从缓存读
  6186. var fileName = getCurrentProject().uuid + "/" + cacheKey;
  6187. native.loadFile(fileName, function (res) {
  6188. if (res) {
  6189. // 缓存有值
  6190. _this.apiResponse = res;
  6191. _this.notifyRefresh();
  6192. resolve(_this.apiResponse);
  6193. }
  6194. else {
  6195. // 缓存没值
  6196. _this.reloadForce(param).then(function (res) {
  6197. resolve(_this.apiResponse);
  6198. });
  6199. }
  6200. });
  6201. }
  6202. else {
  6203. // 不能从缓存读
  6204. _this.reloadForce(param).then(function (res) {
  6205. resolve(_this.apiResponse);
  6206. });
  6207. }
  6208. }
  6209. else {
  6210. // 有值,获取过
  6211. resolve(_this.apiResponse);
  6212. }
  6213. });
  6214. };
  6215. /**
  6216. * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  6217. */
  6218. CacheStore.prototype.reloadForce = function (param) {
  6219. var _this = this;
  6220. _$2.forEach(this.subscribeList, function (fn) {
  6221. fn(true);
  6222. });
  6223. return this.invokeApi(param)
  6224. .then(function (res) {
  6225. _this.apiResponse = res;
  6226. var cacheKey = _this.getCacheKey(param);
  6227. if (cacheKey) {
  6228. // 可以保存到缓存
  6229. var fileName = getCurrentProject().uuid + '/' + cacheKey;
  6230. native.saveFile(fileName, res);
  6231. }
  6232. // 通知订阅者刷新
  6233. _this.notifyRefresh();
  6234. })
  6235. .finally(function () {
  6236. _$2.forEach(_this.subscribeList, function (fn) {
  6237. fn(false);
  6238. });
  6239. });
  6240. };
  6241. /**
  6242. * 通知组件,isLoading状态被更改
  6243. */
  6244. CacheStore.prototype.notifyLoading = function (isLoading) {
  6245. var _this = this;
  6246. _$2.forEach(this.subscribeList, function (fn) {
  6247. fn(_this.apiResponse);
  6248. });
  6249. };
  6250. /**
  6251. * 通知数据更改,需要刷新
  6252. */
  6253. CacheStore.prototype.notifyRefresh = function () {
  6254. var _this = this;
  6255. _$2.forEach(this.subscribeList, function (fn) {
  6256. fn(_this.apiResponse);
  6257. });
  6258. };
  6259. return CacheStore;
  6260. }());
  6261. // 字段域数据
  6262. var columnDomain = undefined;
  6263. var DomainStore = /** @class */ (function (_super) {
  6264. __extends(DomainStore, _super);
  6265. function DomainStore() {
  6266. return _super !== null && _super.apply(this, arguments) || this;
  6267. }
  6268. DomainStore.prototype.getCacheKey = function (param) {
  6269. return "domain_data.json";
  6270. };
  6271. DomainStore.prototype.invokeApi = function (param) {
  6272. return getColumnDomainApi();
  6273. };
  6274. /**
  6275. * 设置全局可访问的 字段域数据
  6276. */
  6277. DomainStore.prototype.getColumnDomainComboData = function () {
  6278. var _this = this;
  6279. return new Promise(function (resolve) {
  6280. _this.reloadIfNeedPromise(undefined).then(function (res) {
  6281. resolve(_this.apiResponse.data.map(function (v) {
  6282. return { id: v.domain_id, text: v.domain_name };
  6283. }));
  6284. });
  6285. });
  6286. };
  6287. /**
  6288. * 设置全局可访问的 字段域数据
  6289. */
  6290. DomainStore.prototype.getColumnDomainById = function (value) {
  6291. return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
  6292. };
  6293. DomainStore.prototype.getAllDomain = function () {
  6294. return new Promise(function (resolve, reject) {
  6295. getColumnDomainApi()
  6296. .then(function (res) {
  6297. if (res.success) {
  6298. if (res.success) {
  6299. var tt = _$2.map(res.data, function (row) {
  6300. return {
  6301. text: row.domain_name,
  6302. id: row.domain_id,
  6303. };
  6304. });
  6305. _$2.set(window, 'DICT_CACHE.column_domain', tt);
  6306. }
  6307. columnDomain = res.data;
  6308. resolve(res.data);
  6309. }
  6310. else {
  6311. window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
  6312. console.error('getColumnDomain', res.msg);
  6313. }
  6314. })
  6315. .catch(function (e) {
  6316. window['showErrorDialog']('getColumnDomain error!');
  6317. console.error('getColumnDomain', e);
  6318. reject(e);
  6319. });
  6320. });
  6321. };
  6322. return DomainStore;
  6323. }(CacheStore));
  6324. var instance = new DomainStore();
  6325. var DbDomain = /** @class */ (function (_super) {
  6326. __extends(DbDomain, _super);
  6327. function DbDomain() {
  6328. return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
  6329. }
  6330. DbDomain.prototype.onLoad = function () {
  6331. var _this = this;
  6332. instance.getAllDomain().then(function (data) {
  6333. _this.refs.grid1.setData(data);
  6334. });
  6335. };
  6336. DbDomain.prototype.gridEditFinish = function () {
  6337. this.viewModel.set('hasChanged', true);
  6338. };
  6339. DbDomain.prototype.addField = function () {
  6340. this.refs.grid1.appendEditRow({
  6341. domainName: '',
  6342. pgSqlDataType: '',
  6343. mysqlDataType: '',
  6344. oracleDataType: '',
  6345. sqlserverDataType: '',
  6346. javaDataType: '',
  6347. isFixSize: true,
  6348. size: '',
  6349. decimalDigits: '',
  6350. isFixDefaultValue: false,
  6351. defaultValue: null,
  6352. domainColumnDict: '',
  6353. domainColumnUI: '',
  6354. note: '',
  6355. domainPerson: '',
  6356. domainVersion: '',
  6357. }, 0);
  6358. };
  6359. DbDomain.prototype.removeField = function () {
  6360. var _this = this;
  6361. var rows = [];
  6362. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  6363. rows.push(r);
  6364. });
  6365. _.forEach(rows, function (r) {
  6366. _this.refs.grid1.getStore().remove(r);
  6367. });
  6368. };
  6369. DbDomain.prototype.save = function () {
  6370. var _this = this;
  6371. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  6372. var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  6373. if (err) {
  6374. // 如果有异常就不保存
  6375. return;
  6376. }
  6377. // 进行业务上的逻辑校验,比如说必填校验等等
  6378. var hasError = false;
  6379. _.forEach(rows, function (row, i) {
  6380. if (isEmpty(row.domain_name)) {
  6381. system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
  6382. hasError = true;
  6383. return false;
  6384. }
  6385. if (isEmpty(row.pgsql_datatype) ||
  6386. isEmpty(row.mysql_datatype) ||
  6387. isEmpty(row.oracle_datatype) ||
  6388. isEmpty(row.sqlserver_datatype)) {
  6389. system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
  6390. hasError = true;
  6391. return false;
  6392. }
  6393. });
  6394. if (hasError) {
  6395. return;
  6396. }
  6397. // 设置当前界面为 "保存中..." 状态
  6398. this.setLoading(true);
  6399. saveColumnDomain({
  6400. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  6401. newRows: newRows,
  6402. modifyRows: modifyRows,
  6403. removeRecords: removeRecords,
  6404. }).then(function (res) {
  6405. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  6406. system.msg(res.msg);
  6407. instance.reloadForce({}).then(function () {
  6408. instance.getAllDomain().then(function (data) {
  6409. _this.refs.grid1.setData(data);
  6410. });
  6411. }).finally(function () {
  6412. // 无论正常异常,关闭 "保存中..." 状态
  6413. _this.setLoading(false);
  6414. });
  6415. }).catch(function (e) {
  6416. // 无论正常异常,关闭 "保存中..." 状态
  6417. _this.setLoading(false);
  6418. });
  6419. };
  6420. return DbDomain;
  6421. }(Scope));
  6422. var model$4 = {
  6423. data: {
  6424. report_id: '',
  6425. report_name: '',
  6426. report_enable: false,
  6427. report: {
  6428. dataSource: '',
  6429. grid: {
  6430. pagination: true,
  6431. },
  6432. query: [],
  6433. columns: [],
  6434. summary: [],
  6435. },
  6436. querySql: '',
  6437. summarySql: '',
  6438. createAt: '',
  6439. createBy: '',
  6440. updateAt: '',
  6441. updateBy: '',
  6442. }
  6443. };
  6444. var vjson$4 = {
  6445. bind: {
  6446. title: '报表-{report_name}',
  6447. },
  6448. layout: 'fit',
  6449. items: [
  6450. {
  6451. layout: 'border',
  6452. items: [
  6453. {
  6454. region: 'north',
  6455. items: [
  6456. {
  6457. xtype: 'toolbar',
  6458. border: false,
  6459. items: [
  6460. {
  6461. xtype: 'button',
  6462. text: '刷新',
  6463. iconCls: 'x-fa fa-refresh',
  6464. listeners: {
  6465. click: 'scope.load'
  6466. }
  6467. },
  6468. {
  6469. xtype: 'button',
  6470. text: '保存',
  6471. iconCls: 'x-fa fa-save',
  6472. listeners: {
  6473. click: 'scope.save'
  6474. }
  6475. },
  6476. {
  6477. xtype: 'button',
  6478. text: '预览',
  6479. iconCls: 'x-fa fa-play-circle-o',
  6480. listeners: {
  6481. click: 'scope.preview'
  6482. }
  6483. },
  6484. {
  6485. xtype: 'textfield',
  6486. fieldLabel: '报表名称',
  6487. flex: 1,
  6488. bind: {
  6489. value: '{report_name}'
  6490. }
  6491. },
  6492. {
  6493. xtype: 'checkbox',
  6494. fieldLabel: '启用报表',
  6495. checkedValue: 1,
  6496. uncheckedValue: 0,
  6497. bind: {
  6498. value: '{report_enable}'
  6499. }
  6500. },
  6501. {
  6502. xtype: 'checkbox',
  6503. fieldLabel: '启用分页',
  6504. bind: {
  6505. value: '{report.grid.pagination}'
  6506. }
  6507. },
  6508. {
  6509. xtype: 'textfield',
  6510. fieldLabel: '数据源',
  6511. flex: 1,
  6512. bind: {
  6513. value: '{report.dataSource}'
  6514. }
  6515. },
  6516. ]
  6517. }
  6518. ]
  6519. },
  6520. {
  6521. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  6522. items: [
  6523. {
  6524. title: 'SQL和查询条件',
  6525. layout: 'border',
  6526. border: false,
  6527. items: [
  6528. {
  6529. region: 'north',
  6530. height: 200,
  6531. border: false,
  6532. split: true,
  6533. xtype: 'yvgrid',
  6534. reference: 'gridCondition',
  6535. pagination: false,
  6536. hideFootbar: true,
  6537. plugins: {
  6538. clipboard: true,
  6539. selectionreplicator: true
  6540. },
  6541. selModel: {
  6542. type: 'spreadsheet',
  6543. columnSelect: false,
  6544. pruneRemoved: false,
  6545. extensible: 'y'
  6546. },
  6547. tbar: {
  6548. xtype: 'toolbar',
  6549. border: false,
  6550. items: [
  6551. {
  6552. xtype: 'button',
  6553. text: '添加条件',
  6554. iconCls: 'x-fa fa-plus-circle',
  6555. listeners: {
  6556. click: 'scope.addCondition'
  6557. }
  6558. },
  6559. {
  6560. xtype: 'button',
  6561. text: '删除条件',
  6562. iconCls: 'x-fa fa-minus-circle',
  6563. listeners: {
  6564. click: 'scope.removeCondition'
  6565. }
  6566. },
  6567. '-',
  6568. {
  6569. xtype: 'button',
  6570. text: '自动分析条件变量',
  6571. iconCls: 'x-fa fa-code-fork',
  6572. listeners: {
  6573. click: 'scope.calcCondition'
  6574. }
  6575. },
  6576. {
  6577. xtype: 'button',
  6578. text: '上移',
  6579. iconCls: 'x-fa fa-arrow-up',
  6580. listeners: {
  6581. click: 'scope.moveUp'
  6582. }
  6583. },
  6584. {
  6585. xtype: 'button',
  6586. text: '下移',
  6587. iconCls: 'x-fa fa-arrow-down',
  6588. listeners: {
  6589. click: 'scope.moveDown'
  6590. }
  6591. },
  6592. ]
  6593. },
  6594. columns: [
  6595. {
  6596. text: '条件变量',
  6597. dataIndex: 'conditionFieldBind',
  6598. width: 140,
  6599. sortable: false,
  6600. menuDisabled: true,
  6601. editor: {
  6602. selectOnFocus: true
  6603. },
  6604. },
  6605. {
  6606. text: '中文标题',
  6607. dataIndex: 'conditionFieldLabel',
  6608. width: 120,
  6609. sortable: false,
  6610. menuDisabled: true,
  6611. editor: {
  6612. selectOnFocus: true
  6613. },
  6614. },
  6615. {
  6616. text: '编辑类型',
  6617. dataIndex: 'conditionFieldXtype',
  6618. width: 80,
  6619. sortable: false,
  6620. menuDisabled: true,
  6621. editor: {
  6622. xtype: 'combo',
  6623. typeAhead: true,
  6624. triggerAction: 'all',
  6625. selectOnFocus: true,
  6626. store: [
  6627. ['textfield', 'textfield'],
  6628. ['combo', 'combo'],
  6629. ['datefield', 'datefield'],
  6630. ['datetimefield', 'datetimefield'],
  6631. ['numberfield', 'numberfield'],
  6632. ['multiplesearch', 'multiplesearch'],
  6633. ]
  6634. }
  6635. },
  6636. {
  6637. text: '权重',
  6638. dataIndex: 'conditionFieldFlex',
  6639. align: 'right',
  6640. width: 60,
  6641. sortable: false,
  6642. menuDisabled: true,
  6643. editor: {
  6644. xtype: 'numberfield',
  6645. selectOnFocus: false,
  6646. minValue: 0,
  6647. maxValue: 10
  6648. },
  6649. },
  6650. {
  6651. text: '字典',
  6652. dataIndex: 'conditionFieldDict',
  6653. width: 160,
  6654. sortable: false,
  6655. menuDisabled: true,
  6656. editor: {
  6657. selectOnFocus: false
  6658. },
  6659. },
  6660. {
  6661. xtype: 'checkcolumn',
  6662. dataIndex: "conditionFieldWrap", header: "换行",
  6663. width: 65,
  6664. sortable: false,
  6665. menuDisabled: true,
  6666. },
  6667. {
  6668. text: '扩展参数',
  6669. dataIndex: 'conditionFieldExtend',
  6670. sortable: false,
  6671. menuDisabled: true,
  6672. editor: {
  6673. selectOnFocus: false
  6674. },
  6675. },
  6676. ]
  6677. },
  6678. {
  6679. region: 'center',
  6680. xtype: 'sqleditor',
  6681. layout: 'fit',
  6682. reference: 'sqlEditor',
  6683. split: true,
  6684. },
  6685. ]
  6686. },
  6687. {
  6688. title: '查询结果字段',
  6689. xtype: 'yvgrid',
  6690. reference: 'gridColumn',
  6691. pagination: false,
  6692. hideFootbar: true,
  6693. border: false,
  6694. plugins: {
  6695. clipboard: true,
  6696. selectionreplicator: true
  6697. },
  6698. selModel: {
  6699. type: 'spreadsheet',
  6700. columnSelect: false,
  6701. pruneRemoved: false,
  6702. extensible: 'y'
  6703. },
  6704. tbar: {
  6705. xtype: 'toolbar',
  6706. items: [
  6707. {
  6708. xtype: 'button',
  6709. text: '添加',
  6710. iconCls: 'x-fa fa-plus-circle',
  6711. listeners: {
  6712. click: 'scope.addColumn'
  6713. }
  6714. },
  6715. {
  6716. xtype: 'button',
  6717. text: '删除',
  6718. iconCls: 'x-fa fa-minus-circle',
  6719. listeners: {
  6720. click: 'scope.removeColumn'
  6721. }
  6722. },
  6723. '-',
  6724. {
  6725. xtype: 'button',
  6726. text: '自动分析',
  6727. iconCls: 'x-fa fa-code-fork',
  6728. listeners: {
  6729. click: 'scope.calcColumn'
  6730. }
  6731. },
  6732. {
  6733. xtype: 'button',
  6734. text: '上移',
  6735. iconCls: 'x-fa fa-arrow-up',
  6736. listeners: {
  6737. click: 'scope.moveUp'
  6738. }
  6739. },
  6740. {
  6741. xtype: 'button',
  6742. text: '下移',
  6743. iconCls: 'x-fa fa-arrow-down',
  6744. listeners: {
  6745. click: 'scope.moveDown'
  6746. }
  6747. },
  6748. ]
  6749. },
  6750. columns: [
  6751. { xtype: 'rownumberer' },
  6752. {
  6753. text: '字段',
  6754. dataIndex: 'dataIndex',
  6755. width: 140,
  6756. sortable: false,
  6757. menuDisabled: true,
  6758. editor: {
  6759. selectOnFocus: true
  6760. },
  6761. },
  6762. {
  6763. text: '标题',
  6764. dataIndex: 'header',
  6765. width: 120,
  6766. sortable: false,
  6767. menuDisabled: true,
  6768. editor: {
  6769. selectOnFocus: true
  6770. },
  6771. },
  6772. {
  6773. text: '显示类型',
  6774. dataIndex: 'xtype',
  6775. width: 90,
  6776. sortable: false,
  6777. menuDisabled: true,
  6778. editor: {
  6779. xtype: 'combo',
  6780. typeAhead: true,
  6781. triggerAction: 'all',
  6782. selectOnFocus: true,
  6783. store: [
  6784. ['', ''],
  6785. ['rownum', 'rownum'],
  6786. ['button', 'button'],
  6787. ['checkbox', 'checkbox'],
  6788. ['progres', 'progres'],
  6789. ]
  6790. }
  6791. },
  6792. {
  6793. text: '数据类型',
  6794. dataIndex: 'dataType',
  6795. width: 90,
  6796. sortable: false,
  6797. menuDisabled: true,
  6798. editor: {
  6799. xtype: 'combo',
  6800. typeAhead: true,
  6801. triggerAction: 'all',
  6802. selectOnFocus: true,
  6803. store: [
  6804. ['', ''],
  6805. ['string', 'string'],
  6806. ['number', 'number'],
  6807. ['date', 'date'],
  6808. ]
  6809. }
  6810. },
  6811. {
  6812. text: '宽度',
  6813. dataIndex: 'width',
  6814. align: 'right',
  6815. width: 60,
  6816. sortable: false,
  6817. menuDisabled: true,
  6818. editor: {
  6819. xtype: 'numberfield',
  6820. selectOnFocus: true,
  6821. minValue: 0,
  6822. maxValue: 1000
  6823. },
  6824. },
  6825. {
  6826. text: '权重',
  6827. dataIndex: 'flex',
  6828. align: 'right',
  6829. width: 60,
  6830. sortable: false,
  6831. menuDisabled: true,
  6832. editor: {
  6833. xtype: 'numberfield',
  6834. selectOnFocus: true,
  6835. minValue: 0,
  6836. maxValue: 10
  6837. },
  6838. },
  6839. {
  6840. text: '字典',
  6841. dataIndex: 'dict',
  6842. sortable: false,
  6843. menuDisabled: true,
  6844. width: 120,
  6845. editor: {
  6846. selectOnFocus: true,
  6847. },
  6848. },
  6849. {
  6850. text: '对齐',
  6851. dataIndex: 'align',
  6852. width: 60,
  6853. sortable: false,
  6854. menuDisabled: true,
  6855. editor: {
  6856. xtype: 'combo',
  6857. typeAhead: true,
  6858. triggerAction: 'all',
  6859. selectOnFocus: false,
  6860. store: [
  6861. ['', ''],
  6862. ['start', 'start'],
  6863. ['center', 'center'],
  6864. ['end', 'end'],
  6865. ]
  6866. },
  6867. },
  6868. {
  6869. text: '过滤',
  6870. dataIndex: 'filterable',
  6871. xtype: 'checkcolumn',
  6872. width: 50,
  6873. resizable: false,
  6874. sortable: false,
  6875. menuDisabled: true,
  6876. },
  6877. {
  6878. text: '隐藏',
  6879. dataIndex: 'hidden',
  6880. xtype: 'checkcolumn',
  6881. width: 50,
  6882. resizable: false,
  6883. sortable: false,
  6884. menuDisabled: true,
  6885. },
  6886. {
  6887. text: '排序',
  6888. dataIndex: 'sortable',
  6889. xtype: 'checkcolumn',
  6890. width: 50,
  6891. resizable: false,
  6892. sortable: false,
  6893. menuDisabled: true,
  6894. },
  6895. {
  6896. text: '扩展参数',
  6897. dataIndex: 'fieldExtend',
  6898. sortable: false,
  6899. menuDisabled: true,
  6900. editor: {
  6901. selectOnFocus: false
  6902. },
  6903. },
  6904. ],
  6905. },
  6906. {
  6907. title: '汇总和汇总逻辑',
  6908. layout: 'border',
  6909. border: false,
  6910. items: [
  6911. {
  6912. xtype: 'yvgrid', region: 'north', layout: 'fit',
  6913. reference: 'gridSum',
  6914. pagination: false,
  6915. hideFootbar: true,
  6916. height: 200,
  6917. split: true,
  6918. border: false,
  6919. plugins: {
  6920. clipboard: true,
  6921. selectionreplicator: true
  6922. },
  6923. selModel: {
  6924. type: 'spreadsheet',
  6925. columnSelect: false,
  6926. pruneRemoved: false,
  6927. extensible: 'y'
  6928. },
  6929. tbar: {
  6930. xtype: 'toolbar',
  6931. border: false,
  6932. items: [
  6933. {
  6934. xtype: 'button',
  6935. text: '添加',
  6936. iconCls: 'x-fa fa-plus-circle',
  6937. listeners: {
  6938. click: 'scope.addSum'
  6939. }
  6940. },
  6941. {
  6942. xtype: 'button',
  6943. text: '删除',
  6944. iconCls: 'x-fa fa-minus-circle',
  6945. listeners: {
  6946. click: 'scope.removeSum'
  6947. }
  6948. },
  6949. '-',
  6950. {
  6951. xtype: 'button',
  6952. text: '自动分析',
  6953. iconCls: 'x-fa fa-code-fork',
  6954. listeners: {
  6955. click: 'scope.calcSum'
  6956. }
  6957. },
  6958. {
  6959. xtype: 'button',
  6960. text: '上移',
  6961. iconCls: 'x-fa fa-arrow-up',
  6962. listeners: {
  6963. click: 'scope.moveUp'
  6964. }
  6965. },
  6966. {
  6967. xtype: 'button',
  6968. text: '下移',
  6969. iconCls: 'x-fa fa-arrow-down',
  6970. listeners: {
  6971. click: 'scope.moveDown'
  6972. }
  6973. },
  6974. ]
  6975. },
  6976. columns: [
  6977. {
  6978. text: '字段名',
  6979. dataIndex: 'sumFieldBind',
  6980. width: 140,
  6981. sortable: false,
  6982. menuDisabled: true,
  6983. editor: {
  6984. selectOnFocus: true
  6985. },
  6986. },
  6987. {
  6988. text: '标题',
  6989. dataIndex: 'sumFieldLabel',
  6990. width: 120,
  6991. sortable: false,
  6992. menuDisabled: true,
  6993. editor: {
  6994. selectOnFocus: true
  6995. },
  6996. },
  6997. {
  6998. text: '权重',
  6999. dataIndex: 'sumFieldFlex',
  7000. align: 'right',
  7001. width: 60,
  7002. sortable: false,
  7003. menuDisabled: true,
  7004. editor: {
  7005. xtype: 'numberfield',
  7006. selectOnFocus: false,
  7007. allowBlank: true,
  7008. minValue: 0,
  7009. maxValue: 10
  7010. },
  7011. },
  7012. {
  7013. xtype: 'checkcolumn',
  7014. dataIndex: "sumFieldWrap", header: "换行",
  7015. sortable: false,
  7016. menuDisabled: true,
  7017. width: 65,
  7018. },
  7019. {
  7020. text: '扩展参数',
  7021. dataIndex: 'sumFieldExtend',
  7022. sortable: false,
  7023. menuDisabled: true,
  7024. editor: {
  7025. selectOnFocus: false
  7026. },
  7027. },
  7028. ]
  7029. },
  7030. {
  7031. region: 'center',
  7032. xtype: 'sqleditor',
  7033. layout: 'fit',
  7034. reference: 'sqlSumEditor',
  7035. },
  7036. ]
  7037. },
  7038. ]
  7039. }
  7040. ]
  7041. }
  7042. ]
  7043. }; //
  7044. //
  7045. var DbStore = /** @class */ (function (_super) {
  7046. __extends(DbStore, _super);
  7047. function DbStore() {
  7048. return _super !== null && _super.apply(this, arguments) || this;
  7049. }
  7050. DbStore.prototype.getCacheKey = function (param) {
  7051. return "db_data.json";
  7052. };
  7053. DbStore.prototype.invokeApi = function (param) {
  7054. return getMateData(param);
  7055. };
  7056. /**
  7057. * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
  7058. */
  7059. DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
  7060. return new Promise(function (resolve, reject) {
  7061. saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
  7062. resolve(res1);
  7063. // TODO 好像不需要,先跳过
  7064. // reloadByTableName(schema_name, table_name).then(res2 => {
  7065. // resolve(res1)
  7066. // }).catch(e => {
  7067. // reject(e)
  7068. // })
  7069. }).catch(function (e) {
  7070. reject(e);
  7071. });
  7072. });
  7073. };
  7074. /**
  7075. * 保存元数据至表格
  7076. */
  7077. DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
  7078. var _this = this;
  7079. return new Promise(function (resolve, reject) {
  7080. saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
  7081. // 保存后重新刷新
  7082. _this.reloadByTableName(schema_name, table_name).then(function (res2) {
  7083. resolve({
  7084. data: res2,
  7085. msg: res1.msg
  7086. });
  7087. }).catch(function (e) {
  7088. reject(e);
  7089. });
  7090. }).catch(function (e) {
  7091. reject(e);
  7092. });
  7093. });
  7094. };
  7095. /**
  7096. * 预览生成的 DDL 语句
  7097. */
  7098. DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
  7099. return new Promise(function (resolve, reject) {
  7100. getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
  7101. .then(function (res) {
  7102. resolve(res);
  7103. });
  7104. });
  7105. };
  7106. /**
  7107. * 执行 DDL
  7108. */
  7109. DbStore.prototype.pushToDbCommit = function (arg) {
  7110. return new Promise(function (resolve, reject) {
  7111. pushToDbCommitApi(arg).then(function (res) {
  7112. resolve(res);
  7113. }).catch(function (e) {
  7114. reject(e);
  7115. });
  7116. });
  7117. };
  7118. /**
  7119. * 重读某一个表格的 meta 元数据
  7120. */
  7121. DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
  7122. var _this = this;
  7123. return new Promise(function (resolve, reject) {
  7124. getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
  7125. if (!res[0] || !res[0].table_list[0]) {
  7126. showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
  7127. return;
  7128. }
  7129. var tableRow = _this.getTableByName(schema_name, table_name);
  7130. if (!tableRow) {
  7131. // 没有找到这个表格,就添加一个表格到对应的 schemaRow
  7132. var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
  7133. if (!schemaRow) {
  7134. showErrorDialog$1('没有找到 schema:' + schema_name);
  7135. return;
  7136. }
  7137. schemaRow.table_list.push(res[0].table_list[0]);
  7138. }
  7139. else {
  7140. // 找到了目标表格,就吧 table 所有属性都赋值过去
  7141. Object.assign(tableRow, res[0].table_list[0]);
  7142. }
  7143. // 所有界面通知一遍刷新
  7144. _this.notifyRefresh();
  7145. resolve(res);
  7146. }).catch(function (e) {
  7147. reject(e);
  7148. });
  7149. });
  7150. };
  7151. DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
  7152. var result = undefined;
  7153. _$2.forEach(this.apiResponse, function (schemaRow) {
  7154. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
  7155. if (tableRow) {
  7156. var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
  7157. if (columnRow) {
  7158. result = columnRow;
  7159. return false;
  7160. }
  7161. }
  7162. });
  7163. return result;
  7164. };
  7165. DbStore.prototype.getTableByName = function (schemaName, tableName) {
  7166. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
  7167. if (!schemaRow) {
  7168. showErrorDialog$1('没有找到 schema:' + schemaName);
  7169. return;
  7170. }
  7171. var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
  7172. if (!schemaRow) {
  7173. showErrorDialog$1('没有找到 table:' + tableName);
  7174. return;
  7175. }
  7176. return tableRow;
  7177. };
  7178. /**
  7179. * 添加一个新表格
  7180. */
  7181. DbStore.prototype.appendNewTable = function (tableInfo) {
  7182. var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
  7183. if (!schemaRow) {
  7184. showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
  7185. return;
  7186. }
  7187. schemaRow.table_list.push(tableInfo);
  7188. };
  7189. /**
  7190. * 从数据库结构重新生成元数据
  7191. */
  7192. DbStore.prototype.dbToMetaAndReload = function () {
  7193. var _this = this;
  7194. this.notifyLoading(true);
  7195. dbToMeta().then(function () {
  7196. _this.reloadForce(undefined);
  7197. }).catch(function (e) {
  7198. _this.notifyLoading(false);
  7199. });
  7200. };
  7201. DbStore.prototype.getSchemaDbType = function (schemaName) {
  7202. var dbType = undefined;
  7203. _$2.forEach(this.apiResponse, function (schemaRow) {
  7204. if (schemaRow.schema_name === schemaName) {
  7205. dbType = schemaRow.db_type;
  7206. return false;
  7207. }
  7208. });
  7209. return dbType;
  7210. };
  7211. return DbStore;
  7212. }(CacheStore));
  7213. function syncQueryDSL(_a) {
  7214. var schema_name = _a.schema_name, table_name = _a.table_name;
  7215. return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
  7216. }
  7217. var instance$1 = new DbStore();
  7218. // // 字段域数据
  7219. // let columnDomain = undefined
  7220. // // 元数据
  7221. // let apiResponse = []
  7222. //
  7223. // // 订阅
  7224. // const subscribeList = []
  7225. // /**
  7226. // * 获取全部元数据
  7227. // */
  7228. // export function getApiResponse() {
  7229. // return apiResponse
  7230. // }
  7231. //
  7232. // export function getColumnDomain() {
  7233. // return columnDomain
  7234. // }
  7235. // window['getApiResponse'] = getApiResponse
  7236. // window['getColumnDomain'] = getColumnDomain
  7237. // window['getDbTreeStore'] = function () {
  7238. // return apiResponse
  7239. // }
  7240. //
  7241. // /**
  7242. // * 订阅结果集
  7243. // */
  7244. // export function subscribe(fn) {
  7245. // subscribeList.push(fn)
  7246. // }
  7247. //
  7248. // /**
  7249. // * 取消订阅
  7250. // */
  7251. // export function describe(fn) {
  7252. // _.remove(subscribeList, item => item === fn)
  7253. // }
  7254. //
  7255. // /**
  7256. // * 刷新,如果前端从来没有取到过结果的话
  7257. // * 如果强制刷新成功,就返回 true
  7258. // * 如果没有被强制刷新,返回 false
  7259. // */
  7260. // export function reloadIfNeed() {
  7261. // if (_.size(apiResponse) <= 0) {
  7262. // reloadForce()
  7263. // return true
  7264. // }
  7265. // return false
  7266. // }
  7267. //
  7268. // export function reloadIfNeedPromise() {
  7269. // return new Promise((resolve, reject) => {
  7270. // if (_.size(apiResponse) <= 0) {
  7271. // // 从未有获取过值
  7272. // reloadForce().then(res => {
  7273. // resolve(apiResponse)
  7274. // })
  7275. // return
  7276. // }
  7277. // resolve(apiResponse)
  7278. // return
  7279. // })
  7280. // }
  7281. //
  7282. // /**
  7283. // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
  7284. // */
  7285. // export function reloadForce() {
  7286. // _.forEach(subscribeList, fn => {
  7287. // fn(true)
  7288. // })
  7289. //
  7290. // return getMateData().then((content) => {
  7291. // apiResponse = content
  7292. // _.forEach(subscribeList, fn => {
  7293. // fn(apiResponse)
  7294. // })
  7295. // }).finally(() => {
  7296. // _.forEach(subscribeList, fn => {
  7297. // fn(false)
  7298. // })
  7299. // })
  7300. // }
  7301. //
  7302. // /**
  7303. // * 通知刷新元数据
  7304. // */
  7305. // export function notifyRefresh() {
  7306. // _.forEach(subscribeList, fn => {
  7307. // fn(apiResponse)
  7308. // })
  7309. // }
  7310. // export function getAllDomain() {
  7311. // return new Promise((resolve, reject) => {
  7312. // getColumnDomainApi()
  7313. // .then(res => {
  7314. // if (res.success) {
  7315. // columnDomain = res.data
  7316. // resolve(res.data)
  7317. // } else {
  7318. // showErrorDialog('getColumnDomain error!\n' + res.msg)
  7319. // console.error('getColumnDomain', res.msg)
  7320. // }
  7321. //
  7322. // })
  7323. // .catch(e => {
  7324. // showErrorDialog('getColumnDomain error!')
  7325. // console.error('getColumnDomain', e)
  7326. // reject(e)
  7327. // })
  7328. // })
  7329. // }
  7330. var PROJECT_DICT_CACHE = {};
  7331. window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
  7332. /**
  7333. *项目运行时构建
  7334. **/
  7335. function createRuntime() {
  7336. {
  7337. // 已经构建过了
  7338. return new Promise(function (resolve) {
  7339. resolve();
  7340. });
  7341. }
  7342. }
  7343. function ReportRunner(reportId, setLoadingFn) {
  7344. return new Promise(function (resolve) {
  7345. setLoadingFn(true);
  7346. Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
  7347. // const {model, vjson, report} = buildVjson(res.data)
  7348. // const ret = new ReportScope({model, vjson})
  7349. // ret.report_id = reportId
  7350. // ret.report = report
  7351. // resolve(ret)
  7352. var _b = __read(_a, 1), res = _b[0];
  7353. var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
  7354. resolve(ret);
  7355. }).finally(function () {
  7356. setLoadingFn(false);
  7357. });
  7358. });
  7359. }
  7360. //gridCondition
  7361. //gridColumn
  7362. //gridSum
  7363. //sqlSumEditor
  7364. //sqlEditor
  7365. var ReportDesign = /** @class */ (function (_super) {
  7366. __extends(ReportDesign, _super);
  7367. function ReportDesign() {
  7368. return _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
  7369. }
  7370. ReportDesign.prototype.onLoad = function () {
  7371. this.load();
  7372. };
  7373. ReportDesign.prototype.save = function (sender) {
  7374. var _this = this;
  7375. this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
  7376. this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
  7377. this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
  7378. this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
  7379. this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
  7380. var report = this.viewModel.get('report');
  7381. var data = {
  7382. report_id: this.viewModel.get('report_id'),
  7383. report_name: this.viewModel.get('report_name'),
  7384. report_enable: this.viewModel.get('report_enable'),
  7385. query_sql: this.viewModel.get('querySql'),
  7386. summary_sql: this.viewModel.get('summarySql'),
  7387. report: json5.stringify(report, null, ' '),
  7388. };
  7389. sender.setLoading(true);
  7390. saveReportApi(data).then(function (res) {
  7391. if (res.success) {
  7392. msg$1('保存成功');
  7393. _this.dialogSuccess(data);
  7394. _this.load();
  7395. }
  7396. }).finally(function () {
  7397. sender.setLoading(false);
  7398. });
  7399. };
  7400. ReportDesign.prototype.preview = function (sender) {
  7401. var reportId = this.viewModel.get('report_id');
  7402. ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
  7403. handles.mainWindow.showReportPreview(reportId, scope);
  7404. });
  7405. };
  7406. ReportDesign.prototype.load = function () {
  7407. var _this = this;
  7408. var reportId = this.viewModel.get('report_id');
  7409. this.setLoading(true);
  7410. reportByIdApi(reportId).then(function (res) {
  7411. 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;
  7412. if (report) {
  7413. report = json5.parse(report);
  7414. }
  7415. else {
  7416. report = {};
  7417. }
  7418. _this.viewModel.set('report_enable', report_enable);
  7419. _this.viewModel.set('report_name', report_name);
  7420. _this.viewModel.set('querySql', query_sql || '');
  7421. _this.viewModel.set('summarySql', summary_sql || '');
  7422. system.mergeViewModel(_this.viewModel, 'report', report, false);
  7423. var query = _this.viewModel.get('report.query') || [];
  7424. var columns = _this.viewModel.get('report.columns') || [];
  7425. var summary = _this.viewModel.get('report.summary') || [];
  7426. var querySql = _this.viewModel.get('querySql');
  7427. var summarySql = _this.viewModel.get('summarySql');
  7428. _this.refs.gridCondition.setData(query);
  7429. _this.refs.gridColumn.setData(columns);
  7430. _this.refs.gridSum.setData(summary);
  7431. _this.refs.sqlEditor.setCode(querySql);
  7432. _this.refs.sqlSumEditor.setCode(summarySql);
  7433. }).finally(function () {
  7434. _this.setLoading(false);
  7435. });
  7436. };
  7437. ReportDesign.prototype.addCondition = function () {
  7438. this.refs.gridCondition.appendEditRow({
  7439. conditionFieldBind: '',
  7440. conditionFieldLabel: '',
  7441. conditionFieldXtype: 'textfield',
  7442. conditionFieldFlex: 1,
  7443. conditionFieldDict: '',
  7444. conditionFieldWrap: false,
  7445. conditionFieldExtend: '{}',
  7446. }, 'conditionFieldBind');
  7447. };
  7448. ReportDesign.prototype.removeCondition = function () {
  7449. var _this = this;
  7450. var rows = [];
  7451. this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
  7452. rows.push(r);
  7453. });
  7454. _.forEach(rows, function (r) {
  7455. _this.refs.gridCondition.getStore().remove(r);
  7456. });
  7457. };
  7458. ReportDesign.prototype.moveUp = function (sender) {
  7459. var grid = sender.up('grid');
  7460. grid.rowMoveUp();
  7461. };
  7462. ReportDesign.prototype.moveDown = function (sender) {
  7463. var grid = sender.up('grid');
  7464. grid.rowMoveDown();
  7465. };
  7466. ReportDesign.prototype.calcCondition = function () {
  7467. var _this = this;
  7468. var sql = this.refs.sqlEditor.getCode();
  7469. var re = sql.matchAll(/#{(.+?)}/gi);
  7470. var rows = this.refs.gridCondition.getDataRows();
  7471. this.refs.gridCondition.setLoading(true);
  7472. Promise.all([
  7473. parseDynamicSqlApi(sql),
  7474. instance$1.reloadIfNeedPromise(),
  7475. ]).then(function (_a) {
  7476. var e_1, _b;
  7477. var _c = __read(_a, 1), res1 = _c[0];
  7478. if (res1.success) {
  7479. var tables_1 = [];
  7480. _.forEach(res1.data, function (parseItem) {
  7481. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7482. if (tableName && !_.includes(tables_1, tableName)) {
  7483. tables_1.push(tableName);
  7484. }
  7485. });
  7486. var _loop_1 = function (m) {
  7487. var e_2, _a;
  7488. var columnName = m[1];
  7489. // 没有这个列才添加
  7490. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  7491. var meta = undefined;
  7492. try {
  7493. 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()) {
  7494. var tableName = tables_2_1.value;
  7495. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7496. if (meta) {
  7497. break;
  7498. }
  7499. }
  7500. }
  7501. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  7502. finally {
  7503. try {
  7504. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  7505. }
  7506. finally { if (e_2) throw e_2.error; }
  7507. }
  7508. if (meta) {
  7509. // 找到元数据
  7510. var r = {
  7511. conditionFieldBind: meta.column_name,
  7512. conditionFieldLabel: meta.column_comment,
  7513. conditionFieldXtype: 'textfield',
  7514. conditionFieldFlex: 1,
  7515. conditionFieldDict: '',
  7516. conditionFieldWrap: false,
  7517. conditionFieldExtend: '{}',
  7518. };
  7519. if (meta.column_ui === 'combo' && meta.column_dict) {
  7520. r.conditionFieldXtype = 'combo';
  7521. r.conditionFieldDict = meta.column_dict;
  7522. }
  7523. else if (meta.column_ui === "checkbox") {
  7524. r.conditionFieldXtype = 'checkbox';
  7525. }
  7526. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7527. r.conditionFieldXtype = 'numberfield';
  7528. }
  7529. _this.refs.gridCondition.appendEditRow(r);
  7530. }
  7531. else {
  7532. // 没找到元数据,直接添加
  7533. _this.refs.gridCondition.appendEditRow({
  7534. conditionFieldBind: columnName,
  7535. conditionFieldLabel: '',
  7536. conditionFieldXtype: 'textfield',
  7537. conditionFieldFlex: 1,
  7538. conditionFieldDict: '',
  7539. conditionFieldWrap: false,
  7540. conditionFieldExtend: '{}',
  7541. });
  7542. }
  7543. }
  7544. };
  7545. try {
  7546. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  7547. var m = re_1_1.value;
  7548. _loop_1(m);
  7549. }
  7550. }
  7551. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  7552. finally {
  7553. try {
  7554. if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
  7555. }
  7556. finally { if (e_1) throw e_1.error; }
  7557. }
  7558. }
  7559. }).finally(function () {
  7560. _this.refs.gridCondition.setLoading(false);
  7561. });
  7562. };
  7563. ReportDesign.prototype.addColumn = function () {
  7564. this.refs.gridColumn.appendEditRow({
  7565. dataIndex: '',
  7566. header: '',
  7567. xtype: '',
  7568. dataType: '',
  7569. width: '',
  7570. dict: '',
  7571. align: '',
  7572. filterable: true,
  7573. hidden: false,
  7574. sortable: true,
  7575. fieldExtend: '{}',
  7576. }, 'header');
  7577. };
  7578. ReportDesign.prototype.removeColumn = function () {
  7579. var _this = this;
  7580. var rows = [];
  7581. this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
  7582. rows.push(r);
  7583. });
  7584. _.forEach(rows, function (r) {
  7585. _this.refs.gridColumn.getStore().remove(r);
  7586. });
  7587. };
  7588. ReportDesign.prototype.calcColumn = function () {
  7589. var _this = this;
  7590. var sql = this.refs.sqlEditor.getCode();
  7591. this.refs.gridColumn.setLoading(true);
  7592. var rows = this.refs.gridColumn.getDataRows();
  7593. Promise.all([
  7594. parseDynamicSqlApi(sql),
  7595. instance$1.reloadIfNeedPromise(),
  7596. ]).then(function (_a) {
  7597. var _b = __read(_a, 1), res1 = _b[0];
  7598. if (res1.success) {
  7599. _.forEach(res1.data, function (parseItem) {
  7600. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  7601. // 是否找到重复字段
  7602. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  7603. if (exists) {
  7604. if ((columnTypeName || "").toLowerCase() === "number") {
  7605. var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
  7606. if (record) {
  7607. record.set("dataType", "number");
  7608. record.set("align", "end");
  7609. }
  7610. }
  7611. return;
  7612. }
  7613. if (tableName) {
  7614. // 解出表格名和字段名
  7615. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  7616. if (meta) {
  7617. // 找到了元数据
  7618. var r = {
  7619. dataIndex: meta.column_name,
  7620. header: meta.column_comment,
  7621. xtype: '',
  7622. dataType: '',
  7623. width: '',
  7624. dict: '',
  7625. align: '',
  7626. filterable: true,
  7627. hidden: false,
  7628. sortable: true,
  7629. fieldExtend: '{}',
  7630. };
  7631. if (meta.column_ui === 'combo' && meta.column_dict) {
  7632. r.dict = meta.column_dict;
  7633. }
  7634. else if (meta.column_ui === "checkbox") {
  7635. r.xtype = 'checkbox';
  7636. }
  7637. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  7638. r.dataType = meta.data_type;
  7639. r.align = 'end';
  7640. }
  7641. if ((columnTypeName || "").toLowerCase() === "number") {
  7642. r.dataType = "number";
  7643. r.align = 'end';
  7644. }
  7645. _this.refs.gridColumn.appendEditRow(r);
  7646. return;
  7647. }
  7648. }
  7649. if (columnName) {
  7650. // 解出字段名
  7651. var r = {
  7652. dataIndex: columnName,
  7653. header: columnName,
  7654. xtype: '',
  7655. dataType: '',
  7656. width: '',
  7657. dict: '',
  7658. align: '',
  7659. filterable: true,
  7660. hidden: false,
  7661. sortable: true,
  7662. fieldExtend: '{}',
  7663. };
  7664. if ((columnTypeName || "").toLowerCase() === "number") {
  7665. r.dataType = "number";
  7666. r.align = 'end';
  7667. }
  7668. _this.refs.gridColumn.appendEditRow(r);
  7669. }
  7670. });
  7671. }
  7672. }).finally(function () {
  7673. _this.refs.gridColumn.setLoading(false);
  7674. });
  7675. };
  7676. ReportDesign.prototype.addSum = function () {
  7677. this.refs.gridSum.appendEditRow({
  7678. sumFieldBind: '',
  7679. sumFieldLabel: '',
  7680. sumFieldFlex: 1,
  7681. sumFieldWrap: false,
  7682. sumFieldExtend: '{}',
  7683. }, 'sumFieldBind');
  7684. };
  7685. ReportDesign.prototype.removeSum = function () {
  7686. var _this = this;
  7687. var rows = [];
  7688. this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
  7689. rows.push(r);
  7690. });
  7691. _.forEach(rows, function (r) {
  7692. _this.refs.gridSum.getStore().remove(r);
  7693. });
  7694. };
  7695. ReportDesign.prototype.calcSum = function () {
  7696. var _this = this;
  7697. var sql = this.refs.sqlSumEditor.getCode();
  7698. var rows = this.refs.gridSum.getDataRows();
  7699. this.refs.gridSum.setLoading(true);
  7700. parseDynamicSqlApi(sql).then(function (res1) {
  7701. if (res1.success) {
  7702. _.forEach(res1.data, function (parseItem) {
  7703. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  7704. // 是否找到重复字段
  7705. if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
  7706. return;
  7707. }
  7708. if (columnName) {
  7709. // 解出字段名
  7710. _this.refs.gridSum.appendEditRow({
  7711. sumFieldBind: columnName,
  7712. sumFieldLabel: columnName,
  7713. sumFieldFlex: 1,
  7714. sumFieldWrap: false,
  7715. sumFieldExtend: '{}',
  7716. });
  7717. }
  7718. });
  7719. }
  7720. }).finally(function () {
  7721. _this.refs.gridSum.setLoading(false);
  7722. });
  7723. };
  7724. Object.defineProperty(ReportDesign.prototype, "reportId", {
  7725. get: function () {
  7726. return this.viewModel.get('report_id');
  7727. },
  7728. enumerable: true,
  7729. configurable: true
  7730. });
  7731. return ReportDesign;
  7732. }(Scope));
  7733. var model$5 = {
  7734. data: {
  7735. originalTableInfo: {
  7736. table_name: '',
  7737. description: '',
  7738. },
  7739. hasChanged: false,
  7740. schema_name: undefined,
  7741. table_name: undefined,
  7742. column_name: undefined,
  7743. tableInfo: {
  7744. schema_name: '',
  7745. table_name: '',
  7746. description: '',
  7747. biz_category: '',
  7748. note: '',
  7749. archive_enable: false,
  7750. archive_cron: '',
  7751. archive_condition: '',
  7752. column_list: []
  7753. },
  7754. },
  7755. formulas: {
  7756. shouldSave: function (get) {
  7757. // console.log("-->", get('grid1.ischanged'))
  7758. return get('grid1.ischanged')
  7759. || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
  7760. || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
  7761. },
  7762. },
  7763. };
  7764. var vjson$5 = {
  7765. bind: {
  7766. title: '{tableName}{shouldSave?" *":""}',
  7767. },
  7768. layout: 'fit',
  7769. items: [
  7770. {
  7771. layout: 'border',
  7772. tbar: {
  7773. xtype: 'toolbar',
  7774. items: [
  7775. // {
  7776. // xtype: 'button',
  7777. // text: '拉取库结构',
  7778. // iconCls: 'x-fa fa-cloud-download',
  7779. // listeners: {
  7780. // click: 'scope.pullFromDb'
  7781. // }
  7782. // },
  7783. {
  7784. xtype: 'button',
  7785. text: '保存至数据库',
  7786. iconCls: 'x-fa fa-save',
  7787. bind: {
  7788. disabled: '{!shouldSave}'
  7789. },
  7790. listeners: {
  7791. click: 'scope.pushToDb'
  7792. }
  7793. },
  7794. '-',
  7795. {
  7796. xtype: 'button',
  7797. text: '刷新 QueryDSL',
  7798. iconCls: 'x-fa fa-refresh',
  7799. listeners: {
  7800. click: 'scope.syncQueryDSL'
  7801. }
  7802. },
  7803. {
  7804. xtype: 'button',
  7805. text: '生成 DDL',
  7806. iconCls: 'x-fa fa-file-text',
  7807. listeners: {
  7808. click: 'scope.buildDDL'
  7809. }
  7810. }
  7811. ]
  7812. },
  7813. items: [
  7814. {
  7815. region: 'center',
  7816. xtype: 'tabpanel',
  7817. items: [
  7818. {
  7819. title: '字段',
  7820. xtype: 'yvgrid',
  7821. selModel: {
  7822. type: 'spreadsheet',
  7823. columnSelect: true,
  7824. pruneRemoved: false,
  7825. extensible: 'y'
  7826. },
  7827. enableLocking: false,
  7828. idField: 'column_name',
  7829. plugins: {
  7830. clipboard: true,
  7831. selectionreplicator: true
  7832. },
  7833. reference: 'grid1',
  7834. pagination: false,
  7835. // hideFootbar: true,
  7836. tbar: {
  7837. xtype: 'form',
  7838. items: [
  7839. {
  7840. xtype: 'cols',
  7841. items: [
  7842. {
  7843. xtype: 'textfield',
  7844. fieldLabel: '表格名',
  7845. reference: 'text_table_name',
  7846. readOnly: true,
  7847. bind: {
  7848. value: '{tableInfo.table_name}'
  7849. }
  7850. },
  7851. {
  7852. xtype: 'textfield',
  7853. fieldLabel: '描述',
  7854. // readOnly: true,
  7855. bind: {
  7856. value: '{tableInfo.description}'
  7857. }
  7858. },
  7859. ]
  7860. },
  7861. {
  7862. xtype: 'toolbar',
  7863. items: [
  7864. {
  7865. xtype: 'button',
  7866. text: '添加',
  7867. iconCls: 'x-fa fa-plus-circle',
  7868. listeners: {
  7869. click: 'scope.addField'
  7870. }
  7871. },
  7872. {
  7873. xtype: 'button',
  7874. text: '删除',
  7875. iconCls: 'x-fa fa-minus-circle',
  7876. listeners: {
  7877. click: 'scope.removeField'
  7878. }
  7879. },
  7880. ]
  7881. },
  7882. ]
  7883. },
  7884. listeners: {
  7885. editbefore: 'scope.gridEditBefore'
  7886. },
  7887. columns: [
  7888. {
  7889. text: '字段名', dataIndex: 'column_name',
  7890. sortable: false,
  7891. menuDisabled: true,
  7892. width: 120,
  7893. editor: {
  7894. allowBlank: true,
  7895. selectOnFocus: false
  7896. }
  7897. },
  7898. {
  7899. text: '字段中文', dataIndex: 'column_comment',
  7900. width: 130,
  7901. sortable: false,
  7902. menuDisabled: true,
  7903. editor: {
  7904. allowBlank: true,
  7905. selectOnFocus: false
  7906. }
  7907. },
  7908. {
  7909. text: '主键', dataIndex: 'is_primary_key',
  7910. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7911. width: 48, resizable: false,
  7912. },
  7913. {
  7914. text: '必填', dataIndex: 'not_null',
  7915. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  7916. width: 48, resizable: false,
  7917. },
  7918. {
  7919. text: '字段域', dataIndex: 'column_domain',
  7920. sortable: false, menuDisabled: true,
  7921. width: 148,
  7922. dict: 'column_domain',
  7923. editor: {
  7924. xtype: 'combo',
  7925. allowBlank: true,
  7926. selectOnFocus: true,
  7927. // fix: ['system.getDict("column_domain")'],
  7928. dict: 'column_domain',
  7929. listConfig: {
  7930. minWidth: 200
  7931. },
  7932. listeners: {
  7933. change: 'scope.columnDomainChange',
  7934. }
  7935. }
  7936. },
  7937. {
  7938. text: '数据类型', dataIndex: 'data_type',
  7939. sortable: false, menuDisabled: true,
  7940. editor: { allowBlank: true, selectOnFocus: true }
  7941. },
  7942. {
  7943. text: '长度', dataIndex: 'column_size',
  7944. sortable: false, menuDisabled: true,
  7945. xtype: 'numbercolumn', format: '0',
  7946. editor: { allowBlank: true, selectOnFocus: true }
  7947. },
  7948. {
  7949. text: '小数位', dataIndex: 'decimal_digits',
  7950. sortable: false, menuDisabled: true,
  7951. xtype: 'numbercolumn', format: '0',
  7952. editor: { allowBlank: true, selectOnFocus: true }
  7953. },
  7954. {
  7955. text: '默认值', dataIndex: 'default_value',
  7956. sortable: false, menuDisabled: true,
  7957. editor: { allowBlank: true, selectOnFocus: true }
  7958. },
  7959. {
  7960. text: '字典', dataIndex: 'column_dict',
  7961. sortable: false, menuDisabled: true,
  7962. // fix: ['system.getDict("DICT")'],
  7963. width: 200,
  7964. editor: {
  7965. xtype: 'combo',
  7966. allowBlank: true,
  7967. listConfig: {
  7968. minWidth: 350
  7969. },
  7970. }
  7971. },
  7972. {
  7973. text: 'UI建议', dataIndex: 'column_ui',
  7974. sortable: false, menuDisabled: true,
  7975. // fix: ['system.getDict("column_ui")'],
  7976. editor: {
  7977. xtype: 'combo',
  7978. allowBlank: true,
  7979. listConfig: {
  7980. minWidth: 200
  7981. },
  7982. }
  7983. },
  7984. {
  7985. text: '详细描述', dataIndex: 'column_note',
  7986. sortable: false, menuDisabled: true,
  7987. editor: { allowBlank: true, }
  7988. },
  7989. ]
  7990. },
  7991. {
  7992. title: '高级属性',
  7993. xtype: 'form',
  7994. items: [
  7995. // {
  7996. // xtype: 'textfield',
  7997. // fieldLabel: '表格名',
  7998. // bind: {
  7999. // value: '{tableName}'
  8000. // }
  8001. // },
  8002. // {
  8003. // xtype: 'textfield',
  8004. // fieldLabel: '中文含义',
  8005. // bind: {
  8006. // value: '{tableInfo.description}'
  8007. // }
  8008. // },
  8009. {
  8010. xtype: 'combo',
  8011. fieldLabel: '业务类型',
  8012. bind: {
  8013. value: '{tableInfo.biz_category}'
  8014. },
  8015. store: [
  8016. '基础资料',
  8017. '系统',
  8018. '账目与库存',
  8019. '单据',
  8020. '指令',
  8021. '规则与流程',
  8022. '开发辅助',
  8023. ]
  8024. },
  8025. {
  8026. xtype: 'textfield',
  8027. fieldLabel: '详细描述',
  8028. bind: {
  8029. value: '{tableInfo.note}'
  8030. },
  8031. },
  8032. {
  8033. xtype: 'checkbox',
  8034. fieldLabel: '允许归档',
  8035. bind: "{tableInfo.archive_enable}",
  8036. },
  8037. {
  8038. xtype: 'textfield',
  8039. fieldLabel: '归档周期',
  8040. bind: {
  8041. value: '{tableInfo.archive_cron}',
  8042. hidden: '{!tableInfo.archive_enable}',
  8043. }
  8044. },
  8045. {
  8046. xtype: 'textfield',
  8047. fieldLabel: '归档条件',
  8048. bind: {
  8049. value: '{tableInfo.archive_condition}',
  8050. hidden: '{!tableInfo.archive_enable}',
  8051. }
  8052. },
  8053. ]
  8054. },
  8055. ]
  8056. }
  8057. ]
  8058. },
  8059. ]
  8060. };
  8061. var DbColumn = /** @class */ (function (_super) {
  8062. __extends(DbColumn, _super);
  8063. function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
  8064. var _this = _super.call(this, {
  8065. model: getModel(model$5, schemaName, tableName, columnName, isCreateTable),
  8066. vjson: vjson$5
  8067. }) || this;
  8068. _this.isCreate = false;
  8069. _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
  8070. return _this;
  8071. }
  8072. DbColumn.prototype.onLoad = function () {
  8073. var _this = this;
  8074. var _a, _b, _c, _d, _e, _f, _g, _h;
  8075. console.log('me', this);
  8076. this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
  8077. this.refs.grid1.autoSizeColumns();
  8078. // this.refs.grid1.columns[0].hide()
  8079. // 自动定位到选定的列
  8080. if (this.viewModel.get('column_name')) {
  8081. for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
  8082. if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
  8083. this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
  8084. return;
  8085. }
  8086. }
  8087. }
  8088. instance.getColumnDomainComboData().then(function () {
  8089. _this.checkDomain();
  8090. });
  8091. 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 : "");
  8092. 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 : "");
  8093. if (this.isCreate)
  8094. (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
  8095. };
  8096. DbColumn.prototype.checkDomain = function () {
  8097. // 走查一遍 domain
  8098. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8099. var dbType = this.viewModel.get('tableInfo.db_type');
  8100. var diffColumnName = [];
  8101. var tableInfo = this.viewModel.get('tableInfo');
  8102. this.refs.grid1.store.data.items.forEach(function (record) {
  8103. var data = record.data;
  8104. var column_domain = data.column_domain;
  8105. var domain = instance.getColumnDomainById(column_domain);
  8106. if (!domain) {
  8107. // 没有找到 domain
  8108. return;
  8109. }
  8110. var editRow = applyDomain(dbType, domain);
  8111. // 字段跟领域做对比
  8112. var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
  8113. if (typeof compareResult === 'string') {
  8114. // 不一样的情况下,要改成一致
  8115. _$2.forOwn(editRow, function (value, key) {
  8116. // 改成与 domain 一致
  8117. record.set(key, value);
  8118. });
  8119. diffColumnName.push(data.column_name + '.' + compareResult);
  8120. }
  8121. });
  8122. if (diffColumnName.length > 0) {
  8123. showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
  8124. }
  8125. };
  8126. DbColumn.prototype.addField = function () {
  8127. this.refs.grid1.appendEditRow({
  8128. column_name: '',
  8129. column_comment: '',
  8130. is_primary_key: false,
  8131. not_null: true,
  8132. column_domain: '',
  8133. data_type: '',
  8134. column_size: 0,
  8135. decimal_digits: 0,
  8136. default_value: '',
  8137. column_dict: '',
  8138. column_ui: '',
  8139. column_note: '',
  8140. }, 'column_name');
  8141. };
  8142. DbColumn.prototype.removeField = function () {
  8143. var _this = this;
  8144. var rows = [];
  8145. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  8146. rows.push(r);
  8147. });
  8148. _$2.forEach(rows, function (r) {
  8149. _this.refs.grid1.getStore().remove(r);
  8150. });
  8151. };
  8152. DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
  8153. instance.getColumnDomainComboData().then(function (data) {
  8154. editor.cmp.columns[5].getEditor().setStore({ data: data });
  8155. });
  8156. // 被字段域锁定的内容,不允许修改
  8157. var record = context.record, field = context.field;
  8158. var domainId = record.get('column_domain');
  8159. if (!domainId) {
  8160. return;
  8161. }
  8162. var domain = instance.getColumnDomainById(domainId);
  8163. if (!domain) {
  8164. msg$1('没有找到字段域' + domainId);
  8165. return;
  8166. }
  8167. if (field === "data_type") {
  8168. // 字段类型不允许修改
  8169. context.cancel = true;
  8170. return;
  8171. }
  8172. if (domain.is_fix_size &&
  8173. (field === "column_size" ||
  8174. field === "decimal_digits")) {
  8175. // 锁定长度的情况下,大小不允许修改
  8176. context.cancel = true;
  8177. return;
  8178. }
  8179. if (domain.is_fix_default_value && field === "default_value") {
  8180. // 锁定默认值的情况下,默认值不允许修改
  8181. context.cancel = true;
  8182. return;
  8183. }
  8184. };
  8185. DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
  8186. if (!newValue) {
  8187. return;
  8188. }
  8189. var grid = editor.up('grid').ownerGrid;
  8190. var domain = instance.getColumnDomainById(newValue);
  8191. if (!domain) {
  8192. msg$1('没有找到 domain:' + newValue);
  8193. return;
  8194. }
  8195. // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
  8196. var dbType = this.viewModel.get('tableInfo.db_type');
  8197. var editRow = applyDomain(dbType, domain);
  8198. grid.setEditRow(editRow);
  8199. };
  8200. DbColumn.prototype.pullFromDb = function () {
  8201. };
  8202. DbColumn.prototype.pushToDb = function (sender) {
  8203. var _this = this;
  8204. // 设置当前界面为 "保存中..." 状态
  8205. var me = this;
  8206. var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
  8207. this.viewModel.set('tableInfo.table_name', table_name);
  8208. this.viewModel.set('tableInfo.schema_name', schema_name);
  8209. var tableInfo = this.viewModel.get('tableInfo');
  8210. var column_list = this.refs.grid1.getDataRows();
  8211. var hasError = false;
  8212. if (column_list.length <= 0) {
  8213. msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
  8214. hasError = true;
  8215. }
  8216. var columnNameExistsCheck = {};
  8217. _$2.forEach(column_list, function (row, i) {
  8218. var checkResult = checkColumn(tableInfo, row);
  8219. if (typeof checkResult !== 'undefined') {
  8220. msg$1(checkResult);
  8221. hasError = true;
  8222. _this.refs.grid1.beginEdit(i, 'column_name');
  8223. return false;
  8224. }
  8225. if (!row.column_domain || row.column_domain === '0') {
  8226. msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
  8227. hasError = true;
  8228. _this.refs.grid1.beginEdit(i, 'column_domain');
  8229. return false;
  8230. }
  8231. if (isEmpty(row.data_type)) {
  8232. msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
  8233. hasError = true;
  8234. _this.refs.grid1.beginEdit(i, 'data_type');
  8235. return false;
  8236. }
  8237. if (_$2.has(columnNameExistsCheck, row.column_name)) {
  8238. // 列名已存在
  8239. msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
  8240. hasError = true;
  8241. _this.refs.grid1.beginEdit(i, 'column_name');
  8242. return false;
  8243. }
  8244. columnNameExistsCheck[row.column_name] = true;
  8245. });
  8246. if (hasError)
  8247. return;
  8248. // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
  8249. me.setLoading(true);
  8250. instance$1.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
  8251. .then(function (res) {
  8252. var _a;
  8253. if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
  8254. // 返回 DDL 就要显示出来
  8255. var window_1 = Ext.create('Ext.window.Window', {
  8256. title: 'SQL 预览',
  8257. height: 400,
  8258. width: 600,
  8259. modal: true,
  8260. animateTarget: sender,
  8261. maximizable: true,
  8262. layout: 'fit',
  8263. items: {
  8264. xtype: 'sqleditor',
  8265. value: res.data.ddl
  8266. },
  8267. buttons: [
  8268. {
  8269. xtype: 'button',
  8270. text: '执行',
  8271. iconCls: 'x-fa fa-save',
  8272. handler: function (sender) {
  8273. var editor = sender.up('window').down('sqleditor');
  8274. var ddl = editor.getValue();
  8275. me.pushToDbCommit(schema_name, table_name, ddl, window_1);
  8276. }
  8277. },
  8278. {
  8279. xtype: 'button',
  8280. text: '取消',
  8281. iconCls: 'x-fa fa-times',
  8282. handler: function () {
  8283. window_1.close();
  8284. }
  8285. }
  8286. ]
  8287. }).show();
  8288. return;
  8289. }
  8290. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8291. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8292. if (!tableRow) {
  8293. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8294. console.log('这是一个新 table');
  8295. instance$1.appendNewTable(tableInfo);
  8296. }
  8297. _this.viewModel.set('schema_name', schema_name);
  8298. _this.viewModel.set('table_name', table_name);
  8299. _this.viewModel.set('tableInfo', tableInfo);
  8300. _this.refs.grid1.setData(tableInfo.column_list);
  8301. if (tableRow)
  8302. Object.assign(tableRow, tableInfo);
  8303. msg$1('保存成功');
  8304. _this.viewModel.set('hasChanged', false);
  8305. })
  8306. .finally(function () {
  8307. me.setLoading(false);
  8308. });
  8309. };
  8310. DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
  8311. var _this = this;
  8312. window.setLoading(true);
  8313. instance$1.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
  8314. .then(function (res) {
  8315. var _a, _b, _c, _d;
  8316. var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
  8317. // 保存成功就提示一下,并重新载入数据
  8318. msg$1(res.msg);
  8319. instance$1.reloadForce(undefined);
  8320. var tableRow = instance$1.getTableByName(schema_name, table_name);
  8321. if (!tableRow) {
  8322. // throw Error('没有找到 table', schemaName, tableName, columnName)
  8323. console.log('这是一个新 table');
  8324. instance$1.appendNewTable(tableInfo);
  8325. }
  8326. _this.viewModel.set('schema_name', schema_name);
  8327. _this.viewModel.set('table_name', table_name);
  8328. _this.viewModel.set('tableInfo', tableInfo);
  8329. _this.refs.grid1.setData(tableInfo.column_list);
  8330. if (tableRow)
  8331. Object.assign(tableRow, tableInfo);
  8332. instance$1.notifyRefresh();
  8333. window.close();
  8334. _this.viewModel.set('hasChanged', false);
  8335. _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
  8336. _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
  8337. (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
  8338. })
  8339. .finally(function () {
  8340. // 无论正常异常,关闭 "保存中..." 状态
  8341. window.setLoading(false);
  8342. });
  8343. };
  8344. DbColumn.prototype.syncQueryDSL = function () {
  8345. var _this = this;
  8346. var tableInfo = this.viewModel.get("tableInfo");
  8347. this.setLoading(true);
  8348. syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
  8349. .then(function () {
  8350. msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
  8351. })
  8352. .finally(function () {
  8353. _this.setLoading(false);
  8354. });
  8355. };
  8356. DbColumn.prototype.buildDDL = function () {
  8357. };
  8358. return DbColumn;
  8359. }(Scope));
  8360. function getModel(model, schemaName, tableName, columnName, isCreateTable) {
  8361. model.data.schema_name = schemaName;
  8362. model.data.table_name = tableName;
  8363. model.data.column_name = columnName;
  8364. if (isCreateTable) {
  8365. var dbType = instance$1.getSchemaDbType(schemaName);
  8366. if (!dbType) {
  8367. throw Error('无法识别数据库类型' + schemaName);
  8368. }
  8369. model.data.tableInfo.schema_name = model.data.schema_name;
  8370. model.data.tableInfo.table_name = model.data.table_name;
  8371. model.data.tableInfo.db_type = dbType;
  8372. model.data.tableInfo.column_list = [];
  8373. model.data.tableInfo.is_create = true;
  8374. return model;
  8375. }
  8376. var tableRow = instance$1.getTableByName(schemaName, tableName);
  8377. if (!tableRow) {
  8378. throw Error('没有找到 table' + schemaName + tableName + columnName);
  8379. }
  8380. model.data.tableInfo = _$2.cloneDeep(tableRow);
  8381. model.data.tableInfo.is_create = false;
  8382. // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
  8383. return model;
  8384. }
  8385. var model$6 = {
  8386. data: {
  8387. id: '',
  8388. path: '',
  8389. form: {
  8390. title: '',
  8391. sqlId: '',
  8392. }
  8393. }
  8394. };
  8395. var vjson$6 = {
  8396. bind: {
  8397. title: '{title}',
  8398. },
  8399. layout: 'fit',
  8400. items: [
  8401. {
  8402. layout: 'border',
  8403. items: [
  8404. {
  8405. region: 'center',
  8406. layout: 'border',
  8407. items: [
  8408. {
  8409. region: 'north',
  8410. items: [
  8411. {
  8412. xtype: 'toolbar',
  8413. border: false,
  8414. items: [
  8415. {
  8416. xtype: 'button',
  8417. text: '刷新',
  8418. iconCls: 'x-fa fa-refresh',
  8419. listeners: {
  8420. click: 'scope.load'
  8421. }
  8422. },
  8423. {
  8424. xtype: 'button',
  8425. text: '保存',
  8426. iconCls: 'x-fa fa-save',
  8427. listeners: {
  8428. click: 'scope.widgetSave'
  8429. }
  8430. },
  8431. {
  8432. xtype: 'button',
  8433. text: '预览',
  8434. iconCls: 'x-fa fa-play-circle-o',
  8435. listeners: {
  8436. //click: 'scope.preview'
  8437. }
  8438. },
  8439. {
  8440. xtype: 'textfield',
  8441. fieldLabel: '弹窗文件',
  8442. reference: "wPath",
  8443. labelWidth: 80,
  8444. //width: 200,
  8445. bind: {
  8446. value: '{widgetPath}',
  8447. },
  8448. readOnly: true,
  8449. },
  8450. {
  8451. xtype: 'textfield',
  8452. fieldLabel: '弹窗名称',
  8453. reference: "wTitle",
  8454. labelWidth: 80,
  8455. //width: 200,
  8456. bind: {
  8457. value: '{form.title}',
  8458. },
  8459. readOnly: true,
  8460. },
  8461. {
  8462. xtype: 'textfield',
  8463. fieldLabel: 'sqlId',
  8464. bind: {
  8465. value: '{form.sqlId}',
  8466. },
  8467. readOnly: true,
  8468. },
  8469. ]
  8470. },
  8471. ]
  8472. },
  8473. {
  8474. xtype: 'tabpanel', region: 'center', plain: true, border: false,
  8475. items: [
  8476. {
  8477. title: "SQL和条件",
  8478. layout: 'border',
  8479. border: false,
  8480. items: [
  8481. {
  8482. region: 'north',
  8483. height: 200,
  8484. xtype: 'yvgrid',
  8485. reference: "grid2",
  8486. split: true,
  8487. selModel: {
  8488. selType: 'rowmodel',
  8489. mode: 'SINGLE',
  8490. },
  8491. store: {},
  8492. pagination: false,
  8493. hideFootbar: true,
  8494. tbar: {
  8495. xtype: 'toolbar',
  8496. items: [
  8497. {
  8498. xtype: 'button',
  8499. text: '添加',
  8500. iconCls: 'x-fa fa-plus-circle',
  8501. listeners: {}
  8502. },
  8503. {
  8504. xtype: 'button',
  8505. text: '删除',
  8506. iconCls: 'x-fa fa-minus-circle',
  8507. listeners: {
  8508. click: 'scope.delCondition'
  8509. }
  8510. },
  8511. '-',
  8512. {
  8513. xtype: 'button',
  8514. text: '上移',
  8515. iconCls: 'x-fa fa-refresh',
  8516. listeners: {
  8517. //click: 'scope.saveAll'
  8518. }
  8519. },
  8520. {
  8521. xtype: 'button',
  8522. text: '下移',
  8523. iconCls: 'x-fa fa-refresh',
  8524. listeners: {
  8525. //click: 'scope.saveAll'
  8526. }
  8527. },
  8528. '-',
  8529. {
  8530. xtype: 'button',
  8531. text: '自动分析',
  8532. iconCls: 'x-fa fa-refresh',
  8533. listeners: {
  8534. click: 'scope.calcCondition'
  8535. }
  8536. },
  8537. ]
  8538. },
  8539. columns: [
  8540. {
  8541. text: '条件变量',
  8542. dataIndex: 'conditionFieldBind',
  8543. width: 140,
  8544. sortable: false,
  8545. menuDisabled: true,
  8546. editor: {
  8547. selectOnFocus: true
  8548. },
  8549. },
  8550. {
  8551. text: '中文标题',
  8552. dataIndex: 'conditionFieldLabel',
  8553. width: 120,
  8554. sortable: false,
  8555. menuDisabled: true,
  8556. editor: {
  8557. selectOnFocus: true
  8558. },
  8559. },
  8560. {
  8561. text: '编辑类型',
  8562. dataIndex: 'xtype',
  8563. sortable: false,
  8564. menuDisabled: true,
  8565. editor: {
  8566. xtype: 'combo',
  8567. typeAhead: true,
  8568. triggerAction: 'all',
  8569. selectOnFocus: true,
  8570. store: [
  8571. ['textfield', 'textfield'],
  8572. ['combo', 'combo'],
  8573. ['datefield', 'datefield'],
  8574. ['datetimefield', 'datetimefield'],
  8575. ['numberfield', 'numberfield'],
  8576. ['multiplesearch', 'multiplesearch'],
  8577. ]
  8578. }
  8579. },
  8580. {
  8581. text: '权重',
  8582. dataIndex: 'conditionFieldFlex',
  8583. align: 'right',
  8584. sortable: false,
  8585. menuDisabled: true,
  8586. editor: {
  8587. xtype: 'numberfield',
  8588. selectOnFocus: false,
  8589. minValue: 0,
  8590. maxValue: 10
  8591. },
  8592. },
  8593. {
  8594. text: '字典',
  8595. dataIndex: 'conditionFieldDict',
  8596. width: 160,
  8597. sortable: false,
  8598. menuDisabled: true,
  8599. editor: {
  8600. selectOnFocus: false
  8601. },
  8602. },
  8603. {
  8604. xtype: 'checkcolumn',
  8605. dataIndex: "conditionFieldWrap", header: "换行",
  8606. width: 65,
  8607. sortable: false,
  8608. menuDisabled: true,
  8609. },
  8610. ]
  8611. },
  8612. {
  8613. region: 'center',
  8614. xtype: 'sqleditor',
  8615. layout: 'fit',
  8616. reference: 'sqlEditor',
  8617. split: true,
  8618. bind: {
  8619. value: "{form.sql}"
  8620. },
  8621. },
  8622. ]
  8623. },
  8624. {
  8625. title: "结果字段定义",
  8626. border: false,
  8627. xtype: 'yvgrid',
  8628. reference: "grid3",
  8629. selModel: {
  8630. selType: 'rowmodel',
  8631. mode: 'SINGLE',
  8632. },
  8633. store: {},
  8634. pagination: false,
  8635. hideFootbar: true,
  8636. tbar: {
  8637. xtype: 'toolbar',
  8638. items: [
  8639. {
  8640. xtype: 'button',
  8641. text: '添加',
  8642. iconCls: 'x-fa fa-plus-circle',
  8643. listeners: {}
  8644. },
  8645. {
  8646. xtype: 'button',
  8647. text: '删除',
  8648. iconCls: 'x-fa fa-minus-circle',
  8649. listeners: {
  8650. click: 'scope.delColumn'
  8651. }
  8652. },
  8653. '-',
  8654. {
  8655. xtype: 'button',
  8656. text: '上移',
  8657. iconCls: 'x-fa fa-refresh',
  8658. listeners: {
  8659. //click: 'scope.saveAll'
  8660. }
  8661. },
  8662. {
  8663. xtype: 'button',
  8664. text: '下移',
  8665. iconCls: 'x-fa fa-refresh',
  8666. listeners: {
  8667. //click: 'scope.saveAll'
  8668. }
  8669. },
  8670. '-',
  8671. {
  8672. xtype: 'button',
  8673. text: '自动分析',
  8674. iconCls: 'x-fa fa-refresh',
  8675. listeners: {
  8676. click: 'scope.calcColumn'
  8677. }
  8678. },
  8679. ]
  8680. },
  8681. columns: [
  8682. { xtype: 'rownumberer' },
  8683. {
  8684. text: '字段',
  8685. dataIndex: 'dataIndex',
  8686. width: 140,
  8687. sortable: false,
  8688. menuDisabled: true,
  8689. editor: {
  8690. selectOnFocus: true
  8691. },
  8692. },
  8693. {
  8694. text: '标题',
  8695. dataIndex: 'header',
  8696. width: 120,
  8697. sortable: false,
  8698. menuDisabled: true,
  8699. editor: {
  8700. selectOnFocus: true
  8701. },
  8702. },
  8703. {
  8704. text: '显示类型',
  8705. dataIndex: 'xtype',
  8706. width: 90,
  8707. sortable: false,
  8708. menuDisabled: true,
  8709. editor: {
  8710. xtype: 'combo',
  8711. typeAhead: true,
  8712. triggerAction: 'all',
  8713. selectOnFocus: true,
  8714. store: [
  8715. ['', ''],
  8716. ['rownum', 'rownum'],
  8717. ['button', 'button'],
  8718. ['checkbox', 'checkbox'],
  8719. ['progres', 'progres'],
  8720. ]
  8721. }
  8722. },
  8723. {
  8724. text: '数据类型',
  8725. dataIndex: 'dataType',
  8726. width: 90,
  8727. sortable: false,
  8728. menuDisabled: true,
  8729. editor: {
  8730. xtype: 'combo',
  8731. typeAhead: true,
  8732. triggerAction: 'all',
  8733. selectOnFocus: true,
  8734. store: [
  8735. ['', ''],
  8736. ['string', 'string'],
  8737. ['number', 'number'],
  8738. ['date', 'date'],
  8739. ]
  8740. }
  8741. },
  8742. {
  8743. text: '数据字典',
  8744. dataIndex: 'dict',
  8745. sortable: false,
  8746. menuDisabled: true,
  8747. width: 120,
  8748. editor: {
  8749. selectOnFocus: true,
  8750. },
  8751. },
  8752. ],
  8753. },
  8754. ]
  8755. },
  8756. ]
  8757. },
  8758. ]
  8759. }
  8760. ]
  8761. }; //
  8762. //
  8763. var WidgetDesign = /** @class */ (function (_super) {
  8764. __extends(WidgetDesign, _super);
  8765. function WidgetDesign(widgetPath, widgetName) {
  8766. var _this = _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
  8767. _this.widgetPath = widgetPath;
  8768. _this.widgetName = widgetName;
  8769. return _this;
  8770. }
  8771. WidgetDesign.prototype.onLoad = function () {
  8772. if (this.widgetPath) {
  8773. this.loadForm(this.widgetPath);
  8774. this.viewModel.set("widgetPath", this.widgetPath);
  8775. this.refs.wTitle.setReadOnly(true);
  8776. this.refs.wPath.setReadOnly(true);
  8777. }
  8778. else {
  8779. this.refs.wTitle.setReadOnly(false);
  8780. this.refs.wPath.setReadOnly(false);
  8781. }
  8782. };
  8783. WidgetDesign.prototype.load = function () {
  8784. var widgetPath = this.viewModel.get("widgetPath");
  8785. if (widgetPath) {
  8786. this.loadForm(widgetPath);
  8787. }
  8788. };
  8789. WidgetDesign.prototype.loadForm = function (widgetPath) {
  8790. var _this = this;
  8791. var me = this;
  8792. me.setLoading(true);
  8793. readWidget({ widgetPath: widgetPath }).then(function (res) {
  8794. msg$1(res.msg);
  8795. if (res.success) {
  8796. _this.viewModel.set("widgetPath", widgetPath);
  8797. me.refs.grid3.getStore().removeAll();
  8798. if (res.data.form.columns) {
  8799. me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
  8800. }
  8801. _this.viewModel.set("form.title", res.data.form.title);
  8802. _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
  8803. // set sql
  8804. _this.refs.sqlEditor.setCode(res.data.sql);
  8805. }
  8806. }).finally(function () {
  8807. me.setLoading(false);
  8808. });
  8809. };
  8810. WidgetDesign.prototype.widgetAdd = function (sender) {
  8811. var _this = this;
  8812. var title = this.viewModel.get("form.title");
  8813. if (title) {
  8814. Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
  8815. if (btn == 'yes') {
  8816. alert(1);
  8817. }
  8818. else {
  8819. alert(2);
  8820. }
  8821. });
  8822. }
  8823. else {
  8824. var me_1 = this;
  8825. var win_1 = new Ext.Window({
  8826. autoDestroy: true,
  8827. title: "新建弹框",
  8828. width: 400,
  8829. height: 220,
  8830. resizable: true,
  8831. closable: true,
  8832. maximizable: true,
  8833. minimizable: true,
  8834. plain: true,
  8835. // constrainHeader: true,
  8836. constrain: true,
  8837. layout: 'fit',
  8838. animateTarget: sender,
  8839. buttonAlign: 'center',
  8840. items: [
  8841. {
  8842. xtype: "form",
  8843. layout: "hbox",
  8844. margin: '10px 20px',
  8845. border: 0,
  8846. items: [
  8847. {
  8848. flex: 1,
  8849. layout: 'vbox',
  8850. items: [
  8851. {
  8852. xtype: "textfield",
  8853. name: "widgetcode",
  8854. fieldLabel: "弹框编号",
  8855. flex: 1,
  8856. allowBlank: false,
  8857. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  8858. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  8859. labelWidth: 50,
  8860. width: "100%",
  8861. },
  8862. {
  8863. xtype: "textfield",
  8864. name: "widgetname",
  8865. fieldLabel: "弹框名称",
  8866. flex: 1,
  8867. allowBlank: false,
  8868. labelWidth: 50,
  8869. width: "100%",
  8870. },
  8871. ]
  8872. },
  8873. ]
  8874. }
  8875. ],
  8876. //窗口按钮
  8877. buttons: [
  8878. {
  8879. xtype: 'button', text: '保存', handler: function (btn) {
  8880. //窗口获取表单
  8881. var form = win_1.down('form');
  8882. var vaildSuccess = form.isValid();
  8883. if (!vaildSuccess) {
  8884. return;
  8885. }
  8886. var title = form.down('textfield[name="widgetname"]').getValue();
  8887. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  8888. me_1.viewModel.set("form.title", title);
  8889. me_1.viewModel.set("widgetPath", widgetPath);
  8890. var formdata = _this.viewModel.get("form");
  8891. saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
  8892. if (res.success) {
  8893. msg$1('添加成功');
  8894. }
  8895. me_1.loadForm(widgetPath);
  8896. win_1.close();
  8897. });
  8898. }
  8899. },
  8900. {
  8901. xtype: 'button', text: '取消', handler: function (btn) {
  8902. //窗口关闭
  8903. win_1.close();
  8904. }
  8905. }
  8906. ]
  8907. });
  8908. win_1.show();
  8909. }
  8910. };
  8911. WidgetDesign.prototype.widgetSave = function () {
  8912. var _this = this;
  8913. var _a, _b;
  8914. var widgetPath = this.viewModel.get("widgetPath");
  8915. if (!widgetPath) {
  8916. msg$1("请选择或添加弹框后再保存!");
  8917. return;
  8918. }
  8919. var title = this.viewModel.get("form.title");
  8920. if (!title) {
  8921. msg$1("请选择或添加弹框后再保存!");
  8922. return;
  8923. }
  8924. // 获取条件
  8925. 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) {
  8926. delete r.id;
  8927. return r;
  8928. });
  8929. this.viewModel.set("form.conditions", conditions);
  8930. // 获取查询列
  8931. 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) {
  8932. delete r.id;
  8933. if (r.dict) {
  8934. r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
  8935. }
  8936. return r;
  8937. });
  8938. this.viewModel.set("form.columns", columns);
  8939. // sql
  8940. var sql = this.refs.sqlEditor.getCode();
  8941. this.viewModel.set("form.sql", sql);
  8942. var form = this.viewModel.get("form");
  8943. saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
  8944. msg$1(res.msg);
  8945. if (res.success) {
  8946. msg$1('保存成功');
  8947. _this.loadForm(widgetPath);
  8948. }
  8949. }).catch(function (res) {
  8950. });
  8951. };
  8952. WidgetDesign.prototype.delCondition = function () {
  8953. var _a;
  8954. this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8955. };
  8956. WidgetDesign.prototype.delColumn = function () {
  8957. var _a;
  8958. this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
  8959. };
  8960. WidgetDesign.prototype.calcCondition = function () {
  8961. var _this = this;
  8962. var sql = this.refs.sqlEditor.getCode();
  8963. var re = sql.matchAll(/#{(.+?)}/gi);
  8964. var rows = this.refs.grid2.getDataRows();
  8965. this.refs.grid2.setLoading(true);
  8966. parseDynamicSqlApi(sql).then(function (res) {
  8967. var e_1, _a;
  8968. if (res.success) {
  8969. var tables_1 = [];
  8970. _.forEach(res.data, function (parseItem) {
  8971. var tableName = parseItem.tableName, columnName = parseItem.columnName;
  8972. if (tableName && !_.includes(tables_1, tableName)) {
  8973. tables_1.push(tableName);
  8974. }
  8975. });
  8976. var _loop_1 = function (m) {
  8977. var e_2, _a;
  8978. var columnName = m[1];
  8979. // 没有这个列才添加
  8980. if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
  8981. var meta = undefined;
  8982. try {
  8983. 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()) {
  8984. var tableName = tables_2_1.value;
  8985. meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  8986. if (meta) {
  8987. break;
  8988. }
  8989. }
  8990. }
  8991. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  8992. finally {
  8993. try {
  8994. if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
  8995. }
  8996. finally { if (e_2) throw e_2.error; }
  8997. }
  8998. if (meta) {
  8999. // 没找到元数据,直接添加
  9000. _this.refs.grid2.appendEditRow({
  9001. conditionFieldBind: columnName,
  9002. conditionFieldLabel: meta.column_comment,
  9003. conditionFieldXtype: 'textfield',
  9004. conditionFieldFlex: 1,
  9005. conditionFieldDict: '',
  9006. conditionFieldWrap: false,
  9007. });
  9008. }
  9009. else {
  9010. _this.refs.grid2.appendEditRow({
  9011. conditionFieldBind: columnName,
  9012. conditionFieldLabel: '',
  9013. conditionFieldXtype: 'textfield',
  9014. conditionFieldFlex: 1,
  9015. conditionFieldDict: '',
  9016. conditionFieldWrap: false,
  9017. });
  9018. }
  9019. }
  9020. };
  9021. try {
  9022. for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
  9023. var m = re_1_1.value;
  9024. _loop_1(m);
  9025. }
  9026. }
  9027. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  9028. finally {
  9029. try {
  9030. if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
  9031. }
  9032. finally { if (e_1) throw e_1.error; }
  9033. }
  9034. }
  9035. }).finally(function () {
  9036. _this.refs.grid2.setLoading(false);
  9037. });
  9038. };
  9039. WidgetDesign.prototype.calcColumn = function () {
  9040. var _this = this;
  9041. var sql = this.refs.sqlEditor.getCode();
  9042. var rows = this.refs.grid3.getDataRows();
  9043. this.refs.grid3.setLoading(true);
  9044. parseDynamicSqlApi(sql).then(function (res) {
  9045. _.forEach(res.data, function (parseItem) {
  9046. var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
  9047. // 是否找到重复字段
  9048. var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
  9049. if (exists) {
  9050. return;
  9051. }
  9052. if (tableName) {
  9053. // 解出表格名和字段名
  9054. var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  9055. if (meta) {
  9056. // 找到了元数据
  9057. var r = {
  9058. dataIndex: meta.column_name,
  9059. header: meta.column_comment,
  9060. xtype: '',
  9061. dataType: 'string',
  9062. dict: '',
  9063. };
  9064. if (meta.column_ui === 'combo' && meta.column_dict) {
  9065. r.dict = meta.column_dict;
  9066. }
  9067. else if (meta.column_ui === "checkbox") {
  9068. r.xtype = 'checkbox';
  9069. }
  9070. else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
  9071. r.dataType = meta.data_type;
  9072. }
  9073. _this.refs.grid3.appendEditRow(r);
  9074. return;
  9075. }
  9076. }
  9077. if (columnName) {
  9078. // 解出字段名
  9079. var r = {
  9080. dataIndex: columnName,
  9081. header: columnName,
  9082. xtype: '',
  9083. dataType: 'string',
  9084. dict: '',
  9085. };
  9086. _this.refs.grid3.appendEditRow(r);
  9087. }
  9088. });
  9089. }).finally(function () {
  9090. _this.refs.grid3.setLoading(false);
  9091. });
  9092. };
  9093. return WidgetDesign;
  9094. }(Scope));
  9095. var model$7 = {
  9096. data: {
  9097. // spreadsheet: false,
  9098. // multSelect: false,
  9099. // showCheckColumn: false,
  9100. // checkColumncheckOnly: false,
  9101. // disableSelection: false,
  9102. vjson: {
  9103. reference: '',
  9104. pagination: false,
  9105. pageSize: false,
  9106. pageSizeOption: false,
  9107. hideFootbar: false,
  9108. hideRefresh: false,
  9109. hideExport: false,
  9110. hideAutoSize: false,
  9111. hideClearFilter: false,
  9112. hideSaveGridUIConfig: false,
  9113. hideClearGridUIConfig: false,
  9114. selectMode: '',
  9115. cellediting_clicksToEdit: 1,
  9116. columnLines: false,
  9117. rowLines: false,
  9118. border: false,
  9119. autoLoad: false,
  9120. remoteSort: false,
  9121. remoteFilter: false,
  9122. enableLocking: false,
  9123. enableColumnHide: false,
  9124. enableColumnMove: false,
  9125. gridfilters: false,
  9126. enableColumnResize: false,
  9127. sortOnClick: false,
  9128. hidden: false,
  9129. cls: '',
  9130. dataSource: {
  9131. url: '',
  9132. params: {
  9133. formData: '{form}',
  9134. },
  9135. },
  9136. listeners: {
  9137. beforeselect: '',
  9138. selectionchange: '',
  9139. itemclick: '',
  9140. itemdblclick: '',
  9141. cellClick: '',
  9142. celldblclick: '',
  9143. afterrender: '',
  9144. destory: '',
  9145. }
  9146. },
  9147. }
  9148. };
  9149. var vjson$7 = {
  9150. title: '表格-高级',
  9151. height: 450,
  9152. width: 970,
  9153. layout: 'fit',
  9154. modal: true,
  9155. items: [
  9156. {
  9157. xtype: 'tabpanel',
  9158. items: [
  9159. {
  9160. title: '属性',
  9161. xtype: 'form',
  9162. scrollable: true,
  9163. items: [
  9164. {
  9165. xtype: 'cols',
  9166. items: [
  9167. {
  9168. xtype: 'textfield',
  9169. fieldLabel: '引用名',
  9170. tooltip: 'reference',
  9171. bind: '{vjson.reference}',
  9172. },
  9173. ]
  9174. },
  9175. {
  9176. xtype: 'cols',
  9177. border: false,
  9178. items: [
  9179. // 允许分页、页大小、页大小选项
  9180. // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
  9181. // 多选、显示勾选、自动勾选、
  9182. // 单击编辑、列分割线、行分割线、边框
  9183. // 数据源自动加载、后端排序、后端过滤
  9184. // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
  9185. {
  9186. xtype: 'checkbox',
  9187. fieldLabel: '允许分页',
  9188. bind: {
  9189. value: "{vjson.pagination}"
  9190. }
  9191. },
  9192. {
  9193. xtype: 'numberfield',
  9194. fieldLabel: '页大小',
  9195. bind: '{vjson.pageSize}',
  9196. },
  9197. {
  9198. xtype: 'textfield',
  9199. fieldLabel: '页大小选项',
  9200. flex: 2,
  9201. bind: '{vjson.pageSizeOption}',
  9202. },
  9203. ]
  9204. },
  9205. {
  9206. layout: 'hbox',
  9207. border: false,
  9208. items: [
  9209. {
  9210. xtype: 'combo',
  9211. fieldLabel: '选择模式',
  9212. flex: 4,
  9213. data: [
  9214. { id: 'spreadsheet', text: 'Excel模式' },
  9215. { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
  9216. { id: 'checkColumn', text: '勾选框' },
  9217. { id: 'row_mulity', text: '行选择-允许多选' },
  9218. { id: 'row_single', text: '行选择-单选' },
  9219. { id: 'disableSelection', text: '禁用' },
  9220. ],
  9221. bind: {
  9222. value: '{vjson.selectMode}'
  9223. }
  9224. }
  9225. ]
  9226. },
  9227. {
  9228. layout: 'hbox',
  9229. border: false,
  9230. defaults: {
  9231. xtype: 'checkbox',
  9232. margin: '0 15 0 0',
  9233. },
  9234. items: [
  9235. {
  9236. xtype: 'container',
  9237. margin: '3',
  9238. border: false,
  9239. width: 80,
  9240. },
  9241. {
  9242. boxLabel: '隐藏底部',
  9243. bind: {
  9244. value: "{vjson.hideFootbar}"
  9245. }
  9246. },
  9247. {
  9248. boxLabel: '隐藏刷新',
  9249. bind: {
  9250. value: "{vjson.hideRefresh}"
  9251. }
  9252. },
  9253. {
  9254. boxLabel: '隐藏导出',
  9255. bind: {
  9256. value: "{vjson.hideExport}"
  9257. }
  9258. },
  9259. {
  9260. boxLabel: '隐藏自动调宽',
  9261. bind: {
  9262. value: "{vjson.hideAutoSize}"
  9263. }
  9264. },
  9265. {
  9266. boxLabel: '隐藏清空筛选',
  9267. bind: {
  9268. value: "{vjson.hideClearFilter}"
  9269. }
  9270. },
  9271. {
  9272. boxLabel: '隐藏保存布局',
  9273. bind: {
  9274. value: "{vjson.hideSaveGridUIConfig}"
  9275. }
  9276. },
  9277. {
  9278. boxLabel: '隐藏重置布局',
  9279. bind: {
  9280. value: "{vjson.hideClearGridUIConfig}"
  9281. }
  9282. },
  9283. ]
  9284. },
  9285. {
  9286. layout: 'hbox',
  9287. border: false,
  9288. defaults: {
  9289. xtype: 'checkbox',
  9290. margin: '0 15 0 0',
  9291. },
  9292. items: [
  9293. {
  9294. xtype: 'container',
  9295. margin: '3',
  9296. border: false,
  9297. width: 80
  9298. },
  9299. {
  9300. boxLabel: '单击编辑',
  9301. bind: {
  9302. value: "{vjson.cellediting_clicksToEdit}"
  9303. }
  9304. },
  9305. {
  9306. boxLabel: '列分隔线',
  9307. bind: {
  9308. value: "{vjson.columnLines}"
  9309. }
  9310. },
  9311. {
  9312. boxLabel: '行分隔线',
  9313. bind: {
  9314. value: "{vjson.rowLines}"
  9315. }
  9316. },
  9317. {
  9318. boxLabel: '边框',
  9319. bind: {
  9320. value: "{vjson.border}"
  9321. }
  9322. },
  9323. ]
  9324. },
  9325. {
  9326. layout: 'hbox',
  9327. border: false,
  9328. defaults: {
  9329. xtype: 'checkbox',
  9330. margin: '0 15 0 0',
  9331. },
  9332. items: [
  9333. {
  9334. xtype: 'container',
  9335. margin: '3',
  9336. border: false,
  9337. width: 80
  9338. },
  9339. {
  9340. boxLabel: '数据源自动加载',
  9341. bind: {
  9342. value: "{vjson.autoLoad}"
  9343. }
  9344. },
  9345. {
  9346. boxLabel: '后端排序',
  9347. bind: {
  9348. value: "{vjson.remoteSort}"
  9349. }
  9350. },
  9351. {
  9352. boxLabel: '后端过滤',
  9353. bind: {
  9354. value: "{vjson.remoteFilter}"
  9355. }
  9356. },
  9357. ]
  9358. },
  9359. {
  9360. layout: 'hbox',
  9361. border: false,
  9362. defaults: {
  9363. xtype: 'checkbox',
  9364. margin: '0 15 0 0',
  9365. },
  9366. items: [
  9367. {
  9368. xtype: 'container',
  9369. margin: '3',
  9370. border: false,
  9371. width: 80
  9372. },
  9373. {
  9374. boxLabel: '自定义锁定',
  9375. bind: {
  9376. value: "{vjson.enableLocking}"
  9377. }
  9378. },
  9379. {
  9380. boxLabel: '自定义隐藏',
  9381. bind: {
  9382. value: "{vjson.enableColumnHide}"
  9383. }
  9384. },
  9385. {
  9386. boxLabel: '用户拖拽字段',
  9387. bind: {
  9388. value: "{vjson.enableColumnMove}"
  9389. }
  9390. },
  9391. {
  9392. boxLabel: '自定义筛选',
  9393. bind: {
  9394. value: "{vjson.gridfilters}"
  9395. }
  9396. },
  9397. {
  9398. boxLabel: '用户拖拽字段宽度',
  9399. bind: {
  9400. value: "{vjson.enableColumnResize}"
  9401. }
  9402. },
  9403. {
  9404. boxLabel: '点击列头排序',
  9405. bind: {
  9406. value: "{vjson.sortOnClick}"
  9407. }
  9408. },
  9409. {
  9410. xtype: 'checkbox',
  9411. boxLabel: '隐藏',
  9412. bind: {
  9413. value: "{vjson.hidden}"
  9414. }
  9415. },
  9416. ]
  9417. },
  9418. {
  9419. xtype: 'cols',
  9420. items: [
  9421. {
  9422. xtype: 'textfield',
  9423. fieldLabel: '样式',
  9424. bind: '{vjson.cls}',
  9425. flex: 4
  9426. },
  9427. ]
  9428. },
  9429. ]
  9430. },
  9431. {
  9432. title: '字段',
  9433. xtype: 'yvgrid',
  9434. reference: 'grid1',
  9435. pagination: false,
  9436. hideFootbar: true,
  9437. plugins: {
  9438. clipboard: true,
  9439. selectionreplicator: true
  9440. },
  9441. selModel: {
  9442. type: 'spreadsheet',
  9443. columnSelect: true,
  9444. pruneRemoved: false,
  9445. extensible: 'y'
  9446. },
  9447. listeners: {
  9448. editfinish: 'scope.gridEditFinish',
  9449. },
  9450. tbar: {
  9451. xtype: 'toolbar',
  9452. items: [
  9453. {
  9454. xtype: 'button',
  9455. text: '添加',
  9456. iconCls: 'x-fa fa-plus-circle',
  9457. listeners: {
  9458. click: 'scope.addColumn'
  9459. }
  9460. },
  9461. {
  9462. xtype: 'button',
  9463. text: '删除',
  9464. iconCls: 'x-fa fa-minus-circle',
  9465. listeners: {
  9466. click: 'scope.removeColumn'
  9467. }
  9468. },
  9469. '-',
  9470. {
  9471. xtype: 'button',
  9472. text: '自动分析',
  9473. iconCls: 'x-fa fa-code-fork',
  9474. listeners: {
  9475. click: 'scope.calcColumn'
  9476. }
  9477. },
  9478. {
  9479. xtype: 'button',
  9480. text: '上移',
  9481. iconCls: 'x-fa fa-arrow-up',
  9482. listeners: {
  9483. click: 'scope.moveUp'
  9484. }
  9485. },
  9486. {
  9487. xtype: 'button',
  9488. text: '下移',
  9489. iconCls: 'x-fa fa-arrow-down',
  9490. listeners: {
  9491. click: 'scope.moveDown'
  9492. }
  9493. },
  9494. ]
  9495. },
  9496. columns: [
  9497. { xtype: 'rownumberer' },
  9498. {
  9499. text: '字段',
  9500. dataIndex: 'dataIndex',
  9501. width: 140,
  9502. sortable: false,
  9503. menuDisabled: true,
  9504. editor: {
  9505. selectOnFocus: true,
  9506. },
  9507. },
  9508. {
  9509. text: '标题',
  9510. dataIndex: 'header',
  9511. width: 120,
  9512. sortable: false,
  9513. menuDisabled: true,
  9514. editor: {
  9515. selectOnFocus: true,
  9516. },
  9517. },
  9518. {
  9519. text: '类型',
  9520. dataIndex: 'xtype',
  9521. width: 100,
  9522. sortable: false,
  9523. menuDisabled: true,
  9524. editor: {
  9525. xtype: 'combo',
  9526. typeAhead: true,
  9527. triggerAction: 'all',
  9528. selectOnFocus: false,
  9529. listConfig: {
  9530. minWidth: 200
  9531. },
  9532. store: [
  9533. ['', '默认'],
  9534. ['rownum', 'rownum'],
  9535. ['checkcolumn', 'checkcolumn'],
  9536. ]
  9537. },
  9538. },
  9539. {
  9540. text: '数据类型',
  9541. dataIndex: 'dataType',
  9542. width: 100,
  9543. sortable: false,
  9544. menuDisabled: true,
  9545. editor: {
  9546. xtype: 'combo',
  9547. selectOnFocus: true,
  9548. listConfig: {
  9549. minWidth: 200
  9550. },
  9551. store: [
  9552. ['', '默认'],
  9553. ['string', 'string'],
  9554. ['number', 'number'],
  9555. ['date', 'date'],
  9556. ]
  9557. },
  9558. },
  9559. {
  9560. text: '编辑模式',
  9561. dataIndex: 'editor',
  9562. width: 100,
  9563. sortable: false,
  9564. menuDisabled: true,
  9565. editor: {
  9566. xtype: 'combo',
  9567. selectOnFocus: true,
  9568. listConfig: {
  9569. minWidth: 200
  9570. },
  9571. store: [
  9572. ['', ''],
  9573. ['textfield', 'textfield'],
  9574. ['numberfield', 'numberfield'],
  9575. ['combo', 'combo'],
  9576. ['combogrid', 'combogrid'],
  9577. ['datefield', 'datefield'],
  9578. ]
  9579. },
  9580. },
  9581. {
  9582. text: '宽度',
  9583. dataIndex: 'width',
  9584. align: 'right',
  9585. width: 100,
  9586. sortable: false,
  9587. menuDisabled: true,
  9588. editor: {
  9589. xtype: 'numberfield',
  9590. selectOnFocus: true,
  9591. minValue: 0,
  9592. maxValue: 1000
  9593. },
  9594. },
  9595. {
  9596. text: '权重',
  9597. dataIndex: 'flex',
  9598. align: 'right',
  9599. width: 90,
  9600. sortable: false,
  9601. menuDisabled: true,
  9602. editor: {
  9603. xtype: 'numberfield',
  9604. selectOnFocus: true,
  9605. minValue: 0,
  9606. maxValue: 10
  9607. },
  9608. },
  9609. {
  9610. text: '字典',
  9611. dataIndex: 'dict',
  9612. sortable: false,
  9613. menuDisabled: true,
  9614. width: 210,
  9615. editor: {
  9616. selectOnFocus: true,
  9617. },
  9618. },
  9619. {
  9620. text: '对齐',
  9621. dataIndex: 'align',
  9622. width: 90,
  9623. sortable: false,
  9624. menuDisabled: true,
  9625. editor: {
  9626. xtype: 'combo',
  9627. selectOnFocus: true,
  9628. listConfig: {
  9629. minWidth: 120
  9630. },
  9631. store: [
  9632. ['start', 'start'],
  9633. ['center', 'center'],
  9634. ['end', 'end'],
  9635. ]
  9636. },
  9637. },
  9638. {
  9639. text: '必填',
  9640. dataIndex: 'notAllowBlank',
  9641. width: 50,
  9642. resizable: false,
  9643. sortable: false,
  9644. menuDisabled: true,
  9645. xtype: 'checkcolumn',
  9646. },
  9647. {
  9648. text: '禁用',
  9649. dataIndex: 'disabled',
  9650. width: 50,
  9651. resizable: false,
  9652. sortable: false,
  9653. menuDisabled: true,
  9654. xtype: 'checkcolumn',
  9655. },
  9656. {
  9657. text: '禁菜',
  9658. dataIndex: 'menuDisabled',
  9659. width: 50,
  9660. resizable: false,
  9661. sortable: false,
  9662. menuDisabled: true,
  9663. xtype: 'checkcolumn',
  9664. },
  9665. {
  9666. text: '过滤',
  9667. dataIndex: 'filterable',
  9668. xtype: 'checkcolumn',
  9669. width: 50,
  9670. resizable: false,
  9671. sortable: false,
  9672. menuDisabled: true,
  9673. },
  9674. {
  9675. text: '隐藏',
  9676. dataIndex: 'hidden',
  9677. xtype: 'checkcolumn',
  9678. width: 50,
  9679. resizable: false,
  9680. sortable: false,
  9681. menuDisabled: true,
  9682. },
  9683. {
  9684. text: '可隐',
  9685. dataIndex: 'hideable',
  9686. xtype: 'checkcolumn',
  9687. width: 50,
  9688. resizable: false,
  9689. sortable: false,
  9690. menuDisabled: true,
  9691. },
  9692. {
  9693. text: '调宽',
  9694. dataIndex: 'resizable',
  9695. xtype: 'checkcolumn',
  9696. width: 50,
  9697. resizable: false,
  9698. sortable: false,
  9699. menuDisabled: true,
  9700. },
  9701. {
  9702. text: '排序',
  9703. dataIndex: 'sortable',
  9704. xtype: 'checkcolumn',
  9705. width: 50,
  9706. resizable: false,
  9707. sortable: false,
  9708. menuDisabled: true,
  9709. },
  9710. {
  9711. text: '适宽',
  9712. dataIndex: 'autoSize',
  9713. xtype: 'checkcolumn',
  9714. width: 50,
  9715. resizable: false,
  9716. sortable: false,
  9717. menuDisabled: true,
  9718. },
  9719. ],
  9720. },
  9721. {
  9722. title: '数据源',
  9723. layout: 'border',
  9724. listeners: {
  9725. activate: 'scope.dataSourceActivate'
  9726. },
  9727. items: [
  9728. {
  9729. region: 'north',
  9730. xtype: 'toolbar',
  9731. border: false,
  9732. items: [
  9733. {
  9734. xtype: 'textfield',
  9735. fieldLabel: '数据源',
  9736. flex: 1,
  9737. bind: {
  9738. value: '{vjson.dataSource.url}'
  9739. }
  9740. },
  9741. {
  9742. xtype: 'button',
  9743. text: '保存',
  9744. iconCls: 'x-fa fa-save',
  9745. listeners: {
  9746. click: 'scope.dataSourceSave'
  9747. }
  9748. },
  9749. {
  9750. xtype: 'button',
  9751. text: '读取',
  9752. iconCls: 'x-fa fa-folder-open',
  9753. listeners: {
  9754. click: 'scope.reloadSqlContent'
  9755. }
  9756. },
  9757. ]
  9758. },
  9759. {
  9760. region: 'center',
  9761. xtype: 'sqleditor',
  9762. layout: 'fit',
  9763. reference: 'sqlEditor',
  9764. },
  9765. {
  9766. region: 'south',
  9767. xtype: 'jsoneditor',
  9768. height: 200,
  9769. split: true,
  9770. collapsible: true,
  9771. title: '参数',
  9772. reference: 'sqlParams',
  9773. }
  9774. ]
  9775. },
  9776. {
  9777. title: '事件',
  9778. xtype: 'form',
  9779. scrollable: true,
  9780. margin: '10',
  9781. defaults: {
  9782. width: '100%',
  9783. labelAlign: 'top',
  9784. },
  9785. items: [
  9786. {
  9787. xtype: 'textfield',
  9788. fieldLabel: '选中前触发 beforeSelect',
  9789. bind: {
  9790. value: '{vjson.listeners.beforeselect}'
  9791. },
  9792. },
  9793. {
  9794. xtype: 'textfield',
  9795. fieldLabel: '选择范围改变 selectionChange',
  9796. bind: {
  9797. value: '{vjson.listeners.selectionchange}'
  9798. },
  9799. },
  9800. {
  9801. xtype: 'textfield',
  9802. fieldLabel: '行点击 itemClick',
  9803. bind: {
  9804. value: '{vjson.listeners.itemclick}'
  9805. },
  9806. },
  9807. {
  9808. xtype: 'textfield',
  9809. fieldLabel: '行双击 itemDblClick',
  9810. bind: {
  9811. value: '{vjson.listeners.itemdblclick}'
  9812. },
  9813. },
  9814. {
  9815. xtype: 'textfield',
  9816. fieldLabel: '单元格点击 cellClick',
  9817. bind: {
  9818. value: '{vjson.listeners.cellClick}'
  9819. },
  9820. },
  9821. {
  9822. xtype: 'textfield',
  9823. fieldLabel: '单元格双击 cellDblClick',
  9824. bind: {
  9825. value: '{vjson.listeners.celldblclick}'
  9826. },
  9827. },
  9828. {
  9829. xtype: 'textfield',
  9830. fieldLabel: '渲染后触发 afterrender',
  9831. bind: {
  9832. value: '{vjson.listeners.afterrender}'
  9833. },
  9834. },
  9835. {
  9836. xtype: 'textfield',
  9837. fieldLabel: '销毁后触发 destory',
  9838. bind: {
  9839. value: '{vjson.listeners.destory}'
  9840. },
  9841. },
  9842. ]
  9843. },
  9844. ],
  9845. }
  9846. ],
  9847. fbar: [
  9848. {
  9849. text: '应用', iconCls: 'x-fa fa-save',
  9850. listeners: {
  9851. click: 'scope.save'
  9852. }
  9853. },
  9854. '-',
  9855. {
  9856. text: '确定', iconCls: 'x-fa fa-check-circle',
  9857. listeners: {
  9858. click: 'scope.saveClose'
  9859. }
  9860. },
  9861. {
  9862. text: '取消', iconCls: 'x-fa fa-times-circle',
  9863. listeners: {
  9864. click: 'system.closeMe()'
  9865. }
  9866. },
  9867. ]
  9868. };
  9869. var checkFlags = {};
  9870. // ------------------------------------------------------------------------------------------ impls
  9871. function jsViewToVJson(modulePage, jsView) {
  9872. if (!jsView)
  9873. return {};
  9874. jsView = jsView.replace(/^\s*export\s+default/, "");
  9875. jsView = _$2.trim(jsView) || "{}";
  9876. try {
  9877. var json = dist.parse(jsView);
  9878. return modulePage.addViewId(json);
  9879. }
  9880. catch (e) {
  9881. //@ts-ignore
  9882. Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
  9883. }
  9884. }
  9885. function stringToJsonObj(jsonStr) {
  9886. if (!jsonStr)
  9887. return {};
  9888. try {
  9889. return dist.parse(jsonStr);
  9890. }
  9891. catch (e) {
  9892. return {};
  9893. }
  9894. }
  9895. /**
  9896. * 获取view.js 文件 string
  9897. */
  9898. function vjsonTojsView(vjson) {
  9899. var reVjson = _$2.cloneDeep(vjson);
  9900. removeDesignProp(reVjson);
  9901. return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
  9902. }
  9903. var ModuleStore = /** @class */ (function (_super) {
  9904. __extends(ModuleStore, _super);
  9905. function ModuleStore() {
  9906. var _this = _super.call(this) || this;
  9907. _this.store = {};
  9908. eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
  9909. var id = _a.id, module = _a.module, modulePage = _a.modulePage;
  9910. _this.addModule(id, module, modulePage);
  9911. });
  9912. eventBus.subscribe(EventType.MainTabChange, function (_a) {
  9913. var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
  9914. _this.onMainTabChange(moduleId, oldModuleId, from);
  9915. });
  9916. return _this;
  9917. }
  9918. ModuleStore.prototype.getCacheKey = function (param) {
  9919. return "filetree_data.json";
  9920. };
  9921. ModuleStore.prototype.invokeApi = function (param) {
  9922. return moduleTree();
  9923. };
  9924. ModuleStore.prototype.reloadModule = function (id) {
  9925. var moduleObject = this.store[id];
  9926. if (!moduleObject)
  9927. return;
  9928. var module = moduleObject.module;
  9929. getModuleFileContent(module).then(function (_a) {
  9930. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9931. moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
  9932. moduleObject.lastModifyTime = lastModifyTime;
  9933. moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
  9934. // 触发事件 ModuleItemChange
  9935. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9936. moduleObject.moduleEventBus.publish(EventType.SetVjson, {
  9937. vjson: moduleObject.moduleObj.vjson,
  9938. from: "reloadModule"
  9939. });
  9940. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
  9941. });
  9942. };
  9943. ModuleStore.prototype.addModule = function (id, module, modulePage) {
  9944. var _this = this;
  9945. window['mainWindow'].setLoading(true);
  9946. getModuleFileContent(module)
  9947. .then(function (_a) {
  9948. var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
  9949. var moduleObject = {
  9950. id: id, module: module,
  9951. fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
  9952. lastModifyTime: lastModifyTime,
  9953. moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
  9954. modulePage: modulePage,
  9955. moduleEventBus: modulePage.moduleEventBus
  9956. };
  9957. _this.store[id] = moduleObject;
  9958. // 触发事件 ModuleItemChange
  9959. moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
  9960. // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
  9961. eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
  9962. })
  9963. .finally(function () {
  9964. window['mainWindow'].setLoading(false);
  9965. });
  9966. };
  9967. ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
  9968. if (this.store[moduleId]) {
  9969. eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
  9970. }
  9971. };
  9972. ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
  9973. var moduleObject = this.store[id];
  9974. moduleObject.fileContent.jsController = codeValue;
  9975. };
  9976. ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
  9977. var moduleObject = this.store[id];
  9978. moduleObject.fileContent.jsView = codeValue;
  9979. moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
  9980. handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, {
  9981. vjson: moduleObject.moduleObj.vjson,
  9982. from: from
  9983. });
  9984. eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
  9985. };
  9986. ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
  9987. var moduleObject = this.store[id];
  9988. moduleObject.fileContent.jsModel = codeValue;
  9989. };
  9990. ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
  9991. var moduleObject = this.store[id];
  9992. moduleObject.fileContent.groovy = codeValue;
  9993. };
  9994. ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
  9995. var moduleObject = this.store[id];
  9996. moduleObject.fileContent.mybatis = codeValue;
  9997. };
  9998. ModuleStore.prototype.getModuleObject = function (id) {
  9999. return this.store[id];
  10000. };
  10001. ModuleStore.prototype.saveFile = function (moduleId, fileType) {
  10002. if (checkFlags[moduleId] === 1) {
  10003. // @ts-ignore
  10004. system.msg("正在检测文件是否有外部修改,请稍后操作");
  10005. }
  10006. eventBus.publish(EventType.StopCheckModule, {});
  10007. var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
  10008. var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
  10009. saveFile(fileFullPath, fileContent).then(function (res) {
  10010. if (res.data && res.data.lastModified) {
  10011. moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
  10012. }
  10013. }).finally(function () {
  10014. eventBus.publish(EventType.RunCheckModule, {});
  10015. });
  10016. };
  10017. ModuleStore.prototype.check = function (moduleId) {
  10018. {
  10019. return;
  10020. }
  10021. };
  10022. return ModuleStore;
  10023. }(CacheStore));
  10024. // ------------------------------------------------------------------------------------------ use
  10025. var moduleStore = new ModuleStore();
  10026. var VjsonExchange = /** @class */ (function () {
  10027. function VjsonExchange(vjson) {
  10028. this.pendingSet = true;
  10029. this.vjsonOrigin = _$2.cloneDeep(vjson);
  10030. this.vjson = _$2.cloneDeep(this.vjsonOrigin);
  10031. }
  10032. /**
  10033. * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
  10034. * @param propName
  10035. * @param value
  10036. */
  10037. VjsonExchange.prototype.setPropValue = function (propName, value) {
  10038. if (this.pendingSet) {
  10039. return;
  10040. }
  10041. // selectMode
  10042. // pageSizeOption
  10043. // cellediting_clicksToEdit
  10044. msg$1('' + propName + '=' + value);
  10045. _$2.set(this.vjson, propName, value);
  10046. };
  10047. /**
  10048. * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
  10049. */
  10050. VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
  10051. var _a, _b, _c;
  10052. if (this.pendingSet) {
  10053. return;
  10054. }
  10055. // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
  10056. // 如果不使用默认属性,就直接设定 undefined
  10057. var vs = {
  10058. dataIndex: undefined,
  10059. header: undefined,
  10060. xtype: '',
  10061. width: undefined,
  10062. flex: undefined,
  10063. align: 'start',
  10064. editor: undefined,
  10065. dataType: 'string',
  10066. dict: undefined,
  10067. disabled: false,
  10068. menuDisabled: false,
  10069. notAllowBlank: false,
  10070. filterable: true,
  10071. hidden: false,
  10072. hideable: true,
  10073. resizable: true,
  10074. sortable: true,
  10075. autoSize: true,
  10076. };
  10077. var raw = record.get('raw');
  10078. if (raw === undefined || raw == null) {
  10079. raw = {};
  10080. record.set('raw', raw);
  10081. }
  10082. var setRaw = function (propName, value) {
  10083. if (typeof value === 'undefined' || value == null) {
  10084. msg$1("delete columns[" + rowIdx + "]." + propName);
  10085. delete raw[propName];
  10086. return;
  10087. }
  10088. var defaultValue = vs[propName];
  10089. if (typeof defaultValue !== 'undefined' && value === defaultValue) {
  10090. // 要设的值,与默认值相同,就直接删除这个属性
  10091. msg$1("delete columns[" + rowIdx + "]." + propName);
  10092. delete raw[propName];
  10093. return;
  10094. }
  10095. msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
  10096. _$2.set(raw, propName, value);
  10097. };
  10098. if (!vs.hasOwnProperty(propName)) {
  10099. msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
  10100. return;
  10101. }
  10102. else if (propName === 'dict') {
  10103. if (value) {
  10104. setRaw('fix', ["system.getDict(\"" + value + "\")"]);
  10105. if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
  10106. setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
  10107. }
  10108. }
  10109. else {
  10110. setRaw('fix', undefined);
  10111. if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
  10112. msg$1("delete columns[" + rowIdx + "].editor.fix");
  10113. delete raw.editor.fix;
  10114. }
  10115. }
  10116. }
  10117. else if (propName === 'xtype') {
  10118. if (!value) {
  10119. setRaw('xtype', undefined);
  10120. }
  10121. else {
  10122. setRaw('xtype', value);
  10123. }
  10124. }
  10125. else if (propName === 'notAllowBlank') {
  10126. setRaw('editor.allowBlank', !value);
  10127. }
  10128. else if (propName === 'editor') {
  10129. if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
  10130. showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
  10131. value = undefined;
  10132. }
  10133. // editor.xtype
  10134. if (!value) {
  10135. // 不需要编辑器
  10136. if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
  10137. msg$1("delete columns[" + rowIdx + "].editor");
  10138. delete raw.editor;
  10139. record.set('notAllowBlank', false);
  10140. }
  10141. }
  10142. else {
  10143. setRaw('editor.xtype', value);
  10144. var dict = record.get('dict');
  10145. if (value === 'combo' && dict) {
  10146. setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
  10147. }
  10148. }
  10149. }
  10150. else if (propName === 'width') {
  10151. var width = value;
  10152. var flex = record.get('flex');
  10153. if (!width && !flex) {
  10154. setRaw('width', undefined);
  10155. setRaw('flex', undefined);
  10156. record.set('flex', undefined);
  10157. record.set('width', undefined);
  10158. return;
  10159. }
  10160. else if (!!width) {
  10161. setRaw('flex', undefined);
  10162. record.set('flex', undefined);
  10163. setRaw('width', width);
  10164. return;
  10165. }
  10166. }
  10167. else if (propName === 'flex') {
  10168. var width = record.get('width');
  10169. var flex = value;
  10170. if (!width && !flex) {
  10171. setRaw('width', undefined);
  10172. setRaw('flex', undefined);
  10173. record.set('flex', undefined);
  10174. record.set('width', undefined);
  10175. return;
  10176. }
  10177. else if (!!flex) {
  10178. setRaw('width', undefined);
  10179. record.set('width', undefined);
  10180. setRaw('flex', flex);
  10181. return;
  10182. }
  10183. }
  10184. else {
  10185. // 其他属性,作为同名属性,与 raw 同步
  10186. setRaw(propName, value);
  10187. }
  10188. };
  10189. /**
  10190. * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
  10191. */
  10192. VjsonExchange.prototype.attachViewModel = function (viewModel) {
  10193. var _this = this;
  10194. var vs = [
  10195. 'reference', 'pagination', 'pageSize',
  10196. 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
  10197. 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
  10198. 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
  10199. 'listeners.beforeselect',
  10200. 'listeners.selectionchange',
  10201. 'listeners.itemclick',
  10202. 'listeners.itemdblclick',
  10203. 'listeners.cellClick',
  10204. 'listeners.celldblclick',
  10205. 'listeners.afterrender',
  10206. 'listeners.destory',
  10207. ];
  10208. _$2.forEach(vs, function (v) {
  10209. viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
  10210. });
  10211. };
  10212. VjsonExchange.prototype.bindChangeProp = function (propName) {
  10213. var me = this;
  10214. return function (value) {
  10215. me.setPropValue(propName, value);
  10216. };
  10217. };
  10218. VjsonExchange.prototype.parseModel = function () {
  10219. var _this = this;
  10220. 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;
  10221. //@ts-ignore
  10222. var df = YvanUI.Defaults.grid;
  10223. var vjson = _$2.assign({}, df, this.vjson);
  10224. var model = {
  10225. reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
  10226. pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
  10227. pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
  10228. pageSizeOption: '["20", "50", "100", "200", "300"]',
  10229. hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
  10230. hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
  10231. hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
  10232. hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
  10233. hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
  10234. hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
  10235. hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
  10236. selectMode: 'spreadsheet',
  10237. cellediting_clicksToEdit: true,
  10238. columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
  10239. rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
  10240. border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
  10241. autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
  10242. remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
  10243. remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
  10244. enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
  10245. enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
  10246. enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
  10247. gridfilters: true,
  10248. enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
  10249. sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
  10250. hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
  10251. cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
  10252. columns: [],
  10253. listeners: {
  10254. beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
  10255. selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
  10256. itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
  10257. itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
  10258. cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
  10259. celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
  10260. afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
  10261. destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
  10262. }
  10263. };
  10264. if (_$2.isArray(this.vjson.pageSizeOption)) {
  10265. model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
  10266. }
  10267. model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
  10268. if (_$2.get(vjson, 'disableSelection') == true) {
  10269. model.selectMode = 'disableSelection';
  10270. }
  10271. else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
  10272. model.selectMode = 'spreadsheet';
  10273. }
  10274. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
  10275. model.selectMode = 'onlyCheckColumn';
  10276. }
  10277. else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
  10278. model.selectMode = 'checkColumn';
  10279. }
  10280. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
  10281. model.selectMode = 'row_mulity';
  10282. }
  10283. else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
  10284. model.selectMode = 'row_single';
  10285. }
  10286. else {
  10287. model.selectMode = 'row_single';
  10288. }
  10289. model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
  10290. if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
  10291. model.dataSource = {
  10292. url: _$2.get(vjson, 'dataSource.url'),
  10293. //@ts-ignore
  10294. params: _$2.get(vjson, 'dataSource.params')
  10295. };
  10296. }
  10297. _$2.forEach(vjson.columns, function (column) {
  10298. model.columns.push(_this.parseColumn(column));
  10299. });
  10300. return model;
  10301. };
  10302. VjsonExchange.prototype.parseColumn = function (column) {
  10303. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
  10304. var model = {
  10305. dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
  10306. header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
  10307. xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
  10308. width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
  10309. flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
  10310. align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
  10311. editor: '',
  10312. editParam: '',
  10313. dict: '',
  10314. disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
  10315. menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
  10316. notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
  10317. filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
  10318. hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
  10319. hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
  10320. resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
  10321. sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
  10322. locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
  10323. lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
  10324. autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
  10325. raw: _$2.cloneDeep(column),
  10326. };
  10327. // width / flex 只能留一个属性, 或者全不留
  10328. if (model.width <= 0 && model.flex <= 0) {
  10329. delete model.width;
  10330. delete model.flex;
  10331. }
  10332. else if (model.width > 0) {
  10333. delete model.flex;
  10334. }
  10335. else {
  10336. delete model.width;
  10337. }
  10338. // editor
  10339. if (_$2.isObject(_$2.get(column, 'editor'))) {
  10340. model.editor = _$2.get(column, 'editor.xtype');
  10341. // model.editParam = window['YvanUI'].json5.stringify(column.editor)
  10342. if (!model.editor) {
  10343. // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
  10344. model.editor = 'textfield';
  10345. }
  10346. else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
  10347. msg$1('不可识别的 editor.xtype=' + model.editor);
  10348. console.error('不可识别的 editor.xtype', column);
  10349. }
  10350. if (_$2.get(column, 'editor.allowBlank') === false) {
  10351. model.notAllowBlank = true;
  10352. }
  10353. }
  10354. // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
  10355. if (_$2.isString(_$2.get(column, 'fix[0]'))) {
  10356. var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
  10357. if (match && match[1]) {
  10358. model.dict = match[1];
  10359. }
  10360. }
  10361. return model;
  10362. };
  10363. return VjsonExchange;
  10364. }());
  10365. //
  10366. var YvgridDesign = /** @class */ (function (_super) {
  10367. __extends(YvgridDesign, _super);
  10368. function YvgridDesign(moduleId) {
  10369. var _this = _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
  10370. _this.moduleId = '';
  10371. _this.name = 'YvgridDesign';
  10372. _this.dataSourceIsActived = false;
  10373. _this.setModuleId(moduleId);
  10374. return _this;
  10375. }
  10376. YvgridDesign.prototype.setModuleId = function (moduleId) {
  10377. var _this = this;
  10378. this.moduleId = moduleId;
  10379. if (this.componentSelectionChangeSubscribe) {
  10380. this.componentSelectionChangeSubscribe.cancel();
  10381. this.componentSelectionChangeSubscribe = null;
  10382. }
  10383. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10384. var id = _a.id, from = _a.from;
  10385. _this.onComponentSelectionChange(id, from);
  10386. });
  10387. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  10388. var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
  10389. if (vj.xtype !== 'yvgrid') {
  10390. throw Error('非 yvgrid 组件');
  10391. }
  10392. this.vjsonExchange = new VjsonExchange(vj);
  10393. };
  10394. YvgridDesign.prototype.onLoad = function () {
  10395. var _this = this;
  10396. var model = this.vjsonExchange.parseModel();
  10397. this.vjsonExchange.pendingSet = true;
  10398. mergeViewModel(this.viewModel, "vjson", model, false);
  10399. this.refs.grid1.setData(model.columns);
  10400. this.vjsonExchange.attachViewModel(this.viewModel);
  10401. _$2.defer(function () {
  10402. _this.vjsonExchange.pendingSet = false;
  10403. });
  10404. };
  10405. YvgridDesign.prototype.moveUp = function (sender) {
  10406. var grid = sender.up('grid');
  10407. grid.rowMoveUp();
  10408. };
  10409. YvgridDesign.prototype.moveDown = function (sender) {
  10410. var grid = sender.up('grid');
  10411. grid.rowMoveDown();
  10412. };
  10413. YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
  10414. this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
  10415. };
  10416. YvgridDesign.prototype.reloadSqlContent = function () {
  10417. var _this = this;
  10418. var url = this.viewModel.get('vjson.dataSource.url');
  10419. if (url) {
  10420. loadSqlContentApi(url).then(function (res) {
  10421. _this.refs.sqlEditor.setCode('');
  10422. if (res.success) {
  10423. _this.refs.sqlEditor.setCode(res.data.content);
  10424. }
  10425. }).catch(function () {
  10426. _this.refs.sqlEditor.setCode('');
  10427. });
  10428. }
  10429. };
  10430. YvgridDesign.prototype.dataSourceSave = function () {
  10431. var url = this.viewModel.get('vjson.dataSource.url');
  10432. if (!url) {
  10433. msg$1('必须填写 groovy/SQL 模块路径');
  10434. return;
  10435. }
  10436. var content = this.refs.sqlEditor.getCode();
  10437. saveSqlContentApi(url, content).then(function (res) {
  10438. if (res.success) {
  10439. msg$1('保存成功');
  10440. }
  10441. else {
  10442. msg$1(res.msg);
  10443. }
  10444. });
  10445. };
  10446. YvgridDesign.prototype.dataSourceActivate = function () {
  10447. if (!this.dataSourceIsActived) {
  10448. // 激活
  10449. this.reloadSqlContent();
  10450. var params = this.viewModel.get('vjson.dataSource.params');
  10451. if (_$2.isObject(params)) {
  10452. this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
  10453. }
  10454. this.dataSourceIsActived = true;
  10455. }
  10456. };
  10457. // 外部控件选择发生改变
  10458. YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
  10459. if (!id || from === this.name) {
  10460. return;
  10461. }
  10462. this.setVjson(id);
  10463. };
  10464. YvgridDesign.prototype.setVjson = function (id) {
  10465. // 找到对应的组件 判断是不是表格
  10466. };
  10467. YvgridDesign.prototype.save = function () {
  10468. var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
  10469. if (this.dataSourceIsActived) {
  10470. var url = this.viewModel.get('vjson.dataSource.url');
  10471. // 解析 params
  10472. var paramsString = this.refs.sqlParams.getCode('');
  10473. var params = undefined;
  10474. if (paramsString) {
  10475. try {
  10476. params = window['YvanUI'].json5.parse(paramsString);
  10477. }
  10478. catch (e) {
  10479. msg$1('dataSource.params 格式非法,请检查');
  10480. return;
  10481. }
  10482. }
  10483. if (typeof params === 'undefined') {
  10484. params = this.viewModel.get('vjson.dataSource.params');
  10485. }
  10486. if (url) {
  10487. _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
  10488. _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
  10489. _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
  10490. }
  10491. else {
  10492. delete this.vjsonExchange.vjson['dataSource'];
  10493. }
  10494. }
  10495. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
  10496. cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
  10497. from: this.name,
  10498. ignoreRenderUI: false
  10499. });
  10500. };
  10501. YvgridDesign.prototype.saveClose = function () {
  10502. this.save();
  10503. this.close();
  10504. };
  10505. YvgridDesign.prototype.addColumn = function () {
  10506. this.refs.grid1.appendEditRow({
  10507. dataIndex: '',
  10508. header: '',
  10509. xtype: '',
  10510. width: 80,
  10511. align: '',
  10512. editor: '',
  10513. editParam: '',
  10514. dict: '',
  10515. disabled: false,
  10516. notAllowBlank: false,
  10517. menuDisabled: false,
  10518. filterable: false,
  10519. hidden: false,
  10520. hideable: true,
  10521. resizable: true,
  10522. sortable: true,
  10523. locked: false,
  10524. lockable: false,
  10525. autoSize: true,
  10526. raw: undefined,
  10527. }, 'header');
  10528. };
  10529. YvgridDesign.prototype.removeColumn = function () {
  10530. var _this = this;
  10531. var rows = [];
  10532. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  10533. rows.push(r);
  10534. });
  10535. _$2.forEach(rows, function (r) {
  10536. _this.refs.grid1.getStore().remove(r);
  10537. });
  10538. };
  10539. YvgridDesign.prototype.calcColumn = function () {
  10540. msg$1('暂未实现');
  10541. };
  10542. YvgridDesign.prototype.onDestroy = function () {
  10543. if (this.componentSelectionChangeSubscribe) {
  10544. this.componentSelectionChangeSubscribe.cancel();
  10545. this.componentSelectionChangeSubscribe = null;
  10546. }
  10547. };
  10548. return YvgridDesign;
  10549. }(Scope));
  10550. // export const idPrefix = "_ds_"
  10551. var _designInstance;
  10552. function setDesignInstance(instance) {
  10553. _designInstance = instance;
  10554. }
  10555. function getDesignInstance() {
  10556. return _designInstance;
  10557. }
  10558. function delegateDragmove(node, source, info) {
  10559. if (_designInstance && typeof _designInstance.dragmove === 'function') {
  10560. //@ts-ignore
  10561. _designInstance.dragmove(node, source, info);
  10562. }
  10563. }
  10564. function delegateDragend(node, source, info) {
  10565. if (_designInstance && typeof _designInstance.dragend === 'function') {
  10566. //@ts-ignore
  10567. _designInstance.dragend(node, source, info);
  10568. }
  10569. }
  10570. var YvanUI$1 = window['YvanUI'];
  10571. var _$1 = window["_"];
  10572. var Ext$1 = window['Ext'];
  10573. var $$1 = window["$"];
  10574. var historySize = 100;
  10575. var ViewDesign = /** @class */ (function () {
  10576. function ViewDesign(moduleId, reference) {
  10577. var _this = this;
  10578. this.name = "ViewDesign";
  10579. this.expandedVjsonObjArray = [];
  10580. // 编辑历史
  10581. this.undoVjsonList = [];
  10582. // 撤销历史
  10583. this.redoVjsonList = [];
  10584. // 订阅事件列表
  10585. this.subscribeList = [];
  10586. // private getOuterCopyValueTimer: any = null
  10587. /**
  10588. * 唯一编号
  10589. */
  10590. this.id = _$1.uniqueId("_dv");
  10591. this.moduleId = moduleId;
  10592. this.moduleObject = moduleStore.getModuleObject(moduleId);
  10593. this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
  10594. this.designReference = reference;
  10595. this.designElement = reference.ariaEl.dom;
  10596. this.$overlay.appendTo(this.designElement);
  10597. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  10598. // 添加到撤销
  10599. this.lastVjson = _$1.cloneDeep(this.vjson);
  10600. this.$overlay.on('contextmenu', '.studio_mask', function (event) {
  10601. event.stopPropagation();
  10602. event.preventDefault();
  10603. eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
  10604. });
  10605. this.$overlay.on('click', '.studio_mask', function (event) {
  10606. event.stopPropagation();
  10607. event.preventDefault();
  10608. _this.clearSelection();
  10609. _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
  10610. _$1.defer(function () {
  10611. _this.$overlay.focus();
  10612. });
  10613. });
  10614. this.$overlay.on('click', this.overlayClickFunction.bind(this));
  10615. this.$overlay.on('keyup', this.onKeyPress.bind(this));
  10616. this.$overlay.on('copy', this.onCopy.bind(this));
  10617. this.$overlay.on('paste', this.onPaste.bind(this));
  10618. this.$overlay.on('focus', this.onfocus.bind(this));
  10619. // this.$overlay.on('mouseenter', ()=>{
  10620. // clearTimeout(this.getOuterCopyValueTimer);
  10621. // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
  10622. // })
  10623. this.$overlay.on('mousemove', _$1.debounce(function (event) {
  10624. _this.onMousemove(event);
  10625. }, 300, { maxWait: 500 }).bind(this));
  10626. window.addEventListener('message', this.onMessageEvent.bind(this));
  10627. this.subscribe();
  10628. setDesignInstance(this);
  10629. }
  10630. // todo ======== 方法 ==========
  10631. ViewDesign.prototype.subscribe = function () {
  10632. var _this = this;
  10633. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10634. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  10635. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  10636. _this.setVjson(vjson, from, ignoreRenderUI);
  10637. }));
  10638. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  10639. var id = _a.id, from = _a.from;
  10640. _this.onComponentSelectionChange(id, from);
  10641. }));
  10642. this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
  10643. var id = _a.id, from = _a.from;
  10644. _this.onComponentDelete(id, from);
  10645. }));
  10646. };
  10647. ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
  10648. if (vjson === void 0) { vjson = this.vjson; }
  10649. if (from === void 0) { from = this.name; }
  10650. this.vjson = vjson;
  10651. if (from !== "undo" && from !== "redo") {
  10652. if (this.undoVjsonList.length >= 100) {
  10653. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  10654. }
  10655. this.undoVjsonList.push(this.lastVjson);
  10656. }
  10657. this.lastVjson = _$1.cloneDeep(vjson);
  10658. this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
  10659. };
  10660. /**
  10661. * 覆盖层点击事件
  10662. */
  10663. ViewDesign.prototype.overlayClickFunction = function (event) {
  10664. if (!event.altKey && !event.shiftKey) {
  10665. var target = this.findElByXY(event.clientX, event.clientY);
  10666. if (target) {
  10667. var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
  10668. var extHandle = Ext$1.get(target).component;
  10669. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10670. rect.x = position.x;
  10671. rect.y = position.y;
  10672. this.clearSelection();
  10673. this.appendMaskbox(rect, extHandle.id);
  10674. }
  10675. }
  10676. };
  10677. ViewDesign.prototype.findElByXY = function (x, y, dragType) {
  10678. if (dragType === void 0) { dragType = ""; }
  10679. var _a, _b, _c, _d, _e, _f, _g, _h, _j;
  10680. var ele = document.elementsFromPoint(x, y);
  10681. if (ele.length <= 1) {
  10682. return;
  10683. }
  10684. var target = null;
  10685. for (var i = 0; i < ele.length; i++) {
  10686. // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
  10687. 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) {
  10688. switch (dragType) {
  10689. case "cols-container":
  10690. if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
  10691. || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
  10692. target = ele[i];
  10693. }
  10694. break;
  10695. case "col-item":
  10696. if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
  10697. || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
  10698. target = ele[i];
  10699. }
  10700. break;
  10701. case "rows-container":
  10702. if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
  10703. || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
  10704. target = ele[i];
  10705. }
  10706. break;
  10707. case "row-item":
  10708. if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
  10709. || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
  10710. target = ele[i];
  10711. }
  10712. break;
  10713. default:
  10714. target = ele[i];
  10715. break;
  10716. }
  10717. if (target) {
  10718. break;
  10719. }
  10720. }
  10721. }
  10722. return target;
  10723. };
  10724. /**
  10725. * 清空选择项
  10726. */
  10727. ViewDesign.prototype.clearSelection = function () {
  10728. // $(this.designElement).removeClass('selected');
  10729. // // $(this.designElement).find('.selected').removeClass('selected')
  10730. // $(this.designElement).find('.ds_mask')
  10731. // .not('.mask_not_hide')
  10732. // .remove();
  10733. $$1('.studio_mask').remove();
  10734. // $(this.designElement).find('.selected').each(function () {
  10735. // $(this).removeClass('selected');
  10736. // // const extHandle = Ext.get(this).component
  10737. // // if (extHandle) {
  10738. // // extHandle.removeCls('selected')
  10739. // // }
  10740. // })
  10741. };
  10742. /**
  10743. * 添加遮罩层
  10744. */
  10745. ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
  10746. var that = this;
  10747. if (vjsonId) {
  10748. this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
  10749. }
  10750. // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
  10751. // return item === cj.xtype
  10752. // }) >= 0
  10753. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10754. 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>");
  10755. // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
  10756. this.$mask.css({
  10757. position: 'absolute',
  10758. top: top, left: left, width: width, height: height,
  10759. border: '2px dashed #1890ff',
  10760. zIndex: 100,
  10761. });
  10762. this.$mask.appendTo(this.$overlay);
  10763. this.$mask.on("click", ".ds_del", function (e) {
  10764. e.stopPropagation();
  10765. e.preventDefault();
  10766. that.deleteComponent(vjsonId);
  10767. });
  10768. // 点击选中父级
  10769. this.$mask.on('click', '.ds_parent', function (e) {
  10770. e.stopPropagation();
  10771. e.preventDefault();
  10772. that.selectParent(vjsonId);
  10773. });
  10774. var sel = document.getElementById(vjsonId);
  10775. var sVjosn = findInCode(this.vjson, vjsonId);
  10776. // 限制可以拖动的组件
  10777. if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
  10778. var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
  10779. this.dragSource = new Ext$1.drag.Source({
  10780. element: this.$mask[0],
  10781. constrain: this.$overlay[0],
  10782. listeners: {
  10783. dragmove: this.dragmove.bind(that, this.vjson),
  10784. dragend: this.dragend.bind(that, this.vjson)
  10785. },
  10786. startRect: rect,
  10787. sourceVjson: findInCode(this.vjson, vjsonId),
  10788. sourceVjsonId: vjsonId,
  10789. dragType: dragType
  10790. });
  10791. }
  10792. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
  10793. };
  10794. /**
  10795. * 选中某个选项
  10796. */
  10797. ViewDesign.prototype.setSelection = function (id) {
  10798. var _a, _b;
  10799. if (!this.designElement) {
  10800. return;
  10801. }
  10802. // 清空选中内容
  10803. this.clearSelection();
  10804. if (!id) {
  10805. return;
  10806. }
  10807. var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
  10808. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10809. rect.x = position.x;
  10810. rect.y = position.y;
  10811. this.appendMaskbox(rect, id);
  10812. };
  10813. /**
  10814. * 删除组件
  10815. * @param id
  10816. */
  10817. ViewDesign.prototype.deleteComponent = function (id) {
  10818. deletVjsonById(this.vjson, id);
  10819. this.moduleObject.modulePage.currentComponentSelectId = null;
  10820. this.setVjson();
  10821. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
  10822. this.clearSelection();
  10823. };
  10824. ViewDesign.prototype.selectParent = function (id) {
  10825. var pid = getSuperVjsonId(this.vjson, id);
  10826. this.moduleObject.modulePage.currentComponentSelectId = pid;
  10827. this.setSelection(pid);
  10828. };
  10829. // todo ====== 拖拽事件 ======
  10830. ViewDesign.prototype.dragmove = function (node, source, info) {
  10831. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10832. if (!target) {
  10833. return;
  10834. }
  10835. var rect = target.getBoundingClientRect();
  10836. var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
  10837. var extHandle = Ext$1.get(target).component;
  10838. if (!extHandle) {
  10839. return;
  10840. }
  10841. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10842. rect.x = position.x;
  10843. rect.y = position.y;
  10844. this.appendDirection(rect, extHandle.id, direction);
  10845. };
  10846. ViewDesign.prototype.dragend = function (node, source, info) {
  10847. var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
  10848. if (!target) {
  10849. return;
  10850. }
  10851. var rect = target.getBoundingClientRect();
  10852. var extHandle = Ext$1.get(target).component;
  10853. var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
  10854. if (!extHandle) {
  10855. return;
  10856. }
  10857. this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
  10858. this.removeDirection();
  10859. };
  10860. ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
  10861. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  10862. var cv = findInCode(this.vjson, vjsonId);
  10863. if (this.$direction) {
  10864. $$1('#direction' + this.id).remove();
  10865. }
  10866. // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
  10867. //
  10868. // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
  10869. if (direction) {
  10870. if (direction === "top") {
  10871. // direction = 'center'
  10872. height = height / 4;
  10873. }
  10874. else if (direction === "bottom") {
  10875. // direction = 'center'
  10876. top = top + height / 4 * 3;
  10877. height = height / 4;
  10878. }
  10879. else if (direction === "left") {
  10880. width = width / 4;
  10881. }
  10882. else if (direction === "right") {
  10883. left = left + width / 4 * 3;
  10884. width = width / 4;
  10885. }
  10886. this.$direction = $$1("<div id='direction" + this.id + "'>");
  10887. this.$direction.css({
  10888. position: 'absolute',
  10889. top: top, left: left, width: width, height: height,
  10890. // border: '2px dashed #1890ff',
  10891. background: 'rgba(40,224,218,0.75)',
  10892. zIndex: 100,
  10893. });
  10894. this.$direction.appendTo(this.$overlay);
  10895. // }
  10896. }
  10897. };
  10898. ViewDesign.prototype.removeDirection = function () {
  10899. if (this.$direction) {
  10900. this.$direction.remove();
  10901. this.$direction = null;
  10902. }
  10903. };
  10904. ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
  10905. var arrS;
  10906. if (sourceVjId) {
  10907. arrS = findArrayContainer(this.vjson, sourceVjId);
  10908. sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
  10909. var indexS = _$1.findIndex(arrS, function (v) {
  10910. return v.id === sourceVjId;
  10911. });
  10912. if (indexS < 0) {
  10913. return;
  10914. }
  10915. }
  10916. delete sourceVjson.id;
  10917. var vjsonT = findInCode(this.vjson, targetVjId);
  10918. var arrT = findArrayContainer(this.vjson, targetVjId);
  10919. var indexT = _$1.findIndex(arrT, function (v) {
  10920. return v.id === targetVjId;
  10921. });
  10922. if (indexT < 0) {
  10923. return;
  10924. }
  10925. switch (direction) {
  10926. case 'top':
  10927. case 'left':
  10928. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10929. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10930. vjsonT.items.splice(0, 0, sourceVjson);
  10931. }
  10932. else {
  10933. arrT.splice(indexT, 0, sourceVjson);
  10934. }
  10935. break;
  10936. case 'bottom':
  10937. case 'right':
  10938. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10939. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10940. vjsonT.items.push(sourceVjson);
  10941. }
  10942. else {
  10943. arrT.splice(indexT + 1, 0, sourceVjson);
  10944. }
  10945. break;
  10946. case 'center':
  10947. if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
  10948. || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
  10949. vjsonT.items.push(sourceVjson);
  10950. }
  10951. else {
  10952. arrT.splice(indexT, 1, sourceVjson);
  10953. }
  10954. break;
  10955. }
  10956. if (sourceVjId) {
  10957. deletVjsonById(this.vjson, sourceVjId);
  10958. sourceVjson.id = sourceVjId;
  10959. }
  10960. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  10961. };
  10962. // todo ======== 事件 ==========
  10963. // 接收 postMessage 事件分发
  10964. ViewDesign.prototype.onMessageEvent = function (event) {
  10965. var _a, _b;
  10966. var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
  10967. if (fucName && typeof this[fucName] === 'function') {
  10968. this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
  10969. }
  10970. };
  10971. // 接收外部选中组件事件
  10972. ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
  10973. if (from !== this.name) {
  10974. this.setSelection(id);
  10975. }
  10976. };
  10977. // 接收外部组件删除事件
  10978. ViewDesign.prototype.onComponentDelete = function (id, from) {
  10979. if (from !== this.name) {
  10980. this.deleteComponent(id);
  10981. }
  10982. };
  10983. // 组件被选中
  10984. ViewDesign.prototype.onComponentSelect = function (args) {
  10985. if (args[2] != this.moduleId) {
  10986. return;
  10987. }
  10988. if (args[0]) {
  10989. var rect = args[0];
  10990. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  10991. rect.x = position.x;
  10992. rect.y = position.y;
  10993. this.clearSelection();
  10994. this.appendMaskbox(rect, args[1]);
  10995. this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
  10996. }
  10997. };
  10998. ViewDesign.prototype.onComponentInfo = function (_a) {
  10999. var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
  11000. if (moduleId != this.moduleId) {
  11001. return;
  11002. }
  11003. if (rect) {
  11004. var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
  11005. rect.x = position.x;
  11006. rect.y = position.y;
  11007. var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
  11008. var cv_1 = findInCode(this.vjson, vjsonId);
  11009. if (this.$direction) {
  11010. $$1('#direction' + this.id).remove();
  11011. }
  11012. if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
  11013. else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
  11014. if (direction) {
  11015. if (direction === "top") {
  11016. direction = 'center';
  11017. //height = height/3
  11018. }
  11019. else if (direction === "bottom") {
  11020. direction = 'center';
  11021. // top=top+height/3*2
  11022. // height = height/3
  11023. }
  11024. else if (direction === "left") {
  11025. width = width / 3;
  11026. }
  11027. else if (direction === "right") {
  11028. left = left + width / 3 * 2;
  11029. width = width / 3;
  11030. }
  11031. this.$direction = $$1("<div id='direction" + this.id + "'>");
  11032. this.$direction.css({
  11033. position: 'absolute',
  11034. top: top, left: left, width: width, height: height,
  11035. // border: '2px dashed #1890ff',
  11036. background: 'rgba(74,106,201,0.42)',
  11037. zIndex: 100,
  11038. });
  11039. this.$direction.appendTo(this.$overlay);
  11040. }
  11041. }
  11042. console.log("direction", direction);
  11043. // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
  11044. // rect.x = position.x
  11045. // rect.y = position.y
  11046. // this.clearSelection()
  11047. // this.appendMaskbox(rect, args[1])
  11048. // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
  11049. }
  11050. };
  11051. ViewDesign.prototype.onUndo = function () {
  11052. if (this.undoVjsonList.length > 0) {
  11053. if (this.redoVjsonList.length >= 100) {
  11054. this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
  11055. }
  11056. this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11057. this.vjson = this.undoVjsonList.pop();
  11058. // this.setVjson(this.vjson, "", false, "undo")
  11059. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
  11060. }
  11061. };
  11062. ViewDesign.prototype.onRedo = function () {
  11063. if (this.redoVjsonList.length > 0) {
  11064. if (this.undoVjsonList.length >= 100) {
  11065. this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
  11066. }
  11067. this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
  11068. this.vjson = this.redoVjsonList.pop();
  11069. // this.setVjson(this.vjson, "", false, "redo")
  11070. this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
  11071. }
  11072. };
  11073. ViewDesign.prototype.onKeyPress = function (event) {
  11074. // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
  11075. // if (this.backStep()) {
  11076. // event.stopPropagation()
  11077. // event.preventDefault()
  11078. // return
  11079. // }
  11080. // }
  11081. //
  11082. // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
  11083. // if (this.recoverStep()) {
  11084. // event.stopPropagation()
  11085. // event.preventDefault()
  11086. // return
  11087. // }
  11088. // }
  11089. // if (event.key === 'ArrowUp') {
  11090. // if (this.selectParent()) {
  11091. // event.stopPropagation()
  11092. // event.preventDefault()
  11093. // return;
  11094. // }
  11095. // }
  11096. if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
  11097. this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
  11098. event.stopPropagation();
  11099. event.preventDefault();
  11100. return;
  11101. }
  11102. // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
  11103. // if (this.copyView()) {
  11104. // event.stopPropagation()
  11105. // event.preventDefault()
  11106. // return;
  11107. // }
  11108. // }
  11109. // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
  11110. // if (this.copyView(true)) {
  11111. // event.stopPropagation()
  11112. // event.preventDefault()
  11113. // return;
  11114. // }
  11115. // }
  11116. //
  11117. // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
  11118. // if (this.selectRoot()) {
  11119. // event.stopPropagation()
  11120. // event.preventDefault()
  11121. // return;
  11122. // }
  11123. //
  11124. };
  11125. ViewDesign.prototype.onCopy = function (event) {
  11126. if (this.moduleObject.modulePage.currentComponentSelectId) {
  11127. var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
  11128. if (copyVjson) {
  11129. removeDesignProp(copyVjson);
  11130. this.moduleObject.modulePage.currentCopyVjson = copyVjson;
  11131. native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
  11132. }
  11133. }
  11134. };
  11135. ViewDesign.prototype.onPaste = function (event) {
  11136. debugger;
  11137. };
  11138. ViewDesign.prototype.onfocus = function () {
  11139. console.log("getCopy");
  11140. console.log("document.activeElement", document.activeElement.id);
  11141. // clearTimeout(this.getOuterCopyValueTimer);
  11142. // native.clipboardRead()
  11143. };
  11144. ViewDesign.prototype.onMousemove = function (event) {
  11145. var _a;
  11146. if (document.activeElement.id === this.$overlay[0].id) {
  11147. // console.log(event.clientX, event.clientY)
  11148. if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
  11149. var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
  11150. // this.iframeWindow.postMessage({
  11151. // method: 'overlayGetInfo',
  11152. // args: [position, this.moduleId]
  11153. // }, '*')
  11154. }
  11155. }
  11156. };
  11157. ViewDesign.prototype.onDestroy = function () {
  11158. window.removeEventListener('message', this.onMessageEvent.bind(this));
  11159. for (var i = 0; i < this.subscribeList.length; i++) {
  11160. this.subscribeList[i].cancel();
  11161. }
  11162. };
  11163. // todo ======== 工具方法 ==========
  11164. ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
  11165. if (relative === void 0) { relative = null; }
  11166. if (from === "main" && to === "overlay") {
  11167. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11168. var x = overlayRect.x;
  11169. var y = overlayRect.y;
  11170. if (relative) {
  11171. var relativeRect = relative.getBoundingClientRect();
  11172. console.log("main->", relativeRect.x, relativeRect.y);
  11173. x = x - relativeRect.x;
  11174. y = y - relativeRect.y;
  11175. }
  11176. pos.x = pos.x - x;
  11177. pos.y = pos.y - y;
  11178. }
  11179. else if (from === "overlay" && to === "main") {
  11180. var overlayRect = this.$overlay[0].getBoundingClientRect();
  11181. var x = overlayRect.x;
  11182. var y = overlayRect.y;
  11183. if (relative) {
  11184. var relativeRect = relative.getBoundingClientRect();
  11185. console.log("iframe->", relativeRect.x, relativeRect.y);
  11186. x = x - relativeRect.x;
  11187. y = y - relativeRect.y;
  11188. }
  11189. pos.x = pos.x + x;
  11190. pos.y = pos.y + y;
  11191. }
  11192. return pos;
  11193. };
  11194. ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
  11195. if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
  11196. && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
  11197. return "center";
  11198. }
  11199. // col-item 只能放左右
  11200. if (dragType === "col-item" || dragType === "") {
  11201. if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
  11202. if (x > rect.x && x < rect.x + rect.width / 3) {
  11203. return "left";
  11204. }
  11205. else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
  11206. return "right";
  11207. }
  11208. }
  11209. }
  11210. // cols-container 只能放上下
  11211. if (dragType === "cols-container" || dragType === "") {
  11212. if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
  11213. if (y > rect.y && y < rect.y + rect.height / 3) {
  11214. return "top";
  11215. }
  11216. else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
  11217. return "bottom";
  11218. }
  11219. }
  11220. }
  11221. return "";
  11222. };
  11223. return ViewDesign;
  11224. }());
  11225. //
  11226. var model$8 = {
  11227. data: {
  11228. iframeSrc: ''
  11229. }
  11230. };
  11231. var vjson$8 = {
  11232. layout: 'fit',
  11233. border: false,
  11234. iconCls: 'x-fa fa-newspaper-o',
  11235. referenceHolder: true,
  11236. items: [
  11237. {
  11238. layout: 'border',
  11239. border: false,
  11240. items: [
  11241. {
  11242. region: 'center',
  11243. xtype: 'tabpanel',
  11244. border: false,
  11245. tabPosition: 'bottom',
  11246. reference: 'tabPanel',
  11247. listeners: {
  11248. tabchange: 'scope.tabchange'
  11249. },
  11250. defaults: {
  11251. border: false,
  11252. },
  11253. items: [
  11254. {
  11255. title: 'controller.js',
  11256. xtype: 'jseditor',
  11257. reference: 'controllerEditor',
  11258. },
  11259. {
  11260. title: 'view.design',
  11261. xtype: 'designer',
  11262. reference: 'designer',
  11263. listeners: {
  11264. afterrender: 'scope.previewRender'
  11265. },
  11266. },
  11267. {
  11268. title: 'view.js',
  11269. xtype: 'jseditor',
  11270. reference: 'viewEditor',
  11271. },
  11272. {
  11273. title: 'model.js',
  11274. xtype: 'jseditor',
  11275. reference: 'modelEditor',
  11276. },
  11277. {
  11278. title: 'groovy',
  11279. xtype: 'groovyeditor',
  11280. reference: 'groovyEditor',
  11281. },
  11282. {
  11283. title: 'SQL',
  11284. xtype: 'sqleditor',
  11285. reference: 'sqlEditor',
  11286. }
  11287. ]
  11288. }
  11289. ]
  11290. }
  11291. ]
  11292. };
  11293. var ModulePage = /** @class */ (function (_super) {
  11294. __extends(ModulePage, _super);
  11295. function ModulePage(moduleId, module) {
  11296. var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
  11297. _this.name = "ModulePage";
  11298. _this.viewDesign = null;
  11299. _this.maxViewId = 0;
  11300. _this.moduleEventBus = new EventBus();
  11301. _this.codeChange = _$2.debounce(function (code, from, e) {
  11302. try {
  11303. switch (from) {
  11304. case _this.refs.controllerEditor.name:
  11305. moduleStore.updateJsController(_this.moduleId, code, from);
  11306. break;
  11307. case _this.refs.viewEditor.name:
  11308. moduleStore.updateJsView(_this.moduleId, code, from);
  11309. break;
  11310. case _this.refs.modelEditor.name:
  11311. moduleStore.updateJsModel(_this.moduleId, code, from);
  11312. break;
  11313. case _this.refs.groovyEditor.name:
  11314. moduleStore.updateGroovy(_this.moduleId, code, from);
  11315. break;
  11316. case _this.refs.sqlEditor.name:
  11317. moduleStore.updateMybatis(_this.moduleId, code, from);
  11318. break;
  11319. }
  11320. }
  11321. catch (e) {
  11322. }
  11323. }, 500, { maxWait: 10000 });
  11324. _this.moduleId = moduleId;
  11325. _this.module = module;
  11326. _this.cancelSubscribe = [];
  11327. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
  11328. _this.initEditor(moduleItem);
  11329. }));
  11330. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  11331. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11332. _this.previewReRender();
  11333. }));
  11334. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  11335. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11336. _this.updateVjson(vjson, from, ignoreRenderUI);
  11337. }));
  11338. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
  11339. var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  11340. _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
  11341. }));
  11342. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  11343. var id = _a.id, from = _a.from;
  11344. _this.onComponentSelectionChange(id, from);
  11345. }));
  11346. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
  11347. _this.onUndo();
  11348. }));
  11349. _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
  11350. _this.onRedo();
  11351. }));
  11352. _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
  11353. _this.currentCopyVjson = stringToJsonObj(value);
  11354. }));
  11355. return _this;
  11356. }
  11357. ModulePage.prototype.onLoad = function () {
  11358. var _this = this;
  11359. // this.refs.preview.src = href
  11360. // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
  11361. this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
  11362. _this.saveCall();
  11363. }));
  11364. this.activeEditor = this.refs.controllerEditor;
  11365. this.refs.controllerEditor.modulePage = this;
  11366. this.refs.viewEditor.modulePage = this;
  11367. this.refs.modelEditor.modulePage = this;
  11368. this.refs.groovyEditor.modulePage = this;
  11369. this.refs.sqlEditor.modulePage = this;
  11370. this.refs.controllerEditor.name = "controllerEditor";
  11371. this.refs.viewEditor.name = "viewEditor";
  11372. this.refs.modelEditor.name = "modelEditor";
  11373. this.refs.groovyEditor.name = "groovyEditor";
  11374. this.refs.sqlEditor.name = "sqlEditor";
  11375. this.refs.controllerEditor.codeChange = this.codeChange;
  11376. this.refs.viewEditor.codeChange = this.codeChange;
  11377. this.refs.modelEditor.codeChange = this.codeChange;
  11378. this.refs.groovyEditor.codeChange = this.codeChange;
  11379. this.refs.sqlEditor.codeChange = this.codeChange;
  11380. };
  11381. ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
  11382. if (!cmpVjson || from === this.name) {
  11383. return;
  11384. }
  11385. var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11386. replaceVjsonById(vj, cmpVjson);
  11387. this.updateVjson(vj, from, ignoreRenderUI);
  11388. };
  11389. ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
  11390. var _this = this;
  11391. var _a, _b;
  11392. if (!vjson || from === this.name) {
  11393. return;
  11394. }
  11395. this.addViewId(vjson);
  11396. moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
  11397. moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
  11398. (_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);
  11399. this.previewReRender();
  11400. _$2.defer(function () {
  11401. _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
  11402. });
  11403. };
  11404. ModulePage.prototype.previewRender = function (sender) {
  11405. var _this = this;
  11406. var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
  11407. if (!this.designScope) {
  11408. this.designScope = new Scope({
  11409. vjson: vjson,
  11410. model: {
  11411. data: {}
  11412. }
  11413. });
  11414. }
  11415. else {
  11416. this.designScope.vjson = vjson;
  11417. }
  11418. this.designScope.showDesigner(sender, {
  11419. moduleId: this.moduleId,
  11420. });
  11421. if (this.viewDesign) {
  11422. return;
  11423. }
  11424. _$2.defer(function () {
  11425. _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
  11426. handles$1.mainWindow.setLoading(false);
  11427. });
  11428. };
  11429. ModulePage.prototype.previewReRender = function () {
  11430. var designer = this.refs.designer;
  11431. this.previewRender(designer);
  11432. };
  11433. ModulePage.prototype.initEditor = function (moduleItem) {
  11434. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
  11435. if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
  11436. return;
  11437. (_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);
  11438. (_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);
  11439. (_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);
  11440. (_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);
  11441. (_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);
  11442. };
  11443. ModulePage.prototype.onComponentSelectionChange = function (id, from) {
  11444. this.currentComponentSelectId = id;
  11445. };
  11446. ModulePage.prototype.onUndo = function () {
  11447. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11448. this.viewDesign.onUndo();
  11449. }
  11450. };
  11451. ModulePage.prototype.onRedo = function () {
  11452. if (this.activeEditor === this.refs.designer && this.viewDesign) {
  11453. this.viewDesign.onRedo();
  11454. }
  11455. };
  11456. ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  11457. this.activeEditor = newCard;
  11458. eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
  11459. };
  11460. ModulePage.prototype.saveCall = function () {
  11461. if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
  11462. moduleStore.saveFile(this.moduleId, "jsView");
  11463. }
  11464. else if (this.activeEditor === this.refs.controllerEditor) {
  11465. moduleStore.saveFile(this.moduleId, "jsController");
  11466. }
  11467. else if (this.activeEditor === this.refs.modelEditor) {
  11468. moduleStore.saveFile(this.moduleId, "jsModel");
  11469. }
  11470. else if (this.activeEditor === this.refs.groovyEditor) {
  11471. moduleStore.saveFile(this.moduleId, "groovy");
  11472. }
  11473. else if (this.activeEditor === this.refs.sqlEditor) {
  11474. moduleStore.saveFile(this.moduleId, "mybatis");
  11475. }
  11476. };
  11477. ModulePage.prototype.check = function () {
  11478. moduleStore.check(this.moduleId);
  11479. };
  11480. /**
  11481. * 为vjson添加id
  11482. * @param vjson
  11483. * @param isAll
  11484. */
  11485. ModulePage.prototype.addViewId = function (vjson, isAll) {
  11486. var _this = this;
  11487. if (isAll === void 0) { isAll = false; }
  11488. var maxIdTag = 0;
  11489. // 先提取当前的最大id
  11490. deepTravVJson(vjson, function (obj) {
  11491. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11492. return;
  11493. }
  11494. if (obj.id && obj.id.indexOf(idPrefix)) {
  11495. var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
  11496. if (sutr.length > 0) {
  11497. var tid = sutr.replace(idPrefix, "");
  11498. var idNum = parseInt(tid);
  11499. if (idNum && maxIdTag < idNum) {
  11500. maxIdTag = idNum;
  11501. }
  11502. }
  11503. }
  11504. });
  11505. // 标记最大的id号,避免重复
  11506. this.maxViewId = maxIdTag;
  11507. deepTravVJson(vjson, function (obj) {
  11508. if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
  11509. return;
  11510. }
  11511. if (!obj.hasOwnProperty('id')) {
  11512. obj.id = _this.createViewId();
  11513. }
  11514. if (!obj.hasOwnProperty('designMode')) {
  11515. obj.designMode = true;
  11516. }
  11517. // if (obj.xtype == "tabview" && obj.activeTab) {
  11518. // // 设置默认的选项
  11519. // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
  11520. // if (typeof obj.activeTab === 'number') {
  11521. // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
  11522. // } else if (typeof obj.activeTab === 'string') {
  11523. // this._tabViewSelect[obj.id] = obj.activeTab
  11524. // }
  11525. //
  11526. // }
  11527. // }
  11528. if (isAll && obj.hasOwnProperty("view")) ;
  11529. });
  11530. return vjson;
  11531. };
  11532. /**
  11533. * 为组件创建 ID
  11534. */
  11535. ModulePage.prototype.createViewId = function () {
  11536. this.maxViewId++;
  11537. return this.id + idPrefix + this.maxViewId;
  11538. };
  11539. ModulePage.prototype.onDestroy = function () {
  11540. for (var i = 0; i < this.cancelSubscribe.length; i++) {
  11541. this.cancelSubscribe[i].cancel();
  11542. }
  11543. _super.prototype.onDestroy.call(this);
  11544. };
  11545. return ModulePage;
  11546. }(Scope));
  11547. var camundaModdleDescriptor = {
  11548. "name": "Camunda",
  11549. "uri": "http://camunda.org/schema/1.0/bpmn",
  11550. "prefix": "camunda",
  11551. "xml": {
  11552. "tagAlias": "lowerCase"
  11553. },
  11554. "associations": [],
  11555. "types": [
  11556. {
  11557. "name": "Definitions",
  11558. "isAbstract": true,
  11559. "extends": [
  11560. "bpmn:Definitions"
  11561. ],
  11562. "properties": [
  11563. {
  11564. "name": "diagramRelationId",
  11565. "isAttr": true,
  11566. "type": "String"
  11567. }
  11568. ]
  11569. },
  11570. {
  11571. "name": "InOutBinding",
  11572. "superClass": [
  11573. "Element"
  11574. ],
  11575. "isAbstract": true,
  11576. "properties": [
  11577. {
  11578. "name": "source",
  11579. "isAttr": true,
  11580. "type": "String"
  11581. },
  11582. {
  11583. "name": "sourceExpression",
  11584. "isAttr": true,
  11585. "type": "String"
  11586. },
  11587. {
  11588. "name": "target",
  11589. "isAttr": true,
  11590. "type": "String"
  11591. },
  11592. {
  11593. "name": "businessKey",
  11594. "isAttr": true,
  11595. "type": "String"
  11596. },
  11597. {
  11598. "name": "local",
  11599. "isAttr": true,
  11600. "type": "Boolean",
  11601. "default": false
  11602. },
  11603. {
  11604. "name": "variables",
  11605. "isAttr": true,
  11606. "type": "String"
  11607. }
  11608. ]
  11609. },
  11610. {
  11611. "name": "In",
  11612. "superClass": [
  11613. "InOutBinding"
  11614. ],
  11615. "meta": {
  11616. "allowedIn": [
  11617. "bpmn:CallActivity",
  11618. "bpmn:SignalEventDefinition"
  11619. ]
  11620. }
  11621. },
  11622. {
  11623. "name": "Out",
  11624. "superClass": [
  11625. "InOutBinding"
  11626. ],
  11627. "meta": {
  11628. "allowedIn": [
  11629. "bpmn:CallActivity"
  11630. ]
  11631. }
  11632. },
  11633. {
  11634. "name": "AsyncCapable",
  11635. "isAbstract": true,
  11636. "extends": [
  11637. "bpmn:Activity",
  11638. "bpmn:Gateway",
  11639. "bpmn:Event"
  11640. ],
  11641. "properties": [
  11642. {
  11643. "name": "async",
  11644. "isAttr": true,
  11645. "type": "Boolean",
  11646. "default": false
  11647. },
  11648. {
  11649. "name": "asyncBefore",
  11650. "isAttr": true,
  11651. "type": "Boolean",
  11652. "default": false
  11653. },
  11654. {
  11655. "name": "asyncAfter",
  11656. "isAttr": true,
  11657. "type": "Boolean",
  11658. "default": false
  11659. },
  11660. {
  11661. "name": "exclusive",
  11662. "isAttr": true,
  11663. "type": "Boolean",
  11664. "default": true
  11665. }
  11666. ]
  11667. },
  11668. {
  11669. "name": "JobPriorized",
  11670. "isAbstract": true,
  11671. "extends": [
  11672. "bpmn:Process",
  11673. "camunda:AsyncCapable"
  11674. ],
  11675. "properties": [
  11676. {
  11677. "name": "jobPriority",
  11678. "isAttr": true,
  11679. "type": "String"
  11680. }
  11681. ]
  11682. },
  11683. {
  11684. "name": "SignalEventDefinitionExtension",
  11685. "isAbstract": true,
  11686. "extends": [
  11687. "bpmn:SignalEventDefinition"
  11688. ],
  11689. "properties": [
  11690. {
  11691. "name": "async",
  11692. "isAttr": true,
  11693. "type": "Boolean",
  11694. "default": false
  11695. }
  11696. ]
  11697. },
  11698. {
  11699. "name": "ErrorEventDefinitionExtension",
  11700. "isAbstract": true,
  11701. "extends": [
  11702. "bpmn:ErrorEventDefinition"
  11703. ],
  11704. "properties": [
  11705. {
  11706. "name": "errorCodeVariable",
  11707. "isAttr": true,
  11708. "type": "String"
  11709. },
  11710. {
  11711. "name": "errorMessageVariable",
  11712. "isAttr": true,
  11713. "type": "String"
  11714. }
  11715. ]
  11716. },
  11717. {
  11718. "name": "ErrorEventDefinition",
  11719. "superClass": [
  11720. "bpmn:ErrorEventDefinition",
  11721. "Element"
  11722. ],
  11723. "properties": [
  11724. {
  11725. "name": "expression",
  11726. "isAttr": true,
  11727. "type": "String"
  11728. }
  11729. ],
  11730. "meta": {
  11731. "allowedIn": ["bpmn:ServiceTask"]
  11732. }
  11733. },
  11734. {
  11735. "name": "Error",
  11736. "isAbstract": true,
  11737. "extends": [
  11738. "bpmn:Error"
  11739. ],
  11740. "properties": [
  11741. {
  11742. "name": "camunda:errorMessage",
  11743. "isAttr": true,
  11744. "type": "String"
  11745. }
  11746. ]
  11747. },
  11748. {
  11749. "name": "PotentialStarter",
  11750. "superClass": [
  11751. "Element"
  11752. ],
  11753. "properties": [
  11754. {
  11755. "name": "resourceAssignmentExpression",
  11756. "type": "bpmn:ResourceAssignmentExpression"
  11757. }
  11758. ]
  11759. },
  11760. {
  11761. "name": "FormSupported",
  11762. "isAbstract": true,
  11763. "extends": [
  11764. "bpmn:StartEvent",
  11765. "bpmn:UserTask"
  11766. ],
  11767. "properties": [
  11768. {
  11769. "name": "formHandlerClass",
  11770. "isAttr": true,
  11771. "type": "String"
  11772. },
  11773. {
  11774. "name": "formKey",
  11775. "isAttr": true,
  11776. "type": "String"
  11777. },
  11778. {
  11779. "name": "formRef",
  11780. "isAttr": true,
  11781. "type": "String"
  11782. },
  11783. {
  11784. "name": "formRefBinding",
  11785. "isAttr": true,
  11786. "type": "String"
  11787. },
  11788. {
  11789. "name": "formRefVersion",
  11790. "isAttr": true,
  11791. "type": "String"
  11792. }
  11793. ]
  11794. },
  11795. {
  11796. "name": "TemplateSupported",
  11797. "isAbstract": true,
  11798. "extends": [
  11799. "bpmn:Collaboration",
  11800. "bpmn:Process",
  11801. "bpmn:FlowElement"
  11802. ],
  11803. "properties": [
  11804. {
  11805. "name": "modelerTemplate",
  11806. "isAttr": true,
  11807. "type": "String"
  11808. },
  11809. {
  11810. "name": "modelerTemplateVersion",
  11811. "isAttr": true,
  11812. "type": "Integer"
  11813. }
  11814. ]
  11815. },
  11816. {
  11817. "name": "Initiator",
  11818. "isAbstract": true,
  11819. "extends": ["bpmn:StartEvent"],
  11820. "properties": [
  11821. {
  11822. "name": "initiator",
  11823. "isAttr": true,
  11824. "type": "String"
  11825. }
  11826. ]
  11827. },
  11828. {
  11829. "name": "ScriptTask",
  11830. "isAbstract": true,
  11831. "extends": [
  11832. "bpmn:ScriptTask"
  11833. ],
  11834. "properties": [
  11835. {
  11836. "name": "resultVariable",
  11837. "isAttr": true,
  11838. "type": "String"
  11839. },
  11840. {
  11841. "name": "resource",
  11842. "isAttr": true,
  11843. "type": "String"
  11844. }
  11845. ]
  11846. },
  11847. {
  11848. "name": "Process",
  11849. "isAbstract": true,
  11850. "extends": [
  11851. "bpmn:Process"
  11852. ],
  11853. "properties": [
  11854. {
  11855. "name": "candidateStarterGroups",
  11856. "isAttr": true,
  11857. "type": "String"
  11858. },
  11859. {
  11860. "name": "candidateStarterUsers",
  11861. "isAttr": true,
  11862. "type": "String"
  11863. },
  11864. {
  11865. "name": "versionTag",
  11866. "isAttr": true,
  11867. "type": "String"
  11868. },
  11869. {
  11870. "name": "historyTimeToLive",
  11871. "isAttr": true,
  11872. "type": "String"
  11873. },
  11874. {
  11875. "name": "isStartableInTasklist",
  11876. "isAttr": true,
  11877. "type": "Boolean",
  11878. "default": true
  11879. }
  11880. ]
  11881. },
  11882. {
  11883. "name": "EscalationEventDefinitionExtension",
  11884. "isAbstract": true,
  11885. "extends": [
  11886. "bpmn:EscalationEventDefinition"
  11887. ],
  11888. "properties": [
  11889. {
  11890. "name": "escalationCodeVariable",
  11891. "isAttr": true,
  11892. "type": "String"
  11893. }
  11894. ]
  11895. },
  11896. {
  11897. "name": "FormalExpression",
  11898. "isAbstract": true,
  11899. "extends": [
  11900. "bpmn:FormalExpression"
  11901. ],
  11902. "properties": [
  11903. {
  11904. "name": "resource",
  11905. "isAttr": true,
  11906. "type": "String"
  11907. }
  11908. ]
  11909. },
  11910. {
  11911. "name": "Assignable",
  11912. "extends": ["bpmn:UserTask"],
  11913. "properties": [
  11914. {
  11915. "name": "assignee",
  11916. "isAttr": true,
  11917. "type": "String"
  11918. },
  11919. {
  11920. "name": "candidateUsers",
  11921. "isAttr": true,
  11922. "type": "String"
  11923. },
  11924. {
  11925. "name": "candidateGroups",
  11926. "isAttr": true,
  11927. "type": "String"
  11928. },
  11929. {
  11930. "name": "dueDate",
  11931. "isAttr": true,
  11932. "type": "String"
  11933. },
  11934. {
  11935. "name": "followUpDate",
  11936. "isAttr": true,
  11937. "type": "String"
  11938. },
  11939. {
  11940. "name": "priority",
  11941. "isAttr": true,
  11942. "type": "String"
  11943. }
  11944. ]
  11945. },
  11946. {
  11947. "name": "CallActivity",
  11948. "extends": ["bpmn:CallActivity"],
  11949. "properties": [
  11950. {
  11951. "name": "calledElementBinding",
  11952. "isAttr": true,
  11953. "type": "String",
  11954. "default": "latest"
  11955. },
  11956. {
  11957. "name": "calledElementVersion",
  11958. "isAttr": true,
  11959. "type": "String"
  11960. },
  11961. {
  11962. "name": "calledElementVersionTag",
  11963. "isAttr": true,
  11964. "type": "String"
  11965. },
  11966. {
  11967. "name": "calledElementTenantId",
  11968. "isAttr": true,
  11969. "type": "String"
  11970. },
  11971. {
  11972. "name": "caseRef",
  11973. "isAttr": true,
  11974. "type": "String"
  11975. },
  11976. {
  11977. "name": "caseBinding",
  11978. "isAttr": true,
  11979. "type": "String",
  11980. "default": "latest"
  11981. },
  11982. {
  11983. "name": "caseVersion",
  11984. "isAttr": true,
  11985. "type": "String"
  11986. },
  11987. {
  11988. "name": "caseTenantId",
  11989. "isAttr": true,
  11990. "type": "String"
  11991. },
  11992. {
  11993. "name": "variableMappingClass",
  11994. "isAttr": true,
  11995. "type": "String"
  11996. },
  11997. {
  11998. "name": "variableMappingDelegateExpression",
  11999. "isAttr": true,
  12000. "type": "String"
  12001. }
  12002. ]
  12003. },
  12004. {
  12005. "name": "ServiceTaskLike",
  12006. "extends": [
  12007. "bpmn:ServiceTask",
  12008. "bpmn:BusinessRuleTask",
  12009. "bpmn:SendTask",
  12010. "bpmn:MessageEventDefinition"
  12011. ],
  12012. "properties": [
  12013. {
  12014. "name": "expression",
  12015. "isAttr": true,
  12016. "type": "String"
  12017. },
  12018. {
  12019. "name": "class",
  12020. "isAttr": true,
  12021. "type": "String"
  12022. },
  12023. {
  12024. "name": "delegateExpression",
  12025. "isAttr": true,
  12026. "type": "String"
  12027. },
  12028. {
  12029. "name": "resultVariable",
  12030. "isAttr": true,
  12031. "type": "String"
  12032. }
  12033. ]
  12034. },
  12035. {
  12036. "name": "DmnCapable",
  12037. "extends": [
  12038. "bpmn:BusinessRuleTask"
  12039. ],
  12040. "properties": [
  12041. {
  12042. "name": "decisionRef",
  12043. "isAttr": true,
  12044. "type": "String"
  12045. },
  12046. {
  12047. "name": "decisionRefBinding",
  12048. "isAttr": true,
  12049. "type": "String",
  12050. "default": "latest"
  12051. },
  12052. {
  12053. "name": "decisionRefVersion",
  12054. "isAttr": true,
  12055. "type": "String"
  12056. },
  12057. {
  12058. "name": "mapDecisionResult",
  12059. "isAttr": true,
  12060. "type": "String",
  12061. "default": "resultList"
  12062. },
  12063. {
  12064. "name": "decisionRefTenantId",
  12065. "isAttr": true,
  12066. "type": "String"
  12067. }
  12068. ]
  12069. },
  12070. {
  12071. "name": "ExternalCapable",
  12072. "extends": [
  12073. "camunda:ServiceTaskLike"
  12074. ],
  12075. "properties": [
  12076. {
  12077. "name": "type",
  12078. "isAttr": true,
  12079. "type": "String"
  12080. },
  12081. {
  12082. "name": "topic",
  12083. "isAttr": true,
  12084. "type": "String"
  12085. }
  12086. ]
  12087. },
  12088. {
  12089. "name": "TaskPriorized",
  12090. "extends": [
  12091. "bpmn:Process",
  12092. "camunda:ExternalCapable"
  12093. ],
  12094. "properties": [
  12095. {
  12096. "name": "taskPriority",
  12097. "isAttr": true,
  12098. "type": "String"
  12099. }
  12100. ]
  12101. },
  12102. {
  12103. "name": "Properties",
  12104. "superClass": [
  12105. "Element"
  12106. ],
  12107. "meta": {
  12108. "allowedIn": ["*"]
  12109. },
  12110. "properties": [
  12111. {
  12112. "name": "values",
  12113. "type": "Property",
  12114. "isMany": true
  12115. }
  12116. ]
  12117. },
  12118. {
  12119. "name": "Property",
  12120. "superClass": [
  12121. "Element"
  12122. ],
  12123. "properties": [
  12124. {
  12125. "name": "id",
  12126. "type": "String",
  12127. "isAttr": true
  12128. },
  12129. {
  12130. "name": "name",
  12131. "type": "String",
  12132. "isAttr": true
  12133. },
  12134. {
  12135. "name": "value",
  12136. "type": "String",
  12137. "isAttr": true
  12138. }
  12139. ]
  12140. },
  12141. {
  12142. "name": "Connector",
  12143. "superClass": [
  12144. "Element"
  12145. ],
  12146. "meta": {
  12147. "allowedIn": [
  12148. "camunda:ServiceTaskLike"
  12149. ]
  12150. },
  12151. "properties": [
  12152. {
  12153. "name": "inputOutput",
  12154. "type": "InputOutput"
  12155. },
  12156. {
  12157. "name": "connectorId",
  12158. "type": "String"
  12159. }
  12160. ]
  12161. },
  12162. {
  12163. "name": "InputOutput",
  12164. "superClass": [
  12165. "Element"
  12166. ],
  12167. "meta": {
  12168. "allowedIn": [
  12169. "bpmn:FlowNode",
  12170. "camunda:Connector"
  12171. ]
  12172. },
  12173. "properties": [
  12174. {
  12175. "name": "inputOutput",
  12176. "type": "InputOutput"
  12177. },
  12178. {
  12179. "name": "connectorId",
  12180. "type": "String"
  12181. },
  12182. {
  12183. "name": "inputParameters",
  12184. "isMany": true,
  12185. "type": "InputParameter"
  12186. },
  12187. {
  12188. "name": "outputParameters",
  12189. "isMany": true,
  12190. "type": "OutputParameter"
  12191. }
  12192. ]
  12193. },
  12194. {
  12195. "name": "InputOutputParameter",
  12196. "properties": [
  12197. {
  12198. "name": "name",
  12199. "isAttr": true,
  12200. "type": "String"
  12201. },
  12202. {
  12203. "name": "value",
  12204. "isBody": true,
  12205. "type": "String"
  12206. },
  12207. {
  12208. "name": "definition",
  12209. "type": "InputOutputParameterDefinition"
  12210. }
  12211. ]
  12212. },
  12213. {
  12214. "name": "InputOutputParameterDefinition",
  12215. "isAbstract": true
  12216. },
  12217. {
  12218. "name": "List",
  12219. "superClass": ["InputOutputParameterDefinition"],
  12220. "properties": [
  12221. {
  12222. "name": "items",
  12223. "isMany": true,
  12224. "type": "InputOutputParameterDefinition"
  12225. }
  12226. ]
  12227. },
  12228. {
  12229. "name": "Map",
  12230. "superClass": ["InputOutputParameterDefinition"],
  12231. "properties": [
  12232. {
  12233. "name": "entries",
  12234. "isMany": true,
  12235. "type": "Entry"
  12236. }
  12237. ]
  12238. },
  12239. {
  12240. "name": "Entry",
  12241. "properties": [
  12242. {
  12243. "name": "key",
  12244. "isAttr": true,
  12245. "type": "String"
  12246. },
  12247. {
  12248. "name": "value",
  12249. "isBody": true,
  12250. "type": "String"
  12251. },
  12252. {
  12253. "name": "definition",
  12254. "type": "InputOutputParameterDefinition"
  12255. }
  12256. ]
  12257. },
  12258. {
  12259. "name": "Value",
  12260. "superClass": [
  12261. "InputOutputParameterDefinition"
  12262. ],
  12263. "properties": [
  12264. {
  12265. "name": "id",
  12266. "isAttr": true,
  12267. "type": "String"
  12268. },
  12269. {
  12270. "name": "name",
  12271. "isAttr": true,
  12272. "type": "String"
  12273. },
  12274. {
  12275. "name": "value",
  12276. "isBody": true,
  12277. "type": "String"
  12278. }
  12279. ]
  12280. },
  12281. {
  12282. "name": "Script",
  12283. "superClass": ["InputOutputParameterDefinition"],
  12284. "properties": [
  12285. {
  12286. "name": "scriptFormat",
  12287. "isAttr": true,
  12288. "type": "String"
  12289. },
  12290. {
  12291. "name": "resource",
  12292. "isAttr": true,
  12293. "type": "String"
  12294. },
  12295. {
  12296. "name": "value",
  12297. "isBody": true,
  12298. "type": "String"
  12299. }
  12300. ]
  12301. },
  12302. {
  12303. "name": "Field",
  12304. "superClass": ["Element"],
  12305. "meta": {
  12306. "allowedIn": [
  12307. "camunda:ServiceTaskLike",
  12308. "camunda:ExecutionListener",
  12309. "camunda:TaskListener"
  12310. ]
  12311. },
  12312. "properties": [
  12313. {
  12314. "name": "name",
  12315. "isAttr": true,
  12316. "type": "String"
  12317. },
  12318. {
  12319. "name": "expression",
  12320. "type": "String"
  12321. },
  12322. {
  12323. "name": "stringValue",
  12324. "isAttr": true,
  12325. "type": "String"
  12326. },
  12327. {
  12328. "name": "string",
  12329. "type": "String"
  12330. }
  12331. ]
  12332. },
  12333. {
  12334. "name": "InputParameter",
  12335. "superClass": ["InputOutputParameter"]
  12336. },
  12337. {
  12338. "name": "OutputParameter",
  12339. "superClass": ["InputOutputParameter"]
  12340. },
  12341. {
  12342. "name": "Collectable",
  12343. "isAbstract": true,
  12344. "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
  12345. "superClass": ["camunda:AsyncCapable"],
  12346. "properties": [
  12347. {
  12348. "name": "collection",
  12349. "isAttr": true,
  12350. "type": "String"
  12351. },
  12352. {
  12353. "name": "elementVariable",
  12354. "isAttr": true,
  12355. "type": "String"
  12356. }
  12357. ]
  12358. },
  12359. {
  12360. "name": "FailedJobRetryTimeCycle",
  12361. "superClass": ["Element"],
  12362. "meta": {
  12363. "allowedIn": [
  12364. "camunda:AsyncCapable",
  12365. "bpmn:MultiInstanceLoopCharacteristics"
  12366. ]
  12367. },
  12368. "properties": [
  12369. {
  12370. "name": "body",
  12371. "isBody": true,
  12372. "type": "String"
  12373. }
  12374. ]
  12375. },
  12376. {
  12377. "name": "ExecutionListener",
  12378. "superClass": ["Element"],
  12379. "meta": {
  12380. "allowedIn": [
  12381. "bpmn:Task",
  12382. "bpmn:ServiceTask",
  12383. "bpmn:UserTask",
  12384. "bpmn:BusinessRuleTask",
  12385. "bpmn:ScriptTask",
  12386. "bpmn:ReceiveTask",
  12387. "bpmn:ManualTask",
  12388. "bpmn:ExclusiveGateway",
  12389. "bpmn:SequenceFlow",
  12390. "bpmn:ParallelGateway",
  12391. "bpmn:InclusiveGateway",
  12392. "bpmn:EventBasedGateway",
  12393. "bpmn:StartEvent",
  12394. "bpmn:IntermediateCatchEvent",
  12395. "bpmn:IntermediateThrowEvent",
  12396. "bpmn:EndEvent",
  12397. "bpmn:BoundaryEvent",
  12398. "bpmn:CallActivity",
  12399. "bpmn:SubProcess",
  12400. "bpmn:Process"
  12401. ]
  12402. },
  12403. "properties": [
  12404. {
  12405. "name": "expression",
  12406. "isAttr": true,
  12407. "type": "String"
  12408. },
  12409. {
  12410. "name": "class",
  12411. "isAttr": true,
  12412. "type": "String"
  12413. },
  12414. {
  12415. "name": "delegateExpression",
  12416. "isAttr": true,
  12417. "type": "String"
  12418. },
  12419. {
  12420. "name": "event",
  12421. "isAttr": true,
  12422. "type": "String"
  12423. },
  12424. {
  12425. "name": "script",
  12426. "type": "Script"
  12427. },
  12428. {
  12429. "name": "fields",
  12430. "type": "Field",
  12431. "isMany": true
  12432. }
  12433. ]
  12434. },
  12435. {
  12436. "name": "TaskListener",
  12437. "superClass": ["Element"],
  12438. "meta": {
  12439. "allowedIn": [
  12440. "bpmn:UserTask"
  12441. ]
  12442. },
  12443. "properties": [
  12444. {
  12445. "name": "expression",
  12446. "isAttr": true,
  12447. "type": "String"
  12448. },
  12449. {
  12450. "name": "class",
  12451. "isAttr": true,
  12452. "type": "String"
  12453. },
  12454. {
  12455. "name": "delegateExpression",
  12456. "isAttr": true,
  12457. "type": "String"
  12458. },
  12459. {
  12460. "name": "event",
  12461. "isAttr": true,
  12462. "type": "String"
  12463. },
  12464. {
  12465. "name": "script",
  12466. "type": "Script"
  12467. },
  12468. {
  12469. "name": "fields",
  12470. "type": "Field",
  12471. "isMany": true
  12472. },
  12473. {
  12474. "name": "id",
  12475. "type": "String",
  12476. "isAttr": true
  12477. },
  12478. {
  12479. "name": "eventDefinitions",
  12480. "type": "bpmn:TimerEventDefinition",
  12481. "isMany": true
  12482. }
  12483. ]
  12484. },
  12485. {
  12486. "name": "FormProperty",
  12487. "superClass": ["Element"],
  12488. "meta": {
  12489. "allowedIn": [
  12490. "bpmn:StartEvent",
  12491. "bpmn:UserTask"
  12492. ]
  12493. },
  12494. "properties": [
  12495. {
  12496. "name": "id",
  12497. "type": "String",
  12498. "isAttr": true
  12499. },
  12500. {
  12501. "name": "name",
  12502. "type": "String",
  12503. "isAttr": true
  12504. },
  12505. {
  12506. "name": "type",
  12507. "type": "String",
  12508. "isAttr": true
  12509. },
  12510. {
  12511. "name": "required",
  12512. "type": "String",
  12513. "isAttr": true
  12514. },
  12515. {
  12516. "name": "readable",
  12517. "type": "String",
  12518. "isAttr": true
  12519. },
  12520. {
  12521. "name": "writable",
  12522. "type": "String",
  12523. "isAttr": true
  12524. },
  12525. {
  12526. "name": "variable",
  12527. "type": "String",
  12528. "isAttr": true
  12529. },
  12530. {
  12531. "name": "expression",
  12532. "type": "String",
  12533. "isAttr": true
  12534. },
  12535. {
  12536. "name": "datePattern",
  12537. "type": "String",
  12538. "isAttr": true
  12539. },
  12540. {
  12541. "name": "default",
  12542. "type": "String",
  12543. "isAttr": true
  12544. },
  12545. {
  12546. "name": "values",
  12547. "type": "Value",
  12548. "isMany": true
  12549. }
  12550. ]
  12551. },
  12552. {
  12553. "name": "FormData",
  12554. "superClass": ["Element"],
  12555. "meta": {
  12556. "allowedIn": [
  12557. "bpmn:StartEvent",
  12558. "bpmn:UserTask"
  12559. ]
  12560. },
  12561. "properties": [
  12562. {
  12563. "name": "fields",
  12564. "type": "FormField",
  12565. "isMany": true
  12566. },
  12567. {
  12568. "name": "businessKey",
  12569. "type": "String",
  12570. "isAttr": true
  12571. }
  12572. ]
  12573. },
  12574. {
  12575. "name": "FormField",
  12576. "superClass": ["Element"],
  12577. "properties": [
  12578. {
  12579. "name": "id",
  12580. "type": "String",
  12581. "isAttr": true
  12582. },
  12583. {
  12584. "name": "label",
  12585. "type": "String",
  12586. "isAttr": true
  12587. },
  12588. {
  12589. "name": "type",
  12590. "type": "String",
  12591. "isAttr": true
  12592. },
  12593. {
  12594. "name": "datePattern",
  12595. "type": "String",
  12596. "isAttr": true
  12597. },
  12598. {
  12599. "name": "defaultValue",
  12600. "type": "String",
  12601. "isAttr": true
  12602. },
  12603. {
  12604. "name": "properties",
  12605. "type": "Properties"
  12606. },
  12607. {
  12608. "name": "validation",
  12609. "type": "Validation"
  12610. },
  12611. {
  12612. "name": "values",
  12613. "type": "Value",
  12614. "isMany": true
  12615. }
  12616. ]
  12617. },
  12618. {
  12619. "name": "Validation",
  12620. "superClass": ["Element"],
  12621. "properties": [
  12622. {
  12623. "name": "constraints",
  12624. "type": "Constraint",
  12625. "isMany": true
  12626. }
  12627. ]
  12628. },
  12629. {
  12630. "name": "Constraint",
  12631. "superClass": ["Element"],
  12632. "properties": [
  12633. {
  12634. "name": "name",
  12635. "type": "String",
  12636. "isAttr": true
  12637. },
  12638. {
  12639. "name": "config",
  12640. "type": "String",
  12641. "isAttr": true
  12642. }
  12643. ]
  12644. },
  12645. {
  12646. "name": "ConditionalEventDefinitionExtension",
  12647. "isAbstract": true,
  12648. "extends": [
  12649. "bpmn:ConditionalEventDefinition"
  12650. ],
  12651. "properties": [
  12652. {
  12653. "name": "variableName",
  12654. "isAttr": true,
  12655. "type": "String"
  12656. },
  12657. {
  12658. "name": "variableEvents",
  12659. "isAttr": true,
  12660. "type": "String"
  12661. }
  12662. ]
  12663. }
  12664. ],
  12665. "emumerations": []
  12666. };
  12667. /**
  12668. * This is a sample file that should be replaced with the actual translation.
  12669. *
  12670. * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
  12671. * translations and labels to translate.
  12672. */
  12673. var translations = {
  12674. // Labels
  12675. 'Activate the global connect tool': '激活全局连接工具',
  12676. 'Append {type}': '追加 {type}',
  12677. 'Append EndEvent': '追加 结束事件 ',
  12678. 'Append Task': '追加 任务',
  12679. 'Append Gateway': '追加 网关',
  12680. 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
  12681. 'Add Lane above': '在上面添加道',
  12682. 'Divide into two Lanes': '分割成两个道',
  12683. 'Divide into three Lanes': '分割成三个道',
  12684. 'Add Lane below': '在下面添加道',
  12685. 'Append compensation activity': '追加补偿活动',
  12686. 'Change type': '修改类型',
  12687. 'Connect using Association': '使用关联连接',
  12688. 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
  12689. 'Connect using DataInputAssociation': '使用数据输入关联连接',
  12690. 'Remove': '移除',
  12691. 'Activate the hand tool': '激活抓手工具',
  12692. 'Activate the lasso tool': '激活套索工具',
  12693. 'Activate the create/remove space tool': '激活创建/删除空间工具',
  12694. 'Create expanded SubProcess': '创建扩展子过程',
  12695. 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
  12696. 'Create Pool/Participant': '创建池/参与者',
  12697. 'Parallel Multi Instance': '并行多重事件',
  12698. 'Sequential Multi Instance': '时序多重事件',
  12699. 'DataObjectReference': '数据对象参考',
  12700. 'DataStoreReference': '数据存储参考',
  12701. 'Loop': '循环',
  12702. 'Ad-hoc': '即席',
  12703. 'Create {type}': '创建 {type}',
  12704. 'Create Task': '创建任务',
  12705. 'Create StartEvent': '创建开始事件',
  12706. 'Create EndEvent': '创建结束事件',
  12707. 'Create Group': '创建组',
  12708. 'Task': '任务',
  12709. 'Send Task': '发送任务',
  12710. 'Receive Task': '接收任务',
  12711. 'User Task': '用户任务',
  12712. 'Manual Task': '手工任务',
  12713. 'Business Rule Task': '业务规则任务',
  12714. 'Service Task': '服务任务',
  12715. 'Script Task': '脚本任务',
  12716. 'Call Activity': '调用活动',
  12717. 'Sub Process (collapsed)': '子流程(折叠的)',
  12718. 'Sub Process (expanded)': '子流程(展开的)',
  12719. 'Start Event': '开始事件',
  12720. 'StartEvent': '开始事件',
  12721. 'Intermediate Throw Event': '中间事件',
  12722. 'End Event': '结束事件',
  12723. 'EndEvent': '结束事件',
  12724. 'Create Gateway': '创建网关',
  12725. 'GateWay': '网关',
  12726. 'Create Intermediate/Boundary Event': '创建中间/边界事件',
  12727. 'Message Start Event': '消息开始事件',
  12728. 'Timer Start Event': '定时开始事件',
  12729. 'Conditional Start Event': '条件开始事件',
  12730. 'Signal Start Event': '信号开始事件',
  12731. 'Error Start Event': '错误开始事件',
  12732. 'Escalation Start Event': '升级开始事件',
  12733. 'Compensation Start Event': '补偿开始事件',
  12734. 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
  12735. 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
  12736. 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
  12737. 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
  12738. 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
  12739. 'Message Intermediate Catch Event': '消息中间捕获事件',
  12740. 'Message Intermediate Throw Event': '消息中间抛出事件',
  12741. 'Timer Intermediate Catch Event': '定时中间捕获事件',
  12742. 'Escalation Intermediate Throw Event': '升级中间抛出事件',
  12743. 'Conditional Intermediate Catch Event': '条件中间捕获事件',
  12744. 'Link Intermediate Catch Event': '链接中间捕获事件',
  12745. 'Link Intermediate Throw Event': '链接中间抛出事件',
  12746. 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
  12747. 'Signal Intermediate Catch Event': '信号中间捕获事件',
  12748. 'Signal Intermediate Throw Event': '信号中间抛出事件',
  12749. 'Message End Event': '消息结束事件',
  12750. 'Escalation End Event': '定时结束事件',
  12751. 'Error End Event': '错误结束事件',
  12752. 'Cancel End Event': '取消结束事件',
  12753. 'Compensation End Event': '补偿结束事件',
  12754. 'Signal End Event': '信号结束事件',
  12755. 'Terminate End Event': '终止结束事件',
  12756. 'Message Boundary Event': '消息边界事件',
  12757. 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
  12758. 'Timer Boundary Event': '定时边界事件',
  12759. 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
  12760. 'Escalation Boundary Event': '升级边界事件',
  12761. 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
  12762. 'Conditional Boundary Event': '条件边界事件',
  12763. 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
  12764. 'Error Boundary Event': '错误边界事件',
  12765. 'Cancel Boundary Event': '取消边界事件',
  12766. 'Signal Boundary Event': '信号边界事件',
  12767. 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
  12768. 'Compensation Boundary Event': '补偿边界事件',
  12769. 'Exclusive Gateway': '互斥网关',
  12770. 'Parallel Gateway': '并行网关',
  12771. 'Inclusive Gateway': '相容网关',
  12772. 'Complex Gateway': '复杂网关',
  12773. 'Event based Gateway': '事件网关',
  12774. 'Transaction': '转运',
  12775. 'Sub Process': '子流程',
  12776. 'Event Sub Process': '事件子流程',
  12777. 'Collapsed Pool': '折叠池',
  12778. 'Expanded Pool': '展开池',
  12779. // Errors
  12780. 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
  12781. 'no shape type specified': '没有指定的形状类型',
  12782. 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
  12783. 'out of bounds release': 'out of bounds release',
  12784. 'more than {count} child lanes': '子道大于{count} ',
  12785. 'element required': '元素不能为空',
  12786. 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
  12787. 'no diagram to display': '没有可展示的流程图',
  12788. 'no process or collaboration to display': '没有可展示的流程/协作',
  12789. 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
  12790. 'already rendered {element}': '{element} 已被渲染',
  12791. 'failed to import {element}': '导入{element}失败',
  12792. // 属性面板的参数
  12793. 'Id': '编号',
  12794. 'Name': '名称',
  12795. 'General': '常规',
  12796. 'Details': '详情',
  12797. 'Message Name': '消息名称',
  12798. 'Message': '消息',
  12799. 'Initiator': '创建者',
  12800. 'Asynchronous Continuations': '持续异步',
  12801. 'Asynchronous Before': '异步前',
  12802. 'Asynchronous After': '异步后',
  12803. 'Job Configuration': '工作配置',
  12804. 'Exclusive': '排除',
  12805. 'Job Priority': '工作优先级',
  12806. 'Retry Time Cycle': '重试时间周期',
  12807. 'Documentation': '文档',
  12808. 'Element Documentation': '元素文档',
  12809. 'History Configuration': '历史配置',
  12810. 'History Time To Live': '历史的生存时间',
  12811. 'Forms': '表单',
  12812. 'Form Key': '表单key',
  12813. 'Form Fields': '表单字段',
  12814. 'Business Key': '业务key',
  12815. 'Form Field': '表单字段',
  12816. 'ID': '编号',
  12817. 'Type': '类型',
  12818. 'Label': '名称',
  12819. 'Default Value': '默认值',
  12820. 'Validation': '校验',
  12821. 'Add Constraint': '添加约束',
  12822. 'Config': '配置',
  12823. 'Properties': '属性',
  12824. 'Add Property': '添加属性',
  12825. 'Value': '值',
  12826. 'Add': '添加',
  12827. 'Values': '值',
  12828. 'Add Value': '添加值',
  12829. 'Listeners': '监听器',
  12830. 'Execution Listener': '执行监听',
  12831. 'Event Type': '事件类型',
  12832. 'Listener Type': '监听器类型',
  12833. 'Java Class': 'Java类',
  12834. 'Expression': '表达式',
  12835. 'Must provide a value': '必须提供一个值',
  12836. 'Delegate Expression': '代理表达式',
  12837. 'Script': '脚本',
  12838. 'Script Format': '脚本格式',
  12839. 'Script Type': '脚本类型',
  12840. 'Inline Script': '内联脚本',
  12841. 'External Script': '外部脚本',
  12842. 'Resource': '资源',
  12843. 'Field Injection': '字段注入',
  12844. 'Extensions': '扩展',
  12845. 'Input/Output': '输入/输出',
  12846. 'Input Parameters': '输入参数',
  12847. 'Output Parameters': '输出参数',
  12848. 'Parameters': '参数',
  12849. 'Output Parameter': '输出参数',
  12850. 'Timer Definition Type': '定时器定义类型',
  12851. 'Timer Definition': '定时器定义',
  12852. 'Date': '日期',
  12853. 'Duration': '持续',
  12854. 'Cycle': '循环',
  12855. 'Signal': '信号',
  12856. 'Signal Name': '信号名称',
  12857. 'Escalation': '升级',
  12858. 'Error': '错误',
  12859. 'Link Name': '链接名称',
  12860. 'Condition': '条件名称',
  12861. 'Variable Name': '变量名称',
  12862. 'Variable Event': '变量事件',
  12863. 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
  12864. 'Wait for Completion': '等待完成',
  12865. 'Activity Ref': '活动参考',
  12866. 'Version Tag': '版本标签',
  12867. 'Executable': '可执行文件',
  12868. 'External Task Configuration': '扩展任务配置',
  12869. 'Task Priority': '任务优先级',
  12870. 'External': '外部',
  12871. 'Connector': '连接器',
  12872. 'Must configure Connector': '必须配置连接器',
  12873. 'Connector Id': '连接器编号',
  12874. 'Implementation': '实现方式',
  12875. 'Field Injections': '字段注入',
  12876. 'Fields': '字段',
  12877. 'Result Variable': '结果变量',
  12878. 'Topic': '主题',
  12879. 'Configure Connector': '配置连接器',
  12880. 'Input Parameter': '输入参数',
  12881. 'Assignee': '代理人',
  12882. 'Candidate Users': '候选用户',
  12883. 'Candidate Groups': '候选组',
  12884. 'Due Date': '到期时间',
  12885. 'Follow Up Date': '跟踪日期',
  12886. 'Priority': '优先级',
  12887. // eslint-disable-next-line no-template-curly-in-string
  12888. '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',
  12889. // eslint-disable-next-line no-template-curly-in-string
  12890. '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',
  12891. 'Variables': '变量',
  12892. 'Candidate Starter Configuration': '候选开始配置',
  12893. 'Task Listener': '任务监听器',
  12894. 'Candidate Starter Groups': '候选开始组',
  12895. 'Candidate Starter Users': '候选开始用户',
  12896. 'Tasklist Configuration': '任务列表配置',
  12897. 'Startable': '启动',
  12898. 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
  12899. 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
  12900. 'This maps to the process definition key.': '这会映射为流程定义的键',
  12901. 'CallActivity Type': '调用活动类型',
  12902. 'Condition Type': '条件类型',
  12903. 'Create UserTask': '创建用户任务',
  12904. 'Create CallActivity': '创建调用活动',
  12905. 'Called Element': '调用元素',
  12906. 'Create DataObjectReference': '创建数据对象引用',
  12907. 'Create DataStoreReference': '创建数据存储引用',
  12908. 'Multi Instance': '多实例',
  12909. 'Loop Cardinality': '实例数量',
  12910. Collection: '任务参与人列表',
  12911. 'Element Variable': '元素变量',
  12912. 'Completion Condition': '完成条件'
  12913. };
  12914. function customTranslate(template, replacements) {
  12915. replacements = replacements || {};
  12916. // Translate
  12917. template = translations[template] || template;
  12918. // Replace
  12919. return template.replace(/{([^}]+)}/g, function (_, key) {
  12920. return replacements[key] || '{' + key + '}';
  12921. });
  12922. }
  12923. var vjson$9 = {
  12924. title: '导入流程',
  12925. layout: 'fit',
  12926. width: 400,
  12927. height: 400,
  12928. items: [
  12929. {
  12930. layout: 'border',
  12931. items: [
  12932. {
  12933. xtype: 'form',
  12934. items: [
  12935. // {
  12936. // xtype: 'cols',
  12937. // items: [
  12938. // {
  12939. // xtype: 'textfield',
  12940. // allowBlank: false,
  12941. // fieldLabel: '流程名称',
  12942. // bind: '{name}'
  12943. // },
  12944. // ],
  12945. // },
  12946. {
  12947. xtype: 'cols',
  12948. items: [
  12949. {
  12950. xtype: 'filefield',
  12951. name: 'deployFile',
  12952. fieldLabel: '文件名称',
  12953. // labelWidth: '100%',
  12954. msgTarget: 'side',
  12955. reference: 'MOBANB_FILE',
  12956. fileUpload: true,
  12957. allowBlank: false,
  12958. // flex: 1,
  12959. // width: '100%',
  12960. buttonText: '请选择文件位置',
  12961. listeners: {
  12962. change: 'scope.fileChange'
  12963. }
  12964. // bind: '{FILE}'
  12965. },
  12966. ]
  12967. }
  12968. ],
  12969. region: 'center',
  12970. split: true,
  12971. },
  12972. ],
  12973. },
  12974. ],
  12975. fbar: {
  12976. xtype: 'toolbar',
  12977. items: [
  12978. {
  12979. xtype: 'button',
  12980. text: '保存',
  12981. iconCls: 'x-fa fa-save',
  12982. listeners: {
  12983. click: 'scope.save',
  12984. },
  12985. }
  12986. ],
  12987. },
  12988. };
  12989. var model$9 = {
  12990. data: {
  12991. name: '',
  12992. file_content: ''
  12993. }
  12994. };
  12995. var ImportBpmn = /** @class */ (function (_super) {
  12996. __extends(ImportBpmn, _super);
  12997. function ImportBpmn() {
  12998. return _super.call(this, { model: model$9, vjson: vjson$9 }) || this;
  12999. }
  13000. ImportBpmn.prototype.onLoad = function () {
  13001. };
  13002. ImportBpmn.prototype.save = function (sender) {
  13003. if (this.data.file_content) {
  13004. this.dialogSuccess(this.data);
  13005. }
  13006. else {
  13007. Ext.Msg.alert('提示', "请先上传文件");
  13008. }
  13009. };
  13010. ImportBpmn.prototype.fileChange = function (e) {
  13011. var _this = this;
  13012. // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
  13013. var file = e.fileInputEl.dom.files[0]; //获取文件
  13014. var reader = new FileReader();
  13015. reader.readAsText(file, "UTF-8");
  13016. reader.onload = function () {
  13017. _this.data.file_content = reader.result;
  13018. };
  13019. };
  13020. return ImportBpmn;
  13021. }(Scope));
  13022. var model$a = {
  13023. data: {
  13024. form_id: '',
  13025. form_name: '',
  13026. save_dir_path: '',
  13027. absolute_path: '',
  13028. form: {
  13029. id: '',
  13030. code: '',
  13031. name: '',
  13032. table: '',
  13033. controller: '',
  13034. groovy: '',
  13035. fields: [],
  13036. buttons: [],
  13037. },
  13038. }
  13039. };
  13040. var vjson$a = {
  13041. title: '配置适配策略',
  13042. layout: 'fit',
  13043. items: [
  13044. {
  13045. layout: 'border',
  13046. items: [
  13047. {
  13048. region: 'center',
  13049. xtype: 'yvgrid',
  13050. pagination: false,
  13051. hideFootbar: true,
  13052. plugins: {
  13053. clipboard: true,
  13054. selectionreplicator: true
  13055. },
  13056. tbar: {
  13057. xtype: 'toolbar',
  13058. items: [
  13059. {
  13060. xtype: 'button',
  13061. text: '添加策略',
  13062. iconCls: 'x-fa fa-plus-circle',
  13063. listeners: {
  13064. click: 'scope.addStrategy'
  13065. }
  13066. },
  13067. {
  13068. xtype: 'button',
  13069. text: '删除',
  13070. iconCls: 'x-fa fa-minus-circle',
  13071. listeners: {}
  13072. },
  13073. '-',
  13074. {
  13075. xtype: 'button',
  13076. text: '上移',
  13077. iconCls: 'x-fa fa-arrow-up',
  13078. listeners: {}
  13079. },
  13080. {
  13081. xtype: 'button',
  13082. text: '下移',
  13083. iconCls: 'x-fa fa-arrow-down',
  13084. listeners: {}
  13085. },
  13086. ]
  13087. },
  13088. columns: [
  13089. { xtype: 'rownumberer' },
  13090. {
  13091. header: '优先级',
  13092. dataIndex: 'priority',
  13093. width: 140,
  13094. sortable: false,
  13095. menuDisabled: true,
  13096. editor: {
  13097. selectOnFocus: true
  13098. },
  13099. },
  13100. {
  13101. header: '策略编号',
  13102. dataIndex: 'strategy_code',
  13103. width: 140,
  13104. sortable: false,
  13105. menuDisabled: true,
  13106. editor: {
  13107. selectOnFocus: true
  13108. },
  13109. },
  13110. {
  13111. header: '策略名称',
  13112. dataIndex: 'strategy_name',
  13113. width: 140,
  13114. sortable: false,
  13115. menuDisabled: true,
  13116. editor: {
  13117. selectOnFocus: true
  13118. },
  13119. },
  13120. {
  13121. header: "条件表达式",
  13122. dataIndex: "strategy_exp",
  13123. },
  13124. ],
  13125. },
  13126. {
  13127. title: '适配条件',
  13128. region: 'south',
  13129. height: '50%',
  13130. xtype: 'form',
  13131. items: [
  13132. {
  13133. xtype: 'cols',
  13134. items: [
  13135. {
  13136. xtype: 'rows',
  13137. items: [
  13138. {
  13139. xtype: 'textfield',
  13140. fieldLabel: "仓库",
  13141. },
  13142. {
  13143. xtype: 'textfield',
  13144. fieldLabel: "货主",
  13145. },
  13146. {
  13147. xtype: 'textfield',
  13148. fieldLabel: "项目",
  13149. },
  13150. {
  13151. xtype: 'textfield',
  13152. fieldLabel: "行政区划",
  13153. },
  13154. {
  13155. xtype: 'textfield',
  13156. fieldLabel: "客户",
  13157. },
  13158. {
  13159. xtype: 'textfield',
  13160. fieldLabel: "商品",
  13161. }
  13162. ]
  13163. },
  13164. {
  13165. xtype: 'rows',
  13166. margin: '8 0 0 10',
  13167. items: [
  13168. {
  13169. xtype: 'label',
  13170. html: '自定义表达式',
  13171. },
  13172. {
  13173. xtype: 'textarea',
  13174. }
  13175. ]
  13176. }
  13177. ]
  13178. }
  13179. ]
  13180. }
  13181. ]
  13182. }
  13183. ]
  13184. };
  13185. //
  13186. // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
  13187. // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
  13188. // import ReportRunner from "./ReportRunner";
  13189. var ConfigStrategy = /** @class */ (function (_super) {
  13190. __extends(ConfigStrategy, _super);
  13191. function ConfigStrategy() {
  13192. return _super.call(this, { model: model$a, vjson: vjson$a }) || this;
  13193. }
  13194. ConfigStrategy.prototype.onLoad = function () {
  13195. this.load();
  13196. };
  13197. ConfigStrategy.prototype.load = function () {
  13198. var _this = this;
  13199. var form_id = this.viewModel.get("form_id");
  13200. var absolute_path = this.viewModel.get("absolute_path");
  13201. var save_dir_path = this.viewModel.get("save_dir_path");
  13202. if (absolute_path && form_id) {
  13203. this.setLoading(true);
  13204. readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
  13205. if (res.success) {
  13206. // 基础属性
  13207. _this.viewModel.set('form', res.data.form);
  13208. // 字段定义
  13209. _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
  13210. // 按钮
  13211. _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
  13212. }
  13213. }).finally(function () {
  13214. _this.setLoading(false);
  13215. });
  13216. }
  13217. };
  13218. ConfigStrategy.prototype.saveAll = function () {
  13219. var _this = this;
  13220. var save_dir_path = this.viewModel.get("save_dir_path");
  13221. if (!save_dir_path) {
  13222. msg("save_dir_path error");
  13223. return;
  13224. }
  13225. var form_id = this.viewModel.get("form_id");
  13226. var absolute_path = this.viewModel.get("absolute_path");
  13227. // 表格校验
  13228. if (!this.refs.form1.isValid()) {
  13229. msg("请检查表单必填项!");
  13230. return;
  13231. }
  13232. // 字段数据
  13233. var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
  13234. delete item.id;
  13235. if (item.hide) {
  13236. delete item.hide_text;
  13237. }
  13238. else {
  13239. item.hide = item.hide_text;
  13240. delete item.hide_text;
  13241. }
  13242. if (item.readonly) {
  13243. delete item.readonly_text;
  13244. }
  13245. else {
  13246. item.readonly = item.readonly_text;
  13247. delete item.readonly_text;
  13248. }
  13249. if (item.disabled) {
  13250. delete item.disabled_text;
  13251. }
  13252. else {
  13253. item.disabled = item.disabled_text;
  13254. delete item.disabled_text;
  13255. }
  13256. if (item.required) {
  13257. delete item.required_text;
  13258. }
  13259. else {
  13260. item.required = item.required_text;
  13261. delete item.required_text;
  13262. }
  13263. return item;
  13264. });
  13265. this.viewModel.set("form.fields", gridColumnRows);
  13266. // 按钮数据
  13267. var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
  13268. delete item.id;
  13269. return item;
  13270. });
  13271. this.viewModel.set("form.buttons", gridBtnRows);
  13272. // 查询条件
  13273. // 策略
  13274. var form = this.viewModel.get("form");
  13275. this.setLoading(true);
  13276. createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
  13277. if (res.success) {
  13278. msg('保存成功');
  13279. handles$1.mainWindow.refs['exporerTree'].reload();
  13280. }
  13281. }).finally(function () {
  13282. _this.setLoading(false);
  13283. });
  13284. };
  13285. ConfigStrategy.prototype.addColumn = function () {
  13286. this.refs.gridColumn.getStore().add({});
  13287. };
  13288. ConfigStrategy.prototype.removeColumn = function () {
  13289. this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
  13290. };
  13291. ConfigStrategy.prototype.calcColumn = function (sender) {
  13292. var _this = this;
  13293. var table = this.viewModel.get("form.table");
  13294. if (!table) {
  13295. msg("表名不存在!");
  13296. return;
  13297. }
  13298. this.setLoading(true);
  13299. calcColumnForm({ table: table }).then(function (res) {
  13300. if (res.success) {
  13301. msg(res.msg);
  13302. if (res.data.columns.length > 0) {
  13303. _$2.forEach(res.data.columns, function (it) {
  13304. _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
  13305. });
  13306. }
  13307. }
  13308. }).finally(function () {
  13309. _this.setLoading(false);
  13310. });
  13311. };
  13312. ConfigStrategy.prototype.addButton = function () {
  13313. this.refs.gridButton.getStore().add({});
  13314. };
  13315. ConfigStrategy.prototype.moveUp = function (sender) {
  13316. var grid = sender.up('grid');
  13317. grid.rowMoveUp();
  13318. };
  13319. ConfigStrategy.prototype.moveDown = function (sender) {
  13320. var grid = sender.up('grid');
  13321. grid.rowMoveDown();
  13322. };
  13323. ConfigStrategy.prototype.addStrategy = function (sender, path) {
  13324. var win = new Ext.Window({
  13325. autoDestroy: true,
  13326. title: "添加(编辑)策略",
  13327. width: 400,
  13328. height: 300,
  13329. resizable: true,
  13330. closable: true,
  13331. maximizable: true,
  13332. minimizable: true,
  13333. plain: true,
  13334. // constrainHeader: true,
  13335. constrain: true,
  13336. layout: 'fit',
  13337. animateTarget: sender,
  13338. buttonAlign: 'center',
  13339. items: [
  13340. {
  13341. xtype: "form",
  13342. layout: "hbox",
  13343. margin: '10px 20px',
  13344. border: 0,
  13345. items: [
  13346. {
  13347. flex: 1,
  13348. layout: 'vbox',
  13349. items: [
  13350. {
  13351. xtype: "numberfield",
  13352. fieldLabel: "优先级",
  13353. flex: 1,
  13354. allowBlank: false,
  13355. labelWidth: 50,
  13356. width: "100%",
  13357. },
  13358. {
  13359. xtype: "textfield",
  13360. fieldLabel: "策略名称",
  13361. flex: 1,
  13362. allowBlank: false,
  13363. labelWidth: 50,
  13364. width: "100%",
  13365. },
  13366. {
  13367. xtype: "textfield",
  13368. fieldLabel: "策略编号",
  13369. flex: 1,
  13370. allowBlank: false,
  13371. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13372. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13373. labelWidth: 50,
  13374. width: "100%",
  13375. },
  13376. {
  13377. xtype: "textfield",
  13378. fieldLabel: "仓库ID",
  13379. flex: 1,
  13380. allowBlank: false,
  13381. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  13382. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  13383. labelWidth: 50,
  13384. width: "100%",
  13385. },
  13386. ]
  13387. },
  13388. ]
  13389. }
  13390. ],
  13391. //窗口按钮
  13392. buttons: [
  13393. {
  13394. xtype: 'button', text: '保存', handler: function (btn) {
  13395. //窗口获取表单
  13396. var form = win.down('form');
  13397. var vaildSuccess = form.isValid();
  13398. if (!vaildSuccess) {
  13399. return;
  13400. }
  13401. var filename = form.down('textfield[name="filename"]').getValue();
  13402. }
  13403. },
  13404. {
  13405. xtype: 'button', text: '取消', handler: function (btn) {
  13406. //窗口关闭
  13407. win.close();
  13408. }
  13409. }
  13410. ]
  13411. });
  13412. win.show();
  13413. };
  13414. return ConfigStrategy;
  13415. }(Scope));
  13416. var buildVjson = function () {
  13417. return {
  13418. bind: {
  13419. title: '流程编辑-{text}',
  13420. },
  13421. layout: 'fit',
  13422. items: [{
  13423. layout: 'border',
  13424. tbar: {
  13425. xtype: 'toolbar',
  13426. items: [
  13427. {
  13428. xtype: 'button',
  13429. text: '撤销',
  13430. listeners: {
  13431. click: "scope.undo"
  13432. }
  13433. },
  13434. {
  13435. xtype: 'button',
  13436. text: '还原',
  13437. listeners: {
  13438. click: "scope.redo"
  13439. }
  13440. },
  13441. {
  13442. xtype: 'button',
  13443. text: '保存',
  13444. listeners: {
  13445. click: "scope.save"
  13446. }
  13447. },
  13448. {
  13449. xtype: 'button',
  13450. text: '导入BPM',
  13451. listeners: {
  13452. click: "scope.importBpm"
  13453. }
  13454. },
  13455. {
  13456. xtype: 'button',
  13457. text: '配置适配策略',
  13458. listeners: {
  13459. click: "scope.configStrategy"
  13460. }
  13461. },
  13462. {
  13463. fieldLabel: '选择配置分支',
  13464. xtype: 'combogrid',
  13465. },
  13466. ]
  13467. },
  13468. items: [
  13469. {
  13470. xtype: "panel",
  13471. region: 'center',
  13472. reference: "bpmn_view",
  13473. html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
  13474. },
  13475. {
  13476. split: true,
  13477. xtype: "panel",
  13478. region: 'east',
  13479. width: '30%',
  13480. reference: "bpmn_properties",
  13481. html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
  13482. }
  13483. ],
  13484. }],
  13485. listeners: {
  13486. afterrender: 'scope.onViewRender'
  13487. }
  13488. };
  13489. };
  13490. var BpmnDesign = /** @class */ (function (_super) {
  13491. __extends(BpmnDesign, _super);
  13492. function BpmnDesign() {
  13493. var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
  13494. _this.bpmnModeler = null;
  13495. _this.bpmnModelerName = "";
  13496. return _this;
  13497. }
  13498. BpmnDesign.prototype.onLoad = function () {
  13499. var _this = this;
  13500. _super.prototype.onLoad.call(this);
  13501. this.setLoading(true);
  13502. this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
  13503. readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
  13504. if (res && res.success && res.data && res.data.bpmn) {
  13505. var diagramXML = res.data.bpmn;
  13506. _this.bpmnModeler.importXML(diagramXML).then(function (res) {
  13507. var elements = _this.bpmnModeler._definitions.rootElements;
  13508. if (Array.isArray(elements) && elements.length > 0) {
  13509. elements[0].name = _this.bpmnModelerName;
  13510. }
  13511. }).catch(function (err) {
  13512. msgError(err);
  13513. });
  13514. }
  13515. else {
  13516. msgError(res.msg);
  13517. }
  13518. }).finally(function () {
  13519. _this.setLoading(false);
  13520. });
  13521. };
  13522. BpmnDesign.prototype.onViewRender = function (sender) {
  13523. var customTranslateModule = {
  13524. translate: ['value', customTranslate]
  13525. };
  13526. this.bpmnModeler = new BpmnModeler({
  13527. container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
  13528. propertiesPanel: {
  13529. parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
  13530. },
  13531. additionalModules: [
  13532. bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
  13533. bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
  13534. bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
  13535. bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
  13536. bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
  13537. bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
  13538. bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
  13539. bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
  13540. customTranslateModule,
  13541. ],
  13542. moddleExtensions: {
  13543. camunda: camundaModdleDescriptor
  13544. },
  13545. keyboard: { bindTo: document } // 使用键盘快捷键
  13546. });
  13547. };
  13548. //开启快捷键
  13549. //modeler.get('keyboard').bind(document);
  13550. //关闭快捷键
  13551. //modeler.get('keyboard').unbind();
  13552. BpmnDesign.prototype.undo = function (sender) {
  13553. this.bpmnModeler.get('commandStack').undo();
  13554. };
  13555. BpmnDesign.prototype.redo = function (sender) {
  13556. this.bpmnModeler.get('commandStack').redo();
  13557. };
  13558. BpmnDesign.prototype.save = function (sender) {
  13559. var _this = this;
  13560. this.setLoading(true);
  13561. this.bpmnModeler.saveXML().then(function (resBpm) {
  13562. saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
  13563. if (res.success) {
  13564. msg$1("保存成功");
  13565. }
  13566. else {
  13567. msgError(res.msg);
  13568. }
  13569. }).catch(function (e) {
  13570. var _a, _b;
  13571. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  13572. msgError(msg);
  13573. }).finally(function () {
  13574. _this.setLoading(false);
  13575. });
  13576. }).catch(function (e) {
  13577. msgError(e);
  13578. _this.setLoading(false);
  13579. });
  13580. };
  13581. BpmnDesign.prototype.importBpm = function (sender) {
  13582. var _this = this;
  13583. var dlg = new ImportBpmn();
  13584. //@ts-ignore
  13585. dlg.success = function (sen, data) {
  13586. _this.bpmnModeler.importXML(data.file_content).then(function (res) {
  13587. var elements = _this.bpmnModeler._definitions.rootElements;
  13588. if (Array.isArray(elements) && elements.length > 0) {
  13589. elements[0].name = _this.bpmnModelerName;
  13590. }
  13591. }).catch(function (err) {
  13592. msgError(err);
  13593. });
  13594. };
  13595. dlg.showDialog(sender, {}, {});
  13596. // this.bpmnModeler.importXML()
  13597. };
  13598. BpmnDesign.prototype.configStrategy = function (sender) {
  13599. var configStrategy = new ConfigStrategy();
  13600. configStrategy.showDialog(sender, {}, {});
  13601. };
  13602. return BpmnDesign;
  13603. }(Scope));
  13604. var model$b = {
  13605. data: {
  13606. id: '',
  13607. path: '',
  13608. form: {
  13609. title: '',
  13610. sqlId: '',
  13611. }
  13612. }
  13613. };
  13614. var vjson$b = {
  13615. bind: {
  13616. title: '{title}',
  13617. },
  13618. layout: 'fit',
  13619. items: [
  13620. {
  13621. layout: 'border',
  13622. items: [
  13623. {
  13624. region: 'center',
  13625. reference: 'editor',
  13626. border: true,
  13627. // html: '<div class="geEditor"></div>',
  13628. // listeners: {
  13629. // afterrender: 'scope.editorInit'
  13630. // }
  13631. html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
  13632. listeners: {
  13633. afterrender: 'scope.iframeRender'
  13634. }
  13635. },
  13636. ]
  13637. }
  13638. ]
  13639. }; //
  13640. //
  13641. var WidgetDesign$1 = /** @class */ (function (_super) {
  13642. __extends(WidgetDesign, _super);
  13643. function WidgetDesign(layoutCode, layoutName) {
  13644. var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
  13645. _this.layoutCode = layoutCode;
  13646. _this.layoutName = layoutName;
  13647. return _this;
  13648. }
  13649. WidgetDesign.prototype.onLoad = function () {
  13650. this.viewModel.set('layoutCode', this.layoutCode);
  13651. this.viewModel.set('layoutName', this.layoutName);
  13652. if (this.layoutCode) {
  13653. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13654. }
  13655. else {
  13656. this.viewModel.set('title', '新建图纸');
  13657. }
  13658. };
  13659. WidgetDesign.prototype.reload = function () {
  13660. var _this = this;
  13661. this.setLoading(true);
  13662. loadWhLayout({
  13663. layoutCode: this.layoutCode,
  13664. layoutName: this.layoutName,
  13665. }).then(function (res) {
  13666. if (res.success) {
  13667. var xml = res.data.layoutContent;
  13668. var doc = _this.mxUtils.parseXml(xml);
  13669. var graph = _this.editorUi.editor.graph;
  13670. graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
  13671. }
  13672. }).finally(function () {
  13673. _this.setLoading(false);
  13674. });
  13675. };
  13676. WidgetDesign.prototype.editorInit = function (sender) {
  13677. var that = this;
  13678. var dom = $(sender.el.dom).find('.geEditor')[0];
  13679. //@ts-ignore
  13680. require(['mxgraph'], function () {
  13681. var editorUiInit = EditorUi.prototype.init;
  13682. EditorUi.prototype.init = function () {
  13683. editorUiInit.apply(this, arguments);
  13684. this.actions.get('save').funct = that.onFileSave.bind(that);
  13685. this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13686. this.actions.get('open').visible = false;
  13687. this.actions.get('new').visible = false;
  13688. this.actions.get('preview').visible = false;
  13689. this.actions.get('print').visible = false;
  13690. this.actions.get('pageSetup').visible = false;
  13691. this.actions.get('help').visible = false;
  13692. this.actions.get('export').visible = false;
  13693. this.actions.get('about').visible = false;
  13694. this.menus.menus.help.setEnabled(false);
  13695. that.editorUi = this;
  13696. if (that.layoutCode) {
  13697. that.reload();
  13698. }
  13699. };
  13700. var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
  13701. var mxLanguage = 'zh';
  13702. mxResources.loadDefaultBundle = false;
  13703. var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
  13704. mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
  13705. var STYLE_PATH = '/assets/mxgraph-editor/styles';
  13706. // Fixes possible asynchronous requests
  13707. mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
  13708. // Adds bundle text to resources
  13709. mxResources.parse(xhr[0].getText());
  13710. // Configures the default graph theme
  13711. var themes = new Object();
  13712. themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
  13713. // Main
  13714. new EditorUi(new Editor(false, themes), dom);
  13715. }, function () {
  13716. dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
  13717. });
  13718. });
  13719. };
  13720. WidgetDesign.prototype.iframeRender = function (sender) {
  13721. var that = this;
  13722. var iframe = $(sender.el.dom).find('iframe')[0];
  13723. iframe.contentWindow['designer'] = that;
  13724. iframe.contentWindow['editorInitFn'] = function (editorUi) {
  13725. editorUi.actions.get('save').funct = that.onFileSave.bind(that);
  13726. editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
  13727. editorUi.actions.get('open').visible = false;
  13728. editorUi.actions.get('new').visible = false;
  13729. editorUi.actions.get('preview').visible = false;
  13730. editorUi.actions.get('print').visible = false;
  13731. editorUi.actions.get('pageSetup').visible = false;
  13732. editorUi.actions.get('help').visible = false;
  13733. editorUi.actions.get('export').visible = false;
  13734. editorUi.actions.get('about').visible = false;
  13735. editorUi.menus.menus.help.setEnabled(false);
  13736. that.editorUi = editorUi;
  13737. that.mxUtils = iframe.contentWindow['mxUtils'];
  13738. if (that.layoutCode) {
  13739. that.reload();
  13740. }
  13741. };
  13742. };
  13743. WidgetDesign.prototype.onDestroy = function () {
  13744. var _a;
  13745. try {
  13746. (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
  13747. }
  13748. catch (e) {
  13749. }
  13750. };
  13751. WidgetDesign.prototype.onFileSaveAs = function () {
  13752. var _this = this;
  13753. this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
  13754. .then(function (_a) {
  13755. var code = _a.code, name = _a.name;
  13756. _this.layoutCode = code;
  13757. _this.layoutName = name;
  13758. _this.onSave();
  13759. });
  13760. };
  13761. WidgetDesign.prototype.onSave = function () {
  13762. var _this = this;
  13763. var layoutContent = this.editorUi.getEditBlankXml();
  13764. var layoutCode = this.layoutCode;
  13765. var layoutName = this.layoutName;
  13766. if (!layoutCode || !layoutName) {
  13767. msg$1('图形编号和图形名称必填');
  13768. return;
  13769. }
  13770. this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
  13771. this.setLoading(true);
  13772. saveWhLayout({
  13773. layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
  13774. }).then(function (res) {
  13775. msg$1(res.msg);
  13776. handles$1.whLayout.reload();
  13777. }).finally(function () {
  13778. _this.setLoading(false);
  13779. });
  13780. };
  13781. WidgetDesign.prototype.onFileSave = function () {
  13782. if (!this.layoutCode || !this.layoutName) {
  13783. this.onFileSaveAs();
  13784. }
  13785. else {
  13786. this.onSave();
  13787. }
  13788. };
  13789. WidgetDesign.prototype.showSaveAsDlg = function (_a) {
  13790. var code = _a.code, name = _a.name;
  13791. return new Promise(function (resolve, reject) {
  13792. var viewModel = new Ext.app.ViewModel({
  13793. data: {
  13794. code: code !== null && code !== void 0 ? code : '',
  13795. name: name !== null && name !== void 0 ? name : '',
  13796. }
  13797. });
  13798. var dlg = Ext.create('Ext.window.Window', {
  13799. title: '保存',
  13800. viewModel: viewModel,
  13801. layout: {
  13802. type: "vbox",
  13803. pack: "start",
  13804. align: "stretch"
  13805. },
  13806. items: [
  13807. {
  13808. xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
  13809. bind: '{code}'
  13810. },
  13811. {
  13812. xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
  13813. bind: '{name}'
  13814. }
  13815. ],
  13816. fbar: [
  13817. {
  13818. xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
  13819. click: function () {
  13820. var code = viewModel.get('code');
  13821. var name = viewModel.get('name');
  13822. resolve({ code: code, name: name });
  13823. dlg.close();
  13824. }
  13825. }
  13826. },
  13827. {
  13828. xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
  13829. click: function () {
  13830. dlg.close();
  13831. }
  13832. }
  13833. },
  13834. ]
  13835. });
  13836. dlg.show();
  13837. });
  13838. };
  13839. return WidgetDesign;
  13840. }(Scope));
  13841. // init()
  13842. var Workbench = /** @class */ (function (_super) {
  13843. __extends(Workbench, _super);
  13844. // activeModulePage: ModulePage = null
  13845. function Workbench() {
  13846. var _this = _super.call(this, { model: model, vjson: vjson }) || this;
  13847. _this.name = "MainWindow";
  13848. _this.modules = [];
  13849. _this.yvgridDesign = null;
  13850. return _this;
  13851. }
  13852. Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
  13853. if (newCard) {
  13854. this.viewModel.set('leftTabTitle', newCard.tooltip);
  13855. }
  13856. else {
  13857. this.viewModel.set('leftTabTitle', '未选中');
  13858. }
  13859. };
  13860. Object.defineProperty(Workbench.prototype, "activeModulePage", {
  13861. get: function () {
  13862. var _a;
  13863. return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
  13864. },
  13865. enumerable: true,
  13866. configurable: true
  13867. });
  13868. Workbench.prototype.documentKeydown = function (event) {
  13869. if (event.ctrlKey || event.metaKey) {
  13870. if (event.key.toLowerCase() === 's') {
  13871. eventBus.publish(EventType.SaveCall, {});
  13872. event.stopPropagation();
  13873. event.preventDefault();
  13874. }
  13875. else if (event.key.toLowerCase() === 'z') {
  13876. if (event.shiftKey) {
  13877. eventBus.publish(EventType.Redo, {});
  13878. event.stopPropagation();
  13879. event.preventDefault();
  13880. }
  13881. else {
  13882. eventBus.publish(EventType.Undo, {});
  13883. event.stopPropagation();
  13884. event.preventDefault();
  13885. }
  13886. }
  13887. }
  13888. };
  13889. Workbench.prototype.onLoad = function () {
  13890. var _this = this;
  13891. window["tt"] = this.refs['tt'];
  13892. window["vm"] = this.viewModel;
  13893. $('#loading').remove();
  13894. setMainWindow(this);
  13895. setStatusbar(this.down('statusbar'));
  13896. document.addEventListener('keydown', this.documentKeydown.bind(this));
  13897. var currentProject = getCurrentProject();
  13898. this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
  13899. // handles.fileTree.reload()
  13900. eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
  13901. _this.showModule(rawData);
  13902. });
  13903. eventBus.subscribe(EventType.Undo, function () {
  13904. _this.onUndo();
  13905. });
  13906. eventBus.subscribe(EventType.Redo, function () {
  13907. _this.onRedo();
  13908. });
  13909. eventBus.subscribe(EventType.Cut, function (_a) {
  13910. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13911. _this.onCut(a, b, c, d);
  13912. });
  13913. eventBus.subscribe(EventType.Copy, function (_a) {
  13914. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13915. _this.onCopy(a, b, c, d);
  13916. });
  13917. eventBus.subscribe(EventType.Paste, function (_a) {
  13918. var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
  13919. _this.onPaste(a, b, c, d);
  13920. });
  13921. eventBus.subscribe(EventType.SelectAll, function () {
  13922. _this.onSelectAll();
  13923. });
  13924. eventBus.subscribe(EventType.SelectAll, function () {
  13925. _this.onSelectAll();
  13926. });
  13927. eventBus.subscribe(EventType.RunCheckModule, function () {
  13928. _this.runCheckModule();
  13929. });
  13930. eventBus.subscribe(EventType.StopCheckModule, function () {
  13931. _this.stopCheckModule();
  13932. });
  13933. eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
  13934. _this.onCompoentContextMenu(args);
  13935. });
  13936. this.runCheckModule();
  13937. };
  13938. Workbench.prototype.onCompoentContextMenu = function (args) {
  13939. var _this = this;
  13940. if (!this.yvgridDesign) {
  13941. this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
  13942. this.yvgridDesign.showDialog(null, {}, {});
  13943. var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
  13944. this.yvgridDesign.onDestroy = function () {
  13945. fn_1();
  13946. _this.yvgridDesign = null;
  13947. };
  13948. }
  13949. };
  13950. Workbench.prototype.runCheckModule = function () {
  13951. var _this = this;
  13952. if (this.checkTimer) {
  13953. return;
  13954. }
  13955. this.checkTimer = setInterval(function () {
  13956. var _a;
  13957. if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
  13958. _this.activeModulePage.check();
  13959. }
  13960. }, 5000);
  13961. };
  13962. Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
  13963. var dlg = new WidgetDesign(widgetPath, widgetName);
  13964. dlg.showPage({
  13965. id: 'widget_' + widgetPath,
  13966. path: 'widget_' + widgetPath,
  13967. }, {
  13968. data: {
  13969. title: widgetPath ? '检索框:' + widgetName : '新建检索框',
  13970. }
  13971. });
  13972. dlg.dialogSuccess = successCallback;
  13973. };
  13974. Workbench.prototype.stopCheckModule = function () {
  13975. clearInterval(this.checkTimer);
  13976. this.checkTimer = null;
  13977. };
  13978. Workbench.prototype.showDataSync = function () {
  13979. var ins = new DbSync();
  13980. ins.showPage({
  13981. id: 'db_sync__',
  13982. path: 'db_sync__',
  13983. }, {
  13984. data: {}
  13985. });
  13986. };
  13987. /**
  13988. * 打开一个项目
  13989. */
  13990. Workbench.prototype.openProject = function (project) {
  13991. setCurrentProject(project);
  13992. this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
  13993. handles$1.fileTree.reload();
  13994. };
  13995. /**
  13996. * 打开模板开发面板
  13997. */
  13998. Workbench.prototype.showTemplateDev = function () {
  13999. var ins = new TemplateDev();
  14000. ins.showPage({
  14001. id: 'template_dev__',
  14002. path: 'template_dev__',
  14003. }, {
  14004. data: {}
  14005. });
  14006. };
  14007. Workbench.prototype.openScope = function () {
  14008. };
  14009. /**
  14010. * 显示字段域管理器
  14011. */
  14012. Workbench.prototype.showColumnDomain = function () {
  14013. var instance = new DbDomain();
  14014. instance.showPage({
  14015. id: 'domain__',
  14016. path: 'domain__',
  14017. }, {
  14018. data: {}
  14019. });
  14020. };
  14021. /**
  14022. * 显示性能统计
  14023. */
  14024. Workbench.prototype.showPerform = function () {
  14025. // const instance = new PerformStats()
  14026. // instance.showPage({
  14027. // id: 'perform__',
  14028. // path: 'perform__',
  14029. //
  14030. // }, {
  14031. // data: {}
  14032. // })
  14033. };
  14034. /**
  14035. * 显示数据库代码模板库
  14036. */
  14037. Workbench.prototype.showDbCodeTemplate = function () {
  14038. // const instance = new DbCodeTemplate()
  14039. // instance.showPage({
  14040. // id: 'dbcode__',
  14041. // path: 'dbcode__',
  14042. //
  14043. // }, {
  14044. // data: {}
  14045. // })
  14046. };
  14047. /**
  14048. * 显示数据库代码模板库
  14049. */
  14050. Workbench.prototype.showReport = function (report_id, report_name, success) {
  14051. var instance = new ReportDesign();
  14052. instance.showPage({
  14053. id: 'report_' + report_id,
  14054. path: 'report_' + report_id,
  14055. }, {
  14056. data: {
  14057. report_id: report_id,
  14058. report_name: report_name,
  14059. }
  14060. });
  14061. instance.dialogSuccess = success;
  14062. };
  14063. /**
  14064. * 显示报表
  14065. */
  14066. Workbench.prototype.showReportPreview = function (report_id, instance) {
  14067. instance.showPage({
  14068. id: 'REPORT__' + report_id,
  14069. path: 'REPORT__' + report_id,
  14070. }, {
  14071. data: {
  14072. report_id: report_id,
  14073. }
  14074. });
  14075. var reportName = instance.viewModel.get('report_name');
  14076. instance.viewModel.set('report_name', '[预览]-' + reportName);
  14077. };
  14078. /**
  14079. * 显示运维页面
  14080. */
  14081. Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
  14082. // const instance = new DevOpsTerminal()
  14083. // instance.showPage({
  14084. // id: 'ops_' + opsId,
  14085. // path: 'ops_' + opsId,
  14086. //
  14087. // }, {
  14088. // data: {
  14089. // opsId: opsId,
  14090. // name: name,
  14091. // }
  14092. // })
  14093. // instance.dialogSuccess = success
  14094. };
  14095. /**
  14096. * 显示表结构
  14097. * tableName 为空的情况就是新建表,否则就是要编辑的表
  14098. * columnName 可以为空
  14099. */
  14100. Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
  14101. var id = 'tableColumn_' + tableName;
  14102. var isCreateTable = false;
  14103. // /ROOT/schema$public/schema$public$bas_location_group_rel
  14104. var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
  14105. if (!tableName) {
  14106. id = _$2.uniqueId('new_table');
  14107. tableName = id;
  14108. isCreateTable = true;
  14109. }
  14110. var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
  14111. instance.showPage({
  14112. id: id,
  14113. path: id,
  14114. locatPath: locatPath
  14115. }, {
  14116. data: {
  14117. tableName: tableName,
  14118. columnName: columnName
  14119. }
  14120. });
  14121. };
  14122. /**
  14123. * 打开某个模块
  14124. * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
  14125. */
  14126. Workbench.prototype.showModule = function (rawData) {
  14127. var id = rawData.id, path = rawData.path;
  14128. var separator = '/';
  14129. var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
  14130. var module = this.modules[idx];
  14131. var pageId = path.replaceAll('/', '_');
  14132. console.log('open module', module);
  14133. var instance = new ModulePage(id, module);
  14134. eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
  14135. instance.showPage({
  14136. id: 'module_' + pageId,
  14137. path: path,
  14138. title: module.name
  14139. }, {
  14140. data: {}
  14141. });
  14142. };
  14143. Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
  14144. var bpmnDesign = new BpmnDesign();
  14145. bpmnDesign.showPage({}, {
  14146. data: {
  14147. absolutePath: absolutePath,
  14148. id: id,
  14149. text: text
  14150. }
  14151. });
  14152. };
  14153. Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
  14154. var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
  14155. var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
  14156. layoutDesign.showPage({
  14157. id: id,
  14158. path: id,
  14159. }, {
  14160. data: {}
  14161. });
  14162. };
  14163. Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
  14164. var _a;
  14165. // this.activeModulePage = newCard.yvanScope
  14166. handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
  14167. handles$1.property.moduleId = newCard.yvanScope.moduleId;
  14168. // handles.dbTree.moduleId = newCard.yvanScope.moduleId
  14169. // handles.dictTree.moduleId = newCard.yvanScope.moduleId
  14170. // handles.fileTree.moduleId = newCard.yvanScope.moduleId
  14171. // handles.statusbar.moduleId = newCard.yvanScope.moduleId
  14172. eventBus.publish(EventType.MainTabChange, {
  14173. moduleId: newCard.yvanScope.moduleId,
  14174. oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
  14175. from: this.name
  14176. });
  14177. };
  14178. Workbench.prototype.onUndo = function () {
  14179. var _a;
  14180. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
  14181. };
  14182. Workbench.prototype.onRedo = function () {
  14183. var _a;
  14184. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
  14185. };
  14186. Workbench.prototype.onCut = function (a, b, c, d) {
  14187. var _a;
  14188. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
  14189. };
  14190. Workbench.prototype.onCopy = function (a, b, c, d) {
  14191. var _a;
  14192. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
  14193. };
  14194. Workbench.prototype.onPaste = function (a, b, c, d) {
  14195. var _a;
  14196. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
  14197. };
  14198. Workbench.prototype.onSelectAll = function () {
  14199. var _a;
  14200. (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
  14201. };
  14202. return Workbench;
  14203. }(Scope));
  14204. (function (FuncDomain) {
  14205. FuncDomain["SCOPE"] = "scope";
  14206. FuncDomain["SYSTEM"] = "system";
  14207. })(exports.FuncDomain || (exports.FuncDomain = {}));
  14208. (function (BizMode) {
  14209. //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
  14210. BizMode[BizMode["query"] = 1] = "query";
  14211. BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
  14212. BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
  14213. BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
  14214. })(exports.BizMode || (exports.BizMode = {}));
  14215. (function (BizFormat) {
  14216. // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
  14217. BizFormat[BizFormat["button"] = 1] = "button";
  14218. BizFormat[BizFormat["progress"] = 2] = "progress";
  14219. BizFormat[BizFormat["date"] = 3] = "date";
  14220. BizFormat[BizFormat["datetime"] = 4] = "datetime";
  14221. BizFormat[BizFormat["percentage"] = 5] = "percentage";
  14222. })(exports.BizFormat || (exports.BizFormat = {}));
  14223. (function (BizUnique) {
  14224. // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
  14225. BizUnique[BizUnique["u_a"] = 1] = "u_a";
  14226. BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
  14227. BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
  14228. BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
  14229. BizUnique[BizUnique["u_od"] = 5] = "u_od";
  14230. BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
  14231. })(exports.BizUnique || (exports.BizUnique = {}));
  14232. var ScopeEngine = /** @class */ (function () {
  14233. function ScopeEngine() {
  14234. }
  14235. ScopeEngine.getBizFile = function (director) {
  14236. return new Promise(function (resolve, reject) {
  14237. debugger;
  14238. });
  14239. };
  14240. ScopeEngine.buildScopeFromBillFile = function (billFile) {
  14241. return new Promise(function (resolve, reject) {
  14242. var requireArr = [];
  14243. var requireKeyArr = [];
  14244. _$2.forOwn(billFile.domains, function (v, k) {
  14245. requireArr.push(v.domain);
  14246. requireKeyArr.push(k);
  14247. if (v.layout) {
  14248. requireArr.push(v.layout);
  14249. requireKeyArr.push(k + "_layout");
  14250. }
  14251. });
  14252. requireArr.push(billFile.layout);
  14253. requireKeyArr.push("layout");
  14254. requireArr.push(billFile.converter);
  14255. requireKeyArr.push("converter");
  14256. // @ts-ignore
  14257. require(requireArr, function () {
  14258. var requireReArr = [];
  14259. for (var _i = 0; _i < arguments.length; _i++) {
  14260. requireReArr[_i] = arguments[_i];
  14261. }
  14262. if (requireReArr.length <= 0) {
  14263. reject(new Error("没有加载到相关的文件!"));
  14264. }
  14265. var domains = {};
  14266. for (var i = 0; i < requireReArr.length - 2; i++) {
  14267. if (requireKeyArr[i].endsWith("_layout")) {
  14268. var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
  14269. domains[key_d].layout = requireReArr[i].default;
  14270. }
  14271. else {
  14272. domains[requireKeyArr[i]] = requireReArr[i].default;
  14273. domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
  14274. domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
  14275. }
  14276. }
  14277. var bizFile = {
  14278. bill: billFile,
  14279. domains: domains,
  14280. layout: requireReArr[requireReArr.length - 2].default,
  14281. converter: requireReArr[requireReArr.length - 1].default,
  14282. };
  14283. var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
  14284. scope.billSetting = bizFile;
  14285. resolve(scope);
  14286. });
  14287. });
  14288. };
  14289. ScopeEngine.buildScopeFromPath = function (path) {
  14290. return new Promise(function (resolve, reject) {
  14291. // @ts-ignore
  14292. require([path], function (bill) {
  14293. bill = bill.default;
  14294. ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
  14295. resolve(scope);
  14296. }).catch(function (e) {
  14297. reject(e);
  14298. });
  14299. });
  14300. });
  14301. };
  14302. ScopeEngine.buildScopeFromBizFile = function (bizFile) {
  14303. var controller = {};
  14304. var vjson = {
  14305. layout: 'fit',
  14306. title: bizFile.bill.name,
  14307. items: []
  14308. };
  14309. var model = {};
  14310. if (bizFile.layout.layout === "fit") {
  14311. vjson.items = bizFile.layout.items;
  14312. }
  14313. else if (bizFile.layout.layout === "border") {
  14314. vjson.items = [bizFile.layout];
  14315. }
  14316. var domainsVjson = {};
  14317. _$2.forOwn(bizFile.domains, function (v, k) {
  14318. var domainVjson = null;
  14319. var buttons = bizFile.domains[k].buttons;
  14320. if (bizFile.bill.domains[k].mode === "form") {
  14321. domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
  14322. if (Array.isArray(buttons) && buttons.length > 0) {
  14323. if (bizFile.bill.domains[k].type === "header") {
  14324. vjson.tbar = {
  14325. xtype: 'toolbar',
  14326. items: ScopeEngine.buildButton(controller, buttons)
  14327. };
  14328. }
  14329. else {
  14330. domainVjson.items.push({
  14331. xtype: "cols",
  14332. items: ScopeEngine.buildButton(controller, buttons)
  14333. });
  14334. }
  14335. }
  14336. }
  14337. else if (bizFile.bill.domains[k].mode === "table") {
  14338. domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
  14339. if (Array.isArray(buttons) && buttons.length > 0) {
  14340. if (bizFile.bill.domains[k].type === "header") {
  14341. vjson.tbar = {
  14342. xtype: 'toolbar',
  14343. items: ScopeEngine.buildButton(controller, buttons)
  14344. };
  14345. }
  14346. else {
  14347. domainVjson.tbar = {
  14348. xtype: 'toolbar',
  14349. items: ScopeEngine.buildButton(controller, buttons)
  14350. };
  14351. }
  14352. }
  14353. }
  14354. if (domainVjson) {
  14355. domainsVjson[k] = domainVjson;
  14356. }
  14357. });
  14358. ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
  14359. var scope = new Scope({ model: model, vjson: vjson });
  14360. scope['bill_define'] = bizFile;
  14361. _$2.merge(scope, controller);
  14362. console.log('bill_define', vjson, scope, scope['bill_define']);
  14363. return scope;
  14364. };
  14365. ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
  14366. var fieldGroups = {};
  14367. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14368. var field = bizFile.domains[domainKey].fields[i];
  14369. var item = { sort: field.form_sort };
  14370. item.xtype = field.xtype;
  14371. item.fieldLabel = field.column_desc;
  14372. item.bind = {
  14373. value: "{" + domainKey + "." + field.column_name + "}",
  14374. };
  14375. _$2.set(model, "data." + domainKey + "." + field.column_name, null);
  14376. // if (field.disabled !== "true" && field.disabled !== "false") {
  14377. // item.bind.disabled = eval(field.disabled)
  14378. // } else {
  14379. // item.disabled = (field.disabled === "true")
  14380. // }
  14381. // if (field.readonly !== "true" && field.readonly !== "false") {
  14382. // item.bind.disabled = eval(field.readonly)
  14383. // } else {
  14384. // item.readonly = (field.readonly === "true")
  14385. // }
  14386. // if (field.required !== "true" && field.required !== "false") {
  14387. // item.bind.required = eval(field.required)
  14388. // } else {
  14389. // item.required = (field.required === "true")
  14390. // }
  14391. // if (field.hide !== "true" && field.hide !== "false") {
  14392. // item.bind.hidden = eval(field.hide)
  14393. // } else {
  14394. // item.hidden = (field.hide === "true")
  14395. // }
  14396. // item.flex = field.
  14397. if (field.dict) {
  14398. item.fix = eval(field.dict);
  14399. }
  14400. // _.set(formModel, "", "")
  14401. item.field = field;
  14402. if (field.form_group) {
  14403. if (!fieldGroups.hasOwnProperty(field.form_group)) {
  14404. fieldGroups[field.form_group] = [item];
  14405. }
  14406. else {
  14407. fieldGroups[field.form_group].push(item);
  14408. }
  14409. }
  14410. }
  14411. var formVjson = {
  14412. xtype: "form",
  14413. title: bizFile.domains[domainKey].name,
  14414. items: []
  14415. };
  14416. _$2.forOwn(fieldGroups, function (fieldGroup, k) {
  14417. var items = ScopeEngine.buildFieldSet(fieldGroup);
  14418. if (items) {
  14419. var fieldsetVjson = {
  14420. xtype: "fieldset",
  14421. title: k,
  14422. items: items
  14423. };
  14424. formVjson.items.push(fieldsetVjson);
  14425. }
  14426. });
  14427. return formVjson;
  14428. };
  14429. ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
  14430. // const vjson = { xtype: "grid", items: []}
  14431. var gridVjson = {
  14432. xtype: "yvgrid",
  14433. columns: [],
  14434. split: true,
  14435. reference: domainKey,
  14436. listeners: {
  14437. itemdblclick: function () {
  14438. },
  14439. },
  14440. };
  14441. for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
  14442. var field = bizFile.domains[domainKey].fields[i];
  14443. gridVjson.columns.push({
  14444. dataIndex: field.column_name,
  14445. header: field.column_desc,
  14446. });
  14447. }
  14448. return gridVjson;
  14449. };
  14450. ScopeEngine.buildFieldSet = function (fieldGroup) {
  14451. var colGroups = [{
  14452. xtype: "cols",
  14453. items: []
  14454. }];
  14455. var colGroup = colGroups[0];
  14456. _$2.sortBy(fieldGroup, function (item) { return item.sort; });
  14457. for (var i = 0; i < fieldGroup.length; i++) {
  14458. var field = fieldGroup[i];
  14459. if (field.field.form_newline === "true") {
  14460. if (colGroup.items.length > 0) {
  14461. colGroup = {
  14462. xtype: "cols",
  14463. items: [field]
  14464. };
  14465. colGroups.push(colGroup);
  14466. }
  14467. }
  14468. else {
  14469. colGroup.items.push(field);
  14470. }
  14471. delete field.field;
  14472. }
  14473. return colGroups;
  14474. };
  14475. ScopeEngine.buildButton = function (controller, buttons) {
  14476. var buttonsVjson = [];
  14477. var _loop_1 = function (i) {
  14478. var item = buttons[i];
  14479. var button = {
  14480. xtype: "button",
  14481. text: item.btn_name,
  14482. iconCls: item.icon
  14483. };
  14484. if (item.hidden === "true" || item.hidden === "false") {
  14485. button.hidden = (item.hidden === "true");
  14486. }
  14487. if (item.listeners) {
  14488. var listeners_1 = {};
  14489. _$2.forOwn(item.listeners, function (v, k) {
  14490. if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
  14491. listeners_1[k] = v;
  14492. }
  14493. else {
  14494. try {
  14495. listeners_1[k] = eval(v);
  14496. }
  14497. catch (e) {
  14498. throw e;
  14499. }
  14500. }
  14501. });
  14502. button.listeners = listeners_1;
  14503. }
  14504. buttonsVjson.push(button);
  14505. };
  14506. for (var i = 0; i < buttons.length; i++) {
  14507. _loop_1(i);
  14508. }
  14509. return buttonsVjson;
  14510. };
  14511. ScopeEngine.buildListeners = function (controller, item) {
  14512. if (!item.hasOwnProperty("listeners")) {
  14513. return;
  14514. }
  14515. _$2.forOwn(item.listeners, function (v, k) {
  14516. if (v && typeof v === "string") {
  14517. if (v.indexOf(".") > -1) {
  14518. var strArr = v.split(".");
  14519. if (strArr.length != 2) {
  14520. console.error(item.listeners, "语法解析错误,请检查!");
  14521. }
  14522. var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
  14523. switch (funcDomain) {
  14524. case exports.FuncDomain.SCOPE:
  14525. controller[k] = findCustFunc(item, k);
  14526. break;
  14527. case exports.FuncDomain.SYSTEM:
  14528. break;
  14529. default:
  14530. throw new Error("错误的函数域定义");
  14531. }
  14532. }
  14533. else {
  14534. var func = eval(v);
  14535. if (typeof func === 'function') {
  14536. controller[k] = func;
  14537. }
  14538. throw new Error("解析自定义函数出错");
  14539. }
  14540. }
  14541. });
  14542. var findCustFunc = function (item, funcName) {
  14543. if (!item.hasOwnProperty("funcs") || !item[funcName]) {
  14544. throw new Error("没有找到相关的函数定义");
  14545. }
  14546. var func = eval(item[funcName]);
  14547. if (typeof func === 'function') {
  14548. return func;
  14549. }
  14550. throw new Error("解析自定义函数出错");
  14551. };
  14552. };
  14553. /**
  14554. * 只检索 items 的模式,深度遍历 vjson
  14555. */
  14556. ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
  14557. if (Array.isArray(vjson)) {
  14558. for (var i = 0; i < vjson.length; i++) {
  14559. ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
  14560. }
  14561. }
  14562. else {
  14563. _$2.forOwn(vjson, function (v, k) {
  14564. if (k !== "domain") {
  14565. if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
  14566. ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
  14567. }
  14568. }
  14569. else {
  14570. delete vjson.domain;
  14571. _$2.merge(vjson, domainsVjson[v]);
  14572. }
  14573. });
  14574. }
  14575. };
  14576. return ScopeEngine;
  14577. }());
  14578. function initComponent () {
  14579. var ct = Ext.Component.prototype.constructor;
  14580. Ext.Component.override({
  14581. constructor: function (config) {
  14582. var _a, _b;
  14583. if (!isDesignMode(this, config)) {
  14584. var me_1 = this;
  14585. // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
  14586. _$2.each(baseConfigProcessList, function (process) {
  14587. process.call(me_1, me_1, config);
  14588. });
  14589. }
  14590. if (config) {
  14591. if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
  14592. config.i18nPath = config.$initParent.i18nPath;
  14593. }
  14594. if ((_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.setTitle) {
  14595. var setTitle_1 = config.$initParent.setTitle;
  14596. var handel_1 = config.$initParent;
  14597. config.$initParent.setTitle = function (title) {
  14598. var t = { title: title };
  14599. var WMSTranslate = window["WMSTranslate"];
  14600. if (WMSTranslate) {
  14601. if (typeof window['viewTranslate'] === 'function') {
  14602. window['viewTranslate'](t, title, "title");
  14603. }
  14604. }
  14605. setTitle_1.call(handel_1, t.title);
  14606. }.bind(config.$initParent);
  14607. }
  14608. var WMSTranslate = window["WMSTranslate"];
  14609. if (WMSTranslate) {
  14610. if (typeof window['viewTranslate'] === 'function') {
  14611. window['viewTranslate'](config, config.text, "text");
  14612. window['viewTranslate'](config, config.title, "title");
  14613. window['viewTranslate'](config, config.header, "header");
  14614. window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
  14615. window['viewTranslate'](config, config.emptyText, "emptyText");
  14616. }
  14617. }
  14618. }
  14619. ct.call(this, config);
  14620. }
  14621. });
  14622. var _initComponent = Ext.picker.Date.prototype.initComponent;
  14623. Ext.picker.Date.override({
  14624. initComponent: function () {
  14625. var me = this;
  14626. me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
  14627. _initComponent.call(me);
  14628. },
  14629. selectToday: function () {
  14630. var me = this, btn = me.todayBtn, handler = me.handler;
  14631. if (btn && !btn.disabled) {
  14632. me.setValue(Ext.Date.clearTime(syncDate(new Date())));
  14633. me.fireEvent('select', me, me.value);
  14634. if (handler) {
  14635. Ext.callback(handler, me.scope, [me, me.value], null, me, me);
  14636. }
  14637. me.onSelect();
  14638. }
  14639. return me;
  14640. },
  14641. });
  14642. }
  14643. function initMainTab () {
  14644. Ext.define('Yvan.MainTab', {
  14645. extend: 'Ext.tab.Panel',
  14646. xtype: 'maintab',
  14647. plugins: Ext.create('Ext.ux.TabCloseMenu', {
  14648. closeTabText: '关闭',
  14649. closeOthersTabsText: '关闭其他',
  14650. closeAllTabsText: '关闭所有'
  14651. }),
  14652. constructor: function (config) {
  14653. var me = this;
  14654. var newConfig = _$2.defaultsDeep({
  14655. // 强制属性
  14656. }, config);
  14657. this.superclass.constructor.call(me, newConfig);
  14658. },
  14659. initComponent: function () {
  14660. var me = this;
  14661. this.on({
  14662. tabchange: function (tabPanel, newCard, oldCard, eOpts) {
  14663. _$2.defer(function () {
  14664. me.changeHash(newCard.id);
  14665. window['cp'] = newCard.yvanScope;
  14666. });
  14667. $$2(window).trigger('tabChange', {
  14668. tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
  14669. });
  14670. },
  14671. afterrender: function () {
  14672. _$2.defer(function () {
  14673. me.tryRestoryPage();
  14674. });
  14675. }
  14676. });
  14677. this.superclass.initComponent.call(me);
  14678. },
  14679. tryRestoryPage: function () {
  14680. var me = this;
  14681. var hash = '' + window.location.hash;
  14682. if (hash && hash.indexOf('page=') > 0) {
  14683. if (hash.startsWith('#')) {
  14684. hash = hash.substr(1);
  14685. }
  14686. if (hash) {
  14687. var page = Qs.parse(hash).page;
  14688. if (page) {
  14689. // this.openScope(page)
  14690. me.fireEvent('restorypage', page);
  14691. }
  14692. }
  14693. }
  14694. },
  14695. changeHash: function (id) {
  14696. window.location.hash = Qs.stringify({ page: id });
  14697. },
  14698. /**
  14699. * 添加一个业务模块实例到选项卡
  14700. * @param scopeInstance 业务对象实例
  14701. * @param config ExtJS配置对象
  14702. * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
  14703. */
  14704. addScope: function (scopeInstance, config, panelInitCallback) {
  14705. scopeInstance.topScope = scopeInstance;
  14706. var me = this;
  14707. if (config.path) {
  14708. for (var i = 0; i < this.items.items.length; i++) {
  14709. // 找到当前 tabs 里有没有已经打开过
  14710. var tab = this.items.items[i];
  14711. if (_$2.isEqual(tab.path, config.path)) {
  14712. // 激活
  14713. this.setActiveTab(tab);
  14714. return tab;
  14715. }
  14716. }
  14717. }
  14718. var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
  14719. if (typeof panelInitCallback === 'function') {
  14720. panelInitCallback(newPanel);
  14721. }
  14722. // 添加业务模块
  14723. var newTab = this.add(newPanel);
  14724. this.setActiveTab(newTab);
  14725. newTab.on({
  14726. destroy: function (sender) {
  14727. me.changeHash('');
  14728. delete window['cp'];
  14729. }
  14730. });
  14731. return newTab;
  14732. }
  14733. });
  14734. }
  14735. /**
  14736. * 构建所有组件的公共属性
  14737. * @param config 原始config
  14738. * @param dragType 组件模式
  14739. * 不填,代表不能在设计时被拖拽
  14740. * row-container 是一个rows容器
  14741. * col-container 是一个cols容器
  14742. * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
  14743. * row-item rows中的一行,比如 tree / grid / panel 等等
  14744. */
  14745. function baseConfig(config, dragType) {
  14746. // if (isDesignMode(config, undefined) && dragType) {
  14747. if (typeof config === 'object') {
  14748. var cc = '';
  14749. switch (dragType) {
  14750. case "cols-container":
  14751. cc = 'design_cols_container';
  14752. break;
  14753. case "col-item":
  14754. cc = 'design_col_item';
  14755. break;
  14756. case "rows-container":
  14757. cc = 'design_rows_container';
  14758. break;
  14759. case "row-item":
  14760. cc = 'design_row_item';
  14761. break;
  14762. }
  14763. if (typeof config.cls === 'string') {
  14764. _$2.extend(config, {
  14765. cls: [config.cls, 'yvan_design', cc]
  14766. });
  14767. }
  14768. else if (_$2.isArray(config.cls)) {
  14769. _$2.extend(config, {
  14770. cls: __spread(config.cls, ['yvan_design', cc])
  14771. });
  14772. }
  14773. else {
  14774. _$2.extend(config, {
  14775. cls: ['yvan_design', cc]
  14776. });
  14777. }
  14778. }
  14779. return config;
  14780. }
  14781. function initPanel () {
  14782. /**
  14783. *
  14784. */
  14785. var ct = Ext.panel.Panel.prototype.constructor;
  14786. Ext.panel.Panel.override({
  14787. constructor: function (config) {
  14788. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
  14789. ct.call(this, newConfig);
  14790. }
  14791. });
  14792. var ss = Ext.form.FieldContainer.prototype;
  14793. Ext.form.FieldContainer.override({
  14794. config: __assign({}, fieldContainer)
  14795. });
  14796. }
  14797. function initGridColumn () {
  14798. var ct = Ext.grid.column.Column.prototype.constructor;
  14799. Ext.grid.column.Column.override({
  14800. constructor: function (config) {
  14801. var scope = lookupScope(config.$initParent.$initParent);
  14802. var newConfig = _$2.defaults({}, config, column);
  14803. if (typeof newConfig.summaryRenderer === 'string') {
  14804. newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
  14805. if (typeof newConfig.summaryRenderer === 'function') {
  14806. newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
  14807. }
  14808. }
  14809. if (config.formatter === 'datetime') {
  14810. newConfig.fix = ['system.formatDate()'];
  14811. delete newConfig.formatter;
  14812. }
  14813. // 在 grid.constructor 已经转换过了
  14814. // if (typeof newConfig.renderer === 'string') {
  14815. // newConfig.renderer = lookupFn(scope, config.renderer)
  14816. // if (typeof newConfig.renderer === 'function') {
  14817. // newConfig.renderer = newConfig.renderer.bind(scope)
  14818. // }
  14819. // }
  14820. ct.call(this, newConfig);
  14821. }
  14822. });
  14823. var ctAction = Ext.grid.column.Action.prototype.constructor;
  14824. Ext.grid.column.Action.override({
  14825. constructor: function (config) {
  14826. var scope = lookupScope(config.$initParent.$initParent);
  14827. _$2.forEach(config.items, function (item) {
  14828. if (typeof item.handler === 'string') {
  14829. item.handler = lookupFn(scope, item.handler);
  14830. if (typeof item.handler === 'function') {
  14831. item.handler = item.handler.bind(scope);
  14832. }
  14833. }
  14834. });
  14835. ctAction.call(this, config);
  14836. }
  14837. });
  14838. var ck = Ext.grid.column.Check.prototype.constructor;
  14839. Ext.grid.column.Check.override({
  14840. constructor: function (config) {
  14841. _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
  14842. var grid = sender.view.grid.ownerGrid;
  14843. var column = grid.getColumns()[sender.fullColumnIndex];
  14844. var context = {
  14845. event: e,
  14846. column: column,
  14847. field: sender.dataIndex,
  14848. value: checked,
  14849. record: record,
  14850. rowIdx: rowIndex
  14851. };
  14852. grid.fireEvent('editfinish', grid, sender, context, eOpts);
  14853. });
  14854. ck.call(this, config);
  14855. }
  14856. });
  14857. // 227573
  14858. // const {onTitleElClick} = Ext.grid.column.Column.prototype
  14859. // Ext.define('Yvan.ColumnOverride', {
  14860. // override: 'Ext.grid.column.Column',
  14861. //
  14862. // config: {
  14863. // enableSortOnClick: false,
  14864. // },
  14865. //
  14866. // // /**@Overrides*/
  14867. // onTitleElClick: function (e, t, sortOnClick) {
  14868. // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
  14869. // if (!$(e.target).is('.x-column-header-trigger')) {
  14870. // // 不是点击菜单的情况下,让列自适应宽度
  14871. // this.autoSize()
  14872. // }
  14873. // return onTitleElClick.call(this, e, t, false)
  14874. // }
  14875. // });
  14876. }
  14877. var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
  14878. /**
  14879. * 判断目标字符串与关键字是否重叠
  14880. * @param target 目标字符串
  14881. * @param keyword 搜索关键字
  14882. */
  14883. function pinyinMatch(target, keyword) {
  14884. if (typeof target != 'string' || typeof keyword != 'string') {
  14885. return false;
  14886. }
  14887. if (!keyword || !target) {
  14888. return false;
  14889. }
  14890. var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
  14891. keyword = _$2.toLower(keyword);
  14892. var pos1 = _$2.toLower(target).indexOf(keyword);
  14893. if (pos1 >= 0) {
  14894. return true;
  14895. }
  14896. var len = _$2.intersection(keyword.split('')).length;
  14897. if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
  14898. return true;
  14899. }
  14900. return false;
  14901. }
  14902. /**
  14903. * 对某个表达式进行求值
  14904. * a:{query.a},b:{query.b} -> a:aValue,b:bValue
  14905. *
  14906. * @example
  14907. * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
  14908. * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
  14909. *
  14910. * @param data 数据环境对象
  14911. * @param express 表达式对象
  14912. */
  14913. function calcExpress(data, express) {
  14914. var result = express;
  14915. if (SIMPLE_RE.test(express)) {
  14916. // '{foo}' 简单表达式
  14917. var path = express.substring(1, express.length - 1);
  14918. var ret = _$2.get(data, path);
  14919. return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
  14920. }
  14921. while (true) {
  14922. var mlist = result.match(/{(.*?)}/);
  14923. if (!mlist) {
  14924. break;
  14925. }
  14926. var pathC = mlist[0]; // {query.a}
  14927. var path = mlist[1]; // query.a
  14928. var value = _$2.get(data, path);
  14929. result = result.replaceAll(pathC, value || '');
  14930. }
  14931. return result;
  14932. }
  14933. /**
  14934. * 对个对象进行表达式求值,不用回调
  14935. * @example
  14936. * 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}'] })
  14937. *
  14938. * {
  14939. * a: '{query.a}',
  14940. * b: {
  14941. * b1: '{query.b1}',
  14942. * b2: '{query.b2}',
  14943. * },
  14944. * c: 'aa',
  14945. * d: [
  14946. * '{query.d1}',
  14947. * '{query.d2}'
  14948. * ]
  14949. * }
  14950. *
  14951. * 计算结果为
  14952. * {
  14953. * a: 'aValue',
  14954. * b: {
  14955. * b1: 'b1Value',
  14956. * b2: 'b2Value'
  14957. * },
  14958. * c: 'aa'
  14959. * d: [
  14960. * '1',
  14961. * '2'
  14962. * ]
  14963. * }
  14964. *
  14965. * @param data
  14966. * @param paramObject
  14967. */
  14968. function calcObjectFlat(data, paramObject) {
  14969. var result = _$2.cloneDeep(paramObject);
  14970. if (typeof paramObject === 'string') {
  14971. return calcExpress(data, paramObject);
  14972. }
  14973. var trav = function (param) {
  14974. _$2.forOwn(param, function (value, key) {
  14975. if (_$2.isPlainObject(value)) {
  14976. // 深度递归,对子对象进行求解
  14977. trav(value);
  14978. }
  14979. else if (_$2.isString(value)) {
  14980. // 字符串直接用 calcExpress 表达式求解
  14981. param[key] = calcExpress(data, param[key]);
  14982. }
  14983. else if (_$2.isArray(value)) {
  14984. // 数组求解
  14985. _$2.each(value, function (v, idx) {
  14986. value[idx] = calcExpress(data, v);
  14987. });
  14988. }
  14989. });
  14990. };
  14991. trav(result);
  14992. return result;
  14993. }
  14994. /**
  14995. * 合併 data 到當前的 ViewModel 對象
  14996. */
  14997. function mergeViewModel(viewModel, propertyName, data, isFlat) {
  14998. var newRow = {};
  14999. if (isFlat == false) {
  15000. newRow = data;
  15001. }
  15002. else {
  15003. flatObject(newRow, '', data);
  15004. }
  15005. if (!propertyName) {
  15006. _$2.forOwn(newRow, function (value, key) {
  15007. viewModel.set(key, value);
  15008. });
  15009. }
  15010. else {
  15011. _$2.forOwn(newRow, function (value, key) {
  15012. viewModel.set(propertyName + "." + key, value);
  15013. });
  15014. }
  15015. }
  15016. /**
  15017. * 转换内联结构的行,到平面结构
  15018. * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
  15019. *
  15020. * @param array
  15021. * @param flatOption
  15022. * @return {[]}
  15023. */
  15024. function flatRow(array) {
  15025. var ret = [];
  15026. _$2.forEach(array, function (row) {
  15027. var newRow = {};
  15028. flatObject(newRow, '', row);
  15029. ret.push(newRow);
  15030. });
  15031. return ret;
  15032. }
  15033. function flatObject(parentObj, parentProp, obj) {
  15034. _$2.forOwn(obj, function (value, key) {
  15035. var fullKey = parentProp ? parentProp + '_' + key : key;
  15036. if (_$2.isArray(value)) {
  15037. parentObj[fullKey] = _$2.map(value, function (row) {
  15038. var newRow = {};
  15039. flatObject(newRow, '', row);
  15040. return newRow;
  15041. });
  15042. }
  15043. else {
  15044. if (typeof value === 'object') {
  15045. flatObject(parentObj, fullKey, value);
  15046. }
  15047. else {
  15048. parentObj[fullKey] = value;
  15049. }
  15050. }
  15051. });
  15052. }
  15053. /**
  15054. * 替换内部结构中,所有 N/A
  15055. */
  15056. function replaceNA(obj) {
  15057. if (obj === 'N/A') {
  15058. return '';
  15059. }
  15060. if (_$2.isArray(obj)) {
  15061. _$2.forEach(obj, function (value, idx) {
  15062. if (value === 'N/A') {
  15063. obj[idx] = '';
  15064. }
  15065. else {
  15066. if (typeof value === "string" && /^-?\d*\.\d+$/.test(value)) {
  15067. var count = 0;
  15068. for (var i = value.length - 1; i > 0; i--) {
  15069. if (value[i] === "0") {
  15070. count++;
  15071. }
  15072. else if (value[i] === ".") {
  15073. count++;
  15074. break;
  15075. }
  15076. else {
  15077. break;
  15078. }
  15079. }
  15080. obj[idx] = value.substr(0, value.length - count);
  15081. }
  15082. else {
  15083. replaceNA(value);
  15084. }
  15085. }
  15086. });
  15087. }
  15088. else if (_$2.isPlainObject(obj)) {
  15089. _$2.forOwn(obj, function (value, key) {
  15090. if (value === 'N/A') {
  15091. obj[key] = '';
  15092. }
  15093. else {
  15094. if (typeof value === "string" && /^-?\d*\.\d+$/.test(value)) {
  15095. var count = 0;
  15096. for (var i = value.length - 1; i > 0; i--) {
  15097. if (value[i] === "0") {
  15098. count++;
  15099. }
  15100. else if (value[i] === ".") {
  15101. count++;
  15102. break;
  15103. }
  15104. else {
  15105. break;
  15106. }
  15107. }
  15108. obj[key] = value.substr(0, value.length - count);
  15109. }
  15110. else {
  15111. replaceNA(value);
  15112. }
  15113. }
  15114. });
  15115. }
  15116. }
  15117. function deepTravJson(obj, resolver) {
  15118. if (_$2.isArray(obj)) {
  15119. _$2.forEach(obj, function (value, idx) {
  15120. if (typeof value === 'string') {
  15121. resolver(obj, value, idx);
  15122. }
  15123. else {
  15124. deepTravJson(value, resolver);
  15125. }
  15126. });
  15127. }
  15128. else if (_$2.isPlainObject(obj)) {
  15129. _$2.forOwn(obj, function (value, key) {
  15130. if (typeof value === 'string') {
  15131. resolver(obj, value, key);
  15132. }
  15133. else {
  15134. deepTravJson(value, resolver);
  15135. }
  15136. });
  15137. }
  15138. }
  15139. /**
  15140. * 根据表达式进入写值
  15141. * express="{query.a}" 写值就是 viewModel.set('query.a', value)
  15142. * express="test-{query.a}" 写值就会失败
  15143. *
  15144. * @example
  15145. * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
  15146. * 写值成功
  15147. *
  15148. * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
  15149. * 写值失败
  15150. *
  15151. * @param viewModel VM对象
  15152. * @param express 表达式对象
  15153. * @param value 目标值
  15154. */
  15155. function tryWriteByExpress(viewModel, express, value) {
  15156. if (SIMPLE_RE.test(express)) {
  15157. // '{foo}' 简单表达式
  15158. express = express.substring(1, express.length - 1);
  15159. viewModel.set(express, value);
  15160. }
  15161. }
  15162. /**
  15163. * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
  15164. * @example
  15165. * 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]})
  15166. *
  15167. * expressObject:
  15168. * {
  15169. * a: '{query.a}',
  15170. * b: {
  15171. * b1: '{query.b1}',
  15172. * b2: '{query.b2}',
  15173. * },
  15174. * c: 'aa',
  15175. * d: [
  15176. * '{query.a}',
  15177. * '{query.b2}'
  15178. * ]
  15179. * }
  15180. *
  15181. * valueObject:
  15182. * {
  15183. * a: 'aValue',
  15184. * b: {
  15185. * b1: 'b1Value',
  15186. * b2: 'b2Value'
  15187. * },
  15188. * c: 'aa'
  15189. * c: [
  15190. * 'aValue',
  15191. * 'b2Value'
  15192. * ]
  15193. * }
  15194. *
  15195. * 系统会尝试回写
  15196. * viewModel.set('query.a', 'aValue')
  15197. * viewModel.set('query.b1', 'b1Value')
  15198. * viewModel.set('query.b2', 'b2Value')
  15199. *
  15200. * @param expressObject 含表达式的对象
  15201. * @param valueObject 表达式计算完成之后的结果对象
  15202. * @param writeFn 写入的方法 (path, value)=>void
  15203. */
  15204. function tryWriteObject(expressObject, valueObject, writeFn) {
  15205. var trav = function (pathPrefix) {
  15206. var parent = expressObject;
  15207. if (_$2.size(pathPrefix) > 1) {
  15208. parent = _$2.get(parent, pathPrefix.substring(1));
  15209. }
  15210. _$2.forOwn(parent, function (value, key) {
  15211. if (_$2.isPlainObject(value)) {
  15212. // 深度递归,对子对象进行求解
  15213. trav(pathPrefix + "." + key);
  15214. }
  15215. else if (_$2.isString(value)) {
  15216. // 字符串直接用 calcExpress 表达式求解
  15217. if (SIMPLE_RE.test(value)) {
  15218. // If we have '{foo}' alone it is a literal 简单表达式
  15219. var targetPath = value.substring(1, value.length - 1);
  15220. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
  15221. if (!writeFn) {
  15222. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15223. }
  15224. else {
  15225. writeFn(targetPath, targetValue);
  15226. }
  15227. }
  15228. }
  15229. else if (_$2.isArray(value)) {
  15230. _$2.each(value, function (v, idx) {
  15231. if (SIMPLE_RE.test(v)) {
  15232. var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
  15233. var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
  15234. if (!writeFn) {
  15235. console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
  15236. }
  15237. else {
  15238. writeFn(targetPath, targetValue);
  15239. }
  15240. }
  15241. });
  15242. }
  15243. });
  15244. };
  15245. trav("");
  15246. }
  15247. /**
  15248. * 尝试去掉变量两边括号
  15249. * {a} => a
  15250. * a => a
  15251. */
  15252. function tryVarSimple(value) {
  15253. if (SIMPLE_RE.test(value)) {
  15254. // If we have '{foo}' alone it is a literal 简单表达式
  15255. return value.substring(1, value.length - 1);
  15256. }
  15257. return value;
  15258. }
  15259. /**
  15260. * 对多个表达式进行求值. 异步回调的方式返回
  15261. * {
  15262. * a: 1,
  15263. * b: '{someBind}',
  15264. * c: ['a', 'b', 'c'],
  15265. * d: ['a', 'b', '{someBind}'],
  15266. * e: {
  15267. * y: 1,
  15268. * z: 2
  15269. * },
  15270. * f: {
  15271. * y: 1,
  15272. * z: '{someBind}'
  15273. * }
  15274. * }
  15275. *
  15276. * // Will produce
  15277. * {
  15278. * b: value,
  15279. * d: ['a', 'b', value],
  15280. * f: {
  15281. * y: 1,
  15282. * z: value
  15283. * }
  15284. * }
  15285. * @param viewModel scope.viewModel对象
  15286. * @param paramObject 求值对象
  15287. */
  15288. function calcObject(viewModel, paramObject) {
  15289. // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
  15290. return new Promise(function (resolve) {
  15291. var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
  15292. schedule.destroy();
  15293. // 从 Ext.data.Model 对象转换为 js-object 对象
  15294. ret = toPlainObject(ret);
  15295. resolve(ret);
  15296. }, viewModel, { single: true });
  15297. });
  15298. }
  15299. /**
  15300. * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
  15301. * @param config 组件构造函数传入的 config 配置文件
  15302. */
  15303. function getParentGrid(config) {
  15304. var _a;
  15305. return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
  15306. }
  15307. /**
  15308. * 解析
  15309. * {
  15310. * condition: "{skuId}",
  15311. * errorMsg: "无法编辑",
  15312. * notice: 'msg'
  15313. * }
  15314. */
  15315. function tryEnable(data, enableSetting) {
  15316. if (!enableSetting) {
  15317. // 没有这一段配置,可以编辑
  15318. return true;
  15319. }
  15320. var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
  15321. if (!evalFunction(data, condition)) {
  15322. // 没有达成 condition 条件
  15323. // 计算 msg 消息内容
  15324. var msgContent = calcExpress(data, errorMsg);
  15325. if (msgContent) {
  15326. if (!notice || notice === 'msg') {
  15327. // 进行提示
  15328. msg$1(msgContent);
  15329. }
  15330. }
  15331. return false;
  15332. }
  15333. return true;
  15334. }
  15335. /**
  15336. * 动态的为 combo 或 columns.combo 设置下拉框的值
  15337. * @param sender 目标对象
  15338. * @param config 目标对象的配置(在构造函数之前也可以)
  15339. * @param getDictFn 获取字典的方法
  15340. * @param bizKey 传入字典的参数
  15341. * @param multiValueSeparator 多个字典值的分割符号
  15342. */
  15343. function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
  15344. if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
  15345. // sender 和 config为空的时候获取值、
  15346. if (_$2.isArray(getDictFn)) {
  15347. // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
  15348. var realArray_1 = getDictFn;
  15349. getDictFn = function () {
  15350. return realArray_1;
  15351. };
  15352. }
  15353. if (!sender) {
  15354. return new Promise(function (resolve, reject) {
  15355. getDictFn(bizKey, function (r) {
  15356. resolve({ config: config, r: r });
  15357. });
  15358. });
  15359. }
  15360. if (sender.xtype === 'combotree') {
  15361. getDictFn(bizKey, function (r) {
  15362. if (sender.store) {
  15363. // 异步回传
  15364. sender.setStore(new Ext.data.TreeStore({ root: r }));
  15365. }
  15366. else {
  15367. // 同步回传
  15368. config.store = new Ext.data.TreeStore({ root: r });
  15369. }
  15370. });
  15371. return;
  15372. }
  15373. else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
  15374. getDictFn(bizKey, function (r) {
  15375. var _a, _b;
  15376. if (sender.store) {
  15377. // 异步回传
  15378. sender.setStore(new Ext.data.Store(r));
  15379. // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
  15380. // 否则在 forceSelection 的模式下。displayField 不会强制做变更
  15381. var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
  15382. if (typeof realValue !== 'undefined') {
  15383. sender.setValue(realValue);
  15384. }
  15385. }
  15386. else {
  15387. // 同步回传
  15388. config.store = new Ext.data.Store(r);
  15389. }
  15390. });
  15391. return;
  15392. }
  15393. else if (sender.xtype === 'gridcolumn') {
  15394. var grid = getParentGrid(config);
  15395. var editor_1 = config.editor, renderer = config.renderer;
  15396. getDictFn(bizKey, function (r) {
  15397. if (sender.store) {
  15398. // 已经渲染出来了, 用方法进行修改
  15399. var editor_2 = sender.getEditor();
  15400. if (editor_2 && editor_2.xtype === 'combo') {
  15401. var valueField_1 = r.field[0];
  15402. var displayField_1 = r.field[1];
  15403. editor_2.valueField = valueField_1;
  15404. editor_2.setDisplayField(displayField_1);
  15405. editor_2.setStore(new Ext.data.Store(r));
  15406. }
  15407. if (!sender.disableListFilter) {
  15408. sender.setFilter({
  15409. type: 'list',
  15410. options: _$2.map(r.data, function (r) { return ({
  15411. id: '' + r.id,
  15412. text: r.text,
  15413. }); })
  15414. });
  15415. }
  15416. }
  15417. else {
  15418. // 没有渲染之前,修改 config 即可
  15419. if (editor_1 && editor_1.xtype === 'combo') {
  15420. // 带编辑模式
  15421. editor_1.store = new Ext.data.Store(r);
  15422. }
  15423. if (!sender.disableListFilter) {
  15424. config.filter = {
  15425. type: 'list',
  15426. options: _$2.map(r.data, function (r) { return ({
  15427. id: r.id,
  15428. text: r.text,
  15429. }); })
  15430. };
  15431. }
  15432. }
  15433. // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
  15434. var renderer = function (value, metaData) {
  15435. if (metaData === void 0) { metaData = false; }
  15436. if (!value && value != 0) {
  15437. return '';
  15438. }
  15439. var valueField = r.field[metaData === true ? 1 : 0];
  15440. var displayField = r.field[metaData === true ? 0 : 1];
  15441. var separator = multiValueSeparator;
  15442. if (separator) {
  15443. var arr = value.split(separator);
  15444. var displayValue_1 = "";
  15445. var _loop_1 = function (i) {
  15446. var itv = arr[i];
  15447. if (i > 0) {
  15448. displayValue_1 += separator;
  15449. }
  15450. _$2.each(r.data, function (row) {
  15451. // 从 valueField 找到要显示的 displayField
  15452. if (row[valueField] == itv) {
  15453. displayValue_1 += row[displayField];
  15454. return false;
  15455. }
  15456. else {
  15457. if (i >= r.data.length - 1) {
  15458. displayValue_1 += itv;
  15459. }
  15460. }
  15461. });
  15462. };
  15463. for (var i = 0; i < arr.length; i++) {
  15464. _loop_1(i);
  15465. }
  15466. return displayValue_1;
  15467. }
  15468. _$2.each(r.data, function (row) {
  15469. // 从 valueField 找到要显示的 displayField
  15470. if (row[valueField] == value) {
  15471. value = row[displayField];
  15472. return false;
  15473. }
  15474. });
  15475. return value;
  15476. };
  15477. var dictForExcel = {};
  15478. var valueField = r.field[0];
  15479. var displayField = r.field[1];
  15480. _$2.each(r.data, function (row) {
  15481. // 从 valueField 找到要显示的 displayField
  15482. var key = row[valueField];
  15483. if (key != '' && typeof key != "undefined" && key != null) {
  15484. dictForExcel[key] = row[displayField];
  15485. }
  15486. });
  15487. if (sender.rendered) {
  15488. // 已经渲染出来了, 对列进行渲染
  15489. sender.renderer = renderer;
  15490. sender.dictForExcel = dictForExcel;
  15491. sender.getView().refresh();
  15492. }
  15493. else {
  15494. sender.renderer = renderer;
  15495. sender.dictForExcel = dictForExcel;
  15496. config.renderer = renderer;
  15497. config.dictForExcel = dictForExcel;
  15498. }
  15499. });
  15500. return;
  15501. }
  15502. throw new TypeError("无法识别的组件类型");
  15503. }
  15504. /**
  15505. * 调用服务器 Ajax
  15506. */
  15507. function invokeServer$1(url) {
  15508. var args = [];
  15509. for (var _i = 1; _i < arguments.length; _i++) {
  15510. args[_i - 1] = arguments[_i];
  15511. }
  15512. // @ts-ignore
  15513. return ajax.func({
  15514. url: url,
  15515. method: 'invoke',
  15516. args: args
  15517. });
  15518. }
  15519. function clearViewModelValues(viewModel, propertyName) {
  15520. if (!propertyName) {
  15521. var dd_1 = viewModel.getData();
  15522. _$2.forOwn(dd_1, function (value, key) {
  15523. viewModel.set(key, '');
  15524. });
  15525. return;
  15526. }
  15527. var dd = _$2.get(viewModel.getData(), propertyName);
  15528. _$2.forOwn(dd, function (value, key) {
  15529. viewModel.set(propertyName + '.' + key, '');
  15530. });
  15531. }
  15532. function reloadGrid(scope, gridRefName) {
  15533. var _a;
  15534. (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
  15535. }
  15536. /**
  15537. * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
  15538. */
  15539. function toPlainObject(obj) {
  15540. if (obj.isModel) {
  15541. obj = obj.data;
  15542. }
  15543. _$2.forOwn(obj, function (v, k) {
  15544. // Ext.data.Model.constructor
  15545. if (!v) {
  15546. return;
  15547. }
  15548. if (v.isModel) {
  15549. v = v.data;
  15550. }
  15551. if (typeof v === 'object') {
  15552. obj[k] = toPlainObject(v);
  15553. }
  15554. else {
  15555. obj[k] = v;
  15556. }
  15557. });
  15558. return obj;
  15559. }
  15560. function confirm(msg, sender) {
  15561. return new Promise(function (resolve) {
  15562. var _a, _b;
  15563. var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
  15564. var t = { msg: msg };
  15565. var WMSTranslate = window["WMSTranslate"];
  15566. if (WMSTranslate) {
  15567. if (typeof window['viewTranslate'] === 'function') {
  15568. window['viewTranslate'](t, msg, "msg");
  15569. }
  15570. }
  15571. var config = {
  15572. title: '请确认',
  15573. modal: true,
  15574. animateTarget: sender,
  15575. // resizable: false,
  15576. // constrainHeader: true,
  15577. // constrain: true,
  15578. // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
  15579. layout: {
  15580. type: 'hbox',
  15581. pack: 'start',
  15582. align: 'stretch'
  15583. },
  15584. items: [
  15585. {
  15586. html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
  15587. border: false,
  15588. },
  15589. {
  15590. flex: 1,
  15591. border: false,
  15592. html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
  15593. }
  15594. ],
  15595. buttons: [
  15596. {
  15597. xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
  15598. handler: function () {
  15599. resolve();
  15600. win.close();
  15601. }
  15602. },
  15603. {
  15604. xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
  15605. handler: function () {
  15606. win.close();
  15607. }
  15608. }
  15609. ],
  15610. keyMapEnabled: true,
  15611. keyMap: {
  15612. ENTER: function () {
  15613. resolve();
  15614. win.close();
  15615. }
  15616. }
  15617. };
  15618. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15619. config.constrain = true;
  15620. }
  15621. var win = new Ext.Window(config);
  15622. if (scope === null || scope === void 0 ? void 0 : scope._handle) {
  15623. (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
  15624. }
  15625. win.show();
  15626. });
  15627. }
  15628. /**
  15629. * 任何符号字符串都替换成下换线
  15630. */
  15631. function normId(value) {
  15632. return _$2.replace(value, /[^\w]/g, '_');
  15633. }
  15634. /**
  15635. *
  15636. * @param sender
  15637. * @param propertyName
  15638. * @param gridRefName
  15639. */
  15640. function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
  15641. var _a, _b;
  15642. var scope = lookupScope(sender);
  15643. clearViewModelValues(scope.viewModel, propertyName);
  15644. if (!gridRefName) {
  15645. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  15646. }
  15647. else {
  15648. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  15649. }
  15650. }
  15651. var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
  15652. if ([10, 13, 20, 40].includes(event.keyCode)) {
  15653. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  15654. var value = _$2.trim(sender.rawValue);
  15655. raiseClick(eOpts.handle);
  15656. }
  15657. }, 150);
  15658. function saveGridRow(grid1) {
  15659. var _a;
  15660. var config = grid1.config;
  15661. var scope = lookupScope(grid1);
  15662. var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
  15663. saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
  15664. // "表格保存"的相关配置
  15665. var dbSaveConfig = {
  15666. columns: [],
  15667. dbTableName: _$2.get(config, 'behavior.dbTableName'),
  15668. saveRowValues: saveRowValues,
  15669. path: scope.originalVjson.__custom_path,
  15670. };
  15671. var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  15672. if (err) {
  15673. // 如果有异常就不保存
  15674. return;
  15675. }
  15676. // 构建"表格保存"的相关配置
  15677. for (var i = 0; i < config.columns.length; i++) {
  15678. var c = config.columns[i];
  15679. var v = {
  15680. dataIndex: c.dataIndex,
  15681. header: c.header,
  15682. dbColumn: c.dbColumn,
  15683. serverCreateValue: c.serverCreateValue,
  15684. dbIsDeleteKey: c.dbIsDeleteKey,
  15685. dbIsUpdateKey: c.dbIsUpdateKey,
  15686. dbUpdateEnable: c.dbUpdateEnable,
  15687. serverValueConvert: c.dbUpdateEnable,
  15688. };
  15689. if (c.editor) {
  15690. v.editor = {
  15691. xtype: c.editor.xtype,
  15692. required: c.editor.required,
  15693. };
  15694. }
  15695. dbSaveConfig.columns.push(v);
  15696. }
  15697. // 进行业务上的逻辑校验
  15698. var hasError = false;
  15699. _$2.forEach(rows, function (row, i) {
  15700. for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
  15701. var c = config.columns[i_1];
  15702. var value = row[c.dataIndex];
  15703. if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
  15704. msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
  15705. hasError = true;
  15706. return false;
  15707. }
  15708. if (c.xtype === 'checkcolumn') {
  15709. if (value === false && typeof c.uncheckedValue !== 'undefined') {
  15710. row[c.dataIndex] = c.uncheckedValue;
  15711. }
  15712. if (value === true && typeof c.checkedValue !== 'undefined') {
  15713. row[c.dataIndex] = c.checkedValue;
  15714. }
  15715. }
  15716. }
  15717. });
  15718. if (hasError) {
  15719. return;
  15720. }
  15721. // 设置当前界面为 "保存中..." 状态
  15722. grid1.setLoading(true);
  15723. invokeServer$1('/Dev@batchSave', {
  15724. newRows: newRows,
  15725. modifyRows: modifyRows,
  15726. removeRecords: removeRecords,
  15727. config: dbSaveConfig,
  15728. }).then(function (res) {
  15729. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  15730. msg$1(res.msg);
  15731. grid1.reload();
  15732. }).catch(function (e) {
  15733. console.error(e);
  15734. showErrorDialog$1(_$2.toString(e));
  15735. }).finally(function () {
  15736. // 无论正常异常,关闭 "保存中..." 状态
  15737. grid1.setLoading(false);
  15738. });
  15739. }
  15740. function insertGridRow(grid1) {
  15741. var config = grid1.config;
  15742. var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
  15743. var insertRow = {};
  15744. _$2.forEach(config.columns, function (c) {
  15745. var fn = c.createValue;
  15746. if (_$2.startsWith(fn, 'scope.') ||
  15747. _$2.startsWith(fn, 'system.')) {
  15748. var scope = lookupScope(grid1);
  15749. var fn2 = lookupFn(scope, fn, c);
  15750. if (_$2.isFunction(fn2)) {
  15751. var newValue = fn2();
  15752. if (!_$2.isUndefined(newValue)) {
  15753. insertRow[c.dataIndex] = newValue;
  15754. }
  15755. }
  15756. }
  15757. else if (_$2.isString(fn) && fn) {
  15758. insertRow[c.dataIndex] = fn;
  15759. }
  15760. });
  15761. grid1.appendEditRow(insertRow, focusColumnAfterInsert);
  15762. }
  15763. function commitMe(sender) {
  15764. var window = sender.up('window');
  15765. var scope = lookupScope(sender);
  15766. if (typeof scope['commit'] === 'function') {
  15767. scope['commit']().then(function (res) {
  15768. window.close();
  15769. });
  15770. }
  15771. }
  15772. function removeGridRow(grid1) {
  15773. var _a;
  15774. var config = grid1.config;
  15775. var rows = [];
  15776. if (grid1.selModel.selType === "rowmodel") {
  15777. rows.push(grid1.selection);
  15778. }
  15779. else {
  15780. (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
  15781. rows.push(r);
  15782. });
  15783. }
  15784. if (rows.length > 1) {
  15785. var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
  15786. if (_$2.isUndefined(batchRemoveConfirm)) {
  15787. //不需要提示
  15788. _$2.forEach(rows, function (r) {
  15789. grid1.getStore().remove(r);
  15790. });
  15791. }
  15792. else {
  15793. var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
  15794. confirm(tip).then(function () {
  15795. _$2.forEach(rows, function (r) {
  15796. grid1.getStore().remove(r);
  15797. });
  15798. });
  15799. }
  15800. }
  15801. else if (rows.length === 1) {
  15802. var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
  15803. if (_$2.isUndefined(singleRemoveConfirm)) {
  15804. //不需要提示
  15805. grid1.getStore().remove(rows[0]);
  15806. }
  15807. else {
  15808. var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
  15809. _$2.forEach(config.columns, function (c) {
  15810. tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
  15811. });
  15812. confirm(tip_1).then(function () {
  15813. grid1.getStore().remove(rows[0]);
  15814. });
  15815. }
  15816. }
  15817. else {
  15818. msg$1('请选择要删除的数据!');
  15819. }
  15820. }
  15821. function moveUpGridRow(grid) {
  15822. grid.rowMoveUp();
  15823. }
  15824. function moveDownGridRow(grid) {
  15825. grid.rowMoveDown();
  15826. }
  15827. var SystemEventFu = /** @class */ (function () {
  15828. function SystemEventFu() {
  15829. }
  15830. SystemEventFu.prototype.moveUpGridRow = function () {
  15831. return function (sender) {
  15832. var grid1 = sender.up('yvgrid');
  15833. moveUpGridRow(grid1);
  15834. };
  15835. };
  15836. SystemEventFu.prototype.commitMe = function () {
  15837. return function (sender) {
  15838. commitMe(sender);
  15839. };
  15840. };
  15841. SystemEventFu.prototype.moveDownGridRow = function () {
  15842. return function (sender) {
  15843. var grid1 = sender.up('yvgrid');
  15844. moveDownGridRow(grid1);
  15845. };
  15846. };
  15847. SystemEventFu.prototype.saveGridRow = function () {
  15848. return function (sender) {
  15849. var grid1 = sender.up('yvgrid');
  15850. saveGridRow(grid1);
  15851. };
  15852. };
  15853. SystemEventFu.prototype.insertGridRow = function () {
  15854. return function (sender) {
  15855. var grid1 = sender.up('yvgrid');
  15856. insertGridRow(grid1);
  15857. };
  15858. };
  15859. SystemEventFu.prototype.removeGridRow = function () {
  15860. return function (sender) {
  15861. var grid1 = sender.up('yvgrid');
  15862. removeGridRow(grid1);
  15863. };
  15864. };
  15865. SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
  15866. return function (sender, config) {
  15867. if (!config.listeners) {
  15868. config.listeners = {};
  15869. }
  15870. config.listeners.afterrender = function (sender) {
  15871. var scope = lookupScope(sender);
  15872. // $(sender.el.dom).on('keydown', (e) => {
  15873. // const xtype = Ext.fly(e.target).component.xtype
  15874. // if (xtype === 'textfield' && e.keyCode === 13) {
  15875. // Ext.defer(() => {
  15876. // raiseClick(scope.refs[btnReferenceName])
  15877. // })
  15878. // e.preventDefault()
  15879. // e.stopPropagation()
  15880. // return false
  15881. // }
  15882. // })
  15883. $(sender.el.dom).on('keyup', function (e) {
  15884. var tt = Ext.fly(e.target).component;
  15885. var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
  15886. if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
  15887. ![10, 13, 20, 40].includes(e.keyCode)) {
  15888. return;
  15889. }
  15890. e.preventDefault();
  15891. e.stopPropagation();
  15892. keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
  15893. return;
  15894. });
  15895. };
  15896. };
  15897. };
  15898. SystemEventFu.prototype.confirm = function (text, fn) {
  15899. return function (sender) {
  15900. var scope = lookupScope(sender);
  15901. var msg = calcExpress(scope.viewModel.data, text);
  15902. confirm(msg, sender).then(function () {
  15903. fn.call(scope, sender);
  15904. });
  15905. };
  15906. };
  15907. SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
  15908. return function (sender) {
  15909. var scope = lookupScope(sender);
  15910. var grid = scope.refs[gridRefName];
  15911. if (grid) {
  15912. var records = grid.getSelectionModel().getLastSelected();
  15913. grid.store.remove(records);
  15914. }
  15915. };
  15916. };
  15917. SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
  15918. //可以是 scope.XX / system.XX / string / lookup表达式
  15919. writeTarget) {
  15920. return function (sender) {
  15921. if (!invokeUrl) {
  15922. return;
  15923. }
  15924. var scope = lookupScope(sender);
  15925. scope.setLoading(true);
  15926. var data = scope.viewModel.data;
  15927. if (invokeParam) {
  15928. data = calcObjectFlat(data, invokeParam);
  15929. }
  15930. invokeServer$1(invokeUrl, data).then(function (res) {
  15931. if (res.success) {
  15932. if (typeof writeTarget === "string") {
  15933. _$2.forOwn(res.data, function (v, k) {
  15934. scope.viewModel.set(writeTarget + "." + k, v);
  15935. });
  15936. }
  15937. else if (typeof writeTarget === 'function') {
  15938. writeTarget.call(scope, res.data);
  15939. }
  15940. else if (typeof writeTarget === 'object') {
  15941. var ret = calcObjectFlat(res.data, writeTarget);
  15942. _$2.forOwn(ret, function (v, k) {
  15943. scope.viewModel.set(k, v);
  15944. });
  15945. }
  15946. }
  15947. else {
  15948. showErrorDialog$1(res.msg || '未知错误', sender);
  15949. }
  15950. }).catch(function (e) {
  15951. var _a, _b;
  15952. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15953. showErrorDialog$1(msg || e.toString(), sender);
  15954. }).finally(function () {
  15955. scope.setLoading(false);
  15956. });
  15957. };
  15958. };
  15959. SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
  15960. return function (sender) {
  15961. var scope = lookupScope(sender);
  15962. scope.setLoading(true);
  15963. var data = scope.viewModel.data;
  15964. if (arg0) {
  15965. data = calcObjectFlat(data, arg0);
  15966. }
  15967. invokeServer$1(groovyUrl, data).then(function (res) {
  15968. if (res.success) {
  15969. if (res.msg) {
  15970. msg(res.msg);
  15971. }
  15972. if (typeof successCallback === 'function') {
  15973. successCallback.call(scope, sender, res.data);
  15974. }
  15975. }
  15976. else {
  15977. showErrorDialog$1(res.msg || '未知错误', sender);
  15978. }
  15979. }).catch(function (e) {
  15980. var _a, _b;
  15981. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  15982. showErrorDialog$1(msg || e.toString(), sender);
  15983. }).finally(function () {
  15984. scope.setLoading(false);
  15985. });
  15986. };
  15987. };
  15988. SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
  15989. return function (sender) {
  15990. var scope = lookupScope(sender);
  15991. var form = scope.down('form');
  15992. if (form) {
  15993. // 如果下级有表单,就做表单校验
  15994. var valid = form.isValid();
  15995. if (!valid) {
  15996. return;
  15997. }
  15998. }
  15999. scope.setLoading(true);
  16000. var data = scope.viewModel.data;
  16001. if (arg0) {
  16002. data = calcObjectFlat(data, arg0);
  16003. }
  16004. invokeServer$1(groovyUrl, data).then(function (res) {
  16005. if (res.success) {
  16006. if (res.msg) {
  16007. msg(res.msg);
  16008. }
  16009. scope.dialogSuccess(res);
  16010. }
  16011. else {
  16012. showErrorDialog$1(res.msg || '未知错误', sender);
  16013. }
  16014. }).catch(function (e) {
  16015. var _a, _b;
  16016. var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
  16017. showErrorDialog$1(msg || e.toString(), sender);
  16018. }).finally(function () {
  16019. scope.setLoading(false);
  16020. });
  16021. };
  16022. };
  16023. SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
  16024. return function (sender) {
  16025. var scope = lookupScope(sender);
  16026. if (lookupObject) {
  16027. scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
  16028. }
  16029. else {
  16030. scope.dialogSuccess();
  16031. }
  16032. };
  16033. };
  16034. SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
  16035. return function (sender) {
  16036. var scope = lookupScope(sender);
  16037. clearViewModelValues(scope.viewModel, propertyName);
  16038. };
  16039. };
  16040. SystemEventFu.prototype.getGrid = function (url) {
  16041. return function (sender, config) {
  16042. if (config.xtype == "combogridmulti") {
  16043. // @ts-ignore
  16044. require([url], function (grid) {
  16045. _$2.forOwn(grid.default, function (v, k) {
  16046. sender[k] = v;
  16047. sender.config[k] = v;
  16048. if (sender.rendered) {
  16049. // 已经渲染出来了,重新调用 reload 强制刷新
  16050. sender.reload();
  16051. }
  16052. });
  16053. });
  16054. }
  16055. else {
  16056. // @ts-ignore
  16057. require([url], function (grid) {
  16058. sender.grid = grid.default;
  16059. config.grid = grid.default;
  16060. });
  16061. }
  16062. };
  16063. };
  16064. SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
  16065. return function (sender) {
  16066. clearViewModelReloadGrid(sender, propertyName, gridRefName);
  16067. };
  16068. };
  16069. SystemEventFu.prototype.reloadGrid = function (gridRefName) {
  16070. return function (sender) {
  16071. var _a, _b;
  16072. var scope = lookupScope(sender);
  16073. if (!gridRefName) {
  16074. (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
  16075. }
  16076. else {
  16077. (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
  16078. }
  16079. };
  16080. };
  16081. SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
  16082. return function (sender) {
  16083. var scope = lookupScope(sender);
  16084. var data = scope.viewModel.data;
  16085. var param = calcObjectFlat(data, lookupForData);
  16086. // @ts-ignore
  16087. require([url], function (module) {
  16088. var ScopeClass = module.default;
  16089. var scope = new ScopeClass();
  16090. scope.success = successCallback;
  16091. scope.showDialog(sender, {}, { data: param });
  16092. });
  16093. };
  16094. };
  16095. SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
  16096. return function (sender, queryValue) {
  16097. showWidget(widgetUrl, lookup, sender, queryValue);
  16098. };
  16099. };
  16100. SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
  16101. return function (sender) {
  16102. clearViewModelByLookup(sender, lookup);
  16103. };
  16104. };
  16105. SystemEventFu.prototype.closeMe = function (callBack) {
  16106. return function (sender) {
  16107. var scope = lookupScope(sender);
  16108. scope.close();
  16109. if (callBack) {
  16110. callBack.call(sender);
  16111. }
  16112. };
  16113. };
  16114. // 未完成
  16115. SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
  16116. return function (sender) {
  16117. var scope = lookupScope(sender);
  16118. var data = scope.viewModel.data;
  16119. var billSetting = scope.billSetting;
  16120. var param = calcObjectFlat(data, lookupForData);
  16121. return new Promise(function (resolve, reject) {
  16122. var sf = function (scope) {
  16123. scope.success = function (dlgScope, dlgSender, reData) {
  16124. };
  16125. scope.showDialog(sender, {}, { data: param });
  16126. };
  16127. // @ts-ignore
  16128. require([url], function (module) {
  16129. // 业务描述文件
  16130. if (url.endsWith(".bill")) {
  16131. ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
  16132. sf(scope);
  16133. });
  16134. }
  16135. else { //原生yvanui文件
  16136. var ScopeClass = module.default;
  16137. var scope_1 = new ScopeClass();
  16138. sf(scope_1);
  16139. }
  16140. });
  16141. });
  16142. };
  16143. };
  16144. __decorate([
  16145. Lib({
  16146. title: '为某个表格,上移行',
  16147. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16148. }),
  16149. __metadata("design:type", Function),
  16150. __metadata("design:paramtypes", []),
  16151. __metadata("design:returntype", void 0)
  16152. ], SystemEventFu.prototype, "moveUpGridRow", null);
  16153. __decorate([
  16154. Lib({
  16155. title: '为某个表格,上移行',
  16156. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16157. }),
  16158. __metadata("design:type", Function),
  16159. __metadata("design:paramtypes", []),
  16160. __metadata("design:returntype", void 0)
  16161. ], SystemEventFu.prototype, "commitMe", null);
  16162. __decorate([
  16163. Lib({
  16164. title: '为某个表格,下移行',
  16165. author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
  16166. }),
  16167. __metadata("design:type", Function),
  16168. __metadata("design:paramtypes", []),
  16169. __metadata("design:returntype", void 0)
  16170. ], SystemEventFu.prototype, "moveDownGridRow", null);
  16171. __decorate([
  16172. Lib({
  16173. title: '为某个表格,批量保存至数据库',
  16174. author: '罗一帆',
  16175. createAt: '2022-07-19',
  16176. updateAt: '2022-07-19',
  16177. type: 'system',
  16178. category: '表格',
  16179. }),
  16180. __metadata("design:type", Function),
  16181. __metadata("design:paramtypes", []),
  16182. __metadata("design:returntype", void 0)
  16183. ], SystemEventFu.prototype, "saveGridRow", null);
  16184. __decorate([
  16185. Lib({
  16186. title: '为某个表格插入数据行',
  16187. author: '罗一帆',
  16188. createAt: '2022-07-19',
  16189. updateAt: '2022-07-19',
  16190. type: 'system',
  16191. category: '表格',
  16192. }),
  16193. __metadata("design:type", Function),
  16194. __metadata("design:paramtypes", []),
  16195. __metadata("design:returntype", void 0)
  16196. ], SystemEventFu.prototype, "insertGridRow", null);
  16197. __decorate([
  16198. Lib({
  16199. title: '为某个表格删除所选数据行',
  16200. author: '罗一帆',
  16201. createAt: '2022-07-19',
  16202. updateAt: '2022-07-19',
  16203. type: 'system',
  16204. category: '表格',
  16205. }),
  16206. __metadata("design:type", Function),
  16207. __metadata("design:paramtypes", []),
  16208. __metadata("design:returntype", void 0)
  16209. ], SystemEventFu.prototype, "removeGridRow", null);
  16210. __decorate([
  16211. Lib({
  16212. title: '按下回车键之后默认是否按下某个按钮',
  16213. author: '罗一帆',
  16214. createAt: '2021-07-02',
  16215. updateAt: '2021-07-02',
  16216. type: 'system',
  16217. category: '字典',
  16218. }),
  16219. __metadata("design:type", Function),
  16220. __metadata("design:paramtypes", [Object]),
  16221. __metadata("design:returntype", void 0)
  16222. ], SystemEventFu.prototype, "enterToClick", null);
  16223. __decorate([
  16224. Lib({
  16225. title: '弹出确认对话框,回答 YES 之后调用某方法',
  16226. author: '罗一帆',
  16227. createAt: '2021-07-06',
  16228. updateAt: '2021-07-06',
  16229. type: 'system',
  16230. category: '对话框',
  16231. }),
  16232. __param(0, LibParam('对话框的确认文字', 'string')),
  16233. __param(1, LibParam('确认之后的调用的方法', 'event')),
  16234. __metadata("design:type", Function),
  16235. __metadata("design:paramtypes", [Object, Object]),
  16236. __metadata("design:returntype", void 0)
  16237. ], SystemEventFu.prototype, "confirm", null);
  16238. __decorate([
  16239. Lib({
  16240. title: '删除表格当前的选中行(前端删除)',
  16241. author: '罗一帆',
  16242. createAt: '2021-07-08',
  16243. updateAt: '2021-07-08',
  16244. type: 'system',
  16245. category: '表格',
  16246. }),
  16247. __param(0, LibParam('表格引用名', 'refs')),
  16248. __metadata("design:type", Function),
  16249. __metadata("design:paramtypes", [Object]),
  16250. __metadata("design:returntype", void 0)
  16251. ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
  16252. __decorate([
  16253. Lib({
  16254. title: '查询表单,如果 url 为空值,就取消查询',
  16255. author: '罗一帆',
  16256. createAt: '2021-07-06',
  16257. updateAt: '2021-07-06',
  16258. type: 'system',
  16259. category: '表单',
  16260. }),
  16261. __param(0, LibParam('后端服务路径', 'string')),
  16262. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16263. __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
  16264. __metadata("design:type", Function),
  16265. __metadata("design:paramtypes", [String, Object, Object]),
  16266. __metadata("design:returntype", void 0)
  16267. ], SystemEventFu.prototype, "loadForm", null);
  16268. __decorate([
  16269. Lib({
  16270. title: '提交(不做校验、不关闭窗体)',
  16271. author: '罗一帆',
  16272. createAt: '2021-07-02',
  16273. updateAt: '2021-07-02',
  16274. type: 'system',
  16275. category: '表单',
  16276. }),
  16277. __param(0, LibParam('后端服务路径', 'string')),
  16278. __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
  16279. __param(2, LibParam('提交成功后的回调', 'event', true)),
  16280. __metadata("design:type", Function),
  16281. __metadata("design:paramtypes", [String, Object, Object]),
  16282. __metadata("design:returntype", void 0)
  16283. ], SystemEventFu.prototype, "commit", null);
  16284. __decorate([
  16285. Lib({
  16286. title: '提交表单',
  16287. author: '罗一帆',
  16288. createAt: '2021-07-02',
  16289. updateAt: '2021-07-02',
  16290. type: 'system',
  16291. category: '表单',
  16292. }),
  16293. __param(0, LibParam('后端服务路径', 'string')),
  16294. __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
  16295. __metadata("design:type", Function),
  16296. __metadata("design:paramtypes", [String, Object]),
  16297. __metadata("design:returntype", void 0)
  16298. ], SystemEventFu.prototype, "formCommit", null);
  16299. __decorate([
  16300. Lib({
  16301. title: '对话框成功回调',
  16302. author: '罗一帆',
  16303. createAt: '2021-07-02',
  16304. updateAt: '2021-07-02',
  16305. type: 'system',
  16306. category: '对话框',
  16307. }),
  16308. __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
  16309. __metadata("design:type", Function),
  16310. __metadata("design:paramtypes", [Object]),
  16311. __metadata("design:returntype", void 0)
  16312. ], SystemEventFu.prototype, "dialogSuccess", null);
  16313. __decorate([
  16314. Lib({
  16315. title: '清空 viewModel 某个属性',
  16316. author: '罗一帆',
  16317. createAt: '2021-07-02',
  16318. updateAt: '2021-07-02',
  16319. type: 'system',
  16320. category: '表单',
  16321. }),
  16322. __param(0, LibParam('属性路径', 'viewModel', true)),
  16323. __metadata("design:type", Function),
  16324. __metadata("design:paramtypes", [String]),
  16325. __metadata("design:returntype", void 0)
  16326. ], SystemEventFu.prototype, "clearViewModelValues", null);
  16327. __decorate([
  16328. Lib({
  16329. title: '从其他资源获取表格设置',
  16330. author: '罗一帆',
  16331. createAt: '2021-07-02',
  16332. updateAt: '2021-07-02',
  16333. type: 'system',
  16334. category: '表单',
  16335. }),
  16336. __param(0, LibParam('定义文件', 'module')),
  16337. __metadata("design:type", Function),
  16338. __metadata("design:paramtypes", [Object]),
  16339. __metadata("design:returntype", void 0)
  16340. ], SystemEventFu.prototype, "getGrid", null);
  16341. __decorate([
  16342. Lib({
  16343. title: '清空 viewModel 某个属性,并刷新表格',
  16344. author: '罗一帆',
  16345. createAt: '2021-07-02',
  16346. updateAt: '2021-07-02',
  16347. type: 'system',
  16348. category: '表单',
  16349. }),
  16350. __param(0, LibParam('清空的属性', 'viewModel')),
  16351. __param(1, LibParam('要刷新的表格', 'refs', true)),
  16352. __metadata("design:type", Function),
  16353. __metadata("design:paramtypes", [String, String]),
  16354. __metadata("design:returntype", void 0)
  16355. ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
  16356. __decorate([
  16357. Lib({
  16358. title: '刷新表格',
  16359. author: '罗一帆',
  16360. createAt: '2021-07-02',
  16361. updateAt: '2021-07-02',
  16362. type: 'system',
  16363. category: '表单',
  16364. }),
  16365. __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
  16366. __metadata("design:type", Function),
  16367. __metadata("design:paramtypes", [String]),
  16368. __metadata("design:returntype", void 0)
  16369. ], SystemEventFu.prototype, "reloadGrid", null);
  16370. __decorate([
  16371. Lib({
  16372. title: '显示对话框',
  16373. author: '罗一帆',
  16374. createAt: '2021-07-02',
  16375. updateAt: '2021-07-02',
  16376. type: 'system',
  16377. category: '对话框',
  16378. }),
  16379. __param(0, LibParam('业务模块名', 'module')),
  16380. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16381. __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
  16382. __metadata("design:type", Function),
  16383. __metadata("design:paramtypes", [String, Object, Object]),
  16384. __metadata("design:returntype", void 0)
  16385. ], SystemEventFu.prototype, "showDialog", null);
  16386. __decorate([
  16387. Lib({
  16388. title: '弹出查找框(不借助 search)',
  16389. author: '罗一帆',
  16390. createAt: '2021-07-02',
  16391. updateAt: '2021-07-02',
  16392. type: 'system',
  16393. category: '对话框',
  16394. }),
  16395. __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
  16396. __param(1, LibParam('lookup 映射关系', 'lookup', true)),
  16397. __metadata("design:type", Function),
  16398. __metadata("design:paramtypes", [Object, Object]),
  16399. __metadata("design:returntype", void 0)
  16400. ], SystemEventFu.prototype, "showWidget", null);
  16401. __decorate([
  16402. Lib({
  16403. title: '根据 lookup 清空 viewModel',
  16404. author: '罗一帆',
  16405. createAt: '2021-07-05',
  16406. updateAt: '2021-07-05',
  16407. type: 'system',
  16408. category: '表单',
  16409. }),
  16410. __param(0, LibParam('设值表达式', 'lookup')),
  16411. __metadata("design:type", Function),
  16412. __metadata("design:paramtypes", [Object]),
  16413. __metadata("design:returntype", void 0)
  16414. ], SystemEventFu.prototype, "clearViewModelByLookup", null);
  16415. __decorate([
  16416. Lib({
  16417. title: '关闭对话框',
  16418. author: '罗一帆',
  16419. createAt: '2021-07-05',
  16420. updateAt: '2021-07-05',
  16421. type: 'system',
  16422. category: '对话框',
  16423. }),
  16424. __param(0, LibParam('对话框的返回值回调', 'event', true)),
  16425. __metadata("design:type", Function),
  16426. __metadata("design:paramtypes", [Object]),
  16427. __metadata("design:returntype", void 0)
  16428. ], SystemEventFu.prototype, "closeMe", null);
  16429. __decorate([
  16430. Lib({
  16431. title: '打开对话框并返回数据',
  16432. author: '余亮',
  16433. createAt: '2022-07-07',
  16434. updateAt: '2022-07-07',
  16435. type: 'system',
  16436. category: '对话框',
  16437. }),
  16438. __param(0, LibParam('业务模块名', 'module')),
  16439. __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
  16440. __param(2, LibParam('结果映射关系', 'string', true)),
  16441. __metadata("design:type", Function),
  16442. __metadata("design:paramtypes", [String, Object, Object]),
  16443. __metadata("design:returntype", void 0)
  16444. ], SystemEventFu.prototype, "showDialogAndFillData", null);
  16445. return SystemEventFu;
  16446. }());
  16447. /**
  16448. * 清空 viewmodel 里下属的所有属性
  16449. * @param viewModel VM对象
  16450. * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
  16451. * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
  16452. */
  16453. function clearViewModel(viewModel, propertyKey, ignoreProps) {
  16454. var data = viewModel.data;
  16455. if (propertyKey) {
  16456. data = _$2.get(data, propertyKey);
  16457. }
  16458. _$2.forOwn(data, function (value, key) {
  16459. var targetKey = propertyKey ? propertyKey + "." + key : key;
  16460. if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
  16461. return;
  16462. }
  16463. viewModel.set(targetKey, '');
  16464. });
  16465. }
  16466. function clearViewModelByLookup(sender, lookup) {
  16467. if (_$2.isPlainObject(lookup)) {
  16468. var parentScope_1 = lookupScope(sender);
  16469. _$2.forOwn(lookup, function (value, key) {
  16470. if (SIMPLE_RE.test(value)) {
  16471. // '{foo}' 简单表达式
  16472. var path = value.substring(1, value.length - 1);
  16473. if (path !== 'queryValue') {
  16474. parentScope_1.viewModel.set(path, '');
  16475. }
  16476. }
  16477. });
  16478. }
  16479. }
  16480. function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
  16481. if (vjson === void 0) { vjson = {}; }
  16482. var parentScope = lookupScope(sender);
  16483. var me = sender;
  16484. // @ts-ignore
  16485. require([widgetUrl], function (widgetScope) {
  16486. var WidgetScopeClass = widgetScope.default;
  16487. widgetScope = new WidgetScopeClass();
  16488. // 传递进 widget.model 的数据
  16489. var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
  16490. widgetScope.parentScope = parentScope;
  16491. widgetScope.searchWidgetSuccess = function (data) {
  16492. if (typeof lookup === 'string') {
  16493. // lookup 是字符串的情况下,就是取某个列作为 value 值
  16494. me.setValue(data[lookup]);
  16495. return;
  16496. }
  16497. /**
  16498. * lookup: {
  16499. * // 扩展到 viewModel 的值做更改
  16500. * WH_CODE: "{queryValue}",
  16501. * WH_NAME: "{query.WH_NAME}",
  16502. * }
  16503. */
  16504. if (_$2.isPlainObject(lookup)) {
  16505. var parentScope_2 = lookupScope(sender);
  16506. tryWriteObject(lookup, data, function (path, value) {
  16507. if (path === 'queryValue') {
  16508. me.setValue(value);
  16509. }
  16510. else {
  16511. parentScope_2.viewModel.set(path, value);
  16512. }
  16513. });
  16514. }
  16515. return true;
  16516. };
  16517. widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
  16518. });
  16519. }
  16520. /**
  16521. * 停止事件的默认行为
  16522. * @param e
  16523. */
  16524. function stopEvent(e) {
  16525. e.preventDefault();
  16526. e.stopPropagation();
  16527. // @ts-ignore
  16528. window.event.cancelBubble = true;
  16529. e.returnValue = false;
  16530. e.cancelBubble = true;
  16531. }
  16532. /**
  16533. * 屏幕中央显示一个黑框提示
  16534. */
  16535. function msg$1(content) {
  16536. msg(content);
  16537. }
  16538. /**
  16539. * 错误对话框的强提醒
  16540. */
  16541. function showErrorDialog$1(msg, sender) {
  16542. showErrorDialog(msg, sender);
  16543. }
  16544. /**
  16545. * 错误对话框的强提醒
  16546. */
  16547. function showInfoDialog(msg, sender) {
  16548. showInfoDialogSimple(msg, sender);
  16549. }
  16550. /**
  16551. * 错误对话框的强提醒
  16552. */
  16553. function prompt$2(message, defaultValue, multiLine) {
  16554. if (defaultValue === void 0) { defaultValue = ""; }
  16555. if (multiLine === void 0) { multiLine = false; }
  16556. return prompt$1(message, defaultValue, multiLine);
  16557. }
  16558. /**
  16559. * 用于计算 express 表达式
  16560. */
  16561. function evalFunction(data, express) {
  16562. var keys = [];
  16563. var values = [];
  16564. _$2.forOwn(data, function (value, key) {
  16565. var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
  16566. if (match) {
  16567. key = key.substring(0, match.index);
  16568. }
  16569. keys.push(key);
  16570. values.push(value);
  16571. });
  16572. var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
  16573. try {
  16574. return func.apply(void 0, __spread(values));
  16575. }
  16576. catch (e) {
  16577. return;
  16578. }
  16579. }
  16580. /**
  16581. * 获取表格编辑的行数据
  16582. */
  16583. function getGridEditRows(grid) {
  16584. return grid.getGridEditRows();
  16585. }
  16586. var SystemLib = /*#__PURE__*/Object.freeze({
  16587. __proto__: null,
  16588. SIMPLE_RE: SIMPLE_RE,
  16589. pinyinMatch: pinyinMatch,
  16590. calcExpress: calcExpress,
  16591. calcObjectFlat: calcObjectFlat,
  16592. mergeViewModel: mergeViewModel,
  16593. flatRow: flatRow,
  16594. replaceNA: replaceNA,
  16595. deepTravJson: deepTravJson,
  16596. tryWriteByExpress: tryWriteByExpress,
  16597. tryWriteObject: tryWriteObject,
  16598. tryVarSimple: tryVarSimple,
  16599. calcObject: calcObject,
  16600. getParentGrid: getParentGrid,
  16601. tryEnable: tryEnable,
  16602. setComboStore: setComboStore,
  16603. invokeServer: invokeServer$1,
  16604. clearViewModelValues: clearViewModelValues,
  16605. reloadGrid: reloadGrid,
  16606. toPlainObject: toPlainObject,
  16607. confirm: confirm,
  16608. normId: normId,
  16609. clearViewModelReloadGrid: clearViewModelReloadGrid,
  16610. saveGridRow: saveGridRow,
  16611. insertGridRow: insertGridRow,
  16612. commitMe: commitMe,
  16613. removeGridRow: removeGridRow,
  16614. moveUpGridRow: moveUpGridRow,
  16615. moveDownGridRow: moveDownGridRow,
  16616. SystemEventFu: SystemEventFu,
  16617. clearViewModel: clearViewModel,
  16618. clearViewModelByLookup: clearViewModelByLookup,
  16619. showWidget: showWidget,
  16620. stopEvent: stopEvent,
  16621. msg: msg$1,
  16622. showErrorDialog: showErrorDialog$1,
  16623. showInfoDialog: showInfoDialog,
  16624. prompt: prompt$2,
  16625. evalFunction: evalFunction,
  16626. getGridEditRows: getGridEditRows
  16627. });
  16628. function initTree () {
  16629. Ext.define('Yvan.Tree', {
  16630. extend: 'Ext.tree.Panel',
  16631. alias: 'widget.yvtree',
  16632. xtype: 'yvtree',
  16633. constructor: function (config) {
  16634. var newConfig = _$2.defaultsDeep({
  16635. // 强制性属性
  16636. }, baseConfig(config, 'row-item'), config, tree);
  16637. _$2.assign(newConfig, {
  16638. tbar: [
  16639. {
  16640. xtype: 'textfield',
  16641. // triggerCls: 'x-form-clear-trigger',
  16642. flex: 1,
  16643. emptyText: '搜索过滤',
  16644. enableKeyEvents: true,
  16645. listeners: {
  16646. change: function (sender) {
  16647. var tree = sender.up("treepanel");
  16648. tree.filterByText(this.getRawValue());
  16649. },
  16650. keyup: function (sender, e) {
  16651. var tree = sender.up("treepanel");
  16652. if (e.ESC === e.getKey()) {
  16653. sender.setValue('');
  16654. tree.filterByText('');
  16655. }
  16656. }
  16657. }
  16658. },
  16659. ],
  16660. });
  16661. if (!newConfig.hideRefresh) {
  16662. newConfig.tbar.push({
  16663. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  16664. listeners: {
  16665. click: function (sender) {
  16666. var scope = sender.up("yvtree");
  16667. scope.reload();
  16668. }
  16669. }
  16670. });
  16671. }
  16672. if (!newConfig.hideExpand) {
  16673. newConfig.tbar.push({
  16674. xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
  16675. listeners: {
  16676. click: function (sender) {
  16677. var scope = sender.up("yvtree");
  16678. scope.expandAll();
  16679. }
  16680. }
  16681. });
  16682. }
  16683. if (!newConfig.hideCollapse) {
  16684. newConfig.tbar.push({
  16685. xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
  16686. listeners: {
  16687. click: function (sender) {
  16688. var scope = sender.up("yvtree");
  16689. scope.collapseAll();
  16690. }
  16691. }
  16692. });
  16693. }
  16694. this.superclass.constructor.call(this, newConfig);
  16695. },
  16696. /**
  16697. * 在根节点上增加一个节点,会触发 addNode 事件
  16698. * @param props
  16699. */
  16700. addRoot: function (props) {
  16701. var me = this;
  16702. var tableNode = me.getRootNode();
  16703. var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
  16704. if (_$2.isFunction(props)) {
  16705. props = props.call(this, parent);
  16706. }
  16707. _$2.forOwn(props, function (value, key) {
  16708. fieldNode.set(key, value);
  16709. });
  16710. var node = tableNode.appendChild(fieldNode);
  16711. me.ensureVisible(node);
  16712. me.setSelection(node);
  16713. me.fireEvent('addNode', me, {
  16714. parent: tableNode,
  16715. node: node,
  16716. });
  16717. },
  16718. addLast: function (props) {
  16719. var me = this;
  16720. var sel = me.selModel.getSelection();
  16721. if (!sel || sel.length <= 0) {
  16722. msg('请选择一个要添加的同级节点路径');
  16723. return;
  16724. }
  16725. var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
  16726. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16727. if (_$2.isFunction(props)) {
  16728. props = props.call(this, parent);
  16729. }
  16730. _$2.forOwn(props, function (value, key) {
  16731. fieldNode.set(key, value);
  16732. });
  16733. var node = parent.appendChild(fieldNode);
  16734. me.ensureVisible(node);
  16735. me.setSelection(node);
  16736. me.fireEvent('addNode', me, {
  16737. parent: parent,
  16738. node: node,
  16739. });
  16740. },
  16741. addChildren: function (props) {
  16742. var me = this;
  16743. var sel = me.selModel.getSelection();
  16744. if (!sel || sel.length <= 0) {
  16745. msg('请选择一个要添加子节点的路径');
  16746. return;
  16747. }
  16748. var parent = sel[0];
  16749. if (_$2.isFunction(props)) {
  16750. props = props.call(this, parent);
  16751. }
  16752. var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
  16753. _$2.forOwn(props, function (value, key) {
  16754. fieldNode.set(key, value);
  16755. });
  16756. var node = parent.appendChild(fieldNode);
  16757. parent.expand();
  16758. me.ensureVisible(node);
  16759. me.setSelection(node);
  16760. me.fireEvent('addNode', me, {
  16761. parent: parent,
  16762. node: node,
  16763. });
  16764. },
  16765. initComponent: function () {
  16766. var me = this;
  16767. var config = me.config;
  16768. var scope = lookupScope(this);
  16769. if (!isDesignMode(scope, config)) {
  16770. // 转换 dataSource 属性
  16771. convertDataSource(me, scope, config);
  16772. }
  16773. this.superclass.initComponent.call(this);
  16774. this.on({
  16775. afterrender: function (sender) {
  16776. var me = this;
  16777. var config = this.config;
  16778. var dataSource = config.dataSource;
  16779. if (config.autoLoad) {
  16780. if (config.dataSourceCallbackFn) {
  16781. me.reload();
  16782. }
  16783. else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
  16784. me.reload();
  16785. }
  16786. }
  16787. }
  16788. });
  16789. },
  16790. _setDataReal: function (value) {
  16791. var me = this;
  16792. // me.setStore(new Ext.data.TreeStore({
  16793. // root: {
  16794. // expanded: true,
  16795. // // children: value
  16796. // children: [
  16797. // {
  16798. // id: '1', text: 'A',
  16799. // children: [
  16800. // {id: '1', text: 'A',},
  16801. // {id: '2', text: 'B'},
  16802. // ]
  16803. // },
  16804. // {id: '2', text: 'B'},
  16805. // ]
  16806. // }
  16807. // }))
  16808. me.store.setRoot({
  16809. expanded: true,
  16810. children: value
  16811. });
  16812. // me.store = new Ext.data.TreeStore({
  16813. // root: {
  16814. // expanded: true,
  16815. // // children: value
  16816. // children: [
  16817. // {
  16818. // id: '1', text: 'A',
  16819. // children: [
  16820. // {id: '1', text: 'A',},
  16821. // {id: '2', text: 'B'},
  16822. // ]
  16823. // },
  16824. // {id: '2', text: 'B'},
  16825. // ]
  16826. // }
  16827. // })
  16828. },
  16829. /**
  16830. * 重新载入数据(重新计算参数)
  16831. */
  16832. reload: function (reloadParams) {
  16833. if (reloadParams === void 0) { reloadParams = {}; }
  16834. var me = this;
  16835. var config = me.config;
  16836. if (config.dataSourceCallbackFn) {
  16837. // 函数请求刷新
  16838. var scope_1 = lookupScope(this);
  16839. // me.setLoading(true)
  16840. config.dataSourceCallbackFn.call(scope_1, me, {
  16841. successCallback: function (value) {
  16842. me._setDataReal(value);
  16843. // me.setLoading(false)
  16844. me.fireEvent('dataLoadComplete', me, true, value);
  16845. },
  16846. failCallback: function (error) {
  16847. // me.setLoading(false)
  16848. me.fireEvent('dataLoadComplete', me, false, error);
  16849. }
  16850. });
  16851. return;
  16852. }
  16853. var scope = lookupScope(me);
  16854. var dataSource = config.dataSource;
  16855. if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
  16856. var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
  16857. me.setLoading(true);
  16858. invokeServer$1(dataSource.url, params)
  16859. .then(function (res) {
  16860. me._setDataReal(res.data);
  16861. me.fireEvent('dataLoadComplete', me, res);
  16862. })
  16863. .finally(function () {
  16864. me.setLoading(false);
  16865. });
  16866. }
  16867. },
  16868. filterByText: function (text) {
  16869. this._filterText = text;
  16870. this._filterBy(this, text, 'text');
  16871. },
  16872. _filterBy: _$2.debounce(function (me, text, by) {
  16873. var view = me.getView();
  16874. me.store.clearFilter();
  16875. if (!me._filterText) {
  16876. // 没有筛选内容,还原状态
  16877. var selections = me.getSelection();
  16878. var selectionPaths_1 = [];
  16879. _$2.forEach(me.getSelection(), function (item) {
  16880. selectionPaths_1.push(item.getPath());
  16881. });
  16882. me.collapseAll();
  16883. _$2.forEach(selectionPaths_1, function (path) {
  16884. me.expandPath(path);
  16885. });
  16886. me.setSelection(selections);
  16887. return;
  16888. }
  16889. // 递归查找所有需要可见的节点 id 数组
  16890. var nodesAndParents = [];
  16891. var expandPaths = [];
  16892. me.getRootNode().cascadeBy(function (tree, view) {
  16893. var currNode = this;
  16894. currNode.collapse();
  16895. if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
  16896. // 展开到匹配的路径
  16897. // me.expandPath(currNode.getPath());
  16898. expandPaths.push(currNode.getPath());
  16899. // 沿途父节点全部设定为可见
  16900. while (currNode.parentNode) {
  16901. nodesAndParents.push(currNode.id);
  16902. currNode = currNode.parentNode;
  16903. }
  16904. }
  16905. }, null, [me, view]);
  16906. me.store.filterBy(function (r) {
  16907. return Ext.Array.contains(nodesAndParents, r.get('id'));
  16908. });
  16909. _$2.forEach(expandPaths, function (path) {
  16910. me.expandPath(path);
  16911. });
  16912. }, 1000),
  16913. });
  16914. }
  16915. function convertDataSource(sender, scope, newConfig) {
  16916. if (typeof newConfig.store !== 'undefined') {
  16917. // 有 store 属性的情况下,不做任何事
  16918. return;
  16919. }
  16920. if (typeof newConfig.dataSource === 'undefined') {
  16921. // 没有定义 dataSource 的情况下,不做任何事
  16922. return;
  16923. }
  16924. var dataSource = newConfig.dataSource;
  16925. if (typeof dataSource === 'string') {
  16926. // dataSource 是字符串的情况下,找到成员函数
  16927. dataSource = lookupFn(scope, dataSource);
  16928. }
  16929. if (typeof dataSource === 'function') {
  16930. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  16931. newConfig.store = new Ext.data.TreeStore({
  16932. root: {
  16933. expanded: true,
  16934. children: []
  16935. }
  16936. });
  16937. newConfig.dataSourceCallbackFn = dataSource;
  16938. return;
  16939. }
  16940. // throw new TypeError('无法识别的调用方法')
  16941. }
  16942. /**
  16943. * 构建一个 grid 支持的 dataSource
  16944. */
  16945. function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
  16946. if (reloadParams === void 0) { reloadParams = {}; }
  16947. if (isExcelExport === void 0) { isExcelExport = false; }
  16948. if (excelExportCallBack === void 0) { excelExportCallBack = null; }
  16949. var _a;
  16950. var me = grid;
  16951. var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
  16952. var storeOption = {};
  16953. if (dataSource.method === 'invoke' || dataSource.sqlId) {
  16954. if (dataSource.sqlId) {
  16955. dataSource.method = 'invoke';
  16956. dataSource.url = '/Dev@executeSQL';
  16957. if (_$2.startsWith(dataSource.sqlId, '@')) {
  16958. // sqlId 是 @ 开头,代表直接带中文名
  16959. var scope_1 = lookupScope(grid);
  16960. params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
  16961. params.sqlId = dataSource.sqlId.substring(1);
  16962. }
  16963. else {
  16964. // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
  16965. var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
  16966. params.path = path;
  16967. params.sqlId = sqlId;
  16968. }
  16969. params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
  16970. }
  16971. var fields_1 = [];
  16972. _$2.forEach(grid.columns, function (col) {
  16973. var c = {};
  16974. if (col.dataIndex) {
  16975. c.name = col.dataIndex;
  16976. fields_1.push(c);
  16977. }
  16978. if (col.dataType) {
  16979. c.type = col.dataType;
  16980. }
  16981. });
  16982. // 默认支持 gridInvoke
  16983. var extraParams = _$2.defaultsDeep({}, reloadParams, params);
  16984. console.log("extraParams", extraParams);
  16985. //@ts-ignore
  16986. storeOption = {
  16987. fields: fields_1,
  16988. remoteSort: config.remoteSort,
  16989. remoteFilter: config.remoteFilter,
  16990. autoLoad: true,
  16991. pageSize: me.store.pageSize || config.pageSize,
  16992. proxy: {
  16993. type: 'jsonAjax',
  16994. $owner: me,
  16995. url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
  16996. extraParams: extraParams,
  16997. reader: {
  16998. type: 'json',
  16999. rootProperty: 'data',
  17000. totalProperty: 'pagination.total',
  17001. successProperty: 'success',
  17002. messageProperty: 'msg',
  17003. transform: function (data) {
  17004. if (typeof window['ajaxProcess'] === 'function') {
  17005. window['ajaxProcess'](data);
  17006. }
  17007. if (typeof window['apiTranslate'] === 'function') {
  17008. window['apiTranslate'](data, dataSource.url);
  17009. }
  17010. if (typeof grid._transform === 'function') {
  17011. // 系统转换函数
  17012. grid._transform(data.data);
  17013. }
  17014. if (grid.dataTransform) {
  17015. if (typeof grid.dataTransform === 'string') {
  17016. grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
  17017. }
  17018. return grid.dataTransform.call(scope, grid, data);
  17019. }
  17020. return data;
  17021. }
  17022. }
  17023. },
  17024. listeners: {
  17025. load: function (store, records, successful, operation) {
  17026. var _a, _b, _c;
  17027. var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
  17028. if (rep.pagination) {
  17029. grid.dbInfo = rep.pagination.dbInfo;
  17030. grid.exportDataSql = rep.pagination.exportDataSql;
  17031. grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
  17032. }
  17033. 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;
  17034. if (isExcelExport) {
  17035. if (typeof excelExportCallBack === 'function') {
  17036. excelExportCallBack(rep);
  17037. }
  17038. else if (excelExportCallBack) {
  17039. console.error("导出回调方法错误!");
  17040. }
  17041. me.fireEvent('excelDataLoadComplete', me, successful, records);
  17042. }
  17043. else {
  17044. if (_$2.get(config, 'behavior.autoSelectFirst')) {
  17045. // 自动选中第一行
  17046. var data = grid.getStore().data;
  17047. if (data.length > 0) {
  17048. grid.setSelection(data.items[0]);
  17049. }
  17050. }
  17051. me.fireEvent('dataLoadComplete', me, successful, records);
  17052. }
  17053. }
  17054. }
  17055. };
  17056. }
  17057. else if (exports.apiConvert) {
  17058. // console.log("apiConvert", apiConvert.gridInvokeBuild)
  17059. // 外部扩展的 apiConvert
  17060. //@ts-ignore
  17061. storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack);
  17062. console.log("storeOption", storeOption);
  17063. }
  17064. else {
  17065. throw new TypeError("不支持的 API 请求方式");
  17066. }
  17067. if (isExcelExport) {
  17068. storeOption.proxy.timeout = 1000 * 60 * 30;
  17069. console.log("isExcelExport", isExcelExport, storeOption);
  17070. var excelStore = new Ext.data.Store(storeOption);
  17071. excelStore.load();
  17072. }
  17073. else {
  17074. if (me.groupField) {
  17075. console.log('groupField', storeOption.groupField);
  17076. storeOption.groupField = me.groupField;
  17077. }
  17078. me.setStore(new Ext.data.Store(storeOption));
  17079. }
  17080. }
  17081. function initStores () {
  17082. Ext.define('Yvan.JsonAjaxProxy', {
  17083. extend: 'Ext.data.proxy.Ajax',
  17084. alias: 'proxy.jsonAjax',
  17085. actionMethods: {
  17086. create: "POST",
  17087. read: "POST",
  17088. update: "POST",
  17089. destroy: "POST"
  17090. },
  17091. timeout: storeAjax.timeout,
  17092. buildRequest: function (operation) {
  17093. // 参考源码 ext-all-debug.js:71468 method:buildRequest
  17094. var me = this;
  17095. var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
  17096. var scope = lookupScope($owner);
  17097. var gridParam = me.getParams(operation);
  17098. var customParam = {};
  17099. // 提取 srot 元素
  17100. if (gridParam.sort) {
  17101. var sort = JSON.parse(gridParam.sort);
  17102. // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
  17103. // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
  17104. customParam.sortModel = [];
  17105. _$2.forEach(sort, function (s) {
  17106. customParam.sortModel.push({
  17107. colId: s.property,
  17108. sort: _$2.toLower(s.direction)
  17109. });
  17110. });
  17111. delete gridParam.sort;
  17112. }
  17113. // 提取筛选元素
  17114. if (gridParam.filter) {
  17115. var filter = JSON.parse(gridParam.filter);
  17116. console.log('gridParam.filter', gridParam.filter);
  17117. // "[{"operator":"like","value":"1","property":"id"}]"
  17118. // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
  17119. customParam.filterModel = {};
  17120. _$2.forEach(filter, function (s) {
  17121. var newFilterItem = {};
  17122. if (s.operator === 'like') {
  17123. newFilterItem.filterType = 'text';
  17124. newFilterItem.type = 'contains';
  17125. newFilterItem.filter = s.value;
  17126. }
  17127. else {
  17128. // 无法识别的筛选类型
  17129. newFilterItem.filterType = 'dict';
  17130. newFilterItem.type = 'in';
  17131. newFilterItem.filter = s.value;
  17132. }
  17133. customParam.filterModel[s.property] = newFilterItem;
  17134. });
  17135. delete gridParam.filter;
  17136. }
  17137. // 被 grid.constructor 作为方法存在
  17138. var extraParams = _$2.cloneDeep(me.getExtraParams());
  17139. var params = _$2.defaultsDeep(gridParam, extraParams);
  17140. // var request = this.superclass.buildRequest.apply(this, arguments);
  17141. var request = new Ext.data.Request({
  17142. params: {},
  17143. action: operation.getAction(),
  17144. records: operation.getRecords(),
  17145. url: me.buildUrl(),
  17146. jsonData: __assign({ args: [
  17147. params
  17148. ] }, customParam),
  17149. proxy: me
  17150. });
  17151. operation.setRequest(request);
  17152. return request;
  17153. },
  17154. afterRequest: function (req, res) {
  17155. // Extend.afterExtRequest(req, res)
  17156. }
  17157. });
  17158. Ext.define('Ext.ux.data.MyReader', {
  17159. extend: 'Ext.data.reader.Json',
  17160. xtype: 'yvgridreader',
  17161. useSimpleAccessors: false,
  17162. });
  17163. }
  17164. function initBehaviorEdit(config) {
  17165. var _a, _b, _c;
  17166. var dbTableName = _$2.get(config, 'behavior.dbTableName');
  17167. var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
  17168. var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
  17169. var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
  17170. if (dbTableName) {
  17171. // 生成增删查改
  17172. var tbar = [
  17173. __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
  17174. click: 'system.saveGridRow()'
  17175. }, bind: {
  17176. disabled: '{!' + config.reference + '.ischanged}'
  17177. } }, saveButtonConfig),
  17178. '-',
  17179. __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
  17180. click: 'system.insertGridRow()'
  17181. } }, addButtonConfig),
  17182. __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
  17183. click: 'system.removeGridRow()'
  17184. } }, deleteButtonConfig),
  17185. ];
  17186. if (_$2.isArray(config.tbar)) {
  17187. config.tbar = __spread(tbar, [
  17188. '-'
  17189. ], config.tbar);
  17190. }
  17191. else if (_$2.isPlainObject(config.tbar)) {
  17192. config.tbar = {
  17193. border: false,
  17194. layout: {
  17195. type: 'vbox',
  17196. align: 'stretch'
  17197. },
  17198. items: [
  17199. {
  17200. xtype: 'toolbar',
  17201. border: false,
  17202. items: tbar
  17203. },
  17204. config.tbar,
  17205. ]
  17206. };
  17207. }
  17208. else if (_$2.isUndefined(config.tbar)) {
  17209. config.tbar = tbar;
  17210. }
  17211. else {
  17212. console.error("can't build tbar property!", config.tbar);
  17213. }
  17214. }
  17215. }
  17216. function initGridDialog(config) {
  17217. var detailDialog = _$2.get(config, 'detailDialog');
  17218. var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
  17219. if (_$2.isPlainObject(detailDialog)) {
  17220. var tbar = [
  17221. __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
  17222. click: 'system.showGridRowDetail()',
  17223. }, bind: {
  17224. disabled: '{!' + config.reference + '.selection}'
  17225. } }, detailButtonConfig)
  17226. ];
  17227. if (_$2.isArray(config.tbar)) {
  17228. config.tbar = __spread(config.tbar, [
  17229. '-'
  17230. ], tbar);
  17231. }
  17232. else if (_$2.isPlainObject(config.tbar)) {
  17233. if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
  17234. config.tbar.items = __spread(config.tbar.items);
  17235. var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
  17236. if (!toolbar) {
  17237. config.tbar.items = __spread(config.tbar.items, [
  17238. {
  17239. xtype: 'toolbar',
  17240. border: false,
  17241. items: tbar
  17242. },
  17243. ]);
  17244. }
  17245. else {
  17246. toolbar.items = __spread(toolbar.items, [
  17247. '-'
  17248. ], tbar);
  17249. }
  17250. }
  17251. else {
  17252. config.tbar = {
  17253. border: false,
  17254. layout: {
  17255. type: 'vbox',
  17256. align: 'stretch'
  17257. },
  17258. items: [
  17259. {
  17260. xtype: 'toolbar',
  17261. border: false,
  17262. items: tbar
  17263. },
  17264. config.tbar,
  17265. ]
  17266. };
  17267. }
  17268. }
  17269. else if (_$2.isUndefined(config.tbar)) {
  17270. config.tbar = tbar;
  17271. }
  17272. else {
  17273. console.error("can't build tbar property!", config.tbar);
  17274. }
  17275. }
  17276. }
  17277. var SystemEventFu$1 = /** @class */ (function () {
  17278. function SystemEventFu() {
  17279. }
  17280. SystemEventFu.prototype.showGridRowDetail = function () {
  17281. return function (sender) {
  17282. var grid1 = sender.up('yvgrid');
  17283. showGridRowDetail(grid1);
  17284. };
  17285. };
  17286. __decorate([
  17287. Lib({
  17288. title: '为某个表格所选数据行, 显示其对话框',
  17289. author: '罗一帆',
  17290. createAt: '2022-07-27',
  17291. updateAt: '2022-07-27',
  17292. type: 'system',
  17293. category: '表格',
  17294. }),
  17295. __metadata("design:type", Function),
  17296. __metadata("design:paramtypes", []),
  17297. __metadata("design:returntype", void 0)
  17298. ], SystemEventFu.prototype, "showGridRowDetail", null);
  17299. return SystemEventFu;
  17300. }());
  17301. function showGridRowDetail(grid1, isEdit) {
  17302. if (isEdit === void 0) { isEdit = true; }
  17303. var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
  17304. if (!grid1.selection) {
  17305. msg$1('请选中要展示的数据行!');
  17306. return;
  17307. }
  17308. var record = grid1.selection;
  17309. if (_$2.isArray(record)) {
  17310. record = record[0];
  17311. }
  17312. if (!record) {
  17313. msg$1('请选中要展示的数据行!');
  17314. return;
  17315. }
  17316. var config = grid1._originVJson;
  17317. var detailDialog = config.detailDialog;
  17318. var vjson = {};
  17319. var parentScope = lookupScope(grid1);
  17320. var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
  17321. var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
  17322. _$2.defaultsDeep(vjson, {
  17323. // 强制属性
  17324. layout: 'fit',
  17325. __custom_path: __custom_path,
  17326. __custom_version: __custom_version,
  17327. fbar: __spread([
  17328. { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
  17329. { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
  17330. ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
  17331. items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
  17332. }, detailDialog, {
  17333. // 默认属性
  17334. width: 800,
  17335. height: 450,
  17336. bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
  17337. });
  17338. if (_$2.isPlainObject(detailDialog.tabpanel)) {
  17339. var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
  17340. vjson.items.push(tabpanel);
  17341. if (tabpanel) {
  17342. // 有多个选项卡,按每个选项卡进行过滤
  17343. _$2.forEach(tabpanel.items, function (tab) {
  17344. var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
  17345. if (tabColumns.length > 0) {
  17346. var tabVjson = buildForm(tabColumns, undefined, detailDialog);
  17347. _$2.extend(tab, tabVjson);
  17348. }
  17349. });
  17350. }
  17351. }
  17352. else {
  17353. vjson.items.push(buildForm(config.columns, undefined, detailDialog));
  17354. }
  17355. var model = {
  17356. data: {
  17357. _edit: isEdit,
  17358. _editType: isEdit ? '编辑' : '添加',
  17359. }
  17360. };
  17361. _$2.forOwn(record.data, function (value, key) {
  17362. if (key === 'id') {
  17363. // 忽略 ID 属性
  17364. return;
  17365. }
  17366. if (_$2.startsWith(key, '_')) {
  17367. // 忽略 _ 开头的所有属性
  17368. return;
  17369. }
  17370. model.data[key] = value;
  17371. });
  17372. console.log(vjson);
  17373. if (((_e = (_d = grid1 === null || grid1 === void 0 ? void 0 : grid1._originVJson) === null || _d === void 0 ? void 0 : _d.detailDialog) === null || _e === void 0 ? void 0 : _e.beforVjson) && ((_g = (_f = grid1 === null || grid1 === void 0 ? void 0 : grid1._originVJson) === null || _f === void 0 ? void 0 : _f.detailDialog) === null || _g === void 0 ? void 0 : _g.beforVjson) instanceof Function) {
  17374. grid1._originVJson.detailDialog.beforVjson(vjson);
  17375. }
  17376. var scope = new Scope({ vjson: vjson, model: model, });
  17377. //@ts-ignore
  17378. scope.commit = function () {
  17379. return new Promise(function (resolve) {
  17380. _$2.forOwn(scope.viewModel.data, function (value, key) {
  17381. if (_$2.startsWith(key, '_')) {
  17382. // _origin 等属性可以被忽略
  17383. return;
  17384. }
  17385. if (key === 'id') {
  17386. // id 属性被忽略
  17387. return;
  17388. }
  17389. record.set(key, value);
  17390. });
  17391. resolve();
  17392. });
  17393. };
  17394. scope.showDialog(grid1, {}, {});
  17395. if (((_j = (_h = grid1 === null || grid1 === void 0 ? void 0 : grid1._originVJson) === null || _h === void 0 ? void 0 : _h.detailDialog) === null || _j === void 0 ? void 0 : _j.afterVjson) && ((_l = (_k = grid1 === null || grid1 === void 0 ? void 0 : grid1._originVJson) === null || _k === void 0 ? void 0 : _k.detailDialog) === null || _l === void 0 ? void 0 : _l.afterVjson) instanceof Function) {
  17396. grid1._originVJson.detailDialog.afterVjson(scope, grid1);
  17397. }
  17398. }
  17399. function buildForm(columns, tabpanel, detailDialog) {
  17400. var vjson = __assign({ border: false, layout: {
  17401. type: 'vbox',
  17402. pack: 'start',
  17403. align: 'stretch'
  17404. }, defaults: {
  17405. border: false,
  17406. anchor: '100%',
  17407. margin: '5',
  17408. }, scrollable: true, items: [] }, detailDialog.form);
  17409. var emptyFieldset = [];
  17410. var fieldsetList = [];
  17411. columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
  17412. _$2.forEach(columns, function (c) {
  17413. var fieldset = _$2.get(c, 'form.fieldset');
  17414. if (fieldset) {
  17415. var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
  17416. if (idx < 0) {
  17417. fieldsetList.push({
  17418. fieldset: fieldset,
  17419. columns: [c]
  17420. });
  17421. }
  17422. else {
  17423. fieldsetList[idx].columns.push(c);
  17424. }
  17425. }
  17426. else {
  17427. emptyFieldset.push(c);
  17428. }
  17429. });
  17430. _$2.forEach(fieldsetList, function (fs) {
  17431. var fieldSetVjson = {
  17432. xtype: 'fieldset',
  17433. title: fs.fieldset,
  17434. items: []
  17435. };
  17436. buildFieldItems(fieldSetVjson.items, fs.columns);
  17437. vjson.items.push(fieldSetVjson);
  17438. });
  17439. buildFieldItems(vjson.items, emptyFieldset);
  17440. return vjson;
  17441. }
  17442. // 构建字段组
  17443. function buildFieldItems(items, columns) {
  17444. var _a, _b, _c, _d, _e;
  17445. var row = {
  17446. xtype: 'cols',
  17447. items: []
  17448. };
  17449. for (var i = 0; i < columns.length; i++) {
  17450. var column = columns[i];
  17451. if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
  17452. delete row.xtype;
  17453. row.layout = column.form.rowlayout;
  17454. }
  17455. if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
  17456. row.items.push({ border: false, flex: column.form.prefix });
  17457. }
  17458. var fieldVjson = buildField(column, row.items.length);
  17459. if (!fieldVjson) {
  17460. continue;
  17461. }
  17462. row.items.push(fieldVjson);
  17463. if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
  17464. row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
  17465. }
  17466. if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
  17467. items.push(row);
  17468. row = {
  17469. xtype: 'cols',
  17470. items: []
  17471. };
  17472. }
  17473. }
  17474. if (row.items.length > 0) {
  17475. items.push(row);
  17476. }
  17477. }
  17478. // 构建字段
  17479. function buildField(column, colIdx) {
  17480. var ret;
  17481. if (column.xtype === 'checkcolumn') {
  17482. ret = _$2.defaultsDeep({
  17483. xtype: 'checkbox',
  17484. uncheckedValue: column.uncheckedValue,
  17485. checkedValue: column.checkedValue,
  17486. boxLabel: column.header,
  17487. bind: {
  17488. value: '{' + column.dataIndex + '}'
  17489. }
  17490. }, column.form);
  17491. if (colIdx == 0) {
  17492. // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
  17493. ret.margin = '0 0 0 85';
  17494. }
  17495. }
  17496. else {
  17497. ret = _$2.defaultsDeep({}, column.form, column.editor, {
  17498. fieldLabel: column.header,
  17499. bind: {
  17500. value: '{' + column.dataIndex + '}'
  17501. },
  17502. });
  17503. }
  17504. if (!ret.xtype) {
  17505. return;
  17506. }
  17507. if (!ret.dict && ret.xtype === 'combo') {
  17508. ret.dict = column.dict;
  17509. }
  17510. // 删除辅助属性
  17511. delete ret.order;
  17512. delete ret.wrap;
  17513. return ret;
  17514. }
  17515. var model$c = {
  17516. data: {}
  17517. };
  17518. var vjson$c = {
  17519. title: '自定义表格属性',
  17520. layout: 'fit',
  17521. width: 980,
  17522. height: 500,
  17523. fbar: [
  17524. {
  17525. xtype: "button",
  17526. text: "保存",
  17527. iconCls: 'x-fa fa-save',
  17528. listeners: {
  17529. click: 'scope.commit',
  17530. }
  17531. },
  17532. {
  17533. xtype: "button",
  17534. text: "关闭",
  17535. iconCls: 'x-fa fa-times',
  17536. listeners: {
  17537. click: 'system.closeMe()',
  17538. }
  17539. },
  17540. ],
  17541. items: [
  17542. {
  17543. region: 'center',
  17544. xtype: 'tabpanel',
  17545. items: [
  17546. {
  17547. title: '基本信息', reference: 'basic',
  17548. layout: {
  17549. type: 'vbox',
  17550. pack: 'start',
  17551. align: 'stretch'
  17552. },
  17553. defaults: {
  17554. border: false,
  17555. anchor: '100%',
  17556. margin: '5',
  17557. },
  17558. scrollable: true,
  17559. items: [
  17560. {
  17561. xtype: 'cols',
  17562. items: [
  17563. {
  17564. fieldLabel: '路径',
  17565. bind: { value: '{__custom_path}' },
  17566. xtype: 'textfield',
  17567. flex: 2,
  17568. },
  17569. {
  17570. fieldLabel: '版本',
  17571. bind: { value: '{__custom_version}' },
  17572. xtype: 'textfield',
  17573. },
  17574. ]
  17575. },
  17576. {
  17577. xtype: 'cols',
  17578. items: [
  17579. {
  17580. fieldLabel: '配置点',
  17581. bind: { value: '{__custom_point}' },
  17582. xtype: 'textfield',
  17583. },
  17584. {
  17585. fieldLabel: 'reference',
  17586. bind: { value: '{reference}' },
  17587. xtype: 'textfield',
  17588. },
  17589. {
  17590. fieldLabel: '编辑模式',
  17591. bind: { value: '{_mode}' },
  17592. xtype: 'combo',
  17593. dict: 'GRID_MODE',
  17594. },
  17595. ]
  17596. },
  17597. {
  17598. layout: 'hbox',
  17599. defaults: {
  17600. margin: '0 0 0 15',
  17601. },
  17602. items: [
  17603. {
  17604. boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
  17605. bind: {
  17606. value: "{hideFootbar}"
  17607. }
  17608. },
  17609. {
  17610. boxLabel: '隐藏刷新', xtype: 'checkbox',
  17611. bind: {
  17612. value: "{hideRefresh}"
  17613. }
  17614. },
  17615. {
  17616. boxLabel: '隐藏导出', xtype: 'checkbox',
  17617. bind: {
  17618. value: "{hideExport}"
  17619. }
  17620. },
  17621. {
  17622. boxLabel: '隐藏自动调宽', xtype: 'checkbox',
  17623. bind: {
  17624. value: "{hideAutoSize}"
  17625. }
  17626. },
  17627. {
  17628. boxLabel: '隐藏清空筛选', xtype: 'checkbox',
  17629. bind: {
  17630. value: "{hideClearFilter}"
  17631. }
  17632. },
  17633. {
  17634. boxLabel: '隐藏保存布局', xtype: 'checkbox',
  17635. bind: {
  17636. value: "{hideSaveGridUIConfig}"
  17637. }
  17638. },
  17639. {
  17640. boxLabel: '隐藏重置布局', xtype: 'checkbox',
  17641. bind: {
  17642. value: "{hideClearGridUIConfig}"
  17643. }
  17644. },
  17645. ]
  17646. },
  17647. {
  17648. layout: 'hbox',
  17649. defaults: {
  17650. margin: '0 0 0 15',
  17651. },
  17652. items: [
  17653. {
  17654. boxLabel: '自动载入数据源', xtype: 'checkbox',
  17655. bind: { value: '{autoLoad}' },
  17656. margin: '0 0 0 85',
  17657. },
  17658. {
  17659. boxLabel: '分页模式', xtype: 'checkbox',
  17660. bind: { value: '{pagination}' },
  17661. },
  17662. {
  17663. boxLabel: '显示行序号', xtype: 'checkbox',
  17664. bind: { value: '{show_rownum}' },
  17665. },
  17666. {
  17667. boxLabel: '后端排序', xtype: 'checkbox',
  17668. bind: {
  17669. value: "{remoteSort}"
  17670. }
  17671. },
  17672. {
  17673. boxLabel: '后端过滤', xtype: 'checkbox',
  17674. bind: {
  17675. value: "{remoteFilter}"
  17676. }
  17677. },
  17678. {
  17679. boxLabel: '隐藏', xtype: 'checkbox',
  17680. bind: {
  17681. value: "{hidden}"
  17682. }
  17683. },
  17684. ]
  17685. },
  17686. {
  17687. layout: 'hbox',
  17688. defaults: {
  17689. margin: '0 0 0 15',
  17690. },
  17691. items: [
  17692. {
  17693. boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
  17694. bind: {
  17695. value: "{enableColumnHide}"
  17696. }
  17697. },
  17698. {
  17699. boxLabel: '用户拖拽字段', xtype: 'checkbox',
  17700. bind: {
  17701. value: "{enableColumnMove}"
  17702. }
  17703. },
  17704. {
  17705. boxLabel: '自定义筛选', xtype: 'checkbox',
  17706. bind: {
  17707. value: "{gridfilters}"
  17708. }
  17709. },
  17710. {
  17711. boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
  17712. bind: {
  17713. value: "{enableColumnResize}"
  17714. }
  17715. },
  17716. {
  17717. boxLabel: '点击列头排序', xtype: 'checkbox',
  17718. bind: {
  17719. value: "{sortOnClick}"
  17720. }
  17721. },
  17722. ]
  17723. },
  17724. {
  17725. xtype: 'cols',
  17726. items: [
  17727. {
  17728. fieldLabel: 'dbTableName',
  17729. labelWidth: 110,
  17730. bind: { value: '{behavior.dbTableName}' },
  17731. xtype: 'textfield',
  17732. },
  17733. {
  17734. fieldLabel: 'theid',
  17735. bind: { value: '{theid}' },
  17736. xtype: 'textfield',
  17737. },
  17738. {
  17739. fieldLabel: '添加行聚焦',
  17740. bind: { value: '{behavior.focusColumnAfterInsert}' },
  17741. xtype: 'textfield',
  17742. },
  17743. ]
  17744. },
  17745. {
  17746. xtype: 'cols',
  17747. items: [
  17748. {
  17749. fieldLabel: '批量删除提示',
  17750. labelWidth: 110,
  17751. bind: { value: '{behavior.batchRemoveConfirm}' },
  17752. xtype: 'textfield',
  17753. },
  17754. {
  17755. fieldLabel: '删除提示',
  17756. bind: { value: '{behavior.singleRemoveConfirm}' },
  17757. xtype: 'textfield',
  17758. },
  17759. {
  17760. fieldLabel: '触发刷新',
  17761. labelWidth: 110,
  17762. bind: { value: '{behavior.selectToReload}' },
  17763. xtype: 'textfield',
  17764. },
  17765. ]
  17766. },
  17767. ]
  17768. },
  17769. {
  17770. title: '字段', reference: 'grid1',
  17771. xtype: 'yvgrid',
  17772. pagination: false,
  17773. _mode: 'edit',
  17774. listeners: {
  17775. buttonclick: 'scope.grid1Buttonclick',
  17776. },
  17777. hideFootbar: true,
  17778. tbar: [
  17779. {
  17780. xtype: 'button',
  17781. text: '添加',
  17782. iconCls: 'x-fa fa-plus-circle',
  17783. listeners: {
  17784. click: 'scope.addField'
  17785. }
  17786. },
  17787. {
  17788. xtype: 'button',
  17789. text: '删除',
  17790. iconCls: 'x-fa fa-minus-circle',
  17791. listeners: {
  17792. click: 'scope.removeField'
  17793. }
  17794. },
  17795. '-',
  17796. {
  17797. xtype: 'button',
  17798. text: '自动分析',
  17799. iconCls: 'x-fa fa-code-fork',
  17800. listeners: {
  17801. click: 'scope.calcField'
  17802. }
  17803. },
  17804. {
  17805. xtype: 'button',
  17806. text: '上移',
  17807. iconCls: 'x-fa fa-arrow-up',
  17808. listeners: {
  17809. click: 'scope.moveUp'
  17810. }
  17811. },
  17812. {
  17813. xtype: 'button',
  17814. text: '下移',
  17815. iconCls: 'x-fa fa-arrow-down',
  17816. listeners: {
  17817. click: 'scope.moveDown'
  17818. }
  17819. },
  17820. ],
  17821. store: {},
  17822. columns: [
  17823. {
  17824. dataIndex: 'dataIndex', header: "字段名", width: 140,
  17825. editor: { xtype: 'textfield' }
  17826. },
  17827. {
  17828. dataIndex: 'dbColumn', header: "数据库字段", width: 140,
  17829. editor: { xtype: 'textfield' }
  17830. },
  17831. {
  17832. dataIndex: 'header', header: '中文', width: 140,
  17833. editor: { xtype: 'textfield' }
  17834. },
  17835. {
  17836. dataIndex: 'dict', header: '字典', width: 110,
  17837. editor: { xtype: 'combogrid' }
  17838. },
  17839. {
  17840. dataIndex: 'editor_widget', header: '下拉表', width: 110,
  17841. editor: { xtype: 'combogrid' }, hidden: true,
  17842. },
  17843. {
  17844. dataIndex: 'width', header: '宽度', width: 80,
  17845. editor: { xtype: 'numberfield' }, hidden: true,
  17846. },
  17847. {
  17848. dataIndex: 'editor_xtype', header: '编辑器', width: 170,
  17849. editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
  17850. },
  17851. {
  17852. dataIndex: 'serverCreateValue', header: '服务端创建值',
  17853. editor: { xtype: 'textfield' },
  17854. },
  17855. {
  17856. dataIndex: 'createValue', text: '客户端新创建值',
  17857. editor: { xtype: 'textfield' },
  17858. },
  17859. {
  17860. dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
  17861. resizable: false, sortable: false, menuDisabled: true,
  17862. checkedValue: true, uncheckedValue: false,
  17863. },
  17864. {
  17865. dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
  17866. resizable: false, sortable: false, menuDisabled: true,
  17867. checkedValue: true, uncheckedValue: false,
  17868. },
  17869. {
  17870. dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
  17871. resizable: false, sortable: false, menuDisabled: true,
  17872. checkedValue: true, uncheckedValue: false,
  17873. },
  17874. {
  17875. dataIndex: 'formatter', header: '格式化', width: 110,
  17876. editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
  17877. },
  17878. {
  17879. dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
  17880. resizable: false, sortable: false, menuDisabled: true,
  17881. checkedValue: true, uncheckedValue: false, hidden: true,
  17882. },
  17883. {
  17884. dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
  17885. resizable: false, sortable: false, menuDisabled: true,
  17886. hidden: true,
  17887. },
  17888. {
  17889. dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
  17890. resizable: false, sortable: false, menuDisabled: true,
  17891. checkedValue: true, uncheckedValue: false, hidden: true,
  17892. },
  17893. {
  17894. dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
  17895. resizable: false, sortable: false, menuDisabled: true,
  17896. },
  17897. {
  17898. dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
  17899. resizable: false, sortable: false, menuDisabled: true,
  17900. checkedValue: true, uncheckedValue: false, hidden: true,
  17901. },
  17902. {
  17903. dataIndex: 'form_order', text: '对话框序号',
  17904. editor: { xtype: 'numberfield' },
  17905. },
  17906. {
  17907. dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
  17908. resizable: false, sortable: false, menuDisabled: true,
  17909. checkedValue: true, uncheckedValue: false,
  17910. },
  17911. {
  17912. dataIndex: 'form_xtype', text: '对话框编辑器',
  17913. editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
  17914. },
  17915. {
  17916. dataIndex: 'form_fieldset', text: '对话框字段组',
  17917. editor: { xtype: 'textfield' }, hidden: true,
  17918. },
  17919. {
  17920. dataIndex: 'form_tab', text: '对话框选项卡',
  17921. editor: { xtype: 'textfield' }, hidden: true,
  17922. },
  17923. {
  17924. dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
  17925. resizable: false, sortable: false, menuDisabled: true,
  17926. checkedValue: true, uncheckedValue: false, hidden: true,
  17927. },
  17928. ],
  17929. },
  17930. {
  17931. title: 'SQL和查询条件', reference: 'sql',
  17932. layout: 'border',
  17933. border: false,
  17934. items: [
  17935. {
  17936. region: 'north',
  17937. height: 200,
  17938. border: false,
  17939. split: true,
  17940. xtype: 'yvgrid',
  17941. reference: 'gridCondition',
  17942. pagination: false,
  17943. hideFootbar: true,
  17944. _mode: 'edit',
  17945. listeners: {
  17946. buttonclick: 'scope.conditionButtonclick',
  17947. },
  17948. store: {},
  17949. tbar: {
  17950. xtype: 'toolbar',
  17951. border: false,
  17952. items: [
  17953. {
  17954. xtype: 'button',
  17955. text: '添加条件',
  17956. iconCls: 'x-fa fa-plus-circle',
  17957. listeners: {
  17958. click: 'scope.addCondition'
  17959. }
  17960. },
  17961. {
  17962. xtype: 'button',
  17963. text: '删除条件',
  17964. iconCls: 'x-fa fa-minus-circle',
  17965. listeners: {
  17966. click: 'scope.removeCondition'
  17967. }
  17968. },
  17969. '-',
  17970. {
  17971. xtype: 'button',
  17972. text: '自动分析条件变量',
  17973. iconCls: 'x-fa fa-code-fork',
  17974. listeners: {
  17975. click: 'scope.calcCondition'
  17976. }
  17977. },
  17978. {
  17979. xtype: 'button',
  17980. text: '上移',
  17981. iconCls: 'x-fa fa-arrow-up',
  17982. listeners: {
  17983. click: 'scope.moveUpCondition'
  17984. }
  17985. },
  17986. {
  17987. xtype: 'button',
  17988. text: '下移',
  17989. iconCls: 'x-fa fa-arrow-down',
  17990. listeners: {
  17991. click: 'scope.moveDownCondition'
  17992. }
  17993. },
  17994. ]
  17995. },
  17996. columns: [
  17997. {
  17998. text: '条件变量',
  17999. dataIndex: 'param_name',
  18000. width: 140,
  18001. sortable: false,
  18002. menuDisabled: true,
  18003. editor: {
  18004. selectOnFocus: true
  18005. },
  18006. },
  18007. {
  18008. text: '中文标题',
  18009. dataIndex: 'fieldLabel',
  18010. width: 120,
  18011. sortable: false,
  18012. menuDisabled: true,
  18013. editor: {
  18014. selectOnFocus: true
  18015. },
  18016. },
  18017. {
  18018. text: '编辑类型',
  18019. dataIndex: 'xtype',
  18020. width: 80,
  18021. sortable: false,
  18022. menuDisabled: true,
  18023. editor: {
  18024. xtype: 'combo',
  18025. typeAhead: true,
  18026. triggerAction: 'all',
  18027. selectOnFocus: true,
  18028. store: [
  18029. ['textfield', 'textfield'],
  18030. ['combo', 'combo'],
  18031. ['datefield', 'datefield'],
  18032. ['datetimefield', 'datetimefield'],
  18033. ['numberfield', 'numberfield'],
  18034. ['multiplesearch', 'multiplesearch'],
  18035. ]
  18036. }
  18037. },
  18038. {
  18039. text: '权重',
  18040. dataIndex: 'conditionFieldFlex',
  18041. align: 'right',
  18042. width: 60,
  18043. sortable: false,
  18044. menuDisabled: true,
  18045. editor: {
  18046. xtype: 'numberfield',
  18047. selectOnFocus: false,
  18048. minValue: 0,
  18049. maxValue: 10
  18050. },
  18051. },
  18052. {
  18053. text: '字典',
  18054. dataIndex: 'conditionFieldDict',
  18055. width: 160,
  18056. sortable: false,
  18057. menuDisabled: true,
  18058. editor: {
  18059. selectOnFocus: false
  18060. },
  18061. },
  18062. {
  18063. xtype: 'checkcolumn',
  18064. dataIndex: "conditionFieldWrap", header: "换行",
  18065. width: 65,
  18066. sortable: false,
  18067. menuDisabled: true,
  18068. },
  18069. {
  18070. text: '扩展参数',
  18071. dataIndex: 'conditionFieldExtend',
  18072. sortable: false,
  18073. menuDisabled: true,
  18074. editor: {
  18075. selectOnFocus: false
  18076. },
  18077. },
  18078. ]
  18079. },
  18080. {
  18081. region: 'center',
  18082. xtype: 'sqleditor',
  18083. layout: 'fit',
  18084. reference: 'sqlEditor',
  18085. split: true,
  18086. },
  18087. ]
  18088. },
  18089. {
  18090. title: '详情对话框',
  18091. layout: {
  18092. type: 'vbox',
  18093. pack: 'start',
  18094. align: 'stretch'
  18095. },
  18096. defaults: {
  18097. border: false,
  18098. anchor: '100%',
  18099. margin: '5',
  18100. },
  18101. scrollable: true,
  18102. items: [
  18103. {
  18104. xtype: 'cols',
  18105. items: [
  18106. {
  18107. fieldLabel: '对话框标题',
  18108. bind: { value: '{detailDialog.title}' },
  18109. xtype: 'textfield',
  18110. flex: 2,
  18111. },
  18112. {
  18113. fieldLabel: '宽度',
  18114. bind: { value: '{detailDialog.width}' },
  18115. xtype: 'numberfield',
  18116. },
  18117. {
  18118. fieldLabel: '高度',
  18119. bind: { value: '{detailDialog.height}' },
  18120. xtype: 'numberfield',
  18121. },
  18122. ]
  18123. },
  18124. ]
  18125. },
  18126. {
  18127. title: '界面源码',
  18128. xtype: 'jseditor',
  18129. reference: 'jseditor'
  18130. }
  18131. ]
  18132. }
  18133. ]
  18134. };
  18135. var GridColumnCustom = /** @class */ (function (_super) {
  18136. __extends(GridColumnCustom, _super);
  18137. function GridColumnCustom() {
  18138. return _super.call(this, { model: model$c, vjson: vjson$c }) || this;
  18139. }
  18140. GridColumnCustom.prototype.commit = function () {
  18141. };
  18142. GridColumnCustom.prototype.grid1Buttonclick = function () {
  18143. };
  18144. GridColumnCustom.prototype.conditionButtonclick = function () {
  18145. };
  18146. GridColumnCustom.prototype.addField = function () {
  18147. };
  18148. GridColumnCustom.prototype.removeField = function () {
  18149. };
  18150. GridColumnCustom.prototype.calcField = function () {
  18151. };
  18152. GridColumnCustom.prototype.moveUp = function () {
  18153. };
  18154. GridColumnCustom.prototype.moveDown = function () {
  18155. };
  18156. GridColumnCustom.prototype.addCondition = function () {
  18157. };
  18158. GridColumnCustom.prototype.removeCondition = function () {
  18159. };
  18160. GridColumnCustom.prototype.calcCondition = function () {
  18161. };
  18162. GridColumnCustom.prototype.moveUpCondition = function () {
  18163. };
  18164. GridColumnCustom.prototype.moveDownCondition = function () {
  18165. };
  18166. return GridColumnCustom;
  18167. }(Scope));
  18168. function initGridCode(grid, newConfig, buttons) {
  18169. if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
  18170. buttons.push({
  18171. xtype: 'button',
  18172. tooltip: '定义表格属性',
  18173. iconCls: 'x-fa fa-codepen',
  18174. handler: function (btn) {
  18175. var customWindow = new GridColumnCustom();
  18176. customWindow.showDialog(btn, {}, {});
  18177. }
  18178. });
  18179. buttons.push({
  18180. xtype: 'button',
  18181. tooltip: '定义表格数据源',
  18182. iconCls: 'x-fa fa-database',
  18183. handler: function () {
  18184. // showCustomGridDataSource(grid)
  18185. }
  18186. });
  18187. }
  18188. }
  18189. window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
  18190. var hexToString = function (hex) {
  18191. var arr = hex.split("");
  18192. var out = "";
  18193. for (var i = 0; i < arr.length / 2; i++) {
  18194. var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
  18195. // @ts-ignore
  18196. var charValue = String.fromCharCode(tmp);
  18197. out += charValue;
  18198. }
  18199. return out;
  18200. };
  18201. var defaultGrid = grid;
  18202. function initGrid () {
  18203. Ext.define('Yvan.Grid', {
  18204. extend: 'Ext.grid.Panel',
  18205. xtype: 'yvgrid',
  18206. __suspendReload: false,
  18207. _originVJson: {},
  18208. constructor: function (config) {
  18209. var _this = this;
  18210. var _a, _b, _c, _d, _e, _f;
  18211. var me = this;
  18212. var dataSource = config.dataSource;
  18213. 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);
  18214. me._originVJson = config;
  18215. if (!isDesignMode(scope, config)) {
  18216. this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
  18217. if (Array.isArray(config.columns) && config.columns.length > 0) {
  18218. var cacheData = this.getColumnConfigCache();
  18219. if (Array.isArray(cacheData) && cacheData.length > 0) {
  18220. var newColumns = [];
  18221. for (var j = 0; j < cacheData.length; j++) {
  18222. var itData = cacheData[j];
  18223. for (var i = 0; i < config.columns.length; i++) {
  18224. var column = config.columns[i];
  18225. if (itData.dataIndex === column.dataIndex) {
  18226. if (itData.width) {
  18227. column.width = itData.width;
  18228. }
  18229. column.hidden = itData.hidden;
  18230. column.locked = itData.locked;
  18231. newColumns.push(column);
  18232. break;
  18233. }
  18234. }
  18235. }
  18236. config.columns = newColumns;
  18237. }
  18238. }
  18239. }
  18240. var newConfig = _$2.defaultsDeep({
  18241. // 强制性属性 bug.
  18242. // lock 属性会造成 Cannot read properties of undefined (reading 'els')
  18243. // enableLocking: false,
  18244. // syncRowHeight: false,
  18245. }, baseConfig(config, 'row-item'), config, grid);
  18246. // 在面板上的组件
  18247. // const scope = newConfig.$initParent?.yvanScope ||
  18248. // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
  18249. // config.$vmParent?.yvanScope ||
  18250. // newConfig.$vmParent?._parent?.yvanScope;
  18251. var buttons = [];
  18252. var getRowClass = newConfig.getRowClass;
  18253. if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
  18254. _$2.startsWith(getRowClass, "system."))) {
  18255. var fn = lookupFn(scope, getRowClass);
  18256. _$2.set(newConfig, 'viewConfig.getRowClass', fn);
  18257. }
  18258. if (!newConfig.hideExport) {
  18259. buttons.push({
  18260. xtype: 'button',
  18261. tooltip: '导出Excel',
  18262. iconCls: 'x-fa fa-download',
  18263. listeners: {
  18264. click: this.exportExcel
  18265. },
  18266. });
  18267. }
  18268. if (!newConfig.hideAutoSize) {
  18269. buttons.push({
  18270. xtype: 'button',
  18271. iconCls: 'x-fa fa-text-width',
  18272. tooltip: '自适应宽度',
  18273. listeners: {
  18274. click: this.autoSizeColumns
  18275. }
  18276. });
  18277. }
  18278. if (!newConfig.hideClearFilter) {
  18279. buttons.push({
  18280. xtype: 'button',
  18281. tooltip: '清空筛选',
  18282. iconCls: 'x-fa fa-filter',
  18283. handler: this.clearFilter
  18284. });
  18285. }
  18286. if (!newConfig.hideSaveGridUIConfig) {
  18287. buttons.push({
  18288. xtype: 'button',
  18289. tooltip: '保存布局',
  18290. iconCls: 'x-fa fa-cogs',
  18291. handler: this.saveGridUIConfig
  18292. });
  18293. }
  18294. if (!newConfig.hideClearGridUIConfig) {
  18295. buttons.push({
  18296. xtype: 'button',
  18297. tooltip: '还原布局',
  18298. iconCls: 'x-fa fa-reply-all',
  18299. handler: this.clearGridUIConfig
  18300. });
  18301. }
  18302. initGridCode(me, newConfig, buttons);
  18303. if (!newConfig.hideFootbar) {
  18304. if (newConfig.pagination) {
  18305. newConfig.bbar = new Ext.PagingToolbar({
  18306. // pageSize: newConfig.pageSize, 这个值是无效的
  18307. displayInfo: true,
  18308. store: this.store,
  18309. emptyMsg: '没有记录',
  18310. cls: 'grid-bbar',
  18311. items: __spread([
  18312. {
  18313. xtype: 'combobox',
  18314. tooltip: '分页',
  18315. queryMode: 'local',
  18316. editable: false,
  18317. allowBlank: true,
  18318. labelAlign: 'right',
  18319. width: 90,
  18320. // labelWidth: 30,
  18321. listConfig: {
  18322. minWidth: null
  18323. },
  18324. value: 50,
  18325. valueField: undefined,
  18326. displayField: undefined,
  18327. hideClear: true,
  18328. store: newConfig.pageSizeOption,
  18329. listeners: {
  18330. change: function (sender, nv, ov) {
  18331. _this.store.pageSize = nv;
  18332. _this.store.loadPage(1);
  18333. }
  18334. }
  18335. }
  18336. ], buttons),
  18337. doRefresh: function () {
  18338. me.reload();
  18339. }
  18340. });
  18341. }
  18342. else {
  18343. newConfig.bbar = {
  18344. xtype: 'toolbar', overflowHandler: 'menu',
  18345. cls: 'grid-bbar',
  18346. items: __spread([
  18347. {
  18348. xtype: 'button',
  18349. tooltip: '刷新',
  18350. iconCls: 'x-fa fa-refresh',
  18351. handler: function () {
  18352. _this.reload();
  18353. }
  18354. },
  18355. '-'
  18356. ], buttons)
  18357. };
  18358. if (newConfig.hideRefresh) {
  18359. newConfig.bbar.items.splice(0, 1);
  18360. }
  18361. }
  18362. }
  18363. if (_$2.isArray(newConfig.condition)) {
  18364. // 带查询条件
  18365. var conditionRows_1 = [];
  18366. var newRow_1 = false;
  18367. var currentRow_1 = { xtype: 'cols', items: [], };
  18368. conditionRows_1.push(currentRow_1);
  18369. _$2.forEach(newConfig.condition, function (item) {
  18370. var _a;
  18371. if (newRow_1) {
  18372. currentRow_1 = { xtype: 'cols', items: [], };
  18373. conditionRows_1.push(currentRow_1);
  18374. }
  18375. var vj = _$2.cloneDeep(item);
  18376. if (vj.xtype) {
  18377. if (item.xtype === 'combo' && item.dict) {
  18378. vj.fix = ['system.getDict("' + item.dict + '")'];
  18379. }
  18380. if (item.xtype === 'datetimefield') {
  18381. _$2.defer(function () {
  18382. //@ts-ignore
  18383. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
  18384. });
  18385. }
  18386. else if (item.xtype === 'datefield') {
  18387. _$2.defer(function () {
  18388. //@ts-ignore
  18389. scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
  18390. });
  18391. }
  18392. else {
  18393. scope.viewModel.set(item.param_name, '');
  18394. }
  18395. }
  18396. else {
  18397. // 没有组件类型,是个空占位符
  18398. vj.border = false;
  18399. }
  18400. if (item.param_name) {
  18401. vj.bind = {
  18402. value: '{' + item.param_name + '}'
  18403. };
  18404. _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18405. _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
  18406. }
  18407. newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
  18408. currentRow_1.items.push(vj);
  18409. });
  18410. newConfig.tbar = {
  18411. xtype: 'form',
  18412. border: false,
  18413. items: conditionRows_1,
  18414. defaults: {
  18415. margin: '8 0 8 0'
  18416. },
  18417. };
  18418. console.log('newConfig', newConfig);
  18419. }
  18420. _$2.each(newConfig.columns, function (c) {
  18421. var renderer = c.renderer, formatter = c.formatter;
  18422. if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
  18423. _$2.startsWith(renderer, "system."))) {
  18424. if (newConfig.$initParent) {
  18425. if (scope) {
  18426. var rendererFn = lookupFn(scope, renderer);
  18427. c.renderer = rendererFn.bind(scope);
  18428. }
  18429. }
  18430. }
  18431. if (c.dict) {
  18432. c.fix = ['system.getDict("' + c.dict + '")'];
  18433. if (c.editor && c.editor.xtype === 'combo') {
  18434. c.editor.fix = ['system.getDict("' + c.dict + '")'];
  18435. c.editor.typeAhead = true;
  18436. c.editor.triggerAction = 'all';
  18437. c.editor.selectOnFocus = false;
  18438. c.editor.listConfig = {
  18439. minWidth: 200
  18440. };
  18441. }
  18442. }
  18443. if (formatter === 'button') {
  18444. c.tdCls = 'td-btn';
  18445. if (!c.listeners) {
  18446. c.listeners = {};
  18447. }
  18448. c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
  18449. if ($(event.target).is('input')) {
  18450. me.fireEvent('buttonclick', me, this, record);
  18451. }
  18452. };
  18453. }
  18454. else if (formatter === 'percentRenderer') {
  18455. c.tdCls = 'td-percent';
  18456. }
  18457. });
  18458. if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
  18459. // 强制为编辑模式
  18460. newConfig.selModel = {
  18461. type: 'spreadsheet',
  18462. columnSelect: true,
  18463. pruneRemoved: false,
  18464. extensible: 'y'
  18465. };
  18466. newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
  18467. if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
  18468. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18469. }
  18470. else {
  18471. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
  18472. }
  18473. }
  18474. else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
  18475. // 强制为勾选模式
  18476. newConfig.selModel = {
  18477. type: 'checkboxmodel',
  18478. mode: 'MULTI',
  18479. };
  18480. }
  18481. else if (newConfig._mode === 'checkonly') {
  18482. newConfig.selModel = {
  18483. type: 'checkboxmodel',
  18484. mode: 'MULTI',
  18485. checkOnly: true,
  18486. };
  18487. }
  18488. else if (newConfig._mode === 'select') {
  18489. // 强制为选择模式
  18490. newConfig.selModel = {
  18491. selType: 'rowmodel',
  18492. mode: 'SINGLE',
  18493. };
  18494. if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
  18495. _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
  18496. }
  18497. }
  18498. initBehaviorEdit(newConfig);
  18499. initGridDialog(newConfig);
  18500. this.superclass.constructor.call(this, newConfig);
  18501. this.store.pageSize = newConfig.pageSize;
  18502. },
  18503. setData: function (value) {
  18504. var me = this;
  18505. me._setDataReal(value);
  18506. },
  18507. /**
  18508. * 添加行,并进入编辑状态
  18509. * @param record 新行的属性集
  18510. * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
  18511. */
  18512. appendEditRow: function (record, editRowCol) {
  18513. var records = this.getStore().add(record);
  18514. var recNew = records[0];
  18515. this.setSelection(records);
  18516. if (typeof editRowCol === 'string' && editRowCol) {
  18517. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18518. }
  18519. if (typeof editRowCol === 'number') {
  18520. var ce = this.findPlugin('cellediting');
  18521. this.editingPlugin = ce;
  18522. ce.startEdit(recNew, editRowCol);
  18523. }
  18524. },
  18525. beginEdit: function (record, editRowCol) {
  18526. if (typeof record === 'number') {
  18527. record = this.store.data.getAt(record);
  18528. }
  18529. if (record.isEntity === true) {
  18530. this.setSelection([record]);
  18531. if (typeof editRowCol === 'string' && editRowCol) {
  18532. editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
  18533. }
  18534. if (typeof editRowCol === 'number') {
  18535. var ce = this.findPlugin('cellediting');
  18536. this.editingPlugin = ce;
  18537. ce.startEdit(record, editRowCol);
  18538. }
  18539. }
  18540. },
  18541. /**
  18542. * 移除行
  18543. * @param record 如果记录传空,就是当前选中的行
  18544. */
  18545. removeEditRow: function (record) {
  18546. if (!record) {
  18547. record = this.selection;
  18548. }
  18549. if (!record) {
  18550. msg('请选中要删除的行');
  18551. return;
  18552. }
  18553. this.getStore().remove(record);
  18554. },
  18555. /**
  18556. * 获取全部原始数据
  18557. */
  18558. getDataRows: function () {
  18559. return this.getStore().data.items.map(function (r) { return r.data; });
  18560. },
  18561. /**
  18562. * 获取全部原始数据, 不带 id/ 不带 origin
  18563. */
  18564. getDataRowsOnlyData: function () {
  18565. return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
  18566. delete r.id;
  18567. delete r._origin;
  18568. return r;
  18569. });
  18570. },
  18571. rowMoveUp: function () {
  18572. var grid = this;
  18573. if (!grid.selection) {
  18574. msg('无法对多行进行移动');
  18575. return;
  18576. }
  18577. var record = grid.selection;
  18578. if (_$2.isArray(record)) {
  18579. record = record[0];
  18580. }
  18581. if (!record) {
  18582. msg('无法对多行进行移动');
  18583. return;
  18584. }
  18585. // const records = grid.selModel.getSelection()
  18586. // if (records.length !== 1) {
  18587. // msg('无法对多行进行移动')
  18588. // return
  18589. // }
  18590. //
  18591. // const [record] = records
  18592. var index = grid.store.indexOf(record);
  18593. if (index > 0) {
  18594. grid.store.removeAt(index);
  18595. grid.store.insert(index - 1, record);
  18596. grid.getView().refresh();
  18597. grid.selModel.select([record]);
  18598. }
  18599. },
  18600. rowMoveDown: function () {
  18601. var grid = this;
  18602. // const records = grid.selModel.getSelection()
  18603. // if (records.length !== 1) {
  18604. // msg('无法对多行进行移动')
  18605. // return
  18606. // }
  18607. if (!grid.selection) {
  18608. msg('无法对多行进行移动');
  18609. return;
  18610. }
  18611. var record = grid.selection;
  18612. if (_$2.isArray(record)) {
  18613. record = record[0];
  18614. }
  18615. if (!record) {
  18616. msg('无法对多行进行移动');
  18617. return;
  18618. }
  18619. var index = grid.store.indexOf(record);
  18620. if (index < grid.store.getCount() - 1) {
  18621. grid.store.removeAt(index);
  18622. grid.store.insert(index + 1, record);
  18623. grid.getView().refresh();
  18624. grid.selModel.select([record]);
  18625. }
  18626. },
  18627. getEditRecord: function () {
  18628. var _a, _b;
  18629. var me = this;
  18630. var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
  18631. 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;
  18632. var record;
  18633. if (typeof rowIdx === 'undefined') {
  18634. record = me.getSelectionModel().getLastSelected();
  18635. }
  18636. else {
  18637. record = me.store.getAt(rowIdx);
  18638. }
  18639. return record;
  18640. },
  18641. getEditRow: function () {
  18642. var _a;
  18643. var me = this;
  18644. return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
  18645. },
  18646. setEditRow: function (rowValues) {
  18647. var me = this;
  18648. var record = me.getEditRecord();
  18649. if (record) {
  18650. _$2.forOwn(rowValues, function (v, k) {
  18651. record.set(k, v);
  18652. });
  18653. }
  18654. },
  18655. _transform: function (data) {
  18656. // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
  18657. _$2.forEach(data, function (row) {
  18658. row._origin = _$2.clone(row);
  18659. });
  18660. },
  18661. _setDataReal: function (value) {
  18662. var me = this;
  18663. this._transform(value);
  18664. var storeOpt = {
  18665. fields: getFileds(this),
  18666. data: value,
  18667. };
  18668. if (this.groupField) {
  18669. storeOpt.groupField = this.groupField;
  18670. }
  18671. var store = new Ext.data.Store(storeOpt);
  18672. me.setStore(store);
  18673. },
  18674. setStore: function (store) {
  18675. var me = this;
  18676. if (_$2.isArray(store)) {
  18677. var value = store;
  18678. this._transform(value);
  18679. var storeOpt = {
  18680. fields: getFileds(this),
  18681. data: value,
  18682. };
  18683. if (this.groupField) {
  18684. storeOpt.groupField = this.groupField;
  18685. }
  18686. store = new Ext.data.Store(storeOpt);
  18687. }
  18688. me.superclass.setStore.call(this, store);
  18689. var reference = this.reference;
  18690. if (reference) {
  18691. var scope = lookupScope(this);
  18692. scope.viewModel.set(reference + '.ischanged', false);
  18693. scope.viewModel.set(reference + '.theid', null);
  18694. scope.viewModel.set(reference + '.theid2', null);
  18695. scope.viewModel.set(reference + '.theid3', null);
  18696. }
  18697. if (store) {
  18698. store.on({
  18699. add: function (store, records, index, eOpts) {
  18700. me._raiseChange(store, 'add');
  18701. },
  18702. remove: function (store, records, index, isMove, eOpts) {
  18703. me._raiseChange(store, 'remove');
  18704. },
  18705. datachanged: function (sender, opt) {
  18706. me._raiseChange(store, 'datachanged');
  18707. }
  18708. });
  18709. }
  18710. },
  18711. _raiseChange: function (store, type) {
  18712. var _a, _b;
  18713. var reference = this.reference;
  18714. if (reference && store) {
  18715. var ischanged = false;
  18716. if (store.getModifiedRecords().length > 0 ||
  18717. store.getNewRecords().length > 0 ||
  18718. store.getRemovedRecords().length > 0) {
  18719. ischanged = true;
  18720. }
  18721. else {
  18722. ischanged = false;
  18723. }
  18724. (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
  18725. }
  18726. },
  18727. /**
  18728. * 轻量级刷新
  18729. */
  18730. refreshData: function () {
  18731. var store = this.getStore();
  18732. if (store) {
  18733. store.reload();
  18734. }
  18735. },
  18736. /**
  18737. * 为表格强制设置焦点
  18738. * @param seq 顺序号
  18739. */
  18740. focusRow: function (seq) {
  18741. this.setSelection(this.store.getAt(seq));
  18742. this.getView().focusRow(seq);
  18743. },
  18744. /**
  18745. * 重新载入数据(重新计算参数)
  18746. */
  18747. reload: function (reloadParams) {
  18748. if (reloadParams === void 0) { reloadParams = {}; }
  18749. var me = this;
  18750. var config = me.config;
  18751. if (config.dataSourceCallbackFn) {
  18752. // 函数请求刷新
  18753. var scope_1 = lookupScope(this);
  18754. _$2.defer(function () {
  18755. me.setLoading(true);
  18756. });
  18757. config.dataSourceCallbackFn.call(scope_1, me, {
  18758. successCallback: function (value) {
  18759. me._setDataReal(value);
  18760. _$2.defer(function () {
  18761. me.setLoading(false);
  18762. });
  18763. // 自动选中第一行
  18764. var data = me.getStore().data;
  18765. if (data.length > 0) {
  18766. me.setSelection(data.items[0]);
  18767. }
  18768. me.fireEvent('dataLoadComplete', me, true, value);
  18769. },
  18770. failCallback: function (error) {
  18771. _$2.defer(function () {
  18772. me.setLoading(false);
  18773. });
  18774. me.fireEvent('dataLoadComplete', me, false, error);
  18775. }
  18776. });
  18777. return;
  18778. }
  18779. // if (this.store) {
  18780. // this.store.reload({aaaa: 1, bbbb: 2})
  18781. // }
  18782. var dataSource = config.dataSource;
  18783. var scope = lookupScope(me);
  18784. if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
  18785. gridInvokeBuild(scope, me, config, dataSource, reloadParams);
  18786. }
  18787. },
  18788. exportCurrentExcelClick: function () {
  18789. var _a;
  18790. var me = this;
  18791. var config = me.config;
  18792. var scope = lookupScope(me);
  18793. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18794. if (excelFileName.endsWith(".xlsx")) {
  18795. excelFileName = excelFileName.split(".xlsx")[0];
  18796. }
  18797. excelFileName += ".xlsx";
  18798. var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  18799. var excelData = me.makeExcelData(rowsAll);
  18800. LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
  18801. },
  18802. /**
  18803. * excel 导出
  18804. * excelExportParams 导出参数
  18805. * isContinue 是否继续导出
  18806. */
  18807. exportExcelClick: function (excelExportParams, isContinue) {
  18808. if (isContinue === void 0) { isContinue = false; }
  18809. var me = this;
  18810. var config = me.config;
  18811. excelExportParams.isExcelExport = true;
  18812. var scope = lookupScope(me);
  18813. var dataSource = config.dataSource;
  18814. var ep = function () {
  18815. scope.setLoading(true);
  18816. console.log("dataSource", dataSource);
  18817. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  18818. var _a, _b, _c, _d;
  18819. console.log("responseData", responseData);
  18820. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || me.exportExcelCurrentPage || 1;
  18821. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  18822. 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;
  18823. me.exportExcelCurrentPage = page;
  18824. me.exportExcelPageSize = size;
  18825. me.exportExcelTotal = total;
  18826. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18827. if (excelFileName.endsWith(".xlsx")) {
  18828. excelFileName = excelFileName.split(".xlsx")[0];
  18829. }
  18830. console.log("makeExcelData", me.makeExcelData);
  18831. var pageExcelData = me.makeExcelData(responseData.data);
  18832. excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
  18833. excelFileName += ".xlsx";
  18834. LAY_EXCEL.exportExcel(pageExcelData, excelFileName, 'xlsx');
  18835. scope.setLoading(false);
  18836. if (page < total / size) {
  18837. page++;
  18838. me.exportExcelCurrentPage = page;
  18839. if (isContinue === true) {
  18840. excelExportParams.exportExcelCurrentPage = page;
  18841. ep();
  18842. }
  18843. }
  18844. });
  18845. };
  18846. ep();
  18847. },
  18848. exportExcelClick2: function (excelExportParams, isContinue) {
  18849. return __awaiter(this, void 0, void 0, function () {
  18850. var currentPage, totalSize, me, config, scope, dataSource, excelData, ep, pageSize, totalPage, sumCount, err, page, progressSize, progress, leftSize, pageData, e_1, excelFileName, pageExcelData;
  18851. return __generator(this, function (_a) {
  18852. switch (_a.label) {
  18853. case 0:
  18854. currentPage = excelExportParams.exportExcelCurrentPage;
  18855. totalSize = excelExportParams.exportExcelPageSize;
  18856. console.log("currentPage", currentPage);
  18857. console.log("pageSize", totalSize);
  18858. me = this;
  18859. config = me.config;
  18860. excelExportParams.isExcelExport = true;
  18861. scope = lookupScope(me);
  18862. dataSource = config.dataSource;
  18863. excelData = [];
  18864. ep = function () {
  18865. return new Promise(function (resolve, reject) {
  18866. console.log("dataSource", dataSource);
  18867. try {
  18868. gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
  18869. var _a, _b, _c, _d;
  18870. console.log("responseData", responseData);
  18871. var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || me.exportExcelCurrentPage || 1;
  18872. var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
  18873. 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;
  18874. me.exportExcelCurrentPage = page;
  18875. me.exportExcelPageSize = size;
  18876. me.exportExcelTotal = total;
  18877. resolve(responseData.data);
  18878. });
  18879. }
  18880. catch (e) {
  18881. reject(e);
  18882. }
  18883. });
  18884. };
  18885. pageSize = 1000;
  18886. totalPage = Math.ceil(totalSize / pageSize);
  18887. sumCount = 0;
  18888. err = null;
  18889. page = 1;
  18890. _a.label = 1;
  18891. case 1:
  18892. if (!(page <= totalPage)) return [3 /*break*/, 6];
  18893. progressSize = (page - 1) * pageSize;
  18894. progress = progressSize / totalSize;
  18895. scope.setLoading("\u6570\u636E\u5BFC\u51FA(" + Math.floor(progress * 10000) / 100 + "%)<br/>" + progressSize + "/" + totalSize);
  18896. leftSize = totalSize - progressSize;
  18897. excelExportParams.exportExcelCurrentPage = page;
  18898. excelExportParams.exportExcelPageSize = leftSize < pageSize ? leftSize : pageSize;
  18899. console.log("Page=", excelExportParams.exportExcelCurrentPage, "Size=", excelExportParams.exportExcelPageSize);
  18900. _a.label = 2;
  18901. case 2:
  18902. _a.trys.push([2, 4, , 5]);
  18903. return [4 /*yield*/, ep()];
  18904. case 3:
  18905. pageData = _a.sent();
  18906. if (!pageData || pageData.length <= 0) {
  18907. return [3 /*break*/, 6];
  18908. }
  18909. sumCount = sumCount + pageData.length;
  18910. excelData.push.apply(excelData, __spread(pageData));
  18911. return [3 /*break*/, 5];
  18912. case 4:
  18913. e_1 = _a.sent();
  18914. err = e_1;
  18915. return [3 /*break*/, 5];
  18916. case 5:
  18917. page++;
  18918. return [3 /*break*/, 1];
  18919. case 6:
  18920. if (!err) {
  18921. scope.setLoading("\u6570\u636E\u5BFC\u51FA(" + Math.floor(excelData.length / sumCount * 10000) / 100 + "%<br/>" + excelData.length + "/" + sumCount);
  18922. }
  18923. excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18924. if (!excelFileName.endsWith(".xlsx")) {
  18925. excelFileName += ".xlsx";
  18926. }
  18927. console.log("excelFileName=", excelFileName);
  18928. pageExcelData = me.makeExcelData(excelData);
  18929. console.log("pageExcelData", pageExcelData);
  18930. // resolve(responseData.data);
  18931. LAY_EXCEL.exportExcel(pageExcelData, excelFileName, 'xlsx');
  18932. scope.setLoading(false);
  18933. if (err)
  18934. throw err;
  18935. return [2 /*return*/];
  18936. }
  18937. });
  18938. });
  18939. },
  18940. exportBigExcelClick: function () {
  18941. var _a;
  18942. var me = this;
  18943. if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
  18944. showErrorDialog('当前表格不支持大批量导出');
  18945. return;
  18946. }
  18947. var config = me.config;
  18948. var scope = lookupScope(me);
  18949. var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
  18950. var head = [];
  18951. var dict = {};
  18952. _$2.forEach(me.columns, function (column) {
  18953. if (column.isHidden())
  18954. return;
  18955. if (!column.dataIndex)
  18956. return;
  18957. if (!column.text)
  18958. return;
  18959. head.push({ field: column.dataIndex, name: column.text });
  18960. if (column.dictForExcel) {
  18961. dict[column.dataIndex] = column.dictForExcel;
  18962. }
  18963. });
  18964. // 判断是否需要解密
  18965. if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
  18966. me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
  18967. me.dbInfo.password = hexToString(me.dbInfo.password);
  18968. me.dbInfo.username = hexToString(me.dbInfo.username);
  18969. }
  18970. scope.setLoading(true);
  18971. Ext.Ajax.request({
  18972. timeout: 15000,
  18973. url: window["EXPORT_DATA_HOST"],
  18974. method: "POST",
  18975. jsonData: {
  18976. file: excelFileName,
  18977. dbInfo: me.dbInfo,
  18978. exportDataSql: me.exportDataSql,
  18979. exportDataSqlParams: me.exportDataSqlParams,
  18980. head: head,
  18981. dict: dict,
  18982. },
  18983. }).then(function () {
  18984. scope.setLoading(false);
  18985. msg('请求成功');
  18986. }).catch(function () {
  18987. scope.setLoading(false);
  18988. showErrorDialog('请求失败,请确认是否已安装客户端');
  18989. });
  18990. },
  18991. makeExcelData: function (jsonData) {
  18992. var me = this;
  18993. me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
  18994. if (!Array.isArray(jsonData) || jsonData.length === 0) {
  18995. return;
  18996. }
  18997. var data = [];
  18998. // 获取表格的列定义
  18999. var headerTextArr = [];
  19000. var headers = [];
  19001. for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
  19002. var header = me.headerCt.getGridColumns()[i];
  19003. if (!header.isHidden()) {
  19004. var textStr = _$2.trim(header.text);
  19005. var dataIndexStr = _$2.trim(header.dataIndex);
  19006. if (dataIndexStr) {
  19007. if (textStr === '') {
  19008. headerTextArr.push(dataIndexStr);
  19009. }
  19010. else {
  19011. headerTextArr.push(textStr);
  19012. }
  19013. headers.push(header);
  19014. }
  19015. }
  19016. }
  19017. if (headers.length === 0) {
  19018. return;
  19019. }
  19020. data.push(headerTextArr);
  19021. for (var i = 0; i < jsonData.length; i++) {
  19022. var dataRow = jsonData[i];
  19023. var row = [];
  19024. for (var j = 0; j < headers.length; j++) {
  19025. var key = headers[j].dataIndex;
  19026. var value = dataRow[key];
  19027. if (!value && value !== 0) {
  19028. value = '';
  19029. }
  19030. var oValue = value;
  19031. // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
  19032. if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
  19033. try {
  19034. value = headers[j].renderer(value);
  19035. if (!value && value !== 0) {
  19036. value = oValue;
  19037. }
  19038. }
  19039. catch (e) {
  19040. value = oValue;
  19041. }
  19042. }
  19043. row.push(value);
  19044. }
  19045. data.push(row);
  19046. }
  19047. return data;
  19048. },
  19049. initComponent: function () {
  19050. var _this = this;
  19051. var _a;
  19052. var me = this;
  19053. var config = me.config;
  19054. var scope = lookupScope(this);
  19055. if (isDesignMode(scope, config)) {
  19056. this.superclass.initComponent.call(this);
  19057. return;
  19058. }
  19059. // 转换 dataSource 属性
  19060. convertDataSource$1(me, scope, config);
  19061. this.on({
  19062. afterrender: function (sender) {
  19063. var me = this;
  19064. var config = this.config;
  19065. var dataSource = config.dataSource;
  19066. if (config.autoLoad) {
  19067. if (config.dataSourceCallbackFn) {
  19068. me.reload();
  19069. }
  19070. else if (_$2.isPlainObject(dataSource)) {
  19071. me.reload();
  19072. }
  19073. }
  19074. if (config.contextMenu === true && _$2.isArray(config.tbar)) {
  19075. var vm = this.lookupViewModel();
  19076. this.contextMenu = this.add(new Ext.menu.Menu({
  19077. viewModel: vm,
  19078. items: _$2.map(config.tbar, function (item) {
  19079. var menuItem = __assign({}, item);
  19080. if (menuItem.xtype === 'button') {
  19081. delete menuItem.xtype;
  19082. }
  19083. return menuItem;
  19084. })
  19085. }));
  19086. }
  19087. else if (_$2.isPlainObject(config.contextMenu)) {
  19088. this.contextMenu = this.add(config.contextMenu);
  19089. }
  19090. var $dom = $(sender.el.dom);
  19091. $dom.on('keydown', function (e) {
  19092. me.fireEvent('keydown', me, e);
  19093. }).on('keyup', function (e) {
  19094. me.fireEvent('keyup', me, e);
  19095. });
  19096. // 默认显示提示
  19097. if (this.cellTip) {
  19098. this.tip = Ext.create('Ext.tip.ToolTip', {
  19099. target: this.el,
  19100. delegate: '.x-grid-cell-inner',
  19101. trackMouse: true,
  19102. ancor: 'top',
  19103. style: 'background-color: #0D6EFD;',
  19104. listeners: {
  19105. beforeshow: function (tip) {
  19106. var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
  19107. if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
  19108. return false;
  19109. }
  19110. tip.update(tipText);
  19111. }
  19112. }
  19113. });
  19114. }
  19115. },
  19116. itemcontextmenu: function (view, rec, node, index, e) {
  19117. if (this.contextMenu) {
  19118. e.stopEvent();
  19119. this.contextMenu.show().setLocalXY(e.getXY());
  19120. return false;
  19121. }
  19122. },
  19123. // columnmove(sender, column, fromIndex, toIndex, eOpts) {
  19124. // this.setColumnConfigCache()
  19125. // },
  19126. // columnhide(sender, column, eOpts) {
  19127. // this.setColumnConfigCache()
  19128. // },
  19129. // columnshow(sender, column, eOpts) {
  19130. // this.setColumnConfigCache()
  19131. // },
  19132. // columnresize(sender, column, width, eOpts) {
  19133. // this.setColumnConfigCache()
  19134. // },
  19135. destory: function () {
  19136. },
  19137. selectionchange: function (sender, param) {
  19138. var record = undefined;
  19139. if (_$2.isArray(param)) {
  19140. record = param[0];
  19141. }
  19142. else if (_$2.isObject(param)) {
  19143. record = _$2.get(param, 'endCell.record');
  19144. }
  19145. itemselectFun(this, sender, record);
  19146. },
  19147. itemclick: function (sender, record) {
  19148. itemselectFun(this, sender, record);
  19149. },
  19150. show: function (sender) {
  19151. if (sender.__suspendReload) {
  19152. sender.__suspendReload = false;
  19153. sender.reload();
  19154. }
  19155. }
  19156. });
  19157. _$2.defer(function () {
  19158. var ce = _this.findPlugin('cellediting');
  19159. ce.on({
  19160. beforeedit: function (editor, context, eOpts) {
  19161. me.fireEvent('editbefore', me, editor, context, eOpts);
  19162. },
  19163. canceledit: function (editor, context, eOpts) {
  19164. me.fireEvent('editcancel', me, editor, context, eOpts);
  19165. },
  19166. edit: function (editor, context, eOpts) {
  19167. me.fireEvent('editfinish', me, editor, context, eOpts);
  19168. },
  19169. validateedit: function (editor, context, eOpts) {
  19170. me.fireEvent('editvalidate', me, editor, context, eOpts);
  19171. },
  19172. });
  19173. });
  19174. var itemselectFun = _$2.debounce(function (me, sender, record) {
  19175. var reference = me.reference;
  19176. var scope = lookupScope(me);
  19177. var theid = _$2.get(config, 'behavior.theid');
  19178. if (theid && reference) {
  19179. if (!record) {
  19180. scope.viewModel.set(reference + '.theid', null);
  19181. }
  19182. else {
  19183. scope.viewModel.set(reference + '.theid', record.get(theid));
  19184. }
  19185. }
  19186. var theid2 = _$2.get(config, 'behavior.theid2');
  19187. if (theid2 && reference) {
  19188. if (!record) {
  19189. scope.viewModel.set(reference + '.theid2', null);
  19190. }
  19191. else {
  19192. scope.viewModel.set(reference + '.theid2', record.get(theid2));
  19193. }
  19194. }
  19195. var theid3 = _$2.get(config, 'behavior.theid3');
  19196. if (theid3 && reference) {
  19197. if (!record) {
  19198. scope.viewModel.set(reference + '.theid3', null);
  19199. }
  19200. else {
  19201. scope.viewModel.set(reference + '.theid3', record.get(theid3));
  19202. }
  19203. }
  19204. me.fireEvent('itemselect', sender, record);
  19205. }, 50);
  19206. if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
  19207. // 为 stores.proxy.buildRequest 做准备
  19208. this.store.proxy.$owner = this;
  19209. }
  19210. var selectToReload = _$2.get(config, 'behavior.selectToReload');
  19211. if (selectToReload) {
  19212. // 点击后触发某个目标表格刷新
  19213. this.on({
  19214. itemselect: function (sender) {
  19215. if (_$2.isArray(selectToReload)) {
  19216. _$2.forEach(selectToReload, function (ref) {
  19217. if (ref) {
  19218. var ctlTarget = scope.refs[ref];
  19219. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19220. if (ctlTarget.isVisible()) {
  19221. ctlTarget.reload();
  19222. }
  19223. else {
  19224. ctlTarget.__suspendReload = true;
  19225. }
  19226. }
  19227. }
  19228. });
  19229. }
  19230. else if (_$2.isString(selectToReload)) {
  19231. var ctlTarget = scope.refs[selectToReload];
  19232. if (ctlTarget && typeof ctlTarget.reload === 'function') {
  19233. ctlTarget.reload();
  19234. }
  19235. }
  19236. }
  19237. });
  19238. }
  19239. this.superclass.initComponent.call(this);
  19240. },
  19241. // 生成列自定义的缓存key
  19242. makeColumnConfigCacheKey: function (config) {
  19243. var _a, _b, _c, _d, _e, _f;
  19244. 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);
  19245. var key = "gridColumnCache-" + scope.scopeKey + "-";
  19246. if (config.reference) {
  19247. key += config.reference;
  19248. }
  19249. else {
  19250. var subKey = "";
  19251. for (var i = 0; i < config.columns.length; i++) {
  19252. var column = config.columns[i];
  19253. if (column.dataIndex) {
  19254. subKey += column.dataIndex;
  19255. }
  19256. }
  19257. key += subKey;
  19258. }
  19259. return key;
  19260. },
  19261. getColumnConfigCache: function () {
  19262. var key = this.columnConfigCacheKey;
  19263. var dataStr = localStorage.getItem(key);
  19264. if (dataStr) {
  19265. return JSON.parse(dataStr);
  19266. }
  19267. return "";
  19268. },
  19269. setColumnConfigCache: function () {
  19270. var key = this.columnConfigCacheKey;
  19271. var cacheData = [];
  19272. var columns = this.headerCt.getGridColumns();
  19273. var index = 0;
  19274. for (var i = 0; i < columns.length; i++) {
  19275. var column = columns[i];
  19276. if (column.dataIndex) {
  19277. cacheData.push({
  19278. dataIndex: column.dataIndex,
  19279. width: column.width,
  19280. hidden: column.hidden,
  19281. locked: column.locked,
  19282. index: index
  19283. });
  19284. index++;
  19285. }
  19286. }
  19287. localStorage.setItem(key, JSON.stringify(cacheData));
  19288. },
  19289. autoSizeColumns: function (sender) {
  19290. var grid = sender ? sender.up('grid') : this;
  19291. // const columns = grid.columns;
  19292. // for (let i = 0; i < columns.length; i++) {
  19293. // const column = columns[i];
  19294. // grid.getView().autoSizeColumn(column);
  19295. // column.setWidth(column.getWidth() + 5);
  19296. // }
  19297. for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19298. grid.headerCt.getGridColumns()[i].autoSize(i);
  19299. grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19300. }
  19301. },
  19302. clearFilter: function (sender) {
  19303. var grid = sender.up('grid');
  19304. grid.filters.clearFilters();
  19305. grid.getStore().sorters.removeAll();
  19306. // grid.getStore().reload()
  19307. },
  19308. saveGridUIConfig: function (sender) {
  19309. var grid = sender.up('grid');
  19310. grid.setColumnConfigCache();
  19311. msg('保存设置成功!');
  19312. },
  19313. clearGridUIConfig: function (sender) {
  19314. var grid = sender.up('grid');
  19315. var key = grid.columnConfigCacheKey;
  19316. localStorage.setItem(key, "");
  19317. msg('清空设置成功,重新打开后生效!');
  19318. },
  19319. setLoading: function (value) {
  19320. if (value) {
  19321. this.mask('读取中');
  19322. }
  19323. else {
  19324. this.unmask();
  19325. }
  19326. },
  19327. exportExcel: function (sender) {
  19328. var _this = this;
  19329. var _a, _b;
  19330. var rect = sender.btnEl.dom.getBoundingClientRect();
  19331. var scope = lookupScope(this);
  19332. var grid = sender.up('grid');
  19333. var menuItems = [];
  19334. var topOffset = 0;
  19335. 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)) {
  19336. menuItems.push({
  19337. text: '大批量导出 (需要客户端支持!)',
  19338. iconCls: 'x-fa fa-download',
  19339. listeners: {
  19340. click: function (sender, value) {
  19341. // @ts-ignore
  19342. YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
  19343. .then(function (res) {
  19344. grid.exportBigExcelClick();
  19345. });
  19346. }
  19347. }
  19348. });
  19349. menuItems.push('-');
  19350. topOffset += 30;
  19351. }
  19352. menuItems.push({
  19353. text: '导出当前数据',
  19354. iconCls: 'x-fa fa-download',
  19355. listeners: {
  19356. click: function (sender, value) {
  19357. grid.exportCurrentExcelClick();
  19358. }
  19359. }
  19360. });
  19361. topOffset += 30;
  19362. if (grid === null || grid === void 0 ? void 0 : grid.dataSource) {
  19363. menuItems.push({
  19364. xtype: "textfield",
  19365. fieldLabel: '当前导出页',
  19366. maskRe: /[0-9]/,
  19367. value: grid.exportExcelCurrentPage,
  19368. listeners: {
  19369. render: function (sender) {
  19370. grid.exportExcelCurrentPageCmp = sender;
  19371. },
  19372. change: function (sender, value) {
  19373. var v = parseInt(value);
  19374. if (isNaN(v) || v === 0) {
  19375. window['system'].msg("页码不能为0");
  19376. v = 1;
  19377. sender.setValue(v);
  19378. }
  19379. var size = parseInt(grid.exportExcelPageSize);
  19380. var total = parseInt(grid.exportExcelTotal);
  19381. if (v > total / size) {
  19382. v = parseInt(total / size + "");
  19383. }
  19384. grid.exportExcelCurrentPage = v + "";
  19385. }
  19386. }
  19387. }, {
  19388. xtype: "textfield",
  19389. fieldLabel: '导出页大小',
  19390. maskRe: /[0-9]/,
  19391. value: grid.exportExcelPageSize,
  19392. listeners: {
  19393. render: function (sender) {
  19394. grid.exportExcelPageSizeCmp = sender;
  19395. },
  19396. change: function (sender, value) {
  19397. var v = parseInt(value);
  19398. if (isNaN(v) || v === 0) {
  19399. window['system'].msg("导出页大小不能为0");
  19400. v = defaultGrid.exportExcelPageSize;
  19401. sender.setValue(v);
  19402. }
  19403. if (window['__isNNDSL'] === true) ;
  19404. else {
  19405. if (v > 10000) {
  19406. window['system'].msg("导出页大小不能大于10000");
  19407. v = 10000;
  19408. sender.setValue(v);
  19409. }
  19410. }
  19411. var page = parseInt(grid.exportExcelCurrentPage);
  19412. var total = parseInt(grid.exportExcelTotal);
  19413. if (page > total / v) {
  19414. page = parseInt(total / v + "") + 1;
  19415. grid.exportExcelCurrentPageCmp.setValue(page);
  19416. }
  19417. grid.exportExcelPageSize = v + "";
  19418. }
  19419. }
  19420. }, {
  19421. xtype: "textfield",
  19422. fieldLabel: '总条数',
  19423. value: grid.exportExcelTotal,
  19424. readOnly: true
  19425. }, {
  19426. text: '导出',
  19427. iconCls: 'x-fa fa-download',
  19428. listeners: {
  19429. click: function (sender, value) {
  19430. var me = _this;
  19431. var scope = lookupScope(me);
  19432. grid.exportExcelClick2({
  19433. exportExcelPageSize: grid.exportExcelPageSize,
  19434. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19435. }).catch(function (e) {
  19436. console.error("导出报错", e);
  19437. system.msg("导出失败:" + e.message);
  19438. }).finally(function () {
  19439. scope.setLoading(false);
  19440. });
  19441. }
  19442. }
  19443. }, {
  19444. text: '连续导出',
  19445. iconCls: 'x-fa fa-download',
  19446. listeners: {
  19447. click: function (sender, value) {
  19448. grid.exportExcelClick({
  19449. exportExcelPageSize: grid.exportExcelPageSize,
  19450. exportExcelCurrentPage: grid.exportExcelCurrentPage
  19451. }, true);
  19452. }
  19453. }
  19454. });
  19455. topOffset += 150;
  19456. }
  19457. var treeMenu = new Ext.menu.Menu({
  19458. xtype: 'menu',
  19459. floated: false,
  19460. width: 300,
  19461. docked: 'left',
  19462. items: menuItems
  19463. });
  19464. treeMenu.showAt(rect.left, rect.top - topOffset);
  19465. // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
  19466. // grid.headerCt.getGridColumns()[i].autoSize(i);
  19467. // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
  19468. // }
  19469. },
  19470. /**
  19471. * 获取表格编辑的行数据
  19472. */
  19473. getGridEditRows: function () {
  19474. var grid = this;
  19475. var store = grid.getStore();
  19476. var rows = [];
  19477. var modifyRows = [];
  19478. var newRows = [];
  19479. var err = "";
  19480. var records = store.getModifiedRecords();
  19481. var newRecords = store.getNewRecords();
  19482. var removeRecords = [];
  19483. _$2.forEach(store.getRemovedRecords(), function (row) {
  19484. removeRecords.push(row.data);
  19485. });
  19486. _$2.forEach(records, function (record) {
  19487. var colums = grid.columns;
  19488. var errFunc = undefined;
  19489. _$2.forEach(colums, function (col) {
  19490. var name = col.dataIndex;
  19491. var value = record.data[name];
  19492. var colIndex = col.getIndex(); //获得列号
  19493. var rowIndex = store.indexOfId(record.id); //获得行号
  19494. var editor = col.getEditor(); //使用的编辑器
  19495. var tmpErrFunc = function () {
  19496. var text = col.text || col.name;
  19497. msg(text + ' 校验失败, 请确保输入的数据正确');
  19498. grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
  19499. };
  19500. if (editor && !editor.allowBlank && isEmpty(value)) {
  19501. errFunc = tmpErrFunc;
  19502. return false;
  19503. }
  19504. if (editor && !isEmpty(value) && !editor.validateValue(value)) {
  19505. errFunc = tmpErrFunc;
  19506. return false;
  19507. }
  19508. });
  19509. if (typeof errFunc === 'function') {
  19510. err = "1";
  19511. _$2.remove(rows, function (n) {
  19512. return true;
  19513. });
  19514. //@ts-ignore
  19515. errFunc();
  19516. // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
  19517. return false;
  19518. }
  19519. else {
  19520. if (_$2.findIndex(newRecords, function (item) {
  19521. return item === record;
  19522. }) >= 0) {
  19523. newRows.push(record.data);
  19524. }
  19525. else {
  19526. modifyRows.push(record.data);
  19527. }
  19528. rows.push(record.data);
  19529. }
  19530. });
  19531. return {
  19532. rows: rows,
  19533. newRows: newRows,
  19534. modifyRows: modifyRows,
  19535. removeRecords: removeRecords,
  19536. err: err
  19537. };
  19538. }
  19539. // reload() {
  19540. // dataSourceReload(this)
  19541. // },
  19542. });
  19543. }
  19544. /**
  19545. * 获取 columns 中所有的 dataIndex
  19546. */
  19547. function getFileds(newConfig) {
  19548. var fields = [];
  19549. _$2.forEach(newConfig.columns, function (c) {
  19550. if (c.dataIndex) {
  19551. fields.push(c.dataIndex);
  19552. }
  19553. });
  19554. return fields;
  19555. }
  19556. function convertDataSource$1(sender, scope, newConfig) {
  19557. if (typeof newConfig.store !== 'undefined') {
  19558. // 有 store 属性的情况下,不做任何事
  19559. return;
  19560. }
  19561. if (typeof newConfig.dataSource === 'undefined') {
  19562. // 没有定义 dataSource 的情况下,不做任何事
  19563. return;
  19564. }
  19565. if (_$2.isArray(newConfig.data)) {
  19566. // 有 data 属性赋值的情况下
  19567. newConfig.store = {
  19568. fields: getFileds(newConfig),
  19569. data: newConfig.data
  19570. };
  19571. delete newConfig.data;
  19572. return;
  19573. }
  19574. var dataSource = newConfig.dataSource;
  19575. if (typeof dataSource === 'string') {
  19576. // dataSource 是字符串的情况下,找到成员函数
  19577. dataSource = lookupFn(scope, dataSource);
  19578. }
  19579. if (typeof dataSource === 'function') {
  19580. // dataSource 是函数的情况下,在 afterrender 之后进行回调
  19581. newConfig.store = new Ext.data.Store({
  19582. fields: getFileds(newConfig),
  19583. // data: [],
  19584. autoLoad: true,
  19585. proxy: {
  19586. type: 'memory',
  19587. data: [],
  19588. }
  19589. });
  19590. newConfig.dataSourceCallbackFn = dataSource;
  19591. return;
  19592. }
  19593. // throw new TypeError('无法识别的调用方法')
  19594. }
  19595. function initTextfield () {
  19596. var cc = Ext.form.field.Text.prototype.constructor;
  19597. var initComponent = Ext.form.field.Text.prototype.initComponent;
  19598. Ext.form.field.Text.override({
  19599. constructor: function (config) {
  19600. var newConfig = _$2.defaultsDeep({
  19601. // 强制属性
  19602. triggers: {
  19603. clear: {
  19604. weight: -1,
  19605. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  19606. hidden: true,
  19607. handler: 'onClearClick',
  19608. },
  19609. }
  19610. }, baseConfig(config, 'col-item'), config, text);
  19611. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19612. newConfig.enableKeyEvents = true;
  19613. }
  19614. cc.call(this, newConfig);
  19615. },
  19616. /**
  19617. * 清空所有值
  19618. */
  19619. onClearClick: function (sender, e) {
  19620. var me = this;
  19621. me.setValue('');
  19622. },
  19623. /**
  19624. * 尝试获取下一个要获取焦点的控件
  19625. */
  19626. _raiseNextFocus: function (sender) {
  19627. var config = sender.config;
  19628. var scope = lookupScope(sender);
  19629. if (typeof config.nextFocus === 'function') {
  19630. config.nextFocus(sender);
  19631. }
  19632. else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
  19633. if (_$2.startsWith(config.nextFocus, 'scope.')) {
  19634. var fn = lookupFn(scope, config.nextFocus);
  19635. if (typeof fn === 'function') {
  19636. var nextCtlReference = fn(sender);
  19637. if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
  19638. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
  19639. if (ctl) {
  19640. if (typeof ctl.focus2 === 'function') {
  19641. ctl.focus2();
  19642. }
  19643. else {
  19644. ctl.focus();
  19645. }
  19646. }
  19647. }
  19648. }
  19649. }
  19650. else {
  19651. var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
  19652. if (ctl) {
  19653. if (typeof ctl.focus2 === 'function') {
  19654. ctl.focus2();
  19655. }
  19656. else {
  19657. ctl.focus();
  19658. }
  19659. }
  19660. }
  19661. }
  19662. },
  19663. initComponent: function () {
  19664. /**
  19665. * 改变必填项之前加星号
  19666. */
  19667. if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
  19668. // this.beforeLabelTextTpl = [
  19669. // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19670. // ];
  19671. this.afterLabelTextTpl = [
  19672. '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
  19673. ];
  19674. }
  19675. var me = this;
  19676. this.on({
  19677. change: function (sender, newVal) {
  19678. var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
  19679. if (hideTrigger || disabled || readOnly || hideClear) {
  19680. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  19681. return;
  19682. }
  19683. var value = newVal;
  19684. if (value) {
  19685. me.getTrigger('clear').show();
  19686. me.updateLayout();
  19687. }
  19688. else {
  19689. me.getTrigger('clear').hide();
  19690. me.updateLayout();
  19691. }
  19692. },
  19693. afterrender: function (sender) {
  19694. var _this = this;
  19695. var _a;
  19696. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  19697. sender.inputEl.dom.setAttribute('spellcheck', "false");
  19698. $$2(sender.inputEl.dom).on('click', function (e) {
  19699. sender.fireEvent('click', _this, e);
  19700. });
  19701. $$2(sender.inputEl.dom).on('keydown', function (e) {
  19702. var _a, _b, _c, _d;
  19703. // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
  19704. if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
  19705. if (sender.isExpanded === true) {
  19706. // 弹开下拉框的基础上,不干预上下选择
  19707. return;
  19708. }
  19709. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  19710. var grid = sender.ownerCt.up('grid');
  19711. var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
  19712. if (editingPlugin) {
  19713. 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;
  19714. var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
  19715. if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
  19716. // editingPlugin
  19717. var targetRecord = void 0;
  19718. if (e.code === 'ArrowDown') {
  19719. targetRecord = grid.store.data.getAt(rowIdx + 1);
  19720. }
  19721. else {
  19722. targetRecord = grid.store.data.getAt(rowIdx - 1);
  19723. }
  19724. if (targetRecord) {
  19725. grid.setSelection([targetRecord]);
  19726. editingPlugin.startEdit(targetRecord, column);
  19727. }
  19728. e.stopPropagation();
  19729. e.preventDefault();
  19730. }
  19731. }
  19732. }
  19733. }
  19734. });
  19735. }
  19736. var config = sender.config;
  19737. if (config.ff && config.ff > 0) {
  19738. setTimeout(function () {
  19739. if (typeof sender.focus2 === 'function') {
  19740. sender.focus2();
  19741. }
  19742. else {
  19743. sender.focus();
  19744. }
  19745. }, config.ff);
  19746. }
  19747. }
  19748. });
  19749. var config = this.config;
  19750. if (config === null || config === void 0 ? void 0 : config.nextFocus) {
  19751. this.on({
  19752. keyup: function (sender, e) {
  19753. if ([10, 13, 20, 40].includes(e.keyCode)) {
  19754. sender._raiseNextFocus(sender);
  19755. }
  19756. }
  19757. });
  19758. }
  19759. var that = this;
  19760. this.on({
  19761. keyup: function (sender, e, eOpts) {
  19762. if (![10, 13, 20, 40].includes(e.keyCode)) {
  19763. return;
  19764. }
  19765. that.keydown_fun_item(sender, e, eOpts);
  19766. }
  19767. });
  19768. initComponent.call(this);
  19769. },
  19770. keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
  19771. var that = sender;
  19772. if ([10, 13, 20, 40].includes(event.keyCode)) {
  19773. // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
  19774. var value = _$2.trim(sender.rawValue);
  19775. var r = that.fireEvent('scancode', that, value, event);
  19776. if (r === 'OK') {
  19777. // 停止事件的默认处理程序,停止事件的冒泡
  19778. // event.stopEvent();
  19779. event.preventDefault();
  19780. event.stopPropagation();
  19781. }
  19782. }
  19783. }, 100)
  19784. });
  19785. }
  19786. function initTbFill () {
  19787. /**
  19788. *
  19789. */
  19790. var ct = Ext.toolbar.Fill.prototype.constructor;
  19791. Ext.toolbar.Fill.override({
  19792. constructor: function (config) {
  19793. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
  19794. ct.call(this, newConfig);
  19795. }
  19796. });
  19797. }
  19798. function initTbSeparator () {
  19799. /**
  19800. *
  19801. */
  19802. var ct = Ext.toolbar.Separator.prototype.constructor;
  19803. Ext.toolbar.Separator.override({
  19804. constructor: function (config) {
  19805. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
  19806. ct.call(this, newConfig);
  19807. }
  19808. });
  19809. }
  19810. function initToolbar () {
  19811. /**
  19812. *
  19813. */
  19814. var ct = Ext.toolbar.Toolbar.prototype.constructor;
  19815. Ext.toolbar.Toolbar.override({
  19816. constructor: function (config) {
  19817. var newConfig = _$2.defaultsDeep({
  19818. // 强制性属性
  19819. }, baseConfig(config, 'cols-container'), config, toolbar);
  19820. ct.call(this, newConfig);
  19821. }
  19822. });
  19823. initTbFill();
  19824. initTbSeparator();
  19825. }
  19826. function initSplitter () {
  19827. var ct = Ext.resizer.Splitter.prototype.constructor;
  19828. Ext.resizer.Splitter.override({
  19829. constructor: function (config) {
  19830. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
  19831. ct.call(this, newConfig);
  19832. }
  19833. });
  19834. }
  19835. /**
  19836. * 通用 dataSource 解析,
  19837. * Tree/Combo/Grid/PageList ... 都会从这里解析
  19838. */
  19839. function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
  19840. var config = ctl.config;
  19841. return new Promise(function (resolve, reject) {
  19842. if (!config.dataSource) {
  19843. // 没有设置数据源,直接置空
  19844. return Promise.resolve();
  19845. }
  19846. var option = {
  19847. extraParam: extraParam,
  19848. _successCb: _successCb,
  19849. successCallback: function (value) {
  19850. if (typeof successCallback === "function") {
  19851. successCallback(value);
  19852. }
  19853. else {
  19854. ctl.setData(value);
  19855. }
  19856. ctl.fireEvent('dataLoadComplete', ctl, true, value);
  19857. ctl.setLoading(false);
  19858. resolve(value);
  19859. },
  19860. failCallback: function (error) {
  19861. if (typeof failCallback === "function") {
  19862. failCallback(error);
  19863. }
  19864. ctl.fireEvent('dataLoadComplete', ctl, false);
  19865. ctl.setLoading(false);
  19866. reject(error);
  19867. }
  19868. };
  19869. // 请求前要求确认一下
  19870. var isCanceled = false;
  19871. ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
  19872. isCanceled = true;
  19873. } }, option));
  19874. if (!isCanceled) {
  19875. // 请求没有被取消
  19876. // 调用异步接口返回 Promise
  19877. return _innerReload(ctl, option);
  19878. }
  19879. return reject();
  19880. });
  19881. }
  19882. function _innerReload(ctl, option) {
  19883. var config = ctl.config;
  19884. ctl.setLoading(true);
  19885. var scope = lookupScope(ctl);
  19886. var dataSource = config.dataSource;
  19887. if (typeof dataSource == 'string') {
  19888. dataSource = lookupFn(scope, config.dataSource);
  19889. }
  19890. if (typeof dataSource === 'function') {
  19891. // @ts-ignore
  19892. dataSource.call(scope, ctl, option);
  19893. return;
  19894. }
  19895. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19896. if (!ajax.func) {
  19897. console.error("没有配置 ajax");
  19898. return;
  19899. }
  19900. var params_1 = {};
  19901. var sortModel = null;
  19902. var filterModel = null;
  19903. if (option.extraParam && option.extraParam.filterModel) {
  19904. filterModel = option.extraParam.filterModel;
  19905. }
  19906. if (option.extraParam && option.extraParam.sortModel) {
  19907. sortModel = option.extraParam.sortModel;
  19908. }
  19909. _$2.forOwn(option.extraParam, function (v, key) {
  19910. if (key != "filterModel" && key != "sortModel") {
  19911. if (typeof v === 'function') {
  19912. params_1[key] = v();
  19913. }
  19914. else {
  19915. params_1[key] = v;
  19916. }
  19917. }
  19918. });
  19919. var ds = dataSource;
  19920. _$2.forOwn(ds.params, function (v, key) {
  19921. if (typeof v === 'function') {
  19922. params_1[key] = v();
  19923. }
  19924. else {
  19925. params_1[key] = v;
  19926. }
  19927. });
  19928. if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
  19929. // @ts-ignore
  19930. ajax.func({
  19931. method: dataSource.method,
  19932. url: ds.url,
  19933. data: params_1,
  19934. filterModel: filterModel,
  19935. sortModel: sortModel,
  19936. }).then(function (res) {
  19937. if (res.success) {
  19938. option.successCallback(res.data);
  19939. }
  19940. else {
  19941. option.failCallback(res.msg);
  19942. }
  19943. }).catch(function (e) {
  19944. option.failCallback(e);
  19945. });
  19946. }
  19947. else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
  19948. var ds_1 = ctl.dataSource;
  19949. // @ts-ignore
  19950. Extend.ajax.func({
  19951. url: ds_1.sqlId,
  19952. data: params_1,
  19953. db: ds_1.db,
  19954. method: 'sql',
  19955. filterModel: filterModel,
  19956. sortModel: sortModel,
  19957. }).then(function (res) {
  19958. if (res.success) {
  19959. option.successCallback(res.data);
  19960. }
  19961. else {
  19962. option.failCallback(res.msg);
  19963. }
  19964. }).catch(function (e) {
  19965. option.failCallback(e);
  19966. }).finally(function () {
  19967. ctl.loading = false;
  19968. });
  19969. return;
  19970. }
  19971. else {
  19972. console.error("非法的 dataSource", ctl.dataSource);
  19973. debugger;
  19974. throw new Error("非法的 dataSource");
  19975. }
  19976. }
  19977. }
  19978. function initCombo () {
  19979. var cc = Ext.form.field.ComboBox.prototype.constructor;
  19980. var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  19981. Ext.form.field.ComboBox.override({
  19982. constructor: function (config) {
  19983. var newConfig = _$2.defaultsDeep({
  19984. // 强制性属性
  19985. }, baseConfig(config, 'col-item'), config, combo);
  19986. if (typeof config.dict === 'string') {
  19987. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  19988. }
  19989. else if (typeof newConfig.store == 'undefined') {
  19990. if (_$2.isArray(newConfig.data)) {
  19991. // ExtJS 无法直接接受数组模式
  19992. newConfig.store = {
  19993. fields: [newConfig.valueField, newConfig.displayField],
  19994. data: newConfig.data
  19995. };
  19996. delete newConfig.data;
  19997. }
  19998. else if (typeof newConfig.data !== 'object') {
  19999. newConfig.store = {
  20000. fields: [newConfig.valueField, newConfig.displayField],
  20001. data: []
  20002. };
  20003. delete newConfig.data;
  20004. }
  20005. }
  20006. cc.call(this, newConfig);
  20007. },
  20008. setDict: function (bizKey) {
  20009. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  20010. this.dict = bizKey;
  20011. },
  20012. getDict: function () {
  20013. return this.dict;
  20014. },
  20015. setData: function (value) {
  20016. if (!value) {
  20017. return;
  20018. }
  20019. var config = value.config;
  20020. if (!this.store) {
  20021. this.store = new Ext.data.Store({
  20022. fields: [config.valueField, config.displayField],
  20023. data: value
  20024. });
  20025. }
  20026. else {
  20027. this.store.getProxy().setData(value);
  20028. this.store.load();
  20029. }
  20030. },
  20031. setLoading: function (value) {
  20032. if (value) {
  20033. if (!this.loadMask) {
  20034. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  20035. }
  20036. }
  20037. else {
  20038. if (this.loadMask) {
  20039. this.loadMask.destroy();
  20040. delete this.loadMask;
  20041. }
  20042. }
  20043. },
  20044. reload: function () {
  20045. dataSourceReload(this);
  20046. },
  20047. initComponent: function () {
  20048. var that = this;
  20049. var toggle = function (e) {
  20050. var readOnly = that.readOnly, disabled = that.disabled;
  20051. if (readOnly || disabled) {
  20052. return;
  20053. }
  20054. if ($(e.target).is('.x-form-trigger')) {
  20055. return;
  20056. }
  20057. // 点击后下拉
  20058. if (that.isExpanded) {
  20059. that.collapse();
  20060. }
  20061. else {
  20062. that.expand();
  20063. that.doQuery(that.allQuery, true);
  20064. }
  20065. };
  20066. this.on({
  20067. afterrender: function (sender) {
  20068. var config = this.config;
  20069. if (config.dataSource && config.autoLoad) {
  20070. dataSourceReload(this);
  20071. }
  20072. // 点击后下拉
  20073. $(this.el.dom).on('click', toggle.bind(this));
  20074. },
  20075. focusenter: function (sender, event, opt) {
  20076. var _a;
  20077. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  20078. // 表格内编辑框,获取焦点后自动弹开
  20079. toggle.call(this, event);
  20080. }
  20081. },
  20082. destory: function () {
  20083. $(this.el.dom).off('click', toggle.bind(this));
  20084. },
  20085. beforequery: function (context) {
  20086. var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
  20087. // console.log('beforequery', query)
  20088. if (!forceAll && query) {
  20089. combo.store.clearFilter();
  20090. combo.store.filterBy(function (record, id) {
  20091. var text = record.get(combo.displayField);
  20092. // 用拼音筛选的方式
  20093. return keywordFilter(query, text, id);
  20094. });
  20095. combo.expand();
  20096. return false;
  20097. }
  20098. combo.store.clearFilter();
  20099. combo.expand();
  20100. return false;
  20101. },
  20102. });
  20103. initComponent.call(this);
  20104. },
  20105. focus2: function () {
  20106. this.focus();
  20107. var that = this;
  20108. _$2.defer(function () {
  20109. if (that.isExpanded) {
  20110. that.collapse();
  20111. }
  20112. else {
  20113. that.expand();
  20114. that.doQuery(that.allQuery, true);
  20115. }
  20116. });
  20117. }
  20118. });
  20119. }
  20120. /**
  20121. xtype: 'tagfield',
  20122. displayField: 'show',
  20123. valueField: 'id',
  20124. queryMode: 'local',
  20125. filterPickList: true,
  20126. store: {
  20127. fields: ['id', 'show'],
  20128. data: [
  20129. {id: 0, show: 'Battlestar Galactica'},
  20130. {id: 1, show: 'Doctor Who'},
  20131. {id: 2, show: 'Farscape'},
  20132. {id: 3, show: 'Firefly'},
  20133. {id: 4, show: 'Star Trek'},
  20134. {id: 5, show: 'Star Wars: Christmas Special'}
  20135. ]
  20136. }
  20137. */
  20138. function initTag () {
  20139. var cc = Ext.form.field.Tag.prototype.constructor;
  20140. var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
  20141. Ext.form.field.Tag.override({
  20142. constructor: function (config) {
  20143. var newConfig = _$2.defaultsDeep({
  20144. // 强制性属性
  20145. }, baseConfig(config, 'col-item'), config, tagfield);
  20146. if (typeof config.dict === 'string') {
  20147. window['yvanLib'].system.getDict(config.dict)(this, newConfig);
  20148. }
  20149. else if (typeof newConfig.store == 'undefined') {
  20150. if (_$2.isArray(newConfig.data)) {
  20151. // ExtJS 无法直接接受数组模式
  20152. newConfig.store = {
  20153. fields: [newConfig.valueField, newConfig.displayField],
  20154. data: newConfig.data
  20155. };
  20156. delete newConfig.data;
  20157. }
  20158. else if (typeof newConfig.data !== 'object') {
  20159. newConfig.store = {
  20160. fields: [newConfig.valueField, newConfig.displayField],
  20161. data: []
  20162. };
  20163. delete newConfig.data;
  20164. }
  20165. }
  20166. cc.call(this, newConfig);
  20167. },
  20168. setDict: function (bizKey) {
  20169. window['yvanLib'].system.getDict(bizKey)(this, this.config);
  20170. this.dict = bizKey;
  20171. },
  20172. getDict: function () {
  20173. return this.dict;
  20174. },
  20175. setData: function (value) {
  20176. if (!value) {
  20177. return;
  20178. }
  20179. var config = value.config;
  20180. if (!this.store) {
  20181. this.store = new Ext.data.Store({
  20182. fields: [config.valueField, config.displayField],
  20183. data: value
  20184. });
  20185. }
  20186. else {
  20187. this.store.getProxy().setData(value);
  20188. this.store.load();
  20189. }
  20190. },
  20191. setLoading: function (value) {
  20192. if (value) {
  20193. if (!this.loadMask) {
  20194. this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
  20195. }
  20196. }
  20197. else {
  20198. if (this.loadMask) {
  20199. this.loadMask.destroy();
  20200. delete this.loadMask;
  20201. }
  20202. }
  20203. },
  20204. reload: function () {
  20205. dataSourceReload(this);
  20206. },
  20207. initComponent: function () {
  20208. var that = this;
  20209. var toggle = function (e) {
  20210. var readOnly = that.readOnly, disabled = that.disabled;
  20211. if (readOnly || disabled) {
  20212. return;
  20213. }
  20214. if ($(e.target).is('.x-form-trigger')) {
  20215. return;
  20216. }
  20217. // 点击后下拉
  20218. if (that.isExpanded) {
  20219. that.collapse();
  20220. }
  20221. else {
  20222. that.expand();
  20223. that.doQuery(that.allQuery, true);
  20224. }
  20225. };
  20226. this.on({
  20227. afterrender: function (sender) {
  20228. var config = this.config;
  20229. if (config.dataSource && config.autoLoad) {
  20230. dataSourceReload(this);
  20231. }
  20232. // 点击后下拉
  20233. $(this.el.dom).on('click', toggle.bind(this));
  20234. },
  20235. focusenter: function (sender, event, opt) {
  20236. var _a;
  20237. if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
  20238. // 表格内编辑框,获取焦点后自动弹开
  20239. toggle.call(this, event);
  20240. }
  20241. },
  20242. destory: function () {
  20243. $(this.el.dom).off('click', toggle.bind(this));
  20244. },
  20245. });
  20246. initComponent.call(this);
  20247. },
  20248. focus2: function () {
  20249. this.focus();
  20250. var that = this;
  20251. _$2.defer(function () {
  20252. if (that.isExpanded) {
  20253. that.collapse();
  20254. }
  20255. else {
  20256. that.expand();
  20257. that.doQuery(that.allQuery, true);
  20258. }
  20259. });
  20260. }
  20261. });
  20262. }
  20263. function initComboGridMulti () {
  20264. Ext.define('Yvan.LocalComboGrid', {
  20265. extend: 'Ext.form.field.Picker',
  20266. // extend: 'Yvan.PickerAlignCenter',
  20267. xtype: 'combogridmulti',
  20268. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  20269. config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
  20270. editable: false,
  20271. initComponent: function () {
  20272. this.on({
  20273. afterrender: function () {
  20274. var config = this.config;
  20275. if (config.dataSource && config.autoLoad) {
  20276. dataSourceReload(this);
  20277. }
  20278. },
  20279. });
  20280. this.superclass.initComponent.apply(this, arguments);
  20281. },
  20282. setStore: function (store) {
  20283. this.store = store;
  20284. var me = this;
  20285. if (me.store) {
  20286. if (me.picker) {
  20287. me.picker.setStore(store);
  20288. if (me.isExpanded) {
  20289. me.collapse();
  20290. delete me.picker;
  20291. me.expand();
  20292. }
  20293. }
  20294. this.onLoad();
  20295. me.mon(me.store, {
  20296. scope: me,
  20297. load: me.onLoad,
  20298. update: me.onUpdate
  20299. });
  20300. }
  20301. },
  20302. reload: function () {
  20303. dataSourceReload(this);
  20304. },
  20305. setData: function (value) {
  20306. var me = this;
  20307. var config = me.config;
  20308. if (!value) {
  20309. return;
  20310. }
  20311. if (!this.store) {
  20312. this.store = new Ext.data.Store({
  20313. fields: [config.valueField, config.displayField],
  20314. data: value
  20315. });
  20316. }
  20317. else {
  20318. this.store.getProxy().setData(value);
  20319. this.store.load();
  20320. }
  20321. this.onLoad();
  20322. },
  20323. createPicker: function () {
  20324. var me = this;
  20325. 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: {
  20326. scope: me,
  20327. selectionchange: me.onSelectionChange,
  20328. itemkeydown: me.onPickerKeyDown
  20329. } })), view = picker.getView();
  20330. if (Ext.isIE9 && Ext.isStrict) {
  20331. view.on({
  20332. scope: me,
  20333. highlightitem: me.repaintPickerView,
  20334. unhighlightitem: me.repaintPickerView,
  20335. afteritemexpand: me.repaintPickerView,
  20336. afteritemcollapse: me.repaintPickerView
  20337. });
  20338. }
  20339. return picker;
  20340. },
  20341. repaintPickerView: function () {
  20342. var style = this.picker.getView().getEl().dom.style;
  20343. style.display = style.display;
  20344. },
  20345. onSelectionChange: function (view, record, node, rowIndex, e) {
  20346. this.selectItem(view, record);
  20347. },
  20348. onPickerKeyDown: function (treeView, record, item, index, e) {
  20349. var key = e.getKey();
  20350. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  20351. this.selectItem(treeView, record);
  20352. }
  20353. },
  20354. selectItem: function (sender, record) {
  20355. var me = this;
  20356. var ids = [];
  20357. _$2.forEach(me.picker.getSelection(), function (record) {
  20358. ids.push(record.get(me.valueField));
  20359. });
  20360. me.fireEvent('select', me, record);
  20361. me.setValue(ids.join(me.splitChar));
  20362. // me.collapse();
  20363. },
  20364. onExpand: function () {
  20365. var me = this;
  20366. var picker = this.picker;
  20367. var value = this.value;
  20368. if (!me.store) {
  20369. msg('正在初始化数据,请稍后');
  20370. me.collapse();
  20371. return;
  20372. }
  20373. var vs = _$2.split(value, me.splitChar);
  20374. var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
  20375. picker.setSelection(records);
  20376. },
  20377. setValue: function (value) {
  20378. var me = this;
  20379. console.log('setValue', value);
  20380. me.value = value;
  20381. if (!me.store || me.store.loading) {
  20382. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  20383. return me.mixins.field.setValue.call(me, value);
  20384. // return me;
  20385. }
  20386. var vs = _$2.split(value, me.splitChar);
  20387. var displayValues = [];
  20388. _$2.forEach(vs, function (v) {
  20389. var _a;
  20390. var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
  20391. var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
  20392. if (dv) {
  20393. displayValues.push(dv);
  20394. }
  20395. else {
  20396. displayValues.push(v);
  20397. }
  20398. });
  20399. // set the raw value to the record's display field if a record was found
  20400. me.setRawValue(displayValues.join(me.splitChar));
  20401. return me.mixins.field.setValue.call(me, value);
  20402. },
  20403. getSubmitValue: function () {
  20404. return this.value;
  20405. },
  20406. getValue: function () {
  20407. return this.value;
  20408. },
  20409. onLoad: function () {
  20410. var value = this.value;
  20411. if (value) {
  20412. this.setValue(value);
  20413. }
  20414. },
  20415. onUpdate: function (store, rec, type, modifiedFieldNames) {
  20416. var display = this.displayField;
  20417. var me = this;
  20418. if (type === 'edit' && modifiedFieldNames &&
  20419. Ext.Array.contains(modifiedFieldNames, display) &&
  20420. this.value === rec.getId()) {
  20421. me.mixins.field.setValue.call(me, this.value);
  20422. this.setRawValue(rec.get(display));
  20423. }
  20424. }
  20425. });
  20426. }
  20427. function initSearch () {
  20428. Ext.define('Yvan.Search', {
  20429. extend: 'Ext.form.field.Text',
  20430. alias: 'widget.searchfield',
  20431. xtype: 'searchfield',
  20432. constructor: function (config) {
  20433. var self = this;
  20434. var newConfig = _$2.defaultsDeep({
  20435. // 强制性属性
  20436. triggers: {
  20437. clear: {
  20438. weight: 0,
  20439. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20440. hidden: true,
  20441. handler: 'onClearClick',
  20442. },
  20443. search: {
  20444. weight: 1,
  20445. cls: Ext.baseCSSPrefix + 'form-search-trigger',
  20446. handler: 'onSearchClick'
  20447. },
  20448. },
  20449. listeners: {
  20450. blur: function (sender, e) {
  20451. this.revertOnblur();
  20452. },
  20453. specialkey: function (sender, e) {
  20454. var _a;
  20455. var me = this;
  20456. if (e.getKey() === e.ENTER) {
  20457. me.onSearchClick(sender, {}, e);
  20458. return;
  20459. }
  20460. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20461. },
  20462. afterrender: function (sender, e) {
  20463. var _a;
  20464. this.replaceRawInputEvent();
  20465. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20466. }
  20467. },
  20468. }, baseConfig(config, 'col-item'), config, search);
  20469. this.superclass.constructor.call(self, newConfig);
  20470. },
  20471. revertOnblur: function () {
  20472. this.setRawValue(this.lastValue);
  20473. },
  20474. onSearchClick: function (sender, vv, e) {
  20475. var me = this;
  20476. var config = me.config;
  20477. var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
  20478. if (e) {
  20479. e.preventDefault();
  20480. e.stopPropagation();
  20481. }
  20482. this.fireEvent('search', sender, e);
  20483. if (!widget) {
  20484. return;
  20485. }
  20486. showWidget(widget, lookup, sender, me.getRawValue(), vjson);
  20487. },
  20488. replaceRawInputEvent: function () {
  20489. var me = this;
  20490. var $dom = $(me.inputEl.dom);
  20491. $dom.on('input', function (e) {
  20492. stopEvent(e);
  20493. // console.log('has input', e)
  20494. });
  20495. $dom.on('keyup', function (e) {
  20496. if (e.key === "Enter") {
  20497. me.onSearchClick(me, {}, e);
  20498. return;
  20499. }
  20500. stopEvent(e);
  20501. });
  20502. $dom.on('change', function (e) {
  20503. stopEvent(e);
  20504. });
  20505. },
  20506. onChange: function (newVal, oldVal) {
  20507. var me = this;
  20508. var value = newVal;
  20509. if (value) {
  20510. me.getTrigger('clear').show();
  20511. me.updateLayout();
  20512. }
  20513. else {
  20514. me.getTrigger('clear').hide();
  20515. me.updateLayout();
  20516. }
  20517. },
  20518. /**
  20519. * 清空所有值
  20520. */
  20521. onClearClick: function (sender, e) {
  20522. var me = this;
  20523. var config = me.config;
  20524. var lookup = config.lookup;
  20525. me.setValue('');
  20526. clearViewModelByLookup(sender, lookup);
  20527. }
  20528. });
  20529. }
  20530. function initMultipleSearch () {
  20531. Ext.define('Yvan.MultipleSearch', {
  20532. extend: 'Ext.form.field.Text',
  20533. xtype: 'multiplesearch',
  20534. bindTargert: '',
  20535. constructor: function (config) {
  20536. var _a, _b, _c, _d;
  20537. var self = this;
  20538. var newConfig = _$2.defaultsDeep({
  20539. // 强制性属性
  20540. triggers: {
  20541. clear: {
  20542. weight: 0,
  20543. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  20544. hidden: true,
  20545. handler: 'onClearClick',
  20546. }
  20547. },
  20548. transformRawValue: function (o) {
  20549. return o;
  20550. },
  20551. listeners: {
  20552. specialkey: function (sender, e) {
  20553. var me = this;
  20554. if (e.getKey() === e.ENTER) {
  20555. me.fireEvent('search', me, e);
  20556. }
  20557. },
  20558. afterrender: function (sender, e) {
  20559. var _a;
  20560. this.replaceRawInputEvent();
  20561. invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
  20562. }
  20563. },
  20564. }, baseConfig(config, 'col-item'), config, search);
  20565. this.superclass.constructor.call(self, newConfig);
  20566. 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 : '';
  20567. vv = _$2.replace(vv, "{", "");
  20568. vv = _$2.replace(vv, "}", "");
  20569. this.bindTargert = vv;
  20570. this.bindTargert = _$2.trim(this.bindTargert);
  20571. },
  20572. setBindValue: function (arrValue) {
  20573. if (this.bindTargert) {
  20574. this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
  20575. }
  20576. },
  20577. replaceRawInputEvent: function () {
  20578. var me = this;
  20579. var $dom = $(me.inputEl.dom);
  20580. $dom.on('input', function (e) {
  20581. var _a, _b, _c, _d, _e, _f;
  20582. if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
  20583. var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
  20584. if (!a.endsWith(",") && a.length > 0) {
  20585. e.currentTarget.value = a + ",";
  20586. }
  20587. else {
  20588. e.currentTarget.value = a;
  20589. }
  20590. }
  20591. e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
  20592. var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
  20593. _$2.remove(arr, function (it) {
  20594. return !it;
  20595. });
  20596. me.setBindValue(arr);
  20597. stopEvent(e);
  20598. });
  20599. $dom.on('keyup', function (e) {
  20600. me.fireEvent('keyup', me, e);
  20601. // invokeMethod(me.config.listeners?.keyup, me, e)
  20602. stopEvent(e);
  20603. });
  20604. $dom.on('keydown', function (e) {
  20605. me.fireEvent('keydown', me, e);
  20606. // invokeMethod(me.config.listeners?.keydown, me, e)
  20607. //stopEvent(e)
  20608. });
  20609. $dom.on('change', function (e) {
  20610. stopEvent(e);
  20611. });
  20612. $dom.on('paste', function (e) {
  20613. var _a;
  20614. // @ts-ignore
  20615. var clipdata = e.originalEvent.clipboardData || window.clipboardData;
  20616. var text = clipdata.getData("text/plain");
  20617. var spliter = ',';
  20618. text = text.replaceAll("\r", "");
  20619. text = text.replaceAll("\n", spliter);
  20620. text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
  20621. var arr = text.split(spliter);
  20622. if (arr && Array.isArray(arr)) {
  20623. for (var i = 0; i < arr.length; i++) {
  20624. arr[i] = _$2.trim(arr[i]);
  20625. }
  20626. }
  20627. _$2.remove(arr, function (it) {
  20628. return !it;
  20629. });
  20630. me.setBindValue(arr);
  20631. stopEvent(e);
  20632. });
  20633. },
  20634. onChange: function (newVal, oldVal) {
  20635. var me = this;
  20636. var value = newVal;
  20637. if (value) {
  20638. me.getTrigger('clear').show();
  20639. me.updateLayout();
  20640. }
  20641. else {
  20642. me.getTrigger('clear').hide();
  20643. me.updateLayout();
  20644. }
  20645. },
  20646. /**
  20647. * 清空所有值
  20648. */
  20649. onClearClick: function (sender, e) {
  20650. var me = this;
  20651. var config = me.config;
  20652. var lookup = config.lookup;
  20653. me.setValue('');
  20654. clearViewModelByLookup(sender, lookup);
  20655. }
  20656. });
  20657. }
  20658. function initDate () {
  20659. var cc = Ext.form.field.Date.prototype.constructor;
  20660. var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
  20661. Ext.form.field.Date.override({
  20662. format: 'Y-m-d',
  20663. altFormats: 'Y-m-d',
  20664. constructor: function (config) {
  20665. var newConfig = _$2.defaultsDeep({
  20666. // 强制属性
  20667. }, baseConfig(config, 'col-item'), config, date);
  20668. cc.call(this, newConfig);
  20669. },
  20670. getValue: function () {
  20671. var ov = getValue.call(this);
  20672. var nv = Ext.util.Format.date(ov, 'Y-m-d');
  20673. // console.log('cc:', nv, ov)
  20674. return nv;
  20675. },
  20676. // focus2() {
  20677. // const that = this
  20678. // if (that.isExpanded) {
  20679. // that.collapse()
  20680. //
  20681. // } else {
  20682. // that.expand();
  20683. // }
  20684. // _.defer(() => {
  20685. // that.focus()
  20686. // })
  20687. // },
  20688. initComponent: function () {
  20689. this.on({
  20690. afterrender: function () {
  20691. var config = this.config;
  20692. // 日期框,不要默认弹出
  20693. // $(this.el.dom).on('click', toggle.bind(this))
  20694. },
  20695. destory: function () {
  20696. // 日期框,不要默认弹出
  20697. // $(this.el.dom).off('click', toggle.bind(this))
  20698. },
  20699. change: {
  20700. fn: function (sender) {
  20701. if (sender.format === 'Y-m-d') {
  20702. // 年月日格式
  20703. var value = sender.getRawValue();
  20704. if (/^\d{8}$/.test(value)) {
  20705. // 8位数字,自动转换为 YYYY-MM-DD
  20706. var newValue = [
  20707. value.substr(0, 4),
  20708. value.substr(4, 2),
  20709. value.substr(6, 2)
  20710. ].join('-');
  20711. sender.setValue(newValue);
  20712. }
  20713. }
  20714. },
  20715. }
  20716. // focus: {
  20717. // // 获得焦点后自动下拉
  20718. // fn(sender) {
  20719. // sender.expand();
  20720. // this.doQuery(this.allQuery, true);
  20721. // },
  20722. // },
  20723. });
  20724. initComponent.call(this);
  20725. },
  20726. createInitialDate: function (value) {
  20727. var minValue = this.minValue, maxValue = this.maxValue;
  20728. value = value || syncDate(new Date());
  20729. if (minValue && minValue > value) {
  20730. value = minValue;
  20731. }
  20732. else if (maxValue && maxValue < value) {
  20733. value = maxValue;
  20734. }
  20735. return value;
  20736. },
  20737. });
  20738. }
  20739. function initDateTimePicker () {
  20740. Ext.define('Yvan.DateTimePicker', {
  20741. extend: 'Ext.picker.Date',
  20742. alias: 'datetimepicker',
  20743. alternateClassName: 'Ext.DateTimePicker',
  20744. renderTpl: [
  20745. '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
  20746. '<div class="{baseCls}-header">',
  20747. '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
  20748. '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
  20749. '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
  20750. '</div>',
  20751. '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
  20752. '<thead>',
  20753. '<tr role="row">',
  20754. '<tpl for="dayNames">',
  20755. '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
  20756. '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
  20757. '</th>',
  20758. '</tpl>',
  20759. '</tr>',
  20760. '</thead>',
  20761. '<tbody>',
  20762. '<tr role="row">',
  20763. '<tpl for="days">',
  20764. '{#:this.isEndOfWeek}',
  20765. '<td role="gridcell">',
  20766. '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
  20767. '</td>',
  20768. '</tpl>',
  20769. '</tr>',
  20770. '</tbody>',
  20771. '</table>',
  20772. '<tpl if="showToday">',
  20773. '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
  20774. '</tpl>',
  20775. // These elements are used with Assistive Technologies such as screen readers
  20776. '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
  20777. '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
  20778. '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
  20779. '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
  20780. '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
  20781. '</div>',
  20782. {
  20783. firstInitial: function (value) {
  20784. return Ext.picker.Date.prototype.getDayInitial(value);
  20785. },
  20786. isEndOfWeek: function (value) {
  20787. // convert from 1 based index to 0 based
  20788. // by decrementing value once.
  20789. value--;
  20790. // eslint-disable-next-line vars-on-top
  20791. var end = value % 7 === 0 && value !== 0;
  20792. return end ? '</tr><tr role="row">' : '';
  20793. },
  20794. renderTodayBtn: function (values, out) {
  20795. Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
  20796. },
  20797. renderMonthBtn: function (values, out) {
  20798. Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
  20799. }
  20800. }
  20801. ],
  20802. beforeRender: function () {
  20803. var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
  20804. this.superclass.beforeRender.call(this);
  20805. function handleInput(extHandle, $input) {
  20806. var $dom = $(extHandle.el.dom);
  20807. // const $up = $dom.find('.x-form-spinner-up')
  20808. // const $down = $dom.find('.x-form-spinner-down')
  20809. // debugger
  20810. // $up.on('mousedown', () => {
  20811. // debugger
  20812. // });
  20813. // $up.on('click', () => {
  20814. // debugger
  20815. // });
  20816. extHandle.on('click', function (sender) {
  20817. var hideBak = me.hide;
  20818. me.hide = Ext.emptyFn;
  20819. extHandle.focus();
  20820. me.hide = hideBak;
  20821. });
  20822. var changeValue = function (delta) {
  20823. if (_$2.trim(extHandle.getValue()) === '') {
  20824. extHandle.setValue(extHandle.minValue);
  20825. }
  20826. else {
  20827. var v = parseInt('' + extHandle.getValue());
  20828. if (v + delta > extHandle.maxValue) {
  20829. extHandle.setValue(extHandle.minValue);
  20830. }
  20831. else if (v + delta < extHandle.minValue) {
  20832. extHandle.setValue(extHandle.maxValue);
  20833. }
  20834. else {
  20835. extHandle.setValue(v + delta);
  20836. }
  20837. }
  20838. };
  20839. $input.on('mousewheel', function (e) {
  20840. e.stopPropagation();
  20841. var event = e.originalEvent;
  20842. var eventDelta = event.wheelDelta || -event.deltaY + 40;
  20843. // if (event.wheelDelta) {
  20844. // delta = event.wheelDelta / 120;
  20845. // } else if (event.detail) {
  20846. // delta = -event.detail / 3;
  20847. // }
  20848. var zoomSize = Math.ceil(eventDelta / 120);
  20849. changeValue(zoomSize);
  20850. // console.log('delta', delta)
  20851. // $input.focus()
  20852. });
  20853. }
  20854. me.input1 = Ext.create('Ext.form.field.Number', {
  20855. minValue: 0,
  20856. maxValue: 23,
  20857. flex: 1,
  20858. enableKeyEvents: true,
  20859. fieldLabel: '时',
  20860. labelWidth: 20,
  20861. hideLabel: true,
  20862. spinDownEnabled: false,
  20863. spinUpEnabled: false,
  20864. style: {
  20865. marginLeft: '5px',
  20866. },
  20867. listeners: {
  20868. afterrender: function (sender) {
  20869. var $input = $(sender.inputEl.dom);
  20870. handleInput(me.input1, $input);
  20871. },
  20872. change: function (sender, e) {
  20873. if (me.getValue()) {
  20874. me.value.setHours(sender.getValue());
  20875. }
  20876. },
  20877. }
  20878. });
  20879. me.input2 = Ext.create('Ext.form.field.Number', {
  20880. minValue: 0,
  20881. maxValue: 59,
  20882. flex: 1,
  20883. enableKeyEvents: true,
  20884. fieldLabel: ' ',
  20885. hideLabel: false,
  20886. labelWidth: 8,
  20887. spinDownEnabled: false,
  20888. spinUpEnabled: false,
  20889. listeners: {
  20890. afterrender: function (sender) {
  20891. var $input = $(sender.inputEl.dom);
  20892. handleInput(me.input2, $input);
  20893. },
  20894. change: function (sender, e) {
  20895. if (me.getValue()) {
  20896. me.value.setMinutes(sender.getValue());
  20897. }
  20898. },
  20899. }
  20900. });
  20901. me.input3 = Ext.create('Ext.form.field.Number', {
  20902. minValue: 0,
  20903. maxValue: 59,
  20904. flex: 1,
  20905. enableKeyEvents: true,
  20906. fieldLabel: ' ',
  20907. hideLabel: false,
  20908. labelWidth: 8,
  20909. spinDownEnabled: false,
  20910. spinUpEnabled: false,
  20911. style: {
  20912. marginRight: '5px',
  20913. },
  20914. listeners: {
  20915. afterrender: function (sender) {
  20916. var $input = $(sender.inputEl.dom);
  20917. handleInput(me.input3, $input);
  20918. },
  20919. change: function (sender, e) {
  20920. if (me.getValue()) {
  20921. me.value.setSeconds(sender.getValue());
  20922. }
  20923. },
  20924. }
  20925. });
  20926. me.confirmBtn = new Ext.button.Button({
  20927. text: '确认',
  20928. handler: me.confirmClick,
  20929. scope: me
  20930. });
  20931. me.tdBtn = new Ext.button.Button({
  20932. text: '现在',
  20933. handler: me.selectToday,
  20934. scope: me
  20935. });
  20936. me.todayBtn = Ext.create('Ext.container.Container', {
  20937. layout: 'anchor', border: false,
  20938. defaults: {
  20939. border: false, anchor: '100%',
  20940. margin: '0 0 5 0',
  20941. },
  20942. items: [
  20943. {
  20944. layout: 'hbox',
  20945. items: [
  20946. me.input1,
  20947. me.input2,
  20948. me.input3,
  20949. ]
  20950. },
  20951. {
  20952. layout: 'hbox',
  20953. items: [
  20954. me.confirmBtn,
  20955. me.tdBtn,
  20956. ]
  20957. }
  20958. ]
  20959. });
  20960. },
  20961. // finishRenderChildren() {
  20962. // var me = this;
  20963. //
  20964. // this.superclass.finishRenderChildren.call(this);
  20965. // //*
  20966. // me.input1.finishRender();
  20967. // me.input2.finishRender();
  20968. // me.input3.finishRender();
  20969. // //
  20970. // me.tdBtn.finishRender();
  20971. // me.confirmBtn.finishRender();
  20972. // },
  20973. setValue: function (value) {
  20974. //this.value = Ext.Date.clearTime(value, true);
  20975. this.value = value;
  20976. this.input1.setValue(this.value.getHours());
  20977. this.input2.setValue(this.value.getMinutes());
  20978. this.input3.setValue(this.value.getSeconds());
  20979. return this.update(this.value);
  20980. },
  20981. selectDate: function (value) {
  20982. if (this.showTime) {
  20983. value.setHours(this.input1.getValue());
  20984. value.setMinutes(this.input2.getValue());
  20985. value.setSeconds(this.input3.getValue());
  20986. }
  20987. this.value = value;
  20988. return this.update(this.value);
  20989. },
  20990. setDisabledStatus: function (disabled) {
  20991. var me = this;
  20992. debugger;
  20993. // me.callParent();
  20994. if (me.showTime) {
  20995. me.confirmBtn.setDisabled(disabled);
  20996. }
  20997. if (me.isShowFooter()) {
  20998. me.footerContainer.setDisabled(disabled);
  20999. }
  21000. },
  21001. handleDateClick: function (e, t) {
  21002. var me = this, handler = me.handler;
  21003. // e.stopEvent();
  21004. if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
  21005. me.doCancelFocus = me.focusOnSelect === false;
  21006. me.selectDate(new Date(t.dateValue));
  21007. delete me.doCancelFocus;
  21008. /* 有时间输入时单击事件不退出选择,只移动光标 */
  21009. if (me.showTime) {
  21010. return;
  21011. }
  21012. me.fireEvent('select', me, me.value);
  21013. if (handler) {
  21014. handler.call(me.scope || me, me, me.value);
  21015. }
  21016. me.onSelect();
  21017. }
  21018. },
  21019. selectToday: function () {
  21020. var me = this, btn = me.todayBtn, handler = me.handler;
  21021. if (btn && !btn.disabled) {
  21022. me.value = syncDate(new Date());
  21023. me.update(me.value);
  21024. me.fireEvent('select', me, me.value);
  21025. if (handler) {
  21026. handler.call(me.scope || me, me, me.value);
  21027. }
  21028. me.onSelect();
  21029. me.hide();
  21030. }
  21031. return me;
  21032. },
  21033. confirmClick: function () {
  21034. var me = this, btn = me.confirmBtn, handler = me.handler;
  21035. if (btn && !btn.disabled) {
  21036. me.fireEvent('select', me, me.value);
  21037. if (handler) {
  21038. handler.call(me.scope || me, me, me.value);
  21039. }
  21040. me.onSelect();
  21041. me.hide();
  21042. }
  21043. return me;
  21044. },
  21045. selectedUpdate: function (date) {
  21046. var me = this,
  21047. //t = date.getTime(),
  21048. t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
  21049. cells.removeCls(cls);
  21050. for (c = 0; c < cLen; c++) {
  21051. cell = Ext.fly(cellItems[c]);
  21052. if (cell.dom.firstChild.dateValue == t) {
  21053. me.fireEvent('highlightitem', me, cell);
  21054. cell.addCls(cls);
  21055. if (me.isVisible() && !me.doCancelFocus) {
  21056. Ext.fly(cell.dom.firstChild).focus(50);
  21057. }
  21058. break;
  21059. }
  21060. }
  21061. },
  21062. // private, inherit docs
  21063. beforeDestroy: function () {
  21064. var me = this;
  21065. if (me.rendered) {
  21066. Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
  21067. }
  21068. me.superclass.beforeDestroy.call(this);
  21069. }
  21070. });
  21071. }
  21072. function initDateTime () {
  21073. Ext.define('Yvan.DateTimeField', {
  21074. extend: 'Ext.form.field.Date',
  21075. xtype: 'datetimefield',
  21076. alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
  21077. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  21078. showTime: true,
  21079. format: "Y-m-d H:i:s",
  21080. constructor: function (config) {
  21081. var newConfig = _$2.defaultsDeep({
  21082. // 强制属性
  21083. }, baseConfig(config, 'col-item'), config, date);
  21084. this.superclass.constructor.call(this, newConfig);
  21085. },
  21086. initComponent: function () {
  21087. this.superclass.initComponent.call(this);
  21088. var setInitValue = function () {
  21089. var value = this.getRawValue();
  21090. if (!value) {
  21091. // 没填内容的时候,自动设置当前时间
  21092. this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
  21093. }
  21094. };
  21095. this.on({
  21096. afterrender: function () {
  21097. var config = this.config;
  21098. // 日期框,不要默认弹出
  21099. $(this.el.dom).on('click', setInitValue.bind(this));
  21100. },
  21101. destory: function () {
  21102. // 日期框,不要默认弹出
  21103. $(this.el.dom).off('click', setInitValue.bind(this));
  21104. },
  21105. change: {
  21106. fn: function (sender) {
  21107. if (sender.format === "Y-m-d H:i:s") {
  21108. // 年月日格式
  21109. var value = sender.getRawValue();
  21110. if (/^\d{14}$/.test(value)) {
  21111. // 8位数字,自动转换为 YYYY-MM-DD
  21112. var newValue = [
  21113. value.substr(0, 4),
  21114. '-',
  21115. value.substr(4, 2),
  21116. '-',
  21117. value.substr(6, 2),
  21118. ' ',
  21119. value.substr(8, 2),
  21120. ':',
  21121. value.substr(10, 2),
  21122. ':',
  21123. value.substr(12, 2)
  21124. ].join('');
  21125. sender.setValue(newValue);
  21126. }
  21127. }
  21128. },
  21129. }
  21130. });
  21131. },
  21132. getValue: function () {
  21133. var ov = this.getRawValue(); //this.superclass.getValue.call(this)
  21134. var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
  21135. // console.log('cc:', nv, ov)
  21136. return nv;
  21137. },
  21138. onExpand: function () {
  21139. var strValue = this.getValue();
  21140. var value;
  21141. if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
  21142. 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)));
  21143. }
  21144. else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
  21145. value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
  21146. }
  21147. else {
  21148. value = syncDate(new Date());
  21149. }
  21150. this.picker.setValue(value);
  21151. },
  21152. createPicker: function () {
  21153. var me = this, format = Ext.String.format;
  21154. //@ts-ignore
  21155. return new Yvan.DateTimePicker({
  21156. pickerField: me,
  21157. ownerCt: me.ownerCt,
  21158. renderTo: document.body,
  21159. floating: true,
  21160. hidden: true,
  21161. focusOnShow: true,
  21162. minDate: me.minValue,
  21163. maxDate: me.maxValue,
  21164. disabledDatesRE: me.disabledDatesRE,
  21165. disabledDatesText: me.disabledDatesText,
  21166. disabledDays: me.disabledDays,
  21167. disabledDaysText: me.disabledDaysText,
  21168. format: me.format,
  21169. showToday: me.showToday,
  21170. showTime: me.showTime,
  21171. startDay: me.startDay,
  21172. minText: format(me.minText, me.formatDate(me.minValue)),
  21173. maxText: format(me.maxText, me.formatDate(me.maxValue)),
  21174. listeners: {
  21175. scope: me,
  21176. select: me.onSelect
  21177. },
  21178. keyNavConfig: {
  21179. esc: function () {
  21180. me.collapse();
  21181. }
  21182. }
  21183. });
  21184. },
  21185. });
  21186. }
  21187. function initNumber () {
  21188. var cc = Ext.form.field.Number.prototype.constructor;
  21189. var initComponent = Ext.form.field.Number.prototype.initComponent;
  21190. Ext.form.field.Number.override({
  21191. constructor: function (config) {
  21192. var newConfig = _$2.defaultsDeep({
  21193. // 强制属性
  21194. }, baseConfig(config, 'col-item'), config, numberfield);
  21195. cc.call(this, newConfig);
  21196. },
  21197. initComponent: function () {
  21198. this.on({
  21199. afterrender: function (sender) {
  21200. var _this = this;
  21201. var _a;
  21202. if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
  21203. sender.inputEl.dom.setAttribute('spellcheck', "false");
  21204. $$2(sender.inputEl.dom).on('click', function (e) {
  21205. sender.fireEvent('click', _this, e);
  21206. });
  21207. }
  21208. }
  21209. });
  21210. initComponent.call(this);
  21211. },
  21212. });
  21213. }
  21214. function initCheckbox () {
  21215. var cc = Ext.form.field.Checkbox.prototype.constructor;
  21216. var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
  21217. Ext.form.field.Checkbox.override({
  21218. constructor: function (config) {
  21219. var newConfig = _$2.defaultsDeep({
  21220. // 强制属性
  21221. }, baseConfig(config, 'col-item'), config, checkbox);
  21222. cc.call(this, newConfig);
  21223. },
  21224. getValue: function () {
  21225. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21226. var ov = getValue.call(this);
  21227. // const ov = this.getRawValue()
  21228. return (ov ? checkedValue : uncheckedValue);
  21229. },
  21230. setValue: function (nv) {
  21231. var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
  21232. var value;
  21233. if (nv === checkedValue) {
  21234. value = true;
  21235. }
  21236. else if (nv === uncheckedValue) {
  21237. value = false;
  21238. }
  21239. else {
  21240. value = !!nv;
  21241. }
  21242. // me.setRawValue(value)
  21243. // me.checked = value
  21244. // return me.mixins.field.setValue.call(me, value);
  21245. setValue.call(this, value);
  21246. },
  21247. updateCheckedCls: function (checked) {
  21248. var me = this;
  21249. var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
  21250. checked = checked != null ? checked : me.getValue();
  21251. if (checked === uncheckedValue) {
  21252. checked = false;
  21253. }
  21254. else if (checked === checkedValue) {
  21255. checked = true;
  21256. }
  21257. me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
  21258. },
  21259. initComponent: function () {
  21260. initComponent.call(this);
  21261. },
  21262. });
  21263. }
  21264. function initCheckboxGroup () {
  21265. var cc = Ext.form.CheckboxGroup.prototype.constructor;
  21266. var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
  21267. Ext.form.CheckboxGroup.override({
  21268. constructor: function (config) {
  21269. var newConfig = _$2.defaultsDeep({
  21270. // 强制属性
  21271. }, baseConfig(config, 'col-item'), config, checkboxgroup);
  21272. cc.call(this, newConfig);
  21273. },
  21274. initComponent: function () {
  21275. initComponent.call(this);
  21276. },
  21277. });
  21278. }
  21279. function initRadio () {
  21280. var cc = Ext.form.field.Radio.prototype.constructor;
  21281. var initComponent = Ext.form.field.Radio.prototype.initComponent;
  21282. Ext.form.field.Radio.override({
  21283. constructor: function (config) {
  21284. var newConfig = _$2.defaultsDeep({
  21285. // 强制属性
  21286. }, baseConfig(config, 'col-item'), config, radio);
  21287. cc.call(this, newConfig);
  21288. },
  21289. initComponent: function () {
  21290. initComponent.call(this);
  21291. },
  21292. });
  21293. }
  21294. function initRadioGroup () {
  21295. var cc = Ext.form.RadioGroup.prototype.constructor;
  21296. var initComponent = Ext.form.RadioGroup.prototype.initComponent;
  21297. Ext.form.RadioGroup.override({
  21298. constructor: function (config) {
  21299. var newConfig = _$2.defaultsDeep({
  21300. // 强制属性
  21301. }, baseConfig(config, 'col-item'), config, radiogroup);
  21302. cc.call(this, newConfig);
  21303. },
  21304. initComponent: function () {
  21305. initComponent.call(this);
  21306. },
  21307. });
  21308. }
  21309. function initFieldset () {
  21310. /**
  21311. *
  21312. */
  21313. var ct = Ext.form.FieldSet.prototype.constructor;
  21314. Ext.form.FieldSet.override({
  21315. constructor: function (config) {
  21316. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
  21317. ct.call(this, newConfig);
  21318. }
  21319. });
  21320. }
  21321. function initCombotree () {
  21322. Ext.define('Yvan.ComboTree', {
  21323. extend: 'Ext.form.field.Picker',
  21324. xtype: 'combotree',
  21325. triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
  21326. config: {
  21327. store: null,
  21328. displayField: null,
  21329. columns: null,
  21330. selectOnTab: true,
  21331. maxPickerHeight: 300,
  21332. minPickerHeight: 100,
  21333. minPickerWidth: 350,
  21334. rootVisible: true,
  21335. },
  21336. editable: false,
  21337. setStore: function (store) {
  21338. this.store = store;
  21339. var me = this;
  21340. if (me.store) {
  21341. if (me.picker) {
  21342. me.picker.setStore(store);
  21343. if (me.isExpanded) {
  21344. me.collapse();
  21345. delete me.picker;
  21346. me.expand();
  21347. }
  21348. }
  21349. this.onLoad();
  21350. me.mon(me.store, {
  21351. scope: me,
  21352. load: me.onLoad,
  21353. update: me.onUpdate
  21354. });
  21355. }
  21356. },
  21357. createPicker: function () {
  21358. var me = this;
  21359. var picker = new Ext.tree.Panel({
  21360. border: false,
  21361. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21362. shrinkWrapDock: 2,
  21363. store: me.store,
  21364. floating: true,
  21365. rootVisible: me.rootVisible,
  21366. displayField: me.displayField,
  21367. columns: me.columns,
  21368. minHeight: me.minPickerHeight,
  21369. maxHeight: me.maxPickerHeight,
  21370. minWidth: me.minPickerWidth,
  21371. manageHeight: false,
  21372. shadow: false,
  21373. scrollable: true,
  21374. // modal: true,
  21375. // constrain: true,
  21376. // constrainTo: topScope._handle.el.dom,
  21377. // renderTo: topScope._handle.el.dom,
  21378. // alignTarget: topScope._handle,
  21379. listeners: {
  21380. scope: me,
  21381. itemclick: me.onItemClick,
  21382. itemkeydown: me.onPickerKeyDown
  21383. }
  21384. }), view = picker.getView();
  21385. if (Ext.isIE9 && Ext.isStrict) {
  21386. view.on({
  21387. scope: me,
  21388. highlightitem: me.repaintPickerView,
  21389. unhighlightitem: me.repaintPickerView,
  21390. afteritemexpand: me.repaintPickerView,
  21391. afteritemcollapse: me.repaintPickerView
  21392. });
  21393. }
  21394. return picker;
  21395. },
  21396. repaintPickerView: function () {
  21397. var style = this.picker.getView().getEl().dom.style;
  21398. style.display = style.display;
  21399. },
  21400. onItemClick: function (view, record, node, rowIndex, e) {
  21401. this.selectItem(view, record);
  21402. },
  21403. onPickerKeyDown: function (treeView, record, item, index, e) {
  21404. var key = e.getKey();
  21405. if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
  21406. this.selectItem(treeView, record);
  21407. }
  21408. },
  21409. selectItem: function (sender, record) {
  21410. var me = this;
  21411. me.setValue(record.getId());
  21412. me.fireEvent('select', me, record);
  21413. me.collapse();
  21414. },
  21415. onExpand: function () {
  21416. var picker = this.picker;
  21417. var store = picker.store;
  21418. var value = this.value;
  21419. var node;
  21420. if (value) {
  21421. node = store.getNodeById(value);
  21422. }
  21423. if (!node) {
  21424. node = store.getRoot();
  21425. }
  21426. picker.ensureVisible(node, {
  21427. select: true,
  21428. focus: true
  21429. });
  21430. },
  21431. setValue: function (value) {
  21432. var me = this;
  21433. console.log('setValue', value);
  21434. me.value = value;
  21435. if (!me.store || me.store.loading) {
  21436. // Called while the Store is loading. Ensure it is processed by the onLoad method.
  21437. return me.mixins.field.setValue.call(me, value);
  21438. // return me;
  21439. }
  21440. var record = value ? me.store.getNodeById(value) : me.store.getRoot();
  21441. if (value === undefined) {
  21442. record = me.store.getRoot();
  21443. console.log('setValue', record.getId());
  21444. me.value = record.getId();
  21445. return me.mixins.field.setValue.call(me, value);
  21446. }
  21447. else {
  21448. record = me.store.getNodeById(value);
  21449. }
  21450. // set the raw value to the record's display field if a record was found
  21451. me.setRawValue(record ? record.get(me.displayField) : '');
  21452. return me.mixins.field.setValue.call(me, value);
  21453. },
  21454. getSubmitValue: function () {
  21455. return this.value;
  21456. },
  21457. getValue: function () {
  21458. return this.value;
  21459. },
  21460. onLoad: function () {
  21461. var value = this.value;
  21462. if (value) {
  21463. this.setValue(value);
  21464. }
  21465. },
  21466. onUpdate: function (store, rec, type, modifiedFieldNames) {
  21467. var display = this.displayField;
  21468. var me = this;
  21469. if (type === 'edit' && modifiedFieldNames &&
  21470. Ext.Array.contains(modifiedFieldNames, display) &&
  21471. this.value === rec.getId()) {
  21472. me.mixins.field.setValue.call(me, this.value);
  21473. this.setRawValue(rec.get(display));
  21474. }
  21475. }
  21476. });
  21477. }
  21478. function initPickerPlus () {
  21479. Ext.define('Yvan.PickerAlignCenter', {
  21480. extend: 'Ext.form.field.Picker',
  21481. /**
  21482. * Performs the alignment on the picker using the class defaults
  21483. * @private
  21484. */
  21485. doAlign: function () {
  21486. // 不要挪动就好
  21487. },
  21488. });
  21489. }
  21490. function initCombogrid () {
  21491. Ext.define('Yvan.ComboGrid', {
  21492. extend: 'Ext.form.field.Picker',
  21493. // extend: 'Yvan.PickerAlignCenter',
  21494. xtype: 'combogrid',
  21495. triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
  21496. triggers: {
  21497. clear: {
  21498. weight: 0,
  21499. cls: Ext.baseCSSPrefix + 'form-clear-trigger',
  21500. hidden: true,
  21501. handler: 'onClearClick',
  21502. },
  21503. },
  21504. config: __assign({}, comboGrid),
  21505. editable: true,
  21506. _superBlur: false,
  21507. allowCustomInput: false,
  21508. pressEnterPopup: true,
  21509. initComponent: function () {
  21510. var that = this;
  21511. var scope = lookupScope(that);
  21512. var config = that.config;
  21513. if (isDesignMode(scope, config)) {
  21514. this.superclass.initComponent.call(this, arguments);
  21515. return;
  21516. }
  21517. this.on({
  21518. blur: function (sender, e) {
  21519. if (this._superBlur) {
  21520. // 挂起时不恢复内容
  21521. return;
  21522. }
  21523. // 离开焦点时,恢复原来的值
  21524. sender.setRawValue(sender.value);
  21525. },
  21526. afterrender: function (sender) {
  21527. var $dom = $(sender.inputEl.dom);
  21528. that.scope = lookupScope(sender);
  21529. if (sender.column) {
  21530. // 列模式,拦截 keydown
  21531. $dom.on('keydown', function (e) {
  21532. if (isChartEvent(e) && !that.tryEnable()) {
  21533. // 没有达成 editEnable 条件,不用响应
  21534. stopEvent(e);
  21535. return;
  21536. }
  21537. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21538. stopEvent(e);
  21539. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21540. return;
  21541. }
  21542. });
  21543. }
  21544. else {
  21545. // 常规模式,拦截 keyup
  21546. $dom.on('keyup', function (e) {
  21547. if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
  21548. return;
  21549. }
  21550. if (isChartEvent(e) && !that.tryEnable()) {
  21551. // 没有达成 editEnable 条件,不用响应
  21552. stopEvent(e);
  21553. return;
  21554. }
  21555. if (that.pressEnterPopup !== false && e.key === 'Enter') {
  21556. stopEvent(e);
  21557. that.onTriggerClick(that, that.getPickerTrigger(), e);
  21558. return;
  21559. }
  21560. if (!that.allowCustomInput) {
  21561. // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
  21562. stopEvent(e);
  21563. }
  21564. });
  21565. $dom.on('change', function (e) {
  21566. // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
  21567. // if (that.isExpanded) {
  21568. // that.filterChange(that, e.target.value)
  21569. // }
  21570. stopEvent(e);
  21571. });
  21572. }
  21573. $dom.on('input', function (e) {
  21574. stopEvent(e);
  21575. });
  21576. },
  21577. });
  21578. this.superclass.initComponent.apply(this, arguments);
  21579. },
  21580. createPicker: function () {
  21581. var me = this;
  21582. var cfg = {
  21583. layout: 'fit',
  21584. border: 0,
  21585. // border: 5,
  21586. style: {
  21587. // borderColor: 'black',
  21588. // borderWidth: '5px',
  21589. // borderStyle: 'solid',
  21590. boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
  21591. },
  21592. shadow: 'side',
  21593. shadowOffset: 100,
  21594. baseCls: Ext.baseCSSPrefix + 'boundlist',
  21595. shrinkWrapDock: 2,
  21596. floating: true,
  21597. width: me.pickerWidth,
  21598. height: me.pickerHeight,
  21599. minWidth: me.pickerWidth,
  21600. minHeight: me.pickerHeight,
  21601. maxWidth: me.pickerWidth,
  21602. maxHeight: me.pickerHeight,
  21603. items: [
  21604. __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
  21605. xtype: 'toolbar',
  21606. items: [
  21607. { xtype: 'textfield', fieldLabel: '筛选' },
  21608. {
  21609. xtype: 'button',
  21610. text: '查询',
  21611. iconCls: 'x-fa fa-search',
  21612. cssType: 'primary',
  21613. listeners: {
  21614. click: function () {
  21615. me.reloadGrid();
  21616. }
  21617. }
  21618. },
  21619. ]
  21620. }, autoLoad: false, listeners: {
  21621. afterrender: function (grid) {
  21622. me.grid = grid;
  21623. grid.focus();
  21624. grid.on({
  21625. rowdblclick: function (sender, row) {
  21626. me.selectItem(row);
  21627. },
  21628. dataLoadComplete: function (sender) {
  21629. _$2.defer(function () {
  21630. me.setFocus();
  21631. });
  21632. },
  21633. keydown: function (sender, e) {
  21634. if (me.column) {
  21635. // 列模式,拦截 keydown
  21636. me.processKey(e);
  21637. }
  21638. },
  21639. keyup: function (sender, e) {
  21640. if (!me.column) {
  21641. // 常规模式,拦截 keyup
  21642. me.processKey(e);
  21643. }
  21644. }
  21645. });
  21646. },
  21647. } })
  21648. ]
  21649. };
  21650. // @ts-ignore
  21651. var picker = new Ext.container.Container(cfg);
  21652. return picker;
  21653. },
  21654. setFocus: function () {
  21655. if (this.grid.store.getCount() > 0) {
  21656. this.grid.focusRow(0);
  21657. }
  21658. },
  21659. processKey: function (e) {
  21660. if (this.pressEnterPopup !== false && e.key === 'Enter') {
  21661. this.selectItem(this.grid.selection);
  21662. stopEvent(e);
  21663. }
  21664. else if (e.key === 'Escape') {
  21665. this.collapse();
  21666. }
  21667. },
  21668. repaintPickerView: function () {
  21669. var style = this.picker.getView().getEl().dom.style;
  21670. style.display = style.display;
  21671. },
  21672. onItemClick: function (view, record, node, rowIndex, e) {
  21673. this.selectItem(record);
  21674. },
  21675. onPickerKeyDown: function (treeView, record, item, index, e) {
  21676. var key = e.getKey();
  21677. if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
  21678. this.selectItem(record);
  21679. }
  21680. },
  21681. filterChange: _$2.debounce(function (sender, value) {
  21682. sender.onExpand();
  21683. }, 1000),
  21684. selectItem: function (record) {
  21685. var me = this;
  21686. var lookup = this.lookup;
  21687. var scope = lookupScope(this);
  21688. me.fireEvent('select', me, record);
  21689. if (record.isModel) {
  21690. record = record.data;
  21691. }
  21692. tryWriteObject(lookup, record, function (path, value) {
  21693. me._lookupSet(path, value);
  21694. });
  21695. // lookup
  21696. // fromColumn: 'toTarget'
  21697. // fromColumn: 'toTarget'
  21698. // fromColumn: 'toTarget'
  21699. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21700. var value = _$2.get(record, fromColumn);
  21701. me._lookupSet(toTarget, value);
  21702. });
  21703. // 选定之后不能做清空
  21704. // const {lookupClearOnChange} = me
  21705. // if (_.isArray(lookupClearOnChange)) {
  21706. // _.each(lookupClearOnChange, item => {
  21707. // me._lookupSet(item, '')
  21708. // })
  21709. // }
  21710. me.collapse();
  21711. // 触发 _raiseNextFocus
  21712. me._raiseNextFocus(me);
  21713. },
  21714. onExpand: function () {
  21715. // 展开时,根据 lookup 带入查询参数
  21716. var expressData = this.getExpressData();
  21717. var txtField = this.grid.down('toolbar').down('textfield');
  21718. txtField.setValue(expressData.queryValue);
  21719. this.reloadGrid();
  21720. },
  21721. reloadGrid: function () {
  21722. // 展开时,根据 lookup 带入查询参数
  21723. var expressData = this.getExpressData();
  21724. var reloadParam = calcObjectFlat(expressData, this.param) || {};
  21725. var txtField = this.grid.down('toolbar').down('textfield');
  21726. // 每个 combogrid 默认带上 __queryValue 属性
  21727. reloadParam["__queryValue"] = txtField.getValue();
  21728. this.grid.reload(reloadParam);
  21729. },
  21730. onTriggerClick: function (sender) {
  21731. var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
  21732. if (!grid) {
  21733. msg('正在初始化,请稍后');
  21734. return;
  21735. }
  21736. if (!this.tryEnable()) {
  21737. // 没有达成 editEnable 条件,不用弹出
  21738. return;
  21739. }
  21740. if (isExpanded || readOnly || disabled) {
  21741. // 已弹出、只读、禁用状态下,不允许弹出
  21742. return;
  21743. }
  21744. this._superBlur = true;
  21745. this.superclass.onTriggerClick.apply(this, arguments);
  21746. this._superBlur = false;
  21747. },
  21748. onCollapse: function () {
  21749. // 每次收回时,删除下拉组件
  21750. // delete this.picker
  21751. },
  21752. /**
  21753. * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
  21754. */
  21755. setValue: function (value) {
  21756. var me = this;
  21757. // 设值用户看到的表面内容
  21758. this.setRawValue(value);
  21759. // 设值 setValue 调用链,正常触发 change 事件等
  21760. return me.mixins.field.setValue.call(me, value);
  21761. },
  21762. _lookupSet: function (path, value) {
  21763. var me = this;
  21764. path = tryVarSimple(path);
  21765. if (me.column) {
  21766. // 判断写入目标,是否与自己绑定的属性相等
  21767. if (path === 'queryValue' || me.column.dataIndex === path) {
  21768. me.setValue(value);
  21769. }
  21770. // 列模式下,写当前编辑行
  21771. var parentRecord = me._lookupEditorRecord();
  21772. if (parentRecord) {
  21773. // Ext.data.Record / Ext.data.Model
  21774. parentRecord.set(path, value);
  21775. }
  21776. else {
  21777. debugger;
  21778. }
  21779. }
  21780. else {
  21781. // 常规模式下,写 viewModel
  21782. me.scope.viewModel.set(path, value);
  21783. }
  21784. },
  21785. _lookupGrid: function () {
  21786. return this.column.up('grid');
  21787. },
  21788. _lookupEditorRecord: function () {
  21789. var _a, _b, _c, _d;
  21790. // parentGrid.getSelectionModel().getLastSelected()
  21791. var grid = this._lookupGrid();
  21792. var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
  21793. if (!editingPlugin) {
  21794. return grid.getSelectionModel().getLastSelected();
  21795. }
  21796. var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
  21797. if (_$2.isNumber(rowIdx)) {
  21798. return grid.store.getAt(rowIdx);
  21799. }
  21800. else {
  21801. return grid.getSelectionModel().getLastSelected();
  21802. }
  21803. },
  21804. onChange: function (newVal, oldVal) {
  21805. var me = this;
  21806. var value = newVal;
  21807. var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
  21808. if (hideTrigger || disabled || readOnly || hideClear) {
  21809. // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
  21810. return;
  21811. }
  21812. if (value) {
  21813. me.getTrigger('clear').show();
  21814. me.updateLayout();
  21815. }
  21816. else {
  21817. me.getTrigger('clear').hide();
  21818. me.updateLayout();
  21819. }
  21820. },
  21821. /**
  21822. * 得到能用于 express 表达式计算的上下文数据
  21823. */
  21824. getExpressData: function () {
  21825. var queryValue = this.getRawValue();
  21826. if (!queryValue) {
  21827. // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
  21828. queryValue = this.getPicker().down('textfield').getRawValue();
  21829. }
  21830. if (this.column) {
  21831. // 列模式, 准备好判断 editEnable 表达式用的数据
  21832. var parentRecord = this._lookupEditorRecord();
  21833. if (!parentRecord) {
  21834. debugger;
  21835. }
  21836. return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
  21837. }
  21838. else {
  21839. // 编辑模式,准备好判断用的数据
  21840. return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
  21841. }
  21842. },
  21843. tryEnable: function () {
  21844. return tryEnable(this.getExpressData(), this.editEnable);
  21845. },
  21846. /**
  21847. * 清空所有值
  21848. */
  21849. onClearClick: function (sender, e) {
  21850. var me = this;
  21851. var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
  21852. me.fireEvent('clear', sender, e);
  21853. me.setValue('');
  21854. _$2.forOwn(lookup, function (toTarget, fromColumn) {
  21855. me._lookupSet(toTarget, '');
  21856. });
  21857. _$2.each(lookupClearOnChange, function (item) {
  21858. me._lookupSet(item, '');
  21859. });
  21860. }
  21861. });
  21862. }
  21863. function initContainer () {
  21864. var cc = Ext.container.Container.prototype.constructor;
  21865. //const {initComponent} = Ext.container.Container.prototype
  21866. Ext.container.Container.override({
  21867. constructor: function (config) {
  21868. var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
  21869. cc.call(this, newConfig);
  21870. },
  21871. });
  21872. }
  21873. function initRows () {
  21874. Ext.define('Yvan.Rows', {
  21875. extend: 'Ext.container.Container',
  21876. xtype: 'rows',
  21877. constructor: function (config) {
  21878. var self = this;
  21879. var newConfig = _$2.defaultsDeep({
  21880. // 强制性属性
  21881. layout: 'anchor', border: false,
  21882. defaults: {
  21883. border: false, anchor: '100%',
  21884. margin: '0 0 5 0',
  21885. },
  21886. }, baseConfig(config, 'rows-container'), config, rows);
  21887. this.superclass.constructor.call(self, newConfig);
  21888. },
  21889. });
  21890. }
  21891. function initForm () {
  21892. var ct = Ext.form.Panel.prototype.constructor;
  21893. Ext.form.Panel.override({
  21894. constructor: function (config) {
  21895. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
  21896. ct.call(this, newConfig);
  21897. }
  21898. });
  21899. }
  21900. function initCols () {
  21901. Ext.define('Yvan.Cols', {
  21902. extend: 'Ext.container.Container',
  21903. xtype: 'cols',
  21904. constructor: function (config) {
  21905. var self = this;
  21906. var newConfig = _$2.defaultsDeep({
  21907. // 强制性属性
  21908. layout: 'hbox',
  21909. minHeight: config.designMode ? 32 : 0
  21910. }, baseConfig(config, 'cols-container'), config, cols);
  21911. this.superclass.constructor.call(self, newConfig);
  21912. },
  21913. });
  21914. }
  21915. function initButton () {
  21916. /**
  21917. *
  21918. */
  21919. var ct = Ext.button.Button.prototype.constructor;
  21920. Ext.button.Button.override({
  21921. constructor: function (config) {
  21922. var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
  21923. ct.call(this, newConfig);
  21924. },
  21925. setLoading: function (value) {
  21926. if (value) {
  21927. if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
  21928. this._originIconCls = this.iconCls;
  21929. }
  21930. this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
  21931. this.setDisabled(true);
  21932. }
  21933. else {
  21934. this.setIconCls(this._originIconCls);
  21935. this.setDisabled(false);
  21936. }
  21937. }
  21938. });
  21939. }
  21940. function initIframe () {
  21941. Ext.define('Ext.ux.IFrame', {
  21942. extend: 'Ext.Component',
  21943. alias: 'widget.uxiframe',
  21944. loadMask: 'Loading...',
  21945. src: 'about:blank',
  21946. renderTpl: [
  21947. '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
  21948. ],
  21949. childEls: ['iframeEl'],
  21950. initComponent: function () {
  21951. this.superclass.initComponent.call(this);
  21952. this.superclass.initEvents.call(this);
  21953. this.frameName = this.frameName || this.id + '-frame';
  21954. },
  21955. initEvents: function () {
  21956. var me = this;
  21957. this.superclass.initEvents.call(this);
  21958. me.iframeEl.on('load', me.onLoad, me);
  21959. },
  21960. initRenderData: function () {
  21961. return Ext.apply(this.superclass.initRenderData.call(this), {
  21962. src: this.src,
  21963. frameName: this.frameName
  21964. });
  21965. },
  21966. getBody: function () {
  21967. var doc = this.getDoc();
  21968. return doc.body || doc.documentElement;
  21969. },
  21970. getDoc: function () {
  21971. try {
  21972. return this.getWin().document;
  21973. }
  21974. catch (ex) {
  21975. return null;
  21976. }
  21977. },
  21978. getWin: function () {
  21979. var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
  21980. return win;
  21981. },
  21982. getFrame: function () {
  21983. var me = this;
  21984. return me.iframeEl.dom;
  21985. },
  21986. onLoad: function () {
  21987. var me = this, doc = me.getDoc();
  21988. if (doc) {
  21989. this.el.unmask();
  21990. this.fireEvent('load', this);
  21991. }
  21992. else if (me.src) {
  21993. this.el.unmask();
  21994. this.fireEvent('error', this);
  21995. }
  21996. },
  21997. load: function (src) {
  21998. var me = this, text = me.loadMask, frame = me.getFrame();
  21999. if (me.fireEvent('beforeload', me, src) !== false) {
  22000. if (text && me.el) {
  22001. me.el.mask(text);
  22002. }
  22003. frame.src = me.src = (src || me.src);
  22004. }
  22005. }
  22006. });
  22007. }
  22008. /**
  22009. * 属性:
  22010. * - autoLoad: true
  22011. * - dataSource: ''
  22012. * 方法:
  22013. * - handleZoomBig
  22014. * - handleZoomSmall
  22015. * - handleZoomReset
  22016. * - openDiagram
  22017. * - getBpmn
  22018. * - getBpmnCanvas
  22019. * - getBpmnOverlays
  22020. * - getBpmnZoomScroll
  22021. * 事件:
  22022. * - initFinish
  22023. * - failed
  22024. * - success
  22025. * - itemHover
  22026. * - itemOut
  22027. * - itemClick
  22028. * - itemDblclick
  22029. * - itemMousedown
  22030. * - itemMouseup
  22031. */
  22032. function initBpmn () {
  22033. Ext.define('Yvan.Bpmn', {
  22034. // extend: 'Ext.container.Container',
  22035. extend: 'Ext.panel.Panel',
  22036. alias: 'widget.bpmn',
  22037. xtype: 'bpmn',
  22038. constructor: function (config) {
  22039. var self = this;
  22040. var newConfig = _$2.defaultsDeep({
  22041. // 强制性属性
  22042. }, baseConfig(config, 'row-item'), config, bpmn);
  22043. if (!newConfig.hideToolbar) {
  22044. newConfig.tbar = [];
  22045. newConfig.tbar.push({
  22046. xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
  22047. listeners: {
  22048. click: function (sender) {
  22049. self.reload();
  22050. }
  22051. }
  22052. });
  22053. newConfig.tbar.push({
  22054. xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
  22055. listeners: {
  22056. click: function (sender) {
  22057. self.handleZoomBig();
  22058. }
  22059. },
  22060. });
  22061. newConfig.tbar.push({
  22062. xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
  22063. listeners: {
  22064. click: function (sender) {
  22065. self.handleZoomSmall();
  22066. }
  22067. },
  22068. });
  22069. newConfig.tbar.push({
  22070. xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
  22071. listeners: {
  22072. click: function (sender) {
  22073. self.handleZoomReset();
  22074. }
  22075. },
  22076. });
  22077. }
  22078. this.superclass.constructor.call(self, newConfig);
  22079. },
  22080. initComponent: function () {
  22081. var _this = this;
  22082. var me = this;
  22083. var config = me.config;
  22084. var scope = lookupScope(this);
  22085. if (!isDesignMode(scope, config)) {
  22086. //@ts-ignore
  22087. require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
  22088. console.log('BpNavigated', me, BpNavigated);
  22089. var dom = me.el.dom;
  22090. var $dom = $(dom);
  22091. var $container = $dom.find('.x-autocontainer-innerCt');
  22092. var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
  22093. _this._bpmn = bpmn;
  22094. if (_this.autoLoad) {
  22095. _this.reload();
  22096. }
  22097. _this.fireEvent('initFinish', _this);
  22098. var eventBus = bpmn.get('eventBus');
  22099. eventBus.on('element.hover', function (e) {
  22100. // this.fireEvent('itemHover', this, e);
  22101. });
  22102. eventBus.on('element.out', function (e) {
  22103. _this.fireEvent('itemOut', _this, e);
  22104. });
  22105. eventBus.on('element.click', function (e) {
  22106. _this.fireEvent('itemClick', _this, e);
  22107. });
  22108. eventBus.on('element.dblclick', function (e) {
  22109. _this.fireEvent('itemDblclick', _this, e);
  22110. });
  22111. eventBus.on('element.mousedown', function (e) {
  22112. _this.fireEvent('itemMousedown', _this, e);
  22113. });
  22114. eventBus.on('element.mouseup', function (e) {
  22115. _this.fireEvent('itemMouseup', _this, e);
  22116. });
  22117. });
  22118. }
  22119. this.superclass.initComponent.call(this);
  22120. this.on({
  22121. afterrender: function (sender) {
  22122. }
  22123. });
  22124. },
  22125. /**
  22126. * 重新载入
  22127. */
  22128. reload: function () {
  22129. var _this = this;
  22130. var _a;
  22131. if (typeof this.dataSource === 'string' && this.dataSource) {
  22132. var scope = lookupScope(this);
  22133. var fn = lookupFn(scope, this.dataSource);
  22134. (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
  22135. _this.openDiagram(res.data);
  22136. });
  22137. }
  22138. },
  22139. /**
  22140. * 获取bpmn
  22141. */
  22142. getBpmn: function () {
  22143. return this._bpmn;
  22144. },
  22145. getBpmnCanvas: function () {
  22146. var _a;
  22147. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
  22148. },
  22149. getBpmnOverlays: function () {
  22150. var _a;
  22151. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
  22152. },
  22153. getBpmnZoomScroll: function () {
  22154. var _a;
  22155. return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
  22156. },
  22157. handleZoomBig: function () {
  22158. var _a;
  22159. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
  22160. },
  22161. handleZoomSmall: function () {
  22162. var _a;
  22163. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
  22164. },
  22165. handleZoomReset: function () {
  22166. var _a;
  22167. (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
  22168. },
  22169. openDiagram: function (diagram) {
  22170. var _this = this;
  22171. if (!this.getBpmn()) {
  22172. return;
  22173. }
  22174. this.getBpmn().importXML(diagram, function (err) {
  22175. if (err) {
  22176. // YvEventDispatch(this.onFailed, this, undefined);
  22177. _this.fireEvent('failed', _this, err);
  22178. return console.error('could not import BPMN 2.0 diagram', err);
  22179. }
  22180. // zoom to fit full viewport
  22181. _this.getBpmnCanvas().zoom('fit-viewport');
  22182. _this.fireEvent('success', _this);
  22183. });
  22184. },
  22185. });
  22186. }
  22187. function initSqlComplex () {
  22188. Ext.define('Yvan.SqlComplex', {
  22189. extend: 'Ext.panel.Panel',
  22190. xtype: 'sqlcomplex',
  22191. alias: 'widget.sqlcomplex',
  22192. getSqlExpress: function () {
  22193. },
  22194. constructor: function (config) {
  22195. var reference = config.reference;
  22196. var me = this;
  22197. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22198. {
  22199. region: 'west',
  22200. width: 280,
  22201. border: false,
  22202. split: true,
  22203. reference: reference + '_tree',
  22204. xtype: 'yvtree',
  22205. hideRefresh: true,
  22206. hideExpand: true,
  22207. hideCollapse: true,
  22208. listeners: {
  22209. itemdblclick: function (sender, record, item, index, e) {
  22210. var field = record.get('field');
  22211. var defaultValue = record.get('defaultValue');
  22212. if (!field) {
  22213. return;
  22214. }
  22215. var tabExpress = me.down('tabpanel');
  22216. var sqleditor = me.down('sqleditor');
  22217. var expressGrid = me.down('yvgrid');
  22218. if (tabExpress.getActiveTab().key !== 'grid') {
  22219. // SQL 模式
  22220. sqleditor.insertText(field + '=');
  22221. }
  22222. else {
  22223. // 表格模式
  22224. expressGrid.appendEditRow({
  22225. field: field,
  22226. operator: '=',
  22227. value: defaultValue,
  22228. remark: '',
  22229. });
  22230. _$2.defer(function () {
  22231. gridChanged(me, expressGrid);
  22232. });
  22233. }
  22234. }
  22235. },
  22236. },
  22237. {
  22238. region: 'center',
  22239. xtype: 'tabpanel',
  22240. reference: reference + '_tab',
  22241. tabPosition: 'bottom',
  22242. listeners: {
  22243. afterrender: function (sender) {
  22244. var scope = lookupScope(me);
  22245. var value = scope.viewModel.get(me.config.bindValue);
  22246. // sql 转换为 grid
  22247. try {
  22248. var list_1 = parseSqlToGrid(value);
  22249. _$2.defer(function () {
  22250. var grid = me.down('yvgrid');
  22251. grid.setData(list_1);
  22252. });
  22253. }
  22254. catch (e) {
  22255. console.error(e);
  22256. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22257. var tabSql = sender.down('sqleditor');
  22258. sender.setActiveTab(tabSql);
  22259. }
  22260. },
  22261. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22262. var scope = lookupScope(me);
  22263. var value = scope.viewModel.get(me.config.bindValue);
  22264. if (newCard.key === 'grid') {
  22265. // sql 转换为 grid
  22266. try {
  22267. var list_2 = parseSqlToGrid(value);
  22268. _$2.defer(function () {
  22269. var grid = me.down('yvgrid');
  22270. grid.setData(list_2);
  22271. });
  22272. return true;
  22273. }
  22274. catch (e) {
  22275. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22276. console.error(e);
  22277. return false;
  22278. }
  22279. }
  22280. else if (newCard.key === 'sql') {
  22281. // grid 转换为 sql
  22282. _$2.defer(function () {
  22283. var editor = me.down('sqleditor');
  22284. editor.setValue(value);
  22285. });
  22286. return true;
  22287. }
  22288. }
  22289. },
  22290. items: [
  22291. {
  22292. title: '表格模式',
  22293. key: 'grid',
  22294. xtype: 'yvgrid',
  22295. _mode: 'select',
  22296. reference: reference + '_grid',
  22297. hideFootbar: true,
  22298. pagination: false,
  22299. tbar: [
  22300. {
  22301. xtype: 'button',
  22302. text: '删除',
  22303. iconCls: 'x-fa fa-minus-circle',
  22304. cls: 'ext-btn-danger',
  22305. bind: {
  22306. disabled: '{!' + reference + '_grid.selection}',
  22307. },
  22308. listeners: {
  22309. click: function (sender) {
  22310. var grid = sender.up('yvgrid');
  22311. removeGridRow(grid);
  22312. gridChanged(me, grid);
  22313. }
  22314. },
  22315. },
  22316. ],
  22317. store: {},
  22318. listeners: {
  22319. editfinish: function (sender) {
  22320. gridChanged(me, sender);
  22321. },
  22322. },
  22323. columns: [
  22324. {
  22325. dataIndex: 'field',
  22326. header: '字段', sortable: false, menuDisabled: true,
  22327. width: 190,
  22328. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22329. var column = context.column;
  22330. var propertyConfig = me.config.propertyConfig;
  22331. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22332. var field = record.get('field');
  22333. if (field) {
  22334. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22335. if (idx >= 0) {
  22336. var meta = propertyConfig[idx];
  22337. return meta.text;
  22338. }
  22339. }
  22340. return value;
  22341. }
  22342. },
  22343. {
  22344. dataIndex: 'operator',
  22345. header: '运算符', sortable: false, menuDisabled: true,
  22346. dict: 'operator',
  22347. width: 65,
  22348. editor: { xtype: 'combo' },
  22349. },
  22350. {
  22351. dataIndex: 'value',
  22352. header: '值', sortable: false, menuDisabled: true,
  22353. flex: 1,
  22354. getEditor: function (record) {
  22355. var column = this;
  22356. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22357. var propertyConfig = me.config.propertyConfig;
  22358. var field = record.get('field');
  22359. if (!field) {
  22360. // 没有填 propertyName
  22361. return;
  22362. }
  22363. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22364. if (idx < 0) {
  22365. console.error('没有找到 field=' + field + ". propertyConfig");
  22366. return;
  22367. }
  22368. var meta = propertyConfig[idx];
  22369. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22370. return new Ext.grid.CellEditor({
  22371. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22372. });
  22373. }
  22374. return new Ext.grid.CellEditor({
  22375. field: __assign({ dict: meta.dict }, meta.editor)
  22376. });
  22377. },
  22378. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22379. var column = context.column;
  22380. var grid = _$2.get(view, 'ownerGrid');
  22381. var propertyConfig = me.config.propertyConfig;
  22382. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22383. var field = record.get('field');
  22384. if (field) {
  22385. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22386. if (idx >= 0) {
  22387. var meta = propertyConfig[idx];
  22388. var dictName = _$2.get(meta, 'dict');
  22389. if (dictName && window['DICT_CACHE'][dictName]) {
  22390. var dict_1 = window['DICT_CACHE'][dictName];
  22391. var valueText_1 = [];
  22392. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22393. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22394. if (idxKv >= 0) {
  22395. valueText_1.push(dict_1[idxKv].text);
  22396. }
  22397. else {
  22398. valueText_1.push(value);
  22399. }
  22400. });
  22401. return valueText_1.join(',');
  22402. }
  22403. }
  22404. }
  22405. return valueList;
  22406. },
  22407. },
  22408. ]
  22409. },
  22410. {
  22411. title: 'SQL模式',
  22412. key: 'sql',
  22413. xtype: 'sqleditor',
  22414. reference: reference + '_sql',
  22415. listeners: {
  22416. change: function (sender) {
  22417. var scope = lookupScope(me);
  22418. // 保存 editor 写入的值
  22419. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22420. }
  22421. }
  22422. },
  22423. ]
  22424. }
  22425. ] });
  22426. this.superclass.constructor.call(this, newConfig);
  22427. },
  22428. initComponent: function () {
  22429. // 货位条件树
  22430. var me = this;
  22431. me.superclass.initComponent.apply(this, arguments);
  22432. var tree = this.down('yvtree');
  22433. var config = me.config;
  22434. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22435. },
  22436. });
  22437. function gridChanged(me, grid) {
  22438. var data = grid.getDataRows();
  22439. var propertyConfig = me.config.propertyConfig;
  22440. var bindValue = me.config.bindValue;
  22441. var scope = lookupScope(me);
  22442. var sql = parseGridToSql(data);
  22443. scope.viewModel.set(bindValue, sql);
  22444. }
  22445. /**
  22446. * 用于从 propertyConfig 解析出树形结构
  22447. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22448. * ->
  22449. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22450. */
  22451. function buildConfigTree(propertyConfig) {
  22452. var root = {
  22453. expanded: true,
  22454. leaf: false,
  22455. children: []
  22456. };
  22457. var categoryObj = {};
  22458. var cfgList = propertyConfig;
  22459. _$2.forEach(cfgList, function (cfg) {
  22460. var cateNode = categoryObj[cfg.category];
  22461. if (!cateNode) {
  22462. cateNode = {
  22463. text: cfg.category, expanded: true, leaf: false,
  22464. children: []
  22465. };
  22466. categoryObj[cfg.category] = cateNode;
  22467. root.children.push(cateNode);
  22468. }
  22469. cateNode.children.push({
  22470. text: cfg.text,
  22471. field: cfg.field,
  22472. operator: cfg.operator,
  22473. defaultValue: cfg.defaultValue,
  22474. leaf: true,
  22475. });
  22476. });
  22477. return root;
  22478. }
  22479. /**
  22480. * 将表格变成 SQL where语句 [
  22481. * {field: 'f1', value: 1, operator: '='}
  22482. * {field: 'f2', value: 2, operator: '='}
  22483. * {field: 'f3', value: '3', operator: '>='}
  22484. * {field: 'f4', value: 4, operator: '='}
  22485. * ]
  22486. * ->
  22487. * f1=v1 and f2=v2
  22488. */
  22489. function parseGridToSql(list) {
  22490. var sqls = [];
  22491. _$2.forEach(list, function (i) {
  22492. var _a;
  22493. if (i.operator === 'in') {
  22494. sqls.push(i.field + ' in (' + (i.value) + ')');
  22495. }
  22496. else if (i.operator === 'notIn') {
  22497. sqls.push(i.field + ' not in (' + (i.value) + ')');
  22498. }
  22499. else {
  22500. sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
  22501. }
  22502. });
  22503. return sqls.join(' AND ');
  22504. }
  22505. /**
  22506. * 将 SQL 语句的 where 片段变成表格
  22507. * @param sql f1=1 and f2=2 and f3>="3" and f4=4
  22508. * @return [
  22509. {field: 'f1', value: 1, operator: '='}
  22510. {field: 'f2', value: 2, operator: '='}
  22511. {field: 'f3', value: '3', operator: '>='}
  22512. {field: 'f4', value: 4, operator: '='}
  22513. ]
  22514. */
  22515. function parseSqlToGrid(sql) {
  22516. if (!sql || !_$2.trim(sql)) {
  22517. return [];
  22518. }
  22519. var parser = new window['NodeSQLParser'].Parser();
  22520. var ast = parser.astify('select * from dual where ' + sql);
  22521. var ret = [];
  22522. exp(ast.where, ret);
  22523. return ret;
  22524. }
  22525. function exp(ast, ret) {
  22526. if (ast.type === 'binary_expr') {
  22527. if (_$2.toUpper(ast.operator) === 'AND') {
  22528. if (ast.left.type === 'binary_expr') {
  22529. exp(ast.left, ret);
  22530. }
  22531. if (ast.right.type === 'binary_expr') {
  22532. exp(ast.right, ret);
  22533. }
  22534. }
  22535. else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
  22536. if (ast.left.type === 'column_ref') {
  22537. if (ast.right.type === 'number' ||
  22538. ast.right.type === 'single_quote_string' ||
  22539. ast.right.type === 'double_quote_string') {
  22540. // 具体值相等
  22541. ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
  22542. }
  22543. else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
  22544. && ast.right.type === 'expr_list') {
  22545. // in / not in
  22546. var valueList_1 = [];
  22547. _$2.forEach(ast.right.value, function (item) {
  22548. valueList_1.push(item.value);
  22549. });
  22550. var operator = void 0;
  22551. if (_$2.toUpper(ast.operator) === 'IN') {
  22552. operator = 'in';
  22553. }
  22554. else if (_$2.toUpper(ast.operator) === 'NOT IN') {
  22555. operator = 'notIn';
  22556. }
  22557. ret.push({
  22558. field: ast.left.column, value: valueList_1.join(','),
  22559. operator: operator
  22560. });
  22561. }
  22562. else {
  22563. throw new Error('ast.right must is value.');
  22564. }
  22565. }
  22566. else {
  22567. throw new Error('ast.left must is column_ref.');
  22568. }
  22569. }
  22570. else {
  22571. // 必须用 AND 条件符匹配
  22572. throw new Error('ast.operator must is "AND / =".');
  22573. }
  22574. }
  22575. else {
  22576. throw new Error('ast.type must is "binary_expr".');
  22577. }
  22578. }
  22579. /**
  22580. * json5.stringify( new NodeSQLParser.Parser().astify("").where)
  22581. * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
  22582. {
  22583. type: 'binary_expr',
  22584. operator: 'AND',
  22585. left: {
  22586. type: 'binary_expr',
  22587. operator: 'AND',
  22588. left: {
  22589. type: 'binary_expr',
  22590. operator: 'AND',
  22591. left: {
  22592. type: 'binary_expr',
  22593. operator: 'AND',
  22594. left: {
  22595. type: 'binary_expr',
  22596. operator: '=',
  22597. left: {
  22598. type: 'column_ref',
  22599. table: null,
  22600. column: 'f1'
  22601. },
  22602. right: {
  22603. type: 'number',
  22604. value: 1
  22605. }
  22606. },
  22607. right: {
  22608. type: 'binary_expr',
  22609. operator: '=',
  22610. left: {
  22611. type: 'column_ref',
  22612. table: null,
  22613. column: 'f2'
  22614. },
  22615. right: {
  22616. type: 'number',
  22617. value: 2
  22618. }
  22619. }
  22620. },
  22621. right: {
  22622. type: 'binary_expr',
  22623. operator: '=',
  22624. left: {
  22625. type: 'column_ref',
  22626. table: null,
  22627. column: 'f3'
  22628. },
  22629. right: {
  22630. type: 'single_quote_string',
  22631. value: '3'
  22632. }
  22633. }
  22634. },
  22635. right: {
  22636. type: 'binary_expr',
  22637. operator: '>=',
  22638. left: {
  22639. type: 'column_ref',
  22640. table: null,
  22641. column: 'f4'
  22642. },
  22643. right: {
  22644. type: 'number',
  22645. value: 4
  22646. }
  22647. }
  22648. },
  22649. right: {
  22650. type: 'binary_expr',
  22651. operator: '<',
  22652. left: {
  22653. type: 'column_ref',
  22654. table: null,
  22655. column: 'f4'
  22656. },
  22657. right: {
  22658. type: 'number',
  22659. value: 3
  22660. }
  22661. }
  22662. }
  22663. * */
  22664. }
  22665. function initParamComplex () {
  22666. Ext.define('Yvan.ParamComplex', {
  22667. extend: 'Ext.panel.Panel',
  22668. xtype: 'paramcomplex',
  22669. alias: 'widget.paramcomplex',
  22670. getSqlExpress: function () {
  22671. },
  22672. constructor: function (config) {
  22673. var reference = config.reference;
  22674. var me = this;
  22675. var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
  22676. {
  22677. region: 'west',
  22678. width: 280,
  22679. border: false,
  22680. split: true,
  22681. reference: reference + '_tree',
  22682. xtype: 'yvtree',
  22683. hideRefresh: true,
  22684. hideExpand: true,
  22685. hideCollapse: true,
  22686. listeners: {
  22687. itemdblclick: function (sender, record, item, index, e) {
  22688. var field = record.get('field');
  22689. var defaultValue = record.get('defaultValue');
  22690. if (!field) {
  22691. return;
  22692. }
  22693. var tabExpress = me.down('tabpanel');
  22694. var sqleditor = me.down('sqleditor');
  22695. var expressGrid = me.down('yvgrid');
  22696. if (tabExpress.getActiveTab().key !== 'grid') {
  22697. // SQL 模式
  22698. sqleditor.insertText(field + '=');
  22699. }
  22700. else {
  22701. // 表格模式
  22702. expressGrid.appendEditRow({
  22703. field: field,
  22704. operator: '=',
  22705. value: defaultValue,
  22706. remark: '',
  22707. });
  22708. _$2.defer(function () {
  22709. gridChanged(me, expressGrid);
  22710. });
  22711. }
  22712. }
  22713. },
  22714. },
  22715. {
  22716. region: 'center',
  22717. xtype: 'tabpanel',
  22718. reference: reference + '_tab',
  22719. tabPosition: 'bottom',
  22720. listeners: {
  22721. afterrender: function (sender) {
  22722. var scope = lookupScope(me);
  22723. var value = scope.viewModel.get(me.config.bindValue);
  22724. // sql 转换为 grid
  22725. try {
  22726. var list_1 = parseParamToGrid(value);
  22727. _$2.defer(function () {
  22728. var grid = me.down('yvgrid');
  22729. grid.setData(list_1);
  22730. });
  22731. }
  22732. catch (e) {
  22733. console.error(e);
  22734. msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
  22735. var tabSql = sender.down('sqleditor');
  22736. sender.setActiveTab(tabSql);
  22737. }
  22738. },
  22739. beforetabchange: function (sender, newCard, oldCard, eOpts) {
  22740. var scope = lookupScope(me);
  22741. var value = scope.viewModel.get(me.config.bindValue);
  22742. if (newCard.key === 'grid') {
  22743. // sql 转换为 grid
  22744. try {
  22745. var list_2 = parseParamToGrid(value);
  22746. _$2.defer(function () {
  22747. var grid = me.down('yvgrid');
  22748. grid.setData(list_2);
  22749. });
  22750. return true;
  22751. }
  22752. catch (e) {
  22753. msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
  22754. console.error(e);
  22755. return false;
  22756. }
  22757. }
  22758. else if (newCard.key === 'sql') {
  22759. // grid 转换为 sql
  22760. _$2.defer(function () {
  22761. var editor = me.down('sqleditor');
  22762. editor.setValue(value);
  22763. });
  22764. return true;
  22765. }
  22766. }
  22767. },
  22768. items: [
  22769. {
  22770. title: '表格模式',
  22771. key: 'grid',
  22772. xtype: 'yvgrid',
  22773. _mode: 'select',
  22774. reference: reference + '_grid',
  22775. hideFootbar: true,
  22776. pagination: false,
  22777. tbar: [
  22778. {
  22779. xtype: 'button',
  22780. text: '删除',
  22781. iconCls: 'x-fa fa-minus-circle',
  22782. cls: 'ext-btn-danger',
  22783. bind: {
  22784. disabled: '{!' + reference + '_grid.selection}',
  22785. },
  22786. listeners: {
  22787. click: function (sender) {
  22788. var grid = sender.up('yvgrid');
  22789. removeGridRow(grid);
  22790. gridChanged(me, grid);
  22791. }
  22792. },
  22793. },
  22794. ],
  22795. store: {},
  22796. listeners: {
  22797. editfinish: function (sender) {
  22798. gridChanged(me, sender);
  22799. },
  22800. },
  22801. columns: [
  22802. {
  22803. dataIndex: 'field',
  22804. header: '字段', sortable: false, menuDisabled: true,
  22805. width: 190,
  22806. renderer: function (value, context, record, rowIdx, colIdx, store, view) {
  22807. var column = context.column;
  22808. var propertyConfig = me.config.propertyConfig;
  22809. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22810. var field = record.get('field');
  22811. if (field) {
  22812. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22813. if (idx >= 0) {
  22814. var meta = propertyConfig[idx];
  22815. return meta.text;
  22816. }
  22817. }
  22818. return value;
  22819. }
  22820. },
  22821. {
  22822. dataIndex: 'value',
  22823. header: '值', sortable: false, menuDisabled: true,
  22824. flex: 1,
  22825. getEditor: function (record) {
  22826. var column = this;
  22827. var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
  22828. var propertyConfig = me.config.propertyConfig;
  22829. var field = record.get('field');
  22830. if (!field) {
  22831. // 没有填 propertyName
  22832. return;
  22833. }
  22834. var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
  22835. if (idx < 0) {
  22836. console.error('没有找到 field=' + field + ". propertyConfig");
  22837. return;
  22838. }
  22839. var meta = propertyConfig[idx];
  22840. if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
  22841. return new Ext.grid.CellEditor({
  22842. field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
  22843. });
  22844. }
  22845. return new Ext.grid.CellEditor({
  22846. field: __assign({ dict: meta.dict }, meta.editor)
  22847. });
  22848. },
  22849. renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
  22850. var column = context.column;
  22851. var grid = _$2.get(view, 'ownerGrid');
  22852. var propertyConfig = me.config.propertyConfig;
  22853. // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
  22854. var field = record.get('field');
  22855. if (field) {
  22856. var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
  22857. if (idx >= 0) {
  22858. var meta = propertyConfig[idx];
  22859. var dictName = _$2.get(meta, 'dict');
  22860. if (dictName && window['DICT_CACHE'][dictName]) {
  22861. var dict_1 = window['DICT_CACHE'][dictName];
  22862. var valueText_1 = [];
  22863. _$2.forEach(_$2.split(valueList, ','), function (value) {
  22864. var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
  22865. if (idxKv >= 0) {
  22866. valueText_1.push(dict_1[idxKv].text);
  22867. }
  22868. else {
  22869. valueText_1.push(value);
  22870. }
  22871. });
  22872. return valueText_1.join(',');
  22873. }
  22874. }
  22875. }
  22876. return valueList;
  22877. },
  22878. },
  22879. ]
  22880. },
  22881. {
  22882. title: '文本模式',
  22883. key: 'sql',
  22884. xtype: 'sqleditor',
  22885. reference: reference + '_sql',
  22886. listeners: {
  22887. change: function (sender) {
  22888. var scope = lookupScope(me);
  22889. // 保存 editor 写入的值
  22890. scope.viewModel.set(me.config.bindValue, sender.getValue());
  22891. }
  22892. }
  22893. },
  22894. ]
  22895. }
  22896. ] });
  22897. this.superclass.constructor.call(this, newConfig);
  22898. },
  22899. initComponent: function () {
  22900. // 货位条件树
  22901. var me = this;
  22902. me.superclass.initComponent.apply(this, arguments);
  22903. var tree = this.down('yvtree');
  22904. var config = me.config;
  22905. tree.setRootNode(buildConfigTree(config.propertyConfig));
  22906. },
  22907. });
  22908. function gridChanged(me, grid) {
  22909. var data = grid.getDataRows();
  22910. var propertyConfig = me.config.propertyConfig;
  22911. var bindValue = me.config.bindValue;
  22912. var scope = lookupScope(me);
  22913. var sql = parseGridToParam(data);
  22914. scope.viewModel.set(bindValue, sql);
  22915. }
  22916. /**
  22917. * 用于从 propertyConfig 解析出树形结构
  22918. * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
  22919. * ->
  22920. * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
  22921. */
  22922. function buildConfigTree(propertyConfig) {
  22923. var root = {
  22924. expanded: true,
  22925. leaf: false,
  22926. children: []
  22927. };
  22928. var categoryObj = {};
  22929. var cfgList = propertyConfig;
  22930. _$2.forEach(cfgList, function (cfg) {
  22931. var cateNode = categoryObj[cfg.category];
  22932. if (!cateNode) {
  22933. cateNode = {
  22934. text: cfg.category, expanded: true, leaf: false,
  22935. children: []
  22936. };
  22937. categoryObj[cfg.category] = cateNode;
  22938. root.children.push(cateNode);
  22939. }
  22940. cateNode.children.push({
  22941. text: cfg.text,
  22942. field: cfg.field,
  22943. operator: cfg.operator,
  22944. defaultValue: cfg.defaultValue,
  22945. leaf: true,
  22946. });
  22947. });
  22948. return root;
  22949. }
  22950. /**
  22951. * 将表格变成参数语句 [
  22952. * {field: 'f1', value: 1}
  22953. * {field: 'f2', value: 2}
  22954. * {field: 'f3', value: '3'}
  22955. * {field: 'f4', value: 4}
  22956. * ]
  22957. * ->
  22958. * f1=v1, f2=v2
  22959. */
  22960. function parseGridToParam(list) {
  22961. var sqls = [];
  22962. _$2.forEach(list, function (i) {
  22963. sqls.push(i.field + '=' + (i.value));
  22964. });
  22965. return sqls.join('; ');
  22966. }
  22967. /**
  22968. * 将 分号分割的的参数设置 变成表格
  22969. * @param param a=1; b=2; c='3'
  22970. * @return [
  22971. {field: 'a', value: 1}
  22972. {field: 'b', value: 2}
  22973. {field: 'c', value: '3'}
  22974. ]
  22975. */
  22976. function parseParamToGrid(param) {
  22977. if (!param || !_$2.trim(param)) {
  22978. return [];
  22979. }
  22980. var ret = [];
  22981. var sp = _$2.split(param, ';');
  22982. _$2.forEach(sp, function (v) {
  22983. var vi = _$2.indexOf(v, '=');
  22984. var field = _$2.trim(v.substr(0, vi));
  22985. var value = eval(v.substr(vi + 1));
  22986. ret.push({ field: field, value: value });
  22987. });
  22988. return ret;
  22989. }
  22990. }
  22991. function initSqlEditor () {
  22992. Ext.define('com.yvan.studio.SqlEditor', {
  22993. extend: 'Ext.panel.Panel',
  22994. alias: 'widget.sqleditor',
  22995. xtype: 'sqleditor',
  22996. layout: 'fit',
  22997. border: false,
  22998. html: "<div class=\"editor\"/>",
  22999. config: {
  23000. value: ''
  23001. },
  23002. codeChange: undefined,
  23003. isChangeFromOuter: false,
  23004. setCode: function (value) {
  23005. var _this = this;
  23006. this.code = value;
  23007. this.value = value;
  23008. _$2.defer(function () {
  23009. _this.isChangeFromOuter = true;
  23010. if (_this.editor) {
  23011. _this.editor.setValue(value);
  23012. }
  23013. });
  23014. },
  23015. getCode: function () {
  23016. return this.getValue();
  23017. },
  23018. updateOptions: function (options) {
  23019. if (this.editor && options) {
  23020. this.editor.updateOptions(options);
  23021. }
  23022. },
  23023. getValue: function () {
  23024. if (!this.editor) {
  23025. return this.code;
  23026. }
  23027. return this.editor.getValue();
  23028. },
  23029. applyPosition: function () {
  23030. var _this = this;
  23031. if (this.autoFocusMethod) {
  23032. if (this.editor) {
  23033. _$2.defer(function () {
  23034. if (_this.autoFocusStartLine) {
  23035. _this.editor.setPosition({
  23036. lineNumber: _this.autoFocusStartLine,
  23037. column: _this.autoFocusStartColumn
  23038. });
  23039. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23040. }
  23041. _this.editor.focus();
  23042. });
  23043. delete this.autoFocusMethod;
  23044. }
  23045. }
  23046. this.editor.layout();
  23047. },
  23048. insertText: function (text) {
  23049. var editor = this.editor;
  23050. var position = editor.getPosition();
  23051. editor.executeEdits('', [
  23052. {
  23053. range: {
  23054. startLineNumber: position.lineNumber,
  23055. startColumn: position.column,
  23056. endLineNumber: position.lineNumber,
  23057. endColumn: position.column
  23058. },
  23059. text: text
  23060. }
  23061. ]);
  23062. },
  23063. setValue: function (value, fromEditor) {
  23064. this.setCode(value);
  23065. var me = this;
  23066. if (me.value === value) {
  23067. // 值相等,不需要变化
  23068. return;
  23069. }
  23070. if (fromEditor !== true && me.editor) {
  23071. // 不是来源于编辑器的变化,才设置编辑器的值
  23072. me.editor.setValue(value);
  23073. }
  23074. // 通知mixins setValue
  23075. me.value = value;
  23076. me.fireEvent('change', value);
  23077. },
  23078. initComponent: function () {
  23079. var that = this;
  23080. this.superclass.initComponent.call(this);
  23081. that.on({
  23082. resize: function () {
  23083. if (that.editor) {
  23084. that.editor.layout();
  23085. }
  23086. },
  23087. destory: function () {
  23088. if (that.editor) {
  23089. that.editor.dispose();
  23090. delete that.editor;
  23091. }
  23092. },
  23093. afterrender: function (sender) {
  23094. var $dom = $(that.el.dom).find('.editor');
  23095. attach_2($dom[0], {
  23096. value: that.code
  23097. }).then(function (editor) {
  23098. that.editor = editor;
  23099. that.applyPosition();
  23100. that.editor.onDidChangeModelContent(function (e) {
  23101. that.fireEvent('change', that.editor, e);
  23102. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23103. that.codeChange(that.editor.getValue(), that.name, e);
  23104. }
  23105. that.isChangeFromOuter = false;
  23106. });
  23107. });
  23108. }
  23109. });
  23110. }
  23111. });
  23112. function attach_2(element, opts) {
  23113. if (!window['monaco']) {
  23114. return;
  23115. }
  23116. var monaco = window['monaco'];
  23117. return new Promise(function (resolve) {
  23118. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  23119. enabled: false
  23120. } }));
  23121. // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  23122. // const sql = editor.getValue()
  23123. // if (_.trim(sql).length > 0) {
  23124. // editor.setValue(format(sql, {
  23125. // indent: ' ',
  23126. // uppercase: true,
  23127. // }))
  23128. // }
  23129. // })
  23130. editor.onKeyUp(function (e) {
  23131. // console.log(e)
  23132. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23133. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23134. }
  23135. });
  23136. resolve(editor);
  23137. });
  23138. }
  23139. }
  23140. function initJsonEditor () {
  23141. Ext.define('com.yvan.studio.JsonEditor', {
  23142. extend: 'Ext.panel.Panel',
  23143. alias: 'widget.jsoneditor',
  23144. xtype: 'jsoneditor',
  23145. layout: 'fit',
  23146. border: false,
  23147. html: "<div class=\"editor\"/>",
  23148. autoFocusMethod: true,
  23149. autoFocusStartLine: 0,
  23150. autoFocusStartColumn: 0,
  23151. codeChange: undefined,
  23152. funcArr: [],
  23153. modulePage: null,
  23154. isChangeFromOuter: false,
  23155. name: "",
  23156. /**
  23157. * 设置代码
  23158. */
  23159. setCode: function (value) {
  23160. var _this = this;
  23161. this.code = value;
  23162. _$2.defer(function () {
  23163. _this.isChangeFromOuter = true;
  23164. if (_this.editor) {
  23165. _this.editor.setValue(value);
  23166. }
  23167. });
  23168. },
  23169. updateOptions: function (options) {
  23170. if (this.editor && options) {
  23171. this.editor.updateOptions(options);
  23172. }
  23173. },
  23174. setLanguage: function (lang) {
  23175. if (!window['monaco']) {
  23176. return;
  23177. }
  23178. var monaco = window['monaco'];
  23179. if (this.editor && lang) {
  23180. monaco.editor.setModelLanguage(this.editor.getModel(), lang);
  23181. }
  23182. },
  23183. getCode: function () {
  23184. var _a;
  23185. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23186. },
  23187. applyPosition: function () {
  23188. var _this = this;
  23189. if (this.autoFocusMethod) {
  23190. if (this.editor) {
  23191. _$2.defer(function () {
  23192. if (_this.autoFocusStartLine) {
  23193. _this.editor.setPosition({
  23194. lineNumber: _this.autoFocusStartLine,
  23195. column: _this.autoFocusStartColumn
  23196. });
  23197. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23198. }
  23199. _this.editor.focus();
  23200. });
  23201. delete this.autoFocusMethod;
  23202. }
  23203. }
  23204. this.editor.layout();
  23205. },
  23206. initComponent: function () {
  23207. var that = this;
  23208. this.superclass.initComponent.apply(this, arguments);
  23209. this.on({
  23210. resize: function (sender, width, height) {
  23211. if (that.editor) {
  23212. that.editor.layout();
  23213. }
  23214. },
  23215. destory: function () {
  23216. if (that.editor) {
  23217. that.editor.dispose();
  23218. delete that.editor;
  23219. }
  23220. },
  23221. afterrender: function (sender) {
  23222. var $dom = $(that.el.dom).find('.editor');
  23223. attach_116($dom[0], {
  23224. value: that.code
  23225. }).then(function (editor) {
  23226. that.editor = editor;
  23227. that.applyPosition();
  23228. that.editor.onDidChangeModelContent(function (e) {
  23229. that.fireEvent('change', that.editor, e);
  23230. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23231. that.codeChange(that.editor.getValue(), that.name, e);
  23232. }
  23233. that.isChangeFromOuter = false;
  23234. });
  23235. });
  23236. }
  23237. });
  23238. },
  23239. });
  23240. function attach_116(element, opts) {
  23241. if (!window['monaco']) {
  23242. return;
  23243. }
  23244. var monaco = window['monaco'];
  23245. return new Promise(function (resolve) {
  23246. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  23247. enabled: false
  23248. } }));
  23249. editor.onKeyUp(function (e) {
  23250. // console.log(e)
  23251. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  23252. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  23253. }
  23254. });
  23255. resolve(editor);
  23256. });
  23257. }
  23258. }
  23259. function initJsEditor () {
  23260. Ext.define('com.yvan.studio.JsEditor', {
  23261. extend: 'Ext.panel.Panel',
  23262. alias: 'widget.jseditor',
  23263. xtype: 'jseditor',
  23264. layout: 'fit',
  23265. border: false,
  23266. html: "<div class=\"editor\"/>",
  23267. autoFocusMethod: true,
  23268. autoFocusStartLine: 0,
  23269. autoFocusStartColumn: 0,
  23270. codeChange: undefined,
  23271. funcArr: [],
  23272. modulePage: null,
  23273. isChangeFromOuter: false,
  23274. name: "",
  23275. /**
  23276. * 设置代码
  23277. */
  23278. setCode: function (value) {
  23279. var _this = this;
  23280. this.code = value;
  23281. _$2.defer(function () {
  23282. _this.isChangeFromOuter = true;
  23283. if (_this.editor) {
  23284. _this.editor.setValue(value);
  23285. if (_this.name === "controllerEditor") {
  23286. _this.funcArr = _this.getAllFunction();
  23287. }
  23288. }
  23289. });
  23290. },
  23291. getCode: function () {
  23292. var _a;
  23293. if (!this.editor) {
  23294. return this.code;
  23295. }
  23296. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  23297. },
  23298. applyPosition: function () {
  23299. var _this = this;
  23300. if (this.autoFocusMethod) {
  23301. if (this.editor) {
  23302. _$2.defer(function () {
  23303. if (_this.autoFocusStartLine) {
  23304. _this.editor.setPosition({
  23305. lineNumber: _this.autoFocusStartLine,
  23306. column: _this.autoFocusStartColumn
  23307. });
  23308. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  23309. }
  23310. _this.editor.focus();
  23311. });
  23312. delete this.autoFocusMethod;
  23313. }
  23314. }
  23315. this.editor.layout();
  23316. },
  23317. initComponent: function () {
  23318. var that = this;
  23319. this.superclass.initComponent.apply(this, arguments);
  23320. this.on({
  23321. resize: function (sender, width, height) {
  23322. if (that.editor) {
  23323. that.editor.layout();
  23324. }
  23325. },
  23326. destory: function () {
  23327. if (that.editor) {
  23328. that.editor.dispose();
  23329. delete that.editor;
  23330. }
  23331. },
  23332. afterrender: function () {
  23333. var $dom = $(that.el.dom).find('.editor');
  23334. attach_1($dom[0], {
  23335. value: that.code
  23336. }).then(function (editor) {
  23337. that.editor = editor;
  23338. that.applyPosition();
  23339. that.editor.onDidChangeModelContent(function (e) {
  23340. that.fireEvent('change', that.editor, e);
  23341. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  23342. that.codeChange(that.editor.getValue(), that.name, e);
  23343. }
  23344. that.isChangeFromOuter = false;
  23345. });
  23346. });
  23347. }
  23348. });
  23349. },
  23350. getAllFunction: function () {
  23351. var funcArr = [];
  23352. var ast = window['YvanUI'].recast.parse(this.code);
  23353. if (ast && ast.program && ast.program.body) {
  23354. if (Array.isArray(ast.program.body)) {
  23355. for (var i = 0; i < ast.program.body.length; i++) {
  23356. var m = ast.program.body[i];
  23357. if (m.type === "ExportDefaultDeclaration") {
  23358. if (m.declaration.type === "ClassDeclaration") {
  23359. if (m.declaration.body.type === "ClassBody") {
  23360. if (Array.isArray(m.declaration.body.body)) {
  23361. for (var j = 0; j < m.declaration.body.body.length; j++) {
  23362. var ob = m.declaration.body.body[j];
  23363. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  23364. var funcItem = { name: ob.key.name, args: [] };
  23365. if (Array.isArray(ob.value.params)) {
  23366. for (var k = 0; k < ob.value.params.length; k++) {
  23367. var p = ob.value.params[k];
  23368. funcItem.args.push(p.name);
  23369. }
  23370. }
  23371. funcArr.push(funcItem);
  23372. }
  23373. }
  23374. }
  23375. }
  23376. }
  23377. }
  23378. }
  23379. }
  23380. }
  23381. return funcArr;
  23382. }
  23383. });
  23384. var isInited = false;
  23385. function attach_1(element, opts) {
  23386. if (!window['monaco']) {
  23387. return;
  23388. }
  23389. var monaco = window['monaco'];
  23390. return new Promise(function (resolve) {
  23391. if (!isInited) {
  23392. isInited = true;
  23393. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  23394. noSemanticValidation: true,
  23395. noSyntaxValidation: false
  23396. });
  23397. // compiler options
  23398. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  23399. target: monaco.languages.typescript.ScriptTarget.ES2016,
  23400. allowNonTsExtensions: true,
  23401. });
  23402. // extra libraries
  23403. var libSource = [
  23404. 'declare class Facts {',
  23405. ' /**',
  23406. ' * Returns the next fact',
  23407. ' */',
  23408. ' static next():string',
  23409. ' static next222():string',
  23410. '}',
  23411. "\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 ",
  23412. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  23413. ].join('\n');
  23414. var libUri = 'file:///index.d.ts';
  23415. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  23416. // When resolving definitions and references, the editor will try to use created models.
  23417. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  23418. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  23419. }
  23420. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  23421. resolve(editor);
  23422. });
  23423. }
  23424. }
  23425. function initClipboard () {
  23426. var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
  23427. var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
  23428. Ext.grid.plugin.Clipboard.override({
  23429. getCellData: function (format, erase) {
  23430. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
  23431. if (selection) {
  23432. selection.eachCell(function (cellContext) {
  23433. column = cellContext.column;
  23434. view = cellContext.column.getView();
  23435. record = cellContext.record;
  23436. // Do not copy the check column or row numberer column
  23437. if (column.ignoreExport && column.xtype !== "checkcolumn") {
  23438. return;
  23439. }
  23440. if (lastRecord !== record) {
  23441. lastRecord = record;
  23442. ret.push(row = []);
  23443. }
  23444. dataIndex = column.dataIndex;
  23445. // 记录原始数据
  23446. var rData = record.data[dataIndex];
  23447. if (isRaw) {
  23448. data = record.data[dataIndex];
  23449. }
  23450. else {
  23451. // Try to access the view node.
  23452. viewNode = view.all.item(cellContext.rowIdx);
  23453. // If we could not, it's because it's outside of the rendered block -
  23454. // recreate it.
  23455. if (!viewNode) {
  23456. viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
  23457. }
  23458. cell = viewNode.dom.querySelector(column.getCellInnerSelector());
  23459. data = cell.innerHTML;
  23460. if (isText) {
  23461. data = Ext.util.Format.stripTags(data);
  23462. }
  23463. // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
  23464. data = data || rData;
  23465. }
  23466. row.push(data);
  23467. if (erase && dataIndex) {
  23468. record.set(dataIndex, null);
  23469. }
  23470. });
  23471. }
  23472. // See decode() comment below
  23473. return Ext.util.TSV.encode(ret, undefined, null);
  23474. },
  23475. getCells: function (format, erase) {
  23476. var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
  23477. if (selection) {
  23478. selection.eachCell(function (cellContext) {
  23479. record = cellContext.record;
  23480. if (lastRecord !== record) {
  23481. lastRecord = record;
  23482. ret.push(row = {
  23483. model: record.self,
  23484. fields: []
  23485. });
  23486. }
  23487. dataIndex = cellContext.column.dataIndex;
  23488. row.fields.push({
  23489. name: dataIndex,
  23490. value: record.data[dataIndex]
  23491. });
  23492. if (erase && dataIndex) {
  23493. record.set(dataIndex, null);
  23494. }
  23495. });
  23496. }
  23497. return ret;
  23498. },
  23499. getTextData: function (format, erase) {
  23500. return this.getCellData(format, erase);
  23501. },
  23502. putCellData: function (data, format) {
  23503. var _a;
  23504. 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 = {};
  23505. // If the view is not focused, use the first cell of the selection as the destination.
  23506. if (!destination && selected) {
  23507. selected.eachCell(function (c) {
  23508. destination = c;
  23509. return false;
  23510. });
  23511. }
  23512. if (destination) {
  23513. // Create a new Context based upon the outermost View.
  23514. // NavigationModel works on local views.
  23515. // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
  23516. // At that point, we can use navModel.getPosition()
  23517. destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
  23518. }
  23519. else {
  23520. destination = new Ext.grid.CellContext(view).setPosition(0, 0);
  23521. }
  23522. destinationStartColumn = destination.colIdx;
  23523. for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
  23524. row = values[sourceRowIdx];
  23525. // Collect new values in dataObject
  23526. for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
  23527. if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
  23528. continue;
  23529. }
  23530. dataIndex = destination.column.dataIndex;
  23531. var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
  23532. if (dataIndex) {
  23533. switch (format) {
  23534. // Raw field values
  23535. case 'raw':
  23536. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23537. break;
  23538. // Textual data with HTML tags stripped
  23539. case 'text':
  23540. {
  23541. if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
  23542. // 获取字典原始的value
  23543. dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
  23544. }
  23545. else {
  23546. dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
  23547. }
  23548. break;
  23549. }
  23550. }
  23551. }
  23552. // If we are at the end of the destination row, break the column loop.
  23553. if (destination.colIdx === maxColIdx) {
  23554. break;
  23555. }
  23556. destination.setColumn(destination.colIdx + 1);
  23557. }
  23558. // Update the record in one go.
  23559. destination.record.set(dataObject);
  23560. // If we are at the end of the destination store, break the row loop.
  23561. if (destination.rowIdx === maxRowIdx) {
  23562. break;
  23563. }
  23564. // Jump to next row in destination
  23565. destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
  23566. }
  23567. },
  23568. putTextData: function (data, format) {
  23569. var _a, _b, _c;
  23570. var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
  23571. // 根据复制的行数自动添加新的行
  23572. 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;
  23573. if (selected.startCell.rowIdx + values.length >= dataLength) {
  23574. for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
  23575. this.cmp.getStore().add({});
  23576. }
  23577. }
  23578. this.putCellData(data, format);
  23579. },
  23580. });
  23581. }
  23582. function initDict () {
  23583. var DICT_CACHE = window['DICT_CACHE'];
  23584. if (!DICT_CACHE) {
  23585. DICT_CACHE = {};
  23586. window['DICT_CACHE'] = DICT_CACHE;
  23587. }
  23588. DICT_CACHE.XTYPE = [
  23589. { id: 'datefield', text: '日期' },
  23590. { id: 'datetimefield', text: '日期时间' },
  23591. { id: 'textfield', text: '文本' },
  23592. { id: 'numberfield', text: '数字' },
  23593. { id: 'combo', text: '下拉框' },
  23594. ];
  23595. DICT_CACHE.operator = [
  23596. { id: '=', text: '=' },
  23597. { id: '>', text: '>' },
  23598. { id: '<', text: '<' },
  23599. { id: '>=', text: '>=' },
  23600. { id: '<=', text: '<=' },
  23601. { id: 'in', text: 'in' },
  23602. { id: 'notIn', text: 'notIn' },
  23603. ];
  23604. DICT_CACHE.GRID_MODE = [
  23605. { id: 'edit1', text: '单机编辑模式' },
  23606. { id: 'edit2', text: '双击编辑模式' },
  23607. { id: 'checkbox', text: '勾选' },
  23608. { id: 'checkonly', text: '只勾选' },
  23609. { id: 'select', text: '行选择模式' },
  23610. ];
  23611. DICT_CACHE.BOTH_SELECT = [
  23612. { id: 'N/A', text: '<无>' },
  23613. { id: 'textfield', text: '文本' },
  23614. { id: 'numberfield', text: '数字框' },
  23615. { id: 'datefield', text: '日期' },
  23616. { id: 'datetimefield', text: '日期时间' },
  23617. { id: 'combo', text: '下拉框' },
  23618. { id: 'combogrid', text: '下拉表' },
  23619. { id: 'checkbox', text: '勾选' },
  23620. ];
  23621. DICT_CACHE.ROW_LAYOUT = [
  23622. { id: 'flex', text: '按权重摆放' },
  23623. { id: 'hbox', text: '按宽度摆放' },
  23624. ];
  23625. DICT_CACHE.GRID_XTYPE = [
  23626. { id: 'N/A', text: '<无>' },
  23627. { id: 'textfield', text: '文本-textfield' },
  23628. { id: 'numberfield', text: '数字框-numberfield' },
  23629. { id: 'datefield', text: '日期-datefield' },
  23630. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23631. { id: 'combo', text: '下拉框-combo' },
  23632. { id: 'combogrid', text: '下拉表-combogrid' },
  23633. { id: 'checkbox', text: '勾选-checkbox' },
  23634. ];
  23635. DICT_CACHE.FORM_XTYPE = [
  23636. { id: 'N/A', text: '<无>' },
  23637. { id: 'textfield', text: '文本-textfield' },
  23638. { id: 'numberfield', text: '数字框-numberfield' },
  23639. { id: 'datefield', text: '日期-datefield' },
  23640. { id: 'datetimefield', text: '日期时间-datetimefield' },
  23641. { id: 'combo', text: '下拉框-combo' },
  23642. { id: 'combogrid', text: '下拉表-combogrid' },
  23643. { id: 'checkbox', text: '勾选-checkbox' },
  23644. { id: 'multiplesearch', text: '多段文本-multiplesearch' },
  23645. ];
  23646. DICT_CACHE.GRID_FORMATTER = [
  23647. { id: 'N/A', text: '默认' },
  23648. { id: 'rownum', text: '序号-rownum' },
  23649. { id: 'button', text: '按钮-button' },
  23650. { id: 'checkbox', text: '勾选-checkbox' },
  23651. { id: 'progres', text: '进度条-progres' },
  23652. ];
  23653. }
  23654. function initDesigner () {
  23655. Ext.define('com.yvan.studio.designer', {
  23656. extend: 'Ext.panel.Panel',
  23657. alias: 'widget.designer',
  23658. xtype: 'designer',
  23659. layout: 'fit',
  23660. items: [],
  23661. constructor: function (config) {
  23662. var self = this;
  23663. var newConfig = _$2.defaultsDeep({
  23664. // 强制性属性
  23665. }, config);
  23666. this.superclass.constructor.call(self, newConfig);
  23667. },
  23668. initComponent: function () {
  23669. var me = this;
  23670. me.on({
  23671. afterrender: function () {
  23672. }
  23673. });
  23674. this.superclass.initComponent.call(me);
  23675. }
  23676. });
  23677. }
  23678. var FixClass = /** @class */ (function () {
  23679. function FixClass() {
  23680. }
  23681. FixClass.prototype.fix = function (me, config) {
  23682. var _this = this;
  23683. if (isDesignMode(me, config)) {
  23684. return;
  23685. }
  23686. if (!config) {
  23687. return;
  23688. }
  23689. var fix = config.fix;
  23690. if (!fix) {
  23691. return;
  23692. }
  23693. delete config.fix;
  23694. // 这里有个 bug
  23695. // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
  23696. // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
  23697. var scope;
  23698. if (config.$initParent) {
  23699. // 在面板上的组件
  23700. scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23701. }
  23702. else if (config.column) {
  23703. // 在列上的组件
  23704. scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
  23705. }
  23706. if (_$2.isArray(fix)) {
  23707. _$2.each(fix, function (f) {
  23708. var fn = lookupFn(scope, f);
  23709. fn.call(_this, me, config);
  23710. });
  23711. }
  23712. else if (_$2.isString(fix)) {
  23713. var fn = lookupFn(scope, fix);
  23714. fn.call(this, me, config);
  23715. }
  23716. };
  23717. __decorate([
  23718. baseConfigProcess(),
  23719. __metadata("design:type", Function),
  23720. __metadata("design:paramtypes", [Object, Object]),
  23721. __metadata("design:returntype", void 0)
  23722. ], FixClass.prototype, "fix", null);
  23723. return FixClass;
  23724. }());
  23725. function init$1() {
  23726. // 引入 filters 过滤插件
  23727. Ext.require([
  23728. 'Ext.grid.filters.Filters'
  23729. ]);
  23730. // 启用 tooltip 快捷提示
  23731. Ext.QuickTips.init();
  23732. // 定义日期格式化方法
  23733. if (Ext.util && Ext.util.Format) {
  23734. Ext.apply(Ext.util.Format, {
  23735. dateFormat: 'Y-m-d'
  23736. });
  23737. }
  23738. Ext.form.field.Display.override({
  23739. cls: 'yvan-display-field',
  23740. labelAlign: 'right'
  23741. });
  23742. Ext.define("Ext.locale.zh_CN.picker.Date", {
  23743. override: "Ext.picker.Date",
  23744. format: "Y-m-d",
  23745. });
  23746. Ext.define("Ext.locale.zh_CN.form.field.Date", {
  23747. override: "Ext.form.field.Date",
  23748. format: "Y-m-d",
  23749. });
  23750. Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
  23751. override: "Ext.grid.PropertyColumnModel",
  23752. format: "Y-m-d",
  23753. });
  23754. Ext.define("Ext.locale.zh_CN.view.AbstractView", {
  23755. override: "Ext.view.AbstractView",
  23756. loadingText: "读取中..."
  23757. });
  23758. Ext.LoadMask.prototype.msg = '请稍后...';
  23759. Ext.define("Ext.locale.zh_CN.grid.header.Container", {
  23760. override: "Ext.grid.header.Container",
  23761. sortClearText: '不排序',
  23762. sortAscText: "正序",
  23763. sortDescText: "倒序",
  23764. lockText: "锁定列",
  23765. unlockText: "解除锁定",
  23766. columnsText: "字段隐藏"
  23767. });
  23768. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
  23769. override: "Ext.grid.filters.filter.Date",
  23770. fields: {
  23771. lt: { text: '之前' },
  23772. gt: { text: '之后' },
  23773. eq: { text: '相等' },
  23774. },
  23775. // Defaults to Ext.Date.defaultFormat
  23776. dateFormat: null
  23777. });
  23778. // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
  23779. // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
  23780. // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
  23781. Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
  23782. override: "Ext.grid.locking.Lockable",
  23783. lockText: "锁定",
  23784. unlockText: '解锁',
  23785. });
  23786. Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
  23787. override: "Ext.grid.filters.Filters",
  23788. menuFilterText: "过滤"
  23789. });
  23790. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
  23791. override: "Ext.grid.filters.filter.Boolean",
  23792. yesText: "已钩选",
  23793. noText: "未勾选"
  23794. });
  23795. Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
  23796. override: "Ext.grid.filters.filter.String",
  23797. emptyText: "输入过滤文本..."
  23798. });
  23799. Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
  23800. override: "Ext.grid.filters.filter.Number",
  23801. emptyText: "输入数字..."
  23802. });
  23803. Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
  23804. override: "Ext.PagingToolbar",
  23805. beforePageText: "第",
  23806. // update
  23807. afterPageText: "/ {0} 页",
  23808. // update
  23809. firstText: "第一页",
  23810. prevText: "上一页",
  23811. // update
  23812. nextText: "下一页",
  23813. lastText: "最后页",
  23814. refreshText: "刷新",
  23815. displayMsg: "总共 {2} 条",
  23816. // update
  23817. emptyMsg: '没有数据'
  23818. });
  23819. /**
  23820. * 改变事件的获取方式.
  23821. * 具体见: ext-all-debug.js:23216 addListener
  23822. * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
  23823. * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
  23824. */
  23825. var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
  23826. Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
  23827. if (typeof fn === 'string' &&
  23828. (_$2.startsWith(fn, 'scope.') ||
  23829. _$2.startsWith(fn, 'system.') ||
  23830. _$2.startsWith(fn, 'format.'))) {
  23831. scope = lookupScope(this);
  23832. if (isDesignMode(scope, undefined)) {
  23833. fn = Ext.emptyFn;
  23834. }
  23835. else {
  23836. // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
  23837. // const vm = this.lookupViewModel()
  23838. // if (vm && vm.yvanScope) {
  23839. // scope = vm.yvanScope
  23840. // fn = scope[fn.substr('scope.'.length)]
  23841. // }
  23842. fn = lookupFn(scope, fn, this);
  23843. }
  23844. }
  23845. _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
  23846. };
  23847. // 将 SystemLib 扩展到 window.system 下
  23848. if (!window['system']) {
  23849. window['system'] = {};
  23850. }
  23851. _$2.extend(window['system'], SystemLib);
  23852. _$2.extend(window['system'], {
  23853. showGridRowDetail: showGridRowDetail
  23854. });
  23855. Ext.apply(Ext.util.Format, {
  23856. // 百分比
  23857. percentRenderer: function (v, rd, model) {
  23858. if (!v) {
  23859. v = 0;
  23860. }
  23861. if (typeof v === 'string') {
  23862. v = parseInt(v);
  23863. }
  23864. var valueString = v.toFixed(2);
  23865. var valueFixed = v > 100 ? 100 : v;
  23866. valueFixed = valueFixed < 0 ? 0 : valueFixed;
  23867. var cls = '';
  23868. if (v < 90) {
  23869. cls = 'danger';
  23870. }
  23871. else if (v < 100) {
  23872. cls = 'warning';
  23873. }
  23874. else {
  23875. cls = 'success';
  23876. }
  23877. return Ext.String
  23878. .format(
  23879. // '<div>'
  23880. // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
  23881. // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
  23882. // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
  23883. // + '</div></div>', valueString, valueFixed, cls);
  23884. '<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(
  23885. // '<div>'
  23886. // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
  23887. // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
  23888. // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
  23889. // + '</div></div>', v, valueFixed, valueString);
  23890. },
  23891. //button
  23892. button: function (v, rd, model) {
  23893. return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
  23894. }
  23895. });
  23896. initComponent();
  23897. initPanel();
  23898. initGridColumn();
  23899. initTree();
  23900. initGrid();
  23901. initMainTab();
  23902. initTextfield();
  23903. initCombo();
  23904. initTag();
  23905. initContainer();
  23906. initRows();
  23907. initCols();
  23908. initForm();
  23909. initToolbar();
  23910. initSplitter();
  23911. initButton();
  23912. initStores();
  23913. initSearch();
  23914. initMultipleSearch();
  23915. initDate();
  23916. initDateTimePicker();
  23917. initDateTime();
  23918. initNumber();
  23919. initCheckbox();
  23920. initCheckboxGroup();
  23921. initRadio();
  23922. initRadioGroup();
  23923. initFieldset();
  23924. initCombotree();
  23925. initPickerPlus();
  23926. initCombogrid();
  23927. initComboGridMulti();
  23928. initIframe();
  23929. initBpmn();
  23930. initSqlEditor();
  23931. initJsonEditor();
  23932. initJsEditor();
  23933. initClipboard();
  23934. initSqlComplex();
  23935. initParamComplex();
  23936. initDict();
  23937. initDesigner();
  23938. }
  23939. /**
  23940. * 创建一个 Ajax 客户端
  23941. */
  23942. function createAjax(createOption) {
  23943. if (createOption.baseUrl) {
  23944. axios__default.defaults.baseURL = createOption.baseUrl;
  23945. axios__default.defaults.timeout = createOption.timeout;
  23946. storeAjax.timeout = createOption.timeout;
  23947. axios__default.defaults.timeoutErrorMessage = '网络超时';
  23948. }
  23949. return function (option) {
  23950. //@ts-ignore
  23951. option.method = (option.method || 'get').toLocaleLowerCase();
  23952. //@ts-ignore
  23953. var ax = __assign({}, option);
  23954. switch (option.method) {
  23955. case 'get':
  23956. ax.method = 'GET';
  23957. ax.params = option.param;
  23958. ax.headers = __assign({}, option.headers);
  23959. break;
  23960. case 'post':
  23961. ax.method = 'POST';
  23962. ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
  23963. ax.params = option.param;
  23964. ax.data = Qs.stringify(option.data);
  23965. break;
  23966. case 'put':
  23967. case 'patch':
  23968. case 'delete':
  23969. ax.method = option.method;
  23970. ax.headers = option.headers;
  23971. ax.params = option.param;
  23972. ax.data = Qs.stringify(option.data);
  23973. break;
  23974. case 'download':
  23975. downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
  23976. return new Promise(function (resolver, reject) {
  23977. });
  23978. case "invoke":
  23979. ax.url = serverInvokeUrlTransform(option.url, option);
  23980. ax.method = 'POST';
  23981. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  23982. if (typeof option.args === 'object') {
  23983. ax.data = JSON.stringify({
  23984. args: option.args,
  23985. });
  23986. }
  23987. else {
  23988. ax.data = JSON.stringify({
  23989. args: [
  23990. __assign(__assign({}, option.data), option.param)
  23991. ],
  23992. filterModel: option.filterModel,
  23993. sortModel: option.sortModel
  23994. });
  23995. }
  23996. break;
  23997. case 'post-json':
  23998. ax.method = 'POST';
  23999. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  24000. ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
  24001. break;
  24002. case 'post-file':
  24003. //TODO 刘壮. 上传文件
  24004. var forms = new FormData();
  24005. ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
  24006. _$2.forOwn(option.data, function (value, key) {
  24007. if (key === 'files') {
  24008. var i_1 = 0;
  24009. _$2.each(value, function (f) {
  24010. // @ts-ignore
  24011. forms.append('file' + (++i_1), f);
  24012. });
  24013. }
  24014. else {
  24015. forms.append(key, value);
  24016. }
  24017. });
  24018. ax.data = forms;
  24019. ax.method = 'POST';
  24020. break;
  24021. case "sql":
  24022. ax.url = sqlUrlTransform(option.url);
  24023. ax.method = 'POST';
  24024. ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
  24025. ax.data = JSON.stringify({
  24026. args: [option.data],
  24027. db: option.db,
  24028. filterModel: option.filterModel,
  24029. sortModel: option.sortModel
  24030. });
  24031. break;
  24032. default:
  24033. throw new Error('not implements');
  24034. }
  24035. return new Promise(function (resolver, reject) {
  24036. axios__default(ax).then(function (resolverRaw) {
  24037. var apiResult = {
  24038. rawData: resolverRaw.data,
  24039. status: resolverRaw.status,
  24040. success: (resolverRaw.data && resolverRaw.data.success),
  24041. data: resolverRaw.data.data,
  24042. pagination: resolverRaw.data.pagination,
  24043. msg: (resolverRaw.data.msg),
  24044. errors: resolverRaw.data.errors,
  24045. headers: resolverRaw.headers
  24046. };
  24047. if (typeof window['apiTranslate'] === 'function') {
  24048. window['apiTranslate'](apiResult.rawData, option.url);
  24049. }
  24050. resolver(apiResult);
  24051. }).catch(function (reason) {
  24052. reject(reason);
  24053. });
  24054. });
  24055. };
  24056. }
  24057. function downLoad(downLoadUrl, filename, data, header, isJson) {
  24058. if (isJson === void 0) { isJson = false; }
  24059. var YvanUI = _$2.get(window, 'YvanUI');
  24060. YvanUI.loading();
  24061. var createObjectURL = function (object) {
  24062. return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
  24063. };
  24064. // const formData = new FormData();
  24065. // _.forOwn(data, (v, k) => {
  24066. // formData.append(k, v);
  24067. // });
  24068. var formData = '';
  24069. var xhr = new XMLHttpRequest();
  24070. xhr.open('POST', downLoadUrl);
  24071. xhr.responseType = 'blob';
  24072. // xhr.setRequestHeader('Authorization', $.cookie('auth'))
  24073. if (isJson) {
  24074. formData = data ? JSON.stringify(data) : '';
  24075. xhr.setRequestHeader('Content-Type', 'application/json');
  24076. }
  24077. else {
  24078. formData = data ? Qs.stringify(data) : '';
  24079. xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  24080. }
  24081. //
  24082. if (header) {
  24083. _$2.forOwn(header, function (v, k) {
  24084. xhr.setRequestHeader(k, v);
  24085. });
  24086. }
  24087. xhr.onload = function (e) {
  24088. if (this.status === 200) {
  24089. var blob = this.response;
  24090. if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
  24091. navigator.msSaveBlob(blob, filename);
  24092. YvanUI.clearLoading();
  24093. }
  24094. else {
  24095. var a = document.createElement('a');
  24096. var url = createObjectURL(blob);
  24097. a.href = url;
  24098. a.download = filename;
  24099. document.append(a);
  24100. a.click();
  24101. a.remove();
  24102. window.URL.revokeObjectURL(url);
  24103. YvanUI.clearLoading();
  24104. }
  24105. }
  24106. };
  24107. xhr.send(formData);
  24108. }
  24109. function readExcel(file) {
  24110. return new Promise(function (resolve, reject) {
  24111. if (!file) {
  24112. reject("文件读取失败!!!");
  24113. return;
  24114. }
  24115. var reader = new FileReader();
  24116. reader.onload = function (e) {
  24117. if (e.target) {
  24118. var data = e.target.result;
  24119. var workbook = XLSX.read(data, { type: 'binary' });
  24120. resolve(workbook);
  24121. }
  24122. else {
  24123. reject("文件读取失败!!!");
  24124. }
  24125. };
  24126. try {
  24127. reader.readAsBinaryString(file);
  24128. }
  24129. catch (e) {
  24130. reject(e);
  24131. }
  24132. });
  24133. }
  24134. function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
  24135. if (dataStartRow === void 0) { dataStartRow = 2; }
  24136. if (titleRowNumber === void 0) { titleRowNumber = 1; }
  24137. if (rowValidate === void 0) { rowValidate = undefined; }
  24138. if (otherValidate === void 0) { otherValidate = undefined; }
  24139. if (fieldValidate === void 0) { fieldValidate = undefined; }
  24140. return new Promise(function (resolve, reject) {
  24141. var promiseArr = [];
  24142. for (var i = 0; i < columnsSet.length; i++) {
  24143. var fix = columnsSet[i].fix;
  24144. if (_$2.isArray(fix) && fix.length > 0) {
  24145. var ss = fix[0].toLowerCase();
  24146. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24147. columnsSet[i].importFormatter = function (vdata) {
  24148. // @ts-ignore
  24149. return window.moment(vdata.ov) - 0;
  24150. };
  24151. }
  24152. else {
  24153. var fn = lookupFn(topScope, fix[0]);
  24154. promiseArr.push(fn(null, columnsSet[i]));
  24155. delete columnsSet[i].fix;
  24156. }
  24157. }
  24158. else if (_$2.isString(fix)) {
  24159. var ss = fix.toLowerCase();
  24160. if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
  24161. columnsSet[i].importFormatter = function (vdata) {
  24162. // @ts-ignore
  24163. return window.moment(vdata.ov) - 0;
  24164. };
  24165. }
  24166. else {
  24167. var fn = lookupFn(topScope, fix);
  24168. promiseArr.push(fn(null, columnsSet[i]));
  24169. delete columnsSet[i].fix;
  24170. }
  24171. }
  24172. }
  24173. var read = function () {
  24174. readExcel(file).then(function (workbook) {
  24175. var sheetNames = workbook.SheetNames; // 工作表名称集合
  24176. var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
  24177. var titleRowValue = [];
  24178. var titleRowKey = [];
  24179. var needLoop = false; // 是否需要迭代
  24180. var columns = [];
  24181. if (worksheet && worksheet["!ref"]) {
  24182. var t = worksheet["!ref"];
  24183. var tempArr = t.split(':');
  24184. if (tempArr.length >= 2) {
  24185. var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
  24186. // 选取title的行,删除之前的行
  24187. if (titleRowNumber > firstRowNumber) {
  24188. for (var i = firstRowNumber; i < titleRowNumber; i++) {
  24189. for (var key in worksheet) {
  24190. if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
  24191. delete worksheet[key];
  24192. }
  24193. }
  24194. }
  24195. var fc = tempArr[0].replace(/[^a-z]/ig, "");
  24196. firstRowNumber = titleRowNumber + '';
  24197. worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
  24198. }
  24199. var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
  24200. // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
  24201. // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
  24202. for (var key in worksheet) {
  24203. if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
  24204. titleRowKey.push(key);
  24205. titleRowValue.push(worksheet[key].v);
  24206. }
  24207. }
  24208. if (columnsSet && columnsSet.length > 0) {
  24209. var length = columnsSet.length;
  24210. length = length <= titleRowKey.length ? length : titleRowKey.length;
  24211. for (var i = 0; i < length; i++) {
  24212. var vk = titleRowKey[i];
  24213. var item = columnsSet[i];
  24214. var column = {};
  24215. if (typeof item === 'string') {
  24216. column.dataIndex = item;
  24217. column.header = worksheet[vk].v;
  24218. worksheet[vk] = { t: "s", v: item, h: item, w: item };
  24219. }
  24220. else if (typeof item.dataIndex === "string") {
  24221. column.dataIndex = item.dataIndex;
  24222. column.header = worksheet[vk].v;
  24223. worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
  24224. if (typeof item.validate === "function") {
  24225. column.validate = item.validate;
  24226. needLoop = true;
  24227. }
  24228. if (typeof item.importFormatter === "function") {
  24229. column.importFormatter = item.importFormatter;
  24230. needLoop = true;
  24231. }
  24232. if ((item.data instanceof Array && item.data.length > 0)
  24233. || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
  24234. column.data = item.data;
  24235. needLoop = true;
  24236. }
  24237. }
  24238. columns.push(column);
  24239. }
  24240. }
  24241. }
  24242. }
  24243. if (fieldValidate && typeof fieldValidate === "function") {
  24244. if (fieldValidate(columns, titleRowValue) !== true) {
  24245. reject("fields validate error");
  24246. return;
  24247. }
  24248. }
  24249. var allData = XLSX.utils.sheet_to_json(worksheet);
  24250. var okData = [], errorData = [], errorMsgData = [];
  24251. var needItemLoop = needLoop;
  24252. if (rowValidate && typeof rowValidate === "function") {
  24253. needLoop = true;
  24254. }
  24255. if (needLoop === true) {
  24256. for (var index = 0; index < allData.length; index++) {
  24257. var row = allData[index];
  24258. var rowNumber = dataStartRow + index;
  24259. row.__importID__ = rowNumber;
  24260. var isRowOk = true;
  24261. if (needItemLoop) {
  24262. var _loop_1 = function (num) {
  24263. var column = columns[num];
  24264. var ov = row[column.dataIndex];
  24265. var nv = ov;
  24266. var hasError = false;
  24267. var rowNumber_1 = dataStartRow + index;
  24268. var ei = {
  24269. errorId: rowNumber_1 + '_' + column.dataIndex,
  24270. importID: rowNumber_1,
  24271. dataIndex: column.dataIndex,
  24272. header: column.header,
  24273. value: ov,
  24274. errormessage: ""
  24275. };
  24276. // 格式化
  24277. if (column.data instanceof Array) {
  24278. nv = undefined;
  24279. ei.errormessage = "字典匹配失败";
  24280. _$2.forEach(column.data, function (v, index) {
  24281. if (v.text === ov) {
  24282. nv = v.id;
  24283. return;
  24284. }
  24285. });
  24286. }
  24287. else if (_$2.isPlainObject(column.data)) {
  24288. nv = undefined;
  24289. ei.errormessage = "字典匹配失败";
  24290. _$2.forEach(column.data, function (value, key) {
  24291. if (value === ov) {
  24292. nv = key;
  24293. return;
  24294. }
  24295. });
  24296. }
  24297. if (typeof column.importFormatter === 'function') {
  24298. var vdata = {
  24299. column: column,
  24300. ov: ov,
  24301. nv: nv,
  24302. rowIndex: index,
  24303. data: row,
  24304. rowDatas: allData
  24305. };
  24306. nv = undefined;
  24307. ei.errormessage = "格式化失败";
  24308. nv = column.importFormatter(vdata);
  24309. }
  24310. if (!nv && nv != 0) {
  24311. hasError = true;
  24312. }
  24313. else {
  24314. row[column.dataIndex] = nv;
  24315. ei.errormessage = "";
  24316. }
  24317. // 校验
  24318. if (typeof column.validate === 'function') {
  24319. var vdata = {
  24320. column: column,
  24321. ov: ov,
  24322. nv: nv,
  24323. rowIndex: index,
  24324. data: row,
  24325. rowDatas: allData
  24326. };
  24327. var errormessage = column.validate(vdata);
  24328. if (errormessage === true) ;
  24329. else {
  24330. hasError = true;
  24331. ei.errormessage = ei.errormessage + "/" + errormessage;
  24332. }
  24333. }
  24334. if (hasError === true) {
  24335. isRowOk = false;
  24336. errorMsgData.push(ei);
  24337. }
  24338. };
  24339. for (var num = 0; num < columns.length; num++) {
  24340. _loop_1(num);
  24341. }
  24342. }
  24343. if (rowValidate && typeof rowValidate === "function") {
  24344. var errormessage = rowValidate({
  24345. columns: columns,
  24346. data: row,
  24347. rowIndex: index,
  24348. rowDatas: allData
  24349. });
  24350. if (errormessage === true) ;
  24351. else {
  24352. isRowOk = false;
  24353. var ei = {
  24354. errorId: rowNumber + '',
  24355. dataIndex: "row",
  24356. header: "数据行",
  24357. value: "当前行的数据",
  24358. importID: rowNumber,
  24359. errormessage: errormessage
  24360. };
  24361. errorMsgData.push(ei);
  24362. }
  24363. }
  24364. row.__hasError__ = !isRowOk;
  24365. if (isRowOk === true) {
  24366. okData.push(row);
  24367. }
  24368. else {
  24369. errorData.push(row);
  24370. }
  24371. }
  24372. }
  24373. else {
  24374. // 添加数据的唯一标识
  24375. for (var index = 0; index < allData.length; index++) {
  24376. var row = allData[index];
  24377. var rowNumber = dataStartRow + index;
  24378. row.__importID__ = rowNumber;
  24379. row.__hasError__ = false;
  24380. }
  24381. okData = allData;
  24382. }
  24383. if (otherValidate && typeof otherValidate === "function") {
  24384. otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
  24385. }
  24386. else {
  24387. resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
  24388. }
  24389. // clearLoading()
  24390. }).catch(function (e) {
  24391. reject(e);
  24392. });
  24393. };
  24394. if (promiseArr.length > 0) {
  24395. Promise.all(promiseArr).then(function (resArr) {
  24396. for (var i = 0; i < resArr.length; i++) {
  24397. var tmp = resArr[i];
  24398. tmp.config.data = [];
  24399. if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
  24400. if (tmp.r.field.length > 1) {
  24401. var keyKey = tmp.r.field[0];
  24402. var valueKey = tmp.r.field[1];
  24403. for (var j = 0; j < tmp.r.data.length; j++) {
  24404. var it = tmp.r.data[j];
  24405. var newIt = {};
  24406. newIt.id = it[keyKey];
  24407. newIt.text = it[valueKey];
  24408. tmp.config.data.push(newIt);
  24409. }
  24410. }
  24411. }
  24412. }
  24413. read();
  24414. });
  24415. }
  24416. else {
  24417. setTimeout(read, 50);
  24418. }
  24419. });
  24420. }
  24421. var ExcelImportDialog = /** @class */ (function (_super) {
  24422. __extends(ExcelImportDialog, _super);
  24423. function ExcelImportDialog(option) {
  24424. var _this = this;
  24425. var vjson = vjsonFunc(option);
  24426. _this = _super.call(this, { model: model$d, vjson: vjson }) || this;
  24427. _this.importExcelOption = option;
  24428. return _this;
  24429. }
  24430. ExcelImportDialog.prototype.onLoad = function () {
  24431. _super.prototype.onLoad.call(this);
  24432. };
  24433. ExcelImportDialog.prototype.fileChange = function (sender) {
  24434. var _this = this;
  24435. var file = sender.fileInputEl.dom.files[0];
  24436. // const senderScope = lookupScope(sender)
  24437. var topScope = this.topScope;
  24438. var rowValidate = this.importExcelOption.rowValidate;
  24439. if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
  24440. rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
  24441. }
  24442. var afterClientValidate = this.importExcelOption.afterClientValidate;
  24443. if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
  24444. afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
  24445. }
  24446. var fieldValidate = this.importExcelOption.fieldValidate;
  24447. if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
  24448. fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
  24449. }
  24450. this.setLoading(true);
  24451. readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
  24452. _this.importData = res;
  24453. _this.refs.dataGrid.setData(res.allData);
  24454. _this.viewModel.set("dataCount", res.allData.length);
  24455. _this.refs.errGrid.setData(res.errorMsgData);
  24456. _this.viewModel.set("errMsgCount", res.errorMsgData.length);
  24457. }).catch(function (e) {
  24458. _this.importData = null;
  24459. _this.refs.dataGrid.setData();
  24460. _this.refs.errGrid.setData();
  24461. msg(e.toString());
  24462. }).finally(function () {
  24463. _this.setLoading(false);
  24464. });
  24465. };
  24466. ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
  24467. if (record.get('__hasError__')) {
  24468. return "x-grid-record-bg-red";
  24469. }
  24470. };
  24471. ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
  24472. return "x-grid-record-bg-red";
  24473. };
  24474. ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
  24475. var _a;
  24476. var id = record.data.__importID__;
  24477. var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
  24478. var selectRecord = null;
  24479. var dataIndex = -1;
  24480. var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24481. for (var i = 0; i < rows.length; i++) {
  24482. if (rows[i].importID === id) {
  24483. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24484. dataIndex = i;
  24485. }
  24486. if (rows[i].errorId === id + "_" + subId) {
  24487. selectRecord = this.refs.errGrid.getStore().getAt(i);
  24488. dataIndex = i;
  24489. break;
  24490. }
  24491. }
  24492. if (selectRecord) {
  24493. this.refs.errGrid.ensureVisible(selectRecord);
  24494. this.refs.errGrid.selModel.select(dataIndex);
  24495. // this.refs.errGrid.reload()
  24496. }
  24497. };
  24498. ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
  24499. var _a;
  24500. var id = record.data.importID;
  24501. var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  24502. var selectRecord = null;
  24503. var dataIndex = -1;
  24504. for (var i = 0; i < rows.length; i++) {
  24505. if (rows[i].__importID__ === id) {
  24506. selectRecord = this.refs.dataGrid.getStore().getAt(i);
  24507. dataIndex = i;
  24508. break;
  24509. }
  24510. }
  24511. if (selectRecord) {
  24512. this.refs.dataGrid.ensureVisible(selectRecord);
  24513. this.refs.dataGrid.selModel.select(dataIndex);
  24514. // this.refs.dataGrid.reload()
  24515. }
  24516. };
  24517. ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
  24518. this.viewModel.set("dataType", newValue);
  24519. if (this.importData) {
  24520. this.refs.dataGrid.setData(this.importData[newValue]);
  24521. this.viewModel.set("dataCount", this.importData[newValue].length);
  24522. }
  24523. };
  24524. ExcelImportDialog.prototype.downloadTemplate = function (sender) {
  24525. if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
  24526. window.location.href = this.importExcelOption.dowLoadUrl;
  24527. return;
  24528. }
  24529. var xt = [];
  24530. _$2.forEach(this.importExcelOption.columns, function (v) {
  24531. xt.push(v.header);
  24532. });
  24533. var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
  24534. if (filename.endsWith(".xlsx")) {
  24535. filename = filename.split(".xlsx")[0];
  24536. }
  24537. filename = filename + ".xlsx";
  24538. var ws_name = "Sheet1"; //Excel第一个sheet的名称
  24539. var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
  24540. XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
  24541. XLSX.writeFile(wb, filename); //导出Excel
  24542. };
  24543. ExcelImportDialog.prototype.getData = function (sender) {
  24544. _$2.each(this.importData.okData, function (item) {
  24545. delete item.id;
  24546. delete item.__hasError__;
  24547. delete item.__importID__;
  24548. delete item._origin;
  24549. });
  24550. _$2.each(this.importData.allData, function (item) {
  24551. delete item.id;
  24552. delete item.__hasError__;
  24553. delete item.__importID__;
  24554. delete item._origin;
  24555. });
  24556. _$2.each(this.importData.errorData, function (item) {
  24557. delete item.id;
  24558. delete item.__hasError__;
  24559. delete item.__importID__;
  24560. delete item._origin;
  24561. });
  24562. this.dialogSuccess(this.importData);
  24563. };
  24564. return ExcelImportDialog;
  24565. }(Scope));
  24566. var model$d = {
  24567. data: {
  24568. dataType: "all",
  24569. errMsgCount: 0,
  24570. dataCount: 0
  24571. }
  24572. };
  24573. var vjsonFunc = function (option) {
  24574. return {
  24575. title: option.title || 'excel导入',
  24576. layout: 'fit',
  24577. items: [
  24578. {
  24579. layout: 'border',
  24580. tbar: {
  24581. xtype: "form",
  24582. items: [
  24583. {
  24584. xtype: "cols",
  24585. items: [
  24586. {
  24587. xtype: "filefield",
  24588. fieldLabel: 'excel文件',
  24589. buttonText: '请选择excel文件',
  24590. accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
  24591. flex: 3,
  24592. listeners: {
  24593. change: "scope.fileChange"
  24594. }
  24595. }, {
  24596. xtype: "button",
  24597. iconCls: "x-fa fa-download",
  24598. text: "下载模版",
  24599. listeners: {
  24600. click: "scope.downloadTemplate"
  24601. }
  24602. }, {
  24603. xtype: 'container',
  24604. border: false,
  24605. layout: 'hbox',
  24606. }, {
  24607. xtype: "button",
  24608. iconCls: "x-fa fa-upload",
  24609. text: option.tQButtonText || "提取数据",
  24610. listeners: {
  24611. click: "scope.getData"
  24612. }
  24613. }
  24614. ]
  24615. },
  24616. ]
  24617. },
  24618. items: [
  24619. {
  24620. tbar: {
  24621. xtype: "toolbar",
  24622. title: "导入的数据",
  24623. items: [{
  24624. xtype: 'label',
  24625. html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
  24626. }, {
  24627. xtype: 'radiogroup',
  24628. items: [
  24629. {
  24630. boxLabel: '所有数据',
  24631. checked: true,
  24632. inputValue: 'allData',
  24633. }, {
  24634. boxLabel: '正确数据',
  24635. inputValue: 'okData',
  24636. }, {
  24637. boxLabel: '错误数据',
  24638. inputValue: 'errorData',
  24639. }
  24640. ],
  24641. listeners: {
  24642. change: 'scope.filterData',
  24643. },
  24644. }, {
  24645. xtype: "textfield",
  24646. readOnly: true,
  24647. fieldLabel: "条目数",
  24648. bind: "{dataCount}"
  24649. }]
  24650. },
  24651. xtype: 'yvgrid',
  24652. reference: 'dataGrid',
  24653. layout: 'fit',
  24654. pagination: false,
  24655. // pageSize: 50,
  24656. getRowClass: 'scope.getDataGridRowRecord',
  24657. columns: option.columns,
  24658. region: 'center',
  24659. split: true,
  24660. listeners: {
  24661. cellclick: "scope.dataGridClick",
  24662. },
  24663. selModel: {
  24664. // type: 'rowmodel',
  24665. mode: 'SINGLE',
  24666. },
  24667. }, {
  24668. tbar: {
  24669. xtype: "toolbar", items: [
  24670. {
  24671. xtype: 'label',
  24672. html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
  24673. }, {
  24674. xtype: "textfield",
  24675. readOnly: true,
  24676. fieldLabel: "条目数",
  24677. bind: "{errMsgCount}"
  24678. }
  24679. ]
  24680. },
  24681. xtype: 'yvgrid',
  24682. reference: 'errGrid',
  24683. layout: 'fit',
  24684. pagination: false,
  24685. getRowClass: 'scope.getErrGridRowRecord',
  24686. height: "40%",
  24687. columns: [
  24688. { dataIndex: "errorId", header: "ID", hidden: true },
  24689. { dataIndex: "importID", header: "行号", width: 80 },
  24690. { dataIndex: "errormessage", header: "错误信息", width: 200 },
  24691. { dataIndex: "value", header: "值", width: 120 },
  24692. { dataIndex: "header", header: "字段名", width: 120 },
  24693. { dataIndex: "dataIndex", header: "字段", width: 120 }
  24694. ],
  24695. region: 'south',
  24696. split: true,
  24697. listeners: {
  24698. itemclick: "scope.errGridClick"
  24699. },
  24700. selModel: {
  24701. // type: 'rowmodel',
  24702. mode: 'SINGLE',
  24703. },
  24704. },
  24705. ],
  24706. },
  24707. ],
  24708. referenceHolder: true,
  24709. };
  24710. };
  24711. function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
  24712. var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
  24713. var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
  24714. ret.report_id = reportId;
  24715. ret.report = report;
  24716. return ret;
  24717. }
  24718. function buildVjson$1(config, invokeServerFn, getDictFnName) {
  24719. var e_1, _a, e_2, _b;
  24720. var model = {
  24721. data: {
  24722. report_name: config.report_name,
  24723. query: {},
  24724. sum: {},
  24725. }
  24726. };
  24727. var json5 = window['YvanUI'].json5;
  24728. var report = config.report ? json5.parse(config.report) : {};
  24729. var conditionRows = [];
  24730. var sumRows = [];
  24731. model.data.has_sum = _$2.size(report.summary) > 0;
  24732. // query 查询条件
  24733. var newRow = false;
  24734. var currentRow = { xtype: 'cols', items: [], };
  24735. conditionRows.push(currentRow);
  24736. _$2.forEach(report.query, function (item) {
  24737. if (newRow) {
  24738. currentRow = { xtype: 'cols', items: [], };
  24739. conditionRows.push(currentRow);
  24740. }
  24741. var vj = json5.parse(item.conditionFieldExtend);
  24742. if (item.conditionFieldXtype) {
  24743. vj.xtype = item.conditionFieldXtype;
  24744. if (item.conditionFieldXtype === 'combo') {
  24745. vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
  24746. }
  24747. if (item.conditionFieldXtype === 'datetimefield') {
  24748. // console.log("#####", item)
  24749. if ((item === null || item === void 0 ? void 0 : item.conditionFieldBind) === "start_time") {
  24750. //@ts-ignore
  24751. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD 00:00:00'));
  24752. }
  24753. else if ((item === null || item === void 0 ? void 0 : item.conditionFieldBind) === "end_time") {
  24754. //@ts-ignore
  24755. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).add(1, 'days').format('YYYY-MM-DD 00:00:00'));
  24756. }
  24757. else {
  24758. //@ts-ignore
  24759. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD 00:00:00'));
  24760. }
  24761. }
  24762. else if (item.conditionFieldXtype === 'datefield') {
  24763. //@ts-ignore
  24764. _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
  24765. }
  24766. else {
  24767. model.data.query[item.conditionFieldBind] = '';
  24768. }
  24769. }
  24770. else {
  24771. // 没有组件类型,是个空占位符
  24772. vj.border = false;
  24773. }
  24774. if (item.conditionFieldBind) {
  24775. vj.bind = {
  24776. value: '{query.' + item.conditionFieldBind + '}'
  24777. };
  24778. }
  24779. if (item.conditionFieldFlex) {
  24780. vj.flex = item.conditionFieldFlex;
  24781. }
  24782. if (item.conditionFieldXtype) {
  24783. vj.fieldLabel = item.conditionFieldLabel;
  24784. }
  24785. if (item.fieldLabel) {
  24786. vj.fieldLabel = item.fieldLabel;
  24787. }
  24788. newRow = item.conditionFieldWrap || false;
  24789. currentRow.items.push(vj);
  24790. });
  24791. if (currentRow) {
  24792. currentRow.margin = '10 0 10 0';
  24793. }
  24794. // sum 汇总条件
  24795. newRow = true;
  24796. try {
  24797. for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
  24798. var item = _d.value;
  24799. if (newRow) {
  24800. currentRow = {
  24801. xtype: 'cols',
  24802. defaultType: 'displayfield',
  24803. defaults: {
  24804. labelWidth: 70,
  24805. },
  24806. items: []
  24807. };
  24808. sumRows.push(currentRow);
  24809. }
  24810. var vj = __assign({}, json5.parse(item.sumFieldExtend));
  24811. if (item.sumFieldBind) {
  24812. vj.bind = '{sum.' + item.sumFieldBind + '}';
  24813. model.data.sum[item.sumFieldBind] = '';
  24814. }
  24815. else {
  24816. // 没有组件类型,是个空占位符
  24817. vj.border = false;
  24818. }
  24819. if (item.sumFieldFlex) {
  24820. vj.flex = item.sumFieldFlex;
  24821. }
  24822. if (item.sumFieldLabel) {
  24823. vj.fieldLabel = item.sumFieldLabel;
  24824. }
  24825. // sumFieldBind: "zs"
  24826. // sumFieldExtend: "{}"
  24827. // sumFieldFlex: 1
  24828. // sumFieldLabel: "总数"
  24829. // sumFieldWrap: false
  24830. newRow = item.sumFieldWrap || false;
  24831. currentRow.items.push(vj);
  24832. }
  24833. }
  24834. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  24835. finally {
  24836. try {
  24837. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  24838. }
  24839. finally { if (e_1) throw e_1.error; }
  24840. }
  24841. if (currentRow) {
  24842. currentRow.margin = '10 0 10 0';
  24843. }
  24844. // column 结果字段
  24845. var columns = [];
  24846. try {
  24847. for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
  24848. var item = _f.value;
  24849. var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
  24850. if (item.xtype) {
  24851. if (item.xtype == 'checkbox') {
  24852. vj.xtype = 'checkcolumn';
  24853. vj.disabled = true;
  24854. }
  24855. else {
  24856. vj.xtype = item.xtype;
  24857. }
  24858. }
  24859. if (item.dataType) {
  24860. vj.dataType = item.dataType;
  24861. }
  24862. if (item.align) {
  24863. vj.align = item.align;
  24864. }
  24865. if (item.width) {
  24866. vj.width = item.width;
  24867. }
  24868. if (item.dict) {
  24869. vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
  24870. }
  24871. columns.push(vj);
  24872. }
  24873. }
  24874. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  24875. finally {
  24876. try {
  24877. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  24878. }
  24879. finally { if (e_2) throw e_2.error; }
  24880. }
  24881. var vjson = {
  24882. bind: {
  24883. title: '{report_name}',
  24884. },
  24885. layout: 'fit',
  24886. referenceHolder: true,
  24887. items: [
  24888. {
  24889. layout: 'border',
  24890. border: false,
  24891. items: [
  24892. {
  24893. region: 'north',
  24894. border: false,
  24895. tbar: {
  24896. xtype: 'toolbar',
  24897. border: false,
  24898. items: [
  24899. {
  24900. xtype: 'button',
  24901. text: '查询',
  24902. reference: 'btnSearch',
  24903. iconCls: 'x-fa fa-search',
  24904. listeners: {
  24905. click: 'scope.reload',
  24906. },
  24907. },
  24908. {
  24909. xtype: 'button',
  24910. text: '关闭',
  24911. iconCls: 'x-fa fa-times',
  24912. listeners: {
  24913. click: 'system.closeMe()',
  24914. },
  24915. },
  24916. ],
  24917. },
  24918. defaults: {
  24919. margin: '8 0 0 0'
  24920. },
  24921. items: __spread(conditionRows, sumRows),
  24922. fix: ['system.enterToClick("btnSearch")'],
  24923. },
  24924. __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
  24925. method: 'invoke',
  24926. url: '/report/Report@execute',
  24927. params: {
  24928. dataSource: report.dataSource,
  24929. pagination: report.grid.pagination || true,
  24930. report_id: config.report_id,
  24931. query: '{query}',
  24932. },
  24933. }, columns: columns }, report.grid),
  24934. ],
  24935. },
  24936. ],
  24937. };
  24938. return { model: model, vjson: vjson, report: report };
  24939. }
  24940. var ReportScope = /** @class */ (function (_super) {
  24941. __extends(ReportScope, _super);
  24942. function ReportScope(_a, invokeServerFn) {
  24943. var model = _a.model, vjson = _a.vjson;
  24944. var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this;
  24945. _this.invokeServerFn = invokeServerFn;
  24946. return _this;
  24947. }
  24948. ReportScope.prototype.onLoad = function () {
  24949. // this.reload()
  24950. };
  24951. ReportScope.prototype.reload = function () {
  24952. var _this = this;
  24953. // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
  24954. if (this.viewModel.get('has_sum')) {
  24955. this.invokeServerFn('/report/Report@executeSum', {
  24956. dataSource: this.report.dataSource,
  24957. report_id: this.report_id,
  24958. query: this.viewModel.get('query'),
  24959. }).then(function (res) {
  24960. if (!res.success) {
  24961. showErrorDialog$1(res.msg);
  24962. }
  24963. else {
  24964. window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
  24965. }
  24966. });
  24967. }
  24968. this.refs.grid1.reload();
  24969. };
  24970. return ReportScope;
  24971. }(Scope));
  24972. var model$e = {
  24973. data: {
  24974. form: {
  24975. resource_parent: '',
  24976. resource_name: '',
  24977. resource_icon: '',
  24978. scope_url: '',
  24979. scope_params: '',
  24980. resource_order: '',
  24981. permission_code: '',
  24982. },
  24983. }
  24984. };
  24985. var vjson$d = {
  24986. title: '注册模块',
  24987. layout: 'fit',
  24988. width: "40%",
  24989. height: "50%",
  24990. fbar: {
  24991. xtype: 'toolbar',
  24992. items: [
  24993. {
  24994. xtype: "button",
  24995. text: "确定",
  24996. iconCls: 'x-fa fa-check',
  24997. listeners: {
  24998. click: 'scope.saveNode',
  24999. }
  25000. },
  25001. {
  25002. xtype: "button",
  25003. text: "关闭",
  25004. iconCls: 'x-fa fa-times',
  25005. listeners: {
  25006. click: 'system.closeMe()',
  25007. }
  25008. },
  25009. ]
  25010. },
  25011. items: [
  25012. {
  25013. layout: 'border',
  25014. items: [
  25015. {
  25016. region: 'west',
  25017. layout: 'fit',
  25018. xtype: 'tabpanel',
  25019. reference: 'tabs',
  25020. width: "50%",
  25021. split: true,
  25022. listeners: {
  25023. tabchange: 'scope.tabchange',
  25024. },
  25025. items: [
  25026. {
  25027. region: 'center',
  25028. layout: 'fit',
  25029. title: 'PC菜单',
  25030. key: "1",
  25031. items: [
  25032. {
  25033. xtype: 'treepanel',
  25034. layout: 'fit',
  25035. region: 'west',
  25036. rootVisible: false,
  25037. useArrows: true,
  25038. reference: 'tree1',
  25039. listeners: {
  25040. itemclick: "scope.tree1NodeClick",
  25041. }
  25042. },
  25043. ]
  25044. },
  25045. {
  25046. region: 'center',
  25047. layout: 'fit',
  25048. title: 'PDA菜单',
  25049. key: "2",
  25050. items: [
  25051. {
  25052. xtype: 'treepanel',
  25053. layout: 'fit',
  25054. region: 'west',
  25055. reference: 'tree2',
  25056. rootVisible: false,
  25057. useArrows: true,
  25058. listeners: {
  25059. itemclick: "scope.tree1NodeClick",
  25060. }
  25061. },
  25062. ]
  25063. },
  25064. ]
  25065. },
  25066. {
  25067. region: 'center',
  25068. xtype: 'form',
  25069. margin: '0 0 0 0',
  25070. split: true,
  25071. width: '50%',
  25072. items: [
  25073. {
  25074. xtype: 'cols',
  25075. items: [
  25076. {
  25077. xtype: 'textfield',
  25078. fieldLabel: '上级资源ID',
  25079. bind: {
  25080. readOnly: true,
  25081. disabled: true,
  25082. value: '{form.resource_parent}'
  25083. },
  25084. },
  25085. ],
  25086. },
  25087. {
  25088. xtype: 'cols',
  25089. items: [
  25090. {
  25091. xtype: 'textfield',
  25092. fieldLabel: '资源名称',
  25093. bind: {
  25094. value: '{form.resource_name}'
  25095. },
  25096. allowBlank: false,
  25097. },
  25098. ],
  25099. },
  25100. {
  25101. xtype: 'cols',
  25102. items: [
  25103. {
  25104. xtype: 'numberfield',
  25105. fieldLabel: '资源排序',
  25106. bind: {
  25107. value: '{form.resource_order}'
  25108. },
  25109. allowBlank: false,
  25110. },
  25111. ],
  25112. },
  25113. {
  25114. xtype: 'cols',
  25115. items: [
  25116. {
  25117. xtype: 'textfield',
  25118. fieldLabel: '功能URL',
  25119. bind: {
  25120. disabled: true,
  25121. value: '{form.scope_url}'
  25122. },
  25123. },
  25124. ]
  25125. },
  25126. {
  25127. xtype: 'cols',
  25128. items: [
  25129. {
  25130. xtype: 'textfield',
  25131. fieldLabel: '权限编码',
  25132. bind: {
  25133. value: '{form.permission_code}'
  25134. }
  25135. },
  25136. ],
  25137. },
  25138. {
  25139. xtype: 'cols',
  25140. items: [
  25141. {
  25142. xtype: 'textfield',
  25143. fieldLabel: '功能参数',
  25144. bind: {
  25145. value: '{form.scope_params}'
  25146. }
  25147. },
  25148. ],
  25149. },
  25150. ],
  25151. },
  25152. ],
  25153. },
  25154. ],
  25155. referenceHolder: true,
  25156. };
  25157. var RegisterModule = /** @class */ (function (_super) {
  25158. __extends(RegisterModule, _super);
  25159. function RegisterModule() {
  25160. return _super.call(this, { model: model$e, vjson: vjson$d }) || this;
  25161. }
  25162. RegisterModule.prototype.onLoad = function () {
  25163. this.reloadTree("PC");
  25164. };
  25165. RegisterModule.prototype.tabchange = function (a, b, c, d) {
  25166. var currTabKey = b.key;
  25167. if (currTabKey === '1') {
  25168. this.viewModel.set('form', '');
  25169. this.reloadTree("PC");
  25170. }
  25171. else {
  25172. this.viewModel.set('form', '');
  25173. this.reloadTree("PDA");
  25174. }
  25175. };
  25176. RegisterModule.prototype.reloadTree = function (type) {
  25177. var _this = this;
  25178. if ("PC" === type) {
  25179. this.setLoading(true);
  25180. getMenuTree({ type: "PC" }).then(function (res) {
  25181. if (res.success) {
  25182. _this.refs.tree1.store.setRootNode({
  25183. expanded: true,
  25184. children: res.data
  25185. });
  25186. }
  25187. }).finally(function () {
  25188. _this.setLoading(false);
  25189. });
  25190. }
  25191. else {
  25192. this.setLoading(true);
  25193. getMenuTree({ type: "PDA" }).then(function (res) {
  25194. if (res.success) {
  25195. _this.refs.tree2.store.setRoot({
  25196. expanded: true,
  25197. children: res.data
  25198. });
  25199. }
  25200. }).finally(function () {
  25201. _this.setLoading(false);
  25202. });
  25203. }
  25204. };
  25205. RegisterModule.prototype.tree1NodeClick = function (tree, node) {
  25206. var id = _$2.split(node.data.id, '_')[1];
  25207. if (!id) {
  25208. return;
  25209. }
  25210. this.viewModel.set('form.resource_parent', id);
  25211. };
  25212. RegisterModule.prototype.saveNode = function () {
  25213. var _this = this;
  25214. var tabKey = this.refs.tabs.activeTab.key;
  25215. // 检验菜单数据
  25216. var param = this.viewModel.get('form');
  25217. if (!param.resource_parent) {
  25218. msg('请选择一个父节点');
  25219. return;
  25220. }
  25221. if (!param.resource_name) {
  25222. msg('资源名称不能为空');
  25223. return;
  25224. }
  25225. if (!param.scope_url) {
  25226. msg('功能URL不能为空');
  25227. return;
  25228. }
  25229. var type;
  25230. if (tabKey === '1') {
  25231. type = 'PC';
  25232. }
  25233. else {
  25234. type = 'PDA';
  25235. }
  25236. this.setLoading(true);
  25237. registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
  25238. if (res.success) {
  25239. msg("注册成功");
  25240. _this.close();
  25241. }
  25242. }).finally(function () {
  25243. _this.setLoading(false);
  25244. });
  25245. };
  25246. return RegisterModule;
  25247. }(Scope));
  25248. var model$f = {
  25249. data: {
  25250. title: "模板选择",
  25251. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
  25252. moduleType: 1,
  25253. // 当前模块包路径 "com/galaxis/wms/bas/area"
  25254. packagePath: "",
  25255. // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
  25256. fileSavePath: "",
  25257. // 模块名称 "Dict"
  25258. moduleName: "NewModule",
  25259. // 页面标题 "字典维护"
  25260. pageTitle: "新模块",
  25261. // 单表查询
  25262. singleTable: {
  25263. sql: "select * from bas_dict",
  25264. // 新增或者删除所用的表
  25265. tableName: "",
  25266. // 是否分页查询
  25267. pagination: true,
  25268. // 是否需要删除
  25269. delete: true,
  25270. // 删除条件字段
  25271. deleteWhereColumn: "",
  25272. // 删除提示语
  25273. deleteTips: "确定要删除?",
  25274. // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
  25275. editType: 2,
  25276. },
  25277. singleTableView: {
  25278. tableNameList: [
  25279. // { value: "aaa"},
  25280. ],
  25281. columnList: [
  25282. // { value: "aaa"},
  25283. ],
  25284. }
  25285. }
  25286. };
  25287. var vjson$e = {
  25288. bind: {
  25289. title: '新建模块-{title}',
  25290. },
  25291. width: "55%",
  25292. height: "60%",
  25293. minWidth: 500,
  25294. minHeight: 400,
  25295. modal: true,
  25296. frame: true,
  25297. layout: 'card',
  25298. bbar: [
  25299. '->',
  25300. {
  25301. itemId: 'card-prev',
  25302. text: '&laquo; 上一步',
  25303. disabled: true,
  25304. listeners: {
  25305. click: 'scope.showPrevious',
  25306. },
  25307. },
  25308. {
  25309. itemId: 'card-next',
  25310. text: '下一步 &raquo;',
  25311. listeners: {
  25312. click: 'scope.showNext',
  25313. },
  25314. },
  25315. {
  25316. itemId: 'card-finish',
  25317. text: '立刻执行',
  25318. iconCls: 'x-fa fa-flash',
  25319. hidden: true,
  25320. listeners: {
  25321. click: 'scope.finish',
  25322. },
  25323. },
  25324. ],
  25325. items: [
  25326. {
  25327. vtitle: '模板选择',
  25328. reference: 'templateSelection',
  25329. layout: {
  25330. type: 'hbox',
  25331. pack: 'start',
  25332. align: 'stretch'
  25333. },
  25334. listeners: {
  25335. cardEnter: 'scope.templateEnter',
  25336. cardLevel: 'scope.templateLevel'
  25337. },
  25338. items: [
  25339. {
  25340. width: 150,
  25341. xtype: 'form',
  25342. border: false,
  25343. layout: {
  25344. type: 'vbox',
  25345. align: 'stretch'
  25346. },
  25347. defaults: {
  25348. border: false,
  25349. anchor: '100%',
  25350. margin: '5',
  25351. },
  25352. items: [
  25353. {
  25354. xtype: 'radiogroup',
  25355. bind: {
  25356. value: '{moduleType}'
  25357. },
  25358. layout: 'vbox',
  25359. defaults: {
  25360. border: false,
  25361. anchor: '100%',
  25362. margin: '5',
  25363. },
  25364. items: [
  25365. { boxLabel: '单表查询', inputValue: 1 },
  25366. { boxLabel: '主/明细查询', inputValue: 2 },
  25367. { boxLabel: '树/明细查询', inputValue: 3 },
  25368. { boxLabel: '卡片表单', inputValue: 4 },
  25369. { boxLabel: '主/详情查询', inputValue: 5 },
  25370. ]
  25371. },
  25372. ]
  25373. },
  25374. {
  25375. flex: 1,
  25376. region: 'center',
  25377. xtype: "panel",
  25378. border: false,
  25379. frame: true,
  25380. padding: "4px 8px",
  25381. html: "描述...",
  25382. }
  25383. ]
  25384. },
  25385. {
  25386. vtitle: '模块名称',
  25387. reference: 'moduleName',
  25388. layout: 'fit',
  25389. listeners: {
  25390. cardEnter: 'scope.moduleEnter',
  25391. cardLevel: 'scope.moduleLevel'
  25392. },
  25393. items: [
  25394. {
  25395. xtype: 'form',
  25396. border: false,
  25397. layout: {
  25398. type: 'vbox',
  25399. align: 'stretch'
  25400. },
  25401. defaults: {
  25402. border: false,
  25403. anchor: '100%',
  25404. margin: '5',
  25405. },
  25406. items: [
  25407. {
  25408. xtype: 'textfield',
  25409. fieldLabel: '包路径',
  25410. allowBlank: false,
  25411. bind: { value: '{packagePath}' },
  25412. },
  25413. {
  25414. xtype: 'textfield',
  25415. fieldLabel: '文件路径',
  25416. allowBlank: false,
  25417. bind: { value: '{fileSavePath}' },
  25418. },
  25419. {
  25420. xtype: 'textfield',
  25421. fieldLabel: '模块名',
  25422. allowBlank: false,
  25423. bind: { value: '{moduleName}' },
  25424. },
  25425. {
  25426. xtype: 'textfield',
  25427. fieldLabel: '菜单名',
  25428. allowBlank: false,
  25429. bind: { value: '{pageTitle}' },
  25430. },
  25431. ]
  25432. },
  25433. ]
  25434. },
  25435. {
  25436. vtitle: '确认结果',
  25437. reference: 'confirmResult',
  25438. layout: 'fit',
  25439. listeners: {
  25440. cardEnter: 'scope.optionEnter',
  25441. cardLevel: 'scope.optionLevel',
  25442. },
  25443. items: [
  25444. {
  25445. xtype: 'jsoneditor',
  25446. reference: 'jsoneditor'
  25447. }
  25448. ]
  25449. },
  25450. // ---------------------------------------------------------------------------------- 单表查询
  25451. {
  25452. vtitle: '查询SQL',
  25453. reference: 'singleTable_1',
  25454. layout: 'fit',
  25455. listeners: {
  25456. cardEnter: 'scope.editorEnter',
  25457. cardLevel: 'scope.editorLevel'
  25458. },
  25459. items: [
  25460. {
  25461. xtype: 'sqleditor',
  25462. }
  25463. ],
  25464. },
  25465. {
  25466. vtitle: '字段选项',
  25467. reference: 'singleTable_2',
  25468. layout: 'fit',
  25469. listeners: {
  25470. cardEnter: 'scope.columnEnter',
  25471. cardLevel: 'scope.columnLevel',
  25472. },
  25473. items: [
  25474. {
  25475. xtype: 'yvgrid',
  25476. border: false,
  25477. selModel: {
  25478. type: 'spreadsheet',
  25479. columnSelect: true,
  25480. pruneRemoved: false,
  25481. extensible: 'y'
  25482. },
  25483. plugins: {
  25484. clipboard: true,
  25485. selectionreplicator: true
  25486. },
  25487. reference: 'grid1',
  25488. idField: 'column_name',
  25489. hideFootbar: true,
  25490. tbar: {
  25491. xtype: 'toolbar',
  25492. items: [
  25493. {
  25494. xtype: 'button',
  25495. text: '添加',
  25496. iconCls: 'x-fa fa-plus-circle',
  25497. listeners: {
  25498. click: 'scope.addField'
  25499. }
  25500. },
  25501. {
  25502. xtype: 'button',
  25503. text: '删除',
  25504. iconCls: 'x-fa fa-minus-circle',
  25505. listeners: {
  25506. click: 'scope.removeField'
  25507. }
  25508. },
  25509. {
  25510. xtype: 'button',
  25511. text: '分析SQL',
  25512. iconCls: 'x-fa fa-refresh',
  25513. listeners: {
  25514. click: 'scope.parseSQL'
  25515. }
  25516. },
  25517. ]
  25518. },
  25519. columns: [
  25520. {
  25521. text: '字段名', dataIndex: 'column_name',
  25522. sortable: false,
  25523. menuDisabled: true,
  25524. width: 150,
  25525. editor: {
  25526. allowBlank: true,
  25527. selectOnFocus: false,
  25528. }
  25529. },
  25530. {
  25531. text: '字段中文', dataIndex: 'column_comment',
  25532. width: 150,
  25533. sortable: false,
  25534. menuDisabled: true,
  25535. editor: {
  25536. allowBlank: true,
  25537. selectOnFocus: false,
  25538. }
  25539. },
  25540. {
  25541. dataIndex: "column_useto",
  25542. // fix: ['system.getDict("column_useto")'],
  25543. header: "用途",
  25544. editor: {
  25545. xtype: 'combo',
  25546. allowBlank: false,
  25547. },
  25548. },
  25549. {
  25550. text: '主键', dataIndex: 'is_primary_key',
  25551. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25552. width: 48, resizable: false,
  25553. },
  25554. {
  25555. text: '必填', dataIndex: 'not_null',
  25556. xtype: 'checkcolumn', sortable: false, menuDisabled: true,
  25557. width: 48, resizable: false,
  25558. },
  25559. {
  25560. text: '长度', dataIndex: 'column_size',
  25561. sortable: false, menuDisabled: true,
  25562. xtype: 'numbercolumn', format: '0',
  25563. editor: { allowBlank: true, selectOnFocus: true }
  25564. },
  25565. {
  25566. text: '字典', dataIndex: 'column_dict',
  25567. sortable: false, menuDisabled: true,
  25568. width: 200,
  25569. editor: {
  25570. allowBlank: true,
  25571. }
  25572. },
  25573. {
  25574. text: 'UI组件', dataIndex: 'column_ui',
  25575. sortable: false, menuDisabled: true,
  25576. // fix: ['system.getDict("column_ui")'],
  25577. width: 150,
  25578. editor: {
  25579. xtype: 'combo',
  25580. allowBlank: true,
  25581. }
  25582. },
  25583. {
  25584. dataIndex: 'data_type',
  25585. hidden: true,
  25586. },
  25587. ]
  25588. }
  25589. ],
  25590. },
  25591. {
  25592. vtitle: '其他选项',
  25593. reference: 'singleTable_3',
  25594. isEnd: true,
  25595. listeners: {
  25596. cardEnter: 'scope.extendEnter',
  25597. cardLevel: 'scope.extendLevel',
  25598. },
  25599. layout: 'fit',
  25600. items: [
  25601. {
  25602. xtype: 'form',
  25603. border: false,
  25604. layout: {
  25605. type: 'vbox',
  25606. align: 'stretch'
  25607. },
  25608. defaults: {
  25609. border: false,
  25610. anchor: '100%',
  25611. margin: '5',
  25612. },
  25613. items: [
  25614. {
  25615. xtype: 'checkbox',
  25616. fieldLabel: '需要分页',
  25617. labelWidth: 100,
  25618. bind: {
  25619. value: '{singleTable.pagination}',
  25620. },
  25621. },
  25622. {
  25623. xtype: 'combobox',
  25624. fieldLabel: '操作数据库表',
  25625. labelWidth: 100,
  25626. publishes: 'singleTable.tableName',
  25627. displayField: 'value',
  25628. valueField: 'value',
  25629. bind: {
  25630. data: '{singleTableView.tableNameList}',
  25631. value: '{singleTable.tableName}',
  25632. },
  25633. },
  25634. {
  25635. xtype: 'checkboxfield',
  25636. fieldLabel: '需要删除',
  25637. labelWidth: 100,
  25638. bind: {
  25639. value: '{singleTable.delete}',
  25640. },
  25641. },
  25642. {
  25643. xtype: 'combobox',
  25644. fieldLabel: '删除条件字段',
  25645. labelWidth: 100,
  25646. publishes: 'singleTable.deleteWhereColumn',
  25647. displayField: 'value',
  25648. valueField: 'value',
  25649. bind: {
  25650. data: '{singleTableView.columnList}',
  25651. hidden: '{!singleTable.delete}',
  25652. value: '{singleTable.deleteWhereColumn}',
  25653. },
  25654. },
  25655. {
  25656. xtype: 'textfield',
  25657. fieldLabel: '删除提示语句',
  25658. labelWidth: 100,
  25659. bind: {
  25660. hidden: '{!singleTable.delete}',
  25661. value: '{singleTable.deleteTips}',
  25662. },
  25663. },
  25664. {
  25665. fieldLabel: '新增与编辑',
  25666. labelWidth: 100,
  25667. xtype: 'radiogroup',
  25668. bind: {
  25669. value: '{singleTable.editType}'
  25670. },
  25671. layout: 'vbox',
  25672. defaults: {
  25673. border: false,
  25674. anchor: '100%',
  25675. margin: '5',
  25676. },
  25677. items: [
  25678. { boxLabel: '不要新增和编辑', inputValue: 1 },
  25679. { boxLabel: '表格内新增/编辑', inputValue: 2 },
  25680. { boxLabel: '对话框新增/编辑', inputValue: 3 },
  25681. ]
  25682. },
  25683. ]
  25684. }
  25685. ]
  25686. },
  25687. // ---------------------------------------------------------------------------------- 主/明细查询
  25688. {
  25689. vtitle: '主表查询SQL',
  25690. reference: 'mainDetailTable_1',
  25691. layout: 'fit',
  25692. listeners: {},
  25693. items: [],
  25694. },
  25695. {
  25696. vtitle: '主表字段选项',
  25697. reference: 'mainDetailTable_2',
  25698. layout: 'fit',
  25699. listeners: {},
  25700. items: [],
  25701. },
  25702. {
  25703. vtitle: '主表其他选项',
  25704. reference: 'mainDetailTable_3',
  25705. layout: 'fit',
  25706. listeners: {},
  25707. items: [],
  25708. },
  25709. {
  25710. vtitle: '子表查询SQL',
  25711. reference: 'mainDetailTable_4',
  25712. layout: 'fit',
  25713. listeners: {},
  25714. items: [],
  25715. },
  25716. {
  25717. vtitle: '子表字段选项',
  25718. reference: 'mainDetailTable_5',
  25719. layout: 'fit',
  25720. listeners: {},
  25721. items: [],
  25722. },
  25723. {
  25724. vtitle: '子表其他选项',
  25725. reference: 'mainDetailTable_6',
  25726. isEnd: true,
  25727. layout: 'fit',
  25728. listeners: {},
  25729. items: [],
  25730. },
  25731. // ---------------------------------------------------------------------------------- 树/明细查询
  25732. // ---------------------------------------------------------------------------------- 卡片表单
  25733. {
  25734. vtitle: '表单字段',
  25735. reference: 'cardForm_1',
  25736. layout: 'fit',
  25737. listeners: {},
  25738. items: [],
  25739. },
  25740. {
  25741. vtitle: '表单初始化',
  25742. reference: 'cardForm_2',
  25743. isEnd: true,
  25744. layout: 'fit',
  25745. listeners: {},
  25746. items: [],
  25747. },
  25748. ]
  25749. };
  25750. // noinspection TypeScriptCheckImport
  25751. function getSingleTableData(origin) {
  25752. return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
  25753. var _a, _b, _c;
  25754. var data = {
  25755. pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
  25756. package: _$2.replace(origin.packagePath, /\//g, "."),
  25757. groovyClass: origin.moduleName,
  25758. qClass: queryDslInfo.qClass,
  25759. qClassTable: queryDslInfo.qClassTable,
  25760. queryColumns: [],
  25761. insertColumns: [],
  25762. updateColumns: [],
  25763. updateWheres: [],
  25764. deleteWheres: [],
  25765. gridColumns: [],
  25766. sql: origin.sql,
  25767. pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
  25768. addButton: origin.editType !== 1,
  25769. saveButton: origin.editType === 2,
  25770. deleteButton: true,
  25771. deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
  25772. invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
  25773. fileSavePath: origin.fileSavePath,
  25774. };
  25775. origin.columnList.forEach(function (column) {
  25776. 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;
  25777. var query = origin.queryColumns.indexOf(column_name) >= 0;
  25778. var insert = origin.insertColumns.indexOf(column_name) >= 0;
  25779. var update = origin.updateColumns.indexOf(column_name) >= 0;
  25780. var grid = origin.gridColumns.indexOf(column_name) >= 0;
  25781. var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
  25782. var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
  25783. if (query) {
  25784. data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
  25785. }
  25786. if (insert) {
  25787. data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
  25788. }
  25789. if (update) {
  25790. data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
  25791. }
  25792. if (grid) {
  25793. var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
  25794. if (column_dict) {
  25795. gridColumn.fix = { dictName: column_dict };
  25796. }
  25797. if (origin.editType == 2 && (insert || update)) {
  25798. gridColumn.editor = { xtype: column_ui, fix: undefined };
  25799. if (column_dict) {
  25800. gridColumn.editor.fix = { dictName: column_dict };
  25801. }
  25802. }
  25803. data.gridColumns.push(gridColumn);
  25804. }
  25805. if (is_primary_key) {
  25806. data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25807. data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
  25808. }
  25809. });
  25810. return data;
  25811. });
  25812. }
  25813. // noinspection HttpUrlsUsage
  25814. var urlPrefix = "/static/studio-template/single_table";
  25815. function generateCode(data) {
  25816. return Promise.all([
  25817. request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
  25818. request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
  25819. request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
  25820. request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
  25821. request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
  25822. ]).then(function (values) {
  25823. var groovy = handlebars.compile(values[0]);
  25824. var mybatis = handlebars.compile(values[1]);
  25825. var controller = handlebars.compile(values[2]);
  25826. var view = handlebars.compile(values[3]);
  25827. var model = handlebars.compile(values[4]);
  25828. var code = {
  25829. groovy: groovy(data),
  25830. mybatis: mybatis(data),
  25831. controller: controller(data),
  25832. view: view(data),
  25833. model: model(data),
  25834. };
  25835. return code;
  25836. });
  25837. }
  25838. var CreateModule = /** @class */ (function (_super) {
  25839. __extends(CreateModule, _super);
  25840. function CreateModule() {
  25841. var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this;
  25842. _this.columns = [];
  25843. return _this;
  25844. }
  25845. CreateModule.prototype.onLoad = function () {
  25846. this.refs.grid1.setData([]);
  25847. };
  25848. CreateModule.prototype.addField = function () {
  25849. this.refs.grid1.appendEditRow({
  25850. column_name: '',
  25851. column_comment: '',
  25852. is_primary_key: false,
  25853. not_null: true,
  25854. column_domain: '',
  25855. data_type: '',
  25856. column_size: 0,
  25857. decimal_digits: 0,
  25858. default_value: '',
  25859. column_dict: '',
  25860. column_ui: '',
  25861. column_note: '',
  25862. }, 0);
  25863. };
  25864. CreateModule.prototype.removeField = function () {
  25865. var _this = this;
  25866. var rows = [];
  25867. this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
  25868. rows.push(r);
  25869. });
  25870. _$2.forEach(rows, function (r) {
  25871. _this.refs.grid1.getStore().remove(r);
  25872. });
  25873. };
  25874. CreateModule.prototype.parseSQL = function (sender) {
  25875. var _this = this;
  25876. var sql = this.viewModel.get('singleTable.sql');
  25877. sender.up('window').setLoading(true);
  25878. instance$1.reloadIfNeedPromise(undefined).then(function (res) {
  25879. parseSqlApi(sql).then(function (parseResult) {
  25880. if (!parseResult.success) {
  25881. msg(parseResult.msg);
  25882. return;
  25883. }
  25884. var tableNameList = [];
  25885. var columnList = [];
  25886. var singleTableTableName;
  25887. var singleTableDeleteWhereColumn;
  25888. _this.refs.grid1.setData([]);
  25889. var rows = _this.refs.grid1.getDataRows();
  25890. _$2.forEach(parseResult.data, function (parseRetColumn) {
  25891. var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
  25892. if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
  25893. return;
  25894. }
  25895. if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
  25896. tableNameList.push({ value: tableName });
  25897. if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
  25898. columnList.push({ value: columnName });
  25899. if (!singleTableTableName)
  25900. singleTableTableName = tableName;
  25901. if (!singleTableDeleteWhereColumn)
  25902. singleTableDeleteWhereColumn = columnName;
  25903. // 已经加过这个列了
  25904. var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
  25905. if (rowExists) {
  25906. return;
  25907. }
  25908. var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName);
  25909. if (columnRow) {
  25910. _this.refs.grid1.appendEditRow({
  25911. table_name: tableName,
  25912. column_name: columnRow.column_name,
  25913. column_comment: columnRow.column_comment,
  25914. column_useto: 2,
  25915. is_primary_key: columnRow.is_primary_key,
  25916. not_null: columnRow.not_null,
  25917. column_size: columnRow.column_size,
  25918. column_dict: columnRow.column_dict,
  25919. column_ui: columnRow.column_ui,
  25920. data_type: columnRow.data_type,
  25921. });
  25922. if (columnRow.is_primary_key)
  25923. singleTableDeleteWhereColumn = columnName;
  25924. }
  25925. else {
  25926. _this.refs.grid1.appendEditRow({
  25927. table_name: tableName,
  25928. column_name: columnName,
  25929. column_useto: 2,
  25930. });
  25931. }
  25932. });
  25933. _this.viewModel.set("singleTableView.columnList", columnList);
  25934. _this.viewModel.set("singleTableView.tableNameList", tableNameList);
  25935. _this.viewModel.set("singleTable.tableName", singleTableTableName);
  25936. _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
  25937. }).finally(function () {
  25938. sender.up('window').setLoading(false);
  25939. });
  25940. }).catch(function () {
  25941. sender.up('window').setLoading(false);
  25942. });
  25943. };
  25944. CreateModule.prototype.templateEnter = function (sender) {
  25945. };
  25946. CreateModule.prototype.templateLevel = function (sender, opt) {
  25947. if (!this.viewModel.get('moduleType')) {
  25948. msg('请选择模板类型');
  25949. opt.cancel = true;
  25950. return;
  25951. }
  25952. };
  25953. CreateModule.prototype.moduleEnter = function (sender) {
  25954. };
  25955. CreateModule.prototype.moduleLevel = function (sender, opt) {
  25956. if (!sender.down('form').isValid()) {
  25957. opt.cancel = true;
  25958. return;
  25959. }
  25960. };
  25961. CreateModule.prototype.editorEnter = function (sender) {
  25962. var editor = sender.down('sqleditor');
  25963. editor.setValue(this.viewModel.get('singleTable.sql'));
  25964. };
  25965. CreateModule.prototype.editorLevel = function (sender, opt) {
  25966. var editor = sender.down('sqleditor');
  25967. var sql = editor.getValue();
  25968. if (!sql) {
  25969. msg('查询SQL语句必填');
  25970. opt.cancel = true;
  25971. return;
  25972. }
  25973. this.viewModel.set('singleTable.sql', sql);
  25974. };
  25975. CreateModule.prototype.columnEnter = function (sender) {
  25976. };
  25977. CreateModule.prototype.columnLevel = function (sender, opt) {
  25978. };
  25979. CreateModule.prototype.extendEnter = function (sender) {
  25980. };
  25981. CreateModule.prototype.extendLevel = function (sender, opt) {
  25982. };
  25983. // 确认结果 - Enter
  25984. CreateModule.prototype.optionEnter = function (sender) {
  25985. var _this = this;
  25986. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  25987. var moduleType = this.viewModel.get("moduleType");
  25988. var data = this.viewModel.getData();
  25989. var code = "";
  25990. var origin = {};
  25991. if (moduleType === 1) {
  25992. var singleTable = data.singleTable;
  25993. var editColumns = this.refs.grid1.getDataRows();
  25994. origin.moduleType = data.moduleType;
  25995. origin.packagePath = data.packagePath;
  25996. origin.fileSavePath = data.fileSavePath;
  25997. origin.moduleName = data.moduleName;
  25998. origin.pageTitle = data.pageTitle;
  25999. if (singleTable) {
  26000. origin.sql = singleTable.sql;
  26001. origin.tableName = singleTable.tableName;
  26002. origin.pagination = singleTable.pagination;
  26003. origin.delete = singleTable.delete;
  26004. origin.deleteWhereColumn = singleTable.deleteWhereColumn;
  26005. origin.deleteTips = singleTable.deleteTips;
  26006. origin.editType = singleTable.editType;
  26007. }
  26008. origin.columnList = [];
  26009. origin.queryColumns = [];
  26010. origin.insertColumns = [];
  26011. origin.updateColumns = [];
  26012. origin.gridColumns = [];
  26013. editColumns.forEach(function (column) {
  26014. var row = {
  26015. table_name: column.table_name,
  26016. column_name: column.column_name,
  26017. column_comment: column.column_comment,
  26018. is_primary_key: column.is_primary_key,
  26019. not_null: column.not_null,
  26020. column_size: column.column_size,
  26021. column_dict: column.column_dict,
  26022. column_ui: column.column_ui,
  26023. data_type: column.data_type,
  26024. column_type: column.column_type,
  26025. };
  26026. origin.columnList.push(row);
  26027. // 1:查询条件; 2:查询结果; 3:条件+结果;
  26028. var column_name = column.column_name, column_useto = column.column_useto;
  26029. switch (column_useto) {
  26030. case 1:
  26031. origin.queryColumns.push(column_name);
  26032. break;
  26033. case 2:
  26034. origin.gridColumns.push(column_name);
  26035. break;
  26036. case 3:
  26037. origin.queryColumns.push(column_name);
  26038. origin.gridColumns.push(column_name);
  26039. break;
  26040. }
  26041. origin.insertColumns.push(column_name);
  26042. origin.updateColumns.push(column_name);
  26043. });
  26044. }
  26045. this.setLoading(true);
  26046. getSingleTableData(origin).then(function (data) {
  26047. code = JSON.stringify(data, null, 4);
  26048. window['lastTemplateData'] = code;
  26049. var editor = _this.refs.jsoneditor;
  26050. editor.setCode(code);
  26051. }).finally(function () { return _this.setLoading(false); });
  26052. };
  26053. // 确认结果 - Level
  26054. CreateModule.prototype.optionLevel = function (sender, opt) {
  26055. };
  26056. // 上一步
  26057. CreateModule.prototype.showPrevious = function () {
  26058. this.doCardNavigation(false);
  26059. };
  26060. // 下一步
  26061. CreateModule.prototype.showNext = function () {
  26062. this.doCardNavigation(true, true);
  26063. };
  26064. CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
  26065. if (isNext === void 0) { isNext = true; }
  26066. if (isCancelable === void 0) { isCancelable = false; }
  26067. var layout = this._handle.getLayout();
  26068. var activeItem = layout.activeItem;
  26069. var reference = activeItem.reference, isEnd = activeItem.isEnd;
  26070. if (isNext)
  26071. this.prevCard = reference;
  26072. var activeCard;
  26073. if (reference === "templateSelection") {
  26074. if (isNext) {
  26075. activeCard = this.refs['moduleName'];
  26076. }
  26077. }
  26078. else if (reference === "moduleName") {
  26079. if (isNext) {
  26080. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  26081. var moduleType = this.viewModel.get("moduleType");
  26082. switch (moduleType) {
  26083. case 1:
  26084. activeCard = this.refs['singleTable_1'];
  26085. break;
  26086. case 2:
  26087. activeCard = this.refs['mainDetailTable_1'];
  26088. break;
  26089. case 3:
  26090. // activeCard =
  26091. break;
  26092. case 4:
  26093. activeCard = this.refs['cardForm_1'];
  26094. break;
  26095. }
  26096. }
  26097. else {
  26098. activeCard = this.refs['templateSelection'];
  26099. }
  26100. }
  26101. else if (reference === "confirmResult") {
  26102. if (!isNext) {
  26103. activeCard = this.refs[this.prevCard];
  26104. }
  26105. }
  26106. else {
  26107. var name = reference.split('_')[0];
  26108. var idx = parseInt(reference.split('_')[1], 10);
  26109. if (isNext) {
  26110. if (isEnd) {
  26111. activeCard = this.refs['confirmResult'];
  26112. }
  26113. else {
  26114. idx += 1;
  26115. }
  26116. }
  26117. else {
  26118. idx -= 1;
  26119. }
  26120. if (idx <= 0) {
  26121. activeCard = this.refs['moduleName'];
  26122. }
  26123. else if (!activeCard) {
  26124. activeCard = this.refs[name + "_" + idx];
  26125. }
  26126. }
  26127. // 按钮状态
  26128. this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
  26129. this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
  26130. this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
  26131. // 设置下一页显示
  26132. if (activeCard) {
  26133. var optCancel = { cancel: false };
  26134. // 发出 cardLevel 事件
  26135. layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
  26136. if (isCancelable && optCancel.cancel) {
  26137. // 取消了
  26138. return;
  26139. }
  26140. layout.setActiveItem(activeCard);
  26141. this.viewModel.set('title', layout.activeItem.vtitle);
  26142. layout.activeItem.fireEvent('cardEnter', layout.activeItem);
  26143. }
  26144. };
  26145. // 立刻执行
  26146. CreateModule.prototype.finish = function (sender) {
  26147. var _this = this;
  26148. var parent = sender.up('window');
  26149. var editor = this.refs.jsoneditor;
  26150. var data = JSON.parse(editor.getCode());
  26151. // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
  26152. var moduleType = this.viewModel.get("moduleType");
  26153. if (moduleType === 1) {
  26154. this.setLoading(true);
  26155. generateCode(data).then(function (code) {
  26156. console.log("===> ", code);
  26157. _this.setLoading(true);
  26158. saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
  26159. .then(function () {
  26160. msg("创建成功!");
  26161. parent.close();
  26162. handles$1.fileTree.reload();
  26163. }).finally(function () { return _this.setLoading(false); });
  26164. }).finally(function () { return _this.setLoading(false); });
  26165. }
  26166. };
  26167. return CreateModule;
  26168. }(Scope));
  26169. function getModuleId(path) {
  26170. var separator = "/";
  26171. var sps = path.split(separator);
  26172. var joinSps = sps.join('$');
  26173. if (!joinSps) {
  26174. return "ROOT";
  26175. }
  26176. return joinSps;
  26177. }
  26178. /**
  26179. * Module数据转换成Tree数据
  26180. */
  26181. function modulesToTreeData(modules) {
  26182. var separator = "/";
  26183. var treeNodeMap = new Map();
  26184. var root = {
  26185. type: "Dir",
  26186. path: "",
  26187. expanded: true,
  26188. leaf: false,
  26189. children: [],
  26190. };
  26191. root.id = getModuleId(root.path);
  26192. treeNodeMap.set(root.path, root);
  26193. modules.forEach(function (module) {
  26194. var _a;
  26195. var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
  26196. if (paths.length <= 0)
  26197. return;
  26198. var path = [];
  26199. var parent = root;
  26200. paths.forEach(function (dirName, idx) {
  26201. var parentPath = path.join(separator);
  26202. parent = treeNodeMap.get(parentPath);
  26203. path.push(dirName);
  26204. var currentPath = path.join(separator);
  26205. var child = treeNodeMap.get(currentPath);
  26206. if (child == null) {
  26207. // 获取当前path 绝对路径
  26208. var indexLength = module.absolutePath.indexOf(currentPath);
  26209. var currentAbsolutePath = "";
  26210. if (indexLength > 0) {
  26211. currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
  26212. }
  26213. child = {
  26214. type: "Dir",
  26215. path: currentPath,
  26216. absolutePath: currentAbsolutePath,
  26217. leaf: false,
  26218. children: [],
  26219. text: dirName
  26220. };
  26221. child.id = getModuleId(child.path);
  26222. parent.children.push(child);
  26223. treeNodeMap.set(child.path, child);
  26224. }
  26225. if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
  26226. var leaf = {
  26227. type: "Module",
  26228. path: module.path + separator + module.name,
  26229. absolutePath: module.absolutePath,
  26230. leaf: true,
  26231. text: module.name,
  26232. module: module,
  26233. };
  26234. leaf.id = getModuleId(leaf.path);
  26235. child.children.push(leaf);
  26236. treeNodeMap.set(leaf.path, leaf);
  26237. }
  26238. });
  26239. });
  26240. // 排序处理
  26241. treeNodeMap.forEach(function (module) {
  26242. if (module.children) {
  26243. var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
  26244. module.children.length = 0;
  26245. children.forEach(function (item) { return module.children.push(item); });
  26246. }
  26247. });
  26248. return root;
  26249. }
  26250. function showDialog(sender, option) {
  26251. var _a, _b;
  26252. var win = new Ext.Window({
  26253. autoDestroy: true,
  26254. title: option.title,
  26255. width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
  26256. height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
  26257. resizable: false,
  26258. closable: true,
  26259. modal: true,
  26260. maximizable: false,
  26261. minimizable: false,
  26262. // constrainHeader: true,
  26263. constrain: true,
  26264. layout: 'fit',
  26265. animateTarget: sender,
  26266. buttonAlign: 'center',
  26267. items: [
  26268. {
  26269. xtype: "form",
  26270. layout: "hbox",
  26271. margin: '10px 20px',
  26272. border: 0,
  26273. items: option.items
  26274. }
  26275. ],
  26276. //窗口按钮
  26277. fbar: [
  26278. {
  26279. xtype: 'button', text: '保存', handler: function (btn) {
  26280. //窗口获取表单
  26281. var form = win.down('form');
  26282. var vaildSuccess = form.isValid();
  26283. if (!vaildSuccess) {
  26284. return;
  26285. }
  26286. option.submitFunc(form);
  26287. }
  26288. },
  26289. {
  26290. xtype: 'button', text: '取消', handler: function (btn) {
  26291. //窗口关闭
  26292. btn.up('window').close();
  26293. }
  26294. }
  26295. ],
  26296. });
  26297. win.show();
  26298. }
  26299. function showCreateFolderWin(sender, parentPath) {
  26300. showDialog(sender, {
  26301. title: '新建文件夹',
  26302. height: 150,
  26303. items: [
  26304. {
  26305. xtype: "textfield",
  26306. name: "filename",
  26307. fieldLabel: "文件夹名称",
  26308. allowBlank: false,
  26309. selectOnFocus: true,
  26310. regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
  26311. regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
  26312. labelWidth: 80,
  26313. width: "100%",
  26314. listeners: {
  26315. afterrender: function (sender) {
  26316. _$2.defer(function () {
  26317. sender.focus();
  26318. });
  26319. }
  26320. }
  26321. },
  26322. ],
  26323. submitFunc: function (form) {
  26324. var filename = form.down('textfield[name="filename"]').getValue();
  26325. createFolder(parentPath, filename).then(function (res) {
  26326. if (res.success) {
  26327. msg$1('创建成功');
  26328. handles$1.fileTree.reload();
  26329. form.up('window').close();
  26330. }
  26331. else {
  26332. showErrorDialog$1(res.msg);
  26333. }
  26334. }).catch(function (e) {
  26335. showErrorDialog$1(e.responseJSON.msg);
  26336. });
  26337. }
  26338. });
  26339. }
  26340. function showCreateModuleCrudWin(sender, path, absolutePath) {
  26341. var dlg = new CreateModule();
  26342. dlg.showDialog(sender, {}, {
  26343. data: {
  26344. packagePath: path,
  26345. fileSavePath: absolutePath,
  26346. }
  26347. });
  26348. }
  26349. function registerModule$1(sender, path, name, icon) {
  26350. // 前缀 com/galaxis/wms 写死了
  26351. var dlg = new RegisterModule();
  26352. dlg.showDialog(sender, {}, {
  26353. data: {
  26354. form: {
  26355. scope_url: path.replace("com/galaxis/wms", "."),
  26356. resource_name: name,
  26357. resource_icon: icon,
  26358. }
  26359. }
  26360. });
  26361. }
  26362. function showCreateEmptyModule(sender, path) {
  26363. var win = new Ext.Window({
  26364. autoDestroy: true,
  26365. title: "新建空模块",
  26366. width: 400,
  26367. height: 150,
  26368. resizable: true,
  26369. closable: true,
  26370. maximizable: true,
  26371. minimizable: true,
  26372. plain: true,
  26373. // constrainHeader: true,
  26374. constrain: true,
  26375. layout: 'fit',
  26376. animateTarget: sender,
  26377. buttonAlign: 'center',
  26378. items: [
  26379. {
  26380. xtype: "form",
  26381. layout: "hbox",
  26382. margin: '10px 20px',
  26383. border: 0,
  26384. items: [
  26385. {
  26386. flex: 1,
  26387. layout: 'vbox',
  26388. items: [
  26389. {
  26390. xtype: "textfield",
  26391. name: "filename",
  26392. fieldLabel: "模块名",
  26393. flex: 1,
  26394. allowBlank: false,
  26395. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  26396. regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
  26397. labelWidth: 50,
  26398. width: "100%",
  26399. },
  26400. ]
  26401. },
  26402. ]
  26403. }
  26404. ],
  26405. //窗口按钮
  26406. buttons: [
  26407. {
  26408. xtype: 'button', text: '保存', handler: function (btn) {
  26409. //窗口获取表单
  26410. var form = win.down('form');
  26411. var vaildSuccess = form.isValid();
  26412. if (!vaildSuccess) {
  26413. return;
  26414. }
  26415. var filename = form.down('textfield[name="filename"]').getValue();
  26416. createEmptyModule(path, filename).then(function (res) {
  26417. if (res.success) {
  26418. Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
  26419. handles$1.fileTree.reload();
  26420. win.close();
  26421. }
  26422. else {
  26423. Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
  26424. }
  26425. }).catch(function (e) {
  26426. Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
  26427. });
  26428. }
  26429. },
  26430. {
  26431. xtype: 'button', text: '取消', handler: function (btn) {
  26432. //窗口关闭
  26433. win.close();
  26434. }
  26435. }
  26436. ]
  26437. });
  26438. win.show();
  26439. }
  26440. function initFileTree () {
  26441. Ext.define('com.yvan.studio.FileTree', {
  26442. extend: 'com.yvan.studio.StateTree',
  26443. xtype: 'filetree',
  26444. tooltip: '文件',
  26445. iconCls: 'x-fa fa-file',
  26446. rootVisible: false,
  26447. useArrows: true,
  26448. colspan: 2,
  26449. lines: true,
  26450. reference: 'filetree',
  26451. multiSelect: true,
  26452. getStateFilename: function () {
  26453. return getCurrentProject().uuid + "/filetree.json";
  26454. },
  26455. openNode: function () {
  26456. var selection = this.getSelection();
  26457. var _a = __read(selection, 1), record = _a[0];
  26458. if (!record) {
  26459. return;
  26460. }
  26461. var raw = record.raw;
  26462. if (raw.type === 'Dir') {
  26463. return;
  26464. }
  26465. if (raw.type === "Module" && raw.module) {
  26466. eventBus.publish(EventType.ModuleOpen, raw);
  26467. }
  26468. },
  26469. openInIdea: function () {
  26470. var _a = __read(this.getSelection(), 1), record = _a[0];
  26471. if (record) {
  26472. var data = record.data;
  26473. if (data.type === "Module") {
  26474. if (data.module.groovyFile && data.module.groovyFile.exists) {
  26475. native.openInIdea(data.module.groovyFile.absolutePath);
  26476. }
  26477. else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
  26478. native.openInIdea(data.module.jsControllerFile.absolutePath);
  26479. }
  26480. else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
  26481. native.openInIdea(data.module.jsViewFile.absolutePath);
  26482. }
  26483. return;
  26484. }
  26485. msg$1('只有文件、模块类型才能在 IDEA 中打开.');
  26486. }
  26487. },
  26488. deleteSelection: function () {
  26489. var selection = this.getSelection();
  26490. var pathList = [];
  26491. _.forEach(selection, function (item) {
  26492. if (item.data.type === "Dir") {
  26493. pathList.push({ path: item.data.path, isFolder: true });
  26494. }
  26495. else {
  26496. pathList.push({ path: item.data.path, isFolder: false });
  26497. }
  26498. });
  26499. {
  26500. return;
  26501. }
  26502. // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
  26503. //
  26504. // Ext.Msg.confirm('提示', title, (btn) => {
  26505. // if (btn === 'yes') {
  26506. // deleteFileOrFolder(raw.path, title, true)
  26507. // }
  26508. // })
  26509. // const title = '您确定要删除(' + raw.path + ')吗?'
  26510. // deleteFileOrFolder(raw.path, title, false)
  26511. },
  26512. listeners: {
  26513. itemverify: function () {
  26514. this.openNode();
  26515. },
  26516. afterrender: function (me) {
  26517. console.log('filetree_afterrender', 'reloadIfNeed');
  26518. moduleStore.registe(me.subscribeModule.bind(this));
  26519. moduleStore.reloadIfNeed("PC");
  26520. },
  26521. destroy: function (me) {
  26522. console.log('filetree_destroy');
  26523. moduleStore.unregiste(me.subscribeModule.bind(this));
  26524. },
  26525. itemcontextmenu: function (sender, node, element, idx, e) {
  26526. e.preventDefault();
  26527. var raw = node.raw;
  26528. var option = {};
  26529. if (raw.type === 'Dir') {
  26530. // 文件夹右键
  26531. option = {
  26532. shadow: 'frame', allowOtherMenus: true,
  26533. items: [
  26534. {
  26535. text: '新建空模块',
  26536. iconCls: 'x-fa fa-plus-circle',
  26537. handler: function (sender) {
  26538. showCreateEmptyModule(sender, raw.path);
  26539. }
  26540. },
  26541. {
  26542. text: '新建模块',
  26543. iconCls: 'x-fa fa-plus-circle',
  26544. handler: function (sender) {
  26545. showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
  26546. }
  26547. },
  26548. '-',
  26549. {
  26550. text: '新建文件夹',
  26551. iconCls: 'x-fa fa-folder-o',
  26552. handler: function (sender) {
  26553. var parentPath = raw.path;
  26554. showCreateFolderWin(sender, parentPath);
  26555. }
  26556. },
  26557. {
  26558. text: '复制路径',
  26559. iconCls: 'x-fa fa-external-link',
  26560. handler: function (sender) {
  26561. native.clipboardSet(raw.path);
  26562. }
  26563. },
  26564. ]
  26565. };
  26566. }
  26567. else {
  26568. // 文件右键
  26569. option = {
  26570. shadow: 'frame', allowOtherMenus: true,
  26571. items: [
  26572. // {
  26573. // text: '重命名',
  26574. // iconCls: 'x-fa fa-terminal',
  26575. // handler(sender) {
  26576. // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
  26577. // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
  26578. // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
  26579. // }
  26580. // },
  26581. // {
  26582. // text: '另存为',
  26583. // iconCls: 'x-fa fa-exchange',
  26584. // handler(sender) {
  26585. // console.error('没做')
  26586. // }
  26587. // },
  26588. {
  26589. text: '复制路径',
  26590. iconCls: 'x-fa fa-external-link',
  26591. handler: function (sender) {
  26592. native.clipboardSet(raw.path);
  26593. }
  26594. },
  26595. '-',
  26596. {
  26597. text: '注册模块',
  26598. iconCls: 'x-fa fa-sign-in',
  26599. handler: function (sender) {
  26600. registerModule$1(sender, raw.path);
  26601. }
  26602. },
  26603. ]
  26604. };
  26605. }
  26606. var treeMenu = new Ext.menu.Menu(option);
  26607. treeMenu.showAt(e.getXY());
  26608. },
  26609. },
  26610. tbar: [
  26611. {
  26612. xtype: 'button',
  26613. iconCls: 'x-fa fa-crosshairs',
  26614. tooltip: '选中当前打开的文件',
  26615. handler: function (sender) {
  26616. msg$1('没做');
  26617. }
  26618. },
  26619. {
  26620. xtype: 'button',
  26621. iconCls: 'x-fa fa-link',
  26622. tooltip: '在IDEA中打开',
  26623. handler: function (sender) {
  26624. var scope = sender.up("filetree");
  26625. scope.openInIdea();
  26626. }
  26627. },
  26628. {
  26629. xtype: 'button',
  26630. iconCls: 'x-fa fa-refresh',
  26631. tooltip: '刷新',
  26632. handler: function (sender) {
  26633. var scope = sender.up("filetree");
  26634. scope.reload();
  26635. }
  26636. },
  26637. {
  26638. xtype: 'button',
  26639. iconCls: 'x-fa fa-percent',
  26640. tooltip: '监控',
  26641. handler: function (sender) {
  26642. // handles.mainWindow.showPerform()
  26643. }
  26644. },
  26645. ],
  26646. initComponent: function () {
  26647. setFileTree(this);
  26648. this.superclass.initComponent.apply(this, arguments);
  26649. // super.initComponent.apply(this, arguments)
  26650. },
  26651. subscribeModule: function (res) {
  26652. if (typeof res === 'object') {
  26653. var rootNode = modulesToTreeData(res.data);
  26654. this.setRootNode(rootNode);
  26655. this.restoreState();
  26656. handles$1.mainWindow.modules = res.data;
  26657. }
  26658. else if (typeof res === 'boolean') {
  26659. this.setLoading(res);
  26660. }
  26661. },
  26662. reload: function () {
  26663. console.log('filetree_reloadForce');
  26664. moduleStore.reloadForce("PC").then(function (res) {
  26665. });
  26666. }
  26667. });
  26668. }
  26669. function initDbTree () {
  26670. var define = {
  26671. extend: 'com.yvan.studio.StateTree',
  26672. xtype: 'dbtree',
  26673. tooltip: '数据库',
  26674. iconCls: 'x-fa fa-database',
  26675. rootVisible: false,
  26676. useArrows: true,
  26677. reference: 'dbtree',
  26678. multiSelect: true,
  26679. getStateFilename: function () {
  26680. return getCurrentProject().uuid + "/dbtree.json";
  26681. },
  26682. tbar: [
  26683. {
  26684. xtype: 'button',
  26685. iconCls: 'x-fa fa-crosshairs',
  26686. tooltip: '选中当前打开的表',
  26687. handler: function (sender) {
  26688. var _a;
  26689. // 获取当前选中的活动标签 tableColumn_bas_car
  26690. var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
  26691. if (!locatPath) {
  26692. return;
  26693. }
  26694. handles$1.dbTree.selectPath(locatPath);
  26695. }
  26696. },
  26697. {
  26698. xtype: 'button',
  26699. iconCls: 'x-fa fa-refresh',
  26700. tooltip: '刷新',
  26701. handler: function (sender) {
  26702. handles$1.dbTree.reload();
  26703. }
  26704. },
  26705. {
  26706. xtype: 'button',
  26707. iconCls: 'x-fa fa-cloud-download',
  26708. tooltip: '重新拉取生成元数据(耗时很长!)',
  26709. handler: function (sender) {
  26710. handles$1.dbTree.dbToMetaAndReload(sender);
  26711. }
  26712. },
  26713. // {
  26714. // xtype: 'button',
  26715. // iconCls: 'x-fa fa-files-o',
  26716. // tooltip: '数据同步',
  26717. // handler(sender) {
  26718. //
  26719. // }
  26720. // },
  26721. {
  26722. xtype: 'button',
  26723. iconCls: 'x-fa fa-exchange',
  26724. tooltip: '数据结构同步',
  26725. handler: function (sender) {
  26726. // handles.mainWindow.showDataSync(sender)
  26727. }
  26728. },
  26729. {
  26730. xtype: 'button',
  26731. iconCls: 'x-fa fa-window-maximize',
  26732. tooltip: 'SQL查询分析器',
  26733. handler: function (sender) {
  26734. // handles.mainWindow.showDbCodeTemplate(sender)
  26735. }
  26736. },
  26737. {
  26738. xtype: 'button',
  26739. iconCls: 'x-fa fa-cubes',
  26740. tooltip: '数据域管理',
  26741. handler: function (sender) {
  26742. // handles.mainWindow.showColumnDomain()
  26743. }
  26744. },
  26745. {
  26746. xtype: 'button',
  26747. iconCls: 'x-fa fa-edit',
  26748. tooltip: '修改结构',
  26749. handler: function (sender) {
  26750. var tree = sender.up("treepanel");
  26751. var selection = tree.getSelection();
  26752. var _a = __read(selection, 1), node = _a[0];
  26753. if (!node) {
  26754. msg$1('请选择一个表');
  26755. return;
  26756. }
  26757. var raw = node.data.raw;
  26758. if (node.get('type') === 'table') ;
  26759. else if (node.get('type') === 'column') ;
  26760. }
  26761. },
  26762. ],
  26763. listeners: {
  26764. afterrender: function (me) {
  26765. setDbTree(this);
  26766. // 找管理器订阅刷新的事件
  26767. instance$1.registe(this.refreshData.bind(this));
  26768. instance$1.reloadIfNeed(undefined);
  26769. },
  26770. destory: function (me) {
  26771. setDbTree(undefined);
  26772. instance$1.unregiste(this.refreshData.bind(this));
  26773. },
  26774. itemcontextmenu: function (sender, node, element, idx, e) {
  26775. var _this = this;
  26776. e.preventDefault();
  26777. var option = {};
  26778. var raw = node.raw.raw;
  26779. if (node.get('type') === 'column') {
  26780. option = {
  26781. shadow: 'frame', allowOtherMenus: true,
  26782. items: [
  26783. {
  26784. text: '设计结构',
  26785. iconCls: 'x-fa fa-edit',
  26786. handler: function (sender) {
  26787. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
  26788. }
  26789. },
  26790. ]
  26791. };
  26792. }
  26793. else if (node.get('type') === 'table') {
  26794. option = {
  26795. shadow: 'frame', allowOtherMenus: true,
  26796. items: [
  26797. {
  26798. text: '新建',
  26799. iconCls: 'x-fa fa-plus',
  26800. handler: function (sender) {
  26801. handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
  26802. }
  26803. },
  26804. {
  26805. text: '设计结构',
  26806. iconCls: 'x-fa fa-edit',
  26807. handler: function (sender) {
  26808. handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
  26809. }
  26810. },
  26811. {
  26812. text: '重命名',
  26813. iconCls: 'x-fa fa-pencil',
  26814. handler: function (sender) {
  26815. _this.renameTable(sender, node.data.raw);
  26816. }
  26817. },
  26818. '-',
  26819. {
  26820. text: '删除',
  26821. iconCls: 'x-fa fa-minus',
  26822. handler: function (sender) {
  26823. _this.removeTable(sender, node.data.raw);
  26824. }
  26825. },
  26826. ]
  26827. };
  26828. }
  26829. var treeMenu = new Ext.menu.Menu(option);
  26830. treeMenu.showAt(e.getXY());
  26831. }
  26832. },
  26833. // DbTreeStore 刷新时,会回调到这个方法
  26834. refreshData: function (isLoadingState) {
  26835. var me = this;
  26836. if (typeof isLoadingState === 'boolean') {
  26837. me.setLoading(isLoadingState);
  26838. return;
  26839. }
  26840. var rootNode = getDbTree(instance$1.apiResponse);
  26841. me.setRootNode(rootNode);
  26842. this.restoreState();
  26843. },
  26844. renameTable: function (sender, tableRow) {
  26845. window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
  26846. renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
  26847. if (!res.data)
  26848. return;
  26849. var window = Ext.create('Ext.window.Window', {
  26850. title: 'SQL 预览',
  26851. height: 400,
  26852. width: 600,
  26853. modal: true,
  26854. animateTarget: sender,
  26855. maximizable: true,
  26856. layout: 'fit',
  26857. items: {
  26858. xtype: 'sqleditor',
  26859. value: res.data,
  26860. },
  26861. buttons: [
  26862. {
  26863. xtype: 'button',
  26864. text: '执行',
  26865. iconCls: 'x-fa fa-save',
  26866. handler: function (sender) {
  26867. var editor = sender.up('window').down('sqleditor');
  26868. var ddl = editor.getValue();
  26869. window.setLoading(true);
  26870. instance$1.pushToDbCommit({
  26871. schema_name: tableRow.schema_name,
  26872. table_name: name,
  26873. old_table_name: tableRow.table_name,
  26874. ddl: ddl,
  26875. }).then(function () {
  26876. handles$1.dbTree.reload();
  26877. window.close();
  26878. }).finally(function () { return window.setLoading(false); });
  26879. },
  26880. },
  26881. {
  26882. xtype: 'button',
  26883. text: '取消',
  26884. iconCls: 'x-fa fa-times',
  26885. handler: function () {
  26886. window.close();
  26887. }
  26888. },
  26889. ]
  26890. }).show();
  26891. });
  26892. });
  26893. },
  26894. removeTable: function (sender, tableRow) {
  26895. dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
  26896. if (!res.data)
  26897. return;
  26898. var window = Ext.create('Ext.window.Window', {
  26899. title: 'SQL 预览',
  26900. height: 400,
  26901. width: 600,
  26902. modal: true,
  26903. animateTarget: sender,
  26904. maximizable: true,
  26905. layout: 'fit',
  26906. items: {
  26907. xtype: 'sqleditor',
  26908. value: res.data,
  26909. },
  26910. buttons: [
  26911. {
  26912. xtype: 'button',
  26913. text: '执行',
  26914. iconCls: 'x-fa fa-save',
  26915. handler: function (sender) {
  26916. var editor = sender.up('window').down('sqleditor');
  26917. var ddl = editor.getValue();
  26918. window.setLoading(true);
  26919. instance$1.pushToDbCommit({
  26920. schema_name: tableRow.schema_name,
  26921. table_name: tableRow.table_name,
  26922. ddl: ddl
  26923. })
  26924. .then(function () {
  26925. handles$1.dbTree.reload();
  26926. window.close();
  26927. }).finally(function () { return window.setLoading(false); });
  26928. }
  26929. },
  26930. {
  26931. xtype: 'button',
  26932. text: '取消',
  26933. iconCls: 'x-fa fa-times',
  26934. handler: function () {
  26935. window.close();
  26936. }
  26937. }
  26938. ]
  26939. }).show();
  26940. });
  26941. },
  26942. // hideHeaders: true,
  26943. // columns: [
  26944. // {
  26945. // xtype: 'treecolumn',
  26946. // text: '名称',
  26947. // dataIndex: 'text',
  26948. // flex: 2,
  26949. // }, {
  26950. // text: '描述',
  26951. // dataIndex: 'comment',
  26952. // flex: 1,
  26953. // }
  26954. // ],
  26955. reload: function () {
  26956. // 强制刷新 DbManager
  26957. instance$1.reloadForce(undefined);
  26958. },
  26959. dbToMetaAndReload: function () {
  26960. // 从数据库结构重新生成元数据
  26961. instance$1.dbToMetaAndReload();
  26962. }
  26963. };
  26964. Ext.define('com.yvan.studio.DbTree', define);
  26965. }
  26966. /**
  26967. * 将数据构建成 dbTree 需要的格式
  26968. */
  26969. function getDbTree(apiResponse) {
  26970. var rootNode = {
  26971. children: [],
  26972. expanded: true,
  26973. id: "ROOT",
  26974. leaf: false,
  26975. };
  26976. _$2.forEach(apiResponse, function (schemaRow) {
  26977. var schemaNode = {
  26978. id: 'schema$' + schemaRow.schema_name,
  26979. type: "schema",
  26980. expanded: true,
  26981. leaf: false,
  26982. iconCls: 'x-fa fa-th-large ',
  26983. text: schemaRow.schema_name,
  26984. raw: __assign({}, schemaRow),
  26985. children: [],
  26986. };
  26987. delete schemaNode.raw.table_list;
  26988. rootNode.children.push(schemaNode);
  26989. _$2.forEach(schemaRow.table_list, function (tableRow) {
  26990. var _a;
  26991. var tableNode = {
  26992. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
  26993. text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
  26994. comment: tableRow.description,
  26995. type: "table",
  26996. iconCls: 'x-fa fa-table',
  26997. expanded: false,
  26998. leaf: false,
  26999. children: [],
  27000. raw: __assign({}, tableRow)
  27001. };
  27002. delete tableNode.raw.column_list;
  27003. schemaNode.children.push(tableNode);
  27004. _$2.forEach(tableRow.column_list, function (columnRow) {
  27005. var _a;
  27006. var iconCls = 'x-fa fa-square-o';
  27007. if (columnRow.is_primary_key) {
  27008. iconCls = 'x-fa fa-key';
  27009. }
  27010. else if (columnRow.not_null) {
  27011. iconCls = 'x-fa fa-check-square';
  27012. }
  27013. var columnNode = {
  27014. id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
  27015. type: "column",
  27016. text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
  27017. comment: columnRow.column_comment,
  27018. leaf: true,
  27019. iconCls: iconCls,
  27020. raw: __assign({}, columnRow)
  27021. };
  27022. tableNode.children.push(columnNode);
  27023. }); // column
  27024. }); // table
  27025. }); // schema
  27026. return rootNode;
  27027. }
  27028. var ReportGridController = /** @class */ (function () {
  27029. function ReportGridController() {
  27030. }
  27031. ReportGridController.prototype.onLoad = function (sender) {
  27032. this.reload();
  27033. setReport(this);
  27034. };
  27035. ReportGridController.prototype.showSingle = function (sender) {
  27036. var _this = this;
  27037. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27038. if (record) {
  27039. handles.mainWindow.showFormSingle(record.data, function () {
  27040. _this.reload();
  27041. });
  27042. }
  27043. };
  27044. ReportGridController.prototype.filterChanged = function (sender, value) {
  27045. console.log('filterChange', sender, value);
  27046. this.view.store.clearFilter();
  27047. if (value) {
  27048. this.view.store.filterBy(function (record) {
  27049. var code = _.lowerCase(record.get('report_name'));
  27050. var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
  27051. return (code.includes(value) ||
  27052. dict_desc_py.includes(value));
  27053. });
  27054. }
  27055. };
  27056. ReportGridController.prototype.onClearClick = function () {
  27057. var _a, _b;
  27058. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  27059. };
  27060. ReportGridController.prototype.reload = function () {
  27061. var me = this;
  27062. me.getView().setLoading(true);
  27063. reportListApi().then(function (res) {
  27064. _.forEach(res.data, function (r) {
  27065. r.report_enable = r.report_enable === 1;
  27066. });
  27067. me.getView().setStore(new Ext.data.Store({
  27068. fields: ['report_id', 'report_name', 'report_enable'],
  27069. data: res.data,
  27070. }));
  27071. }).finally(function () {
  27072. me.getView().setLoading(false);
  27073. });
  27074. };
  27075. ReportGridController.prototype.reportAdd = function () {
  27076. var _this = this;
  27077. prompt$2('请输入报表名称').then(function (name) {
  27078. createReportApi(name).then(function (res) {
  27079. if (res.success) {
  27080. msg$1('添加成功');
  27081. handles.mainWindow.showReport(res.data, name, function () {
  27082. _this.reload();
  27083. });
  27084. }
  27085. _this.reload();
  27086. });
  27087. });
  27088. };
  27089. ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
  27090. e.preventDefault();
  27091. var me = sender.up('grid').ownerGrid.getController();
  27092. var option = {
  27093. shadow: 'frame', allowOtherMenus: true,
  27094. items: [
  27095. {
  27096. text: '添加',
  27097. iconCls: 'x-fa fa-plus-circle',
  27098. handler: function (sender) {
  27099. me.reportAdd();
  27100. }
  27101. },
  27102. {
  27103. text: '编辑',
  27104. iconCls: 'x-fa fa-edit',
  27105. handler: function (sender) {
  27106. me.reportEdit();
  27107. }
  27108. },
  27109. {
  27110. text: '删除',
  27111. iconCls: 'x-fa fa-minus-circle',
  27112. handler: function (sender) {
  27113. me.reportRemove();
  27114. }
  27115. },
  27116. '-',
  27117. {
  27118. text: '注册(至菜单)',
  27119. iconCls: 'x-fa fa-sign-in',
  27120. handler: function (sender) {
  27121. me.reportRegiste(sender);
  27122. }
  27123. },
  27124. {
  27125. text: '卸载',
  27126. iconCls: 'x-fa fa-sign-out',
  27127. handler: function (sender) {
  27128. console.error('没做');
  27129. }
  27130. },
  27131. ]
  27132. };
  27133. var treeMenu = new Ext.menu.Menu(option);
  27134. treeMenu.showAt(e.getXY());
  27135. };
  27136. ReportGridController.prototype.reportRegiste = function (sender) {
  27137. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27138. if (record) {
  27139. var reportName = record.get('report_name');
  27140. var reportId = record.get('report_id');
  27141. registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  27142. }
  27143. };
  27144. ReportGridController.prototype.reportRemove = function () {
  27145. var _this = this;
  27146. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27147. if (record) {
  27148. var reportName = record.get('report_name');
  27149. var reportId_1 = record.get('report_id');
  27150. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  27151. delReportApi(reportId_1).then(function (res) {
  27152. if (res.success) {
  27153. msg$1('删除成功');
  27154. _this.reload();
  27155. }
  27156. });
  27157. });
  27158. }
  27159. };
  27160. ReportGridController.prototype.reportEdit = function () {
  27161. var _this = this;
  27162. var _a = __read(this.getView().getSelection(), 1), record = _a[0];
  27163. if (record) {
  27164. var reportName = record.get('report_name');
  27165. var reportId = record.get('report_id');
  27166. handles.mainWindow.showReport(reportId, reportName, function () {
  27167. _this.reload();
  27168. });
  27169. }
  27170. };
  27171. ReportGridController.prototype.onDblClick = function (sender) {
  27172. this.reportEdit();
  27173. };
  27174. return ReportGridController;
  27175. }());
  27176. function initReportGrid () {
  27177. var controller = new ReportGridController();
  27178. Ext.define('com.yvan.studio.ReportGrid', {
  27179. extend: 'Ext.grid.Panel',
  27180. xtype: 'reportGrid',
  27181. controller: controller,
  27182. scope: controller,
  27183. referenceHolder: true,
  27184. tooltip: '查询报表',
  27185. iconCls: 'x-fa fa-bar-chart',
  27186. useArrows: true,
  27187. reference: 'reportgrid',
  27188. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  27189. listeners: {
  27190. itemdblclick: 'onDblClick',
  27191. afterrender: 'onLoad',
  27192. },
  27193. viewConfig: {
  27194. enableTextSelection: true,
  27195. listeners: {
  27196. itemcontextmenu: 'onGridContextMenu',
  27197. },
  27198. },
  27199. tbar: {
  27200. xtype: 'toolbar',
  27201. items: [
  27202. {
  27203. xtype: 'button',
  27204. tooltip: '测试',
  27205. iconCls: 'x-fa fa-bars',
  27206. listeners: {
  27207. click: 'showSingle'
  27208. }
  27209. },
  27210. {
  27211. xtype: 'button',
  27212. tooltip: '刷新',
  27213. iconCls: 'x-fa fa-refresh',
  27214. listeners: {
  27215. click: 'reload'
  27216. }
  27217. },
  27218. {
  27219. xtype: 'button',
  27220. tooltip: '添加',
  27221. iconCls: 'x-fa fa-plus-circle',
  27222. listeners: {
  27223. click: 'reportAdd'
  27224. }
  27225. },
  27226. {
  27227. xtype: 'button',
  27228. tooltip: '删除',
  27229. iconCls: 'x-fa fa-minus-circle',
  27230. listeners: {
  27231. click: 'reportRemove'
  27232. }
  27233. },
  27234. {
  27235. xtype: 'textfield',
  27236. flex: 1,
  27237. reference: "txtFilter",
  27238. emptyText: '搜索过滤',
  27239. enableKeyEvents: true,
  27240. listeners: {
  27241. change: {
  27242. fn: 'filterChanged',
  27243. buffer: 50
  27244. }
  27245. }
  27246. },
  27247. ]
  27248. },
  27249. columns: [
  27250. {
  27251. text: 'ID', dataIndex: 'report_id',
  27252. hidden: true,
  27253. },
  27254. {
  27255. text: '报表名称', dataIndex: 'report_name',
  27256. flex: 1,
  27257. },
  27258. ]
  27259. });
  27260. }
  27261. /** 所有变量类型 */
  27262. var TypeEnum;
  27263. (function (TypeEnum) {
  27264. TypeEnum["string"] = "string";
  27265. TypeEnum["number"] = "number";
  27266. TypeEnum["object"] = "object";
  27267. TypeEnum["array"] = "array";
  27268. TypeEnum["function"] = "function";
  27269. TypeEnum["null"] = "null";
  27270. TypeEnum["boolean"] = "boolean";
  27271. TypeEnum["symbol"] = "symbol";
  27272. TypeEnum["json"] = "json";
  27273. TypeEnum["math"] = "math";
  27274. TypeEnum["regexp"] = "regexp";
  27275. TypeEnum["date"] = "date";
  27276. TypeEnum["undefined"] = "undefined";
  27277. TypeEnum["nan"] = "nan";
  27278. TypeEnum["reactNode"] = "react_node";
  27279. })(TypeEnum || (TypeEnum = {}));
  27280. /**
  27281. * 判断对象类型
  27282. * @param object 对象
  27283. */
  27284. var variableTypeOf = function (object) {
  27285. var typeStr = Object.prototype.toString.call(object);
  27286. var typeName;
  27287. switch (("" + typeStr).toLowerCase()) {
  27288. case '[object string]':
  27289. typeName = TypeEnum.string;
  27290. break;
  27291. case '[object number]':
  27292. if (Number.isNaN(object)) {
  27293. return TypeEnum.nan;
  27294. }
  27295. typeName = TypeEnum.number;
  27296. break;
  27297. case '[object object]':
  27298. if (object.$$typeof && object.props) {
  27299. var type = variableTypeOf(object.$$typeof);
  27300. if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
  27301. return TypeEnum.reactNode;
  27302. }
  27303. }
  27304. typeName = TypeEnum.object;
  27305. break;
  27306. case '[object array]':
  27307. typeName = TypeEnum.array;
  27308. break;
  27309. case '[object function]':
  27310. typeName = TypeEnum.function;
  27311. break;
  27312. case '[object null]':
  27313. typeName = TypeEnum.null;
  27314. break;
  27315. case '[object boolean]':
  27316. typeName = TypeEnum.boolean;
  27317. break;
  27318. case '[object date]':
  27319. typeName = TypeEnum.date;
  27320. break;
  27321. // 不常用
  27322. case '[object symbol]':
  27323. typeName = TypeEnum.symbol;
  27324. break;
  27325. case '[object json]':
  27326. typeName = TypeEnum.json;
  27327. break;
  27328. case '[object math]':
  27329. typeName = TypeEnum.math;
  27330. break;
  27331. case '[object regexp]':
  27332. typeName = TypeEnum.regexp;
  27333. break;
  27334. // 貌似不会走的分支
  27335. case '[object undefined]':
  27336. typeName = TypeEnum.undefined;
  27337. break;
  27338. // 无法识别
  27339. default:
  27340. if (object === undefined) {
  27341. return TypeEnum.undefined;
  27342. }
  27343. console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
  27344. typeName = TypeEnum.object;
  27345. }
  27346. return typeName;
  27347. };
  27348. function initGroovyEditor () {
  27349. Ext.define('com.yvan.studio.GroovyEditor', {
  27350. extend: 'Ext.panel.Panel',
  27351. alias: 'widget.groovyeditor',
  27352. xtype: 'groovyeditor',
  27353. layout: 'fit',
  27354. border: false,
  27355. html: "<div class=\"editor\"/>",
  27356. config: {
  27357. value: ''
  27358. },
  27359. codeChange: undefined,
  27360. isChangeFromOuter: false,
  27361. getCode: function () {
  27362. if (this.editor) {
  27363. return this.editor.getValue();
  27364. }
  27365. else {
  27366. return this.code;
  27367. }
  27368. },
  27369. setCode: function (value) {
  27370. var _this = this;
  27371. this.code = value;
  27372. this.value = value;
  27373. _$2.defer(function () {
  27374. _this.isChangeFromOuter = true;
  27375. if (_this.editor) {
  27376. _this.editor.setValue(value);
  27377. }
  27378. });
  27379. },
  27380. applyPosition: function () {
  27381. var _this = this;
  27382. if (this.autoFocusMethod) {
  27383. if (this.editor) {
  27384. _$2.defer(function () {
  27385. if (_this.autoFocusStartLine) {
  27386. _this.editor.setPosition({
  27387. lineNumber: _this.autoFocusStartLine,
  27388. column: _this.autoFocusStartColumn
  27389. });
  27390. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27391. }
  27392. _this.editor.focus();
  27393. });
  27394. delete this.autoFocusMethod;
  27395. }
  27396. }
  27397. this.editor.layout();
  27398. },
  27399. getValue: function () {
  27400. return this.value;
  27401. },
  27402. setValue: function (value, fromEditor) {
  27403. var me = this;
  27404. if (me.value === value) {
  27405. // 值相等,不需要变化
  27406. return;
  27407. }
  27408. if (fromEditor !== true && me.editor) {
  27409. // 不是来源于编辑器的变化,才设置编辑器的值
  27410. me.editor.setValue(value);
  27411. }
  27412. // 通知mixins setValue
  27413. me.value = value;
  27414. me.fireEvent('change', value);
  27415. },
  27416. initComponent: function () {
  27417. var that = this;
  27418. this.superclass.initComponent.call(this, arguments);
  27419. that.on({
  27420. resize: function () {
  27421. if (that.editor) {
  27422. that.editor.layout();
  27423. }
  27424. },
  27425. destory: function () {
  27426. if (that.editor) {
  27427. that.editor.dispose();
  27428. delete that.editor;
  27429. }
  27430. },
  27431. afterrender: function (sender) {
  27432. var $dom = $(that.el.dom).find('.editor');
  27433. attach_3($dom[0], {
  27434. value: that.code
  27435. }).then(function (editor) {
  27436. that.editor = editor;
  27437. that.applyPosition();
  27438. that.editor.onDidChangeModelContent(function (e) {
  27439. that.fireEvent('change', that.editor, e);
  27440. if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
  27441. that.codeChange(that.editor.getValue(), that.name, e);
  27442. }
  27443. that.isChangeFromOuter = false;
  27444. });
  27445. });
  27446. }
  27447. });
  27448. }
  27449. });
  27450. }
  27451. function attach_3(element, opts) {
  27452. return new Promise(function (resolve) {
  27453. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
  27454. enabled: false
  27455. } }));
  27456. editor.onKeyUp(function (e) {
  27457. // console.log(e)
  27458. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27459. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27460. }
  27461. });
  27462. resolve(editor);
  27463. });
  27464. }
  27465. function initJsEditor$1 () {
  27466. Ext.define('com.yvan.studio.JsEditor', {
  27467. extend: 'Ext.panel.Panel',
  27468. alias: 'widget.jseditor',
  27469. xtype: 'jseditor',
  27470. layout: 'fit',
  27471. border: false,
  27472. html: "<div class=\"editor\"/>",
  27473. autoFocusMethod: true,
  27474. autoFocusStartLine: 0,
  27475. autoFocusStartColumn: 0,
  27476. codeChange: undefined,
  27477. funcArr: [],
  27478. modulePage: null,
  27479. isChangeFromOuter: false,
  27480. name: "",
  27481. /**
  27482. * 设置代码
  27483. */
  27484. setCode: function (value) {
  27485. var _this = this;
  27486. this.code = value;
  27487. _$2.defer(function () {
  27488. _this.isChangeFromOuter = true;
  27489. if (_this.editor) {
  27490. _this.editor.setValue(value);
  27491. if (_this.name === "controllerEditor") {
  27492. _this.funcArr = _this.getAllFunction();
  27493. }
  27494. }
  27495. });
  27496. },
  27497. getCode: function () {
  27498. var _a;
  27499. if (!this.editor) {
  27500. return this.code;
  27501. }
  27502. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27503. },
  27504. applyPosition: function () {
  27505. var _this = this;
  27506. if (this.autoFocusMethod) {
  27507. if (this.editor) {
  27508. _$2.defer(function () {
  27509. if (_this.autoFocusStartLine) {
  27510. _this.editor.setPosition({
  27511. lineNumber: _this.autoFocusStartLine,
  27512. column: _this.autoFocusStartColumn
  27513. });
  27514. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27515. }
  27516. _this.editor.focus();
  27517. });
  27518. delete this.autoFocusMethod;
  27519. }
  27520. }
  27521. this.editor.layout();
  27522. },
  27523. initComponent: function () {
  27524. var that = this;
  27525. this.superclass.initComponent.apply(this, arguments);
  27526. this.on({
  27527. resize: function (sender, width, height) {
  27528. if (that.editor) {
  27529. that.editor.layout();
  27530. }
  27531. },
  27532. destory: function () {
  27533. if (that.editor) {
  27534. that.editor.dispose();
  27535. delete that.editor;
  27536. }
  27537. },
  27538. afterrender: function () {
  27539. var $dom = $(that.el.dom).find('.editor');
  27540. attach_1($dom[0], {
  27541. value: that.code
  27542. }).then(function (editor) {
  27543. that.editor = editor;
  27544. that.applyPosition();
  27545. that.editor.onDidChangeModelContent(function (e) {
  27546. that.fireEvent('change', that.editor, e);
  27547. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27548. that.codeChange(that.editor.getValue(), that.name, e);
  27549. }
  27550. that.isChangeFromOuter = false;
  27551. });
  27552. });
  27553. }
  27554. });
  27555. },
  27556. getAllFunction: function () {
  27557. var funcArr = [];
  27558. var ast = window['YvanUI'].recast.parse(this.code);
  27559. if (ast && ast.program && ast.program.body) {
  27560. if (Array.isArray(ast.program.body)) {
  27561. for (var i = 0; i < ast.program.body.length; i++) {
  27562. var m = ast.program.body[i];
  27563. if (m.type === "ExportDefaultDeclaration") {
  27564. if (m.declaration.type === "ClassDeclaration") {
  27565. if (m.declaration.body.type === "ClassBody") {
  27566. if (Array.isArray(m.declaration.body.body)) {
  27567. for (var j = 0; j < m.declaration.body.body.length; j++) {
  27568. var ob = m.declaration.body.body[j];
  27569. if (ob.type === "MethodDefinition" && ob.kind === "method") {
  27570. var funcItem = { name: ob.key.name, args: [] };
  27571. if (Array.isArray(ob.value.params)) {
  27572. for (var k = 0; k < ob.value.params.length; k++) {
  27573. var p = ob.value.params[k];
  27574. funcItem.args.push(p.name);
  27575. }
  27576. }
  27577. funcArr.push(funcItem);
  27578. }
  27579. }
  27580. }
  27581. }
  27582. }
  27583. }
  27584. }
  27585. }
  27586. }
  27587. return funcArr;
  27588. }
  27589. });
  27590. }
  27591. var isInited = false;
  27592. function attach_1(element, opts) {
  27593. return new Promise(function (resolve) {
  27594. var monaco = window['monaco'];
  27595. if (!isInited) {
  27596. isInited = true;
  27597. monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
  27598. noSemanticValidation: true,
  27599. noSyntaxValidation: false
  27600. });
  27601. // compiler options
  27602. monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
  27603. target: monaco.languages.typescript.ScriptTarget.ES2016,
  27604. allowNonTsExtensions: true,
  27605. });
  27606. // extra libraries
  27607. var libSource = [
  27608. 'declare class Facts {',
  27609. ' /**',
  27610. ' * Returns the next fact',
  27611. ' */',
  27612. ' static next():string',
  27613. ' static next222():string',
  27614. '}',
  27615. "\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 ",
  27616. "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
  27617. ].join('\n');
  27618. var libUri = 'file:///index.d.ts';
  27619. monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
  27620. // When resolving definitions and references, the editor will try to use created models.
  27621. // Creating a model for the library allows "peek definition/references" commands to work with the library.
  27622. monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
  27623. }
  27624. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
  27625. resolve(editor);
  27626. });
  27627. }
  27628. function initJsonEditor$1 () {
  27629. Ext.define('com.yvan.studio.JsonEditor', {
  27630. extend: 'Ext.panel.Panel',
  27631. alias: 'widget.jsoneditor',
  27632. xtype: 'jsoneditor',
  27633. layout: 'fit',
  27634. border: false,
  27635. html: "<div class=\"editor\"/>",
  27636. autoFocusMethod: true,
  27637. autoFocusStartLine: 0,
  27638. autoFocusStartColumn: 0,
  27639. codeChange: undefined,
  27640. funcArr: [],
  27641. modulePage: null,
  27642. isChangeFromOuter: false,
  27643. name: "",
  27644. /**
  27645. * 设置代码
  27646. */
  27647. setCode: function (value) {
  27648. var _this = this;
  27649. this.code = value;
  27650. _$2.defer(function () {
  27651. _this.isChangeFromOuter = true;
  27652. if (_this.editor) {
  27653. _this.editor.setValue(value);
  27654. }
  27655. });
  27656. },
  27657. updateOptions: function (options) {
  27658. if (this.editor && options) {
  27659. this.editor.updateOptions(options);
  27660. }
  27661. },
  27662. setLanguage: function (lang) {
  27663. if (this.editor && lang) {
  27664. window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
  27665. }
  27666. },
  27667. getCode: function () {
  27668. var _a;
  27669. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27670. },
  27671. applyPosition: function () {
  27672. var _this = this;
  27673. if (this.autoFocusMethod) {
  27674. if (this.editor) {
  27675. _$2.defer(function () {
  27676. if (_this.autoFocusStartLine) {
  27677. _this.editor.setPosition({
  27678. lineNumber: _this.autoFocusStartLine,
  27679. column: _this.autoFocusStartColumn
  27680. });
  27681. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27682. }
  27683. _this.editor.focus();
  27684. });
  27685. delete this.autoFocusMethod;
  27686. }
  27687. }
  27688. this.editor.layout();
  27689. },
  27690. initComponent: function () {
  27691. var that = this;
  27692. this.superclass.initComponent.apply(this, arguments);
  27693. this.on({
  27694. resize: function (sender, width, height) {
  27695. if (that.editor) {
  27696. that.editor.layout();
  27697. }
  27698. },
  27699. destory: function () {
  27700. if (that.editor) {
  27701. that.editor.dispose();
  27702. delete that.editor;
  27703. }
  27704. },
  27705. afterrender: function (sender) {
  27706. var $dom = $(that.el.dom).find('.editor');
  27707. attach_116($dom[0], {
  27708. value: that.code
  27709. }).then(function (editor) {
  27710. that.editor = editor;
  27711. that.applyPosition();
  27712. that.editor.onDidChangeModelContent(function (e) {
  27713. that.fireEvent('change', that.editor, e);
  27714. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27715. that.codeChange(that.editor.getValue(), that.name, e);
  27716. }
  27717. that.isChangeFromOuter = false;
  27718. });
  27719. });
  27720. }
  27721. });
  27722. },
  27723. });
  27724. }
  27725. function attach_116(element, opts) {
  27726. return new Promise(function (resolve) {
  27727. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
  27728. enabled: false
  27729. } }));
  27730. editor.onKeyUp(function (e) {
  27731. // console.log(e)
  27732. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27733. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27734. }
  27735. });
  27736. resolve(editor);
  27737. });
  27738. }
  27739. function initSqlEditor$1 () {
  27740. Ext.define('com.yvan.studio.SqlEditor', {
  27741. extend: 'Ext.panel.Panel',
  27742. alias: 'widget.sqleditor',
  27743. xtype: 'sqleditor',
  27744. layout: 'fit',
  27745. border: false,
  27746. html: "<div class=\"editor\"/>",
  27747. config: {
  27748. value: ''
  27749. },
  27750. codeChange: undefined,
  27751. isChangeFromOuter: false,
  27752. setCode: function (value) {
  27753. var _this = this;
  27754. this.code = value;
  27755. this.value = value;
  27756. _$2.defer(function () {
  27757. _this.isChangeFromOuter = true;
  27758. if (_this.editor) {
  27759. _this.editor.setValue(value);
  27760. }
  27761. });
  27762. },
  27763. getCode: function () {
  27764. return this.getValue();
  27765. },
  27766. updateOptions: function (options) {
  27767. if (this.editor && options) {
  27768. this.editor.updateOptions(options);
  27769. }
  27770. },
  27771. getValue: function () {
  27772. if (!this.editor) {
  27773. return this.code;
  27774. }
  27775. return this.editor.getValue();
  27776. },
  27777. applyPosition: function () {
  27778. var _this = this;
  27779. if (this.autoFocusMethod) {
  27780. if (this.editor) {
  27781. _$2.defer(function () {
  27782. if (_this.autoFocusStartLine) {
  27783. _this.editor.setPosition({
  27784. lineNumber: _this.autoFocusStartLine,
  27785. column: _this.autoFocusStartColumn
  27786. });
  27787. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27788. }
  27789. _this.editor.focus();
  27790. });
  27791. delete this.autoFocusMethod;
  27792. }
  27793. }
  27794. this.editor.layout();
  27795. },
  27796. setValue: function (value, fromEditor) {
  27797. this.setCode(value);
  27798. var me = this;
  27799. if (me.value === value) {
  27800. // 值相等,不需要变化
  27801. return;
  27802. }
  27803. if (fromEditor !== true && me.editor) {
  27804. // 不是来源于编辑器的变化,才设置编辑器的值
  27805. me.editor.setValue(value);
  27806. }
  27807. // 通知mixins setValue
  27808. me.value = value;
  27809. me.fireEvent('change', value);
  27810. },
  27811. initComponent: function () {
  27812. var that = this;
  27813. this.superclass.initComponent.call(this);
  27814. that.on({
  27815. resize: function () {
  27816. if (that.editor) {
  27817. that.editor.layout();
  27818. }
  27819. },
  27820. destory: function () {
  27821. if (that.editor) {
  27822. that.editor.dispose();
  27823. delete that.editor;
  27824. }
  27825. },
  27826. afterrender: function (sender) {
  27827. var $dom = $(that.el.dom).find('.editor');
  27828. attach_2($dom[0], {
  27829. value: that.code
  27830. }).then(function (editor) {
  27831. that.editor = editor;
  27832. that.applyPosition();
  27833. that.editor.onDidChangeModelContent(function (e) {
  27834. that.fireEvent('change', that.editor, e);
  27835. if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
  27836. that.codeChange(that.editor.getValue(), that.name, e);
  27837. }
  27838. that.isChangeFromOuter = false;
  27839. });
  27840. });
  27841. }
  27842. });
  27843. }
  27844. });
  27845. }
  27846. function attach_2(element, opts) {
  27847. return new Promise(function (resolve) {
  27848. var monaco = window['monaco'];
  27849. var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
  27850. enabled: false
  27851. } }));
  27852. editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
  27853. // const sql = editor.getValue()
  27854. // if (_.trim(sql).length > 0) {
  27855. // editor.setValue(format(sql, {
  27856. // indent: ' ',
  27857. // uppercase: true,
  27858. // }))
  27859. // }
  27860. msg$1('没做');
  27861. });
  27862. editor.onKeyUp(function (e) {
  27863. // console.log(e)
  27864. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27865. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27866. }
  27867. });
  27868. resolve(editor);
  27869. });
  27870. }
  27871. function initTemplateEditor () {
  27872. Ext.define('com.yvan.studio.TemplateEditor', {
  27873. extend: 'Ext.panel.Panel',
  27874. alias: 'widget.templateeditor',
  27875. xtype: 'templateeditor',
  27876. layout: 'fit',
  27877. border: false,
  27878. html: "<div class=\"editor\"/>",
  27879. autoFocusMethod: true,
  27880. autoFocusStartLine: 0,
  27881. autoFocusStartColumn: 0,
  27882. codeChange: undefined,
  27883. funcArr: [],
  27884. modulePage: null,
  27885. isChangeFromOuter: false,
  27886. name: "",
  27887. /**
  27888. * 设置代码
  27889. */
  27890. setCode: function (value) {
  27891. var _this = this;
  27892. this.code = value;
  27893. _$2.defer(function () {
  27894. _this.isChangeFromOuter = true;
  27895. if (_this.editor) {
  27896. _this.editor.setValue(value);
  27897. }
  27898. });
  27899. },
  27900. getCode: function () {
  27901. var _a;
  27902. return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
  27903. },
  27904. applyPosition: function () {
  27905. var _this = this;
  27906. if (this.autoFocusMethod) {
  27907. if (this.editor) {
  27908. _$2.defer(function () {
  27909. if (_this.autoFocusStartLine) {
  27910. _this.editor.setPosition({
  27911. lineNumber: _this.autoFocusStartLine,
  27912. column: _this.autoFocusStartColumn
  27913. });
  27914. _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
  27915. }
  27916. _this.editor.focus();
  27917. });
  27918. delete this.autoFocusMethod;
  27919. }
  27920. }
  27921. this.editor.layout();
  27922. },
  27923. initComponent: function () {
  27924. var that = this;
  27925. this.superclass.initComponent.apply(this, arguments);
  27926. this.on({
  27927. resize: function (sender, width, height) {
  27928. if (that.editor) {
  27929. that.editor.layout();
  27930. }
  27931. },
  27932. destory: function () {
  27933. if (that.editor) {
  27934. that.editor.dispose();
  27935. delete that.editor;
  27936. }
  27937. },
  27938. afterrender: function (sender) {
  27939. var $dom = $(that.el.dom).find('.editor');
  27940. attach_117($dom[0], {
  27941. value: that.code
  27942. }).then(function (editor) {
  27943. that.editor = editor;
  27944. that.applyPosition();
  27945. that.editor.onDidChangeModelContent(function (e) {
  27946. that.fireEvent('change', that.editor, e);
  27947. if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
  27948. that.codeChange(that.editor.getValue(), that.name, e);
  27949. }
  27950. that.isChangeFromOuter = false;
  27951. });
  27952. });
  27953. }
  27954. });
  27955. },
  27956. });
  27957. }
  27958. function attach_117(element, opts) {
  27959. return new Promise(function (resolve) {
  27960. var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
  27961. enabled: false
  27962. } }));
  27963. editor.onKeyUp(function (e) {
  27964. // console.log(e)
  27965. if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
  27966. editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
  27967. }
  27968. });
  27969. resolve(editor);
  27970. });
  27971. }
  27972. var DictStore = /** @class */ (function (_super) {
  27973. __extends(DictStore, _super);
  27974. function DictStore() {
  27975. return _super !== null && _super.apply(this, arguments) || this;
  27976. }
  27977. DictStore.prototype.getCacheKey = function (param) {
  27978. return "dict_data.json";
  27979. };
  27980. DictStore.prototype.invokeApi = function (param) {
  27981. return getDict(param);
  27982. };
  27983. DictStore.prototype.getDicts = function () {
  27984. return this.apiResponse.data.dict;
  27985. };
  27986. DictStore.prototype.getDictCodes = function () {
  27987. return new Promise(function (resolve) {
  27988. // reloadIfNeedPromise().then(() => {
  27989. // const result = []
  27990. // _.forEach(this.getDicts(), dictRow => {
  27991. // result.push({
  27992. // id: dictRow.dict_code,
  27993. // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
  27994. // })
  27995. // })
  27996. // resolve(result)
  27997. // })
  27998. });
  27999. };
  28000. DictStore.prototype.saveDict = function (param) {
  28001. return saveDictApi(param);
  28002. };
  28003. DictStore.prototype.saveDictItems = function (param) {
  28004. return saveDictItemsApi(param);
  28005. };
  28006. DictStore.prototype.getDictItemByDictcode = function (dict_code) {
  28007. var results = [];
  28008. _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
  28009. if (dictItemRow.dict_code === dict_code) {
  28010. results.push(_$2.clone(dictItemRow));
  28011. }
  28012. });
  28013. return results;
  28014. };
  28015. return DictStore;
  28016. }(CacheStore));
  28017. var instance$2 = new DictStore();
  28018. var DictTreeController = /** @class */ (function () {
  28019. function DictTreeController() {
  28020. this._saveStateFlag = true;
  28021. }
  28022. DictTreeController.prototype.dictSave = function () {
  28023. var _this = this;
  28024. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  28025. var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
  28026. if (err) {
  28027. // 如果有异常就不保存
  28028. return;
  28029. }
  28030. // 进行业务上的逻辑校验,比如说必填校验等等
  28031. var hasError = false;
  28032. _$2.forEach(rows, function (row, i) {
  28033. if (isEmpty(row.dict_code)) {
  28034. msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
  28035. hasError = true;
  28036. return false;
  28037. }
  28038. });
  28039. if (hasError) {
  28040. return;
  28041. }
  28042. // 设置当前界面为 "保存中..." 状态
  28043. this.view.setLoading(true);
  28044. instance$2.saveDict({
  28045. newRows: newRows,
  28046. modifyRows: modifyRows,
  28047. removeRecords: removeRecords,
  28048. }).then(function (res) {
  28049. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  28050. msg$1(res.msg);
  28051. _this.reload();
  28052. }).finally(function () {
  28053. // 无论正常异常,关闭 "保存中..." 状态
  28054. _this.view.setLoading(false);
  28055. });
  28056. };
  28057. DictTreeController.prototype.dictItemSave = function () {
  28058. var _this = this;
  28059. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28060. var currentDictCode = undefined;
  28061. if (record) {
  28062. currentDictCode = record.get('dict_code');
  28063. }
  28064. if (!currentDictCode) {
  28065. msg$1('请选择一个字典');
  28066. return;
  28067. }
  28068. // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
  28069. var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
  28070. if (err) {
  28071. // 如果有异常就不保存
  28072. return;
  28073. }
  28074. // 进行业务上的逻辑校验,比如说必填校验等等
  28075. var hasError = false;
  28076. _$2.forEach(rows, function (row, i) {
  28077. if (!row.dict_value && row.dict_value !== 0) {
  28078. msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
  28079. hasError = true;
  28080. return false;
  28081. }
  28082. });
  28083. if (hasError) {
  28084. return;
  28085. }
  28086. // 设置当前界面为 "保存中..." 状态
  28087. this.view.setLoading(true);
  28088. instance$2.saveDictItems({
  28089. // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
  28090. newRows: newRows,
  28091. modifyRows: modifyRows,
  28092. removeRecords: removeRecords,
  28093. dict_code: currentDictCode
  28094. }).then(function (res) {
  28095. // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
  28096. msg$1(res.msg);
  28097. _this.reload();
  28098. }).finally(function () {
  28099. // 无论正常异常,关闭 "保存中..." 状态
  28100. _this.view.setLoading(false);
  28101. });
  28102. };
  28103. DictTreeController.prototype.createDictEnum = function () {
  28104. var _this = this;
  28105. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28106. var currentDictCode = undefined;
  28107. if (record) {
  28108. currentDictCode = record.get('dict_code');
  28109. }
  28110. if (!currentDictCode) {
  28111. msg$1('请选择一个字典');
  28112. return;
  28113. }
  28114. // 设置当前界面为 "保存中..." 状态
  28115. this.view.setLoading(true);
  28116. createDictEnum({ dictCode: currentDictCode })
  28117. .then(function () { return _this.reload(); })
  28118. .finally(function () { return _this.view.setLoading(false); });
  28119. };
  28120. DictTreeController.prototype.onLoad = function () {
  28121. setDictTree(this);
  28122. this.grid1 = this.view.lookupReference('grid1');
  28123. this.grid2 = this.view.lookupReference('grid2');
  28124. this.grid1.setData([]);
  28125. this.grid2.setData([]);
  28126. // this.grid1.columns[0].hide()
  28127. this.grid2.columns[0].hide();
  28128. // 找管理器订阅刷新的事件
  28129. instance$2.registe(this.refreshData.bind(this));
  28130. // 非强制性刷新 DbManager
  28131. instance$2.reloadIfNeed(undefined);
  28132. };
  28133. DictTreeController.prototype.onDestory = function () {
  28134. instance$2.unregiste(this.refreshData.bind(this));
  28135. };
  28136. // dictStore 刷新时,会回调到这个方法
  28137. DictTreeController.prototype.refreshData = function (isLoadingState) {
  28138. var me = this;
  28139. if (typeof isLoadingState === 'boolean') {
  28140. me.view.setLoading(isLoadingState);
  28141. return;
  28142. }
  28143. this.grid1.setData(instance$2.getDicts());
  28144. this.restoreState();
  28145. };
  28146. DictTreeController.prototype.grid1Selected = function (sender, record, event) {
  28147. var _this = this;
  28148. _$2.defer(function () {
  28149. _this.saveState();
  28150. });
  28151. if (!record) {
  28152. this.grid2.setData([]);
  28153. return;
  28154. }
  28155. var dict_code = record.get('dict_code');
  28156. var data = instance$2.getDictItemByDictcode(dict_code);
  28157. this.grid2.setData(data);
  28158. };
  28159. DictTreeController.prototype.reload = function () {
  28160. var _this = this;
  28161. // 强制刷新 DbManager
  28162. instance$2.reloadForce(undefined).then(function (res) {
  28163. _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
  28164. });
  28165. };
  28166. DictTreeController.prototype.dictAdd = function () {
  28167. this.grid1.appendEditRow({
  28168. _createFlag: true,
  28169. dict_code: '',
  28170. dict_desc: '',
  28171. }, 0);
  28172. };
  28173. DictTreeController.prototype.dictRemove = function () {
  28174. this.grid1.removeEditRow();
  28175. };
  28176. DictTreeController.prototype.dictItemAdd = function () {
  28177. var _a, _b;
  28178. 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;
  28179. if (!dict_code) {
  28180. msg$1('请先保存字典');
  28181. return;
  28182. }
  28183. this.grid2.appendEditRow({
  28184. dict_code: dict_code,
  28185. dict_text: '',
  28186. dict_value: '',
  28187. }, 0);
  28188. };
  28189. DictTreeController.prototype.dictItemRemove = function () {
  28190. var _this = this;
  28191. var rows = [];
  28192. this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
  28193. rows.push(r);
  28194. });
  28195. _$2.forEach(rows, function (r) {
  28196. _this.grid2.getStore().remove(r);
  28197. });
  28198. };
  28199. DictTreeController.prototype.clearSearch1 = function () {
  28200. this.grid1.store.clearFilter();
  28201. };
  28202. DictTreeController.prototype.search1 = function (sender) {
  28203. this.grid1.store.clearFilter();
  28204. this.getViewModel().set('grid1.selection', null);
  28205. this.grid1.fireEvent('itemselect');
  28206. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28207. if (!value) {
  28208. return;
  28209. }
  28210. this.grid1.store.filterBy(function (record) {
  28211. if (record.get('_createFlag')) {
  28212. return true;
  28213. }
  28214. var dict_code = _$2.lowerCase(record.get('dict_code'));
  28215. var dict_desc = _$2.lowerCase(record.get('dict_desc'));
  28216. var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
  28217. return (dict_code.includes(value) ||
  28218. dict_desc.includes(value) ||
  28219. dict_desc_py.includes(value));
  28220. });
  28221. };
  28222. DictTreeController.prototype.clearSearch2 = function () {
  28223. this.grid2.store.clearFilter();
  28224. };
  28225. DictTreeController.prototype.search2 = function (sender) {
  28226. this.grid2.store.clearFilter();
  28227. var value = _$2.lowerCase(sender.getRawValue()).trim();
  28228. if (!value) {
  28229. return;
  28230. }
  28231. this.grid2.store.filterBy(function (record) {
  28232. var dict_text = _$2.lowerCase(record.get('dict_text'));
  28233. var dict_value = _$2.lowerCase(record.get('dict_value'));
  28234. var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
  28235. return (dict_text.includes(value) ||
  28236. dict_value === value ||
  28237. dict_text_py.includes(value));
  28238. });
  28239. };
  28240. DictTreeController.prototype.getStateFilename = function () {
  28241. return getCurrentProject().uuid + "/dicttree.json";
  28242. };
  28243. DictTreeController.prototype.restoreState = function () {
  28244. var _this = this;
  28245. var grid = this.grid1;
  28246. native.loadFile(this.getStateFilename(), function (content) {
  28247. if (!content)
  28248. return;
  28249. var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
  28250. _this._saveStateFlag = false;
  28251. if (selection) {
  28252. var idx = grid.store.findExact('dict_code', selection);
  28253. if (idx >= 0) {
  28254. var record = grid.store.getAt(idx);
  28255. if (record) {
  28256. grid.setSelection([record]);
  28257. }
  28258. }
  28259. }
  28260. if (scrollPosition && scrollSize) {
  28261. var size = grid.scrollable.getSize();
  28262. if (size.x === scrollSize.x && size.y === scrollSize.y) {
  28263. grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
  28264. }
  28265. }
  28266. setTimeout(function () {
  28267. _this._saveStateFlag = true;
  28268. }, 200);
  28269. });
  28270. };
  28271. DictTreeController.prototype.saveState = function () {
  28272. if (!this._saveStateFlag) {
  28273. return;
  28274. }
  28275. var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
  28276. var selection = undefined;
  28277. if (record) {
  28278. selection = record.get('dict_code');
  28279. }
  28280. var scrollPosition = this.grid1.scrollable.position;
  28281. var scrollSize = this.grid1.scrollable.getSize();
  28282. native.saveFile(this.getStateFilename(), {
  28283. selection: selection,
  28284. scrollPosition: scrollPosition,
  28285. scrollSize: scrollSize
  28286. });
  28287. };
  28288. return DictTreeController;
  28289. }());
  28290. function initDict$1 () {
  28291. var controller = new DictTreeController();
  28292. Ext.define('com.yvan.studio.DictTree', {
  28293. extend: 'Ext.panel.Panel',
  28294. xtype: 'dicttree',
  28295. controller: controller,
  28296. scope: controller,
  28297. referenceHolder: true,
  28298. tooltip: '字典',
  28299. iconCls: 'x-fa fa-book',
  28300. rootVisible: false,
  28301. useArrows: true,
  28302. reference: 'dicttree',
  28303. layout: 'border',
  28304. listeners: {
  28305. afterrender: 'onLoad',
  28306. destory: 'onDestory',
  28307. },
  28308. items: [
  28309. {
  28310. region: 'center',
  28311. xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
  28312. _mode: 'select',
  28313. tbar: [
  28314. {
  28315. xtype: 'button',
  28316. tooltip: '刷新',
  28317. iconCls: 'x-fa fa-refresh',
  28318. listeners: {
  28319. click: 'reload'
  28320. }
  28321. },
  28322. {
  28323. xtype: 'button',
  28324. tooltip: '添加',
  28325. iconCls: 'x-fa fa-plus-circle',
  28326. listeners: {
  28327. click: 'dictAdd'
  28328. }
  28329. },
  28330. {
  28331. xtype: 'button',
  28332. tooltip: '删除',
  28333. iconCls: 'x-fa fa-minus-circle',
  28334. bind: {
  28335. disabled: '{!grid1.selection}'
  28336. },
  28337. listeners: {
  28338. click: 'dictRemove'
  28339. }
  28340. },
  28341. {
  28342. xtype: 'button',
  28343. tooltip: '保存',
  28344. iconCls: 'x-fa fa-save',
  28345. bind: {
  28346. disabled: '{!grid1.ischanged}'
  28347. },
  28348. listeners: {
  28349. click: 'dictSave'
  28350. }
  28351. },
  28352. {
  28353. xtype: 'textfield',
  28354. hideClear: true,
  28355. triggers: {
  28356. clear: {
  28357. cls: 'x-form-clear-trigger',
  28358. handler: 'clearSearch1'
  28359. },
  28360. },
  28361. flex: 1,
  28362. emptyText: '搜索过滤',
  28363. enableKeyEvents: true,
  28364. listeners: {
  28365. keyup: {
  28366. fn: 'search1',
  28367. buffer: 50
  28368. }
  28369. }
  28370. },
  28371. ],
  28372. listeners: {
  28373. itemselect: 'grid1Selected',
  28374. },
  28375. idField: 'dict_code',
  28376. columns: [
  28377. {
  28378. text: '字典编号', dataIndex: 'dict_code',
  28379. menuDisabled: true, flex: 1,
  28380. editor: {
  28381. allowBlank: true,
  28382. selectOnFocus: false
  28383. }
  28384. },
  28385. {
  28386. text: '中文描述', dataIndex: 'dict_desc',
  28387. menuDisabled: true, flex: 1,
  28388. editor: {
  28389. allowBlank: true,
  28390. selectOnFocus: false
  28391. }
  28392. },
  28393. ]
  28394. },
  28395. {
  28396. region: 'south', height: '50%',
  28397. xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
  28398. split: true,
  28399. _mode: 'edit1',
  28400. listeners: {},
  28401. tbar: [
  28402. {
  28403. xtype: 'button',
  28404. tooltip: '添加',
  28405. iconCls: 'x-fa fa-plus-circle',
  28406. bind: {
  28407. disabled: '{!grid1.selection}'
  28408. },
  28409. listeners: {
  28410. click: 'dictItemAdd'
  28411. }
  28412. },
  28413. {
  28414. xtype: 'button',
  28415. tooltip: '删除',
  28416. iconCls: 'x-fa fa-minus-circle',
  28417. bind: {
  28418. disabled: '{!grid1.selection}'
  28419. },
  28420. listeners: {
  28421. click: 'dictItemRemove'
  28422. }
  28423. },
  28424. {
  28425. xtype: 'button',
  28426. tooltip: '保存',
  28427. iconCls: 'x-fa fa-save',
  28428. bind: {
  28429. disabled: '{!grid2.ischanged}'
  28430. },
  28431. listeners: {
  28432. click: 'dictItemSave'
  28433. }
  28434. },
  28435. {
  28436. xtype: 'button',
  28437. tooltip: '刷新代码',
  28438. iconCls: 'x-fa fa-code',
  28439. bind: {
  28440. disabled: '{!grid1.selection}'
  28441. },
  28442. listeners: {
  28443. click: 'createDictEnum'
  28444. }
  28445. },
  28446. ],
  28447. columns: [
  28448. {
  28449. text: '字典项', dataIndex: 'dict_text',
  28450. menuDisabled: true, flex: 1,
  28451. editor: {
  28452. allowBlank: true,
  28453. selectOnFocus: false
  28454. }
  28455. },
  28456. {
  28457. text: '字典值', dataIndex: 'dict_value',
  28458. menuDisabled: true, flex: 1,
  28459. dataType: 'int',
  28460. editor: {
  28461. xtype: 'numberfield',
  28462. allowBlank: true,
  28463. selectOnFocus: false
  28464. }
  28465. },
  28466. {
  28467. text: '激活', dataIndex: 'is_enable',
  28468. xtype: 'checkcolumn', menuDisabled: true,
  28469. },
  28470. {
  28471. text: '变量名', dataIndex: 'var_name',
  28472. menuDisabled: true, flex: 1,
  28473. editor: {
  28474. allowBlank: true,
  28475. selectOnFocus: false
  28476. }
  28477. },
  28478. ]
  28479. }
  28480. ]
  28481. });
  28482. }
  28483. var model$g = {
  28484. data: {
  28485. form: {
  28486. path: "",
  28487. requestBody: "",
  28488. responseBody: "",
  28489. }
  28490. }
  28491. };
  28492. var vjson$f = {
  28493. title: '接口信息',
  28494. layout: 'fit',
  28495. width: 800,
  28496. height: 500,
  28497. items: [
  28498. {
  28499. xtype: 'form',
  28500. layout: {
  28501. type: 'vbox',
  28502. pack: 'start',
  28503. align: 'stretch'
  28504. },
  28505. defaults: {
  28506. border: false,
  28507. anchor: '100%',
  28508. margin: '5',
  28509. },
  28510. items: [
  28511. {
  28512. xtype: 'textfield',
  28513. fieldLabel: '接口路径',
  28514. bind: {
  28515. value: "{form.path}",
  28516. },
  28517. },
  28518. {
  28519. xtype: 'textareafield',
  28520. // height: 150,
  28521. flex: 2,
  28522. fieldLabel: '请求数据',
  28523. bind: {
  28524. value: "{form.requestBody}",
  28525. },
  28526. },
  28527. {
  28528. xtype: 'textareafield',
  28529. // height: 150,
  28530. flex: 5,
  28531. fieldLabel: '响应数据',
  28532. bind: {
  28533. value: "{form.responseBody}",
  28534. },
  28535. },
  28536. ]
  28537. }
  28538. ]
  28539. };
  28540. var ApiInfoDialog = /** @class */ (function (_super) {
  28541. __extends(ApiInfoDialog, _super);
  28542. function ApiInfoDialog() {
  28543. return _super.call(this, { model: model$g, vjson: vjson$f }) || this;
  28544. }
  28545. return ApiInfoDialog;
  28546. }(Scope));
  28547. var model$h = {
  28548. data: {
  28549. query: {
  28550. role_id: '',
  28551. resource_id: '',
  28552. },
  28553. form: {},
  28554. form2: {
  28555. key: "",
  28556. start_at: "",
  28557. end_at: "",
  28558. }
  28559. }
  28560. };
  28561. var vjson$g = {
  28562. title: '接口信息',
  28563. layout: 'fit',
  28564. items: [
  28565. {
  28566. layout: 'border',
  28567. border: false,
  28568. items: [
  28569. {
  28570. region: 'center',
  28571. layout: 'border',
  28572. items: [
  28573. {
  28574. region: 'north',
  28575. bind: {
  28576. title: '{form.title}',
  28577. },
  28578. xtype: 'form',
  28579. scrollable: true,
  28580. layout: {
  28581. type: 'vbox',
  28582. pack: 'start',
  28583. align: 'stretch'
  28584. },
  28585. defaults: {
  28586. border: false,
  28587. anchor: '100%',
  28588. margin: '5',
  28589. },
  28590. tbar: {
  28591. xtype: 'toolbar',
  28592. items: [
  28593. {
  28594. xtype: 'button',
  28595. text: '查询',
  28596. iconCls: 'x-fa fa-search',
  28597. listeners: {
  28598. click: 'scope.requestLogs'
  28599. },
  28600. },
  28601. {
  28602. xtype: 'button',
  28603. text: '保存',
  28604. iconCls: 'x-fa fa-save',
  28605. listeners: {},
  28606. },
  28607. {
  28608. xtype: 'button',
  28609. text: '禁用',
  28610. iconCls: 'x-fa fa-stop-circle',
  28611. bind: {},
  28612. listeners: {},
  28613. },
  28614. {
  28615. xtype: 'button',
  28616. text: '启用',
  28617. iconCls: 'x-fa fa-play-circle',
  28618. bind: {},
  28619. listeners: {},
  28620. },
  28621. ],
  28622. },
  28623. items: [
  28624. {
  28625. xtype: 'cols',
  28626. defaults: { labelWidth: 120 },
  28627. items: [
  28628. {
  28629. xtype: 'textfield',
  28630. fieldLabel: 'URL',
  28631. bind: {
  28632. value: '{form.api_url}',
  28633. },
  28634. readOnly: true,
  28635. },
  28636. {
  28637. xtype: 'textfield',
  28638. fieldLabel: '名称',
  28639. bind: {
  28640. value: '{form.api_name}',
  28641. },
  28642. readOnly: true,
  28643. },
  28644. ],
  28645. },
  28646. {
  28647. xtype: 'cols',
  28648. defaults: { labelWidth: 120 },
  28649. items: [
  28650. {
  28651. xtype: 'textfield',
  28652. fieldLabel: '实现类',
  28653. bind: {
  28654. value: '{form.api_class}',
  28655. },
  28656. readOnly: true,
  28657. },
  28658. {
  28659. border: false,
  28660. flex: 1
  28661. },
  28662. ]
  28663. },
  28664. {
  28665. xtype: 'cols',
  28666. defaults: { labelWidth: 120 },
  28667. items: [
  28668. {
  28669. xtype: 'textfield',
  28670. fieldLabel: '超时时间',
  28671. bind: {
  28672. value: '{form.timeout}',
  28673. },
  28674. readOnly: true,
  28675. },
  28676. {
  28677. border: false,
  28678. flex: 1
  28679. },
  28680. ]
  28681. },
  28682. {
  28683. xtype: 'cols',
  28684. defaults: { labelWidth: 120 },
  28685. items: [
  28686. {
  28687. xtype: 'textfield',
  28688. fieldLabel: 'Remote IP',
  28689. bind: {
  28690. value: '{form.remote_ip}',
  28691. },
  28692. readOnly: true,
  28693. },
  28694. {
  28695. border: false,
  28696. flex: 1
  28697. },
  28698. ]
  28699. },
  28700. {
  28701. xtype: 'cols',
  28702. defaults: { labelWidth: 120 },
  28703. items: [
  28704. {
  28705. xtype: 'textfield',
  28706. fieldLabel: '解析表单',
  28707. bind: {
  28708. value: '{form.chandi}',
  28709. },
  28710. readOnly: true,
  28711. },
  28712. {
  28713. border: false,
  28714. flex: 1
  28715. },
  28716. ]
  28717. },
  28718. ],
  28719. },
  28720. {
  28721. region: 'center',
  28722. // title: 'Request',
  28723. layout: 'border',
  28724. items: [
  28725. {
  28726. region: 'north',
  28727. xtype: 'form',
  28728. reference: 'form2',
  28729. split: true,
  28730. items: [
  28731. {
  28732. xtype: 'cols',
  28733. width: 700,
  28734. items: [
  28735. {
  28736. xtype: 'textfield',
  28737. fieldLabel: '关键字',
  28738. bind: {
  28739. value: "{form2.key}"
  28740. },
  28741. },
  28742. {
  28743. xtype: 'datefield',
  28744. fieldLabel: '开始时间',
  28745. bind: {
  28746. value: "{form2.start_at}"
  28747. },
  28748. },
  28749. {
  28750. xtype: 'datefield',
  28751. fieldLabel: '结束时间',
  28752. bind: {
  28753. value: "{form2.end_at}"
  28754. },
  28755. },
  28756. ]
  28757. }
  28758. ]
  28759. },
  28760. {
  28761. region: 'center',
  28762. xtype: 'yvgrid',
  28763. layout: 'fit',
  28764. reference: 'grid1',
  28765. pagination: true,
  28766. autoLoad: false,
  28767. selModel: {
  28768. selType: 'rowmodel',
  28769. mode: 'SINGLE',
  28770. },
  28771. dataSource: {
  28772. method: 'invoke',
  28773. url: '/sys/api/Api@requestLogs',
  28774. params: {
  28775. formData: '{form2}',
  28776. path: '{form.api_url}',
  28777. },
  28778. },
  28779. listeners: {
  28780. rowdblclick: 'scope.showDialog',
  28781. },
  28782. columns: [
  28783. { dataIndex: "@timestamp", header: "时间", width: 150 },
  28784. { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
  28785. { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
  28786. { dataIndex: "size", header: "大小", width: 80 },
  28787. { dataIndex: "path", header: "path", flex: 1 },
  28788. { dataIndex: "requestBody", header: "requestBody", hidden: true },
  28789. { dataIndex: "responseBody", header: "responseBody", hidden: true },
  28790. ]
  28791. }
  28792. ]
  28793. },
  28794. ],
  28795. },
  28796. ],
  28797. },
  28798. ],
  28799. referenceHolder: true,
  28800. };
  28801. var Api = /** @class */ (function (_super) {
  28802. __extends(Api, _super);
  28803. function Api() {
  28804. return _super.call(this, { model: model$h, vjson: vjson$g }) || this;
  28805. }
  28806. Api.prototype.onLoad = function () {
  28807. _super.prototype.onLoad.call(this);
  28808. this.requestLogs();
  28809. };
  28810. Api.prototype.selectList = function (sender, selected, eOpts) {
  28811. this.viewModel.set("form", selected.data);
  28812. if (selected.data.api_type === '1') {
  28813. this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
  28814. }
  28815. else {
  28816. this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
  28817. }
  28818. };
  28819. Api.prototype.methodDataLoadComplete = function (sender, success, records) {
  28820. var sel = [];
  28821. _$2.forEach(records, function (item) {
  28822. if (item.data.flg === 'Y') {
  28823. sel.push(item);
  28824. }
  28825. });
  28826. this.refs.methodGrid.selModel.select(sel);
  28827. };
  28828. Api.prototype.saveAll = function () {
  28829. var _this = this;
  28830. var _a, _b, _c;
  28831. var role_id = this.viewModel.get("query.role_id");
  28832. if (!role_id) {
  28833. msg$1("请先选择一个角色");
  28834. return;
  28835. }
  28836. var wh_id = this.viewModel.get("form.wh_id");
  28837. if (!wh_id) {
  28838. msg$1("请先选择一个仓库");
  28839. return;
  28840. }
  28841. var menus = this.refs.theTree.getChecked();
  28842. var rowsMenus = [];
  28843. _$2.forEach(menus, function (m) {
  28844. if (m.data.resource_id) {
  28845. rowsMenus.push(m.data.resource_id);
  28846. }
  28847. });
  28848. var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
  28849. 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; });
  28850. _$2.remove(mm, function (x) {
  28851. return methodsArry.includes(x.resource_id);
  28852. });
  28853. var rowsBtn = [];
  28854. _$2.forEach(mm, function (m) {
  28855. rowsBtn.push({ resource_id: m.resource_id });
  28856. });
  28857. this.setLoading(true);
  28858. invokeServer$1('/sys/role/Role@saveAll', {
  28859. wh_id: wh_id,
  28860. role_id: role_id,
  28861. rowsMenus: rowsMenus,
  28862. rowsBtn: rowsBtn,
  28863. }).then(function (res) {
  28864. msg$1(res.msg);
  28865. if (res.success) {
  28866. _this.reloadTree();
  28867. // this.viewModel.set('query.role_id', '')
  28868. _this.viewModel.set('query.resource_id', '');
  28869. _this.refs.methodGrid.reload();
  28870. }
  28871. }).finally(function () {
  28872. _this.setLoading(false);
  28873. });
  28874. };
  28875. Api.prototype.editRoleSuccess = function (sender, data) {
  28876. if (data.success) {
  28877. this.refs.roleGrid.reload();
  28878. this.viewModel.set("query.JIAOS_ID", "");
  28879. this.reloadTree();
  28880. this.viewModel.set("query.CAID_ID", "");
  28881. this.refs.methodGrid.reload();
  28882. }
  28883. };
  28884. Api.prototype.deleteRole = function (sender) {
  28885. var _this = this;
  28886. var role_id = this.viewModel.get("query.role_id");
  28887. if (!role_id) {
  28888. msg$1("请先选择一个角色");
  28889. return;
  28890. }
  28891. Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
  28892. if (btn === 'yes') {
  28893. invokeServer$1('/sys/role/Role@deleteRole', {
  28894. role_id: role_id,
  28895. wh_id: window['whId']
  28896. }).then(function (res) {
  28897. msg$1(res.msg);
  28898. if (res.success) {
  28899. _this.refs.roleGrid.reload();
  28900. _this.viewModel.set("query.role_id", "");
  28901. _this.reloadTree();
  28902. _this.refs.methodGrid.reload();
  28903. }
  28904. });
  28905. }
  28906. });
  28907. };
  28908. Api.prototype.reloadTree = function () {
  28909. showErrorDialog$1('reloadTree 不存在');
  28910. };
  28911. Api.prototype.whChange = function (sender, value) {
  28912. this.viewModel.set("form.wh_id", value);
  28913. this.reloadTree();
  28914. this.refs.methodGrid.reload();
  28915. };
  28916. Api.prototype.requestLogs = function () {
  28917. var path = this.viewModel.get("form.api_url");
  28918. if (!path)
  28919. return;
  28920. this.refs.grid1.reload();
  28921. };
  28922. Api.prototype.showDialog = function (sender) {
  28923. var _a, _b;
  28924. 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; });
  28925. if (!rows || rows.length <= 0)
  28926. return;
  28927. var dialog = new ApiInfoDialog();
  28928. dialog.showDialog(null, {}, {
  28929. data: {
  28930. form: __assign({}, rows[0])
  28931. }
  28932. });
  28933. };
  28934. return Api;
  28935. }(Scope));
  28936. var Controller = /** @class */ (function () {
  28937. function Controller() {
  28938. }
  28939. Controller.prototype.selectList = function (sender, selected, eOpts) {
  28940. var _a, _b, _c, _d, _e, _f, _g, _h;
  28941. // @ts-ignore
  28942. 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; });
  28943. if (!rows || rows.length <= 0)
  28944. return;
  28945. var apiPage = new Api();
  28946. apiPage.showPage({
  28947. title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
  28948. id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
  28949. path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
  28950. }, {
  28951. data: {
  28952. form: __assign({}, rows[0])
  28953. }
  28954. });
  28955. };
  28956. return Controller;
  28957. }());
  28958. var controller = new Controller();
  28959. function initApiTree () {
  28960. Ext.define('com.yvan.studio.ApiGrid', {
  28961. extend: 'Ext.Panel',
  28962. xtype: 'apigrid',
  28963. controller: controller,
  28964. scope: controller,
  28965. referenceHolder: true,
  28966. layout: 'fit',
  28967. items: [
  28968. {
  28969. width: 400,
  28970. split: true,
  28971. xtype: 'yvgrid',
  28972. reference: 'roleGrid',
  28973. border: false,
  28974. pagination: false,
  28975. autoLoad: true,
  28976. remoteFilter: false,
  28977. selModel: {
  28978. selType: 'rowmodel',
  28979. mode: 'SINGLE',
  28980. },
  28981. tbar: {
  28982. xtype: 'toolbar',
  28983. items: [
  28984. {
  28985. xtype: 'button',
  28986. text: '新增',
  28987. iconCls: 'x-fa fa-plus-circle',
  28988. listeners: {},
  28989. },
  28990. {
  28991. xtype: 'button',
  28992. text: '删除',
  28993. iconCls: 'x-fa fa-trash',
  28994. bind: {
  28995. disabled: '{roleGrid.selection==null}',
  28996. },
  28997. listeners: {},
  28998. },
  28999. ],
  29000. },
  29001. dataSource: {
  29002. url: '/sys/api/Api@getApiList',
  29003. method: 'invoke',
  29004. params: {},
  29005. },
  29006. listeners: {
  29007. itemdblclick: "selectList",
  29008. },
  29009. columns: [
  29010. {
  29011. dataIndex: 'api_name',
  29012. header: '接口名称',
  29013. filter: { type: 'string' },
  29014. flex: 1,
  29015. },
  29016. ],
  29017. },
  29018. ]
  29019. });
  29020. }
  29021. var model$i = {
  29022. data: {
  29023. iframeSrc: ''
  29024. }
  29025. };
  29026. var vjson$h = {
  29027. layout: 'fit',
  29028. border: false,
  29029. iconCls: 'x-fa fa-newspaper-o',
  29030. referenceHolder: true,
  29031. items: [
  29032. {
  29033. // title: 'view.design',
  29034. xtype: 'uxiframe',
  29035. layout: 'fit',
  29036. // cls: 'module_page_iframe',
  29037. reference: 'iframe',
  29038. listeners: {
  29039. afterrender: 'scope.iframeRender'
  29040. }
  29041. },
  29042. ]
  29043. };
  29044. var Iframe = /** @class */ (function (_super) {
  29045. __extends(Iframe, _super);
  29046. function Iframe(path) {
  29047. var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this;
  29048. _this.path = "";
  29049. _this.path = path;
  29050. return _this;
  29051. }
  29052. Iframe.prototype.iframeRender = function (sender) {
  29053. var $dom = $(sender.el.dom).find('iframe');
  29054. var iframe = $dom[0];
  29055. iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
  29056. iframe.onload = function () {
  29057. iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
  29058. };
  29059. };
  29060. return Iframe;
  29061. }(Scope));
  29062. var Controller$1 = /** @class */ (function () {
  29063. function Controller() {
  29064. }
  29065. Controller.prototype.onDblClick = function (sender, record) {
  29066. var data = record.raw;
  29067. if (data.text === "运行报表") {
  29068. this.openIframe("/xxl-job/index", "运行报表");
  29069. }
  29070. else if (data.text === "任务管理") {
  29071. this.openIframe("/xxl-job/jobinfo", "任务管理");
  29072. }
  29073. else if (data.text === "调度日志") {
  29074. this.openIframe("/xxl-job/joblog", "调度日志");
  29075. }
  29076. else if (data.text === "执行器管理") {
  29077. this.openIframe("/xxl-job/jobgroup", "执行器管理");
  29078. }
  29079. };
  29080. Controller.prototype.openIframe = function (path, title) {
  29081. var page = new Iframe(path);
  29082. page.showPage({
  29083. title: title,
  29084. id: 'xxljob__' + path.replaceAll("/", "_"),
  29085. path: 'xxljob__' + path.replaceAll("/", "_"),
  29086. }, {});
  29087. };
  29088. Controller.prototype.onLoad = function () {
  29089. var me = this;
  29090. me.getView().setRootNode({
  29091. expanded: true,
  29092. leaf: false,
  29093. children: [
  29094. { leaf: true, text: '运行报表' },
  29095. { leaf: true, text: '任务管理' },
  29096. { leaf: true, text: '调度日志' },
  29097. { leaf: true, text: '执行器管理' },
  29098. ]
  29099. });
  29100. };
  29101. return Controller;
  29102. }());
  29103. var controller$1 = new Controller$1();
  29104. function initTaskTree () {
  29105. Ext.define('com.yvan.studio.TaskTree', {
  29106. extend: 'Ext.tree.Panel',
  29107. xtype: 'tasktree',
  29108. controller: controller$1,
  29109. scope: controller$1,
  29110. reference: 'roleGrid',
  29111. tooltip: '表单定义',
  29112. iconCls: 'x-fa fa-bar-chart',
  29113. useArrows: true,
  29114. rootVisible: false,
  29115. colspan: 2,
  29116. lines: true,
  29117. multiSelect: false,
  29118. referenceHolder: true,
  29119. // openNode() {
  29120. // const selection = this.getSelection()
  29121. // const [record] = selection
  29122. // if (!record) {
  29123. // return
  29124. // }
  29125. //
  29126. // const {raw} = record;
  29127. // if (raw.type === 'Dir') {
  29128. // return
  29129. // }
  29130. // if (raw.type === "Module" && raw.module) {
  29131. // // eventBus.publish(EventType.ModuleOpen, raw)
  29132. // }
  29133. // },
  29134. listeners: {
  29135. itemdblclick: 'onDblClick',
  29136. afterrender: "onLoad",
  29137. },
  29138. });
  29139. }
  29140. var model$j = {
  29141. data: {
  29142. form: {
  29143. address: "",
  29144. level: "",
  29145. logger: "",
  29146. message: "",
  29147. nodeName: "",
  29148. serverName: "",
  29149. thread: "",
  29150. whId: "",
  29151. userId: "",
  29152. }
  29153. }
  29154. };
  29155. var vjson$i = {
  29156. title: '接口信息',
  29157. layout: 'fit',
  29158. width: 800,
  29159. height: 600,
  29160. items: [
  29161. {
  29162. xtype: 'form',
  29163. layout: {
  29164. type: 'vbox',
  29165. pack: 'start',
  29166. align: 'stretch'
  29167. },
  29168. defaults: {
  29169. border: false,
  29170. anchor: '100%',
  29171. margin: '5',
  29172. },
  29173. items: [
  29174. { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
  29175. { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
  29176. { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
  29177. { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
  29178. { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
  29179. { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
  29180. { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
  29181. // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
  29182. {
  29183. xtype: 'textareafield',
  29184. flex: 5,
  29185. fieldLabel: '响应数据',
  29186. bind: {
  29187. value: "{form.message}",
  29188. },
  29189. },
  29190. ]
  29191. }
  29192. ]
  29193. };
  29194. var ApiInfoDialog$1 = /** @class */ (function (_super) {
  29195. __extends(ApiInfoDialog, _super);
  29196. function ApiInfoDialog() {
  29197. return _super.call(this, { model: model$j, vjson: vjson$i }) || this;
  29198. }
  29199. return ApiInfoDialog;
  29200. }(Scope));
  29201. var model$k = {
  29202. data: {
  29203. form2: {}
  29204. }
  29205. };
  29206. var vjson$j = {
  29207. title: '日志查询',
  29208. layout: 'fit',
  29209. width: "70%",
  29210. height: "80%",
  29211. items: [
  29212. {
  29213. region: 'center',
  29214. xtype: 'yvgrid',
  29215. layout: 'fit',
  29216. reference: 'grid1',
  29217. pagination: false,
  29218. autoLoad: false,
  29219. selModel: {
  29220. selType: 'rowmodel',
  29221. mode: 'SINGLE',
  29222. },
  29223. dataSource: {
  29224. method: 'invoke',
  29225. url: '/sys/api/Api@aroundLogs',
  29226. params: {
  29227. formData: '{form2}',
  29228. },
  29229. },
  29230. listeners: {
  29231. rowdblclick: 'scope.showDialog2',
  29232. },
  29233. columns: [
  29234. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29235. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29236. { dataIndex: "thread", header: "thread", width: 150 },
  29237. { dataIndex: "message", header: "message", flex: 1 },
  29238. ]
  29239. }
  29240. ]
  29241. };
  29242. var AroundLog = /** @class */ (function (_super) {
  29243. __extends(AroundLog, _super);
  29244. function AroundLog() {
  29245. return _super.call(this, { model: model$k, vjson: vjson$j }) || this;
  29246. }
  29247. AroundLog.prototype.onLoad = function () {
  29248. _super.prototype.onLoad.call(this);
  29249. this.queryLog();
  29250. };
  29251. AroundLog.prototype.queryLog = function () {
  29252. this.refs.grid1.reload();
  29253. };
  29254. AroundLog.prototype.showDialog2 = function () {
  29255. var _a, _b;
  29256. 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; });
  29257. if (!rows || rows.length <= 0)
  29258. return;
  29259. var dialog = new ApiInfoDialog$1();
  29260. dialog.showDialog(null, {}, {
  29261. data: {
  29262. form: __assign({}, rows[0])
  29263. }
  29264. });
  29265. };
  29266. return AroundLog;
  29267. }(Scope));
  29268. var model$l = {
  29269. data: {
  29270. form2: {
  29271. key: "",
  29272. start_at: "",
  29273. end_at: "",
  29274. }
  29275. }
  29276. };
  29277. var vjson$k = {
  29278. title: '日志查询',
  29279. layout: 'fit',
  29280. tbar: {
  29281. xtype: 'toolbar',
  29282. items: [
  29283. {
  29284. xtype: 'button',
  29285. text: '刷新',
  29286. listeners: {
  29287. click: 'scope.queryLog'
  29288. },
  29289. },
  29290. {
  29291. xtype: 'button',
  29292. text: '周围日志',
  29293. bind: {},
  29294. listeners: {
  29295. click: 'scope.aroundLogs'
  29296. },
  29297. },
  29298. ],
  29299. },
  29300. items: [
  29301. {
  29302. region: 'center',
  29303. xtype: 'yvgrid',
  29304. layout: 'fit',
  29305. reference: 'grid1',
  29306. pagination: true,
  29307. autoLoad: false,
  29308. selModel: {
  29309. selType: 'rowmodel',
  29310. mode: 'SINGLE',
  29311. },
  29312. dataSource: {
  29313. method: 'invoke',
  29314. url: '/sys/api/Api@queryLog',
  29315. params: {
  29316. formData: '{form2}',
  29317. path: '{form.api_url}',
  29318. },
  29319. },
  29320. listeners: {
  29321. rowdblclick: 'scope.showDialog',
  29322. },
  29323. columns: [
  29324. { dataIndex: "@timestamp", header: "时间", width: 150 },
  29325. // {dataIndex: "nodeName", header: "nodeName", width: 80},
  29326. { dataIndex: "thread", header: "thread", width: 150 },
  29327. { dataIndex: "message", header: "message", flex: 1 },
  29328. ]
  29329. }
  29330. ]
  29331. };
  29332. var LogPage = /** @class */ (function (_super) {
  29333. __extends(LogPage, _super);
  29334. function LogPage() {
  29335. return _super.call(this, { model: model$l, vjson: vjson$k }) || this;
  29336. }
  29337. LogPage.prototype.onLoad = function () {
  29338. _super.prototype.onLoad.call(this);
  29339. this.queryLog();
  29340. };
  29341. LogPage.prototype.queryLog = function () {
  29342. this.refs.grid1.reload();
  29343. };
  29344. LogPage.prototype.showDialog = function () {
  29345. var _a, _b;
  29346. 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; });
  29347. if (!rows || rows.length <= 0)
  29348. return;
  29349. var dialog = new ApiInfoDialog$1();
  29350. dialog.showDialog(null, {}, {
  29351. data: {
  29352. form: __assign({}, rows[0])
  29353. }
  29354. });
  29355. };
  29356. LogPage.prototype.aroundLogs = function () {
  29357. var _a, _b;
  29358. 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; });
  29359. if (!rows || rows.length <= 0)
  29360. return;
  29361. var dialog = new AroundLog();
  29362. dialog.showDialog(null, {}, {
  29363. data: {
  29364. form2: __assign({}, rows[0])
  29365. }
  29366. });
  29367. };
  29368. return LogPage;
  29369. }(Scope));
  29370. var Controller$2 = /** @class */ (function () {
  29371. function Controller() {
  29372. }
  29373. Controller.prototype.queryLog = function () {
  29374. var form2 = this.getViewModel().get("form2");
  29375. var logPage = new LogPage();
  29376. logPage.showPage({}, {
  29377. data: {
  29378. form2: __assign({}, form2)
  29379. }
  29380. });
  29381. };
  29382. return Controller;
  29383. }());
  29384. var controller$2 = new Controller$2();
  29385. function initLogsTree () {
  29386. Ext.define('com.yvan.studio.LogsTree', {
  29387. extend: 'Ext.panel.Panel',
  29388. xtype: 'logstree',
  29389. controller: controller$2,
  29390. scope: controller$2,
  29391. viewModel: {
  29392. data: {
  29393. form2: {
  29394. key: "",
  29395. start_at: "",
  29396. end_at: "",
  29397. }
  29398. }
  29399. },
  29400. reference: 'logstree',
  29401. tooltip: '表单定义',
  29402. iconCls: 'x-fa fa-bar-chart',
  29403. useArrows: true,
  29404. rootVisible: false,
  29405. colspan: 2,
  29406. lines: true,
  29407. multiSelect: false,
  29408. referenceHolder: true,
  29409. items: [
  29410. {
  29411. region: 'north',
  29412. xtype: 'form',
  29413. reference: 'form2',
  29414. split: true,
  29415. items: [
  29416. {
  29417. xtype: 'textfield',
  29418. fieldLabel: '关键字',
  29419. bind: {
  29420. value: "{form2.key}"
  29421. },
  29422. },
  29423. {
  29424. xtype: 'datefield',
  29425. fieldLabel: '开始时间',
  29426. bind: {
  29427. value: "{form2.start_at}"
  29428. },
  29429. },
  29430. {
  29431. xtype: 'datefield',
  29432. fieldLabel: '结束时间',
  29433. bind: {
  29434. value: "{form2.end_at}"
  29435. },
  29436. },
  29437. ]
  29438. },
  29439. {
  29440. xtype: "cols",
  29441. items: [
  29442. {
  29443. xtype: "box",
  29444. },
  29445. {
  29446. xtype: "button",
  29447. text: '查询',
  29448. listeners: {
  29449. click: 'queryLog'
  29450. },
  29451. },
  29452. {
  29453. xtype: "box",
  29454. },
  29455. ]
  29456. },
  29457. ],
  29458. });
  29459. }
  29460. var model$m = {
  29461. data: {
  29462. // opsId: "",
  29463. // name: "",
  29464. running: false,
  29465. }
  29466. };
  29467. var vjson$l = {
  29468. bind: {
  29469. title: '运维-{name}',
  29470. },
  29471. layout: 'fit',
  29472. items: [
  29473. {
  29474. layout: 'border',
  29475. items: [
  29476. {
  29477. region: 'north',
  29478. items: [
  29479. {
  29480. xtype: 'toolbar',
  29481. border: false,
  29482. items: [
  29483. {
  29484. xtype: 'button',
  29485. text: '执行',
  29486. iconCls: 'x-fa fa-play',
  29487. bind: {
  29488. hidden: "{running}",
  29489. },
  29490. listeners: {
  29491. click: 'scope.start'
  29492. }
  29493. },
  29494. {
  29495. xtype: 'button',
  29496. text: '停止',
  29497. iconCls: 'x-fa fa-stop',
  29498. bind: {
  29499. hidden: "{!running}",
  29500. },
  29501. listeners: {
  29502. click: 'scope.stop'
  29503. }
  29504. },
  29505. ],
  29506. },
  29507. ]
  29508. },
  29509. {
  29510. region: 'center',
  29511. reference: 'terminal',
  29512. xtype: 'terminal',
  29513. },
  29514. ],
  29515. },
  29516. ],
  29517. };
  29518. var DevOpsTerminal = /** @class */ (function (_super) {
  29519. __extends(DevOpsTerminal, _super);
  29520. function DevOpsTerminal() {
  29521. var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this;
  29522. _this.websocket = undefined;
  29523. return _this;
  29524. }
  29525. DevOpsTerminal.prototype.onLoad = function () {
  29526. this.load();
  29527. };
  29528. DevOpsTerminal.prototype.onDestroy = function () {
  29529. if (this.websocket) {
  29530. this.websocket.close();
  29531. this.websocket = undefined;
  29532. }
  29533. };
  29534. DevOpsTerminal.prototype.load = function () {
  29535. var _this = this;
  29536. var opsId = this.viewModel.get('opsId');
  29537. this.setLoading(true);
  29538. devOpsById(opsId).then(function (res) {
  29539. _this.viewModel.set('devOps', res.data);
  29540. }).finally(function () {
  29541. _this.setLoading(false);
  29542. });
  29543. };
  29544. DevOpsTerminal.prototype.start = function () {
  29545. var me = this;
  29546. var running = this.viewModel.get('running');
  29547. var devOps = this.viewModel.get('devOps');
  29548. if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
  29549. return;
  29550. var devopsServer = "ws://122.9.140.63:9999";
  29551. this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
  29552. this.websocket.addEventListener('open', function () {
  29553. me.viewModel.set('running', true);
  29554. me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
  29555. });
  29556. this.websocket.addEventListener('message', function (event) {
  29557. me.refs.terminal.write(event.data);
  29558. });
  29559. this.websocket.addEventListener('close', function () {
  29560. me.stop();
  29561. });
  29562. this.websocket.addEventListener('error', function () {
  29563. me.stop();
  29564. });
  29565. };
  29566. DevOpsTerminal.prototype.stop = function () {
  29567. if (this.websocket) {
  29568. this.websocket.close();
  29569. this.websocket = undefined;
  29570. }
  29571. this.viewModel.set('running', false);
  29572. };
  29573. return DevOpsTerminal;
  29574. }(Scope));
  29575. var Controller$3 = /** @class */ (function () {
  29576. function Controller() {
  29577. }
  29578. Controller.prototype.onLoad = function (sender) {
  29579. this.reload();
  29580. };
  29581. Controller.prototype.reload = function () {
  29582. var me = this;
  29583. // @ts-ignore
  29584. var view = me.getView();
  29585. view.setLoading(true);
  29586. devOpsList().then(function (res) {
  29587. view.setStore(new Ext.data.Store({
  29588. fields: ['ops_id', 'host', 'name'],
  29589. data: res.data,
  29590. }));
  29591. }).finally(function () {
  29592. view.setLoading(false);
  29593. });
  29594. };
  29595. Controller.prototype.onDblClick = function (sender) {
  29596. this.devOpsTerminal();
  29597. };
  29598. Controller.prototype.devOpsTerminal = function () {
  29599. // @ts-ignore
  29600. var view = this.getView();
  29601. var _a = __read(view.getSelection(), 1), record = _a[0];
  29602. if (record) {
  29603. var name = record.get('name');
  29604. var opsId = record.get('ops_id');
  29605. var instance = new DevOpsTerminal();
  29606. instance.showPage({
  29607. id: 'ops_' + opsId,
  29608. path: 'ops_' + opsId,
  29609. }, {
  29610. data: {
  29611. opsId: opsId,
  29612. name: name,
  29613. }
  29614. });
  29615. instance.dialogSuccess = function () {
  29616. };
  29617. }
  29618. };
  29619. return Controller;
  29620. }());
  29621. var controller$3 = new Controller$3();
  29622. function initDevOpsTree () {
  29623. Ext.define('com.yvan.studio.DevOpsGrid', {
  29624. extend: 'Ext.grid.Panel',
  29625. xtype: 'devopsgrid',
  29626. controller: controller$3,
  29627. scope: controller$3,
  29628. referenceHolder: true,
  29629. tooltip: '运维',
  29630. iconCls: 'x-fa fa-terminal',
  29631. useArrows: true,
  29632. reference: 'devopsgrid',
  29633. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29634. listeners: {
  29635. afterrender: 'onLoad',
  29636. itemdblclick: 'onDblClick',
  29637. },
  29638. viewConfig: {
  29639. // listeners: {
  29640. // itemcontextmenu: 'onGridContextMenu',
  29641. // },
  29642. },
  29643. tbar: {
  29644. xtype: 'toolbar',
  29645. items: [
  29646. {
  29647. xtype: 'button',
  29648. tooltip: '刷新',
  29649. iconCls: 'x-fa fa-refresh',
  29650. listeners: {
  29651. click: 'reload'
  29652. }
  29653. },
  29654. {
  29655. xtype: 'textfield',
  29656. flex: 1,
  29657. emptyText: '搜索过滤',
  29658. enableKeyEvents: true,
  29659. listeners: {
  29660. change: {
  29661. fn: 'filterChanged',
  29662. buffer: 50
  29663. }
  29664. }
  29665. },
  29666. ]
  29667. },
  29668. columns: [
  29669. {
  29670. text: 'ID', dataIndex: 'report_id',
  29671. hidden: true,
  29672. },
  29673. {
  29674. text: '服务器',
  29675. dataIndex: 'host',
  29676. width: 100,
  29677. menuDisabled: true,
  29678. },
  29679. {
  29680. text: '操作名称',
  29681. dataIndex: 'name',
  29682. flex: 1,
  29683. menuDisabled: true,
  29684. },
  29685. ]
  29686. });
  29687. }
  29688. function initTerminal () {
  29689. Ext.define('com.yvan.studio.Terminal', {
  29690. extend: 'Ext.panel.Panel',
  29691. alias: 'widget.terminal',
  29692. xtype: 'terminal',
  29693. layout: 'fit',
  29694. border: false,
  29695. html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
  29696. config: {},
  29697. write: function (str) {
  29698. if (this.term) {
  29699. this.term.write(str);
  29700. }
  29701. },
  29702. initComponent: function () {
  29703. var that = this;
  29704. this.superclass.initComponent.call(this, arguments);
  29705. that.on({
  29706. resize: function () {
  29707. var _a;
  29708. if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
  29709. that.fitAddon.fit();
  29710. }
  29711. },
  29712. destory: function () {
  29713. if (that.term) {
  29714. that.term.dispose();
  29715. delete that.term;
  29716. }
  29717. if (that.fitAddon) {
  29718. that.fitAddon.dispose();
  29719. delete that.fitAddon;
  29720. }
  29721. },
  29722. afterrender: function (sender) {
  29723. _.defer(function () {
  29724. var $dom = $(that.el.dom).find('.terminal');
  29725. that.term = new xterm.Terminal({
  29726. // cursorBlink: false,
  29727. // cursorStyle: 'bar', // block underline bar
  29728. // enableBold: false,
  29729. // bellStyle: "sound",
  29730. fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
  29731. // scrollback: 10000,
  29732. // tabStopWidth: 4,
  29733. disableStdin: true,
  29734. theme: {
  29735. // foreground: "#111",
  29736. // background: "#fdfdfd",
  29737. // background: "#fafafa",
  29738. },
  29739. });
  29740. that.fitAddon = new xtermAddonFit.FitAddon();
  29741. that.term.loadAddon(that.fitAddon);
  29742. that.term.open($dom[0]);
  29743. that.fitAddon.fit();
  29744. // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
  29745. });
  29746. }
  29747. });
  29748. }
  29749. });
  29750. }
  29751. var vjson$m = {
  29752. title: '接口统计',
  29753. layout: 'fit',
  29754. items: [
  29755. {
  29756. title: '接口统计',
  29757. xtype: 'yvgrid',
  29758. enableLocking: false,
  29759. reference: 'grid1',
  29760. pagination: false,
  29761. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29762. tbar: {
  29763. xtype: 'form',
  29764. items: [
  29765. {
  29766. xtype: 'cols',
  29767. items: [
  29768. {
  29769. xtype: 'textfield',
  29770. fieldLabel: '搜索',
  29771. listeners: {
  29772. change: 'scope.requestFilterChange'
  29773. }
  29774. },
  29775. ]
  29776. },
  29777. ]
  29778. },
  29779. columns: [
  29780. { text: '地址', dataIndex: 'url', flex: 1 },
  29781. { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
  29782. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29783. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29784. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29785. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29786. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29787. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29788. ],
  29789. leadingBufferZone: 8,
  29790. trailingBufferZone: 8,
  29791. viewConfig: {
  29792. listeners: {
  29793. expandbody: 'scope.onChildExpand'
  29794. }
  29795. },
  29796. listeners: {
  29797. itemdblclick: 'scope.itemClick1'
  29798. },
  29799. plugins: {
  29800. rowwidget: {
  29801. widget: {
  29802. xtype: 'yvgrid',
  29803. hideFootbar: true,
  29804. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  29805. listeners: {
  29806. itemdblclick: 'scope.itemClick1'
  29807. },
  29808. columns: [
  29809. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  29810. { text: '次数', dataIndex: 'count', dataType: 'number' },
  29811. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  29812. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  29813. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  29814. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  29815. { text: '直方图', dataIndex: 'histogram', width: 180 },
  29816. ]
  29817. }
  29818. }
  29819. }
  29820. },
  29821. ]
  29822. };
  29823. var model$n = {
  29824. data: {
  29825. count: 0,
  29826. dataSourceName: '',
  29827. sql: "",
  29828. histogram: '',
  29829. maxCost: 0,
  29830. minCost: 0,
  29831. avgCost: '',
  29832. sumCost: 0,
  29833. histogramInfos: [
  29834. // count: 1
  29835. // gteCost: 20
  29836. // ltCost: 50
  29837. // 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"
  29838. // topN: [
  29839. // cost: 24
  29840. // occurrenceTime: "1648004895171"
  29841. // 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"
  29842. // ]
  29843. ]
  29844. }
  29845. };
  29846. var vjson$n = {
  29847. title: '性能统计详情',
  29848. height: 400,
  29849. width: 800,
  29850. modal: true,
  29851. layout: 'fit',
  29852. items: [
  29853. {
  29854. xtype: 'tabpanel',
  29855. items: [
  29856. {
  29857. title: '摘要',
  29858. key: "1",
  29859. layout: 'border',
  29860. items: [
  29861. {
  29862. region: 'north',
  29863. border: false,
  29864. defaults: {
  29865. margin: '8 0 0 0'
  29866. },
  29867. items: [
  29868. {
  29869. xtype: 'cols',
  29870. defaultType: 'displayfield',
  29871. defaults: {
  29872. labelWidth: 70,
  29873. },
  29874. items: [
  29875. {
  29876. fieldLabel: 'count',
  29877. bind: {
  29878. value: '{count}'
  29879. }
  29880. },
  29881. {
  29882. fieldLabel: 'maxCost',
  29883. bind: {
  29884. value: '{maxCost}'
  29885. }
  29886. },
  29887. {
  29888. fieldLabel: 'minCost',
  29889. bind: {
  29890. value: '{minCost}'
  29891. }
  29892. },
  29893. {
  29894. fieldLabel: 'avgCost',
  29895. bind: {
  29896. value: '{avgCost}'
  29897. }
  29898. },
  29899. {
  29900. fieldLabel: 'sumCost',
  29901. bind: {
  29902. value: '{sumCost}'
  29903. }
  29904. },
  29905. ]
  29906. },
  29907. {
  29908. xtype: 'cols',
  29909. items: [
  29910. {
  29911. flex: 5,
  29912. border: false,
  29913. items: [
  29914. {
  29915. xtype: 'segmentedbutton',
  29916. reference: 'histogram',
  29917. allowToggle: false,
  29918. border: false,
  29919. items: []
  29920. }
  29921. ]
  29922. },
  29923. ]
  29924. },
  29925. ],
  29926. },
  29927. {
  29928. region: 'center',
  29929. xtype: 'sqleditor',
  29930. reference: 'sqlEditor',
  29931. },
  29932. ]
  29933. },
  29934. {
  29935. title: '直方图',
  29936. key: "2",
  29937. }
  29938. ]
  29939. }
  29940. ]
  29941. };
  29942. var PerformDialog = /** @class */ (function (_super) {
  29943. __extends(PerformDialog, _super);
  29944. function PerformDialog() {
  29945. return _super.call(this, { model: model$n, vjson: vjson$n }) || this;
  29946. }
  29947. PerformDialog.prototype.onLoad = function () {
  29948. var _this = this;
  29949. var sql = this.viewModel.get('sql');
  29950. var sql2 = sqlFormat.format(sql, {
  29951. indent: ' ',
  29952. uppercase: true,
  29953. });
  29954. var histogramInfos = this.viewModel.get('histogramInfos');
  29955. var vs = _$2.map(histogramInfos, function (v) {
  29956. if (v.ltCost > 2100000000) {
  29957. return {
  29958. text: "[" + v.gteCost + ", \u221E):" + v.count
  29959. };
  29960. }
  29961. return {
  29962. text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
  29963. };
  29964. });
  29965. this.refs.sqlEditor.setCode(sql2);
  29966. _$2.forEach(vs, function (v) {
  29967. _this.refs.histogram.add(v);
  29968. });
  29969. };
  29970. return PerformDialog;
  29971. }(Scope));
  29972. var model$o = {
  29973. data: {}
  29974. };
  29975. var PerformStats = /** @class */ (function (_super) {
  29976. __extends(PerformStats, _super);
  29977. function PerformStats() {
  29978. var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this;
  29979. _this.requestFilterChange = _.debounce(function (sender, value) {
  29980. var store = _this.refs.grid1.store;
  29981. store.clearFilter();
  29982. if (value) {
  29983. store.filterBy(function (record, id) {
  29984. var text = toString(record.get('url'));
  29985. // 用拼音筛选的方式
  29986. return text.includes(value);
  29987. });
  29988. }
  29989. }, 100);
  29990. return _this;
  29991. }
  29992. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  29993. widget.setData(record.data.children);
  29994. };
  29995. PerformStats.prototype.itemClick1 = function (sender, record) {
  29996. console.log('itemClick1', record.data);
  29997. new PerformDialog().showDialog(sender, {}, {
  29998. data: record.data
  29999. });
  30000. };
  30001. PerformStats.prototype.onLoad = function () {
  30002. var _this = this;
  30003. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  30004. .then(function (_a) {
  30005. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  30006. var resData = reqRes.data;
  30007. var jdbcData = jdbcRes.data;
  30008. _.forEach(jdbcData, function (item) {
  30009. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30010. });
  30011. _.forEach(resData, function (item) {
  30012. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30013. if (_.isArray(item.sqls)) {
  30014. item.children = _.map(item.sqls, function (sql) {
  30015. return _.find(jdbcData, function (r) { return r.sql === sql; });
  30016. }).filter(function (v) { return !!v; });
  30017. }
  30018. item.jdbcCount = _.size(item.children);
  30019. });
  30020. _this.refs.grid1.setData(resData);
  30021. // this.refs.grid2.setData(jdbcData)
  30022. });
  30023. };
  30024. return PerformStats;
  30025. }(Scope));
  30026. var vjson$o = {
  30027. title: '性能统计',
  30028. layout: 'fit',
  30029. items: [
  30030. {
  30031. title: '数据库统计',
  30032. xtype: 'yvgrid',
  30033. enableLocking: false,
  30034. reference: 'grid2',
  30035. pagination: false,
  30036. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30037. tbar: {
  30038. xtype: 'form',
  30039. items: [
  30040. {
  30041. xtype: 'cols',
  30042. items: [
  30043. {
  30044. fieldLabel: '搜索',
  30045. listeners: {
  30046. change: 'scope.jdbcFilterChange'
  30047. }
  30048. },
  30049. ]
  30050. },
  30051. ]
  30052. },
  30053. listeners: {
  30054. itemdblclick: 'scope.itemClick1'
  30055. },
  30056. columns: [
  30057. { text: 'SQL', dataIndex: 'sql', flex: 1 },
  30058. { text: '次数', dataIndex: 'count', dataType: 'number' },
  30059. { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
  30060. { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
  30061. { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
  30062. { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
  30063. { text: '直方图', dataIndex: 'histogram', width: 180 },
  30064. ]
  30065. },
  30066. ]
  30067. };
  30068. var model$p = {
  30069. data: {}
  30070. };
  30071. var PerformStats$1 = /** @class */ (function (_super) {
  30072. __extends(PerformStats, _super);
  30073. function PerformStats() {
  30074. var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this;
  30075. _this.jdbcFilterChange = _.debounce(function (sender, value) {
  30076. var store = _this.refs.grid2.store;
  30077. store.clearFilter();
  30078. if (value) {
  30079. store.filterBy(function (record, id) {
  30080. var text = toString(record.get('sql'));
  30081. // 用拼音筛选的方式
  30082. return text.includes(value);
  30083. });
  30084. }
  30085. }, 100);
  30086. return _this;
  30087. }
  30088. PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
  30089. widget.setData(record.data.children);
  30090. };
  30091. PerformStats.prototype.itemClick1 = function (sender, record) {
  30092. console.log('itemClick1', record.data);
  30093. new PerformDialog().showDialog(sender, {}, {
  30094. data: record.data
  30095. });
  30096. };
  30097. PerformStats.prototype.onLoad = function () {
  30098. var _this = this;
  30099. Promise.all([metricsRequestApi(), metricsJdbcApi()])
  30100. .then(function (_a) {
  30101. var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
  30102. var resData = reqRes.data;
  30103. var jdbcData = jdbcRes.data;
  30104. _.forEach(jdbcData, function (item) {
  30105. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30106. });
  30107. _.forEach(resData, function (item) {
  30108. item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
  30109. if (_.isArray(item.sqls)) {
  30110. item.children = _.map(item.sqls, function (sql) {
  30111. return _.find(jdbcData, function (r) { return r.sql === sql; });
  30112. }).filter(function (v) { return !!v; });
  30113. }
  30114. item.jdbcCount = _.size(item.children);
  30115. });
  30116. _this.refs.grid2.setData(jdbcData);
  30117. });
  30118. };
  30119. return PerformStats;
  30120. }(Scope));
  30121. var Controller$4 = /** @class */ (function () {
  30122. function Controller() {
  30123. }
  30124. Controller.prototype.onDblClick = function (sender, record) {
  30125. var data = record.raw;
  30126. if (data.text === "接口统计") {
  30127. var page = new PerformStats();
  30128. page.showPage({
  30129. title: "接口统计",
  30130. id: '_InterfaceStatistics',
  30131. path: '_InterfaceStatistics',
  30132. }, {});
  30133. }
  30134. else if (data.text === "数据库统计") {
  30135. var page = new PerformStats$1();
  30136. page.showPage({
  30137. title: "数据库统计",
  30138. id: '_DatabaseStatistics',
  30139. path: '_DatabaseStatistics',
  30140. }, {});
  30141. }
  30142. };
  30143. Controller.prototype.onLoad = function () {
  30144. var me = this;
  30145. //@ts-ignore
  30146. var view = me.getView();
  30147. view.setRootNode({
  30148. expanded: true,
  30149. leaf: false,
  30150. children: [
  30151. { leaf: true, text: '接口统计' },
  30152. { leaf: true, text: '数据库统计' },
  30153. ]
  30154. });
  30155. };
  30156. return Controller;
  30157. }());
  30158. var controller$4 = new Controller$4();
  30159. function initMonitorTree () {
  30160. Ext.define('com.yvan.studio.MonitorTree', {
  30161. extend: 'Ext.tree.Panel',
  30162. xtype: 'monitortree',
  30163. controller: controller$4,
  30164. scope: controller$4,
  30165. reference: 'roleGrid',
  30166. tooltip: '表单定义',
  30167. iconCls: 'x-fa fa-bar-chart',
  30168. useArrows: true,
  30169. rootVisible: false,
  30170. colspan: 2,
  30171. lines: true,
  30172. multiSelect: false,
  30173. referenceHolder: true,
  30174. // openNode() {
  30175. // const selection = this.getSelection()
  30176. // const [record] = selection
  30177. // if (!record) {
  30178. // return
  30179. // }
  30180. //
  30181. // const {raw} = record;
  30182. // if (raw.type === 'Dir') {
  30183. // return
  30184. // }
  30185. // if (raw.type === "Module" && raw.module) {
  30186. // // eventBus.publish(EventType.ModuleOpen, raw)
  30187. // }
  30188. // },
  30189. listeners: {
  30190. itemdblclick: 'onDblClick',
  30191. afterrender: "onLoad",
  30192. },
  30193. });
  30194. }
  30195. var Controller$5 = /** @class */ (function () {
  30196. function Controller() {
  30197. }
  30198. return Controller;
  30199. }());
  30200. var controller$5 = new Controller$5();
  30201. function initHomeTree () {
  30202. Ext.define('com.yvan.studio.HomeTree', {
  30203. extend: 'Ext.Panel',
  30204. xtype: 'hometree',
  30205. controller: controller$5,
  30206. scope: controller$5,
  30207. referenceHolder: true,
  30208. bodyCls: 'home',
  30209. // layout: 'fit',
  30210. tbar: {
  30211. xtype: 'toolbar',
  30212. items: [
  30213. {
  30214. xtype: 'button',
  30215. iconCls: 'x-fa fa-exchange',
  30216. text: '数据结构同步',
  30217. handler: function (sender) {
  30218. handles$1.mainWindow.showDataSync(sender);
  30219. }
  30220. },
  30221. {
  30222. xtype: 'button',
  30223. iconCls: 'x-fa fa-cubes',
  30224. text: '数据域管理',
  30225. handler: function (sender) {
  30226. handles$1.mainWindow.showColumnDomain();
  30227. }
  30228. },
  30229. ],
  30230. },
  30231. // items: [
  30232. //
  30233. // ],
  30234. layout: {
  30235. type: 'vbox',
  30236. pack: 'start',
  30237. align: 'stretch',
  30238. },
  30239. items: [
  30240. { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
  30241. { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
  30242. { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
  30243. { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
  30244. { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
  30245. { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
  30246. { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
  30247. { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
  30248. { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
  30249. ],
  30250. });
  30251. }
  30252. var WidgetStore = /** @class */ (function (_super) {
  30253. __extends(WidgetStore, _super);
  30254. function WidgetStore() {
  30255. return _super !== null && _super.apply(this, arguments) || this;
  30256. }
  30257. WidgetStore.prototype.getCacheKey = function (param) {
  30258. return "widget_data.json";
  30259. };
  30260. /*invokeApi(param: any): Promise<any> {
  30261. return new Promise<any>(resolve => {
  30262. //@ts-ignore
  30263. require(["../../widget/all"], function (res) {
  30264. const widgetList = res.default
  30265. resolve(widgetList)
  30266. })
  30267. })
  30268. }*/
  30269. WidgetStore.prototype.invokeApi = function (param) {
  30270. return widgetListApi(param);
  30271. };
  30272. return WidgetStore;
  30273. }(CacheStore));
  30274. var instance$3 = new WidgetStore();
  30275. var WidgetGridController = /** @class */ (function () {
  30276. function WidgetGridController() {
  30277. }
  30278. WidgetGridController.prototype.onLoad = function (sender) {
  30279. var me = this;
  30280. setWidget(me);
  30281. instance$3.registe(me.reloadData.bind(this));
  30282. instance$3.reloadIfNeed(undefined);
  30283. };
  30284. WidgetGridController.prototype.widgetAdd = function (sender) {
  30285. var me = this;
  30286. var win = new Ext.Window({
  30287. autoDestroy: true,
  30288. title: "新建弹框",
  30289. width: 400,
  30290. height: 220,
  30291. resizable: true,
  30292. closable: true,
  30293. maximizable: true,
  30294. minimizable: true,
  30295. plain: true,
  30296. // constrainHeader: true,
  30297. constrain: true,
  30298. layout: 'fit',
  30299. animateTarget: sender,
  30300. buttonAlign: 'center',
  30301. items: [
  30302. {
  30303. xtype: "form",
  30304. layout: "hbox",
  30305. margin: '10px 20px',
  30306. border: 0,
  30307. items: [
  30308. {
  30309. flex: 1,
  30310. layout: 'vbox',
  30311. items: [
  30312. {
  30313. xtype: "textfield",
  30314. name: "widgetcode",
  30315. fieldLabel: "弹窗文件",
  30316. flex: 1,
  30317. allowBlank: false,
  30318. regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
  30319. regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
  30320. labelWidth: 80,
  30321. width: "100%",
  30322. },
  30323. {
  30324. xtype: "textfield",
  30325. name: "widgetname",
  30326. fieldLabel: "弹窗名称",
  30327. flex: 1,
  30328. allowBlank: false,
  30329. labelWidth: 80,
  30330. width: "100%",
  30331. },
  30332. ]
  30333. },
  30334. ]
  30335. }
  30336. ],
  30337. //窗口按钮
  30338. buttons: [
  30339. {
  30340. xtype: 'button', text: '保存', handler: function (btn) {
  30341. //窗口获取表单
  30342. var form = win.down('form');
  30343. var vaildSuccess = form.isValid();
  30344. if (!vaildSuccess) {
  30345. return;
  30346. }
  30347. var title = form.down('textfield[name="widgetname"]').getValue();
  30348. var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
  30349. saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
  30350. if (res.success) {
  30351. msg$1('添加成功');
  30352. // 添加
  30353. handles$1.mainWindow.showWidget(widgetPath, title, function () {
  30354. me.reload();
  30355. });
  30356. win.close();
  30357. }
  30358. });
  30359. }
  30360. },
  30361. {
  30362. xtype: 'button', text: '取消', handler: function (btn) {
  30363. //窗口关闭
  30364. win.close();
  30365. }
  30366. }
  30367. ]
  30368. });
  30369. win.show();
  30370. };
  30371. WidgetGridController.prototype.widgetRemove = function (sender) {
  30372. var _this = this;
  30373. //@ts-ignore
  30374. var record = this.getView().selection.data;
  30375. if (!record) {
  30376. msg$1('请选择一行');
  30377. return;
  30378. }
  30379. var widgetPath = record.widget_path;
  30380. Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
  30381. if (btn === 'yes') {
  30382. deleteWidget({ widgetPath: widgetPath }).then(function (res) {
  30383. if (res.success) {
  30384. msg$1(res.msg);
  30385. _this.reload();
  30386. }
  30387. });
  30388. }
  30389. });
  30390. };
  30391. WidgetGridController.prototype.widgetEdit = function (record) {
  30392. var _this = this;
  30393. if (record) {
  30394. var widgetPath = record.widget_path;
  30395. var widgetName = record.widget_name;
  30396. handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
  30397. _this.reload();
  30398. });
  30399. }
  30400. };
  30401. WidgetGridController.prototype.onDestory = function (sender) {
  30402. var me = this;
  30403. setWidget(undefined);
  30404. instance$3.unregiste(me.reloadData.bind(this));
  30405. };
  30406. WidgetGridController.prototype.reloadData = function (res) {
  30407. var me = this;
  30408. //@ts-ignore
  30409. var view = me.getView();
  30410. if (typeof res === 'object') {
  30411. // const data = []
  30412. // _.forOwn(res, (v, k) => {
  30413. // data.push({
  30414. // widget_path: k,
  30415. // widget_name: v.title,
  30416. // vjson : v
  30417. // })
  30418. // })
  30419. view.setStore(new Ext.data.Store({
  30420. fields: ['widget_path', 'widget_name'],
  30421. data: res.data,
  30422. }));
  30423. }
  30424. else if (typeof res === 'boolean') {
  30425. view.setLoading(res);
  30426. }
  30427. };
  30428. WidgetGridController.prototype.reload = function () {
  30429. instance$3.reloadForce(undefined);
  30430. };
  30431. WidgetGridController.prototype.filterChanged = function (sender, value) {
  30432. //@ts-ignore
  30433. this.view.store.clearFilter();
  30434. if (value) {
  30435. //@ts-ignore
  30436. this.view.store.filterBy(function (record) {
  30437. var widget_path = record.get('widget_path');
  30438. var widget_name = record.get('widget_name');
  30439. return (window['system'].pinyinMatch(widget_name, value) ||
  30440. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30441. });
  30442. }
  30443. };
  30444. WidgetGridController.prototype.onClearClick = function () {
  30445. var _a, _b;
  30446. //@ts-ignore
  30447. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30448. };
  30449. WidgetGridController.prototype.onDblClick = function (sender, record) {
  30450. this.widgetEdit(record.data);
  30451. };
  30452. return WidgetGridController;
  30453. }());
  30454. function initWidget () {
  30455. var controller = new WidgetGridController();
  30456. Ext.define('com.yvan.studio.WidgetGrid', {
  30457. extend: 'Ext.grid.Panel',
  30458. xtype: 'widgetgrid',
  30459. controller: controller,
  30460. scope: controller,
  30461. referenceHolder: true,
  30462. tooltip: '检索窗口',
  30463. iconCls: 'x-fa fa-search',
  30464. useArrows: true,
  30465. reference: 'widgetgrid',
  30466. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30467. listeners: {
  30468. itemdblclick: 'onDblClick',
  30469. afterrender: 'onLoad',
  30470. destory: 'onDestory',
  30471. },
  30472. viewConfig: {
  30473. listeners: {
  30474. itemcontextmenu: 'onGridContextMenu',
  30475. },
  30476. },
  30477. tbar: [
  30478. {
  30479. xtype: 'button',
  30480. tooltip: '刷新',
  30481. iconCls: 'x-fa fa-refresh',
  30482. listeners: {
  30483. click: 'reload'
  30484. }
  30485. },
  30486. {
  30487. xtype: 'button',
  30488. tooltip: '添加',
  30489. iconCls: 'x-fa fa-plus-circle',
  30490. listeners: {
  30491. click: 'widgetAdd'
  30492. }
  30493. },
  30494. {
  30495. xtype: 'button',
  30496. tooltip: '删除',
  30497. iconCls: 'x-fa fa-minus-circle',
  30498. listeners: {
  30499. click: 'widgetRemove'
  30500. }
  30501. },
  30502. ],
  30503. fbar: [
  30504. {
  30505. xtype: 'textfield',
  30506. flex: 1,
  30507. reference: "txtFilter",
  30508. emptyText: '搜索过滤',
  30509. enableKeyEvents: true,
  30510. listeners: {
  30511. change: {
  30512. fn: 'filterChanged',
  30513. buffer: 50
  30514. }
  30515. }
  30516. },
  30517. ],
  30518. columns: [
  30519. {
  30520. text: '弹窗文件', dataIndex: 'widget_path',
  30521. menuDisabled: true, flex: 1,
  30522. },
  30523. {
  30524. text: '弹窗名称', dataIndex: 'widget_name',
  30525. menuDisabled: true, flex: 1,
  30526. },
  30527. ]
  30528. });
  30529. }
  30530. var WhLayoutController = /** @class */ (function () {
  30531. function WhLayoutController() {
  30532. }
  30533. WhLayoutController.prototype.onLoad = function (sender) {
  30534. var _this = this;
  30535. var me = this;
  30536. setWhLayout(me);
  30537. _$2.defer(function () {
  30538. _this.reload();
  30539. });
  30540. };
  30541. WhLayoutController.prototype.reload = function () {
  30542. //@ts-ignore
  30543. var view = this.getView();
  30544. view.setLoading(true);
  30545. loadWhLayoutAll().then(function (res) {
  30546. view.setStore(new Ext.data.Store({
  30547. fields: ['layout_code', 'layout_name'],
  30548. data: res.data,
  30549. }));
  30550. }).finally(function () {
  30551. view.setLoading(false);
  30552. });
  30553. };
  30554. WhLayoutController.prototype.add = function () {
  30555. handles$1.mainWindow.showLayoutDesign(undefined, undefined);
  30556. };
  30557. WhLayoutController.prototype.edit = function (data) {
  30558. handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
  30559. };
  30560. WhLayoutController.prototype.remove = function () {
  30561. var _this = this;
  30562. var _a;
  30563. //@ts-ignore
  30564. var view = this.getView();
  30565. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30566. if (!record) {
  30567. msg$1('请选择一行数据');
  30568. return;
  30569. }
  30570. var layoutCode = record.layout_code;
  30571. Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
  30572. if (btn === 'yes') {
  30573. deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
  30574. if (res.success) {
  30575. msg$1(res.msg);
  30576. _this.reload();
  30577. }
  30578. });
  30579. }
  30580. });
  30581. };
  30582. WhLayoutController.prototype.onDblClick = function () {
  30583. var _a;
  30584. //@ts-ignore
  30585. var view = this.getView();
  30586. var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
  30587. if (!record) {
  30588. msg$1('请选择一行数据');
  30589. return;
  30590. }
  30591. this.edit(record);
  30592. };
  30593. WhLayoutController.prototype.filterChanged = function (sender, value) {
  30594. //@ts-ignore
  30595. this.view.store.clearFilter();
  30596. if (value) {
  30597. //@ts-ignore
  30598. this.view.store.filterBy(function (record) {
  30599. var widget_path = record.get('widget_path');
  30600. var widget_name = record.get('widget_name');
  30601. return (window['system'].pinyinMatch(widget_name, value) ||
  30602. _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
  30603. });
  30604. }
  30605. };
  30606. WhLayoutController.prototype.onClearClick = function () {
  30607. var _a, _b;
  30608. //@ts-ignore
  30609. (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
  30610. };
  30611. return WhLayoutController;
  30612. }());
  30613. function initWhLayout () {
  30614. var controller = new WhLayoutController();
  30615. Ext.define('com.yvan.studio.WhLayout', {
  30616. extend: 'Ext.grid.Panel',
  30617. xtype: 'whlayout',
  30618. alias: 'widget.whlayout',
  30619. controller: controller,
  30620. scope: controller,
  30621. referenceHolder: true,
  30622. tooltip: '检索窗口',
  30623. iconCls: 'x-fa fa-search',
  30624. useArrows: true,
  30625. reference: 'whlayout',
  30626. selModel: { type: 'rowmodel', mode: 'SINGLE', },
  30627. listeners: {
  30628. itemdblclick: 'onDblClick',
  30629. afterrender: 'onLoad',
  30630. destory: 'onDestory',
  30631. },
  30632. viewConfig: {
  30633. listeners: {
  30634. itemcontextmenu: 'onGridContextMenu',
  30635. },
  30636. },
  30637. tbar: [
  30638. {
  30639. xtype: 'button',
  30640. tooltip: '刷新',
  30641. iconCls: 'x-fa fa-refresh',
  30642. listeners: {
  30643. click: 'reload'
  30644. }
  30645. },
  30646. {
  30647. xtype: 'button',
  30648. tooltip: '添加',
  30649. iconCls: 'x-fa fa-plus-circle',
  30650. listeners: {
  30651. click: 'add'
  30652. }
  30653. },
  30654. {
  30655. xtype: 'button',
  30656. tooltip: '删除',
  30657. iconCls: 'x-fa fa-minus-circle',
  30658. listeners: {
  30659. click: 'remove'
  30660. }
  30661. },
  30662. ],
  30663. fbar: [
  30664. {
  30665. xtype: 'textfield',
  30666. flex: 1,
  30667. reference: "txtFilter",
  30668. emptyText: '搜索过滤',
  30669. enableKeyEvents: true,
  30670. listeners: {
  30671. change: {
  30672. fn: 'filterChanged',
  30673. buffer: 50
  30674. }
  30675. }
  30676. },
  30677. ],
  30678. columns: [
  30679. {
  30680. text: '图编号', dataIndex: 'layout_code',
  30681. menuDisabled: true, flex: 1,
  30682. },
  30683. {
  30684. text: '图名称', dataIndex: 'layout_name',
  30685. menuDisabled: true, flex: 1,
  30686. },
  30687. ]
  30688. });
  30689. }
  30690. var BpmnTreeController = /** @class */ (function () {
  30691. function BpmnTreeController() {
  30692. }
  30693. BpmnTreeController.prototype.onLoad = function (sender) {
  30694. this.reload();
  30695. };
  30696. BpmnTreeController.prototype.reload = function () {
  30697. var me = this;
  30698. me.getView().setLoading(true);
  30699. exporerList().then(function (res) {
  30700. // handles.mainWindow.modules = res.data
  30701. // const rootNode = modulesToTreeData(res.data)
  30702. var rootNode = res.data.tree;
  30703. me.getView().setRootNode({
  30704. expanded: true,
  30705. leaf: false,
  30706. children: rootNode
  30707. });
  30708. // const lastId = window.location.hash.substring(1);
  30709. // file.selectPath(lastId)
  30710. // if (lastId) {
  30711. // const node = getModuleById(rootNode, lastId)
  30712. // if (node) {
  30713. // showDesign(node.id, node.path, node.text, node.module)
  30714. // }
  30715. // }
  30716. // this.restoreState()
  30717. }).finally(function () {
  30718. me.getView().setLoading(false);
  30719. });
  30720. };
  30721. BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
  30722. var _this = this;
  30723. e.preventDefault();
  30724. var raw = node.raw;
  30725. //const me = sender.up("treepanel").scope
  30726. var option;
  30727. if (raw.exporerType === 1) ;
  30728. else if (raw.exporerType === 21) {
  30729. if (raw.type === 'Dir') {
  30730. option = {
  30731. shadow: 'frame', allowOtherMenus: true,
  30732. items: [
  30733. {
  30734. text: '添加',
  30735. iconCls: 'x-fa fa-plus-circle',
  30736. handler: function (sender) {
  30737. var dirPath = raw.dirPath;
  30738. handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
  30739. }
  30740. },
  30741. '-',
  30742. {
  30743. text: '新建文件夹',
  30744. iconCls: 'x-fa fa-folder-o',
  30745. handler: function (sender) {
  30746. }
  30747. }
  30748. ]
  30749. };
  30750. }
  30751. else if (raw.type === 'Model') {
  30752. option = {
  30753. shadow: 'frame', allowOtherMenus: true,
  30754. items: [
  30755. {
  30756. text: '编辑',
  30757. iconCls: 'x-fa fa-edit',
  30758. handler: function (sender) {
  30759. }
  30760. },
  30761. {
  30762. text: '删除',
  30763. iconCls: 'x-fa fa-minus-circle',
  30764. handler: function (sender) {
  30765. }
  30766. },
  30767. '-',
  30768. {
  30769. text: '注册(至菜单)',
  30770. iconCls: 'x-fa fa-sign-in',
  30771. handler: function (sender) {
  30772. }
  30773. },
  30774. {
  30775. text: '新建文件夹',
  30776. iconCls: 'x-fa fa-folder-o',
  30777. handler: function (sender) {
  30778. }
  30779. }
  30780. ]
  30781. };
  30782. }
  30783. }
  30784. else if (raw.exporerType === 22) {
  30785. if (raw.type === 'Dir') {
  30786. option = {
  30787. shadow: 'frame', allowOtherMenus: true,
  30788. items: [
  30789. {
  30790. text: '添加',
  30791. iconCls: 'x-fa fa-plus-circle',
  30792. handler: function (sender) {
  30793. var dirPath = raw.dirPath;
  30794. handles$1.mainWindow.showFormBill();
  30795. }
  30796. },
  30797. '-',
  30798. {
  30799. text: '新建文件夹',
  30800. iconCls: 'x-fa fa-folder-o',
  30801. handler: function (sender) {
  30802. }
  30803. }
  30804. ]
  30805. };
  30806. }
  30807. else if (raw.type === 'Model') {
  30808. option = {
  30809. shadow: 'frame', allowOtherMenus: true,
  30810. items: [
  30811. {
  30812. text: '编辑',
  30813. iconCls: 'x-fa fa-edit',
  30814. handler: function (sender) {
  30815. }
  30816. },
  30817. {
  30818. text: '删除',
  30819. iconCls: 'x-fa fa-minus-circle',
  30820. handler: function (sender) {
  30821. }
  30822. },
  30823. '-',
  30824. {
  30825. text: '注册(至菜单)',
  30826. iconCls: 'x-fa fa-sign-in',
  30827. handler: function (sender) {
  30828. }
  30829. },
  30830. {
  30831. text: '新建文件夹',
  30832. iconCls: 'x-fa fa-folder-o',
  30833. handler: function (sender) {
  30834. }
  30835. }
  30836. ]
  30837. };
  30838. }
  30839. }
  30840. else if (raw.exporerType === 3) ;
  30841. else if (raw.exporerType === 50) {
  30842. option = {
  30843. shadow: 'frame', allowOtherMenus: true,
  30844. items: [
  30845. {
  30846. text: '新建流程',
  30847. iconCls: 'x-fa fa-new',
  30848. handler: function (sender) {
  30849. _this.bpmnAdd(sender);
  30850. }
  30851. },
  30852. ]
  30853. };
  30854. }
  30855. else if (raw.exporerType === 51) {
  30856. option = {
  30857. shadow: 'frame', allowOtherMenus: true,
  30858. items: [
  30859. {
  30860. text: '新建流程',
  30861. iconCls: 'x-fa fa-new',
  30862. handler: function (sender) {
  30863. _this.bpmnAdd(sender);
  30864. }
  30865. },
  30866. {
  30867. text: '删除',
  30868. iconCls: 'x-fa fa-minus-circle',
  30869. handler: function (sender) {
  30870. _this.bpmnDelete(sender, raw);
  30871. }
  30872. },
  30873. ]
  30874. };
  30875. }
  30876. else {
  30877. throw Error('暂时不支持!');
  30878. }
  30879. if (option) {
  30880. var treeMenu = new Ext.menu.Menu(option);
  30881. treeMenu.showAt(e.getXY());
  30882. }
  30883. };
  30884. BpmnTreeController.prototype.bpmnAdd = function (sender) {
  30885. var _this = this;
  30886. prompt$2('输入工作流名称').then(function (name) {
  30887. createBpmn("", name).then(function (res) {
  30888. if (res.success) {
  30889. msg$1('添加成功');
  30890. }
  30891. _this.reload();
  30892. });
  30893. });
  30894. };
  30895. BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
  30896. var _this = this;
  30897. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
  30898. deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
  30899. if (res.success) {
  30900. msg$1('添加成功');
  30901. }
  30902. _this.reload();
  30903. });
  30904. });
  30905. };
  30906. BpmnTreeController.prototype.reportAdd = function (sender) {
  30907. var _this = this;
  30908. prompt$2('请输入报表名称').then(function (name) {
  30909. createReportApi(name).then(function (res) {
  30910. if (res.success) {
  30911. msg$1('添加成功');
  30912. handles$1.mainWindow.showReport(res.data, name, function () {
  30913. _this.reload();
  30914. });
  30915. }
  30916. _this.reload();
  30917. });
  30918. });
  30919. };
  30920. BpmnTreeController.prototype.reportRegiste = function (sender, record) {
  30921. if (record) {
  30922. var reportName = record.get('report_name');
  30923. var reportId = record.get('report_id');
  30924. registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
  30925. }
  30926. };
  30927. BpmnTreeController.prototype.reportRemove = function (sender, record) {
  30928. var _this = this;
  30929. if (record) {
  30930. var reportName = record.get('report_name');
  30931. var reportId_1 = record.get('report_id');
  30932. YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
  30933. delReportApi(reportId_1).then(function (res) {
  30934. if (res.success) {
  30935. msg$1('删除成功');
  30936. _this.reload();
  30937. }
  30938. });
  30939. });
  30940. }
  30941. };
  30942. BpmnTreeController.prototype.reportEdit = function (sender, record) {
  30943. var _this = this;
  30944. if (!record || record.type !== 'Module') {
  30945. return;
  30946. }
  30947. var reportName = record.text;
  30948. var reportId = record.target;
  30949. handles$1.mainWindow.showReport(reportId, reportName, function () {
  30950. _this.reload();
  30951. });
  30952. };
  30953. BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
  30954. var data = record.raw;
  30955. if (data.type !== 'Module' && data.type !== 'Dir') {
  30956. return;
  30957. }
  30958. // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
  30959. if (data.exporerType === 10) { // 表单
  30960. // this.reportEdit(sender, data)
  30961. handles$1.mainWindow.showReport();
  30962. }
  30963. else if (data.exporerType === 21) {
  30964. handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
  30965. }
  30966. else if (data.exporerType === 22) {
  30967. handles$1.mainWindow.showFormBill();
  30968. }
  30969. else if (data.exporerType === 30) {
  30970. handles$1.mainWindow.showWidgetDesign();
  30971. }
  30972. else if (data.exporerType === 51) {
  30973. handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
  30974. }
  30975. else {
  30976. throw Error('暂时不支持!');
  30977. }
  30978. };
  30979. return BpmnTreeController;
  30980. }());
  30981. var controller$6 = new BpmnTreeController();
  30982. function initBpmnTree () {
  30983. Ext.define('com.yvan.studio.BpmnTree', {
  30984. extend: 'Ext.tree.Panel',
  30985. //extend: 'com.yvan.studio.StateTree',
  30986. xtype: 'bpmntree',
  30987. controller: controller$6,
  30988. scope: controller$6,
  30989. tooltip: '表单定义',
  30990. iconCls: 'x-fa fa-random',
  30991. useArrows: true,
  30992. rootVisible: false,
  30993. colspan: 2,
  30994. lines: true,
  30995. multiSelect: true,
  30996. reload: function () {
  30997. this.controller.reload.call(this, arguments);
  30998. },
  30999. openNode: function () {
  31000. var selection = this.getSelection();
  31001. var _a = __read(selection, 1), record = _a[0];
  31002. if (!record) {
  31003. return;
  31004. }
  31005. var raw = record.raw;
  31006. if (raw.type === 'Dir') {
  31007. return;
  31008. }
  31009. if (raw.type === "Module" && raw.module) ;
  31010. },
  31011. listeners: {
  31012. itemdblclick: 'onDblClick',
  31013. afterrender: 'onLoad',
  31014. // itemverify() {
  31015. // this.openNode()
  31016. // },
  31017. itemcontextmenu: 'onLisenContextMenu'
  31018. },
  31019. tbar: {
  31020. xtype: 'toolbar',
  31021. items: [
  31022. {
  31023. xtype: 'button',
  31024. tooltip: '刷新',
  31025. iconCls: 'x-fa fa-refresh',
  31026. listeners: {
  31027. click: 'reload'
  31028. }
  31029. },
  31030. /*{
  31031. xtype: 'button',
  31032. tooltip: '添加',
  31033. iconCls: 'x-fa fa-plus-circle',
  31034. menu: [
  31035. {
  31036. text: '类别',
  31037. listeners: {
  31038. click: 'classAdd'
  31039. }
  31040. },
  31041. {
  31042. text: '查询',
  31043. listeners: {
  31044. click: 'reportAdd'
  31045. }
  31046. },
  31047. '-',
  31048. {
  31049. text: '单表定义',
  31050. listeners: {
  31051. click: 'singleTableAdd'
  31052. }
  31053. },
  31054. {
  31055. text: '多表定义',
  31056. listeners: {
  31057. click: 'complexTableAdd'
  31058. }
  31059. },
  31060. {
  31061. text: '查询窗口定义',
  31062. listeners: {
  31063. click: 'widgetAdd'
  31064. }
  31065. },
  31066. ],
  31067. },
  31068. {
  31069. xtype: 'button',
  31070. tooltip: '删除',
  31071. iconCls: 'x-fa fa-minus-circle',
  31072. listeners: {
  31073. click: 'reportRemove'
  31074. }
  31075. },*/
  31076. {
  31077. xtype: 'textfield',
  31078. flex: 1,
  31079. reference: "txtFilter",
  31080. emptyText: '搜索过滤',
  31081. enableKeyEvents: true,
  31082. listeners: {
  31083. change: {
  31084. fn: 'filterChanged',
  31085. buffer: 50
  31086. }
  31087. }
  31088. },
  31089. ]
  31090. },
  31091. });
  31092. }
  31093. function initToolBox () {
  31094. Ext.define('com.yvan.studio.ToolBox', {
  31095. extend: 'Ext.panel.Panel',
  31096. xtype: 'toolbox',
  31097. tooltip: '工具箱',
  31098. layout: 'fit',
  31099. html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
  31100. border: false,
  31101. beforeRender: function () {
  31102. console.log('beforeRender', this);
  31103. },
  31104. afterRender: function () {
  31105. var $dom = $(this.body.dom).children('div');
  31106. $dom.append(createComponent());
  31107. $dom.css("height", '100%');
  31108. // @ts-ignore
  31109. $('#_toolbox_list').find('li').each(function () {
  31110. var id = $(this).children(':first').attr('drag_id');
  31111. var node = _$2.find(codeLines, function (node) { return node.id === id; });
  31112. setDrag(this, node);
  31113. });
  31114. }
  31115. });
  31116. }
  31117. function setDrag(el, node) {
  31118. new Ext.drag.Source({
  31119. element: el,
  31120. proxy: {
  31121. type: 'placeholder',
  31122. getElement: function (info) {
  31123. var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
  31124. return Ext.getBody().createChild({
  31125. html: html
  31126. });
  31127. }
  31128. },
  31129. listeners: {
  31130. dragmove: delegateDragmove.bind(getDesignInstance(), node),
  31131. dragend: delegateDragend.bind(getDesignInstance(), node),
  31132. },
  31133. sourceVjson: node.code,
  31134. dragType: node.dragType
  31135. });
  31136. }
  31137. function createComponent() {
  31138. var template = [];
  31139. for (var i = 0; i < codeLines.length; i++) {
  31140. var item = codeLines[i];
  31141. if (!item.dragHtml) {
  31142. continue;
  31143. }
  31144. var $ele = $("<li>" + item.dragHtml + "</li>");
  31145. $ele.children(':first').attr('drag_id', item.id);
  31146. $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
  31147. template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
  31148. }
  31149. var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
  31150. return html;
  31151. }
  31152. var codeLines = [
  31153. {
  31154. id: '$label',
  31155. value: layoutOrXtypeNameMap.label + ' - label',
  31156. icon: "fa fa-font",
  31157. dragType: "col-item",
  31158. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31159. code: {
  31160. xtype: 'label',
  31161. text: '文本' + _$2.uniqueId('_l')
  31162. }
  31163. },
  31164. {
  31165. id: '$text',
  31166. value: layoutOrXtypeNameMap.textfield + ' - textfield',
  31167. icon: "fa fa-edit",
  31168. dragType: "col-item",
  31169. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31170. code: {
  31171. xtype: 'textfield',
  31172. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31173. }
  31174. },
  31175. {
  31176. id: '$textarea',
  31177. value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
  31178. icon: "fa fa-edit",
  31179. dragType: "col-item",
  31180. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31181. code: {
  31182. xtype: 'textareafield',
  31183. fieldLabel: '输入框' + _$2.uniqueId('_e')
  31184. }
  31185. },
  31186. {
  31187. id: '$number',
  31188. value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
  31189. icon: "fa fa-edit",
  31190. dragType: "col-item",
  31191. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31192. code: {
  31193. xtype: 'numberfield',
  31194. fieldLabel: '数字框' + _$2.uniqueId('_n')
  31195. }
  31196. },
  31197. {
  31198. id: '$combo',
  31199. value: layoutOrXtypeNameMap.combo + ' - combo',
  31200. icon: "fa fa-angle-double-down",
  31201. dragType: "col-item",
  31202. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31203. code: {
  31204. xtype: 'combo',
  31205. fieldLabel: '请选择',
  31206. data: [
  31207. { id: 'id1', text: '选项1' },
  31208. { id: 'id2', text: '选项2' },
  31209. { id: 'id3', text: '选项3' },
  31210. ],
  31211. }
  31212. },
  31213. {
  31214. id: '$datebox',
  31215. value: layoutOrXtypeNameMap.datefield + ' - datefield',
  31216. icon: "fa fa-calendar",
  31217. dragType: "col-item",
  31218. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31219. code: {
  31220. xtype: "datefield",
  31221. fieldLabel: '日期',
  31222. }
  31223. },
  31224. {
  31225. id: '$searchbox',
  31226. value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
  31227. icon: "fa fa-search",
  31228. dragType: "col-item",
  31229. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31230. code: {
  31231. xtype: 'searchfield',
  31232. fieldLabel: '搜索框',
  31233. }
  31234. },
  31235. {
  31236. id: '$combogrid',
  31237. value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
  31238. icon: "fa fa-table",
  31239. dragType: "col-item",
  31240. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31241. code: {
  31242. xtype: 'combogrid',
  31243. fieldLabel: '下拉表'
  31244. }
  31245. },
  31246. {
  31247. id: '$combotree',
  31248. value: layoutOrXtypeNameMap.combotree + ' - combotree',
  31249. icon: "fa fa-tree",
  31250. dragType: "col-item",
  31251. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31252. code: {
  31253. xtype: 'combotree',
  31254. fieldLabel: '下拉树',
  31255. displayField: 'text',
  31256. rootVisible: false
  31257. }
  31258. },
  31259. {
  31260. id: '$button',
  31261. value: layoutOrXtypeNameMap.button + ' - button',
  31262. icon: 'fa fa-sign-in',
  31263. dragType: "col-item",
  31264. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31265. code: {
  31266. text: '按钮',
  31267. iconCls: 'x-fa fa-bars',
  31268. xtype: 'button'
  31269. }
  31270. },
  31271. {
  31272. id: '$checkbox',
  31273. value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
  31274. icon: 'fa fa-check-square',
  31275. dragType: "col-item",
  31276. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31277. code: {
  31278. xtype: 'checkbox',
  31279. boxLabel: '勾选框',
  31280. hideLabel: true,
  31281. margin: '0 0 0 15',
  31282. flex: 0,
  31283. }
  31284. },
  31285. {
  31286. id: '$checkboxgroup',
  31287. value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
  31288. icon: 'fa fa-check-square',
  31289. dragType: "col-item",
  31290. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31291. code: {
  31292. xtype: 'checkboxgroup',
  31293. fieldLabel: '勾选组',
  31294. items: [
  31295. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31296. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31297. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31298. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31299. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31300. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31301. ]
  31302. }
  31303. },
  31304. {
  31305. id: '$radio',
  31306. value: layoutOrXtypeNameMap.radio + ' - radio',
  31307. icon: 'fa fa-dot-circle-o',
  31308. dragType: "col-item",
  31309. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31310. code: {
  31311. xtype: "radio",
  31312. fieldLabel: "请选择",
  31313. }
  31314. },
  31315. {
  31316. id: '$radiogroup',
  31317. value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
  31318. icon: 'fa fa-dot-circle-o',
  31319. dragType: "col-item",
  31320. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31321. code: {
  31322. xtype: "radiogroup",
  31323. fieldLabel: "请选择",
  31324. items: [
  31325. { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
  31326. { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
  31327. { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
  31328. { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
  31329. { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
  31330. { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
  31331. ]
  31332. }
  31333. },
  31334. {
  31335. id: '$cols',
  31336. value: layoutOrXtypeNameMap.cols + ' - cols',
  31337. icon: 'fa fa-list-alt',
  31338. dragType: "cols-container",
  31339. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31340. code: {
  31341. xtype: 'cols',
  31342. items: [
  31343. {
  31344. xtype: 'textfield',
  31345. fieldLabel: '输入框',
  31346. },
  31347. ],
  31348. }
  31349. },
  31350. {
  31351. id: '$container',
  31352. value: layoutOrXtypeNameMap.container + ' - container',
  31353. icon: 'fa fa-flag',
  31354. dragType: "col-item",
  31355. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31356. code: {
  31357. xtype: 'container',
  31358. border: false,
  31359. layout: 'hbox',
  31360. }
  31361. },
  31362. {
  31363. id: '$fit',
  31364. value: layoutOrXtypeNameMap.fit + ' - fit',
  31365. icon: 'fa fa-flag',
  31366. dragType: "rows-container",
  31367. dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
  31368. code: {
  31369. border: false,
  31370. layout: 'fit',
  31371. items: [
  31372. {
  31373. xtype: 'container',
  31374. border: false,
  31375. layout: 'hbox',
  31376. }
  31377. ]
  31378. }
  31379. },
  31380. ];
  31381. // @ts-ignore
  31382. // export default ToolBoxCmp
  31383. var that = undefined;
  31384. function initPropertyDesign () {
  31385. Ext.define('com.yvan.studio.PropertyDesign', {
  31386. extend: 'Ext.panel.Panel',
  31387. xtype: 'propertydesign',
  31388. name: "PropertyDesign",
  31389. tooltip: '属性',
  31390. iconCls: 'x-fa fa-newspaper-o',
  31391. reference: 'propertygrid',
  31392. layout: 'border',
  31393. border: false,
  31394. moduleId: null,
  31395. currentComponentVJson: null,
  31396. currentComponentPropertyEditSource: null,
  31397. vjson: null,
  31398. propertyHandle: null,
  31399. moduleSubscribe: null,
  31400. items: [
  31401. new Ext.grid.property.Grid({
  31402. sortableColumns: false,
  31403. region: 'center',
  31404. listeners: {
  31405. propertychange: function (source, propName, value, oldValue, eOpts) {
  31406. value = _.trim(value);
  31407. var a = _.find(that.currentComponentPropertyEditSource, function (item) {
  31408. return item.label === propName;
  31409. });
  31410. if (a.type === 'listeners') {
  31411. if (value) {
  31412. if (that.currentComponentVJson.listeners) {
  31413. that.currentComponentVJson.listeners[propName] = value;
  31414. }
  31415. else {
  31416. var t = {};
  31417. t[propName] = value;
  31418. that.currentComponentVJson.listeners = t;
  31419. }
  31420. }
  31421. else {
  31422. _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
  31423. if (!value1) {
  31424. delete that.currentComponentVJson.listeners[key];
  31425. }
  31426. else if (key === propName) {
  31427. delete that.currentComponentVJson.listeners[key];
  31428. }
  31429. });
  31430. if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
  31431. delete that.currentComponentVJson.listeners;
  31432. }
  31433. }
  31434. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31435. vjson: that.vjson,
  31436. from: that.name,
  31437. ignoreRenderUI: true
  31438. });
  31439. }
  31440. else if (a.type === 'fix') {
  31441. if (!value) {
  31442. delete that.currentComponentVJson[propName];
  31443. }
  31444. else {
  31445. that.currentComponentVJson[propName] = value.split("\r\n");
  31446. }
  31447. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31448. vjson: that.vjson,
  31449. from: that.name,
  31450. ignoreRenderUI: true
  31451. });
  31452. }
  31453. else if (a.type === 'bind') {
  31454. var bind_1 = that.currentComponentVJson.bind;
  31455. if (typeof bind_1 === 'string' && a.id === "value") {
  31456. if (value) {
  31457. that.currentComponentVJson.bind = value;
  31458. }
  31459. else {
  31460. delete that.currentComponentVJson.bind;
  31461. }
  31462. }
  31463. else {
  31464. // 转成bind对象
  31465. if (typeof bind_1 === 'string') {
  31466. bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
  31467. }
  31468. if (value) {
  31469. if (bind_1) {
  31470. bind_1[a.id] = value;
  31471. }
  31472. else {
  31473. var t = {};
  31474. t[a.id] = value;
  31475. that.currentComponentVJson.bind = t;
  31476. }
  31477. }
  31478. else {
  31479. _.forOwn(bind_1, function (value1, key) {
  31480. if (!value1) {
  31481. delete bind_1[key];
  31482. }
  31483. else if (key === a.id) {
  31484. delete bind_1[key];
  31485. }
  31486. });
  31487. if (Object.keys(bind_1).length <= 0) {
  31488. delete that.currentComponentVJson.bind;
  31489. }
  31490. }
  31491. }
  31492. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31493. vjson: that.vjson,
  31494. from: that.name,
  31495. ignoreRenderUI: true
  31496. });
  31497. }
  31498. else if (a.type === 'boolean') {
  31499. if (!value) {
  31500. delete that.currentComponentVJson[propName];
  31501. }
  31502. else if (value === 'false') {
  31503. that.currentComponentVJson[propName] = false;
  31504. }
  31505. else if (value === 'true') {
  31506. that.currentComponentVJson[propName] = true;
  31507. }
  31508. else {
  31509. that.currentComponentVJson[propName] = value;
  31510. }
  31511. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31512. vjson: that.vjson,
  31513. from: that.name
  31514. });
  31515. }
  31516. else {
  31517. that.currentComponentVJson[propName] = value;
  31518. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
  31519. vjson: that.vjson,
  31520. from: that.name
  31521. });
  31522. }
  31523. console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
  31524. },
  31525. }
  31526. })
  31527. ],
  31528. listeners: {
  31529. // afterrender() {
  31530. // this.propertyHandle.setSource({
  31531. // "(name)": "My Object",
  31532. // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
  31533. // "Available": false, // boolean type
  31534. // "Version": .01, // decimal type
  31535. // "Description": "A test object"
  31536. // });
  31537. // }
  31538. },
  31539. initComponent: function () {
  31540. var _this = this;
  31541. this.propertyHandle = this.items[0];
  31542. setPropertyPanel(this);
  31543. that = this;
  31544. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31545. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31546. _this.setVjson(moduleId, from, ignoreRenderUI);
  31547. });
  31548. return this.superclass.initComponent.apply(this, arguments);
  31549. },
  31550. setVjson: function (moduleId, from, ignoreRenderUI) {
  31551. var _this = this;
  31552. // if (this.moduleId === null && moduleId) {
  31553. // this.moduleId = moduleId
  31554. // }
  31555. if (moduleId !== this.moduleId || from === this.name) {
  31556. return;
  31557. }
  31558. var moduleObj = moduleStore.getModuleObject(this.moduleId);
  31559. if (!moduleObj) {
  31560. return;
  31561. }
  31562. this.vjson = moduleObj.moduleObj.vjson;
  31563. this.setPropertyAndEventSource();
  31564. if (this.componentSelectionChangeSubscribe) {
  31565. this.componentSelectionChangeSubscribe.cancel();
  31566. this.componentSelectionChangeSubscribe = null;
  31567. }
  31568. if (this.updateVjsonChangeSubscribe) {
  31569. this.updateVjsonChangeSubscribe.cancel();
  31570. this.updateVjsonChangeSubscribe = null;
  31571. }
  31572. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31573. var id = _a.id, from = _a.from;
  31574. _this.onComponentSelectionChange(id, from);
  31575. });
  31576. this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
  31577. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31578. _this.updateVjson(vjson, from, ignoreRenderUI);
  31579. });
  31580. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31581. this.onComponentSelectionChange(id, from);
  31582. },
  31583. updateVjson: function (vjson, from, ignoreRenderUI) {
  31584. if (!vjson || from === this.name) {
  31585. return;
  31586. }
  31587. this.vjson = vjson;
  31588. this.setPropertyAndEventSource();
  31589. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31590. this.onComponentSelectionChange(id, from);
  31591. },
  31592. onComponentSelectionChange: function (id, from) {
  31593. if (from !== this.name) {
  31594. this.currentComponentVJson = findInCode(this.vjson, id);
  31595. this.setPropertyAndEventSource();
  31596. }
  31597. },
  31598. setPropertyAndEventSource: function () {
  31599. var _this = this;
  31600. this.propertyHandle.setSource({});
  31601. if (!this.currentComponentVJson) {
  31602. return;
  31603. }
  31604. var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
  31605. var v = xtype;
  31606. // 选中的对象可能是组
  31607. if (!v) {
  31608. if (_.has(this.currentComponentVJson, "cols")) {
  31609. v = "cols";
  31610. }
  31611. else if (_.has(this.currentComponentVJson, "rows")) {
  31612. v = "rows";
  31613. }
  31614. }
  31615. var pd = YvanUI.PropertyDescriptionTable.get(v);
  31616. if (!pd) {
  31617. // 这个组件没有属性
  31618. this.propertyHandle.setSource({});
  31619. return;
  31620. }
  31621. var funcArr = this.getAllfuncs();
  31622. var createFuncEditor = function () { return new Ext.form.field.ComboBox({
  31623. // disabled: true,
  31624. displayField: 'name',
  31625. valueField: 'name',
  31626. store: funcArr,
  31627. }); };
  31628. // ====================== 属性
  31629. var elements = [];
  31630. var caption = ['通用', '样式', '绑定', '特性', '事件'];
  31631. _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
  31632. var props = pd.getPropsByGroup(group);
  31633. if (props.length <= 0)
  31634. return; //没有这一组属性
  31635. // 显示 group 的中文名
  31636. elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
  31637. if (caption[i] === '绑定') {
  31638. _.each(props, function (prop) {
  31639. elements.push({
  31640. label: "_" + prop.name,
  31641. type: "bind",
  31642. id: prop.name,
  31643. desc: prop.desc,
  31644. editor: new Ext.form.field.Text()
  31645. });
  31646. });
  31647. }
  31648. else {
  31649. _.each(props, function (prop) {
  31650. if (_.isArray(prop.type)) {
  31651. elements.push({
  31652. label: prop.name,
  31653. type: "combo",
  31654. options: prop.type,
  31655. id: prop.name,
  31656. desc: prop.desc
  31657. });
  31658. return;
  31659. }
  31660. switch (prop.type) {
  31661. case 'boolean': {
  31662. elements.push({
  31663. label: prop.name,
  31664. id: prop.name,
  31665. desc: prop.desc,
  31666. type: 'boolean',
  31667. editor: new Ext.form.field.ComboBox({
  31668. displayField: 'text',
  31669. valueField: 'id',
  31670. store: new Ext.data.Store({
  31671. field: ['id', 'text'],
  31672. data: [
  31673. { id: 'true', text: 'True' },
  31674. { id: 'false', text: 'False' },
  31675. ]
  31676. })
  31677. }),
  31678. });
  31679. break;
  31680. }
  31681. case 'number': {
  31682. elements.push({
  31683. label: prop.name,
  31684. type: "number",
  31685. id: prop.name,
  31686. isNum: true,
  31687. desc: prop.desc,
  31688. editor: new Ext.form.field.Number()
  31689. });
  31690. break;
  31691. }
  31692. case 'string': {
  31693. elements.push({
  31694. label: prop.name,
  31695. type: "string",
  31696. id: prop.name,
  31697. desc: prop.desc,
  31698. editor: new Ext.form.field.Text()
  31699. });
  31700. break;
  31701. }
  31702. case 'listeners': {
  31703. elements.push({
  31704. label: prop.name,
  31705. type: "listeners",
  31706. id: prop.name,
  31707. desc: prop.desc,
  31708. editor: createFuncEditor()
  31709. });
  31710. break;
  31711. }
  31712. case 'fix': {
  31713. elements.push({
  31714. label: prop.name,
  31715. type: "fix",
  31716. id: prop.name,
  31717. desc: prop.desc,
  31718. editor: new Ext.form.field.Text()
  31719. });
  31720. break;
  31721. }
  31722. case 'object': {
  31723. break;
  31724. }
  31725. // case 'dataSource' : {
  31726. // break;
  31727. // }
  31728. case 'valid': {
  31729. break;
  31730. }
  31731. default:
  31732. elements.push({
  31733. label: prop.name,
  31734. type: prop.type,
  31735. id: prop.name,
  31736. desc: prop.desc,
  31737. editor: new Ext.form.field.Text({ disabled: true })
  31738. });
  31739. console.error('不支持的编辑类型', prop);
  31740. }
  31741. });
  31742. }
  31743. });
  31744. this.currentComponentPropertyEditSource = elements;
  31745. var panel1Source = {};
  31746. var panel1SourceConfig = {};
  31747. _.each(elements, function (item) {
  31748. var _a;
  31749. if (item.type === "listeners") {
  31750. var listeners = _this.currentComponentVJson.listeners;
  31751. panel1Source[item.label] = listeners ? listeners[item.label] : '';
  31752. }
  31753. else if (item.type === "fix") {
  31754. panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
  31755. }
  31756. else if (item.type === "bind") {
  31757. var bind = _this.currentComponentVJson.bind;
  31758. if (typeof bind === 'string' && item.id === 'value') {
  31759. panel1Source[item.label] = bind;
  31760. }
  31761. else {
  31762. panel1Source[item.label] = bind ? bind[item.id] : '';
  31763. }
  31764. }
  31765. else {
  31766. panel1Source[item.label] = _this.currentComponentVJson[item.label];
  31767. }
  31768. panel1Source[item.label] = panel1Source[item.label] || '';
  31769. panel1SourceConfig[item.label] = { editor: item.editor };
  31770. });
  31771. this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
  31772. },
  31773. getAllfuncs: function () {
  31774. var _a, _b;
  31775. 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;
  31776. var scopeFuncs = [];
  31777. _.forEach(arr, function (item) {
  31778. scopeFuncs.push({ name: "scope." + item.name });
  31779. });
  31780. return scopeFuncs;
  31781. }
  31782. });
  31783. }
  31784. function initViewOutlineTree () {
  31785. Ext.define('com.yvan.studio.ViewOutlineTree', {
  31786. extend: 'Ext.tree.Panel',
  31787. xtype: 'viewoutlinetree',
  31788. name: "ViewOutlineTree",
  31789. tooltip: '设计大纲',
  31790. iconCls: 'x-fa fa-list',
  31791. rootVisible: false,
  31792. useArrows: true,
  31793. allowDeselect: true,
  31794. colspan: 2,
  31795. lines: false,
  31796. reference: 'viewoutlinetree',
  31797. multiSelect: true,
  31798. _saveStateFlag: true,
  31799. keyMapEnabled: true,
  31800. moduleId: null,
  31801. vjson: null,
  31802. columns: [
  31803. {
  31804. xtype: 'treecolumn',
  31805. text: '布局',
  31806. dataIndex: 'layoutNameDesc',
  31807. flex: 2,
  31808. sortable: true
  31809. }, {
  31810. text: '组件',
  31811. dataIndex: 'xtype',
  31812. flex: 1,
  31813. sortable: true,
  31814. align: 'center',
  31815. }
  31816. ],
  31817. listeners: {
  31818. itemcontextmenu: function (sender, node, element, idx, e) {
  31819. e.preventDefault();
  31820. this.rightClickTreeNode(sender, node, element, idx, e);
  31821. },
  31822. select: function (sender, node, index, e) {
  31823. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
  31824. },
  31825. rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
  31826. if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
  31827. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
  31828. }
  31829. }
  31830. },
  31831. initComponent: function () {
  31832. var _this = this;
  31833. setViewoutlinetree(this);
  31834. eventBus.subscribe(EventType.SetVjson, function (_a) {
  31835. var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31836. return _this.setVjson(moduleId, from, ignoreRenderUI);
  31837. });
  31838. return this.superclass.initComponent.apply(this, arguments);
  31839. },
  31840. clear: function () {
  31841. this.setRootNode(null);
  31842. },
  31843. onChangModule: function (moduleId, oldModuleId, from) {
  31844. if (!moduleId || moduleId !== this.moduleId) {
  31845. return;
  31846. }
  31847. if (moduleStore.getModuleObject(moduleId)) {
  31848. this.setVjson(moduleId, from);
  31849. }
  31850. },
  31851. setVjson: function (moduleId, from, ignoreRenderUI) {
  31852. var _this = this;
  31853. if (!moduleId || moduleId !== this.moduleId || from === this.name) {
  31854. return;
  31855. }
  31856. this.moduleId = moduleId;
  31857. // if (from === this.name) {
  31858. // return
  31859. // }
  31860. this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
  31861. this.setTreeValue();
  31862. if (this.componentSelectionChangeSubscribe) {
  31863. this.componentSelectionChangeSubscribe.cancel();
  31864. this.componentSelectionChangeSubscribe = null;
  31865. }
  31866. if (this.setVjsonChangeSubscribe) {
  31867. this.setVjsonChangeSubscribe.cancel();
  31868. this.setVjsonChangeSubscribe = null;
  31869. }
  31870. this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
  31871. var id = _a.id, from = _a.from;
  31872. return _this.onComponentSelectionChange(id, from);
  31873. });
  31874. this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
  31875. var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
  31876. return _this.setModuleVjson(vjson, from, ignoreRenderUI);
  31877. });
  31878. },
  31879. setModuleVjson: function (vjson, from, ignoreRenderUI) {
  31880. if (!vjson || from === this.name) {
  31881. return;
  31882. }
  31883. this.vjson = vjson;
  31884. this.setTreeValue();
  31885. var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
  31886. if (id) {
  31887. this.selectPath(id);
  31888. }
  31889. },
  31890. onComponentSelectionChange: function (id, from) {
  31891. if (from !== this.name) {
  31892. if (id) {
  31893. this.selectPath(id);
  31894. }
  31895. else {
  31896. this.setTreeValue();
  31897. }
  31898. }
  31899. },
  31900. setTreeValue: function () {
  31901. var outlineVj = {};
  31902. _.forOwn(this.vjson, function (obj, key) {
  31903. if (key !== 'viewModel' && key !== 'store') {
  31904. outlineVj[key] = _.cloneDeep(obj);
  31905. }
  31906. });
  31907. getLayoutOutline(outlineVj);
  31908. this.setRootNode(outlineVj);
  31909. },
  31910. rightClickTreeNode: function (sender, node, element, idx, e) {
  31911. var raw = node.data;
  31912. var option = {};
  31913. // 右键
  31914. option = {
  31915. shadow: 'frame',
  31916. allowOtherMenus: true,
  31917. items: []
  31918. };
  31919. var switchType = raw.layoutName;
  31920. if (raw.layoutName === 'north' ||
  31921. raw.layoutName === 'south' ||
  31922. raw.layoutName === 'west' ||
  31923. raw.layoutName === 'east' ||
  31924. raw.layoutName === 'center' ||
  31925. raw.layoutName === 'tbar' ||
  31926. raw.layoutName === 'fbar') {
  31927. switchType = raw.xtype || raw.layout;
  31928. }
  31929. var itemArr = [];
  31930. var hasTbar = false, hasFbar = false, hasBody = false;
  31931. if (raw.hasOwnProperty("children")) {
  31932. _.forEach(raw.children, function (value) {
  31933. if (value.layoutName === 'tbar') {
  31934. hasTbar = true;
  31935. }
  31936. else if (value.layoutName === 'fbar') {
  31937. hasFbar = true;
  31938. }
  31939. else {
  31940. hasBody = true;
  31941. }
  31942. });
  31943. }
  31944. switch (switchType) {
  31945. case 'fit':
  31946. if (!hasTbar) {
  31947. itemArr.push('tbar');
  31948. }
  31949. if (!hasFbar) {
  31950. itemArr.push('fbar');
  31951. }
  31952. if (!hasBody) {
  31953. itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31954. }
  31955. option.items = this.menuNew(itemArr, raw);
  31956. break;
  31957. case 'border':
  31958. if (!hasTbar) {
  31959. itemArr.push('tbar');
  31960. }
  31961. if (!hasFbar) {
  31962. itemArr.push('fbar');
  31963. }
  31964. itemArr.push('cnsew');
  31965. option.items = this.menuNew(itemArr, raw);
  31966. break;
  31967. // case 'tbar':
  31968. // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
  31969. // break;
  31970. // case 'fbar':
  31971. // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
  31972. // break;
  31973. case 'tabpanel':
  31974. if (!hasTbar) {
  31975. itemArr.push('tbar');
  31976. }
  31977. if (!hasFbar) {
  31978. itemArr.push('fbar');
  31979. }
  31980. itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
  31981. option.items = this.menuNew(itemArr, raw);
  31982. break;
  31983. case 'yvgrid':
  31984. if (!hasTbar) {
  31985. itemArr.push('tbar');
  31986. }
  31987. option.items = this.menuNew(itemArr, raw);
  31988. break;
  31989. case 'tree':
  31990. if (!hasTbar) {
  31991. itemArr.push('tbar');
  31992. }
  31993. if (!hasFbar) {
  31994. itemArr.push('fbar');
  31995. }
  31996. option.items = this.menuNew(itemArr, raw);
  31997. break;
  31998. case 'fieldset':
  31999. option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
  32000. break;
  32001. case 'form':
  32002. if (!hasTbar) {
  32003. itemArr.push('tbar');
  32004. }
  32005. if (!hasFbar) {
  32006. itemArr.push('fbar');
  32007. }
  32008. itemArr.push('form', 'fieldset', 'cols');
  32009. option.items = this.menuNew(itemArr, raw);
  32010. break;
  32011. case 'toolbar':
  32012. itemArr.push('button', 'textfield', 'label', 'combo');
  32013. option.items = this.menuNew(itemArr, raw);
  32014. break;
  32015. // case 'fbar':
  32016. // itemArr.push('button', 'textfield', 'label', 'combo')
  32017. // option.items = this.menuNew(itemArr, raw)
  32018. // break
  32019. default:
  32020. option.items = this.menuNew(itemArr, raw);
  32021. break;
  32022. }
  32023. var treeMenu = new Ext.menu.Menu(option);
  32024. treeMenu.showAt(e.getXY());
  32025. },
  32026. newItem: function (viewType, raw, region) {
  32027. var itemVjson = {};
  32028. switch (viewType) {
  32029. case 'fit':
  32030. itemVjson.layout = 'fit';
  32031. itemVjson.items = [];
  32032. break;
  32033. case 'border':
  32034. itemVjson.layout = 'border';
  32035. itemVjson.items = [];
  32036. break;
  32037. case 'toolbar':
  32038. itemVjson.xtype = 'toolbar';
  32039. itemVjson.title = 'toolbar';
  32040. itemVjson.items = [
  32041. {
  32042. xtype: 'button',
  32043. text: 'button'
  32044. }
  32045. ];
  32046. break;
  32047. case 'tabpanel':
  32048. itemVjson.xtype = 'tabpanel';
  32049. itemVjson.layout = 'fit';
  32050. itemVjson.items = [];
  32051. break;
  32052. case 'yvgrid':
  32053. itemVjson.xtype = 'yvgrid';
  32054. itemVjson.layout = 'fit';
  32055. itemVjson.pagination = false;
  32056. itemVjson.columns = [
  32057. {
  32058. dataIndex: "skuId",
  32059. header: "SKU_ID",
  32060. },
  32061. ];
  32062. break;
  32063. case 'tree':
  32064. itemVjson.xtype = 'treepanel';
  32065. itemVjson.layout = 'fit';
  32066. break;
  32067. case 'fieldset':
  32068. case 'form':
  32069. itemVjson.xtype = viewType;
  32070. itemVjson.title = viewType;
  32071. itemVjson.items = [
  32072. {
  32073. xtype: 'cols',
  32074. items: [
  32075. {
  32076. xtype: 'textfield',
  32077. fieldLabel: '输入框'
  32078. }
  32079. ]
  32080. }
  32081. ];
  32082. break;
  32083. case 'cols':
  32084. itemVjson.xtype = 'cols';
  32085. itemVjson.items = [
  32086. {
  32087. xtype: 'textfield',
  32088. fieldLabel: '输入框'
  32089. }
  32090. ];
  32091. break;
  32092. case 'button':
  32093. itemVjson.xtype = 'button';
  32094. itemVjson.text = '按钮';
  32095. itemVjson.iconCls = 'x-fa fa-plus';
  32096. break;
  32097. case 'textfield':
  32098. itemVjson.xtype = 'textfield';
  32099. itemVjson.fieldLabel = '输入框';
  32100. break;
  32101. case 'combo':
  32102. itemVjson.xtype = 'combo';
  32103. itemVjson.fieldLabel = '下拉框';
  32104. break;
  32105. case 'label':
  32106. itemVjson.xtype = 'label';
  32107. itemVjson.text = '文本';
  32108. break;
  32109. }
  32110. var target = findInCode(this.vjson, raw.id);
  32111. if (region) {
  32112. if (region === 'tbar' || region === 'fbar') {
  32113. target[region] = itemVjson;
  32114. }
  32115. else {
  32116. itemVjson.region = region;
  32117. itemVjson.split = true;
  32118. if (region === 'north' || region === 'south') {
  32119. itemVjson.height = '30%';
  32120. itemVjson.collapsible = true;
  32121. }
  32122. else if (region === 'west' || region === 'east') {
  32123. itemVjson.width = '30%';
  32124. itemVjson.collapsible = true;
  32125. }
  32126. target.items.push(itemVjson);
  32127. }
  32128. }
  32129. else {
  32130. if (target.xtype === 'tabpanel') {
  32131. itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
  32132. }
  32133. target.items.push(itemVjson);
  32134. }
  32135. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32136. },
  32137. menuNew: function (typeArr, raw, region) {
  32138. var that = this;
  32139. var reArr = [];
  32140. typeArr.forEach(function (value) {
  32141. if (value === 'cnsew') {
  32142. reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
  32143. }
  32144. else if (value === 'tbar' || value === 'fbar') {
  32145. reArr.push(that.menuNewTFBar(value, raw));
  32146. }
  32147. else {
  32148. reArr.push({
  32149. text: '新建' + layoutOrXtypeNameMap[value],
  32150. iconCls: 'x-fa fa-plus',
  32151. handler: function (sender) {
  32152. that.newItem(value, raw, region);
  32153. }
  32154. });
  32155. }
  32156. reArr.push("-");
  32157. });
  32158. if (region) {
  32159. reArr.pop();
  32160. return reArr;
  32161. }
  32162. reArr.push({
  32163. text: '高级属性',
  32164. iconCls: 'x-fa fa-cog',
  32165. handler: function (sender) {
  32166. var vj = findInCode(that.vjson, raw.id);
  32167. that.advancedSettingWindow(vj);
  32168. }
  32169. }, {
  32170. text: '上移',
  32171. iconCls: 'x-fa fa-trash',
  32172. handler: function (sender) {
  32173. that.moveCmp(raw.id, 'up');
  32174. }
  32175. }, {
  32176. text: '置顶',
  32177. iconCls: 'x-fa fa-trash',
  32178. handler: function (sender) {
  32179. that.moveCmp(raw.id, 'top');
  32180. }
  32181. }, {
  32182. text: '置底',
  32183. iconCls: 'x-fa fa-trash',
  32184. handler: function (sender) {
  32185. that.moveCmp(raw.id, 'bottom');
  32186. }
  32187. }, {
  32188. text: '下移',
  32189. iconCls: 'x-fa fa-trash',
  32190. handler: function (sender) {
  32191. that.moveCmp(raw.id, 'down');
  32192. }
  32193. }, {
  32194. text: '删除',
  32195. iconCls: 'x-fa fa-trash',
  32196. handler: function (sender) {
  32197. deletVjsonById(that.vjson, raw.id);
  32198. moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
  32199. }
  32200. });
  32201. return reArr;
  32202. },
  32203. menuNewCNSEW: function (raw) {
  32204. var that = this;
  32205. var arr = ['center', 'north', 'south', 'west', 'east'];
  32206. if (raw.hasOwnProperty("children")) {
  32207. _.forEach(raw.children, function (value) {
  32208. _.remove(arr, function (it) {
  32209. return it === value.layoutName;
  32210. });
  32211. });
  32212. }
  32213. var reArr = [];
  32214. arr.forEach(function (value) {
  32215. reArr.push({
  32216. text: layoutOrXtypeNameMap[value],
  32217. iconCls: 'x-fa fa-plus',
  32218. menu: {
  32219. showSeparator: true,
  32220. items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
  32221. }
  32222. });
  32223. reArr.push("-");
  32224. });
  32225. reArr.pop();
  32226. return reArr;
  32227. },
  32228. menuNewTFBar: function (barType, raw) {
  32229. var that = this;
  32230. var reObj = {
  32231. text: layoutOrXtypeNameMap[barType],
  32232. iconCls: 'x-fa fa-plus',
  32233. menu: {
  32234. showSeparator: true,
  32235. items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
  32236. }
  32237. };
  32238. return reObj;
  32239. },
  32240. moveCmp: function (id, moveType) {
  32241. var arr = findArrayContainer(this.vjson, id);
  32242. var index = _.findIndex(arr, function (v) { return v.id === id; });
  32243. if (index < 0) {
  32244. return;
  32245. }
  32246. switch (moveType) {
  32247. case 'up':
  32248. if (index > 0) {
  32249. var o = arr[index];
  32250. arr[index] = arr[index - 1];
  32251. arr[index - 1] = o;
  32252. }
  32253. else {
  32254. return;
  32255. }
  32256. break;
  32257. case 'down':
  32258. if (index < arr.length - 1) {
  32259. var o = arr[index];
  32260. arr[index] = arr[index + 1];
  32261. arr[index + 1] = o;
  32262. }
  32263. else {
  32264. return;
  32265. }
  32266. break;
  32267. case 'top':
  32268. if (index > 0) {
  32269. var o = arr[index];
  32270. arr[index] = arr[0];
  32271. arr[0] = o;
  32272. }
  32273. else {
  32274. return;
  32275. }
  32276. break;
  32277. case 'bottom':
  32278. if (index < arr.length - 1) {
  32279. var o = arr[index];
  32280. arr[index] = arr[arr.length - 1];
  32281. arr[arr.length - 1] = o;
  32282. }
  32283. else {
  32284. return;
  32285. }
  32286. break;
  32287. }
  32288. moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
  32289. }
  32290. });
  32291. }
  32292. function init$2 () {
  32293. window['native'] = native;
  32294. native.init();
  32295. init();
  32296. instance.getAllDomain().finally(function () {
  32297. });
  32298. initStateTree();
  32299. initDashboard();
  32300. initFileTree();
  32301. initDbTree();
  32302. initReportGrid();
  32303. initGroovyEditor();
  32304. initJsEditor$1();
  32305. initJsonEditor$1();
  32306. initSqlEditor$1();
  32307. initTemplateEditor();
  32308. initDict$1();
  32309. initBpmnTree();
  32310. initToolBox();
  32311. initPropertyDesign();
  32312. initViewOutlineTree();
  32313. initWidget();
  32314. initWhLayout();
  32315. initApiTree();
  32316. initTaskTree();
  32317. initLogsTree();
  32318. initDevOpsTree();
  32319. initTerminal();
  32320. initMonitorTree();
  32321. initHomeTree();
  32322. }
  32323. var studio = {
  32324. init: init$2,
  32325. handles: handles$1,
  32326. Workbench: Workbench
  32327. };
  32328. exports.axios = axios;
  32329. exports.qs = Qs;
  32330. exports.lodash = _$2;
  32331. exports.jquery = $$2;
  32332. exports.moment = moment$1;
  32333. exports.recast = recast;
  32334. exports.XLSX = XLSX;
  32335. exports.echarts = echarts;
  32336. exports.Defaults = Defaults;
  32337. exports.ExcelImportDialog = ExcelImportDialog;
  32338. exports.Lib = Lib;
  32339. exports.LibParam = LibParam;
  32340. exports.PropertyDescriptionTable = PropertyDescriptionTable;
  32341. exports.ReportScope = ReportScope;
  32342. exports.SIMPLE_RE = SIMPLE_RE;
  32343. exports.Scope = Scope;
  32344. exports.ScopeEngine = ScopeEngine;
  32345. exports.SystemEventFu = SystemEventFu;
  32346. exports.ajax = ajax;
  32347. exports.baseConfigProcess = baseConfigProcess;
  32348. exports.baseConfigProcessList = baseConfigProcessList;
  32349. exports.buildPlus = buildPlus;
  32350. exports.buildReportScope = buildReportScope;
  32351. exports.calcExpress = calcExpress;
  32352. exports.calcObject = calcObject;
  32353. exports.calcObjectFlat = calcObjectFlat;
  32354. exports.clearViewModel = clearViewModel;
  32355. exports.clearViewModelByLookup = clearViewModelByLookup;
  32356. exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
  32357. exports.clearViewModelValues = clearViewModelValues;
  32358. exports.commitMe = commitMe;
  32359. exports.confirm = confirm;
  32360. exports.createAjax = createAjax;
  32361. exports.createUUID = createUUID;
  32362. exports.deepTravJson = deepTravJson;
  32363. exports.downLoad = downLoad;
  32364. exports.evalFunction = evalFunction;
  32365. exports.extend = extend;
  32366. exports.flatRow = flatRow;
  32367. exports.getApiConvert = getApiConvert;
  32368. exports.getGridEditRows = getGridEditRows;
  32369. exports.getParentGrid = getParentGrid;
  32370. exports.getPinyin = getPinyin;
  32371. exports.getRegList = getRegList;
  32372. exports.getRegParamList = getRegParamList;
  32373. exports.getScopeOnCreate = getScopeOnCreate;
  32374. exports.init = init$1;
  32375. exports.insertGridRow = insertGridRow;
  32376. exports.invokeServer = invokeServer$1;
  32377. exports.isDesignMode = isDesignMode;
  32378. exports.isEmpty = isEmpty;
  32379. exports.json5 = dist;
  32380. exports.keywordFilter = keywordFilter;
  32381. exports.lookupFn = lookupFn;
  32382. exports.lookupScope = lookupScope;
  32383. exports.mergeViewModel = mergeViewModel;
  32384. exports.moveDownGridRow = moveDownGridRow;
  32385. exports.moveUpGridRow = moveUpGridRow;
  32386. exports.msg = msg$1;
  32387. exports.msgError = msgError;
  32388. exports.normId = normId;
  32389. exports.pinyinMatch = pinyinMatch;
  32390. exports.prompt = prompt$2;
  32391. exports.raiseClick = raiseClick;
  32392. exports.reloadGrid = reloadGrid;
  32393. exports.removeGridRow = removeGridRow;
  32394. exports.replaceNA = replaceNA;
  32395. exports.saveGridRow = saveGridRow;
  32396. exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
  32397. exports.setComboStore = setComboStore;
  32398. exports.showErrorDialog = showErrorDialog$1;
  32399. exports.showInfoDialog = showInfoDialog;
  32400. exports.showWidget = showWidget;
  32401. exports.sqlUrlTransform = sqlUrlTransform;
  32402. exports.stopEvent = stopEvent;
  32403. exports.studio = studio;
  32404. exports.toPlainObject = toPlainObject;
  32405. exports.toString = toString;
  32406. exports.tryEnable = tryEnable;
  32407. exports.tryVarSimple = tryVarSimple;
  32408. exports.tryWriteByExpress = tryWriteByExpress;
  32409. exports.tryWriteObject = tryWriteObject;
  32410. exports.watch = watch;
  32411. Object.defineProperty(exports, '__esModule', { value: true });
  32412. });
  32413. //# sourceMappingURL=yvan-ext.js.map