design-graph1.vue 234 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160
  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. },
  3366. });
  3367. //20211012 zhang
  3368. console.log("nodedata");
  3369. // console.log(this.nodedata)
  3370. this.nodedata.push(consume_artifact);
  3371. this.nodedata.push(generate_artifact);
  3372. this.nodedata.push(zdocker_test);
  3373. this.nodedata.push(contourTask1);
  3374. this.nodedata.push(contourTask2);
  3375. this.nodedata.push(contourTask3);
  3376. this.nodedata.push(contourApproximate1);
  3377. this.nodedata.push(contourApproximate2);
  3378. this.nodedata.push(contourRect1);
  3379. this.nodedata.push(contourCircle2);
  3380. //数据输入 和 结果输出节点
  3381. this.nodedata.push(dataInputnode);
  3382. this.nodedata.push(dataOutputnode);
  3383. this.nodedata.push(CSVConversionnode);
  3384. console.log(this.nodedata);
  3385. //设置布局左右可拖动
  3386. let me = this;
  3387. me.dragControllerDiv();
  3388. console.log("yu");
  3389. },
  3390. methods: {
  3391. initGraph(info) {
  3392. //修改当前画布
  3393. //查询画布数据,导入画布
  3394. this.workflowId = info.workflowId;
  3395. this.graph.fromJSON(JSON.parse(info.graphJson).cells);
  3396. console.log("fromJson"+info.graphJson)
  3397. console.log(JSON.parse(info.graphJson).cells)
  3398. },
  3399. createGraph() {
  3400. const graph = new Graph({
  3401. grid: true,
  3402. container: document.getElementById("container"),
  3403. // width: 1270,
  3404. // width: 1200,
  3405. // height: 750,
  3406. autoResize: true,
  3407. // panning: {
  3408. // enabled: true,
  3409. // },
  3410. resizing: {
  3411. enabled: true,
  3412. },
  3413. // model: {},
  3414. history: true, //uodo和redo
  3415. highlighting: {
  3416. nodeAvailable: {
  3417. //连线过程中,节点可以被链接时被使用。
  3418. name: "className",
  3419. args: {
  3420. className: "available",
  3421. },
  3422. },
  3423. magnetAvailable: {
  3424. //连线过程中,链接桩可以被链接时被使用。
  3425. name: "className",
  3426. args: {
  3427. className: "available",
  3428. },
  3429. },
  3430. magnetAdsorbed: {
  3431. //连线过程中,自动吸附到链接桩时被使用。
  3432. name: "className",
  3433. args: {
  3434. className: "adsorbed",
  3435. },
  3436. },
  3437. },
  3438. scroller: {
  3439. enabled: true,
  3440. pannable: true,
  3441. },
  3442. mousewheel: {
  3443. enabled: true,
  3444. modifiers: ["ctrl", "meta"],
  3445. },
  3446. clipboard: {
  3447. enabled: true,
  3448. useLocalStorage: true,
  3449. },
  3450. keyboard: {
  3451. enabled: true,
  3452. global: true,
  3453. }, //快捷键
  3454. selecting: {
  3455. enabled: true,
  3456. showNodeSelectionBox: true,
  3457. // showEdgeSelectionBox: true,
  3458. }, //选中 ,框选
  3459. //节点与边交互
  3460. translating: {
  3461. restrict: true, //限制节点不能移动超出画布区域
  3462. },
  3463. connecting: {
  3464. snap: true, //连线距离节点或者连接桩 50px 时会触发自动吸附
  3465. allowBlank: false,
  3466. allowLoop: false,
  3467. highlight: true,
  3468. sourceAnchor: {
  3469. //指定源节点的锚点
  3470. name: "bottom",
  3471. },
  3472. targetAnchor: {
  3473. //指定目标节点的锚点
  3474. name: "center",
  3475. },
  3476. connectionPoint: "anchor",
  3477. // connector: "algo-edge",
  3478. createEdge() {
  3479. return graph.createEdge({
  3480. //更新连接边edge样式
  3481. router: {
  3482. // name: "orth",
  3483. name: "er",
  3484. args: {
  3485. offset: "center",
  3486. },
  3487. },
  3488. attrs: {
  3489. line: {
  3490. // strokeDasharray: "5 5", //虚线
  3491. stroke: "#808080",
  3492. strokeWidth: 1,
  3493. targetMarker: {
  3494. name: "block",
  3495. args: {
  3496. size: "6",
  3497. },
  3498. },
  3499. },
  3500. },
  3501. //在指定的位置处,渲染一个删除按钮,点击时删除对应的边。
  3502. tools: {
  3503. name: "button-remove",
  3504. args: { distance: -40 },
  3505. },
  3506. });
  3507. },
  3508. validateMagnet({ magnet }) {
  3509. return magnet.getAttribute("port-group") !== "in";
  3510. },
  3511. validateConnection({
  3512. sourceView,
  3513. targetView,
  3514. sourceMagnet,
  3515. targetMagnet,
  3516. }) {
  3517. // 只能从输出链接桩创建连接
  3518. if (
  3519. !sourceMagnet ||
  3520. sourceMagnet.getAttribute("port-group") === "in"
  3521. ) {
  3522. return false;
  3523. }
  3524. // 只能连接到输入链接桩
  3525. if (
  3526. !targetMagnet ||
  3527. targetMagnet.getAttribute("port-group") !== "in"
  3528. ) {
  3529. return false;
  3530. }
  3531. // 判断目标链接桩是否可连接
  3532. const portId = targetMagnet.getAttribute("port");
  3533. const node = targetView.cell;
  3534. const port = node.getPort(portId);
  3535. if (port && port.connected) {
  3536. // if (port && port.connected) {
  3537. return false;
  3538. }
  3539. return true;
  3540. },
  3541. },
  3542. });
  3543. // 创建 Graph 的实例
  3544. // const graph = new Graph({
  3545. // container: document.getElementById("container"),
  3546. // width: 1380,
  3547. // height: 750,
  3548. // background: {
  3549. // // color: "#f7f7f4", //设置画布背景颜色
  3550. // color: "#ffffff",
  3551. // },
  3552. // grid: {
  3553. // size: 8,
  3554. // visible: true,
  3555. // }, //网格
  3556. // history: true, //uodo和redo
  3557. // //滚动条
  3558. // // scroller: {
  3559. // // enabled: true,
  3560. // // // pannable: true,
  3561. // // // pageVisible: true,
  3562. // // // pageBreak: false,
  3563. // // },
  3564. // mousewheel: {
  3565. // enabled: true,
  3566. // modifiers: ["ctrl", "meta"],
  3567. // },
  3568. // // clipboard: true, //剪切板
  3569. // clipboard: {
  3570. // enabled: true,
  3571. // useLocalStorage: true,
  3572. // },
  3573. // keyboard: {
  3574. // enabled: true,
  3575. // global: true,
  3576. // }, //快捷键
  3577. // selecting: {
  3578. // enabled: true,
  3579. // showNodeSelectionBox: true,
  3580. // // showEdgeSelectionBox: true,
  3581. // }, //选中 ,框选
  3582. // //节点与边交互
  3583. // translating: {
  3584. // restrict: true, //限制节点不能移动超出画布区域
  3585. // },
  3586. // //连线规则
  3587. // connecting: {
  3588. // snap: true,
  3589. // allowBlank: false, //不允许连接到画布空白位置
  3590. // allowMulti: false, //不允许在相同节点之间创建多条边
  3591. // },
  3592. // });
  3593. this.graph = graph;
  3594. this.history = graph.history; //Redo Undo
  3595. },
  3596. onCollapse(collapsed, type) {
  3597. console.log(collapsed, type);
  3598. },
  3599. onBreakpoint(broken) {
  3600. console.log(broken);
  3601. },
  3602. onUndo() {
  3603. this.history.undo();
  3604. console.log("undo");
  3605. },
  3606. onRedo() {
  3607. this.history.redo();
  3608. console.log("redo");
  3609. },
  3610. onCancel() {
  3611. MessageBox.confirm(`确定进行[退出]操作?`, "提示", {
  3612. confirmButtonText: "确定",
  3613. cancelButtonText: "取消",
  3614. type: "warning",
  3615. })
  3616. .then(() => {
  3617. console.log("任务取消")
  3618. console.log(this.workflowName);
  3619. //确定取消任务后的操作
  3620. if(this.workflowstatustag.name == "Running" && this.workflowName!=""){
  3621. this.$http({
  3622. url: this.$http.adornUrl("/visi/visiworkflow/stopworkflow"),
  3623. method: "post",
  3624. data: this.$http.adornData({workflowName: this.workflowName}),
  3625. }).then(({ data }) => {
  3626. if (data && data.code === 0) {
  3627. this.workflowStatus = data.statusPhase;
  3628. if(this.workflowStatus == "Failed"){
  3629. Message.success("任务已取消");
  3630. }
  3631. console.log("任务已取消")
  3632. }
  3633. });
  3634. }
  3635. })
  3636. .catch(() => {});
  3637. },
  3638. onRun() {
  3639. console.log("graph.toJSON()");
  3640. console.log(this.graph.toJSON());
  3641. // console.log(JSON.stringify(this.graph.toJSON()));
  3642. MessageBox.confirm(`确定进行[提交]操作?`, "提示", {
  3643. confirmButtonText: "确定",
  3644. cancelButtonText: "取消",
  3645. type: "warning",
  3646. })
  3647. .then(() => {
  3648. this.$http({
  3649. url: this.$http.adornUrl("/visi/visiworkflow/submit"),
  3650. method: "post",
  3651. data: this.$http.adornData({
  3652. graphJson: JSON.stringify(this.graph.toJSON()),
  3653. workflowId: this.workflowId,
  3654. experimentName: this.experimentName,
  3655. addorupdate: this.addorupdate,
  3656. }
  3657. ),
  3658. }).then(({ data }) => {
  3659. if (data && data.code === 0) {
  3660. this.workflowName = data.workflowName;
  3661. this.idTemplateNameMap = data.idTemplateNameMap; //节点id与 DAG中task和Template 的对应关系
  3662. this.workflowId = data.workflowId;//若为新增,返回新增的主键ID workflowId
  3663. // 迭代属性名称:
  3664. for (let nodeid of Object.keys(this.idTemplateNameMap)) {
  3665. var tempname = this.idTemplateNameMap[nodeid];
  3666. this.graph
  3667. .getCellById(nodeid)
  3668. .setData({ wftempname: tempname }); //temp后端已向末尾添加随机数
  3669. }
  3670. Message.success("提交成功");
  3671. // this.$message({
  3672. // message: "提交成功",
  3673. // type: "success",
  3674. // });
  3675. this.workflowstatustag.name = "Running";
  3676. this.workflowstatustag.type = "";
  3677. //查询运行状态
  3678. // this.getWorkflowStatus();
  3679. var intervalID = window.setInterval(() => {
  3680. this.getWorkflowStatus();
  3681. // 取消该定时设置
  3682. if (
  3683. this.workflowStatus == "Succeeded" ||
  3684. this.workflowStatus == "Error" ||
  3685. this.workflowStatus == "Failed"
  3686. ) {
  3687. if (this.workflowStatus == "Succeeded") {
  3688. this.workflowstatustag.name = "Succeeded";
  3689. this.workflowstatustag.type = "success";
  3690. } else if (
  3691. this.workflowStatus == "Error" ||
  3692. this.workflowStatus == "Failed"
  3693. ) {
  3694. this.workflowstatustag.name = "Failed";
  3695. this.workflowstatustag.type = "danger";
  3696. }
  3697. window.clearInterval(intervalID);
  3698. }
  3699. }, 5000);
  3700. } else {
  3701. Message.error("提交失败");
  3702. }
  3703. });
  3704. })
  3705. .catch(() => {});
  3706. // // 上方添加 按钮提示框
  3707. // this.$http({
  3708. // url: this.$http.adornUrl("/visi/visiworkflow/submit"),
  3709. // method: "post",
  3710. // data: this.$http.adornData(this.graph.toJSON()),
  3711. // }).then(({ data }) => {
  3712. // if (data && data.code === 0) {
  3713. // this.workflowName = data.workflowName;
  3714. // this.idTemplateNameMap = data.idTemplateNameMap; //节点id与 DAG中task和Template 的对应关系
  3715. // // 迭代属性名称:
  3716. // for (let nodeid of Object.keys(this.idTemplateNameMap)) {
  3717. // var tempname = this.idTemplateNameMap[nodeid];
  3718. // this.graph.getCellById(nodeid).setData({ wftempname: tempname }); //temp后端已向末尾添加随机数
  3719. // }
  3720. // Message.success("提交成功");
  3721. // // this.$message({
  3722. // // message: "提交成功",
  3723. // // type: "success",
  3724. // // });
  3725. // this.workflowstatustag.name = "Running";
  3726. // this.workflowstatustag.type = "";
  3727. // //查询运行状态
  3728. // // this.getWorkflowStatus();
  3729. // var intervalID = window.setInterval(() => {
  3730. // this.getWorkflowStatus();
  3731. // // 取消该定时设置
  3732. // if (
  3733. // this.workflowStatus == "Succeeded" ||
  3734. // this.workflowStatus == "Error" ||
  3735. // this.workflowStatus == "Failed"
  3736. // ) {
  3737. // if (this.workflowStatus == "Succeeded") {
  3738. // this.workflowstatustag.name = "Succeeded";
  3739. // this.workflowstatustag.type = "success";
  3740. // } else if (
  3741. // this.workflowStatus == "Error" ||
  3742. // this.workflowStatus == "Failed"
  3743. // ) {
  3744. // this.workflowstatustag.name = "Failed";
  3745. // this.workflowstatustag.type = "danger";
  3746. // }
  3747. // window.clearInterval(intervalID);
  3748. // }
  3749. // }, 5000);
  3750. // // // 取消该定时设置
  3751. // // if (
  3752. // // this.workflowStatus == "Succeeded" ||
  3753. // // this.workflowStatus == "Error" ||
  3754. // // this.workflowStatus == "Failed"
  3755. // // ) {
  3756. // // if (this.workflowStatus == "Succeeded") {
  3757. // // this.workflowstatustag.name = "Succeeded";
  3758. // // this.workflowstatustag.type = "success";
  3759. // // } else if (
  3760. // // this.workflowStatus == "Error" ||
  3761. // // this.workflowStatus == "Failed"
  3762. // // ) {
  3763. // // this.workflowstatustag.name = "Failed";
  3764. // // this.workflowstatustag.type = "danger";
  3765. // // }
  3766. // // window.clearInterval(intervalID);
  3767. // // }
  3768. // } else {
  3769. // Message.error("提交失败");
  3770. // // this.$message.error("提交失败");
  3771. // // this.$message.error(data.msg);
  3772. // }
  3773. // });
  3774. },
  3775. //20211109 测试 能否保存至数据库
  3776. onPrimary() {
  3777. MessageBox.confirm(`确定进行[保存]操作?`, "提示", {
  3778. confirmButtonText: "确定",
  3779. cancelButtonText: "取消",
  3780. type: "warning",
  3781. })
  3782. .then(() => {
  3783. this.$http({
  3784. url: this.$http.adornUrl("/visi/visiworkflow/save"),
  3785. method: "post",
  3786. data: this.$http.adornData({
  3787. userId: this.$store.state.user.id,
  3788. workflowId: undefined,
  3789. experimentName: this.experimentName,
  3790. workflowtempName: "",
  3791. workflowName: "",
  3792. graphJson: JSON.stringify(this.graph.toJSON()),
  3793. }),
  3794. }).then(({ data }) => {
  3795. if (data && data.code === 0) {
  3796. Message.success("操作成功");
  3797. // this.$message({
  3798. // message: "操作成功",
  3799. // type: "success",
  3800. // duration: 1500,
  3801. // onClose: () => {
  3802. // this.getDataList();
  3803. // },
  3804. // });
  3805. } else {
  3806. // Message.error();
  3807. // this.$message.error(data.msg);
  3808. }
  3809. });
  3810. })
  3811. .catch(() => {});
  3812. console.log(JSON.stringify(this.graph.toJSON()).length);
  3813. console.log(JSON.stringify(this.graph.toJSON()));
  3814. // this.$http({
  3815. // url: this.$http.adornUrl("/visi/visiworkflow/save"),
  3816. // method: "post",
  3817. // data: this.$http.adornData({
  3818. // userId: this.$store.state.user.id,
  3819. // workflowId: undefined,
  3820. // experimentName: "实验1",
  3821. // workflowtempName: "",
  3822. // workflowName: "",
  3823. // graphJson: JSON.stringify(this.graph.toJSON()),
  3824. // }),
  3825. // }).then(({ data }) => {
  3826. // if (data && data.code === 0) {
  3827. // Message.success("操作成功");
  3828. // // this.$message({
  3829. // // message: "操作成功",
  3830. // // type: "success",
  3831. // // duration: 1500,
  3832. // // onClose: () => {
  3833. // // this.getDataList();
  3834. // // },
  3835. // // });
  3836. // } else {
  3837. // // Message.error();
  3838. // // this.$message.error(data.msg);
  3839. // }
  3840. // });
  3841. },
  3842. //查询状态
  3843. getWorkflowStatus() {
  3844. this.$http({
  3845. url: this.$http.adornUrl("/visi/visiworkflow/getworkflowstatus"),
  3846. method: "get",
  3847. params: this.$http.adornParams({
  3848. workflowName: this.workflowName,
  3849. }),
  3850. }).then(({ data }) => {
  3851. this.workflowStatus = data.statusPhase;
  3852. console.log(this.workflowStatus);
  3853. if (this.workflowStatus == "Succeeded") {
  3854. this.workflowstatustag.name = "Succeeded";
  3855. this.workflowstatustag.type = "success";
  3856. } else if (
  3857. this.workflowStatus == "Error" ||
  3858. this.workflowStatus == "Failed"
  3859. ) {
  3860. this.workflowstatustag.name = "Failed";
  3861. this.workflowstatustag.type = "danger";
  3862. } else {
  3863. this.workflowstatustag.name = "Running";
  3864. this.workflowstatustag.type = "";
  3865. }
  3866. //Pending, Running, Succeeded, Skipped, Failed, Error
  3867. });
  3868. },
  3869. //20211111 添加设置每个算法节点 的输入输出设置模板
  3870. //获取代码模板
  3871. getParaTemp() {
  3872. this.paraTempVisible = true;
  3873. this.$nextTick(() => {
  3874. // this.$refs.paraTemp.init(this.measurepoint.join());
  3875. this.$refs.paraTemp.init();
  3876. });
  3877. },
  3878. // 清空当前画布
  3879. onCleargraph() {
  3880. this.graph.clearCells();
  3881. },
  3882. //画布内容居中
  3883. getgraphContentcenter() {
  3884. this.graph.centerContent();
  3885. },
  3886. //获取工作流完整日志
  3887. getworkflowContent() {
  3888. // console.log("graph.toJSON()");
  3889. // console.log(this.graph.toJSON());
  3890. // console.log(JSON.stringify(this.graph.toJSON()));
  3891. // this.$http({
  3892. // url: this.$http.adornUrl("/visi/visiworkflow/getpodlog"),
  3893. // method: "get",
  3894. // data: this.$http.adornData(this.workflowName,this.idTemplateNameMap),
  3895. // }).then(({ data }) => {
  3896. // if (data && data.code === 0) {
  3897. // this.workflowName = data.workflowName;
  3898. // this.workflowContentlog = data.workflowContent;
  3899. // this.podlogs = data.podlogs;
  3900. // console.log("workflowname");
  3901. // console.log(this.workflowName);
  3902. // console.log("workflowcontent")
  3903. // console.log(this.workflowContentlog);
  3904. // console.log("podlogs")
  3905. // console.log(this.podlogs);
  3906. // this.$message({
  3907. // message: "操作成功",
  3908. // type: "success",
  3909. // duration: 1500,
  3910. // onClose: () => {
  3911. // // this.getDataList(); //20211115 待更改 未应用,且不是该函数
  3912. // },
  3913. // });
  3914. // } else {
  3915. // this.$message.error(data.msg);
  3916. // }
  3917. // });
  3918. //获取日志正确代码,现改为弹窗显示
  3919. // if (this.workflowContentVisi) {
  3920. // this.workflowContentVisi = false;
  3921. // } else {
  3922. // this.workflowContentVisi = true;
  3923. // this.$http({
  3924. // url: this.$http.adornUrl("/visi/visiworkflow/getworkflowlog"),
  3925. // method: "get",
  3926. // params: this.$http.adornParams({
  3927. // workflowName: this.workflowName,
  3928. // }),
  3929. // })
  3930. // .then(({ data }) => {
  3931. // this.workflowContent = data.workflowContent;
  3932. // // this.podlogs = data.podlogs;
  3933. // console.log("workflowcontent");
  3934. // console.log(this.workflowContent);
  3935. // console.log(this.workflowContent.main);
  3936. // console.log(this.workflowContent.init);
  3937. // console.log(this.workflowContent.wait);
  3938. // // console.log("podlogs")
  3939. // // console.log(this.podlogs);
  3940. // })
  3941. // .then(() => {
  3942. // // this.visible = true
  3943. // // this.$nextTick(() => {
  3944. // // this.$refs['dataForm'].resetFields()
  3945. // // })
  3946. // });
  3947. // }
  3948. this.workflowContentVisi = true;
  3949. if (this.workflowName != "") {
  3950. this.$nextTick(() => {
  3951. this.$refs.getworkflowlog.init(this.workflowName);
  3952. });
  3953. } else {
  3954. this.$nextTick(() => {
  3955. this.$refs.getworkflowlog.init1();
  3956. });
  3957. }
  3958. },
  3959. //获取单个节点 日志
  3960. getnodepodContent() {
  3961. this.$http({
  3962. url: this.$http.adornUrl("/visi/visiworkflow/getpodlog"),
  3963. method: "get",
  3964. params: this.$http.adornParams({
  3965. workflowName: this.workflowName,
  3966. idTemplateNameMap: this.idTemplateNameMap,
  3967. nodeId: "",
  3968. }),
  3969. })
  3970. .then(({ data }) => {
  3971. // this.workflowContentlog = data.workflowContent;
  3972. // this.podlogs = data.podlogs;
  3973. // console.log("workflowcontent")
  3974. // console.log(this.workflowContentlog);
  3975. // console.log("podlogs")
  3976. // console.log(this.podlogs);
  3977. })
  3978. .then(() => {
  3979. // this.visible = true
  3980. // this.$nextTick(() => {
  3981. // this.$refs['dataForm'].resetFields()
  3982. // })
  3983. });
  3984. },
  3985. //单选控制 日志类型 main init wait
  3986. workflowcontainerchange(e) {
  3987. if (this.containertype == "main") {
  3988. this.workflowContentlog = this.workflowContent.main;
  3989. }
  3990. if (this.containertype == "init") {
  3991. this.workflowContentlog = this.workflowContent.init;
  3992. }
  3993. if (this.containertype == "wait") {
  3994. this.workflowContentlog = this.workflowContent.wait;
  3995. }
  3996. },
  3997. //获取代码示例---轮廓识别
  3998. onGetcontour() {
  3999. //20211129 暂时先注释,为轮廓识别案例
  4000. this.graph.fromJSON([
  4001. {
  4002. position: { x: 60, y: 280 },
  4003. size: { width: 90, height: 80 },
  4004. attrs: {
  4005. image: {
  4006. "xlink:href":
  4007. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4008. },
  4009. label: { text: "contourTask1" },
  4010. },
  4011. shape: "template-node",
  4012. data: {
  4013. nodeName: "contourTask1",
  4014. templateName: "contourTask1",
  4015. templateImage: "zvinjodocker/contous_task1:20211014",
  4016. templateCommand: {},
  4017. templateArgs: {},
  4018. algoparaInput: { userInput: [], getInput: [] },
  4019. algoparaOutput: [],
  4020. algoparaInputargu: { userInput: [], getInput: [] },
  4021. algonodeSource: [],
  4022. inputsparameters: [],
  4023. inputsartifacts: [],
  4024. argumentsparameters: [],
  4025. argumentsartifacts: [],
  4026. outputsparameters: [],
  4027. outputsartifacts: [
  4028. {
  4029. paraname: "thresh",
  4030. paradesc: "",
  4031. paratype: "",
  4032. valuefrom: "/myapps/thresh1.png",
  4033. },
  4034. {
  4035. paraname: "contours",
  4036. paradesc: "",
  4037. paratype: "",
  4038. valuefrom: "/myapps/contours.png",
  4039. },
  4040. ],
  4041. sourcedatalist: [],
  4042. sourceartilist: [],
  4043. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  4044. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  4045. },
  4046. ports: {
  4047. groups: {
  4048. in: {
  4049. position: "left",
  4050. attrs: {
  4051. circle: {
  4052. r: 2.5,
  4053. magnet: true,
  4054. stroke: "black",
  4055. strokeWidth: 1,
  4056. fill: "#fff",
  4057. style: { visibility: true },
  4058. },
  4059. },
  4060. },
  4061. out: {
  4062. position: "right",
  4063. attrs: {
  4064. circle: {
  4065. r: 2.5,
  4066. magnet: true,
  4067. stroke: "black",
  4068. strokeWidth: 1,
  4069. fill: "#fff",
  4070. },
  4071. },
  4072. },
  4073. },
  4074. items: [
  4075. { id: "inport1", group: "in" },
  4076. { id: "inport2", group: "in" },
  4077. { id: "outport1", group: "out" },
  4078. { id: "outport2", group: "out" },
  4079. ],
  4080. },
  4081. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4082. zIndex: 1,
  4083. },
  4084. {
  4085. position: { x: 370, y: 140 },
  4086. size: { width: 90, height: 80 },
  4087. attrs: {
  4088. image: {
  4089. "xlink:href":
  4090. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4091. },
  4092. label: { text: "contourTask2" },
  4093. },
  4094. shape: "template-node",
  4095. data: {
  4096. nodeName: "contourTask2",
  4097. templateName: "contourTask2",
  4098. templateImage: "zvinjodocker/contours_task2:20211014",
  4099. templateCommand: {},
  4100. templateArgs: {},
  4101. algoparaInput: { userInput: [], getInput: [] },
  4102. algoparaOutput: [],
  4103. algoparaInputargu: { userInput: [], getInput: [] },
  4104. algonodeSource: [
  4105. {
  4106. position: { x: 60, y: 280 },
  4107. size: { width: 90, height: 80 },
  4108. attrs: {
  4109. image: {
  4110. "xlink:href":
  4111. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4112. },
  4113. label: { text: "contourTask1" },
  4114. },
  4115. shape: "template-node",
  4116. data: {
  4117. nodeName: "contourTask1",
  4118. templateName: "contourTask1",
  4119. templateImage: "zvinjodocker/contous_task1:20211014",
  4120. templateCommand: {},
  4121. templateArgs: {},
  4122. algoparaInput: { userInput: [], getInput: [] },
  4123. algoparaOutput: [],
  4124. algoparaInputargu: { userInput: [], getInput: [] },
  4125. algonodeSource: [],
  4126. inputsparameters: [],
  4127. inputsartifacts: [],
  4128. argumentsparameters: [],
  4129. argumentsartifacts: [],
  4130. outputsparameters: [],
  4131. outputsartifacts: [
  4132. {
  4133. paraname: "thresh",
  4134. paradesc: "",
  4135. paratype: "",
  4136. valuefrom: "/myapps/thresh1.png",
  4137. },
  4138. {
  4139. paraname: "contours",
  4140. paradesc: "",
  4141. paratype: "",
  4142. valuefrom: "/myapps/contours.png",
  4143. },
  4144. ],
  4145. sourcedatalist: [],
  4146. sourceartilist: [],
  4147. },
  4148. ports: {
  4149. groups: {
  4150. in: {
  4151. position: "left",
  4152. attrs: {
  4153. circle: {
  4154. r: 2.5,
  4155. magnet: true,
  4156. stroke: "black",
  4157. strokeWidth: 1,
  4158. fill: "#fff",
  4159. style: { visibility: true },
  4160. },
  4161. },
  4162. },
  4163. out: {
  4164. position: "right",
  4165. attrs: {
  4166. circle: {
  4167. r: 2.5,
  4168. magnet: true,
  4169. stroke: "black",
  4170. strokeWidth: 1,
  4171. fill: "#fff",
  4172. },
  4173. },
  4174. },
  4175. },
  4176. items: [
  4177. { id: "inport1", group: "in" },
  4178. { id: "inport2", group: "in" },
  4179. { id: "outport1", group: "out" },
  4180. { id: "outport2", group: "out" },
  4181. ],
  4182. },
  4183. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4184. zIndex: 1,
  4185. },
  4186. ],
  4187. inputsparameters: [],
  4188. inputsartifacts: [
  4189. {
  4190. paraname: "thresh",
  4191. parapath: "/myapps/thresh1.png",
  4192. paradesc: "",
  4193. },
  4194. {
  4195. paraname: "contours",
  4196. parapath: "/myapps/contours.png",
  4197. paradesc: "",
  4198. },
  4199. ],
  4200. argumentsparameters: [],
  4201. argumentsartifacts: [
  4202. {
  4203. paraname: "thresh",
  4204. valuefrom: "{{tasks.contourTask1.outputs.artifacts.thresh}}",
  4205. fileurls: [],
  4206. filelist: [],
  4207. value: ["contourTask1", "thresh"],
  4208. },
  4209. {
  4210. paraname: "contours",
  4211. valuefrom: "{{tasks.contourTask1.outputs.artifacts.contours}}",
  4212. fileurls: [],
  4213. filelist: [],
  4214. value: ["contourTask1", "contours"],
  4215. },
  4216. ],
  4217. outputsparameters: [],
  4218. outputsartifacts: [
  4219. {
  4220. paraname: "contours0",
  4221. valuefrom: "/myapps/contours[0].npy",
  4222. paradesc: "",
  4223. paratype: "",
  4224. },
  4225. {
  4226. paraname: "res",
  4227. valuefrom: "/myapps/res1.png",
  4228. paradesc: "",
  4229. paratype: "",
  4230. },
  4231. ],
  4232. sourcedatalist: [],
  4233. sourceartilist: [],
  4234. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  4235. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  4236. },
  4237. ports: {
  4238. groups: {
  4239. in: {
  4240. position: "left",
  4241. attrs: {
  4242. circle: {
  4243. r: 2.5,
  4244. magnet: true,
  4245. stroke: "black",
  4246. strokeWidth: 1,
  4247. fill: "#fff",
  4248. style: { visibility: true },
  4249. },
  4250. },
  4251. },
  4252. out: {
  4253. position: "right",
  4254. attrs: {
  4255. circle: {
  4256. r: 2.5,
  4257. magnet: true,
  4258. stroke: "black",
  4259. strokeWidth: 1,
  4260. fill: "#fff",
  4261. },
  4262. },
  4263. },
  4264. },
  4265. items: [
  4266. { id: "inport1", group: "in" },
  4267. { id: "inport2", group: "in" },
  4268. { id: "outport1", group: "out" },
  4269. { id: "outport2", group: "out" },
  4270. ],
  4271. },
  4272. id: "7d572837-a22b-4dab-a196-8ea411ba868e",
  4273. zIndex: 2,
  4274. },
  4275. {
  4276. shape: "edge",
  4277. attrs: {
  4278. line: {
  4279. stroke: "#808080",
  4280. strokeWidth: 1,
  4281. targetMarker: { name: "block", args: { size: "6" } },
  4282. },
  4283. },
  4284. id: "3b752ac7-2c5f-4596-adf3-ad10dd3718b0",
  4285. router: { name: "er", args: { offset: "center" } },
  4286. tools: {
  4287. items: [{ name: "button-remove", args: { distance: -40 } }],
  4288. },
  4289. source: {
  4290. cell: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4291. port: "outport1",
  4292. },
  4293. target: {
  4294. cell: "7d572837-a22b-4dab-a196-8ea411ba868e",
  4295. port: "inport1",
  4296. },
  4297. zIndex: 3,
  4298. },
  4299. {
  4300. position: { x: 650, y: 140 },
  4301. size: { width: 90, height: 80 },
  4302. attrs: {
  4303. image: {
  4304. "xlink:href":
  4305. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4306. },
  4307. label: { text: "contourTask3" },
  4308. },
  4309. shape: "template-node",
  4310. data: {
  4311. nodeName: "contourTask3",
  4312. templateName: "contourTask3",
  4313. templateImage: "zvinjodocker/contours_task3:20211015",
  4314. templateCommand: {},
  4315. templateArgs: {},
  4316. algoparaInput: { userInput: [], getInput: [] },
  4317. algoparaOutput: [],
  4318. algoparaInputargu: { userInput: [], getInput: [] },
  4319. algonodeSource: [
  4320. {
  4321. position: { x: 370, y: 140 },
  4322. size: { width: 90, height: 80 },
  4323. attrs: {
  4324. image: {
  4325. "xlink:href":
  4326. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4327. },
  4328. label: { text: "contourTask2" },
  4329. },
  4330. shape: "template-node",
  4331. data: {
  4332. nodeName: "contourTask2",
  4333. templateName: "contourTask2",
  4334. templateImage: "zvinjodocker/contours_task2:20211014",
  4335. templateCommand: {},
  4336. templateArgs: {},
  4337. algoparaInput: { userInput: [], getInput: [] },
  4338. algoparaOutput: [],
  4339. algoparaInputargu: { userInput: [], getInput: [] },
  4340. algonodeSource: [
  4341. {
  4342. position: { x: 60, y: 280 },
  4343. size: { width: 90, height: 80 },
  4344. attrs: {
  4345. image: {
  4346. "xlink:href":
  4347. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4348. },
  4349. label: { text: "contourTask1" },
  4350. },
  4351. shape: "template-node",
  4352. data: {
  4353. nodeName: "contourTask1",
  4354. templateName: "contourTask1",
  4355. templateImage: "zvinjodocker/contous_task1:20211014",
  4356. templateCommand: {},
  4357. templateArgs: {},
  4358. algoparaInput: { userInput: [], getInput: [] },
  4359. algoparaOutput: [],
  4360. algoparaInputargu: { userInput: [], getInput: [] },
  4361. algonodeSource: [],
  4362. inputsparameters: [],
  4363. inputsartifacts: [],
  4364. argumentsparameters: [],
  4365. argumentsartifacts: [],
  4366. outputsparameters: [],
  4367. outputsartifacts: [
  4368. {
  4369. paraname: "thresh",
  4370. paradesc: "",
  4371. paratype: "",
  4372. valuefrom: "/myapps/thresh1.png",
  4373. },
  4374. {
  4375. paraname: "contours",
  4376. paradesc: "",
  4377. paratype: "",
  4378. valuefrom: "/myapps/contours.png",
  4379. },
  4380. ],
  4381. sourcedatalist: [],
  4382. sourceartilist: [],
  4383. },
  4384. ports: {
  4385. groups: {
  4386. in: {
  4387. position: "left",
  4388. attrs: {
  4389. circle: {
  4390. r: 2.5,
  4391. magnet: true,
  4392. stroke: "black",
  4393. strokeWidth: 1,
  4394. fill: "#fff",
  4395. style: { visibility: true },
  4396. },
  4397. },
  4398. },
  4399. out: {
  4400. position: "right",
  4401. attrs: {
  4402. circle: {
  4403. r: 2.5,
  4404. magnet: true,
  4405. stroke: "black",
  4406. strokeWidth: 1,
  4407. fill: "#fff",
  4408. },
  4409. },
  4410. },
  4411. },
  4412. items: [
  4413. { id: "inport1", group: "in" },
  4414. { id: "inport2", group: "in" },
  4415. { id: "outport1", group: "out" },
  4416. { id: "outport2", group: "out" },
  4417. ],
  4418. },
  4419. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4420. zIndex: 1,
  4421. },
  4422. ],
  4423. inputsparameters: [],
  4424. inputsartifacts: [
  4425. {
  4426. paraname: "thresh",
  4427. parapath: "/myapps/thresh1.png",
  4428. paradesc: "",
  4429. },
  4430. {
  4431. paraname: "contours",
  4432. parapath: "/myapps/contours.png",
  4433. paradesc: "",
  4434. },
  4435. ],
  4436. argumentsparameters: [],
  4437. argumentsartifacts: [
  4438. {
  4439. paraname: "thresh",
  4440. valuefrom:
  4441. "{{tasks.contourTask1.outputs.artifacts.thresh}}",
  4442. fileurls: [],
  4443. filelist: [],
  4444. value: ["contourTask1", "thresh"],
  4445. },
  4446. {
  4447. paraname: "contours",
  4448. valuefrom:
  4449. "{{tasks.contourTask1.outputs.artifacts.contours}}",
  4450. fileurls: [],
  4451. filelist: [],
  4452. value: ["contourTask1", "contours"],
  4453. },
  4454. ],
  4455. outputsparameters: [],
  4456. outputsartifacts: [
  4457. {
  4458. paraname: "contours0",
  4459. valuefrom: "/myapps/contours[0].npy",
  4460. paradesc: "",
  4461. paratype: "",
  4462. },
  4463. {
  4464. paraname: "res",
  4465. valuefrom: "/myapps/res1.png",
  4466. paradesc: "",
  4467. paratype: "",
  4468. },
  4469. ],
  4470. sourcedatalist: [],
  4471. sourceartilist: [],
  4472. },
  4473. ports: {
  4474. groups: {
  4475. in: {
  4476. position: "left",
  4477. attrs: {
  4478. circle: {
  4479. r: 2.5,
  4480. magnet: true,
  4481. stroke: "black",
  4482. strokeWidth: 1,
  4483. fill: "#fff",
  4484. style: { visibility: true },
  4485. },
  4486. },
  4487. },
  4488. out: {
  4489. position: "right",
  4490. attrs: {
  4491. circle: {
  4492. r: 2.5,
  4493. magnet: true,
  4494. stroke: "black",
  4495. strokeWidth: 1,
  4496. fill: "#fff",
  4497. },
  4498. },
  4499. },
  4500. },
  4501. items: [
  4502. { id: "inport1", group: "in" },
  4503. { id: "inport2", group: "in" },
  4504. { id: "outport1", group: "out" },
  4505. { id: "outport2", group: "out" },
  4506. ],
  4507. },
  4508. id: "7d572837-a22b-4dab-a196-8ea411ba868e",
  4509. zIndex: 2,
  4510. },
  4511. ],
  4512. inputsparameters: [],
  4513. inputsartifacts: [
  4514. {
  4515. paraname: "contours0",
  4516. parapath: "/myapps/contours[0].npy",
  4517. paradesc: "",
  4518. },
  4519. ],
  4520. argumentsparameters: [],
  4521. argumentsartifacts: [
  4522. {
  4523. paraname: "contours0",
  4524. valuefrom: "{{tasks.contourTask2.outputs.artifacts.contours0}}",
  4525. fileurls: [],
  4526. filelist: [],
  4527. value: ["contourTask2", "contours0"],
  4528. },
  4529. ],
  4530. outputsparameters: [],
  4531. outputsartifacts: [],
  4532. sourcedatalist: [],
  4533. sourceartilist: [],
  4534. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  4535. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  4536. },
  4537. ports: {
  4538. groups: {
  4539. in: {
  4540. position: "left",
  4541. attrs: {
  4542. circle: {
  4543. r: 2.5,
  4544. magnet: true,
  4545. stroke: "black",
  4546. strokeWidth: 1,
  4547. fill: "#fff",
  4548. style: { visibility: true },
  4549. },
  4550. },
  4551. },
  4552. out: {
  4553. position: "right",
  4554. attrs: {
  4555. circle: {
  4556. r: 2.5,
  4557. magnet: true,
  4558. stroke: "black",
  4559. strokeWidth: 1,
  4560. fill: "#fff",
  4561. },
  4562. },
  4563. },
  4564. },
  4565. items: [
  4566. { id: "inport1", group: "in" },
  4567. { id: "inport2", group: "in" },
  4568. { id: "outport1", group: "out" },
  4569. { id: "outport2", group: "out" },
  4570. ],
  4571. },
  4572. id: "a40a3ff3-da4c-463c-ab58-bd9735fb57fe",
  4573. zIndex: 4,
  4574. },
  4575. {
  4576. shape: "edge",
  4577. attrs: {
  4578. line: {
  4579. stroke: "#808080",
  4580. strokeWidth: 1,
  4581. targetMarker: { name: "block", args: { size: "6" } },
  4582. },
  4583. },
  4584. id: "e30fefd7-b50a-4152-96a5-a6403f990cf7",
  4585. router: { name: "er", args: { offset: "center" } },
  4586. tools: {
  4587. items: [{ name: "button-remove", args: { distance: -40 } }],
  4588. },
  4589. source: {
  4590. cell: "7d572837-a22b-4dab-a196-8ea411ba868e",
  4591. port: "outport1",
  4592. },
  4593. target: {
  4594. cell: "a40a3ff3-da4c-463c-ab58-bd9735fb57fe",
  4595. port: "inport1",
  4596. },
  4597. zIndex: 5,
  4598. },
  4599. {
  4600. position: { x: 360, y: 390 },
  4601. size: { width: 90, height: 80 },
  4602. attrs: {
  4603. image: {
  4604. "xlink:href":
  4605. "https://gw.alipayobjects.com/zos/bmw-prod/c36fe7cb-dc24-4854-aeb5-88d8dc36d52e.svg",
  4606. },
  4607. label: { text: "contourApproximate1" },
  4608. },
  4609. shape: "template-node",
  4610. data: {
  4611. nodeName: "contourApproximate1",
  4612. templateName: "contourApproximate1",
  4613. templateImage: "zvinjodocker/contour_approximate1:20211015",
  4614. templateCommand: {},
  4615. templateArgs: {},
  4616. algoparaInput: { userInput: [], getInput: [] },
  4617. algoparaOutput: [],
  4618. algoparaInputargu: { userInput: [], getInput: [] },
  4619. algonodeSource: [
  4620. {
  4621. position: { x: 60, y: 280 },
  4622. size: { width: 90, height: 80 },
  4623. attrs: {
  4624. image: {
  4625. "xlink:href":
  4626. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4627. },
  4628. label: { text: "contourTask1" },
  4629. },
  4630. shape: "template-node",
  4631. data: {
  4632. nodeName: "contourTask1",
  4633. templateName: "contourTask1",
  4634. templateImage: "zvinjodocker/contous_task1:20211014",
  4635. templateCommand: {},
  4636. templateArgs: {},
  4637. algoparaInput: { userInput: [], getInput: [] },
  4638. algoparaOutput: [],
  4639. algoparaInputargu: { userInput: [], getInput: [] },
  4640. algonodeSource: [],
  4641. inputsparameters: [],
  4642. inputsartifacts: [],
  4643. argumentsparameters: [],
  4644. argumentsartifacts: [],
  4645. outputsparameters: [],
  4646. outputsartifacts: [
  4647. {
  4648. paraname: "thresh",
  4649. paradesc: "",
  4650. paratype: "",
  4651. valuefrom: "/myapps/thresh1.png",
  4652. },
  4653. {
  4654. paraname: "contours",
  4655. paradesc: "",
  4656. paratype: "",
  4657. valuefrom: "/myapps/contours.png",
  4658. },
  4659. ],
  4660. sourcedatalist: [],
  4661. sourceartilist: [],
  4662. },
  4663. ports: {
  4664. groups: {
  4665. in: {
  4666. position: "left",
  4667. attrs: {
  4668. circle: {
  4669. r: 2.5,
  4670. magnet: true,
  4671. stroke: "black",
  4672. strokeWidth: 1,
  4673. fill: "#fff",
  4674. style: { visibility: true },
  4675. },
  4676. },
  4677. },
  4678. out: {
  4679. position: "right",
  4680. attrs: {
  4681. circle: {
  4682. r: 2.5,
  4683. magnet: true,
  4684. stroke: "black",
  4685. strokeWidth: 1,
  4686. fill: "#fff",
  4687. },
  4688. },
  4689. },
  4690. },
  4691. items: [
  4692. { id: "inport1", group: "in" },
  4693. { id: "inport2", group: "in" },
  4694. { id: "outport1", group: "out" },
  4695. { id: "outport2", group: "out" },
  4696. ],
  4697. },
  4698. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4699. zIndex: 1,
  4700. },
  4701. ],
  4702. inputsparameters: [],
  4703. inputsartifacts: [],
  4704. argumentsparameters: [],
  4705. argumentsartifacts: [],
  4706. outputsparameters: [],
  4707. outputsartifacts: [
  4708. {
  4709. paraname: "approxCnt",
  4710. valuefrom: "/myapps/approx_cnt.npy",
  4711. paradesc: "",
  4712. paratype: "",
  4713. },
  4714. {
  4715. paraname: "approxRes",
  4716. valuefrom: "/myapps/approx_res.png",
  4717. paradesc: "",
  4718. paratype: "",
  4719. },
  4720. ],
  4721. sourcedatalist: [],
  4722. sourceartilist: [],
  4723. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  4724. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  4725. },
  4726. ports: {
  4727. groups: {
  4728. in: {
  4729. position: "left",
  4730. attrs: {
  4731. circle: {
  4732. r: 2.5,
  4733. magnet: true,
  4734. stroke: "black",
  4735. strokeWidth: 1,
  4736. fill: "#fff",
  4737. style: { visibility: true },
  4738. },
  4739. },
  4740. },
  4741. out: {
  4742. position: "right",
  4743. attrs: {
  4744. circle: {
  4745. r: 2.5,
  4746. magnet: true,
  4747. stroke: "black",
  4748. strokeWidth: 1,
  4749. fill: "#fff",
  4750. },
  4751. },
  4752. },
  4753. },
  4754. items: [
  4755. { id: "inport1", group: "in" },
  4756. { id: "inport2", group: "in" },
  4757. { id: "outport1", group: "out" },
  4758. { id: "outport2", group: "out" },
  4759. ],
  4760. },
  4761. id: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  4762. zIndex: 6,
  4763. },
  4764. {
  4765. position: { x: 660, y: 390 },
  4766. size: { width: 90, height: 80 },
  4767. attrs: {
  4768. image: {
  4769. "xlink:href":
  4770. "https://gw.alipayobjects.com/zos/bmw-prod/c55d7ae1-8d20-4585-bd8f-ca23653a4489.svg",
  4771. },
  4772. label: { text: "contourApproximate2" },
  4773. },
  4774. shape: "template-node",
  4775. data: {
  4776. nodeName: "contourApproximate2",
  4777. templateName: "contourApproximate2",
  4778. templateImage: "zvinjodocker/contour_approximate2:20211015",
  4779. templateCommand: {},
  4780. templateArgs: {},
  4781. algoparaInput: { userInput: [], getInput: [] },
  4782. algoparaOutput: [],
  4783. algoparaInputargu: { userInput: [], getInput: [] },
  4784. algonodeSource: [
  4785. {
  4786. position: { x: 360, y: 390 },
  4787. size: { width: 90, height: 80 },
  4788. attrs: {
  4789. image: {
  4790. "xlink:href":
  4791. "https://gw.alipayobjects.com/zos/bmw-prod/c36fe7cb-dc24-4854-aeb5-88d8dc36d52e.svg",
  4792. },
  4793. label: { text: "contourApproximate1" },
  4794. },
  4795. shape: "template-node",
  4796. data: {
  4797. nodeName: "contourApproximate1",
  4798. templateName: "contourApproximate1",
  4799. templateImage: "zvinjodocker/contour_approximate1:20211015",
  4800. templateCommand: {},
  4801. templateArgs: {},
  4802. algoparaInput: { userInput: [], getInput: [] },
  4803. algoparaOutput: [],
  4804. algoparaInputargu: { userInput: [], getInput: [] },
  4805. algonodeSource: [
  4806. {
  4807. position: { x: 60, y: 280 },
  4808. size: { width: 90, height: 80 },
  4809. attrs: {
  4810. image: {
  4811. "xlink:href":
  4812. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  4813. },
  4814. label: { text: "contourTask1" },
  4815. },
  4816. shape: "template-node",
  4817. data: {
  4818. nodeName: "contourTask1",
  4819. templateName: "contourTask1",
  4820. templateImage: "zvinjodocker/contous_task1:20211014",
  4821. templateCommand: {},
  4822. templateArgs: {},
  4823. algoparaInput: { userInput: [], getInput: [] },
  4824. algoparaOutput: [],
  4825. algoparaInputargu: { userInput: [], getInput: [] },
  4826. algonodeSource: [],
  4827. inputsparameters: [],
  4828. inputsartifacts: [],
  4829. argumentsparameters: [],
  4830. argumentsartifacts: [],
  4831. outputsparameters: [],
  4832. outputsartifacts: [
  4833. {
  4834. paraname: "thresh",
  4835. paradesc: "",
  4836. paratype: "",
  4837. valuefrom: "/myapps/thresh1.png",
  4838. },
  4839. {
  4840. paraname: "contours",
  4841. paradesc: "",
  4842. paratype: "",
  4843. valuefrom: "/myapps/contours.png",
  4844. },
  4845. ],
  4846. sourcedatalist: [],
  4847. sourceartilist: [],
  4848. },
  4849. ports: {
  4850. groups: {
  4851. in: {
  4852. position: "left",
  4853. attrs: {
  4854. circle: {
  4855. r: 2.5,
  4856. magnet: true,
  4857. stroke: "black",
  4858. strokeWidth: 1,
  4859. fill: "#fff",
  4860. style: { visibility: true },
  4861. },
  4862. },
  4863. },
  4864. out: {
  4865. position: "right",
  4866. attrs: {
  4867. circle: {
  4868. r: 2.5,
  4869. magnet: true,
  4870. stroke: "black",
  4871. strokeWidth: 1,
  4872. fill: "#fff",
  4873. },
  4874. },
  4875. },
  4876. },
  4877. items: [
  4878. { id: "inport1", group: "in" },
  4879. { id: "inport2", group: "in" },
  4880. { id: "outport1", group: "out" },
  4881. { id: "outport2", group: "out" },
  4882. ],
  4883. },
  4884. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  4885. zIndex: 1,
  4886. },
  4887. ],
  4888. inputsparameters: [],
  4889. inputsartifacts: [],
  4890. argumentsparameters: [],
  4891. argumentsartifacts: [],
  4892. outputsparameters: [],
  4893. outputsartifacts: [
  4894. {
  4895. paraname: "approxCnt",
  4896. valuefrom: "/myapps/approx_cnt.npy",
  4897. paradesc: "",
  4898. paratype: "",
  4899. },
  4900. {
  4901. paraname: "approxRes",
  4902. valuefrom: "/myapps/approx_res.png",
  4903. paradesc: "",
  4904. paratype: "",
  4905. },
  4906. ],
  4907. sourcedatalist: [],
  4908. sourceartilist: [],
  4909. },
  4910. ports: {
  4911. groups: {
  4912. in: {
  4913. position: "left",
  4914. attrs: {
  4915. circle: {
  4916. r: 2.5,
  4917. magnet: true,
  4918. stroke: "black",
  4919. strokeWidth: 1,
  4920. fill: "#fff",
  4921. style: { visibility: true },
  4922. },
  4923. },
  4924. },
  4925. out: {
  4926. position: "right",
  4927. attrs: {
  4928. circle: {
  4929. r: 2.5,
  4930. magnet: true,
  4931. stroke: "black",
  4932. strokeWidth: 1,
  4933. fill: "#fff",
  4934. },
  4935. },
  4936. },
  4937. },
  4938. items: [
  4939. { id: "inport1", group: "in" },
  4940. { id: "inport2", group: "in" },
  4941. { id: "outport1", group: "out" },
  4942. { id: "outport2", group: "out" },
  4943. ],
  4944. },
  4945. id: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  4946. zIndex: 6,
  4947. },
  4948. ],
  4949. inputsparameters: [],
  4950. inputsartifacts: [
  4951. {
  4952. paraname: "approxCnt",
  4953. parapath: "/myapps/approx_cnt.npy",
  4954. paradesc: "",
  4955. },
  4956. ],
  4957. argumentsparameters: [],
  4958. argumentsartifacts: [
  4959. {
  4960. paraname: "approxCnt",
  4961. valuefrom:
  4962. "{{tasks.contourApproximate1.outputs.artifacts.approxCnt}}",
  4963. fileurls: [],
  4964. filelist: [],
  4965. value: ["contourApproximate1", "approxCnt"],
  4966. },
  4967. ],
  4968. outputsparameters: [],
  4969. outputsartifacts: [
  4970. {
  4971. paraname: "approxRes2",
  4972. valuefrom: "/myapps/approx_res2.png",
  4973. paradesc: "",
  4974. paratype: "",
  4975. },
  4976. ],
  4977. sourcedatalist: [],
  4978. sourceartilist: [],
  4979. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  4980. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  4981. },
  4982. ports: {
  4983. groups: {
  4984. in: {
  4985. position: "left",
  4986. attrs: {
  4987. circle: {
  4988. r: 2.5,
  4989. magnet: true,
  4990. stroke: "black",
  4991. strokeWidth: 1,
  4992. fill: "#fff",
  4993. style: { visibility: true },
  4994. },
  4995. },
  4996. },
  4997. out: {
  4998. position: "right",
  4999. attrs: {
  5000. circle: {
  5001. r: 2.5,
  5002. magnet: true,
  5003. stroke: "black",
  5004. strokeWidth: 1,
  5005. fill: "#fff",
  5006. },
  5007. },
  5008. },
  5009. },
  5010. items: [
  5011. { id: "inport1", group: "in" },
  5012. { id: "inport2", group: "in" },
  5013. { id: "outport1", group: "out" },
  5014. { id: "outport2", group: "out" },
  5015. ],
  5016. },
  5017. id: "1e868699-e31f-4daf-a07b-7e903c861fba",
  5018. zIndex: 7,
  5019. },
  5020. {
  5021. shape: "edge",
  5022. attrs: {
  5023. line: {
  5024. stroke: "#808080",
  5025. strokeWidth: 1,
  5026. targetMarker: { name: "block", args: { size: "6" } },
  5027. },
  5028. },
  5029. id: "77d0d40f-d287-4223-abfc-0fd17651bb69",
  5030. router: { name: "er", args: { offset: "center" } },
  5031. tools: {
  5032. items: [{ name: "button-remove", args: { distance: -40 } }],
  5033. },
  5034. source: {
  5035. cell: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  5036. port: "outport1",
  5037. },
  5038. target: {
  5039. cell: "1e868699-e31f-4daf-a07b-7e903c861fba",
  5040. port: "inport1",
  5041. },
  5042. zIndex: 8,
  5043. },
  5044. {
  5045. shape: "edge",
  5046. attrs: {
  5047. line: {
  5048. stroke: "#808080",
  5049. strokeWidth: 1,
  5050. targetMarker: { name: "block", args: { size: "6" } },
  5051. },
  5052. },
  5053. id: "f46b0a77-d34c-4ec8-8bfd-7b48e412669e",
  5054. router: { name: "er", args: { offset: "center" } },
  5055. tools: {
  5056. items: [{ name: "button-remove", args: { distance: -40 } }],
  5057. },
  5058. source: {
  5059. cell: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  5060. port: "outport2",
  5061. },
  5062. target: {
  5063. cell: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  5064. port: "inport1",
  5065. },
  5066. zIndex: 9,
  5067. },
  5068. {
  5069. position: { x: 660, y: 600 },
  5070. size: { width: 90, height: 80 },
  5071. attrs: {
  5072. image: {
  5073. "xlink:href":
  5074. "https://gw.alipayobjects.com/zos/bmw-prod/dc1ced06-417d-466f-927b-b4a4d3265791.svg",
  5075. },
  5076. label: { text: "contourRect1" },
  5077. },
  5078. shape: "template-node",
  5079. data: {
  5080. nodeName: "contourRect1",
  5081. templateName: "contourRect1",
  5082. templateImage: "zvinjodocker/contours_rect1:20211015",
  5083. templateCommand: {},
  5084. templateArgs: {},
  5085. algoparaInput: { userInput: [], getInput: [] },
  5086. algoparaOutput: [],
  5087. algoparaInputargu: { userInput: [], getInput: [] },
  5088. algonodeSource: [
  5089. {
  5090. position: { x: 360, y: 390 },
  5091. size: { width: 90, height: 80 },
  5092. attrs: {
  5093. image: {
  5094. "xlink:href":
  5095. "https://gw.alipayobjects.com/zos/bmw-prod/c36fe7cb-dc24-4854-aeb5-88d8dc36d52e.svg",
  5096. },
  5097. label: { text: "contourApproximate1" },
  5098. },
  5099. shape: "template-node",
  5100. data: {
  5101. nodeName: "contourApproximate1",
  5102. templateName: "contourApproximate1",
  5103. templateImage: "zvinjodocker/contour_approximate1:20211015",
  5104. templateCommand: {},
  5105. templateArgs: {},
  5106. algoparaInput: { userInput: [], getInput: [] },
  5107. algoparaOutput: [],
  5108. algoparaInputargu: { userInput: [], getInput: [] },
  5109. algonodeSource: [
  5110. {
  5111. position: { x: 60, y: 280 },
  5112. size: { width: 90, height: 80 },
  5113. attrs: {
  5114. image: {
  5115. "xlink:href":
  5116. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  5117. },
  5118. label: { text: "contourTask1" },
  5119. },
  5120. shape: "template-node",
  5121. data: {
  5122. nodeName: "contourTask1",
  5123. templateName: "contourTask1",
  5124. templateImage: "zvinjodocker/contous_task1:20211014",
  5125. templateCommand: {},
  5126. templateArgs: {},
  5127. algoparaInput: { userInput: [], getInput: [] },
  5128. algoparaOutput: [],
  5129. algoparaInputargu: { userInput: [], getInput: [] },
  5130. algonodeSource: [],
  5131. inputsparameters: [],
  5132. inputsartifacts: [],
  5133. argumentsparameters: [],
  5134. argumentsartifacts: [],
  5135. outputsparameters: [],
  5136. outputsartifacts: [
  5137. {
  5138. paraname: "thresh",
  5139. paradesc: "",
  5140. paratype: "",
  5141. valuefrom: "/myapps/thresh1.png",
  5142. },
  5143. {
  5144. paraname: "contours",
  5145. paradesc: "",
  5146. paratype: "",
  5147. valuefrom: "/myapps/contours.png",
  5148. },
  5149. ],
  5150. sourcedatalist: [],
  5151. sourceartilist: [],
  5152. },
  5153. ports: {
  5154. groups: {
  5155. in: {
  5156. position: "left",
  5157. attrs: {
  5158. circle: {
  5159. r: 2.5,
  5160. magnet: true,
  5161. stroke: "black",
  5162. strokeWidth: 1,
  5163. fill: "#fff",
  5164. style: { visibility: true },
  5165. },
  5166. },
  5167. },
  5168. out: {
  5169. position: "right",
  5170. attrs: {
  5171. circle: {
  5172. r: 2.5,
  5173. magnet: true,
  5174. stroke: "black",
  5175. strokeWidth: 1,
  5176. fill: "#fff",
  5177. },
  5178. },
  5179. },
  5180. },
  5181. items: [
  5182. { id: "inport1", group: "in" },
  5183. { id: "inport2", group: "in" },
  5184. { id: "outport1", group: "out" },
  5185. { id: "outport2", group: "out" },
  5186. ],
  5187. },
  5188. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  5189. zIndex: 1,
  5190. },
  5191. ],
  5192. inputsparameters: [],
  5193. inputsartifacts: [],
  5194. argumentsparameters: [],
  5195. argumentsartifacts: [],
  5196. outputsparameters: [],
  5197. outputsartifacts: [
  5198. {
  5199. paraname: "approxCnt",
  5200. valuefrom: "/myapps/approx_cnt.npy",
  5201. paradesc: "",
  5202. paratype: "",
  5203. },
  5204. {
  5205. paraname: "approxRes",
  5206. valuefrom: "/myapps/approx_res.png",
  5207. paradesc: "",
  5208. paratype: "",
  5209. },
  5210. ],
  5211. sourcedatalist: [],
  5212. sourceartilist: [],
  5213. },
  5214. ports: {
  5215. groups: {
  5216. in: {
  5217. position: "left",
  5218. attrs: {
  5219. circle: {
  5220. r: 2.5,
  5221. magnet: true,
  5222. stroke: "black",
  5223. strokeWidth: 1,
  5224. fill: "#fff",
  5225. style: { visibility: true },
  5226. },
  5227. },
  5228. },
  5229. out: {
  5230. position: "right",
  5231. attrs: {
  5232. circle: {
  5233. r: 2.5,
  5234. magnet: true,
  5235. stroke: "black",
  5236. strokeWidth: 1,
  5237. fill: "#fff",
  5238. },
  5239. },
  5240. },
  5241. },
  5242. items: [
  5243. { id: "inport1", group: "in" },
  5244. { id: "inport2", group: "in" },
  5245. { id: "outport1", group: "out" },
  5246. { id: "outport2", group: "out" },
  5247. ],
  5248. },
  5249. id: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  5250. zIndex: 6,
  5251. },
  5252. ],
  5253. inputsparameters: [],
  5254. inputsartifacts: [],
  5255. argumentsparameters: [],
  5256. argumentsartifacts: [],
  5257. outputsparameters: [],
  5258. outputsartifacts: [
  5259. {
  5260. paraname: "cnt",
  5261. valuefrom: "/myapps/contour_rect_cnt.npy",
  5262. paradesc: "",
  5263. paratype: "",
  5264. },
  5265. {
  5266. paraname: "contourRect",
  5267. valuefrom: "/myapps/contour_rect.png",
  5268. paradesc: "",
  5269. paratype: "",
  5270. },
  5271. ],
  5272. sourcedatalist: [],
  5273. sourceartilist: [],
  5274. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  5275. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  5276. },
  5277. ports: {
  5278. groups: {
  5279. in: {
  5280. position: "left",
  5281. attrs: {
  5282. circle: {
  5283. r: 2.5,
  5284. magnet: true,
  5285. stroke: "black",
  5286. strokeWidth: 1,
  5287. fill: "#fff",
  5288. style: { visibility: true },
  5289. },
  5290. },
  5291. },
  5292. out: {
  5293. position: "right",
  5294. attrs: {
  5295. circle: {
  5296. r: 2.5,
  5297. magnet: true,
  5298. stroke: "black",
  5299. strokeWidth: 1,
  5300. fill: "#fff",
  5301. },
  5302. },
  5303. },
  5304. },
  5305. items: [
  5306. { id: "inport1", group: "in" },
  5307. { id: "inport2", group: "in" },
  5308. { id: "outport1", group: "out" },
  5309. { id: "outport2", group: "out" },
  5310. ],
  5311. },
  5312. id: "6d787d4a-a68d-4a8c-a3b9-559eb5d4e231",
  5313. zIndex: 10,
  5314. },
  5315. {
  5316. position: { x: 910, y: 600 },
  5317. size: { width: 90, height: 80 },
  5318. attrs: {
  5319. image: {
  5320. "xlink:href":
  5321. "https://gw.alipayobjects.com/zos/bmw-prod/687b6cb9-4b97-42a6-96d0-34b3099133ac.svg",
  5322. },
  5323. label: { text: "contourCircle2" },
  5324. },
  5325. shape: "template-node",
  5326. data: {
  5327. nodeName: "contourCircle2",
  5328. templateName: "contourCircle2",
  5329. templateImage: "zvinjodocker/contours_circle2:20211015",
  5330. templateCommand: {},
  5331. templateArgs: {},
  5332. algoparaInput: { userInput: [], getInput: [] },
  5333. algoparaOutput: [],
  5334. algoparaInputargu: { userInput: [], getInput: [] },
  5335. algonodeSource: [
  5336. {
  5337. position: { x: 660, y: 600 },
  5338. size: { width: 90, height: 80 },
  5339. attrs: {
  5340. image: {
  5341. "xlink:href":
  5342. "https://gw.alipayobjects.com/zos/bmw-prod/dc1ced06-417d-466f-927b-b4a4d3265791.svg",
  5343. },
  5344. label: { text: "contourRect1" },
  5345. },
  5346. shape: "template-node",
  5347. data: {
  5348. nodeName: "contourRect1",
  5349. templateName: "contourRect1",
  5350. templateImage: "zvinjodocker/contours_rect1:20211015",
  5351. templateCommand: {},
  5352. templateArgs: {},
  5353. algoparaInput: { userInput: [], getInput: [] },
  5354. algoparaOutput: [],
  5355. algoparaInputargu: { userInput: [], getInput: [] },
  5356. algonodeSource: [
  5357. {
  5358. position: { x: 360, y: 390 },
  5359. size: { width: 90, height: 80 },
  5360. attrs: {
  5361. image: {
  5362. "xlink:href":
  5363. "https://gw.alipayobjects.com/zos/bmw-prod/c36fe7cb-dc24-4854-aeb5-88d8dc36d52e.svg",
  5364. },
  5365. label: { text: "contourApproximate1" },
  5366. },
  5367. shape: "template-node",
  5368. data: {
  5369. nodeName: "contourApproximate1",
  5370. templateName: "contourApproximate1",
  5371. templateImage:
  5372. "zvinjodocker/contour_approximate1:20211015",
  5373. templateCommand: {},
  5374. templateArgs: {},
  5375. algoparaInput: { userInput: [], getInput: [] },
  5376. algoparaOutput: [],
  5377. algoparaInputargu: { userInput: [], getInput: [] },
  5378. algonodeSource: [
  5379. {
  5380. position: { x: 60, y: 280 },
  5381. size: { width: 90, height: 80 },
  5382. attrs: {
  5383. image: {
  5384. "xlink:href":
  5385. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  5386. },
  5387. label: { text: "contourTask1" },
  5388. },
  5389. shape: "template-node",
  5390. data: {
  5391. nodeName: "contourTask1",
  5392. templateName: "contourTask1",
  5393. templateImage:
  5394. "zvinjodocker/contous_task1:20211014",
  5395. templateCommand: {},
  5396. templateArgs: {},
  5397. algoparaInput: { userInput: [], getInput: [] },
  5398. algoparaOutput: [],
  5399. algoparaInputargu: {
  5400. userInput: [],
  5401. getInput: [],
  5402. },
  5403. algonodeSource: [],
  5404. inputsparameters: [],
  5405. inputsartifacts: [],
  5406. argumentsparameters: [],
  5407. argumentsartifacts: [],
  5408. outputsparameters: [],
  5409. outputsartifacts: [
  5410. {
  5411. paraname: "thresh",
  5412. paradesc: "",
  5413. paratype: "",
  5414. valuefrom: "/myapps/thresh1.png",
  5415. },
  5416. {
  5417. paraname: "contours",
  5418. paradesc: "",
  5419. paratype: "",
  5420. valuefrom: "/myapps/contours.png",
  5421. },
  5422. ],
  5423. sourcedatalist: [],
  5424. sourceartilist: [],
  5425. },
  5426. ports: {
  5427. groups: {
  5428. in: {
  5429. position: "left",
  5430. attrs: {
  5431. circle: {
  5432. r: 2.5,
  5433. magnet: true,
  5434. stroke: "black",
  5435. strokeWidth: 1,
  5436. fill: "#fff",
  5437. style: { visibility: true },
  5438. },
  5439. },
  5440. },
  5441. out: {
  5442. position: "right",
  5443. attrs: {
  5444. circle: {
  5445. r: 2.5,
  5446. magnet: true,
  5447. stroke: "black",
  5448. strokeWidth: 1,
  5449. fill: "#fff",
  5450. },
  5451. },
  5452. },
  5453. },
  5454. items: [
  5455. { id: "inport1", group: "in" },
  5456. { id: "inport2", group: "in" },
  5457. { id: "outport1", group: "out" },
  5458. { id: "outport2", group: "out" },
  5459. ],
  5460. },
  5461. id: "fadef8ac-8dcd-4d8e-8968-d156ffd941c5",
  5462. zIndex: 1,
  5463. },
  5464. ],
  5465. inputsparameters: [],
  5466. inputsartifacts: [],
  5467. argumentsparameters: [],
  5468. argumentsartifacts: [],
  5469. outputsparameters: [],
  5470. outputsartifacts: [
  5471. {
  5472. paraname: "approxCnt",
  5473. valuefrom: "/myapps/approx_cnt.npy",
  5474. paradesc: "",
  5475. paratype: "",
  5476. },
  5477. {
  5478. paraname: "approxRes",
  5479. valuefrom: "/myapps/approx_res.png",
  5480. paradesc: "",
  5481. paratype: "",
  5482. },
  5483. ],
  5484. sourcedatalist: [],
  5485. sourceartilist: [],
  5486. },
  5487. ports: {
  5488. groups: {
  5489. in: {
  5490. position: "left",
  5491. attrs: {
  5492. circle: {
  5493. r: 2.5,
  5494. magnet: true,
  5495. stroke: "black",
  5496. strokeWidth: 1,
  5497. fill: "#fff",
  5498. style: { visibility: true },
  5499. },
  5500. },
  5501. },
  5502. out: {
  5503. position: "right",
  5504. attrs: {
  5505. circle: {
  5506. r: 2.5,
  5507. magnet: true,
  5508. stroke: "black",
  5509. strokeWidth: 1,
  5510. fill: "#fff",
  5511. },
  5512. },
  5513. },
  5514. },
  5515. items: [
  5516. { id: "inport1", group: "in" },
  5517. { id: "inport2", group: "in" },
  5518. { id: "outport1", group: "out" },
  5519. { id: "outport2", group: "out" },
  5520. ],
  5521. },
  5522. id: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  5523. zIndex: 6,
  5524. },
  5525. ],
  5526. inputsparameters: [],
  5527. inputsartifacts: [],
  5528. argumentsparameters: [],
  5529. argumentsartifacts: [],
  5530. outputsparameters: [],
  5531. outputsartifacts: [
  5532. {
  5533. paraname: "cnt",
  5534. valuefrom: "/myapps/contour_rect_cnt.npy",
  5535. paradesc: "",
  5536. paratype: "",
  5537. },
  5538. {
  5539. paraname: "contourRect",
  5540. valuefrom: "/myapps/contour_rect.png",
  5541. paradesc: "",
  5542. paratype: "",
  5543. },
  5544. ],
  5545. sourcedatalist: [],
  5546. sourceartilist: [],
  5547. },
  5548. ports: {
  5549. groups: {
  5550. in: {
  5551. position: "left",
  5552. attrs: {
  5553. circle: {
  5554. r: 2.5,
  5555. magnet: true,
  5556. stroke: "black",
  5557. strokeWidth: 1,
  5558. fill: "#fff",
  5559. style: { visibility: true },
  5560. },
  5561. },
  5562. },
  5563. out: {
  5564. position: "right",
  5565. attrs: {
  5566. circle: {
  5567. r: 2.5,
  5568. magnet: true,
  5569. stroke: "black",
  5570. strokeWidth: 1,
  5571. fill: "#fff",
  5572. },
  5573. },
  5574. },
  5575. },
  5576. items: [
  5577. { id: "inport1", group: "in" },
  5578. { id: "inport2", group: "in" },
  5579. { id: "outport1", group: "out" },
  5580. { id: "outport2", group: "out" },
  5581. ],
  5582. },
  5583. id: "6d787d4a-a68d-4a8c-a3b9-559eb5d4e231",
  5584. zIndex: 10,
  5585. },
  5586. ],
  5587. inputsparameters: [],
  5588. inputsartifacts: [
  5589. {
  5590. paraname: "contourRect",
  5591. parapath: "/myapps/contour_rect.png",
  5592. paradesc: "",
  5593. },
  5594. {
  5595. paraname: "cnt",
  5596. parapath: "/myapps/contour_rect_cnt.npy",
  5597. paradesc: "",
  5598. },
  5599. ],
  5600. argumentsparameters: [],
  5601. argumentsartifacts: [
  5602. {
  5603. paraname: "contourRect",
  5604. valuefrom:
  5605. "{{tasks.contourRect1.outputs.artifacts.contourRect}}",
  5606. fileurls: [],
  5607. filelist: [],
  5608. value: ["contourRect1", "contourRect"],
  5609. },
  5610. {
  5611. paraname: "cnt",
  5612. valuefrom: "{{tasks.contourRect1.outputs.artifacts.cnt}}",
  5613. fileurls: [],
  5614. filelist: [],
  5615. value: ["contourRect1", "cnt"],
  5616. },
  5617. ],
  5618. outputsparameters: [],
  5619. outputsartifacts: [
  5620. {
  5621. paraname: "contourCircle",
  5622. valuefrom: "contour_circle.png",
  5623. paradesc: "",
  5624. paratype: "",
  5625. },
  5626. ],
  5627. sourcedatalist: [],
  5628. sourceartilist: [],
  5629. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  5630. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  5631. },
  5632. ports: {
  5633. groups: {
  5634. in: {
  5635. position: "left",
  5636. attrs: {
  5637. circle: {
  5638. r: 2.5,
  5639. magnet: true,
  5640. stroke: "black",
  5641. strokeWidth: 1,
  5642. fill: "#fff",
  5643. style: { visibility: true },
  5644. },
  5645. },
  5646. },
  5647. out: {
  5648. position: "right",
  5649. attrs: {
  5650. circle: {
  5651. r: 2.5,
  5652. magnet: true,
  5653. stroke: "black",
  5654. strokeWidth: 1,
  5655. fill: "#fff",
  5656. },
  5657. },
  5658. },
  5659. },
  5660. items: [
  5661. { id: "inport1", group: "in" },
  5662. { id: "inport2", group: "in" },
  5663. { id: "outport1", group: "out" },
  5664. { id: "outport2", group: "out" },
  5665. ],
  5666. },
  5667. id: "283ddff1-40c9-43aa-b581-b99706e65fb3",
  5668. zIndex: 11,
  5669. },
  5670. {
  5671. shape: "edge",
  5672. attrs: {
  5673. line: {
  5674. stroke: "#808080",
  5675. strokeWidth: 1,
  5676. targetMarker: { name: "block", args: { size: "6" } },
  5677. },
  5678. },
  5679. id: "5f83bef7-8f4c-4b6a-ac51-b076c1e03042",
  5680. router: { name: "er", args: { offset: "center" } },
  5681. tools: {
  5682. items: [{ name: "button-remove", args: { distance: -40 } }],
  5683. },
  5684. source: {
  5685. cell: "2d3ccc77-be7c-4fa0-ae37-a9af4fdf6730",
  5686. port: "outport2",
  5687. },
  5688. target: {
  5689. cell: "6d787d4a-a68d-4a8c-a3b9-559eb5d4e231",
  5690. port: "inport1",
  5691. },
  5692. zIndex: 12,
  5693. },
  5694. {
  5695. shape: "edge",
  5696. attrs: {
  5697. line: {
  5698. stroke: "#808080",
  5699. strokeWidth: 1,
  5700. targetMarker: { name: "block", args: { size: "6" } },
  5701. },
  5702. },
  5703. id: "9017467c-167e-4f01-97dd-37d2d42bd0ed",
  5704. router: { name: "er", args: { offset: "center" } },
  5705. tools: {
  5706. items: [{ name: "button-remove", args: { distance: -40 } }],
  5707. },
  5708. source: {
  5709. cell: "6d787d4a-a68d-4a8c-a3b9-559eb5d4e231",
  5710. port: "outport1",
  5711. },
  5712. target: {
  5713. cell: "283ddff1-40c9-43aa-b581-b99706e65fb3",
  5714. port: "inport1",
  5715. },
  5716. zIndex: 13,
  5717. },
  5718. ]);
  5719. console.log("fromJson");
  5720. },
  5721. //20211110
  5722. // 获取数据列表------------------20211115 可能后续需要将 其改为workflowdatalist
  5723. getDataList() {
  5724. this.dataListLoading = true;
  5725. this.$http({
  5726. url: this.$http.adornUrl("/sys/visiworkflow/list"),
  5727. method: "get",
  5728. params: this.$http.adornParams({
  5729. page: 1,
  5730. limit: 100,
  5731. key: "",
  5732. // page: this.pageIndex,
  5733. // limit: this.pageSize,
  5734. // key: this.dataForm.key,
  5735. }),
  5736. }).then(({ data }) => {
  5737. if (data && data.code === 0) {
  5738. this.workflowdataList = data.page.list;
  5739. this.workflowtotalPage = data.page.totalCount;
  5740. } else {
  5741. this.workflowdataList = [];
  5742. this.workflowtotalPage = 0;
  5743. }
  5744. this.dataListLoading = false;
  5745. });
  5746. },
  5747. // 每页数 ---避免与其他函数冲突,可能需要改参数 1115
  5748. sizeChangeHandle(val) {
  5749. this.pageSize = val;
  5750. this.pageIndex = 1;
  5751. this.getDataList();
  5752. },
  5753. // 当前页
  5754. currentChangeHandle(val) {
  5755. this.pageIndex = val;
  5756. this.getDataList();
  5757. },
  5758. // 多选
  5759. selectionChangeHandle(val) {
  5760. this.dataListSelections = val;
  5761. },
  5762. //20210805 zhang 右侧参数设置栏 design-panel
  5763. handleFormLayoutChange(e) {
  5764. this.formLayout = e.target.value;
  5765. },
  5766. callback(key) {
  5767. console.log(key);
  5768. },
  5769. //20211115 获取左侧树形组件栏 算法模块节点列表
  5770. // 获取数据列表
  5771. getalgorithmDataList() {
  5772. this.dataListLoading = true;
  5773. this.$http({
  5774. url: this.$http.adornUrl("/sys/visialgorithmnode/list"),
  5775. method: "get",
  5776. params: this.$http.adornParams({
  5777. page: 1,
  5778. limit: 100,
  5779. // key: "",
  5780. }),
  5781. }).then(({ data }) => {
  5782. if (data && data.code === 0) {
  5783. this.algorithmdataList = data.page.list;
  5784. this.algorithmtotalPage = data.page.totalCount;
  5785. //20211115 已成功
  5786. console.log("20211115 左侧节点栏数据");
  5787. console.log(this.algorithmdataList);
  5788. this.createAlgorithmNode();
  5789. } else {
  5790. this.algorithmdataList = [];
  5791. this.totalPage = 0;
  5792. console.log("20211115 左侧节点栏数据 为空");
  5793. console.log(this.algorithmdataList);
  5794. }
  5795. this.dataListLoading = false;
  5796. });
  5797. },
  5798. //添加函数 ----根据数据库中的数据来创建画布中的节点, ----树形组件中的数据包括键
  5799. // 左侧树形组件栏读取数据库表visi_algorithmnode中数据,添加至树形组件treedata中,并创建对应画布节点后添加至nodedata中,可通过点击树形组件栏在画布中创建对应节点的克隆。------已成功
  5800. createAlgorithmNode() {
  5801. this.treeData = [
  5802. {
  5803. title: "操作节点",
  5804. key: "0-0",
  5805. slots: {
  5806. icon: "smile",
  5807. },
  5808. children: [
  5809. // {
  5810. // title: "consume_artifact",
  5811. // key: "consume_artifact",
  5812. // slots: { icon: "meh" },
  5813. // },
  5814. // {
  5815. // title: "generate_artifact",
  5816. // key: "generate_artifact",
  5817. // scopedSlots: { icon: "custom" },
  5818. // },
  5819. // {
  5820. // title: "zdockertest",
  5821. // key: "zdockertest",
  5822. // scopedSlots: { icon: "custom" },
  5823. // },
  5824. {
  5825. title: "条件节点",
  5826. key: "条件节点",
  5827. scopedSlots: { icon: "custom" },
  5828. },
  5829. {
  5830. title: "输入节点",
  5831. key: "dataInputnode",
  5832. scopedSlots: { icon: "custom" },
  5833. },
  5834. {
  5835. title: "输出节点",
  5836. key: "dataOutputnode",
  5837. scopedSlots: { icon: "custom" },
  5838. },
  5839. {
  5840. title: "CSV文件转换节点",
  5841. key: "CSVConversionnode",
  5842. scopedSlots: { icon: "custom" },
  5843. },
  5844. ],
  5845. },
  5846. {
  5847. title: "轮廓识别",
  5848. key: "0-1",
  5849. slots: {
  5850. icon: "smile",
  5851. },
  5852. children: [
  5853. {
  5854. title: "contourTask1",
  5855. key: "contourTask1",
  5856. scopedSlots: { icon: "custom" },
  5857. },
  5858. {
  5859. title: "contourTask2",
  5860. key: "contourTask2",
  5861. scopedSlots: { icon: "custom" },
  5862. },
  5863. {
  5864. title: "contourTask3",
  5865. key: "contourTask3",
  5866. scopedSlots: { icon: "custom" },
  5867. },
  5868. {
  5869. title: "contourApproximate1",
  5870. key: "contourApproximate1",
  5871. scopedSlots: { icon: "custom" },
  5872. },
  5873. {
  5874. title: "contourApproximate2",
  5875. key: "contourApproximate2",
  5876. scopedSlots: { icon: "custom" },
  5877. },
  5878. {
  5879. title: "contourRect1",
  5880. key: "contourRect1",
  5881. scopedSlots: { icon: "custom" },
  5882. },
  5883. {
  5884. title: "contourCircle2",
  5885. key: "contourCircle2",
  5886. scopedSlots: { icon: "custom" },
  5887. },
  5888. ],
  5889. },
  5890. ];
  5891. for (var i = 0; i < this.algorithmdataList.length; i++) {
  5892. // //遍历数组
  5893. // console.log(i);
  5894. // console.log(this.algorithmdataList[i].algonodeName);
  5895. // console.log(this.algorithmdataList[i].algonodeImage);
  5896. // console.log(JSON.parse(this.algorithmdataList[i].algoparatempJson)); //将string转化为Json
  5897. // console.log(
  5898. // JSON.parse(this.algorithmdataList[i].algoparatempJson).Input
  5899. // );
  5900. // console.log(
  5901. // JSON.parse(this.algorithmdataList[i].algoparatempJson).Output
  5902. // );
  5903. // console.log("treeData");
  5904. // console.log(this.treeData);
  5905. // this.treeData[1].children.addNode({
  5906. // title: "this.algorithmdataList[i].algonodeName",
  5907. // key: "this.algorithmdataList[i].algonodeName",
  5908. // scopedSlots: { icon: "custom" },
  5909. // })
  5910. var addalgotree = false; //标志 目录树是否已添加该节点
  5911. for (var j = 0; j < this.treeData.length; j++) {
  5912. if (
  5913. this.treeData[j].title == this.algorithmdataList[i].algotreetype
  5914. ) {
  5915. // //判断是否已有该节点
  5916. // for (var k = 0; k < this.treeData.children.length; k++) {
  5917. // if (
  5918. // this.treeData.children[k].key ==
  5919. // this.algorithmdataList[i].algonodeName
  5920. // ) {
  5921. // addalgotree = true;
  5922. // break;
  5923. // }
  5924. // }
  5925. // if (!addalgotree) {
  5926. this.treeData[j].children.push({
  5927. title: this.algorithmdataList[i].algonodeName,
  5928. key: this.algorithmdataList[i].algonodeName,
  5929. scopedSlots: { icon: "custom" },
  5930. });
  5931. addalgotree = true;
  5932. // break;
  5933. // }
  5934. }
  5935. }
  5936. if (!addalgotree) {
  5937. this.treeData.push({
  5938. title: this.algorithmdataList[i].algotreetype,
  5939. key: this.algorithmdataList[i].algotreetype,
  5940. scopedSlots: { icon: "custom" },
  5941. children: [
  5942. {
  5943. title: this.algorithmdataList[i].algonodeName,
  5944. key: this.algorithmdataList[i].algonodeName,
  5945. scopedSlots: { icon: "custom" },
  5946. },
  5947. ],
  5948. });
  5949. }
  5950. // this.treeData[1].children.push({
  5951. // title: this.algorithmdataList[i].algonodeName,
  5952. // key: this.algorithmdataList[i].algonodeName,
  5953. // scopedSlots: { icon: "custom" },
  5954. // });
  5955. console.log(this.treeData);
  5956. // var imageurl =
  5957. // "/src/assets/img/" + this.algorithmdataList[i].algonodeName + ".svg";
  5958. //节点名称后跟随机参数
  5959. if (
  5960. this.algorithmdataList[i].algotreetype != "传统算法" &&
  5961. this.algorithmdataList[i].algotreetype != "智能应用"
  5962. ) {
  5963. this.imageurl = require("@/assets/img/visisvg/" +
  5964. this.algorithmdataList[i].algonodeName +
  5965. ".svg");
  5966. }
  5967. var newalgonode = this.graph.createNode({
  5968. x: 0,
  5969. y: 0,
  5970. // width: 170,
  5971. // height: 30,
  5972. shape: "template-node",
  5973. // label: "consume_artifact",
  5974. attrs: {
  5975. label: {
  5976. text: this.algorithmdataList[i].algonodeName, //"contour_task1",
  5977. // text: this.algorithmdataList[i].algonodeName, //"contour_task1",
  5978. },
  5979. body: {
  5980. // stroke: "#2CB9FF",
  5981. // fill: "#2CB9FF",
  5982. fill: "#d3ebf3",
  5983. },
  5984. // body: {
  5985. // stroke: "#DA2625",
  5986. // fill: "#DA2625",
  5987. // },
  5988. image: {
  5989. "xlink:href": this.imageurl,
  5990. // "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  5991. // "src/views/modules/visi/visisvg/算法.svg", /src/assets/img/ ../../../assets/img/
  5992. //可放图标
  5993. },
  5994. },
  5995. data: {
  5996. algonodeId: this.algorithmdataList[i].algonodeId,
  5997. nodeName: this.algorithmdataList[i].algonodeName,
  5998. templateName: this.algorithmdataList[i].algonodeName,
  5999. templateImage: this.algorithmdataList[i].algonodeImage,
  6000. templateCommand: {
  6001. // 1: "sh",
  6002. // 2: "-c",
  6003. // 2:"\"{{inputs.parameters.message}}\""
  6004. },
  6005. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  6006. // templateCommand2: [
  6007. // {
  6008. // 1:"echo"
  6009. // },
  6010. // {
  6011. // 2:"{{inputs.parameters.message}}"
  6012. // },
  6013. // ],
  6014. templateArgs: {
  6015. // 1: "cat /tmp/message",
  6016. },
  6017. algoparaInput: JSON.parse(
  6018. this.algorithmdataList[i].algoparatempJson
  6019. ).Input,
  6020. algoparaOutput: JSON.parse(
  6021. this.algorithmdataList[i].algoparatempJson
  6022. ).Output,
  6023. algoparaOutAddress: this.algorithmdataList[i].algoparaoutputAddress,
  6024. algonodeSource: [],
  6025. inputsparameters: JSON.parse(
  6026. this.algorithmdataList[i].algoparatempJson
  6027. ).Input.ParameterInput,
  6028. inputsartifacts: JSON.parse(
  6029. this.algorithmdataList[i].algoparatempJson
  6030. ).Input.FileInput,
  6031. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  6032. //应对应input中的各项参数设置对应参数
  6033. argumentsparameters: JSON.parse(
  6034. this.algorithmdataList[i].algoparatempJson
  6035. ).Input.ParameterInput,
  6036. argumentsartifacts: JSON.parse(
  6037. this.algorithmdataList[i].algoparatempJson
  6038. ).Input.FileInput,
  6039. outputsparameters: JSON.parse(
  6040. this.algorithmdataList[i].algoparatempJson
  6041. ).Output.ParameterOutput,
  6042. outputsartifacts: JSON.parse(
  6043. this.algorithmdataList[i].algoparatempJson
  6044. ).Output.FileOutput,
  6045. //获取到的连接线源的数据 连接线的源的输出数据
  6046. sourcedatalist: [],
  6047. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  6048. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  6049. wftempname: "", //保存Template name
  6050. },
  6051. });
  6052. this.nodedata.push(newalgonode);
  6053. console.log(newalgonode.getData());
  6054. }
  6055. },
  6056. //20211115 左侧栏新增节点测试,未完成 ---------仅测试通过,可存入,需结合新增前端页面重新配置
  6057. addalgorithmdata() {
  6058. this.$http({
  6059. url: this.$http.adornUrl("/sys/visialgorithmnode/save"),
  6060. method: "post",
  6061. data: this.$http.adornData({
  6062. userId: this.$store.state.user.id,
  6063. algonodeId: undefined,
  6064. algonodeName: "contourCircle2",
  6065. algonodeImage: "zvinjodocker/contours_circle2:20211015",
  6066. algoparatempJson: JSON.stringify({
  6067. Input: [
  6068. { paraname: " cnt", paratype: " ", paradesc: " " },
  6069. { paraname: "contour", paratype: " ", paradesc: " " },
  6070. ],
  6071. Output: [
  6072. { paraname: " ", paratype: " ", paradesc: " " },
  6073. { paraname: "", paratype: " ", paradesc: " " },
  6074. ],
  6075. }),
  6076. algoparaoutputAddress: "", //this.dataForm.algoparaoutputAddress
  6077. // userId: this.dataForm.userId,
  6078. // algonodeId: this.dataForm.algonodeId || undefined,
  6079. // algonodeName: this.dataForm.algonodeName,
  6080. // algonodeImage: this.dataForm.algonodeImage,
  6081. // algoparatempJson: this.dataForm.algoparatempJson,
  6082. }),
  6083. }).then(({ data }) => {
  6084. if (data && data.code === 0) {
  6085. Message.success("操作成功");
  6086. // this.$message({
  6087. // message: "操作成功",
  6088. // type: "success",
  6089. // duration: 1500,
  6090. // onClose: () => {
  6091. // this.visible = false;
  6092. // this.$emit("refreshDataList");
  6093. // },
  6094. // });
  6095. } else {
  6096. Message.error(data.msg);
  6097. // this.$message.error(data.msg);
  6098. }
  6099. });
  6100. // this.$refs['dataForm'].validate((valid) => {
  6101. // if (valid) {
  6102. // this.$http({
  6103. // url: this.$http.adornUrl(`/generator/visialgorithmnode/${!this.dataForm.algonodeId ? 'save' : 'update'}`),
  6104. // method: 'post',
  6105. // data: this.$http.adornData({
  6106. // 'userId': this.dataForm.userId,
  6107. // 'algonodeId': this.dataForm.algonodeId || undefined,
  6108. // 'algonodeName': this.dataForm.algonodeName,
  6109. // 'algonodeImage': this.dataForm.algonodeImage,
  6110. // 'algoparatempJson': this.dataForm.algoparatempJson
  6111. // })
  6112. // }).then(({data}) => {
  6113. // if (data && data.code === 0) {
  6114. // this.$message({
  6115. // message: '操作成功',
  6116. // type: 'success',
  6117. // duration: 1500,
  6118. // onClose: () => {
  6119. // this.visible = false
  6120. // this.$emit('refreshDataList')
  6121. // }
  6122. // })
  6123. // } else {
  6124. // this.$message.error(data.msg)
  6125. // }
  6126. // })
  6127. // }
  6128. // })
  6129. },
  6130. //保存实验名称
  6131. primaryExperimentConfig(args) {
  6132. console.log("保存实验名称");
  6133. console.log(args);
  6134. this.experimentName = args[0];
  6135. console.log(this.experimentName);
  6136. },
  6137. //20210810 保存条件节点设置
  6138. primaryConNodeConfig(args) {
  6139. this.graph
  6140. .getCellById(args[1].id)
  6141. .setData({ inputcondition: args[1].getData().inputcondition });
  6142. this.graph
  6143. .getCellById(args[1].id)
  6144. .setData({ nodeName: args[1].getData().nodeName });
  6145. //20210811 测试用
  6146. // //model 获取节点信息
  6147. // //遍历节点信息, 比对节点id 然后赋值
  6148. // console.log("cell:"+args[1]);
  6149. // console.log("cell:"+args[1].id);
  6150. // //返回 [Object,Object ]
  6151. // console.log("对应id的node:"+this.graph.getCellById(args[1]));
  6152. // console.log("更改过的inputcondition:"+args[1].getData("inputcondition"));
  6153. // console.log(args[1].getData().inputcondition);
  6154. // const condition = args[1].getData().inputcondition;
  6155. // this.graph.getCellById(args[1].id).setData({inputcondition: condition});
  6156. // console.log(args[1])
  6157. // console.log("graph node:"+this.graph.getNodes());
  6158. },
  6159. //20210811 保存templateNode节点设置 仅参数设置
  6160. primaryNodeConfig(args) {
  6161. var primarydata = args[1].getData();
  6162. //先保存一遍,做处理在保存一遍
  6163. console.log("更改前");
  6164. console.log(this.graph.getCellById(args[1].id));
  6165. //此部分应该只是展示,不可更改
  6166. // this.graph.getCellById(args[1].id).setData({templateName:primarydata.templateName});
  6167. // this.graph.getCellById(args[1].id).setData({templateImage: primarydata.templateImage});
  6168. // this.graph.getCellById(args[1].id).setData({templateCommand: primarydata.templateCommand});
  6169. // this.graph.getCellById(args[1].id).setData({templateArgs: primarydata.templateArgs});
  6170. // this.graph.getCellById(args[1].id).setData({inputsparameters: primarydata.inputsparameters}); //应该是不变的
  6171. // this.graph.getCellById(args[1].id).setData({outputsparameters: primarydata.outputsparameters}); //应该是不变的
  6172. //仅可更改argumentsparameters 具体对接 还需实现后端
  6173. //20211124 primarydata
  6174. //保存参数类型
  6175. for (var i = 0; i < primarydata.argumentsparameters.length; i++) {
  6176. if (primarydata.argumentsparameters[i].hasOwnProperty("quotevalue")) {
  6177. //成功
  6178. // if (primarydata.argumentsparameters[i].quotevalue && primarydata.argumentsparameters[i].quotevalue.length == 2) {
  6179. // primarydata.argumentsparameters[i].valuefrom =
  6180. // "{{tasks." +
  6181. // primarydata.argumentsparameters[i].quotevalue[0] +
  6182. // ".outputs.parameters." +
  6183. // primarydata.argumentsparameters[i].quotevalue[1] +
  6184. // "}}";
  6185. // console.log(primarydata.argumentsparameters[i].valuefrom)
  6186. // }
  6187. // 引用其他算法节点参数类型输入改为多选节点之后
  6188. primarydata.argumentsparameters[i].valuefrom = [];
  6189. if (
  6190. primarydata.argumentsparameters[i].quotevalue &&
  6191. primarydata.argumentsparameters[i].quotevalue.length != 0
  6192. ) {
  6193. // primarydata.argumentsparameters[i].valuefrom = [];
  6194. for (
  6195. var j = 0;
  6196. j < primarydata.argumentsparameters[i].quotevalue.length;
  6197. j++
  6198. ) {
  6199. console.log(
  6200. " quotevalue.length " +
  6201. primarydata.argumentsparameters[i].quotevalue.length
  6202. );
  6203. primarydata.argumentsparameters[i].valuefrom.push(
  6204. "{{tasks." +
  6205. primarydata.argumentsparameters[i].quotevalue[j][0] +
  6206. ".outputs.parameters." +
  6207. primarydata.argumentsparameters[i].quotevalue[j][1] +
  6208. "}}"
  6209. );
  6210. }
  6211. console.log(primarydata.argumentsparameters[i].valuefrom);
  6212. }
  6213. }
  6214. }
  6215. //保存文件类型
  6216. // const curfilelist = [];
  6217. let filedata = new FormData(); //保存文件内容,传递给后端---遍历完所有的argumentartifact之后统一上传
  6218. for (var i = 0; i < primarydata.argumentsartifacts.length; i++) {
  6219. if (primarydata.argumentsartifacts[i].hasOwnProperty("quotevalue")) {
  6220. if (
  6221. primarydata.argumentsartifacts[i].quotevalue &&
  6222. primarydata.argumentsartifacts[i].quotevalue.length == 2
  6223. ) {
  6224. primarydata.argumentsartifacts[i].valuefrom =
  6225. "{{tasks." +
  6226. primarydata.argumentsartifacts[i].quotevalue[0] +
  6227. ".outputs.artifacts." +
  6228. primarydata.argumentsartifacts[i].quotevalue[1] +
  6229. "}}";
  6230. }
  6231. }
  6232. //1125 需后端保存至 minio 中,返回地址 -----或者在画布提交之后,上传,在应用具体地址信息
  6233. if (primarydata.argumentsartifacts[i].hasOwnProperty("filelist")) {
  6234. if (primarydata.argumentsartifacts[i].filelist.length != 0) {
  6235. const curfilelist = [];
  6236. // const curfileurl = []; //设定一次只能传一个
  6237. // let filedata = new FormData(); //保存文件内容,传递给后端
  6238. for (
  6239. var j = 0;
  6240. j < primarydata.argumentsartifacts[i].filelist.length;
  6241. j++
  6242. ) {
  6243. curfilelist.push(
  6244. primarydata.argumentsartifacts[i].filelist[j].raw
  6245. );
  6246. // filedata.append("file",primarydata.argumentsartifacts[i].filelist[j].raw);
  6247. }
  6248. primarydata.argumentsartifacts[i].filelist = curfilelist;
  6249. // filedata.append("file"+primarydata.argumentsartifacts[i].paraname,primarydata.argumentsartifacts[i].filelist[0].raw);//每个参数仅可输入一个文件
  6250. filedata.append(
  6251. primarydata.argumentsartifacts[i].paraname,
  6252. curfilelist[0]
  6253. ); //每个参数仅可输入一个文件
  6254. // console.log(filedata.get(primarydata.argumentsartifacts[i].paraname));
  6255. }
  6256. }
  6257. }
  6258. if (filedata != null) {
  6259. var jsonfileurl = {};
  6260. this.$http({
  6261. url: this.$http.adornUrl("/visi/visiworkflow/savefile"),
  6262. method: "post",
  6263. data: filedata,
  6264. }).then(({ data }) => {
  6265. if (data && data.code === 0) {
  6266. jsonfileurl = data.jsonfileurl;
  6267. for (var i = 0; i < primarydata.argumentsartifacts.length; i++) {
  6268. if (
  6269. jsonfileurl.hasOwnProperty(
  6270. primarydata.argumentsartifacts[i].paraname
  6271. )
  6272. ) {
  6273. // console.log(
  6274. // jsonfileurl[primarydata.argumentsartifacts[i].paraname]
  6275. // );
  6276. primarydata.argumentsartifacts[i].fileurls.push(
  6277. jsonfileurl[primarydata.argumentsartifacts[i].paraname]
  6278. );
  6279. this.graph.getCellById(args[1].id).setData(primarydata); //终于好了 20211130
  6280. }
  6281. }
  6282. // console.log(data.jsonfileurl)
  6283. // fileurls = data.fileurls;
  6284. // curfileurl.push(data.fileurls);
  6285. /////设置的都是 i,为什么无论怎样都会赋值给 0
  6286. // primarydata.argumentsartifacts[i].fileurls=data.fileurls;
  6287. // console.log("i")
  6288. // this.graph.getCellById(args[1].id).setData(primarydata); //成功成功
  6289. // this.$message({
  6290. // message: "操作成功",
  6291. // type: "success",
  6292. // duration: 1500,
  6293. // onClose: () => {
  6294. // // this.getDataList();
  6295. // },
  6296. // });
  6297. } else {
  6298. Message.error(data.msg);
  6299. // this.$message.error(data.msg);
  6300. }
  6301. });
  6302. }
  6303. // this.graph.getCellById(args[1].id).setData(primarydata); //对应input 保存相应输入的值
  6304. this.graph
  6305. .getCellById(args[1].id)
  6306. .setData({ argumentsparameters: primarydata.argumentsparameters }); //对应input 保存相应输入的值
  6307. this.graph
  6308. .getCellById(args[1].id)
  6309. .setData({ argumentsartifacts: primarydata.argumentsartifacts }); //对应input 保存相应输入的值
  6310. // console.log("当前节点值");
  6311. // console.log(this.graph.getCellById(args[1].id).getData());
  6312. // console.log(
  6313. // this.graph.getCellById(args[1].id).getData().argumentsartifacts
  6314. // );
  6315. this.graph
  6316. .getCellById(args[1].id)
  6317. .setData({ nodeName: primarydata.nodeName }); //对应input 保存相应输入的值
  6318. // console.log("cell:" + args[1].id);
  6319. // console.log("对应id的node:" + this.graph.getCellById(args[1]).toString());
  6320. // console.log(this.graph.getCellById(args[1].id));
  6321. //20211119
  6322. this.graph
  6323. .getCellById(args[1].id)
  6324. .setData({ algoparaInput: primarydata.algoparaInput }); //对应input 保存相应输入的值
  6325. this.graph
  6326. .getCellById(args[1].id)
  6327. .setData({ algonodeSource: primarydata.algonodeSource });
  6328. // console.log("primary-------------");
  6329. // console.log(this.graph.getCellById(args[1].id).getData().algoparaInput);
  6330. // console.log(this.graph.getCellById(args[1].id).getData().algoparaOutput);
  6331. // 遍历algoparaInput中algoparaGetInput中的数据,添加文件地址,后保存到映射关系数据库中
  6332. const curalgoparaInput = primarydata.algoparaInput;
  6333. for (var i = 0; i < curalgoparaInput.getInput.length; i++) {
  6334. for (var j = 0; j < primarydata.algonodeSource.length; j++) {
  6335. if (curalgoparaInput.getInput[i].paravalue != null) {
  6336. if (
  6337. curalgoparaInput.getInput[i].paravalue[0] ==
  6338. primarydata.algonodeSource[j].getData().nodeName
  6339. ) {
  6340. curalgoparaInput.getInput[i].paravalue.push(
  6341. primarydata.algonodeSource[j].getData().algoparaOutAddress
  6342. );
  6343. }
  6344. }
  6345. }
  6346. }
  6347. //202111123 保存在 节点数据中 将curalgoparaInput 保存为 algoparaInput
  6348. // console.log("this.graph.getCellById(args[1].id).getData().algoparaInput");
  6349. this.graph
  6350. .getCellById(args[1].id)
  6351. .setData({ algoparaInput: curalgoparaInput }); //对应input 保存相应输入的值
  6352. // console.log(this.graph.getCellById(args[1].id).getData().algoparaInput);
  6353. // console.log(
  6354. // "遍历algoparaInput中algoparaGetInput中的数据,添加文件地址,后保存到映射关系数据库中"
  6355. // );
  6356. // console.log(curalgoparaInput);
  6357. // 20211123 该部分代码每次保存都会在数据库中添加新的记录
  6358. // this.$http({
  6359. // url: this.$http.adornUrl("/sys/visiworkflowparamap/save"),
  6360. // method: "post",
  6361. // data: this.$http.adornData({
  6362. // paramapId: undefined,
  6363. // userId: this.$store.state.user.id,
  6364. // workflowId: "",
  6365. // inputparaNodename: this.graph.getCellById(args[1].id).getData()
  6366. // .nodeName,
  6367. // inputparaJson: JSON.stringify(curalgoparaInput),
  6368. // }),
  6369. // }).then(({ data }) => {
  6370. // if (data && data.code === 0) {
  6371. // this.$message({
  6372. // message: "操作成功",
  6373. // type: "success",
  6374. // duration: 1500,
  6375. // onClose: () => {
  6376. // this.visible = false;
  6377. // // this.$emit('refreshDataList')
  6378. // },
  6379. // });
  6380. // } else {
  6381. // this.$message.error(data.msg);
  6382. // }
  6383. // });
  6384. },
  6385. primaryCSVselectNodeconfig(args){
  6386. var primarydata = args[1].getData();
  6387. this.graph.getCellById(args[1].id).setData(primarydata);
  6388. // console.log("转换节点新数据")
  6389. // console.log(args[1].getData())
  6390. // console.log(this.graph.getCellById(args[1].id).getData())
  6391. },
  6392. //20210812 左侧树形组件
  6393. handleDragStart(node, ev) {
  6394. console.log("drag start", node);
  6395. },
  6396. handleDragEnter(draggingNode, dropNode, ev) {
  6397. console.log("tree drag enter: ", dropNode.label);
  6398. },
  6399. handleDragLeave(draggingNode, dropNode, ev) {
  6400. console.log("tree drag leave: ", dropNode.label);
  6401. },
  6402. handleDragOver(draggingNode, dropNode, ev) {
  6403. console.log("tree drag over: ", dropNode.label);
  6404. },
  6405. handleDragEnd(draggingNode, dropNode, dropType, ev) {
  6406. console.log("tree drag end: ", dropNode && dropNode.label, dropType);
  6407. },
  6408. handleDrop(draggingNode, dropNode, dropType, ev) {
  6409. console.log("tree drop: ", dropNode.label, dropType);
  6410. },
  6411. allowDrop(draggingNode, dropNode, type) {
  6412. if (dropNode.data.label === "二级 3-1") {
  6413. return type !== "inner";
  6414. } else {
  6415. return true;
  6416. }
  6417. },
  6418. allowDrag(draggingNode) {
  6419. return draggingNode.data.label.indexOf("三级 3-2-2") === -1;
  6420. },
  6421. //20210813
  6422. onSelect(selectedKeys, info) {
  6423. console.log("selected", selectedKeys, info);
  6424. },
  6425. //20210813 dnd
  6426. startDrag(e) {
  6427. // console.log("拖拽前");
  6428. // const target = this.currentTarget
  6429. const target = e.currentTarget;
  6430. const type = target.getAttribute("data-type");
  6431. const node = this.graph.createNode({
  6432. width: 100,
  6433. height: 40,
  6434. attrs: {
  6435. label: {
  6436. text: "circle",
  6437. fill: "#6a6c8a",
  6438. },
  6439. body: {
  6440. stroke: "#31d0c6",
  6441. strokeWidth: 2,
  6442. },
  6443. },
  6444. });
  6445. // console.log("拖拽");
  6446. this.dnd.start(node, e);
  6447. //删除.nativeEvent 前会出错
  6448. // this.dnd.start(node, e.nativeEvent);
  6449. },
  6450. //20210926 树形组件
  6451. onSelect(selectedKeys, info) {
  6452. // console.log("selected", selectedKeys, info);
  6453. // console.log(selectedKeys);
  6454. // console.log(info);
  6455. const zdocker_test = this.graph.createNode({
  6456. // width: 170,
  6457. // height: 30,
  6458. shape: "template-node",
  6459. // label: "consume_artifact",
  6460. attrs: {
  6461. label: {
  6462. text: "zdockertest",
  6463. },
  6464. body: {
  6465. // stroke: "#2CB9FF",
  6466. // fill: "#2CB9FF",
  6467. fill: "#d3ebf3",
  6468. },
  6469. // body: {
  6470. // stroke: "#DA2625",
  6471. // fill: "#DA2625",
  6472. // },
  6473. image: {
  6474. "xlink:href":
  6475. "https://gw.alipayobjects.com/zos/bmw-prod/6eb71764-18ed-4149-b868-53ad1542c405.svg",
  6476. // "xlink:href": "https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg",
  6477. //可放图标
  6478. },
  6479. },
  6480. data: {
  6481. nodeName: "zdockertest",
  6482. templateName: "print-message",
  6483. templateImage: "zvinjodocker/zdockertest1:20211011",
  6484. templateCommand: {
  6485. // 1: "sh",
  6486. // 2: "-c",
  6487. // 2:"\"{{inputs.parameters.message}}\""
  6488. },
  6489. //不确定命令暂时用哪种方式 如果添加属性的话哪一种好添加 ; 考虑动态添加属性和值,此处key为何值都行,主要是value较为重要
  6490. // templateCommand2: [
  6491. // {
  6492. // 1:"echo"
  6493. // },
  6494. // {
  6495. // 2:"{{inputs.parameters.message}}"
  6496. // },
  6497. // ],
  6498. templateArgs: {
  6499. // 1: "cat /tmp/message",
  6500. },
  6501. inputsparameters: [],
  6502. inputsartifacts: [
  6503. //此container 需要输入的参数,固定
  6504. // {
  6505. // name: "message",
  6506. // path: "/tmp/message",
  6507. // },
  6508. ],
  6509. //20210916 argument(parameters以及arguments)均 应是在调用的过程中填写具体值
  6510. //应对应input中的各项参数设置对应参数
  6511. argumentsparameters: [],
  6512. argumentsartifacts: [
  6513. //调用container(该template)输入的参数,后续会变(根据输入弹窗变)
  6514. // {
  6515. // name: "message",
  6516. // valuefrom: "{{tasks.whalesay.outputs.artifacts.hello-art}}",
  6517. // },
  6518. ],
  6519. outputsparameters: [],
  6520. outputsartifacts: [],
  6521. //获取到的连接线源的数据 连接线的源的输出数据
  6522. sourcedatalist: [
  6523. // {
  6524. // name: "source1",
  6525. // },
  6526. // {
  6527. // name: "source2",
  6528. // },
  6529. ],
  6530. inputnodefilemap: [], //引用输入节点的 文件列表,包含文件名和url
  6531. inputnodefilevalue: [], //用户选择的输入节点的文件,存储文件url,后端调用
  6532. },
  6533. });
  6534. //20211012
  6535. // 将树形节点的键与 节点名称对应起来。
  6536. // this.graph.addNode(zdocker_test);
  6537. // this.nodedata.addNode(consume_artifact);
  6538. // this.nodedata.appendChild(consume_artifact);
  6539. // this.nodedata.push(consume_artifact);
  6540. // console.log("nodedata");
  6541. // console.log(this.nodedata);
  6542. // console.log(this.nodedata[0])
  6543. //通过遍历节点列表nodedata中键 selectedKeys与节点中attrs.label.text相匹配,生成对应的节点
  6544. //先将所有的节点创建成功后保存在this.nodedata中,点击对应节点后 匹配正确后将节点加入到画布中
  6545. // console.log(this.nodedata[0].attrs.label.text)
  6546. // this.graph.addNode(this.nodedata[0])
  6547. // console.log(this.nodedata);
  6548. var nodenamenum = Math.floor(Math.random() * 1000); //1000以内随机整数
  6549. for (var i = 0; i < this.nodedata.length; i++) {
  6550. //遍历数组
  6551. if (selectedKeys.toString() === this.nodedata[i].attrs.label.text) {
  6552. // console.log(selectedKeys.toString());
  6553. var clonenode = this.nodedata[i].clone();
  6554. // clonenode.getElementById
  6555. //更改nodeName 及templateName 后添加随机数
  6556. clonenode.setData({
  6557. nodeName: clonenode.getData().nodeName + nodenamenum,
  6558. });
  6559. clonenode.setData({
  6560. templateName: clonenode.getData().templateName + nodenamenum,
  6561. });
  6562. this.graph.addNode(clonenode);
  6563. // this.graph.addNode(this.nodedata[i].clone());
  6564. } else {
  6565. // console.log(selectedKeys.toString());
  6566. }
  6567. // console.log(i);
  6568. }
  6569. },
  6570. onCheck(checkedKeys, info) {
  6571. console.log("onCheck", checkedKeys, info);
  6572. },
  6573. //设置布局可拖动改变大小
  6574. dragControllerDiv: function () {
  6575. // var resize = document.getElementsByClassName("resize");
  6576. // var left = document.getElementsByClassName("left");
  6577. // var mid = document.getElementsByClassName("right");
  6578. // var box = document.getElementsByClassName("box");
  6579. // for (let i = 0; i < resize.length; i++) {
  6580. // // 鼠标按下事件
  6581. // resize[i].onmousedown = function (e) {
  6582. // //颜色改变提醒
  6583. // resize[i].style.background = "#818181";
  6584. // var startX = e.clientX;
  6585. // console.log("拖动改变两侧大小")
  6586. // console.log("startx");
  6587. // console.log(startX);
  6588. // // 鼠标拖动事件
  6589. // document.onmousemove = function (e) {
  6590. // resize[i].left = startX;
  6591. // var endX = e.clientX;
  6592. // var moveLen = resize[i].left + (endX - startX); // (endx-startx)=移动的距离。resize[i].left+移动的距离=左边区域最后的宽度
  6593. // console.log("movelen");
  6594. // console.log(moveLen);
  6595. // var maxT = box[i].clientWidth - resize[i].offsetWidth; // 容器宽度 - 左边区域的宽度 = 右边区域的宽度
  6596. // console.log("maxt ");
  6597. // console.log(maxT);
  6598. // if (moveLen < 800) moveLen = 800; // 左边区域的最小宽度为32px
  6599. // if (moveLen > maxT - 150) moveLen = maxT - 150; //右边区域最小宽度为150px
  6600. // resize[i].style.left = moveLen; // 设置左侧区域的宽度
  6601. // for (let j = 0; j < left.length; j++) {
  6602. // left[j].style.width =(moveLen / document.body.clientWidth) * 100 + "%";
  6603. // mid[j].style.width = ((box[i].clientWidth - moveLen) / document.body.clientWidth -0.008) *100 +"%";
  6604. // }
  6605. // };
  6606. // // 鼠标松开事件
  6607. // document.onmouseup = function (evt) {
  6608. // //颜色恢复
  6609. // resize[i].style.background = "#d6d6d6";
  6610. // document.onmousemove = null;
  6611. // document.onmouseup = null;
  6612. // resize[i].releaseCapture && resize[i].releaseCapture(); //当你不在需要继续获得鼠标消息就要应该调用ReleaseCapture()释放掉
  6613. // };
  6614. // resize[i].setCapture && resize[i].setCapture(); //该函数在属于当前线程的指定窗口里设置鼠标捕获
  6615. // return false;
  6616. // };
  6617. // }
  6618. var resize = document.getElementsByClassName("resize");
  6619. var left = document.getElementsByClassName("left");
  6620. var mid = document.getElementsByClassName("right");
  6621. var box = document.getElementsByClassName("box");
  6622. for (let i = 0; i < resize.length; i++) {
  6623. // 鼠标按下事件
  6624. resize[i].onmousedown = function (e) {
  6625. //颜色改变提醒
  6626. resize[i].style.background = "#818181";
  6627. var startX = e.clientX;
  6628. resize[i].left = resize[i].offsetLeft;
  6629. // 鼠标拖动事件
  6630. document.onmousemove = function (e) {
  6631. var endX = e.clientX;
  6632. var moveLen = resize[i].left + (endX - startX); // (endx-startx)=移动的距离。resize[i].left+移动的距离=左边区域最后的宽度
  6633. var maxT = box[i].clientWidth - resize[i].offsetWidth; // 容器宽度 - 左边区域的宽度 = 右边区域的宽度
  6634. if (moveLen < 800) moveLen = 800; // 左边区域的最小宽度为32px
  6635. if (moveLen > maxT - 300) moveLen = maxT - 300; //右边区域最小宽度为150px
  6636. resize[i].style.left = moveLen; // 设置左侧区域的宽度
  6637. for (let j = 0; j < left.length; j++) {
  6638. left[j].style.width = moveLen + "px";
  6639. mid[j].style.width = box[i].clientWidth - moveLen - 10 + "px";
  6640. }
  6641. };
  6642. // 鼠标松开事件
  6643. document.onmouseup = function (evt) {
  6644. //颜色恢复
  6645. resize[i].style.background = "#d6d6d6";
  6646. document.onmousemove = null;
  6647. document.onmouseup = null;
  6648. resize[i].releaseCapture && resize[i].releaseCapture(); //当你不在需要继续获得鼠标消息就要应该调用ReleaseCapture()释放掉
  6649. };
  6650. resize[i].setCapture && resize[i].setCapture(); //该函数在属于当前线程的指定窗口里设置鼠标捕获
  6651. return false;
  6652. };
  6653. }
  6654. },
  6655. //保存输入节点内容
  6656. primaryInputnodeConfig(args) {
  6657. // console.log("保存输入节点");
  6658. // console.log(args[0].id);
  6659. // // this.$emit("refreshDataList",this.cell,this.st_dataListvalue,this.dy_dataListvalue,this.fileList,this.allfilemap);//各个参数
  6660. // this.graph.getCellById(args[0].id).setData({ st_dataListvalue: args[1] });
  6661. // this.graph.getCellById(args[0].id).setData({ dy_dataListvalue: args[2] });
  6662. // this.graph.getCellById(args[0].id).setData({ fileList: args[3] });
  6663. // this.graph.getCellById(args[0].id).setData({ allfilemap: args[4] });
  6664. // this.$emit("refreshinputnode",this.cell,celldata);
  6665. // console.log(args[1].allfilemap);
  6666. // this.graph.getCellById(args[0].id).setData(args[1]);
  6667. //以该方式 福赋值字符串型可以,数组类型不可以
  6668. // this.graph.getCellById(args[0].id).setData({allfilemap: this.graph.getCellById(args[0].id).getData().allfilemap.concat(args[1].allfilemap)})
  6669. this.graph.getCellById(args[0].id).replaceData(args[1]); /////成功成功
  6670. console.log(this.graph.getCellById(args[0]));
  6671. },
  6672. },
  6673. computed: {
  6674. formItemLayout() {
  6675. const { formLayout } = this;
  6676. return formLayout === "horizontal"
  6677. ? {
  6678. labelCol: { span: 4 },
  6679. wrapperCol: { span: 14 },
  6680. }
  6681. : {};
  6682. },
  6683. buttonItemLayout() {
  6684. const { formLayout } = this;
  6685. return formLayout === "horizontal"
  6686. ? {
  6687. wrapperCol: { span: 14, offset: 4 },
  6688. }
  6689. : {};
  6690. },
  6691. },
  6692. };
  6693. </script>
  6694. <style lang="scss">
  6695. // 20210715 zhang 添加 布局
  6696. #components-layout-demo-responsive .logo {
  6697. height: 32px;
  6698. // background: rgba(255, 255, 255, 0.959);
  6699. margin: 16px;
  6700. display: block;
  6701. background: #dcdfe6;
  6702. }
  6703. .dividesign {
  6704. height: 32px;
  6705. // background: rgba(255, 255, 255, 0.959);
  6706. margin: 16px;
  6707. display: block;
  6708. // background: #dcdfe6;
  6709. // display: block;
  6710. // height: 1px;
  6711. // width: 100%;
  6712. // margin: 24px 0;
  6713. background-color: #dcdfe6;
  6714. // position: relative;
  6715. }
  6716. // .app-stencil {
  6717. // width: 250px;
  6718. // height: 100%;
  6719. // border: 1px solid #f0f0f0;
  6720. // position: relative;
  6721. // }
  6722. .content {
  6723. font-family: sans-serif;
  6724. // display: flex;
  6725. width: 100%;
  6726. background: #dcdfe6;
  6727. }
  6728. // .app-stencil {
  6729. // width: 250px;
  6730. // border: 1px solid #f0f0f0;
  6731. // position: relative;
  6732. // }
  6733. .app-content {
  6734. // flex: 1;
  6735. // height: 520px;
  6736. height: 100%;
  6737. width: 100%;
  6738. margin-left: 8px;
  6739. margin-right: 8px;
  6740. box-shadow: 0 0 10px 1px #e9e9e9;
  6741. // background: #dcdfe6;
  6742. }
  6743. .divi {
  6744. margin: 1px 0;
  6745. }
  6746. .x6-node [magnet="true"] {
  6747. cursor: crosshair;
  6748. transition: none;
  6749. }
  6750. .x6-node [magnet="true"]:hover {
  6751. opacity: 1;
  6752. }
  6753. .x6-node [magnet="true"][port-group="in"] {
  6754. cursor: move;
  6755. }
  6756. .my-port {
  6757. width: 100%;
  6758. height: 100%;
  6759. border: 1px solid #808080;
  6760. border-radius: 100%;
  6761. background: #eee;
  6762. }
  6763. .my-port.connected {
  6764. width: 0;
  6765. height: 0;
  6766. margin-top: 5px;
  6767. margin-left: 1px;
  6768. border-width: 5px 4px 0;
  6769. border-style: solid;
  6770. border-color: #808080 transparent transparent;
  6771. border-radius: 0;
  6772. background-color: transparent;
  6773. }
  6774. .x6-port-body.available {
  6775. overflow: visible;
  6776. }
  6777. .x6-port-body.available body {
  6778. overflow: visible;
  6779. }
  6780. .x6-port-body.available body > div::before {
  6781. content: " ";
  6782. float: left;
  6783. width: 20px;
  6784. height: 20px;
  6785. margin-top: -5px;
  6786. margin-left: -5px;
  6787. border-radius: 50%;
  6788. background-color: rgba(57, 202, 116, 0.6);
  6789. box-sizing: border-box;
  6790. }
  6791. .x6-port-body.available body > div::after {
  6792. content: " ";
  6793. float: left;
  6794. clear: both;
  6795. width: 10px;
  6796. height: 10px;
  6797. margin-top: -15px;
  6798. border-radius: 50%;
  6799. background-color: #fff;
  6800. border: 1px solid #39ca74;
  6801. position: relative;
  6802. z-index: 10;
  6803. box-sizing: border-box;
  6804. }
  6805. .x6-port-body.adsorbed {
  6806. overflow: visible;
  6807. }
  6808. .x6-port-body.adsorbed body {
  6809. overflow: visible;
  6810. }
  6811. .x6-port-body.adsorbed body > div::before {
  6812. content: " ";
  6813. float: left;
  6814. width: 28px;
  6815. height: 28px;
  6816. margin-top: -9px;
  6817. margin-left: -9px;
  6818. border-radius: 50%;
  6819. background-color: rgba(57, 202, 116, 0.6);
  6820. box-sizing: border-box;
  6821. }
  6822. .x6-port-body.adsorbed body > div::after {
  6823. content: " ";
  6824. float: left;
  6825. clear: both;
  6826. width: 10px;
  6827. height: 10px;
  6828. margin-top: -19px;
  6829. border-radius: 50%;
  6830. background-color: #fff;
  6831. border: 1px solid #39ca74;
  6832. position: relative;
  6833. z-index: 10;
  6834. box-sizing: border-box;
  6835. }
  6836. //20210805 design-panel
  6837. .form {
  6838. height: calc(100vh - 100px);
  6839. flex-grow: 1;
  6840. overflow-x: hidden;
  6841. overflow-y: auto;
  6842. background: #fff;
  6843. }
  6844. .ant-tabs-tabpane {
  6845. background: #fff;
  6846. padding: 5px;
  6847. }
  6848. //20210812 zhang 左侧树形组件栏
  6849. .leftDivTree {
  6850. width: 100%;
  6851. height: 93.7%;
  6852. // padding: 10 0px;
  6853. // border:0.2px solid #000;
  6854. // overflow: scroll;
  6855. }
  6856. .leftDivTree ::v-deep .iconfont {
  6857. margin-right: 8px;
  6858. }
  6859. .leftDivTree ::v-deep .el-tree-node {
  6860. display: table;
  6861. min-width: 100%;
  6862. }
  6863. // .leftDivTitle {
  6864. // color: #fff;
  6865. // border-color: #409eff;
  6866. // font-size: 14px;
  6867. // }
  6868. //20210813 左侧组件
  6869. .dnd-rect {
  6870. width: 80px;
  6871. height: 20px;
  6872. border: 2px solid #31d0c6;
  6873. text-align: center;
  6874. line-height: 40px;
  6875. margin: 16px;
  6876. cursor: move;
  6877. }
  6878. //设置布局 可拖动改变大小
  6879. .left {
  6880. width: 69.2%;
  6881. // width: 100%;
  6882. height: 100%;
  6883. overflow-y: auto;
  6884. overflow-x: hidden;
  6885. float: left;
  6886. display: flex;
  6887. }
  6888. .resize {
  6889. cursor: col-resize;
  6890. float: left;
  6891. position: relative;
  6892. top: 10%;
  6893. background-color: #d6d6d6;
  6894. border-radius: 5px;
  6895. margin-top: -10px;
  6896. width: 10px;
  6897. // height: 50px;
  6898. height: 70%;
  6899. line-height: 50px;
  6900. // line-height: 100%;
  6901. // text-align: center;
  6902. background-size: cover;
  6903. background-position: center;
  6904. font-size: 32px;
  6905. color: white;
  6906. }
  6907. /*拖拽区鼠标悬停样式*/
  6908. .resize:hover {
  6909. color: #444444;
  6910. }
  6911. .right {
  6912. // height: 7.8rem;
  6913. height: 100%;
  6914. float: left;
  6915. width: 30%;
  6916. display: flex;
  6917. }
  6918. .box {
  6919. width: 100%;
  6920. // height: 7.8rem;
  6921. height: 100%;
  6922. }
  6923. .boxform {
  6924. width: 100%;
  6925. height: 100%;
  6926. flex: 1;
  6927. background-color: #fff;
  6928. }
  6929. .boxformitem {
  6930. border-style: solid;
  6931. border-width: 1px;
  6932. border-color: #dcdfe6;
  6933. }
  6934. // .el-icon-video-play:before {
  6935. // content: "提交";
  6936. // }
  6937. .mod-demo-echarts {
  6938. > .el-alert {
  6939. margin-bottom: 10px;
  6940. }
  6941. > .el-row {
  6942. margin-top: -10px;
  6943. margin-bottom: -10px;
  6944. .el-col {
  6945. padding-top: 10px;
  6946. padding-bottom: 10px;
  6947. }
  6948. }
  6949. .chart-box {
  6950. min-height: 400px;
  6951. }
  6952. }
  6953. .divi {
  6954. display: block;
  6955. height: 1px;
  6956. width: 100%;
  6957. margin: 24px 0;
  6958. background-color: #dcdfe6;
  6959. position: relative;
  6960. }
  6961. .divi2 {
  6962. display: block;
  6963. height: 1px;
  6964. width: 100%;
  6965. position: relative;
  6966. }
  6967. .x6-graph-scroller {
  6968. min-height: 800px;
  6969. }
  6970. </style>