123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922 |
- 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';
- var axios__default = 'default' in axios ? axios['default'] : axios;
- Qs = Qs && Object.prototype.hasOwnProperty.call(Qs, 'default') ? Qs['default'] : Qs;
- _$2 = _$2 && Object.prototype.hasOwnProperty.call(_$2, 'default') ? _$2['default'] : _$2;
- $$2 = $$2 && Object.prototype.hasOwnProperty.call($$2, 'default') ? $$2['default'] : $$2;
- moment$1 = moment$1 && Object.prototype.hasOwnProperty.call(moment$1, 'default') ? moment$1['default'] : moment$1;
- XLSX = XLSX && Object.prototype.hasOwnProperty.call(XLSX, 'default') ? XLSX['default'] : XLSX;
- localforage = localforage && Object.prototype.hasOwnProperty.call(localforage, 'default') ? localforage['default'] : localforage;
- BpmnModeler = BpmnModeler && Object.prototype.hasOwnProperty.call(BpmnModeler, 'default') ? BpmnModeler['default'] : BpmnModeler;
- handlebars = handlebars && Object.prototype.hasOwnProperty.call(handlebars, 'default') ? handlebars['default'] : handlebars;
- sqlFormat = sqlFormat && Object.prototype.hasOwnProperty.call(sqlFormat, 'default') ? sqlFormat['default'] : sqlFormat;
- var labelWidth = 80;
- var windows = {
- modal: true,
- width: 900,
- height: 600,
- maximizable: true,
- constrain: true,
- shadow: false,
- };
- var date = {
- labelAlign: 'right',
- labelWidth: labelWidth,
- };
- var tagfield = {
- labelAlign: 'right',
- labelWidth: labelWidth,
- valueField: 'id',
- displayField: 'text',
- autoLoad: true,
- mode: 'local',
- forceSelection: true,
- triggerAction: 'all',
- enableKeyEvents: true,
- queryMode: 'local',
- filterPickList: true,
- };
- var combo = {
- labelAlign: 'right',
- labelWidth: labelWidth,
- valueField: 'id',
- displayField: 'text',
- autoLoad: true,
- mode: 'local',
- forceSelection: true,
- triggerAction: 'all',
- enableKeyEvents: true,
- typeAheadDelay: 1,
- queryDelay: 1,
- };
- var comboGrid = {
- selectOnTab: true,
- pickerHeight: 500,
- pickerWidth: 850,
- editEnable: null,
- };
- var comboGridPicker = {
- xtype: 'yvgrid',
- layout: 'fit',
- selModel: {
- selType: 'rowmodel',
- mode: 'SINGLE'
- },
- };
- var comboGridMulti = {
- selectOnTab: true,
- pickerHeight: 500,
- pickerWidth: 850,
- editEnable: null,
- splitChar: ',',
- displayField: 'text',
- valueField: 'id',
- autoLoad: true,
- };
- var comboGridMultiPicker = {
- selType: 'checkboxmodel',
- selModel: {
- type: 'checkboxmodel',
- checkOnly: false
- },
- };
- var numberfield = {
- labelAlign: 'right',
- decimalPrecision: 6,
- labelWidth: labelWidth,
- };
- var checkbox = {
- labelAlign: 'right',
- labelWidth: labelWidth,
- checkedValue: true,
- uncheckedValue: false,
- };
- var checkboxgroup = {
- labelAlign: 'right',
- labelWidth: labelWidth,
- };
- var radio = {
- labelAlign: 'right',
- labelWidth: labelWidth,
- };
- var radiogroup = {
- labelAlign: 'right',
- labelWidth: labelWidth,
- simpleValue: true,
- layout: 'hbox',
- defaults: {
- xtype: 'radio',
- name: 'type',
- margin: '0 15 0 0'
- },
- };
- var form = {
- margin: '5 5 0 0',
- border: false,
- defaults: {
- margin: '0 0 5 0',
- border: false,
- },
- };
- var column = {
- filter: { type: 'string' },
- };
- var grid = {
- border: true,
- columnLines: true,
- rowLines: true,
- plugins: {
- cellediting: {
- clicksToEdit: 1,
- },
- gridfilters: true
- },
- multiColumnSort: true,
- viewConfig: {
- enableTextSelection: true,
- sortOnClick: false,
- emptyText: '没有数据'
- },
- selModel: {
- type: 'checkboxmodel',
- checkOnly: false
- },
- pagination: true,
- pageSize: 50,
- pageSizeOption: ['20', '50', '100', '200', '300', '500', '1000'],
- hideFootbar: false,
- hideRefresh: false,
- hideExport: false,
- hideAutoSize: false,
- hideClearFilter: false,
- hideSaveGridUIConfig: false,
- hideClearGridUIConfig: false,
- autoLoad: true,
- remoteSort: false,
- remoteFilter: false,
- enableLocking: true,
- syncRowHeight: false,
- enableColumnMove: true,
- enableColumnHide: true,
- enableColumnResize: true,
- hidden: false,
- disabled: false,
- exportExcelPageSize: 1000,
- exportExcelCurrentPage: 1,
- exportExcelTotal: 0,
- cellTip: false,
- };
- var fieldContainer = {
- labelAlign: 'right',
- labelWidth: labelWidth,
- layout: 'hbox',
- defaults: {
- flex: 1,
- }
- };
- var tree = {
- autoLoad: true,
- hideFilter: false,
- hideToolbar: false,
- hideRefresh: false,
- hideExpand: false,
- hideCollapse: false,
- root: [],
- rootVisible: false,
- };
- var search = {
- labelAlign: 'right',
- labelWidth: labelWidth,
- };
- var text = {
- labelAlign: 'right',
- labelWidth: labelWidth,
- msgTarget: 'qtip',
- };
- var toolbar = {
- overflowHandler: 'menu',
- };
- var tbfill = {};
- var tbseparator = {};
- var button = {};
- var fieldSet = {
- margin: '5 5 0 0',
- border: false,
- defaults: {
- margin: '0 0 5 0',
- border: false,
- },
- };
- var storeAjax = {
- timeout: 60000
- };
- var panel = {};
- var splitter = {};
- var maintab = {};
- var rows = {};
- var cols = {
- defaults: {
- flex: 1
- },
- };
- var bpmn = {
- hideRefresh: false,
- autoLoad: true,
- dataSource: '',
- bpmnConfig: {}
- };
- var Defaults = /*#__PURE__*/Object.freeze({
- __proto__: null,
- windows: windows,
- date: date,
- tagfield: tagfield,
- combo: combo,
- comboGrid: comboGrid,
- comboGridPicker: comboGridPicker,
- comboGridMulti: comboGridMulti,
- comboGridMultiPicker: comboGridMultiPicker,
- numberfield: numberfield,
- checkbox: checkbox,
- checkboxgroup: checkboxgroup,
- radio: radio,
- radiogroup: radiogroup,
- form: form,
- column: column,
- grid: grid,
- fieldContainer: fieldContainer,
- tree: tree,
- search: search,
- text: text,
- toolbar: toolbar,
- tbfill: tbfill,
- tbseparator: tbseparator,
- button: button,
- fieldSet: fieldSet,
- storeAjax: storeAjax,
- panel: panel,
- splitter: splitter,
- maintab: maintab,
- rows: rows,
- cols: cols,
- bpmn: bpmn
- });
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
- var dist = createCommonjsModule(function (module, exports) {
- (function (global, factory) {
- module.exports = factory() ;
- }(commonjsGlobal, (function () {
- function createCommonjsModule(fn, module) {
- return module = { exports: {} }, fn(module, module.exports), module.exports;
- }
- var _global = createCommonjsModule(function (module) {
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- var global = module.exports = typeof window != 'undefined' && window.Math == Math
- ? window : typeof self != 'undefined' && self.Math == Math ? self
- // eslint-disable-next-line no-new-func
- : Function('return this')();
- if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef
- });
- var _core = createCommonjsModule(function (module) {
- var core = module.exports = { version: '2.6.5' };
- if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef
- });
- var _core_1 = _core.version;
- var _isObject = function (it) {
- return typeof it === 'object' ? it !== null : typeof it === 'function';
- };
- var _anObject = function (it) {
- if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); }
- return it;
- };
- var _fails = function (exec) {
- try {
- return !!exec();
- } catch (e) {
- return true;
- }
- };
- // Thank's IE8 for his funny defineProperty
- var _descriptors = !_fails(function () {
- return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
- });
- var document = _global.document;
- // typeof document.createElement is 'object' in old IE
- var is = _isObject(document) && _isObject(document.createElement);
- var _domCreate = function (it) {
- return is ? document.createElement(it) : {};
- };
- var _ie8DomDefine = !_descriptors && !_fails(function () {
- return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;
- });
- // 7.1.1 ToPrimitive(input [, PreferredType])
- // instead of the ES6 spec version, we didn't implement @@toPrimitive case
- // and the second argument - flag - preferred type is a string
- var _toPrimitive = function (it, S) {
- if (!_isObject(it)) { return it; }
- var fn, val;
- if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
- if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; }
- if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; }
- throw TypeError("Can't convert object to primitive value");
- };
- var dP = Object.defineProperty;
- var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {
- _anObject(O);
- P = _toPrimitive(P, true);
- _anObject(Attributes);
- if (_ie8DomDefine) { try {
- return dP(O, P, Attributes);
- } catch (e) { /* empty */ } }
- if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); }
- if ('value' in Attributes) { O[P] = Attributes.value; }
- return O;
- };
- var _objectDp = {
- f: f
- };
- var _propertyDesc = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- var _hide = _descriptors ? function (object, key, value) {
- return _objectDp.f(object, key, _propertyDesc(1, value));
- } : function (object, key, value) {
- object[key] = value;
- return object;
- };
- var hasOwnProperty = {}.hasOwnProperty;
- var _has = function (it, key) {
- return hasOwnProperty.call(it, key);
- };
- var id = 0;
- var px = Math.random();
- var _uid = function (key) {
- return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
- };
- var _shared = createCommonjsModule(function (module) {
- var SHARED = '__core-js_shared__';
- var store = _global[SHARED] || (_global[SHARED] = {});
- (module.exports = function (key, value) {
- return store[key] || (store[key] = value !== undefined ? value : {});
- })('versions', []).push({
- version: _core.version,
- mode: 'global',
- copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
- });
- });
- var _functionToString = _shared('native-function-to-string', Function.toString);
- var _redefine = createCommonjsModule(function (module) {
- var SRC = _uid('src');
- var TO_STRING = 'toString';
- var TPL = ('' + _functionToString).split(TO_STRING);
- _core.inspectSource = function (it) {
- return _functionToString.call(it);
- };
- (module.exports = function (O, key, val, safe) {
- var isFunction = typeof val == 'function';
- if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); }
- if (O[key] === val) { return; }
- if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); }
- if (O === _global) {
- O[key] = val;
- } else if (!safe) {
- delete O[key];
- _hide(O, key, val);
- } else if (O[key]) {
- O[key] = val;
- } else {
- _hide(O, key, val);
- }
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
- })(Function.prototype, TO_STRING, function toString() {
- return typeof this == 'function' && this[SRC] || _functionToString.call(this);
- });
- });
- var _aFunction = function (it) {
- if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); }
- return it;
- };
- // optional / simple context binding
- var _ctx = function (fn, that, length) {
- _aFunction(fn);
- if (that === undefined) { return fn; }
- switch (length) {
- case 1: return function (a) {
- return fn.call(that, a);
- };
- case 2: return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3: return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function (/* ...args */) {
- return fn.apply(that, arguments);
- };
- };
- var PROTOTYPE = 'prototype';
- var $export = function (type, name, source) {
- var IS_FORCED = type & $export.F;
- var IS_GLOBAL = type & $export.G;
- var IS_STATIC = type & $export.S;
- var IS_PROTO = type & $export.P;
- var IS_BIND = type & $export.B;
- var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];
- var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});
- var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
- var key, own, out, exp;
- if (IS_GLOBAL) { source = name; }
- for (key in source) {
- // contains in native
- own = !IS_FORCED && target && target[key] !== undefined;
- // export native or passed
- out = (own ? target : source)[key];
- // bind timers to global for call from export context
- exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;
- // extend global
- if (target) { _redefine(target, key, out, type & $export.U); }
- // export
- if (exports[key] != out) { _hide(exports, key, exp); }
- if (IS_PROTO && expProto[key] != out) { expProto[key] = out; }
- }
- };
- _global.core = _core;
- // type bitmap
- $export.F = 1; // forced
- $export.G = 2; // global
- $export.S = 4; // static
- $export.P = 8; // proto
- $export.B = 16; // bind
- $export.W = 32; // wrap
- $export.U = 64; // safe
- $export.R = 128; // real proto method for `library`
- var _export = $export;
- // 7.1.4 ToInteger
- var ceil = Math.ceil;
- var floor = Math.floor;
- var _toInteger = function (it) {
- return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
- };
- // 7.2.1 RequireObjectCoercible(argument)
- var _defined = function (it) {
- if (it == undefined) { throw TypeError("Can't call method on " + it); }
- return it;
- };
- // true -> String#at
- // false -> String#codePointAt
- var _stringAt = function (TO_STRING) {
- return function (that, pos) {
- var s = String(_defined(that));
- var i = _toInteger(pos);
- var l = s.length;
- var a, b;
- if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; }
- a = s.charCodeAt(i);
- return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
- ? TO_STRING ? s.charAt(i) : a
- : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
- };
- };
- var $at = _stringAt(false);
- _export(_export.P, 'String', {
- // 21.1.3.3 String.prototype.codePointAt(pos)
- codePointAt: function codePointAt(pos) {
- return $at(this, pos);
- }
- });
- var codePointAt = _core.String.codePointAt;
- var max = Math.max;
- var min = Math.min;
- var _toAbsoluteIndex = function (index, length) {
- index = _toInteger(index);
- return index < 0 ? max(index + length, 0) : min(index, length);
- };
- var fromCharCode = String.fromCharCode;
- var $fromCodePoint = String.fromCodePoint;
- // length should be 1, old FF problem
- _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
- // 21.1.2.2 String.fromCodePoint(...codePoints)
- fromCodePoint: function fromCodePoint(x) {
- var arguments$1 = arguments;
- // eslint-disable-line no-unused-vars
- var res = [];
- var aLen = arguments.length;
- var i = 0;
- var code;
- while (aLen > i) {
- code = +arguments$1[i++];
- if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); }
- res.push(code < 0x10000
- ? fromCharCode(code)
- : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00)
- );
- } return res.join('');
- }
- });
- var fromCodePoint = _core.String.fromCodePoint;
- // This is a generated file. Do not edit.
- var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/;
- 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]/;
- 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]/;
- var unicode = {
- Space_Separator: Space_Separator,
- ID_Start: ID_Start,
- ID_Continue: ID_Continue
- };
- var util = {
- isSpaceSeparator: function isSpaceSeparator (c) {
- return typeof c === 'string' && unicode.Space_Separator.test(c)
- },
- isIdStartChar: function isIdStartChar (c) {
- return typeof c === 'string' && (
- (c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z') ||
- (c === '$') || (c === '_') ||
- unicode.ID_Start.test(c)
- )
- },
- isIdContinueChar: function isIdContinueChar (c) {
- return typeof c === 'string' && (
- (c >= 'a' && c <= 'z') ||
- (c >= 'A' && c <= 'Z') ||
- (c >= '0' && c <= '9') ||
- (c === '$') || (c === '_') ||
- (c === '\u200C') || (c === '\u200D') ||
- unicode.ID_Continue.test(c)
- )
- },
- isDigit: function isDigit (c) {
- return typeof c === 'string' && /[0-9]/.test(c)
- },
- isHexDigit: function isHexDigit (c) {
- return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
- },
- };
- var source;
- var parseState;
- var stack;
- var pos;
- var line;
- var column;
- var token;
- var key;
- var root;
- var parse = function parse (text, reviver) {
- source = String(text);
- parseState = 'start';
- stack = [];
- pos = 0;
- line = 1;
- column = 0;
- token = undefined;
- key = undefined;
- root = undefined;
- do {
- token = lex();
- // This code is unreachable.
- // if (!parseStates[parseState]) {
- // throw invalidParseState()
- // }
- parseStates[parseState]();
- } while (token.type !== 'eof')
- if (typeof reviver === 'function') {
- return internalize({'': root}, '', reviver)
- }
- return root
- };
- function internalize (holder, name, reviver) {
- var value = holder[name];
- if (value != null && typeof value === 'object') {
- for (var key in value) {
- var replacement = internalize(value, key, reviver);
- if (replacement === undefined) {
- delete value[key];
- } else {
- value[key] = replacement;
- }
- }
- }
- return reviver.call(holder, name, value)
- }
- var lexState;
- var buffer;
- var doubleQuote;
- var sign;
- var c;
- function lex () {
- lexState = 'default';
- buffer = '';
- doubleQuote = false;
- sign = 1;
- for (;;) {
- c = peek();
- // This code is unreachable.
- // if (!lexStates[lexState]) {
- // throw invalidLexState(lexState)
- // }
- var token = lexStates[lexState]();
- if (token) {
- return token
- }
- }
- }
- function peek () {
- if (source[pos]) {
- return String.fromCodePoint(source.codePointAt(pos))
- }
- }
- function read () {
- var c = peek();
- if (c === '\n') {
- line++;
- column = 0;
- } else if (c) {
- column += c.length;
- } else {
- column++;
- }
- if (c) {
- pos += c.length;
- }
- return c
- }
- var lexStates = {
- default: function default$1 () {
- switch (c) {
- case '\t':
- case '\v':
- case '\f':
- case ' ':
- case '\u00A0':
- case '\uFEFF':
- case '\n':
- case '\r':
- case '\u2028':
- case '\u2029':
- read();
- return
- case '/':
- read();
- lexState = 'comment';
- return
- case undefined:
- read();
- return newToken('eof')
- }
- if (util.isSpaceSeparator(c)) {
- read();
- return
- }
- // This code is unreachable.
- // if (!lexStates[parseState]) {
- // throw invalidLexState(parseState)
- // }
- return lexStates[parseState]()
- },
- comment: function comment () {
- switch (c) {
- case '*':
- read();
- lexState = 'multiLineComment';
- return
- case '/':
- read();
- lexState = 'singleLineComment';
- return
- }
- throw invalidChar(read())
- },
- multiLineComment: function multiLineComment () {
- switch (c) {
- case '*':
- read();
- lexState = 'multiLineCommentAsterisk';
- return
- case undefined:
- throw invalidChar(read())
- }
- read();
- },
- multiLineCommentAsterisk: function multiLineCommentAsterisk () {
- switch (c) {
- case '*':
- read();
- return
- case '/':
- read();
- lexState = 'default';
- return
- case undefined:
- throw invalidChar(read())
- }
- read();
- lexState = 'multiLineComment';
- },
- singleLineComment: function singleLineComment () {
- switch (c) {
- case '\n':
- case '\r':
- case '\u2028':
- case '\u2029':
- read();
- lexState = 'default';
- return
- case undefined:
- read();
- return newToken('eof')
- }
- read();
- },
- value: function value () {
- switch (c) {
- case '{':
- case '[':
- return newToken('punctuator', read())
- case 'n':
- read();
- literal('ull');
- return newToken('null', null)
- case 't':
- read();
- literal('rue');
- return newToken('boolean', true)
- case 'f':
- read();
- literal('alse');
- return newToken('boolean', false)
- case '-':
- case '+':
- if (read() === '-') {
- sign = -1;
- }
- lexState = 'sign';
- return
- case '.':
- buffer = read();
- lexState = 'decimalPointLeading';
- return
- case '0':
- buffer = read();
- lexState = 'zero';
- return
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- buffer = read();
- lexState = 'decimalInteger';
- return
- case 'I':
- read();
- literal('nfinity');
- return newToken('numeric', Infinity)
- case 'N':
- read();
- literal('aN');
- return newToken('numeric', NaN)
- case '"':
- case "'":
- doubleQuote = (read() === '"');
- buffer = '';
- lexState = 'string';
- return
- }
- throw invalidChar(read())
- },
- identifierNameStartEscape: function identifierNameStartEscape () {
- if (c !== 'u') {
- throw invalidChar(read())
- }
- read();
- var u = unicodeEscape();
- switch (u) {
- case '$':
- case '_':
- break
- default:
- if (!util.isIdStartChar(u)) {
- throw invalidIdentifier()
- }
- break
- }
- buffer += u;
- lexState = 'identifierName';
- },
- identifierName: function identifierName () {
- switch (c) {
- case '$':
- case '_':
- case '\u200C':
- case '\u200D':
- buffer += read();
- return
- case '\\':
- read();
- lexState = 'identifierNameEscape';
- return
- }
- if (util.isIdContinueChar(c)) {
- buffer += read();
- return
- }
- return newToken('identifier', buffer)
- },
- identifierNameEscape: function identifierNameEscape () {
- if (c !== 'u') {
- throw invalidChar(read())
- }
- read();
- var u = unicodeEscape();
- switch (u) {
- case '$':
- case '_':
- case '\u200C':
- case '\u200D':
- break
- default:
- if (!util.isIdContinueChar(u)) {
- throw invalidIdentifier()
- }
- break
- }
- buffer += u;
- lexState = 'identifierName';
- },
- sign: function sign$1 () {
- switch (c) {
- case '.':
- buffer = read();
- lexState = 'decimalPointLeading';
- return
- case '0':
- buffer = read();
- lexState = 'zero';
- return
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- buffer = read();
- lexState = 'decimalInteger';
- return
- case 'I':
- read();
- literal('nfinity');
- return newToken('numeric', sign * Infinity)
- case 'N':
- read();
- literal('aN');
- return newToken('numeric', NaN)
- }
- throw invalidChar(read())
- },
- zero: function zero () {
- switch (c) {
- case '.':
- buffer += read();
- lexState = 'decimalPoint';
- return
- case 'e':
- case 'E':
- buffer += read();
- lexState = 'decimalExponent';
- return
- case 'x':
- case 'X':
- buffer += read();
- lexState = 'hexadecimal';
- return
- }
- return newToken('numeric', sign * 0)
- },
- decimalInteger: function decimalInteger () {
- switch (c) {
- case '.':
- buffer += read();
- lexState = 'decimalPoint';
- return
- case 'e':
- case 'E':
- buffer += read();
- lexState = 'decimalExponent';
- return
- }
- if (util.isDigit(c)) {
- buffer += read();
- return
- }
- return newToken('numeric', sign * Number(buffer))
- },
- decimalPointLeading: function decimalPointLeading () {
- if (util.isDigit(c)) {
- buffer += read();
- lexState = 'decimalFraction';
- return
- }
- throw invalidChar(read())
- },
- decimalPoint: function decimalPoint () {
- switch (c) {
- case 'e':
- case 'E':
- buffer += read();
- lexState = 'decimalExponent';
- return
- }
- if (util.isDigit(c)) {
- buffer += read();
- lexState = 'decimalFraction';
- return
- }
- return newToken('numeric', sign * Number(buffer))
- },
- decimalFraction: function decimalFraction () {
- switch (c) {
- case 'e':
- case 'E':
- buffer += read();
- lexState = 'decimalExponent';
- return
- }
- if (util.isDigit(c)) {
- buffer += read();
- return
- }
- return newToken('numeric', sign * Number(buffer))
- },
- decimalExponent: function decimalExponent () {
- switch (c) {
- case '+':
- case '-':
- buffer += read();
- lexState = 'decimalExponentSign';
- return
- }
- if (util.isDigit(c)) {
- buffer += read();
- lexState = 'decimalExponentInteger';
- return
- }
- throw invalidChar(read())
- },
- decimalExponentSign: function decimalExponentSign () {
- if (util.isDigit(c)) {
- buffer += read();
- lexState = 'decimalExponentInteger';
- return
- }
- throw invalidChar(read())
- },
- decimalExponentInteger: function decimalExponentInteger () {
- if (util.isDigit(c)) {
- buffer += read();
- return
- }
- return newToken('numeric', sign * Number(buffer))
- },
- hexadecimal: function hexadecimal () {
- if (util.isHexDigit(c)) {
- buffer += read();
- lexState = 'hexadecimalInteger';
- return
- }
- throw invalidChar(read())
- },
- hexadecimalInteger: function hexadecimalInteger () {
- if (util.isHexDigit(c)) {
- buffer += read();
- return
- }
- return newToken('numeric', sign * Number(buffer))
- },
- string: function string () {
- switch (c) {
- case '\\':
- read();
- buffer += escape();
- return
- case '"':
- if (doubleQuote) {
- read();
- return newToken('string', buffer)
- }
- buffer += read();
- return
- case "'":
- if (!doubleQuote) {
- read();
- return newToken('string', buffer)
- }
- buffer += read();
- return
- case '\n':
- case '\r':
- throw invalidChar(read())
- case '\u2028':
- case '\u2029':
- separatorChar(c);
- break
- case undefined:
- throw invalidChar(read())
- }
- buffer += read();
- },
- start: function start () {
- switch (c) {
- case '{':
- case '[':
- return newToken('punctuator', read())
- // This code is unreachable since the default lexState handles eof.
- // case undefined:
- // return newToken('eof')
- }
- lexState = 'value';
- },
- beforePropertyName: function beforePropertyName () {
- switch (c) {
- case '$':
- case '_':
- buffer = read();
- lexState = 'identifierName';
- return
- case '\\':
- read();
- lexState = 'identifierNameStartEscape';
- return
- case '}':
- return newToken('punctuator', read())
- case '"':
- case "'":
- doubleQuote = (read() === '"');
- lexState = 'string';
- return
- }
- if (util.isIdStartChar(c)) {
- buffer += read();
- lexState = 'identifierName';
- return
- }
- throw invalidChar(read())
- },
- afterPropertyName: function afterPropertyName () {
- if (c === ':') {
- return newToken('punctuator', read())
- }
- throw invalidChar(read())
- },
- beforePropertyValue: function beforePropertyValue () {
- lexState = 'value';
- },
- afterPropertyValue: function afterPropertyValue () {
- switch (c) {
- case ',':
- case '}':
- return newToken('punctuator', read())
- }
- throw invalidChar(read())
- },
- beforeArrayValue: function beforeArrayValue () {
- if (c === ']') {
- return newToken('punctuator', read())
- }
- lexState = 'value';
- },
- afterArrayValue: function afterArrayValue () {
- switch (c) {
- case ',':
- case ']':
- return newToken('punctuator', read())
- }
- throw invalidChar(read())
- },
- end: function end () {
- // This code is unreachable since it's handled by the default lexState.
- // if (c === undefined) {
- // read()
- // return newToken('eof')
- // }
- throw invalidChar(read())
- },
- };
- function newToken (type, value) {
- return {
- type: type,
- value: value,
- line: line,
- column: column,
- }
- }
- function literal (s) {
- for (var i = 0, list = s; i < list.length; i += 1) {
- var c = list[i];
- var p = peek();
- if (p !== c) {
- throw invalidChar(read())
- }
- read();
- }
- }
- function escape () {
- var c = peek();
- switch (c) {
- case 'b':
- read();
- return '\b'
- case 'f':
- read();
- return '\f'
- case 'n':
- read();
- return '\n'
- case 'r':
- read();
- return '\r'
- case 't':
- read();
- return '\t'
- case 'v':
- read();
- return '\v'
- case '0':
- read();
- if (util.isDigit(peek())) {
- throw invalidChar(read())
- }
- return '\0'
- case 'x':
- read();
- return hexEscape()
- case 'u':
- read();
- return unicodeEscape()
- case '\n':
- case '\u2028':
- case '\u2029':
- read();
- return ''
- case '\r':
- read();
- if (peek() === '\n') {
- read();
- }
- return ''
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- throw invalidChar(read())
- case undefined:
- throw invalidChar(read())
- }
- return read()
- }
- function hexEscape () {
- var buffer = '';
- var c = peek();
- if (!util.isHexDigit(c)) {
- throw invalidChar(read())
- }
- buffer += read();
- c = peek();
- if (!util.isHexDigit(c)) {
- throw invalidChar(read())
- }
- buffer += read();
- return String.fromCodePoint(parseInt(buffer, 16))
- }
- function unicodeEscape () {
- var buffer = '';
- var count = 4;
- while (count-- > 0) {
- var c = peek();
- if (!util.isHexDigit(c)) {
- throw invalidChar(read())
- }
- buffer += read();
- }
- return String.fromCodePoint(parseInt(buffer, 16))
- }
- var parseStates = {
- start: function start () {
- if (token.type === 'eof') {
- throw invalidEOF()
- }
- push();
- },
- beforePropertyName: function beforePropertyName () {
- switch (token.type) {
- case 'identifier':
- case 'string':
- key = token.value;
- parseState = 'afterPropertyName';
- return
- case 'punctuator':
- // This code is unreachable since it's handled by the lexState.
- // if (token.value !== '}') {
- // throw invalidToken()
- // }
- pop();
- return
- case 'eof':
- throw invalidEOF()
- }
- // This code is unreachable since it's handled by the lexState.
- // throw invalidToken()
- },
- afterPropertyName: function afterPropertyName () {
- // This code is unreachable since it's handled by the lexState.
- // if (token.type !== 'punctuator' || token.value !== ':') {
- // throw invalidToken()
- // }
- if (token.type === 'eof') {
- throw invalidEOF()
- }
- parseState = 'beforePropertyValue';
- },
- beforePropertyValue: function beforePropertyValue () {
- if (token.type === 'eof') {
- throw invalidEOF()
- }
- push();
- },
- beforeArrayValue: function beforeArrayValue () {
- if (token.type === 'eof') {
- throw invalidEOF()
- }
- if (token.type === 'punctuator' && token.value === ']') {
- pop();
- return
- }
- push();
- },
- afterPropertyValue: function afterPropertyValue () {
- // This code is unreachable since it's handled by the lexState.
- // if (token.type !== 'punctuator') {
- // throw invalidToken()
- // }
- if (token.type === 'eof') {
- throw invalidEOF()
- }
- switch (token.value) {
- case ',':
- parseState = 'beforePropertyName';
- return
- case '}':
- pop();
- }
- // This code is unreachable since it's handled by the lexState.
- // throw invalidToken()
- },
- afterArrayValue: function afterArrayValue () {
- // This code is unreachable since it's handled by the lexState.
- // if (token.type !== 'punctuator') {
- // throw invalidToken()
- // }
- if (token.type === 'eof') {
- throw invalidEOF()
- }
- switch (token.value) {
- case ',':
- parseState = 'beforeArrayValue';
- return
- case ']':
- pop();
- }
- // This code is unreachable since it's handled by the lexState.
- // throw invalidToken()
- },
- end: function end () {
- // This code is unreachable since it's handled by the lexState.
- // if (token.type !== 'eof') {
- // throw invalidToken()
- // }
- },
- };
- function push () {
- var value;
- switch (token.type) {
- case 'punctuator':
- switch (token.value) {
- case '{':
- value = {};
- break
- case '[':
- value = [];
- break
- }
- break
- case 'null':
- case 'boolean':
- case 'numeric':
- case 'string':
- value = token.value;
- break
- // This code is unreachable.
- // default:
- // throw invalidToken()
- }
- if (root === undefined) {
- root = value;
- } else {
- var parent = stack[stack.length - 1];
- if (Array.isArray(parent)) {
- parent.push(value);
- } else {
- parent[key] = value;
- }
- }
- if (value !== null && typeof value === 'object') {
- stack.push(value);
- if (Array.isArray(value)) {
- parseState = 'beforeArrayValue';
- } else {
- parseState = 'beforePropertyName';
- }
- } else {
- var current = stack[stack.length - 1];
- if (current == null) {
- parseState = 'end';
- } else if (Array.isArray(current)) {
- parseState = 'afterArrayValue';
- } else {
- parseState = 'afterPropertyValue';
- }
- }
- }
- function pop () {
- stack.pop();
- var current = stack[stack.length - 1];
- if (current == null) {
- parseState = 'end';
- } else if (Array.isArray(current)) {
- parseState = 'afterArrayValue';
- } else {
- parseState = 'afterPropertyValue';
- }
- }
- // This code is unreachable.
- // function invalidParseState () {
- // return new Error(`JSON5: invalid parse state '${parseState}'`)
- // }
- // This code is unreachable.
- // function invalidLexState (state) {
- // return new Error(`JSON5: invalid lex state '${state}'`)
- // }
- function invalidChar (c) {
- if (c === undefined) {
- return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
- }
- return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column))
- }
- function invalidEOF () {
- return syntaxError(("JSON5: invalid end of input at " + line + ":" + column))
- }
- // This code is unreachable.
- // function invalidToken () {
- // if (token.type === 'eof') {
- // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)
- // }
- // const c = String.fromCodePoint(token.value.codePointAt(0))
- // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`)
- // }
- function invalidIdentifier () {
- column -= 5;
- return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column))
- }
- function separatorChar (c) {
- console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping"));
- }
- function formatChar (c) {
- var replacements = {
- "'": "\\'",
- '"': '\\"',
- '\\': '\\\\',
- '\b': '\\b',
- '\f': '\\f',
- '\n': '\\n',
- '\r': '\\r',
- '\t': '\\t',
- '\v': '\\v',
- '\0': '\\0',
- '\u2028': '\\u2028',
- '\u2029': '\\u2029',
- };
- if (replacements[c]) {
- return replacements[c]
- }
- if (c < ' ') {
- var hexString = c.charCodeAt(0).toString(16);
- return '\\x' + ('00' + hexString).substring(hexString.length)
- }
- return c
- }
- function syntaxError (message) {
- var err = new SyntaxError(message);
- err.lineNumber = line;
- err.columnNumber = column;
- return err
- }
- var stringify = function stringify (value, replacer, space) {
- var stack = [];
- var indent = '';
- var propertyList;
- var replacerFunc;
- var gap = '';
- var quote;
- if (
- replacer != null &&
- typeof replacer === 'object' &&
- !Array.isArray(replacer)
- ) {
- space = replacer.space;
- quote = replacer.quote;
- replacer = replacer.replacer;
- }
- if (typeof replacer === 'function') {
- replacerFunc = replacer;
- } else if (Array.isArray(replacer)) {
- propertyList = [];
- for (var i = 0, list = replacer; i < list.length; i += 1) {
- var v = list[i];
- var item = (void 0);
- if (typeof v === 'string') {
- item = v;
- } else if (
- typeof v === 'number' ||
- v instanceof String ||
- v instanceof Number
- ) {
- item = String(v);
- }
- if (item !== undefined && propertyList.indexOf(item) < 0) {
- propertyList.push(item);
- }
- }
- }
- if (space instanceof Number) {
- space = Number(space);
- } else if (space instanceof String) {
- space = String(space);
- }
- if (typeof space === 'number') {
- if (space > 0) {
- space = Math.min(10, Math.floor(space));
- gap = ' '.substr(0, space);
- }
- } else if (typeof space === 'string') {
- gap = space.substr(0, 10);
- }
- return serializeProperty('', {'': value})
- function serializeProperty (key, holder) {
- var value = holder[key];
- if (value != null) {
- if (typeof value.toJSON5 === 'function') {
- value = value.toJSON5(key);
- } else if (typeof value.toJSON === 'function') {
- value = value.toJSON(key);
- }
- }
- if (replacerFunc) {
- value = replacerFunc.call(holder, key, value);
- }
- if (value instanceof Number) {
- value = Number(value);
- } else if (value instanceof String) {
- value = String(value);
- } else if (value instanceof Boolean) {
- value = value.valueOf();
- }
- switch (value) {
- case null: return 'null'
- case true: return 'true'
- case false: return 'false'
- }
- if (typeof value === 'string') {
- return quoteString(value)
- }
- if (typeof value === 'number') {
- return String(value)
- }
- if (typeof value === 'object') {
- return Array.isArray(value) ? serializeArray(value) : serializeObject(value)
- }
- return undefined
- }
- function quoteString (value) {
- var quotes = {
- "'": 0.1,
- '"': 0.2,
- };
- var replacements = {
- "'": "\\'",
- '"': '\\"',
- '\\': '\\\\',
- '\b': '\\b',
- '\f': '\\f',
- '\n': '\\n',
- '\r': '\\r',
- '\t': '\\t',
- '\v': '\\v',
- '\0': '\\0',
- '\u2028': '\\u2028',
- '\u2029': '\\u2029',
- };
- var product = '';
- for (var i = 0; i < value.length; i++) {
- var c = value[i];
- switch (c) {
- case "'":
- case '"':
- quotes[c]++;
- product += c;
- continue
- case '\0':
- if (util.isDigit(value[i + 1])) {
- product += '\\x00';
- continue
- }
- }
- if (replacements[c]) {
- product += replacements[c];
- continue
- }
- if (c < ' ') {
- var hexString = c.charCodeAt(0).toString(16);
- product += '\\x' + ('00' + hexString).substring(hexString.length);
- continue
- }
- product += c;
- }
- var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; });
- product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]);
- return quoteChar + product + quoteChar
- }
- function serializeObject (value) {
- if (stack.indexOf(value) >= 0) {
- throw TypeError('Converting circular structure to JSON5')
- }
- stack.push(value);
- var stepback = indent;
- indent = indent + gap;
- var keys = propertyList || Object.keys(value);
- var partial = [];
- for (var i = 0, list = keys; i < list.length; i += 1) {
- var key = list[i];
- var propertyString = serializeProperty(key, value);
- if (propertyString !== undefined) {
- var member = serializeKey(key) + ':';
- if (gap !== '') {
- member += ' ';
- }
- member += propertyString;
- partial.push(member);
- }
- }
- var final;
- if (partial.length === 0) {
- final = '{}';
- } else {
- var properties;
- if (gap === '') {
- properties = partial.join(',');
- final = '{' + properties + '}';
- } else {
- var separator = ',\n' + indent;
- properties = partial.join(separator);
- final = '{\n' + indent + properties + ',\n' + stepback + '}';
- }
- }
- stack.pop();
- indent = stepback;
- return final
- }
- function serializeKey (key) {
- if (key.length === 0) {
- return quoteString(key)
- }
- var firstChar = String.fromCodePoint(key.codePointAt(0));
- if (!util.isIdStartChar(firstChar)) {
- return quoteString(key)
- }
- for (var i = firstChar.length; i < key.length; i++) {
- if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) {
- return quoteString(key)
- }
- }
- return key
- }
- function serializeArray (value) {
- if (stack.indexOf(value) >= 0) {
- throw TypeError('Converting circular structure to JSON5')
- }
- stack.push(value);
- var stepback = indent;
- indent = indent + gap;
- var partial = [];
- for (var i = 0; i < value.length; i++) {
- var propertyString = serializeProperty(String(i), value);
- partial.push((propertyString !== undefined) ? propertyString : 'null');
- }
- var final;
- if (partial.length === 0) {
- final = '[]';
- } else {
- if (gap === '') {
- var properties = partial.join(',');
- final = '[' + properties + ']';
- } else {
- var separator = ',\n' + indent;
- var properties$1 = partial.join(separator);
- final = '[\n' + indent + properties$1 + ',\n' + stepback + ']';
- }
- }
- stack.pop();
- indent = stepback;
- return final
- }
- };
- var JSON5 = {
- parse: parse,
- stringify: stringify,
- };
- var lib = JSON5;
- var es5 = lib;
- return es5;
- })));
- });
- /*! *****************************************************************************
- Copyright (c) Microsoft Corporation.
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted.
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- PERFORMANCE OF THIS SOFTWARE.
- ***************************************************************************** */
- /* global Reflect, Promise */
- var extendStatics = function(d, b) {
- extendStatics = Object.setPrototypeOf ||
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
- function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
- return extendStatics(d, b);
- };
- function __extends(d, b) {
- extendStatics(d, b);
- function __() { this.constructor = d; }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- }
- var __assign = function() {
- __assign = Object.assign || function __assign(t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
- function __decorate(decorators, target, key, desc) {
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
- 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;
- return c > 3 && r && Object.defineProperty(target, key, r), r;
- }
- function __param(paramIndex, decorator) {
- return function (target, key) { decorator(target, key, paramIndex); }
- }
- function __metadata(metadataKey, metadataValue) {
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
- }
- function __awaiter(thisArg, _arguments, P, generator) {
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
- return new (P || (P = Promise))(function (resolve, reject) {
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
- step((generator = generator.apply(thisArg, _arguments || [])).next());
- });
- }
- function __generator(thisArg, body) {
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
- function verb(n) { return function (v) { return step([n, v]); }; }
- function step(op) {
- if (f) throw new TypeError("Generator is already executing.");
- while (_) try {
- 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;
- if (y = 0, t) op = [op[0] & 2, t.value];
- switch (op[0]) {
- case 0: case 1: t = op; break;
- case 4: _.label++; return { value: op[1], done: false };
- case 5: _.label++; y = op[1]; op = [0]; continue;
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
- default:
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
- if (t[2]) _.ops.pop();
- _.trys.pop(); continue;
- }
- op = body.call(thisArg, _);
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
- }
- }
- function __values(o) {
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
- if (m) return m.call(o);
- if (o && typeof o.length === "number") return {
- next: function () {
- if (o && i >= o.length) o = void 0;
- return { value: o && o[i++], done: !o };
- }
- };
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
- }
- function __read(o, n) {
- var m = typeof Symbol === "function" && o[Symbol.iterator];
- if (!m) return o;
- var i = m.call(o), r, ar = [], e;
- try {
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
- }
- catch (error) { e = { error: error }; }
- finally {
- try {
- if (r && !r.done && (m = i["return"])) m.call(i);
- }
- finally { if (e) throw e.error; }
- }
- return ar;
- }
- function __spread() {
- for (var ar = [], i = 0; i < arguments.length; i++)
- ar = ar.concat(__read(arguments[i]));
- return ar;
- }
- var PropertyDescription = /** @class */ (function () {
- function PropertyDescription() {
- var _this = this;
- var args = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- args[_i] = arguments[_i];
- }
- this.propertyes = {
- props: [],
- events: []
- };
- _$2.each(args, function (arg) {
- _this.merge(arg);
- });
- }
- PropertyDescription.prototype.merge = function (pd) {
- this.propertyes.props = (_$2.uniqBy(__spread(this.propertyes.props, pd.props), 'name'));
- if (pd.events) {
- if (this.propertyes.events) {
- this.propertyes.events = (_$2.uniqBy(__spread(this.propertyes.events, pd.events), 'name'));
- }
- else {
- this.propertyes.events = _$2.uniqBy(__spread(pd.events), 'name');
- }
- }
- };
- /**
- * 根据分组名 获取属性定义
- */
- PropertyDescription.prototype.getPropsByGroup = function (name) {
- return _$2.filter(this.propertyes.props, function (i) { return i.group === name; });
- };
- /**
- * 获取全部事件
- */
- PropertyDescription.prototype.getEvents = function () {
- return this.propertyes.events;
- };
- return PropertyDescription;
- }());
- var PropertyDescriptionTable = new Map();
- var width = {
- name: 'width',
- default: '',
- group: 'common',
- desc: '宽',
- type: 'string'
- };
- var height = {
- name: 'height',
- default: '',
- group: 'common',
- desc: '高',
- type: 'string'
- };
- var fieldLabel = {
- name: 'fieldLabel',
- default: '',
- group: 'common',
- desc: '文本描述',
- type: 'string',
- expr: true,
- };
- var text$1 = {
- name: 'text',
- default: '',
- group: 'common',
- desc: '文本描述',
- type: 'string',
- expr: true,
- };
- var iconCls = {
- name: 'iconCls',
- default: '',
- group: 'common',
- desc: '图标',
- type: 'string',
- expr: true,
- };
- var disabled = {
- name: 'disabled',
- default: false,
- group: 'common',
- desc: '禁用',
- type: 'boolean',
- expr: true,
- };
- var value = {
- name: 'value',
- default: '',
- group: 'common',
- desc: '字段值',
- type: 'string',
- expr: true,
- };
- var template = {
- name: 'template',
- default: '',
- group: 'common',
- desc: 'HTML内容',
- type: 'string',
- expr: true,
- };
- var reference = {
- name: 'reference',
- default: '',
- group: 'common',
- desc: '组件句柄',
- type: 'string',
- expr: true,
- };
- var tooltip = {
- name: 'tooltip',
- default: '',
- group: 'common',
- desc: '悬停提示',
- type: 'string'
- };
- // =============事件 ==============
- var click = {
- name: 'click',
- default: '',
- group: 'listeners',
- desc: '点击事件',
- eventParamter: [
- 'sender',
- 'e: any'
- ],
- type: 'listeners'
- };
- var change = {
- name: 'change',
- default: '',
- group: 'listeners',
- desc: 'value change事件',
- eventParamter: [
- 'sender',
- 'e: any'
- ],
- type: 'listeners'
- };
- var keyup = {
- name: 'keyup',
- default: '',
- group: 'listeners',
- desc: '键盘按键抬起事件',
- eventParamter: [
- 'sender',
- 'e'
- ],
- type: 'listeners'
- };
- var afterrender = {
- name: 'afterrender',
- default: '',
- group: 'listeners',
- desc: '控件渲染后触发',
- eventParamter: [
- 'sender',
- 'e'
- ],
- type: 'listeners'
- };
- // =============特性 ==============
- var fix = {
- name: 'fix',
- default: '',
- group: 'fix',
- desc: '特性',
- type: 'fix',
- expr: true,
- };
- PropertyDescriptionTable.set('cols', new PropertyDescription({
- props: [
- height
- ]
- }));
- PropertyDescriptionTable.set('layout', new PropertyDescription({
- props: [
- {
- name: 'borderless',
- default: true,
- group: 'css',
- desc: '有无边框',
- type: 'boolean'
- },
- {
- name: 'type',
- default: '',
- group: 'css',
- desc: '布局类型',
- type: ['line', 'clean', 'wide', 'space', 'form']
- },
- {
- name: '_designMode',
- default: 'module',
- group: 'common',
- desc: '设计类型',
- type: ['none', 'module', 'scroll-module']
- }
- ]
- }));
- var YvBase = {
- props: [
- width, height, reference, afterrender, fix
- ],
- events: [
- // {name: 'onRender', desc: '第一次控件被渲染时触发'}
- ]
- };
- PropertyDescriptionTable.set('template', new PropertyDescription(YvBase, {
- props: [
- template
- ]
- }));
- PropertyDescriptionTable.set('fieldset', new PropertyDescription(YvBase, {
- props: [
- {
- name: 'label',
- default: '',
- group: 'common',
- desc: '字段组标题',
- type: 'string'
- }
- ]
- }));
- PropertyDescriptionTable.set('iframe', new PropertyDescription(YvBase, {
- props: [
- {
- name: 'src',
- default: '',
- group: 'common',
- desc: '地址路径',
- type: 'string'
- }
- ]
- }));
- PropertyDescriptionTable.set('uploader', new PropertyDescription(YvBase, {
- props: [
- width, height,
- {
- name: 'value',
- default: '上传',
- group: 'common',
- desc: '文本描述',
- type: 'string'
- },
- {
- name: 'upload',
- default: '/upload',
- group: 'common',
- desc: '上传地址',
- type: 'string'
- },
- ],
- events: [
- { name: 'onFileUpload', desc: '文件上传成功结束时触发' },
- { name: 'onFileUploadError', desc: '在上传过程中发生服务器端错误时触发' },
- ]
- }));
- PropertyDescriptionTable.set('viewer', new PropertyDescription(YvBase, {
- props: [
- value,
- {
- name: 'imgWidth',
- default: '',
- group: 'common',
- desc: '图片宽',
- type: 'string'
- },
- {
- name: 'imgHeight',
- default: '',
- group: 'common',
- desc: '图片高',
- type: 'string'
- }
- ]
- }));
- PropertyDescriptionTable.set('image', new PropertyDescription(YvBase, {
- props: [
- value,
- {
- name: 'imgWidth',
- default: '',
- group: 'common',
- desc: '图片宽',
- type: 'string'
- },
- {
- name: 'imgHeight',
- default: '',
- group: 'common',
- desc: '图片高',
- type: 'string'
- }
- ]
- }));
- PropertyDescriptionTable.set('button', new PropertyDescription(YvBase, {
- props: [text$1, disabled, height, width, iconCls, click, afterrender],
- }));
- PropertyDescriptionTable.set('fieldSet', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height
- ],
- }));
- PropertyDescriptionTable.set('textfield', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('searchfield', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('radiogroup', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('radio', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('numberfield', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('datetimepicker', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('datetimefield', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('datefield', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('combogrid', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height
- ],
- }));
- PropertyDescriptionTable.set('combo', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('checkboxgroup', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('checkbox', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, keyup, afterrender, change
- ],
- }));
- PropertyDescriptionTable.set('yvgrid', new PropertyDescription(YvBase, {
- props: [
- fieldLabel, value, disabled,
- tooltip, width, height, afterrender, change
- ],
- }));
- /**
- * 弹出输入框,输入文字
- * @param message 提示文字
- * @param defaultValue 默认值
- * @param multiLine 是否多行输入
- */
- function prompt$1(message, defaultValue, multiLine) {
- if (defaultValue === void 0) { defaultValue = ""; }
- if (multiLine === void 0) { multiLine = false; }
- return new Promise(function (resolve) {
- Ext.MessageBox.prompt('请输入', message, function (button, value) {
- if (button === 'ok') {
- resolve(value);
- }
- }, null, multiLine, defaultValue);
- });
- }
- /**
- * 显示错误异常信息
- * @param msg 错误内容
- * @param sender 发送者按钮(可以为空)
- */
- function showErrorDialog(msg, sender) {
- console.error(msg);
- Ext.MessageBox.show({
- title: '错误',
- msg: msg,
- buttons: Ext.MessageBox.OK,
- animateTarget: sender,
- icon: 'error',
- cls: 'show-icon-messagebox',
- });
- }
- /**
- * 显示错误异常信息
- * @param msg 错误内容
- * @param sender 发送者按钮(可以为空)
- */
- function showInfoDialogSimple(msg, sender) {
- console.info(msg);
- Ext.MessageBox.show({
- title: '提示',
- msg: msg,
- buttons: Ext.MessageBox.OK,
- animateTarget: sender,
- icon: 'info',
- cls: 'show-icon-messagebox',
- });
- }
- function msgError(msg, sender) {
- showErrorDialog(msg, sender);
- }
- /**
- * 中间灰底白字提示
- */
- function msg(message) {
- console.log(message);
- var t = { message: message };
- var WMSTranslate = window["WMSTranslate"];
- if (WMSTranslate) {
- if (typeof window['viewTranslate'] === 'function') {
- window['viewTranslate'](t, message, "message");
- }
- }
- var $body = $$2('body');
- $body.find('[xtype=tooltip]').remove();
- var $w = $$2('<div xtype="tooltip" class="yvan-msg yvan-anim yvan-anim-00">' +
- ' <div class="yvan-msg-content">' +
- _$2.escape(t.message) +
- '</div></div>');
- $body.append($w);
- var iframeWidth = $w.parent().width();
- var iframeHeight = $w.parent().height();
- var windowWidth = $w.width();
- var windowHeight = $w.height();
- var setWidth = (iframeWidth - windowWidth) / 2;
- var setHeight = (iframeHeight - windowHeight) / 2;
- if (iframeHeight < windowHeight || setHeight < 0) {
- setHeight = 0;
- }
- if (iframeWidth < windowWidth || setWidth < 0) {
- setWidth = 0;
- }
- $w.css({ left: setWidth, top: setHeight });
- setTimeout(function () {
- $w.remove();
- }, 3000);
- }
- localforage.config({
- name: "studio",
- storeName: "item",
- });
- function getItem(key, callback) {
- localforage.getItem(key).then(function (value) {
- if (callback) {
- callback(value);
- }
- });
- }
- function setItem(key, value, callback) {
- localforage.setItem(key, value).then(function (val) {
- if (callback) {
- callback();
- }
- });
- }
- var native = {
- /**
- * 读取文件
- */
- loadFile: function (fileName, callback) {
- console.log('loadFile', fileName);
- getItem('NATIVE_' + fileName, callback);
- },
- /**
- * 保存文件
- */
- saveFile: function (fileName, content) {
- console.log('saveFile', fileName, content);
- setItem('NATIVE_' + fileName, content);
- },
- openInIdea: function (path) {
- msg(path);
- },
- /**
- * 初始化 native 工具类
- */
- init: function () {
- var ClipboardJS = window['ClipboardJS'];
- if (!ClipboardJS) {
- msg('没有引入 ClipboardJS');
- return;
- }
- $(document.body).append("\n<button class=\"__btnClipboard\" style=\"display: none\" data-clipboard-text=\"Just Clipboard.js\">\n Copy to clipboard\n</button> \n ");
- var clipboard = new ClipboardJS('.__btnClipboard');
- },
- /**
- * 设置剪切板
- */
- clipboardSet: function (c) {
- var $btn = $('.__btnClipboard');
- $btn.attr('data-clipboard-text', c);
- $btn.trigger("click");
- },
- };
- /**
- * 判断变量是否有值 value === null || value === undefined
- * @param value 目标变量
- */
- var noValue = function (value) {
- return value === null || value === undefined;
- };
- function initStateTree () {
- Ext.define('com.yvan.studio.StateTree', {
- extend: 'Ext.tree.Panel',
- _saveStateFlag: true,
- _filterText: '',
- fbar: [
- {
- xtype: 'textfield',
- flex: 1,
- emptyText: '搜索过滤',
- enableKeyEvents: true,
- listeners: {
- change: function (sender) {
- var tree = sender.up("treepanel");
- tree.filterByText(this.getRawValue());
- },
- keyup: function (sender, e) {
- var tree = sender.up("treepanel");
- if (e.ESC === e.getKey()) {
- sender.setValue('');
- tree.filterByText('');
- }
- }
- }
- },
- ],
- getStateFilename: function () {
- throw Error('没有实现这个函数');
- },
- initComponent: function () {
- var me = this;
- this.on({
- afterrender: function () {
- var _this = this;
- // 回车后打开节点
- $(me.el.dom).keydown(function (event) {
- if (event.keyCode === 13) {
- event.preventDefault();
- _this.fireEvent('itemverify');
- return;
- }
- });
- },
- afteritemexpand: {
- fn: function (node, index, item, eOpts) {
- this.saveState();
- },
- buffer: 100,
- },
- afteritemcollapse: {
- fn: function (node, index, item, eOpts) {
- this.saveState();
- },
- buffer: 100,
- },
- itemdblclick: function (sender, record) {
- this.fireEvent('itemverify');
- },
- itemclick: {
- fn: function (node, index, item, eOpts) {
- this.saveState();
- },
- buffer: 100,
- }
- });
- this.superclass.superclass.initComponent.apply(this, arguments);
- },
- restoreState: function () {
- var _this = this;
- native.loadFile(this.getStateFilename(), function (content) {
- if (!content)
- return;
- var expands = content.expands, selections = content.selections, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
- _this._saveStateFlag = false;
- if (_.isArray(expands)) {
- _.forEach(expands, function (p) {
- _this.expandPath(p);
- });
- }
- if (_.isArray(selections) && selections[0]) {
- try {
- _this.selectPath(selections[0]);
- }
- catch (e) {
- }
- }
- if (scrollPosition && scrollSize) {
- var size = _this.scrollable.getSize();
- if (size.x === scrollSize.x && size.y === scrollSize.y) {
- try {
- _this.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
- }
- catch (e) {
- }
- }
- }
- setTimeout(function () {
- _this._saveStateFlag = true;
- }, 200);
- });
- },
- saveState: function () {
- if (!this._saveStateFlag) {
- return;
- }
- if (this._filterText) {
- // 有筛选,不保存展开状态
- return;
- }
- var expands = [];
- var selections = [];
- var selection = this.getSelection();
- _.forEach(selection, function (item) {
- selections.push(item.getPath());
- });
- var data = this.getStore().data;
- _.forEach(data.items, function (item) {
- if (item.data.expanded === true) {
- expands.push(item.getPath());
- }
- });
- var scrollPosition = this.scrollable.position;
- var scrollSize = this.scrollable.getSize();
- native.saveFile(this.getStateFilename(), {
- selections: selections,
- expands: expands,
- scrollPosition: scrollPosition,
- scrollSize: scrollSize
- });
- },
- filterByText: function (text) {
- this._filterText = text;
- this._filterBy(this, text, 'text');
- },
- _filterBy: _.debounce(function (me, text, by) {
- var view = me.getView();
- me.store.clearFilter();
- if (!me._filterText) {
- // 没有筛选内容,还原状态
- var selections = me.getSelection();
- var selectionPaths_1 = [];
- _.forEach(me.getSelection(), function (item) {
- selectionPaths_1.push(item.getPath());
- });
- me.collapseAll();
- me.restoreState();
- _.forEach(selectionPaths_1, function (path) {
- me.expandPath(path);
- });
- me.setSelection(selections);
- return;
- }
- // 递归查找所有需要可见的节点 id 数组
- var nodesAndParents = [];
- var expandPaths = [];
- me.getRootNode().cascadeBy(function (tree, view) {
- var currNode = this;
- currNode.collapse();
- if (currNode && currNode.data[by] &&
- currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
- // 展开到匹配的路径
- // me.expandPath(currNode.getPath());
- expandPaths.push(currNode.getPath());
- // 沿途父节点全部设定为可见
- while (currNode.parentNode) {
- nodesAndParents.push(currNode.id);
- currNode = currNode.parentNode;
- }
- }
- }, null, [me, view]);
- me.store.filterBy(function (r) {
- return Ext.Array.contains(nodesAndParents, r.get('id'));
- });
- _.forEach(expandPaths, function (path) {
- me.expandPath(path);
- });
- }, 1000),
- });
- }
- function initDashboard () {
- Ext.define('com.yvan.studio.Dashboard', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.dashboard',
- xtype: 'dashboard',
- html: ''
- });
- }
- var handles$1 = {
- mainWindow: undefined,
- fileTree: undefined,
- dbTree: undefined,
- viewoutlinetree: undefined,
- statusbar: undefined,
- dictTree: undefined,
- property: undefined,
- dbcode: undefined,
- report: undefined,
- widget: undefined,
- whLayout: undefined,
- };
- window['handles'] = handles$1;
- function setDictTree(value) {
- handles$1.dictTree = value;
- }
- function setMainWindow(value) {
- handles$1.mainWindow = value;
- }
- function setReport(value) {
- handles$1.report = value;
- }
- function setStatusbar(statusbar) {
- handles$1.statusbar = statusbar;
- }
- function setFileTree(value) {
- handles$1.fileTree = value;
- }
- function setDbTree(value) {
- handles$1.dbTree = value;
- }
- function setWidget(value) {
- handles$1.widget = value;
- }
- function setWhLayout(value) {
- handles$1.whLayout = value;
- }
- function setViewoutlinetree(value) {
- handles$1.viewoutlinetree = value;
- }
- function setPropertyPanel(value) {
- handles$1.property = value;
- }
- function setDbCode(value) {
- handles$1.dbcode = value;
- }
- /**
- * 调用方法
- */
- function invokeMethod(fn, sender, args) {
- if (typeof fn === 'function') {
- fn.apply.apply(fn, __spread([sender], args));
- }
- }
- /**
- * 判断事件是否为有效的输入字符
- * @param e
- */
- function isChartEvent(e) {
- if (e.key === 'Shift' ||
- e.key === 'Control' ||
- e.key === 'Alt' ||
- e.key === 'Escape' ||
- e.key === 'ArrowRight' ||
- e.key === 'Tab' ||
- e.key === 'ArrowLeft') {
- return false;
- }
- if (e.keyCode >= 48 && e.keyCode <= 57) {
- // 0-9
- return true;
- }
- if (e.keyCode >= 65 && e.keyCode <= 90) {
- // a-z
- return true;
- }
- if (e.keyCode >= 96 && e.keyCode <= 111 && e.keyCode !== 108) {
- // 小键盘 0-9
- return true;
- }
- return false;
- }
- if (!window["time_offset"]) {
- window["time_offset"] = 0;
- }
- function syncDate(date) {
- if (date && date.setTime && date.getTime) {
- date.setTime(date.getTime() + window["time_offset"]);
- }
- return date;
- }
- function isDesignMode(control, config) {
- var _a, _b;
- if (window["IS_DESIGN_MODE"]) {
- return true;
- }
- if ((control === null || control === void 0 ? void 0 : control.designMode) === true) {
- return true;
- }
- if (((_a = config === null || config === void 0 ? void 0 : config.yvanScope) === null || _a === void 0 ? void 0 : _a.IS_DESIGN_MODE) === true) {
- return true;
- }
- if ((control === null || control === void 0 ? void 0 : control.IS_DESIGN_MODE) === true) {
- return true;
- }
- if (((_b = config === null || config === void 0 ? void 0 : config.session) === null || _b === void 0 ? void 0 : _b.IS_DESIGN_MODE) === true) {
- return true;
- }
- return false;
- }
- function toString(value) {
- if (typeof value === 'undefined' || value === null) {
- return "";
- }
- if (typeof value === 'number' && isNaN(value)) {
- return "";
- }
- if (value == 'N/A') {
- return "";
- }
- return ("" + value);
- }
- function isEmpty(value) {
- if (typeof value === 'undefined' || value === null) {
- return true;
- }
- if (typeof value === 'number' && isNaN(value)) {
- return true;
- }
- if (value == 'N/A') {
- return true;
- }
- return ("" + value).trim().length <= 0;
- }
- function createUUID() {
- //@ts-ignore
- return ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, function (c) {
- return (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16);
- });
- }
- function getRegList() {
- var regList = _$2.get(window, 'yvanLib.regList');
- if (!regList) {
- regList = [];
- _$2.set(window, 'yvanLib.regList', regList);
- }
- return regList;
- }
- function getRegParamList(methodName) {
- var regParamList = _$2.get(window, 'yvanLib.regParamList');
- if (!regParamList) {
- regParamList = {};
- _$2.set(window, 'yvanLib.regParamList', regParamList);
- }
- if (!_$2.has(regParamList, methodName)) {
- regParamList[methodName] = [];
- }
- return regParamList[methodName];
- }
- /**
- * 模拟点击按钮
- */
- function raiseClick(buttonHandle) {
- if (!buttonHandle) {
- return false;
- }
- if (buttonHandle.disabled) {
- // 按钮是禁止状态
- return false;
- }
- if (buttonHandle.hidden) {
- // 按钮是隐藏状态
- return false;
- }
- // 按钮点击
- buttonHandle.click();
- return true;
- }
- /**
- * 标注系统全局函数的参数
- * @param title 函数名称
- * @param type 函数类型
- * @param allowEmpty 可否为空
- */
- function LibParam(title, type, allowEmpty) {
- if (allowEmpty === void 0) { allowEmpty = false; }
- return function (target, methodName, paramsIndex) {
- var systemFnArgs = getRegParamList(methodName);
- systemFnArgs[paramsIndex] = {
- type: type,
- title: title,
- name: methodName,
- allowEmpty: allowEmpty,
- };
- };
- }
- /**
- * 标注函数变成"系统全局函数"
- */
- function Lib(registe) {
- return function (target, propertyKey, descriptor) {
- var libList = getRegList();
- libList.push(__assign(__assign({}, registe), { name: propertyKey, target: target[propertyKey] }));
- if (registe.type === 'system') {
- _$2.set(window, 'yvanLib.system.' + propertyKey, target[propertyKey]);
- }
- else if (registe.type === 'format') {
- _$2.set(window, 'yvanLib.format.' + propertyKey, target[propertyKey]);
- }
- return target;
- };
- }
- /**
- * 解析事件
- * 'scope.私有方法名'
- * 'system.系统函数名'
- * 'format.格式化名'
- */
- function lookupFn(scope, event, errorWho) {
- if (isDesignMode(scope, undefined)) {
- return Ext.emptyFn;
- }
- if (!_$2.startsWith(event, 'scope.') &&
- !_$2.startsWith(event, 'system.') &&
- !_$2.startsWith(event, 'format.')) {
- console.error('无法识别的事件响应类型', event);
- throw new TypeError('无法识别的事件响应类型');
- }
- // 为 eval 准备环境
- var _a = window['yvanLib'], system = _a.system, format = _a.format;
- var data = scope.viewModel.data;
- var keys = [];
- var values = [];
- _$2.forOwn(data, function (value, key) {
- var idxKey = key.indexOf('//');
- if (idxKey >= 0) {
- keys.push(key.substr(0, idxKey));
- }
- else {
- keys.push(key);
- }
- values.push(value);
- });
- var func = Function.apply(void 0, __spread(['scope', 'system', 'format'], keys, ['return ' + event]));
- var funcResult = func.apply(void 0, __spread([scope, system, format], values));
- if (typeof funcResult !== 'function') {
- console.error('无法识别的事件响应类型', event, func, errorWho);
- throw new TypeError('无法识别的事件响应类型');
- }
- return funcResult;
- }
- /**
- * 从 ext.element 获取 scope 对象
- */
- function lookupScope(extHandle) {
- if (!extHandle) {
- // @ts-ignore
- return;
- }
- if (extHandle.isScope) {
- return extHandle;
- }
- if (extHandle.column) {
- // 列上的组件
- return extHandle.column.lookupReferenceHolder().yvanScope;
- }
- if (_$2.get(extHandle, 'alias[0]') === 'widget.button') ;
- if (typeof extHandle.lookupViewModel === 'function') {
- var vm = extHandle.lookupViewModel();
- return vm.yvanScope;
- }
- return;
- }
- /**
- * 全局 ajax 方法
- */
- var ajax = {};
- /**
- * 计算拼音的函数
- */
- var pinyinFunc = function (str) { return (str); };
- exports.scopeOnLoad = null;
- exports.apiConvert = undefined;
- var baseConfigProcessList = [];
- /**
- * 在基类添加 Config 的处理方法
- */
- function baseConfigProcess(option) {
- return function (target, propertyKey) {
- baseConfigProcessList.push(target[propertyKey]);
- };
- }
- // let designMode: boolean = false
- //
- // export function isDesignMode(): boolean {
- // return designMode
- // }
- //
- // export function setDesignMode(v: boolean) {
- // designMode = v
- // }
- /**
- * 将业务定义的 url 转换为调用服务端 groovy 的 url
- */
- function serverInvokeUrlTransform(url, option) {
- return _$2.get(window, '_YvanUI_serverInvokePrefix')(url, option);
- }
- /**
- * 将业务定义的 url 转换为调用服务端 sql 的 Url
- */
- function sqlUrlTransform(url) {
- return _$2.get(window, '_YvanUI_sqlPrefix')(url);
- }
- /**
- * YvanUI 全局扩展配置
- */
- function extend(option) {
- if (option.ajax) {
- ajax.func = option.ajax;
- }
- if (option.serverInvokeUrlTransform) {
- _$2.extend(window, { _YvanUI_serverInvokePrefix: option.serverInvokeUrlTransform });
- }
- if (option.sqlUrlTransform) {
- _$2.extend(window, { _YvanUI_sqlPrefix: option.sqlUrlTransform });
- }
- if (option.pinyinFunction) {
- pinyinFunc = option.pinyinFunction;
- }
- if (option.scopeOnLoad) {
- exports.scopeOnLoad = option.scopeOnLoad;
- }
- if (option.scopeOnCreate) {
- exports.scopeOnCreate = option.scopeOnCreate;
- }
- if (option.apiConvert) {
- exports.apiConvert = option.apiConvert;
- }
- // if (typeof option.designMode !== 'undefined') {
- // setDesignMode(option.designMode)
- // }
- }
- function getApiConvert() {
- return exports.apiConvert;
- }
- function getScopeOnCreate() {
- return exports.scopeOnCreate;
- }
- function getPinyin(v) {
- return pinyinFunc(v);
- }
- /**
- * 适用于 Select / Tree 等,作筛选的通用方法.
- * 1.首字母模糊匹配(不区分大小写)
- * 2.标识的模糊匹配(不区分大小写)
- * 3.名称的模糊匹配,且支持以逗号(全角或半角)隔开的字词匹配,并自动去空格,如“南京, 物流 ”可以匹配出“南京九州通物流技术开发有限公司”
- */
- function keywordFilter(keyword, label, value) {
- if (!keyword) {
- return true;
- }
- var ws = _$2.trim(keyword).split(/\s+|\.|,|\)|\(|,|。|-|—/g);
- // const labelPy = _.toLower(getPinyin(label))
- //@ts-ignore
- var labelPy = _$2.toLower(getFirstPinyin2(label));
- value = _$2.toLower(_$2.trim(value));
- var found = 0;
- _$2.some(ws, function (word) {
- if (labelPy.indexOf(word.toLowerCase()) >= 0 || label.indexOf(word) >= 0) {
- found++;
- return;
- }
- if (value && value.indexOf(word.toLowerCase()) >= 0) {
- found++;
- return;
- }
- });
- return found >= ws.length;
- }
- var idPrefix = "_ds_";
- var colsContainerArr = ['toolbar', 'col', 'form', 'fieldset']; //"design_cols_container"
- var rowsContainerArr = ['form', 'fieldset']; //"design_rows_container"
- var colItemCmpArr = ['label', 'textfield', 'textareafield', 'numberfield', 'combo', 'combobox', "datefield", 'searchfield', 'combotree', 'combogrid', 'button', 'checkbox', 'checkboxgroup', "radio", "radiogroup", "container"];
- var canMoveCmpArr = __spread(colItemCmpArr, ["cols"]);
- var layoutOrXtypeNameMap = {
- fit: 'fit布局',
- border: 'border布局',
- center: '中部',
- north: '上部',
- south: '下部',
- west: '左部',
- east: '右部',
- yvgrid: '表格',
- tree: '树',
- tabpanel: '标签页',
- form: '表单',
- fieldset: '字段组',
- tbar: '顶部工具栏',
- fbar: '底部工具栏',
- toolbar: '工具栏',
- cols: '列容器',
- rows: '行容器',
- textfield: '文本框',
- textareafield: '长文本框',
- numberfield: '数字框',
- label: "文本",
- combo: "下拉框",
- combobox: "下拉框",
- combotree: "下拉树",
- combogrid: "下拉表",
- datefield: "日期框",
- searchfield: "搜索框",
- button: "按钮",
- checkbox: "勾选",
- checkboxgroup: "勾选组",
- radio: "点选",
- radiogroup: "点选组",
- container: "占位"
- };
- /**
- * 从 VJSON 中找到 rows/cols 的数组
- */
- function findArrayContainer(vjson, id) {
- var parentVJson = getSuperVjson(vjson, id);
- if (_$2.isArray(parentVJson)) {
- return parentVJson;
- }
- if (parentVJson.hasOwnProperty('items')) {
- return parentVJson.items;
- }
- }
- /**
- * 根据id查找上级vjson
- * @param vjson 原始 vjson 视图
- * @param targetId 子元素的id
- */
- function getSuperVjson(vjson, targetId) {
- return deepTravFindSuper(vjson, vjson, targetId);
- }
- /**
- * 根据id查找上级vjson id
- * @param vjson 原始 vjson 视图
- * @param targetId 子元素的id
- */
- function getSuperVjsonId(vjson, targetId) {
- var vj = getSuperVjson(vjson, targetId);
- return vj.id;
- }
- function deepTravFindSuper(superVjson, vjson, targetId) {
- var rObj = null;
- _$2.forOwn(vjson, function (value, key) {
- if (rObj) {
- return;
- }
- if (typeof value !== "object") {
- return;
- }
- if (_$2.has(vjson, 'xtype') && vjson.xtype === 'toolbar') {
- if (key !== 'items') {
- return;
- }
- }
- else {
- // 模型、数据、数据源不扫描
- if (key === 'data' ||
- key === 'dataSource' ||
- key === 'suggest' ||
- key === 'options' ||
- key === 'config' ||
- key === 'columns' ||
- key === 'viewModel' ||
- key === 'store') {
- return;
- }
- }
- //事件不扫描
- if (key === "on" && _$2.isObject(value)) {
- return;
- }
- if (key.startsWith("on") && _$2.size(key) > 2) {
- return;
- }
- if (value.id === targetId) {
- if (_$2.isArray(vjson)) {
- rObj = superVjson;
- }
- else {
- rObj = vjson;
- }
- return;
- }
- rObj = deepTravFindSuper(vjson, value, targetId);
- });
- return rObj;
- }
- /**
- * 深度遍历 vjson
- * @param vjson 视图JSON
- * @param resolver 分析函数
- * @return 记录 resolver 方法返回 true 时,对象的访问路径
- */
- function deepTravVJson(vjson, resolver, propDeep) {
- if (propDeep === void 0) { propDeep = false; }
- var markerList = [];
- deepTrav1(vjson, resolver, markerList, propDeep);
- return markerList;
- }
- function deepTrav1(obj, resolver, marker, propDeep) {
- if (propDeep === void 0) { propDeep = false; }
- var isMarker = resolver(obj);
- if (marker && isMarker === true) {
- marker.unshift({ id: 0, keyName: '', object: obj });
- }
- _$2.forOwn(obj, function (value, key) {
- if (typeof value !== 'object') {
- return;
- }
- if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
- if (key !== 'items' && key !== 'children') {
- return;
- }
- }
- else {
- // 模型、数据、数据源不扫描
- if (key === 'data' || key === 'dataSource' || key === 'viewModel' || key === 'store') {
- return;
- }
- if (!propDeep &&
- (key === 'suggest' || key === 'options' || key === 'config' || key === 'columns' ||
- key === 'listeners' || key === 'bind')) {
- return;
- }
- }
- //事件不扫描
- if (key === 'on' && _$2.isObject(value)) {
- return;
- }
- if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
- return;
- }
- var isMarkerChild = deepTrav1(value, resolver, marker, propDeep);
- if (marker && isMarkerChild === true) {
- isMarker = true;
- marker.unshift({ id: obj.id, keyName: key, object: value });
- }
- });
- // @ts-ignore 删除作废对象
- _$2.remove(obj, function (v) { return v && v.isFiltered; });
- return isMarker;
- }
- /**
- * 在代码中找到 reference 对应的对象
- */
- function findInCode(code, id) {
- try {
- deepTravVJson(code, function (child) {
- if (child.id === id) {
- throw child;
- }
- });
- return undefined;
- }
- catch (err) {
- return err;
- }
- }
- function replaceVjsonById(vjson, itemVjson, itemId) {
- if (!itemVjson || (!itemVjson.id && !itemId)) {
- msgError('无法定位组件!');
- debugger;
- return;
- }
- var id = itemId || itemVjson.id;
- deepTravVJson(vjson, function (obj) {
- if (obj.id == id) {
- _$2.assign(obj, itemVjson, { id: id });
- }
- });
- }
- function deepTravDeleteVjson(obj, targetId) {
- var isDelete = false;
- _$2.forOwn(obj, function (value, key) {
- if (isDelete) {
- return;
- }
- if (typeof value !== 'object') {
- return;
- }
- if (_$2.has(obj, 'xtype') && obj.xtype === 'toolbar') {
- if (key !== 'items') {
- return;
- }
- }
- else {
- // 模型、数据、数据源不扫描
- if (key === 'data' ||
- key === 'dataSource' ||
- key === 'suggest' ||
- key === 'options' ||
- key === 'config' ||
- key === 'columns' ||
- key === 'viewModel' ||
- key === 'store') {
- return;
- }
- }
- //事件不扫描
- if (key === 'on' && _$2.isObject(value)) {
- return;
- }
- if (_$2.startsWith(key, 'on') && _$2.size(key) > 2) {
- return;
- }
- if (value.id === targetId) {
- isDelete = true;
- /** 如果是数组的元素*/
- if (_$2.isArray(obj)) {
- obj.splice(key, 1);
- }
- else {
- delete obj[key];
- }
- return;
- }
- isDelete = deepTravDeleteVjson(value, targetId);
- });
- return isDelete;
- }
- /**
- * 根据id删除Vjson 会删除因删除元素造成的空对象
- * @param obj 原始 vjson 视图
- * @param targetId 子元素的id
- */
- function deletVjsonById(vjson, targetId) {
- var isDeleted = deepTravDeleteVjson(vjson, targetId);
- // if (_.isArray(obj)) {
- // if (obj.length <= 0) {
- // let T: any = {
- // view: "template",
- // template: "拖动任何组件到此处",
- // role: "placeholder",
- // id: webix.uid()
- // }
- // obj.push(T);
- // }
- // }
- return isDeleted;
- }
- function removeDesignProp(vjson) {
- deepTravVJson(vjson, function (obj) {
- if (obj.hasOwnProperty('id')) {
- delete obj.id;
- }
- if (obj.hasOwnProperty("designMode")) {
- delete obj.designMode;
- }
- });
- if (vjson.hasOwnProperty("cls")) {
- delete vjson.cls;
- }
- if (vjson.hasOwnProperty("viewModel")) {
- delete vjson.viewModel;
- }
- if (vjson.hasOwnProperty("store")) {
- delete vjson.store;
- }
- }
- function getLayoutOutline(vjson) {
- deepTravVJson(vjson, function (obj) {
- if (!Array.isArray(obj)) {
- _$2.forOwn(obj, function (value, key) {
- if (key === 'id' || key === 'region' || key === 'layoutName'
- || key === 'text' || key === 'fieldLabel' || key === 'title'
- || key === 'layout' || key === 'xtype' || key === 'layoutNameDesc') {
- if (key === 'region'
- || (key === 'xtype' && !_$2.has(obj, 'region'))
- || (key === 'layout' && !_$2.has(obj, 'region') && !_$2.has(obj, 'xtype'))) {
- if (!_$2.has(obj, 'layoutName')) {
- obj.layoutName = obj.title || obj.text || obj.fieldLabel || obj[key];
- obj.layoutNameDesc = layoutOrXtypeNameMap[obj.layoutName] || obj.layoutName;
- // console.log(obj.layoutName, obj.layoutNameDesc)
- }
- }
- }
- else {
- if (key === 'items') {
- obj.children = obj[key];
- }
- if (key === 'tbar') {
- var t = obj[key];
- t.layoutName = key;
- t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
- // console.log(t.layoutName, t.layoutNameDesc)
- if (_$2.has(obj, "items")) {
- obj.items.splice(0, 0, t);
- }
- else if (_$2.has(obj, "children")) {
- obj.children.splice(0, 0, t);
- }
- else {
- obj.children = [t];
- }
- }
- if (key === 'fbar') {
- var t = obj[key];
- t.layoutName = key;
- t.layoutNameDesc = layoutOrXtypeNameMap[t.layoutName] || t.layoutName;
- // console.log(t.layoutName, t.layoutNameDesc)
- if (_$2.has(obj, "items")) {
- obj.items.push(t);
- }
- else if (_$2.has(obj, "children")) {
- obj.children.push(t);
- }
- else {
- obj.children = [t];
- }
- }
- delete obj[key];
- }
- });
- if (!obj.hasOwnProperty("children")) {
- obj.leaf = true;
- }
- if (!obj.hasOwnProperty("expanded")) {
- obj.expanded = true;
- }
- }
- });
- return vjson;
- }
- var Scope = /** @class */ (function () {
- function Scope(args) {
- /**
- * 业务模块的唯一编号
- */
- this.id = _$2.uniqueId('scope_');
- this.IS_DESIGN_MODE = false;
- /**
- * onload 运行完成之后才会设置本标记为 true
- */
- this.isLoadFinish = false;
- this._isLoading = false;
- var model = args.model, vjson = args.vjson, i18n = args.i18n;
- this.model = model;
- if (typeof vjson.layout === 'undefined') {
- // 没有定义布局的情况下,走 buildPlus 重新定义简写版布局
- var ret = buildPlus({ model: model, vjson: vjson });
- model = ret.model;
- vjson = ret.vjson;
- }
- this.originalVjson = _$2.cloneDeep(vjson);
- this.vjson = this.originalVjson; // this.buildVjson()
- var WMSTranslate = window["WMSTranslate"];
- if (WMSTranslate) {
- var i18nPath_1 = this.constructor.name;
- if (i18n) {
- WMSTranslate[i18nPath_1] = i18n;
- }
- this.vjson.i18nPath = i18nPath_1;
- deepTravVJson(this.vjson, function (obj) {
- if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout) || (!obj.xtype && !obj.header)) {
- return;
- }
- obj.i18nPath = i18nPath_1;
- });
- }
- var extScope = getScopeOnCreate();
- if (typeof extScope === 'function') {
- extScope({ vjson: vjson, model: model }, this);
- }
- }
- Scope.prototype._addWatch = function (tplExpress, fn) {
- if (!this._watchList) {
- this._watchList = [];
- }
- this._watchList.push({ watch: tplExpress, fn: fn });
- };
- Scope.prototype._applyWatchList = function () {
- var _this = this;
- _$2.forEach(this._watchList, function (item) {
- _this.viewModel.bind(item.watch, item.fn.bind(_this));
- });
- };
- Object.defineProperty(Scope.prototype, "isScope", {
- get: function () {
- return true;
- },
- enumerable: true,
- configurable: true
- });
- /**
- * 产生一个当前模块有效的唯一id
- * @param key 唯一编号
- */
- Scope.prototype.uid = function (key) {
- return this.id + key;
- };
- /**
- * 对话框"保存"成功.
- * 关闭对话框,并响应 success 方法
- * @param data 要傳回的數據(可以為空)
- */
- Scope.prototype.dialogSuccess = function (data) {
- this._handle.fireEvent('success', this, data);
- var sender = this._handle.config.animateTarget;
- var scope = lookupScope(sender);
- if (typeof this['success'] === 'function') {
- this['success'].call(scope, sender, data);
- }
- this.close();
- };
- /**
- * 设置等待状态
- * @param value
- * @param msg
- */
- Scope.prototype.setLoading = function (value) {
- var _a;
- var scope = this;
- this._isLoading = value;
- (_a = scope._handle) === null || _a === void 0 ? void 0 : _a.setLoading(value);
- };
- Scope.prototype.getLoading = function () {
- return this._isLoading;
- };
- /**
- * 以对话框模式打开当前模块
- * @param sender 发送者(按钮或Scope对象)
- * @param vjsonOption 界面覆盖选项(可以为空)
- * @param dataOption 数据覆盖选项(可以为空)
- */
- Scope.prototype.showDialog = function (sender, vjsonOption, dataOption) {
- var _a;
- var that = this;
- var vmodel = _$2.defaultsDeep({
- //
- }, dataOption, that.model);
- this.viewModel = new Ext.app.ViewModel(vmodel);
- this.viewModel.yvanScope = this;
- this._applyWatchList();
- this["scopeKey"] = "dialog-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
- var config = _$2.defaultsDeep({
- animateTarget: sender,
- viewModel: this.viewModel,
- yvanScope: this,
- referenceHolder: true,
- }, vjsonOption, that.vjson, windows);
- if (config.height === 'unset') {
- delete config.height;
- }
- if (config.width === 'unset') {
- delete config.width;
- }
- // const holder = sender?.lookupReferenceHolder()
- // delete config.constrain
- var topScope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
- if (topScope) {
- config.constrain = true;
- this.topScope = topScope;
- }
- var win = new Ext.Window(config);
- // if (holder) {
- // holder.add(win)
- // }
- if (topScope) {
- topScope._handle.add(win);
- }
- win.addListener('beforerender', function (sender) {
- // 记录句柄
- if (sender && !that._handle) {
- that._handle = sender;
- }
- });
- win.addListener('afterrender', function (sender) {
- // 调用onLoad回调
- try {
- that._onLoad();
- }
- catch (e) {
- console.error('errorAt onLoad', e);
- }
- window['cw'] = that;
- });
- win.addListener('destroy', this._destroy.bind(this));
- win.show();
- };
- /**
- * 以标签模式打开当前模块
- * @param vjsonOption 界面覆盖选项(可以为空)
- * @param dataOption 数据覆盖选项(可以为空)
- */
- Scope.prototype.showPage = function (vjsonOption, dataOption) {
- var _this = this;
- var that = this;
- this._vjsonOption = vjsonOption;
- this._dataOption = dataOption;
- var vmodel = _$2.defaultsDeep({
- data: {}
- }, dataOption, that.model);
- this.viewModel = new Ext.app.ViewModel(vmodel);
- this.viewModel.yvanScope = this;
- this._applyWatchList();
- this["scopeKey"] = "page-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
- // 根级不能设置id
- delete that.vjson.id;
- var config = _$2.defaultsDeep({
- viewModel: this.viewModel,
- yvanScope: this,
- referenceHolder: true,
- }, vjsonOption, that.vjson);
- var tt = Ext.getCmp('TT');
- var handle = tt.addScope(this, config, function (handle) {
- handle.addListener('added', function (sender) {
- // 记录句柄
- if (sender && !that._handle) {
- that._handle = sender;
- }
- });
- handle.addListener('afterrender', function (sender) {
- // 调用onLoad回调
- try {
- that._onLoad();
- }
- catch (e) {
- console.error('errorAt onLoad', e);
- }
- });
- handle.addListener('destroy', _this._destroy.bind(_this));
- });
- return handle;
- };
- /**
- * 直接渲染到元素
- * @param element 渲染目标
- * @param vjsonOption 界面覆盖选项(可以为空)
- * @param dataOption 数据覆盖选项(可以为空)
- */
- Scope.prototype.renderTo = function (element, vjsonOption, dataOption) {
- var that = this;
- this._vjsonOption = vjsonOption;
- this._dataOption = dataOption;
- var vmodel = _$2.defaultsDeep({
- data: {}
- }, that.model, dataOption);
- this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson) + JSON.stringify(vjsonOption));
- this.viewModel = new Ext.app.ViewModel(vmodel);
- this.viewModel.yvanScope = this;
- this._applyWatchList();
- var config = _$2.defaultsDeep({
- viewModel: this.viewModel,
- yvanScope: this,
- referenceHolder: true,
- renderTo: element,
- listeners: {
- afterrender: function (sender) {
- var _a;
- // 记录句柄
- if (sender && !that._handle) {
- that._handle = sender;
- }
- // 调用onLoad回调
- that._onLoad();
- // 如果vjson中配置了 afterrender ,需要恢复状态
- invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
- },
- },
- }, vjsonOption, that.vjson);
- new Ext.container.Viewport(config);
- };
- Scope.prototype.showDesigner = function (designer, option) {
- var that = this;
- var vmodel = _$2.defaultsDeep({
- data: {
- IS_DESIGN_MODE: true,
- }
- }, that.model);
- this.IS_DESIGN_MODE = true;
- this["scopeKey"] = "render-" + getVjsonHash(JSON.stringify(this.vjson));
- this.viewModel = new Ext.app.ViewModel(vmodel);
- this.viewModel.yvanScope = this;
- this._applyWatchList();
- var config = _$2.defaultsDeep({
- viewModel: this.viewModel,
- yvanScope: this,
- referenceHolder: true,
- listeners: {
- afterrender: function (sender) {
- var _a;
- // 记录句柄
- if (sender && !that._handle) {
- that._handle = sender;
- }
- // 调用onLoad回调
- that._onLoad();
- // 如果vjson中配置了 afterrender ,需要恢复状态
- invokeMethod((_a = that.vjson.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, that, arguments);
- },
- },
- }, that.vjson);
- designer.removeAll(true);
- designer.add(config);
- };
- /**
- * 关闭对话框(或标签页)
- */
- Scope.prototype.close = function () {
- this._handle.close();
- };
- Object.defineProperty(Scope.prototype, "data", {
- /**
- * 获取 viewModel 里包含的数据(只读)
- */
- get: function () {
- return this.viewModel.getData();
- },
- enumerable: true,
- configurable: true
- });
- /**
- * 设置 viewModel 中的数据
- * 可以是 key, value 模式
- * 也可以是 {key:value} 模式
- */
- Scope.prototype.set = function (path, value) {
- return this.viewModel.set(path, value);
- };
- /**
- * 寻找模块内所有的 xtype 对应的对象
- * @param xtypeKey
- */
- Scope.prototype.down = function (xtypeKey) {
- return this._handle.down(xtypeKey);
- };
- Object.defineProperty(Scope.prototype, "refs", {
- /**
- * 获取所有设置过 Reference 名称的组件
- */
- get: function () {
- var _a, _b;
- return (_b = (_a = this._handle) === null || _a === void 0 ? void 0 : _a.getReferences()) !== null && _b !== void 0 ? _b : {};
- },
- enumerable: true,
- configurable: true
- });
- Scope.prototype._destroy = function () {
- var that = this;
- that.onDestroy();
- delete that._watchList;
- delete that._handle;
- this.isLoadFinish = false;
- };
- /**
- * 私有渲染完成后的回调
- */
- Scope.prototype._onLoad = function () {
- var _this = this;
- if (exports.scopeOnLoad && typeof exports.scopeOnLoad === 'function') {
- exports.scopeOnLoad(this);
- }
- this.onLoad();
- _$2.defer(function () {
- _this.isLoadFinish = true;
- });
- };
- /**
- * 默认 渲染完成之后调用的函数
- */
- Scope.prototype.onLoad = function () {
- };
- /**
- * 组件卸载之后的回调
- */
- Scope.prototype.onDestroy = function () {
- };
- return Scope;
- }());
- /**
- * 观察装饰器,viewModel 属性更改时触发成员方法
- * @param tplExpress tpl表达式,例如 "{form.f1}"
- */
- function watch(tplExpress, deep) {
- if (deep === void 0) { deep = false; }
- return function (target, propertyKey, pd) {
- target._addWatch({ bindTo: tplExpress, deep: deep }, target[propertyKey]);
- return target[propertyKey];
- };
- }
- // 获取vjson的hash值
- function getVjsonHash(str) {
- var hash = 3465217896, i, ch;
- for (i = str.length - 1; i >= 0; i--) {
- ch = str.charCodeAt(i);
- hash ^= ((hash << 5) + ch + (hash >> 2));
- }
- return (hash & 0x7FFFFFFF) + "";
- }
- function buildPlus(_a) {
- var model = _a.model, vjson = _a.vjson;
- var vjsonNew = __assign(__assign({}, vjson), { layout: 'fit', referenceHolder: true, items: [
- {
- layout: 'border',
- // tbar: vjson.action,
- items: vjson.items,
- },
- ] });
- if (_$2.isArray(vjson.action)) {
- vjsonNew.items[0].tbar = vjson.action;
- }
- return { model: model, vjson: vjsonNew };
- }
- var model = {
- data: {
- leftTabTitle: ''
- }
- };
- var vjson = {
- frame: false,
- layout: 'border',
- width: '100%',
- height: '100%',
- border: false,
- defaults: {
- border: false
- },
- items: [
- {
- region: 'north',
- height: 60,
- cls: 'main-header',
- reference: 'mainTop',
- layout: 'hbox',
- items: [
- {
- html: '<div style="height:60px"><img src="/static/images/logo1.png" alt="" style="margin-top: 3px"></div>',
- flex: 1,
- border: false
- },
- {
- xtype: 'button', text: '配置工具', iconCls: 'fa fa-cogs', cls: 'header-menu', height: 60,
- menu: [
- {
- text: '通用数据设置', iconCls: 'x-fa fa-cog',
- reference: 'commonSetting'
- },
- {
- text: '录制测试脚本', iconCls: 'x-fa fa-check', reference: 'record_ready_api',
- listeners: {
- // click: 'scope.ready_api_click'
- }
- },
- ]
- },
- {
- xtype: 'button', tooltip: "开发者", iconCls: 'x-fa fa-user-circle', height: 60,
- cls: 'header-menu',
- menu: [
- { text: '退出登录', iconCls: 'x-fa fa-power-off', href: "/logout" },
- ]
- },
- ]
- },
- {
- region: 'west',
- bind: {
- title: '{leftTabTitle}',
- },
- titleAlign: 'center',
- border: true, split: true, width: 340, collapsible: true,
- reference: 'leftTab',
- xtype: 'tabpanel',
- tabPosition: 'left',
- tabRotation: 0,
- tabBar: {
- border: false
- },
- listeners: {
- tabchange: 'scope.leftTabChange',
- },
- items: [
- { tooltip: '首页', iconCls: 'x-fa fa-tachometer', xtype: "hometree" },
- { tooltip: '文件', iconCls: 'x-fa fa-file', xtype: 'filetree' },
- { tooltip: '数据模型', iconCls: 'x-fa fa-database', xtype: 'dbtree' },
- // {tooltip: '表单转换', iconCls: 'x-fa fa-exchange',},
- { tooltip: '查询报表', iconCls: 'x-fa fa-binoculars', xtype: 'reportGrid' },
- { tooltip: '字典', iconCls: 'x-fa fa-book', xtype: 'dicttree' },
- { tooltip: '仓库布局设计', iconCls: 'x-fa fa-building-o', xtype: "whlayout" },
- { tooltip: '检索窗口', iconCls: 'x-fa fa-search', xtype: 'widgetgrid' },
- { tooltip: '工作流', iconCls: 'x-fa fa-random', xtype: 'bpmntree' },
- { tooltip: '接口平台', iconCls: 'x-fa fa-plug', xtype: "apigrid" },
- { tooltip: '日志查询', iconCls: 'x-fa fa-hdd-o', xtype: "logstree" },
- { tooltip: '计划任务', iconCls: 'x-fa fa-calendar', xtype: "tasktree" },
- { tooltip: '工具窗口', iconCls: 'x-fa fa-suitcase', xtype: "toolbox" },
- { tooltip: '文档大纲', iconCls: 'x-fa fa-list', xtype: "viewoutlinetree" },
- { tooltip: 'DevOps', iconCls: 'x-fa fa-terminal', xtype: "devopsgrid" },
- { tooltip: '监控', iconCls: 'x-fa fa-bar-chart', xtype: "monitortree" },
- ]
- },
- {
- region: 'east',
- border: true, split: true, width: 340, collapsible: true, collapsed: true,
- title: '属性', iconCls: 'x-fa fa-newspaper-o', xtype: "propertydesign"
- },
- {
- region: 'center',
- split: true, border: true,
- xtype: 'maintab', reference: 'tt', id: 'TT',
- plain: true,
- listeners: {
- restorypage: 'scope.openScope',
- tabchange: 'scope.tabchange'
- },
- items: []
- },
- ],
- };
- /**
- * 获取当前打开的项目资料
- */
- function getCurrentProject() {
- // const value = sessionStorage.getItem('CurrentProject');
- // if (value) {
- // project = JSON.parse(value)
- // if (!project.url) {
- // project = undefined
- // }
- // }
- // return project
- return {
- uuid: '00000000',
- name: '本服项目',
- url: '',
- };
- }
- /**
- * 设置当前打开的项目资料(全局)
- */
- function setCurrentProject(value) {
- sessionStorage.setItem('CurrentProject', JSON.stringify(value));
- }
- // ------------------------------------------------------------------------------------------ types
- /** 订阅消息key类型 */
- var EventType;
- (function (EventType) {
- /** FileTree打开Module */
- EventType["ModuleOpen"] = "ModuleOpen";
- /** ModulePage 创建 */
- EventType["ModulePageCreate"] = "ModulePageCreate";
- /** ModuleItem内容变化 */
- EventType["ModuleItemChange"] = "ModuleItemChange";
- /** ModuleItem的 jsView 内容变化 */
- EventType["ModuleItemChangeViewJsChange"] = "ModuleItemChangeViewJsChange";
- /** 设置 vjson */
- EventType["SetVjson"] = "SetVjson";
- /** 更新 vjson */
- EventType["UpdateVjson"] = "UpdateVjson";
- /** 更新 组件vjson */
- EventType["UpdateComponentVjson"] = "UpdateComponentVjson";
- /** Component 选中内容变化 */
- EventType["ComponentSelectionChange"] = "ComponentSelectionChange";
- /** Component 选中内容变化 */
- EventType["ComponentContextmenu"] = "ComponentContextmenu";
- /** Component 删除事件 */
- EventType["ComponentDelete"] = "ComponentDelete";
- /** MainTab 选中改变事件 */
- EventType["MainTabChange"] = "MainTabChange";
- /** ModuleTab 选中改变事件 */
- EventType["ModuleTabChange"] = "ModuleTabChange";
- /** 保存事件 */
- EventType["SaveCall"] = "SaveCall";
- /** 撤销 */
- EventType["Undo"] = "Undo";
- /** 还原 */
- EventType["Redo"] = "Redo";
- /** 剪切 */
- EventType["Cut"] = "Cut";
- /** 复制 */
- EventType["Copy"] = "Copy";
- /** 粘贴 */
- EventType["Paste"] = "Paste";
- /** 全选 */
- EventType["SelectAll"] = "SelectAll";
- /** 读取剪切板 */
- EventType["ClipboardRead"] = "ClipboardRead";
- /** 检查模块更新 */
- EventType["RunCheckModule"] = "RunCheckModule";
- /** 停止检查模块更新 */
- EventType["StopCheckModule"] = "StopCheckModule";
- })(EventType || (EventType = {}));
- // ------------------------------------------------------------------------------------------ impls
- var EventBus = /** @class */ (function () {
- function EventBus() {
- /** 事件数据 */
- this.store = {};
- /** 事件订阅者注册表 */
- this.observeStoreTable = {};
- this.init();
- }
- EventBus.prototype.init = function () {
- var _this = this;
- // 更改store值就会自动publish消息 - 实现
- this.store = new Proxy({}, {
- get: function (target, key) {
- return target[key];
- },
- // 代理object赋值操作,设置值的时候,触发订阅时的回调函数
- set: function (target, key, data) {
- if (noValue(key))
- return false;
- target[key] = data;
- // 消息通知订阅者
- var observerArr = _this.observeStoreTable[key];
- if (noValue(observerArr) || observerArr.length <= 0)
- return true;
- observerArr.forEach(function (handler) {
- //try {
- handler(data, key);
- // } catch (err) {
- // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
- // }
- });
- return true;
- },
- });
- };
- /** 取消注册订阅者 */
- EventBus.prototype.unregisterObserver = function (key, handler) {
- var _this = this;
- var observerArr = this.observeStoreTable[key];
- if (noValue(observerArr) || observerArr.length <= 0)
- return;
- if (noValue(handler)) {
- this.observeStoreTable[key] = [];
- }
- else {
- observerArr.forEach(function (obsHandler, index) {
- if (obsHandler !== handler)
- return;
- _this.observeStoreTable[key].splice(index, 1);
- });
- }
- };
- /** 注册订阅者 */
- EventBus.prototype.registerObserver = function (key, handler) {
- var observerArr = this.observeStoreTable[key];
- if (noValue(observerArr) || observerArr.length <= 0) {
- observerArr = [];
- this.observeStoreTable[key] = observerArr;
- }
- observerArr.push(handler);
- // if (noValue(key)) return;
- // const sourceValue = this.store[key];
- // if (noValue(sourceValue)) return;
- // handler(sourceValue, key);
- };
- /** 获取存储对象,修改这个对象属性即可publish消息 */
- EventBus.prototype.getStore = function () {
- return this.store;
- };
- /**
- * 取消订阅
- * @param key 订阅的消息key
- * @param handler 指定取消的监听函数
- */
- EventBus.prototype.unsubscribe = function (key, handler) {
- var _this = this;
- if (key instanceof Array) {
- key.forEach(function (k) { return _this.unregisterObserver(k, handler); });
- }
- else {
- this.unregisterObserver(key, handler);
- }
- };
- /**
- * 消息订阅
- * @param key 订阅的消息key
- * @param handler 监听函数
- */
- EventBus.prototype.subscribe = function (key, handler) {
- var _this = this;
- var cancelSubscribe = {
- key: key,
- cancel: function () {
- },
- };
- if (key instanceof Array) {
- key.forEach(function (k) { return _this.registerObserver(k, handler); });
- cancelSubscribe.cancel = function () { return key.forEach(function (k) { return _this.unsubscribe(k, handler); }); };
- }
- else {
- this.registerObserver(key, handler);
- cancelSubscribe.cancel = function () { return _this.unsubscribe(key, handler); };
- }
- return cancelSubscribe;
- };
- /**
- * 消息订阅(只订阅一次)
- * @param key 订阅的消息key
- * @param handler 监听函数
- */
- EventBus.prototype.subscribeOnce = function (key, handler) {
- var cancelSubscribe = this.subscribe(key, function (data) {
- // try {
- handler(data, key);
- // } catch (err) {
- // console.error("消息通知函数执行失败,EventType=", key, " | EventData=", data, " | handler=", handler);
- // }
- cancelSubscribe.cancel();
- });
- };
- /**
- * 发送消息(触发订阅监听函数)
- * @param key 消息key
- * @param eventData 消息值
- */
- EventBus.prototype.publish = function (key, eventData) {
- var _this = this;
- if (key instanceof Array) {
- key.forEach(function (k) { return _this.store[k] = eventData; });
- }
- else {
- this.store[key] = eventData;
- }
- };
- return EventBus;
- }());
- // ------------------------------------------------------------------------------------------ use
- var eventBus = new EventBus();
- var model$1 = {
- data: {
- dataSync_isStart: false,
- dataSync: {
- skipError: false,
- clearData: false,
- tables: []
- },
- dataSyncResult: {
- jobId: ''
- },
- dataSource1: '',
- dataSource2: '',
- schema1: '',
- schema2: '',
- hasDiff: false,
- }
- };
- var vjson$1 = {
- title: '数据库同步',
- layout: 'fit',
- items: [
- {
- reference: 'wizard1',
- layout: 'card',
- items: [
- {
- reference: 'first',
- layout: 'fit',
- bbar: [
- '->',
- {
- xtype: 'button',
- iconCls: 'x-fa fa-road',
- text: '结构同步 »',
- bind: {
- disabled: '{!hasDiff}'
- },
- listeners: {
- click: 'scope.structCopyTo',
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-files-o',
- text: '数据同步 »',
- bind: {
- disabled: '{!hasDiff}'
- },
- listeners: {
- click: 'scope.dataCopyTo',
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-sort-alpha-desc',
- text: '索引同步 »',
- bind: {
- disabled: '{!hasDiff}'
- },
- listeners: {
- click: 'scope.indexCopyTo',
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-product-hunt',
- text: '存储过程同步 »',
- bind: {
- disabled: '{!hasDiff}'
- },
- listeners: {
- click: 'scope.procedureCopyTo',
- }
- },
- ],
- items: [
- {
- title: '数据库对比',
- reference: 'grid1',
- xtype: 'yvgrid',
- pagination: false,
- border: false,
- cellTip: true,
- selModel: {
- type: 'checkboxmodel',
- mode: 'MULTI',
- },
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'combo',
- fieldLabel: '源数据库',
- bind: {
- value: '{dataSource1}'
- },
- dataSource: 'scope.getDataBaseName'
- },
- {
- xtype: 'combo',
- fieldLabel: '目标数据库',
- bind: {
- value: '{dataSource2}'
- },
- dataSource: 'scope.getDataBaseName'
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-flash',
- text: '对比',
- bind: {
- disabled: '{!dataSource1 || !dataSource2}'
- },
- listeners: {
- click: 'scope.diff',
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-cloud-download',
- text: '重新拉取结构(耗时!)',
- bind: {
- disabled: '{!dataSource1 || !dataSource2}'
- },
- listeners: {
- click: 'scope.dbToMeta',
- }
- },
- ]
- },
- columns: [
- {
- dataIndex: 'table_name1',
- header: '源表',
- width: 300,
- },
- {
- dataIndex: 'table_name2',
- header: '目标表',
- width: 300,
- },
- {
- dataIndex: 'diff',
- header: '对比结果',
- width: 100,
- },
- {
- xtype: 'actioncolumn',
- width: 30,
- sortable: false,
- menuDisabled: true,
- items: [
- {
- iconCls: 'x-fa fa-bars',
- text: '打开',
- handler: 'scope.showDetail',
- }
- ]
- },
- {
- dataIndex: 'remark',
- header: '详情',
- width: 200,
- sortable: true,
- },
- ],
- },
- ]
- },
- {
- reference: 'ddl',
- layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch'
- },
- items: [
- {
- xtype: 'sqleditor',
- reference: 'ddleditor',
- flex: 1,
- },
- {
- xtype: 'toolbar',
- items: [
- '->',
- {
- xtype: 'button',
- text: '« 上一步',
- listeners: {
- click: 'scope.back'
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-flash',
- text: '执行',
- listeners: {
- click: 'scope.executeDDL'
- }
- },
- ]
- }
- ]
- },
- {
- reference: 'ddl_idx',
- layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch'
- },
- items: [
- {
- xtype: 'sqleditor',
- reference: 'ddleditor_idx',
- flex: 1,
- },
- {
- xtype: 'toolbar',
- items: [
- '->',
- {
- xtype: 'button',
- text: '« 上一步',
- listeners: {
- click: 'scope.back'
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-flash',
- text: '执行',
- listeners: {
- click: 'scope.executeDDLIdx'
- }
- },
- ]
- }
- ]
- },
- {
- reference: 'ddl_procedure',
- layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch'
- },
- items: [
- {
- xtype: 'sqleditor',
- reference: 'ddleditor_procedure',
- flex: 1,
- },
- {
- xtype: 'toolbar',
- items: [
- '->',
- {
- xtype: 'button',
- text: '« 上一步',
- listeners: {
- click: 'scope.back'
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-flash',
- text: '执行',
- listeners: {
- click: 'scope.executeProcedureSQL'
- }
- },
- ]
- }
- ]
- },
- {
- reference: 'datacopy',
- xtype: 'yvgrid',
- pagination: false,
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'checkbox',
- fieldLabel: '忽略错误',
- bind: {
- value: '{dataSync.skipError}'
- },
- },
- {
- xtype: 'checkbox',
- fieldLabel: '清空数据',
- bind: {
- value: '{dataSync.clearData}'
- },
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-play-circle',
- text: '开始',
- bind: {
- disabled: '{dataSync_isStart}'
- },
- listeners: { click: 'scope.dataSync_start' }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-stop-circle',
- text: '停止',
- bind: {
- disabled: '{!dataSync_isStart}'
- },
- listeners: { click: 'scope.dataSync_stop' }
- },
- ]
- },
- columns: [
- {
- dataIndex: 'tableName', header: '表名',
- width: 300,
- },
- {
- dataIndex: 'dataCount', header: '总记录数',
- width: 150,
- },
- {
- dataIndex: 'currentIdx', header: '当前记录数',
- width: 150,
- },
- {
- dataIndex: 'syncCount', header: '同步数',
- width: 150,
- },
- {
- dataIndex: 'deleteCount', header: '删除',
- width: 150,
- },
- {
- dataIndex: 'syncProgress', header: '进度',
- width: 150, dataType: 'int', formatter: 'percentRenderer'
- },
- ]
- }
- ]
- }
- ]
- };
- var GLOBAL_NAMESPACE_PREFIX = 'com/galaxis/wms';
- function createEmptyModule(path, filename) {
- return request.post(getBaseUrl() + "@createModule", { args: [{ path: path, filename: filename }] });
- }
- function createFolder(parentPath, filename) {
- return request.post(getBaseUrl() + "@createFolder", { args: [{ parentPath: parentPath, filename: filename }] });
- }
- function getModuleFileContent(module) {
- return request.post(getBaseUrl() + "@getModuleFileContent", { args: [module] });
- }
- function saveFile(fileFullPath, fileContent) {
- return request.post(getBaseUrl() + "@saveFile", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
- // @ts-ignore
- system.msg("保存成功");
- return res;
- });
- }
- function getQueryDslInfo(tableName) {
- return request.post(getBaseUrl() + "@getQueryDslInfo", {
- args: [
- { tableName: tableName }
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getQueryDslInfo ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function invokeServer(url, param) {
- url = getCurrentProject().url + "/api/com/galaxis/wms" + url;
- return request.post(url, {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'invokeServer ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function parseSqlApi(sql) {
- return request.post(getBaseUrl() + "@parseSqlApi", {
- args: [sql]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseSqlApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function saveModuleFiles(param) {
- return request.post(getBaseUrl() + "@saveModuleFiles", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveModuleFiles ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function createQueryDSLFile(_a) {
- var schema_name = _a.schema_name, table_name = _a.table_name;
- return request.post(getBaseUrl() + "@createQueryDSLFile", {
- args: [{ schema_name: schema_name, table_name: table_name }]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createQueryDSLFile ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function dbToMeta(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@dbToMeta", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dbToMeta ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function getColumnDomainApi(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@getColumnDomain", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getColumnDomainApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function getMateData(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@getMateData", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateData ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function getMateDataByTableName(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@getMateDataByTableName", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMateDataByTableName ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function saveMetaTableChanges(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@saveMetaTableChanges", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaTableChanges ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function getModifyTableDDL(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@getModifyTableDDL", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyTableDDL ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function pushToDbCommitApi(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@pushToDbCommit", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'pushToDbCommitApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- /**
- * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
- */
- function saveMetaExBuildDDL(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@saveMetaExBuildDDL", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveMetaExBuildDDL ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function registerResource(params) {
- return request.post(getBaseUrl() + "@registerResource", {
- args: [params]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'registerResource ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function getMenuTree(params) {
- return request.post(getBaseUrl() + "@getMenuTree", {
- args: [params]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function moduleTree() {
- return request.post(getBaseUrl() + "@moduleTree")
- .catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getMenuTree ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function dropTableDDL(schemaName, tableName) {
- return request.post(getBaseUrl() + "@dropTableDDL", {
- args: [
- { schemaName: schemaName, tableName: tableName },
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dropTableDDL ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function renameTableDDL(schemaName, tableName, reTableName) {
- return request.post(getBaseUrl() + "@renameTableDDL", {
- args: [{ schemaName: schemaName, tableName: tableName, reTableName: reTableName }]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'renameTableDDL ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function executeModifyProcedureSQL(param) {
- return request.post(getBaseUrl() + "@executeModifyProcedureSQL", {
- args: [
- param,
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function parseDynamicSqlApi(sql, dataSource) {
- return request.post(getBaseUrl() + "@parseDynamicSql", {
- args: [
- { sql: sql, dataSource: dataSource },
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'parseDynamicSqlApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function exporerList() {
- return request.post(getBaseUrl() + "@exporerList", {
- args: [{}]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function reportListApi() {
- return request.post(getBaseUrl() + "@reportList", {
- args: []
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportList ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function reportByIdApi(reportId) {
- return request.post(getBaseUrl() + "@reportById", {
- args: [
- { reportId: reportId },
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'reportById ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function createReportApi(reportName) {
- return request.post(getBaseUrl() + "@createReport", {
- args: [
- { reportName: reportName },
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createReport ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function saveReportApi(param) {
- return request.post(getBaseUrl() + "@saveReport", {
- args: [
- param,
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveReport ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function delReportApi(report_id) {
- return request.post(getBaseUrl() + "@delReport", {
- args: [{ report_id: report_id },]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'delReport ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function getDict(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@getDict", {
- args: [
- param
- ]
- });
- }
- function saveDictApi(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@saveDict", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function saveDictItemsApi(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getCurrentProject().url + "/api/com/galaxis/wms/sys/dict/Dict@saveItems", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveDictItemsApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function createDictEnum(param) {
- return request.post(getBaseUrl() + "@createDictEnum", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createDictEnum ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function loadSqlContentApi(url) {
- return request.post(getBaseUrl() + "@loadSqlContent", {
- args: [
- {
- url: GLOBAL_NAMESPACE_PREFIX + url,
- }
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadSqlContentApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function saveSqlContentApi(url, content) {
- return request.post(getBaseUrl() + "@saveSqlContent", {
- args: [
- {
- url: GLOBAL_NAMESPACE_PREFIX + url,
- content: content,
- }
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveSqlContentApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function readBpmn(param) {
- return request.post(getBaseUrl() + "@readBpmn", {
- args: [param]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function createBpmn(path, filename) {
- return request.post(getBaseUrl() + "@createBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'createBpmn ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function saveBpmn(fileFullPath, fileContent) {
- return request.post(getBaseUrl() + "@saveBpmn", { args: [{ fileFullPath: fileFullPath, fileContent: fileContent }] }).then(function (res) {
- // @ts-ignore
- system.msg("保存成功");
- return res;
- });
- }
- function deleteBpmn(path, filename) {
- return request.post(getBaseUrl() + "@deleteBpmn", { args: [{ path: path, filename: filename }] }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteBpmn ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function createDevForm(param) {
- return request.post(getBaseUrl() + "@createDevForm", {
- args: [param]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function readDevForm(param) {
- return request.post(getBaseUrl() + "@readDevForm", {
- args: [param]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'exporerList ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function calcColumnForm(param) {
- return request.post(getBaseUrl() + "@calcColumnForm", {
- args: [param]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'calcColumnForm ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function widgetListApi(param) {
- return request.post(getBaseUrl() + "@widgetListApi", {
- args: [param]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'widgetListApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function readWidget(param) {
- return request.post(getBaseUrl() + "@readWidget", {
- args: [param]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function saveWidget(param) {
- return request.post(getBaseUrl() + "@saveWidget", {
- args: [param]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWidget ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function deleteWidget(param) {
- return request.post(getBaseUrl() + "@deleteWidget", {
- args: [param]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWidget ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function getDataBaseNameApi() {
- return request.post(getBaseUrl() + "@getDataBaseName", {
- args: []
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'readWidget ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function getDiffDDLApi(param) {
- return request.post(getBaseUrl() + "@getDiffDDL", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getDiffDDLApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function dataSyncApi(param) {
- return request.post(getBaseUrl() + "@dataSync", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function dataSyncInfoApi(param) {
- return request.post(getBaseUrl() + "@dataSyncInfo", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'dataSyncInfoApi ERROR!';
- showErrorDialog(msg);
- console.error(msg, e);
- });
- }
- function saveColumnDomain(param) {
- if (typeof param === 'undefined') {
- param = { datasource: 'master' };
- }
- else if (typeof param.datasource === 'undefined') {
- param.datasource = 'master';
- }
- return request.post(getBaseUrl() + "@saveColumnDomain", {
- args: [
- param
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveColumnDomain ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function devOpsList() {
- return request.post(getBaseUrl() + "@devOpsList", {
- args: [{}]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsList ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function devOpsById(opsId) {
- return request.post(getBaseUrl() + "@devOpsById", {
- args: [{ opsId: opsId }]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'devOpsById ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function metricsRequestApi() {
- return request.get("/api/metrics/request")
- .catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsRequestApi ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function metricsJdbcApi() {
- return request.get("/api/metrics/jdbc")
- .catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'metricsJdbcApi ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function executeDDL(param) {
- return request.post(getBaseUrl() + "@executeDDL", {
- args: [
- param,
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'executeDDL ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function getModifyIdxDDL(param) {
- return request.post(getBaseUrl() + "@getModifyIdxDDL", {
- args: [
- param,
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyIdxDDL ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function getModifyProcedureSQL(param) {
- return request.post(getBaseUrl() + "@getModifyProcedureSQL", {
- args: [
- param,
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'getModifyProcedureSQL ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function saveWhLayout(param) {
- return request.post(getLayoutUrl() + "@saveWhLayout", {
- args: [
- param,
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'saveWhLayout ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function deleteWhLayout(param) {
- return request.post(getLayoutUrl() + "@deleteWhLayout", {
- args: [
- param,
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'deleteWhLayout ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function loadWhLayoutAll() {
- return request.post(getLayoutUrl() + "@loadWhLayoutAll", {
- args: []
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayoutAll ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- function loadWhLayout(param) {
- return request.post(getLayoutUrl() + "@loadWhLayout", {
- args: [
- param,
- ]
- }).catch(function (e) {
- var _a, _b;
- var msg = ((_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg) || 'loadWhLayout ERROR!';
- showErrorDialog('发生错误:' + msg);
- console.error(msg, e);
- });
- }
- var baseUrl = "/api/com/yvan/studio/FileManager";
- var layoutUrl = "/api/com/yvan/studio/LayoutManager";
- function getBaseUrl() {
- // return getCurrentProject().url + baseUrl
- return baseUrl;
- }
- function getLayoutUrl() {
- // return getCurrentProject().url + baseUrl
- return layoutUrl;
- }
- var Request = /** @class */ (function () {
- function Request(axiosInstance) {
- this.axiosInstance = axiosInstance;
- }
- // 全局响应数据转换处理
- Request.transformResponse = function (response) {
- var _a;
- return (_a = response.data) !== null && _a !== void 0 ? _a : null;
- };
- Request.prototype.get = function (url, config) {
- return this.axiosInstance.get(url, config).then(function (response) { return Request.transformResponse(response); });
- };
- Request.prototype.delete = function (url, config) {
- return this.axiosInstance.delete(url, config).then(function (response) { return Request.transformResponse(response); });
- };
- Request.prototype.head = function (url, config) {
- return this.axiosInstance.head(url, config).then(function (response) { return Request.transformResponse(response); });
- };
- Request.prototype.options = function (url, config) {
- return this.axiosInstance.options(url, config).then(function (response) { return Request.transformResponse(response); });
- };
- Request.prototype.post = function (url, data, config) {
- return this.axiosInstance.post(url, data, config).then(function (response) { return Request.transformResponse(response); });
- };
- Request.prototype.put = function (url, data, config) {
- return this.axiosInstance.put(url, data, config).then(function (response) { return Request.transformResponse(response); });
- };
- Request.prototype.patch = function (url, data, config) {
- return this.axiosInstance.patch(url, data, config).then(function (response) { return Request.transformResponse(response); });
- };
- Request.prototype.request = function (config) {
- return this.axiosInstance.request(config).then(function (response) { return Request.transformResponse(response); });
- };
- return Request;
- }());
- /** 创建一个axios实例对象 */
- function axiosCreate(config) {
- return window['axios'].default.create(__assign({ validateStatus: function () { return true; } }, config));
- }
- var axiosInstance;
- function init() {
- axiosInstance = axiosCreate({
- validateStatus: function (status) { return (status >= 200 && status < 400); },
- });
- request = new Request(axiosInstance);
- }
- var request;
- /**
- * 对比两个列 是否存在不一致
- */
- function compareColumn(t1, c1, t2, c2) {
- if (typeof c2 === 'undefined') {
- return 'column_name';
- }
- if (c1.column_name !== c2.column_name) {
- return 'column_name';
- }
- if (toString(c1.default_value).trim() !== toString(c2.default_value).trim()) {
- return 'default_value';
- }
- if (toString(c1.column_comment) !== toString(c2.column_comment)) {
- return 'column_comment';
- }
- if (c1.is_primary_key !== c2.is_primary_key) {
- return 'is_primary_key';
- }
- if (c1.not_null !== c2.not_null) {
- return 'not_null';
- }
- var symbol1 = getDataTypeSymbol(t1, c1);
- var symbol2 = getDataTypeSymbol(t2, c2);
- if (symbol1 !== symbol2) {
- console.log(t1.table_name + "." + c1.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
- return 'data_type';
- }
- if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
- else if (!_$2.includes(['char', 'varchar'], symbol1)) {
- // 只关注长度
- if (c1.column_size != c2.column_size) {
- return 'column_size';
- }
- }
- else {
- // 其他情况,长度和精度都要关注
- if (c1.column_size != c2.column_size) {
- return 'column_size';
- }
- if (c1.decimal_digits !== c2.decimal_digits) {
- return 'decimal_digits';
- }
- }
- }
- function compareDomainApply(tableInfo, column, domain, is_fix_size) {
- var symbol1 = getDataTypeSymbol(tableInfo, column);
- var symbol2 = getDataTypeSymbol(tableInfo, domain);
- if (symbol1 !== symbol2) {
- console.log(tableInfo.table_name + "." + column.column_name + ".dataType \u4E0D\u76F8\u7B49 [" + symbol1 + "," + symbol2 + "]");
- return 'data_type';
- }
- if (is_fix_size) {
- // 字段域吧大小限制住了
- if (_$2.includes(['integer', 'long', 'timestamp', 'clob', 'blob'], symbol1)) ;
- else if (_$2.includes(['char', 'varchar'], symbol1)) {
- // 只关注长度
- if (column.column_size != domain.column_size) {
- return 'column_size';
- }
- }
- else {
- // 其他情况,长度和精度都要关注
- if (column.column_size != domain.column_size) {
- return 'column_size';
- }
- if (column.decimal_digits !== domain.decimal_digits) {
- return 'decimal_digits';
- }
- }
- }
- }
- function checkColumn(table, col) {
- if (isEmpty(col.column_name)) {
- return "\u5B57\u6BB5\u540D\u4E0D\u80FD\u4E3A\u7A7A";
- }
- if (isKeyword(col.column_name)) {
- return "\"" + col.column_name + "\" \u662F\u5173\u952E\u5B57, \u4E0D\u80FD\u4F7F\u7528!";
- }
- if (!/^[a-zA-Z\_][a-zA-Z0-9\_]*$/.test(col.column_name)) {
- return "\u5B57\u6BB5\u540D\u975E\u6CD5";
- }
- return undefined;
- }
- function applyDomain(dbType, domain) {
- var editRow = {
- data_type: domain[dbType + '_datatype'],
- };
- domain = _$2.cloneDeep(domain);
- if (!editRow.data_type) {
- throw Error('字段域没有定义数据类型!');
- }
- // NUMBER(19) => data_type:NUMBER, column_size:19, decimal_digits:0
- var match = editRow.data_type.match(/^(.+)\((\d+)\)$/);
- if (match) {
- // 类型里面包含括号
- var sz = parseInt(match[2]);
- if (isNaN(sz)) {
- throw Error('字段域的定义错误:' + editRow.data_type);
- }
- domain.is_fix_size = true;
- editRow.data_type = match[1];
- domain.column_size = sz;
- domain.decimal_digits = 0;
- }
- else {
- // NUMBER(20,8) => data_type:NUMBER, column_size:20, decimal_digits:8
- var match2 = editRow.data_type.match(/^(.+)\((\d+)\,(\d+)\)$/);
- if (match2) {
- // 类型里面包含括号
- var sz = parseInt(match2[2]);
- if (isNaN(sz)) {
- throw Error('字段域的定义错误:' + editRow.data_type);
- }
- var dg = parseInt(match2[3]);
- if (isNaN(dg)) {
- throw Error('字段域的定义错误:' + editRow.data_type);
- }
- domain.is_fix_size = true;
- editRow.data_type = match[1];
- domain.column_size = sz;
- domain.decimal_digits = dg;
- }
- }
- if (domain.domain_column_ui) {
- _$2.extend(editRow, {
- column_ui: domain.domain_column_ui,
- });
- }
- if (domain.domain_column_dict) {
- _$2.extend(editRow, {
- column_dict: domain.domain_column_dict,
- });
- }
- if (domain.is_fix_size) {
- _$2.extend(editRow, {
- column_size: domain.column_size,
- decimal_digits: domain.decimal_digits
- });
- }
- if (domain.is_fix_default_value) {
- _$2.extend(editRow, {
- default_value: domain.default_value,
- });
- }
- return editRow;
- }
- /**
- * 获取字段类型代号(用于做跨数据库数据类型对比)
- */
- function getDataTypeSymbol(table, col) {
- if (table.db_type === 'oracle') {
- switch (col.data_type) {
- case 'number':
- if (col.column_size <= 10 && !col.decimal_digits) {
- return 'integer';
- }
- else if (col.column_size <= 19 && !col.decimal_digits) {
- return 'long';
- }
- return 'bigdecimal';
- case 'char':
- if (col.column_size > 3000) {
- return 'clob';
- }
- return 'char';
- case 'integer':
- return 'integer';
- case 'varchar':
- case 'varchar2':
- if (col.column_size > 3000) {
- return 'clob';
- }
- return 'varchar';
- case 'clob':
- return 'clob';
- case 'blob':
- return 'blob';
- case 'date':
- case 'timestamp':
- case 'timestamp(6)':
- case 'timestamp with local time zone':
- case 'timestamp(6) with local time zone':
- case 'timestamp(6) with time zone':
- return 'timestamp';
- }
- return "undefined";
- // throw Error('未知 Oracle 数据类型:' + col.data_type)
- }
- if (table.db_type === 'pgsql') {
- switch (col.data_type) {
- case 'int4':
- return 'integer';
- case 'int8':
- return 'long';
- case 'char':
- return 'char';
- case 'varchar':
- case 'varchar2':
- if (col.column_size > 3000) {
- return 'clob';
- }
- return 'varchar';
- case 'numeric':
- if (col.column_size <= 10 && !col.decimal_digits) {
- return 'integer';
- }
- else if (col.column_size <= 19 && !col.decimal_digits) {
- return 'long';
- }
- return 'bigdecimal';
- case 'timestamp':
- case 'timestamptz':
- return 'timestamp';
- case 'bytea':
- return 'blob';
- }
- return "undefined";
- // throw Error('未知 PostgreSQL 数据类型:' + col.data_type)
- }
- throw Error('未知数据库类型:' + table.db_type);
- }
- /**
- * 判断对象名称是不是数据库关键字(保留字)
- */
- function isKeyword(word) {
- if (!word || typeof word !== 'string') {
- return false;
- }
- var kk = ['access',
- 'add',
- 'all',
- 'alter',
- 'and',
- 'any',
- 'as',
- 'asc',
- 'audit',
- 'between',
- 'by',
- 'char',
- 'check',
- 'cluster',
- 'column',
- 'comment',
- 'compress',
- 'connect',
- 'create',
- 'current',
- 'date',
- 'decimal',
- 'default',
- 'delete',
- 'desc',
- 'distinct',
- 'drop',
- 'else',
- 'exclusive',
- 'exists',
- 'file',
- 'float',
- 'for',
- 'from',
- 'grant',
- 'group',
- 'having',
- 'identified',
- 'immediate',
- 'in',
- 'increment',
- 'index',
- 'initial',
- 'insert',
- 'integer',
- 'intersect',
- 'into',
- 'is',
- 'level',
- 'like',
- 'lock',
- 'long',
- 'maxextents',
- 'minus',
- 'mlslabel',
- 'mode',
- 'modify',
- 'noaudit',
- 'nocompress',
- 'not',
- 'nowait',
- 'null',
- 'number',
- 'of',
- 'offline',
- 'on',
- 'online',
- 'option',
- 'or',
- 'order',
- 'p',
- 'ctfree',
- 'prior',
- 'privileges',
- 'public',
- 'raw',
- 'rename',
- 'resource',
- 'revoke',
- 'row',
- 'rowid',
- 'rownum',
- 'rows',
- 'select',
- 'session',
- 'set',
- 'share',
- 'size',
- 'smallint',
- 'start',
- 'successful',
- 'synonym',
- 'sysdate',
- 'table',
- 'then',
- 'to',
- 'trigger',
- 'uid',
- 'union',
- 'unique',
- 'update',
- 'user',
- 'validate',
- 'values',
- 'varchar',
- 'varchar2',
- 'view',
- 'whenever',
- 'where',
- 'with'];
- return _$2.includes(kk, word.toLowerCase());
- }
- var DbSync = /** @class */ (function (_super) {
- __extends(DbSync, _super);
- function DbSync() {
- return _super.call(this, { model: model$1, vjson: vjson$1 }) || this;
- }
- DbSync.prototype.onLoad = function () {
- };
- DbSync.prototype.getDataBaseName = function (sender, _a) {
- var successCallback = _a.successCallback, failCallback = _a.failCallback;
- getDataBaseNameApi().then(function (res) {
- successCallback(res.data.map(function (name) {
- return {
- id: name, text: name
- };
- }));
- });
- };
- DbSync.prototype.showDetail = function (sender, row, col, btn, event, record) {
- showInfoDialog(record.get('remark'));
- };
- DbSync.prototype.diff = function () {
- var _this = this;
- var promise1 = getMateData({
- datasource: this.viewModel.get('dataSource1')
- });
- var promise2 = getMateData({
- datasource: this.viewModel.get('dataSource2')
- });
- this.viewModel.set('schema1', '');
- this.viewModel.set('schema2', '');
- this.refs.grid1.setLoading(true);
- Promise.all([promise1, promise2]).then(function (_a) {
- var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
- var rows = [];
- if (_$2.size(res1) > 0) {
- // res1 起码有一个 schema
- _this.viewModel.set('schema1', res1[0].schema_name);
- _this.viewModel.set('schema2', res2[0].schema_name);
- if (!_this.viewModel.get('schema1')) {
- msg$1('datasource1 最起码需要一张表');
- return;
- }
- if (!_this.viewModel.get('schema2')) {
- msg$1('datasource2 最起码需要一张表');
- return;
- }
- _$2.forEach(res1[0].table_list, function (table1) {
- var _a;
- 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; });
- if (table1.schema_name) {
- _this.viewModel.set('schema1', table1.schema_name);
- }
- if (table2 === null || table2 === void 0 ? void 0 : table2.schema_name) {
- _this.viewModel.set('schema2', table2 === null || table2 === void 0 ? void 0 : table2.schema_name);
- }
- var row = {
- table_name1: table1.table_name,
- table_name2: table2 === null || table2 === void 0 ? void 0 : table2.table_name,
- table_info: table1
- };
- if (!table2) {
- row.diff = '不一致';
- row.remark = '目标表缺失';
- }
- else if (table1.column_list.length !== table2.column_list.length) {
- row.diff = '不一致';
- row.remark = "\u5B57\u6BB5\u6570\u91CF\u4E0D\u4E00\u6837 source=" + table1.column_list.length + " target=" + table2.column_list.length;
- }
- else {
- row.diff = '一致';
- var remark_1 = [];
- _$2.forEach(table1.column_list, function (col1) {
- var col2 = _$2.find(table2.column_list, function (c) { return c.column_name === col1.column_name; });
- if (!col2) {
- row.diff = '不一致';
- remark_1.push("\u5B57\u6BB5\u7F3A\u5931[" + col1.column_name + "]");
- }
- else {
- var colDiff = compareColumn(table1, col1, table2, col2);
- if (colDiff) {
- row.diff = '不一致';
- remark_1.push(col1.column_name + "." + colDiff + "=[" + col1[colDiff] + "," + col2[colDiff] + "]");
- }
- }
- });
- row.remark = remark_1.join('\n');
- }
- rows.push(row);
- });
- }
- _this.refs.grid1.setData(rows);
- _this.viewModel.set('hasDiff', true);
- }).finally(function () {
- _this.refs.grid1.setLoading(false);
- });
- };
- DbSync.prototype.structCopyTo = function () {
- var _this = this;
- if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
- msg$1('选择数据源!');
- return;
- }
- var recordList = this.refs.grid1.getSelection();
- var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
- if (_$2.size(tableNameList) <= 0) {
- msg$1('请选择要同步的表');
- return;
- }
- var error = undefined;
- _$2.forEach(tableNameList, function (tableInfo) {
- _$2.forEach(tableInfo.column_list, function (col) {
- error = checkColumn(tableInfo, col);
- return false;
- });
- if (error) {
- return false;
- }
- });
- if (error) {
- msg$1(error);
- return;
- }
- var schema1 = this.viewModel.get('schema1');
- var schema2 = this.viewModel.get('schema2');
- if (!schema1 || !schema2) {
- msg$1('无法识别 schema 名称');
- return;
- }
- this.refs.grid1.setLoading(true);
- getDiffDDLApi({
- datasource1: this.viewModel.get('dataSource1'),
- datasource2: this.viewModel.get('dataSource2'),
- schema1: this.viewModel.get('schema1'),
- schema2: this.viewModel.get('schema2'),
- tables: tableNameList,
- }).then(function (res) {
- if (res.success) {
- _this.refs.ddleditor.setCode(res.data);
- _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl);
- }
- }).finally(function () {
- _this.refs.grid1.setLoading(false);
- });
- };
- DbSync.prototype.indexCopyTo = function () {
- var _this = this;
- if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
- msg$1('选择数据源!');
- return;
- }
- var recordList = this.refs.grid1.getSelection();
- var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
- if (_$2.size(tableNameList) <= 0) {
- msg$1('请选择要同步的表');
- return;
- }
- var schema1 = this.viewModel.get('schema1');
- var schema2 = this.viewModel.get('schema2');
- if (!schema1 || !schema2) {
- msg$1('无法识别 schema 名称');
- return;
- }
- this.refs.grid1.setLoading(true);
- getModifyIdxDDL({
- datasource1: this.viewModel.get('dataSource1'),
- datasource2: this.viewModel.get('dataSource2'),
- schema1: this.viewModel.get('schema1'),
- schema2: this.viewModel.get('schema2'),
- tables: tableNameList,
- }).then(function (res) {
- if (res.success) {
- _this.refs.ddleditor_idx.setCode(res.data);
- _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_idx);
- }
- }).finally(function () {
- _this.refs.grid1.setLoading(false);
- });
- };
- DbSync.prototype.procedureCopyTo = function () {
- var _this = this;
- if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
- msg$1('选择数据源!');
- return;
- }
- var schema1 = this.viewModel.get('schema1');
- var schema2 = this.viewModel.get('schema2');
- if (!schema1 || !schema2) {
- msg$1('无法识别 schema 名称');
- return;
- }
- this.refs.grid1.setLoading(true);
- getModifyProcedureSQL({
- datasource1: this.viewModel.get('dataSource1'),
- datasource2: this.viewModel.get('dataSource2'),
- schema1: this.viewModel.get('schema1'),
- schema2: this.viewModel.get('schema2'),
- }).then(function (res) {
- if (res.success) {
- _this.refs.ddleditor_procedure.setCode(res.data);
- _this.refs.ddleditor_procedure.updateOptions({ readOnly: true });
- _this.refs.wizard1.getLayout().setActiveItem(_this.refs.ddl_procedure);
- }
- }).finally(function () {
- _this.refs.grid1.setLoading(false);
- });
- };
- DbSync.prototype.dataSync_start = function () {
- var _this = this;
- this.viewModel.set('dataSync_isStart', true);
- var dataSync = __assign({ datasource1: this.viewModel.get('dataSource1'), datasource2: this.viewModel.get('dataSource2') }, this.viewModel.get('dataSync'));
- this.refs.datacopy.setLoading(true);
- dataSyncApi(dataSync)
- .then(function (res) {
- mergeViewModel(_this.viewModel, "dataSyncResult", res, false);
- _this.dataSyncInterval = setInterval(_this.dataSync_process.bind(_this), 1000);
- })
- .finally(function () {
- _this.refs.datacopy.setLoading(false);
- });
- };
- DbSync.prototype.dataSync_process = function () {
- var _this = this;
- var jobId = this.viewModel.get('dataSyncResult.jobId');
- dataSyncInfoApi({ jobId: jobId })
- .then(function (res) {
- if (_$2.isArray(res.tableSyncInfos)) {
- var scrollPosition = _this.refs.datacopy.scrollable.position;
- _this.refs.datacopy.setData(res.tableSyncInfos);
- try {
- _this.refs.datacopy.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
- }
- catch (e) {
- }
- }
- if (res.endTime) {
- // 已经结束
- var cost = ((res.endTime - res.startTime) / 1000).toFixed(0);
- if (res.success) {
- showInfoDialog("\u540C\u6B65\u5DF2\u5B8C\u6210\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
- }
- else {
- showErrorDialog$1("\u540C\u6B65\u51FA\u9519\uFF0C\u8017\u65F6 " + cost + " \u79D2!");
- }
- _this.dataSync_stop();
- }
- })
- .catch(function (e) {
- showErrorDialog$1("dataSyncInfoApi \u63A5\u53E3\u5F02\u5E38!");
- console.error(e);
- // this.dataSync_stop()
- })
- .finally(function () {
- _this.refs.datacopy.setLoading(false);
- });
- };
- DbSync.prototype.dataSync_stop = function () {
- this.viewModel.set('dataSync_isStart', false);
- clearInterval(this.dataSyncInterval);
- delete this.dataSyncInterval;
- };
- DbSync.prototype.dataCopyTo = function () {
- if (!this.viewModel.get('dataSource1') || !this.viewModel.get('dataSource2')) {
- msg$1('选择数据源!');
- return;
- }
- var recordList = this.refs.grid1.getSelection();
- var tableNameList = _$2.map(recordList, function (r) { return r.get('table_name1'); });
- if (_$2.size(tableNameList) <= 0) {
- msg$1('请选择要同步的表');
- return;
- }
- var diffRec = _$2.find(recordList, function (r) { return r.get('diff') !== '一致'; });
- this.viewModel.set('dataSync.tables', tableNameList);
- this.refs.wizard1.getLayout().setActiveItem(this.refs.datacopy);
- };
- DbSync.prototype.next = function () {
- this.refs.wizard1.getLayout().setActiveItem(this.refs.ddl);
- };
- DbSync.prototype.back = function () {
- this.refs.wizard1.getLayout().setActiveItem(this.refs.first);
- };
- DbSync.prototype.dbToMeta = function () {
- var _this = this;
- var dataSource1 = this.viewModel.get('dataSource1');
- var dataSource2 = this.viewModel.get('dataSource2');
- confirm('真的要重新拉取元数据吗?可能耗时 10~30秒左右').then(function (res) {
- var promise1 = dbToMeta({ datasource: dataSource1 });
- var promise2 = dbToMeta({ datasource: dataSource2 });
- _this.refs.grid1.setLoading(true);
- Promise.all([promise1, promise2]).then(function (_a) {
- var _b = __read(_a, 2), res1 = _b[0], res2 = _b[1];
- _this.diff();
- }).catch(function (res) {
- _this.refs.grid1.setLoading(false);
- showErrorDialog$1(res);
- });
- });
- };
- DbSync.prototype.executeDDL = function () {
- var _this = this;
- var code = this.refs.ddleditor.getValue();
- var dataSource2 = this.viewModel.get('dataSource2');
- var target_schema_name = this.viewModel.get('schema2');
- var recordList = this.refs.grid1.getSelection();
- var table_infos = _$2.map(recordList, function (r) {
- return r.get('table_info');
- });
- this.setLoading(true);
- pushToDbCommitApi({
- datasource: dataSource2,
- ddl: code,
- table_infos: table_infos,
- target_schema_name: target_schema_name,
- }).then(function (res) {
- if (res === null || res === void 0 ? void 0 : res.success) {
- msg$1('执行成功');
- _this.back();
- _this.diff();
- return;
- }
- showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- DbSync.prototype.executeDDLIdx = function () {
- var _this = this;
- var code = this.refs.ddleditor_idx.getValue();
- var dataSource2 = this.viewModel.get('dataSource2');
- this.setLoading(true);
- executeDDL({
- datasource: dataSource2,
- ddl: code,
- }).then(function (res) {
- if (res === null || res === void 0 ? void 0 : res.success) {
- msg$1('执行成功');
- _this.back();
- return;
- }
- showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- DbSync.prototype.executeProcedureSQL = function () {
- var _this = this;
- this.setLoading(true);
- executeModifyProcedureSQL({
- datasource1: this.viewModel.get('dataSource1'),
- datasource2: this.viewModel.get('dataSource2'),
- schema1: this.viewModel.get('schema1'),
- schema2: this.viewModel.get('schema2'),
- }).then(function (res) {
- if (res === null || res === void 0 ? void 0 : res.success) {
- msg$1('执行成功');
- _this.back();
- return;
- }
- showErrorDialog$1('发生错误:' + (res === null || res === void 0 ? void 0 : res.msg));
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- return DbSync;
- }(Scope));
- var model$2 = {
- data: {}
- };
- var vjson$2 = {
- title: '示例代码',
- layout: 'fit',
- items: [
- {
- layout: 'border',
- items: [
- {
- region: 'north',
- split: true,
- height: 200,
- title: '表格数据',
- reference: 'dataeditor',
- xtype: 'jsoneditor',
- listeners: {
- change: 'scope.dataChanged'
- },
- },
- {
- region: 'west',
- split: true,
- width: 230,
- title: '模板',
- reference: 'tree1',
- xtype: 'treepanel',
- rootVisible: false,
- useArrows: true,
- colspan: 2,
- lines: true,
- multiSelect: false,
- listeners: {
- itemclick: 'scope.templateChange',
- },
- },
- {
- region: 'center',
- title: '参考代码',
- reference: 'preview',
- xtype: 'jsoneditor',
- },
- ]
- }
- ]
- };
- var rootNode = {
- id: 'ROOT',
- type: "ROOT",
- path: "",
- expanded: true,
- leaf: false,
- children: [
- { id: 'form', url: 'form.js', text: 'PC表单', leaf: true },
- { id: 'yvgrid_columns', url: 'yvgrid_columns.js', text: 'PC表格列', leaf: true },
- { id: 'dsl_select', url: 'dsl_select.js', text: 'QueryDSL查询', leaf: true },
- { id: 'dsl_update', url: 'dsl_update.js', text: 'QueryDSL更新', leaf: true },
- { id: 'dsl_insert', url: 'dsl_insert.js', text: 'QueryDSL插入', leaf: true },
- { id: 'dsl_delete', url: 'dsl_delete.js', text: 'QueryDSL删除', leaf: true },
- ],
- };
- var TemplateDev = /** @class */ (function (_super) {
- __extends(TemplateDev, _super);
- function TemplateDev() {
- var _this = _super.call(this, { model: model$2, vjson: vjson$2 }) || this;
- _this.dataChanged = _$2.debounce(function () {
- var me = _this;
- if (me.refs.tree1.selection) {
- me.templateChange(me.refs.tree1, me.refs.tree1.selection);
- }
- }, 50);
- return _this;
- }
- TemplateDev.prototype.onDestroy = function () {
- setDbCode(undefined);
- handles$1.dbTree.removeListener('selectionchange', this.dbTreeNodeChange);
- };
- TemplateDev.prototype.onLoad = function () {
- setDbCode(this);
- handles$1.dbTree.on('selectionchange', this.dbTreeNodeChange);
- this.refs.tree1.setRootNode(rootNode);
- getColumnDomainApi({}).then(function (_a) {
- var data = _a.data;
- return window['dev_column_domain'] = data;
- });
- };
- TemplateDev.prototype.dbTreeNodeChange = function () {
- var me = handles$1.dbcode;
- var tables = [];
- _$2.forEach(handles$1.dbTree.getSelection(), function (r) {
- var raw = _$2.cloneDeep(r.get('raw'));
- raw.id = r.get('id');
- if (r.get('type') === 'table') {
- tables.push(raw);
- return;
- }
- if (r.get('type') === 'column') {
- var tableInfo = _$2.find(tables, function (t) { return t.table_name === r.get('raw').table_name; });
- if (!tableInfo) {
- tableInfo = _$2.cloneDeep(r.parentNode.get('raw'));
- tables.push(tableInfo);
- }
- if (!tableInfo.column_list) {
- tableInfo.column_list = [raw];
- }
- else {
- tableInfo.column_list.push(raw);
- }
- }
- });
- // 对于没有选择列的表格,默认加上所有列
- _$2.forEach(tables, function (tableInfo) {
- if (typeof tableInfo.column_list === 'undefined') {
- tableInfo.column_list = [];
- handles$1.dbTree.store.getById(tableInfo.id).childNodes.forEach(function (r) {
- tableInfo.column_list.push(_$2.cloneDeep(r.get('raw')));
- });
- }
- });
- var code = JSON.stringify(tables, null, ' ');
- me.refs.dataeditor.setCode(code);
- };
- TemplateDev.prototype.templateChange = function (sender, record, item, index, e, eOpts) {
- var url = record.data.url;
- var rd = _$2.uniqueId('db_code_request');
- if (url) {
- var data = void 0;
- try {
- data = JSON.parse(this.refs.dataeditor.getCode());
- }
- catch (e) {
- return;
- }
- // require(['../../dist/studio/database/template/' + url + '.js?t=' + rd + '&ext='], (node) => {
- // if (typeof node.default === "function") {
- // const v = toString(node.default(data))
- // // this.refs.preview.setLanguage(record?.raw?.language ?? "plaintext")
- // this.refs.preview.setLanguage("plaintext")
- // this.refs.preview.setCode(v)
- // }
- // })
- showErrorDialog$1('没做这里');
- }
- };
- return TemplateDev;
- }(Scope));
- var model$3 = {
- data: {
- hasChanged: false,
- }
- };
- var vjson$3 = {
- bind: {
- title: '字段域{grid1.ischanged?" *":""}',
- },
- layout: 'fit',
- items: [
- {
- layout: 'border',
- items: [
- {
- region: 'center',
- xtype: 'yvgrid',
- selModel: {
- type: 'spreadsheet',
- columnSelect: true,
- pruneRemoved: false,
- extensible: 'y'
- },
- plugins: {
- clipboard: true,
- selectionreplicator: true
- },
- reference: 'grid1',
- pagination: false,
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'scope.addField'
- }
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.removeField'
- }
- },
- {
- xtype: 'button',
- text: '保存',
- iconCls: 'x-fa fa-save',
- bind: {
- disabled: '{!grid1.ischanged}'
- },
- listeners: {
- click: 'scope.save'
- }
- },
- ]
- },
- listeners: {
- editfinish: 'scope.gridEditFinish',
- },
- columns: [
- {
- text: '字段域名称', dataIndex: 'domain_name',
- sortable: false,
- menuDisabled: true,
- locked: true,
- editor: {
- selectOnFocus: true
- }
- },
- {
- text: 'PgSQL类型', dataIndex: 'pgsql_datatype',
- sortable: false, menuDisabled: true,
- editor: {
- selectOnFocus: true
- }
- },
- {
- text: 'MySQL类型', dataIndex: 'mysql_datatype',
- sortable: false, menuDisabled: true,
- editor: {
- selectOnFocus: true
- }
- },
- {
- text: 'Oracle类型', dataIndex: 'oracle_datatype',
- sortable: false, menuDisabled: true,
- editor: {
- selectOnFocus: true
- }
- },
- {
- text: 'SqlServer类型', dataIndex: 'sqlserver_datatype',
- sortable: false, menuDisabled: true,
- editor: {
- selectOnFocus: true
- }
- },
- {
- text: 'Java类型', dataIndex: 'java_datatype',
- sortable: false, menuDisabled: true,
- editor: {
- selectOnFocus: true
- }
- },
- {
- text: '固定长度', dataIndex: 'is_fix_size',
- xtype: 'checkcolumn', sortable: false, menuDisabled: true,
- width: 88, resizable: false,
- },
- {
- text: '长度', dataIndex: 'column_size',
- sortable: false, menuDisabled: true, dataType: 'int',
- xtype: 'numbercolumn', format: '0',
- editor: { selectOnFocus: true }
- },
- {
- text: '小数位', dataIndex: 'decimal_digits',
- sortable: false, menuDisabled: true, dataType: 'int',
- xtype: 'numbercolumn', format: '0',
- editor: { selectOnFocus: true }
- },
- {
- text: '字典', dataIndex: 'domain_column_dict',
- sortable: false, menuDisabled: true,
- // fix: ['system.getDict("DICT")'],
- width: 200,
- editor: {
- xtype: 'combo',
- listConfig: {
- minWidth: 350
- },
- }
- },
- {
- text: '固定默认值', dataIndex: 'is_fix_default_value',
- xtype: 'checkcolumn', sortable: false, menuDisabled: true,
- width: 88, resizable: false,
- },
- {
- text: '默认值', dataIndex: 'default_value',
- sortable: false, menuDisabled: true,
- editor: {
- selectOnFocus: true
- }
- },
- {
- text: 'UI建议', dataIndex: 'domain_column_ui',
- sortable: false, menuDisabled: true,
- // fix: ['system.getDict("column_ui")'],
- editor: {
- xtype: 'combo',
- allowBlank: true,
- listConfig: {
- minWidth: 200
- },
- }
- },
- {
- text: '详细描述', dataIndex: 'domain_note',
- sortable: false, menuDisabled: true,
- editor: {}
- },
- {
- text: '责任人', dataIndex: 'domain_person',
- sortable: false, menuDisabled: true,
- editor: {
- selectOnFocus: true
- }
- },
- {
- text: '版本', dataIndex: 'domain_version',
- sortable: false, menuDisabled: true,
- editor: {
- selectOnFocus: true
- }
- },
- ]
- }
- ]
- },
- ]
- };
- var CacheStore = /** @class */ (function () {
- function CacheStore() {
- // 订阅
- this.subscribeList = [];
- this.apiResponse = undefined;
- }
- /**
- * 订阅结果集
- */
- CacheStore.prototype.registe = function (fn) {
- this.subscribeList.push(fn);
- };
- /**
- * 取消订阅
- */
- CacheStore.prototype.unregiste = function (fn) {
- _$2.remove(this.subscribeList, function (item) { return item === fn; });
- };
- /**
- * 尝试取数据(先读缓存)
- */
- CacheStore.prototype.reloadIfNeed = function (param) {
- var _this = this;
- if (typeof this.apiResponse === 'undefined') {
- // 从未有获取过值
- var cacheKey = this.getCacheKey(param);
- if (cacheKey) {
- // 可以从缓存读
- var fileName = getCurrentProject().uuid + "/" + cacheKey;
- native.loadFile(fileName, function (res) {
- if (res) {
- // 缓存有值
- _this.apiResponse = res;
- _this.notifyRefresh();
- }
- else {
- // 缓存没值
- _this.reloadForce(param).then(function (res) {
- });
- }
- });
- }
- else {
- // 不能从缓存读
- this.reloadForce(param).then(function (res) {
- });
- }
- return true;
- }
- return false;
- };
- /**
- * 尝试取数据(先读缓存), 并以异步方法返回 apiResponse
- */
- CacheStore.prototype.reloadIfNeedPromise = function (param) {
- var _this = this;
- return new Promise(function (resolve, reject) {
- if (typeof _this.apiResponse === 'undefined') {
- // 从未有获取过值
- var cacheKey = _this.getCacheKey(param);
- if (cacheKey) {
- // 可以从缓存读
- var fileName = getCurrentProject().uuid + "/" + cacheKey;
- native.loadFile(fileName, function (res) {
- if (res) {
- // 缓存有值
- _this.apiResponse = res;
- _this.notifyRefresh();
- resolve(_this.apiResponse);
- }
- else {
- // 缓存没值
- _this.reloadForce(param).then(function (res) {
- resolve(_this.apiResponse);
- });
- }
- });
- }
- else {
- // 不能从缓存读
- _this.reloadForce(param).then(function (res) {
- resolve(_this.apiResponse);
- });
- }
- }
- else {
- // 有值,获取过
- resolve(_this.apiResponse);
- }
- });
- };
- /**
- * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
- */
- CacheStore.prototype.reloadForce = function (param) {
- var _this = this;
- _$2.forEach(this.subscribeList, function (fn) {
- fn(true);
- });
- return this.invokeApi(param)
- .then(function (res) {
- _this.apiResponse = res;
- var cacheKey = _this.getCacheKey(param);
- if (cacheKey) {
- // 可以保存到缓存
- var fileName = getCurrentProject().uuid + '/' + cacheKey;
- native.saveFile(fileName, res);
- }
- // 通知订阅者刷新
- _this.notifyRefresh();
- })
- .finally(function () {
- _$2.forEach(_this.subscribeList, function (fn) {
- fn(false);
- });
- });
- };
- /**
- * 通知组件,isLoading状态被更改
- */
- CacheStore.prototype.notifyLoading = function (isLoading) {
- var _this = this;
- _$2.forEach(this.subscribeList, function (fn) {
- fn(_this.apiResponse);
- });
- };
- /**
- * 通知数据更改,需要刷新
- */
- CacheStore.prototype.notifyRefresh = function () {
- var _this = this;
- _$2.forEach(this.subscribeList, function (fn) {
- fn(_this.apiResponse);
- });
- };
- return CacheStore;
- }());
- // 字段域数据
- var columnDomain = undefined;
- var DomainStore = /** @class */ (function (_super) {
- __extends(DomainStore, _super);
- function DomainStore() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- DomainStore.prototype.getCacheKey = function (param) {
- return "domain_data.json";
- };
- DomainStore.prototype.invokeApi = function (param) {
- return getColumnDomainApi();
- };
- /**
- * 设置全局可访问的 字段域数据
- */
- DomainStore.prototype.getColumnDomainComboData = function () {
- var _this = this;
- return new Promise(function (resolve) {
- _this.reloadIfNeedPromise(undefined).then(function (res) {
- resolve(_this.apiResponse.data.map(function (v) {
- return { id: v.domain_id, text: v.domain_name };
- }));
- });
- });
- };
- /**
- * 设置全局可访问的 字段域数据
- */
- DomainStore.prototype.getColumnDomainById = function (value) {
- return _$2.find(this.apiResponse.data, function (v) { return v.domain_id === value; });
- };
- DomainStore.prototype.getAllDomain = function () {
- return new Promise(function (resolve, reject) {
- getColumnDomainApi()
- .then(function (res) {
- if (res.success) {
- if (res.success) {
- var tt = _$2.map(res.data, function (row) {
- return {
- text: row.domain_name,
- id: row.domain_id,
- };
- });
- _$2.set(window, 'DICT_CACHE.column_domain', tt);
- }
- columnDomain = res.data;
- resolve(res.data);
- }
- else {
- window['showErrorDialog']('getColumnDomain error!\n' + res.msg);
- console.error('getColumnDomain', res.msg);
- }
- })
- .catch(function (e) {
- window['showErrorDialog']('getColumnDomain error!');
- console.error('getColumnDomain', e);
- reject(e);
- });
- });
- };
- return DomainStore;
- }(CacheStore));
- var instance = new DomainStore();
- var DbDomain = /** @class */ (function (_super) {
- __extends(DbDomain, _super);
- function DbDomain() {
- return _super.call(this, { model: model$3, vjson: vjson$3 }) || this;
- }
- DbDomain.prototype.onLoad = function () {
- var _this = this;
- instance.getAllDomain().then(function (data) {
- _this.refs.grid1.setData(data);
- });
- };
- DbDomain.prototype.gridEditFinish = function () {
- this.viewModel.set('hasChanged', true);
- };
- DbDomain.prototype.addField = function () {
- this.refs.grid1.appendEditRow({
- domainName: '',
- pgSqlDataType: '',
- mysqlDataType: '',
- oracleDataType: '',
- sqlserverDataType: '',
- javaDataType: '',
- isFixSize: true,
- size: '',
- decimalDigits: '',
- isFixDefaultValue: false,
- defaultValue: null,
- domainColumnDict: '',
- domainColumnUI: '',
- note: '',
- domainPerson: '',
- domainVersion: '',
- }, 0);
- };
- DbDomain.prototype.removeField = function () {
- var _this = this;
- var rows = [];
- this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
- rows.push(r);
- });
- _.forEach(rows, function (r) {
- _this.refs.grid1.getStore().remove(r);
- });
- };
- DbDomain.prototype.save = function () {
- var _this = this;
- // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
- var _a = system.getGridEditRows(this.refs.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
- if (err) {
- // 如果有异常就不保存
- return;
- }
- // 进行业务上的逻辑校验,比如说必填校验等等
- var hasError = false;
- _.forEach(rows, function (row, i) {
- if (isEmpty(row.domain_name)) {
- system.msg("\u5B57\u6BB5\u57DF\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A!");
- hasError = true;
- return false;
- }
- if (isEmpty(row.pgsql_datatype) ||
- isEmpty(row.mysql_datatype) ||
- isEmpty(row.oracle_datatype) ||
- isEmpty(row.sqlserver_datatype)) {
- system.msg("datatype \u4E0D\u80FD\u4E3A\u7A7A!");
- hasError = true;
- return false;
- }
- });
- if (hasError) {
- return;
- }
- // 设置当前界面为 "保存中..." 状态
- this.setLoading(true);
- saveColumnDomain({
- // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
- newRows: newRows,
- modifyRows: modifyRows,
- removeRecords: removeRecords,
- }).then(function (res) {
- // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
- system.msg(res.msg);
- instance.reloadForce({}).then(function () {
- instance.getAllDomain().then(function (data) {
- _this.refs.grid1.setData(data);
- });
- }).finally(function () {
- // 无论正常异常,关闭 "保存中..." 状态
- _this.setLoading(false);
- });
- }).catch(function (e) {
- // 无论正常异常,关闭 "保存中..." 状态
- _this.setLoading(false);
- });
- };
- return DbDomain;
- }(Scope));
- var model$4 = {
- data: {
- report_id: '',
- report_name: '',
- report_enable: false,
- report: {
- dataSource: '',
- grid: {
- pagination: true,
- },
- query: [],
- columns: [],
- summary: [],
- },
- querySql: '',
- summarySql: '',
- createAt: '',
- createBy: '',
- updateAt: '',
- updateBy: '',
- }
- };
- var vjson$4 = {
- bind: {
- title: '报表-{report_name}',
- },
- layout: 'fit',
- items: [
- {
- layout: 'border',
- items: [
- {
- region: 'north',
- items: [
- {
- xtype: 'toolbar',
- border: false,
- items: [
- {
- xtype: 'button',
- text: '刷新',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'scope.load'
- }
- },
- {
- xtype: 'button',
- text: '保存',
- iconCls: 'x-fa fa-save',
- listeners: {
- click: 'scope.save'
- }
- },
- {
- xtype: 'button',
- text: '预览',
- iconCls: 'x-fa fa-play-circle-o',
- listeners: {
- click: 'scope.preview'
- }
- },
- {
- xtype: 'textfield',
- fieldLabel: '报表名称',
- flex: 1,
- bind: {
- value: '{report_name}'
- }
- },
- {
- xtype: 'checkbox',
- fieldLabel: '启用报表',
- checkedValue: 1,
- uncheckedValue: 0,
- bind: {
- value: '{report_enable}'
- }
- },
- {
- xtype: 'checkbox',
- fieldLabel: '启用分页',
- bind: {
- value: '{report.grid.pagination}'
- }
- },
- {
- xtype: 'textfield',
- fieldLabel: '数据源',
- flex: 1,
- bind: {
- value: '{report.dataSource}'
- }
- },
- ]
- }
- ]
- },
- {
- xtype: 'tabpanel', region: 'center', plain: true, border: false,
- items: [
- {
- title: 'SQL和查询条件',
- layout: 'border',
- border: false,
- items: [
- {
- region: 'north',
- height: 200,
- border: false,
- split: true,
- xtype: 'yvgrid',
- reference: 'gridCondition',
- pagination: false,
- hideFootbar: true,
- plugins: {
- clipboard: true,
- selectionreplicator: true
- },
- selModel: {
- type: 'spreadsheet',
- columnSelect: false,
- pruneRemoved: false,
- extensible: 'y'
- },
- tbar: {
- xtype: 'toolbar',
- border: false,
- items: [
- {
- xtype: 'button',
- text: '添加条件',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'scope.addCondition'
- }
- },
- {
- xtype: 'button',
- text: '删除条件',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.removeCondition'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '自动分析条件变量',
- iconCls: 'x-fa fa-code-fork',
- listeners: {
- click: 'scope.calcCondition'
- }
- },
- {
- xtype: 'button',
- text: '上移',
- iconCls: 'x-fa fa-arrow-up',
- listeners: {
- click: 'scope.moveUp'
- }
- },
- {
- xtype: 'button',
- text: '下移',
- iconCls: 'x-fa fa-arrow-down',
- listeners: {
- click: 'scope.moveDown'
- }
- },
- ]
- },
- columns: [
- {
- text: '条件变量',
- dataIndex: 'conditionFieldBind',
- width: 140,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '中文标题',
- dataIndex: 'conditionFieldLabel',
- width: 120,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '编辑类型',
- dataIndex: 'conditionFieldXtype',
- width: 80,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- typeAhead: true,
- triggerAction: 'all',
- selectOnFocus: true,
- store: [
- ['textfield', 'textfield'],
- ['combo', 'combo'],
- ['datefield', 'datefield'],
- ['datetimefield', 'datetimefield'],
- ['numberfield', 'numberfield'],
- ['multiplesearch', 'multiplesearch'],
- ]
- }
- },
- {
- text: '权重',
- dataIndex: 'conditionFieldFlex',
- align: 'right',
- width: 60,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'numberfield',
- selectOnFocus: false,
- minValue: 0,
- maxValue: 10
- },
- },
- {
- text: '字典',
- dataIndex: 'conditionFieldDict',
- width: 160,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: false
- },
- },
- {
- xtype: 'checkcolumn',
- dataIndex: "conditionFieldWrap", header: "换行",
- width: 65,
- sortable: false,
- menuDisabled: true,
- },
- {
- text: '扩展参数',
- dataIndex: 'conditionFieldExtend',
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: false
- },
- },
- ]
- },
- {
- region: 'center',
- xtype: 'sqleditor',
- layout: 'fit',
- reference: 'sqlEditor',
- split: true,
- },
- ]
- },
- {
- title: '查询结果字段',
- xtype: 'yvgrid',
- reference: 'gridColumn',
- pagination: false,
- hideFootbar: true,
- border: false,
- plugins: {
- clipboard: true,
- selectionreplicator: true
- },
- selModel: {
- type: 'spreadsheet',
- columnSelect: false,
- pruneRemoved: false,
- extensible: 'y'
- },
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'scope.addColumn'
- }
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.removeColumn'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '自动分析',
- iconCls: 'x-fa fa-code-fork',
- listeners: {
- click: 'scope.calcColumn'
- }
- },
- {
- xtype: 'button',
- text: '上移',
- iconCls: 'x-fa fa-arrow-up',
- listeners: {
- click: 'scope.moveUp'
- }
- },
- {
- xtype: 'button',
- text: '下移',
- iconCls: 'x-fa fa-arrow-down',
- listeners: {
- click: 'scope.moveDown'
- }
- },
- ]
- },
- columns: [
- { xtype: 'rownumberer' },
- {
- text: '字段',
- dataIndex: 'dataIndex',
- width: 140,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '标题',
- dataIndex: 'header',
- width: 120,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '显示类型',
- dataIndex: 'xtype',
- width: 90,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- typeAhead: true,
- triggerAction: 'all',
- selectOnFocus: true,
- store: [
- ['', ''],
- ['rownum', 'rownum'],
- ['button', 'button'],
- ['checkbox', 'checkbox'],
- ['progres', 'progres'],
- ]
- }
- },
- {
- text: '数据类型',
- dataIndex: 'dataType',
- width: 90,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- typeAhead: true,
- triggerAction: 'all',
- selectOnFocus: true,
- store: [
- ['', ''],
- ['string', 'string'],
- ['number', 'number'],
- ['date', 'date'],
- ]
- }
- },
- {
- text: '宽度',
- dataIndex: 'width',
- align: 'right',
- width: 60,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'numberfield',
- selectOnFocus: true,
- minValue: 0,
- maxValue: 1000
- },
- },
- {
- text: '权重',
- dataIndex: 'flex',
- align: 'right',
- width: 60,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'numberfield',
- selectOnFocus: true,
- minValue: 0,
- maxValue: 10
- },
- },
- {
- text: '字典',
- dataIndex: 'dict',
- sortable: false,
- menuDisabled: true,
- width: 120,
- editor: {
- selectOnFocus: true,
- },
- },
- {
- text: '对齐',
- dataIndex: 'align',
- width: 60,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- typeAhead: true,
- triggerAction: 'all',
- selectOnFocus: false,
- store: [
- ['', ''],
- ['start', 'start'],
- ['center', 'center'],
- ['end', 'end'],
- ]
- },
- },
- {
- text: '过滤',
- dataIndex: 'filterable',
- xtype: 'checkcolumn',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- },
- {
- text: '隐藏',
- dataIndex: 'hidden',
- xtype: 'checkcolumn',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- },
- {
- text: '排序',
- dataIndex: 'sortable',
- xtype: 'checkcolumn',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- },
- {
- text: '扩展参数',
- dataIndex: 'fieldExtend',
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: false
- },
- },
- ],
- },
- {
- title: '汇总和汇总逻辑',
- layout: 'border',
- border: false,
- items: [
- {
- xtype: 'yvgrid', region: 'north', layout: 'fit',
- reference: 'gridSum',
- pagination: false,
- hideFootbar: true,
- height: 200,
- split: true,
- border: false,
- plugins: {
- clipboard: true,
- selectionreplicator: true
- },
- selModel: {
- type: 'spreadsheet',
- columnSelect: false,
- pruneRemoved: false,
- extensible: 'y'
- },
- tbar: {
- xtype: 'toolbar',
- border: false,
- items: [
- {
- xtype: 'button',
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'scope.addSum'
- }
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.removeSum'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '自动分析',
- iconCls: 'x-fa fa-code-fork',
- listeners: {
- click: 'scope.calcSum'
- }
- },
- {
- xtype: 'button',
- text: '上移',
- iconCls: 'x-fa fa-arrow-up',
- listeners: {
- click: 'scope.moveUp'
- }
- },
- {
- xtype: 'button',
- text: '下移',
- iconCls: 'x-fa fa-arrow-down',
- listeners: {
- click: 'scope.moveDown'
- }
- },
- ]
- },
- columns: [
- {
- text: '字段名',
- dataIndex: 'sumFieldBind',
- width: 140,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '标题',
- dataIndex: 'sumFieldLabel',
- width: 120,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '权重',
- dataIndex: 'sumFieldFlex',
- align: 'right',
- width: 60,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'numberfield',
- selectOnFocus: false,
- allowBlank: true,
- minValue: 0,
- maxValue: 10
- },
- },
- {
- xtype: 'checkcolumn',
- dataIndex: "sumFieldWrap", header: "换行",
- sortable: false,
- menuDisabled: true,
- width: 65,
- },
- {
- text: '扩展参数',
- dataIndex: 'sumFieldExtend',
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: false
- },
- },
- ]
- },
- {
- region: 'center',
- xtype: 'sqleditor',
- layout: 'fit',
- reference: 'sqlSumEditor',
- },
- ]
- },
- ]
- }
- ]
- }
- ]
- }; //
- //
- var DbStore = /** @class */ (function (_super) {
- __extends(DbStore, _super);
- function DbStore() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- DbStore.prototype.getCacheKey = function (param) {
- return "db_data.json";
- };
- DbStore.prototype.invokeApi = function (param) {
- return getMateData(param);
- };
- /**
- * 保存 元数据Ex,并构建与数据库差别的 DDL 语句
- */
- DbStore.prototype.saveMetaExBuildDDLPromise = function (schema_name, table_name, tableInfo, column_list) {
- return new Promise(function (resolve, reject) {
- saveMetaExBuildDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, column_list: column_list }).then(function (res1) {
- resolve(res1);
- // TODO 好像不需要,先跳过
- // reloadByTableName(schema_name, table_name).then(res2 => {
- // resolve(res1)
- // }).catch(e => {
- // reject(e)
- // })
- }).catch(function (e) {
- reject(e);
- });
- });
- };
- /**
- * 保存元数据至表格
- */
- DbStore.prototype.saveMetaTable = function (schema_name, table_name, tableInfo, fieldChanges, ddl) {
- var _this = this;
- return new Promise(function (resolve, reject) {
- saveMetaTableChanges({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, ddl: ddl }).then(function (res1) {
- // 保存后重新刷新
- _this.reloadByTableName(schema_name, table_name).then(function (res2) {
- resolve({
- data: res2,
- msg: res1.msg
- });
- }).catch(function (e) {
- reject(e);
- });
- }).catch(function (e) {
- reject(e);
- });
- });
- };
- /**
- * 预览生成的 DDL 语句
- */
- DbStore.prototype.previewColumnChangeDDL = function (schema_name, table_name, tableInfo, fieldChanges, column_list) {
- return new Promise(function (resolve, reject) {
- getModifyTableDDL({ schema_name: schema_name, table_name: table_name, tableInfo: tableInfo, fieldChanges: fieldChanges, column_list: column_list })
- .then(function (res) {
- resolve(res);
- });
- });
- };
- /**
- * 执行 DDL
- */
- DbStore.prototype.pushToDbCommit = function (arg) {
- return new Promise(function (resolve, reject) {
- pushToDbCommitApi(arg).then(function (res) {
- resolve(res);
- }).catch(function (e) {
- reject(e);
- });
- });
- };
- /**
- * 重读某一个表格的 meta 元数据
- */
- DbStore.prototype.reloadByTableName = function (schema_name, table_name) {
- var _this = this;
- return new Promise(function (resolve, reject) {
- getMateDataByTableName({ schema_name: schema_name, table_name: table_name }).then(function (res) {
- if (!res[0] || !res[0].table_list[0]) {
- showErrorDialog$1('获取表格元数据数据失败,' + schema_name + '.' + table_name);
- return;
- }
- var tableRow = _this.getTableByName(schema_name, table_name);
- if (!tableRow) {
- // 没有找到这个表格,就添加一个表格到对应的 schemaRow
- var schemaRow = _$2.find(_this.apiResponse, function (i) { return (i.schema_name === schema_name); });
- if (!schemaRow) {
- showErrorDialog$1('没有找到 schema:' + schema_name);
- return;
- }
- schemaRow.table_list.push(res[0].table_list[0]);
- }
- else {
- // 找到了目标表格,就吧 table 所有属性都赋值过去
- Object.assign(tableRow, res[0].table_list[0]);
- }
- // 所有界面通知一遍刷新
- _this.notifyRefresh();
- resolve(res);
- }).catch(function (e) {
- reject(e);
- });
- });
- };
- DbStore.prototype.getColumnByTableNameColumnName = function (table_name, column_name) {
- var result = undefined;
- _$2.forEach(this.apiResponse, function (schemaRow) {
- var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === table_name); });
- if (tableRow) {
- var columnRow = _$2.find(tableRow.column_list, function (i) { return (i.column_name === column_name); });
- if (columnRow) {
- result = columnRow;
- return false;
- }
- }
- });
- return result;
- };
- DbStore.prototype.getTableByName = function (schemaName, tableName) {
- var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === schemaName); });
- if (!schemaRow) {
- showErrorDialog$1('没有找到 schema:' + schemaName);
- return;
- }
- var tableRow = _$2.find(schemaRow.table_list, function (i) { return (i.table_name === tableName); });
- if (!schemaRow) {
- showErrorDialog$1('没有找到 table:' + tableName);
- return;
- }
- return tableRow;
- };
- /**
- * 添加一个新表格
- */
- DbStore.prototype.appendNewTable = function (tableInfo) {
- var schemaRow = _$2.find(this.apiResponse, function (i) { return (i.schema_name === tableInfo.schema_name); });
- if (!schemaRow) {
- showErrorDialog$1('没有找到 schema:' + tableInfo.schema_name);
- return;
- }
- schemaRow.table_list.push(tableInfo);
- };
- /**
- * 从数据库结构重新生成元数据
- */
- DbStore.prototype.dbToMetaAndReload = function () {
- var _this = this;
- this.notifyLoading(true);
- dbToMeta().then(function () {
- _this.reloadForce(undefined);
- }).catch(function (e) {
- _this.notifyLoading(false);
- });
- };
- DbStore.prototype.getSchemaDbType = function (schemaName) {
- var dbType = undefined;
- _$2.forEach(this.apiResponse, function (schemaRow) {
- if (schemaRow.schema_name === schemaName) {
- dbType = schemaRow.db_type;
- return false;
- }
- });
- return dbType;
- };
- return DbStore;
- }(CacheStore));
- function syncQueryDSL(_a) {
- var schema_name = _a.schema_name, table_name = _a.table_name;
- return createQueryDSLFile({ schema_name: schema_name, table_name: table_name });
- }
- var instance$1 = new DbStore();
- // // 字段域数据
- // let columnDomain = undefined
- // // 元数据
- // let apiResponse = []
- //
- // // 订阅
- // const subscribeList = []
- // /**
- // * 获取全部元数据
- // */
- // export function getApiResponse() {
- // return apiResponse
- // }
- //
- // export function getColumnDomain() {
- // return columnDomain
- // }
- // window['getApiResponse'] = getApiResponse
- // window['getColumnDomain'] = getColumnDomain
- // window['getDbTreeStore'] = function () {
- // return apiResponse
- // }
- //
- // /**
- // * 订阅结果集
- // */
- // export function subscribe(fn) {
- // subscribeList.push(fn)
- // }
- //
- // /**
- // * 取消订阅
- // */
- // export function describe(fn) {
- // _.remove(subscribeList, item => item === fn)
- // }
- //
- // /**
- // * 刷新,如果前端从来没有取到过结果的话
- // * 如果强制刷新成功,就返回 true
- // * 如果没有被强制刷新,返回 false
- // */
- // export function reloadIfNeed() {
- // if (_.size(apiResponse) <= 0) {
- // reloadForce()
- // return true
- // }
- // return false
- // }
- //
- // export function reloadIfNeedPromise() {
- // return new Promise((resolve, reject) => {
- // if (_.size(apiResponse) <= 0) {
- // // 从未有获取过值
- // reloadForce().then(res => {
- // resolve(apiResponse)
- // })
- // return
- // }
- // resolve(apiResponse)
- // return
- // })
- // }
- //
- // /**
- // * 强制完全刷新, 不管之前有没有取过数据,都强制再取一遍
- // */
- // export function reloadForce() {
- // _.forEach(subscribeList, fn => {
- // fn(true)
- // })
- //
- // return getMateData().then((content) => {
- // apiResponse = content
- // _.forEach(subscribeList, fn => {
- // fn(apiResponse)
- // })
- // }).finally(() => {
- // _.forEach(subscribeList, fn => {
- // fn(false)
- // })
- // })
- // }
- //
- // /**
- // * 通知刷新元数据
- // */
- // export function notifyRefresh() {
- // _.forEach(subscribeList, fn => {
- // fn(apiResponse)
- // })
- // }
- // export function getAllDomain() {
- // return new Promise((resolve, reject) => {
- // getColumnDomainApi()
- // .then(res => {
- // if (res.success) {
- // columnDomain = res.data
- // resolve(res.data)
- // } else {
- // showErrorDialog('getColumnDomain error!\n' + res.msg)
- // console.error('getColumnDomain', res.msg)
- // }
- //
- // })
- // .catch(e => {
- // showErrorDialog('getColumnDomain error!')
- // console.error('getColumnDomain', e)
- // reject(e)
- // })
- // })
- // }
- var PROJECT_DICT_CACHE = {};
- window['PROJECT_DICT_CACHE'] = PROJECT_DICT_CACHE;
- /**
- *项目运行时构建
- **/
- function createRuntime() {
- {
- // 已经构建过了
- return new Promise(function (resolve) {
- resolve();
- });
- }
- }
- function ReportRunner(reportId, setLoadingFn) {
- return new Promise(function (resolve) {
- setLoadingFn(true);
- Promise.all([reportByIdApi(reportId), createRuntime()]).then(function (_a) {
- // const {model, vjson, report} = buildVjson(res.data)
- // const ret = new ReportScope({model, vjson})
- // ret.report_id = reportId
- // ret.report = report
- // resolve(ret)
- var _b = __read(_a, 1), res = _b[0];
- var ret = buildReportScope(res.data, reportId, invokeServer, "getProjectDict");
- resolve(ret);
- }).finally(function () {
- setLoadingFn(false);
- });
- });
- }
- //gridCondition
- //gridColumn
- //gridSum
- //sqlSumEditor
- //sqlEditor
- var ReportDesign = /** @class */ (function (_super) {
- __extends(ReportDesign, _super);
- function ReportDesign() {
- return _super.call(this, { model: model$4, vjson: vjson$4 }) || this;
- }
- ReportDesign.prototype.onLoad = function () {
- this.load();
- };
- ReportDesign.prototype.save = function (sender) {
- var _this = this;
- this.viewModel.set('querySql', this.refs.sqlEditor.getCode());
- this.viewModel.set('summarySql', this.refs.sqlSumEditor.getCode());
- this.viewModel.set('report.query', this.refs.gridCondition.getDataRowsOnlyData());
- this.viewModel.set('report.columns', this.refs.gridColumn.getDataRowsOnlyData());
- this.viewModel.set('report.summary', this.refs.gridSum.getDataRowsOnlyData());
- var report = this.viewModel.get('report');
- var data = {
- report_id: this.viewModel.get('report_id'),
- report_name: this.viewModel.get('report_name'),
- report_enable: this.viewModel.get('report_enable'),
- query_sql: this.viewModel.get('querySql'),
- summary_sql: this.viewModel.get('summarySql'),
- report: json5.stringify(report, null, ' '),
- };
- sender.setLoading(true);
- saveReportApi(data).then(function (res) {
- if (res.success) {
- msg$1('保存成功');
- _this.dialogSuccess(data);
- _this.load();
- }
- }).finally(function () {
- sender.setLoading(false);
- });
- };
- ReportDesign.prototype.preview = function (sender) {
- var reportId = this.viewModel.get('report_id');
- ReportRunner(reportId, sender.setLoading.bind(sender)).then(function (scope) {
- handles.mainWindow.showReportPreview(reportId, scope);
- });
- };
- ReportDesign.prototype.load = function () {
- var _this = this;
- var reportId = this.viewModel.get('report_id');
- this.setLoading(true);
- reportByIdApi(reportId).then(function (res) {
- 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;
- if (report) {
- report = json5.parse(report);
- }
- else {
- report = {};
- }
- _this.viewModel.set('report_enable', report_enable);
- _this.viewModel.set('report_name', report_name);
- _this.viewModel.set('querySql', query_sql || '');
- _this.viewModel.set('summarySql', summary_sql || '');
- system.mergeViewModel(_this.viewModel, 'report', report, false);
- var query = _this.viewModel.get('report.query') || [];
- var columns = _this.viewModel.get('report.columns') || [];
- var summary = _this.viewModel.get('report.summary') || [];
- var querySql = _this.viewModel.get('querySql');
- var summarySql = _this.viewModel.get('summarySql');
- _this.refs.gridCondition.setData(query);
- _this.refs.gridColumn.setData(columns);
- _this.refs.gridSum.setData(summary);
- _this.refs.sqlEditor.setCode(querySql);
- _this.refs.sqlSumEditor.setCode(summarySql);
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- ReportDesign.prototype.addCondition = function () {
- this.refs.gridCondition.appendEditRow({
- conditionFieldBind: '',
- conditionFieldLabel: '',
- conditionFieldXtype: 'textfield',
- conditionFieldFlex: 1,
- conditionFieldDict: '',
- conditionFieldWrap: false,
- conditionFieldExtend: '{}',
- }, 'conditionFieldBind');
- };
- ReportDesign.prototype.removeCondition = function () {
- var _this = this;
- var rows = [];
- this.refs.gridCondition.getSelectionModel().getSelected().eachRow(function (r) {
- rows.push(r);
- });
- _.forEach(rows, function (r) {
- _this.refs.gridCondition.getStore().remove(r);
- });
- };
- ReportDesign.prototype.moveUp = function (sender) {
- var grid = sender.up('grid');
- grid.rowMoveUp();
- };
- ReportDesign.prototype.moveDown = function (sender) {
- var grid = sender.up('grid');
- grid.rowMoveDown();
- };
- ReportDesign.prototype.calcCondition = function () {
- var _this = this;
- var sql = this.refs.sqlEditor.getCode();
- var re = sql.matchAll(/#{(.+?)}/gi);
- var rows = this.refs.gridCondition.getDataRows();
- this.refs.gridCondition.setLoading(true);
- Promise.all([
- parseDynamicSqlApi(sql),
- instance$1.reloadIfNeedPromise(),
- ]).then(function (_a) {
- var e_1, _b;
- var _c = __read(_a, 1), res1 = _c[0];
- if (res1.success) {
- var tables_1 = [];
- _.forEach(res1.data, function (parseItem) {
- var tableName = parseItem.tableName, columnName = parseItem.columnName;
- if (tableName && !_.includes(tables_1, tableName)) {
- tables_1.push(tableName);
- }
- });
- var _loop_1 = function (m) {
- var e_2, _a;
- var columnName = m[1];
- // 没有这个列才添加
- if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
- var meta = undefined;
- try {
- 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()) {
- var tableName = tables_2_1.value;
- meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
- if (meta) {
- break;
- }
- }
- }
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
- finally {
- try {
- if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
- }
- finally { if (e_2) throw e_2.error; }
- }
- if (meta) {
- // 找到元数据
- var r = {
- conditionFieldBind: meta.column_name,
- conditionFieldLabel: meta.column_comment,
- conditionFieldXtype: 'textfield',
- conditionFieldFlex: 1,
- conditionFieldDict: '',
- conditionFieldWrap: false,
- conditionFieldExtend: '{}',
- };
- if (meta.column_ui === 'combo' && meta.column_dict) {
- r.conditionFieldXtype = 'combo';
- r.conditionFieldDict = meta.column_dict;
- }
- else if (meta.column_ui === "checkbox") {
- r.conditionFieldXtype = 'checkbox';
- }
- else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
- r.conditionFieldXtype = 'numberfield';
- }
- _this.refs.gridCondition.appendEditRow(r);
- }
- else {
- // 没找到元数据,直接添加
- _this.refs.gridCondition.appendEditRow({
- conditionFieldBind: columnName,
- conditionFieldLabel: '',
- conditionFieldXtype: 'textfield',
- conditionFieldFlex: 1,
- conditionFieldDict: '',
- conditionFieldWrap: false,
- conditionFieldExtend: '{}',
- });
- }
- }
- };
- try {
- for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
- var m = re_1_1.value;
- _loop_1(m);
- }
- }
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
- finally {
- try {
- if (re_1_1 && !re_1_1.done && (_b = re_1.return)) _b.call(re_1);
- }
- finally { if (e_1) throw e_1.error; }
- }
- }
- }).finally(function () {
- _this.refs.gridCondition.setLoading(false);
- });
- };
- ReportDesign.prototype.addColumn = function () {
- this.refs.gridColumn.appendEditRow({
- dataIndex: '',
- header: '',
- xtype: '',
- dataType: '',
- width: '',
- dict: '',
- align: '',
- filterable: true,
- hidden: false,
- sortable: true,
- fieldExtend: '{}',
- }, 'header');
- };
- ReportDesign.prototype.removeColumn = function () {
- var _this = this;
- var rows = [];
- this.refs.gridColumn.getSelectionModel().getSelected().eachRow(function (r) {
- rows.push(r);
- });
- _.forEach(rows, function (r) {
- _this.refs.gridColumn.getStore().remove(r);
- });
- };
- ReportDesign.prototype.calcColumn = function () {
- var _this = this;
- var sql = this.refs.sqlEditor.getCode();
- this.refs.gridColumn.setLoading(true);
- var rows = this.refs.gridColumn.getDataRows();
- Promise.all([
- parseDynamicSqlApi(sql),
- instance$1.reloadIfNeedPromise(),
- ]).then(function (_a) {
- var _b = __read(_a, 1), res1 = _b[0];
- if (res1.success) {
- _.forEach(res1.data, function (parseItem) {
- var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
- // 是否找到重复字段
- var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
- if (exists) {
- if ((columnTypeName || "").toLowerCase() === "number") {
- var record = _this.refs.gridColumn.store.getAt(_.findIndex(rows, function (r) { return r.dataIndex === columnName; }));
- if (record) {
- record.set("dataType", "number");
- record.set("align", "end");
- }
- }
- return;
- }
- if (tableName) {
- // 解出表格名和字段名
- var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
- if (meta) {
- // 找到了元数据
- var r = {
- dataIndex: meta.column_name,
- header: meta.column_comment,
- xtype: '',
- dataType: '',
- width: '',
- dict: '',
- align: '',
- filterable: true,
- hidden: false,
- sortable: true,
- fieldExtend: '{}',
- };
- if (meta.column_ui === 'combo' && meta.column_dict) {
- r.dict = meta.column_dict;
- }
- else if (meta.column_ui === "checkbox") {
- r.xtype = 'checkbox';
- }
- else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
- r.dataType = meta.data_type;
- r.align = 'end';
- }
- if ((columnTypeName || "").toLowerCase() === "number") {
- r.dataType = "number";
- r.align = 'end';
- }
- _this.refs.gridColumn.appendEditRow(r);
- return;
- }
- }
- if (columnName) {
- // 解出字段名
- var r = {
- dataIndex: columnName,
- header: columnName,
- xtype: '',
- dataType: '',
- width: '',
- dict: '',
- align: '',
- filterable: true,
- hidden: false,
- sortable: true,
- fieldExtend: '{}',
- };
- if ((columnTypeName || "").toLowerCase() === "number") {
- r.dataType = "number";
- r.align = 'end';
- }
- _this.refs.gridColumn.appendEditRow(r);
- }
- });
- }
- }).finally(function () {
- _this.refs.gridColumn.setLoading(false);
- });
- };
- ReportDesign.prototype.addSum = function () {
- this.refs.gridSum.appendEditRow({
- sumFieldBind: '',
- sumFieldLabel: '',
- sumFieldFlex: 1,
- sumFieldWrap: false,
- sumFieldExtend: '{}',
- }, 'sumFieldBind');
- };
- ReportDesign.prototype.removeSum = function () {
- var _this = this;
- var rows = [];
- this.refs.gridSum.getSelectionModel().getSelected().eachRow(function (r) {
- rows.push(r);
- });
- _.forEach(rows, function (r) {
- _this.refs.gridSum.getStore().remove(r);
- });
- };
- ReportDesign.prototype.calcSum = function () {
- var _this = this;
- var sql = this.refs.sqlSumEditor.getCode();
- var rows = this.refs.gridSum.getDataRows();
- this.refs.gridSum.setLoading(true);
- parseDynamicSqlApi(sql).then(function (res1) {
- if (res1.success) {
- _.forEach(res1.data, function (parseItem) {
- var tableName = parseItem.tableName, columnName = parseItem.columnName;
- // 是否找到重复字段
- if (_.find(rows, function (r) { return r.sumFieldBind === columnName; })) {
- return;
- }
- if (columnName) {
- // 解出字段名
- _this.refs.gridSum.appendEditRow({
- sumFieldBind: columnName,
- sumFieldLabel: columnName,
- sumFieldFlex: 1,
- sumFieldWrap: false,
- sumFieldExtend: '{}',
- });
- }
- });
- }
- }).finally(function () {
- _this.refs.gridSum.setLoading(false);
- });
- };
- Object.defineProperty(ReportDesign.prototype, "reportId", {
- get: function () {
- return this.viewModel.get('report_id');
- },
- enumerable: true,
- configurable: true
- });
- return ReportDesign;
- }(Scope));
- var model$5 = {
- data: {
- originalTableInfo: {
- table_name: '',
- description: '',
- },
- hasChanged: false,
- schema_name: undefined,
- table_name: undefined,
- column_name: undefined,
- tableInfo: {
- schema_name: '',
- table_name: '',
- description: '',
- biz_category: '',
- note: '',
- archive_enable: false,
- archive_cron: '',
- archive_condition: '',
- column_list: []
- },
- },
- formulas: {
- shouldSave: function (get) {
- // console.log("-->", get('grid1.ischanged'))
- return get('grid1.ischanged')
- || _.trim(get('originalTableInfo.table_name')) !== _.trim(get('tableInfo.table_name'))
- || _.trim(get('originalTableInfo.description')) !== _.trim(get('tableInfo.description'));
- },
- },
- };
- var vjson$5 = {
- bind: {
- title: '{tableName}{shouldSave?" *":""}',
- },
- layout: 'fit',
- items: [
- {
- layout: 'border',
- tbar: {
- xtype: 'toolbar',
- items: [
- // {
- // xtype: 'button',
- // text: '拉取库结构',
- // iconCls: 'x-fa fa-cloud-download',
- // listeners: {
- // click: 'scope.pullFromDb'
- // }
- // },
- {
- xtype: 'button',
- text: '保存至数据库',
- iconCls: 'x-fa fa-save',
- bind: {
- disabled: '{!shouldSave}'
- },
- listeners: {
- click: 'scope.pushToDb'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '刷新 QueryDSL',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'scope.syncQueryDSL'
- }
- },
- {
- xtype: 'button',
- text: '生成 DDL',
- iconCls: 'x-fa fa-file-text',
- listeners: {
- click: 'scope.buildDDL'
- }
- }
- ]
- },
- items: [
- {
- region: 'center',
- xtype: 'tabpanel',
- items: [
- {
- title: '字段',
- xtype: 'yvgrid',
- selModel: {
- type: 'spreadsheet',
- columnSelect: true,
- pruneRemoved: false,
- extensible: 'y'
- },
- enableLocking: false,
- idField: 'column_name',
- plugins: {
- clipboard: true,
- selectionreplicator: true
- },
- reference: 'grid1',
- pagination: false,
- // hideFootbar: true,
- tbar: {
- xtype: 'form',
- items: [
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '表格名',
- reference: 'text_table_name',
- readOnly: true,
- bind: {
- value: '{tableInfo.table_name}'
- }
- },
- {
- xtype: 'textfield',
- fieldLabel: '描述',
- // readOnly: true,
- bind: {
- value: '{tableInfo.description}'
- }
- },
- ]
- },
- {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'scope.addField'
- }
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.removeField'
- }
- },
- ]
- },
- ]
- },
- listeners: {
- editbefore: 'scope.gridEditBefore'
- },
- columns: [
- {
- text: '字段名', dataIndex: 'column_name',
- sortable: false,
- menuDisabled: true,
- width: 120,
- editor: {
- allowBlank: true,
- selectOnFocus: false
- }
- },
- {
- text: '字段中文', dataIndex: 'column_comment',
- width: 130,
- sortable: false,
- menuDisabled: true,
- editor: {
- allowBlank: true,
- selectOnFocus: false
- }
- },
- {
- text: '主键', dataIndex: 'is_primary_key',
- xtype: 'checkcolumn', sortable: false, menuDisabled: true,
- width: 48, resizable: false,
- },
- {
- text: '必填', dataIndex: 'not_null',
- xtype: 'checkcolumn', sortable: false, menuDisabled: true,
- width: 48, resizable: false,
- },
- {
- text: '字段域', dataIndex: 'column_domain',
- sortable: false, menuDisabled: true,
- width: 148,
- dict: 'column_domain',
- editor: {
- xtype: 'combo',
- allowBlank: true,
- selectOnFocus: true,
- // fix: ['system.getDict("column_domain")'],
- dict: 'column_domain',
- listConfig: {
- minWidth: 200
- },
- listeners: {
- change: 'scope.columnDomainChange',
- }
- }
- },
- {
- text: '数据类型', dataIndex: 'data_type',
- sortable: false, menuDisabled: true,
- editor: { allowBlank: true, selectOnFocus: true }
- },
- {
- text: '长度', dataIndex: 'column_size',
- sortable: false, menuDisabled: true,
- xtype: 'numbercolumn', format: '0',
- editor: { allowBlank: true, selectOnFocus: true }
- },
- {
- text: '小数位', dataIndex: 'decimal_digits',
- sortable: false, menuDisabled: true,
- xtype: 'numbercolumn', format: '0',
- editor: { allowBlank: true, selectOnFocus: true }
- },
- {
- text: '默认值', dataIndex: 'default_value',
- sortable: false, menuDisabled: true,
- editor: { allowBlank: true, selectOnFocus: true }
- },
- {
- text: '字典', dataIndex: 'column_dict',
- sortable: false, menuDisabled: true,
- // fix: ['system.getDict("DICT")'],
- width: 200,
- editor: {
- xtype: 'combo',
- allowBlank: true,
- listConfig: {
- minWidth: 350
- },
- }
- },
- {
- text: 'UI建议', dataIndex: 'column_ui',
- sortable: false, menuDisabled: true,
- // fix: ['system.getDict("column_ui")'],
- editor: {
- xtype: 'combo',
- allowBlank: true,
- listConfig: {
- minWidth: 200
- },
- }
- },
- {
- text: '详细描述', dataIndex: 'column_note',
- sortable: false, menuDisabled: true,
- editor: { allowBlank: true, }
- },
- ]
- },
- {
- title: '高级属性',
- xtype: 'form',
- items: [
- // {
- // xtype: 'textfield',
- // fieldLabel: '表格名',
- // bind: {
- // value: '{tableName}'
- // }
- // },
- // {
- // xtype: 'textfield',
- // fieldLabel: '中文含义',
- // bind: {
- // value: '{tableInfo.description}'
- // }
- // },
- {
- xtype: 'combo',
- fieldLabel: '业务类型',
- bind: {
- value: '{tableInfo.biz_category}'
- },
- store: [
- '基础资料',
- '系统',
- '账目与库存',
- '单据',
- '指令',
- '规则与流程',
- '开发辅助',
- ]
- },
- {
- xtype: 'textfield',
- fieldLabel: '详细描述',
- bind: {
- value: '{tableInfo.note}'
- },
- },
- {
- xtype: 'checkbox',
- fieldLabel: '允许归档',
- bind: "{tableInfo.archive_enable}",
- },
- {
- xtype: 'textfield',
- fieldLabel: '归档周期',
- bind: {
- value: '{tableInfo.archive_cron}',
- hidden: '{!tableInfo.archive_enable}',
- }
- },
- {
- xtype: 'textfield',
- fieldLabel: '归档条件',
- bind: {
- value: '{tableInfo.archive_condition}',
- hidden: '{!tableInfo.archive_enable}',
- }
- },
- ]
- },
- ]
- }
- ]
- },
- ]
- };
- var DbColumn = /** @class */ (function (_super) {
- __extends(DbColumn, _super);
- function DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate) {
- var _this = _super.call(this, {
- model: getModel(model$5, schemaName, tableName, columnName, isCreateTable),
- vjson: vjson$5
- }) || this;
- _this.isCreate = false;
- _this.isCreate = isCreate !== null && isCreate !== void 0 ? isCreate : false;
- return _this;
- }
- DbColumn.prototype.onLoad = function () {
- var _this = this;
- var _a, _b, _c, _d, _e, _f, _g, _h;
- console.log('me', this);
- this.refs.grid1.setData(this.viewModel.data.tableInfo.column_list);
- this.refs.grid1.autoSizeColumns();
- // this.refs.grid1.columns[0].hide()
- // 自动定位到选定的列
- if (this.viewModel.get('column_name')) {
- for (var i = 0; i < this.refs.grid1.store.data.items.length; i++) {
- if (this.refs.grid1.store.data.items[i].get('column_name') === this.viewModel.get('column_name')) {
- this.refs.grid1.setSelection(this.refs.grid1.store.data.items[i]);
- return;
- }
- }
- }
- instance.getColumnDomainComboData().then(function () {
- _this.checkDomain();
- });
- 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 : "");
- 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 : "");
- if (this.isCreate)
- (_h = (_g = this.refs) === null || _g === void 0 ? void 0 : _g.text_table_name) === null || _h === void 0 ? void 0 : _h.setReadOnly(false);
- };
- DbColumn.prototype.checkDomain = function () {
- // 走查一遍 domain
- // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
- var dbType = this.viewModel.get('tableInfo.db_type');
- var diffColumnName = [];
- var tableInfo = this.viewModel.get('tableInfo');
- this.refs.grid1.store.data.items.forEach(function (record) {
- var data = record.data;
- var column_domain = data.column_domain;
- var domain = instance.getColumnDomainById(column_domain);
- if (!domain) {
- // 没有找到 domain
- return;
- }
- var editRow = applyDomain(dbType, domain);
- // 字段跟领域做对比
- var compareResult = compareDomainApply(tableInfo, data, editRow, domain.is_fix_size);
- if (typeof compareResult === 'string') {
- // 不一样的情况下,要改成一致
- _$2.forOwn(editRow, function (value, key) {
- // 改成与 domain 一致
- record.set(key, value);
- });
- diffColumnName.push(data.column_name + '.' + compareResult);
- }
- });
- if (diffColumnName.length > 0) {
- showErrorDialog$1("\u6709" + diffColumnName.length + " \u4E2A\u5B57\u6BB5\u7684\u5B57\u6BB5\u57DF\u4E0D\u4E00\u81F4:<br /> " + diffColumnName.join('<br />'));
- }
- };
- DbColumn.prototype.addField = function () {
- this.refs.grid1.appendEditRow({
- column_name: '',
- column_comment: '',
- is_primary_key: false,
- not_null: true,
- column_domain: '',
- data_type: '',
- column_size: 0,
- decimal_digits: 0,
- default_value: '',
- column_dict: '',
- column_ui: '',
- column_note: '',
- }, 'column_name');
- };
- DbColumn.prototype.removeField = function () {
- var _this = this;
- var rows = [];
- this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
- rows.push(r);
- });
- _$2.forEach(rows, function (r) {
- _this.refs.grid1.getStore().remove(r);
- });
- };
- DbColumn.prototype.gridEditBefore = function (sender, editor, context, eOpts) {
- instance.getColumnDomainComboData().then(function (data) {
- editor.cmp.columns[5].getEditor().setStore({ data: data });
- });
- // 被字段域锁定的内容,不允许修改
- var record = context.record, field = context.field;
- var domainId = record.get('column_domain');
- if (!domainId) {
- return;
- }
- var domain = instance.getColumnDomainById(domainId);
- if (!domain) {
- msg$1('没有找到字段域' + domainId);
- return;
- }
- if (field === "data_type") {
- // 字段类型不允许修改
- context.cancel = true;
- return;
- }
- if (domain.is_fix_size &&
- (field === "column_size" ||
- field === "decimal_digits")) {
- // 锁定长度的情况下,大小不允许修改
- context.cancel = true;
- return;
- }
- if (domain.is_fix_default_value && field === "default_value") {
- // 锁定默认值的情况下,默认值不允许修改
- context.cancel = true;
- return;
- }
- };
- DbColumn.prototype.columnDomainChange = function (editor, newValue, oldValue, event) {
- if (!newValue) {
- return;
- }
- var grid = editor.up('grid').ownerGrid;
- var domain = instance.getColumnDomainById(newValue);
- if (!domain) {
- msg$1('没有找到 domain:' + newValue);
- return;
- }
- // 获取到数据类型 mysql_datatype / oracle_datatype / pgsql_datatype / sqlserver_datatype
- var dbType = this.viewModel.get('tableInfo.db_type');
- var editRow = applyDomain(dbType, domain);
- grid.setEditRow(editRow);
- };
- DbColumn.prototype.pullFromDb = function () {
- };
- DbColumn.prototype.pushToDb = function (sender) {
- var _this = this;
- // 设置当前界面为 "保存中..." 状态
- var me = this;
- var _a = this.viewModel.data.tableInfo, table_name = _a.table_name, schema_name = _a.schema_name;
- this.viewModel.set('tableInfo.table_name', table_name);
- this.viewModel.set('tableInfo.schema_name', schema_name);
- var tableInfo = this.viewModel.get('tableInfo');
- var column_list = this.refs.grid1.getDataRows();
- var hasError = false;
- if (column_list.length <= 0) {
- msg$1("\u81F3\u5C11\u8981\u6709\u4E00\u4E2A\u5B57\u6BB5\uFF01");
- hasError = true;
- }
- var columnNameExistsCheck = {};
- _$2.forEach(column_list, function (row, i) {
- var checkResult = checkColumn(tableInfo, row);
- if (typeof checkResult !== 'undefined') {
- msg$1(checkResult);
- hasError = true;
- _this.refs.grid1.beginEdit(i, 'column_name');
- return false;
- }
- if (!row.column_domain || row.column_domain === '0') {
- msg$1("\u5B57\u6BB5\u57DF\u4E0D\u80FD\u4E3A\u7A7A\uFF01");
- hasError = true;
- _this.refs.grid1.beginEdit(i, 'column_domain');
- return false;
- }
- if (isEmpty(row.data_type)) {
- msg$1("\u5B57\u6BB5\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A");
- hasError = true;
- _this.refs.grid1.beginEdit(i, 'data_type');
- return false;
- }
- if (_$2.has(columnNameExistsCheck, row.column_name)) {
- // 列名已存在
- msg$1("\u5B57\u6BB5\u540D" + row.column_name + " \u5DF2\u5B58\u5728!");
- hasError = true;
- _this.refs.grid1.beginEdit(i, 'column_name');
- return false;
- }
- columnNameExistsCheck[row.column_name] = true;
- });
- if (hasError)
- return;
- // 保存 Ex 数据,并生成 DDL 让用户决策是否执行 DDL
- me.setLoading(true);
- instance$1.saveMetaExBuildDDLPromise(schema_name, table_name, tableInfo, column_list)
- .then(function (res) {
- var _a;
- if (typeof ((_a = res.data) === null || _a === void 0 ? void 0 : _a.ddl) === 'string') {
- // 返回 DDL 就要显示出来
- var window_1 = Ext.create('Ext.window.Window', {
- title: 'SQL 预览',
- height: 400,
- width: 600,
- modal: true,
- animateTarget: sender,
- maximizable: true,
- layout: 'fit',
- items: {
- xtype: 'sqleditor',
- value: res.data.ddl
- },
- buttons: [
- {
- xtype: 'button',
- text: '执行',
- iconCls: 'x-fa fa-save',
- handler: function (sender) {
- var editor = sender.up('window').down('sqleditor');
- var ddl = editor.getValue();
- me.pushToDbCommit(schema_name, table_name, ddl, window_1);
- }
- },
- {
- xtype: 'button',
- text: '取消',
- iconCls: 'x-fa fa-times',
- handler: function () {
- window_1.close();
- }
- }
- ]
- }).show();
- return;
- }
- var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
- var tableRow = instance$1.getTableByName(schema_name, table_name);
- if (!tableRow) {
- // throw Error('没有找到 table', schemaName, tableName, columnName)
- console.log('这是一个新 table');
- instance$1.appendNewTable(tableInfo);
- }
- _this.viewModel.set('schema_name', schema_name);
- _this.viewModel.set('table_name', table_name);
- _this.viewModel.set('tableInfo', tableInfo);
- _this.refs.grid1.setData(tableInfo.column_list);
- if (tableRow)
- Object.assign(tableRow, tableInfo);
- msg$1('保存成功');
- _this.viewModel.set('hasChanged', false);
- })
- .finally(function () {
- me.setLoading(false);
- });
- };
- DbColumn.prototype.pushToDbCommit = function (schema_name, table_name, ddl, window) {
- var _this = this;
- window.setLoading(true);
- instance$1.pushToDbCommit({ schema_name: schema_name, table_name: table_name, ddl: ddl })
- .then(function (res) {
- var _a, _b, _c, _d;
- var tableInfo = _$2.cloneDeep(res.data[0].table_list[0]);
- // 保存成功就提示一下,并重新载入数据
- msg$1(res.msg);
- instance$1.reloadForce(undefined);
- var tableRow = instance$1.getTableByName(schema_name, table_name);
- if (!tableRow) {
- // throw Error('没有找到 table', schemaName, tableName, columnName)
- console.log('这是一个新 table');
- instance$1.appendNewTable(tableInfo);
- }
- _this.viewModel.set('schema_name', schema_name);
- _this.viewModel.set('table_name', table_name);
- _this.viewModel.set('tableInfo', tableInfo);
- _this.refs.grid1.setData(tableInfo.column_list);
- if (tableRow)
- Object.assign(tableRow, tableInfo);
- instance$1.notifyRefresh();
- window.close();
- _this.viewModel.set('hasChanged', false);
- _this.viewModel.set('originalTableInfo.table_name', (_a = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.table_name) !== null && _a !== void 0 ? _a : "");
- _this.viewModel.set('originalTableInfo.description', (_b = tableInfo === null || tableInfo === void 0 ? void 0 : tableInfo.description) !== null && _b !== void 0 ? _b : "");
- (_d = (_c = _this.refs) === null || _c === void 0 ? void 0 : _c.text_table_name) === null || _d === void 0 ? void 0 : _d.setReadOnly(true);
- })
- .finally(function () {
- // 无论正常异常,关闭 "保存中..." 状态
- window.setLoading(false);
- });
- };
- DbColumn.prototype.syncQueryDSL = function () {
- var _this = this;
- var tableInfo = this.viewModel.get("tableInfo");
- this.setLoading(true);
- syncQueryDSL({ schema_name: tableInfo.schema_name, table_name: tableInfo.table_name })
- .then(function () {
- msg$1("\u5237\u65B0 QueryDSL\u6210\u529F!");
- })
- .finally(function () {
- _this.setLoading(false);
- });
- };
- DbColumn.prototype.buildDDL = function () {
- };
- return DbColumn;
- }(Scope));
- function getModel(model, schemaName, tableName, columnName, isCreateTable) {
- model.data.schema_name = schemaName;
- model.data.table_name = tableName;
- model.data.column_name = columnName;
- if (isCreateTable) {
- var dbType = instance$1.getSchemaDbType(schemaName);
- if (!dbType) {
- throw Error('无法识别数据库类型' + schemaName);
- }
- model.data.tableInfo.schema_name = model.data.schema_name;
- model.data.tableInfo.table_name = model.data.table_name;
- model.data.tableInfo.db_type = dbType;
- model.data.tableInfo.column_list = [];
- model.data.tableInfo.is_create = true;
- return model;
- }
- var tableRow = instance$1.getTableByName(schemaName, tableName);
- if (!tableRow) {
- throw Error('没有找到 table' + schemaName + tableName + columnName);
- }
- model.data.tableInfo = _$2.cloneDeep(tableRow);
- model.data.tableInfo.is_create = false;
- // model.data.tableInfo.attributes = JSON.parse(tableRow.attributes)
- return model;
- }
- var model$6 = {
- data: {
- id: '',
- path: '',
- form: {
- title: '',
- sqlId: '',
- }
- }
- };
- var vjson$6 = {
- bind: {
- title: '{title}',
- },
- layout: 'fit',
- items: [
- {
- layout: 'border',
- items: [
- {
- region: 'center',
- layout: 'border',
- items: [
- {
- region: 'north',
- items: [
- {
- xtype: 'toolbar',
- border: false,
- items: [
- {
- xtype: 'button',
- text: '刷新',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'scope.load'
- }
- },
- {
- xtype: 'button',
- text: '保存',
- iconCls: 'x-fa fa-save',
- listeners: {
- click: 'scope.widgetSave'
- }
- },
- {
- xtype: 'button',
- text: '预览',
- iconCls: 'x-fa fa-play-circle-o',
- listeners: {
- //click: 'scope.preview'
- }
- },
- {
- xtype: 'textfield',
- fieldLabel: '弹窗文件',
- reference: "wPath",
- labelWidth: 80,
- //width: 200,
- bind: {
- value: '{widgetPath}',
- },
- readOnly: true,
- },
- {
- xtype: 'textfield',
- fieldLabel: '弹窗名称',
- reference: "wTitle",
- labelWidth: 80,
- //width: 200,
- bind: {
- value: '{form.title}',
- },
- readOnly: true,
- },
- {
- xtype: 'textfield',
- fieldLabel: 'sqlId',
- bind: {
- value: '{form.sqlId}',
- },
- readOnly: true,
- },
- ]
- },
- ]
- },
- {
- xtype: 'tabpanel', region: 'center', plain: true, border: false,
- items: [
- {
- title: "SQL和条件",
- layout: 'border',
- border: false,
- items: [
- {
- region: 'north',
- height: 200,
- xtype: 'yvgrid',
- reference: "grid2",
- split: true,
- selModel: {
- selType: 'rowmodel',
- mode: 'SINGLE',
- },
- store: {},
- pagination: false,
- hideFootbar: true,
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {}
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.delCondition'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '上移',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- //click: 'scope.saveAll'
- }
- },
- {
- xtype: 'button',
- text: '下移',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- //click: 'scope.saveAll'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '自动分析',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'scope.calcCondition'
- }
- },
- ]
- },
- columns: [
- {
- text: '条件变量',
- dataIndex: 'conditionFieldBind',
- width: 140,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '中文标题',
- dataIndex: 'conditionFieldLabel',
- width: 120,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '编辑类型',
- dataIndex: 'xtype',
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- typeAhead: true,
- triggerAction: 'all',
- selectOnFocus: true,
- store: [
- ['textfield', 'textfield'],
- ['combo', 'combo'],
- ['datefield', 'datefield'],
- ['datetimefield', 'datetimefield'],
- ['numberfield', 'numberfield'],
- ['multiplesearch', 'multiplesearch'],
- ]
- }
- },
- {
- text: '权重',
- dataIndex: 'conditionFieldFlex',
- align: 'right',
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'numberfield',
- selectOnFocus: false,
- minValue: 0,
- maxValue: 10
- },
- },
- {
- text: '字典',
- dataIndex: 'conditionFieldDict',
- width: 160,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: false
- },
- },
- {
- xtype: 'checkcolumn',
- dataIndex: "conditionFieldWrap", header: "换行",
- width: 65,
- sortable: false,
- menuDisabled: true,
- },
- ]
- },
- {
- region: 'center',
- xtype: 'sqleditor',
- layout: 'fit',
- reference: 'sqlEditor',
- split: true,
- bind: {
- value: "{form.sql}"
- },
- },
- ]
- },
- {
- title: "结果字段定义",
- border: false,
- xtype: 'yvgrid',
- reference: "grid3",
- selModel: {
- selType: 'rowmodel',
- mode: 'SINGLE',
- },
- store: {},
- pagination: false,
- hideFootbar: true,
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {}
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.delColumn'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '上移',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- //click: 'scope.saveAll'
- }
- },
- {
- xtype: 'button',
- text: '下移',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- //click: 'scope.saveAll'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '自动分析',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'scope.calcColumn'
- }
- },
- ]
- },
- columns: [
- { xtype: 'rownumberer' },
- {
- text: '字段',
- dataIndex: 'dataIndex',
- width: 140,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '标题',
- dataIndex: 'header',
- width: 120,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '显示类型',
- dataIndex: 'xtype',
- width: 90,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- typeAhead: true,
- triggerAction: 'all',
- selectOnFocus: true,
- store: [
- ['', ''],
- ['rownum', 'rownum'],
- ['button', 'button'],
- ['checkbox', 'checkbox'],
- ['progres', 'progres'],
- ]
- }
- },
- {
- text: '数据类型',
- dataIndex: 'dataType',
- width: 90,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- typeAhead: true,
- triggerAction: 'all',
- selectOnFocus: true,
- store: [
- ['', ''],
- ['string', 'string'],
- ['number', 'number'],
- ['date', 'date'],
- ]
- }
- },
- {
- text: '数据字典',
- dataIndex: 'dict',
- sortable: false,
- menuDisabled: true,
- width: 120,
- editor: {
- selectOnFocus: true,
- },
- },
- ],
- },
- ]
- },
- ]
- },
- ]
- }
- ]
- }; //
- //
- var WidgetDesign = /** @class */ (function (_super) {
- __extends(WidgetDesign, _super);
- function WidgetDesign(widgetPath, widgetName) {
- var _this = _super.call(this, { model: model$6, vjson: vjson$6 }) || this;
- _this.widgetPath = widgetPath;
- _this.widgetName = widgetName;
- return _this;
- }
- WidgetDesign.prototype.onLoad = function () {
- if (this.widgetPath) {
- this.loadForm(this.widgetPath);
- this.viewModel.set("widgetPath", this.widgetPath);
- this.refs.wTitle.setReadOnly(true);
- this.refs.wPath.setReadOnly(true);
- }
- else {
- this.refs.wTitle.setReadOnly(false);
- this.refs.wPath.setReadOnly(false);
- }
- };
- WidgetDesign.prototype.load = function () {
- var widgetPath = this.viewModel.get("widgetPath");
- if (widgetPath) {
- this.loadForm(widgetPath);
- }
- };
- WidgetDesign.prototype.loadForm = function (widgetPath) {
- var _this = this;
- var me = this;
- me.setLoading(true);
- readWidget({ widgetPath: widgetPath }).then(function (res) {
- msg$1(res.msg);
- if (res.success) {
- _this.viewModel.set("widgetPath", widgetPath);
- me.refs.grid3.getStore().removeAll();
- if (res.data.form.columns) {
- me.refs.grid3.getStore().add(res.data.form.columns.filter(function (r) { return r != null; }));
- }
- _this.viewModel.set("form.title", res.data.form.title);
- _this.viewModel.set("form.sqlId", res.data.form.dataSource.params.sqlId);
- // set sql
- _this.refs.sqlEditor.setCode(res.data.sql);
- }
- }).finally(function () {
- me.setLoading(false);
- });
- };
- WidgetDesign.prototype.widgetAdd = function (sender) {
- var _this = this;
- var title = this.viewModel.get("form.title");
- if (title) {
- Ext.Msg.confirm('提示', "是否保存【" + title + "】后再新增弹框?", function (btn) {
- if (btn == 'yes') {
- alert(1);
- }
- else {
- alert(2);
- }
- });
- }
- else {
- var me_1 = this;
- var win_1 = new Ext.Window({
- autoDestroy: true,
- title: "新建弹框",
- width: 400,
- height: 220,
- resizable: true,
- closable: true,
- maximizable: true,
- minimizable: true,
- plain: true,
- // constrainHeader: true,
- constrain: true,
- layout: 'fit',
- animateTarget: sender,
- buttonAlign: 'center',
- items: [
- {
- xtype: "form",
- layout: "hbox",
- margin: '10px 20px',
- border: 0,
- items: [
- {
- flex: 1,
- layout: 'vbox',
- items: [
- {
- xtype: "textfield",
- name: "widgetcode",
- fieldLabel: "弹框编号",
- flex: 1,
- allowBlank: false,
- regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
- regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
- labelWidth: 50,
- width: "100%",
- },
- {
- xtype: "textfield",
- name: "widgetname",
- fieldLabel: "弹框名称",
- flex: 1,
- allowBlank: false,
- labelWidth: 50,
- width: "100%",
- },
- ]
- },
- ]
- }
- ],
- //窗口按钮
- buttons: [
- {
- xtype: 'button', text: '保存', handler: function (btn) {
- //窗口获取表单
- var form = win_1.down('form');
- var vaildSuccess = form.isValid();
- if (!vaildSuccess) {
- return;
- }
- var title = form.down('textfield[name="widgetname"]').getValue();
- var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
- me_1.viewModel.set("form.title", title);
- me_1.viewModel.set("widgetPath", widgetPath);
- var formdata = _this.viewModel.get("form");
- saveWidget({ widgetPath: widgetPath, form: formdata }).then(function (res) {
- if (res.success) {
- msg$1('添加成功');
- }
- me_1.loadForm(widgetPath);
- win_1.close();
- });
- }
- },
- {
- xtype: 'button', text: '取消', handler: function (btn) {
- //窗口关闭
- win_1.close();
- }
- }
- ]
- });
- win_1.show();
- }
- };
- WidgetDesign.prototype.widgetSave = function () {
- var _this = this;
- var _a, _b;
- var widgetPath = this.viewModel.get("widgetPath");
- if (!widgetPath) {
- msg$1("请选择或添加弹框后再保存!");
- return;
- }
- var title = this.viewModel.get("form.title");
- if (!title) {
- msg$1("请选择或添加弹框后再保存!");
- return;
- }
- // 获取条件
- 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) {
- delete r.id;
- return r;
- });
- this.viewModel.set("form.conditions", conditions);
- // 获取查询列
- 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) {
- delete r.id;
- if (r.dict) {
- r.fix = ["system.getDict('" + r.dict.toUpperCase() + "')"];
- }
- return r;
- });
- this.viewModel.set("form.columns", columns);
- // sql
- var sql = this.refs.sqlEditor.getCode();
- this.viewModel.set("form.sql", sql);
- var form = this.viewModel.get("form");
- saveWidget({ widgetPath: widgetPath, form: form }).then(function (res) {
- msg$1(res.msg);
- if (res.success) {
- msg$1('保存成功');
- _this.loadForm(widgetPath);
- }
- }).catch(function (res) {
- });
- };
- WidgetDesign.prototype.delCondition = function () {
- var _a;
- this.refs.grid2.getStore().remove((_a = this.refs.grid2.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
- };
- WidgetDesign.prototype.delColumn = function () {
- var _a;
- this.refs.grid3.getStore().remove((_a = this.refs.grid3.selModel.selected) === null || _a === void 0 ? void 0 : _a.items);
- };
- WidgetDesign.prototype.calcCondition = function () {
- var _this = this;
- var sql = this.refs.sqlEditor.getCode();
- var re = sql.matchAll(/#{(.+?)}/gi);
- var rows = this.refs.grid2.getDataRows();
- this.refs.grid2.setLoading(true);
- parseDynamicSqlApi(sql).then(function (res) {
- var e_1, _a;
- if (res.success) {
- var tables_1 = [];
- _.forEach(res.data, function (parseItem) {
- var tableName = parseItem.tableName, columnName = parseItem.columnName;
- if (tableName && !_.includes(tables_1, tableName)) {
- tables_1.push(tableName);
- }
- });
- var _loop_1 = function (m) {
- var e_2, _a;
- var columnName = m[1];
- // 没有这个列才添加
- if (!_.find(rows, function (r) { return r.conditionFieldBind === columnName; })) {
- var meta = undefined;
- try {
- 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()) {
- var tableName = tables_2_1.value;
- meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
- if (meta) {
- break;
- }
- }
- }
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
- finally {
- try {
- if (tables_2_1 && !tables_2_1.done && (_a = tables_2.return)) _a.call(tables_2);
- }
- finally { if (e_2) throw e_2.error; }
- }
- if (meta) {
- // 没找到元数据,直接添加
- _this.refs.grid2.appendEditRow({
- conditionFieldBind: columnName,
- conditionFieldLabel: meta.column_comment,
- conditionFieldXtype: 'textfield',
- conditionFieldFlex: 1,
- conditionFieldDict: '',
- conditionFieldWrap: false,
- });
- }
- else {
- _this.refs.grid2.appendEditRow({
- conditionFieldBind: columnName,
- conditionFieldLabel: '',
- conditionFieldXtype: 'textfield',
- conditionFieldFlex: 1,
- conditionFieldDict: '',
- conditionFieldWrap: false,
- });
- }
- }
- };
- try {
- for (var re_1 = __values(re), re_1_1 = re_1.next(); !re_1_1.done; re_1_1 = re_1.next()) {
- var m = re_1_1.value;
- _loop_1(m);
- }
- }
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
- finally {
- try {
- if (re_1_1 && !re_1_1.done && (_a = re_1.return)) _a.call(re_1);
- }
- finally { if (e_1) throw e_1.error; }
- }
- }
- }).finally(function () {
- _this.refs.grid2.setLoading(false);
- });
- };
- WidgetDesign.prototype.calcColumn = function () {
- var _this = this;
- var sql = this.refs.sqlEditor.getCode();
- var rows = this.refs.grid3.getDataRows();
- this.refs.grid3.setLoading(true);
- parseDynamicSqlApi(sql).then(function (res) {
- _.forEach(res.data, function (parseItem) {
- var tableName = parseItem.tableName, columnName = parseItem.columnName, columnTypeName = parseItem.columnTypeName;
- // 是否找到重复字段
- var exists = _.find(rows, function (r) { return r.dataIndex === columnName; });
- if (exists) {
- return;
- }
- if (tableName) {
- // 解出表格名和字段名
- var meta = instance$1.getColumnByTableNameColumnName(tableName, columnName);
- if (meta) {
- // 找到了元数据
- var r = {
- dataIndex: meta.column_name,
- header: meta.column_comment,
- xtype: '',
- dataType: 'string',
- dict: '',
- };
- if (meta.column_ui === 'combo' && meta.column_dict) {
- r.dict = meta.column_dict;
- }
- else if (meta.column_ui === "checkbox") {
- r.xtype = 'checkbox';
- }
- else if (meta.data_type === 'number' && !meta.column_dict && meta.column_size <= 10) {
- r.dataType = meta.data_type;
- }
- _this.refs.grid3.appendEditRow(r);
- return;
- }
- }
- if (columnName) {
- // 解出字段名
- var r = {
- dataIndex: columnName,
- header: columnName,
- xtype: '',
- dataType: 'string',
- dict: '',
- };
- _this.refs.grid3.appendEditRow(r);
- }
- });
- }).finally(function () {
- _this.refs.grid3.setLoading(false);
- });
- };
- return WidgetDesign;
- }(Scope));
- var model$7 = {
- data: {
- // spreadsheet: false,
- // multSelect: false,
- // showCheckColumn: false,
- // checkColumncheckOnly: false,
- // disableSelection: false,
- vjson: {
- reference: '',
- pagination: false,
- pageSize: false,
- pageSizeOption: false,
- hideFootbar: false,
- hideRefresh: false,
- hideExport: false,
- hideAutoSize: false,
- hideClearFilter: false,
- hideSaveGridUIConfig: false,
- hideClearGridUIConfig: false,
- selectMode: '',
- cellediting_clicksToEdit: 1,
- columnLines: false,
- rowLines: false,
- border: false,
- autoLoad: false,
- remoteSort: false,
- remoteFilter: false,
- enableLocking: false,
- enableColumnHide: false,
- enableColumnMove: false,
- gridfilters: false,
- enableColumnResize: false,
- sortOnClick: false,
- hidden: false,
- cls: '',
- dataSource: {
- url: '',
- params: {
- formData: '{form}',
- },
- },
- listeners: {
- beforeselect: '',
- selectionchange: '',
- itemclick: '',
- itemdblclick: '',
- cellClick: '',
- celldblclick: '',
- afterrender: '',
- destory: '',
- }
- },
- }
- };
- var vjson$7 = {
- title: '表格-高级',
- height: 450,
- width: 970,
- layout: 'fit',
- modal: true,
- items: [
- {
- xtype: 'tabpanel',
- items: [
- {
- title: '属性',
- xtype: 'form',
- scrollable: true,
- items: [
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '引用名',
- tooltip: 'reference',
- bind: '{vjson.reference}',
- },
- ]
- },
- {
- xtype: 'cols',
- border: false,
- items: [
- // 允许分页、页大小、页大小选项
- // 隐藏底部小工具、隐藏刷新、隐藏导出、隐藏自动调整列宽
- // 多选、显示勾选、自动勾选、
- // 单击编辑、列分割线、行分割线、边框
- // 数据源自动加载、后端排序、后端过滤
- // 自定义锁定、自定义隐藏、自定义顺序、自定义筛选
- {
- xtype: 'checkbox',
- fieldLabel: '允许分页',
- bind: {
- value: "{vjson.pagination}"
- }
- },
- {
- xtype: 'numberfield',
- fieldLabel: '页大小',
- bind: '{vjson.pageSize}',
- },
- {
- xtype: 'textfield',
- fieldLabel: '页大小选项',
- flex: 2,
- bind: '{vjson.pageSizeOption}',
- },
- ]
- },
- {
- layout: 'hbox',
- border: false,
- items: [
- {
- xtype: 'combo',
- fieldLabel: '选择模式',
- flex: 4,
- data: [
- { id: 'spreadsheet', text: 'Excel模式' },
- { id: 'onlyCheckColumn', text: '勾选框-只用勾选框多选' },
- { id: 'checkColumn', text: '勾选框' },
- { id: 'row_mulity', text: '行选择-允许多选' },
- { id: 'row_single', text: '行选择-单选' },
- { id: 'disableSelection', text: '禁用' },
- ],
- bind: {
- value: '{vjson.selectMode}'
- }
- }
- ]
- },
- {
- layout: 'hbox',
- border: false,
- defaults: {
- xtype: 'checkbox',
- margin: '0 15 0 0',
- },
- items: [
- {
- xtype: 'container',
- margin: '3',
- border: false,
- width: 80,
- },
- {
- boxLabel: '隐藏底部',
- bind: {
- value: "{vjson.hideFootbar}"
- }
- },
- {
- boxLabel: '隐藏刷新',
- bind: {
- value: "{vjson.hideRefresh}"
- }
- },
- {
- boxLabel: '隐藏导出',
- bind: {
- value: "{vjson.hideExport}"
- }
- },
- {
- boxLabel: '隐藏自动调宽',
- bind: {
- value: "{vjson.hideAutoSize}"
- }
- },
- {
- boxLabel: '隐藏清空筛选',
- bind: {
- value: "{vjson.hideClearFilter}"
- }
- },
- {
- boxLabel: '隐藏保存布局',
- bind: {
- value: "{vjson.hideSaveGridUIConfig}"
- }
- },
- {
- boxLabel: '隐藏重置布局',
- bind: {
- value: "{vjson.hideClearGridUIConfig}"
- }
- },
- ]
- },
- {
- layout: 'hbox',
- border: false,
- defaults: {
- xtype: 'checkbox',
- margin: '0 15 0 0',
- },
- items: [
- {
- xtype: 'container',
- margin: '3',
- border: false,
- width: 80
- },
- {
- boxLabel: '单击编辑',
- bind: {
- value: "{vjson.cellediting_clicksToEdit}"
- }
- },
- {
- boxLabel: '列分隔线',
- bind: {
- value: "{vjson.columnLines}"
- }
- },
- {
- boxLabel: '行分隔线',
- bind: {
- value: "{vjson.rowLines}"
- }
- },
- {
- boxLabel: '边框',
- bind: {
- value: "{vjson.border}"
- }
- },
- ]
- },
- {
- layout: 'hbox',
- border: false,
- defaults: {
- xtype: 'checkbox',
- margin: '0 15 0 0',
- },
- items: [
- {
- xtype: 'container',
- margin: '3',
- border: false,
- width: 80
- },
- {
- boxLabel: '数据源自动加载',
- bind: {
- value: "{vjson.autoLoad}"
- }
- },
- {
- boxLabel: '后端排序',
- bind: {
- value: "{vjson.remoteSort}"
- }
- },
- {
- boxLabel: '后端过滤',
- bind: {
- value: "{vjson.remoteFilter}"
- }
- },
- ]
- },
- {
- layout: 'hbox',
- border: false,
- defaults: {
- xtype: 'checkbox',
- margin: '0 15 0 0',
- },
- items: [
- {
- xtype: 'container',
- margin: '3',
- border: false,
- width: 80
- },
- {
- boxLabel: '自定义锁定',
- bind: {
- value: "{vjson.enableLocking}"
- }
- },
- {
- boxLabel: '自定义隐藏',
- bind: {
- value: "{vjson.enableColumnHide}"
- }
- },
- {
- boxLabel: '用户拖拽字段',
- bind: {
- value: "{vjson.enableColumnMove}"
- }
- },
- {
- boxLabel: '自定义筛选',
- bind: {
- value: "{vjson.gridfilters}"
- }
- },
- {
- boxLabel: '用户拖拽字段宽度',
- bind: {
- value: "{vjson.enableColumnResize}"
- }
- },
- {
- boxLabel: '点击列头排序',
- bind: {
- value: "{vjson.sortOnClick}"
- }
- },
- {
- xtype: 'checkbox',
- boxLabel: '隐藏',
- bind: {
- value: "{vjson.hidden}"
- }
- },
- ]
- },
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '样式',
- bind: '{vjson.cls}',
- flex: 4
- },
- ]
- },
- ]
- },
- {
- title: '字段',
- xtype: 'yvgrid',
- reference: 'grid1',
- pagination: false,
- hideFootbar: true,
- plugins: {
- clipboard: true,
- selectionreplicator: true
- },
- selModel: {
- type: 'spreadsheet',
- columnSelect: true,
- pruneRemoved: false,
- extensible: 'y'
- },
- listeners: {
- editfinish: 'scope.gridEditFinish',
- },
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'scope.addColumn'
- }
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.removeColumn'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '自动分析',
- iconCls: 'x-fa fa-code-fork',
- listeners: {
- click: 'scope.calcColumn'
- }
- },
- {
- xtype: 'button',
- text: '上移',
- iconCls: 'x-fa fa-arrow-up',
- listeners: {
- click: 'scope.moveUp'
- }
- },
- {
- xtype: 'button',
- text: '下移',
- iconCls: 'x-fa fa-arrow-down',
- listeners: {
- click: 'scope.moveDown'
- }
- },
- ]
- },
- columns: [
- { xtype: 'rownumberer' },
- {
- text: '字段',
- dataIndex: 'dataIndex',
- width: 140,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true,
- },
- },
- {
- text: '标题',
- dataIndex: 'header',
- width: 120,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true,
- },
- },
- {
- text: '类型',
- dataIndex: 'xtype',
- width: 100,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- typeAhead: true,
- triggerAction: 'all',
- selectOnFocus: false,
- listConfig: {
- minWidth: 200
- },
- store: [
- ['', '默认'],
- ['rownum', 'rownum'],
- ['checkcolumn', 'checkcolumn'],
- ]
- },
- },
- {
- text: '数据类型',
- dataIndex: 'dataType',
- width: 100,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- selectOnFocus: true,
- listConfig: {
- minWidth: 200
- },
- store: [
- ['', '默认'],
- ['string', 'string'],
- ['number', 'number'],
- ['date', 'date'],
- ]
- },
- },
- {
- text: '编辑模式',
- dataIndex: 'editor',
- width: 100,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- selectOnFocus: true,
- listConfig: {
- minWidth: 200
- },
- store: [
- ['', ''],
- ['textfield', 'textfield'],
- ['numberfield', 'numberfield'],
- ['combo', 'combo'],
- ['combogrid', 'combogrid'],
- ['datefield', 'datefield'],
- ]
- },
- },
- {
- text: '宽度',
- dataIndex: 'width',
- align: 'right',
- width: 100,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'numberfield',
- selectOnFocus: true,
- minValue: 0,
- maxValue: 1000
- },
- },
- {
- text: '权重',
- dataIndex: 'flex',
- align: 'right',
- width: 90,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'numberfield',
- selectOnFocus: true,
- minValue: 0,
- maxValue: 10
- },
- },
- {
- text: '字典',
- dataIndex: 'dict',
- sortable: false,
- menuDisabled: true,
- width: 210,
- editor: {
- selectOnFocus: true,
- },
- },
- {
- text: '对齐',
- dataIndex: 'align',
- width: 90,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- selectOnFocus: true,
- listConfig: {
- minWidth: 120
- },
- store: [
- ['start', 'start'],
- ['center', 'center'],
- ['end', 'end'],
- ]
- },
- },
- {
- text: '必填',
- dataIndex: 'notAllowBlank',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- xtype: 'checkcolumn',
- },
- {
- text: '禁用',
- dataIndex: 'disabled',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- xtype: 'checkcolumn',
- },
- {
- text: '禁菜',
- dataIndex: 'menuDisabled',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- xtype: 'checkcolumn',
- },
- {
- text: '过滤',
- dataIndex: 'filterable',
- xtype: 'checkcolumn',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- },
- {
- text: '隐藏',
- dataIndex: 'hidden',
- xtype: 'checkcolumn',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- },
- {
- text: '可隐',
- dataIndex: 'hideable',
- xtype: 'checkcolumn',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- },
- {
- text: '调宽',
- dataIndex: 'resizable',
- xtype: 'checkcolumn',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- },
- {
- text: '排序',
- dataIndex: 'sortable',
- xtype: 'checkcolumn',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- },
- {
- text: '适宽',
- dataIndex: 'autoSize',
- xtype: 'checkcolumn',
- width: 50,
- resizable: false,
- sortable: false,
- menuDisabled: true,
- },
- ],
- },
- {
- title: '数据源',
- layout: 'border',
- listeners: {
- activate: 'scope.dataSourceActivate'
- },
- items: [
- {
- region: 'north',
- xtype: 'toolbar',
- border: false,
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '数据源',
- flex: 1,
- bind: {
- value: '{vjson.dataSource.url}'
- }
- },
- {
- xtype: 'button',
- text: '保存',
- iconCls: 'x-fa fa-save',
- listeners: {
- click: 'scope.dataSourceSave'
- }
- },
- {
- xtype: 'button',
- text: '读取',
- iconCls: 'x-fa fa-folder-open',
- listeners: {
- click: 'scope.reloadSqlContent'
- }
- },
- ]
- },
- {
- region: 'center',
- xtype: 'sqleditor',
- layout: 'fit',
- reference: 'sqlEditor',
- },
- {
- region: 'south',
- xtype: 'jsoneditor',
- height: 200,
- split: true,
- collapsible: true,
- title: '参数',
- reference: 'sqlParams',
- }
- ]
- },
- {
- title: '事件',
- xtype: 'form',
- scrollable: true,
- margin: '10',
- defaults: {
- width: '100%',
- labelAlign: 'top',
- },
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '选中前触发 beforeSelect',
- bind: {
- value: '{vjson.listeners.beforeselect}'
- },
- },
- {
- xtype: 'textfield',
- fieldLabel: '选择范围改变 selectionChange',
- bind: {
- value: '{vjson.listeners.selectionchange}'
- },
- },
- {
- xtype: 'textfield',
- fieldLabel: '行点击 itemClick',
- bind: {
- value: '{vjson.listeners.itemclick}'
- },
- },
- {
- xtype: 'textfield',
- fieldLabel: '行双击 itemDblClick',
- bind: {
- value: '{vjson.listeners.itemdblclick}'
- },
- },
- {
- xtype: 'textfield',
- fieldLabel: '单元格点击 cellClick',
- bind: {
- value: '{vjson.listeners.cellClick}'
- },
- },
- {
- xtype: 'textfield',
- fieldLabel: '单元格双击 cellDblClick',
- bind: {
- value: '{vjson.listeners.celldblclick}'
- },
- },
- {
- xtype: 'textfield',
- fieldLabel: '渲染后触发 afterrender',
- bind: {
- value: '{vjson.listeners.afterrender}'
- },
- },
- {
- xtype: 'textfield',
- fieldLabel: '销毁后触发 destory',
- bind: {
- value: '{vjson.listeners.destory}'
- },
- },
- ]
- },
- ],
- }
- ],
- fbar: [
- {
- text: '应用', iconCls: 'x-fa fa-save',
- listeners: {
- click: 'scope.save'
- }
- },
- '-',
- {
- text: '确定', iconCls: 'x-fa fa-check-circle',
- listeners: {
- click: 'scope.saveClose'
- }
- },
- {
- text: '取消', iconCls: 'x-fa fa-times-circle',
- listeners: {
- click: 'system.closeMe()'
- }
- },
- ]
- };
- var checkFlags = {};
- // ------------------------------------------------------------------------------------------ impls
- function jsViewToVJson(modulePage, jsView) {
- if (!jsView)
- return {};
- jsView = jsView.replace(/^\s*export\s+default/, "");
- jsView = _$2.trim(jsView) || "{}";
- try {
- var json = dist.parse(jsView);
- return modulePage.addViewId(json);
- }
- catch (e) {
- //@ts-ignore
- Ext.Msg.alert(modulePage.module.name + '界面文件加载异常', e, Ext.emptyFn);
- }
- }
- function stringToJsonObj(jsonStr) {
- if (!jsonStr)
- return {};
- try {
- return dist.parse(jsonStr);
- }
- catch (e) {
- return {};
- }
- }
- /**
- * 获取view.js 文件 string
- */
- function vjsonTojsView(vjson) {
- var reVjson = _$2.cloneDeep(vjson);
- removeDesignProp(reVjson);
- return "export default " + dist.stringify(__assign({}, reVjson), null, ' ');
- }
- var ModuleStore = /** @class */ (function (_super) {
- __extends(ModuleStore, _super);
- function ModuleStore() {
- var _this = _super.call(this) || this;
- _this.store = {};
- eventBus.subscribe(EventType.ModulePageCreate, function (_a) {
- var id = _a.id, module = _a.module, modulePage = _a.modulePage;
- _this.addModule(id, module, modulePage);
- });
- eventBus.subscribe(EventType.MainTabChange, function (_a) {
- var moduleId = _a.moduleId, oldModuleId = _a.oldModuleId, from = _a.from;
- _this.onMainTabChange(moduleId, oldModuleId, from);
- });
- return _this;
- }
- ModuleStore.prototype.getCacheKey = function (param) {
- return "filetree_data.json";
- };
- ModuleStore.prototype.invokeApi = function (param) {
- return moduleTree();
- };
- ModuleStore.prototype.reloadModule = function (id) {
- var moduleObject = this.store[id];
- if (!moduleObject)
- return;
- var module = moduleObject.module;
- getModuleFileContent(module).then(function (_a) {
- var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
- moduleObject.fileContent = { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis };
- moduleObject.lastModifyTime = lastModifyTime;
- moduleObject.moduleObj = { vjson: jsViewToVJson(moduleObject.modulePage, jsView) };
- // 触发事件 ModuleItemChange
- moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
- moduleObject.moduleEventBus.publish(EventType.SetVjson, {
- vjson: moduleObject.moduleObj.vjson,
- from: "reloadModule"
- });
- eventBus.publish(EventType.SetVjson, { moduleId: id, from: "reloadModule" });
- });
- };
- ModuleStore.prototype.addModule = function (id, module, modulePage) {
- var _this = this;
- window['mainWindow'].setLoading(true);
- getModuleFileContent(module)
- .then(function (_a) {
- var _b = _a.data, jsController = _b.jsController, jsView = _b.jsView, jsModel = _b.jsModel, groovy = _b.groovy, mybatis = _b.mybatis, lastModifyTime = _b.lastModifyTime;
- var moduleObject = {
- id: id, module: module,
- fileContent: { jsController: jsController, jsView: jsView, jsModel: jsModel, groovy: groovy, mybatis: mybatis },
- lastModifyTime: lastModifyTime,
- moduleObj: { vjson: jsViewToVJson(modulePage, jsView) },
- modulePage: modulePage,
- moduleEventBus: modulePage.moduleEventBus
- };
- _this.store[id] = moduleObject;
- // 触发事件 ModuleItemChange
- moduleObject.moduleEventBus.publish(EventType.ModuleItemChange, moduleObject);
- // moduleObject.moduleEventBus.publish(EventType.SetVjson, {moduleId: id, from: "addModule"})
- eventBus.publish(EventType.SetVjson, { moduleId: id, from: "addModule" });
- })
- .finally(function () {
- window['mainWindow'].setLoading(false);
- });
- };
- ModuleStore.prototype.onMainTabChange = function (moduleId, oldModuleId, from) {
- if (this.store[moduleId]) {
- eventBus.publish(EventType.SetVjson, { moduleId: moduleId, from: from });
- }
- };
- ModuleStore.prototype.updateJsController = function (id, codeValue, from) {
- var moduleObject = this.store[id];
- moduleObject.fileContent.jsController = codeValue;
- };
- ModuleStore.prototype.updateJsView = function (id, codeValue, from) {
- var moduleObject = this.store[id];
- moduleObject.fileContent.jsView = codeValue;
- moduleObject.moduleObj.vjson = jsViewToVJson(moduleObject.modulePage, codeValue);
- handles$1.mainWindow.activeModulePage.moduleEventBus.publish(EventType.SetVjson, {
- vjson: moduleObject.moduleObj.vjson,
- from: from
- });
- eventBus.publish(EventType.SetVjson, { moduleId: id, from: from });
- };
- ModuleStore.prototype.updateJsModel = function (id, codeValue, from) {
- var moduleObject = this.store[id];
- moduleObject.fileContent.jsModel = codeValue;
- };
- ModuleStore.prototype.updateGroovy = function (id, codeValue, from) {
- var moduleObject = this.store[id];
- moduleObject.fileContent.groovy = codeValue;
- };
- ModuleStore.prototype.updateMybatis = function (id, codeValue, from) {
- var moduleObject = this.store[id];
- moduleObject.fileContent.mybatis = codeValue;
- };
- ModuleStore.prototype.getModuleObject = function (id) {
- return this.store[id];
- };
- ModuleStore.prototype.saveFile = function (moduleId, fileType) {
- if (checkFlags[moduleId] === 1) {
- // @ts-ignore
- system.msg("正在检测文件是否有外部修改,请稍后操作");
- }
- eventBus.publish(EventType.StopCheckModule, {});
- var fileFullPath = moduleStore.getModuleObject(moduleId).module[fileType + "File"].absolutePath;
- var fileContent = moduleStore.getModuleObject(moduleId).fileContent[fileType];
- saveFile(fileFullPath, fileContent).then(function (res) {
- if (res.data && res.data.lastModified) {
- moduleStore.getModuleObject(moduleId).module[fileType + "File"].lastModified = res.data.lastModified;
- }
- }).finally(function () {
- eventBus.publish(EventType.RunCheckModule, {});
- });
- };
- ModuleStore.prototype.check = function (moduleId) {
- {
- return;
- }
- };
- return ModuleStore;
- }(CacheStore));
- // ------------------------------------------------------------------------------------------ use
- var moduleStore = new ModuleStore();
- var VjsonExchange = /** @class */ (function () {
- function VjsonExchange(vjson) {
- this.pendingSet = true;
- this.vjsonOrigin = _$2.cloneDeep(vjson);
- this.vjson = _$2.cloneDeep(this.vjsonOrigin);
- }
- /**
- * 设值某个 viewModel 属性发生变化时, vjson 应该做出的变化
- * @param propName
- * @param value
- */
- VjsonExchange.prototype.setPropValue = function (propName, value) {
- if (this.pendingSet) {
- return;
- }
- // selectMode
- // pageSizeOption
- // cellediting_clicksToEdit
- msg$1('' + propName + '=' + value);
- _$2.set(this.vjson, propName, value);
- };
- /**
- * 字段编辑表格中,某字段属性发生变化,函数返回属性变化对应的 vjson.column 所需变化
- */
- VjsonExchange.prototype.setColumnValue = function (propName, value, record, rowIdx) {
- var _a, _b, _c;
- if (this.pendingSet) {
- return;
- }
- // 默认属性对照表 vs, 如果要设定的值与默认值相等,就删除这个属性
- // 如果不使用默认属性,就直接设定 undefined
- var vs = {
- dataIndex: undefined,
- header: undefined,
- xtype: '',
- width: undefined,
- flex: undefined,
- align: 'start',
- editor: undefined,
- dataType: 'string',
- dict: undefined,
- disabled: false,
- menuDisabled: false,
- notAllowBlank: false,
- filterable: true,
- hidden: false,
- hideable: true,
- resizable: true,
- sortable: true,
- autoSize: true,
- };
- var raw = record.get('raw');
- if (raw === undefined || raw == null) {
- raw = {};
- record.set('raw', raw);
- }
- var setRaw = function (propName, value) {
- if (typeof value === 'undefined' || value == null) {
- msg$1("delete columns[" + rowIdx + "]." + propName);
- delete raw[propName];
- return;
- }
- var defaultValue = vs[propName];
- if (typeof defaultValue !== 'undefined' && value === defaultValue) {
- // 要设的值,与默认值相同,就直接删除这个属性
- msg$1("delete columns[" + rowIdx + "]." + propName);
- delete raw[propName];
- return;
- }
- msg$1("set columns[" + rowIdx + "]." + propName + "=" + value);
- _$2.set(raw, propName, value);
- };
- if (!vs.hasOwnProperty(propName)) {
- msg$1("\u4E0D\u652F\u6301\u7684\u7F16\u8F91\u5C5E\u6027 columns[" + rowIdx + "]." + propName);
- return;
- }
- else if (propName === 'dict') {
- if (value) {
- setRaw('fix', ["system.getDict(\"" + value + "\")"]);
- if (((_a = raw.editor) === null || _a === void 0 ? void 0 : _a.xtype) === 'combo') {
- setRaw('editor.fix', ["system.getDict(\"" + value + "\")"]);
- }
- }
- else {
- setRaw('fix', undefined);
- if (_$2.isArray((_b = raw.editor) === null || _b === void 0 ? void 0 : _b.fix)) {
- msg$1("delete columns[" + rowIdx + "].editor.fix");
- delete raw.editor.fix;
- }
- }
- }
- else if (propName === 'xtype') {
- if (!value) {
- setRaw('xtype', undefined);
- }
- else {
- setRaw('xtype', value);
- }
- }
- else if (propName === 'notAllowBlank') {
- setRaw('editor.allowBlank', !value);
- }
- else if (propName === 'editor') {
- if (value && !_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], value)) {
- showErrorDialog$1("\u4E0D\u53EF\u8BC6\u522B\u7684 columns[" + rowIdx + "].editor.xtype=" + value);
- value = undefined;
- }
- // editor.xtype
- if (!value) {
- // 不需要编辑器
- if ((_c = raw.editor) === null || _c === void 0 ? void 0 : _c.xtype) {
- msg$1("delete columns[" + rowIdx + "].editor");
- delete raw.editor;
- record.set('notAllowBlank', false);
- }
- }
- else {
- setRaw('editor.xtype', value);
- var dict = record.get('dict');
- if (value === 'combo' && dict) {
- setRaw('editor.fix', ["system.getDict(\"" + dict + "\")"]);
- }
- }
- }
- else if (propName === 'width') {
- var width = value;
- var flex = record.get('flex');
- if (!width && !flex) {
- setRaw('width', undefined);
- setRaw('flex', undefined);
- record.set('flex', undefined);
- record.set('width', undefined);
- return;
- }
- else if (!!width) {
- setRaw('flex', undefined);
- record.set('flex', undefined);
- setRaw('width', width);
- return;
- }
- }
- else if (propName === 'flex') {
- var width = record.get('width');
- var flex = value;
- if (!width && !flex) {
- setRaw('width', undefined);
- setRaw('flex', undefined);
- record.set('flex', undefined);
- record.set('width', undefined);
- return;
- }
- else if (!!flex) {
- setRaw('width', undefined);
- record.set('width', undefined);
- setRaw('flex', flex);
- return;
- }
- }
- else {
- // 其他属性,作为同名属性,与 raw 同步
- setRaw(propName, value);
- }
- };
- /**
- * 观察 viewModel 中的属性值变化,如果变化,将会改变 vjson 中相对应的属性
- */
- VjsonExchange.prototype.attachViewModel = function (viewModel) {
- var _this = this;
- var vs = [
- 'reference', 'pagination', 'pageSize',
- 'hideFootbar', 'hideRefresh', 'hideExport', 'hideAutoSize', 'hideClearFilter', 'hideSaveGridUIConfig', 'hideClearGridUIConfig',
- 'columnLines', 'rowLines', 'border', 'autoLoad', 'remoteSort', 'remoteFilter', 'enableLocking', 'enableColumnHide',
- 'enableColumnMove', 'gridfilters', 'enableColumnResize', 'sortOnClick', 'hidden', 'cls',
- 'listeners.beforeselect',
- 'listeners.selectionchange',
- 'listeners.itemclick',
- 'listeners.itemdblclick',
- 'listeners.cellClick',
- 'listeners.celldblclick',
- 'listeners.afterrender',
- 'listeners.destory',
- ];
- _$2.forEach(vs, function (v) {
- viewModel.bind('{vjson.' + v + '}', _this.bindChangeProp(v));
- });
- };
- VjsonExchange.prototype.bindChangeProp = function (propName) {
- var me = this;
- return function (value) {
- me.setPropValue(propName, value);
- };
- };
- VjsonExchange.prototype.parseModel = function () {
- var _this = this;
- 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;
- //@ts-ignore
- var df = YvanUI.Defaults.grid;
- var vjson = _$2.assign({}, df, this.vjson);
- var model = {
- reference: (_a = vjson.reference) !== null && _a !== void 0 ? _a : '',
- pagination: (_b = vjson.pagination) !== null && _b !== void 0 ? _b : true,
- pageSize: (_c = vjson.pageSize) !== null && _c !== void 0 ? _c : 50,
- pageSizeOption: '["20", "50", "100", "200", "300"]',
- hideFootbar: (_d = vjson.hideFootbar) !== null && _d !== void 0 ? _d : false,
- hideRefresh: (_e = vjson.hideRefresh) !== null && _e !== void 0 ? _e : false,
- hideExport: (_f = vjson.hideExport) !== null && _f !== void 0 ? _f : false,
- hideAutoSize: (_g = vjson.hideAutoSize) !== null && _g !== void 0 ? _g : false,
- hideClearFilter: (_h = vjson.hideClearFilter) !== null && _h !== void 0 ? _h : false,
- hideSaveGridUIConfig: (_j = vjson.hideSaveGridUIConfig) !== null && _j !== void 0 ? _j : false,
- hideClearGridUIConfig: (_k = vjson.hideClearGridUIConfig) !== null && _k !== void 0 ? _k : false,
- selectMode: 'spreadsheet',
- cellediting_clicksToEdit: true,
- columnLines: (_l = vjson.columnLines) !== null && _l !== void 0 ? _l : true,
- rowLines: (_m = vjson.rowLines) !== null && _m !== void 0 ? _m : true,
- border: (_o = vjson.border) !== null && _o !== void 0 ? _o : true,
- autoLoad: (_p = vjson.autoLoad) !== null && _p !== void 0 ? _p : true,
- remoteSort: (_q = vjson.remoteSort) !== null && _q !== void 0 ? _q : false,
- remoteFilter: (_r = vjson.remoteFilter) !== null && _r !== void 0 ? _r : false,
- enableLocking: (_s = vjson.enableLocking) !== null && _s !== void 0 ? _s : false,
- enableColumnHide: (_t = vjson.enableColumnHide) !== null && _t !== void 0 ? _t : true,
- enableColumnMove: (_u = vjson.enableColumnMove) !== null && _u !== void 0 ? _u : true,
- gridfilters: true,
- enableColumnResize: (_v = vjson.enableColumnResize) !== null && _v !== void 0 ? _v : true,
- sortOnClick: (_w = vjson.sortOnClick) !== null && _w !== void 0 ? _w : true,
- hidden: (_x = vjson.hidden) !== null && _x !== void 0 ? _x : false,
- cls: (_y = vjson.cls) !== null && _y !== void 0 ? _y : '',
- columns: [],
- listeners: {
- beforeselect: (_0 = (_z = vjson.listeners) === null || _z === void 0 ? void 0 : _z.beforeselect) !== null && _0 !== void 0 ? _0 : '',
- selectionchange: (_2 = (_1 = vjson.listeners) === null || _1 === void 0 ? void 0 : _1.selectionchange) !== null && _2 !== void 0 ? _2 : '',
- itemclick: (_4 = (_3 = vjson.listeners) === null || _3 === void 0 ? void 0 : _3.itemclick) !== null && _4 !== void 0 ? _4 : '',
- itemdblclick: (_6 = (_5 = vjson.listeners) === null || _5 === void 0 ? void 0 : _5.itemdblclick) !== null && _6 !== void 0 ? _6 : '',
- cellClick: (_8 = (_7 = vjson.listeners) === null || _7 === void 0 ? void 0 : _7.cellClick) !== null && _8 !== void 0 ? _8 : '',
- celldblclick: (_10 = (_9 = vjson.listeners) === null || _9 === void 0 ? void 0 : _9.celldblclick) !== null && _10 !== void 0 ? _10 : '',
- afterrender: (_12 = (_11 = vjson.listeners) === null || _11 === void 0 ? void 0 : _11.afterrender) !== null && _12 !== void 0 ? _12 : '',
- destory: (_14 = (_13 = vjson.listeners) === null || _13 === void 0 ? void 0 : _13.destory) !== null && _14 !== void 0 ? _14 : '',
- }
- };
- if (_$2.isArray(this.vjson.pageSizeOption)) {
- model.pageSizeOption = JSON.stringify(this.vjson.pageSizeOption);
- }
- model.gridfilters = _$2.get(this.vjson, 'plugins.gridfilters');
- if (_$2.get(vjson, 'disableSelection') == true) {
- model.selectMode = 'disableSelection';
- }
- else if (_$2.get(vjson, 'selModel.type') == 'spreadsheet') {
- model.selectMode = 'spreadsheet';
- }
- else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel' && _$2.get(this.vjson, 'selModel.checkOnly') == true) {
- model.selectMode = 'onlyCheckColumn';
- }
- else if (_$2.get(vjson, 'selModel.type') == 'checkboxmodel') {
- model.selectMode = 'checkColumn';
- }
- else if (_$2.get(vjson, 'selModel.type') == 'rowmodel' && _$2.get(this.vjson, 'selModel.mode') == 'MULTI') {
- model.selectMode = 'row_mulity';
- }
- else if (_$2.get(vjson, 'selModel.type') == 'rowmodel') {
- model.selectMode = 'row_single';
- }
- else {
- model.selectMode = 'row_single';
- }
- model.cellediting_clicksToEdit = (_$2.get(vjson, 'plugins.cellediting.clicksToEdit') > 0);
- if (_$2.get(vjson, 'dataSource.method') === 'invoke') {
- model.dataSource = {
- url: _$2.get(vjson, 'dataSource.url'),
- //@ts-ignore
- params: _$2.get(vjson, 'dataSource.params')
- };
- }
- _$2.forEach(vjson.columns, function (column) {
- model.columns.push(_this.parseColumn(column));
- });
- return model;
- };
- VjsonExchange.prototype.parseColumn = function (column) {
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
- var model = {
- dataIndex: (_a = column.dataIndex) !== null && _a !== void 0 ? _a : '',
- header: (_b = column.header) !== null && _b !== void 0 ? _b : '',
- xtype: (_c = column.xtype) !== null && _c !== void 0 ? _c : '',
- width: (_d = column.width) !== null && _d !== void 0 ? _d : 0,
- flex: (_e = column.flex) !== null && _e !== void 0 ? _e : 0,
- align: (_f = column.align) !== null && _f !== void 0 ? _f : 'start',
- editor: '',
- editParam: '',
- dict: '',
- disabled: (_g = column.disabled) !== null && _g !== void 0 ? _g : false,
- menuDisabled: (_h = column.menuDisabled) !== null && _h !== void 0 ? _h : false,
- notAllowBlank: (_j = column.notAllowBlank) !== null && _j !== void 0 ? _j : false,
- filterable: (_k = column.filterable) !== null && _k !== void 0 ? _k : true,
- hidden: (_l = column.hidden) !== null && _l !== void 0 ? _l : false,
- hideable: (_m = column.hideable) !== null && _m !== void 0 ? _m : true,
- resizable: (_o = column.resizable) !== null && _o !== void 0 ? _o : true,
- sortable: (_p = column.sortable) !== null && _p !== void 0 ? _p : true,
- locked: (_q = column.locked) !== null && _q !== void 0 ? _q : false,
- lockable: (_r = column.lockable) !== null && _r !== void 0 ? _r : false,
- autoSize: (_s = column.autoSize) !== null && _s !== void 0 ? _s : true,
- raw: _$2.cloneDeep(column),
- };
- // width / flex 只能留一个属性, 或者全不留
- if (model.width <= 0 && model.flex <= 0) {
- delete model.width;
- delete model.flex;
- }
- else if (model.width > 0) {
- delete model.flex;
- }
- else {
- delete model.width;
- }
- // editor
- if (_$2.isObject(_$2.get(column, 'editor'))) {
- model.editor = _$2.get(column, 'editor.xtype');
- // model.editParam = window['YvanUI'].json5.stringify(column.editor)
- if (!model.editor) {
- // 有 editor 属性,但没有 editor.xtype 属性,默认是文本输入框
- model.editor = 'textfield';
- }
- else if (!_$2.includes(['numberfield', 'datefield', 'combo', 'combogrid', 'textfield'], model.editor)) {
- msg$1('不可识别的 editor.xtype=' + model.editor);
- console.error('不可识别的 editor.xtype', column);
- }
- if (_$2.get(column, 'editor.allowBlank') === false) {
- model.notAllowBlank = true;
- }
- }
- // dict -> { fix: ['system.getDict("AREA_CLASSIFY")'], }
- if (_$2.isString(_$2.get(column, 'fix[0]'))) {
- var match = _$2.get(column, 'fix[0]').match(/^system.getDict\(\"(.*?)\"\)$/);
- if (match && match[1]) {
- model.dict = match[1];
- }
- }
- return model;
- };
- return VjsonExchange;
- }());
- //
- var YvgridDesign = /** @class */ (function (_super) {
- __extends(YvgridDesign, _super);
- function YvgridDesign(moduleId) {
- var _this = _super.call(this, { model: model$7, vjson: vjson$7 }) || this;
- _this.moduleId = '';
- _this.name = 'YvgridDesign';
- _this.dataSourceIsActived = false;
- _this.setModuleId(moduleId);
- return _this;
- }
- YvgridDesign.prototype.setModuleId = function (moduleId) {
- var _this = this;
- this.moduleId = moduleId;
- if (this.componentSelectionChangeSubscribe) {
- this.componentSelectionChangeSubscribe.cancel();
- this.componentSelectionChangeSubscribe = null;
- }
- this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
- var id = _a.id, from = _a.from;
- _this.onComponentSelectionChange(id, from);
- });
- var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
- var vj = findInCode(moduleStore.getModuleObject(this.moduleId).moduleObj.vjson, id);
- if (vj.xtype !== 'yvgrid') {
- throw Error('非 yvgrid 组件');
- }
- this.vjsonExchange = new VjsonExchange(vj);
- };
- YvgridDesign.prototype.onLoad = function () {
- var _this = this;
- var model = this.vjsonExchange.parseModel();
- this.vjsonExchange.pendingSet = true;
- mergeViewModel(this.viewModel, "vjson", model, false);
- this.refs.grid1.setData(model.columns);
- this.vjsonExchange.attachViewModel(this.viewModel);
- _$2.defer(function () {
- _this.vjsonExchange.pendingSet = false;
- });
- };
- YvgridDesign.prototype.moveUp = function (sender) {
- var grid = sender.up('grid');
- grid.rowMoveUp();
- };
- YvgridDesign.prototype.moveDown = function (sender) {
- var grid = sender.up('grid');
- grid.rowMoveDown();
- };
- YvgridDesign.prototype.gridEditFinish = function (sender, editor, context, eOpts) {
- this.vjsonExchange.setColumnValue(context.field, context.value, context.record, context.rowIdx);
- };
- YvgridDesign.prototype.reloadSqlContent = function () {
- var _this = this;
- var url = this.viewModel.get('vjson.dataSource.url');
- if (url) {
- loadSqlContentApi(url).then(function (res) {
- _this.refs.sqlEditor.setCode('');
- if (res.success) {
- _this.refs.sqlEditor.setCode(res.data.content);
- }
- }).catch(function () {
- _this.refs.sqlEditor.setCode('');
- });
- }
- };
- YvgridDesign.prototype.dataSourceSave = function () {
- var url = this.viewModel.get('vjson.dataSource.url');
- if (!url) {
- msg$1('必须填写 groovy/SQL 模块路径');
- return;
- }
- var content = this.refs.sqlEditor.getCode();
- saveSqlContentApi(url, content).then(function (res) {
- if (res.success) {
- msg$1('保存成功');
- }
- else {
- msg$1(res.msg);
- }
- });
- };
- YvgridDesign.prototype.dataSourceActivate = function () {
- if (!this.dataSourceIsActived) {
- // 激活
- this.reloadSqlContent();
- var params = this.viewModel.get('vjson.dataSource.params');
- if (_$2.isObject(params)) {
- this.refs.sqlParams.setCode(window['YvanUI'].json5.stringify(params, null, ' '));
- }
- this.dataSourceIsActived = true;
- }
- };
- // 外部控件选择发生改变
- YvgridDesign.prototype.onComponentSelectionChange = function (id, from) {
- if (!id || from === this.name) {
- return;
- }
- this.setVjson(id);
- };
- YvgridDesign.prototype.setVjson = function (id) {
- // 找到对应的组件 判断是不是表格
- };
- YvgridDesign.prototype.save = function () {
- var columns = this.refs.grid1.getDataRowsOnlyData().map(function (r) { return r.raw; });
- if (this.dataSourceIsActived) {
- var url = this.viewModel.get('vjson.dataSource.url');
- // 解析 params
- var paramsString = this.refs.sqlParams.getCode('');
- var params = undefined;
- if (paramsString) {
- try {
- params = window['YvanUI'].json5.parse(paramsString);
- }
- catch (e) {
- msg$1('dataSource.params 格式非法,请检查');
- return;
- }
- }
- if (typeof params === 'undefined') {
- params = this.viewModel.get('vjson.dataSource.params');
- }
- if (url) {
- _$2.set(this.vjsonExchange.vjson, 'dataSource.url', url);
- _$2.set(this.vjsonExchange.vjson, 'dataSource.method', 'invoke');
- _$2.set(this.vjsonExchange.vjson, 'dataSource.params', params);
- }
- else {
- delete this.vjsonExchange.vjson['dataSource'];
- }
- }
- moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateComponentVjson, {
- cmpVjson: __assign(__assign({}, this.vjsonExchange.vjson), { columns: columns }),
- from: this.name,
- ignoreRenderUI: false
- });
- };
- YvgridDesign.prototype.saveClose = function () {
- this.save();
- this.close();
- };
- YvgridDesign.prototype.addColumn = function () {
- this.refs.grid1.appendEditRow({
- dataIndex: '',
- header: '',
- xtype: '',
- width: 80,
- align: '',
- editor: '',
- editParam: '',
- dict: '',
- disabled: false,
- notAllowBlank: false,
- menuDisabled: false,
- filterable: false,
- hidden: false,
- hideable: true,
- resizable: true,
- sortable: true,
- locked: false,
- lockable: false,
- autoSize: true,
- raw: undefined,
- }, 'header');
- };
- YvgridDesign.prototype.removeColumn = function () {
- var _this = this;
- var rows = [];
- this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
- rows.push(r);
- });
- _$2.forEach(rows, function (r) {
- _this.refs.grid1.getStore().remove(r);
- });
- };
- YvgridDesign.prototype.calcColumn = function () {
- msg$1('暂未实现');
- };
- YvgridDesign.prototype.onDestroy = function () {
- if (this.componentSelectionChangeSubscribe) {
- this.componentSelectionChangeSubscribe.cancel();
- this.componentSelectionChangeSubscribe = null;
- }
- };
- return YvgridDesign;
- }(Scope));
- // export const idPrefix = "_ds_"
- var _designInstance;
- function setDesignInstance(instance) {
- _designInstance = instance;
- }
- function getDesignInstance() {
- return _designInstance;
- }
- function delegateDragmove(node, source, info) {
- if (_designInstance && typeof _designInstance.dragmove === 'function') {
- //@ts-ignore
- _designInstance.dragmove(node, source, info);
- }
- }
- function delegateDragend(node, source, info) {
- if (_designInstance && typeof _designInstance.dragend === 'function') {
- //@ts-ignore
- _designInstance.dragend(node, source, info);
- }
- }
- var YvanUI$1 = window['YvanUI'];
- var _$1 = window["_"];
- var Ext$1 = window['Ext'];
- var $$1 = window["$"];
- var historySize = 100;
- var ViewDesign = /** @class */ (function () {
- function ViewDesign(moduleId, reference) {
- var _this = this;
- this.name = "ViewDesign";
- this.expandedVjsonObjArray = [];
- // 编辑历史
- this.undoVjsonList = [];
- // 撤销历史
- this.redoVjsonList = [];
- // 订阅事件列表
- this.subscribeList = [];
- // private getOuterCopyValueTimer: any = null
- /**
- * 唯一编号
- */
- this.id = _$1.uniqueId("_dv");
- this.moduleId = moduleId;
- this.moduleObject = moduleStore.getModuleObject(moduleId);
- this.$overlay = $$1('<div id = "' + this.id + '"class="yvan_designer_overlay" style="z-index: 99" tabindex="0"></div>');
- this.designReference = reference;
- this.designElement = reference.ariaEl.dom;
- this.$overlay.appendTo(this.designElement);
- this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
- // 添加到撤销
- this.lastVjson = _$1.cloneDeep(this.vjson);
- this.$overlay.on('contextmenu', '.studio_mask', function (event) {
- event.stopPropagation();
- event.preventDefault();
- eventBus.publish(EventType.ComponentContextmenu, { id: "", from: _this.name });
- });
- this.$overlay.on('click', '.studio_mask', function (event) {
- event.stopPropagation();
- event.preventDefault();
- _this.clearSelection();
- _this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: "", from: _this.name });
- _$1.defer(function () {
- _this.$overlay.focus();
- });
- });
- this.$overlay.on('click', this.overlayClickFunction.bind(this));
- this.$overlay.on('keyup', this.onKeyPress.bind(this));
- this.$overlay.on('copy', this.onCopy.bind(this));
- this.$overlay.on('paste', this.onPaste.bind(this));
- this.$overlay.on('focus', this.onfocus.bind(this));
- // this.$overlay.on('mouseenter', ()=>{
- // clearTimeout(this.getOuterCopyValueTimer);
- // this.getOuterCopyValueTimer = setTimeout(()=>{this.$overlay.focus()}, 500)
- // })
- this.$overlay.on('mousemove', _$1.debounce(function (event) {
- _this.onMousemove(event);
- }, 300, { maxWait: 500 }).bind(this));
- window.addEventListener('message', this.onMessageEvent.bind(this));
- this.subscribe();
- setDesignInstance(this);
- }
- // todo ======== 方法 ==========
- ViewDesign.prototype.subscribe = function () {
- var _this = this;
- this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
- this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
- var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
- _this.setVjson(vjson, from, ignoreRenderUI);
- }));
- this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
- var id = _a.id, from = _a.from;
- _this.onComponentSelectionChange(id, from);
- }));
- this.subscribeList.push(this.moduleObject.moduleEventBus.subscribe(EventType.ComponentDelete, function (_a) {
- var id = _a.id, from = _a.from;
- _this.onComponentDelete(id, from);
- }));
- };
- ViewDesign.prototype.setVjson = function (vjson, from, ignoreRenderUI) {
- if (vjson === void 0) { vjson = this.vjson; }
- if (from === void 0) { from = this.name; }
- this.vjson = vjson;
- if (from !== "undo" && from !== "redo") {
- if (this.undoVjsonList.length >= 100) {
- this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
- }
- this.undoVjsonList.push(this.lastVjson);
- }
- this.lastVjson = _$1.cloneDeep(vjson);
- this.setSelection(this.moduleObject.modulePage.currentComponentSelectId);
- };
- /**
- * 覆盖层点击事件
- */
- ViewDesign.prototype.overlayClickFunction = function (event) {
- if (!event.altKey && !event.shiftKey) {
- var target = this.findElByXY(event.clientX, event.clientY);
- if (target) {
- var rect = target === null || target === void 0 ? void 0 : target.getBoundingClientRect();
- var extHandle = Ext$1.get(target).component;
- var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
- rect.x = position.x;
- rect.y = position.y;
- this.clearSelection();
- this.appendMaskbox(rect, extHandle.id);
- }
- }
- };
- ViewDesign.prototype.findElByXY = function (x, y, dragType) {
- if (dragType === void 0) { dragType = ""; }
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
- var ele = document.elementsFromPoint(x, y);
- if (ele.length <= 1) {
- return;
- }
- var target = null;
- for (var i = 0; i < ele.length; i++) {
- // 包含设计样式 并且有 id 并且 id 不包含被动生成id (有效id是设计器生成的, 不包含 '-' )
- 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) {
- switch (dragType) {
- case "cols-container":
- if (((_b = ele[i].getAttribute("class")) === null || _b === void 0 ? void 0 : _b.indexOf("design_rows_container")) >= 0
- || ((_c = ele[i].getAttribute("class")) === null || _c === void 0 ? void 0 : _c.indexOf("design_cols_container")) >= 0) {
- target = ele[i];
- }
- break;
- case "col-item":
- if (((_d = ele[i].getAttribute("class")) === null || _d === void 0 ? void 0 : _d.indexOf("design_cols_container")) >= 0
- || ((_e = ele[i].getAttribute("class")) === null || _e === void 0 ? void 0 : _e.indexOf("design_col_item")) >= 0) {
- target = ele[i];
- }
- break;
- case "rows-container":
- if (((_f = ele[i].getAttribute("class")) === null || _f === void 0 ? void 0 : _f.indexOf("design_cols_container")) >= 0
- || ((_g = ele[i].getAttribute("class")) === null || _g === void 0 ? void 0 : _g.indexOf("design_rows_container")) >= 0) {
- target = ele[i];
- }
- break;
- case "row-item":
- if (((_h = ele[i].getAttribute("class")) === null || _h === void 0 ? void 0 : _h.indexOf("design_row_item")) >= 0
- || ((_j = ele[i].getAttribute("class")) === null || _j === void 0 ? void 0 : _j.indexOf("design_rows_container")) >= 0) {
- target = ele[i];
- }
- break;
- default:
- target = ele[i];
- break;
- }
- if (target) {
- break;
- }
- }
- }
- return target;
- };
- /**
- * 清空选择项
- */
- ViewDesign.prototype.clearSelection = function () {
- // $(this.designElement).removeClass('selected');
- // // $(this.designElement).find('.selected').removeClass('selected')
- // $(this.designElement).find('.ds_mask')
- // .not('.mask_not_hide')
- // .remove();
- $$1('.studio_mask').remove();
- // $(this.designElement).find('.selected').each(function () {
- // $(this).removeClass('selected');
- // // const extHandle = Ext.get(this).component
- // // if (extHandle) {
- // // extHandle.removeCls('selected')
- // // }
- // })
- };
- /**
- * 添加遮罩层
- */
- ViewDesign.prototype.appendMaskbox = function (rect, vjsonId) {
- var that = this;
- if (vjsonId) {
- this.moduleObject.modulePage.currentComponentSelectId = vjsonId;
- }
- // = cj.hasOwnProperty("xtype") && _.findIndex(ViewHelper.canMoveCmpArr, (item) => {
- // return item === cj.xtype
- // }) >= 0
- var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
- 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>");
- // ${canMove ? '<i class="fa fa-arrows"></i>' : ''}
- this.$mask.css({
- position: 'absolute',
- top: top, left: left, width: width, height: height,
- border: '2px dashed #1890ff',
- zIndex: 100,
- });
- this.$mask.appendTo(this.$overlay);
- this.$mask.on("click", ".ds_del", function (e) {
- e.stopPropagation();
- e.preventDefault();
- that.deleteComponent(vjsonId);
- });
- // 点击选中父级
- this.$mask.on('click', '.ds_parent', function (e) {
- e.stopPropagation();
- e.preventDefault();
- that.selectParent(vjsonId);
- });
- var sel = document.getElementById(vjsonId);
- var sVjosn = findInCode(this.vjson, vjsonId);
- // 限制可以拖动的组件
- if ( canMoveCmpArr.indexOf(sVjosn.xtype) >= 0) {
- var dragType = colItemCmpArr.indexOf(sVjosn.xtype) >= 0 ? "col-item" : sVjosn.xtype === 'cols' ? 'cols-container' : '';
- this.dragSource = new Ext$1.drag.Source({
- element: this.$mask[0],
- constrain: this.$overlay[0],
- listeners: {
- dragmove: this.dragmove.bind(that, this.vjson),
- dragend: this.dragend.bind(that, this.vjson)
- },
- startRect: rect,
- sourceVjson: findInCode(this.vjson, vjsonId),
- sourceVjsonId: vjsonId,
- dragType: dragType
- });
- }
- this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: vjsonId, from: this.name });
- };
- /**
- * 选中某个选项
- */
- ViewDesign.prototype.setSelection = function (id) {
- var _a, _b;
- if (!this.designElement) {
- return;
- }
- // 清空选中内容
- this.clearSelection();
- if (!id) {
- return;
- }
- var rect = (_b = (_a = Ext$1.get(id)) === null || _a === void 0 ? void 0 : _a.dom) === null || _b === void 0 ? void 0 : _b.getBoundingClientRect();
- var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
- rect.x = position.x;
- rect.y = position.y;
- this.appendMaskbox(rect, id);
- };
- /**
- * 删除组件
- * @param id
- */
- ViewDesign.prototype.deleteComponent = function (id) {
- deletVjsonById(this.vjson, id);
- this.moduleObject.modulePage.currentComponentSelectId = null;
- this.setVjson();
- this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: this.name });
- this.clearSelection();
- };
- ViewDesign.prototype.selectParent = function (id) {
- var pid = getSuperVjsonId(this.vjson, id);
- this.moduleObject.modulePage.currentComponentSelectId = pid;
- this.setSelection(pid);
- };
- // todo ====== 拖拽事件 ======
- ViewDesign.prototype.dragmove = function (node, source, info) {
- var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
- if (!target) {
- return;
- }
- var rect = target.getBoundingClientRect();
- var position = this.getPosition({ x: rect.x, y: rect.y }, "main", "overlay");
- var extHandle = Ext$1.get(target).component;
- if (!extHandle) {
- return;
- }
- var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
- rect.x = position.x;
- rect.y = position.y;
- this.appendDirection(rect, extHandle.id, direction);
- };
- ViewDesign.prototype.dragend = function (node, source, info) {
- var target = this.findElByXY(info.cursor.current.x, info.cursor.current.y, source.dragType);
- if (!target) {
- return;
- }
- var rect = target.getBoundingClientRect();
- var extHandle = Ext$1.get(target).component;
- var direction = this.getDirection(info.cursor.current.x, info.cursor.current.y, rect, source.dragType);
- if (!extHandle) {
- return;
- }
- this.putVjosn(source.sourceVjsonId, source.sourceVjson, extHandle.id, direction, source.dragType);
- this.removeDirection();
- };
- ViewDesign.prototype.appendDirection = function (rect, vjsonId, direction) {
- var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
- var cv = findInCode(this.vjson, vjsonId);
- if (this.$direction) {
- $$1('#direction' + this.id).remove();
- }
- // if (_.findIndex(colsContainerArr, it => it === cv.xtype) >= 0) {
- //
- // } else if (_.findIndex(colItemCmpArr, it => it === cv.xtype) >= 0) {
- if (direction) {
- if (direction === "top") {
- // direction = 'center'
- height = height / 4;
- }
- else if (direction === "bottom") {
- // direction = 'center'
- top = top + height / 4 * 3;
- height = height / 4;
- }
- else if (direction === "left") {
- width = width / 4;
- }
- else if (direction === "right") {
- left = left + width / 4 * 3;
- width = width / 4;
- }
- this.$direction = $$1("<div id='direction" + this.id + "'>");
- this.$direction.css({
- position: 'absolute',
- top: top, left: left, width: width, height: height,
- // border: '2px dashed #1890ff',
- background: 'rgba(40,224,218,0.75)',
- zIndex: 100,
- });
- this.$direction.appendTo(this.$overlay);
- // }
- }
- };
- ViewDesign.prototype.removeDirection = function () {
- if (this.$direction) {
- this.$direction.remove();
- this.$direction = null;
- }
- };
- ViewDesign.prototype.putVjosn = function (sourceVjId, sourceVjson, targetVjId, direction, dragType) {
- var arrS;
- if (sourceVjId) {
- arrS = findArrayContainer(this.vjson, sourceVjId);
- sourceVjson = _$1.cloneDeep(findInCode(this.vjson, sourceVjId));
- var indexS = _$1.findIndex(arrS, function (v) {
- return v.id === sourceVjId;
- });
- if (indexS < 0) {
- return;
- }
- }
- delete sourceVjson.id;
- var vjsonT = findInCode(this.vjson, targetVjId);
- var arrT = findArrayContainer(this.vjson, targetVjId);
- var indexT = _$1.findIndex(arrT, function (v) {
- return v.id === targetVjId;
- });
- if (indexT < 0) {
- return;
- }
- switch (direction) {
- case 'top':
- case 'left':
- if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
- || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
- vjsonT.items.splice(0, 0, sourceVjson);
- }
- else {
- arrT.splice(indexT, 0, sourceVjson);
- }
- break;
- case 'bottom':
- case 'right':
- if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
- || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
- vjsonT.items.push(sourceVjson);
- }
- else {
- arrT.splice(indexT + 1, 0, sourceVjson);
- }
- break;
- case 'center':
- if ((dragType === "col-item" && colsContainerArr.indexOf(vjsonT.xtype) >= 0)
- || (dragType === "row-item" && rowsContainerArr.indexOf(vjsonT.xtype) >= 0)) {
- vjsonT.items.push(sourceVjson);
- }
- else {
- arrT.splice(indexT, 1, sourceVjson);
- }
- break;
- }
- if (sourceVjId) {
- deletVjsonById(this.vjson, sourceVjId);
- sourceVjson.id = sourceVjId;
- }
- this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
- };
- // todo ======== 事件 ==========
- // 接收 postMessage 事件分发
- ViewDesign.prototype.onMessageEvent = function (event) {
- var _a, _b;
- var fucName = (_a = event === null || event === void 0 ? void 0 : event.data) === null || _a === void 0 ? void 0 : _a.method;
- if (fucName && typeof this[fucName] === 'function') {
- this[fucName](((_b = event === null || event === void 0 ? void 0 : event.data) === null || _b === void 0 ? void 0 : _b.args) || null);
- }
- };
- // 接收外部选中组件事件
- ViewDesign.prototype.onComponentSelectionChange = function (id, from) {
- if (from !== this.name) {
- this.setSelection(id);
- }
- };
- // 接收外部组件删除事件
- ViewDesign.prototype.onComponentDelete = function (id, from) {
- if (from !== this.name) {
- this.deleteComponent(id);
- }
- };
- // 组件被选中
- ViewDesign.prototype.onComponentSelect = function (args) {
- if (args[2] != this.moduleId) {
- return;
- }
- if (args[0]) {
- var rect = args[0];
- var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
- rect.x = position.x;
- rect.y = position.y;
- this.clearSelection();
- this.appendMaskbox(rect, args[1]);
- this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, { id: args[1], from: this.name });
- }
- };
- ViewDesign.prototype.onComponentInfo = function (_a) {
- var _b = __read(_a, 4), rect = _b[0], vjsonId = _b[1], moduleId = _b[2], direction = _b[3];
- if (moduleId != this.moduleId) {
- return;
- }
- if (rect) {
- var position = this.getPosition({ x: rect.x, y: rect.y }, "overlay", "main", this.$overlay[0]);
- rect.x = position.x;
- rect.y = position.y;
- var top = rect.top, left = rect.left, width = rect.width, height = rect.height;
- var cv_1 = findInCode(this.vjson, vjsonId);
- if (this.$direction) {
- $$1('#direction' + this.id).remove();
- }
- if (_$1.findIndex(colsContainerArr, function (it) { return it === cv_1.xtype; }) >= 0) ;
- else if (_$1.findIndex(colItemCmpArr, function (it) { return it === cv_1.xtype; }) >= 0) {
- if (direction) {
- if (direction === "top") {
- direction = 'center';
- //height = height/3
- }
- else if (direction === "bottom") {
- direction = 'center';
- // top=top+height/3*2
- // height = height/3
- }
- else if (direction === "left") {
- width = width / 3;
- }
- else if (direction === "right") {
- left = left + width / 3 * 2;
- width = width / 3;
- }
- this.$direction = $$1("<div id='direction" + this.id + "'>");
- this.$direction.css({
- position: 'absolute',
- top: top, left: left, width: width, height: height,
- // border: '2px dashed #1890ff',
- background: 'rgba(74,106,201,0.42)',
- zIndex: 100,
- });
- this.$direction.appendTo(this.$overlay);
- }
- }
- console.log("direction", direction);
- // const position = this.getPosition({x: rect.x, y: rect.y}, "iframe", "main", this.$overlay[0])
- // rect.x = position.x
- // rect.y = position.y
- // this.clearSelection()
- // this.appendMaskbox(rect, args[1])
- // this.moduleObject.moduleEventBus.publish(EventType.ComponentSelectionChange, {id: args[1], from: this.name})
- }
- };
- ViewDesign.prototype.onUndo = function () {
- if (this.undoVjsonList.length > 0) {
- if (this.redoVjsonList.length >= 100) {
- this.redoVjsonList.splice(0, this.redoVjsonList.length - historySize + 1);
- }
- this.redoVjsonList.push(_$1.cloneDeep(this.lastVjson));
- this.vjson = this.undoVjsonList.pop();
- // this.setVjson(this.vjson, "", false, "undo")
- this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "undo" });
- }
- };
- ViewDesign.prototype.onRedo = function () {
- if (this.redoVjsonList.length > 0) {
- if (this.undoVjsonList.length >= 100) {
- this.undoVjsonList.splice(0, this.undoVjsonList.length - historySize + 1);
- }
- this.undoVjsonList.push(_$1.cloneDeep(this.lastVjson));
- this.vjson = this.redoVjsonList.pop();
- // this.setVjson(this.vjson, "", false, "redo")
- this.moduleObject.moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson, from: "redo" });
- }
- };
- ViewDesign.prototype.onKeyPress = function (event) {
- // if ((event.ctrlKey && _.upperCase(event.key) === "Z") || (event.metaKey && (!event.shiftKey) && _.upperCase(event.key) === "Z")) {
- // if (this.backStep()) {
- // event.stopPropagation()
- // event.preventDefault()
- // return
- // }
- // }
- //
- // if ((event.ctrlKey && _.upperCase(event.key) === "Y") || (event.metaKey && event.shiftKey && _.upperCase(event.key) === "Z")) {
- // if (this.recoverStep()) {
- // event.stopPropagation()
- // event.preventDefault()
- // return
- // }
- // }
- // if (event.key === 'ArrowUp') {
- // if (this.selectParent()) {
- // event.stopPropagation()
- // event.preventDefault()
- // return;
- // }
- // }
- if (!event.ctrlKey && !event.metaKey && (event.key === "Delete" || event.key === 'Backspace')) {
- this.deleteComponent(this.moduleObject.modulePage.currentComponentSelectId);
- event.stopPropagation();
- event.preventDefault();
- return;
- }
- // if ((event.ctrlKey && _.upperCase(event.key) === "C") || (event.metaKey && _.upperCase(event.key) === "C")) {
- // if (this.copyView()) {
- // event.stopPropagation()
- // event.preventDefault()
- // return;
- // }
- // }
- // if ((event.ctrlKey && _.upperCase(event.key) === "X") || (event.metaKey && _.upperCase(event.key) === "X")) {
- // if (this.copyView(true)) {
- // event.stopPropagation()
- // event.preventDefault()
- // return;
- // }
- // }
- //
- // if ((event.ctrlKey && _.upperCase(event.key) === "A") || (event.metaKey && _.upperCase(event.key) === "A")) {
- // if (this.selectRoot()) {
- // event.stopPropagation()
- // event.preventDefault()
- // return;
- // }
- //
- };
- ViewDesign.prototype.onCopy = function (event) {
- if (this.moduleObject.modulePage.currentComponentSelectId) {
- var copyVjson = findInCode(this.vjson, this.moduleObject.modulePage.currentComponentSelectId);
- if (copyVjson) {
- removeDesignProp(copyVjson);
- this.moduleObject.modulePage.currentCopyVjson = copyVjson;
- native.clipboardSet(YvanUI$1.json5.stringify(copyVjson, null, ' '));
- }
- }
- };
- ViewDesign.prototype.onPaste = function (event) {
- debugger;
- };
- ViewDesign.prototype.onfocus = function () {
- console.log("getCopy");
- console.log("document.activeElement", document.activeElement.id);
- // clearTimeout(this.getOuterCopyValueTimer);
- // native.clipboardRead()
- };
- ViewDesign.prototype.onMousemove = function (event) {
- var _a;
- if (document.activeElement.id === this.$overlay[0].id) {
- // console.log(event.clientX, event.clientY)
- if ((_a = this.moduleObject.modulePage.currentCopyVjson) === null || _a === void 0 ? void 0 : _a.hasOwnProperty("xtype")) {
- var position = this.getPosition({ x: event.clientX, y: event.clientY }, "main", "overlay");
- // this.iframeWindow.postMessage({
- // method: 'overlayGetInfo',
- // args: [position, this.moduleId]
- // }, '*')
- }
- }
- };
- ViewDesign.prototype.onDestroy = function () {
- window.removeEventListener('message', this.onMessageEvent.bind(this));
- for (var i = 0; i < this.subscribeList.length; i++) {
- this.subscribeList[i].cancel();
- }
- };
- // todo ======== 工具方法 ==========
- ViewDesign.prototype.getPosition = function (pos, from, to, relative) {
- if (relative === void 0) { relative = null; }
- if (from === "main" && to === "overlay") {
- var overlayRect = this.$overlay[0].getBoundingClientRect();
- var x = overlayRect.x;
- var y = overlayRect.y;
- if (relative) {
- var relativeRect = relative.getBoundingClientRect();
- console.log("main->", relativeRect.x, relativeRect.y);
- x = x - relativeRect.x;
- y = y - relativeRect.y;
- }
- pos.x = pos.x - x;
- pos.y = pos.y - y;
- }
- else if (from === "overlay" && to === "main") {
- var overlayRect = this.$overlay[0].getBoundingClientRect();
- var x = overlayRect.x;
- var y = overlayRect.y;
- if (relative) {
- var relativeRect = relative.getBoundingClientRect();
- console.log("iframe->", relativeRect.x, relativeRect.y);
- x = x - relativeRect.x;
- y = y - relativeRect.y;
- }
- pos.x = pos.x + x;
- pos.y = pos.y + y;
- }
- return pos;
- };
- ViewDesign.prototype.getDirection = function (x, y, rect, dragType) {
- if (x > rect.x + rect.width / 3 && x < rect.x + (rect.width / 3 * 2)
- && y > rect.y + rect.height / 3 && y < rect.y + (rect.height / 3 * 2)) {
- return "center";
- }
- // col-item 只能放左右
- if (dragType === "col-item" || dragType === "") {
- if (y > rect.y + rect.height / 4 && y < rect.y + (rect.height / 4 * 3)) {
- if (x > rect.x && x < rect.x + rect.width / 3) {
- return "left";
- }
- else if (x < rect.x + rect.width && x > rect.x + (rect.width / 3 * 2)) {
- return "right";
- }
- }
- }
- // cols-container 只能放上下
- if (dragType === "cols-container" || dragType === "") {
- if (x > rect.x + rect.width / 4 && x < rect.x + (rect.width / 4 * 3)) {
- if (y > rect.y && y < rect.y + rect.height / 3) {
- return "top";
- }
- else if (y < rect.y + rect.height && y > rect.y + (rect.height / 3 * 2)) {
- return "bottom";
- }
- }
- }
- return "";
- };
- return ViewDesign;
- }());
- //
- var model$8 = {
- data: {
- iframeSrc: ''
- }
- };
- var vjson$8 = {
- layout: 'fit',
- border: false,
- iconCls: 'x-fa fa-newspaper-o',
- referenceHolder: true,
- items: [
- {
- layout: 'border',
- border: false,
- items: [
- {
- region: 'center',
- xtype: 'tabpanel',
- border: false,
- tabPosition: 'bottom',
- reference: 'tabPanel',
- listeners: {
- tabchange: 'scope.tabchange'
- },
- defaults: {
- border: false,
- },
- items: [
- {
- title: 'controller.js',
- xtype: 'jseditor',
- reference: 'controllerEditor',
- },
- {
- title: 'view.design',
- xtype: 'designer',
- reference: 'designer',
- listeners: {
- afterrender: 'scope.previewRender'
- },
- },
- {
- title: 'view.js',
- xtype: 'jseditor',
- reference: 'viewEditor',
- },
- {
- title: 'model.js',
- xtype: 'jseditor',
- reference: 'modelEditor',
- },
- {
- title: 'groovy',
- xtype: 'groovyeditor',
- reference: 'groovyEditor',
- },
- {
- title: 'SQL',
- xtype: 'sqleditor',
- reference: 'sqlEditor',
- }
- ]
- }
- ]
- }
- ]
- };
- var ModulePage = /** @class */ (function (_super) {
- __extends(ModulePage, _super);
- function ModulePage(moduleId, module) {
- var _this = _super.call(this, { model: model$8, vjson: vjson$8 }) || this;
- _this.name = "ModulePage";
- _this.viewDesign = null;
- _this.maxViewId = 0;
- _this.moduleEventBus = new EventBus();
- _this.codeChange = _$2.debounce(function (code, from, e) {
- try {
- switch (from) {
- case _this.refs.controllerEditor.name:
- moduleStore.updateJsController(_this.moduleId, code, from);
- break;
- case _this.refs.viewEditor.name:
- moduleStore.updateJsView(_this.moduleId, code, from);
- break;
- case _this.refs.modelEditor.name:
- moduleStore.updateJsModel(_this.moduleId, code, from);
- break;
- case _this.refs.groovyEditor.name:
- moduleStore.updateGroovy(_this.moduleId, code, from);
- break;
- case _this.refs.sqlEditor.name:
- moduleStore.updateMybatis(_this.moduleId, code, from);
- break;
- }
- }
- catch (e) {
- }
- }, 500, { maxWait: 10000 });
- _this.moduleId = moduleId;
- _this.module = module;
- _this.cancelSubscribe = [];
- _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ModuleItemChange, function (moduleItem) {
- _this.initEditor(moduleItem);
- }));
- _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
- var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
- _this.previewReRender();
- }));
- _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
- var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
- _this.updateVjson(vjson, from, ignoreRenderUI);
- }));
- _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.UpdateComponentVjson, function (_a) {
- var cmpVjson = _a.cmpVjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
- _this.updateComponentVjson(cmpVjson, from, ignoreRenderUI);
- }));
- _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
- var id = _a.id, from = _a.from;
- _this.onComponentSelectionChange(id, from);
- }));
- _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Undo, function () {
- _this.onUndo();
- }));
- _this.cancelSubscribe.push(_this.moduleEventBus.subscribe(EventType.Redo, function () {
- _this.onRedo();
- }));
- _this.cancelSubscribe.push(eventBus.subscribe(EventType.ClipboardRead, function (value) {
- _this.currentCopyVjson = stringToJsonObj(value);
- }));
- return _this;
- }
- ModulePage.prototype.onLoad = function () {
- var _this = this;
- // this.refs.preview.src = href
- // eventBus.subscribe(EventType.SetVjson, ({vjson, from, ignoreRenderUI}) => this.setVjson(vjson, from, ignoreRenderUI));
- this.cancelSubscribe.push(eventBus.subscribe(EventType.SaveCall, function () {
- _this.saveCall();
- }));
- this.activeEditor = this.refs.controllerEditor;
- this.refs.controllerEditor.modulePage = this;
- this.refs.viewEditor.modulePage = this;
- this.refs.modelEditor.modulePage = this;
- this.refs.groovyEditor.modulePage = this;
- this.refs.sqlEditor.modulePage = this;
- this.refs.controllerEditor.name = "controllerEditor";
- this.refs.viewEditor.name = "viewEditor";
- this.refs.modelEditor.name = "modelEditor";
- this.refs.groovyEditor.name = "groovyEditor";
- this.refs.sqlEditor.name = "sqlEditor";
- this.refs.controllerEditor.codeChange = this.codeChange;
- this.refs.viewEditor.codeChange = this.codeChange;
- this.refs.modelEditor.codeChange = this.codeChange;
- this.refs.groovyEditor.codeChange = this.codeChange;
- this.refs.sqlEditor.codeChange = this.codeChange;
- };
- ModulePage.prototype.updateComponentVjson = function (cmpVjson, from, ignoreRenderUI) {
- if (!cmpVjson || from === this.name) {
- return;
- }
- var vj = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
- replaceVjsonById(vj, cmpVjson);
- this.updateVjson(vj, from, ignoreRenderUI);
- };
- ModulePage.prototype.updateVjson = function (vjson, from, ignoreRenderUI) {
- var _this = this;
- var _a, _b;
- if (!vjson || from === this.name) {
- return;
- }
- this.addViewId(vjson);
- moduleStore.getModuleObject(this.moduleId).moduleObj.vjson = vjson;
- moduleStore.getModuleObject(this.moduleId).fileContent.jsView = vjsonTojsView(vjson);
- (_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);
- this.previewReRender();
- _$2.defer(function () {
- _this.moduleEventBus.publish(EventType.SetVjson, { vjson: vjson, from: from });
- });
- };
- ModulePage.prototype.previewRender = function (sender) {
- var _this = this;
- var vjson = moduleStore.getModuleObject(this.moduleId).moduleObj.vjson;
- if (!this.designScope) {
- this.designScope = new Scope({
- vjson: vjson,
- model: {
- data: {}
- }
- });
- }
- else {
- this.designScope.vjson = vjson;
- }
- this.designScope.showDesigner(sender, {
- moduleId: this.moduleId,
- });
- if (this.viewDesign) {
- return;
- }
- _$2.defer(function () {
- _this.viewDesign = new ViewDesign(_this.moduleId, _this.refs.designer);
- handles$1.mainWindow.setLoading(false);
- });
- };
- ModulePage.prototype.previewReRender = function () {
- var designer = this.refs.designer;
- this.previewRender(designer);
- };
- ModulePage.prototype.initEditor = function (moduleItem) {
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
- if (!(moduleItem === null || moduleItem === void 0 ? void 0 : moduleItem.fileContent))
- return;
- (_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);
- (_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);
- (_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);
- (_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);
- (_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);
- };
- ModulePage.prototype.onComponentSelectionChange = function (id, from) {
- this.currentComponentSelectId = id;
- };
- ModulePage.prototype.onUndo = function () {
- if (this.activeEditor === this.refs.designer && this.viewDesign) {
- this.viewDesign.onUndo();
- }
- };
- ModulePage.prototype.onRedo = function () {
- if (this.activeEditor === this.refs.designer && this.viewDesign) {
- this.viewDesign.onRedo();
- }
- };
- ModulePage.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
- this.activeEditor = newCard;
- eventBus.publish(EventType.ModuleTabChange, { newCard: newCard, oldCard: oldCard, eOpts: eOpts });
- };
- ModulePage.prototype.saveCall = function () {
- if (this.activeEditor === this.refs.designer || this.activeEditor === this.refs.viewEditor) {
- moduleStore.saveFile(this.moduleId, "jsView");
- }
- else if (this.activeEditor === this.refs.controllerEditor) {
- moduleStore.saveFile(this.moduleId, "jsController");
- }
- else if (this.activeEditor === this.refs.modelEditor) {
- moduleStore.saveFile(this.moduleId, "jsModel");
- }
- else if (this.activeEditor === this.refs.groovyEditor) {
- moduleStore.saveFile(this.moduleId, "groovy");
- }
- else if (this.activeEditor === this.refs.sqlEditor) {
- moduleStore.saveFile(this.moduleId, "mybatis");
- }
- };
- ModulePage.prototype.check = function () {
- moduleStore.check(this.moduleId);
- };
- /**
- * 为vjson添加id
- * @param vjson
- * @param isAll
- */
- ModulePage.prototype.addViewId = function (vjson, isAll) {
- var _this = this;
- if (isAll === void 0) { isAll = false; }
- var maxIdTag = 0;
- // 先提取当前的最大id
- deepTravVJson(vjson, function (obj) {
- if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
- return;
- }
- if (obj.id && obj.id.indexOf(idPrefix)) {
- var sutr = obj.id.substring(obj.id.indexOf(idPrefix));
- if (sutr.length > 0) {
- var tid = sutr.replace(idPrefix, "");
- var idNum = parseInt(tid);
- if (idNum && maxIdTag < idNum) {
- maxIdTag = idNum;
- }
- }
- }
- });
- // 标记最大的id号,避免重复
- this.maxViewId = maxIdTag;
- deepTravVJson(vjson, function (obj) {
- if (Array.isArray(obj) || !obj || (!obj.xtype && !obj.layout)) {
- return;
- }
- if (!obj.hasOwnProperty('id')) {
- obj.id = _this.createViewId();
- }
- if (!obj.hasOwnProperty('designMode')) {
- obj.designMode = true;
- }
- // if (obj.xtype == "tabview" && obj.activeTab) {
- // // 设置默认的选项
- // if (obj.activeTab && !this._tabViewSelect.hasOwnProperty(obj.id)) {
- // if (typeof obj.activeTab === 'number') {
- // this._tabViewSelect[obj.id] = obj.items[obj.activeTab].id
- // } else if (typeof obj.activeTab === 'string') {
- // this._tabViewSelect[obj.id] = obj.activeTab
- // }
- //
- // }
- // }
- if (isAll && obj.hasOwnProperty("view")) ;
- });
- return vjson;
- };
- /**
- * 为组件创建 ID
- */
- ModulePage.prototype.createViewId = function () {
- this.maxViewId++;
- return this.id + idPrefix + this.maxViewId;
- };
- ModulePage.prototype.onDestroy = function () {
- for (var i = 0; i < this.cancelSubscribe.length; i++) {
- this.cancelSubscribe[i].cancel();
- }
- _super.prototype.onDestroy.call(this);
- };
- return ModulePage;
- }(Scope));
- var camundaModdleDescriptor = {
- "name": "Camunda",
- "uri": "http://camunda.org/schema/1.0/bpmn",
- "prefix": "camunda",
- "xml": {
- "tagAlias": "lowerCase"
- },
- "associations": [],
- "types": [
- {
- "name": "Definitions",
- "isAbstract": true,
- "extends": [
- "bpmn:Definitions"
- ],
- "properties": [
- {
- "name": "diagramRelationId",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "InOutBinding",
- "superClass": [
- "Element"
- ],
- "isAbstract": true,
- "properties": [
- {
- "name": "source",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "sourceExpression",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "target",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "businessKey",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "local",
- "isAttr": true,
- "type": "Boolean",
- "default": false
- },
- {
- "name": "variables",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "In",
- "superClass": [
- "InOutBinding"
- ],
- "meta": {
- "allowedIn": [
- "bpmn:CallActivity",
- "bpmn:SignalEventDefinition"
- ]
- }
- },
- {
- "name": "Out",
- "superClass": [
- "InOutBinding"
- ],
- "meta": {
- "allowedIn": [
- "bpmn:CallActivity"
- ]
- }
- },
- {
- "name": "AsyncCapable",
- "isAbstract": true,
- "extends": [
- "bpmn:Activity",
- "bpmn:Gateway",
- "bpmn:Event"
- ],
- "properties": [
- {
- "name": "async",
- "isAttr": true,
- "type": "Boolean",
- "default": false
- },
- {
- "name": "asyncBefore",
- "isAttr": true,
- "type": "Boolean",
- "default": false
- },
- {
- "name": "asyncAfter",
- "isAttr": true,
- "type": "Boolean",
- "default": false
- },
- {
- "name": "exclusive",
- "isAttr": true,
- "type": "Boolean",
- "default": true
- }
- ]
- },
- {
- "name": "JobPriorized",
- "isAbstract": true,
- "extends": [
- "bpmn:Process",
- "camunda:AsyncCapable"
- ],
- "properties": [
- {
- "name": "jobPriority",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "SignalEventDefinitionExtension",
- "isAbstract": true,
- "extends": [
- "bpmn:SignalEventDefinition"
- ],
- "properties": [
- {
- "name": "async",
- "isAttr": true,
- "type": "Boolean",
- "default": false
- }
- ]
- },
- {
- "name": "ErrorEventDefinitionExtension",
- "isAbstract": true,
- "extends": [
- "bpmn:ErrorEventDefinition"
- ],
- "properties": [
- {
- "name": "errorCodeVariable",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "errorMessageVariable",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "ErrorEventDefinition",
- "superClass": [
- "bpmn:ErrorEventDefinition",
- "Element"
- ],
- "properties": [
- {
- "name": "expression",
- "isAttr": true,
- "type": "String"
- }
- ],
- "meta": {
- "allowedIn": ["bpmn:ServiceTask"]
- }
- },
- {
- "name": "Error",
- "isAbstract": true,
- "extends": [
- "bpmn:Error"
- ],
- "properties": [
- {
- "name": "camunda:errorMessage",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "PotentialStarter",
- "superClass": [
- "Element"
- ],
- "properties": [
- {
- "name": "resourceAssignmentExpression",
- "type": "bpmn:ResourceAssignmentExpression"
- }
- ]
- },
- {
- "name": "FormSupported",
- "isAbstract": true,
- "extends": [
- "bpmn:StartEvent",
- "bpmn:UserTask"
- ],
- "properties": [
- {
- "name": "formHandlerClass",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "formKey",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "formRef",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "formRefBinding",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "formRefVersion",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "TemplateSupported",
- "isAbstract": true,
- "extends": [
- "bpmn:Collaboration",
- "bpmn:Process",
- "bpmn:FlowElement"
- ],
- "properties": [
- {
- "name": "modelerTemplate",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "modelerTemplateVersion",
- "isAttr": true,
- "type": "Integer"
- }
- ]
- },
- {
- "name": "Initiator",
- "isAbstract": true,
- "extends": ["bpmn:StartEvent"],
- "properties": [
- {
- "name": "initiator",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "ScriptTask",
- "isAbstract": true,
- "extends": [
- "bpmn:ScriptTask"
- ],
- "properties": [
- {
- "name": "resultVariable",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "resource",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "Process",
- "isAbstract": true,
- "extends": [
- "bpmn:Process"
- ],
- "properties": [
- {
- "name": "candidateStarterGroups",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "candidateStarterUsers",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "versionTag",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "historyTimeToLive",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "isStartableInTasklist",
- "isAttr": true,
- "type": "Boolean",
- "default": true
- }
- ]
- },
- {
- "name": "EscalationEventDefinitionExtension",
- "isAbstract": true,
- "extends": [
- "bpmn:EscalationEventDefinition"
- ],
- "properties": [
- {
- "name": "escalationCodeVariable",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "FormalExpression",
- "isAbstract": true,
- "extends": [
- "bpmn:FormalExpression"
- ],
- "properties": [
- {
- "name": "resource",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "Assignable",
- "extends": ["bpmn:UserTask"],
- "properties": [
- {
- "name": "assignee",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "candidateUsers",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "candidateGroups",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "dueDate",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "followUpDate",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "priority",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "CallActivity",
- "extends": ["bpmn:CallActivity"],
- "properties": [
- {
- "name": "calledElementBinding",
- "isAttr": true,
- "type": "String",
- "default": "latest"
- },
- {
- "name": "calledElementVersion",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "calledElementVersionTag",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "calledElementTenantId",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "caseRef",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "caseBinding",
- "isAttr": true,
- "type": "String",
- "default": "latest"
- },
- {
- "name": "caseVersion",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "caseTenantId",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "variableMappingClass",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "variableMappingDelegateExpression",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "ServiceTaskLike",
- "extends": [
- "bpmn:ServiceTask",
- "bpmn:BusinessRuleTask",
- "bpmn:SendTask",
- "bpmn:MessageEventDefinition"
- ],
- "properties": [
- {
- "name": "expression",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "class",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "delegateExpression",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "resultVariable",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "DmnCapable",
- "extends": [
- "bpmn:BusinessRuleTask"
- ],
- "properties": [
- {
- "name": "decisionRef",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "decisionRefBinding",
- "isAttr": true,
- "type": "String",
- "default": "latest"
- },
- {
- "name": "decisionRefVersion",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "mapDecisionResult",
- "isAttr": true,
- "type": "String",
- "default": "resultList"
- },
- {
- "name": "decisionRefTenantId",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "ExternalCapable",
- "extends": [
- "camunda:ServiceTaskLike"
- ],
- "properties": [
- {
- "name": "type",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "topic",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "TaskPriorized",
- "extends": [
- "bpmn:Process",
- "camunda:ExternalCapable"
- ],
- "properties": [
- {
- "name": "taskPriority",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "Properties",
- "superClass": [
- "Element"
- ],
- "meta": {
- "allowedIn": ["*"]
- },
- "properties": [
- {
- "name": "values",
- "type": "Property",
- "isMany": true
- }
- ]
- },
- {
- "name": "Property",
- "superClass": [
- "Element"
- ],
- "properties": [
- {
- "name": "id",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "name",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "value",
- "type": "String",
- "isAttr": true
- }
- ]
- },
- {
- "name": "Connector",
- "superClass": [
- "Element"
- ],
- "meta": {
- "allowedIn": [
- "camunda:ServiceTaskLike"
- ]
- },
- "properties": [
- {
- "name": "inputOutput",
- "type": "InputOutput"
- },
- {
- "name": "connectorId",
- "type": "String"
- }
- ]
- },
- {
- "name": "InputOutput",
- "superClass": [
- "Element"
- ],
- "meta": {
- "allowedIn": [
- "bpmn:FlowNode",
- "camunda:Connector"
- ]
- },
- "properties": [
- {
- "name": "inputOutput",
- "type": "InputOutput"
- },
- {
- "name": "connectorId",
- "type": "String"
- },
- {
- "name": "inputParameters",
- "isMany": true,
- "type": "InputParameter"
- },
- {
- "name": "outputParameters",
- "isMany": true,
- "type": "OutputParameter"
- }
- ]
- },
- {
- "name": "InputOutputParameter",
- "properties": [
- {
- "name": "name",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "value",
- "isBody": true,
- "type": "String"
- },
- {
- "name": "definition",
- "type": "InputOutputParameterDefinition"
- }
- ]
- },
- {
- "name": "InputOutputParameterDefinition",
- "isAbstract": true
- },
- {
- "name": "List",
- "superClass": ["InputOutputParameterDefinition"],
- "properties": [
- {
- "name": "items",
- "isMany": true,
- "type": "InputOutputParameterDefinition"
- }
- ]
- },
- {
- "name": "Map",
- "superClass": ["InputOutputParameterDefinition"],
- "properties": [
- {
- "name": "entries",
- "isMany": true,
- "type": "Entry"
- }
- ]
- },
- {
- "name": "Entry",
- "properties": [
- {
- "name": "key",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "value",
- "isBody": true,
- "type": "String"
- },
- {
- "name": "definition",
- "type": "InputOutputParameterDefinition"
- }
- ]
- },
- {
- "name": "Value",
- "superClass": [
- "InputOutputParameterDefinition"
- ],
- "properties": [
- {
- "name": "id",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "name",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "value",
- "isBody": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "Script",
- "superClass": ["InputOutputParameterDefinition"],
- "properties": [
- {
- "name": "scriptFormat",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "resource",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "value",
- "isBody": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "Field",
- "superClass": ["Element"],
- "meta": {
- "allowedIn": [
- "camunda:ServiceTaskLike",
- "camunda:ExecutionListener",
- "camunda:TaskListener"
- ]
- },
- "properties": [
- {
- "name": "name",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "expression",
- "type": "String"
- },
- {
- "name": "stringValue",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "string",
- "type": "String"
- }
- ]
- },
- {
- "name": "InputParameter",
- "superClass": ["InputOutputParameter"]
- },
- {
- "name": "OutputParameter",
- "superClass": ["InputOutputParameter"]
- },
- {
- "name": "Collectable",
- "isAbstract": true,
- "extends": ["bpmn:MultiInstanceLoopCharacteristics"],
- "superClass": ["camunda:AsyncCapable"],
- "properties": [
- {
- "name": "collection",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "elementVariable",
- "isAttr": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "FailedJobRetryTimeCycle",
- "superClass": ["Element"],
- "meta": {
- "allowedIn": [
- "camunda:AsyncCapable",
- "bpmn:MultiInstanceLoopCharacteristics"
- ]
- },
- "properties": [
- {
- "name": "body",
- "isBody": true,
- "type": "String"
- }
- ]
- },
- {
- "name": "ExecutionListener",
- "superClass": ["Element"],
- "meta": {
- "allowedIn": [
- "bpmn:Task",
- "bpmn:ServiceTask",
- "bpmn:UserTask",
- "bpmn:BusinessRuleTask",
- "bpmn:ScriptTask",
- "bpmn:ReceiveTask",
- "bpmn:ManualTask",
- "bpmn:ExclusiveGateway",
- "bpmn:SequenceFlow",
- "bpmn:ParallelGateway",
- "bpmn:InclusiveGateway",
- "bpmn:EventBasedGateway",
- "bpmn:StartEvent",
- "bpmn:IntermediateCatchEvent",
- "bpmn:IntermediateThrowEvent",
- "bpmn:EndEvent",
- "bpmn:BoundaryEvent",
- "bpmn:CallActivity",
- "bpmn:SubProcess",
- "bpmn:Process"
- ]
- },
- "properties": [
- {
- "name": "expression",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "class",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "delegateExpression",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "event",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "script",
- "type": "Script"
- },
- {
- "name": "fields",
- "type": "Field",
- "isMany": true
- }
- ]
- },
- {
- "name": "TaskListener",
- "superClass": ["Element"],
- "meta": {
- "allowedIn": [
- "bpmn:UserTask"
- ]
- },
- "properties": [
- {
- "name": "expression",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "class",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "delegateExpression",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "event",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "script",
- "type": "Script"
- },
- {
- "name": "fields",
- "type": "Field",
- "isMany": true
- },
- {
- "name": "id",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "eventDefinitions",
- "type": "bpmn:TimerEventDefinition",
- "isMany": true
- }
- ]
- },
- {
- "name": "FormProperty",
- "superClass": ["Element"],
- "meta": {
- "allowedIn": [
- "bpmn:StartEvent",
- "bpmn:UserTask"
- ]
- },
- "properties": [
- {
- "name": "id",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "name",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "type",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "required",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "readable",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "writable",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "variable",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "expression",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "datePattern",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "default",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "values",
- "type": "Value",
- "isMany": true
- }
- ]
- },
- {
- "name": "FormData",
- "superClass": ["Element"],
- "meta": {
- "allowedIn": [
- "bpmn:StartEvent",
- "bpmn:UserTask"
- ]
- },
- "properties": [
- {
- "name": "fields",
- "type": "FormField",
- "isMany": true
- },
- {
- "name": "businessKey",
- "type": "String",
- "isAttr": true
- }
- ]
- },
- {
- "name": "FormField",
- "superClass": ["Element"],
- "properties": [
- {
- "name": "id",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "label",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "type",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "datePattern",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "defaultValue",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "properties",
- "type": "Properties"
- },
- {
- "name": "validation",
- "type": "Validation"
- },
- {
- "name": "values",
- "type": "Value",
- "isMany": true
- }
- ]
- },
- {
- "name": "Validation",
- "superClass": ["Element"],
- "properties": [
- {
- "name": "constraints",
- "type": "Constraint",
- "isMany": true
- }
- ]
- },
- {
- "name": "Constraint",
- "superClass": ["Element"],
- "properties": [
- {
- "name": "name",
- "type": "String",
- "isAttr": true
- },
- {
- "name": "config",
- "type": "String",
- "isAttr": true
- }
- ]
- },
- {
- "name": "ConditionalEventDefinitionExtension",
- "isAbstract": true,
- "extends": [
- "bpmn:ConditionalEventDefinition"
- ],
- "properties": [
- {
- "name": "variableName",
- "isAttr": true,
- "type": "String"
- },
- {
- "name": "variableEvents",
- "isAttr": true,
- "type": "String"
- }
- ]
- }
- ],
- "emumerations": []
- };
- /**
- * This is a sample file that should be replaced with the actual translation.
- *
- * Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
- * translations and labels to translate.
- */
- var translations = {
- // Labels
- 'Activate the global connect tool': '激活全局连接工具',
- 'Append {type}': '追加 {type}',
- 'Append EndEvent': '追加 结束事件 ',
- 'Append Task': '追加 任务',
- 'Append Gateway': '追加 网关',
- 'Append Intermediate/Boundary Event': '追加 中间/边界 事件',
- 'Add Lane above': '在上面添加道',
- 'Divide into two Lanes': '分割成两个道',
- 'Divide into three Lanes': '分割成三个道',
- 'Add Lane below': '在下面添加道',
- 'Append compensation activity': '追加补偿活动',
- 'Change type': '修改类型',
- 'Connect using Association': '使用关联连接',
- 'Connect using Sequence/MessageFlow or Association': '使用顺序/消息流或者关联连接',
- 'Connect using DataInputAssociation': '使用数据输入关联连接',
- 'Remove': '移除',
- 'Activate the hand tool': '激活抓手工具',
- 'Activate the lasso tool': '激活套索工具',
- 'Activate the create/remove space tool': '激活创建/删除空间工具',
- 'Create expanded SubProcess': '创建扩展子过程',
- 'Create IntermediateThrowEvent/BoundaryEvent': '创建中间抛出事件/边界事件',
- 'Create Pool/Participant': '创建池/参与者',
- 'Parallel Multi Instance': '并行多重事件',
- 'Sequential Multi Instance': '时序多重事件',
- 'DataObjectReference': '数据对象参考',
- 'DataStoreReference': '数据存储参考',
- 'Loop': '循环',
- 'Ad-hoc': '即席',
- 'Create {type}': '创建 {type}',
- 'Create Task': '创建任务',
- 'Create StartEvent': '创建开始事件',
- 'Create EndEvent': '创建结束事件',
- 'Create Group': '创建组',
- 'Task': '任务',
- 'Send Task': '发送任务',
- 'Receive Task': '接收任务',
- 'User Task': '用户任务',
- 'Manual Task': '手工任务',
- 'Business Rule Task': '业务规则任务',
- 'Service Task': '服务任务',
- 'Script Task': '脚本任务',
- 'Call Activity': '调用活动',
- 'Sub Process (collapsed)': '子流程(折叠的)',
- 'Sub Process (expanded)': '子流程(展开的)',
- 'Start Event': '开始事件',
- 'StartEvent': '开始事件',
- 'Intermediate Throw Event': '中间事件',
- 'End Event': '结束事件',
- 'EndEvent': '结束事件',
- 'Create Gateway': '创建网关',
- 'GateWay': '网关',
- 'Create Intermediate/Boundary Event': '创建中间/边界事件',
- 'Message Start Event': '消息开始事件',
- 'Timer Start Event': '定时开始事件',
- 'Conditional Start Event': '条件开始事件',
- 'Signal Start Event': '信号开始事件',
- 'Error Start Event': '错误开始事件',
- 'Escalation Start Event': '升级开始事件',
- 'Compensation Start Event': '补偿开始事件',
- 'Message Start Event (non-interrupting)': '消息开始事件(非中断)',
- 'Timer Start Event (non-interrupting)': '定时开始事件(非中断)',
- 'Conditional Start Event (non-interrupting)': '条件开始事件(非中断)',
- 'Signal Start Event (non-interrupting)': '信号开始事件(非中断)',
- 'Escalation Start Event (non-interrupting)': '升级开始事件(非中断)',
- 'Message Intermediate Catch Event': '消息中间捕获事件',
- 'Message Intermediate Throw Event': '消息中间抛出事件',
- 'Timer Intermediate Catch Event': '定时中间捕获事件',
- 'Escalation Intermediate Throw Event': '升级中间抛出事件',
- 'Conditional Intermediate Catch Event': '条件中间捕获事件',
- 'Link Intermediate Catch Event': '链接中间捕获事件',
- 'Link Intermediate Throw Event': '链接中间抛出事件',
- 'Compensation Intermediate Throw Event': '补偿中间抛出事件',
- 'Signal Intermediate Catch Event': '信号中间捕获事件',
- 'Signal Intermediate Throw Event': '信号中间抛出事件',
- 'Message End Event': '消息结束事件',
- 'Escalation End Event': '定时结束事件',
- 'Error End Event': '错误结束事件',
- 'Cancel End Event': '取消结束事件',
- 'Compensation End Event': '补偿结束事件',
- 'Signal End Event': '信号结束事件',
- 'Terminate End Event': '终止结束事件',
- 'Message Boundary Event': '消息边界事件',
- 'Message Boundary Event (non-interrupting)': '消息边界事件(非中断)',
- 'Timer Boundary Event': '定时边界事件',
- 'Timer Boundary Event (non-interrupting)': '定时边界事件(非中断)',
- 'Escalation Boundary Event': '升级边界事件',
- 'Escalation Boundary Event (non-interrupting)': '升级边界事件(非中断)',
- 'Conditional Boundary Event': '条件边界事件',
- 'Conditional Boundary Event (non-interrupting)': '条件边界事件(非中断)',
- 'Error Boundary Event': '错误边界事件',
- 'Cancel Boundary Event': '取消边界事件',
- 'Signal Boundary Event': '信号边界事件',
- 'Signal Boundary Event (non-interrupting)': '信号边界事件(非中断)',
- 'Compensation Boundary Event': '补偿边界事件',
- 'Exclusive Gateway': '互斥网关',
- 'Parallel Gateway': '并行网关',
- 'Inclusive Gateway': '相容网关',
- 'Complex Gateway': '复杂网关',
- 'Event based Gateway': '事件网关',
- 'Transaction': '转运',
- 'Sub Process': '子流程',
- 'Event Sub Process': '事件子流程',
- 'Collapsed Pool': '折叠池',
- 'Expanded Pool': '展开池',
- // Errors
- 'no parent for {element} in {parent}': '在{parent}里,{element}没有父类',
- 'no shape type specified': '没有指定的形状类型',
- 'flow elements must be children of pools/participants': '流元素必须是池/参与者的子类',
- 'out of bounds release': 'out of bounds release',
- 'more than {count} child lanes': '子道大于{count} ',
- 'element required': '元素不能为空',
- 'diagram not part of bpmn:Definitions': '流程图不符合bpmn规范',
- 'no diagram to display': '没有可展示的流程图',
- 'no process or collaboration to display': '没有可展示的流程/协作',
- 'element {element} referenced by {referenced}#{property} not yet drawn': '由{referenced}#{property}引用的{element}元素仍未绘制',
- 'already rendered {element}': '{element} 已被渲染',
- 'failed to import {element}': '导入{element}失败',
- // 属性面板的参数
- 'Id': '编号',
- 'Name': '名称',
- 'General': '常规',
- 'Details': '详情',
- 'Message Name': '消息名称',
- 'Message': '消息',
- 'Initiator': '创建者',
- 'Asynchronous Continuations': '持续异步',
- 'Asynchronous Before': '异步前',
- 'Asynchronous After': '异步后',
- 'Job Configuration': '工作配置',
- 'Exclusive': '排除',
- 'Job Priority': '工作优先级',
- 'Retry Time Cycle': '重试时间周期',
- 'Documentation': '文档',
- 'Element Documentation': '元素文档',
- 'History Configuration': '历史配置',
- 'History Time To Live': '历史的生存时间',
- 'Forms': '表单',
- 'Form Key': '表单key',
- 'Form Fields': '表单字段',
- 'Business Key': '业务key',
- 'Form Field': '表单字段',
- 'ID': '编号',
- 'Type': '类型',
- 'Label': '名称',
- 'Default Value': '默认值',
- 'Validation': '校验',
- 'Add Constraint': '添加约束',
- 'Config': '配置',
- 'Properties': '属性',
- 'Add Property': '添加属性',
- 'Value': '值',
- 'Add': '添加',
- 'Values': '值',
- 'Add Value': '添加值',
- 'Listeners': '监听器',
- 'Execution Listener': '执行监听',
- 'Event Type': '事件类型',
- 'Listener Type': '监听器类型',
- 'Java Class': 'Java类',
- 'Expression': '表达式',
- 'Must provide a value': '必须提供一个值',
- 'Delegate Expression': '代理表达式',
- 'Script': '脚本',
- 'Script Format': '脚本格式',
- 'Script Type': '脚本类型',
- 'Inline Script': '内联脚本',
- 'External Script': '外部脚本',
- 'Resource': '资源',
- 'Field Injection': '字段注入',
- 'Extensions': '扩展',
- 'Input/Output': '输入/输出',
- 'Input Parameters': '输入参数',
- 'Output Parameters': '输出参数',
- 'Parameters': '参数',
- 'Output Parameter': '输出参数',
- 'Timer Definition Type': '定时器定义类型',
- 'Timer Definition': '定时器定义',
- 'Date': '日期',
- 'Duration': '持续',
- 'Cycle': '循环',
- 'Signal': '信号',
- 'Signal Name': '信号名称',
- 'Escalation': '升级',
- 'Error': '错误',
- 'Link Name': '链接名称',
- 'Condition': '条件名称',
- 'Variable Name': '变量名称',
- 'Variable Event': '变量事件',
- 'Specify more than one variable change event as a comma separated list.': '多个变量事件以逗号隔开',
- 'Wait for Completion': '等待完成',
- 'Activity Ref': '活动参考',
- 'Version Tag': '版本标签',
- 'Executable': '可执行文件',
- 'External Task Configuration': '扩展任务配置',
- 'Task Priority': '任务优先级',
- 'External': '外部',
- 'Connector': '连接器',
- 'Must configure Connector': '必须配置连接器',
- 'Connector Id': '连接器编号',
- 'Implementation': '实现方式',
- 'Field Injections': '字段注入',
- 'Fields': '字段',
- 'Result Variable': '结果变量',
- 'Topic': '主题',
- 'Configure Connector': '配置连接器',
- 'Input Parameter': '输入参数',
- 'Assignee': '代理人',
- 'Candidate Users': '候选用户',
- 'Candidate Groups': '候选组',
- 'Due Date': '到期时间',
- 'Follow Up Date': '跟踪日期',
- 'Priority': '优先级',
- // eslint-disable-next-line no-template-curly-in-string
- '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',
- // eslint-disable-next-line no-template-curly-in-string
- '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',
- 'Variables': '变量',
- 'Candidate Starter Configuration': '候选开始配置',
- 'Task Listener': '任务监听器',
- 'Candidate Starter Groups': '候选开始组',
- 'Candidate Starter Users': '候选开始用户',
- 'Tasklist Configuration': '任务列表配置',
- 'Startable': '启动',
- 'Specify more than one group as a comma separated list.': '指定多个组,用逗号分隔',
- 'Specify more than one user as a comma separated list.': '指定多个用户,用逗号分隔',
- 'This maps to the process definition key.': '这会映射为流程定义的键',
- 'CallActivity Type': '调用活动类型',
- 'Condition Type': '条件类型',
- 'Create UserTask': '创建用户任务',
- 'Create CallActivity': '创建调用活动',
- 'Called Element': '调用元素',
- 'Create DataObjectReference': '创建数据对象引用',
- 'Create DataStoreReference': '创建数据存储引用',
- 'Multi Instance': '多实例',
- 'Loop Cardinality': '实例数量',
- Collection: '任务参与人列表',
- 'Element Variable': '元素变量',
- 'Completion Condition': '完成条件'
- };
- function customTranslate(template, replacements) {
- replacements = replacements || {};
- // Translate
- template = translations[template] || template;
- // Replace
- return template.replace(/{([^}]+)}/g, function (_, key) {
- return replacements[key] || '{' + key + '}';
- });
- }
- var vjson$9 = {
- title: '导入流程',
- layout: 'fit',
- width: 400,
- height: 400,
- items: [
- {
- layout: 'border',
- items: [
- {
- xtype: 'form',
- items: [
- // {
- // xtype: 'cols',
- // items: [
- // {
- // xtype: 'textfield',
- // allowBlank: false,
- // fieldLabel: '流程名称',
- // bind: '{name}'
- // },
- // ],
- // },
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'filefield',
- name: 'deployFile',
- fieldLabel: '文件名称',
- // labelWidth: '100%',
- msgTarget: 'side',
- reference: 'MOBANB_FILE',
- fileUpload: true,
- allowBlank: false,
- // flex: 1,
- // width: '100%',
- buttonText: '请选择文件位置',
- listeners: {
- change: 'scope.fileChange'
- }
- // bind: '{FILE}'
- },
- ]
- }
- ],
- region: 'center',
- split: true,
- },
- ],
- },
- ],
- fbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '保存',
- iconCls: 'x-fa fa-save',
- listeners: {
- click: 'scope.save',
- },
- }
- ],
- },
- };
- var model$9 = {
- data: {
- name: '',
- file_content: ''
- }
- };
- var ImportBpmn = /** @class */ (function (_super) {
- __extends(ImportBpmn, _super);
- function ImportBpmn() {
- return _super.call(this, { model: model$9, vjson: vjson$9 }) || this;
- }
- ImportBpmn.prototype.onLoad = function () {
- };
- ImportBpmn.prototype.save = function (sender) {
- if (this.data.file_content) {
- this.dialogSuccess(this.data);
- }
- else {
- Ext.Msg.alert('提示', "请先上传文件");
- }
- };
- ImportBpmn.prototype.fileChange = function (e) {
- var _this = this;
- // this.data.MOBANB_FILE = e.fileInputEl.dom.files[0]
- var file = e.fileInputEl.dom.files[0]; //获取文件
- var reader = new FileReader();
- reader.readAsText(file, "UTF-8");
- reader.onload = function () {
- _this.data.file_content = reader.result;
- };
- };
- return ImportBpmn;
- }(Scope));
- var model$a = {
- data: {
- form_id: '',
- form_name: '',
- save_dir_path: '',
- absolute_path: '',
- form: {
- id: '',
- code: '',
- name: '',
- table: '',
- controller: '',
- groovy: '',
- fields: [],
- buttons: [],
- },
- }
- };
- var vjson$a = {
- title: '配置适配策略',
- layout: 'fit',
- items: [
- {
- layout: 'border',
- items: [
- {
- region: 'center',
- xtype: 'yvgrid',
- pagination: false,
- hideFootbar: true,
- plugins: {
- clipboard: true,
- selectionreplicator: true
- },
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '添加策略',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'scope.addStrategy'
- }
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {}
- },
- '-',
- {
- xtype: 'button',
- text: '上移',
- iconCls: 'x-fa fa-arrow-up',
- listeners: {}
- },
- {
- xtype: 'button',
- text: '下移',
- iconCls: 'x-fa fa-arrow-down',
- listeners: {}
- },
- ]
- },
- columns: [
- { xtype: 'rownumberer' },
- {
- header: '优先级',
- dataIndex: 'priority',
- width: 140,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- header: '策略编号',
- dataIndex: 'strategy_code',
- width: 140,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- header: '策略名称',
- dataIndex: 'strategy_name',
- width: 140,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- header: "条件表达式",
- dataIndex: "strategy_exp",
- },
- ],
- },
- {
- title: '适配条件',
- region: 'south',
- height: '50%',
- xtype: 'form',
- items: [
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'rows',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: "仓库",
- },
- {
- xtype: 'textfield',
- fieldLabel: "货主",
- },
- {
- xtype: 'textfield',
- fieldLabel: "项目",
- },
- {
- xtype: 'textfield',
- fieldLabel: "行政区划",
- },
- {
- xtype: 'textfield',
- fieldLabel: "客户",
- },
- {
- xtype: 'textfield',
- fieldLabel: "商品",
- }
- ]
- },
- {
- xtype: 'rows',
- margin: '8 0 0 10',
- items: [
- {
- xtype: 'label',
- html: '自定义表达式',
- },
- {
- xtype: 'textarea',
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- };
- //
- // import {parseDynamicSqlApi, reportByIdApi, saveReportApi} from "../utils/Request";
- // import {getColumnByTableNameColumnName, reloadIfNeedPromise} from "../database/DbTreeStore";
- // import ReportRunner from "./ReportRunner";
- var ConfigStrategy = /** @class */ (function (_super) {
- __extends(ConfigStrategy, _super);
- function ConfigStrategy() {
- return _super.call(this, { model: model$a, vjson: vjson$a }) || this;
- }
- ConfigStrategy.prototype.onLoad = function () {
- this.load();
- };
- ConfigStrategy.prototype.load = function () {
- var _this = this;
- var form_id = this.viewModel.get("form_id");
- var absolute_path = this.viewModel.get("absolute_path");
- var save_dir_path = this.viewModel.get("save_dir_path");
- if (absolute_path && form_id) {
- this.setLoading(true);
- readDevForm({ absolute_path: absolute_path, form_id: form_id }).then(function (res) {
- if (res.success) {
- // 基础属性
- _this.viewModel.set('form', res.data.form);
- // 字段定义
- _this.refs.gridColumn.getStore().add(_this.viewModel.get('form.fields'));
- // 按钮
- _this.refs.gridButton.getStore().add(_this.viewModel.get('form.buttons'));
- }
- }).finally(function () {
- _this.setLoading(false);
- });
- }
- };
- ConfigStrategy.prototype.saveAll = function () {
- var _this = this;
- var save_dir_path = this.viewModel.get("save_dir_path");
- if (!save_dir_path) {
- msg("save_dir_path error");
- return;
- }
- var form_id = this.viewModel.get("form_id");
- var absolute_path = this.viewModel.get("absolute_path");
- // 表格校验
- if (!this.refs.form1.isValid()) {
- msg("请检查表单必填项!");
- return;
- }
- // 字段数据
- var gridColumnRows = this.refs.gridColumn.getDataRows().map(function (item) {
- delete item.id;
- if (item.hide) {
- delete item.hide_text;
- }
- else {
- item.hide = item.hide_text;
- delete item.hide_text;
- }
- if (item.readonly) {
- delete item.readonly_text;
- }
- else {
- item.readonly = item.readonly_text;
- delete item.readonly_text;
- }
- if (item.disabled) {
- delete item.disabled_text;
- }
- else {
- item.disabled = item.disabled_text;
- delete item.disabled_text;
- }
- if (item.required) {
- delete item.required_text;
- }
- else {
- item.required = item.required_text;
- delete item.required_text;
- }
- return item;
- });
- this.viewModel.set("form.fields", gridColumnRows);
- // 按钮数据
- var gridBtnRows = this.refs.gridButton.getDataRows().map(function (item) {
- delete item.id;
- return item;
- });
- this.viewModel.set("form.buttons", gridBtnRows);
- // 查询条件
- // 策略
- var form = this.viewModel.get("form");
- this.setLoading(true);
- createDevForm({ save_dir_path: save_dir_path, absolute_path: absolute_path, form_id: form_id, form: form }).then(function (res) {
- if (res.success) {
- msg('保存成功');
- handles$1.mainWindow.refs['exporerTree'].reload();
- }
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- ConfigStrategy.prototype.addColumn = function () {
- this.refs.gridColumn.getStore().add({});
- };
- ConfigStrategy.prototype.removeColumn = function () {
- this.refs.gridColumn.getStore().remove(this.refs.gridColumn.getSelection());
- };
- ConfigStrategy.prototype.calcColumn = function (sender) {
- var _this = this;
- var table = this.viewModel.get("form.table");
- if (!table) {
- msg("表名不存在!");
- return;
- }
- this.setLoading(true);
- calcColumnForm({ table: table }).then(function (res) {
- if (res.success) {
- msg(res.msg);
- if (res.data.columns.length > 0) {
- _$2.forEach(res.data.columns, function (it) {
- _this.refs.gridColumn.getStore().add({ column_desc: it.columnComment, column_name: it.columnName });
- });
- }
- }
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- ConfigStrategy.prototype.addButton = function () {
- this.refs.gridButton.getStore().add({});
- };
- ConfigStrategy.prototype.moveUp = function (sender) {
- var grid = sender.up('grid');
- grid.rowMoveUp();
- };
- ConfigStrategy.prototype.moveDown = function (sender) {
- var grid = sender.up('grid');
- grid.rowMoveDown();
- };
- ConfigStrategy.prototype.addStrategy = function (sender, path) {
- var win = new Ext.Window({
- autoDestroy: true,
- title: "添加(编辑)策略",
- width: 400,
- height: 300,
- resizable: true,
- closable: true,
- maximizable: true,
- minimizable: true,
- plain: true,
- // constrainHeader: true,
- constrain: true,
- layout: 'fit',
- animateTarget: sender,
- buttonAlign: 'center',
- items: [
- {
- xtype: "form",
- layout: "hbox",
- margin: '10px 20px',
- border: 0,
- items: [
- {
- flex: 1,
- layout: 'vbox',
- items: [
- {
- xtype: "numberfield",
- fieldLabel: "优先级",
- flex: 1,
- allowBlank: false,
- labelWidth: 50,
- width: "100%",
- },
- {
- xtype: "textfield",
- fieldLabel: "策略名称",
- flex: 1,
- allowBlank: false,
- labelWidth: 50,
- width: "100%",
- },
- {
- xtype: "textfield",
- fieldLabel: "策略编号",
- flex: 1,
- allowBlank: false,
- regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
- regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
- labelWidth: 50,
- width: "100%",
- },
- {
- xtype: "textfield",
- fieldLabel: "仓库ID",
- flex: 1,
- allowBlank: false,
- regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
- regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
- labelWidth: 50,
- width: "100%",
- },
- ]
- },
- ]
- }
- ],
- //窗口按钮
- buttons: [
- {
- xtype: 'button', text: '保存', handler: function (btn) {
- //窗口获取表单
- var form = win.down('form');
- var vaildSuccess = form.isValid();
- if (!vaildSuccess) {
- return;
- }
- var filename = form.down('textfield[name="filename"]').getValue();
- }
- },
- {
- xtype: 'button', text: '取消', handler: function (btn) {
- //窗口关闭
- win.close();
- }
- }
- ]
- });
- win.show();
- };
- return ConfigStrategy;
- }(Scope));
- var buildVjson = function () {
- return {
- bind: {
- title: '流程编辑-{text}',
- },
- layout: 'fit',
- items: [{
- layout: 'border',
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '撤销',
- listeners: {
- click: "scope.undo"
- }
- },
- {
- xtype: 'button',
- text: '还原',
- listeners: {
- click: "scope.redo"
- }
- },
- {
- xtype: 'button',
- text: '保存',
- listeners: {
- click: "scope.save"
- }
- },
- {
- xtype: 'button',
- text: '导入BPM',
- listeners: {
- click: "scope.importBpm"
- }
- },
- {
- xtype: 'button',
- text: '配置适配策略',
- listeners: {
- click: "scope.configStrategy"
- }
- },
- {
- fieldLabel: '选择配置分支',
- xtype: 'combogrid',
- },
- ]
- },
- items: [
- {
- xtype: "panel",
- region: 'center',
- reference: "bpmn_view",
- html: "<div class=\"bpmn_view\" style=\"width: 100%; height: 100%\"/>",
- },
- {
- split: true,
- xtype: "panel",
- region: 'east',
- width: '30%',
- reference: "bpmn_properties",
- html: "<div class=\"bpmn_properties\" style=\"width: 100%; height: 100%\"/>",
- }
- ],
- }],
- listeners: {
- afterrender: 'scope.onViewRender'
- }
- };
- };
- var BpmnDesign = /** @class */ (function (_super) {
- __extends(BpmnDesign, _super);
- function BpmnDesign() {
- var _this = _super.call(this, { model: {}, vjson: buildVjson() }) || this;
- _this.bpmnModeler = null;
- _this.bpmnModelerName = "";
- return _this;
- }
- BpmnDesign.prototype.onLoad = function () {
- var _this = this;
- _super.prototype.onLoad.call(this);
- this.setLoading(true);
- this.bpmnModelerName = this.data.text.substring(0, this.data.text.indexOf(".bpmn"));
- readBpmn({ absolute_path: this.data.absolutePath }).then(function (res) {
- if (res && res.success && res.data && res.data.bpmn) {
- var diagramXML = res.data.bpmn;
- _this.bpmnModeler.importXML(diagramXML).then(function (res) {
- var elements = _this.bpmnModeler._definitions.rootElements;
- if (Array.isArray(elements) && elements.length > 0) {
- elements[0].name = _this.bpmnModelerName;
- }
- }).catch(function (err) {
- msgError(err);
- });
- }
- else {
- msgError(res.msg);
- }
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- BpmnDesign.prototype.onViewRender = function (sender) {
- var customTranslateModule = {
- translate: ['value', customTranslate]
- };
- this.bpmnModeler = new BpmnModeler({
- container: $(this.refs.bpmn_view.body.dom).find(".bpmn_view")[0],
- propertiesPanel: {
- parent: $(this.refs.bpmn_properties.body.dom).find(".bpmn_properties")[0],
- },
- additionalModules: [
- bpmnJsPropertiesPanel.BpmnPropertiesPanelModule,
- bpmnJsPropertiesPanel.BpmnPropertiesProviderModule,
- bpmnJsPropertiesPanel.CamundaPlatformPropertiesProviderModule,
- bpmnJsPropertiesPanel.CloudElementTemplatesPropertiesProviderModule,
- bpmnJsPropertiesPanel.CloudElementTemplatesValidator,
- bpmnJsPropertiesPanel.ElementTemplatesPropertiesProviderModule,
- bpmnJsPropertiesPanel.ZeebeDescriptionProvider,
- bpmnJsPropertiesPanel.ZeebePropertiesProviderModule,
- customTranslateModule,
- ],
- moddleExtensions: {
- camunda: camundaModdleDescriptor
- },
- keyboard: { bindTo: document } // 使用键盘快捷键
- });
- };
- //开启快捷键
- //modeler.get('keyboard').bind(document);
- //关闭快捷键
- //modeler.get('keyboard').unbind();
- BpmnDesign.prototype.undo = function (sender) {
- this.bpmnModeler.get('commandStack').undo();
- };
- BpmnDesign.prototype.redo = function (sender) {
- this.bpmnModeler.get('commandStack').redo();
- };
- BpmnDesign.prototype.save = function (sender) {
- var _this = this;
- this.setLoading(true);
- this.bpmnModeler.saveXML().then(function (resBpm) {
- saveBpmn(_this.data.absolutePath, resBpm.xml).then(function (res) {
- if (res.success) {
- msg$1("保存成功");
- }
- else {
- msgError(res.msg);
- }
- }).catch(function (e) {
- var _a, _b;
- var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
- msgError(msg);
- }).finally(function () {
- _this.setLoading(false);
- });
- }).catch(function (e) {
- msgError(e);
- _this.setLoading(false);
- });
- };
- BpmnDesign.prototype.importBpm = function (sender) {
- var _this = this;
- var dlg = new ImportBpmn();
- //@ts-ignore
- dlg.success = function (sen, data) {
- _this.bpmnModeler.importXML(data.file_content).then(function (res) {
- var elements = _this.bpmnModeler._definitions.rootElements;
- if (Array.isArray(elements) && elements.length > 0) {
- elements[0].name = _this.bpmnModelerName;
- }
- }).catch(function (err) {
- msgError(err);
- });
- };
- dlg.showDialog(sender, {}, {});
- // this.bpmnModeler.importXML()
- };
- BpmnDesign.prototype.configStrategy = function (sender) {
- var configStrategy = new ConfigStrategy();
- configStrategy.showDialog(sender, {}, {});
- };
- return BpmnDesign;
- }(Scope));
- var model$b = {
- data: {
- id: '',
- path: '',
- form: {
- title: '',
- sqlId: '',
- }
- }
- };
- var vjson$b = {
- bind: {
- title: '{title}',
- },
- layout: 'fit',
- items: [
- {
- layout: 'border',
- items: [
- {
- region: 'center',
- reference: 'editor',
- border: true,
- // html: '<div class="geEditor"></div>',
- // listeners: {
- // afterrender: 'scope.editorInit'
- // }
- html: '<iframe style="height:100%;width:100%;border:border: 1px solid #d4d4d5;border-top: none;" src="/assets/mxgraph-editor/index.html"></iframe>',
- listeners: {
- afterrender: 'scope.iframeRender'
- }
- },
- ]
- }
- ]
- }; //
- //
- var WidgetDesign$1 = /** @class */ (function (_super) {
- __extends(WidgetDesign, _super);
- function WidgetDesign(layoutCode, layoutName) {
- var _this = _super.call(this, { model: model$b, vjson: vjson$b }) || this;
- _this.layoutCode = layoutCode;
- _this.layoutName = layoutName;
- return _this;
- }
- WidgetDesign.prototype.onLoad = function () {
- this.viewModel.set('layoutCode', this.layoutCode);
- this.viewModel.set('layoutName', this.layoutName);
- if (this.layoutCode) {
- this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
- }
- else {
- this.viewModel.set('title', '新建图纸');
- }
- };
- WidgetDesign.prototype.reload = function () {
- var _this = this;
- this.setLoading(true);
- loadWhLayout({
- layoutCode: this.layoutCode,
- layoutName: this.layoutName,
- }).then(function (res) {
- if (res.success) {
- var xml = res.data.layoutContent;
- var doc = _this.mxUtils.parseXml(xml);
- var graph = _this.editorUi.editor.graph;
- graph.setSelectionCells(graph.importGraphModel(doc.documentElement));
- }
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- WidgetDesign.prototype.editorInit = function (sender) {
- var that = this;
- var dom = $(sender.el.dom).find('.geEditor')[0];
- //@ts-ignore
- require(['mxgraph'], function () {
- var editorUiInit = EditorUi.prototype.init;
- EditorUi.prototype.init = function () {
- editorUiInit.apply(this, arguments);
- this.actions.get('save').funct = that.onFileSave.bind(that);
- this.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
- this.actions.get('open').visible = false;
- this.actions.get('new').visible = false;
- this.actions.get('preview').visible = false;
- this.actions.get('print').visible = false;
- this.actions.get('pageSetup').visible = false;
- this.actions.get('help').visible = false;
- this.actions.get('export').visible = false;
- this.actions.get('about').visible = false;
- this.menus.menus.help.setEnabled(false);
- that.editorUi = this;
- if (that.layoutCode) {
- that.reload();
- }
- };
- var RESOURCE_BASE = '/assets/mxgraph-editor/resources/grapheditor';
- var mxLanguage = 'zh';
- mxResources.loadDefaultBundle = false;
- var bundle = mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
- mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage);
- var STYLE_PATH = '/assets/mxgraph-editor/styles';
- // Fixes possible asynchronous requests
- mxUtils.getAll([bundle, STYLE_PATH + '/default.xml'], function (xhr) {
- // Adds bundle text to resources
- mxResources.parse(xhr[0].getText());
- // Configures the default graph theme
- var themes = new Object();
- themes[Graph.prototype.defaultThemeName] = xhr[1].getDocumentElement();
- // Main
- new EditorUi(new Editor(false, themes), dom);
- }, function () {
- dom.innerHTML = '<center style="margin-top:10%;">Error loading resource files. Please check browser console.</center>';
- });
- });
- };
- WidgetDesign.prototype.iframeRender = function (sender) {
- var that = this;
- var iframe = $(sender.el.dom).find('iframe')[0];
- iframe.contentWindow['designer'] = that;
- iframe.contentWindow['editorInitFn'] = function (editorUi) {
- editorUi.actions.get('save').funct = that.onFileSave.bind(that);
- editorUi.actions.get('saveAs').funct = that.onFileSaveAs.bind(that);
- editorUi.actions.get('open').visible = false;
- editorUi.actions.get('new').visible = false;
- editorUi.actions.get('preview').visible = false;
- editorUi.actions.get('print').visible = false;
- editorUi.actions.get('pageSetup').visible = false;
- editorUi.actions.get('help').visible = false;
- editorUi.actions.get('export').visible = false;
- editorUi.actions.get('about').visible = false;
- editorUi.menus.menus.help.setEnabled(false);
- that.editorUi = editorUi;
- that.mxUtils = iframe.contentWindow['mxUtils'];
- if (that.layoutCode) {
- that.reload();
- }
- };
- };
- WidgetDesign.prototype.onDestroy = function () {
- var _a;
- try {
- (_a = this.editorUi) === null || _a === void 0 ? void 0 : _a.destroy();
- }
- catch (e) {
- }
- };
- WidgetDesign.prototype.onFileSaveAs = function () {
- var _this = this;
- this.showSaveAsDlg({ code: this.layoutCode, name: this.layoutName })
- .then(function (_a) {
- var code = _a.code, name = _a.name;
- _this.layoutCode = code;
- _this.layoutName = name;
- _this.onSave();
- });
- };
- WidgetDesign.prototype.onSave = function () {
- var _this = this;
- var layoutContent = this.editorUi.getEditBlankXml();
- var layoutCode = this.layoutCode;
- var layoutName = this.layoutName;
- if (!layoutCode || !layoutName) {
- msg$1('图形编号和图形名称必填');
- return;
- }
- this.viewModel.set('title', this.layoutName + ' [' + this.layoutCode + ']');
- this.setLoading(true);
- saveWhLayout({
- layoutCode: layoutCode, layoutName: layoutName, layoutContent: layoutContent
- }).then(function (res) {
- msg$1(res.msg);
- handles$1.whLayout.reload();
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- WidgetDesign.prototype.onFileSave = function () {
- if (!this.layoutCode || !this.layoutName) {
- this.onFileSaveAs();
- }
- else {
- this.onSave();
- }
- };
- WidgetDesign.prototype.showSaveAsDlg = function (_a) {
- var code = _a.code, name = _a.name;
- return new Promise(function (resolve, reject) {
- var viewModel = new Ext.app.ViewModel({
- data: {
- code: code !== null && code !== void 0 ? code : '',
- name: name !== null && name !== void 0 ? name : '',
- }
- });
- var dlg = Ext.create('Ext.window.Window', {
- title: '保存',
- viewModel: viewModel,
- layout: {
- type: "vbox",
- pack: "start",
- align: "stretch"
- },
- items: [
- {
- xtype: 'textfield', fieldLabel: '图编号', margin: '0 15 15 0',
- bind: '{code}'
- },
- {
- xtype: 'textfield', fieldLabel: '图名称', margin: '0 15 15 0',
- bind: '{name}'
- }
- ],
- fbar: [
- {
- xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', listeners: {
- click: function () {
- var code = viewModel.get('code');
- var name = viewModel.get('name');
- resolve({ code: code, name: name });
- dlg.close();
- }
- }
- },
- {
- xtype: 'button', text: '取消', iconCls: 'x-fa fa-times', listeners: {
- click: function () {
- dlg.close();
- }
- }
- },
- ]
- });
- dlg.show();
- });
- };
- return WidgetDesign;
- }(Scope));
- // init()
- var Workbench = /** @class */ (function (_super) {
- __extends(Workbench, _super);
- // activeModulePage: ModulePage = null
- function Workbench() {
- var _this = _super.call(this, { model: model, vjson: vjson }) || this;
- _this.name = "MainWindow";
- _this.modules = [];
- _this.yvgridDesign = null;
- return _this;
- }
- Workbench.prototype.leftTabChange = function (tabPanel, newCard, oldCard) {
- if (newCard) {
- this.viewModel.set('leftTabTitle', newCard.tooltip);
- }
- else {
- this.viewModel.set('leftTabTitle', '未选中');
- }
- };
- Object.defineProperty(Workbench.prototype, "activeModulePage", {
- get: function () {
- var _a;
- return ((_a = window['mainWindow'].refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.yvanScope) || undefined;
- },
- enumerable: true,
- configurable: true
- });
- Workbench.prototype.documentKeydown = function (event) {
- if (event.ctrlKey || event.metaKey) {
- if (event.key.toLowerCase() === 's') {
- eventBus.publish(EventType.SaveCall, {});
- event.stopPropagation();
- event.preventDefault();
- }
- else if (event.key.toLowerCase() === 'z') {
- if (event.shiftKey) {
- eventBus.publish(EventType.Redo, {});
- event.stopPropagation();
- event.preventDefault();
- }
- else {
- eventBus.publish(EventType.Undo, {});
- event.stopPropagation();
- event.preventDefault();
- }
- }
- }
- };
- Workbench.prototype.onLoad = function () {
- var _this = this;
- window["tt"] = this.refs['tt'];
- window["vm"] = this.viewModel;
- $('#loading').remove();
- setMainWindow(this);
- setStatusbar(this.down('statusbar'));
- document.addEventListener('keydown', this.documentKeydown.bind(this));
- var currentProject = getCurrentProject();
- this.viewModel.set("currentProject", (currentProject === null || currentProject === void 0 ? void 0 : currentProject.url) + "(" + (currentProject === null || currentProject === void 0 ? void 0 : currentProject.name) + ")");
- // handles.fileTree.reload()
- eventBus.subscribe(EventType.ModuleOpen, function (rawData) {
- _this.showModule(rawData);
- });
- eventBus.subscribe(EventType.Undo, function () {
- _this.onUndo();
- });
- eventBus.subscribe(EventType.Redo, function () {
- _this.onRedo();
- });
- eventBus.subscribe(EventType.Cut, function (_a) {
- var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
- _this.onCut(a, b, c, d);
- });
- eventBus.subscribe(EventType.Copy, function (_a) {
- var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
- _this.onCopy(a, b, c, d);
- });
- eventBus.subscribe(EventType.Paste, function (_a) {
- var a = _a.a, b = _a.b, c = _a.c, d = _a.d;
- _this.onPaste(a, b, c, d);
- });
- eventBus.subscribe(EventType.SelectAll, function () {
- _this.onSelectAll();
- });
- eventBus.subscribe(EventType.SelectAll, function () {
- _this.onSelectAll();
- });
- eventBus.subscribe(EventType.RunCheckModule, function () {
- _this.runCheckModule();
- });
- eventBus.subscribe(EventType.StopCheckModule, function () {
- _this.stopCheckModule();
- });
- eventBus.subscribe(EventType.ComponentContextmenu, function (args) {
- _this.onCompoentContextMenu(args);
- });
- this.runCheckModule();
- };
- Workbench.prototype.onCompoentContextMenu = function (args) {
- var _this = this;
- if (!this.yvgridDesign) {
- this.yvgridDesign = new YvgridDesign(this.activeModulePage.moduleId);
- this.yvgridDesign.showDialog(null, {}, {});
- var fn_1 = this.yvgridDesign.onDestroy.bind(this.yvgridDesign);
- this.yvgridDesign.onDestroy = function () {
- fn_1();
- _this.yvgridDesign = null;
- };
- }
- };
- Workbench.prototype.runCheckModule = function () {
- var _this = this;
- if (this.checkTimer) {
- return;
- }
- this.checkTimer = setInterval(function () {
- var _a;
- if ((_a = _this.activeModulePage) === null || _a === void 0 ? void 0 : _a.check) {
- _this.activeModulePage.check();
- }
- }, 5000);
- };
- Workbench.prototype.showWidget = function (widgetPath, widgetName, successCallback) {
- var dlg = new WidgetDesign(widgetPath, widgetName);
- dlg.showPage({
- id: 'widget_' + widgetPath,
- path: 'widget_' + widgetPath,
- }, {
- data: {
- title: widgetPath ? '检索框:' + widgetName : '新建检索框',
- }
- });
- dlg.dialogSuccess = successCallback;
- };
- Workbench.prototype.stopCheckModule = function () {
- clearInterval(this.checkTimer);
- this.checkTimer = null;
- };
- Workbench.prototype.showDataSync = function () {
- var ins = new DbSync();
- ins.showPage({
- id: 'db_sync__',
- path: 'db_sync__',
- }, {
- data: {}
- });
- };
- /**
- * 打开一个项目
- */
- Workbench.prototype.openProject = function (project) {
- setCurrentProject(project);
- this.viewModel.set("currentProject", (project === null || project === void 0 ? void 0 : project.url) + "(" + (project === null || project === void 0 ? void 0 : project.name) + ")");
- handles$1.fileTree.reload();
- };
- /**
- * 打开模板开发面板
- */
- Workbench.prototype.showTemplateDev = function () {
- var ins = new TemplateDev();
- ins.showPage({
- id: 'template_dev__',
- path: 'template_dev__',
- }, {
- data: {}
- });
- };
- Workbench.prototype.openScope = function () {
- };
- /**
- * 显示字段域管理器
- */
- Workbench.prototype.showColumnDomain = function () {
- var instance = new DbDomain();
- instance.showPage({
- id: 'domain__',
- path: 'domain__',
- }, {
- data: {}
- });
- };
- /**
- * 显示性能统计
- */
- Workbench.prototype.showPerform = function () {
- // const instance = new PerformStats()
- // instance.showPage({
- // id: 'perform__',
- // path: 'perform__',
- //
- // }, {
- // data: {}
- // })
- };
- /**
- * 显示数据库代码模板库
- */
- Workbench.prototype.showDbCodeTemplate = function () {
- // const instance = new DbCodeTemplate()
- // instance.showPage({
- // id: 'dbcode__',
- // path: 'dbcode__',
- //
- // }, {
- // data: {}
- // })
- };
- /**
- * 显示数据库代码模板库
- */
- Workbench.prototype.showReport = function (report_id, report_name, success) {
- var instance = new ReportDesign();
- instance.showPage({
- id: 'report_' + report_id,
- path: 'report_' + report_id,
- }, {
- data: {
- report_id: report_id,
- report_name: report_name,
- }
- });
- instance.dialogSuccess = success;
- };
- /**
- * 显示报表
- */
- Workbench.prototype.showReportPreview = function (report_id, instance) {
- instance.showPage({
- id: 'REPORT__' + report_id,
- path: 'REPORT__' + report_id,
- }, {
- data: {
- report_id: report_id,
- }
- });
- var reportName = instance.viewModel.get('report_name');
- instance.viewModel.set('report_name', '[预览]-' + reportName);
- };
- /**
- * 显示运维页面
- */
- Workbench.prototype.showDevOpsTerminal = function (opsId, name, success) {
- // const instance = new DevOpsTerminal()
- // instance.showPage({
- // id: 'ops_' + opsId,
- // path: 'ops_' + opsId,
- //
- // }, {
- // data: {
- // opsId: opsId,
- // name: name,
- // }
- // })
- // instance.dialogSuccess = success
- };
- /**
- * 显示表结构
- * tableName 为空的情况就是新建表,否则就是要编辑的表
- * columnName 可以为空
- */
- Workbench.prototype.showTableColumn = function (schemaName, tableName, columnName, isCreate) {
- var id = 'tableColumn_' + tableName;
- var isCreateTable = false;
- // /ROOT/schema$public/schema$public$bas_location_group_rel
- var locatPath = "/ROOT/schema$" + schemaName + "/schema$" + schemaName + "$" + tableName;
- if (!tableName) {
- id = _$2.uniqueId('new_table');
- tableName = id;
- isCreateTable = true;
- }
- var instance = new DbColumn(schemaName, tableName, columnName, isCreateTable, isCreate);
- instance.showPage({
- id: id,
- path: id,
- locatPath: locatPath
- }, {
- data: {
- tableName: tableName,
- columnName: columnName
- }
- });
- };
- /**
- * 打开某个模块
- * 例如: com/galaxis/wms/inbound/cmd_in/CmdIn
- */
- Workbench.prototype.showModule = function (rawData) {
- var id = rawData.id, path = rawData.path;
- var separator = '/';
- var idx = _$2.findIndex(this.modules, function (item) { return item.path + separator + item.name === path; });
- var module = this.modules[idx];
- var pageId = path.replaceAll('/', '_');
- console.log('open module', module);
- var instance = new ModulePage(id, module);
- eventBus.publish(EventType.ModulePageCreate, __assign(__assign({}, rawData), { modulePage: instance }));
- instance.showPage({
- id: 'module_' + pageId,
- path: path,
- title: module.name
- }, {
- data: {}
- });
- };
- Workbench.prototype.showBmpnDesign = function (absolutePath, id, text) {
- var bpmnDesign = new BpmnDesign();
- bpmnDesign.showPage({}, {
- data: {
- absolutePath: absolutePath,
- id: id,
- text: text
- }
- });
- };
- Workbench.prototype.showLayoutDesign = function (layoutCode, layoutName) {
- var id = layoutCode !== null && layoutCode !== void 0 ? layoutCode : _$2.uniqueId('new_layout');
- var layoutDesign = new WidgetDesign$1(layoutCode, layoutName);
- layoutDesign.showPage({
- id: id,
- path: id,
- }, {
- data: {}
- });
- };
- Workbench.prototype.tabchange = function (tabPanel, newCard, oldCard, eOpts) {
- var _a;
- // this.activeModulePage = newCard.yvanScope
- handles$1.viewoutlinetree.moduleId = newCard.yvanScope.moduleId;
- handles$1.property.moduleId = newCard.yvanScope.moduleId;
- // handles.dbTree.moduleId = newCard.yvanScope.moduleId
- // handles.dictTree.moduleId = newCard.yvanScope.moduleId
- // handles.fileTree.moduleId = newCard.yvanScope.moduleId
- // handles.statusbar.moduleId = newCard.yvanScope.moduleId
- eventBus.publish(EventType.MainTabChange, {
- moduleId: newCard.yvanScope.moduleId,
- oldModuleId: (_a = oldCard === null || oldCard === void 0 ? void 0 : oldCard.yvanScope) === null || _a === void 0 ? void 0 : _a.moduleId,
- from: this.name
- });
- };
- Workbench.prototype.onUndo = function () {
- var _a;
- (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Undo, {});
- };
- Workbench.prototype.onRedo = function () {
- var _a;
- (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Redo, {});
- };
- Workbench.prototype.onCut = function (a, b, c, d) {
- var _a;
- (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Cut, {});
- };
- Workbench.prototype.onCopy = function (a, b, c, d) {
- var _a;
- (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Copy, {});
- };
- Workbench.prototype.onPaste = function (a, b, c, d) {
- var _a;
- (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.Paste, {});
- };
- Workbench.prototype.onSelectAll = function () {
- var _a;
- (_a = this.activeModulePage) === null || _a === void 0 ? void 0 : _a.moduleEventBus.publish(EventType.SelectAll, {});
- };
- return Workbench;
- }(Scope));
- (function (FuncDomain) {
- FuncDomain["SCOPE"] = "scope";
- FuncDomain["SYSTEM"] = "system";
- })(exports.FuncDomain || (exports.FuncDomain = {}));
- (function (BizMode) {
- //mode : 1, '仅查询' 2, '表单+表格编辑' 3, '仅表单编辑' 4, '仅表格编辑'
- BizMode[BizMode["query"] = 1] = "query";
- BizMode[BizMode["formAndGridEdit"] = 2] = "formAndGridEdit";
- BizMode[BizMode["formEditOnly"] = 3] = "formEditOnly";
- BizMode[BizMode["gridEditOnly"] = 4] = "gridEditOnly";
- })(exports.BizMode || (exports.BizMode = {}));
- (function (BizFormat) {
- // "format" : 1, button 2 progres 3 date 4 datetime 5 percentage
- BizFormat[BizFormat["button"] = 1] = "button";
- BizFormat[BizFormat["progress"] = 2] = "progress";
- BizFormat[BizFormat["date"] = 3] = "date";
- BizFormat[BizFormat["datetime"] = 4] = "datetime";
- BizFormat[BizFormat["percentage"] = 5] = "percentage";
- })(exports.BizFormat || (exports.BizFormat = {}));
- (function (BizUnique) {
- // "unique" : 1主键(全局唯一) 2仓库唯一 3货主唯一 4项目唯一 5单据唯一 6仓库+货主+项目唯一
- BizUnique[BizUnique["u_a"] = 1] = "u_a";
- BizUnique[BizUnique["u_wh"] = 2] = "u_wh";
- BizUnique[BizUnique["u_ow"] = 3] = "u_ow";
- BizUnique[BizUnique["u_pj"] = 4] = "u_pj";
- BizUnique[BizUnique["u_od"] = 5] = "u_od";
- BizUnique[BizUnique["u_wh_ow_pj"] = 6] = "u_wh_ow_pj";
- })(exports.BizUnique || (exports.BizUnique = {}));
- var ScopeEngine = /** @class */ (function () {
- function ScopeEngine() {
- }
- ScopeEngine.getBizFile = function (director) {
- return new Promise(function (resolve, reject) {
- debugger;
- });
- };
- ScopeEngine.buildScopeFromBillFile = function (billFile) {
- return new Promise(function (resolve, reject) {
- var requireArr = [];
- var requireKeyArr = [];
- _$2.forOwn(billFile.domains, function (v, k) {
- requireArr.push(v.domain);
- requireKeyArr.push(k);
- if (v.layout) {
- requireArr.push(v.layout);
- requireKeyArr.push(k + "_layout");
- }
- });
- requireArr.push(billFile.layout);
- requireKeyArr.push("layout");
- requireArr.push(billFile.converter);
- requireKeyArr.push("converter");
- // @ts-ignore
- require(requireArr, function () {
- var requireReArr = [];
- for (var _i = 0; _i < arguments.length; _i++) {
- requireReArr[_i] = arguments[_i];
- }
- if (requireReArr.length <= 0) {
- reject(new Error("没有加载到相关的文件!"));
- }
- var domains = {};
- for (var i = 0; i < requireReArr.length - 2; i++) {
- if (requireKeyArr[i].endsWith("_layout")) {
- var key_d = requireKeyArr[i].substr(0, requireKeyArr[i].indexOf("_layout"));
- domains[key_d].layout = requireReArr[i].default;
- }
- else {
- domains[requireKeyArr[i]] = requireReArr[i].default;
- domains[requireKeyArr[i]].type = billFile.domains[requireKeyArr[i]].type;
- domains[requireKeyArr[i]].mode = billFile.domains[requireKeyArr[i]].mode;
- }
- }
- var bizFile = {
- bill: billFile,
- domains: domains,
- layout: requireReArr[requireReArr.length - 2].default,
- converter: requireReArr[requireReArr.length - 1].default,
- };
- var scope = ScopeEngine.buildScopeFromBizFile(bizFile);
- scope.billSetting = bizFile;
- resolve(scope);
- });
- });
- };
- ScopeEngine.buildScopeFromPath = function (path) {
- return new Promise(function (resolve, reject) {
- // @ts-ignore
- require([path], function (bill) {
- bill = bill.default;
- ScopeEngine.buildScopeFromBillFile(bill).then(function (scope) {
- resolve(scope);
- }).catch(function (e) {
- reject(e);
- });
- });
- });
- };
- ScopeEngine.buildScopeFromBizFile = function (bizFile) {
- var controller = {};
- var vjson = {
- layout: 'fit',
- title: bizFile.bill.name,
- items: []
- };
- var model = {};
- if (bizFile.layout.layout === "fit") {
- vjson.items = bizFile.layout.items;
- }
- else if (bizFile.layout.layout === "border") {
- vjson.items = [bizFile.layout];
- }
- var domainsVjson = {};
- _$2.forOwn(bizFile.domains, function (v, k) {
- var domainVjson = null;
- var buttons = bizFile.domains[k].buttons;
- if (bizFile.bill.domains[k].mode === "form") {
- domainVjson = ScopeEngine.buildForm(controller, model, bizFile, k);
- if (Array.isArray(buttons) && buttons.length > 0) {
- if (bizFile.bill.domains[k].type === "header") {
- vjson.tbar = {
- xtype: 'toolbar',
- items: ScopeEngine.buildButton(controller, buttons)
- };
- }
- else {
- domainVjson.items.push({
- xtype: "cols",
- items: ScopeEngine.buildButton(controller, buttons)
- });
- }
- }
- }
- else if (bizFile.bill.domains[k].mode === "table") {
- domainVjson = ScopeEngine.buildGrid(controller, model, bizFile, k);
- if (Array.isArray(buttons) && buttons.length > 0) {
- if (bizFile.bill.domains[k].type === "header") {
- vjson.tbar = {
- xtype: 'toolbar',
- items: ScopeEngine.buildButton(controller, buttons)
- };
- }
- else {
- domainVjson.tbar = {
- xtype: 'toolbar',
- items: ScopeEngine.buildButton(controller, buttons)
- };
- }
- }
- }
- if (domainVjson) {
- domainsVjson[k] = domainVjson;
- }
- });
- ScopeEngine.deepTravVJsonReplaceDomain(vjson, domainsVjson);
- var scope = new Scope({ model: model, vjson: vjson });
- scope['bill_define'] = bizFile;
- _$2.merge(scope, controller);
- console.log('bill_define', vjson, scope, scope['bill_define']);
- return scope;
- };
- ScopeEngine.buildForm = function (controller, model, bizFile, domainKey) {
- var fieldGroups = {};
- for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
- var field = bizFile.domains[domainKey].fields[i];
- var item = { sort: field.form_sort };
- item.xtype = field.xtype;
- item.fieldLabel = field.column_desc;
- item.bind = {
- value: "{" + domainKey + "." + field.column_name + "}",
- };
- _$2.set(model, "data." + domainKey + "." + field.column_name, null);
- // if (field.disabled !== "true" && field.disabled !== "false") {
- // item.bind.disabled = eval(field.disabled)
- // } else {
- // item.disabled = (field.disabled === "true")
- // }
- // if (field.readonly !== "true" && field.readonly !== "false") {
- // item.bind.disabled = eval(field.readonly)
- // } else {
- // item.readonly = (field.readonly === "true")
- // }
- // if (field.required !== "true" && field.required !== "false") {
- // item.bind.required = eval(field.required)
- // } else {
- // item.required = (field.required === "true")
- // }
- // if (field.hide !== "true" && field.hide !== "false") {
- // item.bind.hidden = eval(field.hide)
- // } else {
- // item.hidden = (field.hide === "true")
- // }
- // item.flex = field.
- if (field.dict) {
- item.fix = eval(field.dict);
- }
- // _.set(formModel, "", "")
- item.field = field;
- if (field.form_group) {
- if (!fieldGroups.hasOwnProperty(field.form_group)) {
- fieldGroups[field.form_group] = [item];
- }
- else {
- fieldGroups[field.form_group].push(item);
- }
- }
- }
- var formVjson = {
- xtype: "form",
- title: bizFile.domains[domainKey].name,
- items: []
- };
- _$2.forOwn(fieldGroups, function (fieldGroup, k) {
- var items = ScopeEngine.buildFieldSet(fieldGroup);
- if (items) {
- var fieldsetVjson = {
- xtype: "fieldset",
- title: k,
- items: items
- };
- formVjson.items.push(fieldsetVjson);
- }
- });
- return formVjson;
- };
- ScopeEngine.buildGrid = function (controller, model, bizFile, domainKey) {
- // const vjson = { xtype: "grid", items: []}
- var gridVjson = {
- xtype: "yvgrid",
- columns: [],
- split: true,
- reference: domainKey,
- listeners: {
- itemdblclick: function () {
- },
- },
- };
- for (var i = 0; i < bizFile.domains[domainKey].fields.length; i++) {
- var field = bizFile.domains[domainKey].fields[i];
- gridVjson.columns.push({
- dataIndex: field.column_name,
- header: field.column_desc,
- });
- }
- return gridVjson;
- };
- ScopeEngine.buildFieldSet = function (fieldGroup) {
- var colGroups = [{
- xtype: "cols",
- items: []
- }];
- var colGroup = colGroups[0];
- _$2.sortBy(fieldGroup, function (item) { return item.sort; });
- for (var i = 0; i < fieldGroup.length; i++) {
- var field = fieldGroup[i];
- if (field.field.form_newline === "true") {
- if (colGroup.items.length > 0) {
- colGroup = {
- xtype: "cols",
- items: [field]
- };
- colGroups.push(colGroup);
- }
- }
- else {
- colGroup.items.push(field);
- }
- delete field.field;
- }
- return colGroups;
- };
- ScopeEngine.buildButton = function (controller, buttons) {
- var buttonsVjson = [];
- var _loop_1 = function (i) {
- var item = buttons[i];
- var button = {
- xtype: "button",
- text: item.btn_name,
- iconCls: item.icon
- };
- if (item.hidden === "true" || item.hidden === "false") {
- button.hidden = (item.hidden === "true");
- }
- if (item.listeners) {
- var listeners_1 = {};
- _$2.forOwn(item.listeners, function (v, k) {
- if (v.startsWith(exports.FuncDomain.SCOPE + ".") || v.startsWith(exports.FuncDomain.SYSTEM + ".")) {
- listeners_1[k] = v;
- }
- else {
- try {
- listeners_1[k] = eval(v);
- }
- catch (e) {
- throw e;
- }
- }
- });
- button.listeners = listeners_1;
- }
- buttonsVjson.push(button);
- };
- for (var i = 0; i < buttons.length; i++) {
- _loop_1(i);
- }
- return buttonsVjson;
- };
- ScopeEngine.buildListeners = function (controller, item) {
- if (!item.hasOwnProperty("listeners")) {
- return;
- }
- _$2.forOwn(item.listeners, function (v, k) {
- if (v && typeof v === "string") {
- if (v.indexOf(".") > -1) {
- var strArr = v.split(".");
- if (strArr.length != 2) {
- console.error(item.listeners, "语法解析错误,请检查!");
- }
- var _a = __read(strArr, 2), funcDomain = _a[0], funcName = _a[1];
- switch (funcDomain) {
- case exports.FuncDomain.SCOPE:
- controller[k] = findCustFunc(item, k);
- break;
- case exports.FuncDomain.SYSTEM:
- break;
- default:
- throw new Error("错误的函数域定义");
- }
- }
- else {
- var func = eval(v);
- if (typeof func === 'function') {
- controller[k] = func;
- }
- throw new Error("解析自定义函数出错");
- }
- }
- });
- var findCustFunc = function (item, funcName) {
- if (!item.hasOwnProperty("funcs") || !item[funcName]) {
- throw new Error("没有找到相关的函数定义");
- }
- var func = eval(item[funcName]);
- if (typeof func === 'function') {
- return func;
- }
- throw new Error("解析自定义函数出错");
- };
- };
- /**
- * 只检索 items 的模式,深度遍历 vjson
- */
- ScopeEngine.deepTravVJsonReplaceDomain = function (vjson, domainsVjson) {
- if (Array.isArray(vjson)) {
- for (var i = 0; i < vjson.length; i++) {
- ScopeEngine.deepTravVJsonReplaceDomain(vjson[i], domainsVjson);
- }
- }
- else {
- _$2.forOwn(vjson, function (v, k) {
- if (k !== "domain") {
- if (Array.isArray(v) || Object.prototype.toString.call(v) === "[object Object]") {
- ScopeEngine.deepTravVJsonReplaceDomain(v, domainsVjson);
- }
- }
- else {
- delete vjson.domain;
- _$2.merge(vjson, domainsVjson[v]);
- }
- });
- }
- };
- return ScopeEngine;
- }());
- function initComponent () {
- var ct = Ext.Component.prototype.constructor;
- Ext.Component.override({
- constructor: function (config) {
- var _a, _b;
- if (!isDesignMode(this, config)) {
- var me_1 = this;
- // 任意组件 Ext.Component 构造时调用的方法, 可以用来在渲染之前加工处理 VJSON
- _$2.each(baseConfigProcessList, function (process) {
- process.call(me_1, me_1, config);
- });
- }
- if (config) {
- if (!config.i18nPath && ((_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.i18nPath)) {
- config.i18nPath = config.$initParent.i18nPath;
- }
- if ((_b = config.$initParent) === null || _b === void 0 ? void 0 : _b.setTitle) {
- var setTitle_1 = config.$initParent.setTitle;
- var handel_1 = config.$initParent;
- config.$initParent.setTitle = function (title) {
- var t = { title: title };
- var WMSTranslate = window["WMSTranslate"];
- if (WMSTranslate) {
- if (typeof window['viewTranslate'] === 'function') {
- window['viewTranslate'](t, title, "title");
- }
- }
- setTitle_1.call(handel_1, t.title);
- }.bind(config.$initParent);
- }
- var WMSTranslate = window["WMSTranslate"];
- if (WMSTranslate) {
- if (typeof window['viewTranslate'] === 'function') {
- window['viewTranslate'](config, config.text, "text");
- window['viewTranslate'](config, config.title, "title");
- window['viewTranslate'](config, config.header, "header");
- window['viewTranslate'](config, config.fieldLabel, "fieldLabel");
- window['viewTranslate'](config, config.emptyText, "emptyText");
- }
- }
- }
- ct.call(this, config);
- }
- });
- var _initComponent = Ext.picker.Date.prototype.initComponent;
- Ext.picker.Date.override({
- initComponent: function () {
- var me = this;
- me.defaultValue = Ext.isDate(me.defaultValue) ? me.defaultValue : syncDate(new Date());
- _initComponent.call(me);
- },
- selectToday: function () {
- var me = this, btn = me.todayBtn, handler = me.handler;
- if (btn && !btn.disabled) {
- me.setValue(Ext.Date.clearTime(syncDate(new Date())));
- me.fireEvent('select', me, me.value);
- if (handler) {
- Ext.callback(handler, me.scope, [me, me.value], null, me, me);
- }
- me.onSelect();
- }
- return me;
- },
- });
- }
- function initMainTab () {
- Ext.define('Yvan.MainTab', {
- extend: 'Ext.tab.Panel',
- xtype: 'maintab',
- plugins: Ext.create('Ext.ux.TabCloseMenu', {
- closeTabText: '关闭',
- closeOthersTabsText: '关闭其他',
- closeAllTabsText: '关闭所有'
- }),
- constructor: function (config) {
- var me = this;
- var newConfig = _$2.defaultsDeep({
- // 强制属性
- }, config);
- this.superclass.constructor.call(me, newConfig);
- },
- initComponent: function () {
- var me = this;
- this.on({
- tabchange: function (tabPanel, newCard, oldCard, eOpts) {
- _$2.defer(function () {
- me.changeHash(newCard.id);
- window['cp'] = newCard.yvanScope;
- });
- $$2(window).trigger('tabChange', {
- tabPanel: tabPanel, newCard: newCard, oldCard: oldCard, eOpts: eOpts
- });
- },
- afterrender: function () {
- _$2.defer(function () {
- me.tryRestoryPage();
- });
- }
- });
- this.superclass.initComponent.call(me);
- },
- tryRestoryPage: function () {
- var me = this;
- var hash = '' + window.location.hash;
- if (hash && hash.indexOf('page=') > 0) {
- if (hash.startsWith('#')) {
- hash = hash.substr(1);
- }
- if (hash) {
- var page = Qs.parse(hash).page;
- if (page) {
- // this.openScope(page)
- me.fireEvent('restorypage', page);
- }
- }
- }
- },
- changeHash: function (id) {
- window.location.hash = Qs.stringify({ page: id });
- },
- /**
- * 添加一个业务模块实例到选项卡
- * @param scopeInstance 业务对象实例
- * @param config ExtJS配置对象
- * @param panelInitCallback panel初始化之后会调用函数进行构造前的加工
- */
- addScope: function (scopeInstance, config, panelInitCallback) {
- scopeInstance.topScope = scopeInstance;
- var me = this;
- if (config.path) {
- for (var i = 0; i < this.items.items.length; i++) {
- // 找到当前 tabs 里有没有已经打开过
- var tab = this.items.items[i];
- if (_$2.isEqual(tab.path, config.path)) {
- // 激活
- this.setActiveTab(tab);
- return tab;
- }
- }
- }
- var newPanel = new Ext.panel.Panel(__assign({ closable: true }, config));
- if (typeof panelInitCallback === 'function') {
- panelInitCallback(newPanel);
- }
- // 添加业务模块
- var newTab = this.add(newPanel);
- this.setActiveTab(newTab);
- newTab.on({
- destroy: function (sender) {
- me.changeHash('');
- delete window['cp'];
- }
- });
- return newTab;
- }
- });
- }
- /**
- * 构建所有组件的公共属性
- * @param config 原始config
- * @param dragType 组件模式
- * 不填,代表不能在设计时被拖拽
- * row-container 是一个rows容器
- * col-container 是一个cols容器
- * col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
- * row-item rows中的一行,比如 tree / grid / panel 等等
- */
- function baseConfig(config, dragType) {
- // if (isDesignMode(config, undefined) && dragType) {
- if (typeof config === 'object') {
- var cc = '';
- switch (dragType) {
- case "cols-container":
- cc = 'design_cols_container';
- break;
- case "col-item":
- cc = 'design_col_item';
- break;
- case "rows-container":
- cc = 'design_rows_container';
- break;
- case "row-item":
- cc = 'design_row_item';
- break;
- }
- if (typeof config.cls === 'string') {
- _$2.extend(config, {
- cls: [config.cls, 'yvan_design', cc]
- });
- }
- else if (_$2.isArray(config.cls)) {
- _$2.extend(config, {
- cls: __spread(config.cls, ['yvan_design', cc])
- });
- }
- else {
- _$2.extend(config, {
- cls: ['yvan_design', cc]
- });
- }
- }
- return config;
- }
- function initPanel () {
- /**
- *
- */
- var ct = Ext.panel.Panel.prototype.constructor;
- Ext.panel.Panel.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), panel);
- ct.call(this, newConfig);
- }
- });
- var ss = Ext.form.FieldContainer.prototype;
- Ext.form.FieldContainer.override({
- config: __assign({}, fieldContainer)
- });
- }
- function initGridColumn () {
- var ct = Ext.grid.column.Column.prototype.constructor;
- Ext.grid.column.Column.override({
- constructor: function (config) {
- var scope = lookupScope(config.$initParent.$initParent);
- var newConfig = _$2.defaults({}, config, column);
- if (typeof newConfig.summaryRenderer === 'string') {
- newConfig.summaryRenderer = lookupFn(scope, config.summaryRenderer);
- if (typeof newConfig.summaryRenderer === 'function') {
- newConfig.summaryRenderer = newConfig.summaryRenderer.bind(scope);
- }
- }
- if (config.formatter === 'datetime') {
- newConfig.fix = ['system.formatDate()'];
- delete newConfig.formatter;
- }
- // 在 grid.constructor 已经转换过了
- // if (typeof newConfig.renderer === 'string') {
- // newConfig.renderer = lookupFn(scope, config.renderer)
- // if (typeof newConfig.renderer === 'function') {
- // newConfig.renderer = newConfig.renderer.bind(scope)
- // }
- // }
- ct.call(this, newConfig);
- }
- });
- var ctAction = Ext.grid.column.Action.prototype.constructor;
- Ext.grid.column.Action.override({
- constructor: function (config) {
- var scope = lookupScope(config.$initParent.$initParent);
- _$2.forEach(config.items, function (item) {
- if (typeof item.handler === 'string') {
- item.handler = lookupFn(scope, item.handler);
- if (typeof item.handler === 'function') {
- item.handler = item.handler.bind(scope);
- }
- }
- });
- ctAction.call(this, config);
- }
- });
- var ck = Ext.grid.column.Check.prototype.constructor;
- Ext.grid.column.Check.override({
- constructor: function (config) {
- _$2.set(config, 'listeners.checkchange', function (sender, rowIndex, checked, record, e, eOpts) {
- var grid = sender.view.grid.ownerGrid;
- var column = grid.getColumns()[sender.fullColumnIndex];
- var context = {
- event: e,
- column: column,
- field: sender.dataIndex,
- value: checked,
- record: record,
- rowIdx: rowIndex
- };
- grid.fireEvent('editfinish', grid, sender, context, eOpts);
- });
- ck.call(this, config);
- }
- });
- // 227573
- // const {onTitleElClick} = Ext.grid.column.Column.prototype
- // Ext.define('Yvan.ColumnOverride', {
- // override: 'Ext.grid.column.Column',
- //
- // config: {
- // enableSortOnClick: false,
- // },
- //
- // // /**@Overrides*/
- // onTitleElClick: function (e, t, sortOnClick) {
- // // return this.callParent([e, t, this.enableSortOnClick && sortOnClick]);
- // if (!$(e.target).is('.x-column-header-trigger')) {
- // // 不是点击菜单的情况下,让列自适应宽度
- // this.autoSize()
- // }
- // return onTitleElClick.call(this, e, t, false)
- // }
- // });
- }
- var SIMPLE_RE = /^(?:\{(?:(\d+)|([a-z_][\w\.]*))\})$/i;
- /**
- * 判断目标字符串与关键字是否重叠
- * @param target 目标字符串
- * @param keyword 搜索关键字
- */
- function pinyinMatch(target, keyword) {
- if (typeof target != 'string' || typeof keyword != 'string') {
- return false;
- }
- if (!keyword || !target) {
- return false;
- }
- var pyzh = _$2.toLower(window['getFirstPinyin2'](target));
- keyword = _$2.toLower(keyword);
- var pos1 = _$2.toLower(target).indexOf(keyword);
- if (pos1 >= 0) {
- return true;
- }
- var len = _$2.intersection(keyword.split('')).length;
- if (_$2.intersection(pyzh.split(''), keyword.split('')).length === len) {
- return true;
- }
- return false;
- }
- /**
- * 对某个表达式进行求值
- * a:{query.a},b:{query.b} -> a:aValue,b:bValue
- *
- * @example
- * calcExpress(cc.viewModel.data, "WH_ID:{query.WH_ID},C:{theGrid.selection.data.WH_ID}")
- * 计算出来的值是: "WH_ID:queryWhId,C:JH000000001"
- *
- * @param data 数据环境对象
- * @param express 表达式对象
- */
- function calcExpress(data, express) {
- var result = express;
- if (SIMPLE_RE.test(express)) {
- // '{foo}' 简单表达式
- var path = express.substring(1, express.length - 1);
- var ret = _$2.get(data, path);
- return (ret === null || ret === void 0 ? void 0 : ret.isModel) ? ret.data : ret;
- }
- while (true) {
- var mlist = result.match(/{(.*?)}/);
- if (!mlist) {
- break;
- }
- var pathC = mlist[0]; // {query.a}
- var path = mlist[1]; // query.a
- var value = _$2.get(data, path);
- result = result.replaceAll(pathC, value || '');
- }
- return result;
- }
- /**
- * 对个对象进行表达式求值,不用回调
- * @example
- * 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}'] })
- *
- * {
- * 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'
- * ]
- * }
- *
- * @param data
- * @param paramObject
- */
- function calcObjectFlat(data, paramObject) {
- var result = _$2.cloneDeep(paramObject);
- if (typeof paramObject === 'string') {
- return calcExpress(data, paramObject);
- }
- var trav = function (param) {
- _$2.forOwn(param, function (value, key) {
- if (_$2.isPlainObject(value)) {
- // 深度递归,对子对象进行求解
- trav(value);
- }
- else if (_$2.isString(value)) {
- // 字符串直接用 calcExpress 表达式求解
- param[key] = calcExpress(data, param[key]);
- }
- else if (_$2.isArray(value)) {
- // 数组求解
- _$2.each(value, function (v, idx) {
- value[idx] = calcExpress(data, v);
- });
- }
- });
- };
- trav(result);
- return result;
- }
- /**
- * 合併 data 到當前的 ViewModel 對象
- */
- function mergeViewModel(viewModel, propertyName, data, isFlat) {
- var newRow = {};
- if (isFlat == false) {
- newRow = data;
- }
- else {
- flatObject(newRow, '', data);
- }
- if (!propertyName) {
- _$2.forOwn(newRow, function (value, key) {
- viewModel.set(key, value);
- });
- }
- else {
- _$2.forOwn(newRow, function (value, key) {
- viewModel.set(propertyName + "." + key, value);
- });
- }
- }
- /**
- * 转换内联结构的行,到平面结构
- * company: { name:'公司1', id:'编号1' } => { company_id:'编号1', company_name:'公司1' }
- *
- * @param array
- * @param flatOption
- * @return {[]}
- */
- function flatRow(array) {
- var ret = [];
- _$2.forEach(array, function (row) {
- var newRow = {};
- flatObject(newRow, '', row);
- ret.push(newRow);
- });
- return ret;
- }
- function flatObject(parentObj, parentProp, obj) {
- _$2.forOwn(obj, function (value, key) {
- var fullKey = parentProp ? parentProp + '_' + key : key;
- if (_$2.isArray(value)) {
- parentObj[fullKey] = _$2.map(value, function (row) {
- var newRow = {};
- flatObject(newRow, '', row);
- return newRow;
- });
- }
- else {
- if (typeof value === 'object') {
- flatObject(parentObj, fullKey, value);
- }
- else {
- parentObj[fullKey] = value;
- }
- }
- });
- }
- /**
- * 替换内部结构中,所有 N/A
- */
- function replaceNA(obj) {
- if (obj === 'N/A') {
- return '';
- }
- if (_$2.isArray(obj)) {
- _$2.forEach(obj, function (value, idx) {
- if (value === 'N/A') {
- obj[idx] = '';
- }
- else {
- if (typeof value === "string" && /^-?\d*\.\d+$/.test(value)) {
- var count = 0;
- for (var i = value.length - 1; i > 0; i--) {
- if (value[i] === "0") {
- count++;
- }
- else if (value[i] === ".") {
- count++;
- break;
- }
- else {
- break;
- }
- }
- obj[idx] = value.substr(0, value.length - count);
- }
- else {
- replaceNA(value);
- }
- }
- });
- }
- else if (_$2.isPlainObject(obj)) {
- _$2.forOwn(obj, function (value, key) {
- if (value === 'N/A') {
- obj[key] = '';
- }
- else {
- if (typeof value === "string" && /^-?\d*\.\d+$/.test(value)) {
- var count = 0;
- for (var i = value.length - 1; i > 0; i--) {
- if (value[i] === "0") {
- count++;
- }
- else if (value[i] === ".") {
- count++;
- break;
- }
- else {
- break;
- }
- }
- obj[key] = value.substr(0, value.length - count);
- }
- else {
- replaceNA(value);
- }
- }
- });
- }
- }
- function deepTravJson(obj, resolver) {
- if (_$2.isArray(obj)) {
- _$2.forEach(obj, function (value, idx) {
- if (typeof value === 'string') {
- resolver(obj, value, idx);
- }
- else {
- deepTravJson(value, resolver);
- }
- });
- }
- else if (_$2.isPlainObject(obj)) {
- _$2.forOwn(obj, function (value, key) {
- if (typeof value === 'string') {
- resolver(obj, value, key);
- }
- else {
- deepTravJson(value, resolver);
- }
- });
- }
- }
- /**
- * 根据表达式进入写值
- * express="{query.a}" 写值就是 viewModel.set('query.a', value)
- * express="test-{query.a}" 写值就会失败
- *
- * @example
- * tryWriteByExpress(cc.viewModel, "{query.WH_ID}", "111")
- * 写值成功
- *
- * tryWriteByExpress(cc.viewModel, "test-{query.WH_ID}", "111")
- * 写值失败
- *
- * @param viewModel VM对象
- * @param express 表达式对象
- * @param value 目标值
- */
- function tryWriteByExpress(viewModel, express, value) {
- if (SIMPLE_RE.test(express)) {
- // '{foo}' 简单表达式
- express = express.substring(1, express.length - 1);
- viewModel.set(express, value);
- }
- }
- /**
- * 尝试根据含表达式的对象回写, calcObjectFlat 的逆向方法
- * @example
- * 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]})
- *
- * expressObject:
- * {
- * a: '{query.a}',
- * b: {
- * b1: '{query.b1}',
- * b2: '{query.b2}',
- * },
- * c: 'aa',
- * d: [
- * '{query.a}',
- * '{query.b2}'
- * ]
- * }
- *
- * valueObject:
- * {
- * a: 'aValue',
- * b: {
- * b1: 'b1Value',
- * b2: 'b2Value'
- * },
- * c: 'aa'
- * c: [
- * 'aValue',
- * 'b2Value'
- * ]
- * }
- *
- * 系统会尝试回写
- * viewModel.set('query.a', 'aValue')
- * viewModel.set('query.b1', 'b1Value')
- * viewModel.set('query.b2', 'b2Value')
- *
- * @param expressObject 含表达式的对象
- * @param valueObject 表达式计算完成之后的结果对象
- * @param writeFn 写入的方法 (path, value)=>void
- */
- function tryWriteObject(expressObject, valueObject, writeFn) {
- var trav = function (pathPrefix) {
- var parent = expressObject;
- if (_$2.size(pathPrefix) > 1) {
- parent = _$2.get(parent, pathPrefix.substring(1));
- }
- _$2.forOwn(parent, function (value, key) {
- if (_$2.isPlainObject(value)) {
- // 深度递归,对子对象进行求解
- trav(pathPrefix + "." + key);
- }
- else if (_$2.isString(value)) {
- // 字符串直接用 calcExpress 表达式求解
- if (SIMPLE_RE.test(value)) {
- // If we have '{foo}' alone it is a literal 简单表达式
- var targetPath = value.substring(1, value.length - 1);
- var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1));
- if (!writeFn) {
- console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
- }
- else {
- writeFn(targetPath, targetValue);
- }
- }
- }
- else if (_$2.isArray(value)) {
- _$2.each(value, function (v, idx) {
- if (SIMPLE_RE.test(v)) {
- var targetPath = (pathPrefix + "." + key).substr(1) + "[" + idx + "]";
- var targetValue = _$2.get(valueObject, (pathPrefix + "." + key).substr(1) + "[" + idx + "]");
- if (!writeFn) {
- console.log("viewModel.set('" + targetPath + "', '" + targetValue + "')");
- }
- else {
- writeFn(targetPath, targetValue);
- }
- }
- });
- }
- });
- };
- trav("");
- }
- /**
- * 尝试去掉变量两边括号
- * {a} => a
- * a => a
- */
- function tryVarSimple(value) {
- if (SIMPLE_RE.test(value)) {
- // If we have '{foo}' alone it is a literal 简单表达式
- return value.substring(1, value.length - 1);
- }
- return value;
- }
- /**
- * 对多个表达式进行求值. 异步回调的方式返回
- * {
- * a: 1,
- * b: '{someBind}',
- * c: ['a', 'b', 'c'],
- * d: ['a', 'b', '{someBind}'],
- * e: {
- * y: 1,
- * z: 2
- * },
- * f: {
- * y: 1,
- * z: '{someBind}'
- * }
- * }
- *
- * // Will produce
- * {
- * b: value,
- * d: ['a', 'b', value],
- * f: {
- * y: 1,
- * z: value
- * }
- * }
- * @param viewModel scope.viewModel对象
- * @param paramObject 求值对象
- */
- function calcObject(viewModel, paramObject) {
- // new Ext.app.bind.Multi({a:'1',b:'ddd{query.WH_ID}'},currentScope.viewModel,function(v){console.log(v)},currentScope, {single: true})
- return new Promise(function (resolve) {
- var schedule = new Ext.app.bind.Multi(paramObject, viewModel, function (ret) {
- schedule.destroy();
- // 从 Ext.data.Model 对象转换为 js-object 对象
- ret = toPlainObject(ret);
- resolve(ret);
- }, viewModel, { single: true });
- });
- }
- /**
- * 用于任意组件 Ext.Component 构造时,获取当前组件对应的表格(如果不是 grid.columns 对象就会返回 undefined)
- * @param config 组件构造函数传入的 config 配置文件
- */
- function getParentGrid(config) {
- var _a;
- return (_a = config.$initParent) === null || _a === void 0 ? void 0 : _a.grid;
- }
- /**
- * 解析
- * {
- * condition: "{skuId}",
- * errorMsg: "无法编辑",
- * notice: 'msg'
- * }
- */
- function tryEnable(data, enableSetting) {
- if (!enableSetting) {
- // 没有这一段配置,可以编辑
- return true;
- }
- var condition = enableSetting.condition, errorMsg = enableSetting.errorMsg, notice = enableSetting.notice;
- if (!evalFunction(data, condition)) {
- // 没有达成 condition 条件
- // 计算 msg 消息内容
- var msgContent = calcExpress(data, errorMsg);
- if (msgContent) {
- if (!notice || notice === 'msg') {
- // 进行提示
- msg$1(msgContent);
- }
- }
- return false;
- }
- return true;
- }
- /**
- * 动态的为 combo 或 columns.combo 设置下拉框的值
- * @param sender 目标对象
- * @param config 目标对象的配置(在构造函数之前也可以)
- * @param getDictFn 获取字典的方法
- * @param bizKey 传入字典的参数
- * @param multiValueSeparator 多个字典值的分割符号
- */
- function setComboStore(sender, config, getDictFn, bizKey, multiValueSeparator) {
- if (multiValueSeparator === void 0) { multiValueSeparator = ""; }
- // sender 和 config为空的时候获取值、
- if (_$2.isArray(getDictFn)) {
- // 如果 getDictFn 是直接给定的值,就造一个异步回调的方法
- var realArray_1 = getDictFn;
- getDictFn = function () {
- return realArray_1;
- };
- }
- if (!sender) {
- return new Promise(function (resolve, reject) {
- getDictFn(bizKey, function (r) {
- resolve({ config: config, r: r });
- });
- });
- }
- if (sender.xtype === 'combotree') {
- getDictFn(bizKey, function (r) {
- if (sender.store) {
- // 异步回传
- sender.setStore(new Ext.data.TreeStore({ root: r }));
- }
- else {
- // 同步回传
- config.store = new Ext.data.TreeStore({ root: r });
- }
- });
- return;
- }
- else if (sender.$className === 'Ext.form.field.ComboBox' || sender.$className === 'Ext.form.field.Tag') {
- getDictFn(bizKey, function (r) {
- var _a, _b;
- if (sender.store) {
- // 异步回传
- sender.setStore(new Ext.data.Store(r));
- // 这里有个bug, 异步回传完毕之后, 需要强制刷新一下
- // 否则在 forceSelection 的模式下。displayField 不会强制做变更
- var realValue = (_b = (_a = sender.bind) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.getValue();
- if (typeof realValue !== 'undefined') {
- sender.setValue(realValue);
- }
- }
- else {
- // 同步回传
- config.store = new Ext.data.Store(r);
- }
- });
- return;
- }
- else if (sender.xtype === 'gridcolumn') {
- var grid = getParentGrid(config);
- var editor_1 = config.editor, renderer = config.renderer;
- getDictFn(bizKey, function (r) {
- if (sender.store) {
- // 已经渲染出来了, 用方法进行修改
- var editor_2 = sender.getEditor();
- if (editor_2 && editor_2.xtype === 'combo') {
- var valueField_1 = r.field[0];
- var displayField_1 = r.field[1];
- editor_2.valueField = valueField_1;
- editor_2.setDisplayField(displayField_1);
- editor_2.setStore(new Ext.data.Store(r));
- }
- if (!sender.disableListFilter) {
- sender.setFilter({
- type: 'list',
- options: _$2.map(r.data, function (r) { return ({
- id: '' + r.id,
- text: r.text,
- }); })
- });
- }
- }
- else {
- // 没有渲染之前,修改 config 即可
- if (editor_1 && editor_1.xtype === 'combo') {
- // 带编辑模式
- editor_1.store = new Ext.data.Store(r);
- }
- if (!sender.disableListFilter) {
- config.filter = {
- type: 'list',
- options: _$2.map(r.data, function (r) { return ({
- id: r.id,
- text: r.text,
- }); })
- };
- }
- }
- // 当 metaData === true 表示反向取字典 (根据字典显示值获取id值)
- var renderer = function (value, metaData) {
- if (metaData === void 0) { metaData = false; }
- if (!value && value != 0) {
- return '';
- }
- var valueField = r.field[metaData === true ? 1 : 0];
- var displayField = r.field[metaData === true ? 0 : 1];
- var separator = multiValueSeparator;
- if (separator) {
- var arr = value.split(separator);
- var displayValue_1 = "";
- var _loop_1 = function (i) {
- var itv = arr[i];
- if (i > 0) {
- displayValue_1 += separator;
- }
- _$2.each(r.data, function (row) {
- // 从 valueField 找到要显示的 displayField
- if (row[valueField] == itv) {
- displayValue_1 += row[displayField];
- return false;
- }
- else {
- if (i >= r.data.length - 1) {
- displayValue_1 += itv;
- }
- }
- });
- };
- for (var i = 0; i < arr.length; i++) {
- _loop_1(i);
- }
- return displayValue_1;
- }
- _$2.each(r.data, function (row) {
- // 从 valueField 找到要显示的 displayField
- if (row[valueField] == value) {
- value = row[displayField];
- return false;
- }
- });
- return value;
- };
- var dictForExcel = {};
- var valueField = r.field[0];
- var displayField = r.field[1];
- _$2.each(r.data, function (row) {
- // 从 valueField 找到要显示的 displayField
- var key = row[valueField];
- if (key != '' && typeof key != "undefined" && key != null) {
- dictForExcel[key] = row[displayField];
- }
- });
- if (sender.rendered) {
- // 已经渲染出来了, 对列进行渲染
- sender.renderer = renderer;
- sender.dictForExcel = dictForExcel;
- sender.getView().refresh();
- }
- else {
- sender.renderer = renderer;
- sender.dictForExcel = dictForExcel;
- config.renderer = renderer;
- config.dictForExcel = dictForExcel;
- }
- });
- return;
- }
- throw new TypeError("无法识别的组件类型");
- }
- /**
- * 调用服务器 Ajax
- */
- function invokeServer$1(url) {
- var args = [];
- for (var _i = 1; _i < arguments.length; _i++) {
- args[_i - 1] = arguments[_i];
- }
- // @ts-ignore
- return ajax.func({
- url: url,
- method: 'invoke',
- args: args
- });
- }
- function clearViewModelValues(viewModel, propertyName) {
- if (!propertyName) {
- var dd_1 = viewModel.getData();
- _$2.forOwn(dd_1, function (value, key) {
- viewModel.set(key, '');
- });
- return;
- }
- var dd = _$2.get(viewModel.getData(), propertyName);
- _$2.forOwn(dd, function (value, key) {
- viewModel.set(propertyName + '.' + key, '');
- });
- }
- function reloadGrid(scope, gridRefName) {
- var _a;
- (_a = scope.refs[gridRefName]) === null || _a === void 0 ? void 0 : _a.reload();
- }
- /**
- * 将 Ext.data.Model 对象 (及子属性) 转换为 js.object 对象
- */
- function toPlainObject(obj) {
- if (obj.isModel) {
- obj = obj.data;
- }
- _$2.forOwn(obj, function (v, k) {
- // Ext.data.Model.constructor
- if (!v) {
- return;
- }
- if (v.isModel) {
- v = v.data;
- }
- if (typeof v === 'object') {
- obj[k] = toPlainObject(v);
- }
- else {
- obj[k] = v;
- }
- });
- return obj;
- }
- function confirm(msg, sender) {
- return new Promise(function (resolve) {
- var _a, _b;
- var scope = (_a = lookupScope(sender)) === null || _a === void 0 ? void 0 : _a.topScope;
- var t = { msg: msg };
- var WMSTranslate = window["WMSTranslate"];
- if (WMSTranslate) {
- if (typeof window['viewTranslate'] === 'function') {
- window['viewTranslate'](t, msg, "msg");
- }
- }
- var config = {
- title: '请确认',
- modal: true,
- animateTarget: sender,
- // resizable: false,
- // constrainHeader: true,
- // constrain: true,
- // constrainTo: scope._handle?.el?.dom || Ext.getBody(),
- layout: {
- type: 'hbox',
- pack: 'start',
- align: 'stretch'
- },
- items: [
- {
- html: '<i class="x-fa fa-question-circle" style="font:normal normal normal 40px/1 FontAwesome;color: #31708f;"></i>',
- border: false,
- },
- {
- flex: 1,
- border: false,
- html: "<div style=\"min-width: 170px;min-height: 25px;max-width: 400px;\">" + _$2.escape(t.msg) + "</div>"
- }
- ],
- buttons: [
- {
- xtype: 'button', text: '确定', iconCls: 'x-fa fa-check-circle',
- handler: function () {
- resolve();
- win.close();
- }
- },
- {
- xtype: 'button', text: '取消', iconCls: 'x-fa fa-power-off',
- handler: function () {
- win.close();
- }
- }
- ],
- keyMapEnabled: true,
- keyMap: {
- ENTER: function () {
- resolve();
- win.close();
- }
- }
- };
- if (scope === null || scope === void 0 ? void 0 : scope._handle) {
- config.constrain = true;
- }
- var win = new Ext.Window(config);
- if (scope === null || scope === void 0 ? void 0 : scope._handle) {
- (_b = scope === null || scope === void 0 ? void 0 : scope._handle) === null || _b === void 0 ? void 0 : _b.add(win);
- }
- win.show();
- });
- }
- /**
- * 任何符号字符串都替换成下换线
- */
- function normId(value) {
- return _$2.replace(value, /[^\w]/g, '_');
- }
- /**
- *
- * @param sender
- * @param propertyName
- * @param gridRefName
- */
- function clearViewModelReloadGrid(sender, propertyName, gridRefName) {
- var _a, _b;
- var scope = lookupScope(sender);
- clearViewModelValues(scope.viewModel, propertyName);
- if (!gridRefName) {
- (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
- }
- else {
- (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
- }
- }
- var keydown_fun_item = _$2.debounce(function (sender, event, eOpts) {
- if ([10, 13, 20, 40].includes(event.keyCode)) {
- // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
- var value = _$2.trim(sender.rawValue);
- raiseClick(eOpts.handle);
- }
- }, 150);
- function saveGridRow(grid1) {
- var _a;
- var config = grid1.config;
- var scope = lookupScope(grid1);
- var saveRowValues = (_a = _$2.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
- saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
- // "表格保存"的相关配置
- var dbSaveConfig = {
- columns: [],
- dbTableName: _$2.get(config, 'behavior.dbTableName'),
- saveRowValues: saveRowValues,
- path: scope.originalVjson.__custom_path,
- };
- var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
- if (err) {
- // 如果有异常就不保存
- return;
- }
- // 构建"表格保存"的相关配置
- for (var i = 0; i < config.columns.length; i++) {
- var c = config.columns[i];
- var v = {
- dataIndex: c.dataIndex,
- header: c.header,
- dbColumn: c.dbColumn,
- serverCreateValue: c.serverCreateValue,
- dbIsDeleteKey: c.dbIsDeleteKey,
- dbIsUpdateKey: c.dbIsUpdateKey,
- dbUpdateEnable: c.dbUpdateEnable,
- serverValueConvert: c.dbUpdateEnable,
- };
- if (c.editor) {
- v.editor = {
- xtype: c.editor.xtype,
- required: c.editor.required,
- };
- }
- dbSaveConfig.columns.push(v);
- }
- // 进行业务上的逻辑校验
- var hasError = false;
- _$2.forEach(rows, function (row, i) {
- for (var i_1 = 0; i_1 < config.columns.length; i_1++) {
- var c = config.columns[i_1];
- var value = row[c.dataIndex];
- if (_$2.get(c, 'editor.required') === true && isEmpty(value)) {
- msg$1("\"" + c.header + "\" \u4E0D\u80FD\u4E3A\u7A7A!");
- hasError = true;
- return false;
- }
- if (c.xtype === 'checkcolumn') {
- if (value === false && typeof c.uncheckedValue !== 'undefined') {
- row[c.dataIndex] = c.uncheckedValue;
- }
- if (value === true && typeof c.checkedValue !== 'undefined') {
- row[c.dataIndex] = c.checkedValue;
- }
- }
- }
- });
- if (hasError) {
- return;
- }
- // 设置当前界面为 "保存中..." 状态
- grid1.setLoading(true);
- invokeServer$1('/Dev@batchSave', {
- newRows: newRows,
- modifyRows: modifyRows,
- removeRecords: removeRecords,
- config: dbSaveConfig,
- }).then(function (res) {
- // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
- msg$1(res.msg);
- grid1.reload();
- }).catch(function (e) {
- console.error(e);
- showErrorDialog$1(_$2.toString(e));
- }).finally(function () {
- // 无论正常异常,关闭 "保存中..." 状态
- grid1.setLoading(false);
- });
- }
- function insertGridRow(grid1) {
- var config = grid1.config;
- var focusColumnAfterInsert = _$2.get(config, 'behavior.focusColumnAfterInsert');
- var insertRow = {};
- _$2.forEach(config.columns, function (c) {
- var fn = c.createValue;
- if (_$2.startsWith(fn, 'scope.') ||
- _$2.startsWith(fn, 'system.')) {
- var scope = lookupScope(grid1);
- var fn2 = lookupFn(scope, fn, c);
- if (_$2.isFunction(fn2)) {
- var newValue = fn2();
- if (!_$2.isUndefined(newValue)) {
- insertRow[c.dataIndex] = newValue;
- }
- }
- }
- else if (_$2.isString(fn) && fn) {
- insertRow[c.dataIndex] = fn;
- }
- });
- grid1.appendEditRow(insertRow, focusColumnAfterInsert);
- }
- function commitMe(sender) {
- var window = sender.up('window');
- var scope = lookupScope(sender);
- if (typeof scope['commit'] === 'function') {
- scope['commit']().then(function (res) {
- window.close();
- });
- }
- }
- function removeGridRow(grid1) {
- var _a;
- var config = grid1.config;
- var rows = [];
- if (grid1.selModel.selType === "rowmodel") {
- rows.push(grid1.selection);
- }
- else {
- (_a = grid1.getSelectionModel().getSelected()) === null || _a === void 0 ? void 0 : _a.eachRow(function (r) {
- rows.push(r);
- });
- }
- if (rows.length > 1) {
- var batchRemoveConfirm = _$2.get(config, 'behavior.batchRemoveConfirm');
- if (_$2.isUndefined(batchRemoveConfirm)) {
- //不需要提示
- _$2.forEach(rows, function (r) {
- grid1.getStore().remove(r);
- });
- }
- else {
- var tip = _$2.replace(batchRemoveConfirm, '{count}', '' + rows.length);
- confirm(tip).then(function () {
- _$2.forEach(rows, function (r) {
- grid1.getStore().remove(r);
- });
- });
- }
- }
- else if (rows.length === 1) {
- var singleRemoveConfirm = _$2.get(config, 'behavior.singleRemoveConfirm');
- if (_$2.isUndefined(singleRemoveConfirm)) {
- //不需要提示
- grid1.getStore().remove(rows[0]);
- }
- else {
- var tip_1 = _$2.replace(singleRemoveConfirm, '{count}', '' + rows.length);
- _$2.forEach(config.columns, function (c) {
- tip_1 = _$2.replace(tip_1, "{" + c.dataIndex + "}", rows[0].get(c.dataIndex));
- });
- confirm(tip_1).then(function () {
- grid1.getStore().remove(rows[0]);
- });
- }
- }
- else {
- msg$1('请选择要删除的数据!');
- }
- }
- function moveUpGridRow(grid) {
- grid.rowMoveUp();
- }
- function moveDownGridRow(grid) {
- grid.rowMoveDown();
- }
- var SystemEventFu = /** @class */ (function () {
- function SystemEventFu() {
- }
- SystemEventFu.prototype.moveUpGridRow = function () {
- return function (sender) {
- var grid1 = sender.up('yvgrid');
- moveUpGridRow(grid1);
- };
- };
- SystemEventFu.prototype.commitMe = function () {
- return function (sender) {
- commitMe(sender);
- };
- };
- SystemEventFu.prototype.moveDownGridRow = function () {
- return function (sender) {
- var grid1 = sender.up('yvgrid');
- moveDownGridRow(grid1);
- };
- };
- SystemEventFu.prototype.saveGridRow = function () {
- return function (sender) {
- var grid1 = sender.up('yvgrid');
- saveGridRow(grid1);
- };
- };
- SystemEventFu.prototype.insertGridRow = function () {
- return function (sender) {
- var grid1 = sender.up('yvgrid');
- insertGridRow(grid1);
- };
- };
- SystemEventFu.prototype.removeGridRow = function () {
- return function (sender) {
- var grid1 = sender.up('yvgrid');
- removeGridRow(grid1);
- };
- };
- SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
- return function (sender, config) {
- if (!config.listeners) {
- config.listeners = {};
- }
- config.listeners.afterrender = function (sender) {
- var scope = lookupScope(sender);
- // $(sender.el.dom).on('keydown', (e) => {
- // const xtype = Ext.fly(e.target).component.xtype
- // if (xtype === 'textfield' && e.keyCode === 13) {
- // Ext.defer(() => {
- // raiseClick(scope.refs[btnReferenceName])
- // })
- // e.preventDefault()
- // e.stopPropagation()
- // return false
- // }
- // })
- $(sender.el.dom).on('keyup', function (e) {
- var tt = Ext.fly(e.target).component;
- var xtype = tt === null || tt === void 0 ? void 0 : tt.xtype;
- if ((xtype !== 'textfield' && xtype !== 'numberfield') ||
- ![10, 13, 20, 40].includes(e.keyCode)) {
- return;
- }
- e.preventDefault();
- e.stopPropagation();
- keydown_fun_item(tt, e, { handle: scope.refs[btnReferenceName] });
- return;
- });
- };
- };
- };
- SystemEventFu.prototype.confirm = function (text, fn) {
- return function (sender) {
- var scope = lookupScope(sender);
- var msg = calcExpress(scope.viewModel.data, text);
- confirm(msg, sender).then(function () {
- fn.call(scope, sender);
- });
- };
- };
- SystemEventFu.prototype.gridRemoveCurrentRow = function (gridRefName) {
- return function (sender) {
- var scope = lookupScope(sender);
- var grid = scope.refs[gridRefName];
- if (grid) {
- var records = grid.getSelectionModel().getLastSelected();
- grid.store.remove(records);
- }
- };
- };
- SystemEventFu.prototype.loadForm = function (invokeUrl, invokeParam,
- //可以是 scope.XX / system.XX / string / lookup表达式
- writeTarget) {
- return function (sender) {
- if (!invokeUrl) {
- return;
- }
- var scope = lookupScope(sender);
- scope.setLoading(true);
- var data = scope.viewModel.data;
- if (invokeParam) {
- data = calcObjectFlat(data, invokeParam);
- }
- invokeServer$1(invokeUrl, data).then(function (res) {
- if (res.success) {
- if (typeof writeTarget === "string") {
- _$2.forOwn(res.data, function (v, k) {
- scope.viewModel.set(writeTarget + "." + k, v);
- });
- }
- else if (typeof writeTarget === 'function') {
- writeTarget.call(scope, res.data);
- }
- else if (typeof writeTarget === 'object') {
- var ret = calcObjectFlat(res.data, writeTarget);
- _$2.forOwn(ret, function (v, k) {
- scope.viewModel.set(k, v);
- });
- }
- }
- else {
- showErrorDialog$1(res.msg || '未知错误', sender);
- }
- }).catch(function (e) {
- var _a, _b;
- var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
- showErrorDialog$1(msg || e.toString(), sender);
- }).finally(function () {
- scope.setLoading(false);
- });
- };
- };
- SystemEventFu.prototype.commit = function (groovyUrl, arg0, successCallback) {
- return function (sender) {
- var scope = lookupScope(sender);
- scope.setLoading(true);
- var data = scope.viewModel.data;
- if (arg0) {
- data = calcObjectFlat(data, arg0);
- }
- invokeServer$1(groovyUrl, data).then(function (res) {
- if (res.success) {
- if (res.msg) {
- msg(res.msg);
- }
- if (typeof successCallback === 'function') {
- successCallback.call(scope, sender, res.data);
- }
- }
- else {
- showErrorDialog$1(res.msg || '未知错误', sender);
- }
- }).catch(function (e) {
- var _a, _b;
- var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
- showErrorDialog$1(msg || e.toString(), sender);
- }).finally(function () {
- scope.setLoading(false);
- });
- };
- };
- SystemEventFu.prototype.formCommit = function (groovyUrl, arg0) {
- return function (sender) {
- var scope = lookupScope(sender);
- var form = scope.down('form');
- if (form) {
- // 如果下级有表单,就做表单校验
- var valid = form.isValid();
- if (!valid) {
- return;
- }
- }
- scope.setLoading(true);
- var data = scope.viewModel.data;
- if (arg0) {
- data = calcObjectFlat(data, arg0);
- }
- invokeServer$1(groovyUrl, data).then(function (res) {
- if (res.success) {
- if (res.msg) {
- msg(res.msg);
- }
- scope.dialogSuccess(res);
- }
- else {
- showErrorDialog$1(res.msg || '未知错误', sender);
- }
- }).catch(function (e) {
- var _a, _b;
- var msg = (_b = (_a = e.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.msg;
- showErrorDialog$1(msg || e.toString(), sender);
- }).finally(function () {
- scope.setLoading(false);
- });
- };
- };
- SystemEventFu.prototype.dialogSuccess = function (lookupObject) {
- return function (sender) {
- var scope = lookupScope(sender);
- if (lookupObject) {
- scope.dialogSuccess(calcObjectFlat(scope.viewModel.data, lookupObject));
- }
- else {
- scope.dialogSuccess();
- }
- };
- };
- SystemEventFu.prototype.clearViewModelValues = function (propertyName) {
- return function (sender) {
- var scope = lookupScope(sender);
- clearViewModelValues(scope.viewModel, propertyName);
- };
- };
- SystemEventFu.prototype.getGrid = function (url) {
- return function (sender, config) {
- if (config.xtype == "combogridmulti") {
- // @ts-ignore
- require([url], function (grid) {
- _$2.forOwn(grid.default, function (v, k) {
- sender[k] = v;
- sender.config[k] = v;
- if (sender.rendered) {
- // 已经渲染出来了,重新调用 reload 强制刷新
- sender.reload();
- }
- });
- });
- }
- else {
- // @ts-ignore
- require([url], function (grid) {
- sender.grid = grid.default;
- config.grid = grid.default;
- });
- }
- };
- };
- SystemEventFu.prototype.clearViewModelReloadGrid = function (propertyName, gridRefName) {
- return function (sender) {
- clearViewModelReloadGrid(sender, propertyName, gridRefName);
- };
- };
- SystemEventFu.prototype.reloadGrid = function (gridRefName) {
- return function (sender) {
- var _a, _b;
- var scope = lookupScope(sender);
- if (!gridRefName) {
- (_a = scope.down('grid')) === null || _a === void 0 ? void 0 : _a.reload();
- }
- else {
- (_b = scope.refs[gridRefName]) === null || _b === void 0 ? void 0 : _b.reload();
- }
- };
- };
- SystemEventFu.prototype.showDialog = function (url, lookupForData, successCallback) {
- return function (sender) {
- var scope = lookupScope(sender);
- var data = scope.viewModel.data;
- var param = calcObjectFlat(data, lookupForData);
- // @ts-ignore
- require([url], function (module) {
- var ScopeClass = module.default;
- var scope = new ScopeClass();
- scope.success = successCallback;
- scope.showDialog(sender, {}, { data: param });
- });
- };
- };
- SystemEventFu.prototype.showWidget = function (widgetUrl, lookup) {
- return function (sender, queryValue) {
- showWidget(widgetUrl, lookup, sender, queryValue);
- };
- };
- SystemEventFu.prototype.clearViewModelByLookup = function (lookup) {
- return function (sender) {
- clearViewModelByLookup(sender, lookup);
- };
- };
- SystemEventFu.prototype.closeMe = function (callBack) {
- return function (sender) {
- var scope = lookupScope(sender);
- scope.close();
- if (callBack) {
- callBack.call(sender);
- }
- };
- };
- // 未完成
- SystemEventFu.prototype.showDialogAndFillData = function (url, lookupForData, map) {
- return function (sender) {
- var scope = lookupScope(sender);
- var data = scope.viewModel.data;
- var billSetting = scope.billSetting;
- var param = calcObjectFlat(data, lookupForData);
- return new Promise(function (resolve, reject) {
- var sf = function (scope) {
- scope.success = function (dlgScope, dlgSender, reData) {
- };
- scope.showDialog(sender, {}, { data: param });
- };
- // @ts-ignore
- require([url], function (module) {
- // 业务描述文件
- if (url.endsWith(".bill")) {
- ScopeEngine.buildScopeFromBillFile(module.default).then(function (scope) {
- sf(scope);
- });
- }
- else { //原生yvanui文件
- var ScopeClass = module.default;
- var scope_1 = new ScopeClass();
- sf(scope_1);
- }
- });
- });
- };
- };
- __decorate([
- Lib({
- title: '为某个表格,上移行',
- author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
- }),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", []),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "moveUpGridRow", null);
- __decorate([
- Lib({
- title: '为某个表格,上移行',
- author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
- }),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", []),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "commitMe", null);
- __decorate([
- Lib({
- title: '为某个表格,下移行',
- author: '罗一帆', createAt: '2022-07-19', updateAt: '2022-07-19', type: 'system', category: '表格',
- }),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", []),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "moveDownGridRow", null);
- __decorate([
- Lib({
- title: '为某个表格,批量保存至数据库',
- author: '罗一帆',
- createAt: '2022-07-19',
- updateAt: '2022-07-19',
- type: 'system',
- category: '表格',
- }),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", []),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "saveGridRow", null);
- __decorate([
- Lib({
- title: '为某个表格插入数据行',
- author: '罗一帆',
- createAt: '2022-07-19',
- updateAt: '2022-07-19',
- type: 'system',
- category: '表格',
- }),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", []),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "insertGridRow", null);
- __decorate([
- Lib({
- title: '为某个表格删除所选数据行',
- author: '罗一帆',
- createAt: '2022-07-19',
- updateAt: '2022-07-19',
- type: 'system',
- category: '表格',
- }),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", []),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "removeGridRow", null);
- __decorate([
- Lib({
- title: '按下回车键之后默认是否按下某个按钮',
- author: '罗一帆',
- createAt: '2021-07-02',
- updateAt: '2021-07-02',
- type: 'system',
- category: '字典',
- }),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "enterToClick", null);
- __decorate([
- Lib({
- title: '弹出确认对话框,回答 YES 之后调用某方法',
- author: '罗一帆',
- createAt: '2021-07-06',
- updateAt: '2021-07-06',
- type: 'system',
- category: '对话框',
- }),
- __param(0, LibParam('对话框的确认文字', 'string')),
- __param(1, LibParam('确认之后的调用的方法', 'event')),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Object, Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "confirm", null);
- __decorate([
- Lib({
- title: '删除表格当前的选中行(前端删除)',
- author: '罗一帆',
- createAt: '2021-07-08',
- updateAt: '2021-07-08',
- type: 'system',
- category: '表格',
- }),
- __param(0, LibParam('表格引用名', 'refs')),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "gridRemoveCurrentRow", null);
- __decorate([
- Lib({
- title: '查询表单,如果 url 为空值,就取消查询',
- author: '罗一帆',
- createAt: '2021-07-06',
- updateAt: '2021-07-06',
- type: 'system',
- category: '表单',
- }),
- __param(0, LibParam('后端服务路径', 'string')),
- __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
- __param(2, LibParam('提交成功后的回调', 'viewModel', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [String, Object, Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "loadForm", null);
- __decorate([
- Lib({
- title: '提交(不做校验、不关闭窗体)',
- author: '罗一帆',
- createAt: '2021-07-02',
- updateAt: '2021-07-02',
- type: 'system',
- category: '表单',
- }),
- __param(0, LibParam('后端服务路径', 'string')),
- __param(1, LibParam('后端需要的数据,默认情况提交所有', 'lookup', true)),
- __param(2, LibParam('提交成功后的回调', 'event', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [String, Object, Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "commit", null);
- __decorate([
- Lib({
- title: '提交表单',
- author: '罗一帆',
- createAt: '2021-07-02',
- updateAt: '2021-07-02',
- type: 'system',
- category: '表单',
- }),
- __param(0, LibParam('后端服务路径', 'string')),
- __param(1, LibParam('后端需要的参数,默认情况提交所有', 'lookup', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [String, Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "formCommit", null);
- __decorate([
- Lib({
- title: '对话框成功回调',
- author: '罗一帆',
- createAt: '2021-07-02',
- updateAt: '2021-07-02',
- type: 'system',
- category: '对话框',
- }),
- __param(0, LibParam('传回给父窗口的成功参数对象', 'lookup', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "dialogSuccess", null);
- __decorate([
- Lib({
- title: '清空 viewModel 某个属性',
- author: '罗一帆',
- createAt: '2021-07-02',
- updateAt: '2021-07-02',
- type: 'system',
- category: '表单',
- }),
- __param(0, LibParam('属性路径', 'viewModel', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [String]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "clearViewModelValues", null);
- __decorate([
- Lib({
- title: '从其他资源获取表格设置',
- author: '罗一帆',
- createAt: '2021-07-02',
- updateAt: '2021-07-02',
- type: 'system',
- category: '表单',
- }),
- __param(0, LibParam('定义文件', 'module')),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "getGrid", null);
- __decorate([
- Lib({
- title: '清空 viewModel 某个属性,并刷新表格',
- author: '罗一帆',
- createAt: '2021-07-02',
- updateAt: '2021-07-02',
- type: 'system',
- category: '表单',
- }),
- __param(0, LibParam('清空的属性', 'viewModel')),
- __param(1, LibParam('要刷新的表格', 'refs', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [String, String]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "clearViewModelReloadGrid", null);
- __decorate([
- Lib({
- title: '刷新表格',
- author: '罗一帆',
- createAt: '2021-07-02',
- updateAt: '2021-07-02',
- type: 'system',
- category: '表单',
- }),
- __param(0, LibParam('表格对象,不填的情况下就是第一个表格', 'refs', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [String]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "reloadGrid", null);
- __decorate([
- Lib({
- title: '显示对话框',
- author: '罗一帆',
- createAt: '2021-07-02',
- updateAt: '2021-07-02',
- type: 'system',
- category: '对话框',
- }),
- __param(0, LibParam('业务模块名', 'module')),
- __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
- __param(2, LibParam('成功回调(对话框成功结束后的回调方法)', 'event', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [String, Object, Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "showDialog", null);
- __decorate([
- Lib({
- title: '弹出查找框(不借助 search)',
- author: '罗一帆',
- createAt: '2021-07-02',
- updateAt: '2021-07-02',
- type: 'system',
- category: '对话框',
- }),
- __param(0, LibParam('模块名 (WidgetDialog)', 'module')),
- __param(1, LibParam('lookup 映射关系', 'lookup', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Object, Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "showWidget", null);
- __decorate([
- Lib({
- title: '根据 lookup 清空 viewModel',
- author: '罗一帆',
- createAt: '2021-07-05',
- updateAt: '2021-07-05',
- type: 'system',
- category: '表单',
- }),
- __param(0, LibParam('设值表达式', 'lookup')),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "clearViewModelByLookup", null);
- __decorate([
- Lib({
- title: '关闭对话框',
- author: '罗一帆',
- createAt: '2021-07-05',
- updateAt: '2021-07-05',
- type: 'system',
- category: '对话框',
- }),
- __param(0, LibParam('对话框的返回值回调', 'event', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "closeMe", null);
- __decorate([
- Lib({
- title: '打开对话框并返回数据',
- author: '余亮',
- createAt: '2022-07-07',
- updateAt: '2022-07-07',
- type: 'system',
- category: '对话框',
- }),
- __param(0, LibParam('业务模块名', 'module')),
- __param(1, LibParam('参数数据 lookup 表达式', 'lookup', true)),
- __param(2, LibParam('结果映射关系', 'string', true)),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [String, Object, Object]),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "showDialogAndFillData", null);
- return SystemEventFu;
- }());
- /**
- * 清空 viewmodel 里下属的所有属性
- * @param viewModel VM对象
- * @param propertyKey 要清空的属性,可以是 "a.b.c" 这种表达模式
- * @param ignoreProps 要忽略清空的属性名集合, 比如 ["a.b","b"]
- */
- function clearViewModel(viewModel, propertyKey, ignoreProps) {
- var data = viewModel.data;
- if (propertyKey) {
- data = _$2.get(data, propertyKey);
- }
- _$2.forOwn(data, function (value, key) {
- var targetKey = propertyKey ? propertyKey + "." + key : key;
- if (ignoreProps && _$2.indexOf(ignoreProps, targetKey) >= 0) {
- return;
- }
- viewModel.set(targetKey, '');
- });
- }
- function clearViewModelByLookup(sender, lookup) {
- if (_$2.isPlainObject(lookup)) {
- var parentScope_1 = lookupScope(sender);
- _$2.forOwn(lookup, function (value, key) {
- if (SIMPLE_RE.test(value)) {
- // '{foo}' 简单表达式
- var path = value.substring(1, value.length - 1);
- if (path !== 'queryValue') {
- parentScope_1.viewModel.set(path, '');
- }
- }
- });
- }
- }
- function showWidget(widgetUrl, lookup, sender, queryValue, vjson) {
- if (vjson === void 0) { vjson = {}; }
- var parentScope = lookupScope(sender);
- var me = sender;
- // @ts-ignore
- require([widgetUrl], function (widgetScope) {
- var WidgetScopeClass = widgetScope.default;
- widgetScope = new WidgetScopeClass();
- // 传递进 widget.model 的数据
- var widgetDialogData = calcObjectFlat(__assign({ queryValue: queryValue }, parentScope.viewModel.data), lookup);
- widgetScope.parentScope = parentScope;
- widgetScope.searchWidgetSuccess = function (data) {
- if (typeof lookup === 'string') {
- // lookup 是字符串的情况下,就是取某个列作为 value 值
- me.setValue(data[lookup]);
- return;
- }
- /**
- * lookup: {
- * // 扩展到 viewModel 的值做更改
- * WH_CODE: "{queryValue}",
- * WH_NAME: "{query.WH_NAME}",
- * }
- */
- if (_$2.isPlainObject(lookup)) {
- var parentScope_2 = lookupScope(sender);
- tryWriteObject(lookup, data, function (path, value) {
- if (path === 'queryValue') {
- me.setValue(value);
- }
- else {
- parentScope_2.viewModel.set(path, value);
- }
- });
- }
- return true;
- };
- widgetScope.showDialog(sender, vjson, { data: widgetDialogData });
- });
- }
- /**
- * 停止事件的默认行为
- * @param e
- */
- function stopEvent(e) {
- e.preventDefault();
- e.stopPropagation();
- // @ts-ignore
- window.event.cancelBubble = true;
- e.returnValue = false;
- e.cancelBubble = true;
- }
- /**
- * 屏幕中央显示一个黑框提示
- */
- function msg$1(content) {
- msg(content);
- }
- /**
- * 错误对话框的强提醒
- */
- function showErrorDialog$1(msg, sender) {
- showErrorDialog(msg, sender);
- }
- /**
- * 错误对话框的强提醒
- */
- function showInfoDialog(msg, sender) {
- showInfoDialogSimple(msg, sender);
- }
- /**
- * 错误对话框的强提醒
- */
- function prompt$2(message, defaultValue, multiLine) {
- if (defaultValue === void 0) { defaultValue = ""; }
- if (multiLine === void 0) { multiLine = false; }
- return prompt$1(message, defaultValue, multiLine);
- }
- /**
- * 用于计算 express 表达式
- */
- function evalFunction(data, express) {
- var keys = [];
- var values = [];
- _$2.forOwn(data, function (value, key) {
- var match = key.match(/\-|\*|\\|\/|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)/i);
- if (match) {
- key = key.substring(0, match.index);
- }
- keys.push(key);
- values.push(value);
- });
- var func = Function.apply(void 0, __spread(keys, ['return ' + express]));
- try {
- return func.apply(void 0, __spread(values));
- }
- catch (e) {
- return;
- }
- }
- /**
- * 获取表格编辑的行数据
- */
- function getGridEditRows(grid) {
- return grid.getGridEditRows();
- }
- var SystemLib = /*#__PURE__*/Object.freeze({
- __proto__: null,
- SIMPLE_RE: SIMPLE_RE,
- pinyinMatch: pinyinMatch,
- calcExpress: calcExpress,
- calcObjectFlat: calcObjectFlat,
- mergeViewModel: mergeViewModel,
- flatRow: flatRow,
- replaceNA: replaceNA,
- deepTravJson: deepTravJson,
- tryWriteByExpress: tryWriteByExpress,
- tryWriteObject: tryWriteObject,
- tryVarSimple: tryVarSimple,
- calcObject: calcObject,
- getParentGrid: getParentGrid,
- tryEnable: tryEnable,
- setComboStore: setComboStore,
- invokeServer: invokeServer$1,
- clearViewModelValues: clearViewModelValues,
- reloadGrid: reloadGrid,
- toPlainObject: toPlainObject,
- confirm: confirm,
- normId: normId,
- clearViewModelReloadGrid: clearViewModelReloadGrid,
- saveGridRow: saveGridRow,
- insertGridRow: insertGridRow,
- commitMe: commitMe,
- removeGridRow: removeGridRow,
- moveUpGridRow: moveUpGridRow,
- moveDownGridRow: moveDownGridRow,
- SystemEventFu: SystemEventFu,
- clearViewModel: clearViewModel,
- clearViewModelByLookup: clearViewModelByLookup,
- showWidget: showWidget,
- stopEvent: stopEvent,
- msg: msg$1,
- showErrorDialog: showErrorDialog$1,
- showInfoDialog: showInfoDialog,
- prompt: prompt$2,
- evalFunction: evalFunction,
- getGridEditRows: getGridEditRows
- });
- function initTree () {
- Ext.define('Yvan.Tree', {
- extend: 'Ext.tree.Panel',
- alias: 'widget.yvtree',
- xtype: 'yvtree',
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制性属性
- }, baseConfig(config, 'row-item'), config, tree);
- _$2.assign(newConfig, {
- tbar: [
- {
- xtype: 'textfield',
- // triggerCls: 'x-form-clear-trigger',
- flex: 1,
- emptyText: '搜索过滤',
- enableKeyEvents: true,
- listeners: {
- change: function (sender) {
- var tree = sender.up("treepanel");
- tree.filterByText(this.getRawValue());
- },
- keyup: function (sender, e) {
- var tree = sender.up("treepanel");
- if (e.ESC === e.getKey()) {
- sender.setValue('');
- tree.filterByText('');
- }
- }
- }
- },
- ],
- });
- if (!newConfig.hideRefresh) {
- newConfig.tbar.push({
- xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
- listeners: {
- click: function (sender) {
- var scope = sender.up("yvtree");
- scope.reload();
- }
- }
- });
- }
- if (!newConfig.hideExpand) {
- newConfig.tbar.push({
- xtype: 'button', iconCls: 'x-fa fa-plus-square-o', tooltip: '全部展开',
- listeners: {
- click: function (sender) {
- var scope = sender.up("yvtree");
- scope.expandAll();
- }
- }
- });
- }
- if (!newConfig.hideCollapse) {
- newConfig.tbar.push({
- xtype: 'button', iconCls: 'x-fa fa-minus-square-o', tooltip: '全部收起',
- listeners: {
- click: function (sender) {
- var scope = sender.up("yvtree");
- scope.collapseAll();
- }
- }
- });
- }
- this.superclass.constructor.call(this, newConfig);
- },
- /**
- * 在根节点上增加一个节点,会触发 addNode 事件
- * @param props
- */
- addRoot: function (props) {
- var me = this;
- var tableNode = me.getRootNode();
- var fieldNode = tableNode.createNode(new Ext.data.NodeInterface({}));
- if (_$2.isFunction(props)) {
- props = props.call(this, parent);
- }
- _$2.forOwn(props, function (value, key) {
- fieldNode.set(key, value);
- });
- var node = tableNode.appendChild(fieldNode);
- me.ensureVisible(node);
- me.setSelection(node);
- me.fireEvent('addNode', me, {
- parent: tableNode,
- node: node,
- });
- },
- addLast: function (props) {
- var me = this;
- var sel = me.selModel.getSelection();
- if (!sel || sel.length <= 0) {
- msg('请选择一个要添加的同级节点路径');
- return;
- }
- var parent = sel[0].parentNode ? sel[0].parentNode : me.getRootNode();
- var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
- if (_$2.isFunction(props)) {
- props = props.call(this, parent);
- }
- _$2.forOwn(props, function (value, key) {
- fieldNode.set(key, value);
- });
- var node = parent.appendChild(fieldNode);
- me.ensureVisible(node);
- me.setSelection(node);
- me.fireEvent('addNode', me, {
- parent: parent,
- node: node,
- });
- },
- addChildren: function (props) {
- var me = this;
- var sel = me.selModel.getSelection();
- if (!sel || sel.length <= 0) {
- msg('请选择一个要添加子节点的路径');
- return;
- }
- var parent = sel[0];
- if (_$2.isFunction(props)) {
- props = props.call(this, parent);
- }
- var fieldNode = parent.createNode(new Ext.data.NodeInterface({}));
- _$2.forOwn(props, function (value, key) {
- fieldNode.set(key, value);
- });
- var node = parent.appendChild(fieldNode);
- parent.expand();
- me.ensureVisible(node);
- me.setSelection(node);
- me.fireEvent('addNode', me, {
- parent: parent,
- node: node,
- });
- },
- initComponent: function () {
- var me = this;
- var config = me.config;
- var scope = lookupScope(this);
- if (!isDesignMode(scope, config)) {
- // 转换 dataSource 属性
- convertDataSource(me, scope, config);
- }
- this.superclass.initComponent.call(this);
- this.on({
- afterrender: function (sender) {
- var me = this;
- var config = this.config;
- var dataSource = config.dataSource;
- if (config.autoLoad) {
- if (config.dataSourceCallbackFn) {
- me.reload();
- }
- else if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke') {
- me.reload();
- }
- }
- }
- });
- },
- _setDataReal: function (value) {
- var me = this;
- // me.setStore(new Ext.data.TreeStore({
- // root: {
- // expanded: true,
- // // children: value
- // children: [
- // {
- // id: '1', text: 'A',
- // children: [
- // {id: '1', text: 'A',},
- // {id: '2', text: 'B'},
- // ]
- // },
- // {id: '2', text: 'B'},
- // ]
- // }
- // }))
- me.store.setRoot({
- expanded: true,
- children: value
- });
- // me.store = new Ext.data.TreeStore({
- // root: {
- // expanded: true,
- // // children: value
- // children: [
- // {
- // id: '1', text: 'A',
- // children: [
- // {id: '1', text: 'A',},
- // {id: '2', text: 'B'},
- // ]
- // },
- // {id: '2', text: 'B'},
- // ]
- // }
- // })
- },
- /**
- * 重新载入数据(重新计算参数)
- */
- reload: function (reloadParams) {
- if (reloadParams === void 0) { reloadParams = {}; }
- var me = this;
- var config = me.config;
- if (config.dataSourceCallbackFn) {
- // 函数请求刷新
- var scope_1 = lookupScope(this);
- // me.setLoading(true)
- config.dataSourceCallbackFn.call(scope_1, me, {
- successCallback: function (value) {
- me._setDataReal(value);
- // me.setLoading(false)
- me.fireEvent('dataLoadComplete', me, true, value);
- },
- failCallback: function (error) {
- // me.setLoading(false)
- me.fireEvent('dataLoadComplete', me, false, error);
- }
- });
- return;
- }
- var scope = lookupScope(me);
- var dataSource = config.dataSource;
- if (_$2.isPlainObject(dataSource) && dataSource.method === 'invoke' && !isDesignMode(scope, config)) {
- var params = calcObjectFlat(scope.viewModel.data, _$2.defaultsDeep({}, reloadParams, dataSource.params));
- me.setLoading(true);
- invokeServer$1(dataSource.url, params)
- .then(function (res) {
- me._setDataReal(res.data);
- me.fireEvent('dataLoadComplete', me, res);
- })
- .finally(function () {
- me.setLoading(false);
- });
- }
- },
- filterByText: function (text) {
- this._filterText = text;
- this._filterBy(this, text, 'text');
- },
- _filterBy: _$2.debounce(function (me, text, by) {
- var view = me.getView();
- me.store.clearFilter();
- if (!me._filterText) {
- // 没有筛选内容,还原状态
- var selections = me.getSelection();
- var selectionPaths_1 = [];
- _$2.forEach(me.getSelection(), function (item) {
- selectionPaths_1.push(item.getPath());
- });
- me.collapseAll();
- _$2.forEach(selectionPaths_1, function (path) {
- me.expandPath(path);
- });
- me.setSelection(selections);
- return;
- }
- // 递归查找所有需要可见的节点 id 数组
- var nodesAndParents = [];
- var expandPaths = [];
- me.getRootNode().cascadeBy(function (tree, view) {
- var currNode = this;
- currNode.collapse();
- if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
- // 展开到匹配的路径
- // me.expandPath(currNode.getPath());
- expandPaths.push(currNode.getPath());
- // 沿途父节点全部设定为可见
- while (currNode.parentNode) {
- nodesAndParents.push(currNode.id);
- currNode = currNode.parentNode;
- }
- }
- }, null, [me, view]);
- me.store.filterBy(function (r) {
- return Ext.Array.contains(nodesAndParents, r.get('id'));
- });
- _$2.forEach(expandPaths, function (path) {
- me.expandPath(path);
- });
- }, 1000),
- });
- }
- function convertDataSource(sender, scope, newConfig) {
- if (typeof newConfig.store !== 'undefined') {
- // 有 store 属性的情况下,不做任何事
- return;
- }
- if (typeof newConfig.dataSource === 'undefined') {
- // 没有定义 dataSource 的情况下,不做任何事
- return;
- }
- var dataSource = newConfig.dataSource;
- if (typeof dataSource === 'string') {
- // dataSource 是字符串的情况下,找到成员函数
- dataSource = lookupFn(scope, dataSource);
- }
- if (typeof dataSource === 'function') {
- // dataSource 是函数的情况下,在 afterrender 之后进行回调
- newConfig.store = new Ext.data.TreeStore({
- root: {
- expanded: true,
- children: []
- }
- });
- newConfig.dataSourceCallbackFn = dataSource;
- return;
- }
- // throw new TypeError('无法识别的调用方法')
- }
- /**
- * 构建一个 grid 支持的 dataSource
- */
- function gridInvokeBuild(scope, grid, config, dataSource, reloadParams, isExcelExport, excelExportCallBack) {
- if (reloadParams === void 0) { reloadParams = {}; }
- if (isExcelExport === void 0) { isExcelExport = false; }
- if (excelExportCallBack === void 0) { excelExportCallBack = null; }
- var _a;
- var me = grid;
- var params = calcObjectFlat(scope.viewModel.data, dataSource.params);
- var storeOption = {};
- if (dataSource.method === 'invoke' || dataSource.sqlId) {
- if (dataSource.sqlId) {
- dataSource.method = 'invoke';
- dataSource.url = '/Dev@executeSQL';
- if (_$2.startsWith(dataSource.sqlId, '@')) {
- // sqlId 是 @ 开头,代表直接带中文名
- var scope_1 = lookupScope(grid);
- params.path = sqlUrlTransform(_$2.get(scope_1, 'originalVjson.__custom_path'));
- params.sqlId = dataSource.sqlId.substring(1);
- }
- else {
- // sqlId 是 aa/bb/cc@dd 模式,代表直接带中文名
- var _b = __read(dataSource.sqlId.split('@'), 2), path = _b[0], sqlId = _b[1];
- params.path = path;
- params.sqlId = sqlId;
- }
- params.pagination = (_a = config.pagination) !== null && _a !== void 0 ? _a : true;
- }
- var fields_1 = [];
- _$2.forEach(grid.columns, function (col) {
- var c = {};
- if (col.dataIndex) {
- c.name = col.dataIndex;
- fields_1.push(c);
- }
- if (col.dataType) {
- c.type = col.dataType;
- }
- });
- // 默认支持 gridInvoke
- var extraParams = _$2.defaultsDeep({}, reloadParams, params);
- console.log("extraParams", extraParams);
- //@ts-ignore
- storeOption = {
- fields: fields_1,
- remoteSort: config.remoteSort,
- remoteFilter: config.remoteFilter,
- autoLoad: true,
- pageSize: me.store.pageSize || config.pageSize,
- proxy: {
- type: 'jsonAjax',
- $owner: me,
- url: serverInvokeUrlTransform(dataSource.url, { scope: scope, grid: grid, isExcelExport: isExcelExport, excelExportCallBack: excelExportCallBack }),
- extraParams: extraParams,
- reader: {
- type: 'json',
- rootProperty: 'data',
- totalProperty: 'pagination.total',
- successProperty: 'success',
- messageProperty: 'msg',
- transform: function (data) {
- if (typeof window['ajaxProcess'] === 'function') {
- window['ajaxProcess'](data);
- }
- if (typeof window['apiTranslate'] === 'function') {
- window['apiTranslate'](data, dataSource.url);
- }
- if (typeof grid._transform === 'function') {
- // 系统转换函数
- grid._transform(data.data);
- }
- if (grid.dataTransform) {
- if (typeof grid.dataTransform === 'string') {
- grid.dataTransform = lookupFn(lookupScope(grid), grid.dataTransform);
- }
- return grid.dataTransform.call(scope, grid, data);
- }
- return data;
- }
- }
- },
- listeners: {
- load: function (store, records, successful, operation) {
- var _a, _b, _c;
- var rep = (_a = operation.getResponse()) === null || _a === void 0 ? void 0 : _a.responseJson;
- if (rep.pagination) {
- grid.dbInfo = rep.pagination.dbInfo;
- grid.exportDataSql = rep.pagination.exportDataSql;
- grid.exportDataSqlParams = rep.pagination.exportDataSqlParams;
- }
- 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;
- if (isExcelExport) {
- if (typeof excelExportCallBack === 'function') {
- excelExportCallBack(rep);
- }
- else if (excelExportCallBack) {
- console.error("导出回调方法错误!");
- }
- me.fireEvent('excelDataLoadComplete', me, successful, records);
- }
- else {
- if (_$2.get(config, 'behavior.autoSelectFirst')) {
- // 自动选中第一行
- var data = grid.getStore().data;
- if (data.length > 0) {
- grid.setSelection(data.items[0]);
- }
- }
- me.fireEvent('dataLoadComplete', me, successful, records);
- }
- }
- }
- };
- }
- else if (exports.apiConvert) {
- // console.log("apiConvert", apiConvert.gridInvokeBuild)
- // 外部扩展的 apiConvert
- //@ts-ignore
- storeOption = exports.apiConvert.gridInvokeBuild(scope, grid, config, dataSource, params, reloadParams, isExcelExport, excelExportCallBack);
- console.log("storeOption", storeOption);
- }
- else {
- throw new TypeError("不支持的 API 请求方式");
- }
- if (isExcelExport) {
- storeOption.proxy.timeout = 1000 * 60 * 30;
- console.log("isExcelExport", isExcelExport, storeOption);
- var excelStore = new Ext.data.Store(storeOption);
- excelStore.load();
- }
- else {
- if (me.groupField) {
- console.log('groupField', storeOption.groupField);
- storeOption.groupField = me.groupField;
- }
- me.setStore(new Ext.data.Store(storeOption));
- }
- }
- function initStores () {
- Ext.define('Yvan.JsonAjaxProxy', {
- extend: 'Ext.data.proxy.Ajax',
- alias: 'proxy.jsonAjax',
- actionMethods: {
- create: "POST",
- read: "POST",
- update: "POST",
- destroy: "POST"
- },
- timeout: storeAjax.timeout,
- buildRequest: function (operation) {
- // 参考源码 ext-all-debug.js:71468 method:buildRequest
- var me = this;
- var $owner = me.$owner; // 在 grid.initComponent 中赋值 $owner
- var scope = lookupScope($owner);
- var gridParam = me.getParams(operation);
- var customParam = {};
- // 提取 srot 元素
- if (gridParam.sort) {
- var sort = JSON.parse(gridParam.sort);
- // 字符串 [{"property":"BRANCHID","direction":"ASC"}]
- // 转换为对象 [{colId: "BRANCHID", sort: "asc"}]
- customParam.sortModel = [];
- _$2.forEach(sort, function (s) {
- customParam.sortModel.push({
- colId: s.property,
- sort: _$2.toLower(s.direction)
- });
- });
- delete gridParam.sort;
- }
- // 提取筛选元素
- if (gridParam.filter) {
- var filter = JSON.parse(gridParam.filter);
- console.log('gridParam.filter', gridParam.filter);
- // "[{"operator":"like","value":"1","property":"id"}]"
- // 转换为 filterModel: {BRANCHID: {filterType: "text", type: "contains", filter: "12"}}
- customParam.filterModel = {};
- _$2.forEach(filter, function (s) {
- var newFilterItem = {};
- if (s.operator === 'like') {
- newFilterItem.filterType = 'text';
- newFilterItem.type = 'contains';
- newFilterItem.filter = s.value;
- }
- else {
- // 无法识别的筛选类型
- newFilterItem.filterType = 'dict';
- newFilterItem.type = 'in';
- newFilterItem.filter = s.value;
- }
- customParam.filterModel[s.property] = newFilterItem;
- });
- delete gridParam.filter;
- }
- // 被 grid.constructor 作为方法存在
- var extraParams = _$2.cloneDeep(me.getExtraParams());
- var params = _$2.defaultsDeep(gridParam, extraParams);
- // var request = this.superclass.buildRequest.apply(this, arguments);
- var request = new Ext.data.Request({
- params: {},
- action: operation.getAction(),
- records: operation.getRecords(),
- url: me.buildUrl(),
- jsonData: __assign({ args: [
- params
- ] }, customParam),
- proxy: me
- });
- operation.setRequest(request);
- return request;
- },
- afterRequest: function (req, res) {
- // Extend.afterExtRequest(req, res)
- }
- });
- Ext.define('Ext.ux.data.MyReader', {
- extend: 'Ext.data.reader.Json',
- xtype: 'yvgridreader',
- useSimpleAccessors: false,
- });
- }
- function initBehaviorEdit(config) {
- var _a, _b, _c;
- var dbTableName = _$2.get(config, 'behavior.dbTableName');
- var addButtonConfig = (_a = _$2.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
- var deleteButtonConfig = (_b = _$2.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
- var saveButtonConfig = (_c = _$2.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
- if (dbTableName) {
- // 生成增删查改
- var tbar = [
- __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
- click: 'system.saveGridRow()'
- }, bind: {
- disabled: '{!' + config.reference + '.ischanged}'
- } }, saveButtonConfig),
- '-',
- __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
- click: 'system.insertGridRow()'
- } }, addButtonConfig),
- __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
- click: 'system.removeGridRow()'
- } }, deleteButtonConfig),
- ];
- if (_$2.isArray(config.tbar)) {
- config.tbar = __spread(tbar, [
- '-'
- ], config.tbar);
- }
- else if (_$2.isPlainObject(config.tbar)) {
- config.tbar = {
- border: false,
- layout: {
- type: 'vbox',
- align: 'stretch'
- },
- items: [
- {
- xtype: 'toolbar',
- border: false,
- items: tbar
- },
- config.tbar,
- ]
- };
- }
- else if (_$2.isUndefined(config.tbar)) {
- config.tbar = tbar;
- }
- else {
- console.error("can't build tbar property!", config.tbar);
- }
- }
- }
- function initGridDialog(config) {
- var detailDialog = _$2.get(config, 'detailDialog');
- var detailButtonConfig = _$2.get(config, 'behavior.detailButtonConfig');
- if (_$2.isPlainObject(detailDialog)) {
- var tbar = [
- __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-id-card-o', listeners: {
- click: 'system.showGridRowDetail()',
- }, bind: {
- disabled: '{!' + config.reference + '.selection}'
- } }, detailButtonConfig)
- ];
- if (_$2.isArray(config.tbar)) {
- config.tbar = __spread(config.tbar, [
- '-'
- ], tbar);
- }
- else if (_$2.isPlainObject(config.tbar)) {
- if (_$2.get(config.tbar, 'layout.type') === 'vbox' || _$2.get(config.tbar, 'layout') === 'vbox') {
- config.tbar.items = __spread(config.tbar.items);
- var toolbar = _$2.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
- if (!toolbar) {
- config.tbar.items = __spread(config.tbar.items, [
- {
- xtype: 'toolbar',
- border: false,
- items: tbar
- },
- ]);
- }
- else {
- toolbar.items = __spread(toolbar.items, [
- '-'
- ], tbar);
- }
- }
- else {
- config.tbar = {
- border: false,
- layout: {
- type: 'vbox',
- align: 'stretch'
- },
- items: [
- {
- xtype: 'toolbar',
- border: false,
- items: tbar
- },
- config.tbar,
- ]
- };
- }
- }
- else if (_$2.isUndefined(config.tbar)) {
- config.tbar = tbar;
- }
- else {
- console.error("can't build tbar property!", config.tbar);
- }
- }
- }
- var SystemEventFu$1 = /** @class */ (function () {
- function SystemEventFu() {
- }
- SystemEventFu.prototype.showGridRowDetail = function () {
- return function (sender) {
- var grid1 = sender.up('yvgrid');
- showGridRowDetail(grid1);
- };
- };
- __decorate([
- Lib({
- title: '为某个表格所选数据行, 显示其对话框',
- author: '罗一帆',
- createAt: '2022-07-27',
- updateAt: '2022-07-27',
- type: 'system',
- category: '表格',
- }),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", []),
- __metadata("design:returntype", void 0)
- ], SystemEventFu.prototype, "showGridRowDetail", null);
- return SystemEventFu;
- }());
- function showGridRowDetail(grid1, isEdit) {
- if (isEdit === void 0) { isEdit = true; }
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
- if (!grid1.selection) {
- msg$1('请选中要展示的数据行!');
- return;
- }
- var record = grid1.selection;
- if (_$2.isArray(record)) {
- record = record[0];
- }
- if (!record) {
- msg$1('请选中要展示的数据行!');
- return;
- }
- var config = grid1._originVJson;
- var detailDialog = config.detailDialog;
- var vjson = {};
- var parentScope = lookupScope(grid1);
- var __custom_path = _$2.get(parentScope, 'originalVjson.__custom_path');
- var __custom_version = _$2.get(parentScope, 'originalVjson.__custom_version');
- _$2.defaultsDeep(vjson, {
- // 强制属性
- layout: 'fit',
- __custom_path: __custom_path,
- __custom_version: __custom_version,
- fbar: __spread([
- { xtype: 'button', iconCls: 'x-fa fa-save', text: '确定', listeners: { click: 'system.commitMe()' } },
- { xtype: 'button', iconCls: 'x-fa fa-times', text: '取消', listeners: { click: 'system.closeMe()' } }
- ], ((_a = detailDialog.fbar) !== null && _a !== void 0 ? _a : [])),
- items: (_b = detailDialog.items) !== null && _b !== void 0 ? _b : [],
- }, detailDialog, {
- // 默认属性
- width: 800,
- height: 450,
- bind: __assign({ title: '{_editType}' }, ((_c = detailDialog.bind) !== null && _c !== void 0 ? _c : {})),
- });
- if (_$2.isPlainObject(detailDialog.tabpanel)) {
- var tabpanel = __assign({ xtype: 'tabpanel' }, _$2.cloneDeep(detailDialog.tabpanel));
- vjson.items.push(tabpanel);
- if (tabpanel) {
- // 有多个选项卡,按每个选项卡进行过滤
- _$2.forEach(tabpanel.items, function (tab) {
- var tabColumns = _$2.filter(config.columns, function (c) { var _a; return ((_a = c.form) === null || _a === void 0 ? void 0 : _a.tab) === tab.title; });
- if (tabColumns.length > 0) {
- var tabVjson = buildForm(tabColumns, undefined, detailDialog);
- _$2.extend(tab, tabVjson);
- }
- });
- }
- }
- else {
- vjson.items.push(buildForm(config.columns, undefined, detailDialog));
- }
- var model = {
- data: {
- _edit: isEdit,
- _editType: isEdit ? '编辑' : '添加',
- }
- };
- _$2.forOwn(record.data, function (value, key) {
- if (key === 'id') {
- // 忽略 ID 属性
- return;
- }
- if (_$2.startsWith(key, '_')) {
- // 忽略 _ 开头的所有属性
- return;
- }
- model.data[key] = value;
- });
- console.log(vjson);
- 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) {
- grid1._originVJson.detailDialog.beforVjson(vjson);
- }
- var scope = new Scope({ vjson: vjson, model: model, });
- //@ts-ignore
- scope.commit = function () {
- return new Promise(function (resolve) {
- _$2.forOwn(scope.viewModel.data, function (value, key) {
- if (_$2.startsWith(key, '_')) {
- // _origin 等属性可以被忽略
- return;
- }
- if (key === 'id') {
- // id 属性被忽略
- return;
- }
- record.set(key, value);
- });
- resolve();
- });
- };
- scope.showDialog(grid1, {}, {});
- 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) {
- grid1._originVJson.detailDialog.afterVjson(scope, grid1);
- }
- }
- function buildForm(columns, tabpanel, detailDialog) {
- var vjson = __assign({ border: false, layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch'
- }, defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- }, scrollable: true, items: [] }, detailDialog.form);
- var emptyFieldset = [];
- var fieldsetList = [];
- columns = _$2.sortBy(columns, function (c) { var _a; return (_a = _$2.get(c, 'form.order')) !== null && _a !== void 0 ? _a : 1; });
- _$2.forEach(columns, function (c) {
- var fieldset = _$2.get(c, 'form.fieldset');
- if (fieldset) {
- var idx = _$2.findIndex(fieldsetList, function (t) { return t.fieldset === fieldset; });
- if (idx < 0) {
- fieldsetList.push({
- fieldset: fieldset,
- columns: [c]
- });
- }
- else {
- fieldsetList[idx].columns.push(c);
- }
- }
- else {
- emptyFieldset.push(c);
- }
- });
- _$2.forEach(fieldsetList, function (fs) {
- var fieldSetVjson = {
- xtype: 'fieldset',
- title: fs.fieldset,
- items: []
- };
- buildFieldItems(fieldSetVjson.items, fs.columns);
- vjson.items.push(fieldSetVjson);
- });
- buildFieldItems(vjson.items, emptyFieldset);
- return vjson;
- }
- // 构建字段组
- function buildFieldItems(items, columns) {
- var _a, _b, _c, _d, _e;
- var row = {
- xtype: 'cols',
- items: []
- };
- for (var i = 0; i < columns.length; i++) {
- var column = columns[i];
- if ((_a = column.form) === null || _a === void 0 ? void 0 : _a.rowlayout) {
- delete row.xtype;
- row.layout = column.form.rowlayout;
- }
- if ((_b = column.form) === null || _b === void 0 ? void 0 : _b.prefix) {
- row.items.push({ border: false, flex: column.form.prefix });
- }
- var fieldVjson = buildField(column, row.items.length);
- if (!fieldVjson) {
- continue;
- }
- row.items.push(fieldVjson);
- if ((_c = column.form) === null || _c === void 0 ? void 0 : _c.suffix) {
- row.items.push({ border: false, flex: (_d = column.form) === null || _d === void 0 ? void 0 : _d.suffix });
- }
- if ((_e = column.form) === null || _e === void 0 ? void 0 : _e.wrap) {
- items.push(row);
- row = {
- xtype: 'cols',
- items: []
- };
- }
- }
- if (row.items.length > 0) {
- items.push(row);
- }
- }
- // 构建字段
- function buildField(column, colIdx) {
- var ret;
- if (column.xtype === 'checkcolumn') {
- ret = _$2.defaultsDeep({
- xtype: 'checkbox',
- uncheckedValue: column.uncheckedValue,
- checkedValue: column.checkedValue,
- boxLabel: column.header,
- bind: {
- value: '{' + column.dataIndex + '}'
- }
- }, column.form);
- if (colIdx == 0) {
- // 第一列的checkbox, 要向左空出 85 像素, 预留出 labelWidth
- ret.margin = '0 0 0 85';
- }
- }
- else {
- ret = _$2.defaultsDeep({}, column.form, column.editor, {
- fieldLabel: column.header,
- bind: {
- value: '{' + column.dataIndex + '}'
- },
- });
- }
- if (!ret.xtype) {
- return;
- }
- if (!ret.dict && ret.xtype === 'combo') {
- ret.dict = column.dict;
- }
- // 删除辅助属性
- delete ret.order;
- delete ret.wrap;
- return ret;
- }
- var model$c = {
- data: {}
- };
- var vjson$c = {
- title: '自定义表格属性',
- layout: 'fit',
- width: 980,
- height: 500,
- fbar: [
- {
- xtype: "button",
- text: "保存",
- iconCls: 'x-fa fa-save',
- listeners: {
- click: 'scope.commit',
- }
- },
- {
- xtype: "button",
- text: "关闭",
- iconCls: 'x-fa fa-times',
- listeners: {
- click: 'system.closeMe()',
- }
- },
- ],
- items: [
- {
- region: 'center',
- xtype: 'tabpanel',
- items: [
- {
- title: '基本信息', reference: 'basic',
- layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch'
- },
- defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- },
- scrollable: true,
- items: [
- {
- xtype: 'cols',
- items: [
- {
- fieldLabel: '路径',
- bind: { value: '{__custom_path}' },
- xtype: 'textfield',
- flex: 2,
- },
- {
- fieldLabel: '版本',
- bind: { value: '{__custom_version}' },
- xtype: 'textfield',
- },
- ]
- },
- {
- xtype: 'cols',
- items: [
- {
- fieldLabel: '配置点',
- bind: { value: '{__custom_point}' },
- xtype: 'textfield',
- },
- {
- fieldLabel: 'reference',
- bind: { value: '{reference}' },
- xtype: 'textfield',
- },
- {
- fieldLabel: '编辑模式',
- bind: { value: '{_mode}' },
- xtype: 'combo',
- dict: 'GRID_MODE',
- },
- ]
- },
- {
- layout: 'hbox',
- defaults: {
- margin: '0 0 0 15',
- },
- items: [
- {
- boxLabel: '隐藏底部工具栏', margin: '0 0 0 85', xtype: 'checkbox',
- bind: {
- value: "{hideFootbar}"
- }
- },
- {
- boxLabel: '隐藏刷新', xtype: 'checkbox',
- bind: {
- value: "{hideRefresh}"
- }
- },
- {
- boxLabel: '隐藏导出', xtype: 'checkbox',
- bind: {
- value: "{hideExport}"
- }
- },
- {
- boxLabel: '隐藏自动调宽', xtype: 'checkbox',
- bind: {
- value: "{hideAutoSize}"
- }
- },
- {
- boxLabel: '隐藏清空筛选', xtype: 'checkbox',
- bind: {
- value: "{hideClearFilter}"
- }
- },
- {
- boxLabel: '隐藏保存布局', xtype: 'checkbox',
- bind: {
- value: "{hideSaveGridUIConfig}"
- }
- },
- {
- boxLabel: '隐藏重置布局', xtype: 'checkbox',
- bind: {
- value: "{hideClearGridUIConfig}"
- }
- },
- ]
- },
- {
- layout: 'hbox',
- defaults: {
- margin: '0 0 0 15',
- },
- items: [
- {
- boxLabel: '自动载入数据源', xtype: 'checkbox',
- bind: { value: '{autoLoad}' },
- margin: '0 0 0 85',
- },
- {
- boxLabel: '分页模式', xtype: 'checkbox',
- bind: { value: '{pagination}' },
- },
- {
- boxLabel: '显示行序号', xtype: 'checkbox',
- bind: { value: '{show_rownum}' },
- },
- {
- boxLabel: '后端排序', xtype: 'checkbox',
- bind: {
- value: "{remoteSort}"
- }
- },
- {
- boxLabel: '后端过滤', xtype: 'checkbox',
- bind: {
- value: "{remoteFilter}"
- }
- },
- {
- boxLabel: '隐藏', xtype: 'checkbox',
- bind: {
- value: "{hidden}"
- }
- },
- ]
- },
- {
- layout: 'hbox',
- defaults: {
- margin: '0 0 0 15',
- },
- items: [
- {
- boxLabel: '自定义隐藏', xtype: 'checkbox', margin: '0 0 0 85',
- bind: {
- value: "{enableColumnHide}"
- }
- },
- {
- boxLabel: '用户拖拽字段', xtype: 'checkbox',
- bind: {
- value: "{enableColumnMove}"
- }
- },
- {
- boxLabel: '自定义筛选', xtype: 'checkbox',
- bind: {
- value: "{gridfilters}"
- }
- },
- {
- boxLabel: '用户拖拽字段宽度', xtype: 'checkbox',
- bind: {
- value: "{enableColumnResize}"
- }
- },
- {
- boxLabel: '点击列头排序', xtype: 'checkbox',
- bind: {
- value: "{sortOnClick}"
- }
- },
- ]
- },
- {
- xtype: 'cols',
- items: [
- {
- fieldLabel: 'dbTableName',
- labelWidth: 110,
- bind: { value: '{behavior.dbTableName}' },
- xtype: 'textfield',
- },
- {
- fieldLabel: 'theid',
- bind: { value: '{theid}' },
- xtype: 'textfield',
- },
- {
- fieldLabel: '添加行聚焦',
- bind: { value: '{behavior.focusColumnAfterInsert}' },
- xtype: 'textfield',
- },
- ]
- },
- {
- xtype: 'cols',
- items: [
- {
- fieldLabel: '批量删除提示',
- labelWidth: 110,
- bind: { value: '{behavior.batchRemoveConfirm}' },
- xtype: 'textfield',
- },
- {
- fieldLabel: '删除提示',
- bind: { value: '{behavior.singleRemoveConfirm}' },
- xtype: 'textfield',
- },
- {
- fieldLabel: '触发刷新',
- labelWidth: 110,
- bind: { value: '{behavior.selectToReload}' },
- xtype: 'textfield',
- },
- ]
- },
- ]
- },
- {
- title: '字段', reference: 'grid1',
- xtype: 'yvgrid',
- pagination: false,
- _mode: 'edit',
- listeners: {
- buttonclick: 'scope.grid1Buttonclick',
- },
- hideFootbar: true,
- tbar: [
- {
- xtype: 'button',
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'scope.addField'
- }
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.removeField'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '自动分析',
- iconCls: 'x-fa fa-code-fork',
- listeners: {
- click: 'scope.calcField'
- }
- },
- {
- xtype: 'button',
- text: '上移',
- iconCls: 'x-fa fa-arrow-up',
- listeners: {
- click: 'scope.moveUp'
- }
- },
- {
- xtype: 'button',
- text: '下移',
- iconCls: 'x-fa fa-arrow-down',
- listeners: {
- click: 'scope.moveDown'
- }
- },
- ],
- store: {},
- columns: [
- {
- dataIndex: 'dataIndex', header: "字段名", width: 140,
- editor: { xtype: 'textfield' }
- },
- {
- dataIndex: 'dbColumn', header: "数据库字段", width: 140,
- editor: { xtype: 'textfield' }
- },
- {
- dataIndex: 'header', header: '中文', width: 140,
- editor: { xtype: 'textfield' }
- },
- {
- dataIndex: 'dict', header: '字典', width: 110,
- editor: { xtype: 'combogrid' }
- },
- {
- dataIndex: 'editor_widget', header: '下拉表', width: 110,
- editor: { xtype: 'combogrid' }, hidden: true,
- },
- {
- dataIndex: 'width', header: '宽度', width: 80,
- editor: { xtype: 'numberfield' }, hidden: true,
- },
- {
- dataIndex: 'editor_xtype', header: '编辑器', width: 170,
- editor: { xtype: 'combo' }, dict: 'GRID_XTYPE'
- },
- {
- dataIndex: 'serverCreateValue', header: '服务端创建值',
- editor: { xtype: 'textfield' },
- },
- {
- dataIndex: 'createValue', text: '客户端新创建值',
- editor: { xtype: 'textfield' },
- },
- {
- dataIndex: 'dbIsDeleteKey', text: '删除键', xtype: 'checkcolumn', width: 60,
- resizable: false, sortable: false, menuDisabled: true,
- checkedValue: true, uncheckedValue: false,
- },
- {
- dataIndex: 'dbIsUpdateKey', text: '更新键', xtype: 'checkcolumn', width: 60,
- resizable: false, sortable: false, menuDisabled: true,
- checkedValue: true, uncheckedValue: false,
- },
- {
- dataIndex: 'dbUpdateDisable', text: '禁更新', xtype: 'checkcolumn', width: 60,
- resizable: false, sortable: false, menuDisabled: true,
- checkedValue: true, uncheckedValue: false,
- },
- {
- dataIndex: 'formatter', header: '格式化', width: 110,
- editor: { xtype: 'combo' }, dict: 'GRID_FORMATTER', hidden: true,
- },
- {
- dataIndex: 'resizable', text: '调整宽', xtype: 'checkcolumn', width: 60,
- resizable: false, sortable: false, menuDisabled: true,
- checkedValue: true, uncheckedValue: false, hidden: true,
- },
- {
- dataIndex: 'editor_required', text: '必填', xtype: 'checkcolumn', width: 50,
- resizable: false, sortable: false, menuDisabled: true,
- hidden: true,
- },
- {
- dataIndex: 'filterable', text: '过滤', xtype: 'checkcolumn', width: 50,
- resizable: false, sortable: false, menuDisabled: true,
- checkedValue: true, uncheckedValue: false, hidden: true,
- },
- {
- dataIndex: 'hidden', text: '隐藏', xtype: 'checkcolumn', width: 50,
- resizable: false, sortable: false, menuDisabled: true,
- },
- {
- dataIndex: 'sortable', text: '排序', xtype: 'checkcolumn', width: 50,
- resizable: false, sortable: false, menuDisabled: true,
- checkedValue: true, uncheckedValue: false, hidden: true,
- },
- {
- dataIndex: 'form_order', text: '对话框序号',
- editor: { xtype: 'numberfield' },
- },
- {
- dataIndex: 'form_xtype', text: '框换行', xtype: 'checkcolumn', width: 60,
- resizable: false, sortable: false, menuDisabled: true,
- checkedValue: true, uncheckedValue: false,
- },
- {
- dataIndex: 'form_xtype', text: '对话框编辑器',
- editor: { xtype: 'combo' }, dict: 'FORM_XTYPE', hidden: true,
- },
- {
- dataIndex: 'form_fieldset', text: '对话框字段组',
- editor: { xtype: 'textfield' }, hidden: true,
- },
- {
- dataIndex: 'form_tab', text: '对话框选项卡',
- editor: { xtype: 'textfield' }, hidden: true,
- },
- {
- dataIndex: 'form_readonly', text: '框只读', xtype: 'checkcolumn', width: 60,
- resizable: false, sortable: false, menuDisabled: true,
- checkedValue: true, uncheckedValue: false, hidden: true,
- },
- ],
- },
- {
- title: 'SQL和查询条件', reference: 'sql',
- layout: 'border',
- border: false,
- items: [
- {
- region: 'north',
- height: 200,
- border: false,
- split: true,
- xtype: 'yvgrid',
- reference: 'gridCondition',
- pagination: false,
- hideFootbar: true,
- _mode: 'edit',
- listeners: {
- buttonclick: 'scope.conditionButtonclick',
- },
- store: {},
- tbar: {
- xtype: 'toolbar',
- border: false,
- items: [
- {
- xtype: 'button',
- text: '添加条件',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'scope.addCondition'
- }
- },
- {
- xtype: 'button',
- text: '删除条件',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.removeCondition'
- }
- },
- '-',
- {
- xtype: 'button',
- text: '自动分析条件变量',
- iconCls: 'x-fa fa-code-fork',
- listeners: {
- click: 'scope.calcCondition'
- }
- },
- {
- xtype: 'button',
- text: '上移',
- iconCls: 'x-fa fa-arrow-up',
- listeners: {
- click: 'scope.moveUpCondition'
- }
- },
- {
- xtype: 'button',
- text: '下移',
- iconCls: 'x-fa fa-arrow-down',
- listeners: {
- click: 'scope.moveDownCondition'
- }
- },
- ]
- },
- columns: [
- {
- text: '条件变量',
- dataIndex: 'param_name',
- width: 140,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '中文标题',
- dataIndex: 'fieldLabel',
- width: 120,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: true
- },
- },
- {
- text: '编辑类型',
- dataIndex: 'xtype',
- width: 80,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'combo',
- typeAhead: true,
- triggerAction: 'all',
- selectOnFocus: true,
- store: [
- ['textfield', 'textfield'],
- ['combo', 'combo'],
- ['datefield', 'datefield'],
- ['datetimefield', 'datetimefield'],
- ['numberfield', 'numberfield'],
- ['multiplesearch', 'multiplesearch'],
- ]
- }
- },
- {
- text: '权重',
- dataIndex: 'conditionFieldFlex',
- align: 'right',
- width: 60,
- sortable: false,
- menuDisabled: true,
- editor: {
- xtype: 'numberfield',
- selectOnFocus: false,
- minValue: 0,
- maxValue: 10
- },
- },
- {
- text: '字典',
- dataIndex: 'conditionFieldDict',
- width: 160,
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: false
- },
- },
- {
- xtype: 'checkcolumn',
- dataIndex: "conditionFieldWrap", header: "换行",
- width: 65,
- sortable: false,
- menuDisabled: true,
- },
- {
- text: '扩展参数',
- dataIndex: 'conditionFieldExtend',
- sortable: false,
- menuDisabled: true,
- editor: {
- selectOnFocus: false
- },
- },
- ]
- },
- {
- region: 'center',
- xtype: 'sqleditor',
- layout: 'fit',
- reference: 'sqlEditor',
- split: true,
- },
- ]
- },
- {
- title: '详情对话框',
- layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch'
- },
- defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- },
- scrollable: true,
- items: [
- {
- xtype: 'cols',
- items: [
- {
- fieldLabel: '对话框标题',
- bind: { value: '{detailDialog.title}' },
- xtype: 'textfield',
- flex: 2,
- },
- {
- fieldLabel: '宽度',
- bind: { value: '{detailDialog.width}' },
- xtype: 'numberfield',
- },
- {
- fieldLabel: '高度',
- bind: { value: '{detailDialog.height}' },
- xtype: 'numberfield',
- },
- ]
- },
- ]
- },
- {
- title: '界面源码',
- xtype: 'jseditor',
- reference: 'jseditor'
- }
- ]
- }
- ]
- };
- var GridColumnCustom = /** @class */ (function (_super) {
- __extends(GridColumnCustom, _super);
- function GridColumnCustom() {
- return _super.call(this, { model: model$c, vjson: vjson$c }) || this;
- }
- GridColumnCustom.prototype.commit = function () {
- };
- GridColumnCustom.prototype.grid1Buttonclick = function () {
- };
- GridColumnCustom.prototype.conditionButtonclick = function () {
- };
- GridColumnCustom.prototype.addField = function () {
- };
- GridColumnCustom.prototype.removeField = function () {
- };
- GridColumnCustom.prototype.calcField = function () {
- };
- GridColumnCustom.prototype.moveUp = function () {
- };
- GridColumnCustom.prototype.moveDown = function () {
- };
- GridColumnCustom.prototype.addCondition = function () {
- };
- GridColumnCustom.prototype.removeCondition = function () {
- };
- GridColumnCustom.prototype.calcCondition = function () {
- };
- GridColumnCustom.prototype.moveUpCondition = function () {
- };
- GridColumnCustom.prototype.moveDownCondition = function () {
- };
- return GridColumnCustom;
- }(Scope));
- function initGridCode(grid, newConfig, buttons) {
- if (typeof newConfig.__custom_point === "string" && newConfig.__custom_point) {
- buttons.push({
- xtype: 'button',
- tooltip: '定义表格属性',
- iconCls: 'x-fa fa-codepen',
- handler: function (btn) {
- var customWindow = new GridColumnCustom();
- customWindow.showDialog(btn, {}, {});
- }
- });
- buttons.push({
- xtype: 'button',
- tooltip: '定义表格数据源',
- iconCls: 'x-fa fa-database',
- handler: function () {
- // showCustomGridDataSource(grid)
- }
- });
- }
- }
- window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
- var hexToString = function (hex) {
- var arr = hex.split("");
- var out = "";
- for (var i = 0; i < arr.length / 2; i++) {
- var tmp = "0x" + arr[i * 2] + arr[i * 2 + 1];
- // @ts-ignore
- var charValue = String.fromCharCode(tmp);
- out += charValue;
- }
- return out;
- };
- var defaultGrid = grid;
- function initGrid () {
- Ext.define('Yvan.Grid', {
- extend: 'Ext.grid.Panel',
- xtype: 'yvgrid',
- __suspendReload: false,
- _originVJson: {},
- constructor: function (config) {
- var _this = this;
- var _a, _b, _c, _d, _e, _f;
- var me = this;
- var dataSource = config.dataSource;
- 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);
- me._originVJson = config;
- if (!isDesignMode(scope, config)) {
- this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
- if (Array.isArray(config.columns) && config.columns.length > 0) {
- var cacheData = this.getColumnConfigCache();
- if (Array.isArray(cacheData) && cacheData.length > 0) {
- var newColumns = [];
- for (var j = 0; j < cacheData.length; j++) {
- var itData = cacheData[j];
- for (var i = 0; i < config.columns.length; i++) {
- var column = config.columns[i];
- if (itData.dataIndex === column.dataIndex) {
- if (itData.width) {
- column.width = itData.width;
- }
- column.hidden = itData.hidden;
- column.locked = itData.locked;
- newColumns.push(column);
- break;
- }
- }
- }
- config.columns = newColumns;
- }
- }
- }
- var newConfig = _$2.defaultsDeep({
- // 强制性属性 bug.
- // lock 属性会造成 Cannot read properties of undefined (reading 'els')
- // enableLocking: false,
- // syncRowHeight: false,
- }, baseConfig(config, 'row-item'), config, grid);
- // 在面板上的组件
- // const scope = newConfig.$initParent?.yvanScope ||
- // newConfig.$initParent?.lookupReferenceHolder()?.yvanScope ||
- // config.$vmParent?.yvanScope ||
- // newConfig.$vmParent?._parent?.yvanScope;
- var buttons = [];
- var getRowClass = newConfig.getRowClass;
- if (typeof getRowClass === 'string' && (_$2.startsWith(getRowClass, "scope.") ||
- _$2.startsWith(getRowClass, "system."))) {
- var fn = lookupFn(scope, getRowClass);
- _$2.set(newConfig, 'viewConfig.getRowClass', fn);
- }
- if (!newConfig.hideExport) {
- buttons.push({
- xtype: 'button',
- tooltip: '导出Excel',
- iconCls: 'x-fa fa-download',
- listeners: {
- click: this.exportExcel
- },
- });
- }
- if (!newConfig.hideAutoSize) {
- buttons.push({
- xtype: 'button',
- iconCls: 'x-fa fa-text-width',
- tooltip: '自适应宽度',
- listeners: {
- click: this.autoSizeColumns
- }
- });
- }
- if (!newConfig.hideClearFilter) {
- buttons.push({
- xtype: 'button',
- tooltip: '清空筛选',
- iconCls: 'x-fa fa-filter',
- handler: this.clearFilter
- });
- }
- if (!newConfig.hideSaveGridUIConfig) {
- buttons.push({
- xtype: 'button',
- tooltip: '保存布局',
- iconCls: 'x-fa fa-cogs',
- handler: this.saveGridUIConfig
- });
- }
- if (!newConfig.hideClearGridUIConfig) {
- buttons.push({
- xtype: 'button',
- tooltip: '还原布局',
- iconCls: 'x-fa fa-reply-all',
- handler: this.clearGridUIConfig
- });
- }
- initGridCode(me, newConfig, buttons);
- if (!newConfig.hideFootbar) {
- if (newConfig.pagination) {
- newConfig.bbar = new Ext.PagingToolbar({
- // pageSize: newConfig.pageSize, 这个值是无效的
- displayInfo: true,
- store: this.store,
- emptyMsg: '没有记录',
- cls: 'grid-bbar',
- items: __spread([
- {
- xtype: 'combobox',
- tooltip: '分页',
- queryMode: 'local',
- editable: false,
- allowBlank: true,
- labelAlign: 'right',
- width: 90,
- // labelWidth: 30,
- listConfig: {
- minWidth: null
- },
- value: 50,
- valueField: undefined,
- displayField: undefined,
- hideClear: true,
- store: newConfig.pageSizeOption,
- listeners: {
- change: function (sender, nv, ov) {
- _this.store.pageSize = nv;
- _this.store.loadPage(1);
- }
- }
- }
- ], buttons),
- doRefresh: function () {
- me.reload();
- }
- });
- }
- else {
- newConfig.bbar = {
- xtype: 'toolbar', overflowHandler: 'menu',
- cls: 'grid-bbar',
- items: __spread([
- {
- xtype: 'button',
- tooltip: '刷新',
- iconCls: 'x-fa fa-refresh',
- handler: function () {
- _this.reload();
- }
- },
- '-'
- ], buttons)
- };
- if (newConfig.hideRefresh) {
- newConfig.bbar.items.splice(0, 1);
- }
- }
- }
- if (_$2.isArray(newConfig.condition)) {
- // 带查询条件
- var conditionRows_1 = [];
- var newRow_1 = false;
- var currentRow_1 = { xtype: 'cols', items: [], };
- conditionRows_1.push(currentRow_1);
- _$2.forEach(newConfig.condition, function (item) {
- var _a;
- if (newRow_1) {
- currentRow_1 = { xtype: 'cols', items: [], };
- conditionRows_1.push(currentRow_1);
- }
- var vj = _$2.cloneDeep(item);
- if (vj.xtype) {
- if (item.xtype === 'combo' && item.dict) {
- vj.fix = ['system.getDict("' + item.dict + '")'];
- }
- if (item.xtype === 'datetimefield') {
- _$2.defer(function () {
- //@ts-ignore
- scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD HH:mm:ss'));
- });
- }
- else if (item.xtype === 'datefield') {
- _$2.defer(function () {
- //@ts-ignore
- scope.viewModel.set(item.param_name, moment(window.getServerTime()).format('YYYY-MM-DD'));
- });
- }
- else {
- scope.viewModel.set(item.param_name, '');
- }
- }
- else {
- // 没有组件类型,是个空占位符
- vj.border = false;
- }
- if (item.param_name) {
- vj.bind = {
- value: '{' + item.param_name + '}'
- };
- _$2.set(newConfig.dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
- _$2.set(dataSource, 'params.' + item.param_name, '{' + item.param_name + '}');
- }
- newRow_1 = (_a = item.wrap) !== null && _a !== void 0 ? _a : false;
- currentRow_1.items.push(vj);
- });
- newConfig.tbar = {
- xtype: 'form',
- border: false,
- items: conditionRows_1,
- defaults: {
- margin: '8 0 8 0'
- },
- };
- console.log('newConfig', newConfig);
- }
- _$2.each(newConfig.columns, function (c) {
- var renderer = c.renderer, formatter = c.formatter;
- if (typeof renderer === 'string' && (_$2.startsWith(renderer, "scope.") ||
- _$2.startsWith(renderer, "system."))) {
- if (newConfig.$initParent) {
- if (scope) {
- var rendererFn = lookupFn(scope, renderer);
- c.renderer = rendererFn.bind(scope);
- }
- }
- }
- if (c.dict) {
- c.fix = ['system.getDict("' + c.dict + '")'];
- if (c.editor && c.editor.xtype === 'combo') {
- c.editor.fix = ['system.getDict("' + c.dict + '")'];
- c.editor.typeAhead = true;
- c.editor.triggerAction = 'all';
- c.editor.selectOnFocus = false;
- c.editor.listConfig = {
- minWidth: 200
- };
- }
- }
- if (formatter === 'button') {
- c.tdCls = 'td-btn';
- if (!c.listeners) {
- c.listeners = {};
- }
- c.listeners.click = function (sender, td, rowIdx, colIdx, event, record) {
- if ($(event.target).is('input')) {
- me.fireEvent('buttonclick', me, this, record);
- }
- };
- }
- else if (formatter === 'percentRenderer') {
- c.tdCls = 'td-percent';
- }
- });
- if (newConfig._mode === 'edit' || newConfig._mode === 'edit1' || newConfig._mode === 'edit2') {
- // 强制为编辑模式
- newConfig.selModel = {
- type: 'spreadsheet',
- columnSelect: true,
- pruneRemoved: false,
- extensible: 'y'
- };
- newConfig.plugins = __assign(__assign({}, newConfig.plugins), { clipboard: true, selectionreplicator: true });
- if (newConfig._mode === 'edit2' || newConfig._mode === 'edit') {
- _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
- }
- else {
- _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 1);
- }
- }
- else if (newConfig._mode === 'checkbox' || newConfig._mode === 'check') {
- // 强制为勾选模式
- newConfig.selModel = {
- type: 'checkboxmodel',
- mode: 'MULTI',
- };
- }
- else if (newConfig._mode === 'checkonly') {
- newConfig.selModel = {
- type: 'checkboxmodel',
- mode: 'MULTI',
- checkOnly: true,
- };
- }
- else if (newConfig._mode === 'select') {
- // 强制为选择模式
- newConfig.selModel = {
- selType: 'rowmodel',
- mode: 'SINGLE',
- };
- if (typeof _$2.get(newConfig, 'plugins.cellediting.clicksToEdit') === 'number') {
- _$2.set(newConfig, 'plugins.cellediting.clicksToEdit', 2);
- }
- }
- initBehaviorEdit(newConfig);
- initGridDialog(newConfig);
- this.superclass.constructor.call(this, newConfig);
- this.store.pageSize = newConfig.pageSize;
- },
- setData: function (value) {
- var me = this;
- me._setDataReal(value);
- },
- /**
- * 添加行,并进入编辑状态
- * @param record 新行的属性集
- * @param editRowCol 要编辑的列序号,或 dataIndex 的名称
- */
- appendEditRow: function (record, editRowCol) {
- var records = this.getStore().add(record);
- var recNew = records[0];
- this.setSelection(records);
- if (typeof editRowCol === 'string' && editRowCol) {
- editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
- }
- if (typeof editRowCol === 'number') {
- var ce = this.findPlugin('cellediting');
- this.editingPlugin = ce;
- ce.startEdit(recNew, editRowCol);
- }
- },
- beginEdit: function (record, editRowCol) {
- if (typeof record === 'number') {
- record = this.store.data.getAt(record);
- }
- if (record.isEntity === true) {
- this.setSelection([record]);
- if (typeof editRowCol === 'string' && editRowCol) {
- editRowCol = this.columns.findIndex(function (c) { return c.dataIndex === editRowCol; });
- }
- if (typeof editRowCol === 'number') {
- var ce = this.findPlugin('cellediting');
- this.editingPlugin = ce;
- ce.startEdit(record, editRowCol);
- }
- }
- },
- /**
- * 移除行
- * @param record 如果记录传空,就是当前选中的行
- */
- removeEditRow: function (record) {
- if (!record) {
- record = this.selection;
- }
- if (!record) {
- msg('请选中要删除的行');
- return;
- }
- this.getStore().remove(record);
- },
- /**
- * 获取全部原始数据
- */
- getDataRows: function () {
- return this.getStore().data.items.map(function (r) { return r.data; });
- },
- /**
- * 获取全部原始数据, 不带 id/ 不带 origin
- */
- getDataRowsOnlyData: function () {
- return _$2.map(_$2.cloneDeep(this.getDataRows()), function (r) {
- delete r.id;
- delete r._origin;
- return r;
- });
- },
- rowMoveUp: function () {
- var grid = this;
- if (!grid.selection) {
- msg('无法对多行进行移动');
- return;
- }
- var record = grid.selection;
- if (_$2.isArray(record)) {
- record = record[0];
- }
- if (!record) {
- msg('无法对多行进行移动');
- return;
- }
- // const records = grid.selModel.getSelection()
- // if (records.length !== 1) {
- // msg('无法对多行进行移动')
- // return
- // }
- //
- // const [record] = records
- var index = grid.store.indexOf(record);
- if (index > 0) {
- grid.store.removeAt(index);
- grid.store.insert(index - 1, record);
- grid.getView().refresh();
- grid.selModel.select([record]);
- }
- },
- rowMoveDown: function () {
- var grid = this;
- // const records = grid.selModel.getSelection()
- // if (records.length !== 1) {
- // msg('无法对多行进行移动')
- // return
- // }
- if (!grid.selection) {
- msg('无法对多行进行移动');
- return;
- }
- var record = grid.selection;
- if (_$2.isArray(record)) {
- record = record[0];
- }
- if (!record) {
- msg('无法对多行进行移动');
- return;
- }
- var index = grid.store.indexOf(record);
- if (index < grid.store.getCount() - 1) {
- grid.store.removeAt(index);
- grid.store.insert(index + 1, record);
- grid.getView().refresh();
- grid.selModel.select([record]);
- }
- },
- getEditRecord: function () {
- var _a, _b;
- var me = this;
- var editingPlugin = me.editingPlugin || me.ownerGrid.editingPlugin;
- 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;
- var record;
- if (typeof rowIdx === 'undefined') {
- record = me.getSelectionModel().getLastSelected();
- }
- else {
- record = me.store.getAt(rowIdx);
- }
- return record;
- },
- getEditRow: function () {
- var _a;
- var me = this;
- return (_a = me.getEditRecord()) === null || _a === void 0 ? void 0 : _a.data;
- },
- setEditRow: function (rowValues) {
- var me = this;
- var record = me.getEditRecord();
- if (record) {
- _$2.forOwn(rowValues, function (v, k) {
- record.set(k, v);
- });
- }
- },
- _transform: function (data) {
- // 无论是 grid._setDataReal 还是 stores.gridInvokeBuild 都会走这个函数,设值前都可以改变表格值
- _$2.forEach(data, function (row) {
- row._origin = _$2.clone(row);
- });
- },
- _setDataReal: function (value) {
- var me = this;
- this._transform(value);
- var storeOpt = {
- fields: getFileds(this),
- data: value,
- };
- if (this.groupField) {
- storeOpt.groupField = this.groupField;
- }
- var store = new Ext.data.Store(storeOpt);
- me.setStore(store);
- },
- setStore: function (store) {
- var me = this;
- if (_$2.isArray(store)) {
- var value = store;
- this._transform(value);
- var storeOpt = {
- fields: getFileds(this),
- data: value,
- };
- if (this.groupField) {
- storeOpt.groupField = this.groupField;
- }
- store = new Ext.data.Store(storeOpt);
- }
- me.superclass.setStore.call(this, store);
- var reference = this.reference;
- if (reference) {
- var scope = lookupScope(this);
- scope.viewModel.set(reference + '.ischanged', false);
- scope.viewModel.set(reference + '.theid', null);
- scope.viewModel.set(reference + '.theid2', null);
- scope.viewModel.set(reference + '.theid3', null);
- }
- if (store) {
- store.on({
- add: function (store, records, index, eOpts) {
- me._raiseChange(store, 'add');
- },
- remove: function (store, records, index, isMove, eOpts) {
- me._raiseChange(store, 'remove');
- },
- datachanged: function (sender, opt) {
- me._raiseChange(store, 'datachanged');
- }
- });
- }
- },
- _raiseChange: function (store, type) {
- var _a, _b;
- var reference = this.reference;
- if (reference && store) {
- var ischanged = false;
- if (store.getModifiedRecords().length > 0 ||
- store.getNewRecords().length > 0 ||
- store.getRemovedRecords().length > 0) {
- ischanged = true;
- }
- else {
- ischanged = false;
- }
- (_b = (_a = lookupScope(this)) === null || _a === void 0 ? void 0 : _a.viewModel) === null || _b === void 0 ? void 0 : _b.set(reference + '.ischanged', ischanged);
- }
- },
- /**
- * 轻量级刷新
- */
- refreshData: function () {
- var store = this.getStore();
- if (store) {
- store.reload();
- }
- },
- /**
- * 为表格强制设置焦点
- * @param seq 顺序号
- */
- focusRow: function (seq) {
- this.setSelection(this.store.getAt(seq));
- this.getView().focusRow(seq);
- },
- /**
- * 重新载入数据(重新计算参数)
- */
- reload: function (reloadParams) {
- if (reloadParams === void 0) { reloadParams = {}; }
- var me = this;
- var config = me.config;
- if (config.dataSourceCallbackFn) {
- // 函数请求刷新
- var scope_1 = lookupScope(this);
- _$2.defer(function () {
- me.setLoading(true);
- });
- config.dataSourceCallbackFn.call(scope_1, me, {
- successCallback: function (value) {
- me._setDataReal(value);
- _$2.defer(function () {
- me.setLoading(false);
- });
- // 自动选中第一行
- var data = me.getStore().data;
- if (data.length > 0) {
- me.setSelection(data.items[0]);
- }
- me.fireEvent('dataLoadComplete', me, true, value);
- },
- failCallback: function (error) {
- _$2.defer(function () {
- me.setLoading(false);
- });
- me.fireEvent('dataLoadComplete', me, false, error);
- }
- });
- return;
- }
- // if (this.store) {
- // this.store.reload({aaaa: 1, bbbb: 2})
- // }
- var dataSource = config.dataSource;
- var scope = lookupScope(me);
- if (_$2.isPlainObject(dataSource) && !isDesignMode(scope, config)) {
- gridInvokeBuild(scope, me, config, dataSource, reloadParams);
- }
- },
- exportCurrentExcelClick: function () {
- var _a;
- var me = this;
- var config = me.config;
- var scope = lookupScope(me);
- var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
- if (excelFileName.endsWith(".xlsx")) {
- excelFileName = excelFileName.split(".xlsx")[0];
- }
- excelFileName += ".xlsx";
- var rowsAll = (_a = this.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
- var excelData = me.makeExcelData(rowsAll);
- LAY_EXCEL.exportExcel(excelData, excelFileName, 'xlsx');
- },
- /**
- * excel 导出
- * excelExportParams 导出参数
- * isContinue 是否继续导出
- */
- exportExcelClick: function (excelExportParams, isContinue) {
- if (isContinue === void 0) { isContinue = false; }
- var me = this;
- var config = me.config;
- excelExportParams.isExcelExport = true;
- var scope = lookupScope(me);
- var dataSource = config.dataSource;
- var ep = function () {
- scope.setLoading(true);
- console.log("dataSource", dataSource);
- gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
- var _a, _b, _c, _d;
- console.log("responseData", responseData);
- var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || me.exportExcelCurrentPage || 1;
- var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
- 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;
- me.exportExcelCurrentPage = page;
- me.exportExcelPageSize = size;
- me.exportExcelTotal = total;
- var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
- if (excelFileName.endsWith(".xlsx")) {
- excelFileName = excelFileName.split(".xlsx")[0];
- }
- console.log("makeExcelData", me.makeExcelData);
- var pageExcelData = me.makeExcelData(responseData.data);
- excelFileName += "(第" + me.exportExcelCurrentPage + "页,共" + Math.ceil(total / size) + "页、" + total + "条)";
- excelFileName += ".xlsx";
- LAY_EXCEL.exportExcel(pageExcelData, excelFileName, 'xlsx');
- scope.setLoading(false);
- if (page < total / size) {
- page++;
- me.exportExcelCurrentPage = page;
- if (isContinue === true) {
- excelExportParams.exportExcelCurrentPage = page;
- ep();
- }
- }
- });
- };
- ep();
- },
- exportExcelClick2: function (excelExportParams, isContinue) {
- return __awaiter(this, void 0, void 0, function () {
- var currentPage, totalSize, me, config, scope, dataSource, excelData, ep, pageSize, totalPage, sumCount, err, page, progressSize, progress, leftSize, pageData, e_1, excelFileName, pageExcelData;
- return __generator(this, function (_a) {
- switch (_a.label) {
- case 0:
- currentPage = excelExportParams.exportExcelCurrentPage;
- totalSize = excelExportParams.exportExcelPageSize;
- console.log("currentPage", currentPage);
- console.log("pageSize", totalSize);
- me = this;
- config = me.config;
- excelExportParams.isExcelExport = true;
- scope = lookupScope(me);
- dataSource = config.dataSource;
- excelData = [];
- ep = function () {
- return new Promise(function (resolve, reject) {
- console.log("dataSource", dataSource);
- try {
- gridInvokeBuild(scope, me, config, dataSource, excelExportParams, true, function (responseData) {
- var _a, _b, _c, _d;
- console.log("responseData", responseData);
- var page = parseInt((_a = responseData.pagination) === null || _a === void 0 ? void 0 : _a.current) || me.exportExcelCurrentPage || 1;
- var size = parseInt((_b = responseData.pagination) === null || _b === void 0 ? void 0 : _b.size) || me.exportExcelPageSize;
- 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;
- me.exportExcelCurrentPage = page;
- me.exportExcelPageSize = size;
- me.exportExcelTotal = total;
- resolve(responseData.data);
- });
- }
- catch (e) {
- reject(e);
- }
- });
- };
- pageSize = 1000;
- totalPage = Math.ceil(totalSize / pageSize);
- sumCount = 0;
- err = null;
- page = 1;
- _a.label = 1;
- case 1:
- if (!(page <= totalPage)) return [3 /*break*/, 6];
- progressSize = (page - 1) * pageSize;
- progress = progressSize / totalSize;
- scope.setLoading("\u6570\u636E\u5BFC\u51FA(" + Math.floor(progress * 10000) / 100 + "%)<br/>" + progressSize + "/" + totalSize);
- leftSize = totalSize - progressSize;
- excelExportParams.exportExcelCurrentPage = page;
- excelExportParams.exportExcelPageSize = leftSize < pageSize ? leftSize : pageSize;
- console.log("Page=", excelExportParams.exportExcelCurrentPage, "Size=", excelExportParams.exportExcelPageSize);
- _a.label = 2;
- case 2:
- _a.trys.push([2, 4, , 5]);
- return [4 /*yield*/, ep()];
- case 3:
- pageData = _a.sent();
- if (!pageData || pageData.length <= 0) {
- return [3 /*break*/, 6];
- }
- sumCount = sumCount + pageData.length;
- excelData.push.apply(excelData, __spread(pageData));
- return [3 /*break*/, 5];
- case 4:
- e_1 = _a.sent();
- err = e_1;
- return [3 /*break*/, 5];
- case 5:
- page++;
- return [3 /*break*/, 1];
- case 6:
- if (!err) {
- scope.setLoading("\u6570\u636E\u5BFC\u51FA(" + Math.floor(excelData.length / sumCount * 10000) / 100 + "%<br/>" + excelData.length + "/" + sumCount);
- }
- excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
- if (!excelFileName.endsWith(".xlsx")) {
- excelFileName += ".xlsx";
- }
- console.log("excelFileName=", excelFileName);
- console.log("makeExcelData", me.makeExcelData);
- pageExcelData = me.makeExcelData(excelData);
- console.log("pageExcelData", pageExcelData);
- // resolve(responseData.data);
- LAY_EXCEL.exportExcel(pageExcelData, excelFileName, 'xlsx');
- scope.setLoading(false);
- if (err)
- throw err;
- return [2 /*return*/];
- }
- });
- });
- },
- exportBigExcelClick: function () {
- var _a;
- var me = this;
- if (!((_a = me.dbInfo) === null || _a === void 0 ? void 0 : _a.jdbcurl) || !me.exportDataSql) {
- showErrorDialog('当前表格不支持大批量导出');
- return;
- }
- var config = me.config;
- var scope = lookupScope(me);
- var excelFileName = config.excelFileName || scope.vjson.title || _$2.uniqueId("excel-");
- var head = [];
- var dict = {};
- _$2.forEach(me.columns, function (column) {
- if (column.isHidden())
- return;
- if (!column.dataIndex)
- return;
- if (!column.text)
- return;
- head.push({ field: column.dataIndex, name: column.text });
- if (column.dictForExcel) {
- dict[column.dataIndex] = column.dictForExcel;
- }
- });
- // 判断是否需要解密
- if (me.dbInfo.jdbcurl.indexOf("jdbc") < 0) {
- me.dbInfo.jdbcurl = hexToString(me.dbInfo.jdbcurl);
- me.dbInfo.password = hexToString(me.dbInfo.password);
- me.dbInfo.username = hexToString(me.dbInfo.username);
- }
- scope.setLoading(true);
- Ext.Ajax.request({
- timeout: 15000,
- url: window["EXPORT_DATA_HOST"],
- method: "POST",
- jsonData: {
- file: excelFileName,
- dbInfo: me.dbInfo,
- exportDataSql: me.exportDataSql,
- exportDataSqlParams: me.exportDataSqlParams,
- head: head,
- dict: dict,
- },
- }).then(function () {
- scope.setLoading(false);
- msg('请求成功');
- }).catch(function () {
- scope.setLoading(false);
- showErrorDialog('请求失败,请确认是否已安装客户端');
- });
- },
- makeExcelData: function (jsonData) {
- var me = this;
- me.fireEvent('onExcelDataLoadCompleted', me, jsonData);
- if (!Array.isArray(jsonData) || jsonData.length === 0) {
- return;
- }
- var data = [];
- // 获取表格的列定义
- var headerTextArr = [];
- var headers = [];
- for (var i = 0; i < me.headerCt.getGridColumns().length; i++) {
- var header = me.headerCt.getGridColumns()[i];
- if (!header.isHidden()) {
- var textStr = _$2.trim(header.text);
- var dataIndexStr = _$2.trim(header.dataIndex);
- if (dataIndexStr) {
- if (textStr === '') {
- headerTextArr.push(dataIndexStr);
- }
- else {
- headerTextArr.push(textStr);
- }
- headers.push(header);
- }
- }
- }
- if (headers.length === 0) {
- return;
- }
- data.push(headerTextArr);
- for (var i = 0; i < jsonData.length; i++) {
- var dataRow = jsonData[i];
- var row = [];
- for (var j = 0; j < headers.length; j++) {
- var key = headers[j].dataIndex;
- var value = dataRow[key];
- if (!value && value !== 0) {
- value = '';
- }
- var oValue = value;
- // todo 导出处理字典日期等数据,如果有特殊的单元格渲染也可能出现导出的数据有特殊标记需要特殊处理一下
- if (typeof headers[j].renderer === 'function' && (!headers[j].config.formatter)) {
- try {
- value = headers[j].renderer(value);
- if (!value && value !== 0) {
- value = oValue;
- }
- }
- catch (e) {
- value = oValue;
- }
- }
- row.push(value);
- }
- data.push(row);
- }
- return data;
- },
- initComponent: function () {
- var _this = this;
- var _a;
- var me = this;
- var config = me.config;
- var scope = lookupScope(this);
- if (isDesignMode(scope, config)) {
- this.superclass.initComponent.call(this);
- return;
- }
- // 转换 dataSource 属性
- convertDataSource$1(me, scope, config);
- this.on({
- afterrender: function (sender) {
- var me = this;
- var config = this.config;
- var dataSource = config.dataSource;
- if (config.autoLoad) {
- if (config.dataSourceCallbackFn) {
- me.reload();
- }
- else if (_$2.isPlainObject(dataSource)) {
- me.reload();
- }
- }
- if (config.contextMenu === true && _$2.isArray(config.tbar)) {
- var vm = this.lookupViewModel();
- this.contextMenu = this.add(new Ext.menu.Menu({
- viewModel: vm,
- items: _$2.map(config.tbar, function (item) {
- var menuItem = __assign({}, item);
- if (menuItem.xtype === 'button') {
- delete menuItem.xtype;
- }
- return menuItem;
- })
- }));
- }
- else if (_$2.isPlainObject(config.contextMenu)) {
- this.contextMenu = this.add(config.contextMenu);
- }
- var $dom = $(sender.el.dom);
- $dom.on('keydown', function (e) {
- me.fireEvent('keydown', me, e);
- }).on('keyup', function (e) {
- me.fireEvent('keyup', me, e);
- });
- // 默认显示提示
- if (this.cellTip) {
- this.tip = Ext.create('Ext.tip.ToolTip', {
- target: this.el,
- delegate: '.x-grid-cell-inner',
- trackMouse: true,
- ancor: 'top',
- style: 'background-color: #0D6EFD;',
- listeners: {
- beforeshow: function (tip) {
- var tipText = (tip.triggerElement.innerText || tip.triggerElement.textContent);
- if (Ext.isEmpty(tipText) || Ext.isEmpty(tipText.trim())) {
- return false;
- }
- tip.update(tipText);
- }
- }
- });
- }
- },
- itemcontextmenu: function (view, rec, node, index, e) {
- if (this.contextMenu) {
- e.stopEvent();
- this.contextMenu.show().setLocalXY(e.getXY());
- return false;
- }
- },
- // columnmove(sender, column, fromIndex, toIndex, eOpts) {
- // this.setColumnConfigCache()
- // },
- // columnhide(sender, column, eOpts) {
- // this.setColumnConfigCache()
- // },
- // columnshow(sender, column, eOpts) {
- // this.setColumnConfigCache()
- // },
- // columnresize(sender, column, width, eOpts) {
- // this.setColumnConfigCache()
- // },
- destory: function () {
- },
- selectionchange: function (sender, param) {
- var record = undefined;
- if (_$2.isArray(param)) {
- record = param[0];
- }
- else if (_$2.isObject(param)) {
- record = _$2.get(param, 'endCell.record');
- }
- itemselectFun(this, sender, record);
- },
- itemclick: function (sender, record) {
- itemselectFun(this, sender, record);
- },
- show: function (sender) {
- if (sender.__suspendReload) {
- sender.__suspendReload = false;
- sender.reload();
- }
- }
- });
- _$2.defer(function () {
- var ce = _this.findPlugin('cellediting');
- ce.on({
- beforeedit: function (editor, context, eOpts) {
- me.fireEvent('editbefore', me, editor, context, eOpts);
- },
- canceledit: function (editor, context, eOpts) {
- me.fireEvent('editcancel', me, editor, context, eOpts);
- },
- edit: function (editor, context, eOpts) {
- me.fireEvent('editfinish', me, editor, context, eOpts);
- },
- validateedit: function (editor, context, eOpts) {
- me.fireEvent('editvalidate', me, editor, context, eOpts);
- },
- });
- });
- var itemselectFun = _$2.debounce(function (me, sender, record) {
- var reference = me.reference;
- var scope = lookupScope(me);
- var theid = _$2.get(config, 'behavior.theid');
- if (theid && reference) {
- if (!record) {
- scope.viewModel.set(reference + '.theid', null);
- }
- else {
- scope.viewModel.set(reference + '.theid', record.get(theid));
- }
- }
- var theid2 = _$2.get(config, 'behavior.theid2');
- if (theid2 && reference) {
- if (!record) {
- scope.viewModel.set(reference + '.theid2', null);
- }
- else {
- scope.viewModel.set(reference + '.theid2', record.get(theid2));
- }
- }
- var theid3 = _$2.get(config, 'behavior.theid3');
- if (theid3 && reference) {
- if (!record) {
- scope.viewModel.set(reference + '.theid3', null);
- }
- else {
- scope.viewModel.set(reference + '.theid3', record.get(theid3));
- }
- }
- me.fireEvent('itemselect', sender, record);
- }, 50);
- if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
- // 为 stores.proxy.buildRequest 做准备
- this.store.proxy.$owner = this;
- }
- var selectToReload = _$2.get(config, 'behavior.selectToReload');
- if (selectToReload) {
- // 点击后触发某个目标表格刷新
- this.on({
- itemselect: function (sender) {
- if (_$2.isArray(selectToReload)) {
- _$2.forEach(selectToReload, function (ref) {
- if (ref) {
- var ctlTarget = scope.refs[ref];
- if (ctlTarget && typeof ctlTarget.reload === 'function') {
- if (ctlTarget.isVisible()) {
- ctlTarget.reload();
- }
- else {
- ctlTarget.__suspendReload = true;
- }
- }
- }
- });
- }
- else if (_$2.isString(selectToReload)) {
- var ctlTarget = scope.refs[selectToReload];
- if (ctlTarget && typeof ctlTarget.reload === 'function') {
- ctlTarget.reload();
- }
- }
- }
- });
- }
- this.superclass.initComponent.call(this);
- },
- // 生成列自定义的缓存key
- makeColumnConfigCacheKey: function (config) {
- var _a, _b, _c, _d, _e, _f;
- 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);
- var key = "gridColumnCache-" + scope.scopeKey + "-";
- if (config.reference) {
- key += config.reference;
- }
- else {
- var subKey = "";
- for (var i = 0; i < config.columns.length; i++) {
- var column = config.columns[i];
- if (column.dataIndex) {
- subKey += column.dataIndex;
- }
- }
- key += subKey;
- }
- return key;
- },
- getColumnConfigCache: function () {
- var key = this.columnConfigCacheKey;
- var dataStr = localStorage.getItem(key);
- if (dataStr) {
- return JSON.parse(dataStr);
- }
- return "";
- },
- setColumnConfigCache: function () {
- var key = this.columnConfigCacheKey;
- var cacheData = [];
- var columns = this.headerCt.getGridColumns();
- var index = 0;
- for (var i = 0; i < columns.length; i++) {
- var column = columns[i];
- if (column.dataIndex) {
- cacheData.push({
- dataIndex: column.dataIndex,
- width: column.width,
- hidden: column.hidden,
- locked: column.locked,
- index: index
- });
- index++;
- }
- }
- localStorage.setItem(key, JSON.stringify(cacheData));
- },
- autoSizeColumns: function (sender) {
- var grid = sender ? sender.up('grid') : this;
- // const columns = grid.columns;
- // for (let i = 0; i < columns.length; i++) {
- // const column = columns[i];
- // grid.getView().autoSizeColumn(column);
- // column.setWidth(column.getWidth() + 5);
- // }
- for (var i = 1; i < grid.headerCt.getColumnCount(); i++) {
- grid.headerCt.getGridColumns()[i].autoSize(i);
- grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
- }
- },
- clearFilter: function (sender) {
- var grid = sender.up('grid');
- grid.filters.clearFilters();
- grid.getStore().sorters.removeAll();
- // grid.getStore().reload()
- },
- saveGridUIConfig: function (sender) {
- var grid = sender.up('grid');
- grid.setColumnConfigCache();
- msg('保存设置成功!');
- },
- clearGridUIConfig: function (sender) {
- var grid = sender.up('grid');
- var key = grid.columnConfigCacheKey;
- localStorage.setItem(key, "");
- msg('清空设置成功,重新打开后生效!');
- },
- setLoading: function (value) {
- if (value) {
- this.mask('读取中');
- }
- else {
- this.unmask();
- }
- },
- exportExcel: function (sender) {
- var _this = this;
- var _a, _b;
- var rect = sender.btnEl.dom.getBoundingClientRect();
- var scope = lookupScope(this);
- var grid = sender.up('grid');
- var menuItems = [];
- var topOffset = 0;
- 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)) {
- menuItems.push({
- text: '大批量导出 (需要客户端支持!)',
- iconCls: 'x-fa fa-download',
- listeners: {
- click: function (sender, value) {
- // @ts-ignore
- YvanUI.confirm('大批量数据导出会占用大量服务器资源和带宽资源,您真的要导出吗?')
- .then(function (res) {
- grid.exportBigExcelClick();
- });
- }
- }
- });
- menuItems.push('-');
- topOffset += 30;
- }
- menuItems.push({
- text: '导出当前数据',
- iconCls: 'x-fa fa-download',
- listeners: {
- click: function (sender, value) {
- grid.exportCurrentExcelClick();
- }
- }
- });
- topOffset += 30;
- if (grid === null || grid === void 0 ? void 0 : grid.dataSource) {
- menuItems.push({
- xtype: "textfield",
- fieldLabel: '当前导出页',
- maskRe: /[0-9]/,
- value: grid.exportExcelCurrentPage,
- listeners: {
- render: function (sender) {
- grid.exportExcelCurrentPageCmp = sender;
- },
- change: function (sender, value) {
- var v = parseInt(value);
- if (isNaN(v) || v === 0) {
- window['system'].msg("页码不能为0");
- v = 1;
- sender.setValue(v);
- }
- var size = parseInt(grid.exportExcelPageSize);
- var total = parseInt(grid.exportExcelTotal);
- if (v > total / size) {
- v = parseInt(total / size + "");
- }
- grid.exportExcelCurrentPage = v + "";
- }
- }
- }, {
- xtype: "textfield",
- fieldLabel: '导出页大小',
- maskRe: /[0-9]/,
- value: grid.exportExcelPageSize,
- listeners: {
- render: function (sender) {
- grid.exportExcelPageSizeCmp = sender;
- },
- change: function (sender, value) {
- var v = parseInt(value);
- if (isNaN(v) || v === 0) {
- window['system'].msg("导出页大小不能为0");
- v = defaultGrid.exportExcelPageSize;
- sender.setValue(v);
- }
- if (window['__isNNDSL'] === true) ;
- else {
- if (v > 10000) {
- window['system'].msg("导出页大小不能大于10000");
- v = 10000;
- sender.setValue(v);
- }
- }
- var page = parseInt(grid.exportExcelCurrentPage);
- var total = parseInt(grid.exportExcelTotal);
- if (page > total / v) {
- page = parseInt(total / v + "") + 1;
- grid.exportExcelCurrentPageCmp.setValue(page);
- }
- grid.exportExcelPageSize = v + "";
- }
- }
- }, {
- xtype: "textfield",
- fieldLabel: '总条数',
- value: grid.exportExcelTotal,
- readOnly: true
- }, {
- text: '导出',
- iconCls: 'x-fa fa-download',
- listeners: {
- click: function (sender, value) {
- var me = _this;
- var scope = lookupScope(me);
- grid.exportExcelClick2({
- exportExcelPageSize: grid.exportExcelPageSize,
- exportExcelCurrentPage: grid.exportExcelCurrentPage
- }).catch(function (e) {
- console.error("导出报错", e);
- system.msg("导出失败:" + e.message);
- }).finally(function () {
- scope.setLoading(false);
- });
- }
- }
- }, {
- text: '连续导出',
- iconCls: 'x-fa fa-download',
- listeners: {
- click: function (sender, value) {
- grid.exportExcelClick({
- exportExcelPageSize: grid.exportExcelPageSize,
- exportExcelCurrentPage: grid.exportExcelCurrentPage
- }, true);
- }
- }
- });
- topOffset += 150;
- }
- var treeMenu = new Ext.menu.Menu({
- xtype: 'menu',
- floated: false,
- width: 300,
- docked: 'left',
- items: menuItems
- });
- treeMenu.showAt(rect.left, rect.top - topOffset);
- // for (let i = 1; i < grid.headerCt.getColumnCount(); i++) {
- // grid.headerCt.getGridColumns()[i].autoSize(i);
- // grid.headerCt.getGridColumns()[i].setWidth(grid.headerCt.getGridColumns()[i].getWidth() + 15);
- // }
- },
- /**
- * 获取表格编辑的行数据
- */
- getGridEditRows: function () {
- var grid = this;
- var store = grid.getStore();
- var rows = [];
- var modifyRows = [];
- var newRows = [];
- var err = "";
- var records = store.getModifiedRecords();
- var newRecords = store.getNewRecords();
- var removeRecords = [];
- _$2.forEach(store.getRemovedRecords(), function (row) {
- removeRecords.push(row.data);
- });
- _$2.forEach(records, function (record) {
- var colums = grid.columns;
- var errFunc = undefined;
- _$2.forEach(colums, function (col) {
- var name = col.dataIndex;
- var value = record.data[name];
- var colIndex = col.getIndex(); //获得列号
- var rowIndex = store.indexOfId(record.id); //获得行号
- var editor = col.getEditor(); //使用的编辑器
- var tmpErrFunc = function () {
- var text = col.text || col.name;
- msg(text + ' 校验失败, 请确保输入的数据正确');
- grid.findPlugin('cellediting').startEdit(rowIndex, col); //如果不通过激活当前编辑状态
- };
- if (editor && !editor.allowBlank && isEmpty(value)) {
- errFunc = tmpErrFunc;
- return false;
- }
- if (editor && !isEmpty(value) && !editor.validateValue(value)) {
- errFunc = tmpErrFunc;
- return false;
- }
- });
- if (typeof errFunc === 'function') {
- err = "1";
- _$2.remove(rows, function (n) {
- return true;
- });
- //@ts-ignore
- errFunc();
- // Ext.Msg.alert('提示', '请确保输入的数据正确', errFunc)
- return false;
- }
- else {
- if (_$2.findIndex(newRecords, function (item) {
- return item === record;
- }) >= 0) {
- newRows.push(record.data);
- }
- else {
- modifyRows.push(record.data);
- }
- rows.push(record.data);
- }
- });
- return {
- rows: rows,
- newRows: newRows,
- modifyRows: modifyRows,
- removeRecords: removeRecords,
- err: err
- };
- }
- // reload() {
- // dataSourceReload(this)
- // },
- });
- }
- /**
- * 获取 columns 中所有的 dataIndex
- */
- function getFileds(newConfig) {
- var fields = [];
- _$2.forEach(newConfig.columns, function (c) {
- if (c.dataIndex) {
- fields.push(c.dataIndex);
- }
- });
- return fields;
- }
- function convertDataSource$1(sender, scope, newConfig) {
- if (typeof newConfig.store !== 'undefined') {
- // 有 store 属性的情况下,不做任何事
- return;
- }
- if (typeof newConfig.dataSource === 'undefined') {
- // 没有定义 dataSource 的情况下,不做任何事
- return;
- }
- if (_$2.isArray(newConfig.data)) {
- // 有 data 属性赋值的情况下
- newConfig.store = {
- fields: getFileds(newConfig),
- data: newConfig.data
- };
- delete newConfig.data;
- return;
- }
- var dataSource = newConfig.dataSource;
- if (typeof dataSource === 'string') {
- // dataSource 是字符串的情况下,找到成员函数
- dataSource = lookupFn(scope, dataSource);
- }
- if (typeof dataSource === 'function') {
- // dataSource 是函数的情况下,在 afterrender 之后进行回调
- newConfig.store = new Ext.data.Store({
- fields: getFileds(newConfig),
- // data: [],
- autoLoad: true,
- proxy: {
- type: 'memory',
- data: [],
- }
- });
- newConfig.dataSourceCallbackFn = dataSource;
- return;
- }
- // throw new TypeError('无法识别的调用方法')
- }
- function initTextfield () {
- var cc = Ext.form.field.Text.prototype.constructor;
- var initComponent = Ext.form.field.Text.prototype.initComponent;
- Ext.form.field.Text.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制属性
- triggers: {
- clear: {
- weight: -1,
- cls: Ext.baseCSSPrefix + 'form-clear-trigger',
- hidden: true,
- handler: 'onClearClick',
- },
- }
- }, baseConfig(config, 'col-item'), config, text);
- if (config === null || config === void 0 ? void 0 : config.nextFocus) {
- newConfig.enableKeyEvents = true;
- }
- cc.call(this, newConfig);
- },
- /**
- * 清空所有值
- */
- onClearClick: function (sender, e) {
- var me = this;
- me.setValue('');
- },
- /**
- * 尝试获取下一个要获取焦点的控件
- */
- _raiseNextFocus: function (sender) {
- var config = sender.config;
- var scope = lookupScope(sender);
- if (typeof config.nextFocus === 'function') {
- config.nextFocus(sender);
- }
- else if (typeof config.nextFocus === 'string' && _$2.size(config.nextFocus) > 0) {
- if (_$2.startsWith(config.nextFocus, 'scope.')) {
- var fn = lookupFn(scope, config.nextFocus);
- if (typeof fn === 'function') {
- var nextCtlReference = fn(sender);
- if (typeof nextCtlReference === 'string' && _$2.size(nextCtlReference) > 0) {
- var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[nextCtlReference];
- if (ctl) {
- if (typeof ctl.focus2 === 'function') {
- ctl.focus2();
- }
- else {
- ctl.focus();
- }
- }
- }
- }
- }
- else {
- var ctl = scope === null || scope === void 0 ? void 0 : scope.refs[config.nextFocus];
- if (ctl) {
- if (typeof ctl.focus2 === 'function') {
- ctl.focus2();
- }
- else {
- ctl.focus();
- }
- }
- }
- }
- },
- initComponent: function () {
- /**
- * 改变必填项之前加星号
- */
- if (this.config.readOnly !== true && (this.allowBlank === false || this.validateBlank === true)) {
- // this.beforeLabelTextTpl = [
- // '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
- // ];
- this.afterLabelTextTpl = [
- '<span style="color:red;font-weight:bold" data-qtip="必填选项">*</span>'
- ];
- }
- var me = this;
- this.on({
- change: function (sender, newVal) {
- var hideTrigger = sender.hideTrigger, disabled = sender.disabled, readOnly = sender.readOnly, hideClear = sender.hideClear;
- if (hideTrigger || disabled || readOnly || hideClear) {
- // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
- return;
- }
- var value = newVal;
- if (value) {
- me.getTrigger('clear').show();
- me.updateLayout();
- }
- else {
- me.getTrigger('clear').hide();
- me.updateLayout();
- }
- },
- afterrender: function (sender) {
- var _this = this;
- var _a;
- if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
- sender.inputEl.dom.setAttribute('spellcheck', "false");
- $$2(sender.inputEl.dom).on('click', function (e) {
- sender.fireEvent('click', _this, e);
- });
- $$2(sender.inputEl.dom).on('keydown', function (e) {
- var _a, _b, _c, _d;
- // 表格内编辑器,按上下键时,可以切换到下一行/上一行 进入编辑
- if (e.code === "ArrowDown" || e.code === 'ArrowUp') {
- if (sender.isExpanded === true) {
- // 弹开下拉框的基础上,不干预上下选择
- return;
- }
- if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
- var grid = sender.ownerCt.up('grid');
- var editingPlugin = grid.editingPlugin || grid.ownerGrid.editingPlugin;
- if (editingPlugin) {
- 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;
- var column = (_d = editingPlugin === null || editingPlugin === void 0 ? void 0 : editingPlugin.activeEditor) === null || _d === void 0 ? void 0 : _d.column;
- if (typeof rowIdx !== 'undefined' && typeof column !== 'undefined') {
- // editingPlugin
- var targetRecord = void 0;
- if (e.code === 'ArrowDown') {
- targetRecord = grid.store.data.getAt(rowIdx + 1);
- }
- else {
- targetRecord = grid.store.data.getAt(rowIdx - 1);
- }
- if (targetRecord) {
- grid.setSelection([targetRecord]);
- editingPlugin.startEdit(targetRecord, column);
- }
- e.stopPropagation();
- e.preventDefault();
- }
- }
- }
- }
- });
- }
- var config = sender.config;
- if (config.ff && config.ff > 0) {
- setTimeout(function () {
- if (typeof sender.focus2 === 'function') {
- sender.focus2();
- }
- else {
- sender.focus();
- }
- }, config.ff);
- }
- }
- });
- var config = this.config;
- if (config === null || config === void 0 ? void 0 : config.nextFocus) {
- this.on({
- keyup: function (sender, e) {
- if ([10, 13, 20, 40].includes(e.keyCode)) {
- sender._raiseNextFocus(sender);
- }
- }
- });
- }
- var that = this;
- this.on({
- keyup: function (sender, e, eOpts) {
- if (![10, 13, 20, 40].includes(e.keyCode)) {
- return;
- }
- that.keydown_fun_item(sender, e, eOpts);
- }
- });
- initComponent.call(this);
- },
- keydown_fun_item: _$2.debounce(function (sender, event, eOpts) {
- var that = sender;
- if ([10, 13, 20, 40].includes(event.keyCode)) {
- // 获取读码器读取的内容,最好不要从 viewModel 中取值,而是从 sender.rawValue 中取值
- var value = _$2.trim(sender.rawValue);
- var r = that.fireEvent('scancode', that, value, event);
- if (r === 'OK') {
- // 停止事件的默认处理程序,停止事件的冒泡
- // event.stopEvent();
- event.preventDefault();
- event.stopPropagation();
- }
- }
- }, 100)
- });
- }
- function initTbFill () {
- /**
- *
- */
- var ct = Ext.toolbar.Fill.prototype.constructor;
- Ext.toolbar.Fill.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbfill);
- ct.call(this, newConfig);
- }
- });
- }
- function initTbSeparator () {
- /**
- *
- */
- var ct = Ext.toolbar.Separator.prototype.constructor;
- Ext.toolbar.Separator.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), tbseparator);
- ct.call(this, newConfig);
- }
- });
- }
- function initToolbar () {
- /**
- *
- */
- var ct = Ext.toolbar.Toolbar.prototype.constructor;
- Ext.toolbar.Toolbar.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制性属性
- }, baseConfig(config, 'cols-container'), config, toolbar);
- ct.call(this, newConfig);
- }
- });
- initTbFill();
- initTbSeparator();
- }
- function initSplitter () {
- var ct = Ext.resizer.Splitter.prototype.constructor;
- Ext.resizer.Splitter.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "row-item"), splitter);
- ct.call(this, newConfig);
- }
- });
- }
- /**
- * 通用 dataSource 解析,
- * Tree/Combo/Grid/PageList ... 都会从这里解析
- */
- function dataSourceReload(ctl, extraParam, _successCb, successCallback, failCallback) {
- var config = ctl.config;
- return new Promise(function (resolve, reject) {
- if (!config.dataSource) {
- // 没有设置数据源,直接置空
- return Promise.resolve();
- }
- var option = {
- extraParam: extraParam,
- _successCb: _successCb,
- successCallback: function (value) {
- if (typeof successCallback === "function") {
- successCallback(value);
- }
- else {
- ctl.setData(value);
- }
- ctl.fireEvent('dataLoadComplete', ctl, true, value);
- ctl.setLoading(false);
- resolve(value);
- },
- failCallback: function (error) {
- if (typeof failCallback === "function") {
- failCallback(error);
- }
- ctl.fireEvent('dataLoadComplete', ctl, false);
- ctl.setLoading(false);
- reject(error);
- }
- };
- // 请求前要求确认一下
- var isCanceled = false;
- ctl.fireEvent('dataBeforeLoad', ctl, __assign({ cancel: function () {
- isCanceled = true;
- } }, option));
- if (!isCanceled) {
- // 请求没有被取消
- // 调用异步接口返回 Promise
- return _innerReload(ctl, option);
- }
- return reject();
- });
- }
- function _innerReload(ctl, option) {
- var config = ctl.config;
- ctl.setLoading(true);
- var scope = lookupScope(ctl);
- var dataSource = config.dataSource;
- if (typeof dataSource == 'string') {
- dataSource = lookupFn(scope, config.dataSource);
- }
- if (typeof dataSource === 'function') {
- // @ts-ignore
- dataSource.call(scope, ctl, option);
- return;
- }
- else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string' || typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
- if (!ajax.func) {
- console.error("没有配置 ajax");
- return;
- }
- var params_1 = {};
- var sortModel = null;
- var filterModel = null;
- if (option.extraParam && option.extraParam.filterModel) {
- filterModel = option.extraParam.filterModel;
- }
- if (option.extraParam && option.extraParam.sortModel) {
- sortModel = option.extraParam.sortModel;
- }
- _$2.forOwn(option.extraParam, function (v, key) {
- if (key != "filterModel" && key != "sortModel") {
- if (typeof v === 'function') {
- params_1[key] = v();
- }
- else {
- params_1[key] = v;
- }
- }
- });
- var ds = dataSource;
- _$2.forOwn(ds.params, function (v, key) {
- if (typeof v === 'function') {
- params_1[key] = v();
- }
- else {
- params_1[key] = v;
- }
- });
- if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.url) === 'string') {
- // @ts-ignore
- ajax.func({
- method: dataSource.method,
- url: ds.url,
- data: params_1,
- filterModel: filterModel,
- sortModel: sortModel,
- }).then(function (res) {
- if (res.success) {
- option.successCallback(res.data);
- }
- else {
- option.failCallback(res.msg);
- }
- }).catch(function (e) {
- option.failCallback(e);
- });
- }
- else if (typeof (dataSource === null || dataSource === void 0 ? void 0 : dataSource.sqlId) === 'string') {
- var ds_1 = ctl.dataSource;
- // @ts-ignore
- Extend.ajax.func({
- url: ds_1.sqlId,
- data: params_1,
- db: ds_1.db,
- method: 'sql',
- filterModel: filterModel,
- sortModel: sortModel,
- }).then(function (res) {
- if (res.success) {
- option.successCallback(res.data);
- }
- else {
- option.failCallback(res.msg);
- }
- }).catch(function (e) {
- option.failCallback(e);
- }).finally(function () {
- ctl.loading = false;
- });
- return;
- }
- else {
- console.error("非法的 dataSource", ctl.dataSource);
- debugger;
- throw new Error("非法的 dataSource");
- }
- }
- }
- function initCombo () {
- var cc = Ext.form.field.ComboBox.prototype.constructor;
- var _a = Ext.form.field.ComboBox.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
- Ext.form.field.ComboBox.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制性属性
- }, baseConfig(config, 'col-item'), config, combo);
- if (typeof config.dict === 'string') {
- window['yvanLib'].system.getDict(config.dict)(this, newConfig);
- }
- else if (typeof newConfig.store == 'undefined') {
- if (_$2.isArray(newConfig.data)) {
- // ExtJS 无法直接接受数组模式
- newConfig.store = {
- fields: [newConfig.valueField, newConfig.displayField],
- data: newConfig.data
- };
- delete newConfig.data;
- }
- else if (typeof newConfig.data !== 'object') {
- newConfig.store = {
- fields: [newConfig.valueField, newConfig.displayField],
- data: []
- };
- delete newConfig.data;
- }
- }
- cc.call(this, newConfig);
- },
- setDict: function (bizKey) {
- window['yvanLib'].system.getDict(bizKey)(this, this.config);
- this.dict = bizKey;
- },
- getDict: function () {
- return this.dict;
- },
- setData: function (value) {
- if (!value) {
- return;
- }
- var config = value.config;
- if (!this.store) {
- this.store = new Ext.data.Store({
- fields: [config.valueField, config.displayField],
- data: value
- });
- }
- else {
- this.store.getProxy().setData(value);
- this.store.load();
- }
- },
- setLoading: function (value) {
- if (value) {
- if (!this.loadMask) {
- this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
- }
- }
- else {
- if (this.loadMask) {
- this.loadMask.destroy();
- delete this.loadMask;
- }
- }
- },
- reload: function () {
- dataSourceReload(this);
- },
- initComponent: function () {
- var that = this;
- var toggle = function (e) {
- var readOnly = that.readOnly, disabled = that.disabled;
- if (readOnly || disabled) {
- return;
- }
- if ($(e.target).is('.x-form-trigger')) {
- return;
- }
- // 点击后下拉
- if (that.isExpanded) {
- that.collapse();
- }
- else {
- that.expand();
- that.doQuery(that.allQuery, true);
- }
- };
- this.on({
- afterrender: function (sender) {
- var config = this.config;
- if (config.dataSource && config.autoLoad) {
- dataSourceReload(this);
- }
- // 点击后下拉
- $(this.el.dom).on('click', toggle.bind(this));
- },
- focusenter: function (sender, event, opt) {
- var _a;
- if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
- // 表格内编辑框,获取焦点后自动弹开
- toggle.call(this, event);
- }
- },
- destory: function () {
- $(this.el.dom).off('click', toggle.bind(this));
- },
- beforequery: function (context) {
- var cancel = context.cancel, forceAll = context.forceAll, lastQuery = context.lastQuery, query = context.query, rawQuery = context.rawQuery, combo = context.combo;
- // console.log('beforequery', query)
- if (!forceAll && query) {
- combo.store.clearFilter();
- combo.store.filterBy(function (record, id) {
- var text = record.get(combo.displayField);
- // 用拼音筛选的方式
- return keywordFilter(query, text, id);
- });
- combo.expand();
- return false;
- }
- combo.store.clearFilter();
- combo.expand();
- return false;
- },
- });
- initComponent.call(this);
- },
- focus2: function () {
- this.focus();
- var that = this;
- _$2.defer(function () {
- if (that.isExpanded) {
- that.collapse();
- }
- else {
- that.expand();
- that.doQuery(that.allQuery, true);
- }
- });
- }
- });
- }
- /**
- xtype: 'tagfield',
- displayField: 'show',
- valueField: 'id',
- queryMode: 'local',
- filterPickList: true,
- store: {
- fields: ['id', 'show'],
- data: [
- {id: 0, show: 'Battlestar Galactica'},
- {id: 1, show: 'Doctor Who'},
- {id: 2, show: 'Farscape'},
- {id: 3, show: 'Firefly'},
- {id: 4, show: 'Star Trek'},
- {id: 5, show: 'Star Wars: Christmas Special'}
- ]
- }
- */
- function initTag () {
- var cc = Ext.form.field.Tag.prototype.constructor;
- var _a = Ext.form.field.Tag.prototype, initComponent = _a.initComponent, setData = _a.setData, setStore = _a.setStore;
- Ext.form.field.Tag.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制性属性
- }, baseConfig(config, 'col-item'), config, tagfield);
- if (typeof config.dict === 'string') {
- window['yvanLib'].system.getDict(config.dict)(this, newConfig);
- }
- else if (typeof newConfig.store == 'undefined') {
- if (_$2.isArray(newConfig.data)) {
- // ExtJS 无法直接接受数组模式
- newConfig.store = {
- fields: [newConfig.valueField, newConfig.displayField],
- data: newConfig.data
- };
- delete newConfig.data;
- }
- else if (typeof newConfig.data !== 'object') {
- newConfig.store = {
- fields: [newConfig.valueField, newConfig.displayField],
- data: []
- };
- delete newConfig.data;
- }
- }
- cc.call(this, newConfig);
- },
- setDict: function (bizKey) {
- window['yvanLib'].system.getDict(bizKey)(this, this.config);
- this.dict = bizKey;
- },
- getDict: function () {
- return this.dict;
- },
- setData: function (value) {
- if (!value) {
- return;
- }
- var config = value.config;
- if (!this.store) {
- this.store = new Ext.data.Store({
- fields: [config.valueField, config.displayField],
- data: value
- });
- }
- else {
- this.store.getProxy().setData(value);
- this.store.load();
- }
- },
- setLoading: function (value) {
- if (value) {
- if (!this.loadMask) {
- this.loadMask = new Ext.LoadMask(this, { msg: "loading..." });
- }
- }
- else {
- if (this.loadMask) {
- this.loadMask.destroy();
- delete this.loadMask;
- }
- }
- },
- reload: function () {
- dataSourceReload(this);
- },
- initComponent: function () {
- var that = this;
- var toggle = function (e) {
- var readOnly = that.readOnly, disabled = that.disabled;
- if (readOnly || disabled) {
- return;
- }
- if ($(e.target).is('.x-form-trigger')) {
- return;
- }
- // 点击后下拉
- if (that.isExpanded) {
- that.collapse();
- }
- else {
- that.expand();
- that.doQuery(that.allQuery, true);
- }
- };
- this.on({
- afterrender: function (sender) {
- var config = this.config;
- if (config.dataSource && config.autoLoad) {
- dataSourceReload(this);
- }
- // 点击后下拉
- $(this.el.dom).on('click', toggle.bind(this));
- },
- focusenter: function (sender, event, opt) {
- var _a;
- if (((_a = sender.ownerCt) === null || _a === void 0 ? void 0 : _a.xtype) === 'celleditor') {
- // 表格内编辑框,获取焦点后自动弹开
- toggle.call(this, event);
- }
- },
- destory: function () {
- $(this.el.dom).off('click', toggle.bind(this));
- },
- });
- initComponent.call(this);
- },
- focus2: function () {
- this.focus();
- var that = this;
- _$2.defer(function () {
- if (that.isExpanded) {
- that.collapse();
- }
- else {
- that.expand();
- that.doQuery(that.allQuery, true);
- }
- });
- }
- });
- }
- function initComboGridMulti () {
- Ext.define('Yvan.LocalComboGrid', {
- extend: 'Ext.form.field.Picker',
- // extend: 'Yvan.PickerAlignCenter',
- xtype: 'combogridmulti',
- triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
- config: __assign(__assign({}, comboGridMulti), { store: null, displayField: null, columns: null, selectOnTab: true, maxPickerHeight: 300, minPickerHeight: 100, minPickerWidth: 350, rootVisible: true }),
- editable: false,
- initComponent: function () {
- this.on({
- afterrender: function () {
- var config = this.config;
- if (config.dataSource && config.autoLoad) {
- dataSourceReload(this);
- }
- },
- });
- this.superclass.initComponent.apply(this, arguments);
- },
- setStore: function (store) {
- this.store = store;
- var me = this;
- if (me.store) {
- if (me.picker) {
- me.picker.setStore(store);
- if (me.isExpanded) {
- me.collapse();
- delete me.picker;
- me.expand();
- }
- }
- this.onLoad();
- me.mon(me.store, {
- scope: me,
- load: me.onLoad,
- update: me.onUpdate
- });
- }
- },
- reload: function () {
- dataSourceReload(this);
- },
- setData: function (value) {
- var me = this;
- var config = me.config;
- if (!value) {
- return;
- }
- if (!this.store) {
- this.store = new Ext.data.Store({
- fields: [config.valueField, config.displayField],
- data: value
- });
- }
- else {
- this.store.getProxy().setData(value);
- this.store.load();
- }
- this.onLoad();
- },
- createPicker: function () {
- var me = this;
- 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: {
- scope: me,
- selectionchange: me.onSelectionChange,
- itemkeydown: me.onPickerKeyDown
- } })), view = picker.getView();
- if (Ext.isIE9 && Ext.isStrict) {
- view.on({
- scope: me,
- highlightitem: me.repaintPickerView,
- unhighlightitem: me.repaintPickerView,
- afteritemexpand: me.repaintPickerView,
- afteritemcollapse: me.repaintPickerView
- });
- }
- return picker;
- },
- repaintPickerView: function () {
- var style = this.picker.getView().getEl().dom.style;
- style.display = style.display;
- },
- onSelectionChange: function (view, record, node, rowIndex, e) {
- this.selectItem(view, record);
- },
- onPickerKeyDown: function (treeView, record, item, index, e) {
- var key = e.getKey();
- if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
- this.selectItem(treeView, record);
- }
- },
- selectItem: function (sender, record) {
- var me = this;
- var ids = [];
- _$2.forEach(me.picker.getSelection(), function (record) {
- ids.push(record.get(me.valueField));
- });
- me.fireEvent('select', me, record);
- me.setValue(ids.join(me.splitChar));
- // me.collapse();
- },
- onExpand: function () {
- var me = this;
- var picker = this.picker;
- var value = this.value;
- if (!me.store) {
- msg('正在初始化数据,请稍后');
- me.collapse();
- return;
- }
- var vs = _$2.split(value, me.splitChar);
- var records = me.store.queryRecordsBy(function (r) { return _$2.findIndex(vs, function (i) { return r.get(me.valueField) === i; }) >= 0; });
- picker.setSelection(records);
- },
- setValue: function (value) {
- var me = this;
- console.log('setValue', value);
- me.value = value;
- if (!me.store || me.store.loading) {
- // Called while the Store is loading. Ensure it is processed by the onLoad method.
- return me.mixins.field.setValue.call(me, value);
- // return me;
- }
- var vs = _$2.split(value, me.splitChar);
- var displayValues = [];
- _$2.forEach(vs, function (v) {
- var _a;
- var record = me.store.queryRecordsBy(function (r) { return r.get(me.valueField) === v; });
- var dv = (_a = record[0]) === null || _a === void 0 ? void 0 : _a.get(me.displayField);
- if (dv) {
- displayValues.push(dv);
- }
- else {
- displayValues.push(v);
- }
- });
- // set the raw value to the record's display field if a record was found
- me.setRawValue(displayValues.join(me.splitChar));
- return me.mixins.field.setValue.call(me, value);
- },
- getSubmitValue: function () {
- return this.value;
- },
- getValue: function () {
- return this.value;
- },
- onLoad: function () {
- var value = this.value;
- if (value) {
- this.setValue(value);
- }
- },
- onUpdate: function (store, rec, type, modifiedFieldNames) {
- var display = this.displayField;
- var me = this;
- if (type === 'edit' && modifiedFieldNames &&
- Ext.Array.contains(modifiedFieldNames, display) &&
- this.value === rec.getId()) {
- me.mixins.field.setValue.call(me, this.value);
- this.setRawValue(rec.get(display));
- }
- }
- });
- }
- function initSearch () {
- Ext.define('Yvan.Search', {
- extend: 'Ext.form.field.Text',
- alias: 'widget.searchfield',
- xtype: 'searchfield',
- constructor: function (config) {
- var self = this;
- var newConfig = _$2.defaultsDeep({
- // 强制性属性
- triggers: {
- clear: {
- weight: 0,
- cls: Ext.baseCSSPrefix + 'form-clear-trigger',
- hidden: true,
- handler: 'onClearClick',
- },
- search: {
- weight: 1,
- cls: Ext.baseCSSPrefix + 'form-search-trigger',
- handler: 'onSearchClick'
- },
- },
- listeners: {
- blur: function (sender, e) {
- this.revertOnblur();
- },
- specialkey: function (sender, e) {
- var _a;
- var me = this;
- if (e.getKey() === e.ENTER) {
- me.onSearchClick(sender, {}, e);
- return;
- }
- invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
- },
- afterrender: function (sender, e) {
- var _a;
- this.replaceRawInputEvent();
- invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
- }
- },
- }, baseConfig(config, 'col-item'), config, search);
- this.superclass.constructor.call(self, newConfig);
- },
- revertOnblur: function () {
- this.setRawValue(this.lastValue);
- },
- onSearchClick: function (sender, vv, e) {
- var me = this;
- var config = me.config;
- var widget = config.widget, vjson = config.vjson, lookup = config.lookup;
- if (e) {
- e.preventDefault();
- e.stopPropagation();
- }
- this.fireEvent('search', sender, e);
- if (!widget) {
- return;
- }
- showWidget(widget, lookup, sender, me.getRawValue(), vjson);
- },
- replaceRawInputEvent: function () {
- var me = this;
- var $dom = $(me.inputEl.dom);
- $dom.on('input', function (e) {
- stopEvent(e);
- // console.log('has input', e)
- });
- $dom.on('keyup', function (e) {
- if (e.key === "Enter") {
- me.onSearchClick(me, {}, e);
- return;
- }
- stopEvent(e);
- });
- $dom.on('change', function (e) {
- stopEvent(e);
- });
- },
- onChange: function (newVal, oldVal) {
- var me = this;
- var value = newVal;
- if (value) {
- me.getTrigger('clear').show();
- me.updateLayout();
- }
- else {
- me.getTrigger('clear').hide();
- me.updateLayout();
- }
- },
- /**
- * 清空所有值
- */
- onClearClick: function (sender, e) {
- var me = this;
- var config = me.config;
- var lookup = config.lookup;
- me.setValue('');
- clearViewModelByLookup(sender, lookup);
- }
- });
- }
- function initMultipleSearch () {
- Ext.define('Yvan.MultipleSearch', {
- extend: 'Ext.form.field.Text',
- xtype: 'multiplesearch',
- bindTargert: '',
- constructor: function (config) {
- var _a, _b, _c, _d;
- var self = this;
- var newConfig = _$2.defaultsDeep({
- // 强制性属性
- triggers: {
- clear: {
- weight: 0,
- cls: Ext.baseCSSPrefix + 'form-clear-trigger',
- hidden: true,
- handler: 'onClearClick',
- }
- },
- transformRawValue: function (o) {
- return o;
- },
- listeners: {
- specialkey: function (sender, e) {
- var me = this;
- if (e.getKey() === e.ENTER) {
- me.fireEvent('search', me, e);
- }
- },
- afterrender: function (sender, e) {
- var _a;
- this.replaceRawInputEvent();
- invokeMethod((_a = config.listeners) === null || _a === void 0 ? void 0 : _a.afterrender, sender, e);
- }
- },
- }, baseConfig(config, 'col-item'), config, search);
- this.superclass.constructor.call(self, newConfig);
- 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 : '';
- vv = _$2.replace(vv, "{", "");
- vv = _$2.replace(vv, "}", "");
- this.bindTargert = vv;
- this.bindTargert = _$2.trim(this.bindTargert);
- },
- setBindValue: function (arrValue) {
- if (this.bindTargert) {
- this.lookupViewModel().yvanScope.viewModel.set(this.bindTargert, arrValue);
- }
- },
- replaceRawInputEvent: function () {
- var me = this;
- var $dom = $(me.inputEl.dom);
- $dom.on('input', function (e) {
- var _a, _b, _c, _d, _e, _f;
- if ((_b = (_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b.endsWith(" ")) {
- var a = _$2.trimEnd((_c = e.currentTarget) === null || _c === void 0 ? void 0 : _c.value);
- if (!a.endsWith(",") && a.length > 0) {
- e.currentTarget.value = a + ",";
- }
- else {
- e.currentTarget.value = a;
- }
- }
- e.currentTarget.value = (_d = e.currentTarget.value) === null || _d === void 0 ? void 0 : _d.replaceAll(",,", ",");
- var arr = (_f = (_e = e.currentTarget) === null || _e === void 0 ? void 0 : _e.value) === null || _f === void 0 ? void 0 : _f.split(",");
- _$2.remove(arr, function (it) {
- return !it;
- });
- me.setBindValue(arr);
- stopEvent(e);
- });
- $dom.on('keyup', function (e) {
- me.fireEvent('keyup', me, e);
- // invokeMethod(me.config.listeners?.keyup, me, e)
- stopEvent(e);
- });
- $dom.on('keydown', function (e) {
- me.fireEvent('keydown', me, e);
- // invokeMethod(me.config.listeners?.keydown, me, e)
- //stopEvent(e)
- });
- $dom.on('change', function (e) {
- stopEvent(e);
- });
- $dom.on('paste', function (e) {
- var _a;
- // @ts-ignore
- var clipdata = e.originalEvent.clipboardData || window.clipboardData;
- var text = clipdata.getData("text/plain");
- var spliter = ',';
- text = text.replaceAll("\r", "");
- text = text.replaceAll("\n", spliter);
- text = ((_a = e.currentTarget) === null || _a === void 0 ? void 0 : _a.value) + "," + text;
- var arr = text.split(spliter);
- if (arr && Array.isArray(arr)) {
- for (var i = 0; i < arr.length; i++) {
- arr[i] = _$2.trim(arr[i]);
- }
- }
- _$2.remove(arr, function (it) {
- return !it;
- });
- me.setBindValue(arr);
- stopEvent(e);
- });
- },
- onChange: function (newVal, oldVal) {
- var me = this;
- var value = newVal;
- if (value) {
- me.getTrigger('clear').show();
- me.updateLayout();
- }
- else {
- me.getTrigger('clear').hide();
- me.updateLayout();
- }
- },
- /**
- * 清空所有值
- */
- onClearClick: function (sender, e) {
- var me = this;
- var config = me.config;
- var lookup = config.lookup;
- me.setValue('');
- clearViewModelByLookup(sender, lookup);
- }
- });
- }
- function initDate () {
- var cc = Ext.form.field.Date.prototype.constructor;
- var _a = Ext.form.field.Date.prototype, initComponent = _a.initComponent, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
- Ext.form.field.Date.override({
- format: 'Y-m-d',
- altFormats: 'Y-m-d',
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制属性
- }, baseConfig(config, 'col-item'), config, date);
- cc.call(this, newConfig);
- },
- getValue: function () {
- var ov = getValue.call(this);
- var nv = Ext.util.Format.date(ov, 'Y-m-d');
- // console.log('cc:', nv, ov)
- return nv;
- },
- // focus2() {
- // const that = this
- // if (that.isExpanded) {
- // that.collapse()
- //
- // } else {
- // that.expand();
- // }
- // _.defer(() => {
- // that.focus()
- // })
- // },
- initComponent: function () {
- this.on({
- afterrender: function () {
- var config = this.config;
- // 日期框,不要默认弹出
- // $(this.el.dom).on('click', toggle.bind(this))
- },
- destory: function () {
- // 日期框,不要默认弹出
- // $(this.el.dom).off('click', toggle.bind(this))
- },
- change: {
- fn: function (sender) {
- if (sender.format === 'Y-m-d') {
- // 年月日格式
- var value = sender.getRawValue();
- if (/^\d{8}$/.test(value)) {
- // 8位数字,自动转换为 YYYY-MM-DD
- var newValue = [
- value.substr(0, 4),
- value.substr(4, 2),
- value.substr(6, 2)
- ].join('-');
- sender.setValue(newValue);
- }
- }
- },
- }
- // focus: {
- // // 获得焦点后自动下拉
- // fn(sender) {
- // sender.expand();
- // this.doQuery(this.allQuery, true);
- // },
- // },
- });
- initComponent.call(this);
- },
- createInitialDate: function (value) {
- var minValue = this.minValue, maxValue = this.maxValue;
- value = value || syncDate(new Date());
- if (minValue && minValue > value) {
- value = minValue;
- }
- else if (maxValue && maxValue < value) {
- value = maxValue;
- }
- return value;
- },
- });
- }
- function initDateTimePicker () {
- Ext.define('Yvan.DateTimePicker', {
- extend: 'Ext.picker.Date',
- alias: 'datetimepicker',
- alternateClassName: 'Ext.DateTimePicker',
- renderTpl: [
- '<div id="{id}-innerEl" data-ref="innerEl" role="presentation">',
- '<div class="{baseCls}-header">',
- '<div id="{id}-prevEl" data-ref="prevEl" class="{baseCls}-prev {baseCls}-arrow" role="presentation" title="{prevText}"></div>',
- '<div id="{id}-middleBtnEl" data-ref="middleBtnEl" class="{baseCls}-month" role="heading">{%this.renderMonthBtn(values, out)%}</div>',
- '<div id="{id}-nextEl" data-ref="nextEl" class="{baseCls}-next {baseCls}-arrow" role="presentation" title="{nextText}"></div>',
- '</div>',
- '<table role="grid" id="{id}-eventEl" data-ref="eventEl" class="{baseCls}-inner" cellspacing="0" tabindex="0" aria-readonly="true">',
- '<thead>',
- '<tr role="row">',
- '<tpl for="dayNames">',
- '<th role="columnheader" class="{parent.baseCls}-column-header" aria-label="{.}">',
- '<div role="presentation" class="{parent.baseCls}-column-header-inner">{.:this.firstInitial}</div>',
- '</th>',
- '</tpl>',
- '</tr>',
- '</thead>',
- '<tbody>',
- '<tr role="row">',
- '<tpl for="days">',
- '{#:this.isEndOfWeek}',
- '<td role="gridcell">',
- '<div hidefocus="on" class="{parent.baseCls}-date"></div>',
- '</td>',
- '</tpl>',
- '</tr>',
- '</tbody>',
- '</table>',
- '<tpl if="showToday">',
- '<div id="{id}-footerEl" data-ref="footerEl" role="presentation" class="{baseCls}-footer">{%this.renderTodayBtn(values, out)%}</div>',
- '</tpl>',
- // These elements are used with Assistive Technologies such as screen readers
- '<div id="{id}-todayText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{todayText}.</div>',
- '<div id="{id}-ariaMinText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMinText}.</div>',
- '<div id="{id}-ariaMaxText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaMaxText}.</div>',
- '<div id="{id}-ariaDisabledDaysText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDaysText}.</div>',
- '<div id="{id}-ariaDisabledDatesText" class="' + Ext.baseCSSPrefix + 'hidden-clip">{ariaDisabledDatesText}.</div>',
- '</div>',
- {
- firstInitial: function (value) {
- return Ext.picker.Date.prototype.getDayInitial(value);
- },
- isEndOfWeek: function (value) {
- // convert from 1 based index to 0 based
- // by decrementing value once.
- value--;
- // eslint-disable-next-line vars-on-top
- var end = value % 7 === 0 && value !== 0;
- return end ? '</tr><tr role="row">' : '';
- },
- renderTodayBtn: function (values, out) {
- Ext.DomHelper.generateMarkup(values.$comp.todayBtn.getRenderTree(), out);
- },
- renderMonthBtn: function (values, out) {
- Ext.DomHelper.generateMarkup(values.$comp.monthBtn.getRenderTree(), out);
- }
- }
- ],
- beforeRender: function () {
- var me = this, today = Ext.Date.format(syncDate(new Date()), me.format);
- this.superclass.beforeRender.call(this);
- function handleInput(extHandle, $input) {
- var $dom = $(extHandle.el.dom);
- // const $up = $dom.find('.x-form-spinner-up')
- // const $down = $dom.find('.x-form-spinner-down')
- // debugger
- // $up.on('mousedown', () => {
- // debugger
- // });
- // $up.on('click', () => {
- // debugger
- // });
- extHandle.on('click', function (sender) {
- var hideBak = me.hide;
- me.hide = Ext.emptyFn;
- extHandle.focus();
- me.hide = hideBak;
- });
- var changeValue = function (delta) {
- if (_$2.trim(extHandle.getValue()) === '') {
- extHandle.setValue(extHandle.minValue);
- }
- else {
- var v = parseInt('' + extHandle.getValue());
- if (v + delta > extHandle.maxValue) {
- extHandle.setValue(extHandle.minValue);
- }
- else if (v + delta < extHandle.minValue) {
- extHandle.setValue(extHandle.maxValue);
- }
- else {
- extHandle.setValue(v + delta);
- }
- }
- };
- $input.on('mousewheel', function (e) {
- e.stopPropagation();
- var event = e.originalEvent;
- var eventDelta = event.wheelDelta || -event.deltaY + 40;
- // if (event.wheelDelta) {
- // delta = event.wheelDelta / 120;
- // } else if (event.detail) {
- // delta = -event.detail / 3;
- // }
- var zoomSize = Math.ceil(eventDelta / 120);
- changeValue(zoomSize);
- // console.log('delta', delta)
- // $input.focus()
- });
- }
- me.input1 = Ext.create('Ext.form.field.Number', {
- minValue: 0,
- maxValue: 23,
- flex: 1,
- enableKeyEvents: true,
- fieldLabel: '时',
- labelWidth: 20,
- hideLabel: true,
- spinDownEnabled: false,
- spinUpEnabled: false,
- style: {
- marginLeft: '5px',
- },
- listeners: {
- afterrender: function (sender) {
- var $input = $(sender.inputEl.dom);
- handleInput(me.input1, $input);
- },
- change: function (sender, e) {
- if (me.getValue()) {
- me.value.setHours(sender.getValue());
- }
- },
- }
- });
- me.input2 = Ext.create('Ext.form.field.Number', {
- minValue: 0,
- maxValue: 59,
- flex: 1,
- enableKeyEvents: true,
- fieldLabel: ' ',
- hideLabel: false,
- labelWidth: 8,
- spinDownEnabled: false,
- spinUpEnabled: false,
- listeners: {
- afterrender: function (sender) {
- var $input = $(sender.inputEl.dom);
- handleInput(me.input2, $input);
- },
- change: function (sender, e) {
- if (me.getValue()) {
- me.value.setMinutes(sender.getValue());
- }
- },
- }
- });
- me.input3 = Ext.create('Ext.form.field.Number', {
- minValue: 0,
- maxValue: 59,
- flex: 1,
- enableKeyEvents: true,
- fieldLabel: ' ',
- hideLabel: false,
- labelWidth: 8,
- spinDownEnabled: false,
- spinUpEnabled: false,
- style: {
- marginRight: '5px',
- },
- listeners: {
- afterrender: function (sender) {
- var $input = $(sender.inputEl.dom);
- handleInput(me.input3, $input);
- },
- change: function (sender, e) {
- if (me.getValue()) {
- me.value.setSeconds(sender.getValue());
- }
- },
- }
- });
- me.confirmBtn = new Ext.button.Button({
- text: '确认',
- handler: me.confirmClick,
- scope: me
- });
- me.tdBtn = new Ext.button.Button({
- text: '现在',
- handler: me.selectToday,
- scope: me
- });
- me.todayBtn = Ext.create('Ext.container.Container', {
- layout: 'anchor', border: false,
- defaults: {
- border: false, anchor: '100%',
- margin: '0 0 5 0',
- },
- items: [
- {
- layout: 'hbox',
- items: [
- me.input1,
- me.input2,
- me.input3,
- ]
- },
- {
- layout: 'hbox',
- items: [
- me.confirmBtn,
- me.tdBtn,
- ]
- }
- ]
- });
- },
- // finishRenderChildren() {
- // var me = this;
- //
- // this.superclass.finishRenderChildren.call(this);
- // //*
- // me.input1.finishRender();
- // me.input2.finishRender();
- // me.input3.finishRender();
- // //
- // me.tdBtn.finishRender();
- // me.confirmBtn.finishRender();
- // },
- setValue: function (value) {
- //this.value = Ext.Date.clearTime(value, true);
- this.value = value;
- this.input1.setValue(this.value.getHours());
- this.input2.setValue(this.value.getMinutes());
- this.input3.setValue(this.value.getSeconds());
- return this.update(this.value);
- },
- selectDate: function (value) {
- if (this.showTime) {
- value.setHours(this.input1.getValue());
- value.setMinutes(this.input2.getValue());
- value.setSeconds(this.input3.getValue());
- }
- this.value = value;
- return this.update(this.value);
- },
- setDisabledStatus: function (disabled) {
- var me = this;
- debugger;
- // me.callParent();
- if (me.showTime) {
- me.confirmBtn.setDisabled(disabled);
- }
- if (me.isShowFooter()) {
- me.footerContainer.setDisabled(disabled);
- }
- },
- handleDateClick: function (e, t) {
- var me = this, handler = me.handler;
- // e.stopEvent();
- if (!me.disabled && t.dateValue && !Ext.fly(t.parentNode).hasCls(me.disabledCellCls)) {
- me.doCancelFocus = me.focusOnSelect === false;
- me.selectDate(new Date(t.dateValue));
- delete me.doCancelFocus;
- /* 有时间输入时单击事件不退出选择,只移动光标 */
- if (me.showTime) {
- return;
- }
- me.fireEvent('select', me, me.value);
- if (handler) {
- handler.call(me.scope || me, me, me.value);
- }
- me.onSelect();
- }
- },
- selectToday: function () {
- var me = this, btn = me.todayBtn, handler = me.handler;
- if (btn && !btn.disabled) {
- me.value = syncDate(new Date());
- me.update(me.value);
- me.fireEvent('select', me, me.value);
- if (handler) {
- handler.call(me.scope || me, me, me.value);
- }
- me.onSelect();
- me.hide();
- }
- return me;
- },
- confirmClick: function () {
- var me = this, btn = me.confirmBtn, handler = me.handler;
- if (btn && !btn.disabled) {
- me.fireEvent('select', me, me.value);
- if (handler) {
- handler.call(me.scope || me, me, me.value);
- }
- me.onSelect();
- me.hide();
- }
- return me;
- },
- selectedUpdate: function (date) {
- var me = this,
- //t = date.getTime(),
- t = Ext.Date.clearTime(date, true).getTime(), cells = me.cells, cls = me.selectedCls, cellItems = cells.elements, c, cLen = cellItems.length, cell;
- cells.removeCls(cls);
- for (c = 0; c < cLen; c++) {
- cell = Ext.fly(cellItems[c]);
- if (cell.dom.firstChild.dateValue == t) {
- me.fireEvent('highlightitem', me, cell);
- cell.addCls(cls);
- if (me.isVisible() && !me.doCancelFocus) {
- Ext.fly(cell.dom.firstChild).focus(50);
- }
- break;
- }
- }
- },
- // private, inherit docs
- beforeDestroy: function () {
- var me = this;
- if (me.rendered) {
- Ext.destroy(me.input1, me.input2, me.input3, me.confirmBtn, me.tdBtn, me.todayBtn);
- }
- me.superclass.beforeDestroy.call(this);
- }
- });
- }
- function initDateTime () {
- Ext.define('Yvan.DateTimeField', {
- extend: 'Ext.form.field.Date',
- xtype: 'datetimefield',
- alternateClassName: ['Ext.form.DateTimeField', 'Ext.form.DateTime'],
- triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
- showTime: true,
- format: "Y-m-d H:i:s",
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制属性
- }, baseConfig(config, 'col-item'), config, date);
- this.superclass.constructor.call(this, newConfig);
- },
- initComponent: function () {
- this.superclass.initComponent.call(this);
- var setInitValue = function () {
- var value = this.getRawValue();
- if (!value) {
- // 没填内容的时候,自动设置当前时间
- this.setValue(Ext.util.Format.date(syncDate(new Date()), this.format));
- }
- };
- this.on({
- afterrender: function () {
- var config = this.config;
- // 日期框,不要默认弹出
- $(this.el.dom).on('click', setInitValue.bind(this));
- },
- destory: function () {
- // 日期框,不要默认弹出
- $(this.el.dom).off('click', setInitValue.bind(this));
- },
- change: {
- fn: function (sender) {
- if (sender.format === "Y-m-d H:i:s") {
- // 年月日格式
- var value = sender.getRawValue();
- if (/^\d{14}$/.test(value)) {
- // 8位数字,自动转换为 YYYY-MM-DD
- var newValue = [
- value.substr(0, 4),
- '-',
- value.substr(4, 2),
- '-',
- value.substr(6, 2),
- ' ',
- value.substr(8, 2),
- ':',
- value.substr(10, 2),
- ':',
- value.substr(12, 2)
- ].join('');
- sender.setValue(newValue);
- }
- }
- },
- }
- });
- },
- getValue: function () {
- var ov = this.getRawValue(); //this.superclass.getValue.call(this)
- var nv = Ext.util.Format.date(ov, 'Y-m-d H:i:s');
- // console.log('cc:', nv, ov)
- return nv;
- },
- onExpand: function () {
- var strValue = this.getValue();
- var value;
- if (/^\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d$/.test(strValue)) {
- 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)));
- }
- else if (/^\d\d\d\d-\d\d-\d\d$/.test(strValue)) {
- value = new Date(parseInt(strValue.substr(0, 4)), parseInt(strValue.substr(5, 2)) - 1, parseInt(strValue.substr(8, 2)));
- }
- else {
- value = syncDate(new Date());
- }
- this.picker.setValue(value);
- },
- createPicker: function () {
- var me = this, format = Ext.String.format;
- //@ts-ignore
- return new Yvan.DateTimePicker({
- pickerField: me,
- ownerCt: me.ownerCt,
- renderTo: document.body,
- floating: true,
- hidden: true,
- focusOnShow: true,
- minDate: me.minValue,
- maxDate: me.maxValue,
- disabledDatesRE: me.disabledDatesRE,
- disabledDatesText: me.disabledDatesText,
- disabledDays: me.disabledDays,
- disabledDaysText: me.disabledDaysText,
- format: me.format,
- showToday: me.showToday,
- showTime: me.showTime,
- startDay: me.startDay,
- minText: format(me.minText, me.formatDate(me.minValue)),
- maxText: format(me.maxText, me.formatDate(me.maxValue)),
- listeners: {
- scope: me,
- select: me.onSelect
- },
- keyNavConfig: {
- esc: function () {
- me.collapse();
- }
- }
- });
- },
- });
- }
- function initNumber () {
- var cc = Ext.form.field.Number.prototype.constructor;
- var initComponent = Ext.form.field.Number.prototype.initComponent;
- Ext.form.field.Number.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制属性
- }, baseConfig(config, 'col-item'), config, numberfield);
- cc.call(this, newConfig);
- },
- initComponent: function () {
- this.on({
- afterrender: function (sender) {
- var _this = this;
- var _a;
- if ((_a = sender.inputEl) === null || _a === void 0 ? void 0 : _a.dom) {
- sender.inputEl.dom.setAttribute('spellcheck', "false");
- $$2(sender.inputEl.dom).on('click', function (e) {
- sender.fireEvent('click', _this, e);
- });
- }
- }
- });
- initComponent.call(this);
- },
- });
- }
- function initCheckbox () {
- var cc = Ext.form.field.Checkbox.prototype.constructor;
- var _a = Ext.form.field.Checkbox.prototype, initComponent = _a.initComponent, getValue = _a.getValue, setValue = _a.setValue;
- Ext.form.field.Checkbox.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制属性
- }, baseConfig(config, 'col-item'), config, checkbox);
- cc.call(this, newConfig);
- },
- getValue: function () {
- var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
- var ov = getValue.call(this);
- // const ov = this.getRawValue()
- return (ov ? checkedValue : uncheckedValue);
- },
- setValue: function (nv) {
- var _a = this, checkedValue = _a.checkedValue, uncheckedValue = _a.uncheckedValue;
- var value;
- if (nv === checkedValue) {
- value = true;
- }
- else if (nv === uncheckedValue) {
- value = false;
- }
- else {
- value = !!nv;
- }
- // me.setRawValue(value)
- // me.checked = value
- // return me.mixins.field.setValue.call(me, value);
- setValue.call(this, value);
- },
- updateCheckedCls: function (checked) {
- var me = this;
- var _a = this, uncheckedValue = _a.uncheckedValue, checkedValue = _a.checkedValue;
- checked = checked != null ? checked : me.getValue();
- if (checked === uncheckedValue) {
- checked = false;
- }
- else if (checked === checkedValue) {
- checked = true;
- }
- me[checked ? 'addCls' : 'removeCls'](me.checkedCls);
- },
- initComponent: function () {
- initComponent.call(this);
- },
- });
- }
- function initCheckboxGroup () {
- var cc = Ext.form.CheckboxGroup.prototype.constructor;
- var initComponent = Ext.form.CheckboxGroup.prototype.initComponent;
- Ext.form.CheckboxGroup.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制属性
- }, baseConfig(config, 'col-item'), config, checkboxgroup);
- cc.call(this, newConfig);
- },
- initComponent: function () {
- initComponent.call(this);
- },
- });
- }
- function initRadio () {
- var cc = Ext.form.field.Radio.prototype.constructor;
- var initComponent = Ext.form.field.Radio.prototype.initComponent;
- Ext.form.field.Radio.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制属性
- }, baseConfig(config, 'col-item'), config, radio);
- cc.call(this, newConfig);
- },
- initComponent: function () {
- initComponent.call(this);
- },
- });
- }
- function initRadioGroup () {
- var cc = Ext.form.RadioGroup.prototype.constructor;
- var initComponent = Ext.form.RadioGroup.prototype.initComponent;
- Ext.form.RadioGroup.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({
- // 强制属性
- }, baseConfig(config, 'col-item'), config, radiogroup);
- cc.call(this, newConfig);
- },
- initComponent: function () {
- initComponent.call(this);
- },
- });
- }
- function initFieldset () {
- /**
- *
- */
- var ct = Ext.form.FieldSet.prototype.constructor;
- Ext.form.FieldSet.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "rows-container"), fieldSet);
- ct.call(this, newConfig);
- }
- });
- }
- function initCombotree () {
- Ext.define('Yvan.ComboTree', {
- extend: 'Ext.form.field.Picker',
- xtype: 'combotree',
- triggerCls: Ext.baseCSSPrefix + 'form-arrow-trigger',
- config: {
- store: null,
- displayField: null,
- columns: null,
- selectOnTab: true,
- maxPickerHeight: 300,
- minPickerHeight: 100,
- minPickerWidth: 350,
- rootVisible: true,
- },
- editable: false,
- setStore: function (store) {
- this.store = store;
- var me = this;
- if (me.store) {
- if (me.picker) {
- me.picker.setStore(store);
- if (me.isExpanded) {
- me.collapse();
- delete me.picker;
- me.expand();
- }
- }
- this.onLoad();
- me.mon(me.store, {
- scope: me,
- load: me.onLoad,
- update: me.onUpdate
- });
- }
- },
- createPicker: function () {
- var me = this;
- var picker = new Ext.tree.Panel({
- border: false,
- baseCls: Ext.baseCSSPrefix + 'boundlist',
- shrinkWrapDock: 2,
- store: me.store,
- floating: true,
- rootVisible: me.rootVisible,
- displayField: me.displayField,
- columns: me.columns,
- minHeight: me.minPickerHeight,
- maxHeight: me.maxPickerHeight,
- minWidth: me.minPickerWidth,
- manageHeight: false,
- shadow: false,
- scrollable: true,
- // modal: true,
- // constrain: true,
- // constrainTo: topScope._handle.el.dom,
- // renderTo: topScope._handle.el.dom,
- // alignTarget: topScope._handle,
- listeners: {
- scope: me,
- itemclick: me.onItemClick,
- itemkeydown: me.onPickerKeyDown
- }
- }), view = picker.getView();
- if (Ext.isIE9 && Ext.isStrict) {
- view.on({
- scope: me,
- highlightitem: me.repaintPickerView,
- unhighlightitem: me.repaintPickerView,
- afteritemexpand: me.repaintPickerView,
- afteritemcollapse: me.repaintPickerView
- });
- }
- return picker;
- },
- repaintPickerView: function () {
- var style = this.picker.getView().getEl().dom.style;
- style.display = style.display;
- },
- onItemClick: function (view, record, node, rowIndex, e) {
- this.selectItem(view, record);
- },
- onPickerKeyDown: function (treeView, record, item, index, e) {
- var key = e.getKey();
- if (key === e.ENTER || (key === e.TAB && this.selectOnTab)) {
- this.selectItem(treeView, record);
- }
- },
- selectItem: function (sender, record) {
- var me = this;
- me.setValue(record.getId());
- me.fireEvent('select', me, record);
- me.collapse();
- },
- onExpand: function () {
- var picker = this.picker;
- var store = picker.store;
- var value = this.value;
- var node;
- if (value) {
- node = store.getNodeById(value);
- }
- if (!node) {
- node = store.getRoot();
- }
- picker.ensureVisible(node, {
- select: true,
- focus: true
- });
- },
- setValue: function (value) {
- var me = this;
- console.log('setValue', value);
- me.value = value;
- if (!me.store || me.store.loading) {
- // Called while the Store is loading. Ensure it is processed by the onLoad method.
- return me.mixins.field.setValue.call(me, value);
- // return me;
- }
- var record = value ? me.store.getNodeById(value) : me.store.getRoot();
- if (value === undefined) {
- record = me.store.getRoot();
- console.log('setValue', record.getId());
- me.value = record.getId();
- return me.mixins.field.setValue.call(me, value);
- }
- else {
- record = me.store.getNodeById(value);
- }
- // set the raw value to the record's display field if a record was found
- me.setRawValue(record ? record.get(me.displayField) : '');
- return me.mixins.field.setValue.call(me, value);
- },
- getSubmitValue: function () {
- return this.value;
- },
- getValue: function () {
- return this.value;
- },
- onLoad: function () {
- var value = this.value;
- if (value) {
- this.setValue(value);
- }
- },
- onUpdate: function (store, rec, type, modifiedFieldNames) {
- var display = this.displayField;
- var me = this;
- if (type === 'edit' && modifiedFieldNames &&
- Ext.Array.contains(modifiedFieldNames, display) &&
- this.value === rec.getId()) {
- me.mixins.field.setValue.call(me, this.value);
- this.setRawValue(rec.get(display));
- }
- }
- });
- }
- function initPickerPlus () {
- Ext.define('Yvan.PickerAlignCenter', {
- extend: 'Ext.form.field.Picker',
- /**
- * Performs the alignment on the picker using the class defaults
- * @private
- */
- doAlign: function () {
- // 不要挪动就好
- },
- });
- }
- function initCombogrid () {
- Ext.define('Yvan.ComboGrid', {
- extend: 'Ext.form.field.Picker',
- // extend: 'Yvan.PickerAlignCenter',
- xtype: 'combogrid',
- triggerCls: Ext.baseCSSPrefix + 'form-search-trigger',
- triggers: {
- clear: {
- weight: 0,
- cls: Ext.baseCSSPrefix + 'form-clear-trigger',
- hidden: true,
- handler: 'onClearClick',
- },
- },
- config: __assign({}, comboGrid),
- editable: true,
- _superBlur: false,
- allowCustomInput: false,
- pressEnterPopup: true,
- initComponent: function () {
- var that = this;
- var scope = lookupScope(that);
- var config = that.config;
- if (isDesignMode(scope, config)) {
- this.superclass.initComponent.call(this, arguments);
- return;
- }
- this.on({
- blur: function (sender, e) {
- if (this._superBlur) {
- // 挂起时不恢复内容
- return;
- }
- // 离开焦点时,恢复原来的值
- sender.setRawValue(sender.value);
- },
- afterrender: function (sender) {
- var $dom = $(sender.inputEl.dom);
- that.scope = lookupScope(sender);
- if (sender.column) {
- // 列模式,拦截 keydown
- $dom.on('keydown', function (e) {
- if (isChartEvent(e) && !that.tryEnable()) {
- // 没有达成 editEnable 条件,不用响应
- stopEvent(e);
- return;
- }
- if (that.pressEnterPopup !== false && e.key === 'Enter') {
- stopEvent(e);
- that.onTriggerClick(that, that.getPickerTrigger(), e);
- return;
- }
- });
- }
- else {
- // 常规模式,拦截 keyup
- $dom.on('keyup', function (e) {
- if (e.key === 'Escape' || e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
- return;
- }
- if (isChartEvent(e) && !that.tryEnable()) {
- // 没有达成 editEnable 条件,不用响应
- stopEvent(e);
- return;
- }
- if (that.pressEnterPopup !== false && e.key === 'Enter') {
- stopEvent(e);
- that.onTriggerClick(that, that.getPickerTrigger(), e);
- return;
- }
- if (!that.allowCustomInput) {
- // 取消 keyup 事件,让 ext 不要吧当前输入的值记录到 value 中
- stopEvent(e);
- }
- });
- $dom.on('change', function (e) {
- // 这里注释掉,是因为 当鼠标点击触发弹出后,会导致取"e.target.value"值无效
- // if (that.isExpanded) {
- // that.filterChange(that, e.target.value)
- // }
- stopEvent(e);
- });
- }
- $dom.on('input', function (e) {
- stopEvent(e);
- });
- },
- });
- this.superclass.initComponent.apply(this, arguments);
- },
- createPicker: function () {
- var me = this;
- var cfg = {
- layout: 'fit',
- border: 0,
- // border: 5,
- style: {
- // borderColor: 'black',
- // borderWidth: '5px',
- // borderStyle: 'solid',
- boxShadow: '0px 2px 5px rgba(0,0,0,.5)'
- },
- shadow: 'side',
- shadowOffset: 100,
- baseCls: Ext.baseCSSPrefix + 'boundlist',
- shrinkWrapDock: 2,
- floating: true,
- width: me.pickerWidth,
- height: me.pickerHeight,
- minWidth: me.pickerWidth,
- minHeight: me.pickerHeight,
- maxWidth: me.pickerWidth,
- maxHeight: me.pickerHeight,
- items: [
- __assign(__assign(__assign({}, comboGridPicker), me.grid), { tbar: {
- xtype: 'toolbar',
- items: [
- { xtype: 'textfield', fieldLabel: '筛选' },
- {
- xtype: 'button',
- text: '查询',
- iconCls: 'x-fa fa-search',
- cssType: 'primary',
- listeners: {
- click: function () {
- me.reloadGrid();
- }
- }
- },
- ]
- }, autoLoad: false, listeners: {
- afterrender: function (grid) {
- me.grid = grid;
- grid.focus();
- grid.on({
- rowdblclick: function (sender, row) {
- me.selectItem(row);
- },
- dataLoadComplete: function (sender) {
- _$2.defer(function () {
- me.setFocus();
- });
- },
- keydown: function (sender, e) {
- if (me.column) {
- // 列模式,拦截 keydown
- me.processKey(e);
- }
- },
- keyup: function (sender, e) {
- if (!me.column) {
- // 常规模式,拦截 keyup
- me.processKey(e);
- }
- }
- });
- },
- } })
- ]
- };
- // @ts-ignore
- var picker = new Ext.container.Container(cfg);
- return picker;
- },
- setFocus: function () {
- if (this.grid.store.getCount() > 0) {
- this.grid.focusRow(0);
- }
- },
- processKey: function (e) {
- if (this.pressEnterPopup !== false && e.key === 'Enter') {
- this.selectItem(this.grid.selection);
- stopEvent(e);
- }
- else if (e.key === 'Escape') {
- this.collapse();
- }
- },
- repaintPickerView: function () {
- var style = this.picker.getView().getEl().dom.style;
- style.display = style.display;
- },
- onItemClick: function (view, record, node, rowIndex, e) {
- this.selectItem(record);
- },
- onPickerKeyDown: function (treeView, record, item, index, e) {
- var key = e.getKey();
- if ((this.pressEnterPopup !== false && key === e.ENTER) || (key === e.TAB && this.selectOnTab)) {
- this.selectItem(record);
- }
- },
- filterChange: _$2.debounce(function (sender, value) {
- sender.onExpand();
- }, 1000),
- selectItem: function (record) {
- var me = this;
- var lookup = this.lookup;
- var scope = lookupScope(this);
- me.fireEvent('select', me, record);
- if (record.isModel) {
- record = record.data;
- }
- tryWriteObject(lookup, record, function (path, value) {
- me._lookupSet(path, value);
- });
- // lookup
- // fromColumn: 'toTarget'
- // fromColumn: 'toTarget'
- // fromColumn: 'toTarget'
- _$2.forOwn(lookup, function (toTarget, fromColumn) {
- var value = _$2.get(record, fromColumn);
- me._lookupSet(toTarget, value);
- });
- // 选定之后不能做清空
- // const {lookupClearOnChange} = me
- // if (_.isArray(lookupClearOnChange)) {
- // _.each(lookupClearOnChange, item => {
- // me._lookupSet(item, '')
- // })
- // }
- me.collapse();
- // 触发 _raiseNextFocus
- me._raiseNextFocus(me);
- },
- onExpand: function () {
- // 展开时,根据 lookup 带入查询参数
- var expressData = this.getExpressData();
- var txtField = this.grid.down('toolbar').down('textfield');
- txtField.setValue(expressData.queryValue);
- this.reloadGrid();
- },
- reloadGrid: function () {
- // 展开时,根据 lookup 带入查询参数
- var expressData = this.getExpressData();
- var reloadParam = calcObjectFlat(expressData, this.param) || {};
- var txtField = this.grid.down('toolbar').down('textfield');
- // 每个 combogrid 默认带上 __queryValue 属性
- reloadParam["__queryValue"] = txtField.getValue();
- this.grid.reload(reloadParam);
- },
- onTriggerClick: function (sender) {
- var _a = this, isExpanded = _a.isExpanded, readOnly = _a.readOnly, disabled = _a.disabled, grid = _a.grid;
- if (!grid) {
- msg('正在初始化,请稍后');
- return;
- }
- if (!this.tryEnable()) {
- // 没有达成 editEnable 条件,不用弹出
- return;
- }
- if (isExpanded || readOnly || disabled) {
- // 已弹出、只读、禁用状态下,不允许弹出
- return;
- }
- this._superBlur = true;
- this.superclass.onTriggerClick.apply(this, arguments);
- this._superBlur = false;
- },
- onCollapse: function () {
- // 每次收回时,删除下拉组件
- // delete this.picker
- },
- /**
- * 本方法只会从 API 或外部调用,键盘输入的内容不会记录在内
- */
- setValue: function (value) {
- var me = this;
- // 设值用户看到的表面内容
- this.setRawValue(value);
- // 设值 setValue 调用链,正常触发 change 事件等
- return me.mixins.field.setValue.call(me, value);
- },
- _lookupSet: function (path, value) {
- var me = this;
- path = tryVarSimple(path);
- if (me.column) {
- // 判断写入目标,是否与自己绑定的属性相等
- if (path === 'queryValue' || me.column.dataIndex === path) {
- me.setValue(value);
- }
- // 列模式下,写当前编辑行
- var parentRecord = me._lookupEditorRecord();
- if (parentRecord) {
- // Ext.data.Record / Ext.data.Model
- parentRecord.set(path, value);
- }
- else {
- debugger;
- }
- }
- else {
- // 常规模式下,写 viewModel
- me.scope.viewModel.set(path, value);
- }
- },
- _lookupGrid: function () {
- return this.column.up('grid');
- },
- _lookupEditorRecord: function () {
- var _a, _b, _c, _d;
- // parentGrid.getSelectionModel().getLastSelected()
- var grid = this._lookupGrid();
- var editingPlugin = (_a = grid.editingPlugin) !== null && _a !== void 0 ? _a : (_b = grid.ownerGrid) === null || _b === void 0 ? void 0 : _b.editingPlugin;
- if (!editingPlugin) {
- return grid.getSelectionModel().getLastSelected();
- }
- var rowIdx = (_d = (_c = editingPlugin.activeEditor) === null || _c === void 0 ? void 0 : _c.context) === null || _d === void 0 ? void 0 : _d.rowIdx;
- if (_$2.isNumber(rowIdx)) {
- return grid.store.getAt(rowIdx);
- }
- else {
- return grid.getSelectionModel().getLastSelected();
- }
- },
- onChange: function (newVal, oldVal) {
- var me = this;
- var value = newVal;
- var hideTrigger = me.hideTrigger, disabled = me.disabled, readOnly = me.readOnly, hideClear = me.hideClear;
- if (hideTrigger || disabled || readOnly || hideClear) {
- // 禁用、隐藏、只读、隐藏清空状态下,不需要显示清空按钮
- return;
- }
- if (value) {
- me.getTrigger('clear').show();
- me.updateLayout();
- }
- else {
- me.getTrigger('clear').hide();
- me.updateLayout();
- }
- },
- /**
- * 得到能用于 express 表达式计算的上下文数据
- */
- getExpressData: function () {
- var queryValue = this.getRawValue();
- if (!queryValue) {
- // 父 combogrid 输入的内容为空的情况下,看看弹出框内部的输入框
- queryValue = this.getPicker().down('textfield').getRawValue();
- }
- if (this.column) {
- // 列模式, 准备好判断 editEnable 表达式用的数据
- var parentRecord = this._lookupEditorRecord();
- if (!parentRecord) {
- debugger;
- }
- return __assign(__assign(__assign({}, this.scope.viewModel.data), parentRecord.data), { queryValue: queryValue });
- }
- else {
- // 编辑模式,准备好判断用的数据
- return __assign(__assign({}, this.scope.viewModel.data), { queryValue: queryValue });
- }
- },
- tryEnable: function () {
- return tryEnable(this.getExpressData(), this.editEnable);
- },
- /**
- * 清空所有值
- */
- onClearClick: function (sender, e) {
- var me = this;
- var lookup = me.lookup, lookupClearOnChange = me.lookupClearOnChange;
- me.fireEvent('clear', sender, e);
- me.setValue('');
- _$2.forOwn(lookup, function (toTarget, fromColumn) {
- me._lookupSet(toTarget, '');
- });
- _$2.each(lookupClearOnChange, function (item) {
- me._lookupSet(item, '');
- });
- }
- });
- }
- function initContainer () {
- var cc = Ext.container.Container.prototype.constructor;
- //const {initComponent} = Ext.container.Container.prototype
- Ext.container.Container.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({}, baseConfig(config, 'col-item'), config);
- cc.call(this, newConfig);
- },
- });
- }
- function initRows () {
- Ext.define('Yvan.Rows', {
- extend: 'Ext.container.Container',
- xtype: 'rows',
- constructor: function (config) {
- var self = this;
- var newConfig = _$2.defaultsDeep({
- // 强制性属性
- layout: 'anchor', border: false,
- defaults: {
- border: false, anchor: '100%',
- margin: '0 0 5 0',
- },
- }, baseConfig(config, 'rows-container'), config, rows);
- this.superclass.constructor.call(self, newConfig);
- },
- });
- }
- function initForm () {
- var ct = Ext.form.Panel.prototype.constructor;
- Ext.form.Panel.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "cols-container"), form);
- ct.call(this, newConfig);
- }
- });
- }
- function initCols () {
- Ext.define('Yvan.Cols', {
- extend: 'Ext.container.Container',
- xtype: 'cols',
- constructor: function (config) {
- var self = this;
- var newConfig = _$2.defaultsDeep({
- // 强制性属性
- layout: 'hbox',
- minHeight: config.designMode ? 32 : 0
- }, baseConfig(config, 'cols-container'), config, cols);
- this.superclass.constructor.call(self, newConfig);
- },
- });
- }
- function initButton () {
- /**
- *
- */
- var ct = Ext.button.Button.prototype.constructor;
- Ext.button.Button.override({
- constructor: function (config) {
- var newConfig = _$2.defaultsDeep({}, config, baseConfig(config, "col-item"), button);
- ct.call(this, newConfig);
- },
- setLoading: function (value) {
- if (value) {
- if (this.iconCls !== 'x-fa fa-spinner fa-spin fa-fw') {
- this._originIconCls = this.iconCls;
- }
- this.setIconCls('x-fa fa-spinner fa-spin fa-fw');
- this.setDisabled(true);
- }
- else {
- this.setIconCls(this._originIconCls);
- this.setDisabled(false);
- }
- }
- });
- }
- function initIframe () {
- Ext.define('Ext.ux.IFrame', {
- extend: 'Ext.Component',
- alias: 'widget.uxiframe',
- loadMask: 'Loading...',
- src: 'about:blank',
- renderTpl: [
- '<iframe src="{src}" id="{id}-iframeEl" data-ref="iframeEl" name="{frameName}" width="100%" height="100%" frameborder="0"></iframe>'
- ],
- childEls: ['iframeEl'],
- initComponent: function () {
- this.superclass.initComponent.call(this);
- this.superclass.initEvents.call(this);
- this.frameName = this.frameName || this.id + '-frame';
- },
- initEvents: function () {
- var me = this;
- this.superclass.initEvents.call(this);
- me.iframeEl.on('load', me.onLoad, me);
- },
- initRenderData: function () {
- return Ext.apply(this.superclass.initRenderData.call(this), {
- src: this.src,
- frameName: this.frameName
- });
- },
- getBody: function () {
- var doc = this.getDoc();
- return doc.body || doc.documentElement;
- },
- getDoc: function () {
- try {
- return this.getWin().document;
- }
- catch (ex) {
- return null;
- }
- },
- getWin: function () {
- var me = this, name = me.frameName, win = Ext.isIE ? me.iframeEl.dom.contentWindow : window.frames[name];
- return win;
- },
- getFrame: function () {
- var me = this;
- return me.iframeEl.dom;
- },
- onLoad: function () {
- var me = this, doc = me.getDoc();
- if (doc) {
- this.el.unmask();
- this.fireEvent('load', this);
- }
- else if (me.src) {
- this.el.unmask();
- this.fireEvent('error', this);
- }
- },
- load: function (src) {
- var me = this, text = me.loadMask, frame = me.getFrame();
- if (me.fireEvent('beforeload', me, src) !== false) {
- if (text && me.el) {
- me.el.mask(text);
- }
- frame.src = me.src = (src || me.src);
- }
- }
- });
- }
- /**
- * 属性:
- * - autoLoad: true
- * - dataSource: ''
- * 方法:
- * - handleZoomBig
- * - handleZoomSmall
- * - handleZoomReset
- * - openDiagram
- * - getBpmn
- * - getBpmnCanvas
- * - getBpmnOverlays
- * - getBpmnZoomScroll
- * 事件:
- * - initFinish
- * - failed
- * - success
- * - itemHover
- * - itemOut
- * - itemClick
- * - itemDblclick
- * - itemMousedown
- * - itemMouseup
- */
- function initBpmn () {
- Ext.define('Yvan.Bpmn', {
- // extend: 'Ext.container.Container',
- extend: 'Ext.panel.Panel',
- alias: 'widget.bpmn',
- xtype: 'bpmn',
- constructor: function (config) {
- var self = this;
- var newConfig = _$2.defaultsDeep({
- // 强制性属性
- }, baseConfig(config, 'row-item'), config, bpmn);
- if (!newConfig.hideToolbar) {
- newConfig.tbar = [];
- newConfig.tbar.push({
- xtype: 'button', iconCls: 'x-fa fa-refresh', tooltip: '刷新',
- listeners: {
- click: function (sender) {
- self.reload();
- }
- }
- });
- newConfig.tbar.push({
- xtype: 'button', tooltip: "放大", iconCls: "x-fa fa-search-plus",
- listeners: {
- click: function (sender) {
- self.handleZoomBig();
- }
- },
- });
- newConfig.tbar.push({
- xtype: 'button', tooltip: "缩小", iconCls: "x-fa fa-search-minus",
- listeners: {
- click: function (sender) {
- self.handleZoomSmall();
- }
- },
- });
- newConfig.tbar.push({
- xtype: 'button', tooltip: "还原", iconCls: "x-fa fa-reply",
- listeners: {
- click: function (sender) {
- self.handleZoomReset();
- }
- },
- });
- }
- this.superclass.constructor.call(self, newConfig);
- },
- initComponent: function () {
- var _this = this;
- var me = this;
- var config = me.config;
- var scope = lookupScope(this);
- if (!isDesignMode(scope, config)) {
- //@ts-ignore
- require(['bpmn-modeler', 'bpmn-navigated', 'bpmn-viewer'], function (BpModeler, BpNavigated, BpmnViewer) {
- console.log('BpNavigated', me, BpNavigated);
- var dom = me.el.dom;
- var $dom = $(dom);
- var $container = $dom.find('.x-autocontainer-innerCt');
- var bpmn = new BpNavigated(__assign({ container: $container[0] }, config.bpmnConfig));
- _this._bpmn = bpmn;
- if (_this.autoLoad) {
- _this.reload();
- }
- _this.fireEvent('initFinish', _this);
- var eventBus = bpmn.get('eventBus');
- eventBus.on('element.hover', function (e) {
- // this.fireEvent('itemHover', this, e);
- });
- eventBus.on('element.out', function (e) {
- _this.fireEvent('itemOut', _this, e);
- });
- eventBus.on('element.click', function (e) {
- _this.fireEvent('itemClick', _this, e);
- });
- eventBus.on('element.dblclick', function (e) {
- _this.fireEvent('itemDblclick', _this, e);
- });
- eventBus.on('element.mousedown', function (e) {
- _this.fireEvent('itemMousedown', _this, e);
- });
- eventBus.on('element.mouseup', function (e) {
- _this.fireEvent('itemMouseup', _this, e);
- });
- });
- }
- this.superclass.initComponent.call(this);
- this.on({
- afterrender: function (sender) {
- }
- });
- },
- /**
- * 重新载入
- */
- reload: function () {
- var _this = this;
- var _a;
- if (typeof this.dataSource === 'string' && this.dataSource) {
- var scope = lookupScope(this);
- var fn = lookupFn(scope, this.dataSource);
- (_a = fn.call(scope, this)) === null || _a === void 0 ? void 0 : _a.then(function (res) {
- _this.openDiagram(res.data);
- });
- }
- },
- /**
- * 获取bpmn
- */
- getBpmn: function () {
- return this._bpmn;
- },
- getBpmnCanvas: function () {
- var _a;
- return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('canvas');
- },
- getBpmnOverlays: function () {
- var _a;
- return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('overlays');
- },
- getBpmnZoomScroll: function () {
- var _a;
- return (_a = this.getBpmn()) === null || _a === void 0 ? void 0 : _a.get('zoomScroll');
- },
- handleZoomBig: function () {
- var _a;
- (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(1);
- },
- handleZoomSmall: function () {
- var _a;
- (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.stepZoom(-1);
- },
- handleZoomReset: function () {
- var _a;
- (_a = this.getBpmnZoomScroll()) === null || _a === void 0 ? void 0 : _a.reset();
- },
- openDiagram: function (diagram) {
- var _this = this;
- if (!this.getBpmn()) {
- return;
- }
- this.getBpmn().importXML(diagram, function (err) {
- if (err) {
- // YvEventDispatch(this.onFailed, this, undefined);
- _this.fireEvent('failed', _this, err);
- return console.error('could not import BPMN 2.0 diagram', err);
- }
- // zoom to fit full viewport
- _this.getBpmnCanvas().zoom('fit-viewport');
- _this.fireEvent('success', _this);
- });
- },
- });
- }
- function initSqlComplex () {
- Ext.define('Yvan.SqlComplex', {
- extend: 'Ext.panel.Panel',
- xtype: 'sqlcomplex',
- alias: 'widget.sqlcomplex',
- getSqlExpress: function () {
- },
- constructor: function (config) {
- var reference = config.reference;
- var me = this;
- var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
- {
- region: 'west',
- width: 280,
- border: false,
- split: true,
- reference: reference + '_tree',
- xtype: 'yvtree',
- hideRefresh: true,
- hideExpand: true,
- hideCollapse: true,
- listeners: {
- itemdblclick: function (sender, record, item, index, e) {
- var field = record.get('field');
- var defaultValue = record.get('defaultValue');
- if (!field) {
- return;
- }
- var tabExpress = me.down('tabpanel');
- var sqleditor = me.down('sqleditor');
- var expressGrid = me.down('yvgrid');
- if (tabExpress.getActiveTab().key !== 'grid') {
- // SQL 模式
- sqleditor.insertText(field + '=');
- }
- else {
- // 表格模式
- expressGrid.appendEditRow({
- field: field,
- operator: '=',
- value: defaultValue,
- remark: '',
- });
- _$2.defer(function () {
- gridChanged(me, expressGrid);
- });
- }
- }
- },
- },
- {
- region: 'center',
- xtype: 'tabpanel',
- reference: reference + '_tab',
- tabPosition: 'bottom',
- listeners: {
- afterrender: function (sender) {
- var scope = lookupScope(me);
- var value = scope.viewModel.get(me.config.bindValue);
- // sql 转换为 grid
- try {
- var list_1 = parseSqlToGrid(value);
- _$2.defer(function () {
- var grid = me.down('yvgrid');
- grid.setData(list_1);
- });
- }
- catch (e) {
- console.error(e);
- msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
- var tabSql = sender.down('sqleditor');
- sender.setActiveTab(tabSql);
- }
- },
- beforetabchange: function (sender, newCard, oldCard, eOpts) {
- var scope = lookupScope(me);
- var value = scope.viewModel.get(me.config.bindValue);
- if (newCard.key === 'grid') {
- // sql 转换为 grid
- try {
- var list_2 = parseSqlToGrid(value);
- _$2.defer(function () {
- var grid = me.down('yvgrid');
- grid.setData(list_2);
- });
- return true;
- }
- catch (e) {
- msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
- console.error(e);
- return false;
- }
- }
- else if (newCard.key === 'sql') {
- // grid 转换为 sql
- _$2.defer(function () {
- var editor = me.down('sqleditor');
- editor.setValue(value);
- });
- return true;
- }
- }
- },
- items: [
- {
- title: '表格模式',
- key: 'grid',
- xtype: 'yvgrid',
- _mode: 'select',
- reference: reference + '_grid',
- hideFootbar: true,
- pagination: false,
- tbar: [
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- cls: 'ext-btn-danger',
- bind: {
- disabled: '{!' + reference + '_grid.selection}',
- },
- listeners: {
- click: function (sender) {
- var grid = sender.up('yvgrid');
- removeGridRow(grid);
- gridChanged(me, grid);
- }
- },
- },
- ],
- store: {},
- listeners: {
- editfinish: function (sender) {
- gridChanged(me, sender);
- },
- },
- columns: [
- {
- dataIndex: 'field',
- header: '字段', sortable: false, menuDisabled: true,
- width: 190,
- renderer: function (value, context, record, rowIdx, colIdx, store, view) {
- var column = context.column;
- var propertyConfig = me.config.propertyConfig;
- // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
- var field = record.get('field');
- if (field) {
- var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
- if (idx >= 0) {
- var meta = propertyConfig[idx];
- return meta.text;
- }
- }
- return value;
- }
- },
- {
- dataIndex: 'operator',
- header: '运算符', sortable: false, menuDisabled: true,
- dict: 'operator',
- width: 65,
- editor: { xtype: 'combo' },
- },
- {
- dataIndex: 'value',
- header: '值', sortable: false, menuDisabled: true,
- flex: 1,
- getEditor: function (record) {
- var column = this;
- var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
- var propertyConfig = me.config.propertyConfig;
- var field = record.get('field');
- if (!field) {
- // 没有填 propertyName
- return;
- }
- var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
- if (idx < 0) {
- console.error('没有找到 field=' + field + ". propertyConfig");
- return;
- }
- var meta = propertyConfig[idx];
- if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
- return new Ext.grid.CellEditor({
- field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
- });
- }
- return new Ext.grid.CellEditor({
- field: __assign({ dict: meta.dict }, meta.editor)
- });
- },
- renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
- var column = context.column;
- var grid = _$2.get(view, 'ownerGrid');
- var propertyConfig = me.config.propertyConfig;
- // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
- var field = record.get('field');
- if (field) {
- var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
- if (idx >= 0) {
- var meta = propertyConfig[idx];
- var dictName = _$2.get(meta, 'dict');
- if (dictName && window['DICT_CACHE'][dictName]) {
- var dict_1 = window['DICT_CACHE'][dictName];
- var valueText_1 = [];
- _$2.forEach(_$2.split(valueList, ','), function (value) {
- var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
- if (idxKv >= 0) {
- valueText_1.push(dict_1[idxKv].text);
- }
- else {
- valueText_1.push(value);
- }
- });
- return valueText_1.join(',');
- }
- }
- }
- return valueList;
- },
- },
- ]
- },
- {
- title: 'SQL模式',
- key: 'sql',
- xtype: 'sqleditor',
- reference: reference + '_sql',
- listeners: {
- change: function (sender) {
- var scope = lookupScope(me);
- // 保存 editor 写入的值
- scope.viewModel.set(me.config.bindValue, sender.getValue());
- }
- }
- },
- ]
- }
- ] });
- this.superclass.constructor.call(this, newConfig);
- },
- initComponent: function () {
- // 货位条件树
- var me = this;
- me.superclass.initComponent.apply(this, arguments);
- var tree = this.down('yvtree');
- var config = me.config;
- tree.setRootNode(buildConfigTree(config.propertyConfig));
- },
- });
- function gridChanged(me, grid) {
- var data = grid.getDataRows();
- var propertyConfig = me.config.propertyConfig;
- var bindValue = me.config.bindValue;
- var scope = lookupScope(me);
- var sql = parseGridToSql(data);
- scope.viewModel.set(bindValue, sql);
- }
- /**
- * 用于从 propertyConfig 解析出树形结构
- * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
- * ->
- * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
- */
- function buildConfigTree(propertyConfig) {
- var root = {
- expanded: true,
- leaf: false,
- children: []
- };
- var categoryObj = {};
- var cfgList = propertyConfig;
- _$2.forEach(cfgList, function (cfg) {
- var cateNode = categoryObj[cfg.category];
- if (!cateNode) {
- cateNode = {
- text: cfg.category, expanded: true, leaf: false,
- children: []
- };
- categoryObj[cfg.category] = cateNode;
- root.children.push(cateNode);
- }
- cateNode.children.push({
- text: cfg.text,
- field: cfg.field,
- operator: cfg.operator,
- defaultValue: cfg.defaultValue,
- leaf: true,
- });
- });
- return root;
- }
- /**
- * 将表格变成 SQL where语句 [
- * {field: 'f1', value: 1, operator: '='}
- * {field: 'f2', value: 2, operator: '='}
- * {field: 'f3', value: '3', operator: '>='}
- * {field: 'f4', value: 4, operator: '='}
- * ]
- * ->
- * f1=v1 and f2=v2
- */
- function parseGridToSql(list) {
- var sqls = [];
- _$2.forEach(list, function (i) {
- var _a;
- if (i.operator === 'in') {
- sqls.push(i.field + ' in (' + (i.value) + ')');
- }
- else if (i.operator === 'notIn') {
- sqls.push(i.field + ' not in (' + (i.value) + ')');
- }
- else {
- sqls.push(i.field + ' ' + i.operator + ' ' + ((_a = i.value) !== null && _a !== void 0 ? _a : 0));
- }
- });
- return sqls.join(' AND ');
- }
- /**
- * 将 SQL 语句的 where 片段变成表格
- * @param sql f1=1 and f2=2 and f3>="3" and f4=4
- * @return [
- {field: 'f1', value: 1, operator: '='}
- {field: 'f2', value: 2, operator: '='}
- {field: 'f3', value: '3', operator: '>='}
- {field: 'f4', value: 4, operator: '='}
- ]
- */
- function parseSqlToGrid(sql) {
- if (!sql || !_$2.trim(sql)) {
- return [];
- }
- var parser = new window['NodeSQLParser'].Parser();
- var ast = parser.astify('select * from dual where ' + sql);
- var ret = [];
- exp(ast.where, ret);
- return ret;
- }
- function exp(ast, ret) {
- if (ast.type === 'binary_expr') {
- if (_$2.toUpper(ast.operator) === 'AND') {
- if (ast.left.type === 'binary_expr') {
- exp(ast.left, ret);
- }
- if (ast.right.type === 'binary_expr') {
- exp(ast.right, ret);
- }
- }
- else if (['=', '>=', '>', '<=', '<', 'IN', 'NOT IN'].includes(_$2.toUpper(ast.operator))) {
- if (ast.left.type === 'column_ref') {
- if (ast.right.type === 'number' ||
- ast.right.type === 'single_quote_string' ||
- ast.right.type === 'double_quote_string') {
- // 具体值相等
- ret.push({ field: ast.left.column, value: ast.right.value, operator: ast.operator });
- }
- else if ((_$2.toUpper(ast.operator) === 'IN' || _$2.toUpper(ast.operator) === 'NOT IN')
- && ast.right.type === 'expr_list') {
- // in / not in
- var valueList_1 = [];
- _$2.forEach(ast.right.value, function (item) {
- valueList_1.push(item.value);
- });
- var operator = void 0;
- if (_$2.toUpper(ast.operator) === 'IN') {
- operator = 'in';
- }
- else if (_$2.toUpper(ast.operator) === 'NOT IN') {
- operator = 'notIn';
- }
- ret.push({
- field: ast.left.column, value: valueList_1.join(','),
- operator: operator
- });
- }
- else {
- throw new Error('ast.right must is value.');
- }
- }
- else {
- throw new Error('ast.left must is column_ref.');
- }
- }
- else {
- // 必须用 AND 条件符匹配
- throw new Error('ast.operator must is "AND / =".');
- }
- }
- else {
- throw new Error('ast.type must is "binary_expr".');
- }
- }
- /**
- * json5.stringify( new NodeSQLParser.Parser().astify("").where)
- * select * from aa where f1=1 and f2=2 and f3='3' and f4>=4 and f4<3
- {
- type: 'binary_expr',
- operator: 'AND',
- left: {
- type: 'binary_expr',
- operator: 'AND',
- left: {
- type: 'binary_expr',
- operator: 'AND',
- left: {
- type: 'binary_expr',
- operator: 'AND',
- left: {
- type: 'binary_expr',
- operator: '=',
- left: {
- type: 'column_ref',
- table: null,
- column: 'f1'
- },
- right: {
- type: 'number',
- value: 1
- }
- },
- right: {
- type: 'binary_expr',
- operator: '=',
- left: {
- type: 'column_ref',
- table: null,
- column: 'f2'
- },
- right: {
- type: 'number',
- value: 2
- }
- }
- },
- right: {
- type: 'binary_expr',
- operator: '=',
- left: {
- type: 'column_ref',
- table: null,
- column: 'f3'
- },
- right: {
- type: 'single_quote_string',
- value: '3'
- }
- }
- },
- right: {
- type: 'binary_expr',
- operator: '>=',
- left: {
- type: 'column_ref',
- table: null,
- column: 'f4'
- },
- right: {
- type: 'number',
- value: 4
- }
- }
- },
- right: {
- type: 'binary_expr',
- operator: '<',
- left: {
- type: 'column_ref',
- table: null,
- column: 'f4'
- },
- right: {
- type: 'number',
- value: 3
- }
- }
- }
- * */
- }
- function initParamComplex () {
- Ext.define('Yvan.ParamComplex', {
- extend: 'Ext.panel.Panel',
- xtype: 'paramcomplex',
- alias: 'widget.paramcomplex',
- getSqlExpress: function () {
- },
- constructor: function (config) {
- var reference = config.reference;
- var me = this;
- var newConfig = __assign(__assign({}, config), { layout: 'border', items: [
- {
- region: 'west',
- width: 280,
- border: false,
- split: true,
- reference: reference + '_tree',
- xtype: 'yvtree',
- hideRefresh: true,
- hideExpand: true,
- hideCollapse: true,
- listeners: {
- itemdblclick: function (sender, record, item, index, e) {
- var field = record.get('field');
- var defaultValue = record.get('defaultValue');
- if (!field) {
- return;
- }
- var tabExpress = me.down('tabpanel');
- var sqleditor = me.down('sqleditor');
- var expressGrid = me.down('yvgrid');
- if (tabExpress.getActiveTab().key !== 'grid') {
- // SQL 模式
- sqleditor.insertText(field + '=');
- }
- else {
- // 表格模式
- expressGrid.appendEditRow({
- field: field,
- operator: '=',
- value: defaultValue,
- remark: '',
- });
- _$2.defer(function () {
- gridChanged(me, expressGrid);
- });
- }
- }
- },
- },
- {
- region: 'center',
- xtype: 'tabpanel',
- reference: reference + '_tab',
- tabPosition: 'bottom',
- listeners: {
- afterrender: function (sender) {
- var scope = lookupScope(me);
- var value = scope.viewModel.get(me.config.bindValue);
- // sql 转换为 grid
- try {
- var list_1 = parseParamToGrid(value);
- _$2.defer(function () {
- var grid = me.down('yvgrid');
- grid.setData(list_1);
- });
- }
- catch (e) {
- console.error(e);
- msg$1('无法解析SQL语法! 目前只能以 SQL 模式打开,如果在表格中做修改,将会覆盖原语句!');
- var tabSql = sender.down('sqleditor');
- sender.setActiveTab(tabSql);
- }
- },
- beforetabchange: function (sender, newCard, oldCard, eOpts) {
- var scope = lookupScope(me);
- var value = scope.viewModel.get(me.config.bindValue);
- if (newCard.key === 'grid') {
- // sql 转换为 grid
- try {
- var list_2 = parseParamToGrid(value);
- _$2.defer(function () {
- var grid = me.down('yvgrid');
- grid.setData(list_2);
- });
- return true;
- }
- catch (e) {
- msg$1('无法解析 SQL 语法! 表格模式只适用于简单语法');
- console.error(e);
- return false;
- }
- }
- else if (newCard.key === 'sql') {
- // grid 转换为 sql
- _$2.defer(function () {
- var editor = me.down('sqleditor');
- editor.setValue(value);
- });
- return true;
- }
- }
- },
- items: [
- {
- title: '表格模式',
- key: 'grid',
- xtype: 'yvgrid',
- _mode: 'select',
- reference: reference + '_grid',
- hideFootbar: true,
- pagination: false,
- tbar: [
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- cls: 'ext-btn-danger',
- bind: {
- disabled: '{!' + reference + '_grid.selection}',
- },
- listeners: {
- click: function (sender) {
- var grid = sender.up('yvgrid');
- removeGridRow(grid);
- gridChanged(me, grid);
- }
- },
- },
- ],
- store: {},
- listeners: {
- editfinish: function (sender) {
- gridChanged(me, sender);
- },
- },
- columns: [
- {
- dataIndex: 'field',
- header: '字段', sortable: false, menuDisabled: true,
- width: 190,
- renderer: function (value, context, record, rowIdx, colIdx, store, view) {
- var column = context.column;
- var propertyConfig = me.config.propertyConfig;
- // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
- var field = record.get('field');
- if (field) {
- var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
- if (idx >= 0) {
- var meta = propertyConfig[idx];
- return meta.text;
- }
- }
- return value;
- }
- },
- {
- dataIndex: 'value',
- header: '值', sortable: false, menuDisabled: true,
- flex: 1,
- getEditor: function (record) {
- var column = this;
- var grid = _$2.get(column, 'ownerCt.grid.ownerGrid');
- var propertyConfig = me.config.propertyConfig;
- var field = record.get('field');
- if (!field) {
- // 没有填 propertyName
- return;
- }
- var idx = _$2.findIndex(propertyConfig, function (p) { return p.field === field; });
- if (idx < 0) {
- console.error('没有找到 field=' + field + ". propertyConfig");
- return;
- }
- var meta = propertyConfig[idx];
- if ((record.get('operator') === 'in' || record.get('operator') === 'notIn') && meta.editor.xtype === 'combo') {
- return new Ext.grid.CellEditor({
- field: __assign(__assign({ dict: meta.dict }, meta.editor), { xtype: 'tagfield' })
- });
- }
- return new Ext.grid.CellEditor({
- field: __assign({ dict: meta.dict }, meta.editor)
- });
- },
- renderer: function (valueList, context, record, rowIdx, colIdx, store, view) {
- var column = context.column;
- var grid = _$2.get(view, 'ownerGrid');
- var propertyConfig = me.config.propertyConfig;
- // 找到 propertyConfig 对应 propertyName 名称的 dict 字典的 dict.text 值
- var field = record.get('field');
- if (field) {
- var idx = _$2.findIndex(propertyConfig, function (p) { return (p.field) === field; });
- if (idx >= 0) {
- var meta = propertyConfig[idx];
- var dictName = _$2.get(meta, 'dict');
- if (dictName && window['DICT_CACHE'][dictName]) {
- var dict_1 = window['DICT_CACHE'][dictName];
- var valueText_1 = [];
- _$2.forEach(_$2.split(valueList, ','), function (value) {
- var idxKv = _$2.findIndex(dict_1, function (kv) { return _$2.toString(kv.id) === _$2.toString(value); });
- if (idxKv >= 0) {
- valueText_1.push(dict_1[idxKv].text);
- }
- else {
- valueText_1.push(value);
- }
- });
- return valueText_1.join(',');
- }
- }
- }
- return valueList;
- },
- },
- ]
- },
- {
- title: '文本模式',
- key: 'sql',
- xtype: 'sqleditor',
- reference: reference + '_sql',
- listeners: {
- change: function (sender) {
- var scope = lookupScope(me);
- // 保存 editor 写入的值
- scope.viewModel.set(me.config.bindValue, sender.getValue());
- }
- }
- },
- ]
- }
- ] });
- this.superclass.constructor.call(this, newConfig);
- },
- initComponent: function () {
- // 货位条件树
- var me = this;
- me.superclass.initComponent.apply(this, arguments);
- var tree = this.down('yvtree');
- var config = me.config;
- tree.setRootNode(buildConfigTree(config.propertyConfig));
- },
- });
- function gridChanged(me, grid) {
- var data = grid.getDataRows();
- var propertyConfig = me.config.propertyConfig;
- var bindValue = me.config.bindValue;
- var scope = lookupScope(me);
- var sql = parseGridToParam(data);
- scope.viewModel.set(bindValue, sql);
- }
- /**
- * 用于从 propertyConfig 解析出树形结构
- * { text: '库别分类', field: 'loc_classify', operator: '=', category: '库位属性', editor: {xtype: 'combo'}, dict: 'AREA_CLASSIFY', },
- * ->
- * {text: '库别分类', field: 'loc_classify', operator: '=', leaf: true},
- */
- function buildConfigTree(propertyConfig) {
- var root = {
- expanded: true,
- leaf: false,
- children: []
- };
- var categoryObj = {};
- var cfgList = propertyConfig;
- _$2.forEach(cfgList, function (cfg) {
- var cateNode = categoryObj[cfg.category];
- if (!cateNode) {
- cateNode = {
- text: cfg.category, expanded: true, leaf: false,
- children: []
- };
- categoryObj[cfg.category] = cateNode;
- root.children.push(cateNode);
- }
- cateNode.children.push({
- text: cfg.text,
- field: cfg.field,
- operator: cfg.operator,
- defaultValue: cfg.defaultValue,
- leaf: true,
- });
- });
- return root;
- }
- /**
- * 将表格变成参数语句 [
- * {field: 'f1', value: 1}
- * {field: 'f2', value: 2}
- * {field: 'f3', value: '3'}
- * {field: 'f4', value: 4}
- * ]
- * ->
- * f1=v1, f2=v2
- */
- function parseGridToParam(list) {
- var sqls = [];
- _$2.forEach(list, function (i) {
- sqls.push(i.field + '=' + (i.value));
- });
- return sqls.join('; ');
- }
- /**
- * 将 分号分割的的参数设置 变成表格
- * @param param a=1; b=2; c='3'
- * @return [
- {field: 'a', value: 1}
- {field: 'b', value: 2}
- {field: 'c', value: '3'}
- ]
- */
- function parseParamToGrid(param) {
- if (!param || !_$2.trim(param)) {
- return [];
- }
- var ret = [];
- var sp = _$2.split(param, ';');
- _$2.forEach(sp, function (v) {
- var vi = _$2.indexOf(v, '=');
- var field = _$2.trim(v.substr(0, vi));
- var value = eval(v.substr(vi + 1));
- ret.push({ field: field, value: value });
- });
- return ret;
- }
- }
- function initSqlEditor () {
- Ext.define('com.yvan.studio.SqlEditor', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.sqleditor',
- xtype: 'sqleditor',
- layout: 'fit',
- border: false,
- html: "<div class=\"editor\"/>",
- config: {
- value: ''
- },
- codeChange: undefined,
- isChangeFromOuter: false,
- setCode: function (value) {
- var _this = this;
- this.code = value;
- this.value = value;
- _$2.defer(function () {
- _this.isChangeFromOuter = true;
- if (_this.editor) {
- _this.editor.setValue(value);
- }
- });
- },
- getCode: function () {
- return this.getValue();
- },
- updateOptions: function (options) {
- if (this.editor && options) {
- this.editor.updateOptions(options);
- }
- },
- getValue: function () {
- if (!this.editor) {
- return this.code;
- }
- return this.editor.getValue();
- },
- applyPosition: function () {
- var _this = this;
- if (this.autoFocusMethod) {
- if (this.editor) {
- _$2.defer(function () {
- if (_this.autoFocusStartLine) {
- _this.editor.setPosition({
- lineNumber: _this.autoFocusStartLine,
- column: _this.autoFocusStartColumn
- });
- _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
- }
- _this.editor.focus();
- });
- delete this.autoFocusMethod;
- }
- }
- this.editor.layout();
- },
- insertText: function (text) {
- var editor = this.editor;
- var position = editor.getPosition();
- editor.executeEdits('', [
- {
- range: {
- startLineNumber: position.lineNumber,
- startColumn: position.column,
- endLineNumber: position.lineNumber,
- endColumn: position.column
- },
- text: text
- }
- ]);
- },
- setValue: function (value, fromEditor) {
- this.setCode(value);
- var me = this;
- if (me.value === value) {
- // 值相等,不需要变化
- return;
- }
- if (fromEditor !== true && me.editor) {
- // 不是来源于编辑器的变化,才设置编辑器的值
- me.editor.setValue(value);
- }
- // 通知mixins setValue
- me.value = value;
- me.fireEvent('change', value);
- },
- initComponent: function () {
- var that = this;
- this.superclass.initComponent.call(this);
- that.on({
- resize: function () {
- if (that.editor) {
- that.editor.layout();
- }
- },
- destory: function () {
- if (that.editor) {
- that.editor.dispose();
- delete that.editor;
- }
- },
- afterrender: function (sender) {
- var $dom = $(that.el.dom).find('.editor');
- attach_2($dom[0], {
- value: that.code
- }).then(function (editor) {
- that.editor = editor;
- that.applyPosition();
- that.editor.onDidChangeModelContent(function (e) {
- that.fireEvent('change', that.editor, e);
- if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
- that.codeChange(that.editor.getValue(), that.name, e);
- }
- that.isChangeFromOuter = false;
- });
- });
- }
- });
- }
- });
- function attach_2(element, opts) {
- if (!window['monaco']) {
- return;
- }
- var monaco = window['monaco'];
- return new Promise(function (resolve) {
- var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
- enabled: false
- } }));
- // editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
- // const sql = editor.getValue()
- // if (_.trim(sql).length > 0) {
- // editor.setValue(format(sql, {
- // indent: ' ',
- // uppercase: true,
- // }))
- // }
- // })
- editor.onKeyUp(function (e) {
- // console.log(e)
- if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
- editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
- }
- });
- resolve(editor);
- });
- }
- }
- function initJsonEditor () {
- Ext.define('com.yvan.studio.JsonEditor', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.jsoneditor',
- xtype: 'jsoneditor',
- layout: 'fit',
- border: false,
- html: "<div class=\"editor\"/>",
- autoFocusMethod: true,
- autoFocusStartLine: 0,
- autoFocusStartColumn: 0,
- codeChange: undefined,
- funcArr: [],
- modulePage: null,
- isChangeFromOuter: false,
- name: "",
- /**
- * 设置代码
- */
- setCode: function (value) {
- var _this = this;
- this.code = value;
- _$2.defer(function () {
- _this.isChangeFromOuter = true;
- if (_this.editor) {
- _this.editor.setValue(value);
- }
- });
- },
- updateOptions: function (options) {
- if (this.editor && options) {
- this.editor.updateOptions(options);
- }
- },
- setLanguage: function (lang) {
- if (!window['monaco']) {
- return;
- }
- var monaco = window['monaco'];
- if (this.editor && lang) {
- monaco.editor.setModelLanguage(this.editor.getModel(), lang);
- }
- },
- getCode: function () {
- var _a;
- return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
- },
- applyPosition: function () {
- var _this = this;
- if (this.autoFocusMethod) {
- if (this.editor) {
- _$2.defer(function () {
- if (_this.autoFocusStartLine) {
- _this.editor.setPosition({
- lineNumber: _this.autoFocusStartLine,
- column: _this.autoFocusStartColumn
- });
- _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
- }
- _this.editor.focus();
- });
- delete this.autoFocusMethod;
- }
- }
- this.editor.layout();
- },
- initComponent: function () {
- var that = this;
- this.superclass.initComponent.apply(this, arguments);
- this.on({
- resize: function (sender, width, height) {
- if (that.editor) {
- that.editor.layout();
- }
- },
- destory: function () {
- if (that.editor) {
- that.editor.dispose();
- delete that.editor;
- }
- },
- afterrender: function (sender) {
- var $dom = $(that.el.dom).find('.editor');
- attach_116($dom[0], {
- value: that.code
- }).then(function (editor) {
- that.editor = editor;
- that.applyPosition();
- that.editor.onDidChangeModelContent(function (e) {
- that.fireEvent('change', that.editor, e);
- if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
- that.codeChange(that.editor.getValue(), that.name, e);
- }
- that.isChangeFromOuter = false;
- });
- });
- }
- });
- },
- });
- function attach_116(element, opts) {
- if (!window['monaco']) {
- return;
- }
- var monaco = window['monaco'];
- return new Promise(function (resolve) {
- var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
- enabled: false
- } }));
- editor.onKeyUp(function (e) {
- // console.log(e)
- if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
- editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
- }
- });
- resolve(editor);
- });
- }
- }
- function initJsEditor () {
- Ext.define('com.yvan.studio.JsEditor', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.jseditor',
- xtype: 'jseditor',
- layout: 'fit',
- border: false,
- html: "<div class=\"editor\"/>",
- autoFocusMethod: true,
- autoFocusStartLine: 0,
- autoFocusStartColumn: 0,
- codeChange: undefined,
- funcArr: [],
- modulePage: null,
- isChangeFromOuter: false,
- name: "",
- /**
- * 设置代码
- */
- setCode: function (value) {
- var _this = this;
- this.code = value;
- _$2.defer(function () {
- _this.isChangeFromOuter = true;
- if (_this.editor) {
- _this.editor.setValue(value);
- if (_this.name === "controllerEditor") {
- _this.funcArr = _this.getAllFunction();
- }
- }
- });
- },
- getCode: function () {
- var _a;
- if (!this.editor) {
- return this.code;
- }
- return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
- },
- applyPosition: function () {
- var _this = this;
- if (this.autoFocusMethod) {
- if (this.editor) {
- _$2.defer(function () {
- if (_this.autoFocusStartLine) {
- _this.editor.setPosition({
- lineNumber: _this.autoFocusStartLine,
- column: _this.autoFocusStartColumn
- });
- _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
- }
- _this.editor.focus();
- });
- delete this.autoFocusMethod;
- }
- }
- this.editor.layout();
- },
- initComponent: function () {
- var that = this;
- this.superclass.initComponent.apply(this, arguments);
- this.on({
- resize: function (sender, width, height) {
- if (that.editor) {
- that.editor.layout();
- }
- },
- destory: function () {
- if (that.editor) {
- that.editor.dispose();
- delete that.editor;
- }
- },
- afterrender: function () {
- var $dom = $(that.el.dom).find('.editor');
- attach_1($dom[0], {
- value: that.code
- }).then(function (editor) {
- that.editor = editor;
- that.applyPosition();
- that.editor.onDidChangeModelContent(function (e) {
- that.fireEvent('change', that.editor, e);
- if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
- that.codeChange(that.editor.getValue(), that.name, e);
- }
- that.isChangeFromOuter = false;
- });
- });
- }
- });
- },
- getAllFunction: function () {
- var funcArr = [];
- var ast = window['YvanUI'].recast.parse(this.code);
- if (ast && ast.program && ast.program.body) {
- if (Array.isArray(ast.program.body)) {
- for (var i = 0; i < ast.program.body.length; i++) {
- var m = ast.program.body[i];
- if (m.type === "ExportDefaultDeclaration") {
- if (m.declaration.type === "ClassDeclaration") {
- if (m.declaration.body.type === "ClassBody") {
- if (Array.isArray(m.declaration.body.body)) {
- for (var j = 0; j < m.declaration.body.body.length; j++) {
- var ob = m.declaration.body.body[j];
- if (ob.type === "MethodDefinition" && ob.kind === "method") {
- var funcItem = { name: ob.key.name, args: [] };
- if (Array.isArray(ob.value.params)) {
- for (var k = 0; k < ob.value.params.length; k++) {
- var p = ob.value.params[k];
- funcItem.args.push(p.name);
- }
- }
- funcArr.push(funcItem);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return funcArr;
- }
- });
- var isInited = false;
- function attach_1(element, opts) {
- if (!window['monaco']) {
- return;
- }
- var monaco = window['monaco'];
- return new Promise(function (resolve) {
- if (!isInited) {
- isInited = true;
- monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
- noSemanticValidation: true,
- noSyntaxValidation: false
- });
- // compiler options
- monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
- target: monaco.languages.typescript.ScriptTarget.ES2016,
- allowNonTsExtensions: true,
- });
- // extra libraries
- var libSource = [
- 'declare class Facts {',
- ' /**',
- ' * Returns the next fact',
- ' */',
- ' static next():string',
- ' static next222():string',
- '}',
- "\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 ",
- "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
- ].join('\n');
- var libUri = 'file:///index.d.ts';
- monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
- // When resolving definitions and references, the editor will try to use created models.
- // Creating a model for the library allows "peek definition/references" commands to work with the library.
- monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
- }
- var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
- resolve(editor);
- });
- }
- }
- function initClipboard () {
- var cc = Ext.grid.plugin.Clipboard.prototype.constructor;
- var initComponent = Ext.grid.plugin.Clipboard.prototype.initComponent;
- Ext.grid.plugin.Clipboard.override({
- getCellData: function (format, erase) {
- var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], isRaw = format === 'raw', isText = format === 'text', viewNode, cell, data, dataIndex, lastRecord, column, record, row, view;
- if (selection) {
- selection.eachCell(function (cellContext) {
- column = cellContext.column;
- view = cellContext.column.getView();
- record = cellContext.record;
- // Do not copy the check column or row numberer column
- if (column.ignoreExport && column.xtype !== "checkcolumn") {
- return;
- }
- if (lastRecord !== record) {
- lastRecord = record;
- ret.push(row = []);
- }
- dataIndex = column.dataIndex;
- // 记录原始数据
- var rData = record.data[dataIndex];
- if (isRaw) {
- data = record.data[dataIndex];
- }
- else {
- // Try to access the view node.
- viewNode = view.all.item(cellContext.rowIdx);
- // If we could not, it's because it's outside of the rendered block -
- // recreate it.
- if (!viewNode) {
- viewNode = Ext.fly(view.createRowElement(record, cellContext.rowIdx));
- }
- cell = viewNode.dom.querySelector(column.getCellInnerSelector());
- data = cell.innerHTML;
- if (isText) {
- data = Ext.util.Format.stripTags(data);
- }
- // 没有找到html text的数据时候给原数据, 主要针对column.xtype === "checkcolumn" 时无法copy到有效值
- data = data || rData;
- }
- row.push(data);
- if (erase && dataIndex) {
- record.set(dataIndex, null);
- }
- });
- }
- // See decode() comment below
- return Ext.util.TSV.encode(ret, undefined, null);
- },
- getCells: function (format, erase) {
- var cmp = this.getCmp(), selection = cmp.getSelectionModel().getSelected(), ret = [], dataIndex, lastRecord, record, row;
- if (selection) {
- selection.eachCell(function (cellContext) {
- record = cellContext.record;
- if (lastRecord !== record) {
- lastRecord = record;
- ret.push(row = {
- model: record.self,
- fields: []
- });
- }
- dataIndex = cellContext.column.dataIndex;
- row.fields.push({
- name: dataIndex,
- value: record.data[dataIndex]
- });
- if (erase && dataIndex) {
- record.set(dataIndex, null);
- }
- });
- }
- return ret;
- },
- getTextData: function (format, erase) {
- return this.getCellData(format, erase);
- },
- putCellData: function (data, format) {
- var _a;
- 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 = {};
- // If the view is not focused, use the first cell of the selection as the destination.
- if (!destination && selected) {
- selected.eachCell(function (c) {
- destination = c;
- return false;
- });
- }
- if (destination) {
- // Create a new Context based upon the outermost View.
- // NavigationModel works on local views.
- // TODO: remove this step when NavModel is fixed to use outermost view in locked grid.
- // At that point, we can use navModel.getPosition()
- destination = new Ext.grid.CellContext(view).setPosition(destination.record, destination.column);
- }
- else {
- destination = new Ext.grid.CellContext(view).setPosition(0, 0);
- }
- destinationStartColumn = destination.colIdx;
- for (sourceRowIdx = 0; sourceRowIdx < recCount; sourceRowIdx++) {
- row = values[sourceRowIdx];
- // Collect new values in dataObject
- for (sourceColIdx = 0; sourceColIdx < colCount; sourceColIdx++) {
- if (!destination.column.initialConfig.editor && destination.column.xtype !== "checkcolumn") {
- continue;
- }
- dataIndex = destination.column.dataIndex;
- var editorXtype = (_a = destination.column.editor) === null || _a === void 0 ? void 0 : _a.xtype;
- if (dataIndex) {
- switch (format) {
- // Raw field values
- case 'raw':
- dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
- break;
- // Textual data with HTML tags stripped
- case 'text':
- {
- if ((editorXtype === "combo" || editorXtype === "combobox") && (typeof destination.column.renderer === "function")) {
- // 获取字典原始的value
- dataObject[dataIndex] = destination.column.renderer(row[sourceColIdx], true);
- }
- else {
- dataObject[dataIndex] = row[sourceColIdx] === "false" ? false : row[sourceColIdx] === "true" ? true : row[sourceColIdx];
- }
- break;
- }
- }
- }
- // If we are at the end of the destination row, break the column loop.
- if (destination.colIdx === maxColIdx) {
- break;
- }
- destination.setColumn(destination.colIdx + 1);
- }
- // Update the record in one go.
- destination.record.set(dataObject);
- // If we are at the end of the destination store, break the row loop.
- if (destination.rowIdx === maxRowIdx) {
- break;
- }
- // Jump to next row in destination
- destination.setPosition(destination.rowIdx + 1, destinationStartColumn);
- }
- },
- putTextData: function (data, format) {
- var _a, _b, _c;
- var values = Ext.util.TSV.decode(data, undefined, null), view = this.getCmp().getView(), selModel = view.getSelectionModel(), selected = selModel.getSelected();
- // 根据复制的行数自动添加新的行
- 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;
- if (selected.startCell.rowIdx + values.length >= dataLength) {
- for (var i = 0; i < selected.startCell.rowIdx + values.length - dataLength; i++) {
- this.cmp.getStore().add({});
- }
- }
- this.putCellData(data, format);
- },
- });
- }
- function initDict () {
- var DICT_CACHE = window['DICT_CACHE'];
- if (!DICT_CACHE) {
- DICT_CACHE = {};
- window['DICT_CACHE'] = DICT_CACHE;
- }
- DICT_CACHE.XTYPE = [
- { id: 'datefield', text: '日期' },
- { id: 'datetimefield', text: '日期时间' },
- { id: 'textfield', text: '文本' },
- { id: 'numberfield', text: '数字' },
- { id: 'combo', text: '下拉框' },
- ];
- DICT_CACHE.operator = [
- { id: '=', text: '=' },
- { id: '>', text: '>' },
- { id: '<', text: '<' },
- { id: '>=', text: '>=' },
- { id: '<=', text: '<=' },
- { id: 'in', text: 'in' },
- { id: 'notIn', text: 'notIn' },
- ];
- DICT_CACHE.GRID_MODE = [
- { id: 'edit1', text: '单机编辑模式' },
- { id: 'edit2', text: '双击编辑模式' },
- { id: 'checkbox', text: '勾选' },
- { id: 'checkonly', text: '只勾选' },
- { id: 'select', text: '行选择模式' },
- ];
- DICT_CACHE.BOTH_SELECT = [
- { id: 'N/A', text: '<无>' },
- { id: 'textfield', text: '文本' },
- { id: 'numberfield', text: '数字框' },
- { id: 'datefield', text: '日期' },
- { id: 'datetimefield', text: '日期时间' },
- { id: 'combo', text: '下拉框' },
- { id: 'combogrid', text: '下拉表' },
- { id: 'checkbox', text: '勾选' },
- ];
- DICT_CACHE.ROW_LAYOUT = [
- { id: 'flex', text: '按权重摆放' },
- { id: 'hbox', text: '按宽度摆放' },
- ];
- DICT_CACHE.GRID_XTYPE = [
- { id: 'N/A', text: '<无>' },
- { id: 'textfield', text: '文本-textfield' },
- { id: 'numberfield', text: '数字框-numberfield' },
- { id: 'datefield', text: '日期-datefield' },
- { id: 'datetimefield', text: '日期时间-datetimefield' },
- { id: 'combo', text: '下拉框-combo' },
- { id: 'combogrid', text: '下拉表-combogrid' },
- { id: 'checkbox', text: '勾选-checkbox' },
- ];
- DICT_CACHE.FORM_XTYPE = [
- { id: 'N/A', text: '<无>' },
- { id: 'textfield', text: '文本-textfield' },
- { id: 'numberfield', text: '数字框-numberfield' },
- { id: 'datefield', text: '日期-datefield' },
- { id: 'datetimefield', text: '日期时间-datetimefield' },
- { id: 'combo', text: '下拉框-combo' },
- { id: 'combogrid', text: '下拉表-combogrid' },
- { id: 'checkbox', text: '勾选-checkbox' },
- { id: 'multiplesearch', text: '多段文本-multiplesearch' },
- ];
- DICT_CACHE.GRID_FORMATTER = [
- { id: 'N/A', text: '默认' },
- { id: 'rownum', text: '序号-rownum' },
- { id: 'button', text: '按钮-button' },
- { id: 'checkbox', text: '勾选-checkbox' },
- { id: 'progres', text: '进度条-progres' },
- ];
- }
- function initDesigner () {
- Ext.define('com.yvan.studio.designer', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.designer',
- xtype: 'designer',
- layout: 'fit',
- items: [],
- constructor: function (config) {
- var self = this;
- var newConfig = _$2.defaultsDeep({
- // 强制性属性
- }, config);
- this.superclass.constructor.call(self, newConfig);
- },
- initComponent: function () {
- var me = this;
- me.on({
- afterrender: function () {
- }
- });
- this.superclass.initComponent.call(me);
- }
- });
- }
- var FixClass = /** @class */ (function () {
- function FixClass() {
- }
- FixClass.prototype.fix = function (me, config) {
- var _this = this;
- if (isDesignMode(me, config)) {
- return;
- }
- if (!config) {
- return;
- }
- var fix = config.fix;
- if (!fix) {
- return;
- }
- delete config.fix;
- // 这里有个 bug
- // 但凡是调用了 this.lookupViewModel() 就会出现绑定不了的情况
- // const scope = config.$initParent.lookupReferenceHolder().yvanScope //lookupScope(me)
- var scope;
- if (config.$initParent) {
- // 在面板上的组件
- scope = config.$initParent.lookupReferenceHolder().yvanScope; //lookupScope(me)
- }
- else if (config.column) {
- // 在列上的组件
- scope = config.column.lookupReferenceHolder().yvanScope; //lookupScope(me)
- }
- if (_$2.isArray(fix)) {
- _$2.each(fix, function (f) {
- var fn = lookupFn(scope, f);
- fn.call(_this, me, config);
- });
- }
- else if (_$2.isString(fix)) {
- var fn = lookupFn(scope, fix);
- fn.call(this, me, config);
- }
- };
- __decorate([
- baseConfigProcess(),
- __metadata("design:type", Function),
- __metadata("design:paramtypes", [Object, Object]),
- __metadata("design:returntype", void 0)
- ], FixClass.prototype, "fix", null);
- return FixClass;
- }());
- function init$1() {
- // 引入 filters 过滤插件
- Ext.require([
- 'Ext.grid.filters.Filters'
- ]);
- // 启用 tooltip 快捷提示
- Ext.QuickTips.init();
- // 定义日期格式化方法
- if (Ext.util && Ext.util.Format) {
- Ext.apply(Ext.util.Format, {
- dateFormat: 'Y-m-d'
- });
- }
- Ext.form.field.Display.override({
- cls: 'yvan-display-field',
- labelAlign: 'right'
- });
- Ext.define("Ext.locale.zh_CN.picker.Date", {
- override: "Ext.picker.Date",
- format: "Y-m-d",
- });
- Ext.define("Ext.locale.zh_CN.form.field.Date", {
- override: "Ext.form.field.Date",
- format: "Y-m-d",
- });
- Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
- override: "Ext.grid.PropertyColumnModel",
- format: "Y-m-d",
- });
- Ext.define("Ext.locale.zh_CN.view.AbstractView", {
- override: "Ext.view.AbstractView",
- loadingText: "读取中..."
- });
- Ext.LoadMask.prototype.msg = '请稍后...';
- Ext.define("Ext.locale.zh_CN.grid.header.Container", {
- override: "Ext.grid.header.Container",
- sortClearText: '不排序',
- sortAscText: "正序",
- sortDescText: "倒序",
- lockText: "锁定列",
- unlockText: "解除锁定",
- columnsText: "字段隐藏"
- });
- Ext.define("Ext.locale.zh_CN.grid.filters.filter.Date", {
- override: "Ext.grid.filters.filter.Date",
- fields: {
- lt: { text: '之前' },
- gt: { text: '之后' },
- eq: { text: '相等' },
- },
- // Defaults to Ext.Date.defaultFormat
- dateFormat: null
- });
- // Ext.grid.locking.Lockable.prototype.unlockText = '解锁'
- // Ext.grid.locking.Lockable.prototype.lockText = '锁定'
- // Ext.grid.filters.Filters.prototype.menuFilterText = "过滤"
- Ext.define("Ext.locale.zh_CN.grid.locking.Lockable", {
- override: "Ext.grid.locking.Lockable",
- lockText: "锁定",
- unlockText: '解锁',
- });
- Ext.define("Ext.locale.zh_CN.grid.filters.Filters", {
- override: "Ext.grid.filters.Filters",
- menuFilterText: "过滤"
- });
- Ext.define("Ext.locale.zh_CN.grid.filters.filter.Boolean", {
- override: "Ext.grid.filters.filter.Boolean",
- yesText: "已钩选",
- noText: "未勾选"
- });
- Ext.define("Ext.locale.zh_CN.grid.filters.filter.String", {
- override: "Ext.grid.filters.filter.String",
- emptyText: "输入过滤文本..."
- });
- Ext.define("Ext.locale.zh_CN.grid.filters.filter.Number", {
- override: "Ext.grid.filters.filter.Number",
- emptyText: "输入数字..."
- });
- Ext.define("Ext.locale.zh_CN.toolbar.Paging", {
- override: "Ext.PagingToolbar",
- beforePageText: "第",
- // update
- afterPageText: "/ {0} 页",
- // update
- firstText: "第一页",
- prevText: "上一页",
- // update
- nextText: "下一页",
- lastText: "最后页",
- refreshText: "刷新",
- displayMsg: "总共 {2} 条",
- // update
- emptyMsg: '没有数据'
- });
- /**
- * 改变事件的获取方式.
- * 具体见: ext-all-debug.js:23216 addListener
- * https://docs.sencha.com/extjs/6.6.0/classic/Ext.util.Observable.html#method-addListener
- * https://docs.sencha.com/extjs/6.6.0/classic/src/Observable.js.html#Ext.mixin.Observable-method-addListener
- */
- var _doAddListener = Ext.mixin.Observable.prototype.doAddListener;
- Ext.mixin.Observable.prototype.doAddListener = function (ename, fn, scope, options, order, caller, manager) {
- if (typeof fn === 'string' &&
- (_$2.startsWith(fn, 'scope.') ||
- _$2.startsWith(fn, 'system.') ||
- _$2.startsWith(fn, 'format.'))) {
- scope = lookupScope(this);
- if (isDesignMode(scope, undefined)) {
- fn = Ext.emptyFn;
- }
- else {
- // console.log('doAddListener', ename, fn, scope, options, order, caller, manager)
- // const vm = this.lookupViewModel()
- // if (vm && vm.yvanScope) {
- // scope = vm.yvanScope
- // fn = scope[fn.substr('scope.'.length)]
- // }
- fn = lookupFn(scope, fn, this);
- }
- }
- _doAddListener.call(this, ename, fn, scope, options, order, caller, manager);
- };
- // 将 SystemLib 扩展到 window.system 下
- if (!window['system']) {
- window['system'] = {};
- }
- _$2.extend(window['system'], SystemLib);
- _$2.extend(window['system'], {
- showGridRowDetail: showGridRowDetail
- });
- Ext.apply(Ext.util.Format, {
- // 百分比
- percentRenderer: function (v, rd, model) {
- if (!v) {
- v = 0;
- }
- if (typeof v === 'string') {
- v = parseInt(v);
- }
- var valueString = v.toFixed(2);
- var valueFixed = v > 100 ? 100 : v;
- valueFixed = valueFixed < 0 ? 0 : valueFixed;
- var cls = '';
- if (v < 90) {
- cls = 'danger';
- }
- else if (v < 100) {
- cls = 'warning';
- }
- else {
- cls = 'success';
- }
- return Ext.String
- .format(
- // '<div>'
- // + '<div style="float:left;width:100%; background:#ECECEC;border:none">'
- // + '<div style="float:left;text-align:center;width:100%;color:#fff;line-height:24px;font-size:13px;">{0}%</div>'
- // + '<div style="width:{1}%;height:24px;" class="progress-{2}"></div>'
- // + '</div></div>', valueString, valueFixed, cls);
- '<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(
- // '<div>'
- // + '<div style="float:left;border:1px solid #008000;height:15px;width:100%;">'
- // + '<div style="float:left;text-align:center;width:100%;color:blue;">{0}%</div>'
- // + '<div style="background: #FAB2{2};width:{1}%;height:13px;"></div>'
- // + '</div></div>', v, valueFixed, valueString);
- },
- //button
- button: function (v, rd, model) {
- return "<input style=\"color:#fff\" type=\"button\" value=\"" + v + "\" class=\"area-tag\" />";
- }
- });
- initComponent();
- initPanel();
- initGridColumn();
- initTree();
- initGrid();
- initMainTab();
- initTextfield();
- initCombo();
- initTag();
- initContainer();
- initRows();
- initCols();
- initForm();
- initToolbar();
- initSplitter();
- initButton();
- initStores();
- initSearch();
- initMultipleSearch();
- initDate();
- initDateTimePicker();
- initDateTime();
- initNumber();
- initCheckbox();
- initCheckboxGroup();
- initRadio();
- initRadioGroup();
- initFieldset();
- initCombotree();
- initPickerPlus();
- initCombogrid();
- initComboGridMulti();
- initIframe();
- initBpmn();
- initSqlEditor();
- initJsonEditor();
- initJsEditor();
- initClipboard();
- initSqlComplex();
- initParamComplex();
- initDict();
- initDesigner();
- }
- /**
- * 创建一个 Ajax 客户端
- */
- function createAjax(createOption) {
- if (createOption.baseUrl) {
- axios__default.defaults.baseURL = createOption.baseUrl;
- axios__default.defaults.timeout = createOption.timeout;
- storeAjax.timeout = createOption.timeout;
- axios__default.defaults.timeoutErrorMessage = '网络超时';
- }
- return function (option) {
- //@ts-ignore
- option.method = (option.method || 'get').toLocaleLowerCase();
- //@ts-ignore
- var ax = __assign({}, option);
- switch (option.method) {
- case 'get':
- ax.method = 'GET';
- ax.params = option.param;
- ax.headers = __assign({}, option.headers);
- break;
- case 'post':
- ax.method = 'POST';
- ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
- ax.params = option.param;
- ax.data = Qs.stringify(option.data);
- break;
- case 'put':
- case 'patch':
- case 'delete':
- ax.method = option.method;
- ax.headers = option.headers;
- ax.params = option.param;
- ax.data = Qs.stringify(option.data);
- break;
- case 'download':
- downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
- return new Promise(function (resolver, reject) {
- });
- case "invoke":
- ax.url = serverInvokeUrlTransform(option.url, option);
- ax.method = 'POST';
- ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
- if (typeof option.args === 'object') {
- ax.data = JSON.stringify({
- args: option.args,
- });
- }
- else {
- ax.data = JSON.stringify({
- args: [
- __assign(__assign({}, option.data), option.param)
- ],
- filterModel: option.filterModel,
- sortModel: option.sortModel
- });
- }
- break;
- case 'post-json':
- ax.method = 'POST';
- ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
- ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
- break;
- case 'post-file':
- //TODO 刘壮. 上传文件
- var forms = new FormData();
- ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
- _$2.forOwn(option.data, function (value, key) {
- if (key === 'files') {
- var i_1 = 0;
- _$2.each(value, function (f) {
- // @ts-ignore
- forms.append('file' + (++i_1), f);
- });
- }
- else {
- forms.append(key, value);
- }
- });
- ax.data = forms;
- ax.method = 'POST';
- break;
- case "sql":
- ax.url = sqlUrlTransform(option.url);
- ax.method = 'POST';
- ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
- ax.data = JSON.stringify({
- args: [option.data],
- db: option.db,
- filterModel: option.filterModel,
- sortModel: option.sortModel
- });
- break;
- default:
- throw new Error('not implements');
- }
- return new Promise(function (resolver, reject) {
- axios__default(ax).then(function (resolverRaw) {
- var apiResult = {
- rawData: resolverRaw.data,
- status: resolverRaw.status,
- success: (resolverRaw.data && resolverRaw.data.success),
- data: resolverRaw.data.data,
- pagination: resolverRaw.data.pagination,
- msg: (resolverRaw.data.msg),
- errors: resolverRaw.data.errors,
- headers: resolverRaw.headers
- };
- if (typeof window['apiTranslate'] === 'function') {
- window['apiTranslate'](apiResult.rawData, option.url);
- }
- resolver(apiResult);
- }).catch(function (reason) {
- reject(reason);
- });
- });
- };
- }
- function downLoad(downLoadUrl, filename, data, header, isJson) {
- if (isJson === void 0) { isJson = false; }
- var YvanUI = _$2.get(window, 'YvanUI');
- YvanUI.loading();
- var createObjectURL = function (object) {
- return (window.URL) ? window.URL.createObjectURL(object) : _$2.get(window, 'webkitURL').createObjectURL(object);
- };
- // const formData = new FormData();
- // _.forOwn(data, (v, k) => {
- // formData.append(k, v);
- // });
- var formData = '';
- var xhr = new XMLHttpRequest();
- xhr.open('POST', downLoadUrl);
- xhr.responseType = 'blob';
- // xhr.setRequestHeader('Authorization', $.cookie('auth'))
- if (isJson) {
- formData = data ? JSON.stringify(data) : '';
- xhr.setRequestHeader('Content-Type', 'application/json');
- }
- else {
- formData = data ? Qs.stringify(data) : '';
- xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
- }
- //
- if (header) {
- _$2.forOwn(header, function (v, k) {
- xhr.setRequestHeader(k, v);
- });
- }
- xhr.onload = function (e) {
- if (this.status === 200) {
- var blob = this.response;
- if (_$2.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
- navigator.msSaveBlob(blob, filename);
- YvanUI.clearLoading();
- }
- else {
- var a = document.createElement('a');
- var url = createObjectURL(blob);
- a.href = url;
- a.download = filename;
- document.append(a);
- a.click();
- a.remove();
- window.URL.revokeObjectURL(url);
- YvanUI.clearLoading();
- }
- }
- };
- xhr.send(formData);
- }
- function readExcel(file) {
- return new Promise(function (resolve, reject) {
- if (!file) {
- reject("文件读取失败!!!");
- return;
- }
- var reader = new FileReader();
- reader.onload = function (e) {
- if (e.target) {
- var data = e.target.result;
- var workbook = XLSX.read(data, { type: 'binary' });
- resolve(workbook);
- }
- else {
- reject("文件读取失败!!!");
- }
- };
- try {
- reader.readAsBinaryString(file);
- }
- catch (e) {
- reject(e);
- }
- });
- }
- function readExcelWithColumnsSet(topScope, file, columnsSet, dataStartRow, titleRowNumber, rowValidate, otherValidate, fieldValidate) {
- if (dataStartRow === void 0) { dataStartRow = 2; }
- if (titleRowNumber === void 0) { titleRowNumber = 1; }
- if (rowValidate === void 0) { rowValidate = undefined; }
- if (otherValidate === void 0) { otherValidate = undefined; }
- if (fieldValidate === void 0) { fieldValidate = undefined; }
- return new Promise(function (resolve, reject) {
- var promiseArr = [];
- for (var i = 0; i < columnsSet.length; i++) {
- var fix = columnsSet[i].fix;
- if (_$2.isArray(fix) && fix.length > 0) {
- var ss = fix[0].toLowerCase();
- if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
- columnsSet[i].importFormatter = function (vdata) {
- // @ts-ignore
- return window.moment(vdata.ov) - 0;
- };
- }
- else {
- var fn = lookupFn(topScope, fix[0]);
- promiseArr.push(fn(null, columnsSet[i]));
- delete columnsSet[i].fix;
- }
- }
- else if (_$2.isString(fix)) {
- var ss = fix.toLowerCase();
- if (ss.indexOf("date") > -1 || ss.indexOf("time") > -1) {
- columnsSet[i].importFormatter = function (vdata) {
- // @ts-ignore
- return window.moment(vdata.ov) - 0;
- };
- }
- else {
- var fn = lookupFn(topScope, fix);
- promiseArr.push(fn(null, columnsSet[i]));
- delete columnsSet[i].fix;
- }
- }
- }
- var read = function () {
- readExcel(file).then(function (workbook) {
- var sheetNames = workbook.SheetNames; // 工作表名称集合
- var worksheet = workbook.Sheets[sheetNames[0]]; // 这里我们只读取第一张sheet
- var titleRowValue = [];
- var titleRowKey = [];
- var needLoop = false; // 是否需要迭代
- var columns = [];
- if (worksheet && worksheet["!ref"]) {
- var t = worksheet["!ref"];
- var tempArr = t.split(':');
- if (tempArr.length >= 2) {
- var firstRowNumber = tempArr[0].replace(/[^0-9]/ig, "");
- // 选取title的行,删除之前的行
- if (titleRowNumber > firstRowNumber) {
- for (var i = firstRowNumber; i < titleRowNumber; i++) {
- for (var key in worksheet) {
- if (key.endsWith(i) && key.replace(/[^0-9]/ig, "") === i) {
- delete worksheet[key];
- }
- }
- }
- var fc = tempArr[0].replace(/[^a-z]/ig, "");
- firstRowNumber = titleRowNumber + '';
- worksheet["!ref"] = fc + firstRowNumber + ":" + tempArr[1];
- }
- var lastRowNumber = tempArr[1].replace(/[^0-9]/ig, "");
- // const firstColNumber = tempArr[0].split(''+firstRowNumber)[0];
- // const lastColNumber = tempArr[1].split(''+lastRowNumber)[0];
- for (var key in worksheet) {
- if (key.endsWith(firstRowNumber) && key.replace(/[^0-9]/ig, "") === firstRowNumber) {
- titleRowKey.push(key);
- titleRowValue.push(worksheet[key].v);
- }
- }
- if (columnsSet && columnsSet.length > 0) {
- var length = columnsSet.length;
- length = length <= titleRowKey.length ? length : titleRowKey.length;
- for (var i = 0; i < length; i++) {
- var vk = titleRowKey[i];
- var item = columnsSet[i];
- var column = {};
- if (typeof item === 'string') {
- column.dataIndex = item;
- column.header = worksheet[vk].v;
- worksheet[vk] = { t: "s", v: item, h: item, w: item };
- }
- else if (typeof item.dataIndex === "string") {
- column.dataIndex = item.dataIndex;
- column.header = worksheet[vk].v;
- worksheet[vk] = { t: "s", v: item.dataIndex, h: item.dataIndex, w: item.dataIndex };
- if (typeof item.validate === "function") {
- column.validate = item.validate;
- needLoop = true;
- }
- if (typeof item.importFormatter === "function") {
- column.importFormatter = item.importFormatter;
- needLoop = true;
- }
- if ((item.data instanceof Array && item.data.length > 0)
- || _$2.isPlainObject(item.data) && Object.keys(item.data).length > 0) {
- column.data = item.data;
- needLoop = true;
- }
- }
- columns.push(column);
- }
- }
- }
- }
- if (fieldValidate && typeof fieldValidate === "function") {
- if (fieldValidate(columns, titleRowValue) !== true) {
- reject("fields validate error");
- return;
- }
- }
- var allData = XLSX.utils.sheet_to_json(worksheet);
- var okData = [], errorData = [], errorMsgData = [];
- var needItemLoop = needLoop;
- if (rowValidate && typeof rowValidate === "function") {
- needLoop = true;
- }
- if (needLoop === true) {
- for (var index = 0; index < allData.length; index++) {
- var row = allData[index];
- var rowNumber = dataStartRow + index;
- row.__importID__ = rowNumber;
- var isRowOk = true;
- if (needItemLoop) {
- var _loop_1 = function (num) {
- var column = columns[num];
- var ov = row[column.dataIndex];
- var nv = ov;
- var hasError = false;
- var rowNumber_1 = dataStartRow + index;
- var ei = {
- errorId: rowNumber_1 + '_' + column.dataIndex,
- importID: rowNumber_1,
- dataIndex: column.dataIndex,
- header: column.header,
- value: ov,
- errormessage: ""
- };
- // 格式化
- if (column.data instanceof Array) {
- nv = undefined;
- ei.errormessage = "字典匹配失败";
- _$2.forEach(column.data, function (v, index) {
- if (v.text === ov) {
- nv = v.id;
- return;
- }
- });
- }
- else if (_$2.isPlainObject(column.data)) {
- nv = undefined;
- ei.errormessage = "字典匹配失败";
- _$2.forEach(column.data, function (value, key) {
- if (value === ov) {
- nv = key;
- return;
- }
- });
- }
- if (typeof column.importFormatter === 'function') {
- var vdata = {
- column: column,
- ov: ov,
- nv: nv,
- rowIndex: index,
- data: row,
- rowDatas: allData
- };
- nv = undefined;
- ei.errormessage = "格式化失败";
- nv = column.importFormatter(vdata);
- }
- if (!nv && nv != 0) {
- hasError = true;
- }
- else {
- row[column.dataIndex] = nv;
- ei.errormessage = "";
- }
- // 校验
- if (typeof column.validate === 'function') {
- var vdata = {
- column: column,
- ov: ov,
- nv: nv,
- rowIndex: index,
- data: row,
- rowDatas: allData
- };
- var errormessage = column.validate(vdata);
- if (errormessage === true) ;
- else {
- hasError = true;
- ei.errormessage = ei.errormessage + "/" + errormessage;
- }
- }
- if (hasError === true) {
- isRowOk = false;
- errorMsgData.push(ei);
- }
- };
- for (var num = 0; num < columns.length; num++) {
- _loop_1(num);
- }
- }
- if (rowValidate && typeof rowValidate === "function") {
- var errormessage = rowValidate({
- columns: columns,
- data: row,
- rowIndex: index,
- rowDatas: allData
- });
- if (errormessage === true) ;
- else {
- isRowOk = false;
- var ei = {
- errorId: rowNumber + '',
- dataIndex: "row",
- header: "数据行",
- value: "当前行的数据",
- importID: rowNumber,
- errormessage: errormessage
- };
- errorMsgData.push(ei);
- }
- }
- row.__hasError__ = !isRowOk;
- if (isRowOk === true) {
- okData.push(row);
- }
- else {
- errorData.push(row);
- }
- }
- }
- else {
- // 添加数据的唯一标识
- for (var index = 0; index < allData.length; index++) {
- var row = allData[index];
- var rowNumber = dataStartRow + index;
- row.__importID__ = rowNumber;
- row.__hasError__ = false;
- }
- okData = allData;
- }
- if (otherValidate && typeof otherValidate === "function") {
- otherValidate({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData }, resolve);
- }
- else {
- resolve({ allData: allData, okData: okData, errorData: errorData, errorMsgData: errorMsgData });
- }
- // clearLoading()
- }).catch(function (e) {
- reject(e);
- });
- };
- if (promiseArr.length > 0) {
- Promise.all(promiseArr).then(function (resArr) {
- for (var i = 0; i < resArr.length; i++) {
- var tmp = resArr[i];
- tmp.config.data = [];
- if (tmp && tmp.r && Array.isArray(tmp.r.field) && Array.isArray(tmp.r.data)) {
- if (tmp.r.field.length > 1) {
- var keyKey = tmp.r.field[0];
- var valueKey = tmp.r.field[1];
- for (var j = 0; j < tmp.r.data.length; j++) {
- var it = tmp.r.data[j];
- var newIt = {};
- newIt.id = it[keyKey];
- newIt.text = it[valueKey];
- tmp.config.data.push(newIt);
- }
- }
- }
- }
- read();
- });
- }
- else {
- setTimeout(read, 50);
- }
- });
- }
- var ExcelImportDialog = /** @class */ (function (_super) {
- __extends(ExcelImportDialog, _super);
- function ExcelImportDialog(option) {
- var _this = this;
- var vjson = vjsonFunc(option);
- _this = _super.call(this, { model: model$d, vjson: vjson }) || this;
- _this.importExcelOption = option;
- return _this;
- }
- ExcelImportDialog.prototype.onLoad = function () {
- _super.prototype.onLoad.call(this);
- };
- ExcelImportDialog.prototype.fileChange = function (sender) {
- var _this = this;
- var file = sender.fileInputEl.dom.files[0];
- // const senderScope = lookupScope(sender)
- var topScope = this.topScope;
- var rowValidate = this.importExcelOption.rowValidate;
- if (this.importExcelOption.rowValidate && typeof this.importExcelOption.rowValidate === 'string') {
- rowValidate = lookupFn(topScope, this.importExcelOption.rowValidate).bind(topScope);
- }
- var afterClientValidate = this.importExcelOption.afterClientValidate;
- if (this.importExcelOption.afterClientValidate && typeof this.importExcelOption.afterClientValidate === 'string') {
- afterClientValidate = lookupFn(topScope, this.importExcelOption.afterClientValidate).bind(topScope);
- }
- var fieldValidate = this.importExcelOption.fieldValidate;
- if (this.importExcelOption.fieldValidate && typeof this.importExcelOption.fieldValidate === 'string') {
- fieldValidate = lookupFn(topScope, this.importExcelOption.fieldValidate).bind(topScope);
- }
- this.setLoading(true);
- readExcelWithColumnsSet(topScope, file, this.importExcelOption.columns, this.importExcelOption.dataStartRow, this.importExcelOption.titleRowNumber, rowValidate, afterClientValidate, fieldValidate).then(function (res) {
- _this.importData = res;
- _this.refs.dataGrid.setData(res.allData);
- _this.viewModel.set("dataCount", res.allData.length);
- _this.refs.errGrid.setData(res.errorMsgData);
- _this.viewModel.set("errMsgCount", res.errorMsgData.length);
- }).catch(function (e) {
- _this.importData = null;
- _this.refs.dataGrid.setData();
- _this.refs.errGrid.setData();
- msg(e.toString());
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- ExcelImportDialog.prototype.getDataGridRowRecord = function (record, rowIndex, rowParams, store) {
- if (record.get('__hasError__')) {
- return "x-grid-record-bg-red";
- }
- };
- ExcelImportDialog.prototype.getErrGridRowRecord = function (record, rowIndex, rowParams, store) {
- return "x-grid-record-bg-red";
- };
- ExcelImportDialog.prototype.dataGridClick = function (sender, td, cellIndex, record, item, index, e, eOpts) {
- var _a;
- var id = record.data.__importID__;
- var subId = this.refs.dataGrid.headerCt.getGridColumns()[cellIndex].dataIndex;
- var selectRecord = null;
- var dataIndex = -1;
- var rows = (_a = this.refs.errGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
- for (var i = 0; i < rows.length; i++) {
- if (rows[i].importID === id) {
- selectRecord = this.refs.errGrid.getStore().getAt(i);
- dataIndex = i;
- }
- if (rows[i].errorId === id + "_" + subId) {
- selectRecord = this.refs.errGrid.getStore().getAt(i);
- dataIndex = i;
- break;
- }
- }
- if (selectRecord) {
- this.refs.errGrid.ensureVisible(selectRecord);
- this.refs.errGrid.selModel.select(dataIndex);
- // this.refs.errGrid.reload()
- }
- };
- ExcelImportDialog.prototype.errGridClick = function (sender, record, item, index, e, eOpts) {
- var _a;
- var id = record.data.importID;
- var rows = (_a = this.refs.dataGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
- var selectRecord = null;
- var dataIndex = -1;
- for (var i = 0; i < rows.length; i++) {
- if (rows[i].__importID__ === id) {
- selectRecord = this.refs.dataGrid.getStore().getAt(i);
- dataIndex = i;
- break;
- }
- }
- if (selectRecord) {
- this.refs.dataGrid.ensureVisible(selectRecord);
- this.refs.dataGrid.selModel.select(dataIndex);
- // this.refs.dataGrid.reload()
- }
- };
- ExcelImportDialog.prototype.filterData = function (sender, newValue, oldValue, eOpts) {
- this.viewModel.set("dataType", newValue);
- if (this.importData) {
- this.refs.dataGrid.setData(this.importData[newValue]);
- this.viewModel.set("dataCount", this.importData[newValue].length);
- }
- };
- ExcelImportDialog.prototype.downloadTemplate = function (sender) {
- if (this.importExcelOption.dowLoadUrl && this.importExcelOption.dowLoadUrl.length > 0) {
- window.location.href = this.importExcelOption.dowLoadUrl;
- return;
- }
- var xt = [];
- _$2.forEach(this.importExcelOption.columns, function (v) {
- xt.push(v.header);
- });
- var filename = this.importExcelOption.templateName ? this.importExcelOption.templateName : "模版"; //文件名称
- if (filename.endsWith(".xlsx")) {
- filename = filename.split(".xlsx")[0];
- }
- filename = filename + ".xlsx";
- var ws_name = "Sheet1"; //Excel第一个sheet的名称
- var wb = XLSX.utils.book_new(), ws = XLSX.utils.aoa_to_sheet([xt]);
- XLSX.utils.book_append_sheet(wb, ws, ws_name); //将数据添加到工作薄
- XLSX.writeFile(wb, filename); //导出Excel
- };
- ExcelImportDialog.prototype.getData = function (sender) {
- _$2.each(this.importData.okData, function (item) {
- delete item.id;
- delete item.__hasError__;
- delete item.__importID__;
- delete item._origin;
- });
- _$2.each(this.importData.allData, function (item) {
- delete item.id;
- delete item.__hasError__;
- delete item.__importID__;
- delete item._origin;
- });
- _$2.each(this.importData.errorData, function (item) {
- delete item.id;
- delete item.__hasError__;
- delete item.__importID__;
- delete item._origin;
- });
- this.dialogSuccess(this.importData);
- };
- return ExcelImportDialog;
- }(Scope));
- var model$d = {
- data: {
- dataType: "all",
- errMsgCount: 0,
- dataCount: 0
- }
- };
- var vjsonFunc = function (option) {
- return {
- title: option.title || 'excel导入',
- layout: 'fit',
- items: [
- {
- layout: 'border',
- tbar: {
- xtype: "form",
- items: [
- {
- xtype: "cols",
- items: [
- {
- xtype: "filefield",
- fieldLabel: 'excel文件',
- buttonText: '请选择excel文件',
- accept: ".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel",
- flex: 3,
- listeners: {
- change: "scope.fileChange"
- }
- }, {
- xtype: "button",
- iconCls: "x-fa fa-download",
- text: "下载模版",
- listeners: {
- click: "scope.downloadTemplate"
- }
- }, {
- xtype: 'container',
- border: false,
- layout: 'hbox',
- }, {
- xtype: "button",
- iconCls: "x-fa fa-upload",
- text: option.tQButtonText || "提取数据",
- listeners: {
- click: "scope.getData"
- }
- }
- ]
- },
- ]
- },
- items: [
- {
- tbar: {
- xtype: "toolbar",
- title: "导入的数据",
- items: [{
- xtype: 'label',
- html: '<span style="font-size: 14px; font-weight: bold">导入的数据</span>',
- }, {
- xtype: 'radiogroup',
- items: [
- {
- boxLabel: '所有数据',
- checked: true,
- inputValue: 'allData',
- }, {
- boxLabel: '正确数据',
- inputValue: 'okData',
- }, {
- boxLabel: '错误数据',
- inputValue: 'errorData',
- }
- ],
- listeners: {
- change: 'scope.filterData',
- },
- }, {
- xtype: "textfield",
- readOnly: true,
- fieldLabel: "条目数",
- bind: "{dataCount}"
- }]
- },
- xtype: 'yvgrid',
- reference: 'dataGrid',
- layout: 'fit',
- pagination: false,
- // pageSize: 50,
- getRowClass: 'scope.getDataGridRowRecord',
- columns: option.columns,
- region: 'center',
- split: true,
- listeners: {
- cellclick: "scope.dataGridClick",
- },
- selModel: {
- // type: 'rowmodel',
- mode: 'SINGLE',
- },
- }, {
- tbar: {
- xtype: "toolbar", items: [
- {
- xtype: 'label',
- html: '<span style="font-size: 14px; font-weight: bold; color: red">错误信息</span>',
- }, {
- xtype: "textfield",
- readOnly: true,
- fieldLabel: "条目数",
- bind: "{errMsgCount}"
- }
- ]
- },
- xtype: 'yvgrid',
- reference: 'errGrid',
- layout: 'fit',
- pagination: false,
- getRowClass: 'scope.getErrGridRowRecord',
- height: "40%",
- columns: [
- { dataIndex: "errorId", header: "ID", hidden: true },
- { dataIndex: "importID", header: "行号", width: 80 },
- { dataIndex: "errormessage", header: "错误信息", width: 200 },
- { dataIndex: "value", header: "值", width: 120 },
- { dataIndex: "header", header: "字段名", width: 120 },
- { dataIndex: "dataIndex", header: "字段", width: 120 }
- ],
- region: 'south',
- split: true,
- listeners: {
- itemclick: "scope.errGridClick"
- },
- selModel: {
- // type: 'rowmodel',
- mode: 'SINGLE',
- },
- },
- ],
- },
- ],
- referenceHolder: true,
- };
- };
- function buildReportScope(config, reportId, invokeServerFn, getDictFnName) {
- var _a = buildVjson$1(config, invokeServerFn, getDictFnName), model = _a.model, vjson = _a.vjson, report = _a.report;
- var ret = new ReportScope({ model: model, vjson: vjson }, invokeServerFn);
- ret.report_id = reportId;
- ret.report = report;
- return ret;
- }
- function buildVjson$1(config, invokeServerFn, getDictFnName) {
- var e_1, _a, e_2, _b;
- var model = {
- data: {
- report_name: config.report_name,
- query: {},
- sum: {},
- }
- };
- var json5 = window['YvanUI'].json5;
- var report = config.report ? json5.parse(config.report) : {};
- var conditionRows = [];
- var sumRows = [];
- model.data.has_sum = _$2.size(report.summary) > 0;
- // query 查询条件
- var newRow = false;
- var currentRow = { xtype: 'cols', items: [], };
- conditionRows.push(currentRow);
- _$2.forEach(report.query, function (item) {
- if (newRow) {
- currentRow = { xtype: 'cols', items: [], };
- conditionRows.push(currentRow);
- }
- var vj = json5.parse(item.conditionFieldExtend);
- if (item.conditionFieldXtype) {
- vj.xtype = item.conditionFieldXtype;
- if (item.conditionFieldXtype === 'combo') {
- vj.fix = ['system.' + getDictFnName + '("' + item.conditionFieldDict + '")'];
- }
- if (item.conditionFieldXtype === 'datetimefield') {
- // console.log("#####", item)
- if ((item === null || item === void 0 ? void 0 : item.conditionFieldBind) === "start_time") {
- //@ts-ignore
- _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD 00:00:00'));
- }
- else if ((item === null || item === void 0 ? void 0 : item.conditionFieldBind) === "end_time") {
- //@ts-ignore
- _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).add(1, 'days').format('YYYY-MM-DD 00:00:00'));
- }
- else {
- //@ts-ignore
- _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD 00:00:00'));
- }
- }
- else if (item.conditionFieldXtype === 'datefield') {
- //@ts-ignore
- _$2.set(model.data.query, item.conditionFieldBind, moment(window.getServerTime()).format('YYYY-MM-DD'));
- }
- else {
- model.data.query[item.conditionFieldBind] = '';
- }
- }
- else {
- // 没有组件类型,是个空占位符
- vj.border = false;
- }
- if (item.conditionFieldBind) {
- vj.bind = {
- value: '{query.' + item.conditionFieldBind + '}'
- };
- }
- if (item.conditionFieldFlex) {
- vj.flex = item.conditionFieldFlex;
- }
- if (item.conditionFieldXtype) {
- vj.fieldLabel = item.conditionFieldLabel;
- }
- if (item.fieldLabel) {
- vj.fieldLabel = item.fieldLabel;
- }
- newRow = item.conditionFieldWrap || false;
- currentRow.items.push(vj);
- });
- if (currentRow) {
- currentRow.margin = '10 0 10 0';
- }
- // sum 汇总条件
- newRow = true;
- try {
- for (var _c = __values(report.summary), _d = _c.next(); !_d.done; _d = _c.next()) {
- var item = _d.value;
- if (newRow) {
- currentRow = {
- xtype: 'cols',
- defaultType: 'displayfield',
- defaults: {
- labelWidth: 70,
- },
- items: []
- };
- sumRows.push(currentRow);
- }
- var vj = __assign({}, json5.parse(item.sumFieldExtend));
- if (item.sumFieldBind) {
- vj.bind = '{sum.' + item.sumFieldBind + '}';
- model.data.sum[item.sumFieldBind] = '';
- }
- else {
- // 没有组件类型,是个空占位符
- vj.border = false;
- }
- if (item.sumFieldFlex) {
- vj.flex = item.sumFieldFlex;
- }
- if (item.sumFieldLabel) {
- vj.fieldLabel = item.sumFieldLabel;
- }
- // sumFieldBind: "zs"
- // sumFieldExtend: "{}"
- // sumFieldFlex: 1
- // sumFieldLabel: "总数"
- // sumFieldWrap: false
- newRow = item.sumFieldWrap || false;
- currentRow.items.push(vj);
- }
- }
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
- finally {
- try {
- if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
- }
- finally { if (e_1) throw e_1.error; }
- }
- if (currentRow) {
- currentRow.margin = '10 0 10 0';
- }
- // column 结果字段
- var columns = [];
- try {
- for (var _e = __values(report.columns), _f = _e.next(); !_f.done; _f = _e.next()) {
- var item = _f.value;
- var vj = __assign({ dataIndex: item.dataIndex, header: item.header, hidden: item.hidden, sortable: item.sortable, filterable: item.filterable }, json5.parse(item.fieldExtend));
- if (item.xtype) {
- if (item.xtype == 'checkbox') {
- vj.xtype = 'checkcolumn';
- vj.disabled = true;
- }
- else {
- vj.xtype = item.xtype;
- }
- }
- if (item.dataType) {
- vj.dataType = item.dataType;
- }
- if (item.align) {
- vj.align = item.align;
- }
- if (item.width) {
- vj.width = item.width;
- }
- if (item.dict) {
- vj.fix = ['system.' + getDictFnName + '("' + item.dict + '")'];
- }
- columns.push(vj);
- }
- }
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
- finally {
- try {
- if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
- }
- finally { if (e_2) throw e_2.error; }
- }
- var vjson = {
- bind: {
- title: '{report_name}',
- },
- layout: 'fit',
- referenceHolder: true,
- items: [
- {
- layout: 'border',
- border: false,
- items: [
- {
- region: 'north',
- border: false,
- tbar: {
- xtype: 'toolbar',
- border: false,
- items: [
- {
- xtype: 'button',
- text: '查询',
- reference: 'btnSearch',
- iconCls: 'x-fa fa-search',
- listeners: {
- click: 'scope.reload',
- },
- },
- {
- xtype: 'button',
- text: '关闭',
- iconCls: 'x-fa fa-times',
- listeners: {
- click: 'system.closeMe()',
- },
- },
- ],
- },
- defaults: {
- margin: '8 0 0 0'
- },
- items: __spread(conditionRows, sumRows),
- fix: ['system.enterToClick("btnSearch")'],
- },
- __assign({ region: 'center', xtype: 'yvgrid', reference: 'grid1', border: false, selModel: { selType: 'rowmodel', mode: 'SINGLE', }, autoLoad: false, dataSource: {
- method: 'invoke',
- url: '/report/Report@execute',
- params: {
- dataSource: report.dataSource,
- pagination: report.grid.pagination || true,
- report_id: config.report_id,
- query: '{query}',
- },
- }, columns: columns }, report.grid),
- ],
- },
- ],
- };
- return { model: model, vjson: vjson, report: report };
- }
- var ReportScope = /** @class */ (function (_super) {
- __extends(ReportScope, _super);
- function ReportScope(_a, invokeServerFn) {
- var model = _a.model, vjson = _a.vjson;
- var _this = _super.call(this, { model: model, vjson: vjson, i18n: null }) || this;
- _this.invokeServerFn = invokeServerFn;
- return _this;
- }
- ReportScope.prototype.onLoad = function () {
- // this.reload()
- };
- ReportScope.prototype.reload = function () {
- var _this = this;
- // http://127.0.0.1:8095/api/com/galaxis/wms/report/Report@executeSum
- if (this.viewModel.get('has_sum')) {
- this.invokeServerFn('/report/Report@executeSum', {
- dataSource: this.report.dataSource,
- report_id: this.report_id,
- query: this.viewModel.get('query'),
- }).then(function (res) {
- if (!res.success) {
- showErrorDialog$1(res.msg);
- }
- else {
- window['system'].mergeViewModel(_this.viewModel, 'sum', res.data, false);
- }
- });
- }
- this.refs.grid1.reload();
- };
- return ReportScope;
- }(Scope));
- var model$e = {
- data: {
- form: {
- resource_parent: '',
- resource_name: '',
- resource_icon: '',
- scope_url: '',
- scope_params: '',
- resource_order: '',
- permission_code: '',
- },
- }
- };
- var vjson$d = {
- title: '注册模块',
- layout: 'fit',
- width: "40%",
- height: "50%",
- fbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: "button",
- text: "确定",
- iconCls: 'x-fa fa-check',
- listeners: {
- click: 'scope.saveNode',
- }
- },
- {
- xtype: "button",
- text: "关闭",
- iconCls: 'x-fa fa-times',
- listeners: {
- click: 'system.closeMe()',
- }
- },
- ]
- },
- items: [
- {
- layout: 'border',
- items: [
- {
- region: 'west',
- layout: 'fit',
- xtype: 'tabpanel',
- reference: 'tabs',
- width: "50%",
- split: true,
- listeners: {
- tabchange: 'scope.tabchange',
- },
- items: [
- {
- region: 'center',
- layout: 'fit',
- title: 'PC菜单',
- key: "1",
- items: [
- {
- xtype: 'treepanel',
- layout: 'fit',
- region: 'west',
- rootVisible: false,
- useArrows: true,
- reference: 'tree1',
- listeners: {
- itemclick: "scope.tree1NodeClick",
- }
- },
- ]
- },
- {
- region: 'center',
- layout: 'fit',
- title: 'PDA菜单',
- key: "2",
- items: [
- {
- xtype: 'treepanel',
- layout: 'fit',
- region: 'west',
- reference: 'tree2',
- rootVisible: false,
- useArrows: true,
- listeners: {
- itemclick: "scope.tree1NodeClick",
- }
- },
- ]
- },
- ]
- },
- {
- region: 'center',
- xtype: 'form',
- margin: '0 0 0 0',
- split: true,
- width: '50%',
- items: [
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '上级资源ID',
- bind: {
- readOnly: true,
- disabled: true,
- value: '{form.resource_parent}'
- },
- },
- ],
- },
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '资源名称',
- bind: {
- value: '{form.resource_name}'
- },
- allowBlank: false,
- },
- ],
- },
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'numberfield',
- fieldLabel: '资源排序',
- bind: {
- value: '{form.resource_order}'
- },
- allowBlank: false,
- },
- ],
- },
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '功能URL',
- bind: {
- disabled: true,
- value: '{form.scope_url}'
- },
- },
- ]
- },
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '权限编码',
- bind: {
- value: '{form.permission_code}'
- }
- },
- ],
- },
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '功能参数',
- bind: {
- value: '{form.scope_params}'
- }
- },
- ],
- },
- ],
- },
- ],
- },
- ],
- referenceHolder: true,
- };
- var RegisterModule = /** @class */ (function (_super) {
- __extends(RegisterModule, _super);
- function RegisterModule() {
- return _super.call(this, { model: model$e, vjson: vjson$d }) || this;
- }
- RegisterModule.prototype.onLoad = function () {
- this.reloadTree("PC");
- };
- RegisterModule.prototype.tabchange = function (a, b, c, d) {
- var currTabKey = b.key;
- if (currTabKey === '1') {
- this.viewModel.set('form', '');
- this.reloadTree("PC");
- }
- else {
- this.viewModel.set('form', '');
- this.reloadTree("PDA");
- }
- };
- RegisterModule.prototype.reloadTree = function (type) {
- var _this = this;
- if ("PC" === type) {
- this.setLoading(true);
- getMenuTree({ type: "PC" }).then(function (res) {
- if (res.success) {
- _this.refs.tree1.store.setRootNode({
- expanded: true,
- children: res.data
- });
- }
- }).finally(function () {
- _this.setLoading(false);
- });
- }
- else {
- this.setLoading(true);
- getMenuTree({ type: "PDA" }).then(function (res) {
- if (res.success) {
- _this.refs.tree2.store.setRoot({
- expanded: true,
- children: res.data
- });
- }
- }).finally(function () {
- _this.setLoading(false);
- });
- }
- };
- RegisterModule.prototype.tree1NodeClick = function (tree, node) {
- var id = _$2.split(node.data.id, '_')[1];
- if (!id) {
- return;
- }
- this.viewModel.set('form.resource_parent', id);
- };
- RegisterModule.prototype.saveNode = function () {
- var _this = this;
- var tabKey = this.refs.tabs.activeTab.key;
- // 检验菜单数据
- var param = this.viewModel.get('form');
- if (!param.resource_parent) {
- msg('请选择一个父节点');
- return;
- }
- if (!param.resource_name) {
- msg('资源名称不能为空');
- return;
- }
- if (!param.scope_url) {
- msg('功能URL不能为空');
- return;
- }
- var type;
- if (tabKey === '1') {
- type = 'PC';
- }
- else {
- type = 'PDA';
- }
- this.setLoading(true);
- registerResource(__assign(__assign({}, param), { type: type })).then(function (res) {
- if (res.success) {
- msg("注册成功");
- _this.close();
- }
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- return RegisterModule;
- }(Scope));
- var model$f = {
- data: {
- title: "模板选择",
- // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;5:主/详情查询
- moduleType: 1,
- // 当前模块包路径 "com/galaxis/wms/bas/area"
- packagePath: "",
- // 当前模块文件保存路径 "D:/SourceCode/jztd/wms8-bench/wms-biz/bundle/src/com/galaxis/wms/bas/area"
- fileSavePath: "",
- // 模块名称 "Dict"
- moduleName: "NewModule",
- // 页面标题 "字典维护"
- pageTitle: "新模块",
- // 单表查询
- singleTable: {
- sql: "select * from bas_dict",
- // 新增或者删除所用的表
- tableName: "",
- // 是否分页查询
- pagination: true,
- // 是否需要删除
- delete: true,
- // 删除条件字段
- deleteWhereColumn: "",
- // 删除提示语
- deleteTips: "确定要删除?",
- // 编辑类型: 1 不要新增和编辑; 2 表格内新增/编辑; 3对话框新增/编辑;
- editType: 2,
- },
- singleTableView: {
- tableNameList: [
- // { value: "aaa"},
- ],
- columnList: [
- // { value: "aaa"},
- ],
- }
- }
- };
- var vjson$e = {
- bind: {
- title: '新建模块-{title}',
- },
- width: "55%",
- height: "60%",
- minWidth: 500,
- minHeight: 400,
- modal: true,
- frame: true,
- layout: 'card',
- bbar: [
- '->',
- {
- itemId: 'card-prev',
- text: '« 上一步',
- disabled: true,
- listeners: {
- click: 'scope.showPrevious',
- },
- },
- {
- itemId: 'card-next',
- text: '下一步 »',
- listeners: {
- click: 'scope.showNext',
- },
- },
- {
- itemId: 'card-finish',
- text: '立刻执行',
- iconCls: 'x-fa fa-flash',
- hidden: true,
- listeners: {
- click: 'scope.finish',
- },
- },
- ],
- items: [
- {
- vtitle: '模板选择',
- reference: 'templateSelection',
- layout: {
- type: 'hbox',
- pack: 'start',
- align: 'stretch'
- },
- listeners: {
- cardEnter: 'scope.templateEnter',
- cardLevel: 'scope.templateLevel'
- },
- items: [
- {
- width: 150,
- xtype: 'form',
- border: false,
- layout: {
- type: 'vbox',
- align: 'stretch'
- },
- defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- },
- items: [
- {
- xtype: 'radiogroup',
- bind: {
- value: '{moduleType}'
- },
- layout: 'vbox',
- defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- },
- items: [
- { boxLabel: '单表查询', inputValue: 1 },
- { boxLabel: '主/明细查询', inputValue: 2 },
- { boxLabel: '树/明细查询', inputValue: 3 },
- { boxLabel: '卡片表单', inputValue: 4 },
- { boxLabel: '主/详情查询', inputValue: 5 },
- ]
- },
- ]
- },
- {
- flex: 1,
- region: 'center',
- xtype: "panel",
- border: false,
- frame: true,
- padding: "4px 8px",
- html: "描述...",
- }
- ]
- },
- {
- vtitle: '模块名称',
- reference: 'moduleName',
- layout: 'fit',
- listeners: {
- cardEnter: 'scope.moduleEnter',
- cardLevel: 'scope.moduleLevel'
- },
- items: [
- {
- xtype: 'form',
- border: false,
- layout: {
- type: 'vbox',
- align: 'stretch'
- },
- defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- },
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '包路径',
- allowBlank: false,
- bind: { value: '{packagePath}' },
- },
- {
- xtype: 'textfield',
- fieldLabel: '文件路径',
- allowBlank: false,
- bind: { value: '{fileSavePath}' },
- },
- {
- xtype: 'textfield',
- fieldLabel: '模块名',
- allowBlank: false,
- bind: { value: '{moduleName}' },
- },
- {
- xtype: 'textfield',
- fieldLabel: '菜单名',
- allowBlank: false,
- bind: { value: '{pageTitle}' },
- },
- ]
- },
- ]
- },
- {
- vtitle: '确认结果',
- reference: 'confirmResult',
- layout: 'fit',
- listeners: {
- cardEnter: 'scope.optionEnter',
- cardLevel: 'scope.optionLevel',
- },
- items: [
- {
- xtype: 'jsoneditor',
- reference: 'jsoneditor'
- }
- ]
- },
- // ---------------------------------------------------------------------------------- 单表查询
- {
- vtitle: '查询SQL',
- reference: 'singleTable_1',
- layout: 'fit',
- listeners: {
- cardEnter: 'scope.editorEnter',
- cardLevel: 'scope.editorLevel'
- },
- items: [
- {
- xtype: 'sqleditor',
- }
- ],
- },
- {
- vtitle: '字段选项',
- reference: 'singleTable_2',
- layout: 'fit',
- listeners: {
- cardEnter: 'scope.columnEnter',
- cardLevel: 'scope.columnLevel',
- },
- items: [
- {
- xtype: 'yvgrid',
- border: false,
- selModel: {
- type: 'spreadsheet',
- columnSelect: true,
- pruneRemoved: false,
- extensible: 'y'
- },
- plugins: {
- clipboard: true,
- selectionreplicator: true
- },
- reference: 'grid1',
- idField: 'column_name',
- hideFootbar: true,
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'scope.addField'
- }
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'scope.removeField'
- }
- },
- {
- xtype: 'button',
- text: '分析SQL',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'scope.parseSQL'
- }
- },
- ]
- },
- columns: [
- {
- text: '字段名', dataIndex: 'column_name',
- sortable: false,
- menuDisabled: true,
- width: 150,
- editor: {
- allowBlank: true,
- selectOnFocus: false,
- }
- },
- {
- text: '字段中文', dataIndex: 'column_comment',
- width: 150,
- sortable: false,
- menuDisabled: true,
- editor: {
- allowBlank: true,
- selectOnFocus: false,
- }
- },
- {
- dataIndex: "column_useto",
- // fix: ['system.getDict("column_useto")'],
- header: "用途",
- editor: {
- xtype: 'combo',
- allowBlank: false,
- },
- },
- {
- text: '主键', dataIndex: 'is_primary_key',
- xtype: 'checkcolumn', sortable: false, menuDisabled: true,
- width: 48, resizable: false,
- },
- {
- text: '必填', dataIndex: 'not_null',
- xtype: 'checkcolumn', sortable: false, menuDisabled: true,
- width: 48, resizable: false,
- },
- {
- text: '长度', dataIndex: 'column_size',
- sortable: false, menuDisabled: true,
- xtype: 'numbercolumn', format: '0',
- editor: { allowBlank: true, selectOnFocus: true }
- },
- {
- text: '字典', dataIndex: 'column_dict',
- sortable: false, menuDisabled: true,
- width: 200,
- editor: {
- allowBlank: true,
- }
- },
- {
- text: 'UI组件', dataIndex: 'column_ui',
- sortable: false, menuDisabled: true,
- // fix: ['system.getDict("column_ui")'],
- width: 150,
- editor: {
- xtype: 'combo',
- allowBlank: true,
- }
- },
- {
- dataIndex: 'data_type',
- hidden: true,
- },
- ]
- }
- ],
- },
- {
- vtitle: '其他选项',
- reference: 'singleTable_3',
- isEnd: true,
- listeners: {
- cardEnter: 'scope.extendEnter',
- cardLevel: 'scope.extendLevel',
- },
- layout: 'fit',
- items: [
- {
- xtype: 'form',
- border: false,
- layout: {
- type: 'vbox',
- align: 'stretch'
- },
- defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- },
- items: [
- {
- xtype: 'checkbox',
- fieldLabel: '需要分页',
- labelWidth: 100,
- bind: {
- value: '{singleTable.pagination}',
- },
- },
- {
- xtype: 'combobox',
- fieldLabel: '操作数据库表',
- labelWidth: 100,
- publishes: 'singleTable.tableName',
- displayField: 'value',
- valueField: 'value',
- bind: {
- data: '{singleTableView.tableNameList}',
- value: '{singleTable.tableName}',
- },
- },
- {
- xtype: 'checkboxfield',
- fieldLabel: '需要删除',
- labelWidth: 100,
- bind: {
- value: '{singleTable.delete}',
- },
- },
- {
- xtype: 'combobox',
- fieldLabel: '删除条件字段',
- labelWidth: 100,
- publishes: 'singleTable.deleteWhereColumn',
- displayField: 'value',
- valueField: 'value',
- bind: {
- data: '{singleTableView.columnList}',
- hidden: '{!singleTable.delete}',
- value: '{singleTable.deleteWhereColumn}',
- },
- },
- {
- xtype: 'textfield',
- fieldLabel: '删除提示语句',
- labelWidth: 100,
- bind: {
- hidden: '{!singleTable.delete}',
- value: '{singleTable.deleteTips}',
- },
- },
- {
- fieldLabel: '新增与编辑',
- labelWidth: 100,
- xtype: 'radiogroup',
- bind: {
- value: '{singleTable.editType}'
- },
- layout: 'vbox',
- defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- },
- items: [
- { boxLabel: '不要新增和编辑', inputValue: 1 },
- { boxLabel: '表格内新增/编辑', inputValue: 2 },
- { boxLabel: '对话框新增/编辑', inputValue: 3 },
- ]
- },
- ]
- }
- ]
- },
- // ---------------------------------------------------------------------------------- 主/明细查询
- {
- vtitle: '主表查询SQL',
- reference: 'mainDetailTable_1',
- layout: 'fit',
- listeners: {},
- items: [],
- },
- {
- vtitle: '主表字段选项',
- reference: 'mainDetailTable_2',
- layout: 'fit',
- listeners: {},
- items: [],
- },
- {
- vtitle: '主表其他选项',
- reference: 'mainDetailTable_3',
- layout: 'fit',
- listeners: {},
- items: [],
- },
- {
- vtitle: '子表查询SQL',
- reference: 'mainDetailTable_4',
- layout: 'fit',
- listeners: {},
- items: [],
- },
- {
- vtitle: '子表字段选项',
- reference: 'mainDetailTable_5',
- layout: 'fit',
- listeners: {},
- items: [],
- },
- {
- vtitle: '子表其他选项',
- reference: 'mainDetailTable_6',
- isEnd: true,
- layout: 'fit',
- listeners: {},
- items: [],
- },
- // ---------------------------------------------------------------------------------- 树/明细查询
- // ---------------------------------------------------------------------------------- 卡片表单
- {
- vtitle: '表单字段',
- reference: 'cardForm_1',
- layout: 'fit',
- listeners: {},
- items: [],
- },
- {
- vtitle: '表单初始化',
- reference: 'cardForm_2',
- isEnd: true,
- layout: 'fit',
- listeners: {},
- items: [],
- },
- ]
- };
- // noinspection TypeScriptCheckImport
- function getSingleTableData(origin) {
- return getQueryDslInfo(origin.tableName).then(function (queryDslInfo) {
- var _a, _b, _c;
- var data = {
- pagination: (_a = origin.pagination) !== null && _a !== void 0 ? _a : true,
- package: _$2.replace(origin.packagePath, /\//g, "."),
- groovyClass: origin.moduleName,
- qClass: queryDslInfo.qClass,
- qClassTable: queryDslInfo.qClassTable,
- queryColumns: [],
- insertColumns: [],
- updateColumns: [],
- updateWheres: [],
- deleteWheres: [],
- gridColumns: [],
- sql: origin.sql,
- pageTitle: (_b = origin.pageTitle) !== null && _b !== void 0 ? _b : "新模块",
- addButton: origin.editType !== 1,
- saveButton: origin.editType === 2,
- deleteButton: true,
- deleteTips: (_c = origin.deleteTips) !== null && _c !== void 0 ? _c : "真的要删除?",
- invokeUrlPrefix: origin.packagePath.replace("com/galaxis/wms", "") + "/" + origin.moduleName,
- fileSavePath: origin.fileSavePath,
- };
- origin.columnList.forEach(function (column) {
- 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;
- var query = origin.queryColumns.indexOf(column_name) >= 0;
- var insert = origin.insertColumns.indexOf(column_name) >= 0;
- var update = origin.updateColumns.indexOf(column_name) >= 0;
- var grid = origin.gridColumns.indexOf(column_name) >= 0;
- var dslField = queryDslInfo.fields.find(function (field) { return column_name === field.columnName; });
- var qClassField = dslField.qClassField, dbConvMethod = dslField.dbConvMethod;
- if (query) {
- data.queryColumns.push({ column_name: column_name, column_dict: column_dict, column_ui: column_ui });
- }
- if (insert) {
- data.insertColumns.push({ qClassField: qClassField, paramField: column_name });
- }
- if (update) {
- data.updateColumns.push({ qClassField: qClassField, paramField: column_name });
- }
- if (grid) {
- var gridColumn = { dataIndex: column_name, header: column_comment, fix: undefined, editor: undefined };
- if (column_dict) {
- gridColumn.fix = { dictName: column_dict };
- }
- if (origin.editType == 2 && (insert || update)) {
- gridColumn.editor = { xtype: column_ui, fix: undefined };
- if (column_dict) {
- gridColumn.editor.fix = { dictName: column_dict };
- }
- }
- data.gridColumns.push(gridColumn);
- }
- if (is_primary_key) {
- data.updateWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
- data.deleteWheres.push({ qClassField: qClassField, dbConvMethod: dbConvMethod, paramField: column_name });
- }
- });
- return data;
- });
- }
- // noinspection HttpUrlsUsage
- var urlPrefix = "/static/studio-template/single_table";
- function generateCode(data) {
- return Promise.all([
- request.get(urlPrefix + "/groovy.hbs", { responseType: 'text' }),
- request.get(urlPrefix + "/mybatis.hbs", { responseType: 'text' }),
- request.get(urlPrefix + "/controller.hbs", { responseType: 'text' }),
- request.get(urlPrefix + "/view.hbs", { responseType: 'text' }),
- request.get(urlPrefix + "/model.hbs", { responseType: 'text' }),
- ]).then(function (values) {
- var groovy = handlebars.compile(values[0]);
- var mybatis = handlebars.compile(values[1]);
- var controller = handlebars.compile(values[2]);
- var view = handlebars.compile(values[3]);
- var model = handlebars.compile(values[4]);
- var code = {
- groovy: groovy(data),
- mybatis: mybatis(data),
- controller: controller(data),
- view: view(data),
- model: model(data),
- };
- return code;
- });
- }
- var CreateModule = /** @class */ (function (_super) {
- __extends(CreateModule, _super);
- function CreateModule() {
- var _this = _super.call(this, { model: model$f, vjson: vjson$e }) || this;
- _this.columns = [];
- return _this;
- }
- CreateModule.prototype.onLoad = function () {
- this.refs.grid1.setData([]);
- };
- CreateModule.prototype.addField = function () {
- this.refs.grid1.appendEditRow({
- column_name: '',
- column_comment: '',
- is_primary_key: false,
- not_null: true,
- column_domain: '',
- data_type: '',
- column_size: 0,
- decimal_digits: 0,
- default_value: '',
- column_dict: '',
- column_ui: '',
- column_note: '',
- }, 0);
- };
- CreateModule.prototype.removeField = function () {
- var _this = this;
- var rows = [];
- this.refs.grid1.getSelectionModel().getSelected().eachRow(function (r) {
- rows.push(r);
- });
- _$2.forEach(rows, function (r) {
- _this.refs.grid1.getStore().remove(r);
- });
- };
- CreateModule.prototype.parseSQL = function (sender) {
- var _this = this;
- var sql = this.viewModel.get('singleTable.sql');
- sender.up('window').setLoading(true);
- instance$1.reloadIfNeedPromise(undefined).then(function (res) {
- parseSqlApi(sql).then(function (parseResult) {
- if (!parseResult.success) {
- msg(parseResult.msg);
- return;
- }
- var tableNameList = [];
- var columnList = [];
- var singleTableTableName;
- var singleTableDeleteWhereColumn;
- _this.refs.grid1.setData([]);
- var rows = _this.refs.grid1.getDataRows();
- _$2.forEach(parseResult.data, function (parseRetColumn) {
- var columnName = parseRetColumn.columnName, tableName = parseRetColumn.tableName;
- if (!columnName || _$2.indexOf(columnName, '?') >= 0) {
- return;
- }
- if (tableNameList.findIndex(function (row) { return tableName === row.value; }) < 0)
- tableNameList.push({ value: tableName });
- if (columnList.findIndex(function (row) { return columnName === row.value; }) < 0)
- columnList.push({ value: columnName });
- if (!singleTableTableName)
- singleTableTableName = tableName;
- if (!singleTableDeleteWhereColumn)
- singleTableDeleteWhereColumn = columnName;
- // 已经加过这个列了
- var rowExists = _$2.find(rows, function (row) { return row.column_name === columnName; });
- if (rowExists) {
- return;
- }
- var columnRow = instance$1.getColumnByTableNameColumnName(tableName, columnName);
- if (columnRow) {
- _this.refs.grid1.appendEditRow({
- table_name: tableName,
- column_name: columnRow.column_name,
- column_comment: columnRow.column_comment,
- column_useto: 2,
- is_primary_key: columnRow.is_primary_key,
- not_null: columnRow.not_null,
- column_size: columnRow.column_size,
- column_dict: columnRow.column_dict,
- column_ui: columnRow.column_ui,
- data_type: columnRow.data_type,
- });
- if (columnRow.is_primary_key)
- singleTableDeleteWhereColumn = columnName;
- }
- else {
- _this.refs.grid1.appendEditRow({
- table_name: tableName,
- column_name: columnName,
- column_useto: 2,
- });
- }
- });
- _this.viewModel.set("singleTableView.columnList", columnList);
- _this.viewModel.set("singleTableView.tableNameList", tableNameList);
- _this.viewModel.set("singleTable.tableName", singleTableTableName);
- _this.viewModel.set("singleTable.deleteWhereColumn", singleTableDeleteWhereColumn);
- }).finally(function () {
- sender.up('window').setLoading(false);
- });
- }).catch(function () {
- sender.up('window').setLoading(false);
- });
- };
- CreateModule.prototype.templateEnter = function (sender) {
- };
- CreateModule.prototype.templateLevel = function (sender, opt) {
- if (!this.viewModel.get('moduleType')) {
- msg('请选择模板类型');
- opt.cancel = true;
- return;
- }
- };
- CreateModule.prototype.moduleEnter = function (sender) {
- };
- CreateModule.prototype.moduleLevel = function (sender, opt) {
- if (!sender.down('form').isValid()) {
- opt.cancel = true;
- return;
- }
- };
- CreateModule.prototype.editorEnter = function (sender) {
- var editor = sender.down('sqleditor');
- editor.setValue(this.viewModel.get('singleTable.sql'));
- };
- CreateModule.prototype.editorLevel = function (sender, opt) {
- var editor = sender.down('sqleditor');
- var sql = editor.getValue();
- if (!sql) {
- msg('查询SQL语句必填');
- opt.cancel = true;
- return;
- }
- this.viewModel.set('singleTable.sql', sql);
- };
- CreateModule.prototype.columnEnter = function (sender) {
- };
- CreateModule.prototype.columnLevel = function (sender, opt) {
- };
- CreateModule.prototype.extendEnter = function (sender) {
- };
- CreateModule.prototype.extendLevel = function (sender, opt) {
- };
- // 确认结果 - Enter
- CreateModule.prototype.optionEnter = function (sender) {
- var _this = this;
- // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
- var moduleType = this.viewModel.get("moduleType");
- var data = this.viewModel.getData();
- var code = "";
- var origin = {};
- if (moduleType === 1) {
- var singleTable = data.singleTable;
- var editColumns = this.refs.grid1.getDataRows();
- origin.moduleType = data.moduleType;
- origin.packagePath = data.packagePath;
- origin.fileSavePath = data.fileSavePath;
- origin.moduleName = data.moduleName;
- origin.pageTitle = data.pageTitle;
- if (singleTable) {
- origin.sql = singleTable.sql;
- origin.tableName = singleTable.tableName;
- origin.pagination = singleTable.pagination;
- origin.delete = singleTable.delete;
- origin.deleteWhereColumn = singleTable.deleteWhereColumn;
- origin.deleteTips = singleTable.deleteTips;
- origin.editType = singleTable.editType;
- }
- origin.columnList = [];
- origin.queryColumns = [];
- origin.insertColumns = [];
- origin.updateColumns = [];
- origin.gridColumns = [];
- editColumns.forEach(function (column) {
- var row = {
- table_name: column.table_name,
- column_name: column.column_name,
- column_comment: column.column_comment,
- is_primary_key: column.is_primary_key,
- not_null: column.not_null,
- column_size: column.column_size,
- column_dict: column.column_dict,
- column_ui: column.column_ui,
- data_type: column.data_type,
- column_type: column.column_type,
- };
- origin.columnList.push(row);
- // 1:查询条件; 2:查询结果; 3:条件+结果;
- var column_name = column.column_name, column_useto = column.column_useto;
- switch (column_useto) {
- case 1:
- origin.queryColumns.push(column_name);
- break;
- case 2:
- origin.gridColumns.push(column_name);
- break;
- case 3:
- origin.queryColumns.push(column_name);
- origin.gridColumns.push(column_name);
- break;
- }
- origin.insertColumns.push(column_name);
- origin.updateColumns.push(column_name);
- });
- }
- this.setLoading(true);
- getSingleTableData(origin).then(function (data) {
- code = JSON.stringify(data, null, 4);
- window['lastTemplateData'] = code;
- var editor = _this.refs.jsoneditor;
- editor.setCode(code);
- }).finally(function () { return _this.setLoading(false); });
- };
- // 确认结果 - Level
- CreateModule.prototype.optionLevel = function (sender, opt) {
- };
- // 上一步
- CreateModule.prototype.showPrevious = function () {
- this.doCardNavigation(false);
- };
- // 下一步
- CreateModule.prototype.showNext = function () {
- this.doCardNavigation(true, true);
- };
- CreateModule.prototype.doCardNavigation = function (isNext, isCancelable) {
- if (isNext === void 0) { isNext = true; }
- if (isCancelable === void 0) { isCancelable = false; }
- var layout = this._handle.getLayout();
- var activeItem = layout.activeItem;
- var reference = activeItem.reference, isEnd = activeItem.isEnd;
- if (isNext)
- this.prevCard = reference;
- var activeCard;
- if (reference === "templateSelection") {
- if (isNext) {
- activeCard = this.refs['moduleName'];
- }
- }
- else if (reference === "moduleName") {
- if (isNext) {
- // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
- var moduleType = this.viewModel.get("moduleType");
- switch (moduleType) {
- case 1:
- activeCard = this.refs['singleTable_1'];
- break;
- case 2:
- activeCard = this.refs['mainDetailTable_1'];
- break;
- case 3:
- // activeCard =
- break;
- case 4:
- activeCard = this.refs['cardForm_1'];
- break;
- }
- }
- else {
- activeCard = this.refs['templateSelection'];
- }
- }
- else if (reference === "confirmResult") {
- if (!isNext) {
- activeCard = this.refs[this.prevCard];
- }
- }
- else {
- var name = reference.split('_')[0];
- var idx = parseInt(reference.split('_')[1], 10);
- if (isNext) {
- if (isEnd) {
- activeCard = this.refs['confirmResult'];
- }
- else {
- idx += 1;
- }
- }
- else {
- idx -= 1;
- }
- if (idx <= 0) {
- activeCard = this.refs['moduleName'];
- }
- else if (!activeCard) {
- activeCard = this.refs[name + "_" + idx];
- }
- }
- // 按钮状态
- this.down('#card-finish').setHidden(activeCard !== this.refs['confirmResult']);
- this.down('#card-prev').setDisabled(activeCard === this.refs['templateSelection']);
- this.down('#card-next').setHidden(activeCard === this.refs['confirmResult']);
- // 设置下一页显示
- if (activeCard) {
- var optCancel = { cancel: false };
- // 发出 cardLevel 事件
- layout.activeItem.fireEvent('cardLevel', activeItem, optCancel);
- if (isCancelable && optCancel.cancel) {
- // 取消了
- return;
- }
- layout.setActiveItem(activeCard);
- this.viewModel.set('title', layout.activeItem.vtitle);
- layout.activeItem.fireEvent('cardEnter', layout.activeItem);
- }
- };
- // 立刻执行
- CreateModule.prototype.finish = function (sender) {
- var _this = this;
- var parent = sender.up('window');
- var editor = this.refs.jsoneditor;
- var data = JSON.parse(editor.getCode());
- // 1:单表查询; 2:主/明细查询; 3:树/明细查询; 4:卡片表单;
- var moduleType = this.viewModel.get("moduleType");
- if (moduleType === 1) {
- this.setLoading(true);
- generateCode(data).then(function (code) {
- console.log("===> ", code);
- _this.setLoading(true);
- saveModuleFiles(__assign(__assign({}, code), { fileSavePath: data.fileSavePath, groovyClass: data.groovyClass }))
- .then(function () {
- msg("创建成功!");
- parent.close();
- handles$1.fileTree.reload();
- }).finally(function () { return _this.setLoading(false); });
- }).finally(function () { return _this.setLoading(false); });
- }
- };
- return CreateModule;
- }(Scope));
- function getModuleId(path) {
- var separator = "/";
- var sps = path.split(separator);
- var joinSps = sps.join('$');
- if (!joinSps) {
- return "ROOT";
- }
- return joinSps;
- }
- /**
- * Module数据转换成Tree数据
- */
- function modulesToTreeData(modules) {
- var separator = "/";
- var treeNodeMap = new Map();
- var root = {
- type: "Dir",
- path: "",
- expanded: true,
- leaf: false,
- children: [],
- };
- root.id = getModuleId(root.path);
- treeNodeMap.set(root.path, root);
- modules.forEach(function (module) {
- var _a;
- var paths = (_a = _$2.split(module.path, separator)) === null || _a === void 0 ? void 0 : _a.filter(function (path) { return path; });
- if (paths.length <= 0)
- return;
- var path = [];
- var parent = root;
- paths.forEach(function (dirName, idx) {
- var parentPath = path.join(separator);
- parent = treeNodeMap.get(parentPath);
- path.push(dirName);
- var currentPath = path.join(separator);
- var child = treeNodeMap.get(currentPath);
- if (child == null) {
- // 获取当前path 绝对路径
- var indexLength = module.absolutePath.indexOf(currentPath);
- var currentAbsolutePath = "";
- if (indexLength > 0) {
- currentAbsolutePath = module.absolutePath.substring(0, indexLength) + currentPath;
- }
- child = {
- type: "Dir",
- path: currentPath,
- absolutePath: currentAbsolutePath,
- leaf: false,
- children: [],
- text: dirName
- };
- child.id = getModuleId(child.path);
- parent.children.push(child);
- treeNodeMap.set(child.path, child);
- }
- if ((idx + 1) === paths.length && module.name && module.jsControllerFile) {
- var leaf = {
- type: "Module",
- path: module.path + separator + module.name,
- absolutePath: module.absolutePath,
- leaf: true,
- text: module.name,
- module: module,
- };
- leaf.id = getModuleId(leaf.path);
- child.children.push(leaf);
- treeNodeMap.set(leaf.path, leaf);
- }
- });
- });
- // 排序处理
- treeNodeMap.forEach(function (module) {
- if (module.children) {
- var children = _$2.sortBy(module.children, function (item) { return item.type + "_" + item.path; });
- module.children.length = 0;
- children.forEach(function (item) { return module.children.push(item); });
- }
- });
- return root;
- }
- function showDialog(sender, option) {
- var _a, _b;
- var win = new Ext.Window({
- autoDestroy: true,
- title: option.title,
- width: (_a = option.width) !== null && _a !== void 0 ? _a : 400,
- height: (_b = option.height) !== null && _b !== void 0 ? _b : 300,
- resizable: false,
- closable: true,
- modal: true,
- maximizable: false,
- minimizable: false,
- // constrainHeader: true,
- constrain: true,
- layout: 'fit',
- animateTarget: sender,
- buttonAlign: 'center',
- items: [
- {
- xtype: "form",
- layout: "hbox",
- margin: '10px 20px',
- border: 0,
- items: option.items
- }
- ],
- //窗口按钮
- fbar: [
- {
- xtype: 'button', text: '保存', handler: function (btn) {
- //窗口获取表单
- var form = win.down('form');
- var vaildSuccess = form.isValid();
- if (!vaildSuccess) {
- return;
- }
- option.submitFunc(form);
- }
- },
- {
- xtype: 'button', text: '取消', handler: function (btn) {
- //窗口关闭
- btn.up('window').close();
- }
- }
- ],
- });
- win.show();
- }
- function showCreateFolderWin(sender, parentPath) {
- showDialog(sender, {
- title: '新建文件夹',
- height: 150,
- items: [
- {
- xtype: "textfield",
- name: "filename",
- fieldLabel: "文件夹名称",
- allowBlank: false,
- selectOnFocus: true,
- regex: /^[a-zA-Z\_][a-zA-Z0-9\_]*$/,
- regexText: "文件夹只能以英文字母开头,且只包含英文字母、数字、及某些特殊符号",
- labelWidth: 80,
- width: "100%",
- listeners: {
- afterrender: function (sender) {
- _$2.defer(function () {
- sender.focus();
- });
- }
- }
- },
- ],
- submitFunc: function (form) {
- var filename = form.down('textfield[name="filename"]').getValue();
- createFolder(parentPath, filename).then(function (res) {
- if (res.success) {
- msg$1('创建成功');
- handles$1.fileTree.reload();
- form.up('window').close();
- }
- else {
- showErrorDialog$1(res.msg);
- }
- }).catch(function (e) {
- showErrorDialog$1(e.responseJSON.msg);
- });
- }
- });
- }
- function showCreateModuleCrudWin(sender, path, absolutePath) {
- var dlg = new CreateModule();
- dlg.showDialog(sender, {}, {
- data: {
- packagePath: path,
- fileSavePath: absolutePath,
- }
- });
- }
- function registerModule$1(sender, path, name, icon) {
- // 前缀 com/galaxis/wms 写死了
- var dlg = new RegisterModule();
- dlg.showDialog(sender, {}, {
- data: {
- form: {
- scope_url: path.replace("com/galaxis/wms", "."),
- resource_name: name,
- resource_icon: icon,
- }
- }
- });
- }
- function showCreateEmptyModule(sender, path) {
- var win = new Ext.Window({
- autoDestroy: true,
- title: "新建空模块",
- width: 400,
- height: 150,
- resizable: true,
- closable: true,
- maximizable: true,
- minimizable: true,
- plain: true,
- // constrainHeader: true,
- constrain: true,
- layout: 'fit',
- animateTarget: sender,
- buttonAlign: 'center',
- items: [
- {
- xtype: "form",
- layout: "hbox",
- margin: '10px 20px',
- border: 0,
- items: [
- {
- flex: 1,
- layout: 'vbox',
- items: [
- {
- xtype: "textfield",
- name: "filename",
- fieldLabel: "模块名",
- flex: 1,
- allowBlank: false,
- regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
- regexText: "文件名只能以英文字母开头,且只包含英文字母、数字",
- labelWidth: 50,
- width: "100%",
- },
- ]
- },
- ]
- }
- ],
- //窗口按钮
- buttons: [
- {
- xtype: 'button', text: '保存', handler: function (btn) {
- //窗口获取表单
- var form = win.down('form');
- var vaildSuccess = form.isValid();
- if (!vaildSuccess) {
- return;
- }
- var filename = form.down('textfield[name="filename"]').getValue();
- createEmptyModule(path, filename).then(function (res) {
- if (res.success) {
- Ext.toast({ html: 'createModule', title: '提示', width: 200, align: 't' });
- handles$1.fileTree.reload();
- win.close();
- }
- else {
- Ext.toast({ html: res.msg, title: '提示', width: 200, align: 't' });
- }
- }).catch(function (e) {
- Ext.toast({ html: e.responseJSON.msg, title: '提示', width: 200, align: 't' });
- });
- }
- },
- {
- xtype: 'button', text: '取消', handler: function (btn) {
- //窗口关闭
- win.close();
- }
- }
- ]
- });
- win.show();
- }
- function initFileTree () {
- Ext.define('com.yvan.studio.FileTree', {
- extend: 'com.yvan.studio.StateTree',
- xtype: 'filetree',
- tooltip: '文件',
- iconCls: 'x-fa fa-file',
- rootVisible: false,
- useArrows: true,
- colspan: 2,
- lines: true,
- reference: 'filetree',
- multiSelect: true,
- getStateFilename: function () {
- return getCurrentProject().uuid + "/filetree.json";
- },
- openNode: function () {
- var selection = this.getSelection();
- var _a = __read(selection, 1), record = _a[0];
- if (!record) {
- return;
- }
- var raw = record.raw;
- if (raw.type === 'Dir') {
- return;
- }
- if (raw.type === "Module" && raw.module) {
- eventBus.publish(EventType.ModuleOpen, raw);
- }
- },
- openInIdea: function () {
- var _a = __read(this.getSelection(), 1), record = _a[0];
- if (record) {
- var data = record.data;
- if (data.type === "Module") {
- if (data.module.groovyFile && data.module.groovyFile.exists) {
- native.openInIdea(data.module.groovyFile.absolutePath);
- }
- else if (data.module.jsControllerFile && data.module.jsControllerFile.exists) {
- native.openInIdea(data.module.jsControllerFile.absolutePath);
- }
- else if (data.module.jsViewFile && data.module.jsViewFile.exists) {
- native.openInIdea(data.module.jsViewFile.absolutePath);
- }
- return;
- }
- msg$1('只有文件、模块类型才能在 IDEA 中打开.');
- }
- },
- deleteSelection: function () {
- var selection = this.getSelection();
- var pathList = [];
- _.forEach(selection, function (item) {
- if (item.data.type === "Dir") {
- pathList.push({ path: item.data.path, isFolder: true });
- }
- else {
- pathList.push({ path: item.data.path, isFolder: false });
- }
- });
- {
- return;
- }
- // const title = '您确定要删除(' + raw.path + ')及此目录下所有文件吗?'
- //
- // Ext.Msg.confirm('提示', title, (btn) => {
- // if (btn === 'yes') {
- // deleteFileOrFolder(raw.path, title, true)
- // }
- // })
- // const title = '您确定要删除(' + raw.path + ')吗?'
- // deleteFileOrFolder(raw.path, title, false)
- },
- listeners: {
- itemverify: function () {
- this.openNode();
- },
- afterrender: function (me) {
- console.log('filetree_afterrender', 'reloadIfNeed');
- moduleStore.registe(me.subscribeModule.bind(this));
- moduleStore.reloadIfNeed("PC");
- },
- destroy: function (me) {
- console.log('filetree_destroy');
- moduleStore.unregiste(me.subscribeModule.bind(this));
- },
- itemcontextmenu: function (sender, node, element, idx, e) {
- e.preventDefault();
- var raw = node.raw;
- var option = {};
- if (raw.type === 'Dir') {
- // 文件夹右键
- option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- {
- text: '新建空模块',
- iconCls: 'x-fa fa-plus-circle',
- handler: function (sender) {
- showCreateEmptyModule(sender, raw.path);
- }
- },
- {
- text: '新建模块',
- iconCls: 'x-fa fa-plus-circle',
- handler: function (sender) {
- showCreateModuleCrudWin(sender, raw.path, raw.absolutePath);
- }
- },
- '-',
- {
- text: '新建文件夹',
- iconCls: 'x-fa fa-folder-o',
- handler: function (sender) {
- var parentPath = raw.path;
- showCreateFolderWin(sender, parentPath);
- }
- },
- {
- text: '复制路径',
- iconCls: 'x-fa fa-external-link',
- handler: function (sender) {
- native.clipboardSet(raw.path);
- }
- },
- ]
- };
- }
- else {
- // 文件右键
- option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- // {
- // text: '重命名',
- // iconCls: 'x-fa fa-terminal',
- // handler(sender) {
- // const regex = /^[a-zA-Z0-9\_\-\+\=@#\$\%\^\&\(\)]+$/
- // const regexText = "文件名只能以英文字母开头,且只包含英文字母、数字"
- // showRenameWin(sender, raw.path, raw.text, regex, regexText, false)
- // }
- // },
- // {
- // text: '另存为',
- // iconCls: 'x-fa fa-exchange',
- // handler(sender) {
- // console.error('没做')
- // }
- // },
- {
- text: '复制路径',
- iconCls: 'x-fa fa-external-link',
- handler: function (sender) {
- native.clipboardSet(raw.path);
- }
- },
- '-',
- {
- text: '注册模块',
- iconCls: 'x-fa fa-sign-in',
- handler: function (sender) {
- registerModule$1(sender, raw.path);
- }
- },
- ]
- };
- }
- var treeMenu = new Ext.menu.Menu(option);
- treeMenu.showAt(e.getXY());
- },
- },
- tbar: [
- {
- xtype: 'button',
- iconCls: 'x-fa fa-crosshairs',
- tooltip: '选中当前打开的文件',
- handler: function (sender) {
- msg$1('没做');
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-link',
- tooltip: '在IDEA中打开',
- handler: function (sender) {
- var scope = sender.up("filetree");
- scope.openInIdea();
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-refresh',
- tooltip: '刷新',
- handler: function (sender) {
- var scope = sender.up("filetree");
- scope.reload();
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-percent',
- tooltip: '监控',
- handler: function (sender) {
- // handles.mainWindow.showPerform()
- }
- },
- ],
- initComponent: function () {
- setFileTree(this);
- this.superclass.initComponent.apply(this, arguments);
- // super.initComponent.apply(this, arguments)
- },
- subscribeModule: function (res) {
- if (typeof res === 'object') {
- var rootNode = modulesToTreeData(res.data);
- this.setRootNode(rootNode);
- this.restoreState();
- handles$1.mainWindow.modules = res.data;
- }
- else if (typeof res === 'boolean') {
- this.setLoading(res);
- }
- },
- reload: function () {
- console.log('filetree_reloadForce');
- moduleStore.reloadForce("PC").then(function (res) {
- });
- }
- });
- }
- function initDbTree () {
- var define = {
- extend: 'com.yvan.studio.StateTree',
- xtype: 'dbtree',
- tooltip: '数据库',
- iconCls: 'x-fa fa-database',
- rootVisible: false,
- useArrows: true,
- reference: 'dbtree',
- multiSelect: true,
- getStateFilename: function () {
- return getCurrentProject().uuid + "/dbtree.json";
- },
- tbar: [
- {
- xtype: 'button',
- iconCls: 'x-fa fa-crosshairs',
- tooltip: '选中当前打开的表',
- handler: function (sender) {
- var _a;
- // 获取当前选中的活动标签 tableColumn_bas_car
- var locatPath = (_a = handles$1.mainWindow.refs.tt.getActiveTab()) === null || _a === void 0 ? void 0 : _a.locatPath;
- if (!locatPath) {
- return;
- }
- handles$1.dbTree.selectPath(locatPath);
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-refresh',
- tooltip: '刷新',
- handler: function (sender) {
- handles$1.dbTree.reload();
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-cloud-download',
- tooltip: '重新拉取生成元数据(耗时很长!)',
- handler: function (sender) {
- handles$1.dbTree.dbToMetaAndReload(sender);
- }
- },
- // {
- // xtype: 'button',
- // iconCls: 'x-fa fa-files-o',
- // tooltip: '数据同步',
- // handler(sender) {
- //
- // }
- // },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-exchange',
- tooltip: '数据结构同步',
- handler: function (sender) {
- // handles.mainWindow.showDataSync(sender)
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-window-maximize',
- tooltip: 'SQL查询分析器',
- handler: function (sender) {
- // handles.mainWindow.showDbCodeTemplate(sender)
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-cubes',
- tooltip: '数据域管理',
- handler: function (sender) {
- // handles.mainWindow.showColumnDomain()
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-edit',
- tooltip: '修改结构',
- handler: function (sender) {
- var tree = sender.up("treepanel");
- var selection = tree.getSelection();
- var _a = __read(selection, 1), node = _a[0];
- if (!node) {
- msg$1('请选择一个表');
- return;
- }
- var raw = node.data.raw;
- if (node.get('type') === 'table') ;
- else if (node.get('type') === 'column') ;
- }
- },
- ],
- listeners: {
- afterrender: function (me) {
- setDbTree(this);
- // 找管理器订阅刷新的事件
- instance$1.registe(this.refreshData.bind(this));
- instance$1.reloadIfNeed(undefined);
- },
- destory: function (me) {
- setDbTree(undefined);
- instance$1.unregiste(this.refreshData.bind(this));
- },
- itemcontextmenu: function (sender, node, element, idx, e) {
- var _this = this;
- e.preventDefault();
- var option = {};
- var raw = node.raw.raw;
- if (node.get('type') === 'column') {
- option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- {
- text: '设计结构',
- iconCls: 'x-fa fa-edit',
- handler: function (sender) {
- handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, raw.column_name, false);
- }
- },
- ]
- };
- }
- else if (node.get('type') === 'table') {
- option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- {
- text: '新建',
- iconCls: 'x-fa fa-plus',
- handler: function (sender) {
- handles$1.mainWindow.showTableColumn(raw.schema_name, null, null, true);
- }
- },
- {
- text: '设计结构',
- iconCls: 'x-fa fa-edit',
- handler: function (sender) {
- handles$1.mainWindow.showTableColumn(raw.schema_name, raw.table_name, null, false);
- }
- },
- {
- text: '重命名',
- iconCls: 'x-fa fa-pencil',
- handler: function (sender) {
- _this.renameTable(sender, node.data.raw);
- }
- },
- '-',
- {
- text: '删除',
- iconCls: 'x-fa fa-minus',
- handler: function (sender) {
- _this.removeTable(sender, node.data.raw);
- }
- },
- ]
- };
- }
- var treeMenu = new Ext.menu.Menu(option);
- treeMenu.showAt(e.getXY());
- }
- },
- // DbTreeStore 刷新时,会回调到这个方法
- refreshData: function (isLoadingState) {
- var me = this;
- if (typeof isLoadingState === 'boolean') {
- me.setLoading(isLoadingState);
- return;
- }
- var rootNode = getDbTree(instance$1.apiResponse);
- me.setRootNode(rootNode);
- this.restoreState();
- },
- renameTable: function (sender, tableRow) {
- window['YvanUI'].prompt('输入新表名', tableRow.table_name).then(function (name) {
- renameTableDDL(tableRow.schema_name, tableRow.table_name, name).then(function (res) {
- if (!res.data)
- return;
- var window = Ext.create('Ext.window.Window', {
- title: 'SQL 预览',
- height: 400,
- width: 600,
- modal: true,
- animateTarget: sender,
- maximizable: true,
- layout: 'fit',
- items: {
- xtype: 'sqleditor',
- value: res.data,
- },
- buttons: [
- {
- xtype: 'button',
- text: '执行',
- iconCls: 'x-fa fa-save',
- handler: function (sender) {
- var editor = sender.up('window').down('sqleditor');
- var ddl = editor.getValue();
- window.setLoading(true);
- instance$1.pushToDbCommit({
- schema_name: tableRow.schema_name,
- table_name: name,
- old_table_name: tableRow.table_name,
- ddl: ddl,
- }).then(function () {
- handles$1.dbTree.reload();
- window.close();
- }).finally(function () { return window.setLoading(false); });
- },
- },
- {
- xtype: 'button',
- text: '取消',
- iconCls: 'x-fa fa-times',
- handler: function () {
- window.close();
- }
- },
- ]
- }).show();
- });
- });
- },
- removeTable: function (sender, tableRow) {
- dropTableDDL(tableRow.schema_name, tableRow.table_name).then(function (res) {
- if (!res.data)
- return;
- var window = Ext.create('Ext.window.Window', {
- title: 'SQL 预览',
- height: 400,
- width: 600,
- modal: true,
- animateTarget: sender,
- maximizable: true,
- layout: 'fit',
- items: {
- xtype: 'sqleditor',
- value: res.data,
- },
- buttons: [
- {
- xtype: 'button',
- text: '执行',
- iconCls: 'x-fa fa-save',
- handler: function (sender) {
- var editor = sender.up('window').down('sqleditor');
- var ddl = editor.getValue();
- window.setLoading(true);
- instance$1.pushToDbCommit({
- schema_name: tableRow.schema_name,
- table_name: tableRow.table_name,
- ddl: ddl
- })
- .then(function () {
- handles$1.dbTree.reload();
- window.close();
- }).finally(function () { return window.setLoading(false); });
- }
- },
- {
- xtype: 'button',
- text: '取消',
- iconCls: 'x-fa fa-times',
- handler: function () {
- window.close();
- }
- }
- ]
- }).show();
- });
- },
- // hideHeaders: true,
- // columns: [
- // {
- // xtype: 'treecolumn',
- // text: '名称',
- // dataIndex: 'text',
- // flex: 2,
- // }, {
- // text: '描述',
- // dataIndex: 'comment',
- // flex: 1,
- // }
- // ],
- reload: function () {
- // 强制刷新 DbManager
- instance$1.reloadForce(undefined);
- },
- dbToMetaAndReload: function () {
- // 从数据库结构重新生成元数据
- instance$1.dbToMetaAndReload();
- }
- };
- Ext.define('com.yvan.studio.DbTree', define);
- }
- /**
- * 将数据构建成 dbTree 需要的格式
- */
- function getDbTree(apiResponse) {
- var rootNode = {
- children: [],
- expanded: true,
- id: "ROOT",
- leaf: false,
- };
- _$2.forEach(apiResponse, function (schemaRow) {
- var schemaNode = {
- id: 'schema$' + schemaRow.schema_name,
- type: "schema",
- expanded: true,
- leaf: false,
- iconCls: 'x-fa fa-th-large ',
- text: schemaRow.schema_name,
- raw: __assign({}, schemaRow),
- children: [],
- };
- delete schemaNode.raw.table_list;
- rootNode.children.push(schemaNode);
- _$2.forEach(schemaRow.table_list, function (tableRow) {
- var _a;
- var tableNode = {
- id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name,
- text: _$2.trim((_a = tableRow.description) !== null && _a !== void 0 ? _a : "").length <= 0 ? tableRow.table_name : tableRow.table_name + "(" + tableRow.description + ")",
- comment: tableRow.description,
- type: "table",
- iconCls: 'x-fa fa-table',
- expanded: false,
- leaf: false,
- children: [],
- raw: __assign({}, tableRow)
- };
- delete tableNode.raw.column_list;
- schemaNode.children.push(tableNode);
- _$2.forEach(tableRow.column_list, function (columnRow) {
- var _a;
- var iconCls = 'x-fa fa-square-o';
- if (columnRow.is_primary_key) {
- iconCls = 'x-fa fa-key';
- }
- else if (columnRow.not_null) {
- iconCls = 'x-fa fa-check-square';
- }
- var columnNode = {
- id: 'schema$' + schemaRow.schema_name + '$' + tableRow.table_name + '$' + columnRow.column_name,
- type: "column",
- text: _$2.trim((_a = columnRow.column_comment) !== null && _a !== void 0 ? _a : "").length <= 0 ? columnRow.column_name : columnRow.column_name + "(" + columnRow.column_comment + ")",
- comment: columnRow.column_comment,
- leaf: true,
- iconCls: iconCls,
- raw: __assign({}, columnRow)
- };
- tableNode.children.push(columnNode);
- }); // column
- }); // table
- }); // schema
- return rootNode;
- }
- var ReportGridController = /** @class */ (function () {
- function ReportGridController() {
- }
- ReportGridController.prototype.onLoad = function (sender) {
- this.reload();
- setReport(this);
- };
- ReportGridController.prototype.showSingle = function (sender) {
- var _this = this;
- var _a = __read(this.getView().getSelection(), 1), record = _a[0];
- if (record) {
- handles.mainWindow.showFormSingle(record.data, function () {
- _this.reload();
- });
- }
- };
- ReportGridController.prototype.filterChanged = function (sender, value) {
- console.log('filterChange', sender, value);
- this.view.store.clearFilter();
- if (value) {
- this.view.store.filterBy(function (record) {
- var code = _.lowerCase(record.get('report_name'));
- var dict_desc_py = _.lowerCase(pinyinUtil.getFirstLetter(code));
- return (code.includes(value) ||
- dict_desc_py.includes(value));
- });
- }
- };
- ReportGridController.prototype.onClearClick = function () {
- var _a, _b;
- (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
- };
- ReportGridController.prototype.reload = function () {
- var me = this;
- me.getView().setLoading(true);
- reportListApi().then(function (res) {
- _.forEach(res.data, function (r) {
- r.report_enable = r.report_enable === 1;
- });
- me.getView().setStore(new Ext.data.Store({
- fields: ['report_id', 'report_name', 'report_enable'],
- data: res.data,
- }));
- }).finally(function () {
- me.getView().setLoading(false);
- });
- };
- ReportGridController.prototype.reportAdd = function () {
- var _this = this;
- prompt$2('请输入报表名称').then(function (name) {
- createReportApi(name).then(function (res) {
- if (res.success) {
- msg$1('添加成功');
- handles.mainWindow.showReport(res.data, name, function () {
- _this.reload();
- });
- }
- _this.reload();
- });
- });
- };
- ReportGridController.prototype.onGridContextMenu = function (sender, node, element, idx, e) {
- e.preventDefault();
- var me = sender.up('grid').ownerGrid.getController();
- var option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- {
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- handler: function (sender) {
- me.reportAdd();
- }
- },
- {
- text: '编辑',
- iconCls: 'x-fa fa-edit',
- handler: function (sender) {
- me.reportEdit();
- }
- },
- {
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- handler: function (sender) {
- me.reportRemove();
- }
- },
- '-',
- {
- text: '注册(至菜单)',
- iconCls: 'x-fa fa-sign-in',
- handler: function (sender) {
- me.reportRegiste(sender);
- }
- },
- {
- text: '卸载',
- iconCls: 'x-fa fa-sign-out',
- handler: function (sender) {
- console.error('没做');
- }
- },
- ]
- };
- var treeMenu = new Ext.menu.Menu(option);
- treeMenu.showAt(e.getXY());
- };
- ReportGridController.prototype.reportRegiste = function (sender) {
- var _a = __read(this.getView().getSelection(), 1), record = _a[0];
- if (record) {
- var reportName = record.get('report_name');
- var reportId = record.get('report_id');
- registerModule$1(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
- }
- };
- ReportGridController.prototype.reportRemove = function () {
- var _this = this;
- var _a = __read(this.getView().getSelection(), 1), record = _a[0];
- if (record) {
- var reportName = record.get('report_name');
- var reportId_1 = record.get('report_id');
- YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
- delReportApi(reportId_1).then(function (res) {
- if (res.success) {
- msg$1('删除成功');
- _this.reload();
- }
- });
- });
- }
- };
- ReportGridController.prototype.reportEdit = function () {
- var _this = this;
- var _a = __read(this.getView().getSelection(), 1), record = _a[0];
- if (record) {
- var reportName = record.get('report_name');
- var reportId = record.get('report_id');
- handles.mainWindow.showReport(reportId, reportName, function () {
- _this.reload();
- });
- }
- };
- ReportGridController.prototype.onDblClick = function (sender) {
- this.reportEdit();
- };
- return ReportGridController;
- }());
- function initReportGrid () {
- var controller = new ReportGridController();
- Ext.define('com.yvan.studio.ReportGrid', {
- extend: 'Ext.grid.Panel',
- xtype: 'reportGrid',
- controller: controller,
- scope: controller,
- referenceHolder: true,
- tooltip: '查询报表',
- iconCls: 'x-fa fa-bar-chart',
- useArrows: true,
- reference: 'reportgrid',
- selModel: { type: 'rowmodel', mode: 'SINGLE', },
- listeners: {
- itemdblclick: 'onDblClick',
- afterrender: 'onLoad',
- },
- viewConfig: {
- enableTextSelection: true,
- listeners: {
- itemcontextmenu: 'onGridContextMenu',
- },
- },
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- tooltip: '测试',
- iconCls: 'x-fa fa-bars',
- listeners: {
- click: 'showSingle'
- }
- },
- {
- xtype: 'button',
- tooltip: '刷新',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'reload'
- }
- },
- {
- xtype: 'button',
- tooltip: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'reportAdd'
- }
- },
- {
- xtype: 'button',
- tooltip: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'reportRemove'
- }
- },
- {
- xtype: 'textfield',
- flex: 1,
- reference: "txtFilter",
- emptyText: '搜索过滤',
- enableKeyEvents: true,
- listeners: {
- change: {
- fn: 'filterChanged',
- buffer: 50
- }
- }
- },
- ]
- },
- columns: [
- {
- text: 'ID', dataIndex: 'report_id',
- hidden: true,
- },
- {
- text: '报表名称', dataIndex: 'report_name',
- flex: 1,
- },
- ]
- });
- }
- /** 所有变量类型 */
- var TypeEnum;
- (function (TypeEnum) {
- TypeEnum["string"] = "string";
- TypeEnum["number"] = "number";
- TypeEnum["object"] = "object";
- TypeEnum["array"] = "array";
- TypeEnum["function"] = "function";
- TypeEnum["null"] = "null";
- TypeEnum["boolean"] = "boolean";
- TypeEnum["symbol"] = "symbol";
- TypeEnum["json"] = "json";
- TypeEnum["math"] = "math";
- TypeEnum["regexp"] = "regexp";
- TypeEnum["date"] = "date";
- TypeEnum["undefined"] = "undefined";
- TypeEnum["nan"] = "nan";
- TypeEnum["reactNode"] = "react_node";
- })(TypeEnum || (TypeEnum = {}));
- /**
- * 判断对象类型
- * @param object 对象
- */
- var variableTypeOf = function (object) {
- var typeStr = Object.prototype.toString.call(object);
- var typeName;
- switch (("" + typeStr).toLowerCase()) {
- case '[object string]':
- typeName = TypeEnum.string;
- break;
- case '[object number]':
- if (Number.isNaN(object)) {
- return TypeEnum.nan;
- }
- typeName = TypeEnum.number;
- break;
- case '[object object]':
- if (object.$$typeof && object.props) {
- var type = variableTypeOf(object.$$typeof);
- if (type === TypeEnum.symbol || type === TypeEnum.reactNode) {
- return TypeEnum.reactNode;
- }
- }
- typeName = TypeEnum.object;
- break;
- case '[object array]':
- typeName = TypeEnum.array;
- break;
- case '[object function]':
- typeName = TypeEnum.function;
- break;
- case '[object null]':
- typeName = TypeEnum.null;
- break;
- case '[object boolean]':
- typeName = TypeEnum.boolean;
- break;
- case '[object date]':
- typeName = TypeEnum.date;
- break;
- // 不常用
- case '[object symbol]':
- typeName = TypeEnum.symbol;
- break;
- case '[object json]':
- typeName = TypeEnum.json;
- break;
- case '[object math]':
- typeName = TypeEnum.math;
- break;
- case '[object regexp]':
- typeName = TypeEnum.regexp;
- break;
- // 貌似不会走的分支
- case '[object undefined]':
- typeName = TypeEnum.undefined;
- break;
- // 无法识别
- default:
- if (object === undefined) {
- return TypeEnum.undefined;
- }
- console.log('varTypeOf -> ', object, ' | -> ', typeStr, ' | ', ("" + typeStr).toLowerCase());
- typeName = TypeEnum.object;
- }
- return typeName;
- };
- function initGroovyEditor () {
- Ext.define('com.yvan.studio.GroovyEditor', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.groovyeditor',
- xtype: 'groovyeditor',
- layout: 'fit',
- border: false,
- html: "<div class=\"editor\"/>",
- config: {
- value: ''
- },
- codeChange: undefined,
- isChangeFromOuter: false,
- getCode: function () {
- if (this.editor) {
- return this.editor.getValue();
- }
- else {
- return this.code;
- }
- },
- setCode: function (value) {
- var _this = this;
- this.code = value;
- this.value = value;
- _$2.defer(function () {
- _this.isChangeFromOuter = true;
- if (_this.editor) {
- _this.editor.setValue(value);
- }
- });
- },
- applyPosition: function () {
- var _this = this;
- if (this.autoFocusMethod) {
- if (this.editor) {
- _$2.defer(function () {
- if (_this.autoFocusStartLine) {
- _this.editor.setPosition({
- lineNumber: _this.autoFocusStartLine,
- column: _this.autoFocusStartColumn
- });
- _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
- }
- _this.editor.focus();
- });
- delete this.autoFocusMethod;
- }
- }
- this.editor.layout();
- },
- getValue: function () {
- return this.value;
- },
- setValue: function (value, fromEditor) {
- var me = this;
- if (me.value === value) {
- // 值相等,不需要变化
- return;
- }
- if (fromEditor !== true && me.editor) {
- // 不是来源于编辑器的变化,才设置编辑器的值
- me.editor.setValue(value);
- }
- // 通知mixins setValue
- me.value = value;
- me.fireEvent('change', value);
- },
- initComponent: function () {
- var that = this;
- this.superclass.initComponent.call(this, arguments);
- that.on({
- resize: function () {
- if (that.editor) {
- that.editor.layout();
- }
- },
- destory: function () {
- if (that.editor) {
- that.editor.dispose();
- delete that.editor;
- }
- },
- afterrender: function (sender) {
- var $dom = $(that.el.dom).find('.editor');
- attach_3($dom[0], {
- value: that.code
- }).then(function (editor) {
- that.editor = editor;
- that.applyPosition();
- that.editor.onDidChangeModelContent(function (e) {
- that.fireEvent('change', that.editor, e);
- if (variableTypeOf(that.codeChange) === "function" /*&& !that.isChangeFromOuter*/) {
- that.codeChange(that.editor.getValue(), that.name, e);
- }
- that.isChangeFromOuter = false;
- });
- });
- }
- });
- }
- });
- }
- function attach_3(element, opts) {
- return new Promise(function (resolve) {
- var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'java', minimap: {
- enabled: false
- } }));
- editor.onKeyUp(function (e) {
- // console.log(e)
- if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
- editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
- }
- });
- resolve(editor);
- });
- }
- function initJsEditor$1 () {
- Ext.define('com.yvan.studio.JsEditor', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.jseditor',
- xtype: 'jseditor',
- layout: 'fit',
- border: false,
- html: "<div class=\"editor\"/>",
- autoFocusMethod: true,
- autoFocusStartLine: 0,
- autoFocusStartColumn: 0,
- codeChange: undefined,
- funcArr: [],
- modulePage: null,
- isChangeFromOuter: false,
- name: "",
- /**
- * 设置代码
- */
- setCode: function (value) {
- var _this = this;
- this.code = value;
- _$2.defer(function () {
- _this.isChangeFromOuter = true;
- if (_this.editor) {
- _this.editor.setValue(value);
- if (_this.name === "controllerEditor") {
- _this.funcArr = _this.getAllFunction();
- }
- }
- });
- },
- getCode: function () {
- var _a;
- if (!this.editor) {
- return this.code;
- }
- return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
- },
- applyPosition: function () {
- var _this = this;
- if (this.autoFocusMethod) {
- if (this.editor) {
- _$2.defer(function () {
- if (_this.autoFocusStartLine) {
- _this.editor.setPosition({
- lineNumber: _this.autoFocusStartLine,
- column: _this.autoFocusStartColumn
- });
- _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
- }
- _this.editor.focus();
- });
- delete this.autoFocusMethod;
- }
- }
- this.editor.layout();
- },
- initComponent: function () {
- var that = this;
- this.superclass.initComponent.apply(this, arguments);
- this.on({
- resize: function (sender, width, height) {
- if (that.editor) {
- that.editor.layout();
- }
- },
- destory: function () {
- if (that.editor) {
- that.editor.dispose();
- delete that.editor;
- }
- },
- afterrender: function () {
- var $dom = $(that.el.dom).find('.editor');
- attach_1($dom[0], {
- value: that.code
- }).then(function (editor) {
- that.editor = editor;
- that.applyPosition();
- that.editor.onDidChangeModelContent(function (e) {
- that.fireEvent('change', that.editor, e);
- if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
- that.codeChange(that.editor.getValue(), that.name, e);
- }
- that.isChangeFromOuter = false;
- });
- });
- }
- });
- },
- getAllFunction: function () {
- var funcArr = [];
- var ast = window['YvanUI'].recast.parse(this.code);
- if (ast && ast.program && ast.program.body) {
- if (Array.isArray(ast.program.body)) {
- for (var i = 0; i < ast.program.body.length; i++) {
- var m = ast.program.body[i];
- if (m.type === "ExportDefaultDeclaration") {
- if (m.declaration.type === "ClassDeclaration") {
- if (m.declaration.body.type === "ClassBody") {
- if (Array.isArray(m.declaration.body.body)) {
- for (var j = 0; j < m.declaration.body.body.length; j++) {
- var ob = m.declaration.body.body[j];
- if (ob.type === "MethodDefinition" && ob.kind === "method") {
- var funcItem = { name: ob.key.name, args: [] };
- if (Array.isArray(ob.value.params)) {
- for (var k = 0; k < ob.value.params.length; k++) {
- var p = ob.value.params[k];
- funcItem.args.push(p.name);
- }
- }
- funcArr.push(funcItem);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- return funcArr;
- }
- });
- }
- var isInited = false;
- function attach_1(element, opts) {
- return new Promise(function (resolve) {
- var monaco = window['monaco'];
- if (!isInited) {
- isInited = true;
- monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
- noSemanticValidation: true,
- noSyntaxValidation: false
- });
- // compiler options
- monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
- target: monaco.languages.typescript.ScriptTarget.ES2016,
- allowNonTsExtensions: true,
- });
- // extra libraries
- var libSource = [
- 'declare class Facts {',
- ' /**',
- ' * Returns the next fact',
- ' */',
- ' static next():string',
- ' static next222():string',
- '}',
- "\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 ",
- "\n declare module 'fs' {\n function readFileSync(path: string | number, options?: { encoding?: string; flag?: string; } | null): string;\n }\n "
- ].join('\n');
- var libUri = 'file:///index.d.ts';
- monaco.languages.typescript.javascriptDefaults.addExtraLib(libSource, libUri);
- // When resolving definitions and references, the editor will try to use created models.
- // Creating a model for the library allows "peek definition/references" commands to work with the library.
- monaco.editor.createModel(libSource, 'javascript', monaco.Uri.parse(libUri));
- }
- var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'javascript' }));
- resolve(editor);
- });
- }
- function initJsonEditor$1 () {
- Ext.define('com.yvan.studio.JsonEditor', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.jsoneditor',
- xtype: 'jsoneditor',
- layout: 'fit',
- border: false,
- html: "<div class=\"editor\"/>",
- autoFocusMethod: true,
- autoFocusStartLine: 0,
- autoFocusStartColumn: 0,
- codeChange: undefined,
- funcArr: [],
- modulePage: null,
- isChangeFromOuter: false,
- name: "",
- /**
- * 设置代码
- */
- setCode: function (value) {
- var _this = this;
- this.code = value;
- _$2.defer(function () {
- _this.isChangeFromOuter = true;
- if (_this.editor) {
- _this.editor.setValue(value);
- }
- });
- },
- updateOptions: function (options) {
- if (this.editor && options) {
- this.editor.updateOptions(options);
- }
- },
- setLanguage: function (lang) {
- if (this.editor && lang) {
- window['monaco'].editor.setModelLanguage(this.editor.getModel(), lang);
- }
- },
- getCode: function () {
- var _a;
- return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
- },
- applyPosition: function () {
- var _this = this;
- if (this.autoFocusMethod) {
- if (this.editor) {
- _$2.defer(function () {
- if (_this.autoFocusStartLine) {
- _this.editor.setPosition({
- lineNumber: _this.autoFocusStartLine,
- column: _this.autoFocusStartColumn
- });
- _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
- }
- _this.editor.focus();
- });
- delete this.autoFocusMethod;
- }
- }
- this.editor.layout();
- },
- initComponent: function () {
- var that = this;
- this.superclass.initComponent.apply(this, arguments);
- this.on({
- resize: function (sender, width, height) {
- if (that.editor) {
- that.editor.layout();
- }
- },
- destory: function () {
- if (that.editor) {
- that.editor.dispose();
- delete that.editor;
- }
- },
- afterrender: function (sender) {
- var $dom = $(that.el.dom).find('.editor');
- attach_116($dom[0], {
- value: that.code
- }).then(function (editor) {
- that.editor = editor;
- that.applyPosition();
- that.editor.onDidChangeModelContent(function (e) {
- that.fireEvent('change', that.editor, e);
- if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
- that.codeChange(that.editor.getValue(), that.name, e);
- }
- that.isChangeFromOuter = false;
- });
- });
- }
- });
- },
- });
- }
- function attach_116(element, opts) {
- return new Promise(function (resolve) {
- var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'json', minimap: {
- enabled: false
- } }));
- editor.onKeyUp(function (e) {
- // console.log(e)
- if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
- editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
- }
- });
- resolve(editor);
- });
- }
- function initSqlEditor$1 () {
- Ext.define('com.yvan.studio.SqlEditor', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.sqleditor',
- xtype: 'sqleditor',
- layout: 'fit',
- border: false,
- html: "<div class=\"editor\"/>",
- config: {
- value: ''
- },
- codeChange: undefined,
- isChangeFromOuter: false,
- setCode: function (value) {
- var _this = this;
- this.code = value;
- this.value = value;
- _$2.defer(function () {
- _this.isChangeFromOuter = true;
- if (_this.editor) {
- _this.editor.setValue(value);
- }
- });
- },
- getCode: function () {
- return this.getValue();
- },
- updateOptions: function (options) {
- if (this.editor && options) {
- this.editor.updateOptions(options);
- }
- },
- getValue: function () {
- if (!this.editor) {
- return this.code;
- }
- return this.editor.getValue();
- },
- applyPosition: function () {
- var _this = this;
- if (this.autoFocusMethod) {
- if (this.editor) {
- _$2.defer(function () {
- if (_this.autoFocusStartLine) {
- _this.editor.setPosition({
- lineNumber: _this.autoFocusStartLine,
- column: _this.autoFocusStartColumn
- });
- _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
- }
- _this.editor.focus();
- });
- delete this.autoFocusMethod;
- }
- }
- this.editor.layout();
- },
- setValue: function (value, fromEditor) {
- this.setCode(value);
- var me = this;
- if (me.value === value) {
- // 值相等,不需要变化
- return;
- }
- if (fromEditor !== true && me.editor) {
- // 不是来源于编辑器的变化,才设置编辑器的值
- me.editor.setValue(value);
- }
- // 通知mixins setValue
- me.value = value;
- me.fireEvent('change', value);
- },
- initComponent: function () {
- var that = this;
- this.superclass.initComponent.call(this);
- that.on({
- resize: function () {
- if (that.editor) {
- that.editor.layout();
- }
- },
- destory: function () {
- if (that.editor) {
- that.editor.dispose();
- delete that.editor;
- }
- },
- afterrender: function (sender) {
- var $dom = $(that.el.dom).find('.editor');
- attach_2($dom[0], {
- value: that.code
- }).then(function (editor) {
- that.editor = editor;
- that.applyPosition();
- that.editor.onDidChangeModelContent(function (e) {
- that.fireEvent('change', that.editor, e);
- if (typeof that.codeChange === "function" && !that.isChangeFromOuter) {
- that.codeChange(that.editor.getValue(), that.name, e);
- }
- that.isChangeFromOuter = false;
- });
- });
- }
- });
- }
- });
- }
- function attach_2(element, opts) {
- return new Promise(function (resolve) {
- var monaco = window['monaco'];
- var editor = monaco.editor.create(element, __assign(__assign({}, opts), { language: 'sql', minimap: {
- enabled: false
- } }));
- editor.addCommand(monaco.KeyMod.Shift | monaco.KeyMod.Alt | monaco.KeyCode.KeyF, function () {
- // const sql = editor.getValue()
- // if (_.trim(sql).length > 0) {
- // editor.setValue(format(sql, {
- // indent: ' ',
- // uppercase: true,
- // }))
- // }
- msg$1('没做');
- });
- editor.onKeyUp(function (e) {
- // console.log(e)
- if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
- editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
- }
- });
- resolve(editor);
- });
- }
- function initTemplateEditor () {
- Ext.define('com.yvan.studio.TemplateEditor', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.templateeditor',
- xtype: 'templateeditor',
- layout: 'fit',
- border: false,
- html: "<div class=\"editor\"/>",
- autoFocusMethod: true,
- autoFocusStartLine: 0,
- autoFocusStartColumn: 0,
- codeChange: undefined,
- funcArr: [],
- modulePage: null,
- isChangeFromOuter: false,
- name: "",
- /**
- * 设置代码
- */
- setCode: function (value) {
- var _this = this;
- this.code = value;
- _$2.defer(function () {
- _this.isChangeFromOuter = true;
- if (_this.editor) {
- _this.editor.setValue(value);
- }
- });
- },
- getCode: function () {
- var _a;
- return (_a = this.editor) === null || _a === void 0 ? void 0 : _a.getValue();
- },
- applyPosition: function () {
- var _this = this;
- if (this.autoFocusMethod) {
- if (this.editor) {
- _$2.defer(function () {
- if (_this.autoFocusStartLine) {
- _this.editor.setPosition({
- lineNumber: _this.autoFocusStartLine,
- column: _this.autoFocusStartColumn
- });
- _this.editor.revealLine(_this.autoFocusStartLine); //滚动到特定行
- }
- _this.editor.focus();
- });
- delete this.autoFocusMethod;
- }
- }
- this.editor.layout();
- },
- initComponent: function () {
- var that = this;
- this.superclass.initComponent.apply(this, arguments);
- this.on({
- resize: function (sender, width, height) {
- if (that.editor) {
- that.editor.layout();
- }
- },
- destory: function () {
- if (that.editor) {
- that.editor.dispose();
- delete that.editor;
- }
- },
- afterrender: function (sender) {
- var $dom = $(that.el.dom).find('.editor');
- attach_117($dom[0], {
- value: that.code
- }).then(function (editor) {
- that.editor = editor;
- that.applyPosition();
- that.editor.onDidChangeModelContent(function (e) {
- that.fireEvent('change', that.editor, e);
- if (typeof (that.codeChange) === "function" && !that.isChangeFromOuter) {
- that.codeChange(that.editor.getValue(), that.name, e);
- }
- that.isChangeFromOuter = false;
- });
- });
- }
- });
- },
- });
- }
- function attach_117(element, opts) {
- return new Promise(function (resolve) {
- var editor = window['monaco'].editor.create(element, __assign(__assign({}, opts), { language: 'handlebars', minimap: {
- enabled: false
- } }));
- editor.onKeyUp(function (e) {
- // console.log(e)
- if ( /*e.code === 'Enter'||*/e.code === 'Quote') {
- editor.trigger('随便写点儿啥', 'editor.action.triggerSuggest', {});
- }
- });
- resolve(editor);
- });
- }
- var DictStore = /** @class */ (function (_super) {
- __extends(DictStore, _super);
- function DictStore() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- DictStore.prototype.getCacheKey = function (param) {
- return "dict_data.json";
- };
- DictStore.prototype.invokeApi = function (param) {
- return getDict(param);
- };
- DictStore.prototype.getDicts = function () {
- return this.apiResponse.data.dict;
- };
- DictStore.prototype.getDictCodes = function () {
- return new Promise(function (resolve) {
- // reloadIfNeedPromise().then(() => {
- // const result = []
- // _.forEach(this.getDicts(), dictRow => {
- // result.push({
- // id: dictRow.dict_code,
- // text: dictRow.dict_code + ' (' + dictRow.dict_desc + ')',
- // })
- // })
- // resolve(result)
- // })
- });
- };
- DictStore.prototype.saveDict = function (param) {
- return saveDictApi(param);
- };
- DictStore.prototype.saveDictItems = function (param) {
- return saveDictItemsApi(param);
- };
- DictStore.prototype.getDictItemByDictcode = function (dict_code) {
- var results = [];
- _$2.forEach(this.apiResponse.data.dictItems, function (dictItemRow) {
- if (dictItemRow.dict_code === dict_code) {
- results.push(_$2.clone(dictItemRow));
- }
- });
- return results;
- };
- return DictStore;
- }(CacheStore));
- var instance$2 = new DictStore();
- var DictTreeController = /** @class */ (function () {
- function DictTreeController() {
- this._saveStateFlag = true;
- }
- DictTreeController.prototype.dictSave = function () {
- var _this = this;
- // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
- var _a = system.getGridEditRows(this.grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
- if (err) {
- // 如果有异常就不保存
- return;
- }
- // 进行业务上的逻辑校验,比如说必填校验等等
- var hasError = false;
- _$2.forEach(rows, function (row, i) {
- if (isEmpty(row.dict_code)) {
- msg$1("\u5B57\u5178\u7F16\u53F7\u4E0D\u80FD\u4E3A\u7A7A!");
- hasError = true;
- return false;
- }
- });
- if (hasError) {
- return;
- }
- // 设置当前界面为 "保存中..." 状态
- this.view.setLoading(true);
- instance$2.saveDict({
- newRows: newRows,
- modifyRows: modifyRows,
- removeRecords: removeRecords,
- }).then(function (res) {
- // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
- msg$1(res.msg);
- _this.reload();
- }).finally(function () {
- // 无论正常异常,关闭 "保存中..." 状态
- _this.view.setLoading(false);
- });
- };
- DictTreeController.prototype.dictItemSave = function () {
- var _this = this;
- var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
- var currentDictCode = undefined;
- if (record) {
- currentDictCode = record.get('dict_code');
- }
- if (!currentDictCode) {
- msg$1('请选择一个字典');
- return;
- }
- // 提取表格中,所有的 新行(newRows) / 修改过的行(modifyRows) / 删除过的行(removeRecords) / 全部行(rows) / 异常(err)
- var _b = system.getGridEditRows(this.grid2), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
- if (err) {
- // 如果有异常就不保存
- return;
- }
- // 进行业务上的逻辑校验,比如说必填校验等等
- var hasError = false;
- _$2.forEach(rows, function (row, i) {
- if (!row.dict_value && row.dict_value !== 0) {
- msg$1("\u5B57\u5178\u503C\u4E0D\u80FD\u4E3A\u7A7A!");
- hasError = true;
- return false;
- }
- });
- if (hasError) {
- return;
- }
- // 设置当前界面为 "保存中..." 状态
- this.view.setLoading(true);
- instance$2.saveDictItems({
- // 吧 newRows / modifyRows / removeRecords 再外加一些需要附带的数据,一并提交给后台,进行一次性事务提交
- newRows: newRows,
- modifyRows: modifyRows,
- removeRecords: removeRecords,
- dict_code: currentDictCode
- }).then(function (res) {
- // 保存成功就提示一下,并重新载入数据 (根据 dataSource 的设置)
- msg$1(res.msg);
- _this.reload();
- }).finally(function () {
- // 无论正常异常,关闭 "保存中..." 状态
- _this.view.setLoading(false);
- });
- };
- DictTreeController.prototype.createDictEnum = function () {
- var _this = this;
- var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
- var currentDictCode = undefined;
- if (record) {
- currentDictCode = record.get('dict_code');
- }
- if (!currentDictCode) {
- msg$1('请选择一个字典');
- return;
- }
- // 设置当前界面为 "保存中..." 状态
- this.view.setLoading(true);
- createDictEnum({ dictCode: currentDictCode })
- .then(function () { return _this.reload(); })
- .finally(function () { return _this.view.setLoading(false); });
- };
- DictTreeController.prototype.onLoad = function () {
- setDictTree(this);
- this.grid1 = this.view.lookupReference('grid1');
- this.grid2 = this.view.lookupReference('grid2');
- this.grid1.setData([]);
- this.grid2.setData([]);
- // this.grid1.columns[0].hide()
- this.grid2.columns[0].hide();
- // 找管理器订阅刷新的事件
- instance$2.registe(this.refreshData.bind(this));
- // 非强制性刷新 DbManager
- instance$2.reloadIfNeed(undefined);
- };
- DictTreeController.prototype.onDestory = function () {
- instance$2.unregiste(this.refreshData.bind(this));
- };
- // dictStore 刷新时,会回调到这个方法
- DictTreeController.prototype.refreshData = function (isLoadingState) {
- var me = this;
- if (typeof isLoadingState === 'boolean') {
- me.view.setLoading(isLoadingState);
- return;
- }
- this.grid1.setData(instance$2.getDicts());
- this.restoreState();
- };
- DictTreeController.prototype.grid1Selected = function (sender, record, event) {
- var _this = this;
- _$2.defer(function () {
- _this.saveState();
- });
- if (!record) {
- this.grid2.setData([]);
- return;
- }
- var dict_code = record.get('dict_code');
- var data = instance$2.getDictItemByDictcode(dict_code);
- this.grid2.setData(data);
- };
- DictTreeController.prototype.reload = function () {
- var _this = this;
- // 强制刷新 DbManager
- instance$2.reloadForce(undefined).then(function (res) {
- _this.search1(_this.getView().down('[emptyText=搜索过滤]'));
- });
- };
- DictTreeController.prototype.dictAdd = function () {
- this.grid1.appendEditRow({
- _createFlag: true,
- dict_code: '',
- dict_desc: '',
- }, 0);
- };
- DictTreeController.prototype.dictRemove = function () {
- this.grid1.removeEditRow();
- };
- DictTreeController.prototype.dictItemAdd = function () {
- var _a, _b;
- 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;
- if (!dict_code) {
- msg$1('请先保存字典');
- return;
- }
- this.grid2.appendEditRow({
- dict_code: dict_code,
- dict_text: '',
- dict_value: '',
- }, 0);
- };
- DictTreeController.prototype.dictItemRemove = function () {
- var _this = this;
- var rows = [];
- this.grid2.getSelectionModel().getSelected().eachRow(function (r) {
- rows.push(r);
- });
- _$2.forEach(rows, function (r) {
- _this.grid2.getStore().remove(r);
- });
- };
- DictTreeController.prototype.clearSearch1 = function () {
- this.grid1.store.clearFilter();
- };
- DictTreeController.prototype.search1 = function (sender) {
- this.grid1.store.clearFilter();
- this.getViewModel().set('grid1.selection', null);
- this.grid1.fireEvent('itemselect');
- var value = _$2.lowerCase(sender.getRawValue()).trim();
- if (!value) {
- return;
- }
- this.grid1.store.filterBy(function (record) {
- if (record.get('_createFlag')) {
- return true;
- }
- var dict_code = _$2.lowerCase(record.get('dict_code'));
- var dict_desc = _$2.lowerCase(record.get('dict_desc'));
- var dict_desc_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_desc));
- return (dict_code.includes(value) ||
- dict_desc.includes(value) ||
- dict_desc_py.includes(value));
- });
- };
- DictTreeController.prototype.clearSearch2 = function () {
- this.grid2.store.clearFilter();
- };
- DictTreeController.prototype.search2 = function (sender) {
- this.grid2.store.clearFilter();
- var value = _$2.lowerCase(sender.getRawValue()).trim();
- if (!value) {
- return;
- }
- this.grid2.store.filterBy(function (record) {
- var dict_text = _$2.lowerCase(record.get('dict_text'));
- var dict_value = _$2.lowerCase(record.get('dict_value'));
- var dict_text_py = _$2.lowerCase(pinyinUtil.getFirstLetter(dict_text));
- return (dict_text.includes(value) ||
- dict_value === value ||
- dict_text_py.includes(value));
- });
- };
- DictTreeController.prototype.getStateFilename = function () {
- return getCurrentProject().uuid + "/dicttree.json";
- };
- DictTreeController.prototype.restoreState = function () {
- var _this = this;
- var grid = this.grid1;
- native.loadFile(this.getStateFilename(), function (content) {
- if (!content)
- return;
- var selection = content.selection, scrollPosition = content.scrollPosition, scrollSize = content.scrollSize;
- _this._saveStateFlag = false;
- if (selection) {
- var idx = grid.store.findExact('dict_code', selection);
- if (idx >= 0) {
- var record = grid.store.getAt(idx);
- if (record) {
- grid.setSelection([record]);
- }
- }
- }
- if (scrollPosition && scrollSize) {
- var size = grid.scrollable.getSize();
- if (size.x === scrollSize.x && size.y === scrollSize.y) {
- grid.scrollable.doScrollTo(scrollPosition.x, scrollPosition.y);
- }
- }
- setTimeout(function () {
- _this._saveStateFlag = true;
- }, 200);
- });
- };
- DictTreeController.prototype.saveState = function () {
- if (!this._saveStateFlag) {
- return;
- }
- var _a = __read(this.grid1.getSelection(), 1), record = _a[0];
- var selection = undefined;
- if (record) {
- selection = record.get('dict_code');
- }
- var scrollPosition = this.grid1.scrollable.position;
- var scrollSize = this.grid1.scrollable.getSize();
- native.saveFile(this.getStateFilename(), {
- selection: selection,
- scrollPosition: scrollPosition,
- scrollSize: scrollSize
- });
- };
- return DictTreeController;
- }());
- function initDict$1 () {
- var controller = new DictTreeController();
- Ext.define('com.yvan.studio.DictTree', {
- extend: 'Ext.panel.Panel',
- xtype: 'dicttree',
- controller: controller,
- scope: controller,
- referenceHolder: true,
- tooltip: '字典',
- iconCls: 'x-fa fa-book',
- rootVisible: false,
- useArrows: true,
- reference: 'dicttree',
- layout: 'border',
- listeners: {
- afterrender: 'onLoad',
- destory: 'onDestory',
- },
- items: [
- {
- region: 'center',
- xtype: 'yvgrid', hideFootbar: true, reference: 'grid1',
- _mode: 'select',
- tbar: [
- {
- xtype: 'button',
- tooltip: '刷新',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'reload'
- }
- },
- {
- xtype: 'button',
- tooltip: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'dictAdd'
- }
- },
- {
- xtype: 'button',
- tooltip: '删除',
- iconCls: 'x-fa fa-minus-circle',
- bind: {
- disabled: '{!grid1.selection}'
- },
- listeners: {
- click: 'dictRemove'
- }
- },
- {
- xtype: 'button',
- tooltip: '保存',
- iconCls: 'x-fa fa-save',
- bind: {
- disabled: '{!grid1.ischanged}'
- },
- listeners: {
- click: 'dictSave'
- }
- },
- {
- xtype: 'textfield',
- hideClear: true,
- triggers: {
- clear: {
- cls: 'x-form-clear-trigger',
- handler: 'clearSearch1'
- },
- },
- flex: 1,
- emptyText: '搜索过滤',
- enableKeyEvents: true,
- listeners: {
- keyup: {
- fn: 'search1',
- buffer: 50
- }
- }
- },
- ],
- listeners: {
- itemselect: 'grid1Selected',
- },
- idField: 'dict_code',
- columns: [
- {
- text: '字典编号', dataIndex: 'dict_code',
- menuDisabled: true, flex: 1,
- editor: {
- allowBlank: true,
- selectOnFocus: false
- }
- },
- {
- text: '中文描述', dataIndex: 'dict_desc',
- menuDisabled: true, flex: 1,
- editor: {
- allowBlank: true,
- selectOnFocus: false
- }
- },
- ]
- },
- {
- region: 'south', height: '50%',
- xtype: 'yvgrid', hideFootbar: true, reference: 'grid2',
- split: true,
- _mode: 'edit1',
- listeners: {},
- tbar: [
- {
- xtype: 'button',
- tooltip: '添加',
- iconCls: 'x-fa fa-plus-circle',
- bind: {
- disabled: '{!grid1.selection}'
- },
- listeners: {
- click: 'dictItemAdd'
- }
- },
- {
- xtype: 'button',
- tooltip: '删除',
- iconCls: 'x-fa fa-minus-circle',
- bind: {
- disabled: '{!grid1.selection}'
- },
- listeners: {
- click: 'dictItemRemove'
- }
- },
- {
- xtype: 'button',
- tooltip: '保存',
- iconCls: 'x-fa fa-save',
- bind: {
- disabled: '{!grid2.ischanged}'
- },
- listeners: {
- click: 'dictItemSave'
- }
- },
- {
- xtype: 'button',
- tooltip: '刷新代码',
- iconCls: 'x-fa fa-code',
- bind: {
- disabled: '{!grid1.selection}'
- },
- listeners: {
- click: 'createDictEnum'
- }
- },
- ],
- columns: [
- {
- text: '字典项', dataIndex: 'dict_text',
- menuDisabled: true, flex: 1,
- editor: {
- allowBlank: true,
- selectOnFocus: false
- }
- },
- {
- text: '字典值', dataIndex: 'dict_value',
- menuDisabled: true, flex: 1,
- dataType: 'int',
- editor: {
- xtype: 'numberfield',
- allowBlank: true,
- selectOnFocus: false
- }
- },
- {
- text: '激活', dataIndex: 'is_enable',
- xtype: 'checkcolumn', menuDisabled: true,
- },
- {
- text: '变量名', dataIndex: 'var_name',
- menuDisabled: true, flex: 1,
- editor: {
- allowBlank: true,
- selectOnFocus: false
- }
- },
- ]
- }
- ]
- });
- }
- var model$g = {
- data: {
- form: {
- path: "",
- requestBody: "",
- responseBody: "",
- }
- }
- };
- var vjson$f = {
- title: '接口信息',
- layout: 'fit',
- width: 800,
- height: 500,
- items: [
- {
- xtype: 'form',
- layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch'
- },
- defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- },
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '接口路径',
- bind: {
- value: "{form.path}",
- },
- },
- {
- xtype: 'textareafield',
- // height: 150,
- flex: 2,
- fieldLabel: '请求数据',
- bind: {
- value: "{form.requestBody}",
- },
- },
- {
- xtype: 'textareafield',
- // height: 150,
- flex: 5,
- fieldLabel: '响应数据',
- bind: {
- value: "{form.responseBody}",
- },
- },
- ]
- }
- ]
- };
- var ApiInfoDialog = /** @class */ (function (_super) {
- __extends(ApiInfoDialog, _super);
- function ApiInfoDialog() {
- return _super.call(this, { model: model$g, vjson: vjson$f }) || this;
- }
- return ApiInfoDialog;
- }(Scope));
- var model$h = {
- data: {
- query: {
- role_id: '',
- resource_id: '',
- },
- form: {},
- form2: {
- key: "",
- start_at: "",
- end_at: "",
- }
- }
- };
- var vjson$g = {
- title: '接口信息',
- layout: 'fit',
- items: [
- {
- layout: 'border',
- border: false,
- items: [
- {
- region: 'center',
- layout: 'border',
- items: [
- {
- region: 'north',
- bind: {
- title: '{form.title}',
- },
- xtype: 'form',
- scrollable: true,
- layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch'
- },
- defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- },
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '查询',
- iconCls: 'x-fa fa-search',
- listeners: {
- click: 'scope.requestLogs'
- },
- },
- {
- xtype: 'button',
- text: '保存',
- iconCls: 'x-fa fa-save',
- listeners: {},
- },
- {
- xtype: 'button',
- text: '禁用',
- iconCls: 'x-fa fa-stop-circle',
- bind: {},
- listeners: {},
- },
- {
- xtype: 'button',
- text: '启用',
- iconCls: 'x-fa fa-play-circle',
- bind: {},
- listeners: {},
- },
- ],
- },
- items: [
- {
- xtype: 'cols',
- defaults: { labelWidth: 120 },
- items: [
- {
- xtype: 'textfield',
- fieldLabel: 'URL',
- bind: {
- value: '{form.api_url}',
- },
- readOnly: true,
- },
- {
- xtype: 'textfield',
- fieldLabel: '名称',
- bind: {
- value: '{form.api_name}',
- },
- readOnly: true,
- },
- ],
- },
- {
- xtype: 'cols',
- defaults: { labelWidth: 120 },
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '实现类',
- bind: {
- value: '{form.api_class}',
- },
- readOnly: true,
- },
- {
- border: false,
- flex: 1
- },
- ]
- },
- {
- xtype: 'cols',
- defaults: { labelWidth: 120 },
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '超时时间',
- bind: {
- value: '{form.timeout}',
- },
- readOnly: true,
- },
- {
- border: false,
- flex: 1
- },
- ]
- },
- {
- xtype: 'cols',
- defaults: { labelWidth: 120 },
- items: [
- {
- xtype: 'textfield',
- fieldLabel: 'Remote IP',
- bind: {
- value: '{form.remote_ip}',
- },
- readOnly: true,
- },
- {
- border: false,
- flex: 1
- },
- ]
- },
- {
- xtype: 'cols',
- defaults: { labelWidth: 120 },
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '解析表单',
- bind: {
- value: '{form.chandi}',
- },
- readOnly: true,
- },
- {
- border: false,
- flex: 1
- },
- ]
- },
- ],
- },
- {
- region: 'center',
- // title: 'Request',
- layout: 'border',
- items: [
- {
- region: 'north',
- xtype: 'form',
- reference: 'form2',
- split: true,
- items: [
- {
- xtype: 'cols',
- width: 700,
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '关键字',
- bind: {
- value: "{form2.key}"
- },
- },
- {
- xtype: 'datefield',
- fieldLabel: '开始时间',
- bind: {
- value: "{form2.start_at}"
- },
- },
- {
- xtype: 'datefield',
- fieldLabel: '结束时间',
- bind: {
- value: "{form2.end_at}"
- },
- },
- ]
- }
- ]
- },
- {
- region: 'center',
- xtype: 'yvgrid',
- layout: 'fit',
- reference: 'grid1',
- pagination: true,
- autoLoad: false,
- selModel: {
- selType: 'rowmodel',
- mode: 'SINGLE',
- },
- dataSource: {
- method: 'invoke',
- url: '/sys/api/Api@requestLogs',
- params: {
- formData: '{form2}',
- path: '{form.api_url}',
- },
- },
- listeners: {
- rowdblclick: 'scope.showDialog',
- },
- columns: [
- { dataIndex: "@timestamp", header: "时间", width: 150 },
- { dataIndex: "remoteIP", header: "RemoteIP", width: 150 },
- { dataIndex: "cost", header: "耗时(毫秒)", width: 80 },
- { dataIndex: "size", header: "大小", width: 80 },
- { dataIndex: "path", header: "path", flex: 1 },
- { dataIndex: "requestBody", header: "requestBody", hidden: true },
- { dataIndex: "responseBody", header: "responseBody", hidden: true },
- ]
- }
- ]
- },
- ],
- },
- ],
- },
- ],
- referenceHolder: true,
- };
- var Api = /** @class */ (function (_super) {
- __extends(Api, _super);
- function Api() {
- return _super.call(this, { model: model$h, vjson: vjson$g }) || this;
- }
- Api.prototype.onLoad = function () {
- _super.prototype.onLoad.call(this);
- this.requestLogs();
- };
- Api.prototype.selectList = function (sender, selected, eOpts) {
- this.viewModel.set("form", selected.data);
- if (selected.data.api_type === '1') {
- this.viewModel.set("form.title", selected.data.api_name + "-(接收)");
- }
- else {
- this.viewModel.set("form.title", selected.data.api_name + "-(发送)");
- }
- };
- Api.prototype.methodDataLoadComplete = function (sender, success, records) {
- var sel = [];
- _$2.forEach(records, function (item) {
- if (item.data.flg === 'Y') {
- sel.push(item);
- }
- });
- this.refs.methodGrid.selModel.select(sel);
- };
- Api.prototype.saveAll = function () {
- var _this = this;
- var _a, _b, _c;
- var role_id = this.viewModel.get("query.role_id");
- if (!role_id) {
- msg$1("请先选择一个角色");
- return;
- }
- var wh_id = this.viewModel.get("form.wh_id");
- if (!wh_id) {
- msg$1("请先选择一个仓库");
- return;
- }
- var menus = this.refs.theTree.getChecked();
- var rowsMenus = [];
- _$2.forEach(menus, function (m) {
- if (m.data.resource_id) {
- rowsMenus.push(m.data.resource_id);
- }
- });
- var mm = (_a = this.refs.methodGrid.getStore().getData().items) === null || _a === void 0 ? void 0 : _a.map(function (r) { return r.data; });
- 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; });
- _$2.remove(mm, function (x) {
- return methodsArry.includes(x.resource_id);
- });
- var rowsBtn = [];
- _$2.forEach(mm, function (m) {
- rowsBtn.push({ resource_id: m.resource_id });
- });
- this.setLoading(true);
- invokeServer$1('/sys/role/Role@saveAll', {
- wh_id: wh_id,
- role_id: role_id,
- rowsMenus: rowsMenus,
- rowsBtn: rowsBtn,
- }).then(function (res) {
- msg$1(res.msg);
- if (res.success) {
- _this.reloadTree();
- // this.viewModel.set('query.role_id', '')
- _this.viewModel.set('query.resource_id', '');
- _this.refs.methodGrid.reload();
- }
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- Api.prototype.editRoleSuccess = function (sender, data) {
- if (data.success) {
- this.refs.roleGrid.reload();
- this.viewModel.set("query.JIAOS_ID", "");
- this.reloadTree();
- this.viewModel.set("query.CAID_ID", "");
- this.refs.methodGrid.reload();
- }
- };
- Api.prototype.deleteRole = function (sender) {
- var _this = this;
- var role_id = this.viewModel.get("query.role_id");
- if (!role_id) {
- msg$1("请先选择一个角色");
- return;
- }
- Ext.Msg.confirm('提示', "您确定要删除该角色吗?", function (btn) {
- if (btn === 'yes') {
- invokeServer$1('/sys/role/Role@deleteRole', {
- role_id: role_id,
- wh_id: window['whId']
- }).then(function (res) {
- msg$1(res.msg);
- if (res.success) {
- _this.refs.roleGrid.reload();
- _this.viewModel.set("query.role_id", "");
- _this.reloadTree();
- _this.refs.methodGrid.reload();
- }
- });
- }
- });
- };
- Api.prototype.reloadTree = function () {
- showErrorDialog$1('reloadTree 不存在');
- };
- Api.prototype.whChange = function (sender, value) {
- this.viewModel.set("form.wh_id", value);
- this.reloadTree();
- this.refs.methodGrid.reload();
- };
- Api.prototype.requestLogs = function () {
- var path = this.viewModel.get("form.api_url");
- if (!path)
- return;
- this.refs.grid1.reload();
- };
- Api.prototype.showDialog = function (sender) {
- var _a, _b;
- 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; });
- if (!rows || rows.length <= 0)
- return;
- var dialog = new ApiInfoDialog();
- dialog.showDialog(null, {}, {
- data: {
- form: __assign({}, rows[0])
- }
- });
- };
- return Api;
- }(Scope));
- var Controller = /** @class */ (function () {
- function Controller() {
- }
- Controller.prototype.selectList = function (sender, selected, eOpts) {
- var _a, _b, _c, _d, _e, _f, _g, _h;
- // @ts-ignore
- 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; });
- if (!rows || rows.length <= 0)
- return;
- var apiPage = new Api();
- apiPage.showPage({
- title: "API-" + ((_d = (_c = rows[0]) === null || _c === void 0 ? void 0 : _c.api_name) !== null && _d !== void 0 ? _d : ""),
- id: ("API_" + ((_f = (_e = rows[0]) === null || _e === void 0 ? void 0 : _e.api_url) !== null && _f !== void 0 ? _f : "")).replace(/[-/@]/g, "_"),
- path: ("API_" + ((_h = (_g = rows[0]) === null || _g === void 0 ? void 0 : _g.api_url) !== null && _h !== void 0 ? _h : "")).replace(/[-/@]/g, "_"),
- }, {
- data: {
- form: __assign({}, rows[0])
- }
- });
- };
- return Controller;
- }());
- var controller = new Controller();
- function initApiTree () {
- Ext.define('com.yvan.studio.ApiGrid', {
- extend: 'Ext.Panel',
- xtype: 'apigrid',
- controller: controller,
- scope: controller,
- referenceHolder: true,
- layout: 'fit',
- items: [
- {
- width: 400,
- split: true,
- xtype: 'yvgrid',
- reference: 'roleGrid',
- border: false,
- pagination: false,
- autoLoad: true,
- remoteFilter: false,
- selModel: {
- selType: 'rowmodel',
- mode: 'SINGLE',
- },
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '新增',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {},
- },
- {
- xtype: 'button',
- text: '删除',
- iconCls: 'x-fa fa-trash',
- bind: {
- disabled: '{roleGrid.selection==null}',
- },
- listeners: {},
- },
- ],
- },
- dataSource: {
- url: '/sys/api/Api@getApiList',
- method: 'invoke',
- params: {},
- },
- listeners: {
- itemdblclick: "selectList",
- },
- columns: [
- {
- dataIndex: 'api_name',
- header: '接口名称',
- filter: { type: 'string' },
- flex: 1,
- },
- ],
- },
- ]
- });
- }
- var model$i = {
- data: {
- iframeSrc: ''
- }
- };
- var vjson$h = {
- layout: 'fit',
- border: false,
- iconCls: 'x-fa fa-newspaper-o',
- referenceHolder: true,
- items: [
- {
- // title: 'view.design',
- xtype: 'uxiframe',
- layout: 'fit',
- // cls: 'module_page_iframe',
- reference: 'iframe',
- listeners: {
- afterrender: 'scope.iframeRender'
- }
- },
- ]
- };
- var Iframe = /** @class */ (function (_super) {
- __extends(Iframe, _super);
- function Iframe(path) {
- var _this = _super.call(this, { model: model$i, vjson: vjson$h }) || this;
- _this.path = "";
- _this.path = path;
- return _this;
- }
- Iframe.prototype.iframeRender = function (sender) {
- var $dom = $(sender.el.dom).find('iframe');
- var iframe = $dom[0];
- iframe.src = getCurrentProject().url + this.path + "?xxl-job-token=m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL";
- iframe.onload = function () {
- iframe.contentWindow.postMessage("m5nxz7UdeixzQyy5KiDckL0ne3GtNhvvCwPL47rEp5jR7eTOAK50QjvqHgZOxOStusSyB5jZViBuc0ysdT7M8IfjsVEgj7ATEL", '*');
- };
- };
- return Iframe;
- }(Scope));
- var Controller$1 = /** @class */ (function () {
- function Controller() {
- }
- Controller.prototype.onDblClick = function (sender, record) {
- var data = record.raw;
- if (data.text === "运行报表") {
- this.openIframe("/xxl-job/index", "运行报表");
- }
- else if (data.text === "任务管理") {
- this.openIframe("/xxl-job/jobinfo", "任务管理");
- }
- else if (data.text === "调度日志") {
- this.openIframe("/xxl-job/joblog", "调度日志");
- }
- else if (data.text === "执行器管理") {
- this.openIframe("/xxl-job/jobgroup", "执行器管理");
- }
- };
- Controller.prototype.openIframe = function (path, title) {
- var page = new Iframe(path);
- page.showPage({
- title: title,
- id: 'xxljob__' + path.replaceAll("/", "_"),
- path: 'xxljob__' + path.replaceAll("/", "_"),
- }, {});
- };
- Controller.prototype.onLoad = function () {
- var me = this;
- me.getView().setRootNode({
- expanded: true,
- leaf: false,
- children: [
- { leaf: true, text: '运行报表' },
- { leaf: true, text: '任务管理' },
- { leaf: true, text: '调度日志' },
- { leaf: true, text: '执行器管理' },
- ]
- });
- };
- return Controller;
- }());
- var controller$1 = new Controller$1();
- function initTaskTree () {
- Ext.define('com.yvan.studio.TaskTree', {
- extend: 'Ext.tree.Panel',
- xtype: 'tasktree',
- controller: controller$1,
- scope: controller$1,
- reference: 'roleGrid',
- tooltip: '表单定义',
- iconCls: 'x-fa fa-bar-chart',
- useArrows: true,
- rootVisible: false,
- colspan: 2,
- lines: true,
- multiSelect: false,
- referenceHolder: true,
- // openNode() {
- // const selection = this.getSelection()
- // const [record] = selection
- // if (!record) {
- // return
- // }
- //
- // const {raw} = record;
- // if (raw.type === 'Dir') {
- // return
- // }
- // if (raw.type === "Module" && raw.module) {
- // // eventBus.publish(EventType.ModuleOpen, raw)
- // }
- // },
- listeners: {
- itemdblclick: 'onDblClick',
- afterrender: "onLoad",
- },
- });
- }
- var model$j = {
- data: {
- form: {
- address: "",
- level: "",
- logger: "",
- message: "",
- nodeName: "",
- serverName: "",
- thread: "",
- whId: "",
- userId: "",
- }
- }
- };
- var vjson$i = {
- title: '接口信息',
- layout: 'fit',
- width: 800,
- height: 600,
- items: [
- {
- xtype: 'form',
- layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch'
- },
- defaults: {
- border: false,
- anchor: '100%',
- margin: '5',
- },
- items: [
- { xtype: 'textfield', fieldLabel: '服务名', bind: { value: "{form.serverName}" } },
- { xtype: 'textfield', fieldLabel: '服务地址', bind: { value: "{form.address}" } },
- { xtype: 'textfield', fieldLabel: '节点名称', bind: { value: "{form.nodeName}" } },
- { xtype: 'textfield', fieldLabel: '日志级别', bind: { value: "{form.level}" } },
- { xtype: 'textfield', fieldLabel: '日志Logger', bind: { value: "{form.logger}" } },
- { xtype: 'textfield', fieldLabel: '线程号', bind: { value: "{form.thread}" } },
- { xtype: 'textfield', fieldLabel: '仓库ID', bind: { value: "{form.whId}" } },
- // {xtype: 'textfield', fieldLabel: '用户ID', bind: {value: "{form.userId}"}},
- {
- xtype: 'textareafield',
- flex: 5,
- fieldLabel: '响应数据',
- bind: {
- value: "{form.message}",
- },
- },
- ]
- }
- ]
- };
- var ApiInfoDialog$1 = /** @class */ (function (_super) {
- __extends(ApiInfoDialog, _super);
- function ApiInfoDialog() {
- return _super.call(this, { model: model$j, vjson: vjson$i }) || this;
- }
- return ApiInfoDialog;
- }(Scope));
- var model$k = {
- data: {
- form2: {}
- }
- };
- var vjson$j = {
- title: '日志查询',
- layout: 'fit',
- width: "70%",
- height: "80%",
- items: [
- {
- region: 'center',
- xtype: 'yvgrid',
- layout: 'fit',
- reference: 'grid1',
- pagination: false,
- autoLoad: false,
- selModel: {
- selType: 'rowmodel',
- mode: 'SINGLE',
- },
- dataSource: {
- method: 'invoke',
- url: '/sys/api/Api@aroundLogs',
- params: {
- formData: '{form2}',
- },
- },
- listeners: {
- rowdblclick: 'scope.showDialog2',
- },
- columns: [
- { dataIndex: "@timestamp", header: "时间", width: 150 },
- // {dataIndex: "nodeName", header: "nodeName", width: 80},
- { dataIndex: "thread", header: "thread", width: 150 },
- { dataIndex: "message", header: "message", flex: 1 },
- ]
- }
- ]
- };
- var AroundLog = /** @class */ (function (_super) {
- __extends(AroundLog, _super);
- function AroundLog() {
- return _super.call(this, { model: model$k, vjson: vjson$j }) || this;
- }
- AroundLog.prototype.onLoad = function () {
- _super.prototype.onLoad.call(this);
- this.queryLog();
- };
- AroundLog.prototype.queryLog = function () {
- this.refs.grid1.reload();
- };
- AroundLog.prototype.showDialog2 = function () {
- var _a, _b;
- 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; });
- if (!rows || rows.length <= 0)
- return;
- var dialog = new ApiInfoDialog$1();
- dialog.showDialog(null, {}, {
- data: {
- form: __assign({}, rows[0])
- }
- });
- };
- return AroundLog;
- }(Scope));
- var model$l = {
- data: {
- form2: {
- key: "",
- start_at: "",
- end_at: "",
- }
- }
- };
- var vjson$k = {
- title: '日志查询',
- layout: 'fit',
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- text: '刷新',
- listeners: {
- click: 'scope.queryLog'
- },
- },
- {
- xtype: 'button',
- text: '周围日志',
- bind: {},
- listeners: {
- click: 'scope.aroundLogs'
- },
- },
- ],
- },
- items: [
- {
- region: 'center',
- xtype: 'yvgrid',
- layout: 'fit',
- reference: 'grid1',
- pagination: true,
- autoLoad: false,
- selModel: {
- selType: 'rowmodel',
- mode: 'SINGLE',
- },
- dataSource: {
- method: 'invoke',
- url: '/sys/api/Api@queryLog',
- params: {
- formData: '{form2}',
- path: '{form.api_url}',
- },
- },
- listeners: {
- rowdblclick: 'scope.showDialog',
- },
- columns: [
- { dataIndex: "@timestamp", header: "时间", width: 150 },
- // {dataIndex: "nodeName", header: "nodeName", width: 80},
- { dataIndex: "thread", header: "thread", width: 150 },
- { dataIndex: "message", header: "message", flex: 1 },
- ]
- }
- ]
- };
- var LogPage = /** @class */ (function (_super) {
- __extends(LogPage, _super);
- function LogPage() {
- return _super.call(this, { model: model$l, vjson: vjson$k }) || this;
- }
- LogPage.prototype.onLoad = function () {
- _super.prototype.onLoad.call(this);
- this.queryLog();
- };
- LogPage.prototype.queryLog = function () {
- this.refs.grid1.reload();
- };
- LogPage.prototype.showDialog = function () {
- var _a, _b;
- 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; });
- if (!rows || rows.length <= 0)
- return;
- var dialog = new ApiInfoDialog$1();
- dialog.showDialog(null, {}, {
- data: {
- form: __assign({}, rows[0])
- }
- });
- };
- LogPage.prototype.aroundLogs = function () {
- var _a, _b;
- 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; });
- if (!rows || rows.length <= 0)
- return;
- var dialog = new AroundLog();
- dialog.showDialog(null, {}, {
- data: {
- form2: __assign({}, rows[0])
- }
- });
- };
- return LogPage;
- }(Scope));
- var Controller$2 = /** @class */ (function () {
- function Controller() {
- }
- Controller.prototype.queryLog = function () {
- var form2 = this.getViewModel().get("form2");
- var logPage = new LogPage();
- logPage.showPage({}, {
- data: {
- form2: __assign({}, form2)
- }
- });
- };
- return Controller;
- }());
- var controller$2 = new Controller$2();
- function initLogsTree () {
- Ext.define('com.yvan.studio.LogsTree', {
- extend: 'Ext.panel.Panel',
- xtype: 'logstree',
- controller: controller$2,
- scope: controller$2,
- viewModel: {
- data: {
- form2: {
- key: "",
- start_at: "",
- end_at: "",
- }
- }
- },
- reference: 'logstree',
- tooltip: '表单定义',
- iconCls: 'x-fa fa-bar-chart',
- useArrows: true,
- rootVisible: false,
- colspan: 2,
- lines: true,
- multiSelect: false,
- referenceHolder: true,
- items: [
- {
- region: 'north',
- xtype: 'form',
- reference: 'form2',
- split: true,
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '关键字',
- bind: {
- value: "{form2.key}"
- },
- },
- {
- xtype: 'datefield',
- fieldLabel: '开始时间',
- bind: {
- value: "{form2.start_at}"
- },
- },
- {
- xtype: 'datefield',
- fieldLabel: '结束时间',
- bind: {
- value: "{form2.end_at}"
- },
- },
- ]
- },
- {
- xtype: "cols",
- items: [
- {
- xtype: "box",
- },
- {
- xtype: "button",
- text: '查询',
- listeners: {
- click: 'queryLog'
- },
- },
- {
- xtype: "box",
- },
- ]
- },
- ],
- });
- }
- var model$m = {
- data: {
- // opsId: "",
- // name: "",
- running: false,
- }
- };
- var vjson$l = {
- bind: {
- title: '运维-{name}',
- },
- layout: 'fit',
- items: [
- {
- layout: 'border',
- items: [
- {
- region: 'north',
- items: [
- {
- xtype: 'toolbar',
- border: false,
- items: [
- {
- xtype: 'button',
- text: '执行',
- iconCls: 'x-fa fa-play',
- bind: {
- hidden: "{running}",
- },
- listeners: {
- click: 'scope.start'
- }
- },
- {
- xtype: 'button',
- text: '停止',
- iconCls: 'x-fa fa-stop',
- bind: {
- hidden: "{!running}",
- },
- listeners: {
- click: 'scope.stop'
- }
- },
- ],
- },
- ]
- },
- {
- region: 'center',
- reference: 'terminal',
- xtype: 'terminal',
- },
- ],
- },
- ],
- };
- var DevOpsTerminal = /** @class */ (function (_super) {
- __extends(DevOpsTerminal, _super);
- function DevOpsTerminal() {
- var _this = _super.call(this, { model: model$m, vjson: vjson$l }) || this;
- _this.websocket = undefined;
- return _this;
- }
- DevOpsTerminal.prototype.onLoad = function () {
- this.load();
- };
- DevOpsTerminal.prototype.onDestroy = function () {
- if (this.websocket) {
- this.websocket.close();
- this.websocket = undefined;
- }
- };
- DevOpsTerminal.prototype.load = function () {
- var _this = this;
- var opsId = this.viewModel.get('opsId');
- this.setLoading(true);
- devOpsById(opsId).then(function (res) {
- _this.viewModel.set('devOps', res.data);
- }).finally(function () {
- _this.setLoading(false);
- });
- };
- DevOpsTerminal.prototype.start = function () {
- var me = this;
- var running = this.viewModel.get('running');
- var devOps = this.viewModel.get('devOps');
- if (running || !(devOps === null || devOps === void 0 ? void 0 : devOps.host) || !(devOps === null || devOps === void 0 ? void 0 : devOps.cmd_tpl))
- return;
- var devopsServer = "ws://122.9.140.63:9999";
- this.websocket = new WebSocket(devopsServer + "/ssh?token=b78f3e0ada722acb7a14ac1a4b19f10d03197eabac39ea92e511bb38b9e3a91f79a87e9699427b83c55591f79a55ca87479b259fc304");
- this.websocket.addEventListener('open', function () {
- me.viewModel.set('running', true);
- me.websocket.send(JSON.stringify({ host: devOps.host, cmd: devOps.cmd_tpl }));
- });
- this.websocket.addEventListener('message', function (event) {
- me.refs.terminal.write(event.data);
- });
- this.websocket.addEventListener('close', function () {
- me.stop();
- });
- this.websocket.addEventListener('error', function () {
- me.stop();
- });
- };
- DevOpsTerminal.prototype.stop = function () {
- if (this.websocket) {
- this.websocket.close();
- this.websocket = undefined;
- }
- this.viewModel.set('running', false);
- };
- return DevOpsTerminal;
- }(Scope));
- var Controller$3 = /** @class */ (function () {
- function Controller() {
- }
- Controller.prototype.onLoad = function (sender) {
- this.reload();
- };
- Controller.prototype.reload = function () {
- var me = this;
- // @ts-ignore
- var view = me.getView();
- view.setLoading(true);
- devOpsList().then(function (res) {
- view.setStore(new Ext.data.Store({
- fields: ['ops_id', 'host', 'name'],
- data: res.data,
- }));
- }).finally(function () {
- view.setLoading(false);
- });
- };
- Controller.prototype.onDblClick = function (sender) {
- this.devOpsTerminal();
- };
- Controller.prototype.devOpsTerminal = function () {
- // @ts-ignore
- var view = this.getView();
- var _a = __read(view.getSelection(), 1), record = _a[0];
- if (record) {
- var name = record.get('name');
- var opsId = record.get('ops_id');
- var instance = new DevOpsTerminal();
- instance.showPage({
- id: 'ops_' + opsId,
- path: 'ops_' + opsId,
- }, {
- data: {
- opsId: opsId,
- name: name,
- }
- });
- instance.dialogSuccess = function () {
- };
- }
- };
- return Controller;
- }());
- var controller$3 = new Controller$3();
- function initDevOpsTree () {
- Ext.define('com.yvan.studio.DevOpsGrid', {
- extend: 'Ext.grid.Panel',
- xtype: 'devopsgrid',
- controller: controller$3,
- scope: controller$3,
- referenceHolder: true,
- tooltip: '运维',
- iconCls: 'x-fa fa-terminal',
- useArrows: true,
- reference: 'devopsgrid',
- selModel: { type: 'rowmodel', mode: 'SINGLE', },
- listeners: {
- afterrender: 'onLoad',
- itemdblclick: 'onDblClick',
- },
- viewConfig: {
- // listeners: {
- // itemcontextmenu: 'onGridContextMenu',
- // },
- },
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- tooltip: '刷新',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'reload'
- }
- },
- {
- xtype: 'textfield',
- flex: 1,
- emptyText: '搜索过滤',
- enableKeyEvents: true,
- listeners: {
- change: {
- fn: 'filterChanged',
- buffer: 50
- }
- }
- },
- ]
- },
- columns: [
- {
- text: 'ID', dataIndex: 'report_id',
- hidden: true,
- },
- {
- text: '服务器',
- dataIndex: 'host',
- width: 100,
- menuDisabled: true,
- },
- {
- text: '操作名称',
- dataIndex: 'name',
- flex: 1,
- menuDisabled: true,
- },
- ]
- });
- }
- function initTerminal () {
- Ext.define('com.yvan.studio.Terminal', {
- extend: 'Ext.panel.Panel',
- alias: 'widget.terminal',
- xtype: 'terminal',
- layout: 'fit',
- border: false,
- html: "<div class=\"terminal\" style=\"height: 100%;\"/>",
- config: {},
- write: function (str) {
- if (this.term) {
- this.term.write(str);
- }
- },
- initComponent: function () {
- var that = this;
- this.superclass.initComponent.call(this, arguments);
- that.on({
- resize: function () {
- var _a;
- if ((_a = that.fitAddon) === null || _a === void 0 ? void 0 : _a.fit) {
- that.fitAddon.fit();
- }
- },
- destory: function () {
- if (that.term) {
- that.term.dispose();
- delete that.term;
- }
- if (that.fitAddon) {
- that.fitAddon.dispose();
- delete that.fitAddon;
- }
- },
- afterrender: function (sender) {
- _.defer(function () {
- var $dom = $(that.el.dom).find('.terminal');
- that.term = new xterm.Terminal({
- // cursorBlink: false,
- // cursorStyle: 'bar', // block underline bar
- // enableBold: false,
- // bellStyle: "sound",
- fontFamily: '"DejaVu Sans Mono", "Everson Mono", FreeMono, Menlo, Terminal, monospace, Consolas',
- // scrollback: 10000,
- // tabStopWidth: 4,
- disableStdin: true,
- theme: {
- // foreground: "#111",
- // background: "#fdfdfd",
- // background: "#fafafa",
- },
- });
- that.fitAddon = new xtermAddonFit.FitAddon();
- that.term.loadAddon(that.fitAddon);
- that.term.open($dom[0]);
- that.fitAddon.fit();
- // that.term.write('Hello from \x1B[1;3;31mxterm.js\x1B[0m $ ')
- });
- }
- });
- }
- });
- }
- var vjson$m = {
- title: '接口统计',
- layout: 'fit',
- items: [
- {
- title: '接口统计',
- xtype: 'yvgrid',
- enableLocking: false,
- reference: 'grid1',
- pagination: false,
- selModel: { type: 'rowmodel', mode: 'SINGLE', },
- tbar: {
- xtype: 'form',
- items: [
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '搜索',
- listeners: {
- change: 'scope.requestFilterChange'
- }
- },
- ]
- },
- ]
- },
- columns: [
- { text: '地址', dataIndex: 'url', flex: 1 },
- { text: '数据库请求', dataIndex: 'jdbcCount', dataType: 'number' },
- { text: '次数', dataIndex: 'count', dataType: 'number' },
- { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
- { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
- { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
- { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
- { text: '直方图', dataIndex: 'histogram', width: 180 },
- ],
- leadingBufferZone: 8,
- trailingBufferZone: 8,
- viewConfig: {
- listeners: {
- expandbody: 'scope.onChildExpand'
- }
- },
- listeners: {
- itemdblclick: 'scope.itemClick1'
- },
- plugins: {
- rowwidget: {
- widget: {
- xtype: 'yvgrid',
- hideFootbar: true,
- selModel: { type: 'rowmodel', mode: 'SINGLE', },
- listeners: {
- itemdblclick: 'scope.itemClick1'
- },
- columns: [
- { text: 'SQL', dataIndex: 'sql', flex: 1 },
- { text: '次数', dataIndex: 'count', dataType: 'number' },
- { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
- { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
- { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
- { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
- { text: '直方图', dataIndex: 'histogram', width: 180 },
- ]
- }
- }
- }
- },
- ]
- };
- var model$n = {
- data: {
- count: 0,
- dataSourceName: '',
- sql: "",
- histogram: '',
- maxCost: 0,
- minCost: 0,
- avgCost: '',
- sumCost: 0,
- histogramInfos: [
- // count: 1
- // gteCost: 20
- // ltCost: 50
- // 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"
- // topN: [
- // cost: 24
- // occurrenceTime: "1648004895171"
- // 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"
- // ]
- ]
- }
- };
- var vjson$n = {
- title: '性能统计详情',
- height: 400,
- width: 800,
- modal: true,
- layout: 'fit',
- items: [
- {
- xtype: 'tabpanel',
- items: [
- {
- title: '摘要',
- key: "1",
- layout: 'border',
- items: [
- {
- region: 'north',
- border: false,
- defaults: {
- margin: '8 0 0 0'
- },
- items: [
- {
- xtype: 'cols',
- defaultType: 'displayfield',
- defaults: {
- labelWidth: 70,
- },
- items: [
- {
- fieldLabel: 'count',
- bind: {
- value: '{count}'
- }
- },
- {
- fieldLabel: 'maxCost',
- bind: {
- value: '{maxCost}'
- }
- },
- {
- fieldLabel: 'minCost',
- bind: {
- value: '{minCost}'
- }
- },
- {
- fieldLabel: 'avgCost',
- bind: {
- value: '{avgCost}'
- }
- },
- {
- fieldLabel: 'sumCost',
- bind: {
- value: '{sumCost}'
- }
- },
- ]
- },
- {
- xtype: 'cols',
- items: [
- {
- flex: 5,
- border: false,
- items: [
- {
- xtype: 'segmentedbutton',
- reference: 'histogram',
- allowToggle: false,
- border: false,
- items: []
- }
- ]
- },
- ]
- },
- ],
- },
- {
- region: 'center',
- xtype: 'sqleditor',
- reference: 'sqlEditor',
- },
- ]
- },
- {
- title: '直方图',
- key: "2",
- }
- ]
- }
- ]
- };
- var PerformDialog = /** @class */ (function (_super) {
- __extends(PerformDialog, _super);
- function PerformDialog() {
- return _super.call(this, { model: model$n, vjson: vjson$n }) || this;
- }
- PerformDialog.prototype.onLoad = function () {
- var _this = this;
- var sql = this.viewModel.get('sql');
- var sql2 = sqlFormat.format(sql, {
- indent: ' ',
- uppercase: true,
- });
- var histogramInfos = this.viewModel.get('histogramInfos');
- var vs = _$2.map(histogramInfos, function (v) {
- if (v.ltCost > 2100000000) {
- return {
- text: "[" + v.gteCost + ", \u221E):" + v.count
- };
- }
- return {
- text: "[" + v.gteCost + ", " + v.ltCost + "):" + v.count
- };
- });
- this.refs.sqlEditor.setCode(sql2);
- _$2.forEach(vs, function (v) {
- _this.refs.histogram.add(v);
- });
- };
- return PerformDialog;
- }(Scope));
- var model$o = {
- data: {}
- };
- var PerformStats = /** @class */ (function (_super) {
- __extends(PerformStats, _super);
- function PerformStats() {
- var _this = _super.call(this, { model: model$o, vjson: vjson$m }) || this;
- _this.requestFilterChange = _.debounce(function (sender, value) {
- var store = _this.refs.grid1.store;
- store.clearFilter();
- if (value) {
- store.filterBy(function (record, id) {
- var text = toString(record.get('url'));
- // 用拼音筛选的方式
- return text.includes(value);
- });
- }
- }, 100);
- return _this;
- }
- PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
- widget.setData(record.data.children);
- };
- PerformStats.prototype.itemClick1 = function (sender, record) {
- console.log('itemClick1', record.data);
- new PerformDialog().showDialog(sender, {}, {
- data: record.data
- });
- };
- PerformStats.prototype.onLoad = function () {
- var _this = this;
- Promise.all([metricsRequestApi(), metricsJdbcApi()])
- .then(function (_a) {
- var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
- var resData = reqRes.data;
- var jdbcData = jdbcRes.data;
- _.forEach(jdbcData, function (item) {
- item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
- });
- _.forEach(resData, function (item) {
- item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
- if (_.isArray(item.sqls)) {
- item.children = _.map(item.sqls, function (sql) {
- return _.find(jdbcData, function (r) { return r.sql === sql; });
- }).filter(function (v) { return !!v; });
- }
- item.jdbcCount = _.size(item.children);
- });
- _this.refs.grid1.setData(resData);
- // this.refs.grid2.setData(jdbcData)
- });
- };
- return PerformStats;
- }(Scope));
- var vjson$o = {
- title: '性能统计',
- layout: 'fit',
- items: [
- {
- title: '数据库统计',
- xtype: 'yvgrid',
- enableLocking: false,
- reference: 'grid2',
- pagination: false,
- selModel: { type: 'rowmodel', mode: 'SINGLE', },
- tbar: {
- xtype: 'form',
- items: [
- {
- xtype: 'cols',
- items: [
- {
- fieldLabel: '搜索',
- listeners: {
- change: 'scope.jdbcFilterChange'
- }
- },
- ]
- },
- ]
- },
- listeners: {
- itemdblclick: 'scope.itemClick1'
- },
- columns: [
- { text: 'SQL', dataIndex: 'sql', flex: 1 },
- { text: '次数', dataIndex: 'count', dataType: 'number' },
- { text: '总耗时', dataIndex: 'sumCost', dataType: 'number' },
- { text: '平均耗时', dataIndex: 'avgCost', dataType: 'number' },
- { text: '最大耗时', dataIndex: 'maxCost', dataType: 'number' },
- { text: '最小耗时', dataIndex: 'minCost', dataType: 'number' },
- { text: '直方图', dataIndex: 'histogram', width: 180 },
- ]
- },
- ]
- };
- var model$p = {
- data: {}
- };
- var PerformStats$1 = /** @class */ (function (_super) {
- __extends(PerformStats, _super);
- function PerformStats() {
- var _this = _super.call(this, { model: model$p, vjson: vjson$o }) || this;
- _this.jdbcFilterChange = _.debounce(function (sender, value) {
- var store = _this.refs.grid2.store;
- store.clearFilter();
- if (value) {
- store.filterBy(function (record, id) {
- var text = toString(record.get('sql'));
- // 用拼音筛选的方式
- return text.includes(value);
- });
- }
- }, 100);
- return _this;
- }
- PerformStats.prototype.onChildExpand = function (rowNode, record, expandRow, widget) {
- widget.setData(record.data.children);
- };
- PerformStats.prototype.itemClick1 = function (sender, record) {
- console.log('itemClick1', record.data);
- new PerformDialog().showDialog(sender, {}, {
- data: record.data
- });
- };
- PerformStats.prototype.onLoad = function () {
- var _this = this;
- Promise.all([metricsRequestApi(), metricsJdbcApi()])
- .then(function (_a) {
- var _b = __read(_a, 2), reqRes = _b[0], jdbcRes = _b[1];
- var resData = reqRes.data;
- var jdbcData = jdbcRes.data;
- _.forEach(jdbcData, function (item) {
- item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
- });
- _.forEach(resData, function (item) {
- item.histogram = JSON.stringify(_.reverse(_.map(item === null || item === void 0 ? void 0 : item.histogramInfos, function (h) { return h.count; })));
- if (_.isArray(item.sqls)) {
- item.children = _.map(item.sqls, function (sql) {
- return _.find(jdbcData, function (r) { return r.sql === sql; });
- }).filter(function (v) { return !!v; });
- }
- item.jdbcCount = _.size(item.children);
- });
- _this.refs.grid2.setData(jdbcData);
- });
- };
- return PerformStats;
- }(Scope));
- var Controller$4 = /** @class */ (function () {
- function Controller() {
- }
- Controller.prototype.onDblClick = function (sender, record) {
- var data = record.raw;
- if (data.text === "接口统计") {
- var page = new PerformStats();
- page.showPage({
- title: "接口统计",
- id: '_InterfaceStatistics',
- path: '_InterfaceStatistics',
- }, {});
- }
- else if (data.text === "数据库统计") {
- var page = new PerformStats$1();
- page.showPage({
- title: "数据库统计",
- id: '_DatabaseStatistics',
- path: '_DatabaseStatistics',
- }, {});
- }
- };
- Controller.prototype.onLoad = function () {
- var me = this;
- //@ts-ignore
- var view = me.getView();
- view.setRootNode({
- expanded: true,
- leaf: false,
- children: [
- { leaf: true, text: '接口统计' },
- { leaf: true, text: '数据库统计' },
- ]
- });
- };
- return Controller;
- }());
- var controller$4 = new Controller$4();
- function initMonitorTree () {
- Ext.define('com.yvan.studio.MonitorTree', {
- extend: 'Ext.tree.Panel',
- xtype: 'monitortree',
- controller: controller$4,
- scope: controller$4,
- reference: 'roleGrid',
- tooltip: '表单定义',
- iconCls: 'x-fa fa-bar-chart',
- useArrows: true,
- rootVisible: false,
- colspan: 2,
- lines: true,
- multiSelect: false,
- referenceHolder: true,
- // openNode() {
- // const selection = this.getSelection()
- // const [record] = selection
- // if (!record) {
- // return
- // }
- //
- // const {raw} = record;
- // if (raw.type === 'Dir') {
- // return
- // }
- // if (raw.type === "Module" && raw.module) {
- // // eventBus.publish(EventType.ModuleOpen, raw)
- // }
- // },
- listeners: {
- itemdblclick: 'onDblClick',
- afterrender: "onLoad",
- },
- });
- }
- var Controller$5 = /** @class */ (function () {
- function Controller() {
- }
- return Controller;
- }());
- var controller$5 = new Controller$5();
- function initHomeTree () {
- Ext.define('com.yvan.studio.HomeTree', {
- extend: 'Ext.Panel',
- xtype: 'hometree',
- controller: controller$5,
- scope: controller$5,
- referenceHolder: true,
- bodyCls: 'home',
- // layout: 'fit',
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- iconCls: 'x-fa fa-exchange',
- text: '数据结构同步',
- handler: function (sender) {
- handles$1.mainWindow.showDataSync(sender);
- }
- },
- {
- xtype: 'button',
- iconCls: 'x-fa fa-cubes',
- text: '数据域管理',
- handler: function (sender) {
- handles$1.mainWindow.showColumnDomain();
- }
- },
- ],
- },
- // items: [
- //
- // ],
- layout: {
- type: 'vbox',
- pack: 'start',
- align: 'stretch',
- },
- items: [
- { html: '<div class="title">功能模块:</div><div class="subtitle">1134</div>' },
- { html: '<div class="title">查询模块:</div><div class="subtitle">4</div>' },
- { html: '<div class="title">数据表格:</div><div class="subtitle">265</div>' },
- { html: '<div class="title">字段域:</div><div class="subtitle">17</div>' },
- { html: '<div class="title">检索窗口:</div><div class="subtitle">38</div>' },
- { html: '<div class="title">接口平台:</div><div class="subtitle">16</div>' },
- { html: '<div class="title">计划任务:</div><div class="subtitle">0</div>' },
- { html: '<div class="title">工作流:</div><div class="subtitle">4</div>' },
- { html: '<div class="title">字典:</div><div class="subtitle">162</div>' },
- ],
- });
- }
- var WidgetStore = /** @class */ (function (_super) {
- __extends(WidgetStore, _super);
- function WidgetStore() {
- return _super !== null && _super.apply(this, arguments) || this;
- }
- WidgetStore.prototype.getCacheKey = function (param) {
- return "widget_data.json";
- };
- /*invokeApi(param: any): Promise<any> {
- return new Promise<any>(resolve => {
- //@ts-ignore
- require(["../../widget/all"], function (res) {
- const widgetList = res.default
- resolve(widgetList)
- })
- })
- }*/
- WidgetStore.prototype.invokeApi = function (param) {
- return widgetListApi(param);
- };
- return WidgetStore;
- }(CacheStore));
- var instance$3 = new WidgetStore();
- var WidgetGridController = /** @class */ (function () {
- function WidgetGridController() {
- }
- WidgetGridController.prototype.onLoad = function (sender) {
- var me = this;
- setWidget(me);
- instance$3.registe(me.reloadData.bind(this));
- instance$3.reloadIfNeed(undefined);
- };
- WidgetGridController.prototype.widgetAdd = function (sender) {
- var me = this;
- var win = new Ext.Window({
- autoDestroy: true,
- title: "新建弹框",
- width: 400,
- height: 220,
- resizable: true,
- closable: true,
- maximizable: true,
- minimizable: true,
- plain: true,
- // constrainHeader: true,
- constrain: true,
- layout: 'fit',
- animateTarget: sender,
- buttonAlign: 'center',
- items: [
- {
- xtype: "form",
- layout: "hbox",
- margin: '10px 20px',
- border: 0,
- items: [
- {
- flex: 1,
- layout: 'vbox',
- items: [
- {
- xtype: "textfield",
- name: "widgetcode",
- fieldLabel: "弹窗文件",
- flex: 1,
- allowBlank: false,
- regex: /^[a-zA-Z][a-zA-Z0-9]*$/,
- regexText: "编号名只能以英文字母开头,且只包含英文字母、数字",
- labelWidth: 80,
- width: "100%",
- },
- {
- xtype: "textfield",
- name: "widgetname",
- fieldLabel: "弹窗名称",
- flex: 1,
- allowBlank: false,
- labelWidth: 80,
- width: "100%",
- },
- ]
- },
- ]
- }
- ],
- //窗口按钮
- buttons: [
- {
- xtype: 'button', text: '保存', handler: function (btn) {
- //窗口获取表单
- var form = win.down('form');
- var vaildSuccess = form.isValid();
- if (!vaildSuccess) {
- return;
- }
- var title = form.down('textfield[name="widgetname"]').getValue();
- var widgetPath = form.down('textfield[name="widgetcode"]').getValue();
- saveWidget({ widgetPath: widgetPath, form: { title: title } }).then(function (res) {
- if (res.success) {
- msg$1('添加成功');
- // 添加
- handles$1.mainWindow.showWidget(widgetPath, title, function () {
- me.reload();
- });
- win.close();
- }
- });
- }
- },
- {
- xtype: 'button', text: '取消', handler: function (btn) {
- //窗口关闭
- win.close();
- }
- }
- ]
- });
- win.show();
- };
- WidgetGridController.prototype.widgetRemove = function (sender) {
- var _this = this;
- //@ts-ignore
- var record = this.getView().selection.data;
- if (!record) {
- msg$1('请选择一行');
- return;
- }
- var widgetPath = record.widget_path;
- Ext.Msg.confirm('提示', "是否删除弹框:" + widgetPath + "?", function (btn) {
- if (btn === 'yes') {
- deleteWidget({ widgetPath: widgetPath }).then(function (res) {
- if (res.success) {
- msg$1(res.msg);
- _this.reload();
- }
- });
- }
- });
- };
- WidgetGridController.prototype.widgetEdit = function (record) {
- var _this = this;
- if (record) {
- var widgetPath = record.widget_path;
- var widgetName = record.widget_name;
- handles$1.mainWindow.showWidget(widgetPath, widgetName, function () {
- _this.reload();
- });
- }
- };
- WidgetGridController.prototype.onDestory = function (sender) {
- var me = this;
- setWidget(undefined);
- instance$3.unregiste(me.reloadData.bind(this));
- };
- WidgetGridController.prototype.reloadData = function (res) {
- var me = this;
- //@ts-ignore
- var view = me.getView();
- if (typeof res === 'object') {
- // const data = []
- // _.forOwn(res, (v, k) => {
- // data.push({
- // widget_path: k,
- // widget_name: v.title,
- // vjson : v
- // })
- // })
- view.setStore(new Ext.data.Store({
- fields: ['widget_path', 'widget_name'],
- data: res.data,
- }));
- }
- else if (typeof res === 'boolean') {
- view.setLoading(res);
- }
- };
- WidgetGridController.prototype.reload = function () {
- instance$3.reloadForce(undefined);
- };
- WidgetGridController.prototype.filterChanged = function (sender, value) {
- //@ts-ignore
- this.view.store.clearFilter();
- if (value) {
- //@ts-ignore
- this.view.store.filterBy(function (record) {
- var widget_path = record.get('widget_path');
- var widget_name = record.get('widget_name');
- return (window['system'].pinyinMatch(widget_name, value) ||
- _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
- });
- }
- };
- WidgetGridController.prototype.onClearClick = function () {
- var _a, _b;
- //@ts-ignore
- (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
- };
- WidgetGridController.prototype.onDblClick = function (sender, record) {
- this.widgetEdit(record.data);
- };
- return WidgetGridController;
- }());
- function initWidget () {
- var controller = new WidgetGridController();
- Ext.define('com.yvan.studio.WidgetGrid', {
- extend: 'Ext.grid.Panel',
- xtype: 'widgetgrid',
- controller: controller,
- scope: controller,
- referenceHolder: true,
- tooltip: '检索窗口',
- iconCls: 'x-fa fa-search',
- useArrows: true,
- reference: 'widgetgrid',
- selModel: { type: 'rowmodel', mode: 'SINGLE', },
- listeners: {
- itemdblclick: 'onDblClick',
- afterrender: 'onLoad',
- destory: 'onDestory',
- },
- viewConfig: {
- listeners: {
- itemcontextmenu: 'onGridContextMenu',
- },
- },
- tbar: [
- {
- xtype: 'button',
- tooltip: '刷新',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'reload'
- }
- },
- {
- xtype: 'button',
- tooltip: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'widgetAdd'
- }
- },
- {
- xtype: 'button',
- tooltip: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'widgetRemove'
- }
- },
- ],
- fbar: [
- {
- xtype: 'textfield',
- flex: 1,
- reference: "txtFilter",
- emptyText: '搜索过滤',
- enableKeyEvents: true,
- listeners: {
- change: {
- fn: 'filterChanged',
- buffer: 50
- }
- }
- },
- ],
- columns: [
- {
- text: '弹窗文件', dataIndex: 'widget_path',
- menuDisabled: true, flex: 1,
- },
- {
- text: '弹窗名称', dataIndex: 'widget_name',
- menuDisabled: true, flex: 1,
- },
- ]
- });
- }
- var WhLayoutController = /** @class */ (function () {
- function WhLayoutController() {
- }
- WhLayoutController.prototype.onLoad = function (sender) {
- var _this = this;
- var me = this;
- setWhLayout(me);
- _$2.defer(function () {
- _this.reload();
- });
- };
- WhLayoutController.prototype.reload = function () {
- //@ts-ignore
- var view = this.getView();
- view.setLoading(true);
- loadWhLayoutAll().then(function (res) {
- view.setStore(new Ext.data.Store({
- fields: ['layout_code', 'layout_name'],
- data: res.data,
- }));
- }).finally(function () {
- view.setLoading(false);
- });
- };
- WhLayoutController.prototype.add = function () {
- handles$1.mainWindow.showLayoutDesign(undefined, undefined);
- };
- WhLayoutController.prototype.edit = function (data) {
- handles$1.mainWindow.showLayoutDesign(data.layout_code, data.layout_name);
- };
- WhLayoutController.prototype.remove = function () {
- var _this = this;
- var _a;
- //@ts-ignore
- var view = this.getView();
- var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
- if (!record) {
- msg$1('请选择一行数据');
- return;
- }
- var layoutCode = record.layout_code;
- Ext.Msg.confirm('提示', "是否删除图形:" + layoutCode + "?", function (btn) {
- if (btn === 'yes') {
- deleteWhLayout({ layoutCode: layoutCode }).then(function (res) {
- if (res.success) {
- msg$1(res.msg);
- _this.reload();
- }
- });
- }
- });
- };
- WhLayoutController.prototype.onDblClick = function () {
- var _a;
- //@ts-ignore
- var view = this.getView();
- var record = (_a = view.selection) === null || _a === void 0 ? void 0 : _a.data;
- if (!record) {
- msg$1('请选择一行数据');
- return;
- }
- this.edit(record);
- };
- WhLayoutController.prototype.filterChanged = function (sender, value) {
- //@ts-ignore
- this.view.store.clearFilter();
- if (value) {
- //@ts-ignore
- this.view.store.filterBy(function (record) {
- var widget_path = record.get('widget_path');
- var widget_name = record.get('widget_name');
- return (window['system'].pinyinMatch(widget_name, value) ||
- _$2.includes(_$2.toLower(widget_path), _$2.toLower(value)));
- });
- }
- };
- WhLayoutController.prototype.onClearClick = function () {
- var _a, _b;
- //@ts-ignore
- (_b = (_a = this.getReferences()) === null || _a === void 0 ? void 0 : _a.txtFilter) === null || _b === void 0 ? void 0 : _b.setValue('');
- };
- return WhLayoutController;
- }());
- function initWhLayout () {
- var controller = new WhLayoutController();
- Ext.define('com.yvan.studio.WhLayout', {
- extend: 'Ext.grid.Panel',
- xtype: 'whlayout',
- alias: 'widget.whlayout',
- controller: controller,
- scope: controller,
- referenceHolder: true,
- tooltip: '检索窗口',
- iconCls: 'x-fa fa-search',
- useArrows: true,
- reference: 'whlayout',
- selModel: { type: 'rowmodel', mode: 'SINGLE', },
- listeners: {
- itemdblclick: 'onDblClick',
- afterrender: 'onLoad',
- destory: 'onDestory',
- },
- viewConfig: {
- listeners: {
- itemcontextmenu: 'onGridContextMenu',
- },
- },
- tbar: [
- {
- xtype: 'button',
- tooltip: '刷新',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'reload'
- }
- },
- {
- xtype: 'button',
- tooltip: '添加',
- iconCls: 'x-fa fa-plus-circle',
- listeners: {
- click: 'add'
- }
- },
- {
- xtype: 'button',
- tooltip: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'remove'
- }
- },
- ],
- fbar: [
- {
- xtype: 'textfield',
- flex: 1,
- reference: "txtFilter",
- emptyText: '搜索过滤',
- enableKeyEvents: true,
- listeners: {
- change: {
- fn: 'filterChanged',
- buffer: 50
- }
- }
- },
- ],
- columns: [
- {
- text: '图编号', dataIndex: 'layout_code',
- menuDisabled: true, flex: 1,
- },
- {
- text: '图名称', dataIndex: 'layout_name',
- menuDisabled: true, flex: 1,
- },
- ]
- });
- }
- var BpmnTreeController = /** @class */ (function () {
- function BpmnTreeController() {
- }
- BpmnTreeController.prototype.onLoad = function (sender) {
- this.reload();
- };
- BpmnTreeController.prototype.reload = function () {
- var me = this;
- me.getView().setLoading(true);
- exporerList().then(function (res) {
- // handles.mainWindow.modules = res.data
- // const rootNode = modulesToTreeData(res.data)
- var rootNode = res.data.tree;
- me.getView().setRootNode({
- expanded: true,
- leaf: false,
- children: rootNode
- });
- // const lastId = window.location.hash.substring(1);
- // file.selectPath(lastId)
- // if (lastId) {
- // const node = getModuleById(rootNode, lastId)
- // if (node) {
- // showDesign(node.id, node.path, node.text, node.module)
- // }
- // }
- // this.restoreState()
- }).finally(function () {
- me.getView().setLoading(false);
- });
- };
- BpmnTreeController.prototype.onLisenContextMenu = function (sender, node, element, idx, e) {
- var _this = this;
- e.preventDefault();
- var raw = node.raw;
- //const me = sender.up("treepanel").scope
- var option;
- if (raw.exporerType === 1) ;
- else if (raw.exporerType === 21) {
- if (raw.type === 'Dir') {
- option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- {
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- handler: function (sender) {
- var dirPath = raw.dirPath;
- handles$1.mainWindow.showFormSingle(dirPath, "", "", "");
- }
- },
- '-',
- {
- text: '新建文件夹',
- iconCls: 'x-fa fa-folder-o',
- handler: function (sender) {
- }
- }
- ]
- };
- }
- else if (raw.type === 'Model') {
- option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- {
- text: '编辑',
- iconCls: 'x-fa fa-edit',
- handler: function (sender) {
- }
- },
- {
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- handler: function (sender) {
- }
- },
- '-',
- {
- text: '注册(至菜单)',
- iconCls: 'x-fa fa-sign-in',
- handler: function (sender) {
- }
- },
- {
- text: '新建文件夹',
- iconCls: 'x-fa fa-folder-o',
- handler: function (sender) {
- }
- }
- ]
- };
- }
- }
- else if (raw.exporerType === 22) {
- if (raw.type === 'Dir') {
- option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- {
- text: '添加',
- iconCls: 'x-fa fa-plus-circle',
- handler: function (sender) {
- var dirPath = raw.dirPath;
- handles$1.mainWindow.showFormBill();
- }
- },
- '-',
- {
- text: '新建文件夹',
- iconCls: 'x-fa fa-folder-o',
- handler: function (sender) {
- }
- }
- ]
- };
- }
- else if (raw.type === 'Model') {
- option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- {
- text: '编辑',
- iconCls: 'x-fa fa-edit',
- handler: function (sender) {
- }
- },
- {
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- handler: function (sender) {
- }
- },
- '-',
- {
- text: '注册(至菜单)',
- iconCls: 'x-fa fa-sign-in',
- handler: function (sender) {
- }
- },
- {
- text: '新建文件夹',
- iconCls: 'x-fa fa-folder-o',
- handler: function (sender) {
- }
- }
- ]
- };
- }
- }
- else if (raw.exporerType === 3) ;
- else if (raw.exporerType === 50) {
- option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- {
- text: '新建流程',
- iconCls: 'x-fa fa-new',
- handler: function (sender) {
- _this.bpmnAdd(sender);
- }
- },
- ]
- };
- }
- else if (raw.exporerType === 51) {
- option = {
- shadow: 'frame', allowOtherMenus: true,
- items: [
- {
- text: '新建流程',
- iconCls: 'x-fa fa-new',
- handler: function (sender) {
- _this.bpmnAdd(sender);
- }
- },
- {
- text: '删除',
- iconCls: 'x-fa fa-minus-circle',
- handler: function (sender) {
- _this.bpmnDelete(sender, raw);
- }
- },
- ]
- };
- }
- else {
- throw Error('暂时不支持!');
- }
- if (option) {
- var treeMenu = new Ext.menu.Menu(option);
- treeMenu.showAt(e.getXY());
- }
- };
- BpmnTreeController.prototype.bpmnAdd = function (sender) {
- var _this = this;
- prompt$2('输入工作流名称').then(function (name) {
- createBpmn("", name).then(function (res) {
- if (res.success) {
- msg$1('添加成功');
- }
- _this.reload();
- });
- });
- };
- BpmnTreeController.prototype.bpmnDelete = function (sender, raw) {
- var _this = this;
- YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + raw.text + "\" ?").then(function () {
- deleteBpmn(raw.absolutePath, raw.text).then(function (res) {
- if (res.success) {
- msg$1('添加成功');
- }
- _this.reload();
- });
- });
- };
- BpmnTreeController.prototype.reportAdd = function (sender) {
- var _this = this;
- prompt$2('请输入报表名称').then(function (name) {
- createReportApi(name).then(function (res) {
- if (res.success) {
- msg$1('添加成功');
- handles$1.mainWindow.showReport(res.data, name, function () {
- _this.reload();
- });
- }
- _this.reload();
- });
- });
- };
- BpmnTreeController.prototype.reportRegiste = function (sender, record) {
- if (record) {
- var reportName = record.get('report_name');
- var reportId = record.get('report_id');
- registerModule(sender, 'REPORT__' + reportId, reportName, 'x-fa fa-search');
- }
- };
- BpmnTreeController.prototype.reportRemove = function (sender, record) {
- var _this = this;
- if (record) {
- var reportName = record.get('report_name');
- var reportId_1 = record.get('report_id');
- YvanUI.confirm("\u771F\u7684\u8981\u5220\u9664 \"" + reportName + "\" ?").then(function () {
- delReportApi(reportId_1).then(function (res) {
- if (res.success) {
- msg$1('删除成功');
- _this.reload();
- }
- });
- });
- }
- };
- BpmnTreeController.prototype.reportEdit = function (sender, record) {
- var _this = this;
- if (!record || record.type !== 'Module') {
- return;
- }
- var reportName = record.text;
- var reportId = record.target;
- handles$1.mainWindow.showReport(reportId, reportName, function () {
- _this.reload();
- });
- };
- BpmnTreeController.prototype.onDblClick = function (sender, record, eOpts) {
- var data = record.raw;
- if (data.type !== 'Module' && data.type !== 'Dir') {
- return;
- }
- // TODO 10:查询报表, 20:表单,30:弹出框,40:字典,50:工作流,60:定时任务,70:系统参数
- if (data.exporerType === 10) { // 表单
- // this.reportEdit(sender, data)
- handles$1.mainWindow.showReport();
- }
- else if (data.exporerType === 21) {
- handles$1.mainWindow.showFormSingle(data.dirPath, data.absolutePath, data.id, data.id);
- }
- else if (data.exporerType === 22) {
- handles$1.mainWindow.showFormBill();
- }
- else if (data.exporerType === 30) {
- handles$1.mainWindow.showWidgetDesign();
- }
- else if (data.exporerType === 51) {
- handles$1.mainWindow.showBmpnDesign(data.absolutePath, data.id, data.text);
- }
- else {
- throw Error('暂时不支持!');
- }
- };
- return BpmnTreeController;
- }());
- var controller$6 = new BpmnTreeController();
- function initBpmnTree () {
- Ext.define('com.yvan.studio.BpmnTree', {
- extend: 'Ext.tree.Panel',
- //extend: 'com.yvan.studio.StateTree',
- xtype: 'bpmntree',
- controller: controller$6,
- scope: controller$6,
- tooltip: '表单定义',
- iconCls: 'x-fa fa-random',
- useArrows: true,
- rootVisible: false,
- colspan: 2,
- lines: true,
- multiSelect: true,
- reload: function () {
- this.controller.reload.call(this, arguments);
- },
- openNode: function () {
- var selection = this.getSelection();
- var _a = __read(selection, 1), record = _a[0];
- if (!record) {
- return;
- }
- var raw = record.raw;
- if (raw.type === 'Dir') {
- return;
- }
- if (raw.type === "Module" && raw.module) ;
- },
- listeners: {
- itemdblclick: 'onDblClick',
- afterrender: 'onLoad',
- // itemverify() {
- // this.openNode()
- // },
- itemcontextmenu: 'onLisenContextMenu'
- },
- tbar: {
- xtype: 'toolbar',
- items: [
- {
- xtype: 'button',
- tooltip: '刷新',
- iconCls: 'x-fa fa-refresh',
- listeners: {
- click: 'reload'
- }
- },
- /*{
- xtype: 'button',
- tooltip: '添加',
- iconCls: 'x-fa fa-plus-circle',
- menu: [
- {
- text: '类别',
- listeners: {
- click: 'classAdd'
- }
- },
- {
- text: '查询',
- listeners: {
- click: 'reportAdd'
- }
- },
- '-',
- {
- text: '单表定义',
- listeners: {
- click: 'singleTableAdd'
- }
- },
- {
- text: '多表定义',
- listeners: {
- click: 'complexTableAdd'
- }
- },
- {
- text: '查询窗口定义',
- listeners: {
- click: 'widgetAdd'
- }
- },
- ],
- },
- {
- xtype: 'button',
- tooltip: '删除',
- iconCls: 'x-fa fa-minus-circle',
- listeners: {
- click: 'reportRemove'
- }
- },*/
- {
- xtype: 'textfield',
- flex: 1,
- reference: "txtFilter",
- emptyText: '搜索过滤',
- enableKeyEvents: true,
- listeners: {
- change: {
- fn: 'filterChanged',
- buffer: 50
- }
- }
- },
- ]
- },
- });
- }
- function initToolBox () {
- Ext.define('com.yvan.studio.ToolBox', {
- extend: 'Ext.panel.Panel',
- xtype: 'toolbox',
- tooltip: '工具箱',
- layout: 'fit',
- html: '<div role="component" style="height: 100%; width: 100%; display: flex; flex-direction: column"/>',
- border: false,
- beforeRender: function () {
- console.log('beforeRender', this);
- },
- afterRender: function () {
- var $dom = $(this.body.dom).children('div');
- $dom.append(createComponent());
- $dom.css("height", '100%');
- // @ts-ignore
- $('#_toolbox_list').find('li').each(function () {
- var id = $(this).children(':first').attr('drag_id');
- var node = _$2.find(codeLines, function (node) { return node.id === id; });
- setDrag(this, node);
- });
- }
- });
- }
- function setDrag(el, node) {
- new Ext.drag.Source({
- element: el,
- proxy: {
- type: 'placeholder',
- getElement: function (info) {
- var html = "<div style=\"border: 1px dashed #1890ff;width: 100px; height: 20px\">" + info.eventTarget.innerText + "</div>";
- return Ext.getBody().createChild({
- html: html
- });
- }
- },
- listeners: {
- dragmove: delegateDragmove.bind(getDesignInstance(), node),
- dragend: delegateDragend.bind(getDesignInstance(), node),
- },
- sourceVjson: node.code,
- dragType: node.dragType
- });
- }
- function createComponent() {
- var template = [];
- for (var i = 0; i < codeLines.length; i++) {
- var item = codeLines[i];
- if (!item.dragHtml) {
- continue;
- }
- var $ele = $("<li>" + item.dragHtml + "</li>");
- $ele.children(':first').attr('drag_id', item.id);
- $ele.children(':first').append("<div class=\"at_toolbox\"><i class=\"" + item.icon + "\"></i><span>" + item.value + "</span></div>");
- template.push("<li style=\"height: 30px; margin-bottom: 5px; border: blue; border-width: 1px\">" + $ele.html() + "</li>");
- }
- var html = "<div class=\"design_toolbox_list\"><ul id=\"_toolbox_list\" class=\"toolbox-list\">" + template.join('\n') + "</ul></div>";
- return html;
- }
- var codeLines = [
- {
- id: '$label',
- value: layoutOrXtypeNameMap.label + ' - label',
- icon: "fa fa-font",
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'label',
- text: '文本' + _$2.uniqueId('_l')
- }
- },
- {
- id: '$text',
- value: layoutOrXtypeNameMap.textfield + ' - textfield',
- icon: "fa fa-edit",
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'textfield',
- fieldLabel: '输入框' + _$2.uniqueId('_e')
- }
- },
- {
- id: '$textarea',
- value: layoutOrXtypeNameMap.textareafield + ' - textareafield',
- icon: "fa fa-edit",
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'textareafield',
- fieldLabel: '输入框' + _$2.uniqueId('_e')
- }
- },
- {
- id: '$number',
- value: layoutOrXtypeNameMap.numberfield + ' - numberfield',
- icon: "fa fa-edit",
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'numberfield',
- fieldLabel: '数字框' + _$2.uniqueId('_n')
- }
- },
- {
- id: '$combo',
- value: layoutOrXtypeNameMap.combo + ' - combo',
- icon: "fa fa-angle-double-down",
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'combo',
- fieldLabel: '请选择',
- data: [
- { id: 'id1', text: '选项1' },
- { id: 'id2', text: '选项2' },
- { id: 'id3', text: '选项3' },
- ],
- }
- },
- {
- id: '$datebox',
- value: layoutOrXtypeNameMap.datefield + ' - datefield',
- icon: "fa fa-calendar",
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: "datefield",
- fieldLabel: '日期',
- }
- },
- {
- id: '$searchbox',
- value: layoutOrXtypeNameMap.searchfield + ' - searchfield',
- icon: "fa fa-search",
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'searchfield',
- fieldLabel: '搜索框',
- }
- },
- {
- id: '$combogrid',
- value: layoutOrXtypeNameMap.combogrid + ' - combogrid',
- icon: "fa fa-table",
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'combogrid',
- fieldLabel: '下拉表'
- }
- },
- {
- id: '$combotree',
- value: layoutOrXtypeNameMap.combotree + ' - combotree',
- icon: "fa fa-tree",
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'combotree',
- fieldLabel: '下拉树',
- displayField: 'text',
- rootVisible: false
- }
- },
- {
- id: '$button',
- value: layoutOrXtypeNameMap.button + ' - button',
- icon: 'fa fa-sign-in',
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- text: '按钮',
- iconCls: 'x-fa fa-bars',
- xtype: 'button'
- }
- },
- {
- id: '$checkbox',
- value: layoutOrXtypeNameMap.checkbox + ' - checkbox',
- icon: 'fa fa-check-square',
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'checkbox',
- boxLabel: '勾选框',
- hideLabel: true,
- margin: '0 0 0 15',
- flex: 0,
- }
- },
- {
- id: '$checkboxgroup',
- value: layoutOrXtypeNameMap.checkboxgroup + ' - checkboxgroup',
- icon: 'fa fa-check-square',
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'checkboxgroup',
- fieldLabel: '勾选组',
- items: [
- { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
- { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
- { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
- { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
- { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
- { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
- ]
- }
- },
- {
- id: '$radio',
- value: layoutOrXtypeNameMap.radio + ' - radio',
- icon: 'fa fa-dot-circle-o',
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: "radio",
- fieldLabel: "请选择",
- }
- },
- {
- id: '$radiogroup',
- value: layoutOrXtypeNameMap.radiogroup + ' - radiogroup',
- icon: 'fa fa-dot-circle-o',
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: "radiogroup",
- fieldLabel: "请选择",
- items: [
- { boxLabel: 'Item 1', name: 'rb', inputValue: '1' },
- { boxLabel: 'Item 2', name: 'rb', inputValue: '2', checked: true },
- { boxLabel: 'Item 3', name: 'rb', inputValue: '3' },
- { boxLabel: 'Item 4', name: 'rb', inputValue: '4' },
- { boxLabel: 'Item 5', name: 'rb', inputValue: '5' },
- { boxLabel: 'Item 6', name: 'rb', inputValue: '6' }
- ]
- }
- },
- {
- id: '$cols',
- value: layoutOrXtypeNameMap.cols + ' - cols',
- icon: 'fa fa-list-alt',
- dragType: "cols-container",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '输入框',
- },
- ],
- }
- },
- {
- id: '$container',
- value: layoutOrXtypeNameMap.container + ' - container',
- icon: 'fa fa-flag',
- dragType: "col-item",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- xtype: 'container',
- border: false,
- layout: 'hbox',
- }
- },
- {
- id: '$fit',
- value: layoutOrXtypeNameMap.fit + ' - fit',
- icon: 'fa fa-flag',
- dragType: "rows-container",
- dragHtml: "<div class=\"design_view \"><div class=\"design_control\"></div></div>",
- code: {
- border: false,
- layout: 'fit',
- items: [
- {
- xtype: 'container',
- border: false,
- layout: 'hbox',
- }
- ]
- }
- },
- ];
- // @ts-ignore
- // export default ToolBoxCmp
- var that = undefined;
- function initPropertyDesign () {
- Ext.define('com.yvan.studio.PropertyDesign', {
- extend: 'Ext.panel.Panel',
- xtype: 'propertydesign',
- name: "PropertyDesign",
- tooltip: '属性',
- iconCls: 'x-fa fa-newspaper-o',
- reference: 'propertygrid',
- layout: 'border',
- border: false,
- moduleId: null,
- currentComponentVJson: null,
- currentComponentPropertyEditSource: null,
- vjson: null,
- propertyHandle: null,
- moduleSubscribe: null,
- items: [
- new Ext.grid.property.Grid({
- sortableColumns: false,
- region: 'center',
- listeners: {
- propertychange: function (source, propName, value, oldValue, eOpts) {
- value = _.trim(value);
- var a = _.find(that.currentComponentPropertyEditSource, function (item) {
- return item.label === propName;
- });
- if (a.type === 'listeners') {
- if (value) {
- if (that.currentComponentVJson.listeners) {
- that.currentComponentVJson.listeners[propName] = value;
- }
- else {
- var t = {};
- t[propName] = value;
- that.currentComponentVJson.listeners = t;
- }
- }
- else {
- _.forOwn(that.currentComponentVJson.listeners, function (value1, key) {
- if (!value1) {
- delete that.currentComponentVJson.listeners[key];
- }
- else if (key === propName) {
- delete that.currentComponentVJson.listeners[key];
- }
- });
- if (that.currentComponentVJson.listeners && Object.keys(that.currentComponentVJson.listeners).length <= 0) {
- delete that.currentComponentVJson.listeners;
- }
- }
- moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
- vjson: that.vjson,
- from: that.name,
- ignoreRenderUI: true
- });
- }
- else if (a.type === 'fix') {
- if (!value) {
- delete that.currentComponentVJson[propName];
- }
- else {
- that.currentComponentVJson[propName] = value.split("\r\n");
- }
- moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
- vjson: that.vjson,
- from: that.name,
- ignoreRenderUI: true
- });
- }
- else if (a.type === 'bind') {
- var bind_1 = that.currentComponentVJson.bind;
- if (typeof bind_1 === 'string' && a.id === "value") {
- if (value) {
- that.currentComponentVJson.bind = value;
- }
- else {
- delete that.currentComponentVJson.bind;
- }
- }
- else {
- // 转成bind对象
- if (typeof bind_1 === 'string') {
- bind_1 = that.currentComponentVJson.bind = { value: bind_1 };
- }
- if (value) {
- if (bind_1) {
- bind_1[a.id] = value;
- }
- else {
- var t = {};
- t[a.id] = value;
- that.currentComponentVJson.bind = t;
- }
- }
- else {
- _.forOwn(bind_1, function (value1, key) {
- if (!value1) {
- delete bind_1[key];
- }
- else if (key === a.id) {
- delete bind_1[key];
- }
- });
- if (Object.keys(bind_1).length <= 0) {
- delete that.currentComponentVJson.bind;
- }
- }
- }
- moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
- vjson: that.vjson,
- from: that.name,
- ignoreRenderUI: true
- });
- }
- else if (a.type === 'boolean') {
- if (!value) {
- delete that.currentComponentVJson[propName];
- }
- else if (value === 'false') {
- that.currentComponentVJson[propName] = false;
- }
- else if (value === 'true') {
- that.currentComponentVJson[propName] = true;
- }
- else {
- that.currentComponentVJson[propName] = value;
- }
- moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
- vjson: that.vjson,
- from: that.name
- });
- }
- else {
- that.currentComponentVJson[propName] = value;
- moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, {
- vjson: that.vjson,
- from: that.name
- });
- }
- console.log('修改属性 [' + propName + ']=' + value, that.currentComponentVJson);
- },
- }
- })
- ],
- listeners: {
- // afterrender() {
- // this.propertyHandle.setSource({
- // "(name)": "My Object",
- // "Created": Ext.Date.parse('10/15/2006', 'm/d/Y'), // date type
- // "Available": false, // boolean type
- // "Version": .01, // decimal type
- // "Description": "A test object"
- // });
- // }
- },
- initComponent: function () {
- var _this = this;
- this.propertyHandle = this.items[0];
- setPropertyPanel(this);
- that = this;
- eventBus.subscribe(EventType.SetVjson, function (_a) {
- var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
- _this.setVjson(moduleId, from, ignoreRenderUI);
- });
- return this.superclass.initComponent.apply(this, arguments);
- },
- setVjson: function (moduleId, from, ignoreRenderUI) {
- var _this = this;
- // if (this.moduleId === null && moduleId) {
- // this.moduleId = moduleId
- // }
- if (moduleId !== this.moduleId || from === this.name) {
- return;
- }
- var moduleObj = moduleStore.getModuleObject(this.moduleId);
- if (!moduleObj) {
- return;
- }
- this.vjson = moduleObj.moduleObj.vjson;
- this.setPropertyAndEventSource();
- if (this.componentSelectionChangeSubscribe) {
- this.componentSelectionChangeSubscribe.cancel();
- this.componentSelectionChangeSubscribe = null;
- }
- if (this.updateVjsonChangeSubscribe) {
- this.updateVjsonChangeSubscribe.cancel();
- this.updateVjsonChangeSubscribe = null;
- }
- this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
- var id = _a.id, from = _a.from;
- _this.onComponentSelectionChange(id, from);
- });
- this.updateVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.UpdateVjson, function (_a) {
- var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
- _this.updateVjson(vjson, from, ignoreRenderUI);
- });
- var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
- this.onComponentSelectionChange(id, from);
- },
- updateVjson: function (vjson, from, ignoreRenderUI) {
- if (!vjson || from === this.name) {
- return;
- }
- this.vjson = vjson;
- this.setPropertyAndEventSource();
- var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
- this.onComponentSelectionChange(id, from);
- },
- onComponentSelectionChange: function (id, from) {
- if (from !== this.name) {
- this.currentComponentVJson = findInCode(this.vjson, id);
- this.setPropertyAndEventSource();
- }
- },
- setPropertyAndEventSource: function () {
- var _this = this;
- this.propertyHandle.setSource({});
- if (!this.currentComponentVJson) {
- return;
- }
- var _a = this.currentComponentVJson, id = _a.id, xtype = _a.xtype;
- var v = xtype;
- // 选中的对象可能是组
- if (!v) {
- if (_.has(this.currentComponentVJson, "cols")) {
- v = "cols";
- }
- else if (_.has(this.currentComponentVJson, "rows")) {
- v = "rows";
- }
- }
- var pd = YvanUI.PropertyDescriptionTable.get(v);
- if (!pd) {
- // 这个组件没有属性
- this.propertyHandle.setSource({});
- return;
- }
- var funcArr = this.getAllfuncs();
- var createFuncEditor = function () { return new Ext.form.field.ComboBox({
- // disabled: true,
- displayField: 'name',
- valueField: 'name',
- store: funcArr,
- }); };
- // ====================== 属性
- var elements = [];
- var caption = ['通用', '样式', '绑定', '特性', '事件'];
- _.each(['common', 'css', 'common', 'fix', 'listeners'], function (group, i) {
- var props = pd.getPropsByGroup(group);
- if (props.length <= 0)
- return; //没有这一组属性
- // 显示 group 的中文名
- elements.push({ label: caption[i], editor: new Ext.form.field.Text({ disabled: true }) });
- if (caption[i] === '绑定') {
- _.each(props, function (prop) {
- elements.push({
- label: "_" + prop.name,
- type: "bind",
- id: prop.name,
- desc: prop.desc,
- editor: new Ext.form.field.Text()
- });
- });
- }
- else {
- _.each(props, function (prop) {
- if (_.isArray(prop.type)) {
- elements.push({
- label: prop.name,
- type: "combo",
- options: prop.type,
- id: prop.name,
- desc: prop.desc
- });
- return;
- }
- switch (prop.type) {
- case 'boolean': {
- elements.push({
- label: prop.name,
- id: prop.name,
- desc: prop.desc,
- type: 'boolean',
- editor: new Ext.form.field.ComboBox({
- displayField: 'text',
- valueField: 'id',
- store: new Ext.data.Store({
- field: ['id', 'text'],
- data: [
- { id: 'true', text: 'True' },
- { id: 'false', text: 'False' },
- ]
- })
- }),
- });
- break;
- }
- case 'number': {
- elements.push({
- label: prop.name,
- type: "number",
- id: prop.name,
- isNum: true,
- desc: prop.desc,
- editor: new Ext.form.field.Number()
- });
- break;
- }
- case 'string': {
- elements.push({
- label: prop.name,
- type: "string",
- id: prop.name,
- desc: prop.desc,
- editor: new Ext.form.field.Text()
- });
- break;
- }
- case 'listeners': {
- elements.push({
- label: prop.name,
- type: "listeners",
- id: prop.name,
- desc: prop.desc,
- editor: createFuncEditor()
- });
- break;
- }
- case 'fix': {
- elements.push({
- label: prop.name,
- type: "fix",
- id: prop.name,
- desc: prop.desc,
- editor: new Ext.form.field.Text()
- });
- break;
- }
- case 'object': {
- break;
- }
- // case 'dataSource' : {
- // break;
- // }
- case 'valid': {
- break;
- }
- default:
- elements.push({
- label: prop.name,
- type: prop.type,
- id: prop.name,
- desc: prop.desc,
- editor: new Ext.form.field.Text({ disabled: true })
- });
- console.error('不支持的编辑类型', prop);
- }
- });
- }
- });
- this.currentComponentPropertyEditSource = elements;
- var panel1Source = {};
- var panel1SourceConfig = {};
- _.each(elements, function (item) {
- var _a;
- if (item.type === "listeners") {
- var listeners = _this.currentComponentVJson.listeners;
- panel1Source[item.label] = listeners ? listeners[item.label] : '';
- }
- else if (item.type === "fix") {
- panel1Source[item.label] = (_a = _this.currentComponentVJson[item.label]) === null || _a === void 0 ? void 0 : _a.join("\r\n");
- }
- else if (item.type === "bind") {
- var bind = _this.currentComponentVJson.bind;
- if (typeof bind === 'string' && item.id === 'value') {
- panel1Source[item.label] = bind;
- }
- else {
- panel1Source[item.label] = bind ? bind[item.id] : '';
- }
- }
- else {
- panel1Source[item.label] = _this.currentComponentVJson[item.label];
- }
- panel1Source[item.label] = panel1Source[item.label] || '';
- panel1SourceConfig[item.label] = { editor: item.editor };
- });
- this.propertyHandle.setSource(panel1Source, panel1SourceConfig);
- },
- getAllfuncs: function () {
- var _a, _b;
- 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;
- var scopeFuncs = [];
- _.forEach(arr, function (item) {
- scopeFuncs.push({ name: "scope." + item.name });
- });
- return scopeFuncs;
- }
- });
- }
- function initViewOutlineTree () {
- Ext.define('com.yvan.studio.ViewOutlineTree', {
- extend: 'Ext.tree.Panel',
- xtype: 'viewoutlinetree',
- name: "ViewOutlineTree",
- tooltip: '设计大纲',
- iconCls: 'x-fa fa-list',
- rootVisible: false,
- useArrows: true,
- allowDeselect: true,
- colspan: 2,
- lines: false,
- reference: 'viewoutlinetree',
- multiSelect: true,
- _saveStateFlag: true,
- keyMapEnabled: true,
- moduleId: null,
- vjson: null,
- columns: [
- {
- xtype: 'treecolumn',
- text: '布局',
- dataIndex: 'layoutNameDesc',
- flex: 2,
- sortable: true
- }, {
- text: '组件',
- dataIndex: 'xtype',
- flex: 1,
- sortable: true,
- align: 'center',
- }
- ],
- listeners: {
- itemcontextmenu: function (sender, node, element, idx, e) {
- e.preventDefault();
- this.rightClickTreeNode(sender, node, element, idx, e);
- },
- select: function (sender, node, index, e) {
- moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentSelectionChange, { id: node.data.id, from: this.name });
- },
- rowkeydown: function (sender, node, element, rowIndex, e, eOpts) {
- if (e.keyCodes[e.keyCode] === 'DELETE' || e.keyCodes[e.keyCode] === 'BACKSPACE') {
- moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.ComponentDelete, { id: node.data.id, from: this.name });
- }
- }
- },
- initComponent: function () {
- var _this = this;
- setViewoutlinetree(this);
- eventBus.subscribe(EventType.SetVjson, function (_a) {
- var moduleId = _a.moduleId, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
- return _this.setVjson(moduleId, from, ignoreRenderUI);
- });
- return this.superclass.initComponent.apply(this, arguments);
- },
- clear: function () {
- this.setRootNode(null);
- },
- onChangModule: function (moduleId, oldModuleId, from) {
- if (!moduleId || moduleId !== this.moduleId) {
- return;
- }
- if (moduleStore.getModuleObject(moduleId)) {
- this.setVjson(moduleId, from);
- }
- },
- setVjson: function (moduleId, from, ignoreRenderUI) {
- var _this = this;
- if (!moduleId || moduleId !== this.moduleId || from === this.name) {
- return;
- }
- this.moduleId = moduleId;
- // if (from === this.name) {
- // return
- // }
- this.vjson = moduleStore.getModuleObject(moduleId).moduleObj.vjson;
- this.setTreeValue();
- if (this.componentSelectionChangeSubscribe) {
- this.componentSelectionChangeSubscribe.cancel();
- this.componentSelectionChangeSubscribe = null;
- }
- if (this.setVjsonChangeSubscribe) {
- this.setVjsonChangeSubscribe.cancel();
- this.setVjsonChangeSubscribe = null;
- }
- this.componentSelectionChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.ComponentSelectionChange, function (_a) {
- var id = _a.id, from = _a.from;
- return _this.onComponentSelectionChange(id, from);
- });
- this.setVjsonChangeSubscribe = moduleStore.getModuleObject(this.moduleId).moduleEventBus.subscribe(EventType.SetVjson, function (_a) {
- var vjson = _a.vjson, from = _a.from, ignoreRenderUI = _a.ignoreRenderUI;
- return _this.setModuleVjson(vjson, from, ignoreRenderUI);
- });
- },
- setModuleVjson: function (vjson, from, ignoreRenderUI) {
- if (!vjson || from === this.name) {
- return;
- }
- this.vjson = vjson;
- this.setTreeValue();
- var id = moduleStore.getModuleObject(this.moduleId).modulePage.currentComponentSelectId;
- if (id) {
- this.selectPath(id);
- }
- },
- onComponentSelectionChange: function (id, from) {
- if (from !== this.name) {
- if (id) {
- this.selectPath(id);
- }
- else {
- this.setTreeValue();
- }
- }
- },
- setTreeValue: function () {
- var outlineVj = {};
- _.forOwn(this.vjson, function (obj, key) {
- if (key !== 'viewModel' && key !== 'store') {
- outlineVj[key] = _.cloneDeep(obj);
- }
- });
- getLayoutOutline(outlineVj);
- this.setRootNode(outlineVj);
- },
- rightClickTreeNode: function (sender, node, element, idx, e) {
- var raw = node.data;
- var option = {};
- // 右键
- option = {
- shadow: 'frame',
- allowOtherMenus: true,
- items: []
- };
- var switchType = raw.layoutName;
- if (raw.layoutName === 'north' ||
- raw.layoutName === 'south' ||
- raw.layoutName === 'west' ||
- raw.layoutName === 'east' ||
- raw.layoutName === 'center' ||
- raw.layoutName === 'tbar' ||
- raw.layoutName === 'fbar') {
- switchType = raw.xtype || raw.layout;
- }
- var itemArr = [];
- var hasTbar = false, hasFbar = false, hasBody = false;
- if (raw.hasOwnProperty("children")) {
- _.forEach(raw.children, function (value) {
- if (value.layoutName === 'tbar') {
- hasTbar = true;
- }
- else if (value.layoutName === 'fbar') {
- hasFbar = true;
- }
- else {
- hasBody = true;
- }
- });
- }
- switch (switchType) {
- case 'fit':
- if (!hasTbar) {
- itemArr.push('tbar');
- }
- if (!hasFbar) {
- itemArr.push('fbar');
- }
- if (!hasBody) {
- itemArr.push('fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
- }
- option.items = this.menuNew(itemArr, raw);
- break;
- case 'border':
- if (!hasTbar) {
- itemArr.push('tbar');
- }
- if (!hasFbar) {
- itemArr.push('fbar');
- }
- itemArr.push('cnsew');
- option.items = this.menuNew(itemArr, raw);
- break;
- // case 'tbar':
- // option.items = this.menuNew(['toolbar', 'form', 'tfbar'], raw)
- // break;
- // case 'fbar':
- // option.items = this.menuNew(['toolbar', 'form', 'fieldset'], raw)
- // break;
- case 'tabpanel':
- if (!hasTbar) {
- itemArr.push('tbar');
- }
- if (!hasFbar) {
- itemArr.push('fbar');
- }
- itemArr.push('border', 'yvgrid', 'tree', 'form', 'fieldset', 'tabpanel');
- option.items = this.menuNew(itemArr, raw);
- break;
- case 'yvgrid':
- if (!hasTbar) {
- itemArr.push('tbar');
- }
- option.items = this.menuNew(itemArr, raw);
- break;
- case 'tree':
- if (!hasTbar) {
- itemArr.push('tbar');
- }
- if (!hasFbar) {
- itemArr.push('fbar');
- }
- option.items = this.menuNew(itemArr, raw);
- break;
- case 'fieldset':
- option.items = this.menuNew(['form', 'fieldset', 'cols'], raw);
- break;
- case 'form':
- if (!hasTbar) {
- itemArr.push('tbar');
- }
- if (!hasFbar) {
- itemArr.push('fbar');
- }
- itemArr.push('form', 'fieldset', 'cols');
- option.items = this.menuNew(itemArr, raw);
- break;
- case 'toolbar':
- itemArr.push('button', 'textfield', 'label', 'combo');
- option.items = this.menuNew(itemArr, raw);
- break;
- // case 'fbar':
- // itemArr.push('button', 'textfield', 'label', 'combo')
- // option.items = this.menuNew(itemArr, raw)
- // break
- default:
- option.items = this.menuNew(itemArr, raw);
- break;
- }
- var treeMenu = new Ext.menu.Menu(option);
- treeMenu.showAt(e.getXY());
- },
- newItem: function (viewType, raw, region) {
- var itemVjson = {};
- switch (viewType) {
- case 'fit':
- itemVjson.layout = 'fit';
- itemVjson.items = [];
- break;
- case 'border':
- itemVjson.layout = 'border';
- itemVjson.items = [];
- break;
- case 'toolbar':
- itemVjson.xtype = 'toolbar';
- itemVjson.title = 'toolbar';
- itemVjson.items = [
- {
- xtype: 'button',
- text: 'button'
- }
- ];
- break;
- case 'tabpanel':
- itemVjson.xtype = 'tabpanel';
- itemVjson.layout = 'fit';
- itemVjson.items = [];
- break;
- case 'yvgrid':
- itemVjson.xtype = 'yvgrid';
- itemVjson.layout = 'fit';
- itemVjson.pagination = false;
- itemVjson.columns = [
- {
- dataIndex: "skuId",
- header: "SKU_ID",
- },
- ];
- break;
- case 'tree':
- itemVjson.xtype = 'treepanel';
- itemVjson.layout = 'fit';
- break;
- case 'fieldset':
- case 'form':
- itemVjson.xtype = viewType;
- itemVjson.title = viewType;
- itemVjson.items = [
- {
- xtype: 'cols',
- items: [
- {
- xtype: 'textfield',
- fieldLabel: '输入框'
- }
- ]
- }
- ];
- break;
- case 'cols':
- itemVjson.xtype = 'cols';
- itemVjson.items = [
- {
- xtype: 'textfield',
- fieldLabel: '输入框'
- }
- ];
- break;
- case 'button':
- itemVjson.xtype = 'button';
- itemVjson.text = '按钮';
- itemVjson.iconCls = 'x-fa fa-plus';
- break;
- case 'textfield':
- itemVjson.xtype = 'textfield';
- itemVjson.fieldLabel = '输入框';
- break;
- case 'combo':
- itemVjson.xtype = 'combo';
- itemVjson.fieldLabel = '下拉框';
- break;
- case 'label':
- itemVjson.xtype = 'label';
- itemVjson.text = '文本';
- break;
- }
- var target = findInCode(this.vjson, raw.id);
- if (region) {
- if (region === 'tbar' || region === 'fbar') {
- target[region] = itemVjson;
- }
- else {
- itemVjson.region = region;
- itemVjson.split = true;
- if (region === 'north' || region === 'south') {
- itemVjson.height = '30%';
- itemVjson.collapsible = true;
- }
- else if (region === 'west' || region === 'east') {
- itemVjson.width = '30%';
- itemVjson.collapsible = true;
- }
- target.items.push(itemVjson);
- }
- }
- else {
- if (target.xtype === 'tabpanel') {
- itemVjson.title = prompt("请输入标题", _.uniqueId("未命名"));
- }
- target.items.push(itemVjson);
- }
- moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
- },
- menuNew: function (typeArr, raw, region) {
- var that = this;
- var reArr = [];
- typeArr.forEach(function (value) {
- if (value === 'cnsew') {
- reArr.push.apply(reArr, __spread(that.menuNewCNSEW(raw)));
- }
- else if (value === 'tbar' || value === 'fbar') {
- reArr.push(that.menuNewTFBar(value, raw));
- }
- else {
- reArr.push({
- text: '新建' + layoutOrXtypeNameMap[value],
- iconCls: 'x-fa fa-plus',
- handler: function (sender) {
- that.newItem(value, raw, region);
- }
- });
- }
- reArr.push("-");
- });
- if (region) {
- reArr.pop();
- return reArr;
- }
- reArr.push({
- text: '高级属性',
- iconCls: 'x-fa fa-cog',
- handler: function (sender) {
- var vj = findInCode(that.vjson, raw.id);
- that.advancedSettingWindow(vj);
- }
- }, {
- text: '上移',
- iconCls: 'x-fa fa-trash',
- handler: function (sender) {
- that.moveCmp(raw.id, 'up');
- }
- }, {
- text: '置顶',
- iconCls: 'x-fa fa-trash',
- handler: function (sender) {
- that.moveCmp(raw.id, 'top');
- }
- }, {
- text: '置底',
- iconCls: 'x-fa fa-trash',
- handler: function (sender) {
- that.moveCmp(raw.id, 'bottom');
- }
- }, {
- text: '下移',
- iconCls: 'x-fa fa-trash',
- handler: function (sender) {
- that.moveCmp(raw.id, 'down');
- }
- }, {
- text: '删除',
- iconCls: 'x-fa fa-trash',
- handler: function (sender) {
- deletVjsonById(that.vjson, raw.id);
- moduleStore.getModuleObject(that.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: that.vjson });
- }
- });
- return reArr;
- },
- menuNewCNSEW: function (raw) {
- var that = this;
- var arr = ['center', 'north', 'south', 'west', 'east'];
- if (raw.hasOwnProperty("children")) {
- _.forEach(raw.children, function (value) {
- _.remove(arr, function (it) {
- return it === value.layoutName;
- });
- });
- }
- var reArr = [];
- arr.forEach(function (value) {
- reArr.push({
- text: layoutOrXtypeNameMap[value],
- iconCls: 'x-fa fa-plus',
- menu: {
- showSeparator: true,
- items: that.menuNew(['fit', 'border', 'yvgrid', 'tree', 'form', 'fieldset', 'toolbar', 'tabpanel'], raw, value)
- }
- });
- reArr.push("-");
- });
- reArr.pop();
- return reArr;
- },
- menuNewTFBar: function (barType, raw) {
- var that = this;
- var reObj = {
- text: layoutOrXtypeNameMap[barType],
- iconCls: 'x-fa fa-plus',
- menu: {
- showSeparator: true,
- items: that.menuNew(['toolbar', 'form', 'fieldset'], raw, barType)
- }
- };
- return reObj;
- },
- moveCmp: function (id, moveType) {
- var arr = findArrayContainer(this.vjson, id);
- var index = _.findIndex(arr, function (v) { return v.id === id; });
- if (index < 0) {
- return;
- }
- switch (moveType) {
- case 'up':
- if (index > 0) {
- var o = arr[index];
- arr[index] = arr[index - 1];
- arr[index - 1] = o;
- }
- else {
- return;
- }
- break;
- case 'down':
- if (index < arr.length - 1) {
- var o = arr[index];
- arr[index] = arr[index + 1];
- arr[index + 1] = o;
- }
- else {
- return;
- }
- break;
- case 'top':
- if (index > 0) {
- var o = arr[index];
- arr[index] = arr[0];
- arr[0] = o;
- }
- else {
- return;
- }
- break;
- case 'bottom':
- if (index < arr.length - 1) {
- var o = arr[index];
- arr[index] = arr[arr.length - 1];
- arr[arr.length - 1] = o;
- }
- else {
- return;
- }
- break;
- }
- moduleStore.getModuleObject(this.moduleId).moduleEventBus.publish(EventType.UpdateVjson, { vjson: this.vjson });
- }
- });
- }
- function init$2 () {
- window['native'] = native;
- native.init();
- init();
- instance.getAllDomain().finally(function () {
- });
- initStateTree();
- initDashboard();
- initFileTree();
- initDbTree();
- initReportGrid();
- initGroovyEditor();
- initJsEditor$1();
- initJsonEditor$1();
- initSqlEditor$1();
- initTemplateEditor();
- initDict$1();
- initBpmnTree();
- initToolBox();
- initPropertyDesign();
- initViewOutlineTree();
- initWidget();
- initWhLayout();
- initApiTree();
- initTaskTree();
- initLogsTree();
- initDevOpsTree();
- initTerminal();
- initMonitorTree();
- initHomeTree();
- }
- var studio = {
- init: init$2,
- handles: handles$1,
- Workbench: Workbench
- };
- exports.axios = axios;
- exports.qs = Qs;
- exports.lodash = _$2;
- exports.jquery = $$2;
- exports.moment = moment$1;
- exports.recast = recast;
- exports.XLSX = XLSX;
- exports.echarts = echarts;
- exports.Defaults = Defaults;
- exports.ExcelImportDialog = ExcelImportDialog;
- exports.Lib = Lib;
- exports.LibParam = LibParam;
- exports.PropertyDescriptionTable = PropertyDescriptionTable;
- exports.ReportScope = ReportScope;
- exports.SIMPLE_RE = SIMPLE_RE;
- exports.Scope = Scope;
- exports.ScopeEngine = ScopeEngine;
- exports.SystemEventFu = SystemEventFu;
- exports.ajax = ajax;
- exports.baseConfigProcess = baseConfigProcess;
- exports.baseConfigProcessList = baseConfigProcessList;
- exports.buildPlus = buildPlus;
- exports.buildReportScope = buildReportScope;
- exports.calcExpress = calcExpress;
- exports.calcObject = calcObject;
- exports.calcObjectFlat = calcObjectFlat;
- exports.clearViewModel = clearViewModel;
- exports.clearViewModelByLookup = clearViewModelByLookup;
- exports.clearViewModelReloadGrid = clearViewModelReloadGrid;
- exports.clearViewModelValues = clearViewModelValues;
- exports.commitMe = commitMe;
- exports.confirm = confirm;
- exports.createAjax = createAjax;
- exports.createUUID = createUUID;
- exports.deepTravJson = deepTravJson;
- exports.downLoad = downLoad;
- exports.evalFunction = evalFunction;
- exports.extend = extend;
- exports.flatRow = flatRow;
- exports.getApiConvert = getApiConvert;
- exports.getGridEditRows = getGridEditRows;
- exports.getParentGrid = getParentGrid;
- exports.getPinyin = getPinyin;
- exports.getRegList = getRegList;
- exports.getRegParamList = getRegParamList;
- exports.getScopeOnCreate = getScopeOnCreate;
- exports.init = init$1;
- exports.insertGridRow = insertGridRow;
- exports.invokeServer = invokeServer$1;
- exports.isDesignMode = isDesignMode;
- exports.isEmpty = isEmpty;
- exports.json5 = dist;
- exports.keywordFilter = keywordFilter;
- exports.lookupFn = lookupFn;
- exports.lookupScope = lookupScope;
- exports.mergeViewModel = mergeViewModel;
- exports.moveDownGridRow = moveDownGridRow;
- exports.moveUpGridRow = moveUpGridRow;
- exports.msg = msg$1;
- exports.msgError = msgError;
- exports.normId = normId;
- exports.pinyinMatch = pinyinMatch;
- exports.prompt = prompt$2;
- exports.raiseClick = raiseClick;
- exports.reloadGrid = reloadGrid;
- exports.removeGridRow = removeGridRow;
- exports.replaceNA = replaceNA;
- exports.saveGridRow = saveGridRow;
- exports.serverInvokeUrlTransform = serverInvokeUrlTransform;
- exports.setComboStore = setComboStore;
- exports.showErrorDialog = showErrorDialog$1;
- exports.showInfoDialog = showInfoDialog;
- exports.showWidget = showWidget;
- exports.sqlUrlTransform = sqlUrlTransform;
- exports.stopEvent = stopEvent;
- exports.studio = studio;
- exports.toPlainObject = toPlainObject;
- exports.toString = toString;
- exports.tryEnable = tryEnable;
- exports.tryVarSimple = tryVarSimple;
- exports.tryWriteByExpress = tryWriteByExpress;
- exports.tryWriteObject = tryWriteObject;
- exports.watch = watch;
- Object.defineProperty(exports, '__esModule', { value: true });
- });
- //# sourceMappingURL=yvan-ext.js.map
|