design-graph1.vue 234 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161
  1. <template>
  2. <div class="mod-demo-echarts">
  3. <el-breadcrumb class="divi2" separator-class="el-icon-arrow-right">
  4. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  5. <el-breadcrumb-item :to="{ path: '/visi-design' }"
  6. >可视化设计</el-breadcrumb-item
  7. >
  8. <el-breadcrumb-item>实验设置</el-breadcrumb-item>
  9. </el-breadcrumb>
  10. <el-divider class="divi"></el-divider>
  11. <!-- <design-graph></design-graph> -->
  12. <!-- <design-graph-1 :visible.sync="designgraphvisi" v-if="designgraphvisi" ref="designgraph"></design-graph-1> -->
  13. <a-layout id="components-layout-demo-responsive">
  14. <!-- 左侧组件栏 default-expand-all-->
  15. <a-layout-sider
  16. breakpoint="lg"
  17. collapsed-width="0"
  18. @collapse="onCollapse"
  19. @breakpoint="onBreakpoint"
  20. theme="light"
  21. v-model="collapsed"
  22. collapsible
  23. >
  24. <div>
  25. <a-tree
  26. show-line
  27. show-icon
  28. :tree-data="treeData"
  29. :default-selected-keys="['0-0-0']"
  30. @select="onSelect"
  31. >
  32. <a-icon slot="icon" type="carry-out" />
  33. </a-tree>
  34. </div>
  35. </a-layout-sider>
  36. <!-- <div class="box" ref="box"> -->
  37. <!-- <div class="left"> -->
  38. <!-- 右侧画布 -->
  39. <div class="content">
  40. <div class="app-content">
  41. <div class="box" ref="box">
  42. <div class="left">
  43. <!-- <a-layout style="width:'100%',height:'100%',display:'flex'"> -->
  44. <el-form class="boxform">
  45. <el-form-item class="boxformitem">
  46. <!-- 画布上方按钮 undo redo-->
  47. <el-row>
  48. <el-tooltip
  49. content="提交"
  50. placement="bottom-end"
  51. effect="dark"
  52. >
  53. <i
  54. @click="onRun"
  55. style="
  56. height: 50px;
  57. width: 50px;
  58. margin: 10px 5px 10px 10px;
  59. font-size: 23px;
  60. "
  61. class="iconfont icon-yunXang"
  62. ></i>
  63. </el-tooltip>
  64. <el-tooltip
  65. content="保存"
  66. placement="bottom-end"
  67. effect="dark"
  68. >
  69. <i
  70. @click="onPrimary"
  71. style="
  72. height: 25px;
  73. width: 25px;
  74. margin: 10px 5px 10px 10px;
  75. font-size: 23px;
  76. "
  77. class="el-icon-document-checked"
  78. >
  79. </i>
  80. </el-tooltip>
  81. <el-tooltip content="取消" effect="dark">
  82. <i
  83. @click="onCancel"
  84. style="
  85. height: 25px;
  86. width: 25px;
  87. margin: 10px 5px 10px 10px;
  88. font-size: 23px;
  89. "
  90. class="el-icon-error"
  91. >
  92. </i>
  93. </el-tooltip>
  94. <el-tooltip content="Undo" effect="dark">
  95. <i
  96. @click="onUndo"
  97. style="
  98. height: 25px;
  99. width: 25px;
  100. margin: 10px 5px 10px 10px;
  101. font-size: 23px;
  102. "
  103. class="el-icon-arrow-left"
  104. >
  105. </i>
  106. </el-tooltip>
  107. <el-tooltip content="Redo" effect="dark">
  108. <i
  109. @click="onRedo"
  110. style="
  111. height: 25px;
  112. width: 25px;
  113. margin: 10px 5px 10px 10px;
  114. font-size: 23px;
  115. "
  116. class="el-icon-arrow-right"
  117. >
  118. </i>
  119. </el-tooltip>
  120. <el-tooltip content="示例" effect="dark">
  121. <i
  122. @click="onGetcontour"
  123. style="
  124. height: 25px;
  125. width: 25px;
  126. margin: 10px 5px 10px 10px;
  127. font-size: 23px;
  128. "
  129. class="el-icon-notebook-2"
  130. >
  131. </i>
  132. </el-tooltip>
  133. <el-tooltip content="清空" effect="dark">
  134. <i
  135. @click="onCleargraph"
  136. style="
  137. height: 25px;
  138. width: 25px;
  139. margin: 10px 5px 10px 10px;
  140. font-size: 23px;
  141. "
  142. class="el-icon-delete"
  143. >
  144. </i>
  145. </el-tooltip>
  146. <el-tooltip content="获取代码模板" effect="dark">
  147. <i
  148. @click="getParaTemp()"
  149. style="
  150. height: 25px;
  151. width: 25px;
  152. margin: 10px 5px 10px 10px;
  153. font-size: 23px;
  154. "
  155. class="el-icon-tickets"
  156. >
  157. </i>
  158. </el-tooltip>
  159. <el-tooltip content="日志" effect="dark">
  160. <i
  161. @click="getworkflowContent"
  162. style="
  163. height: 25px;
  164. width: 25px;
  165. margin: 10px 5px 10px 10px;
  166. font-size: 23px;
  167. "
  168. class="el-icon-document"
  169. >
  170. </i>
  171. </el-tooltip>
  172. <el-tooltip content="节点居中" effect="dark">
  173. <i
  174. @click="getgraphContentcenter"
  175. style="
  176. height: 25px;
  177. width: 25px;
  178. margin: 10px 5px 10px 10px;
  179. font-size: 23px;
  180. "
  181. class="iconfont icon-tishi"
  182. >
  183. </i>
  184. </el-tooltip>
  185. <el-tag
  186. :key="workflowstatustag.name"
  187. :type="workflowstatustag.type"
  188. @click="getWorkflowStatus"
  189. >{{ workflowstatustag.name }}</el-tag
  190. >
  191. </el-row>
  192. </el-form-item>
  193. <el-form-item class="boxformitem">
  194. <!-- 画布具体位置 -->
  195. <!-- <a-layout-content :style="{ margin: '0px 0px 0' }"> -->
  196. <!-- <div :style="{ padding: '24px', background: '#fff', minHeight: '360px' }"> -->
  197. <div
  198. style="width: 100%; height: 100%; display: flex"
  199. :style="{
  200. padding: '0px',
  201. background: '#fff',
  202. minHeight: '800px',
  203. }"
  204. >
  205. <!-- content -->
  206. <!-- 画布 style="width: 100%; height: 100%" class="app-content"-->
  207. <div id="container" style="flex: 1"></div>
  208. </div>
  209. <!-- </a-layout-content> -->
  210. </el-form-item>
  211. </el-form>
  212. <!-- </a-layout> -->
  213. </div>
  214. <div class="resize" title="收缩侧边栏"></div>
  215. <div class="right">
  216. <!-- 右侧组件栏 width="290px" style="width: 100%" width="239px" 309px-->
  217. <ExperimentConfig
  218. v-show="experimentVisi"
  219. ref="experConfig"
  220. @primaryExperimentclick="primaryExperimentConfig(arguments)"
  221. ></ExperimentConfig>
  222. <NodeConfig
  223. v-show="nodeConfigVisi"
  224. ref="newNodeConfig"
  225. @primaryNodeclick="primaryNodeConfig(arguments)"
  226. ></NodeConfig>
  227. <ConNodeConfig
  228. v-show="conNodeConfigVisi"
  229. ref="newConNodeConfig"
  230. @primaryclick="primaryConNodeConfig(arguments)"
  231. ></ConNodeConfig>
  232. <CSVSelectNodeConfig v-show="csvselectNodeConVisible" ref="csvselectNodeConfig" @primaryCSVselectNodeclick="primaryCSVselectNodeconfig(arguments)"></CSVSelectNodeConfig>
  233. <!-- <a-layout-sider
  234. breakpoint="lg"
  235. theme="light"
  236. width="100%"
  237. height="100%"
  238. collapsed-width="2"
  239. @collapse="onCollapse"
  240. @breakpoint="onBreakpoint"
  241. >
  242. <ExperimentConfig
  243. v-show="experimentVisi"
  244. ref="experConfig"
  245. ></ExperimentConfig>
  246. <NodeConfig
  247. v-show="nodeConfigVisi"
  248. ref="newNodeConfig"
  249. @primaryNodeclick="primaryNodeConfig(arguments)"
  250. ></NodeConfig>
  251. <ConNodeConfig
  252. v-show="conNodeConfigVisi"
  253. ref="newConNodeConfig"
  254. @primaryclick="primaryConNodeConfig(arguments)"
  255. ></ConNodeConfig>
  256. </a-layout-sider> -->
  257. </div>
  258. </div>
  259. </div>
  260. </div>
  261. <NodeParaTemp v-if="paraTempVisible" ref="paraTemp"></NodeParaTemp>
  262. <InputNodeConfig
  263. v-if="inputNodeConVisible"
  264. ref="inputNodeConfig"
  265. @refreshinputnode="primaryInputnodeConfig(arguments)"
  266. ></InputNodeConfig>
  267. <OutputNodeConfig
  268. v-if="outputNodeConVisible"
  269. ref="outputNodeConfig"
  270. ></OutputNodeConfig>
  271. <Workflowlog
  272. v-if="workflowContentVisi"
  273. ref="getworkflowlog"
  274. ></Workflowlog>
  275. </a-layout>
  276. <!-- 弹窗 -->
  277. <!-- <ConWatch v-if="newWatchVisible" ref="newWatch" @refreshDataList="getDataList"></ConWatch> -->
  278. </div>
  279. </template>
  280. <script>
  281. import { Cell, Graph, Model, Node } from "@antv/x6";
  282. import { Shape } from "@antv/x6";
  283. import { Addon } from "@antv/x6";
  284. import { Path } from "@antv/x6";
  285. // import { X6Splitbox } from "x6-vue-components";
  286. // import { SplitBox } from "@antv/x6";
  287. // import { X6Splitbox } from "@antv/x6-vue-shape";
  288. import { Rect } from "@antv/x6/lib/shape/basic";
  289. // import ConWatch from "./condition-watch.vue";
  290. // import StencilTree from "./stencil-tree.vue";
  291. import NodeConfig from "./design-node-config.vue";
  292. import ConNodeConfig from "./design-connode-config.vue";
  293. import ExperimentConfig from "./design-experconfig.vue";
  294. import NodeParaTemp from "./design-para-temp.vue";
  295. import InputNodeConfig from "./design-inputnode-config1.vue";
  296. import OutputNodeConfig from "./design-outputnode-config.vue";
  297. import Workflowlog from "./design-workflowlog.vue";
  298. import CSVSelectNodeConfig from "./design-csvselect-config.vue";
  299. import "@/ant-design-vue";
  300. import { Message } from "element-ui";
  301. import { MessageBox } from "element-ui";
  302. export default {
  303. data() {
  304. return {
  305. pregraphdata: "",
  306. dnd: null,
  307. // newConWatchVisible: false, //条件弹窗
  308. conNodeConfigVisi: false, //条件节点配置
  309. nodeConfigVisi: false, //普通节点配置
  310. experimentVisi: true, //实验配置
  311. paraTempVisible: false, //20211111 算法节点输入输出参数代码模板
  312. inputNodeConVisible: false, //输入节点配置
  313. outputNodeConVisible: false, //输出节点配置
  314. csvselectNodeConVisible: false, //csv文件转换节点配置
  315. //右侧参数设置组件栏
  316. formLayout: "horizontal",
  317. form: this.$form.createForm(this, { name: "coordinated" }),
  318. collapsed: false, //设置左侧侧边栏可收起
  319. addorupdate: true,//true表示update,新增 false表示add
  320. workflowId: null,//当前工作流id
  321. experimentName: "",//当前实验名称
  322. workflowName: "", //当前画布工作流名称
  323. workflowContent: { main: "", wait: "", init: "" }, //当前画布工作流整个日志
  324. workflowContentlog: "",
  325. workflowContentVisi: false,
  326. podlogs: null, //当前节点与workflow pod对应情况
  327. idTemplateNameMap: null, //id与templatename
  328. containertype: "main",
  329. workflowStatus: "uncommitted", //提交后的状态
  330. workflowstatustag: {
  331. name: "未提交",
  332. type: "info",
  333. },
  334. workflowdataList: [], //获取已经生成的画布列表, workflow列表
  335. algorithmdataList: [], //获取左侧树形组件栏,所有算法模块节点列表
  336. //20210926 树形组件
  337. treeData: [
  338. {
  339. title: "parent 1",
  340. key: "0-0",
  341. slots: {
  342. icon: "smile",
  343. },
  344. children: [
  345. // {
  346. // title: "consume_artifact",
  347. // key: "consume_artifact",
  348. // slots: { icon: "meh" },
  349. // },
  350. // {
  351. // title: "generate_artifact",
  352. // key: "generate_artifact",
  353. // scopedSlots: { icon: "custom" },
  354. // },
  355. // {
  356. // title: "zdockertest",
  357. // key: "zdockertest",
  358. // scopedSlots: { icon: "custom" },
  359. // },
  360. {
  361. title: "条件节点",
  362. key: "条件节点",
  363. scopedSlots: { icon: "custom" },
  364. },
  365. {
  366. title: "输入节点",
  367. key: "dataInputnode",
  368. scopedSlots: { icon: "custom" },
  369. },
  370. {
  371. title: "输出节点",
  372. key: "dataOutputnode",
  373. scopedSlots: { icon: "custom" },
  374. },
  375. {
  376. title: "CSV文件转换节点",
  377. key: "CSVSelectnode",
  378. scopedSlots: { icon: "custom" },
  379. },
  380. ],
  381. },
  382. {
  383. title: "轮廓识别",
  384. key: "0-1",
  385. slots: {
  386. icon: "smile",
  387. },
  388. children: [
  389. {
  390. title: "contourTask1",
  391. key: "contourTask1",
  392. scopedSlots: { icon: "custom" },
  393. },
  394. {
  395. title: "contourTask2",
  396. key: "contourTask2",
  397. scopedSlots: { icon: "custom" },
  398. },
  399. {
  400. title: "contourTask3",
  401. key: "contourTask3",
  402. scopedSlots: { icon: "custom" },
  403. },
  404. {
  405. title: "contourApproximate1",
  406. key: "contourApproximate1",
  407. scopedSlots: { icon: "custom" },
  408. },
  409. {
  410. title: "contourApproximate2",
  411. key: "contourApproximate2",
  412. scopedSlots: { icon: "custom" },
  413. },
  414. {
  415. title: "contourRect1",
  416. key: "contourRect1",
  417. scopedSlots: { icon: "custom" },
  418. },
  419. {
  420. title: "contourCircle2",
  421. key: "contourCircle2",
  422. scopedSlots: { icon: "custom" },
  423. },
  424. ],
  425. },
  426. ],
  427. showLine: true,
  428. showIcon: false,
  429. nodedata: [],
  430. imageurl: require("@/assets/img/cnnmnist.svg"),
  431. };
  432. },
  433. components: {
  434. NodeConfig: NodeConfig,
  435. ConNodeConfig: ConNodeConfig,
  436. ExperimentConfig: ExperimentConfig,
  437. NodeParaTemp: NodeParaTemp,
  438. InputNodeConfig: InputNodeConfig,
  439. OutputNodeConfig: OutputNodeConfig,
  440. Workflowlog: Workflowlog,
  441. CSVSelectNodeConfig: CSVSelectNodeConfig,
  442. // X6Splitbox: X6Splitbox,
  443. // SplitBox: splitbox,
  444. },
  445. activated() {
  446. this.getalgorithmDataList();
  447. this.onCleargraph();
  448. this.addorupdate = this.$route.query.update;
  449. console.log("addorupdate")
  450. console.log(this.addorupdate)
  451. //路由跳转--如果是修改,则加载画布信息;如果为新建,则不加载
  452. if(this.$route.query.update==true){
  453. this.initGraph(this.$route.query.winfo);
  454. }
  455. // this.createGraph();
  456. // this.addalgorithmdata();
  457. },
  458. // mounted() {
  459. mounted() {
  460. //为测试artifact 重新定义设置节点 保留之前的普通参数方式
  461. //将inputparameters 等参数[] 设置初始化为空
  462. // 定义节点
  463. Graph.registerNode("template-node", {
  464. inherit: "rect",
  465. width: 90,
  466. height: 80,
  467. attrs: {
  468. body: {
  469. strokeWidth: 1,
  470. stroke: "#d3e3ee",
  471. // fill: "#d3ebf3",
  472. fill: "#1891ec",
  473. rx: 8,
  474. ry: 8,
  475. },
  476. //设置内部添加图片
  477. image: {
  478. width: 36,
  479. height: 36,
  480. refX: 30,
  481. refY: 16,
  482. // "xlink:href":
  483. // "https://gw.alipayobjects.com/zos/bmw-prod/c55d7ae1-8d20-4585-bd8f-ca23653a4489.svg",
  484. },
  485. // label: {
  486. // refX: 3,
  487. // refY: 2,
  488. // textAnchor: "left",
  489. // textVerticalAnchor: "top",
  490. // fontSize: 12,
  491. // fill: "#fff",
  492. // },
  493. //删除功能
  494. //设置可通过backspace 删除,注释此部分
  495. // btn: {
  496. // refX: "100%",
  497. // refX2: -28,
  498. // // y: 4,
  499. // width: 24,
  500. // height: 18,
  501. // rx: 5,
  502. // ry: 5,
  503. // fill: "rgba(255,255,0,0.01)",
  504. // stroke: "white",
  505. // cursor: "pointer",
  506. // event: "node:delete",
  507. // },
  508. // btnText: {
  509. // fontSize: 14,
  510. // fill: "white",
  511. // text: "x",
  512. // refX: "100%",
  513. // refX2: -19,
  514. // // y: 17,
  515. // cursor: "pointer",
  516. // pointerEvent: "none",
  517. // },
  518. label: {
  519. // refX: 3,
  520. // refY: 2,
  521. refX: 0.5,
  522. refY: 0.85,
  523. fill: "#333",
  524. fontSize: 11,
  525. // fontWeight: "bold",
  526. fontVariant: "small-caps",
  527. },
  528. },
  529. ports: {
  530. groups: {
  531. // 输入链接桩群组定义
  532. in: {
  533. position: "left",
  534. attrs: {
  535. circle: {
  536. r: 2.5,
  537. magnet: true,
  538. stroke: "black",
  539. strokeWidth: 1,
  540. fill: "#fff",
  541. style: {
  542. visibility: true, //默认隐藏,不显示。定位到节点, 才展示
  543. },
  544. },
  545. },
  546. },
  547. // 输出链接桩群组定义
  548. out: {
  549. position: "right",
  550. attrs: {
  551. circle: {
  552. r: 2.5,
  553. magnet: true,
  554. stroke: "black",
  555. // stroke: "#fff",
  556. strokeWidth: 1,
  557. fill: "#fff",
  558. // style: {
  559. // visibility: "hidden", //默认隐藏,不显示。定位到节点, 才展示
  560. // },
  561. },
  562. },
  563. },
  564. },
  565. items: [
  566. {
  567. id: "inport1",
  568. group: "in",
  569. },
  570. {
  571. id: "inport2",
  572. group: "in",
  573. },
  574. {
  575. id: "outport1",
  576. group: "out",
  577. },
  578. {
  579. id: "outport2",
  580. group: "out",
  581. },
  582. ],
  583. },
  584. markup: [
  585. {
  586. tagName: "rect",
  587. selector: "body",
  588. attrs: {
  589. fill: "#fff",
  590. stroke: "#000",
  591. strokeWidth: 2,
  592. },
  593. },
  594. {
  595. tagName: "image",
  596. selector: "image",
  597. },
  598. {
  599. tagName: "text",
  600. selector: "label",
  601. attrs: {
  602. fill: "#333",
  603. textAnchor: "middle",
  604. textVerticalAnchor: "middle",
  605. },
  606. },
  607. // {
  608. // tagName: "g",
  609. // children: [
  610. // {
  611. // tagName: "text",
  612. // selector: "btnText",
  613. // },
  614. // {
  615. // tagName: "rect",
  616. // selector: "btn",
  617. // },
  618. // ],
  619. // },
  620. ],
  621. data: {
  622. nodeName: "",
  623. algonodeId: null,
  624. templateName: "",
  625. templateImage: "",
  626. templateCommand: {
  627. // 1: "echo",
  628. // 2: "{{inputs.parameters.message}}",
  629. // // 2:"\"{{inputs.parameters.message}}\""
  630. },
  631. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  632. // templateCommand2: [
  633. // {
  634. // 1:"echo"
  635. // },
  636. // {
  637. // 2:"{{inputs.parameters.message}}"
  638. // },
  639. // ],
  640. templateArgs: {
  641. // 1: "echo",
  642. },
  643. //20211116 新增 根据输入输出模板获取到的输入输出参数名称,类型,描述等
  644. algoparaInput: {
  645. userInput: [],
  646. getInput: [],
  647. }, //包括 userInput [] 和getInput[]
  648. algoparaOutput: [],
  649. //保存输入
  650. algoparaInputargu: {
  651. userInput: [],
  652. getInput: [],
  653. }, //包括 userInput [] 和getInput[]
  654. // algoparaOutAddress: "", //已改为description 无用
  655. algonodeSource: [],
  656. inputsparameters: [
  657. // //此container 需要输入的参数,固定
  658. // {
  659. // name: "message",
  660. // },
  661. // {
  662. // name: "message1",
  663. // },
  664. ],
  665. inputsartifacts: [
  666. // //此container 需要输入的参数,固定
  667. // {
  668. // name: "message",
  669. // path: "",
  670. // },
  671. ],
  672. argumentsparameters: [
  673. // {
  674. // name: "message",
  675. // value: "A",
  676. // },
  677. // //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  678. // {
  679. // name: "message1",
  680. // value: "A",
  681. // },
  682. ],
  683. argumentsartifacts: [
  684. // //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  685. // {
  686. // name: "message",
  687. // valuefrom: "A",
  688. // },
  689. ],
  690. outputsparameters: [
  691. // {
  692. // name: "message",
  693. // },
  694. // //此container 输出的参数,固定
  695. // // {
  696. // // name: "message1",
  697. // // },
  698. // // {
  699. // // name: "message2",
  700. // // },
  701. ],
  702. outputsartifacts: [
  703. // //此container 输出的参数,固定
  704. // {
  705. // name: "message",
  706. // path: "",
  707. // },
  708. ],
  709. //获取到的连接线源的数据 连接线的源的输出数据
  710. sourcedatalist: [
  711. // {
  712. // name: "source1",
  713. // from: "", // {{tasks.nodename.outputs.parameters.参数名}}
  714. // },
  715. // {
  716. // name: "source2",
  717. // from: "",
  718. // },
  719. ],
  720. sourceartilist: [
  721. // {
  722. // name: "source2",
  723. // from: "", //{{tasks.nodename.outputs.artifacts.参数名}}
  724. // },
  725. ],
  726. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  727. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  728. },
  729. });
  730. // // 定义边
  731. // Graph.registerConnector(
  732. // "algo-edge",
  733. // (source, target) => {
  734. // const offset = 4;
  735. // const control = 80;
  736. // const v1 = { x: source.x, y: source.y + offset + control };
  737. // const v2 = { x: target.x, y: target.y - offset - control };
  738. // return `M ${source.x} ${source.y}
  739. // L ${source.x} ${source.y + offset}
  740. // C ${v1.x} ${v1.y} ${v2.x} ${v2.y} ${target.x} ${target.y - offset}
  741. // L ${target.x} ${target.y}
  742. // `;
  743. // },
  744. // true
  745. // );
  746. //定义输入节点
  747. Graph.registerNode("template-input", {
  748. inherit: "rect",
  749. width: 90,
  750. height: 80,
  751. attrs: {
  752. body: {
  753. strokeWidth: 1,
  754. stroke: "#d3e3ee",
  755. fill: "#e2c3a0",
  756. rx: 8,
  757. ry: 8,
  758. },
  759. //设置内部添加图片
  760. image: {
  761. width: 36,
  762. height: 36,
  763. refX: 30,
  764. refY: 16,
  765. "xlink:href":
  766. "https://gw.alipayobjects.com/zos/bmw-prod/c55d7ae1-8d20-4585-bd8f-ca23653a4489.svg",
  767. },
  768. label: {
  769. refX: 0.5,
  770. refY: 0.85,
  771. fill: "#333",
  772. fontSize: 11,
  773. // fontWeight: "bold",
  774. fontVariant: "small-caps",
  775. },
  776. },
  777. ports: {
  778. groups: {
  779. // 输入链接桩群组定义
  780. in: {
  781. position: "left",
  782. attrs: {
  783. circle: {
  784. r: 2.5,
  785. magnet: true,
  786. stroke: "black",
  787. strokeWidth: 1,
  788. fill: "#fff",
  789. style: {
  790. visibility: true, //默认隐藏,不显示。定位到节点, 才展示
  791. },
  792. },
  793. },
  794. },
  795. // 输出链接桩群组定义
  796. out: {
  797. position: "right",
  798. attrs: {
  799. circle: {
  800. r: 2.5,
  801. magnet: true,
  802. stroke: "black",
  803. // stroke: "#fff",
  804. strokeWidth: 1,
  805. fill: "#fff",
  806. // style: {
  807. // visibility: "hidden", //默认隐藏,不显示。定位到节点, 才展示
  808. // },
  809. },
  810. },
  811. },
  812. },
  813. items: [
  814. {
  815. id: "inport1",
  816. group: "in",
  817. },
  818. {
  819. id: "inport2",
  820. group: "in",
  821. },
  822. {
  823. id: "outport1",
  824. group: "out",
  825. },
  826. {
  827. id: "outport2",
  828. group: "out",
  829. },
  830. ],
  831. },
  832. markup: [
  833. {
  834. tagName: "rect",
  835. selector: "body",
  836. attrs: {
  837. fill: "#fff",
  838. stroke: "#000",
  839. strokeWidth: 2,
  840. },
  841. },
  842. {
  843. tagName: "image",
  844. selector: "image",
  845. },
  846. {
  847. tagName: "text",
  848. selector: "label",
  849. attrs: {
  850. fill: "#333",
  851. textAnchor: "middle",
  852. textVerticalAnchor: "middle",
  853. },
  854. },
  855. ],
  856. data: {
  857. nodeName: "",
  858. algonodeId: null,
  859. st_dataListvalue: [], //静态数据集选中 文件对应value
  860. dy_dataListvalue: [], //动态数据集选中 文件对应value
  861. fileList: [], //外部上传 文件
  862. allfilemap: [{}], //选中的文件对应的名称及url
  863. },
  864. });
  865. //定义输出节点
  866. Graph.registerNode("template-output", {
  867. inherit: "rect",
  868. width: 90,
  869. height: 80,
  870. attrs: {
  871. body: {
  872. strokeWidth: 1,
  873. stroke: "#d3e3ee",
  874. fill: "#e2c3a0",
  875. rx: 8,
  876. ry: 8,
  877. },
  878. //设置内部添加图片
  879. image: {
  880. width: 36,
  881. height: 36,
  882. refX: 30,
  883. refY: 16,
  884. "xlink:href":
  885. "https://gw.alipayobjects.com/zos/bmw-prod/c55d7ae1-8d20-4585-bd8f-ca23653a4489.svg",
  886. },
  887. label: {
  888. refX: 0.5,
  889. refY: 0.85,
  890. fill: "#333",
  891. fontSize: 11,
  892. // fontWeight: "bold",
  893. fontVariant: "small-caps",
  894. },
  895. },
  896. ports: {
  897. groups: {
  898. // 输入链接桩群组定义
  899. in: {
  900. position: "left",
  901. attrs: {
  902. circle: {
  903. r: 2.5,
  904. magnet: true,
  905. stroke: "black",
  906. strokeWidth: 1,
  907. fill: "#fff",
  908. style: {
  909. visibility: true, //默认隐藏,不显示。定位到节点, 才展示
  910. },
  911. },
  912. },
  913. },
  914. // 输出链接桩群组定义
  915. out: {
  916. position: "right",
  917. attrs: {
  918. circle: {
  919. r: 2.5,
  920. magnet: true,
  921. stroke: "black",
  922. // stroke: "#fff",
  923. strokeWidth: 1,
  924. fill: "#fff",
  925. // style: {
  926. // visibility: "hidden", //默认隐藏,不显示。定位到节点, 才展示
  927. // },
  928. },
  929. },
  930. },
  931. },
  932. items: [
  933. {
  934. id: "inport1",
  935. group: "in",
  936. },
  937. {
  938. id: "inport2",
  939. group: "in",
  940. },
  941. {
  942. id: "outport1",
  943. group: "out",
  944. },
  945. {
  946. id: "outport2",
  947. group: "out",
  948. },
  949. ],
  950. },
  951. markup: [
  952. {
  953. tagName: "rect",
  954. selector: "body",
  955. attrs: {
  956. fill: "#fff",
  957. stroke: "#000",
  958. strokeWidth: 2,
  959. },
  960. },
  961. {
  962. tagName: "image",
  963. selector: "image",
  964. },
  965. {
  966. tagName: "text",
  967. selector: "label",
  968. attrs: {
  969. fill: "#333",
  970. textAnchor: "middle",
  971. textVerticalAnchor: "middle",
  972. },
  973. },
  974. ],
  975. data: {
  976. nodeName: "",
  977. algonodeId: null,
  978. sourcealgocell: null,
  979. },
  980. });
  981. //定义输出节点
  982. Graph.registerNode("template-csvselect", {
  983. inherit: "rect",
  984. width: 90,
  985. height: 80,
  986. attrs: {
  987. body: {
  988. strokeWidth: 1,
  989. stroke: "#d3e3ee",
  990. fill: "#e2c3a0",
  991. rx: 8,
  992. ry: 8,
  993. },
  994. //设置内部添加图片
  995. image: {
  996. width: 36,
  997. height: 36,
  998. refX: 30,
  999. refY: 16,
  1000. "xlink:href":
  1001. "https://gw.alipayobjects.com/zos/bmw-prod/c55d7ae1-8d20-4585-bd8f-ca23653a4489.svg",
  1002. },
  1003. label: {
  1004. refX: 0.5,
  1005. refY: 0.85,
  1006. fill: "#333",
  1007. fontSize: 11,
  1008. // fontWeight: "bold",
  1009. fontVariant: "small-caps",
  1010. },
  1011. },
  1012. ports: {
  1013. groups: {
  1014. // 输入链接桩群组定义
  1015. in: {
  1016. position: "left",
  1017. attrs: {
  1018. circle: {
  1019. r: 2.5,
  1020. magnet: true,
  1021. stroke: "black",
  1022. strokeWidth: 1,
  1023. fill: "#fff",
  1024. style: {
  1025. visibility: true, //默认隐藏,不显示。定位到节点, 才展示
  1026. },
  1027. },
  1028. },
  1029. },
  1030. // 输出链接桩群组定义
  1031. out: {
  1032. position: "right",
  1033. attrs: {
  1034. circle: {
  1035. r: 2.5,
  1036. magnet: true,
  1037. stroke: "black",
  1038. // stroke: "#fff",
  1039. strokeWidth: 1,
  1040. fill: "#fff",
  1041. // style: {
  1042. // visibility: "hidden", //默认隐藏,不显示。定位到节点, 才展示
  1043. // },
  1044. },
  1045. },
  1046. },
  1047. },
  1048. items: [
  1049. {
  1050. id: "inport1",
  1051. group: "in",
  1052. },
  1053. {
  1054. id: "inport2",
  1055. group: "in",
  1056. },
  1057. {
  1058. id: "outport1",
  1059. group: "out",
  1060. },
  1061. {
  1062. id: "outport2",
  1063. group: "out",
  1064. },
  1065. ],
  1066. },
  1067. markup: [
  1068. {
  1069. tagName: "rect",
  1070. selector: "body",
  1071. attrs: {
  1072. fill: "#fff",
  1073. stroke: "#000",
  1074. strokeWidth: 2,
  1075. },
  1076. },
  1077. {
  1078. tagName: "image",
  1079. selector: "image",
  1080. },
  1081. {
  1082. tagName: "text",
  1083. selector: "label",
  1084. attrs: {
  1085. fill: "#333",
  1086. textAnchor: "middle",
  1087. textVerticalAnchor: "middle",
  1088. },
  1089. },
  1090. ],
  1091. data: {
  1092. nodeName: "",
  1093. algonodeId: null,
  1094. st_dataListvalue: [], //静态数据集选中 文件对应value
  1095. dy_dataListvalue: [], //动态数据集选中 文件对应value
  1096. fileList: [], //外部上传 文件
  1097. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  1098. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用 ---与算法节点的不同,存储文件名,桶名称,url
  1099. allfilemap: [{}], //选中的文件对应的名称及url
  1100. isMakenewfile: false,
  1101. },
  1102. });
  1103. // 初始化画布
  1104. const graph = new Graph({
  1105. grid: true,
  1106. container: document.getElementById("container"),
  1107. // width: 1270,
  1108. // width: 1200,
  1109. // height: 750,
  1110. autoResize: true,
  1111. panning: {
  1112. enabled: true,
  1113. },
  1114. //调节节点大小
  1115. resizing: {
  1116. enabled: false,
  1117. },
  1118. // model: {},
  1119. history: true, //uodo和redo
  1120. highlighting: {
  1121. nodeAvailable: {
  1122. //连线过程中,节点可以被链接时被使用。
  1123. name: "className",
  1124. args: {
  1125. className: "available",
  1126. },
  1127. },
  1128. magnetAvailable: {
  1129. //连线过程中,链接桩可以被链接时被使用。
  1130. name: "className",
  1131. args: {
  1132. className: "available",
  1133. },
  1134. },
  1135. magnetAdsorbed: {
  1136. //连线过程中,自动吸附到链接桩时被使用。
  1137. name: "className",
  1138. args: {
  1139. className: "adsorbed",
  1140. },
  1141. },
  1142. },
  1143. scroller: {
  1144. enabled: true,
  1145. pannable: true,
  1146. minVisibleHeight: 800,
  1147. minVisibleWidth: 800,
  1148. autoResize: true,
  1149. height: 800,
  1150. className: "x6-graph-scroller",
  1151. },
  1152. mousewheel: {
  1153. enabled: true,
  1154. modifiers: ["ctrl", "meta"],
  1155. },
  1156. clipboard: {
  1157. enabled: true,
  1158. useLocalStorage: true,
  1159. },
  1160. keyboard: {
  1161. enabled: true,
  1162. global: true,
  1163. }, //快捷键
  1164. selecting: {
  1165. enabled: true,
  1166. showNodeSelectionBox: true,
  1167. // showEdgeSelectionBox: true,
  1168. }, //选中 ,框选
  1169. //节点与边交互
  1170. translating: {
  1171. restrict: true, //限制节点不能移动超出画布区域
  1172. },
  1173. connecting: {
  1174. snap: true, //连线距离节点或者连接桩 50px 时会触发自动吸附
  1175. allowBlank: false,
  1176. allowLoop: false,
  1177. highlight: true,
  1178. sourceAnchor: {
  1179. //指定源节点的锚点
  1180. name: "bottom",
  1181. },
  1182. targetAnchor: {
  1183. //指定目标节点的锚点
  1184. name: "center",
  1185. },
  1186. connectionPoint: "anchor",
  1187. // connector: "algo-edge",
  1188. createEdge() {
  1189. return graph.createEdge({
  1190. //更新连接边edge样式
  1191. router: {
  1192. // name: "orth",
  1193. name: "er",
  1194. args: {
  1195. offset: "center",
  1196. },
  1197. },
  1198. attrs: {
  1199. line: {
  1200. // strokeDasharray: "5 5", //虚线
  1201. stroke: "#808080",
  1202. strokeWidth: 1,
  1203. targetMarker: {
  1204. name: "block",
  1205. args: {
  1206. size: "6",
  1207. },
  1208. },
  1209. },
  1210. },
  1211. //在指定的位置处,渲染一个删除按钮,点击时删除对应的边。
  1212. tools: {
  1213. name: "button-remove",
  1214. args: { distance: -40 },
  1215. },
  1216. });
  1217. },
  1218. validateMagnet({ magnet }) {
  1219. return magnet.getAttribute("port-group") !== "in";
  1220. },
  1221. validateConnection({
  1222. sourceView,
  1223. targetView,
  1224. sourceMagnet,
  1225. targetMagnet,
  1226. }) {
  1227. // 只能从输出链接桩创建连接
  1228. if (
  1229. !sourceMagnet ||
  1230. sourceMagnet.getAttribute("port-group") === "in"
  1231. ) {
  1232. return false;
  1233. }
  1234. // 只能连接到输入链接桩
  1235. if (
  1236. !targetMagnet ||
  1237. targetMagnet.getAttribute("port-group") !== "in"
  1238. ) {
  1239. return false;
  1240. }
  1241. // 判断目标链接桩是否可连接
  1242. const portId = targetMagnet.getAttribute("port");
  1243. const node = targetView.cell;
  1244. const port = node.getPort(portId);
  1245. if (port && port.connected) {
  1246. // if (port && port.connected) {
  1247. return false;
  1248. }
  1249. return true;
  1250. },
  1251. },
  1252. });
  1253. // 创建 Graph 的实例
  1254. // const graph = new Graph({
  1255. // container: document.getElementById("container"),
  1256. // width: 1380,
  1257. // height: 750,
  1258. // background: {
  1259. // // color: "#f7f7f4", //设置画布背景颜色
  1260. // color: "#ffffff",
  1261. // },
  1262. // grid: {
  1263. // size: 8,
  1264. // visible: true,
  1265. // }, //网格
  1266. // history: true, //uodo和redo
  1267. // //滚动条
  1268. // // scroller: {
  1269. // // enabled: true,
  1270. // // // pannable: true,
  1271. // // // pageVisible: true,
  1272. // // // pageBreak: false,
  1273. // // },
  1274. // mousewheel: {
  1275. // enabled: true,
  1276. // modifiers: ["ctrl", "meta"],
  1277. // },
  1278. // // clipboard: true, //剪切板
  1279. // clipboard: {
  1280. // enabled: true,
  1281. // useLocalStorage: true,
  1282. // },
  1283. // keyboard: {
  1284. // enabled: true,
  1285. // global: true,
  1286. // }, //快捷键
  1287. // selecting: {
  1288. // enabled: true,
  1289. // showNodeSelectionBox: true,
  1290. // // showEdgeSelectionBox: true,
  1291. // }, //选中 ,框选
  1292. // //节点与边交互
  1293. // translating: {
  1294. // restrict: true, //限制节点不能移动超出画布区域
  1295. // },
  1296. // //连线规则
  1297. // connecting: {
  1298. // snap: true,
  1299. // allowBlank: false, //不允许连接到画布空白位置
  1300. // allowMulti: false, //不允许在相同节点之间创建多条边
  1301. // },
  1302. // });
  1303. this.graph = graph;
  1304. this.history = graph.history; //Redo Undo
  1305. // this.graph.toJSON()
  1306. // const dnd = new Addon.Dnd({
  1307. // target: this.graph,
  1308. // scaled: false,
  1309. // animation: true,
  1310. // getDragNode(node) {
  1311. // // 这里返回一个新的节点作为拖拽节点
  1312. // return graph.createNode({
  1313. // width: 60,
  1314. // height: 20,
  1315. // attrs: {
  1316. // label: {
  1317. // text: "Rect",
  1318. // fill: "#6a6c8a",
  1319. // },
  1320. // body: {
  1321. // stroke: "#31d0c6",
  1322. // strokeWidth: 2,
  1323. // },
  1324. // },
  1325. // });
  1326. // },
  1327. // getDropNode(node) {
  1328. // const { width, height } = node.size();
  1329. // // 返回一个新的节点作为实际放置到画布上的节点
  1330. // return node.clone().size(width * 3, height * 3);
  1331. // },
  1332. // });
  1333. // this.dnd = dnd;
  1334. // // console.log("this.dnd");
  1335. // // console.log(this.dnd);
  1336. //绑定快捷键 ctrl+c ctrl+v
  1337. this.graph.bindKey("ctrl+c", () => {
  1338. const cells = this.graph.getSelectedCells();
  1339. if (cells.length) {
  1340. this.graph.copy(cells);
  1341. }
  1342. return false;
  1343. });
  1344. this.graph.bindKey("ctrl+v", () => {
  1345. if (!this.graph.isClipboardEmpty()) {
  1346. const cells = this.graph.paste({ offset: 32 });
  1347. this.graph.cleanSelection();
  1348. this.graph.select(cells);
  1349. }
  1350. return false;
  1351. });
  1352. this.graph.bindKey("backspace", () => {
  1353. const cells = graph.getSelectedCells();
  1354. if (cells.length) {
  1355. graph.removeCells(cells);
  1356. }
  1357. });
  1358. //节点删除 边未完成
  1359. graph.on("node:delete", ({ view, e }) => {
  1360. e.stopPropagation();
  1361. view.cell.remove();
  1362. console.log("node:delete");
  1363. });
  1364. //删除边
  1365. graph.on("edge:delete", ({ view, e }) => {
  1366. e.stopPropagation();
  1367. view.cell.remove();
  1368. });
  1369. //delete
  1370. graph.bindKey("backspace", () => {
  1371. const cells = graph.getSelectedCells();
  1372. if (cells.length) {
  1373. graph.removeCells(cells);
  1374. }
  1375. });
  1376. //20210804 涉及到一些通过 边连接 时传递的参数 及赋值行为,在边取消是要进行及时更改
  1377. graph.on("cell:click", ({ e, cell, view }) => {
  1378. // reset();
  1379. // node.attr("body/stroke", "orange");
  1380. console.log("单击节点成功");
  1381. this.cell = cell;
  1382. //条件节点;
  1383. if (cell.shape == "polygon") {
  1384. // this.newConWatchVisible = true;
  1385. // this.conNodeConfigVisi = true;
  1386. this.$nextTick(() => {
  1387. this.conNodeConfigVisi = true;
  1388. this.experimentVisi = false;
  1389. this.nodeConfigVisi = false;
  1390. this.csvselectNodeConVisible = false;
  1391. this.$refs.newConNodeConfig.init(
  1392. cell.getData().sourcedatalist,
  1393. cell.getData().sourceartilist,
  1394. cell.getData().inputcondition,
  1395. cell
  1396. );
  1397. // this.$refs.newConWatch.init(
  1398. // cell.getData().sourcedatalist,
  1399. // cell.getData().inputcondition
  1400. // );
  1401. });
  1402. } else if (cell.shape == "template-node") {
  1403. // console.log(cell.getData());
  1404. // console.log(this.workflowName);
  1405. // console.log(cell.id);
  1406. this.$nextTick(() => {
  1407. this.nodeConfigVisi = true;
  1408. this.conNodeConfigVisi = false;
  1409. this.experimentVisi = false;
  1410. this.csvselectNodeConVisible = false;
  1411. this.$refs.newNodeConfig.init1(
  1412. cell.getData(),
  1413. cell,
  1414. this.workflowName,
  1415. this.idTemplateNameMap,
  1416. this.workflowStatus
  1417. );
  1418. // if (this.$refs.newNodeConfig) {
  1419. // // console.log("出现了");
  1420. // this.$refs.newNodeConfig.init1(cell.getData(), cell);
  1421. // }
  1422. });
  1423. } else if (cell.shape == "template-input") {
  1424. // console.log(cell);
  1425. // console.log(cell.getData());
  1426. // console.log(this.workflowName);
  1427. // console.log(cell.id);
  1428. this.inputNodeConVisible = true;
  1429. this.$nextTick(() => {
  1430. this.$refs.inputNodeConfig.init(cell);
  1431. });
  1432. // addOrUpdateHandle(id) {
  1433. // this.addOrUpdateVisible = true;
  1434. // this.$nextTick(() => {
  1435. // this.$refs.addOrUpdate.init(id);
  1436. // });
  1437. // },
  1438. } else if (cell.shape == "template-output") {
  1439. // console.log(cell.getData());
  1440. // console.log(this.workflowName);
  1441. // console.log(cell.id);\
  1442. this.outputNodeConVisible = true;
  1443. if (cell.getData().sourcealgocell != null) {
  1444. //当前输出节点有 前序 算法节点
  1445. this.$nextTick(() => {
  1446. this.$refs.outputNodeConfig.init(
  1447. cell,
  1448. cell.getData(),
  1449. cell.getData().sourcealgocell.getData(),
  1450. this.workflowName,
  1451. this.workflowStatus
  1452. );
  1453. });
  1454. } else {
  1455. this.$nextTick(() => {
  1456. this.$refs.outputNodeConfig.init1(
  1457. cell,
  1458. cell.getData(),
  1459. this.workflowName
  1460. );
  1461. });
  1462. }
  1463. }else if (cell.shape == "template-csvselect") {
  1464. // console.log(cell.getData());
  1465. // console.log(this.workflowName);
  1466. // console.log(cell.id);
  1467. this.$nextTick(() => {
  1468. this.csvselectNodeConVisible = true;
  1469. this.nodeConfigVisi = false;
  1470. this.conNodeConfigVisi = false;
  1471. this.experimentVisi = false;
  1472. this.$refs.csvselectNodeConfig.init1(
  1473. cell.getData(),cell
  1474. );
  1475. // if (this.$refs.newNodeConfig) {
  1476. // // console.log("出现了");
  1477. // this.$refs.newNodeConfig.init1(cell.getData(), cell);
  1478. // }
  1479. });
  1480. }
  1481. });
  1482. //20211008 blank 画布空白区域
  1483. graph.on("blank:click", ({ e, x, y }) => {
  1484. // reset();
  1485. // node.attr("body/stroke", "orange");
  1486. console.log("单击空白区域成功");
  1487. this.$nextTick(() => {
  1488. this.conNodeConfigVisi = false;
  1489. this.experimentVisi = true;
  1490. this.nodeConfigVisi = false;
  1491. this.csvselectNodeConVisible = false;
  1492. this.$refs.experConfig.init();
  1493. // this.visible = true;
  1494. // this.$refs.experConfig.init();
  1495. });
  1496. });
  1497. //双击节点 弹窗
  1498. // graph.on("cell:dblclick", ({ e, cell, view }) => {
  1499. // //条件节点
  1500. // if (cell.shape == "polygon") {
  1501. // // this.newConWatchVisible = true;
  1502. // this.$nextTick(() => {
  1503. // this.newConWatchVisible = true;
  1504. // this.$refs.newConWatch.init(
  1505. // cell.getData().sourcedatalist,
  1506. // cell.getData().inputcondition
  1507. // );
  1508. // });
  1509. // console.log("双击成功");
  1510. // }
  1511. // //普通rect节点
  1512. // });
  1513. //20210730
  1514. //边发生连接 条件节点
  1515. graph.on(
  1516. "edge:connected",
  1517. ({ isNew, edge, previousCell, previousPort, currentCell }) => {
  1518. if (isNew) {
  1519. // 对新创建的边进行插入数据库等持久化操作
  1520. console.log("新建边:" + edge.id);
  1521. const source = edge.getSourceCell();
  1522. // console.log(edge);
  1523. // console.log(edge.getSourceCell());
  1524. // console.log(edge.getTargetCell());
  1525. // console.log(currentCell);
  1526. //添加任意一条边后,都需要获取源节点的输出参数列表,并将其写入到目标节点中
  1527. //源节点为 rect,目标节点为rect
  1528. if (
  1529. source.shape == "template-node" &&
  1530. currentCell.shape == "template-node"
  1531. ) {
  1532. //20211118
  1533. var salgonodeSource = currentCell.getData().algonodeSource;
  1534. var flag = 0;
  1535. for (var i = 0; i < salgonodeSource.length; i++) {
  1536. // if (salgonodeSource[i].cellId == source.cellId) {
  1537. // flag = 1;
  1538. // }
  1539. if (salgonodeSource[i].id == source.id) {
  1540. flag = 1;
  1541. }
  1542. }
  1543. console.log("flag " + flag);
  1544. if (flag == 0) {
  1545. currentCell.setData({
  1546. algonodeSource: salgonodeSource.concat(source),
  1547. });
  1548. }
  1549. console.log(currentCell.getData().algonodeSource);
  1550. //20210922 更改并保存 注释
  1551. // const sourcedata = source.getData();
  1552. // currentCell.setData({
  1553. // sourcedatalist: sourcedata.outputsparameters,
  1554. // });
  1555. // //此处已更改
  1556. // console.log("源节点为 template-node,目标节点为template-node");
  1557. // console.log(edge.shape);
  1558. // //仅为传递到 节点参数设置栏便于展示
  1559. // //20210819 是否可以根据 nodeConfigVisi 来选择是否刷新
  1560. // this.$nextTick(() => {
  1561. // // this.nodeConfigVisi = true;
  1562. // // this.conNodeConfigVisi = false;
  1563. // // this.experimentVisi = false;
  1564. // this.$refs.newNodeConfig.changeSourcedata(
  1565. // currentCell.getData(),
  1566. // currentCell
  1567. // );
  1568. // });
  1569. // console.log(
  1570. // "源节点为 template-node,目标节点为template-node 222"
  1571. // );
  1572. // const sourcedata = source.getData();
  1573. // var soutputsparameters = sourcedata.outputsparameters;
  1574. // var soutputsartifacts = sourcedata.outputsartifacts;
  1575. // for (var i = 0; i < soutputsparameters.length; i++) {
  1576. // soutputsparameters[i].from =
  1577. // "{{tasks." +
  1578. // sourcedata.nodeName +
  1579. // ".outputs.parameters." +
  1580. // soutputsparameters[i].name +
  1581. // "}}";
  1582. // }
  1583. // for (var i = 0; i < soutputsartifacts.length; i++) {
  1584. // soutputsartifacts[i].from =
  1585. // "{{tasks." +
  1586. // sourcedata.nodeName +
  1587. // ".outputs.artifacts." +
  1588. // soutputsartifacts[i].name +
  1589. // "}}";
  1590. // }
  1591. // console.log("soutputsparameters,soutputsartifacts");
  1592. // console.log(soutputsparameters);
  1593. // console.log(soutputsartifacts);
  1594. // //添加数据的方式 ---追加
  1595. // //var newArr = arr.concat(arr2); concat()方法生成了一个新的数组,并不改变原来的数组。
  1596. // const currsourcedatalist = currentCell.getData().sourcedatalist;
  1597. // const currsourceartilist = currentCell.getData().sourceartilist;
  1598. // currentCell.setData({
  1599. // sourcedatalist: currsourcedatalist.concat(soutputsparameters),
  1600. // sourceartilist: currsourceartilist.concat(soutputsartifacts),
  1601. // });
  1602. //此处已更改
  1603. console.log("源节点为 template-node,目标节点为template-node");
  1604. console.log(edge.shape);
  1605. //仅为传递到 节点参数设置栏便于展示
  1606. //20210819 是否可以根据 nodeConfigVisi 来选择是否刷新
  1607. this.$nextTick(() => {
  1608. // this.nodeConfigVisi = true;
  1609. // this.conNodeConfigVisi = false;
  1610. // this.experimentVisi = false;
  1611. this.$refs.newNodeConfig.changeSourcedata(
  1612. currentCell.getData(),
  1613. currentCell
  1614. );
  1615. });
  1616. }
  1617. //源节点为 rect,目标节点为 polygon
  1618. if (
  1619. source.shape == "template-node" &&
  1620. currentCell.shape == "polygon"
  1621. ) {
  1622. const sourcedata = source.getData();
  1623. // currentCell.setData({
  1624. // sourcedatalist: sourcedata.outputsparameters,
  1625. // });
  1626. var soutputsparameters = sourcedata.outputsparameters;
  1627. var soutputsartifacts = sourcedata.outputsartifacts;
  1628. for (var i = 0; i < soutputsparameters.length; i++) {
  1629. soutputsparameters[i].from =
  1630. "{{tasks." +
  1631. sourcedata.nodeName +
  1632. ".outputs.parameters." +
  1633. soutputsparameters[i].paraname +
  1634. "}}";
  1635. }
  1636. for (var i = 0; i < soutputsartifacts.length; i++) {
  1637. soutputsartifacts[i].from =
  1638. "{{tasks." +
  1639. sourcedata.nodeName +
  1640. ".outputs.partifacts." +
  1641. soutputsartifacts[i].paraname +
  1642. "}}";
  1643. }
  1644. currentCell.setData({
  1645. sourcedatalist: currentCell
  1646. .getData()
  1647. .sourcedatalist.concat(soutputsparameters),
  1648. });
  1649. currentCell.setData({
  1650. sourceartilist: currentCell
  1651. .getData()
  1652. .sourceartilist.concat(soutputsartifacts),
  1653. });
  1654. // console.log(currentCell.getData());
  1655. // console.log("源节点为 template-node,目标节点为polygon");
  1656. this.$nextTick(() => {
  1657. // this.nodeConfigVisi = true;
  1658. // this.conNodeConfigVisi = false;
  1659. // this.experimentVisi = false;
  1660. this.$refs.newConNodeConfig.changeSourcedata(
  1661. currentCell.getData(),
  1662. currentCell
  1663. );
  1664. });
  1665. // console.log("源节点为 template-node,目标节点为polygon");
  1666. }
  1667. //源节点为 polygon,目标节点为 polygon
  1668. //20210802 此处进行条件节点连接条件节点 ,改变目标节点的条件,与原条件进行 && 。可先进行判断目标节点的条件是否为空,若为空,直接复制,若不为空 ,则&&
  1669. //取反等 均为字符串拼接
  1670. //那么在用户输入条件语句时,也要判断节点条件是否为空,若为空,赋值,若不为空,&&
  1671. //源节点为 polygon
  1672. if (source.shape == "polygon") {
  1673. //边的起始节点类型为条件节点
  1674. if (edge.source.port == "righttrue") {
  1675. // if(edge.getSourcePortId=="righttrue"){
  1676. // source.data("truetargetid",currentCell.id);
  1677. //20210730 zhang 赋值成功
  1678. source.setData({ truetargetid: currentCell.id });
  1679. //还需确定删除连接边之后 回复空值
  1680. } else if (edge.source.port == "bottomfalse") {
  1681. //边的目标节点为条件节点
  1682. source.setData({ falsetargetid: currentCell.id });
  1683. }
  1684. }
  1685. //如果源节点为输入节点,目的节点为 算法节点
  1686. if (
  1687. source.shape == "template-input" &&
  1688. currentCell.shape == "template-node"
  1689. ) {
  1690. console.log("源节点为 template-input,目标节点为template-node");
  1691. console.log(edge.shape);
  1692. //仅为传递到 节点参数设置栏便于展示
  1693. //20210819 是否可以根据 nodeConfigVisi 来选择是否刷新
  1694. console.log(source);
  1695. console.log(source.allfilemap);
  1696. // currentCell.setData({inputnodefilemap:source.getData().allfilemap});
  1697. this.$nextTick(() => {
  1698. // this.nodeConfigVisi = true;
  1699. // this.conNodeConfigVisi = false;
  1700. // this.experimentVisi = false;
  1701. this.$refs.newNodeConfig.changeinputnodemap(
  1702. currentCell.getData(),
  1703. currentCell,
  1704. source.getData().allfilemap
  1705. );
  1706. });
  1707. }
  1708. //如果源节点为算法节点,目的节点为输入节点
  1709. if (
  1710. source.shape == "template-node" &&
  1711. currentCell.shape == "template-output"
  1712. ) {
  1713. console.log("源节点为 template-node,目标节点为template-output");
  1714. var curcelldata = currentCell.getData();
  1715. curcelldata.sourcealgocell = source;
  1716. this.graph.getCellById(currentCell.id).setData(curcelldata);
  1717. this.$nextTick(() => {
  1718. // this.nodeConfigVisi = true;
  1719. // this.conNodeConfigVisi = false;
  1720. // this.experimentVisi = false;
  1721. this.$refs.outputNodeConfig.changeoutputsourcealgo(
  1722. currentCell,
  1723. currentCell.getData(),
  1724. source,
  1725. source.getData()
  1726. );
  1727. });
  1728. }
  1729. //如果源节点为输入节点,目的节点为CSV转换节点
  1730. if (
  1731. source.shape == "template-input" &&
  1732. currentCell.shape == "template-csvselect"
  1733. ) {
  1734. console.log("源节点为 template-input,目标节点为template-csvselect");
  1735. console.log(edge.shape);
  1736. //仅为传递到 节点参数设置栏便于展示
  1737. //20210819 是否可以根据 nodeConfigVisi 来选择是否刷新
  1738. console.log(source);
  1739. console.log(source.allfilemap);
  1740. // currentCell.setData({inputnodefilemap:source.getData().allfilemap});
  1741. this.$nextTick(() => {
  1742. // this.nodeConfigVisi = true;
  1743. // this.conNodeConfigVisi = false;
  1744. // this.experimentVisi = false;
  1745. this.$refs.csvselectNodeConfig.changeinputnodemap(
  1746. currentCell.getData(),
  1747. currentCell,
  1748. source.getData().allfilemap
  1749. );
  1750. //待更改0722
  1751. });
  1752. }
  1753. //如果源节点为输入节点,目的节点为 算法节点
  1754. if (
  1755. source.shape == "template-csvselect" &&
  1756. currentCell.shape == "template-node"
  1757. ) {
  1758. console.log("源节点为 template-csvselect,目标节点为template-node");
  1759. console.log(edge.shape);
  1760. //仅为传递到 节点参数设置栏便于展示
  1761. //20210819 是否可以根据 nodeConfigVisi 来选择是否刷新
  1762. console.log(source);
  1763. console.log(source.allfilemap);
  1764. // currentCell.setData({inputnodefilemap:source.getData().allfilemap});
  1765. this.$nextTick(() => {
  1766. // this.nodeConfigVisi = true;
  1767. // this.conNodeConfigVisi = false;
  1768. // this.experimentVisi = false;
  1769. this.$refs.newNodeConfig.changeinputnodemap(
  1770. currentCell.getData(),
  1771. currentCell,
  1772. source.getData().allfilemap
  1773. );
  1774. });
  1775. }
  1776. }
  1777. }
  1778. );
  1779. //依据条件判断的 赋值修改操作
  1780. //20210922
  1781. //边被移除 -----?
  1782. graph.on(
  1783. "edge:removed",
  1784. ({ edge, previousCell, previousPort, currentCell, index }) => {
  1785. console.log("edge:removed");
  1786. // //20210923 将edge.getSourceCell() 以及previousCell 替换为edge.source,将currentCell替换为edge.target
  1787. // //20210923 edge.source以及edge.target获取到的cell 并非为template-node 类型节点,修改为先回去源及目标节点Id,根据节点Id获取节点信息
  1788. // //previousCell, currentCell 均为undefined
  1789. // //edge.getSourceCell() 以及 edge.getTargetCell() 均为null
  1790. // // console.log(previousCell);//undefined
  1791. // // const source = edge.getSourceCell();
  1792. // // const source = edge.source;
  1793. // // const target = edge.target;
  1794. // const sourceId = edge.getSourceCellId();
  1795. // const source = graph.getCellById(sourceId);
  1796. // const cellId = edge.getTargetCellId();
  1797. // const target = graph.getCellById(cellId);
  1798. // console.log(edge.source);
  1799. // console.log(source.shape);
  1800. // console.log(target.shape);
  1801. // //删除边时,获取源节点的输出参数列表,匹配目标节点的sourcedatalist及sourceartilist
  1802. // //源节点为 rect,目标节点为rect
  1803. // if (
  1804. // source.shape == "template-node" &&
  1805. // target.shape == "template-node"
  1806. // ) {
  1807. // const sourcedata = source.getData();
  1808. // //获取目标节点当前 sourcedatalist及sourceartilist
  1809. // var targetsourpara = target.getData().sourcedatalist;
  1810. // var targetsourarti = target.getData().sourceartilist;
  1811. // //获取源节点的输出参数outputsparameters outputsartifacts
  1812. // const soutputsparameters = sourcedata.outputsparameters;
  1813. // const soutputsartifacts = sourcedata.outputsartifacts;
  1814. // //遍历源节点的输出参数,在目标节点的 中删除对应的参数
  1815. // for (var i = 0; i < soutputsparameters.length; i++) {
  1816. // let strfrom =
  1817. // "{{tasks." +
  1818. // sourcedata.nodeName +
  1819. // ".outputs.parameters." +
  1820. // soutputsparameters[i].name +
  1821. // "}}";
  1822. // //acData.find(x => x.sid == id);
  1823. // let index = targetsourpara.find((item) => item.from === strfrom);
  1824. // targetsourpara.splice(index, 1);
  1825. // }
  1826. // for (var i = 0; i < soutputsartifacts.length; i++) {
  1827. // let strfrom =
  1828. // "{{tasks." +
  1829. // sourcedata.nodeName +
  1830. // ".outputs.partifacts." +
  1831. // soutputsartifacts[i].name +
  1832. // "}}";
  1833. // let index = targetsourarti.find((item) => item.from === strfrom);
  1834. // targetsourarti.splice(index, 1);
  1835. // }
  1836. // target.setData({
  1837. // sourcedatalist: targetsourpara,
  1838. // sourceartilist: targetsourarti,
  1839. // });
  1840. // //此处已更改
  1841. // console.log("源节点为 template-node,目标节点为template-node");
  1842. // console.log(edge.shape);
  1843. // //仅为传递到 节点参数设置栏便于展示
  1844. // //20210819 是否可以根据 nodeConfigVisi 来选择是否刷新
  1845. // this.$nextTick(() => {
  1846. // // this.nodeConfigVisi = true;
  1847. // // this.conNodeConfigVisi = false;
  1848. // // this.experimentVisi = false;
  1849. // this.$refs.newNodeConfig.changeSourcedata(target.getData(), target);
  1850. // });
  1851. // console.log("源节点为 template-node,目标节点为template-node 222");
  1852. // }
  1853. // //源节点为 rect,目标节点为 polygon
  1854. // if (source.shape == "template-node" && target.shape == "polygon") {
  1855. // console.log("源节点为 rect,目标节点为 polygon");
  1856. // const sourcedata = source.getData();
  1857. // //获取目标节点当前 sourcedatalist及sourceartilist
  1858. // var targetsourpara = target.getData().sourcedatalist;
  1859. // var targetsourarti = target.getData().sourceartilist;
  1860. // //获取源节点的输出参数outputsparameters outputsartifacts
  1861. // const soutputsparameters = sourcedata.outputsparameters;
  1862. // const soutputsartifacts = sourcedata.outputsartifacts;
  1863. // //遍历源节点的输出参数,在目标节点的 中删除对应的参数
  1864. // for (var i = 0; i < soutputsparameters.length; i++) {
  1865. // let strfrom =
  1866. // "{{tasks." +
  1867. // sourcedata.nodeName +
  1868. // ".outputs.parameters." +
  1869. // soutputsparameters[i].name +
  1870. // "}}";
  1871. // //acData.find(x => x.sid == id);
  1872. // console.log("strfrom:" + strfrom);
  1873. // let index = targetsourpara.find((item) => item.from === strfrom);
  1874. // console.log("index" + index);
  1875. // targetsourpara.splice(index, 1);
  1876. // }
  1877. // for (var i = 0; i < soutputsartifacts.length; i++) {
  1878. // let strfrom =
  1879. // "{{tasks." +
  1880. // sourcedata.nodeName +
  1881. // ".outputs.partifacts." +
  1882. // soutputsartifacts[i].name +
  1883. // "}}";
  1884. // console.log("strfrom:" + strfrom);
  1885. // // let index = targetsourarti.find(item => item.from == strfrom);
  1886. // let index = targetsourarti.findIndex(
  1887. // (item) => item.from == strfrom
  1888. // );
  1889. // console.log("index");
  1890. // console.log(index);
  1891. // console.log(targetsourarti);
  1892. // targetsourarti.splice(index, 1);
  1893. // }
  1894. // target.setData({
  1895. // sourcedatalist: targetsourpara,
  1896. // sourceartilist: targetsourarti,
  1897. // });
  1898. // console.log(target.getData());
  1899. // console.log("源节点为 template-node,目标节点为polygon");
  1900. // this.$nextTick(() => {
  1901. // // this.nodeConfigVisi = true;
  1902. // // this.conNodeConfigVisi = false;
  1903. // // this.experimentVisi = false;
  1904. // this.$refs.newConNodeConfig.changeSourcedata(
  1905. // target.getData(),
  1906. // target
  1907. // );
  1908. // });
  1909. // console.log("源节点为 template-node,目标节点为polygon");
  1910. // }
  1911. // //源节点为 polygon,目标节点为 polygon
  1912. // //20210802 此处进行条件节点连接条件节点 ,改变目标节点的条件,与原条件进行 && 。可先进行判断目标节点的条件是否为空,若为空,直接复制,若不为空 ,则&&
  1913. // //取反等 均为字符串拼接
  1914. // //那么在用户输入条件语句时,也要判断节点条件是否为空,若为空,赋值,若不为空,&&
  1915. // //源节点为 polygon
  1916. // if (source.shape == "polygon") {
  1917. // //边的起始节点类型为条件节点
  1918. // if (edge.source.port == "righttrue") {
  1919. // // if(edge.getSourcePortId=="righttrue"){
  1920. // // source.data("truetargetid",currentCell.id);
  1921. // //20210730 zhang 赋值成功
  1922. // source.setData({ truetargetid: target.id });
  1923. // //还需确定删除连接边之后 回复空值
  1924. // } else if (edge.source.port == "bottomfalse") {
  1925. // //边的目标节点为条件节点
  1926. // source.setData({ falsetargetid: target.id });
  1927. // }
  1928. // }
  1929. }
  1930. );
  1931. //20210803 边 可删
  1932. Graph.registerConnector(
  1933. "curve",
  1934. (sourcePoint, targetPoint) => {
  1935. const path = new Path();
  1936. path.appendSegment(Path.createSegment("M", sourcePoint));
  1937. path.appendSegment(
  1938. Path.createSegment(
  1939. "C",
  1940. sourcePoint.x,
  1941. sourcePoint.y + 180,
  1942. targetPoint.x,
  1943. targetPoint.y - 180,
  1944. targetPoint.x,
  1945. targetPoint.y
  1946. )
  1947. );
  1948. return path.serialize();
  1949. },
  1950. true
  1951. );
  1952. //20210715 zhang 该圆角矩形大小 及颜色合适
  1953. const rect1 = new Shape.Rect({
  1954. id: "node3",
  1955. x: 60,
  1956. y: 60,
  1957. width: 140,
  1958. height: 40,
  1959. label: "rect",
  1960. zIndex: 3,
  1961. data: {
  1962. templateName: "echo1",
  1963. templateImage: "alpine:3.7",
  1964. templateCommand: {
  1965. 1: "echo",
  1966. 2: "{{inputs.parameters.message}}",
  1967. // 2:"\"{{inputs.parameters.message}}\""
  1968. },
  1969. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  1970. // templateCommand2: [
  1971. // {
  1972. // 1:"echo"
  1973. // },
  1974. // {
  1975. // 2:"{{inputs.parameters.message}}"
  1976. // },
  1977. // ],
  1978. templateArgs: {
  1979. // 1: "echo",
  1980. },
  1981. inputsparameters: [
  1982. //此container 需要输入的参数,固定
  1983. {
  1984. name: "message",
  1985. },
  1986. ],
  1987. argumentsparameters: [
  1988. //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  1989. {
  1990. name: "message",
  1991. value: "A",
  1992. },
  1993. ],
  1994. outputsparameters: [
  1995. //此container 输出的参数,固定
  1996. {
  1997. name: "message",
  1998. },
  1999. {
  2000. name: "message1",
  2001. },
  2002. ],
  2003. },
  2004. markup: [
  2005. {
  2006. tagName: "rect",
  2007. selector: "body",
  2008. },
  2009. {
  2010. tagName: "text",
  2011. selector: "label",
  2012. },
  2013. {
  2014. tagName: "g",
  2015. children: [
  2016. {
  2017. tagName: "text",
  2018. selector: "btnText",
  2019. },
  2020. {
  2021. tagName: "rect",
  2022. selector: "btn",
  2023. },
  2024. ],
  2025. },
  2026. ],
  2027. attrs: {
  2028. body: {
  2029. fill: "#ffffff",
  2030. // stroke: '#5dc3fd',
  2031. stroke: "#5dc3fd",
  2032. rx: 16,
  2033. ry: 16,
  2034. },
  2035. //20210729 删除功能
  2036. btn: {
  2037. refX: "100%",
  2038. refX2: -28,
  2039. // y: 4,
  2040. width: 24,
  2041. height: 18,
  2042. rx: 10,
  2043. ry: 10,
  2044. fill: "rgba(255,255,0,0.01)",
  2045. stroke: "red",
  2046. cursor: "pointer",
  2047. event: "node:delete",
  2048. },
  2049. btnText: {
  2050. fontSize: 14,
  2051. fill: "red",
  2052. text: "x",
  2053. refX: "100%",
  2054. refX2: -19,
  2055. // y: 17,
  2056. cursor: "pointer",
  2057. pointerEvent: "none",
  2058. },
  2059. label: {
  2060. text: "World",
  2061. fill: "#333",
  2062. fontSize: 18,
  2063. fontWeight: "bold",
  2064. fontVariant: "small-caps",
  2065. },
  2066. },
  2067. ports: {
  2068. groups: {
  2069. // 输入链接桩群组定义
  2070. in: {
  2071. position: "left",
  2072. attrs: {
  2073. circle: {
  2074. r: 4,
  2075. magnet: true,
  2076. stroke: "#31d0c6",
  2077. strokeWidth: 2,
  2078. fill: "#fff",
  2079. },
  2080. },
  2081. },
  2082. // 输出链接桩群组定义
  2083. out: {
  2084. position: "right",
  2085. attrs: {
  2086. circle: {
  2087. r: 4,
  2088. magnet: true,
  2089. stroke: "#31d0c6",
  2090. strokeWidth: 2,
  2091. fill: "#fff",
  2092. },
  2093. },
  2094. },
  2095. },
  2096. items: [
  2097. {
  2098. id: "port1",
  2099. group: "in",
  2100. },
  2101. {
  2102. id: "port2",
  2103. group: "out",
  2104. },
  2105. ],
  2106. },
  2107. });
  2108. const condition = new Shape.Polygon({
  2109. width: 120,
  2110. height: 120,
  2111. attrs: {
  2112. text: { text: "条件节点", fill: "condition" },
  2113. body: {
  2114. // fill: "#b6e3e7",
  2115. stroke: "#b6e3e7",
  2116. refPoints: "0,10 10,0 20,10 10,20",
  2117. // refY: 0.3,
  2118. },
  2119. label: {
  2120. fontSize: 16,
  2121. fill: "#333",
  2122. fontWeight: 800,
  2123. // refY: 0.8,
  2124. },
  2125. },
  2126. data: {
  2127. nodeName: "condition1",
  2128. truetargetid: "",
  2129. falsetargetid: "",
  2130. inputcondition: "true",
  2131. sourcedatalist: [
  2132. // {
  2133. // name: "source1",
  2134. // from: "",
  2135. // },
  2136. // {
  2137. // name: "source2",
  2138. // from: "",
  2139. // },
  2140. ],
  2141. sourceartilist: [
  2142. // {
  2143. // name: "source1",
  2144. // from: "",
  2145. // },
  2146. // {
  2147. // name: "source2",
  2148. // from: "",
  2149. // },
  2150. ],
  2151. },
  2152. ports: {
  2153. groups: {
  2154. in: {
  2155. position: "top",
  2156. attrs: {
  2157. circle: {
  2158. r: 4,
  2159. magnet: true,
  2160. stroke: "#5F95FF",
  2161. strokeWidth: 2,
  2162. fill: "#fff",
  2163. // style: {
  2164. // visibility: "hidden",
  2165. // },
  2166. },
  2167. },
  2168. },
  2169. right: {
  2170. position: "right",
  2171. label: {
  2172. position: "top",
  2173. },
  2174. attrs: {
  2175. circle: {
  2176. r: 4,
  2177. magnet: true,
  2178. stroke: "#5F95FF",
  2179. strokeWidth: 2,
  2180. fill: "#fff",
  2181. // style: {
  2182. // visibility: "hidden",
  2183. // },
  2184. },
  2185. },
  2186. },
  2187. bottom: {
  2188. position: "bottom",
  2189. label: {
  2190. position: "right",
  2191. },
  2192. attrs: {
  2193. circle: {
  2194. r: 4,
  2195. magnet: true,
  2196. stroke: "#5F95FF",
  2197. strokeWidth: 2,
  2198. fill: "#fff",
  2199. // style: {
  2200. // visibility: "hidden",
  2201. // },
  2202. },
  2203. },
  2204. },
  2205. left: {
  2206. position: "left",
  2207. attrs: {
  2208. circle: {
  2209. r: 4,
  2210. magnet: true,
  2211. stroke: "#5F95FF",
  2212. strokeWidth: 2,
  2213. fill: "#fff",
  2214. // style: {
  2215. // visibility: "hidden",
  2216. // },
  2217. },
  2218. },
  2219. },
  2220. },
  2221. items: [
  2222. {
  2223. //通过id辨别
  2224. group: "in",
  2225. },
  2226. {
  2227. id: "righttrue",
  2228. group: "right",
  2229. attrs: {
  2230. text: { text: "是" },
  2231. },
  2232. },
  2233. {
  2234. id: "bottomfalse",
  2235. group: "bottom",
  2236. attrs: {
  2237. text: { text: "否" },
  2238. },
  2239. },
  2240. {
  2241. group: "left",
  2242. },
  2243. ],
  2244. },
  2245. });
  2246. //条件节点
  2247. const conditionnode = new Shape.Polygon({
  2248. width: 80,
  2249. height: 80,
  2250. attrs: {
  2251. text: { text: "条件节点", fill: "condition" },
  2252. body: {
  2253. // fill: "#b6e3e7",
  2254. stroke: "#b6e3e7",
  2255. refPoints: "0,10 10,0 20,10 10,20",
  2256. // refY: 0.3,
  2257. },
  2258. label: {
  2259. text: "条件节点",
  2260. fontSize: 8,
  2261. fill: "#333",
  2262. fontWeight: 800,
  2263. // refY: 0.8,
  2264. },
  2265. },
  2266. data: {
  2267. truetargetid: "",
  2268. falsetargetid: "",
  2269. inputcondition: "true",
  2270. sourcedatalist: [
  2271. {
  2272. // name: "source1",
  2273. // from: "",
  2274. },
  2275. ],
  2276. sourceartilist: [
  2277. {
  2278. // name: "source1",
  2279. // from: "",
  2280. },
  2281. ],
  2282. },
  2283. ports: {
  2284. groups: {
  2285. in: {
  2286. position: "top",
  2287. attrs: {
  2288. circle: {
  2289. r: 2,
  2290. magnet: true,
  2291. stroke: "#5F95FF",
  2292. strokeWidth: 2,
  2293. fill: "#fff",
  2294. // style: {
  2295. // visibility: "hidden",
  2296. // },
  2297. },
  2298. },
  2299. },
  2300. out: {
  2301. position: "right",
  2302. label: {
  2303. position: "top",
  2304. },
  2305. attrs: {
  2306. circle: {
  2307. r: 2,
  2308. magnet: true,
  2309. stroke: "#5F95FF",
  2310. strokeWidth: 2,
  2311. fill: "#fff",
  2312. // style: {
  2313. // visibility: "hidden",
  2314. // },
  2315. },
  2316. },
  2317. },
  2318. out1: {
  2319. position: "bottom",
  2320. label: {
  2321. position: "right",
  2322. },
  2323. attrs: {
  2324. circle: {
  2325. r: 2,
  2326. magnet: true,
  2327. stroke: "#5F95FF",
  2328. strokeWidth: 2,
  2329. fill: "#fff",
  2330. // style: {
  2331. // visibility: "hidden",
  2332. // },
  2333. },
  2334. },
  2335. },
  2336. left: {
  2337. position: "left",
  2338. attrs: {
  2339. circle: {
  2340. r: 2,
  2341. magnet: true,
  2342. stroke: "#5F95FF",
  2343. strokeWidth: 2,
  2344. fill: "#fff",
  2345. // style: {
  2346. // visibility: "hidden",
  2347. // },
  2348. },
  2349. },
  2350. },
  2351. },
  2352. items: [
  2353. {
  2354. //通过id辨别
  2355. id: "top",
  2356. group: "in",
  2357. },
  2358. {
  2359. id: "righttrue",
  2360. group: "out",
  2361. attrs: {
  2362. text: { text: "是" },
  2363. },
  2364. },
  2365. {
  2366. id: "bottomfalse",
  2367. group: "out1",
  2368. attrs: {
  2369. text: { text: "否" },
  2370. },
  2371. },
  2372. {
  2373. group: "left",
  2374. },
  2375. ],
  2376. },
  2377. });
  2378. this.nodedata.push(conditionnode);
  2379. //20210727 zhang 自定義中文
  2380. // Graph.registerNode("selectnode", Rect);
  2381. // //20211012 注释
  2382. // ///20210720 zhang 左侧ui栏及拖拽 -----已变为左侧组件点击后画布生成
  2383. // const stencil = new Addon.Stencil({
  2384. // title: "组件库",
  2385. // target: graph,
  2386. // search(cell, keyword) {
  2387. // return cell.shape.indexOf(keyword) !== -1;
  2388. // },
  2389. // placeholder: "Search by shape name",
  2390. // notFoundText: "Not Found",
  2391. // collapsable: true,
  2392. // stencilGraphWidth: 240,
  2393. // stencilGraphHeight: 600,
  2394. // layoutOptions: {
  2395. // columns: 1,
  2396. // center: true,
  2397. // dx: 30,
  2398. // dy: 5,
  2399. // },
  2400. // groups: [
  2401. // {
  2402. // name: "group1",
  2403. // title: "分类1",
  2404. // },
  2405. // {
  2406. // name: "group2",
  2407. // title: "分类2",
  2408. // // collapsable: false,
  2409. // },
  2410. // ],
  2411. // });
  2412. // this.$refs.stencilContainer.appendChild(stencil.container);
  2413. //20210907 zhang 左侧组件栏设置节点信息 从数据库读入时需要设置节点包含的相关pod 信息
  2414. // stencil.load([c2.clone(), r2, r3, c3], "group2");
  2415. // //20211012 注释
  2416. // stencil.load(
  2417. // [
  2418. // cellz3,
  2419. // generate_artifact,
  2420. // consume_artifact,
  2421. // cellz3.clone(),
  2422. // cellz3.clone(),
  2423. // ],
  2424. // "group1"
  2425. // );
  2426. // stencil.load(
  2427. // [
  2428. // cellz3.clone(),
  2429. // cellz3.clone(),
  2430. // cellz3.clone(),
  2431. // cellz3.clone(),
  2432. // cellz3.clone(),
  2433. // condition,
  2434. // ],
  2435. // "group2"
  2436. // );
  2437. // stencil.load([c2.clone(), r2, r3, c3, c3.clone()], "group2");
  2438. // stencil.load([c2.clone(), r2, r3, c3], "group2");
  2439. //创建节点
  2440. const consume_artifact = this.graph.createNode({
  2441. // width: 170,
  2442. // height: 30,
  2443. shape: "template-node",
  2444. // label: "consume_artifact",
  2445. attrs: {
  2446. label: {
  2447. text: "consume_artifact",
  2448. },
  2449. body: {
  2450. // stroke: "#2CB9FF",
  2451. // fill: "#2CB9FF",
  2452. fill: "#d3ebf3",
  2453. },
  2454. // body: {
  2455. // stroke: "#DA2625",
  2456. // fill: "#DA2625",
  2457. // },
  2458. image: {
  2459. "xlink:href":
  2460. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  2461. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  2462. //可放图标
  2463. },
  2464. },
  2465. data: {
  2466. nodeName: "zhang_consume_artifac",
  2467. templateName: "print-message",
  2468. templateImage: "alpine:latest",
  2469. templateCommand: {
  2470. 1: "sh",
  2471. 2: "-c",
  2472. // 2:"\"{{inputs.parameters.message}}\""
  2473. },
  2474. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  2475. // templateCommand2: [
  2476. // {
  2477. // 1:"echo"
  2478. // },
  2479. // {
  2480. // 2:"{{inputs.parameters.message}}"
  2481. // },
  2482. // ],
  2483. templateArgs: {
  2484. 1: "cat /tmp/message",
  2485. },
  2486. inputsparameters: [],
  2487. inputsartifacts: [
  2488. //此container 需要输入的参数,固定
  2489. {
  2490. name: "message",
  2491. path: "/tmp/message",
  2492. },
  2493. ],
  2494. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  2495. //应对应input中的各项参数设置对应参数
  2496. argumentsparameters: [],
  2497. argumentsartifacts: [
  2498. //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  2499. {
  2500. name: "message",
  2501. valuefrom: "{{tasks.whalesay.outputs.artifacts.hello-art}}",
  2502. },
  2503. ],
  2504. outputsparameters: [],
  2505. outputsartifacts: [],
  2506. //获取到的连接线源的数据 连接线的源的输出数据
  2507. sourcedatalist: [
  2508. // {
  2509. // name: "source1",
  2510. // },
  2511. // {
  2512. // name: "source2",
  2513. // },
  2514. ],
  2515. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  2516. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  2517. },
  2518. });
  2519. // cellz4.setData({ templateName: "zhang" });
  2520. const generate_artifact = graph.createNode({
  2521. // width: 170,
  2522. // height: 30,
  2523. shape: "template-node",
  2524. attrs: {
  2525. label: {
  2526. text: "generate_artifact",
  2527. },
  2528. image: {
  2529. "xlink:href":
  2530. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  2531. },
  2532. },
  2533. data: {
  2534. nodeName: "zhang_generate_artifact",
  2535. templateName: "whalesay",
  2536. templateImage: "docker/whalesay:latest",
  2537. templateCommand: {
  2538. 1: "sh",
  2539. 2: "-c",
  2540. // 2:"\"{{inputs.parameters.message}}\""
  2541. },
  2542. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  2543. // templateCommand2: [
  2544. // {
  2545. // 1:"echo"
  2546. // },
  2547. // {
  2548. // 2:"{{inputs.parameters.message}}"
  2549. // },
  2550. // ],
  2551. templateArgs: {
  2552. 1: "sleep 1; cowsay hello world | tee /tmp/hello_world.txt",
  2553. },
  2554. inputsparameters: [],
  2555. inputsartifacts: [],
  2556. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  2557. //应对应input中的各项参数设置对应参数
  2558. argumentsparameters: [],
  2559. argumentsartifacts: [],
  2560. outputsparameters: [],
  2561. outputsartifacts: [
  2562. //此container 输出的参数,固定
  2563. {
  2564. name: "hello-art",
  2565. path: "/tmp/hello_world.txt",
  2566. },
  2567. ],
  2568. //获取到的连接线源的数据 连接线的源的输出数据
  2569. sourcedatalist: [
  2570. // {
  2571. // name: "source1",
  2572. // },
  2573. // {
  2574. // name: "source2",
  2575. // },
  2576. ],
  2577. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  2578. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  2579. },
  2580. });
  2581. // 轮廓识别代码示例,需重新更改节点数据格式
  2582. const zdocker_test = this.graph.createNode({
  2583. // width: 170,
  2584. // height: 30,
  2585. shape: "template-node",
  2586. // label: "consume_artifact",
  2587. attrs: {
  2588. label: {
  2589. text: "zdockertest",
  2590. },
  2591. body: {
  2592. // stroke: "#2CB9FF",
  2593. // fill: "#2CB9FF",
  2594. fill: "#d3ebf3",
  2595. },
  2596. // body: {
  2597. // stroke: "#DA2625",
  2598. // fill: "#DA2625",
  2599. // },
  2600. image: {
  2601. "xlink:href":
  2602. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  2603. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  2604. //可放图标
  2605. },
  2606. },
  2607. data: {
  2608. nodeName: "zdockertest",
  2609. templateName: "print-message",
  2610. templateImage: "zvinjodocker/zdockertest1:20211011",
  2611. templateCommand: {
  2612. // 1: "sh",
  2613. // 2: "-c",
  2614. // 2:"\"{{inputs.parameters.message}}\""
  2615. },
  2616. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  2617. // templateCommand2: [
  2618. // {
  2619. // 1:"echo"
  2620. // },
  2621. // {
  2622. // 2:"{{inputs.parameters.message}}"
  2623. // },
  2624. // ],
  2625. templateArgs: {
  2626. // 1: "cat /tmp/message",
  2627. },
  2628. inputsparameters: [],
  2629. inputsartifacts: [
  2630. //此container 需要输入的参数,固定
  2631. // {
  2632. // name: "message",
  2633. // path: "/tmp/message",
  2634. // },
  2635. ],
  2636. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  2637. //应对应input中的各项参数设置对应参数
  2638. argumentsparameters: [],
  2639. argumentsartifacts: [
  2640. //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  2641. // {
  2642. // name: "message",
  2643. // valuefrom: "{{tasks.whalesay.outputs.artifacts.hello-art}}",
  2644. // },
  2645. ],
  2646. outputsparameters: [],
  2647. outputsartifacts: [],
  2648. //获取到的连接线源的数据 连接线的源的输出数据
  2649. sourcedatalist: [
  2650. // {
  2651. // name: "source1",
  2652. // },
  2653. // {
  2654. // name: "source2",
  2655. // },
  2656. ],
  2657. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  2658. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  2659. },
  2660. });
  2661. const contourTask1 = this.graph.createNode({
  2662. // width: 170,
  2663. // height: 30,
  2664. shape: "template-node",
  2665. // label: "consume_artifact",
  2666. attrs: {
  2667. label: {
  2668. text: "contourTask1",
  2669. },
  2670. body: {
  2671. // stroke: "#2CB9FF",
  2672. // fill: "#2CB9FF",
  2673. fill: "#d3ebf3",
  2674. },
  2675. // body: {
  2676. // stroke: "#DA2625",
  2677. // fill: "#DA2625",
  2678. // },
  2679. image: {
  2680. "xlink:href":
  2681. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  2682. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  2683. //可放图标
  2684. },
  2685. },
  2686. data: {
  2687. nodeName: "contourTask1",
  2688. templateName: "contourTask1",
  2689. templateImage: "zvinjodocker/contous_task1:20211014",
  2690. templateCommand: {
  2691. // 1: "sh",
  2692. // 2: "-c",
  2693. // 2:"\"{{inputs.parameters.message}}\""
  2694. },
  2695. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  2696. // templateCommand2: [
  2697. // {
  2698. // 1:"echo"
  2699. // },
  2700. // {
  2701. // 2:"{{inputs.parameters.message}}"
  2702. // },
  2703. // ],
  2704. templateArgs: {
  2705. // 1: "cat /tmp/message",
  2706. },
  2707. inputsparameters: [],
  2708. inputsartifacts: [
  2709. //此container 需要输入的参数,固定
  2710. // {
  2711. // name: "message",
  2712. // path: "/tmp/message",
  2713. // },
  2714. ],
  2715. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  2716. //应对应input中的各项参数设置对应参数
  2717. argumentsparameters: [],
  2718. argumentsartifacts: [
  2719. //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  2720. // {
  2721. // name: "message",
  2722. // valuefrom: "{{tasks.whalesay.outputs.artifacts.hello-art}}",
  2723. // },
  2724. ],
  2725. outputsparameters: [],
  2726. outputsartifacts: [
  2727. {
  2728. paraname: "thresh",
  2729. paradesc: "",
  2730. paratype: "",
  2731. // path: "/myapps/thresh1.png",
  2732. valuefrom: "/myapps/thresh1.png",
  2733. },
  2734. {
  2735. paraname: "contours",
  2736. // path: "/myapps/contours.png",
  2737. paradesc: "",
  2738. paratype: "",
  2739. valuefrom: "/myapps/contours.png",
  2740. },
  2741. ],
  2742. //获取到的连接线源的数据 连接线的源的输出数据
  2743. sourcedatalist: [
  2744. // {
  2745. // name: "source1",
  2746. // },
  2747. // {
  2748. // name: "source2",
  2749. // },
  2750. ],
  2751. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  2752. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  2753. },
  2754. });
  2755. const contourTask2 = this.graph.createNode({
  2756. // width: 170,
  2757. // height: 30,
  2758. shape: "template-node",
  2759. attrs: {
  2760. label: {
  2761. text: "contourTask2",
  2762. },
  2763. body: {
  2764. // stroke: "#2CB9FF",
  2765. // fill: "#2CB9FF",
  2766. fill: "#d3ebf3",
  2767. },
  2768. image: {
  2769. "xlink:href":
  2770. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  2771. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  2772. //可放图标
  2773. },
  2774. },
  2775. data: {
  2776. nodeName: "contourTask2",
  2777. templateName: "contourTask2",
  2778. templateImage: "zvinjodocker/contours_task2:20211014",
  2779. templateCommand: {},
  2780. templateArgs: {},
  2781. inputsparameters: [],
  2782. inputsartifacts: [
  2783. {
  2784. paraname: "thresh",
  2785. parapath: "/myapps/thresh1.png",
  2786. paradesc: "",
  2787. },
  2788. {
  2789. paraname: "contours",
  2790. parapath: "/myapps/contours.png",
  2791. paradesc: "",
  2792. },
  2793. ],
  2794. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  2795. //应对应input中的各项参数设置对应参数
  2796. argumentsparameters: [],
  2797. argumentsartifacts: [
  2798. {
  2799. paraname: "thresh",
  2800. valuefrom: "{{tasks.contourTask1.outputs.artifacts.thresh}}",
  2801. fileurls: [],
  2802. },
  2803. {
  2804. paraname: "contours",
  2805. valuefrom: "{{tasks.contourTask1.outputs.artifacts.contours}}",
  2806. fileurls: [],
  2807. },
  2808. ],
  2809. outputsparameters: [],
  2810. outputsartifacts: [
  2811. {
  2812. paraname: "contours0",
  2813. // path: "/myapps/contours[0].npy",
  2814. valuefrom: "/myapps/contours[0].npy",
  2815. paradesc: "",
  2816. paratype: "",
  2817. },
  2818. {
  2819. paraname: "res",
  2820. // path: "/myapps/res1.png",
  2821. valuefrom: "/myapps/res1.png",
  2822. paradesc: "",
  2823. paratype: "",
  2824. },
  2825. ],
  2826. //获取到的连接线源的数据 连接线的源的输出数据
  2827. sourcedatalist: [],
  2828. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  2829. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  2830. },
  2831. });
  2832. const contourTask3 = this.graph.createNode({
  2833. // width: 170,
  2834. // height: 30,
  2835. shape: "template-node",
  2836. // label: "consume_artifact",
  2837. attrs: {
  2838. label: {
  2839. text: "contourTask3",
  2840. },
  2841. body: {
  2842. // stroke: "#2CB9FF",
  2843. // fill: "#2CB9FF",
  2844. fill: "#d3ebf3",
  2845. },
  2846. image: {
  2847. "xlink:href":
  2848. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  2849. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  2850. //可放图标
  2851. },
  2852. },
  2853. data: {
  2854. nodeName: "contourTask3",
  2855. templateName: "contourTask3",
  2856. templateImage: "zvinjodocker/contours_task3:20211015",
  2857. templateCommand: {},
  2858. templateArgs: {},
  2859. inputsparameters: [],
  2860. inputsartifacts: [
  2861. {
  2862. paraname: "contours0",
  2863. parapath: "/myapps/contours[0].npy",
  2864. paradesc: "",
  2865. },
  2866. ],
  2867. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  2868. //应对应input中的各项参数设置对应参数
  2869. argumentsparameters: [],
  2870. argumentsartifacts: [
  2871. {
  2872. paraname: "contours0",
  2873. valuefrom: "{{tasks.contourTask2.outputs.artifacts.contours0}}",
  2874. fileurls: [],
  2875. },
  2876. ],
  2877. outputsparameters: [],
  2878. outputsartifacts: [],
  2879. //获取到的连接线源的数据 连接线的源的输出数据
  2880. sourcedatalist: [],
  2881. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  2882. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  2883. },
  2884. });
  2885. const contourApproximate1 = this.graph.createNode({
  2886. // width: 170,
  2887. // height: 30,
  2888. shape: "template-node",
  2889. // label: "consume_artifact",
  2890. attrs: {
  2891. label: {
  2892. text: "contourApproximate1",
  2893. },
  2894. body: {
  2895. // stroke: "#2CB9FF",
  2896. // fill: "#2CB9FF",
  2897. fill: "#d3ebf3",
  2898. },
  2899. image: {
  2900. "xlink:href":
  2901. "https://gw.alipayobjects.com/zos/bmw-prod/c36fe7cb-dc24-4854-aeb5-88d8dc36d52e.svg",
  2902. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  2903. //可放图标
  2904. },
  2905. },
  2906. data: {
  2907. nodeName: "contourApproximate1",
  2908. templateName: "contourApproximate1",
  2909. templateImage: "zvinjodocker/contour_approximate1:20211015",
  2910. templateCommand: {},
  2911. templateArgs: {},
  2912. inputsparameters: [],
  2913. inputsartifacts: [],
  2914. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  2915. //应对应input中的各项参数设置对应参数
  2916. argumentsparameters: [],
  2917. argumentsartifacts: [],
  2918. outputsparameters: [],
  2919. outputsartifacts: [
  2920. {
  2921. paraname: "approxCnt",
  2922. // path: "/myapps/approx_cnt.npy",
  2923. valuefrom: "/myapps/approx_cnt.npy",
  2924. paradesc: "",
  2925. paratype: "",
  2926. },
  2927. {
  2928. paraname: "approxRes",
  2929. // path: "/myapps/approx_res.png",
  2930. valuefrom: "/myapps/approx_res.png",
  2931. paradesc: "",
  2932. paratype: "",
  2933. },
  2934. ],
  2935. //获取到的连接线源的数据 连接线的源的输出数据
  2936. sourcedatalist: [],
  2937. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  2938. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  2939. },
  2940. });
  2941. console.log("创建节点 contour_approximate1成功");
  2942. const contourApproximate2 = this.graph.createNode({
  2943. // width: 170,
  2944. // height: 30,
  2945. shape: "template-node",
  2946. // label: "consume_artifact",
  2947. attrs: {
  2948. label: {
  2949. text: "contourApproximate2",
  2950. },
  2951. body: {
  2952. // stroke: "#2CB9FF",
  2953. // fill: "#2CB9FF",
  2954. fill: "#d3ebf3",
  2955. },
  2956. // body: {
  2957. // stroke: "#DA2625",
  2958. // fill: "#DA2625",
  2959. // },
  2960. image: {
  2961. "xlink:href":
  2962. "https://gw.alipayobjects.com/zos/bmw-prod/c55d7ae1-8d20-4585-bd8f-ca23653a4489.svg",
  2963. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  2964. //可放图标
  2965. },
  2966. },
  2967. data: {
  2968. nodeName: "contourApproximate2",
  2969. templateName: "contourApproximate2",
  2970. templateImage: "zvinjodocker/contour_approximate2:20211015",
  2971. templateCommand: {
  2972. // 1: "sh",
  2973. // 2: "-c",
  2974. // 2:"\"{{inputs.parameters.message}}\""
  2975. },
  2976. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  2977. // templateCommand2: [
  2978. // {
  2979. // 1:"echo"
  2980. // },
  2981. // {
  2982. // 2:"{{inputs.parameters.message}}"
  2983. // },
  2984. // ],
  2985. templateArgs: {
  2986. // 1: "cat /tmp/message",
  2987. },
  2988. inputsparameters: [],
  2989. inputsartifacts: [
  2990. //此container 需要输入的参数,固定
  2991. // {
  2992. // name: "message",
  2993. // path: "/tmp/message",
  2994. // },
  2995. {
  2996. paraname: "approxCnt",
  2997. parapath: "/myapps/approx_cnt.npy",
  2998. paradesc: "",
  2999. },
  3000. ],
  3001. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  3002. //应对应input中的各项参数设置对应参数
  3003. argumentsparameters: [],
  3004. argumentsartifacts: [
  3005. //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  3006. // {
  3007. // name: "message",
  3008. // valuefrom: "{{tasks.whalesay.outputs.artifacts.hello-art}}",
  3009. // },
  3010. {
  3011. paraname: "approxCnt",
  3012. valuefrom:
  3013. "{{tasks.contourApproximate1.outputs.artifacts.approxCnt}}",
  3014. fileurls: [],
  3015. },
  3016. ],
  3017. outputsparameters: [],
  3018. outputsartifacts: [
  3019. // {
  3020. // name: "thresh",
  3021. // path: "/myapps/thresh1.png",
  3022. // },
  3023. // {
  3024. // name: "contours",
  3025. // path: "/myapps/contours.png",
  3026. // },
  3027. {
  3028. paraname: "approxRes2",
  3029. // path: "/myapps/approx_res2.png",
  3030. valuefrom: "/myapps/approx_res2.png",
  3031. paradesc: "",
  3032. paratype: "",
  3033. },
  3034. ],
  3035. //获取到的连接线源的数据 连接线的源的输出数据
  3036. sourcedatalist: [
  3037. // {
  3038. // name: "source1",
  3039. // },
  3040. // {
  3041. // name: "source2",
  3042. // },
  3043. ],
  3044. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  3045. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  3046. },
  3047. });
  3048. console.log("创建节点 contour_approximate2成功");
  3049. const contourRect1 = this.graph.createNode({
  3050. // width: 170,
  3051. // height: 30,
  3052. shape: "template-node",
  3053. // label: "consume_artifact",
  3054. attrs: {
  3055. label: {
  3056. text: "contourRect1",
  3057. },
  3058. body: {
  3059. // stroke: "#2CB9FF",
  3060. // fill: "#2CB9FF",
  3061. fill: "#d3ebf3",
  3062. },
  3063. // body: {
  3064. // stroke: "#DA2625",
  3065. // fill: "#DA2625",
  3066. // },
  3067. image: {
  3068. "xlink:href":
  3069. "https://gw.alipayobjects.com/zos/bmw-prod/dc1ced06-417d-466f-927b-b4a4d3265791.svg",
  3070. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  3071. //可放图标
  3072. },
  3073. },
  3074. data: {
  3075. nodeName: "contourRect1",
  3076. templateName: "contourRect1",
  3077. templateImage: "zvinjodocker/contours_rect1:20211015",
  3078. templateCommand: {
  3079. // 1: "sh",
  3080. // 2: "-c",
  3081. // 2:"\"{{inputs.parameters.message}}\""
  3082. },
  3083. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  3084. // templateCommand2: [
  3085. // {
  3086. // 1:"echo"
  3087. // },
  3088. // {
  3089. // 2:"{{inputs.parameters.message}}"
  3090. // },
  3091. // ],
  3092. templateArgs: {
  3093. // 1: "cat /tmp/message",
  3094. },
  3095. inputsparameters: [],
  3096. inputsartifacts: [
  3097. //此container 需要输入的参数,固定
  3098. // {
  3099. // name: "message",
  3100. // path: "/tmp/message",
  3101. // },
  3102. ],
  3103. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  3104. //应对应input中的各项参数设置对应参数
  3105. argumentsparameters: [],
  3106. argumentsartifacts: [
  3107. //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  3108. // {
  3109. // name: "message",
  3110. // valuefrom: "{{tasks.whalesay.outputs.artifacts.hello-art}}",
  3111. // },
  3112. ],
  3113. outputsparameters: [],
  3114. outputsartifacts: [
  3115. // {
  3116. // name: "thresh",
  3117. // path: "/myapps/thresh1.png",
  3118. // },
  3119. // {
  3120. // name: "contours",
  3121. // path: "/myapps/contours.png",
  3122. // },
  3123. {
  3124. paraname: "cnt",
  3125. // path: "/myapps/contour_rect_cnt.npy",
  3126. valuefrom: "/myapps/contour_rect_cnt.npy",
  3127. paradesc: "",
  3128. paratype: "",
  3129. },
  3130. {
  3131. paraname: "contourRect",
  3132. // path: "/myapps/contour_rect.png",
  3133. valuefrom: "/myapps/contour_rect.png",
  3134. paradesc: "",
  3135. paratype: "",
  3136. },
  3137. ],
  3138. //获取到的连接线源的数据 连接线的源的输出数据
  3139. sourcedatalist: [
  3140. // {
  3141. // name: "source1",
  3142. // },
  3143. // {
  3144. // name: "source2",
  3145. // },
  3146. ],
  3147. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  3148. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  3149. },
  3150. });
  3151. console.log("创建节点 contour_rect1成功");
  3152. const contourCircle2 = this.graph.createNode({
  3153. // width: 170,
  3154. // height: 30,
  3155. shape: "template-node",
  3156. // label: "consume_artifact",
  3157. attrs: {
  3158. label: {
  3159. text: "contourCircle2",
  3160. },
  3161. body: {
  3162. // stroke: "#2CB9FF",
  3163. // fill: "#2CB9FF",
  3164. fill: "#d3ebf3",
  3165. },
  3166. // body: {
  3167. // stroke: "#DA2625",
  3168. // fill: "#DA2625",
  3169. // },
  3170. image: {
  3171. "xlink:href":
  3172. "https://gw.alipayobjects.com/zos/bmw-prod/687b6cb9-4b97-42a6-96d0-34b3099133ac.svg",
  3173. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logogetworkflowlog-with-text-73b8a.svg",
  3174. //可放图标
  3175. },
  3176. },
  3177. data: {
  3178. nodeName: "contourCircle2",
  3179. templateName: "contourCircle2",
  3180. templateImage: "zvinjodocker/contours_circle2:20211015",
  3181. templateCommand: {
  3182. // 1: "sh",
  3183. // 2: "-c",
  3184. // 2:"\"{{inputs.parameters.message}}\""
  3185. },
  3186. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  3187. // templateCommand2: [
  3188. // {
  3189. // 1:"echo"
  3190. // },
  3191. // {
  3192. // 2:"{{inputs.parameters.message}}"
  3193. // },
  3194. // ],
  3195. templateArgs: {
  3196. // 1: "cat /tmp/message",
  3197. },
  3198. inputsparameters: [],
  3199. inputsartifacts: [
  3200. //此container 需要输入的参数,固定
  3201. // {
  3202. // name: "message",
  3203. // path: "/tmp/message",
  3204. // },
  3205. {
  3206. paraname: "contourRect",
  3207. parapath: "/myapps/contour_rect.png",
  3208. paradesc: "",
  3209. },
  3210. {
  3211. paraname: "cnt",
  3212. parapath: "/myapps/contour_rect_cnt.npy",
  3213. paradesc: "",
  3214. },
  3215. ],
  3216. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  3217. //应对应input中的各项参数设置对应参数
  3218. argumentsparameters: [],
  3219. argumentsartifacts: [
  3220. //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  3221. // {
  3222. // name: "message",
  3223. // valuefrom: "{{tasks.whalesay.outputs.artifacts.hello-art}}",
  3224. // },
  3225. {
  3226. paraname: "contourRect",
  3227. valuefrom: "{{tasks.contourRect1.outputs.artifacts.contourRect}}",
  3228. fileurls: [],
  3229. },
  3230. {
  3231. paraname: "cnt",
  3232. valuefrom: "{{tasks.contourRect1.outputs.artifacts.cnt}}",
  3233. fileurls: [],
  3234. },
  3235. ],
  3236. outputsparameters: [],
  3237. outputsartifacts: [
  3238. // {
  3239. // name: "thresh",
  3240. // path: "/myapps/thresh1.png",
  3241. // },
  3242. // {
  3243. // name: "contours",
  3244. // path: "/myapps/contours.png",
  3245. // },
  3246. {
  3247. paraname: "contourCircle",
  3248. valuefrom: "contour_circle.png",
  3249. // path: "contour_circle.png",
  3250. paradesc: "",
  3251. paratype: "",
  3252. },
  3253. ],
  3254. //获取到的连接线源的数据 连接线的源的输出数据
  3255. sourcedatalist: [
  3256. // {
  3257. // name: "source1",
  3258. // },
  3259. // {
  3260. // name: "source2",
  3261. // },
  3262. ],
  3263. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  3264. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  3265. },
  3266. });
  3267. // console.log("创建节点 contour_circle2成功");
  3268. console.log("创建节点 algoinputnode");
  3269. const dataInputnode = this.graph.createNode({
  3270. // width: 170,
  3271. // height: 30,
  3272. shape: "template-input",
  3273. // label: "consume_artifact",
  3274. attrs: {
  3275. label: {
  3276. text: "dataInputnode",
  3277. },
  3278. body: {
  3279. // stroke: "#2CB9FF",
  3280. // fill: "#2CB9FF",
  3281. fill: "#e2c3a0",
  3282. },
  3283. // body: {
  3284. // stroke: "#DA2625",
  3285. // fill: "#DA2625",
  3286. // },
  3287. image: {
  3288. "xlink:href":
  3289. "https://gw.alipayobjects.com/zos/bmw-prod/687b6cb9-4b97-42a6-96d0-34b3099133ac.svg",
  3290. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  3291. //可放图标
  3292. },
  3293. },
  3294. data: {
  3295. nodeName: "dataInputnode",
  3296. templateName: "dataInputnode",
  3297. st_dataListvalue: [], //静态数据集选中 文件对应value
  3298. dy_dataListvalue: [], //动态数据集选中 文件对应value
  3299. fileList: [], //外部上传 文件
  3300. allfilemap: null, //选中的文件对应的名称及url
  3301. },
  3302. });
  3303. const dataOutputnode = this.graph.createNode({
  3304. // width: 170,
  3305. // height: 30,
  3306. shape: "template-output",
  3307. // label: "consume_artifact",
  3308. attrs: {
  3309. label: {
  3310. text: "dataOutputnode",
  3311. },
  3312. body: {
  3313. // stroke: "#2CB9FF",
  3314. // fill: "#2CB9FF",
  3315. fill: "#e2c3a0",
  3316. },
  3317. // body: {
  3318. // stroke: "#DA2625",
  3319. // fill: "#DA2625",
  3320. // },
  3321. image: {
  3322. "xlink:href":
  3323. "https://gw.alipayobjects.com/zos/bmw-prod/687b6cb9-4b97-42a6-96d0-34b3099133ac.svg",
  3324. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  3325. //可放图标
  3326. },
  3327. },
  3328. data: {
  3329. nodeName: "dataOutputnode",
  3330. templateName: "dataOutputnode",
  3331. sourcealgocell: null, //输出节点的前一个节点的结果
  3332. },
  3333. });
  3334. //创建CSV文件转换节点
  3335. const CSVConversionnode = this.graph.createNode({
  3336. // width: 170,
  3337. // height: 30,
  3338. shape: "template-csvselect",
  3339. // label: "consume_artifact",
  3340. attrs: {
  3341. label: {
  3342. text: "CSVConversionnode",
  3343. },
  3344. body: {
  3345. // stroke: "#2CB9FF",
  3346. // fill: "#2CB9FF",
  3347. fill: "#e2c3a0",
  3348. },
  3349. // body: {
  3350. // stroke: "#DA2625",
  3351. // fill: "#DA2625",
  3352. // },
  3353. image: {
  3354. "xlink:href":
  3355. "https://gw.alipayobjects.com/zos/bmw-prod/687b6cb9-4b97-42a6-96d0-34b3099133ac.svg",
  3356. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  3357. //可放图标
  3358. },
  3359. },
  3360. data: {
  3361. nodeName: "CSVConversionnode",
  3362. templateName: "CSVConversionnode",
  3363. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  3364. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  3365. allfilemap: null, //选中的文件对应的名称及url
  3366. },
  3367. });
  3368. //20211012 zhang
  3369. console.log("nodedata");
  3370. // console.log(this.nodedata)
  3371. this.nodedata.push(consume_artifact);
  3372. this.nodedata.push(generate_artifact);
  3373. this.nodedata.push(zdocker_test);
  3374. this.nodedata.push(contourTask1);
  3375. this.nodedata.push(contourTask2);
  3376. this.nodedata.push(contourTask3);
  3377. this.nodedata.push(contourApproximate1);
  3378. this.nodedata.push(contourApproximate2);
  3379. this.nodedata.push(contourRect1);
  3380. this.nodedata.push(contourCircle2);
  3381. //数据输入 和 结果输出节点
  3382. this.nodedata.push(dataInputnode);
  3383. this.nodedata.push(dataOutputnode);
  3384. this.nodedata.push(CSVConversionnode);
  3385. console.log(this.nodedata);
  3386. //设置布局左右可拖动
  3387. let me = this;
  3388. me.dragControllerDiv();
  3389. console.log("yu");
  3390. },
  3391. methods: {
  3392. initGraph(info) {
  3393. //修改当前画布
  3394. //查询画布数据,导入画布
  3395. this.workflowId = info.workflowId;
  3396. this.graph.fromJSON(JSON.parse(info.graphJson).cells);
  3397. console.log("fromJson"+info.graphJson)
  3398. console.log(JSON.parse(info.graphJson).cells)
  3399. },
  3400. createGraph() {
  3401. const graph = new Graph({
  3402. grid: true,
  3403. container: document.getElementById("container"),
  3404. // width: 1270,
  3405. // width: 1200,
  3406. // height: 750,
  3407. autoResize: true,
  3408. // panning: {
  3409. // enabled: true,
  3410. // },
  3411. resizing: {
  3412. enabled: true,
  3413. },
  3414. // model: {},
  3415. history: true, //uodo和redo
  3416. highlighting: {
  3417. nodeAvailable: {
  3418. //连线过程中,节点可以被链接时被使用。
  3419. name: "className",
  3420. args: {
  3421. className: "available",
  3422. },
  3423. },
  3424. magnetAvailable: {
  3425. //连线过程中,链接桩可以被链接时被使用。
  3426. name: "className",
  3427. args: {
  3428. className: "available",
  3429. },
  3430. },
  3431. magnetAdsorbed: {
  3432. //连线过程中,自动吸附到链接桩时被使用。
  3433. name: "className",
  3434. args: {
  3435. className: "adsorbed",
  3436. },
  3437. },
  3438. },
  3439. scroller: {
  3440. enabled: true,
  3441. pannable: true,
  3442. },
  3443. mousewheel: {
  3444. enabled: true,
  3445. modifiers: ["ctrl", "meta"],
  3446. },
  3447. clipboard: {
  3448. enabled: true,
  3449. useLocalStorage: true,
  3450. },
  3451. keyboard: {
  3452. enabled: true,
  3453. global: true,
  3454. }, //快捷键
  3455. selecting: {
  3456. enabled: true,
  3457. showNodeSelectionBox: true,
  3458. // showEdgeSelectionBox: true,
  3459. }, //选中 ,框选
  3460. //节点与边交互
  3461. translating: {
  3462. restrict: true, //限制节点不能移动超出画布区域
  3463. },
  3464. connecting: {
  3465. snap: true, //连线距离节点或者连接桩 50px 时会触发自动吸附
  3466. allowBlank: false,
  3467. allowLoop: false,
  3468. highlight: true,
  3469. sourceAnchor: {
  3470. //指定源节点的锚点
  3471. name: "bottom",
  3472. },
  3473. targetAnchor: {
  3474. //指定目标节点的锚点
  3475. name: "center",
  3476. },
  3477. connectionPoint: "anchor",
  3478. // connector: "algo-edge",
  3479. createEdge() {
  3480. return graph.createEdge({
  3481. //更新连接边edge样式
  3482. router: {
  3483. // name: "orth",
  3484. name: "er",
  3485. args: {
  3486. offset: "center",
  3487. },
  3488. },
  3489. attrs: {
  3490. line: {
  3491. // strokeDasharray: "5 5", //虚线
  3492. stroke: "#808080",
  3493. strokeWidth: 1,
  3494. targetMarker: {
  3495. name: "block",
  3496. args: {
  3497. size: "6",
  3498. },
  3499. },
  3500. },
  3501. },
  3502. //在指定的位置处,渲染一个删除按钮,点击时删除对应的边。
  3503. tools: {
  3504. name: "button-remove",
  3505. args: { distance: -40 },
  3506. },
  3507. });
  3508. },
  3509. validateMagnet({ magnet }) {
  3510. return magnet.getAttribute("port-group") !== "in";
  3511. },
  3512. validateConnection({
  3513. sourceView,
  3514. targetView,
  3515. sourceMagnet,
  3516. targetMagnet,
  3517. }) {
  3518. // 只能从输出链接桩创建连接
  3519. if (
  3520. !sourceMagnet ||
  3521. sourceMagnet.getAttribute("port-group") === "in"
  3522. ) {
  3523. return false;
  3524. }
  3525. // 只能连接到输入链接桩
  3526. if (
  3527. !targetMagnet ||
  3528. targetMagnet.getAttribute("port-group") !== "in"
  3529. ) {
  3530. return false;
  3531. }
  3532. // 判断目标链接桩是否可连接
  3533. const portId = targetMagnet.getAttribute("port");
  3534. const node = targetView.cell;
  3535. const port = node.getPort(portId);
  3536. if (port && port.connected) {
  3537. // if (port && port.connected) {
  3538. return false;
  3539. }
  3540. return true;
  3541. },
  3542. },
  3543. });
  3544. // 创建 Graph 的实例
  3545. // const graph = new Graph({
  3546. // container: document.getElementById("container"),
  3547. // width: 1380,
  3548. // height: 750,
  3549. // background: {
  3550. // // color: "#f7f7f4", //设置画布背景颜色
  3551. // color: "#ffffff",
  3552. // },
  3553. // grid: {
  3554. // size: 8,
  3555. // visible: true,
  3556. // }, //网格
  3557. // history: true, //uodo和redo
  3558. // //滚动条
  3559. // // scroller: {
  3560. // // enabled: true,
  3561. // // // pannable: true,
  3562. // // // pageVisible: true,
  3563. // // // pageBreak: false,
  3564. // // },
  3565. // mousewheel: {
  3566. // enabled: true,
  3567. // modifiers: ["ctrl", "meta"],
  3568. // },
  3569. // // clipboard: true, //剪切板
  3570. // clipboard: {
  3571. // enabled: true,
  3572. // useLocalStorage: true,
  3573. // },
  3574. // keyboard: {
  3575. // enabled: true,
  3576. // global: true,
  3577. // }, //快捷键
  3578. // selecting: {
  3579. // enabled: true,
  3580. // showNodeSelectionBox: true,
  3581. // // showEdgeSelectionBox: true,
  3582. // }, //选中 ,框选
  3583. // //节点与边交互
  3584. // translating: {
  3585. // restrict: true, //限制节点不能移动超出画布区域
  3586. // },
  3587. // //连线规则
  3588. // connecting: {
  3589. // snap: true,
  3590. // allowBlank: false, //不允许连接到画布空白位置
  3591. // allowMulti: false, //不允许在相同节点之间创建多条边
  3592. // },
  3593. // });
  3594. this.graph = graph;
  3595. this.history = graph.history; //Redo Undo
  3596. },
  3597. onCollapse(collapsed, type) {
  3598. console.log(collapsed, type);
  3599. },
  3600. onBreakpoint(broken) {
  3601. console.log(broken);
  3602. },
  3603. onUndo() {
  3604. this.history.undo();
  3605. console.log("undo");
  3606. },
  3607. onRedo() {
  3608. this.history.redo();
  3609. console.log("redo");
  3610. },
  3611. onCancel() {
  3612. MessageBox.confirm(`确定进行[退出]操作?`, "提示", {
  3613. confirmButtonText: "确定",
  3614. cancelButtonText: "取消",
  3615. type: "warning",
  3616. })
  3617. .then(() => {
  3618. console.log("任务取消")
  3619. console.log(this.workflowName);
  3620. //确定取消任务后的操作
  3621. if(this.workflowstatustag.name == "Running" && this.workflowName!=""){
  3622. this.$http({
  3623. url: this.$http.adornUrl("/visi/visiworkflow/stopworkflow"),
  3624. method: "post",
  3625. data: this.$http.adornData({workflowName: this.workflowName}),
  3626. }).then(({ data }) => {
  3627. if (data && data.code === 0) {
  3628. this.workflowStatus = data.statusPhase;
  3629. if(this.workflowStatus == "Failed"){
  3630. Message.success("任务已取消");
  3631. }
  3632. console.log("任务已取消")
  3633. }
  3634. });
  3635. }
  3636. })
  3637. .catch(() => {});
  3638. },
  3639. onRun() {
  3640. console.log("graph.toJSON()");
  3641. console.log(this.graph.toJSON());
  3642. // console.log(JSON.stringify(this.graph.toJSON()));
  3643. MessageBox.confirm(`确定进行[提交]操作?`, "提示", {
  3644. confirmButtonText: "确定",
  3645. cancelButtonText: "取消",
  3646. type: "warning",
  3647. })
  3648. .then(() => {
  3649. this.$http({
  3650. url: this.$http.adornUrl("/visi/visiworkflow/submit"),
  3651. method: "post",
  3652. data: this.$http.adornData({
  3653. graphJson: JSON.stringify(this.graph.toJSON()),
  3654. workflowId: this.workflowId,
  3655. experimentName: this.experimentName,
  3656. addorupdate: this.addorupdate,
  3657. }
  3658. ),
  3659. }).then(({ data }) => {
  3660. if (data && data.code === 0) {
  3661. this.workflowName = data.workflowName;
  3662. this.idTemplateNameMap = data.idTemplateNameMap; //节点id与 DAG中task和Template 的对应关系
  3663. this.workflowId = data.workflowId;//若为新增,返回新增的主键ID workflowId
  3664. // 迭代属性名称:
  3665. for (let nodeid of Object.keys(this.idTemplateNameMap)) {
  3666. var tempname = this.idTemplateNameMap[nodeid];
  3667. this.graph
  3668. .getCellById(nodeid)
  3669. .setData({ wftempname: tempname }); //temp后端已向末尾添加随机数
  3670. }
  3671. Message.success("提交成功");
  3672. // this.$message({
  3673. // message: "提交成功",
  3674. // type: "success",
  3675. // });
  3676. this.workflowstatustag.name = "Running";
  3677. this.workflowstatustag.type = "";
  3678. //查询运行状态
  3679. // this.getWorkflowStatus();
  3680. var intervalID = window.setInterval(() => {
  3681. this.getWorkflowStatus();
  3682. // 取消该定时设置
  3683. if (
  3684. this.workflowStatus == "Succeeded" ||
  3685. this.workflowStatus == "Error" ||
  3686. this.workflowStatus == "Failed"
  3687. ) {
  3688. if (this.workflowStatus == "Succeeded") {
  3689. this.workflowstatustag.name = "Succeeded";
  3690. this.workflowstatustag.type = "success";
  3691. } else if (
  3692. this.workflowStatus == "Error" ||
  3693. this.workflowStatus == "Failed"
  3694. ) {
  3695. this.workflowstatustag.name = "Failed";
  3696. this.workflowstatustag.type = "danger";
  3697. }
  3698. window.clearInterval(intervalID);
  3699. }
  3700. }, 5000);
  3701. } else {
  3702. Message.error("提交失败");
  3703. }
  3704. });
  3705. })
  3706. .catch(() => {});
  3707. // // 上方添加 按钮提示框
  3708. // this.$http({
  3709. // url: this.$http.adornUrl("/visi/visiworkflow/submit"),
  3710. // method: "post",
  3711. // data: this.$http.adornData(this.graph.toJSON()),
  3712. // }).then(({ data }) => {
  3713. // if (data && data.code === 0) {
  3714. // this.workflowName = data.workflowName;
  3715. // this.idTemplateNameMap = data.idTemplateNameMap; //节点id与 DAG中task和Template 的对应关系
  3716. // // 迭代属性名称:
  3717. // for (let nodeid of Object.keys(this.idTemplateNameMap)) {
  3718. // var tempname = this.idTemplateNameMap[nodeid];
  3719. // this.graph.getCellById(nodeid).setData({ wftempname: tempname }); //temp后端已向末尾添加随机数
  3720. // }
  3721. // Message.success("提交成功");
  3722. // // this.$message({
  3723. // // message: "提交成功",
  3724. // // type: "success",
  3725. // // });
  3726. // this.workflowstatustag.name = "Running";
  3727. // this.workflowstatustag.type = "";
  3728. // //查询运行状态
  3729. // // this.getWorkflowStatus();
  3730. // var intervalID = window.setInterval(() => {
  3731. // this.getWorkflowStatus();
  3732. // // 取消该定时设置
  3733. // if (
  3734. // this.workflowStatus == "Succeeded" ||
  3735. // this.workflowStatus == "Error" ||
  3736. // this.workflowStatus == "Failed"
  3737. // ) {
  3738. // if (this.workflowStatus == "Succeeded") {
  3739. // this.workflowstatustag.name = "Succeeded";
  3740. // this.workflowstatustag.type = "success";
  3741. // } else if (
  3742. // this.workflowStatus == "Error" ||
  3743. // this.workflowStatus == "Failed"
  3744. // ) {
  3745. // this.workflowstatustag.name = "Failed";
  3746. // this.workflowstatustag.type = "danger";
  3747. // }
  3748. // window.clearInterval(intervalID);
  3749. // }
  3750. // }, 5000);
  3751. // // // 取消该定时设置
  3752. // // if (
  3753. // // this.workflowStatus == "Succeeded" ||
  3754. // // this.workflowStatus == "Error" ||
  3755. // // this.workflowStatus == "Failed"
  3756. // // ) {
  3757. // // if (this.workflowStatus == "Succeeded") {
  3758. // // this.workflowstatustag.name = "Succeeded";
  3759. // // this.workflowstatustag.type = "success";
  3760. // // } else if (
  3761. // // this.workflowStatus == "Error" ||
  3762. // // this.workflowStatus == "Failed"
  3763. // // ) {
  3764. // // this.workflowstatustag.name = "Failed";
  3765. // // this.workflowstatustag.type = "danger";
  3766. // // }
  3767. // // window.clearInterval(intervalID);
  3768. // // }
  3769. // } else {
  3770. // Message.error("提交失败");
  3771. // // this.$message.error("提交失败");
  3772. // // this.$message.error(data.msg);
  3773. // }
  3774. // });
  3775. },
  3776. //20211109 测试 能否保存至数据库
  3777. onPrimary() {
  3778. MessageBox.confirm(`确定进行[保存]操作?`, "提示", {
  3779. confirmButtonText: "确定",
  3780. cancelButtonText: "取消",
  3781. type: "warning",
  3782. })
  3783. .then(() => {
  3784. this.$http({
  3785. url: this.$http.adornUrl("/visi/visiworkflow/save"),
  3786. method: "post",
  3787. data: this.$http.adornData({
  3788. userId: this.$store.state.user.id,
  3789. workflowId: undefined,
  3790. experimentName: this.experimentName,
  3791. workflowtempName: "",
  3792. workflowName: "",
  3793. graphJson: JSON.stringify(this.graph.toJSON()),
  3794. }),
  3795. }).then(({ data }) => {
  3796. if (data && data.code === 0) {
  3797. Message.success("操作成功");
  3798. // this.$message({
  3799. // message: "操作成功",
  3800. // type: "success",
  3801. // duration: 1500,
  3802. // onClose: () => {
  3803. // this.getDataList();
  3804. // },
  3805. // });
  3806. } else {
  3807. // Message.error();
  3808. // this.$message.error(data.msg);
  3809. }
  3810. });
  3811. })
  3812. .catch(() => {});
  3813. console.log(JSON.stringify(this.graph.toJSON()).length);
  3814. console.log(JSON.stringify(this.graph.toJSON()));
  3815. // this.$http({
  3816. // url: this.$http.adornUrl("/visi/visiworkflow/save"),
  3817. // method: "post",
  3818. // data: this.$http.adornData({
  3819. // userId: this.$store.state.user.id,
  3820. // workflowId: undefined,
  3821. // experimentName: "实验1",
  3822. // workflowtempName: "",
  3823. // workflowName: "",
  3824. // graphJson: JSON.stringify(this.graph.toJSON()),
  3825. // }),
  3826. // }).then(({ data }) => {
  3827. // if (data && data.code === 0) {
  3828. // Message.success("操作成功");
  3829. // // this.$message({
  3830. // // message: "操作成功",
  3831. // // type: "success",
  3832. // // duration: 1500,
  3833. // // onClose: () => {
  3834. // // this.getDataList();
  3835. // // },
  3836. // // });
  3837. // } else {
  3838. // // Message.error();
  3839. // // this.$message.error(data.msg);
  3840. // }
  3841. // });
  3842. },
  3843. //查询状态
  3844. getWorkflowStatus() {
  3845. this.$http({
  3846. url: this.$http.adornUrl("/visi/visiworkflow/getworkflowstatus"),
  3847. method: "get",
  3848. params: this.$http.adornParams({
  3849. workflowName: this.workflowName,
  3850. }),
  3851. }).then(({ data }) => {
  3852. this.workflowStatus = data.statusPhase;
  3853. console.log(this.workflowStatus);
  3854. if (this.workflowStatus == "Succeeded") {
  3855. this.workflowstatustag.name = "Succeeded";
  3856. this.workflowstatustag.type = "success";
  3857. } else if (
  3858. this.workflowStatus == "Error" ||
  3859. this.workflowStatus == "Failed"
  3860. ) {
  3861. this.workflowstatustag.name = "Failed";
  3862. this.workflowstatustag.type = "danger";
  3863. } else {
  3864. this.workflowstatustag.name = "Running";
  3865. this.workflowstatustag.type = "";
  3866. }
  3867. //Pending, Running, Succeeded, Skipped, Failed, Error
  3868. });
  3869. },
  3870. //20211111 添加设置每个算法节点 的输入输出设置模板
  3871. //获取代码模板
  3872. getParaTemp() {
  3873. this.paraTempVisible = true;
  3874. this.$nextTick(() => {
  3875. // this.$refs.paraTemp.init(this.measurepoint.join());
  3876. this.$refs.paraTemp.init();
  3877. });
  3878. },
  3879. // 清空当前画布
  3880. onCleargraph() {
  3881. this.graph.clearCells();
  3882. },
  3883. //画布内容居中
  3884. getgraphContentcenter() {
  3885. this.graph.centerContent();
  3886. },
  3887. //获取工作流完整日志
  3888. getworkflowContent() {
  3889. // console.log("graph.toJSON()");
  3890. // console.log(this.graph.toJSON());
  3891. // console.log(JSON.stringify(this.graph.toJSON()));
  3892. // this.$http({
  3893. // url: this.$http.adornUrl("/visi/visiworkflow/getpodlog"),
  3894. // method: "get",
  3895. // data: this.$http.adornData(this.workflowName,this.idTemplateNameMap),
  3896. // }).then(({ data }) => {
  3897. // if (data && data.code === 0) {
  3898. // this.workflowName = data.workflowName;
  3899. // this.workflowContentlog = data.workflowContent;
  3900. // this.podlogs = data.podlogs;
  3901. // console.log("workflowname");
  3902. // console.log(this.workflowName);
  3903. // console.log("workflowcontent")
  3904. // console.log(this.workflowContentlog);
  3905. // console.log("podlogs")
  3906. // console.log(this.podlogs);
  3907. // this.$message({
  3908. // message: "操作成功",
  3909. // type: "success",
  3910. // duration: 1500,
  3911. // onClose: () => {
  3912. // // this.getDataList(); //20211115 待更改 未应用,且不是该函数
  3913. // },
  3914. // });
  3915. // } else {
  3916. // this.$message.error(data.msg);
  3917. // }
  3918. // });
  3919. //获取日志正确代码,现改为弹窗显示
  3920. // if (this.workflowContentVisi) {
  3921. // this.workflowContentVisi = false;
  3922. // } else {
  3923. // this.workflowContentVisi = true;
  3924. // this.$http({
  3925. // url: this.$http.adornUrl("/visi/visiworkflow/getworkflowlog"),
  3926. // method: "get",
  3927. // params: this.$http.adornParams({
  3928. // workflowName: this.workflowName,
  3929. // }),
  3930. // })
  3931. // .then(({ data }) => {
  3932. // this.workflowContent = data.workflowContent;
  3933. // // this.podlogs = data.podlogs;
  3934. // console.log("workflowcontent");
  3935. // console.log(this.workflowContent);
  3936. // console.log(this.workflowContent.main);
  3937. // console.log(this.workflowContent.init);
  3938. // console.log(this.workflowContent.wait);
  3939. // // console.log("podlogs")
  3940. // // console.log(this.podlogs);
  3941. // })
  3942. // .then(() => {
  3943. // // this.visible = true
  3944. // // this.$nextTick(() => {
  3945. // // this.$refs['dataForm'].resetFields()
  3946. // // })
  3947. // });
  3948. // }
  3949. this.workflowContentVisi = true;
  3950. if (this.workflowName != "") {
  3951. this.$nextTick(() => {
  3952. this.$refs.getworkflowlog.init(this.workflowName);
  3953. });
  3954. } else {
  3955. this.$nextTick(() => {
  3956. this.$refs.getworkflowlog.init1();
  3957. });
  3958. }
  3959. },
  3960. //获取单个节点 日志
  3961. getnodepodContent() {
  3962. this.$http({
  3963. url: this.$http.adornUrl("/visi/visiworkflow/getpodlog"),
  3964. method: "get",
  3965. params: this.$http.adornParams({
  3966. workflowName: this.workflowName,
  3967. idTemplateNameMap: this.idTemplateNameMap,
  3968. nodeId: "",
  3969. }),
  3970. })
  3971. .then(({ data }) => {
  3972. // this.workflowContentlog = data.workflowContent;
  3973. // this.podlogs = data.podlogs;
  3974. // console.log("workflowcontent")
  3975. // console.log(this.workflowContentlog);
  3976. // console.log("podlogs")
  3977. // console.log(this.podlogs);
  3978. })
  3979. .then(() => {
  3980. // this.visible = true
  3981. // this.$nextTick(() => {
  3982. // this.$refs['dataForm'].resetFields()
  3983. // })
  3984. });
  3985. },
  3986. //单选控制 日志类型 main init wait
  3987. workflowcontainerchange(e) {
  3988. if (this.containertype == "main") {
  3989. this.workflowContentlog = this.workflowContent.main;
  3990. }
  3991. if (this.containertype == "init") {
  3992. this.workflowContentlog = this.workflowContent.init;
  3993. }
  3994. if (this.containertype == "wait") {
  3995. this.workflowContentlog = this.workflowContent.wait;
  3996. }
  3997. },
  3998. //获取代码示例---轮廓识别
  3999. onGetcontour() {
  4000. //20211129 暂时先注释,为轮廓识别案例
  4001. this.graph.fromJSON([
  4002. {
  4003. position: { x: 60, y: 280 },
  4004. size: { width: 90, height: 80 },
  4005. attrs: {
  4006. image: {
  4007. "xlink:href":
  4008. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4009. },
  4010. label: { text: "contourTask1" },
  4011. },
  4012. shape: "template-node",
  4013. data: {
  4014. nodeName: "contourTask1",
  4015. templateName: "contourTask1",
  4016. templateImage: "zvinjodocker/contous_task1:20211014",
  4017. templateCommand: {},
  4018. templateArgs: {},
  4019. algoparaInput: { userInput: [], getInput: [] },
  4020. algoparaOutput: [],
  4021. algoparaInputargu: { userInput: [], getInput: [] },
  4022. algonodeSource: [],
  4023. inputsparameters: [],
  4024. inputsartifacts: [],
  4025. argumentsparameters: [],
  4026. argumentsartifacts: [],
  4027. outputsparameters: [],
  4028. outputsartifacts: [
  4029. {
  4030. paraname: "thresh",
  4031. paradesc: "",
  4032. paratype: "",
  4033. valuefrom: "/myapps/thresh1.png",
  4034. },
  4035. {
  4036. paraname: "contours",
  4037. paradesc: "",
  4038. paratype: "",
  4039. valuefrom: "/myapps/contours.png",
  4040. },
  4041. ],
  4042. sourcedatalist: [],
  4043. sourceartilist: [],
  4044. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  4045. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  4046. },
  4047. ports: {
  4048. groups: {
  4049. in: {
  4050. position: "left",
  4051. attrs: {
  4052. circle: {
  4053. r: 2.5,
  4054. magnet: true,
  4055. stroke: "black",
  4056. strokeWidth: 1,
  4057. fill: "#fff",
  4058. style: { visibility: true },
  4059. },
  4060. },
  4061. },
  4062. out: {
  4063. position: "right",
  4064. attrs: {
  4065. circle: {
  4066. r: 2.5,
  4067. magnet: true,
  4068. stroke: "black",
  4069. strokeWidth: 1,
  4070. fill: "#fff",
  4071. },
  4072. },
  4073. },
  4074. },
  4075. items: [
  4076. { id: "inport1", group: "in" },
  4077. { id: "inport2", group: "in" },
  4078. { id: "outport1", group: "out" },
  4079. { id: "outport2", group: "out" },
  4080. ],
  4081. },
  4082. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4083. zIndex: 1,
  4084. },
  4085. {
  4086. position: { x: 370, y: 140 },
  4087. size: { width: 90, height: 80 },
  4088. attrs: {
  4089. image: {
  4090. "xlink:href":
  4091. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4092. },
  4093. label: { text: "contourTask2" },
  4094. },
  4095. shape: "template-node",
  4096. data: {
  4097. nodeName: "contourTask2",
  4098. templateName: "contourTask2",
  4099. templateImage: "zvinjodocker/contours_task2:20211014",
  4100. templateCommand: {},
  4101. templateArgs: {},
  4102. algoparaInput: { userInput: [], getInput: [] },
  4103. algoparaOutput: [],
  4104. algoparaInputargu: { userInput: [], getInput: [] },
  4105. algonodeSource: [
  4106. {
  4107. position: { x: 60, y: 280 },
  4108. size: { width: 90, height: 80 },
  4109. attrs: {
  4110. image: {
  4111. "xlink:href":
  4112. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4113. },
  4114. label: { text: "contourTask1" },
  4115. },
  4116. shape: "template-node",
  4117. data: {
  4118. nodeName: "contourTask1",
  4119. templateName: "contourTask1",
  4120. templateImage: "zvinjodocker/contous_task1:20211014",
  4121. templateCommand: {},
  4122. templateArgs: {},
  4123. algoparaInput: { userInput: [], getInput: [] },
  4124. algoparaOutput: [],
  4125. algoparaInputargu: { userInput: [], getInput: [] },
  4126. algonodeSource: [],
  4127. inputsparameters: [],
  4128. inputsartifacts: [],
  4129. argumentsparameters: [],
  4130. argumentsartifacts: [],
  4131. outputsparameters: [],
  4132. outputsartifacts: [
  4133. {
  4134. paraname: "thresh",
  4135. paradesc: "",
  4136. paratype: "",
  4137. valuefrom: "/myapps/thresh1.png",
  4138. },
  4139. {
  4140. paraname: "contours",
  4141. paradesc: "",
  4142. paratype: "",
  4143. valuefrom: "/myapps/contours.png",
  4144. },
  4145. ],
  4146. sourcedatalist: [],
  4147. sourceartilist: [],
  4148. },
  4149. ports: {
  4150. groups: {
  4151. in: {
  4152. position: "left",
  4153. attrs: {
  4154. circle: {
  4155. r: 2.5,
  4156. magnet: true,
  4157. stroke: "black",
  4158. strokeWidth: 1,
  4159. fill: "#fff",
  4160. style: { visibility: true },
  4161. },
  4162. },
  4163. },
  4164. out: {
  4165. position: "right",
  4166. attrs: {
  4167. circle: {
  4168. r: 2.5,
  4169. magnet: true,
  4170. stroke: "black",
  4171. strokeWidth: 1,
  4172. fill: "#fff",
  4173. },
  4174. },
  4175. },
  4176. },
  4177. items: [
  4178. { id: "inport1", group: "in" },
  4179. { id: "inport2", group: "in" },
  4180. { id: "outport1", group: "out" },
  4181. { id: "outport2", group: "out" },
  4182. ],
  4183. },
  4184. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4185. zIndex: 1,
  4186. },
  4187. ],
  4188. inputsparameters: [],
  4189. inputsartifacts: [
  4190. {
  4191. paraname: "thresh",
  4192. parapath: "/myapps/thresh1.png",
  4193. paradesc: "",
  4194. },
  4195. {
  4196. paraname: "contours",
  4197. parapath: "/myapps/contours.png",
  4198. paradesc: "",
  4199. },
  4200. ],
  4201. argumentsparameters: [],
  4202. argumentsartifacts: [
  4203. {
  4204. paraname: "thresh",
  4205. valuefrom: "{{tasks.contourTask1.outputs.artifacts.thresh}}",
  4206. fileurls: [],
  4207. filelist: [],
  4208. value: ["contourTask1", "thresh"],
  4209. },
  4210. {
  4211. paraname: "contours",
  4212. valuefrom: "{{tasks.contourTask1.outputs.artifacts.contours}}",
  4213. fileurls: [],
  4214. filelist: [],
  4215. value: ["contourTask1", "contours"],
  4216. },
  4217. ],
  4218. outputsparameters: [],
  4219. outputsartifacts: [
  4220. {
  4221. paraname: "contours0",
  4222. valuefrom: "/myapps/contours[0].npy",
  4223. paradesc: "",
  4224. paratype: "",
  4225. },
  4226. {
  4227. paraname: "res",
  4228. valuefrom: "/myapps/res1.png",
  4229. paradesc: "",
  4230. paratype: "",
  4231. },
  4232. ],
  4233. sourcedatalist: [],
  4234. sourceartilist: [],
  4235. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  4236. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  4237. },
  4238. ports: {
  4239. groups: {
  4240. in: {
  4241. position: "left",
  4242. attrs: {
  4243. circle: {
  4244. r: 2.5,
  4245. magnet: true,
  4246. stroke: "black",
  4247. strokeWidth: 1,
  4248. fill: "#fff",
  4249. style: { visibility: true },
  4250. },
  4251. },
  4252. },
  4253. out: {
  4254. position: "right",
  4255. attrs: {
  4256. circle: {
  4257. r: 2.5,
  4258. magnet: true,
  4259. stroke: "black",
  4260. strokeWidth: 1,
  4261. fill: "#fff",
  4262. },
  4263. },
  4264. },
  4265. },
  4266. items: [
  4267. { id: "inport1", group: "in" },
  4268. { id: "inport2", group: "in" },
  4269. { id: "outport1", group: "out" },
  4270. { id: "outport2", group: "out" },
  4271. ],
  4272. },
  4273. id: "7d572837-a22b-4dab-a196-8ea411ba868e",
  4274. zIndex: 2,
  4275. },
  4276. {
  4277. shape: "edge",
  4278. attrs: {
  4279. line: {
  4280. stroke: "#808080",
  4281. strokeWidth: 1,
  4282. targetMarker: { name: "block", args: { size: "6" } },
  4283. },
  4284. },
  4285. id: "3b752ac7-2c5f-4596-adf3-ad10dd3718b0",
  4286. router: { name: "er", args: { offset: "center" } },
  4287. tools: {
  4288. items: [{ name: "button-remove", args: { distance: -40 } }],
  4289. },
  4290. source: {
  4291. cell: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4292. port: "outport1",
  4293. },
  4294. target: {
  4295. cell: "7d572837-a22b-4dab-a196-8ea411ba868e",
  4296. port: "inport1",
  4297. },
  4298. zIndex: 3,
  4299. },
  4300. {
  4301. position: { x: 650, y: 140 },
  4302. size: { width: 90, height: 80 },
  4303. attrs: {
  4304. image: {
  4305. "xlink:href":
  4306. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4307. },
  4308. label: { text: "contourTask3" },
  4309. },
  4310. shape: "template-node",
  4311. data: {
  4312. nodeName: "contourTask3",
  4313. templateName: "contourTask3",
  4314. templateImage: "zvinjodocker/contours_task3:20211015",
  4315. templateCommand: {},
  4316. templateArgs: {},
  4317. algoparaInput: { userInput: [], getInput: [] },
  4318. algoparaOutput: [],
  4319. algoparaInputargu: { userInput: [], getInput: [] },
  4320. algonodeSource: [
  4321. {
  4322. position: { x: 370, y: 140 },
  4323. size: { width: 90, height: 80 },
  4324. attrs: {
  4325. image: {
  4326. "xlink:href":
  4327. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4328. },
  4329. label: { text: "contourTask2" },
  4330. },
  4331. shape: "template-node",
  4332. data: {
  4333. nodeName: "contourTask2",
  4334. templateName: "contourTask2",
  4335. templateImage: "zvinjodocker/contours_task2:20211014",
  4336. templateCommand: {},
  4337. templateArgs: {},
  4338. algoparaInput: { userInput: [], getInput: [] },
  4339. algoparaOutput: [],
  4340. algoparaInputargu: { userInput: [], getInput: [] },
  4341. algonodeSource: [
  4342. {
  4343. position: { x: 60, y: 280 },
  4344. size: { width: 90, height: 80 },
  4345. attrs: {
  4346. image: {
  4347. "xlink:href":
  4348. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4349. },
  4350. label: { text: "contourTask1" },
  4351. },
  4352. shape: "template-node",
  4353. data: {
  4354. nodeName: "contourTask1",
  4355. templateName: "contourTask1",
  4356. templateImage: "zvinjodocker/contous_task1:20211014",
  4357. templateCommand: {},
  4358. templateArgs: {},
  4359. algoparaInput: { userInput: [], getInput: [] },
  4360. algoparaOutput: [],
  4361. algoparaInputargu: { userInput: [], getInput: [] },
  4362. algonodeSource: [],
  4363. inputsparameters: [],
  4364. inputsartifacts: [],
  4365. argumentsparameters: [],
  4366. argumentsartifacts: [],
  4367. outputsparameters: [],
  4368. outputsartifacts: [
  4369. {
  4370. paraname: "thresh",
  4371. paradesc: "",
  4372. paratype: "",
  4373. valuefrom: "/myapps/thresh1.png",
  4374. },
  4375. {
  4376. paraname: "contours",
  4377. paradesc: "",
  4378. paratype: "",
  4379. valuefrom: "/myapps/contours.png",
  4380. },
  4381. ],
  4382. sourcedatalist: [],
  4383. sourceartilist: [],
  4384. },
  4385. ports: {
  4386. groups: {
  4387. in: {
  4388. position: "left",
  4389. attrs: {
  4390. circle: {
  4391. r: 2.5,
  4392. magnet: true,
  4393. stroke: "black",
  4394. strokeWidth: 1,
  4395. fill: "#fff",
  4396. style: { visibility: true },
  4397. },
  4398. },
  4399. },
  4400. out: {
  4401. position: "right",
  4402. attrs: {
  4403. circle: {
  4404. r: 2.5,
  4405. magnet: true,
  4406. stroke: "black",
  4407. strokeWidth: 1,
  4408. fill: "#fff",
  4409. },
  4410. },
  4411. },
  4412. },
  4413. items: [
  4414. { id: "inport1", group: "in" },
  4415. { id: "inport2", group: "in" },
  4416. { id: "outport1", group: "out" },
  4417. { id: "outport2", group: "out" },
  4418. ],
  4419. },
  4420. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4421. zIndex: 1,
  4422. },
  4423. ],
  4424. inputsparameters: [],
  4425. inputsartifacts: [
  4426. {
  4427. paraname: "thresh",
  4428. parapath: "/myapps/thresh1.png",
  4429. paradesc: "",
  4430. },
  4431. {
  4432. paraname: "contours",
  4433. parapath: "/myapps/contours.png",
  4434. paradesc: "",
  4435. },
  4436. ],
  4437. argumentsparameters: [],
  4438. argumentsartifacts: [
  4439. {
  4440. paraname: "thresh",
  4441. valuefrom:
  4442. "{{tasks.contourTask1.outputs.artifacts.thresh}}",
  4443. fileurls: [],
  4444. filelist: [],
  4445. value: ["contourTask1", "thresh"],
  4446. },
  4447. {
  4448. paraname: "contours",
  4449. valuefrom:
  4450. "{{tasks.contourTask1.outputs.artifacts.contours}}",
  4451. fileurls: [],
  4452. filelist: [],
  4453. value: ["contourTask1", "contours"],
  4454. },
  4455. ],
  4456. outputsparameters: [],
  4457. outputsartifacts: [
  4458. {
  4459. paraname: "contours0",
  4460. valuefrom: "/myapps/contours[0].npy",
  4461. paradesc: "",
  4462. paratype: "",
  4463. },
  4464. {
  4465. paraname: "res",
  4466. valuefrom: "/myapps/res1.png",
  4467. paradesc: "",
  4468. paratype: "",
  4469. },
  4470. ],
  4471. sourcedatalist: [],
  4472. sourceartilist: [],
  4473. },
  4474. ports: {
  4475. groups: {
  4476. in: {
  4477. position: "left",
  4478. attrs: {
  4479. circle: {
  4480. r: 2.5,
  4481. magnet: true,
  4482. stroke: "black",
  4483. strokeWidth: 1,
  4484. fill: "#fff",
  4485. style: { visibility: true },
  4486. },
  4487. },
  4488. },
  4489. out: {
  4490. position: "right",
  4491. attrs: {
  4492. circle: {
  4493. r: 2.5,
  4494. magnet: true,
  4495. stroke: "black",
  4496. strokeWidth: 1,
  4497. fill: "#fff",
  4498. },
  4499. },
  4500. },
  4501. },
  4502. items: [
  4503. { id: "inport1", group: "in" },
  4504. { id: "inport2", group: "in" },
  4505. { id: "outport1", group: "out" },
  4506. { id: "outport2", group: "out" },
  4507. ],
  4508. },
  4509. id: "7d572837-a22b-4dab-a196-8ea411ba868e",
  4510. zIndex: 2,
  4511. },
  4512. ],
  4513. inputsparameters: [],
  4514. inputsartifacts: [
  4515. {
  4516. paraname: "contours0",
  4517. parapath: "/myapps/contours[0].npy",
  4518. paradesc: "",
  4519. },
  4520. ],
  4521. argumentsparameters: [],
  4522. argumentsartifacts: [
  4523. {
  4524. paraname: "contours0",
  4525. valuefrom: "{{tasks.contourTask2.outputs.artifacts.contours0}}",
  4526. fileurls: [],
  4527. filelist: [],
  4528. value: ["contourTask2", "contours0"],
  4529. },
  4530. ],
  4531. outputsparameters: [],
  4532. outputsartifacts: [],
  4533. sourcedatalist: [],
  4534. sourceartilist: [],
  4535. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  4536. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  4537. },
  4538. ports: {
  4539. groups: {
  4540. in: {
  4541. position: "left",
  4542. attrs: {
  4543. circle: {
  4544. r: 2.5,
  4545. magnet: true,
  4546. stroke: "black",
  4547. strokeWidth: 1,
  4548. fill: "#fff",
  4549. style: { visibility: true },
  4550. },
  4551. },
  4552. },
  4553. out: {
  4554. position: "right",
  4555. attrs: {
  4556. circle: {
  4557. r: 2.5,
  4558. magnet: true,
  4559. stroke: "black",
  4560. strokeWidth: 1,
  4561. fill: "#fff",
  4562. },
  4563. },
  4564. },
  4565. },
  4566. items: [
  4567. { id: "inport1", group: "in" },
  4568. { id: "inport2", group: "in" },
  4569. { id: "outport1", group: "out" },
  4570. { id: "outport2", group: "out" },
  4571. ],
  4572. },
  4573. id: "a40a3ff3-da4c-463c-ab58-bd9735fb57fe",
  4574. zIndex: 4,
  4575. },
  4576. {
  4577. shape: "edge",
  4578. attrs: {
  4579. line: {
  4580. stroke: "#808080",
  4581. strokeWidth: 1,
  4582. targetMarker: { name: "block", args: { size: "6" } },
  4583. },
  4584. },
  4585. id: "e30fefd7-b50a-4152-96a5-a6403f990cf7",
  4586. router: { name: "er", args: { offset: "center" } },
  4587. tools: {
  4588. items: [{ name: "button-remove", args: { distance: -40 } }],
  4589. },
  4590. source: {
  4591. cell: "7d572837-a22b-4dab-a196-8ea411ba868e",
  4592. port: "outport1",
  4593. },
  4594. target: {
  4595. cell: "a40a3ff3-da4c-463c-ab58-bd9735fb57fe",
  4596. port: "inport1",
  4597. },
  4598. zIndex: 5,
  4599. },
  4600. {
  4601. position: { x: 360, y: 390 },
  4602. size: { width: 90, height: 80 },
  4603. attrs: {
  4604. image: {
  4605. "xlink:href":
  4606. "https://gw.alipayobjects.com/zos/bmw-prod/c36fe7cb-dc24-4854-aeb5-88d8dc36d52e.svg",
  4607. },
  4608. label: { text: "contourApproximate1" },
  4609. },
  4610. shape: "template-node",
  4611. data: {
  4612. nodeName: "contourApproximate1",
  4613. templateName: "contourApproximate1",
  4614. templateImage: "zvinjodocker/contour_approximate1:20211015",
  4615. templateCommand: {},
  4616. templateArgs: {},
  4617. algoparaInput: { userInput: [], getInput: [] },
  4618. algoparaOutput: [],
  4619. algoparaInputargu: { userInput: [], getInput: [] },
  4620. algonodeSource: [
  4621. {
  4622. position: { x: 60, y: 280 },
  4623. size: { width: 90, height: 80 },
  4624. attrs: {
  4625. image: {
  4626. "xlink:href":
  4627. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4628. },
  4629. label: { text: "contourTask1" },
  4630. },
  4631. shape: "template-node",
  4632. data: {
  4633. nodeName: "contourTask1",
  4634. templateName: "contourTask1",
  4635. templateImage: "zvinjodocker/contous_task1:20211014",
  4636. templateCommand: {},
  4637. templateArgs: {},
  4638. algoparaInput: { userInput: [], getInput: [] },
  4639. algoparaOutput: [],
  4640. algoparaInputargu: { userInput: [], getInput: [] },
  4641. algonodeSource: [],
  4642. inputsparameters: [],
  4643. inputsartifacts: [],
  4644. argumentsparameters: [],
  4645. argumentsartifacts: [],
  4646. outputsparameters: [],
  4647. outputsartifacts: [
  4648. {
  4649. paraname: "thresh",
  4650. paradesc: "",
  4651. paratype: "",
  4652. valuefrom: "/myapps/thresh1.png",
  4653. },
  4654. {
  4655. paraname: "contours",
  4656. paradesc: "",
  4657. paratype: "",
  4658. valuefrom: "/myapps/contours.png",
  4659. },
  4660. ],
  4661. sourcedatalist: [],
  4662. sourceartilist: [],
  4663. },
  4664. ports: {
  4665. groups: {
  4666. in: {
  4667. position: "left",
  4668. attrs: {
  4669. circle: {
  4670. r: 2.5,
  4671. magnet: true,
  4672. stroke: "black",
  4673. strokeWidth: 1,
  4674. fill: "#fff",
  4675. style: { visibility: true },
  4676. },
  4677. },
  4678. },
  4679. out: {
  4680. position: "right",
  4681. attrs: {
  4682. circle: {
  4683. r: 2.5,
  4684. magnet: true,
  4685. stroke: "black",
  4686. strokeWidth: 1,
  4687. fill: "#fff",
  4688. },
  4689. },
  4690. },
  4691. },
  4692. items: [
  4693. { id: "inport1", group: "in" },
  4694. { id: "inport2", group: "in" },
  4695. { id: "outport1", group: "out" },
  4696. { id: "outport2", group: "out" },
  4697. ],
  4698. },
  4699. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4700. zIndex: 1,
  4701. },
  4702. ],
  4703. inputsparameters: [],
  4704. inputsartifacts: [],
  4705. argumentsparameters: [],
  4706. argumentsartifacts: [],
  4707. outputsparameters: [],
  4708. outputsartifacts: [
  4709. {
  4710. paraname: "approxCnt",
  4711. valuefrom: "/myapps/approx_cnt.npy",
  4712. paradesc: "",
  4713. paratype: "",
  4714. },
  4715. {
  4716. paraname: "approxRes",
  4717. valuefrom: "/myapps/approx_res.png",
  4718. paradesc: "",
  4719. paratype: "",
  4720. },
  4721. ],
  4722. sourcedatalist: [],
  4723. sourceartilist: [],
  4724. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  4725. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  4726. },
  4727. ports: {
  4728. groups: {
  4729. in: {
  4730. position: "left",
  4731. attrs: {
  4732. circle: {
  4733. r: 2.5,
  4734. magnet: true,
  4735. stroke: "black",
  4736. strokeWidth: 1,
  4737. fill: "#fff",
  4738. style: { visibility: true },
  4739. },
  4740. },
  4741. },
  4742. out: {
  4743. position: "right",
  4744. attrs: {
  4745. circle: {
  4746. r: 2.5,
  4747. magnet: true,
  4748. stroke: "black",
  4749. strokeWidth: 1,
  4750. fill: "#fff",
  4751. },
  4752. },
  4753. },
  4754. },
  4755. items: [
  4756. { id: "inport1", group: "in" },
  4757. { id: "inport2", group: "in" },
  4758. { id: "outport1", group: "out" },
  4759. { id: "outport2", group: "out" },
  4760. ],
  4761. },
  4762. id: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  4763. zIndex: 6,
  4764. },
  4765. {
  4766. position: { x: 660, y: 390 },
  4767. size: { width: 90, height: 80 },
  4768. attrs: {
  4769. image: {
  4770. "xlink:href":
  4771. "https://gw.alipayobjects.com/zos/bmw-prod/c55d7ae1-8d20-4585-bd8f-ca23653a4489.svg",
  4772. },
  4773. label: { text: "contourApproximate2" },
  4774. },
  4775. shape: "template-node",
  4776. data: {
  4777. nodeName: "contourApproximate2",
  4778. templateName: "contourApproximate2",
  4779. templateImage: "zvinjodocker/contour_approximate2:20211015",
  4780. templateCommand: {},
  4781. templateArgs: {},
  4782. algoparaInput: { userInput: [], getInput: [] },
  4783. algoparaOutput: [],
  4784. algoparaInputargu: { userInput: [], getInput: [] },
  4785. algonodeSource: [
  4786. {
  4787. position: { x: 360, y: 390 },
  4788. size: { width: 90, height: 80 },
  4789. attrs: {
  4790. image: {
  4791. "xlink:href":
  4792. "https://gw.alipayobjects.com/zos/bmw-prod/c36fe7cb-dc24-4854-aeb5-88d8dc36d52e.svg",
  4793. },
  4794. label: { text: "contourApproximate1" },
  4795. },
  4796. shape: "template-node",
  4797. data: {
  4798. nodeName: "contourApproximate1",
  4799. templateName: "contourApproximate1",
  4800. templateImage: "zvinjodocker/contour_approximate1:20211015",
  4801. templateCommand: {},
  4802. templateArgs: {},
  4803. algoparaInput: { userInput: [], getInput: [] },
  4804. algoparaOutput: [],
  4805. algoparaInputargu: { userInput: [], getInput: [] },
  4806. algonodeSource: [
  4807. {
  4808. position: { x: 60, y: 280 },
  4809. size: { width: 90, height: 80 },
  4810. attrs: {
  4811. image: {
  4812. "xlink:href":
  4813. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4814. },
  4815. label: { text: "contourTask1" },
  4816. },
  4817. shape: "template-node",
  4818. data: {
  4819. nodeName: "contourTask1",
  4820. templateName: "contourTask1",
  4821. templateImage: "zvinjodocker/contous_task1:20211014",
  4822. templateCommand: {},
  4823. templateArgs: {},
  4824. algoparaInput: { userInput: [], getInput: [] },
  4825. algoparaOutput: [],
  4826. algoparaInputargu: { userInput: [], getInput: [] },
  4827. algonodeSource: [],
  4828. inputsparameters: [],
  4829. inputsartifacts: [],
  4830. argumentsparameters: [],
  4831. argumentsartifacts: [],
  4832. outputsparameters: [],
  4833. outputsartifacts: [
  4834. {
  4835. paraname: "thresh",
  4836. paradesc: "",
  4837. paratype: "",
  4838. valuefrom: "/myapps/thresh1.png",
  4839. },
  4840. {
  4841. paraname: "contours",
  4842. paradesc: "",
  4843. paratype: "",
  4844. valuefrom: "/myapps/contours.png",
  4845. },
  4846. ],
  4847. sourcedatalist: [],
  4848. sourceartilist: [],
  4849. },
  4850. ports: {
  4851. groups: {
  4852. in: {
  4853. position: "left",
  4854. attrs: {
  4855. circle: {
  4856. r: 2.5,
  4857. magnet: true,
  4858. stroke: "black",
  4859. strokeWidth: 1,
  4860. fill: "#fff",
  4861. style: { visibility: true },
  4862. },
  4863. },
  4864. },
  4865. out: {
  4866. position: "right",
  4867. attrs: {
  4868. circle: {
  4869. r: 2.5,
  4870. magnet: true,
  4871. stroke: "black",
  4872. strokeWidth: 1,
  4873. fill: "#fff",
  4874. },
  4875. },
  4876. },
  4877. },
  4878. items: [
  4879. { id: "inport1", group: "in" },
  4880. { id: "inport2", group: "in" },
  4881. { id: "outport1", group: "out" },
  4882. { id: "outport2", group: "out" },
  4883. ],
  4884. },
  4885. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4886. zIndex: 1,
  4887. },
  4888. ],
  4889. inputsparameters: [],
  4890. inputsartifacts: [],
  4891. argumentsparameters: [],
  4892. argumentsartifacts: [],
  4893. outputsparameters: [],
  4894. outputsartifacts: [
  4895. {
  4896. paraname: "approxCnt",
  4897. valuefrom: "/myapps/approx_cnt.npy",
  4898. paradesc: "",
  4899. paratype: "",
  4900. },
  4901. {
  4902. paraname: "approxRes",
  4903. valuefrom: "/myapps/approx_res.png",
  4904. paradesc: "",
  4905. paratype: "",
  4906. },
  4907. ],
  4908. sourcedatalist: [],
  4909. sourceartilist: [],
  4910. },
  4911. ports: {
  4912. groups: {
  4913. in: {
  4914. position: "left",
  4915. attrs: {
  4916. circle: {
  4917. r: 2.5,
  4918. magnet: true,
  4919. stroke: "black",
  4920. strokeWidth: 1,
  4921. fill: "#fff",
  4922. style: { visibility: true },
  4923. },
  4924. },
  4925. },
  4926. out: {
  4927. position: "right",
  4928. attrs: {
  4929. circle: {
  4930. r: 2.5,
  4931. magnet: true,
  4932. stroke: "black",
  4933. strokeWidth: 1,
  4934. fill: "#fff",
  4935. },
  4936. },
  4937. },
  4938. },
  4939. items: [
  4940. { id: "inport1", group: "in" },
  4941. { id: "inport2", group: "in" },
  4942. { id: "outport1", group: "out" },
  4943. { id: "outport2", group: "out" },
  4944. ],
  4945. },
  4946. id: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  4947. zIndex: 6,
  4948. },
  4949. ],
  4950. inputsparameters: [],
  4951. inputsartifacts: [
  4952. {
  4953. paraname: "approxCnt",
  4954. parapath: "/myapps/approx_cnt.npy",
  4955. paradesc: "",
  4956. },
  4957. ],
  4958. argumentsparameters: [],
  4959. argumentsartifacts: [
  4960. {
  4961. paraname: "approxCnt",
  4962. valuefrom:
  4963. "{{tasks.contourApproximate1.outputs.artifacts.approxCnt}}",
  4964. fileurls: [],
  4965. filelist: [],
  4966. value: ["contourApproximate1", "approxCnt"],
  4967. },
  4968. ],
  4969. outputsparameters: [],
  4970. outputsartifacts: [
  4971. {
  4972. paraname: "approxRes2",
  4973. valuefrom: "/myapps/approx_res2.png",
  4974. paradesc: "",
  4975. paratype: "",
  4976. },
  4977. ],
  4978. sourcedatalist: [],
  4979. sourceartilist: [],
  4980. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  4981. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  4982. },
  4983. ports: {
  4984. groups: {
  4985. in: {
  4986. position: "left",
  4987. attrs: {
  4988. circle: {
  4989. r: 2.5,
  4990. magnet: true,
  4991. stroke: "black",
  4992. strokeWidth: 1,
  4993. fill: "#fff",
  4994. style: { visibility: true },
  4995. },
  4996. },
  4997. },
  4998. out: {
  4999. position: "right",
  5000. attrs: {
  5001. circle: {
  5002. r: 2.5,
  5003. magnet: true,
  5004. stroke: "black",
  5005. strokeWidth: 1,
  5006. fill: "#fff",
  5007. },
  5008. },
  5009. },
  5010. },
  5011. items: [
  5012. { id: "inport1", group: "in" },
  5013. { id: "inport2", group: "in" },
  5014. { id: "outport1", group: "out" },
  5015. { id: "outport2", group: "out" },
  5016. ],
  5017. },
  5018. id: "1e868699-e31f-4daf-a07b-7e903c861fba",
  5019. zIndex: 7,
  5020. },
  5021. {
  5022. shape: "edge",
  5023. attrs: {
  5024. line: {
  5025. stroke: "#808080",
  5026. strokeWidth: 1,
  5027. targetMarker: { name: "block", args: { size: "6" } },
  5028. },
  5029. },
  5030. id: "77d0d40f-d287-4223-abfc-0fd17651bb69",
  5031. router: { name: "er", args: { offset: "center" } },
  5032. tools: {
  5033. items: [{ name: "button-remove", args: { distance: -40 } }],
  5034. },
  5035. source: {
  5036. cell: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  5037. port: "outport1",
  5038. },
  5039. target: {
  5040. cell: "1e868699-e31f-4daf-a07b-7e903c861fba",
  5041. port: "inport1",
  5042. },
  5043. zIndex: 8,
  5044. },
  5045. {
  5046. shape: "edge",
  5047. attrs: {
  5048. line: {
  5049. stroke: "#808080",
  5050. strokeWidth: 1,
  5051. targetMarker: { name: "block", args: { size: "6" } },
  5052. },
  5053. },
  5054. id: "f46b0a77-d34c-4ec8-8bfd-7b48e412669e",
  5055. router: { name: "er", args: { offset: "center" } },
  5056. tools: {
  5057. items: [{ name: "button-remove", args: { distance: -40 } }],
  5058. },
  5059. source: {
  5060. cell: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  5061. port: "outport2",
  5062. },
  5063. target: {
  5064. cell: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  5065. port: "inport1",
  5066. },
  5067. zIndex: 9,
  5068. },
  5069. {
  5070. position: { x: 660, y: 600 },
  5071. size: { width: 90, height: 80 },
  5072. attrs: {
  5073. image: {
  5074. "xlink:href":
  5075. "https://gw.alipayobjects.com/zos/bmw-prod/dc1ced06-417d-466f-927b-b4a4d3265791.svg",
  5076. },
  5077. label: { text: "contourRect1" },
  5078. },
  5079. shape: "template-node",
  5080. data: {
  5081. nodeName: "contourRect1",
  5082. templateName: "contourRect1",
  5083. templateImage: "zvinjodocker/contours_rect1:20211015",
  5084. templateCommand: {},
  5085. templateArgs: {},
  5086. algoparaInput: { userInput: [], getInput: [] },
  5087. algoparaOutput: [],
  5088. algoparaInputargu: { userInput: [], getInput: [] },
  5089. algonodeSource: [
  5090. {
  5091. position: { x: 360, y: 390 },
  5092. size: { width: 90, height: 80 },
  5093. attrs: {
  5094. image: {
  5095. "xlink:href":
  5096. "https://gw.alipayobjects.com/zos/bmw-prod/c36fe7cb-dc24-4854-aeb5-88d8dc36d52e.svg",
  5097. },
  5098. label: { text: "contourApproximate1" },
  5099. },
  5100. shape: "template-node",
  5101. data: {
  5102. nodeName: "contourApproximate1",
  5103. templateName: "contourApproximate1",
  5104. templateImage: "zvinjodocker/contour_approximate1:20211015",
  5105. templateCommand: {},
  5106. templateArgs: {},
  5107. algoparaInput: { userInput: [], getInput: [] },
  5108. algoparaOutput: [],
  5109. algoparaInputargu: { userInput: [], getInput: [] },
  5110. algonodeSource: [
  5111. {
  5112. position: { x: 60, y: 280 },
  5113. size: { width: 90, height: 80 },
  5114. attrs: {
  5115. image: {
  5116. "xlink:href":
  5117. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  5118. },
  5119. label: { text: "contourTask1" },
  5120. },
  5121. shape: "template-node",
  5122. data: {
  5123. nodeName: "contourTask1",
  5124. templateName: "contourTask1",
  5125. templateImage: "zvinjodocker/contous_task1:20211014",
  5126. templateCommand: {},
  5127. templateArgs: {},
  5128. algoparaInput: { userInput: [], getInput: [] },
  5129. algoparaOutput: [],
  5130. algoparaInputargu: { userInput: [], getInput: [] },
  5131. algonodeSource: [],
  5132. inputsparameters: [],
  5133. inputsartifacts: [],
  5134. argumentsparameters: [],
  5135. argumentsartifacts: [],
  5136. outputsparameters: [],
  5137. outputsartifacts: [
  5138. {
  5139. paraname: "thresh",
  5140. paradesc: "",
  5141. paratype: "",
  5142. valuefrom: "/myapps/thresh1.png",
  5143. },
  5144. {
  5145. paraname: "contours",
  5146. paradesc: "",
  5147. paratype: "",
  5148. valuefrom: "/myapps/contours.png",
  5149. },
  5150. ],
  5151. sourcedatalist: [],
  5152. sourceartilist: [],
  5153. },
  5154. ports: {
  5155. groups: {
  5156. in: {
  5157. position: "left",
  5158. attrs: {
  5159. circle: {
  5160. r: 2.5,
  5161. magnet: true,
  5162. stroke: "black",
  5163. strokeWidth: 1,
  5164. fill: "#fff",
  5165. style: { visibility: true },
  5166. },
  5167. },
  5168. },
  5169. out: {
  5170. position: "right",
  5171. attrs: {
  5172. circle: {
  5173. r: 2.5,
  5174. magnet: true,
  5175. stroke: "black",
  5176. strokeWidth: 1,
  5177. fill: "#fff",
  5178. },
  5179. },
  5180. },
  5181. },
  5182. items: [
  5183. { id: "inport1", group: "in" },
  5184. { id: "inport2", group: "in" },
  5185. { id: "outport1", group: "out" },
  5186. { id: "outport2", group: "out" },
  5187. ],
  5188. },
  5189. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  5190. zIndex: 1,
  5191. },
  5192. ],
  5193. inputsparameters: [],
  5194. inputsartifacts: [],
  5195. argumentsparameters: [],
  5196. argumentsartifacts: [],
  5197. outputsparameters: [],
  5198. outputsartifacts: [
  5199. {
  5200. paraname: "approxCnt",
  5201. valuefrom: "/myapps/approx_cnt.npy",
  5202. paradesc: "",
  5203. paratype: "",
  5204. },
  5205. {
  5206. paraname: "approxRes",
  5207. valuefrom: "/myapps/approx_res.png",
  5208. paradesc: "",
  5209. paratype: "",
  5210. },
  5211. ],
  5212. sourcedatalist: [],
  5213. sourceartilist: [],
  5214. },
  5215. ports: {
  5216. groups: {
  5217. in: {
  5218. position: "left",
  5219. attrs: {
  5220. circle: {
  5221. r: 2.5,
  5222. magnet: true,
  5223. stroke: "black",
  5224. strokeWidth: 1,
  5225. fill: "#fff",
  5226. style: { visibility: true },
  5227. },
  5228. },
  5229. },
  5230. out: {
  5231. position: "right",
  5232. attrs: {
  5233. circle: {
  5234. r: 2.5,
  5235. magnet: true,
  5236. stroke: "black",
  5237. strokeWidth: 1,
  5238. fill: "#fff",
  5239. },
  5240. },
  5241. },
  5242. },
  5243. items: [
  5244. { id: "inport1", group: "in" },
  5245. { id: "inport2", group: "in" },
  5246. { id: "outport1", group: "out" },
  5247. { id: "outport2", group: "out" },
  5248. ],
  5249. },
  5250. id: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  5251. zIndex: 6,
  5252. },
  5253. ],
  5254. inputsparameters: [],
  5255. inputsartifacts: [],
  5256. argumentsparameters: [],
  5257. argumentsartifacts: [],
  5258. outputsparameters: [],
  5259. outputsartifacts: [
  5260. {
  5261. paraname: "cnt",
  5262. valuefrom: "/myapps/contour_rect_cnt.npy",
  5263. paradesc: "",
  5264. paratype: "",
  5265. },
  5266. {
  5267. paraname: "contourRect",
  5268. valuefrom: "/myapps/contour_rect.png",
  5269. paradesc: "",
  5270. paratype: "",
  5271. },
  5272. ],
  5273. sourcedatalist: [],
  5274. sourceartilist: [],
  5275. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  5276. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  5277. },
  5278. ports: {
  5279. groups: {
  5280. in: {
  5281. position: "left",
  5282. attrs: {
  5283. circle: {
  5284. r: 2.5,
  5285. magnet: true,
  5286. stroke: "black",
  5287. strokeWidth: 1,
  5288. fill: "#fff",
  5289. style: { visibility: true },
  5290. },
  5291. },
  5292. },
  5293. out: {
  5294. position: "right",
  5295. attrs: {
  5296. circle: {
  5297. r: 2.5,
  5298. magnet: true,
  5299. stroke: "black",
  5300. strokeWidth: 1,
  5301. fill: "#fff",
  5302. },
  5303. },
  5304. },
  5305. },
  5306. items: [
  5307. { id: "inport1", group: "in" },
  5308. { id: "inport2", group: "in" },
  5309. { id: "outport1", group: "out" },
  5310. { id: "outport2", group: "out" },
  5311. ],
  5312. },
  5313. id: "6d787d4a-a68d-4a8c-a3b9-559eb5d4e231",
  5314. zIndex: 10,
  5315. },
  5316. {
  5317. position: { x: 910, y: 600 },
  5318. size: { width: 90, height: 80 },
  5319. attrs: {
  5320. image: {
  5321. "xlink:href":
  5322. "https://gw.alipayobjects.com/zos/bmw-prod/687b6cb9-4b97-42a6-96d0-34b3099133ac.svg",
  5323. },
  5324. label: { text: "contourCircle2" },
  5325. },
  5326. shape: "template-node",
  5327. data: {
  5328. nodeName: "contourCircle2",
  5329. templateName: "contourCircle2",
  5330. templateImage: "zvinjodocker/contours_circle2:20211015",
  5331. templateCommand: {},
  5332. templateArgs: {},
  5333. algoparaInput: { userInput: [], getInput: [] },
  5334. algoparaOutput: [],
  5335. algoparaInputargu: { userInput: [], getInput: [] },
  5336. algonodeSource: [
  5337. {
  5338. position: { x: 660, y: 600 },
  5339. size: { width: 90, height: 80 },
  5340. attrs: {
  5341. image: {
  5342. "xlink:href":
  5343. "https://gw.alipayobjects.com/zos/bmw-prod/dc1ced06-417d-466f-927b-b4a4d3265791.svg",
  5344. },
  5345. label: { text: "contourRect1" },
  5346. },
  5347. shape: "template-node",
  5348. data: {
  5349. nodeName: "contourRect1",
  5350. templateName: "contourRect1",
  5351. templateImage: "zvinjodocker/contours_rect1:20211015",
  5352. templateCommand: {},
  5353. templateArgs: {},
  5354. algoparaInput: { userInput: [], getInput: [] },
  5355. algoparaOutput: [],
  5356. algoparaInputargu: { userInput: [], getInput: [] },
  5357. algonodeSource: [
  5358. {
  5359. position: { x: 360, y: 390 },
  5360. size: { width: 90, height: 80 },
  5361. attrs: {
  5362. image: {
  5363. "xlink:href":
  5364. "https://gw.alipayobjects.com/zos/bmw-prod/c36fe7cb-dc24-4854-aeb5-88d8dc36d52e.svg",
  5365. },
  5366. label: { text: "contourApproximate1" },
  5367. },
  5368. shape: "template-node",
  5369. data: {
  5370. nodeName: "contourApproximate1",
  5371. templateName: "contourApproximate1",
  5372. templateImage:
  5373. "zvinjodocker/contour_approximate1:20211015",
  5374. templateCommand: {},
  5375. templateArgs: {},
  5376. algoparaInput: { userInput: [], getInput: [] },
  5377. algoparaOutput: [],
  5378. algoparaInputargu: { userInput: [], getInput: [] },
  5379. algonodeSource: [
  5380. {
  5381. position: { x: 60, y: 280 },
  5382. size: { width: 90, height: 80 },
  5383. attrs: {
  5384. image: {
  5385. "xlink:href":
  5386. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  5387. },
  5388. label: { text: "contourTask1" },
  5389. },
  5390. shape: "template-node",
  5391. data: {
  5392. nodeName: "contourTask1",
  5393. templateName: "contourTask1",
  5394. templateImage:
  5395. "zvinjodocker/contous_task1:20211014",
  5396. templateCommand: {},
  5397. templateArgs: {},
  5398. algoparaInput: { userInput: [], getInput: [] },
  5399. algoparaOutput: [],
  5400. algoparaInputargu: {
  5401. userInput: [],
  5402. getInput: [],
  5403. },
  5404. algonodeSource: [],
  5405. inputsparameters: [],
  5406. inputsartifacts: [],
  5407. argumentsparameters: [],
  5408. argumentsartifacts: [],
  5409. outputsparameters: [],
  5410. outputsartifacts: [
  5411. {
  5412. paraname: "thresh",
  5413. paradesc: "",
  5414. paratype: "",
  5415. valuefrom: "/myapps/thresh1.png",
  5416. },
  5417. {
  5418. paraname: "contours",
  5419. paradesc: "",
  5420. paratype: "",
  5421. valuefrom: "/myapps/contours.png",
  5422. },
  5423. ],
  5424. sourcedatalist: [],
  5425. sourceartilist: [],
  5426. },
  5427. ports: {
  5428. groups: {
  5429. in: {
  5430. position: "left",
  5431. attrs: {
  5432. circle: {
  5433. r: 2.5,
  5434. magnet: true,
  5435. stroke: "black",
  5436. strokeWidth: 1,
  5437. fill: "#fff",
  5438. style: { visibility: true },
  5439. },
  5440. },
  5441. },
  5442. out: {
  5443. position: "right",
  5444. attrs: {
  5445. circle: {
  5446. r: 2.5,
  5447. magnet: true,
  5448. stroke: "black",
  5449. strokeWidth: 1,
  5450. fill: "#fff",
  5451. },
  5452. },
  5453. },
  5454. },
  5455. items: [
  5456. { id: "inport1", group: "in" },
  5457. { id: "inport2", group: "in" },
  5458. { id: "outport1", group: "out" },
  5459. { id: "outport2", group: "out" },
  5460. ],
  5461. },
  5462. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  5463. zIndex: 1,
  5464. },
  5465. ],
  5466. inputsparameters: [],
  5467. inputsartifacts: [],
  5468. argumentsparameters: [],
  5469. argumentsartifacts: [],
  5470. outputsparameters: [],
  5471. outputsartifacts: [
  5472. {
  5473. paraname: "approxCnt",
  5474. valuefrom: "/myapps/approx_cnt.npy",
  5475. paradesc: "",
  5476. paratype: "",
  5477. },
  5478. {
  5479. paraname: "approxRes",
  5480. valuefrom: "/myapps/approx_res.png",
  5481. paradesc: "",
  5482. paratype: "",
  5483. },
  5484. ],
  5485. sourcedatalist: [],
  5486. sourceartilist: [],
  5487. },
  5488. ports: {
  5489. groups: {
  5490. in: {
  5491. position: "left",
  5492. attrs: {
  5493. circle: {
  5494. r: 2.5,
  5495. magnet: true,
  5496. stroke: "black",
  5497. strokeWidth: 1,
  5498. fill: "#fff",
  5499. style: { visibility: true },
  5500. },
  5501. },
  5502. },
  5503. out: {
  5504. position: "right",
  5505. attrs: {
  5506. circle: {
  5507. r: 2.5,
  5508. magnet: true,
  5509. stroke: "black",
  5510. strokeWidth: 1,
  5511. fill: "#fff",
  5512. },
  5513. },
  5514. },
  5515. },
  5516. items: [
  5517. { id: "inport1", group: "in" },
  5518. { id: "inport2", group: "in" },
  5519. { id: "outport1", group: "out" },
  5520. { id: "outport2", group: "out" },
  5521. ],
  5522. },
  5523. id: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  5524. zIndex: 6,
  5525. },
  5526. ],
  5527. inputsparameters: [],
  5528. inputsartifacts: [],
  5529. argumentsparameters: [],
  5530. argumentsartifacts: [],
  5531. outputsparameters: [],
  5532. outputsartifacts: [
  5533. {
  5534. paraname: "cnt",
  5535. valuefrom: "/myapps/contour_rect_cnt.npy",
  5536. paradesc: "",
  5537. paratype: "",
  5538. },
  5539. {
  5540. paraname: "contourRect",
  5541. valuefrom: "/myapps/contour_rect.png",
  5542. paradesc: "",
  5543. paratype: "",
  5544. },
  5545. ],
  5546. sourcedatalist: [],
  5547. sourceartilist: [],
  5548. },
  5549. ports: {
  5550. groups: {
  5551. in: {
  5552. position: "left",
  5553. attrs: {
  5554. circle: {
  5555. r: 2.5,
  5556. magnet: true,
  5557. stroke: "black",
  5558. strokeWidth: 1,
  5559. fill: "#fff",
  5560. style: { visibility: true },
  5561. },
  5562. },
  5563. },
  5564. out: {
  5565. position: "right",
  5566. attrs: {
  5567. circle: {
  5568. r: 2.5,
  5569. magnet: true,
  5570. stroke: "black",
  5571. strokeWidth: 1,
  5572. fill: "#fff",
  5573. },
  5574. },
  5575. },
  5576. },
  5577. items: [
  5578. { id: "inport1", group: "in" },
  5579. { id: "inport2", group: "in" },
  5580. { id: "outport1", group: "out" },
  5581. { id: "outport2", group: "out" },
  5582. ],
  5583. },
  5584. id: "6d787d4a-a68d-4a8c-a3b9-559eb5d4e231",
  5585. zIndex: 10,
  5586. },
  5587. ],
  5588. inputsparameters: [],
  5589. inputsartifacts: [
  5590. {
  5591. paraname: "contourRect",
  5592. parapath: "/myapps/contour_rect.png",
  5593. paradesc: "",
  5594. },
  5595. {
  5596. paraname: "cnt",
  5597. parapath: "/myapps/contour_rect_cnt.npy",
  5598. paradesc: "",
  5599. },
  5600. ],
  5601. argumentsparameters: [],
  5602. argumentsartifacts: [
  5603. {
  5604. paraname: "contourRect",
  5605. valuefrom:
  5606. "{{tasks.contourRect1.outputs.artifacts.contourRect}}",
  5607. fileurls: [],
  5608. filelist: [],
  5609. value: ["contourRect1", "contourRect"],
  5610. },
  5611. {
  5612. paraname: "cnt",
  5613. valuefrom: "{{tasks.contourRect1.outputs.artifacts.cnt}}",
  5614. fileurls: [],
  5615. filelist: [],
  5616. value: ["contourRect1", "cnt"],
  5617. },
  5618. ],
  5619. outputsparameters: [],
  5620. outputsartifacts: [
  5621. {
  5622. paraname: "contourCircle",
  5623. valuefrom: "contour_circle.png",
  5624. paradesc: "",
  5625. paratype: "",
  5626. },
  5627. ],
  5628. sourcedatalist: [],
  5629. sourceartilist: [],
  5630. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  5631. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  5632. },
  5633. ports: {
  5634. groups: {
  5635. in: {
  5636. position: "left",
  5637. attrs: {
  5638. circle: {
  5639. r: 2.5,
  5640. magnet: true,
  5641. stroke: "black",
  5642. strokeWidth: 1,
  5643. fill: "#fff",
  5644. style: { visibility: true },
  5645. },
  5646. },
  5647. },
  5648. out: {
  5649. position: "right",
  5650. attrs: {
  5651. circle: {
  5652. r: 2.5,
  5653. magnet: true,
  5654. stroke: "black",
  5655. strokeWidth: 1,
  5656. fill: "#fff",
  5657. },
  5658. },
  5659. },
  5660. },
  5661. items: [
  5662. { id: "inport1", group: "in" },
  5663. { id: "inport2", group: "in" },
  5664. { id: "outport1", group: "out" },
  5665. { id: "outport2", group: "out" },
  5666. ],
  5667. },
  5668. id: "283ddff1-40c9-43aa-b581-b99706e65fb3",
  5669. zIndex: 11,
  5670. },
  5671. {
  5672. shape: "edge",
  5673. attrs: {
  5674. line: {
  5675. stroke: "#808080",
  5676. strokeWidth: 1,
  5677. targetMarker: { name: "block", args: { size: "6" } },
  5678. },
  5679. },
  5680. id: "5f83bef7-8f4c-4b6a-ac51-b076c1e03042",
  5681. router: { name: "er", args: { offset: "center" } },
  5682. tools: {
  5683. items: [{ name: "button-remove", args: { distance: -40 } }],
  5684. },
  5685. source: {
  5686. cell: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  5687. port: "outport2",
  5688. },
  5689. target: {
  5690. cell: "6d787d4a-a68d-4a8c-a3b9-559eb5d4e231",
  5691. port: "inport1",
  5692. },
  5693. zIndex: 12,
  5694. },
  5695. {
  5696. shape: "edge",
  5697. attrs: {
  5698. line: {
  5699. stroke: "#808080",
  5700. strokeWidth: 1,
  5701. targetMarker: { name: "block", args: { size: "6" } },
  5702. },
  5703. },
  5704. id: "9017467c-167e-4f01-97dd-37d2d42bd0ed",
  5705. router: { name: "er", args: { offset: "center" } },
  5706. tools: {
  5707. items: [{ name: "button-remove", args: { distance: -40 } }],
  5708. },
  5709. source: {
  5710. cell: "6d787d4a-a68d-4a8c-a3b9-559eb5d4e231",
  5711. port: "outport1",
  5712. },
  5713. target: {
  5714. cell: "283ddff1-40c9-43aa-b581-b99706e65fb3",
  5715. port: "inport1",
  5716. },
  5717. zIndex: 13,
  5718. },
  5719. ]);
  5720. console.log("fromJson");
  5721. },
  5722. //20211110
  5723. // 获取数据列表------------------20211115 可能后续需要将 其改为workflowdatalist
  5724. getDataList() {
  5725. this.dataListLoading = true;
  5726. this.$http({
  5727. url: this.$http.adornUrl("/sys/visiworkflow/list"),
  5728. method: "get",
  5729. params: this.$http.adornParams({
  5730. page: 1,
  5731. limit: 100,
  5732. key: "",
  5733. // page: this.pageIndex,
  5734. // limit: this.pageSize,
  5735. // key: this.dataForm.key,
  5736. }),
  5737. }).then(({ data }) => {
  5738. if (data && data.code === 0) {
  5739. this.workflowdataList = data.page.list;
  5740. this.workflowtotalPage = data.page.totalCount;
  5741. } else {
  5742. this.workflowdataList = [];
  5743. this.workflowtotalPage = 0;
  5744. }
  5745. this.dataListLoading = false;
  5746. });
  5747. },
  5748. // 每页数 ---避免与其他函数冲突,可能需要改参数 1115
  5749. sizeChangeHandle(val) {
  5750. this.pageSize = val;
  5751. this.pageIndex = 1;
  5752. this.getDataList();
  5753. },
  5754. // 当前页
  5755. currentChangeHandle(val) {
  5756. this.pageIndex = val;
  5757. this.getDataList();
  5758. },
  5759. // 多选
  5760. selectionChangeHandle(val) {
  5761. this.dataListSelections = val;
  5762. },
  5763. //20210805 zhang 右侧参数设置栏 design-panel
  5764. handleFormLayoutChange(e) {
  5765. this.formLayout = e.target.value;
  5766. },
  5767. callback(key) {
  5768. console.log(key);
  5769. },
  5770. //20211115 获取左侧树形组件栏 算法模块节点列表
  5771. // 获取数据列表
  5772. getalgorithmDataList() {
  5773. this.dataListLoading = true;
  5774. this.$http({
  5775. url: this.$http.adornUrl("/sys/visialgorithmnode/list"),
  5776. method: "get",
  5777. params: this.$http.adornParams({
  5778. page: 1,
  5779. limit: 100,
  5780. // key: "",
  5781. }),
  5782. }).then(({ data }) => {
  5783. if (data && data.code === 0) {
  5784. this.algorithmdataList = data.page.list;
  5785. this.algorithmtotalPage = data.page.totalCount;
  5786. //20211115 已成功
  5787. console.log("20211115 左侧节点栏数据");
  5788. console.log(this.algorithmdataList);
  5789. this.createAlgorithmNode();
  5790. } else {
  5791. this.algorithmdataList = [];
  5792. this.totalPage = 0;
  5793. console.log("20211115 左侧节点栏数据 为空");
  5794. console.log(this.algorithmdataList);
  5795. }
  5796. this.dataListLoading = false;
  5797. });
  5798. },
  5799. //添加函数 ----根据数据库中的数据来创建画布中的节点, ----树形组件中的数据包括键
  5800. // 左侧树形组件栏读取数据库表visi_algorithmnode中数据,添加至树形组件treedata中,并创建对应画布节点后添加至nodedata中,可通过点击树形组件栏在画布中创建对应节点的克隆。------已成功
  5801. createAlgorithmNode() {
  5802. this.treeData = [
  5803. {
  5804. title: "操作节点",
  5805. key: "0-0",
  5806. slots: {
  5807. icon: "smile",
  5808. },
  5809. children: [
  5810. // {
  5811. // title: "consume_artifact",
  5812. // key: "consume_artifact",
  5813. // slots: { icon: "meh" },
  5814. // },
  5815. // {
  5816. // title: "generate_artifact",
  5817. // key: "generate_artifact",
  5818. // scopedSlots: { icon: "custom" },
  5819. // },
  5820. // {
  5821. // title: "zdockertest",
  5822. // key: "zdockertest",
  5823. // scopedSlots: { icon: "custom" },
  5824. // },
  5825. {
  5826. title: "条件节点",
  5827. key: "条件节点",
  5828. scopedSlots: { icon: "custom" },
  5829. },
  5830. {
  5831. title: "输入节点",
  5832. key: "dataInputnode",
  5833. scopedSlots: { icon: "custom" },
  5834. },
  5835. {
  5836. title: "输出节点",
  5837. key: "dataOutputnode",
  5838. scopedSlots: { icon: "custom" },
  5839. },
  5840. {
  5841. title: "CSV文件转换节点",
  5842. key: "CSVConversionnode",
  5843. scopedSlots: { icon: "custom" },
  5844. },
  5845. ],
  5846. },
  5847. {
  5848. title: "轮廓识别",
  5849. key: "0-1",
  5850. slots: {
  5851. icon: "smile",
  5852. },
  5853. children: [
  5854. {
  5855. title: "contourTask1",
  5856. key: "contourTask1",
  5857. scopedSlots: { icon: "custom" },
  5858. },
  5859. {
  5860. title: "contourTask2",
  5861. key: "contourTask2",
  5862. scopedSlots: { icon: "custom" },
  5863. },
  5864. {
  5865. title: "contourTask3",
  5866. key: "contourTask3",
  5867. scopedSlots: { icon: "custom" },
  5868. },
  5869. {
  5870. title: "contourApproximate1",
  5871. key: "contourApproximate1",
  5872. scopedSlots: { icon: "custom" },
  5873. },
  5874. {
  5875. title: "contourApproximate2",
  5876. key: "contourApproximate2",
  5877. scopedSlots: { icon: "custom" },
  5878. },
  5879. {
  5880. title: "contourRect1",
  5881. key: "contourRect1",
  5882. scopedSlots: { icon: "custom" },
  5883. },
  5884. {
  5885. title: "contourCircle2",
  5886. key: "contourCircle2",
  5887. scopedSlots: { icon: "custom" },
  5888. },
  5889. ],
  5890. },
  5891. ];
  5892. for (var i = 0; i < this.algorithmdataList.length; i++) {
  5893. // //遍历数组
  5894. // console.log(i);
  5895. // console.log(this.algorithmdataList[i].algonodeName);
  5896. // console.log(this.algorithmdataList[i].algonodeImage);
  5897. // console.log(JSON.parse(this.algorithmdataList[i].algoparatempJson)); //将string转化为Json
  5898. // console.log(
  5899. // JSON.parse(this.algorithmdataList[i].algoparatempJson).Input
  5900. // );
  5901. // console.log(
  5902. // JSON.parse(this.algorithmdataList[i].algoparatempJson).Output
  5903. // );
  5904. // console.log("treeData");
  5905. // console.log(this.treeData);
  5906. // this.treeData[1].children.addNode({
  5907. // title: "this.algorithmdataList[i].algonodeName",
  5908. // key: "this.algorithmdataList[i].algonodeName",
  5909. // scopedSlots: { icon: "custom" },
  5910. // })
  5911. var addalgotree = false; //标志 目录树是否已添加该节点
  5912. for (var j = 0; j < this.treeData.length; j++) {
  5913. if (
  5914. this.treeData[j].title == this.algorithmdataList[i].algotreetype
  5915. ) {
  5916. // //判断是否已有该节点
  5917. // for (var k = 0; k < this.treeData.children.length; k++) {
  5918. // if (
  5919. // this.treeData.children[k].key ==
  5920. // this.algorithmdataList[i].algonodeName
  5921. // ) {
  5922. // addalgotree = true;
  5923. // break;
  5924. // }
  5925. // }
  5926. // if (!addalgotree) {
  5927. this.treeData[j].children.push({
  5928. title: this.algorithmdataList[i].algonodeName,
  5929. key: this.algorithmdataList[i].algonodeName,
  5930. scopedSlots: { icon: "custom" },
  5931. });
  5932. addalgotree = true;
  5933. // break;
  5934. // }
  5935. }
  5936. }
  5937. if (!addalgotree) {
  5938. this.treeData.push({
  5939. title: this.algorithmdataList[i].algotreetype,
  5940. key: this.algorithmdataList[i].algotreetype,
  5941. scopedSlots: { icon: "custom" },
  5942. children: [
  5943. {
  5944. title: this.algorithmdataList[i].algonodeName,
  5945. key: this.algorithmdataList[i].algonodeName,
  5946. scopedSlots: { icon: "custom" },
  5947. },
  5948. ],
  5949. });
  5950. }
  5951. // this.treeData[1].children.push({
  5952. // title: this.algorithmdataList[i].algonodeName,
  5953. // key: this.algorithmdataList[i].algonodeName,
  5954. // scopedSlots: { icon: "custom" },
  5955. // });
  5956. console.log(this.treeData);
  5957. // var imageurl =
  5958. // "/src/assets/img/" + this.algorithmdataList[i].algonodeName + ".svg";
  5959. //节点名称后跟随机参数
  5960. if (
  5961. this.algorithmdataList[i].algotreetype != "传统算法" &&
  5962. this.algorithmdataList[i].algotreetype != "智能应用"
  5963. ) {
  5964. this.imageurl = require("@/assets/img/visisvg/" +
  5965. this.algorithmdataList[i].algonodeName +
  5966. ".svg");
  5967. }
  5968. var newalgonode = this.graph.createNode({
  5969. x: 0,
  5970. y: 0,
  5971. // width: 170,
  5972. // height: 30,
  5973. shape: "template-node",
  5974. // label: "consume_artifact",
  5975. attrs: {
  5976. label: {
  5977. text: this.algorithmdataList[i].algonodeName, //"contour_task1",
  5978. // text: this.algorithmdataList[i].algonodeName, //"contour_task1",
  5979. },
  5980. body: {
  5981. // stroke: "#2CB9FF",
  5982. // fill: "#2CB9FF",
  5983. fill: "#d3ebf3",
  5984. },
  5985. // body: {
  5986. // stroke: "#DA2625",
  5987. // fill: "#DA2625",
  5988. // },
  5989. image: {
  5990. "xlink:href": this.imageurl,
  5991. // "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  5992. // "src/views/modules/visi/visisvg/算法.svg", /src/assets/img/ ../../../assets/img/
  5993. //可放图标
  5994. },
  5995. },
  5996. data: {
  5997. algonodeId: this.algorithmdataList[i].algonodeId,
  5998. nodeName: this.algorithmdataList[i].algonodeName,
  5999. templateName: this.algorithmdataList[i].algonodeName,
  6000. templateImage: this.algorithmdataList[i].algonodeImage,
  6001. templateCommand: {
  6002. // 1: "sh",
  6003. // 2: "-c",
  6004. // 2:"\"{{inputs.parameters.message}}\""
  6005. },
  6006. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  6007. // templateCommand2: [
  6008. // {
  6009. // 1:"echo"
  6010. // },
  6011. // {
  6012. // 2:"{{inputs.parameters.message}}"
  6013. // },
  6014. // ],
  6015. templateArgs: {
  6016. // 1: "cat /tmp/message",
  6017. },
  6018. algoparaInput: JSON.parse(
  6019. this.algorithmdataList[i].algoparatempJson
  6020. ).Input,
  6021. algoparaOutput: JSON.parse(
  6022. this.algorithmdataList[i].algoparatempJson
  6023. ).Output,
  6024. algoparaOutAddress: this.algorithmdataList[i].algoparaoutputAddress,
  6025. algonodeSource: [],
  6026. inputsparameters: JSON.parse(
  6027. this.algorithmdataList[i].algoparatempJson
  6028. ).Input.ParameterInput,
  6029. inputsartifacts: JSON.parse(
  6030. this.algorithmdataList[i].algoparatempJson
  6031. ).Input.FileInput,
  6032. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  6033. //应对应input中的各项参数设置对应参数
  6034. argumentsparameters: JSON.parse(
  6035. this.algorithmdataList[i].algoparatempJson
  6036. ).Input.ParameterInput,
  6037. argumentsartifacts: JSON.parse(
  6038. this.algorithmdataList[i].algoparatempJson
  6039. ).Input.FileInput,
  6040. outputsparameters: JSON.parse(
  6041. this.algorithmdataList[i].algoparatempJson
  6042. ).Output.ParameterOutput,
  6043. outputsartifacts: JSON.parse(
  6044. this.algorithmdataList[i].algoparatempJson
  6045. ).Output.FileOutput,
  6046. //获取到的连接线源的数据 连接线的源的输出数据
  6047. sourcedatalist: [],
  6048. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  6049. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  6050. wftempname: "", //保存Template name
  6051. },
  6052. });
  6053. this.nodedata.push(newalgonode);
  6054. console.log(newalgonode.getData());
  6055. }
  6056. },
  6057. //20211115 左侧栏新增节点测试,未完成 ---------仅测试通过,可存入,需结合新增前端页面重新配置
  6058. addalgorithmdata() {
  6059. this.$http({
  6060. url: this.$http.adornUrl("/sys/visialgorithmnode/save"),
  6061. method: "post",
  6062. data: this.$http.adornData({
  6063. userId: this.$store.state.user.id,
  6064. algonodeId: undefined,
  6065. algonodeName: "contourCircle2",
  6066. algonodeImage: "zvinjodocker/contours_circle2:20211015",
  6067. algoparatempJson: JSON.stringify({
  6068. Input: [
  6069. { paraname: " cnt", paratype: " ", paradesc: " " },
  6070. { paraname: "contour", paratype: " ", paradesc: " " },
  6071. ],
  6072. Output: [
  6073. { paraname: " ", paratype: " ", paradesc: " " },
  6074. { paraname: "", paratype: " ", paradesc: " " },
  6075. ],
  6076. }),
  6077. algoparaoutputAddress: "", //this.dataForm.algoparaoutputAddress
  6078. // userId: this.dataForm.userId,
  6079. // algonodeId: this.dataForm.algonodeId || undefined,
  6080. // algonodeName: this.dataForm.algonodeName,
  6081. // algonodeImage: this.dataForm.algonodeImage,
  6082. // algoparatempJson: this.dataForm.algoparatempJson,
  6083. }),
  6084. }).then(({ data }) => {
  6085. if (data && data.code === 0) {
  6086. Message.success("操作成功");
  6087. // this.$message({
  6088. // message: "操作成功",
  6089. // type: "success",
  6090. // duration: 1500,
  6091. // onClose: () => {
  6092. // this.visible = false;
  6093. // this.$emit("refreshDataList");
  6094. // },
  6095. // });
  6096. } else {
  6097. Message.error(data.msg);
  6098. // this.$message.error(data.msg);
  6099. }
  6100. });
  6101. // this.$refs['dataForm'].validate((valid) => {
  6102. // if (valid) {
  6103. // this.$http({
  6104. // url: this.$http.adornUrl(`/generator/visialgorithmnode/${!this.dataForm.algonodeId ? 'save' : 'update'}`),
  6105. // method: 'post',
  6106. // data: this.$http.adornData({
  6107. // 'userId': this.dataForm.userId,
  6108. // 'algonodeId': this.dataForm.algonodeId || undefined,
  6109. // 'algonodeName': this.dataForm.algonodeName,
  6110. // 'algonodeImage': this.dataForm.algonodeImage,
  6111. // 'algoparatempJson': this.dataForm.algoparatempJson
  6112. // })
  6113. // }).then(({data}) => {
  6114. // if (data && data.code === 0) {
  6115. // this.$message({
  6116. // message: '操作成功',
  6117. // type: 'success',
  6118. // duration: 1500,
  6119. // onClose: () => {
  6120. // this.visible = false
  6121. // this.$emit('refreshDataList')
  6122. // }
  6123. // })
  6124. // } else {
  6125. // this.$message.error(data.msg)
  6126. // }
  6127. // })
  6128. // }
  6129. // })
  6130. },
  6131. //保存实验名称
  6132. primaryExperimentConfig(args) {
  6133. console.log("保存实验名称");
  6134. console.log(args);
  6135. this.experimentName = args[0];
  6136. console.log(this.experimentName);
  6137. },
  6138. //20210810 保存条件节点设置
  6139. primaryConNodeConfig(args) {
  6140. this.graph
  6141. .getCellById(args[1].id)
  6142. .setData({ inputcondition: args[1].getData().inputcondition });
  6143. this.graph
  6144. .getCellById(args[1].id)
  6145. .setData({ nodeName: args[1].getData().nodeName });
  6146. //20210811 测试用
  6147. // //model 获取节点信息
  6148. // //遍历节点信息, 比对节点id 然后赋值
  6149. // console.log("cell:"+args[1]);
  6150. // console.log("cell:"+args[1].id);
  6151. // //返回 [Object,Object ]
  6152. // console.log("对应id的node:"+this.graph.getCellById(args[1]));
  6153. // console.log("更改过的inputcondition:"+args[1].getData("inputcondition"));
  6154. // console.log(args[1].getData().inputcondition);
  6155. // const condition = args[1].getData().inputcondition;
  6156. // this.graph.getCellById(args[1].id).setData({inputcondition: condition});
  6157. // console.log(args[1])
  6158. // console.log("graph node:"+this.graph.getNodes());
  6159. },
  6160. //20210811 保存templateNode节点设置 仅参数设置
  6161. primaryNodeConfig(args) {
  6162. var primarydata = args[1].getData();
  6163. //先保存一遍,做处理在保存一遍
  6164. console.log("更改前");
  6165. console.log(this.graph.getCellById(args[1].id));
  6166. //此部分应该只是展示,不可更改
  6167. // this.graph.getCellById(args[1].id).setData({templateName:primarydata.templateName});
  6168. // this.graph.getCellById(args[1].id).setData({templateImage: primarydata.templateImage});
  6169. // this.graph.getCellById(args[1].id).setData({templateCommand: primarydata.templateCommand});
  6170. // this.graph.getCellById(args[1].id).setData({templateArgs: primarydata.templateArgs});
  6171. // this.graph.getCellById(args[1].id).setData({inputsparameters: primarydata.inputsparameters}); //应该是不变的
  6172. // this.graph.getCellById(args[1].id).setData({outputsparameters: primarydata.outputsparameters}); //应该是不变的
  6173. //仅可更改argumentsparameters 具体对接 还需实现后端
  6174. //20211124 primarydata
  6175. //保存参数类型
  6176. for (var i = 0; i < primarydata.argumentsparameters.length; i++) {
  6177. if (primarydata.argumentsparameters[i].hasOwnProperty("quotevalue")) {
  6178. //成功
  6179. // if (primarydata.argumentsparameters[i].quotevalue && primarydata.argumentsparameters[i].quotevalue.length == 2) {
  6180. // primarydata.argumentsparameters[i].valuefrom =
  6181. // "{{tasks." +
  6182. // primarydata.argumentsparameters[i].quotevalue[0] +
  6183. // ".outputs.parameters." +
  6184. // primarydata.argumentsparameters[i].quotevalue[1] +
  6185. // "}}";
  6186. // console.log(primarydata.argumentsparameters[i].valuefrom)
  6187. // }
  6188. // 引用其他算法节点参数类型输入改为多选节点之后
  6189. primarydata.argumentsparameters[i].valuefrom = [];
  6190. if (
  6191. primarydata.argumentsparameters[i].quotevalue &&
  6192. primarydata.argumentsparameters[i].quotevalue.length != 0
  6193. ) {
  6194. // primarydata.argumentsparameters[i].valuefrom = [];
  6195. for (
  6196. var j = 0;
  6197. j < primarydata.argumentsparameters[i].quotevalue.length;
  6198. j++
  6199. ) {
  6200. console.log(
  6201. " quotevalue.length " +
  6202. primarydata.argumentsparameters[i].quotevalue.length
  6203. );
  6204. primarydata.argumentsparameters[i].valuefrom.push(
  6205. "{{tasks." +
  6206. primarydata.argumentsparameters[i].quotevalue[j][0] +
  6207. ".outputs.parameters." +
  6208. primarydata.argumentsparameters[i].quotevalue[j][1] +
  6209. "}}"
  6210. );
  6211. }
  6212. console.log(primarydata.argumentsparameters[i].valuefrom);
  6213. }
  6214. }
  6215. }
  6216. //保存文件类型
  6217. // const curfilelist = [];
  6218. let filedata = new FormData(); //保存文件内容,传递给后端---遍历完所有的argumentartifact之后统一上传
  6219. for (var i = 0; i < primarydata.argumentsartifacts.length; i++) {
  6220. if (primarydata.argumentsartifacts[i].hasOwnProperty("quotevalue")) {
  6221. if (
  6222. primarydata.argumentsartifacts[i].quotevalue &&
  6223. primarydata.argumentsartifacts[i].quotevalue.length == 2
  6224. ) {
  6225. primarydata.argumentsartifacts[i].valuefrom =
  6226. "{{tasks." +
  6227. primarydata.argumentsartifacts[i].quotevalue[0] +
  6228. ".outputs.artifacts." +
  6229. primarydata.argumentsartifacts[i].quotevalue[1] +
  6230. "}}";
  6231. }
  6232. }
  6233. //1125 需后端保存至 minio 中,返回地址 -----或者在画布提交之后,上传,在应用具体地址信息
  6234. if (primarydata.argumentsartifacts[i].hasOwnProperty("filelist")) {
  6235. if (primarydata.argumentsartifacts[i].filelist.length != 0) {
  6236. const curfilelist = [];
  6237. // const curfileurl = []; //设定一次只能传一个
  6238. // let filedata = new FormData(); //保存文件内容,传递给后端
  6239. for (
  6240. var j = 0;
  6241. j < primarydata.argumentsartifacts[i].filelist.length;
  6242. j++
  6243. ) {
  6244. curfilelist.push(
  6245. primarydata.argumentsartifacts[i].filelist[j].raw
  6246. );
  6247. // filedata.append("file",primarydata.argumentsartifacts[i].filelist[j].raw);
  6248. }
  6249. primarydata.argumentsartifacts[i].filelist = curfilelist;
  6250. // filedata.append("file"+primarydata.argumentsartifacts[i].paraname,primarydata.argumentsartifacts[i].filelist[0].raw);//每个参数仅可输入一个文件
  6251. filedata.append(
  6252. primarydata.argumentsartifacts[i].paraname,
  6253. curfilelist[0]
  6254. ); //每个参数仅可输入一个文件
  6255. // console.log(filedata.get(primarydata.argumentsartifacts[i].paraname));
  6256. }
  6257. }
  6258. }
  6259. if (filedata != null) {
  6260. var jsonfileurl = {};
  6261. this.$http({
  6262. url: this.$http.adornUrl("/visi/visiworkflow/savefile"),
  6263. method: "post",
  6264. data: filedata,
  6265. }).then(({ data }) => {
  6266. if (data && data.code === 0) {
  6267. jsonfileurl = data.jsonfileurl;
  6268. for (var i = 0; i < primarydata.argumentsartifacts.length; i++) {
  6269. if (
  6270. jsonfileurl.hasOwnProperty(
  6271. primarydata.argumentsartifacts[i].paraname
  6272. )
  6273. ) {
  6274. // console.log(
  6275. // jsonfileurl[primarydata.argumentsartifacts[i].paraname]
  6276. // );
  6277. primarydata.argumentsartifacts[i].fileurls.push(
  6278. jsonfileurl[primarydata.argumentsartifacts[i].paraname]
  6279. );
  6280. this.graph.getCellById(args[1].id).setData(primarydata); //终于好了 20211130
  6281. }
  6282. }
  6283. // console.log(data.jsonfileurl)
  6284. // fileurls = data.fileurls;
  6285. // curfileurl.push(data.fileurls);
  6286. /////设置的都是 i,为什么无论怎样都会赋值给 0
  6287. // primarydata.argumentsartifacts[i].fileurls=data.fileurls;
  6288. // console.log("i")
  6289. // this.graph.getCellById(args[1].id).setData(primarydata); //成功成功
  6290. // this.$message({
  6291. // message: "操作成功",
  6292. // type: "success",
  6293. // duration: 1500,
  6294. // onClose: () => {
  6295. // // this.getDataList();
  6296. // },
  6297. // });
  6298. } else {
  6299. Message.error(data.msg);
  6300. // this.$message.error(data.msg);
  6301. }
  6302. });
  6303. }
  6304. // this.graph.getCellById(args[1].id).setData(primarydata); //对应input 保存相应输入的值
  6305. this.graph
  6306. .getCellById(args[1].id)
  6307. .setData({ argumentsparameters: primarydata.argumentsparameters }); //对应input 保存相应输入的值
  6308. this.graph
  6309. .getCellById(args[1].id)
  6310. .setData({ argumentsartifacts: primarydata.argumentsartifacts }); //对应input 保存相应输入的值
  6311. // console.log("当前节点值");
  6312. // console.log(this.graph.getCellById(args[1].id).getData());
  6313. // console.log(
  6314. // this.graph.getCellById(args[1].id).getData().argumentsartifacts
  6315. // );
  6316. this.graph
  6317. .getCellById(args[1].id)
  6318. .setData({ nodeName: primarydata.nodeName }); //对应input 保存相应输入的值
  6319. // console.log("cell:" + args[1].id);
  6320. // console.log("对应id的node:" + this.graph.getCellById(args[1]).toString());
  6321. // console.log(this.graph.getCellById(args[1].id));
  6322. //20211119
  6323. this.graph
  6324. .getCellById(args[1].id)
  6325. .setData({ algoparaInput: primarydata.algoparaInput }); //对应input 保存相应输入的值
  6326. this.graph
  6327. .getCellById(args[1].id)
  6328. .setData({ algonodeSource: primarydata.algonodeSource });
  6329. // console.log("primary-------------");
  6330. // console.log(this.graph.getCellById(args[1].id).getData().algoparaInput);
  6331. // console.log(this.graph.getCellById(args[1].id).getData().algoparaOutput);
  6332. // 遍历algoparaInput中algoparaGetInput中的数据,添加文件地址,后保存到映射关系数据库中
  6333. const curalgoparaInput = primarydata.algoparaInput;
  6334. for (var i = 0; i < curalgoparaInput.getInput.length; i++) {
  6335. for (var j = 0; j < primarydata.algonodeSource.length; j++) {
  6336. if (curalgoparaInput.getInput[i].paravalue != null) {
  6337. if (
  6338. curalgoparaInput.getInput[i].paravalue[0] ==
  6339. primarydata.algonodeSource[j].getData().nodeName
  6340. ) {
  6341. curalgoparaInput.getInput[i].paravalue.push(
  6342. primarydata.algonodeSource[j].getData().algoparaOutAddress
  6343. );
  6344. }
  6345. }
  6346. }
  6347. }
  6348. //202111123 保存在 节点数据中 将curalgoparaInput 保存为 algoparaInput
  6349. // console.log("this.graph.getCellById(args[1].id).getData().algoparaInput");
  6350. this.graph
  6351. .getCellById(args[1].id)
  6352. .setData({ algoparaInput: curalgoparaInput }); //对应input 保存相应输入的值
  6353. // console.log(this.graph.getCellById(args[1].id).getData().algoparaInput);
  6354. // console.log(
  6355. // "遍历algoparaInput中algoparaGetInput中的数据,添加文件地址,后保存到映射关系数据库中"
  6356. // );
  6357. // console.log(curalgoparaInput);
  6358. // 20211123 该部分代码每次保存都会在数据库中添加新的记录
  6359. // this.$http({
  6360. // url: this.$http.adornUrl("/sys/visiworkflowparamap/save"),
  6361. // method: "post",
  6362. // data: this.$http.adornData({
  6363. // paramapId: undefined,
  6364. // userId: this.$store.state.user.id,
  6365. // workflowId: "",
  6366. // inputparaNodename: this.graph.getCellById(args[1].id).getData()
  6367. // .nodeName,
  6368. // inputparaJson: JSON.stringify(curalgoparaInput),
  6369. // }),
  6370. // }).then(({ data }) => {
  6371. // if (data && data.code === 0) {
  6372. // this.$message({
  6373. // message: "操作成功",
  6374. // type: "success",
  6375. // duration: 1500,
  6376. // onClose: () => {
  6377. // this.visible = false;
  6378. // // this.$emit('refreshDataList')
  6379. // },
  6380. // });
  6381. // } else {
  6382. // this.$message.error(data.msg);
  6383. // }
  6384. // });
  6385. },
  6386. primaryCSVselectNodeconfig(args){
  6387. var primarydata = args[1].getData();
  6388. this.graph.getCellById(args[1].id).setData(primarydata);
  6389. // console.log("转换节点新数据")
  6390. // console.log(args[1].getData())
  6391. // console.log(this.graph.getCellById(args[1].id).getData())
  6392. },
  6393. //20210812 左侧树形组件
  6394. handleDragStart(node, ev) {
  6395. console.log("drag start", node);
  6396. },
  6397. handleDragEnter(draggingNode, dropNode, ev) {
  6398. console.log("tree drag enter: ", dropNode.label);
  6399. },
  6400. handleDragLeave(draggingNode, dropNode, ev) {
  6401. console.log("tree drag leave: ", dropNode.label);
  6402. },
  6403. handleDragOver(draggingNode, dropNode, ev) {
  6404. console.log("tree drag over: ", dropNode.label);
  6405. },
  6406. handleDragEnd(draggingNode, dropNode, dropType, ev) {
  6407. console.log("tree drag end: ", dropNode && dropNode.label, dropType);
  6408. },
  6409. handleDrop(draggingNode, dropNode, dropType, ev) {
  6410. console.log("tree drop: ", dropNode.label, dropType);
  6411. },
  6412. allowDrop(draggingNode, dropNode, type) {
  6413. if (dropNode.data.label === "二级 3-1") {
  6414. return type !== "inner";
  6415. } else {
  6416. return true;
  6417. }
  6418. },
  6419. allowDrag(draggingNode) {
  6420. return draggingNode.data.label.indexOf("三级 3-2-2") === -1;
  6421. },
  6422. //20210813
  6423. onSelect(selectedKeys, info) {
  6424. console.log("selected", selectedKeys, info);
  6425. },
  6426. //20210813 dnd
  6427. startDrag(e) {
  6428. // console.log("拖拽前");
  6429. // const target = this.currentTarget
  6430. const target = e.currentTarget;
  6431. const type = target.getAttribute("data-type");
  6432. const node = this.graph.createNode({
  6433. width: 100,
  6434. height: 40,
  6435. attrs: {
  6436. label: {
  6437. text: "circle",
  6438. fill: "#6a6c8a",
  6439. },
  6440. body: {
  6441. stroke: "#31d0c6",
  6442. strokeWidth: 2,
  6443. },
  6444. },
  6445. });
  6446. // console.log("拖拽");
  6447. this.dnd.start(node, e);
  6448. //删除.nativeEvent 前会出错
  6449. // this.dnd.start(node, e.nativeEvent);
  6450. },
  6451. //20210926 树形组件
  6452. onSelect(selectedKeys, info) {
  6453. // console.log("selected", selectedKeys, info);
  6454. // console.log(selectedKeys);
  6455. // console.log(info);
  6456. const zdocker_test = this.graph.createNode({
  6457. // width: 170,
  6458. // height: 30,
  6459. shape: "template-node",
  6460. // label: "consume_artifact",
  6461. attrs: {
  6462. label: {
  6463. text: "zdockertest",
  6464. },
  6465. body: {
  6466. // stroke: "#2CB9FF",
  6467. // fill: "#2CB9FF",
  6468. fill: "#d3ebf3",
  6469. },
  6470. // body: {
  6471. // stroke: "#DA2625",
  6472. // fill: "#DA2625",
  6473. // },
  6474. image: {
  6475. "xlink:href":
  6476. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  6477. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  6478. //可放图标
  6479. },
  6480. },
  6481. data: {
  6482. nodeName: "zdockertest",
  6483. templateName: "print-message",
  6484. templateImage: "zvinjodocker/zdockertest1:20211011",
  6485. templateCommand: {
  6486. // 1: "sh",
  6487. // 2: "-c",
  6488. // 2:"\"{{inputs.parameters.message}}\""
  6489. },
  6490. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  6491. // templateCommand2: [
  6492. // {
  6493. // 1:"echo"
  6494. // },
  6495. // {
  6496. // 2:"{{inputs.parameters.message}}"
  6497. // },
  6498. // ],
  6499. templateArgs: {
  6500. // 1: "cat /tmp/message",
  6501. },
  6502. inputsparameters: [],
  6503. inputsartifacts: [
  6504. //此container 需要输入的参数,固定
  6505. // {
  6506. // name: "message",
  6507. // path: "/tmp/message",
  6508. // },
  6509. ],
  6510. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  6511. //应对应input中的各项参数设置对应参数
  6512. argumentsparameters: [],
  6513. argumentsartifacts: [
  6514. //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  6515. // {
  6516. // name: "message",
  6517. // valuefrom: "{{tasks.whalesay.outputs.artifacts.hello-art}}",
  6518. // },
  6519. ],
  6520. outputsparameters: [],
  6521. outputsartifacts: [],
  6522. //获取到的连接线源的数据 连接线的源的输出数据
  6523. sourcedatalist: [
  6524. // {
  6525. // name: "source1",
  6526. // },
  6527. // {
  6528. // name: "source2",
  6529. // },
  6530. ],
  6531. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  6532. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  6533. },
  6534. });
  6535. //20211012
  6536. // 将树形节点的键与 节点名称对应起来。
  6537. // this.graph.addNode(zdocker_test);
  6538. // this.nodedata.addNode(consume_artifact);
  6539. // this.nodedata.appendChild(consume_artifact);
  6540. // this.nodedata.push(consume_artifact);
  6541. // console.log("nodedata");
  6542. // console.log(this.nodedata);
  6543. // console.log(this.nodedata[0])
  6544. //通过遍历节点列表nodedata中键 selectedKeys与节点中attrs.label.text相匹配,生成对应的节点
  6545. //先将所有的节点创建成功后保存在this.nodedata中,点击对应节点后 匹配正确后将节点加入到画布中
  6546. // console.log(this.nodedata[0].attrs.label.text)
  6547. // this.graph.addNode(this.nodedata[0])
  6548. // console.log(this.nodedata);
  6549. var nodenamenum = Math.floor(Math.random() * 1000); //1000以内随机整数
  6550. for (var i = 0; i < this.nodedata.length; i++) {
  6551. //遍历数组
  6552. if (selectedKeys.toString() === this.nodedata[i].attrs.label.text) {
  6553. // console.log(selectedKeys.toString());
  6554. var clonenode = this.nodedata[i].clone();
  6555. // clonenode.getElementById
  6556. //更改nodeName 及templateName 后添加随机数
  6557. clonenode.setData({
  6558. nodeName: clonenode.getData().nodeName + nodenamenum,
  6559. });
  6560. clonenode.setData({
  6561. templateName: clonenode.getData().templateName + nodenamenum,
  6562. });
  6563. this.graph.addNode(clonenode);
  6564. // this.graph.addNode(this.nodedata[i].clone());
  6565. } else {
  6566. // console.log(selectedKeys.toString());
  6567. }
  6568. // console.log(i);
  6569. }
  6570. },
  6571. onCheck(checkedKeys, info) {
  6572. console.log("onCheck", checkedKeys, info);
  6573. },
  6574. //设置布局可拖动改变大小
  6575. dragControllerDiv: function () {
  6576. // var resize = document.getElementsByClassName("resize");
  6577. // var left = document.getElementsByClassName("left");
  6578. // var mid = document.getElementsByClassName("right");
  6579. // var box = document.getElementsByClassName("box");
  6580. // for (let i = 0; i < resize.length; i++) {
  6581. // // 鼠标按下事件
  6582. // resize[i].onmousedown = function (e) {
  6583. // //颜色改变提醒
  6584. // resize[i].style.background = "#818181";
  6585. // var startX = e.clientX;
  6586. // console.log("拖动改变两侧大小")
  6587. // console.log("startx");
  6588. // console.log(startX);
  6589. // // 鼠标拖动事件
  6590. // document.onmousemove = function (e) {
  6591. // resize[i].left = startX;
  6592. // var endX = e.clientX;
  6593. // var moveLen = resize[i].left + (endX - startX); // (endx-startx)=移动的距离。resize[i].left+移动的距离=左边区域最后的宽度
  6594. // console.log("movelen");
  6595. // console.log(moveLen);
  6596. // var maxT = box[i].clientWidth - resize[i].offsetWidth; // 容器宽度 - 左边区域的宽度 = 右边区域的宽度
  6597. // console.log("maxt ");
  6598. // console.log(maxT);
  6599. // if (moveLen < 800) moveLen = 800; // 左边区域的最小宽度为32px
  6600. // if (moveLen > maxT - 150) moveLen = maxT - 150; //右边区域最小宽度为150px
  6601. // resize[i].style.left = moveLen; // 设置左侧区域的宽度
  6602. // for (let j = 0; j < left.length; j++) {
  6603. // left[j].style.width =(moveLen / document.body.clientWidth) * 100 + "%";
  6604. // mid[j].style.width = ((box[i].clientWidth - moveLen) / document.body.clientWidth -0.008) *100 +"%";
  6605. // }
  6606. // };
  6607. // // 鼠标松开事件
  6608. // document.onmouseup = function (evt) {
  6609. // //颜色恢复
  6610. // resize[i].style.background = "#d6d6d6";
  6611. // document.onmousemove = null;
  6612. // document.onmouseup = null;
  6613. // resize[i].releaseCapture && resize[i].releaseCapture(); //当你不在需要继续获得鼠标消息就要应该调用ReleaseCapture()释放掉
  6614. // };
  6615. // resize[i].setCapture && resize[i].setCapture(); //该函数在属于当前线程的指定窗口里设置鼠标捕获
  6616. // return false;
  6617. // };
  6618. // }
  6619. var resize = document.getElementsByClassName("resize");
  6620. var left = document.getElementsByClassName("left");
  6621. var mid = document.getElementsByClassName("right");
  6622. var box = document.getElementsByClassName("box");
  6623. for (let i = 0; i < resize.length; i++) {
  6624. // 鼠标按下事件
  6625. resize[i].onmousedown = function (e) {
  6626. //颜色改变提醒
  6627. resize[i].style.background = "#818181";
  6628. var startX = e.clientX;
  6629. resize[i].left = resize[i].offsetLeft;
  6630. // 鼠标拖动事件
  6631. document.onmousemove = function (e) {
  6632. var endX = e.clientX;
  6633. var moveLen = resize[i].left + (endX - startX); // (endx-startx)=移动的距离。resize[i].left+移动的距离=左边区域最后的宽度
  6634. var maxT = box[i].clientWidth - resize[i].offsetWidth; // 容器宽度 - 左边区域的宽度 = 右边区域的宽度
  6635. if (moveLen < 800) moveLen = 800; // 左边区域的最小宽度为32px
  6636. if (moveLen > maxT - 300) moveLen = maxT - 300; //右边区域最小宽度为150px
  6637. resize[i].style.left = moveLen; // 设置左侧区域的宽度
  6638. for (let j = 0; j < left.length; j++) {
  6639. left[j].style.width = moveLen + "px";
  6640. mid[j].style.width = box[i].clientWidth - moveLen - 10 + "px";
  6641. }
  6642. };
  6643. // 鼠标松开事件
  6644. document.onmouseup = function (evt) {
  6645. //颜色恢复
  6646. resize[i].style.background = "#d6d6d6";
  6647. document.onmousemove = null;
  6648. document.onmouseup = null;
  6649. resize[i].releaseCapture && resize[i].releaseCapture(); //当你不在需要继续获得鼠标消息就要应该调用ReleaseCapture()释放掉
  6650. };
  6651. resize[i].setCapture && resize[i].setCapture(); //该函数在属于当前线程的指定窗口里设置鼠标捕获
  6652. return false;
  6653. };
  6654. }
  6655. },
  6656. //保存输入节点内容
  6657. primaryInputnodeConfig(args) {
  6658. // console.log("保存输入节点");
  6659. // console.log(args[0].id);
  6660. // // this.$emit("refreshDataList",this.cell,this.st_dataListvalue,this.dy_dataListvalue,this.fileList,this.allfilemap);//各个参数
  6661. // this.graph.getCellById(args[0].id).setData({ st_dataListvalue: args[1] });
  6662. // this.graph.getCellById(args[0].id).setData({ dy_dataListvalue: args[2] });
  6663. // this.graph.getCellById(args[0].id).setData({ fileList: args[3] });
  6664. // this.graph.getCellById(args[0].id).setData({ allfilemap: args[4] });
  6665. // this.$emit("refreshinputnode",this.cell,celldata);
  6666. // console.log(args[1].allfilemap);
  6667. // this.graph.getCellById(args[0].id).setData(args[1]);
  6668. //以该方式 福赋值字符串型可以,数组类型不可以
  6669. // this.graph.getCellById(args[0].id).setData({allfilemap: this.graph.getCellById(args[0].id).getData().allfilemap.concat(args[1].allfilemap)})
  6670. this.graph.getCellById(args[0].id).replaceData(args[1]); /////成功成功
  6671. console.log(this.graph.getCellById(args[0]));
  6672. },
  6673. },
  6674. computed: {
  6675. formItemLayout() {
  6676. const { formLayout } = this;
  6677. return formLayout === "horizontal"
  6678. ? {
  6679. labelCol: { span: 4 },
  6680. wrapperCol: { span: 14 },
  6681. }
  6682. : {};
  6683. },
  6684. buttonItemLayout() {
  6685. const { formLayout } = this;
  6686. return formLayout === "horizontal"
  6687. ? {
  6688. wrapperCol: { span: 14, offset: 4 },
  6689. }
  6690. : {};
  6691. },
  6692. },
  6693. };
  6694. </script>
  6695. <style lang="scss">
  6696. // 20210715 zhang 添加 布局
  6697. #components-layout-demo-responsive .logo {
  6698. height: 32px;
  6699. // background: rgba(255, 255, 255, 0.959);
  6700. margin: 16px;
  6701. display: block;
  6702. background: #dcdfe6;
  6703. }
  6704. .dividesign {
  6705. height: 32px;
  6706. // background: rgba(255, 255, 255, 0.959);
  6707. margin: 16px;
  6708. display: block;
  6709. // background: #dcdfe6;
  6710. // display: block;
  6711. // height: 1px;
  6712. // width: 100%;
  6713. // margin: 24px 0;
  6714. background-color: #dcdfe6;
  6715. // position: relative;
  6716. }
  6717. // .app-stencil {
  6718. // width: 250px;
  6719. // height: 100%;
  6720. // border: 1px solid #f0f0f0;
  6721. // position: relative;
  6722. // }
  6723. .content {
  6724. font-family: sans-serif;
  6725. // display: flex;
  6726. width: 100%;
  6727. background: #dcdfe6;
  6728. }
  6729. // .app-stencil {
  6730. // width: 250px;
  6731. // border: 1px solid #f0f0f0;
  6732. // position: relative;
  6733. // }
  6734. .app-content {
  6735. // flex: 1;
  6736. // height: 520px;
  6737. height: 100%;
  6738. width: 100%;
  6739. margin-left: 8px;
  6740. margin-right: 8px;
  6741. box-shadow: 0 0 10px 1px #e9e9e9;
  6742. // background: #dcdfe6;
  6743. }
  6744. .divi {
  6745. margin: 1px 0;
  6746. }
  6747. .x6-node [magnet="true"] {
  6748. cursor: crosshair;
  6749. transition: none;
  6750. }
  6751. .x6-node [magnet="true"]:hover {
  6752. opacity: 1;
  6753. }
  6754. .x6-node [magnet="true"][port-group="in"] {
  6755. cursor: move;
  6756. }
  6757. .my-port {
  6758. width: 100%;
  6759. height: 100%;
  6760. border: 1px solid #808080;
  6761. border-radius: 100%;
  6762. background: #eee;
  6763. }
  6764. .my-port.connected {
  6765. width: 0;
  6766. height: 0;
  6767. margin-top: 5px;
  6768. margin-left: 1px;
  6769. border-width: 5px 4px 0;
  6770. border-style: solid;
  6771. border-color: #808080 transparent transparent;
  6772. border-radius: 0;
  6773. background-color: transparent;
  6774. }
  6775. .x6-port-body.available {
  6776. overflow: visible;
  6777. }
  6778. .x6-port-body.available body {
  6779. overflow: visible;
  6780. }
  6781. .x6-port-body.available body > div::before {
  6782. content: " ";
  6783. float: left;
  6784. width: 20px;
  6785. height: 20px;
  6786. margin-top: -5px;
  6787. margin-left: -5px;
  6788. border-radius: 50%;
  6789. background-color: rgba(57, 202, 116, 0.6);
  6790. box-sizing: border-box;
  6791. }
  6792. .x6-port-body.available body > div::after {
  6793. content: " ";
  6794. float: left;
  6795. clear: both;
  6796. width: 10px;
  6797. height: 10px;
  6798. margin-top: -15px;
  6799. border-radius: 50%;
  6800. background-color: #fff;
  6801. border: 1px solid #39ca74;
  6802. position: relative;
  6803. z-index: 10;
  6804. box-sizing: border-box;
  6805. }
  6806. .x6-port-body.adsorbed {
  6807. overflow: visible;
  6808. }
  6809. .x6-port-body.adsorbed body {
  6810. overflow: visible;
  6811. }
  6812. .x6-port-body.adsorbed body > div::before {
  6813. content: " ";
  6814. float: left;
  6815. width: 28px;
  6816. height: 28px;
  6817. margin-top: -9px;
  6818. margin-left: -9px;
  6819. border-radius: 50%;
  6820. background-color: rgba(57, 202, 116, 0.6);
  6821. box-sizing: border-box;
  6822. }
  6823. .x6-port-body.adsorbed body > div::after {
  6824. content: " ";
  6825. float: left;
  6826. clear: both;
  6827. width: 10px;
  6828. height: 10px;
  6829. margin-top: -19px;
  6830. border-radius: 50%;
  6831. background-color: #fff;
  6832. border: 1px solid #39ca74;
  6833. position: relative;
  6834. z-index: 10;
  6835. box-sizing: border-box;
  6836. }
  6837. //20210805 design-panel
  6838. .form {
  6839. height: calc(100vh - 100px);
  6840. flex-grow: 1;
  6841. overflow-x: hidden;
  6842. overflow-y: auto;
  6843. background: #fff;
  6844. }
  6845. .ant-tabs-tabpane {
  6846. background: #fff;
  6847. padding: 5px;
  6848. }
  6849. //20210812 zhang 左侧树形组件栏
  6850. .leftDivTree {
  6851. width: 100%;
  6852. height: 93.7%;
  6853. // padding: 10 0px;
  6854. // border:0.2px solid #000;
  6855. // overflow: scroll;
  6856. }
  6857. .leftDivTree ::v-deep .iconfont {
  6858. margin-right: 8px;
  6859. }
  6860. .leftDivTree ::v-deep .el-tree-node {
  6861. display: table;
  6862. min-width: 100%;
  6863. }
  6864. // .leftDivTitle {
  6865. // color: #fff;
  6866. // border-color: #409eff;
  6867. // font-size: 14px;
  6868. // }
  6869. //20210813 左侧组件
  6870. .dnd-rect {
  6871. width: 80px;
  6872. height: 20px;
  6873. border: 2px solid #31d0c6;
  6874. text-align: center;
  6875. line-height: 40px;
  6876. margin: 16px;
  6877. cursor: move;
  6878. }
  6879. //设置布局 可拖动改变大小
  6880. .left {
  6881. width: 69.2%;
  6882. // width: 100%;
  6883. height: 100%;
  6884. overflow-y: auto;
  6885. overflow-x: hidden;
  6886. float: left;
  6887. display: flex;
  6888. }
  6889. .resize {
  6890. cursor: col-resize;
  6891. float: left;
  6892. position: relative;
  6893. top: 10%;
  6894. background-color: #d6d6d6;
  6895. border-radius: 5px;
  6896. margin-top: -10px;
  6897. width: 10px;
  6898. // height: 50px;
  6899. height: 70%;
  6900. line-height: 50px;
  6901. // line-height: 100%;
  6902. // text-align: center;
  6903. background-size: cover;
  6904. background-position: center;
  6905. font-size: 32px;
  6906. color: white;
  6907. }
  6908. /*拖拽区鼠标悬停样式*/
  6909. .resize:hover {
  6910. color: #444444;
  6911. }
  6912. .right {
  6913. // height: 7.8rem;
  6914. height: 100%;
  6915. float: left;
  6916. width: 30%;
  6917. display: flex;
  6918. }
  6919. .box {
  6920. width: 100%;
  6921. // height: 7.8rem;
  6922. height: 100%;
  6923. }
  6924. .boxform {
  6925. width: 100%;
  6926. height: 100%;
  6927. flex: 1;
  6928. background-color: #fff;
  6929. }
  6930. .boxformitem {
  6931. border-style: solid;
  6932. border-width: 1px;
  6933. border-color: #dcdfe6;
  6934. }
  6935. // .el-icon-video-play:before {
  6936. // content: "提交";
  6937. // }
  6938. .mod-demo-echarts {
  6939. > .el-alert {
  6940. margin-bottom: 10px;
  6941. }
  6942. > .el-row {
  6943. margin-top: -10px;
  6944. margin-bottom: -10px;
  6945. .el-col {
  6946. padding-top: 10px;
  6947. padding-bottom: 10px;
  6948. }
  6949. }
  6950. .chart-box {
  6951. min-height: 400px;
  6952. }
  6953. }
  6954. .divi {
  6955. display: block;
  6956. height: 1px;
  6957. width: 100%;
  6958. margin: 24px 0;
  6959. background-color: #dcdfe6;
  6960. position: relative;
  6961. }
  6962. .divi2 {
  6963. display: block;
  6964. height: 1px;
  6965. width: 100%;
  6966. position: relative;
  6967. }
  6968. .x6-graph-scroller {
  6969. min-height: 800px;
  6970. }
  6971. </style>