tree.vue 181 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159
  1. <template>
  2. <div style="height: 100%">
  3. <basic-container v-show="showType == 1">
  4. <el-row class="titlerow">
  5. <el-col>
  6. <div style="position: relative">
  7. <span style="float: left; margin-top: 15px; color: white">{{
  8. projectName
  9. }}</span>
  10. <el-button
  11. size="medium"
  12. icon="el-icon-help"
  13. style="margin-right: 10px"
  14. @click="fileTitleHandle"
  15. >文件题名(全局)
  16. </el-button>
  17. <el-dropdown style="margin-right: 10px" @command ="handleBasicClick" v-if="wbsType == 2">
  18. <el-button size="medium">
  19. 基础数据管理<i class="el-icon-arrow-down el-icon--right"></i>
  20. </el-button>
  21. <el-dropdown-menu slot="dropdown">
  22. <el-dropdown-item command="code">编号管理</el-dropdown-item>
  23. <el-dropdown-item command="rule">规范参数配置</el-dropdown-item>
  24. </el-dropdown-menu>
  25. </el-dropdown>
  26. <!-- 同步按钮 -->
  27. <el-button
  28. size="medium"
  29. style="margin-right: 10px"
  30. @click="proSyncbtn"
  31. >项目数据同步
  32. </el-button>
  33. <el-button
  34. size="medium"
  35. icon="el-icon-s-grid"
  36. @click="eleFormulaHandle"
  37. v-if="leftType == 5"
  38. >表单设置
  39. </el-button>
  40. <el-button
  41. size="medium"
  42. icon="el-icon-s-grid"
  43. @click="eleHandle"
  44. v-else
  45. >元素设置
  46. </el-button>
  47. <el-button size="medium" icon="el-icon-help" @click="nodeInfoHandle"
  48. >节点参数设置
  49. </el-button>
  50. <el-button
  51. style="margin-top: 10px"
  52. size="medium"
  53. icon="el-icon-price-tag"
  54. @click="independent"
  55. >独立表单库
  56. </el-button>
  57. <el-button
  58. style="margin-top: 10px"
  59. size="medium"
  60. icon="el-icon-time"
  61. @click="archiveTimeClick"
  62. >归档文件时间设置
  63. </el-button>
  64. </div>
  65. </el-col>
  66. </el-row>
  67. <el-row :gutter="20" class="h-100p" style="padding: 10px">
  68. <el-col :span="8" style="height: 85%">
  69. <div class="h-100p flex flex-d-c">
  70. <p style="margin-top: 2px">
  71. 工程节点信息
  72. <el-button
  73. v-if="isNodeType"
  74. style="margin-right: 10px"
  75. size="medium"
  76. icon="el-icon-set-up"
  77. @click="changeType(false)"
  78. type="primary"
  79. >切换表单
  80. </el-button>
  81. <el-button
  82. v-else
  83. style="margin-right: 10px"
  84. size="medium"
  85. icon="el-icon-set-up"
  86. @click="changeType(true)"
  87. type="warning"
  88. >切换节点
  89. </el-button>
  90. </p>
  91. <div
  92. class="flex"
  93. style="align-items: center; justify-content: space-between"
  94. >
  95. <div v-if="isNodeType">
  96. <div>
  97. <el-radio v-model="searchType" label="1">节点</el-radio>
  98. </div>
  99. <div>
  100. <el-radio v-model="searchType" label="2">表名</el-radio>
  101. </div>
  102. </div>
  103. <el-input
  104. v-if="isNodeType"
  105. placeholder="输入关键字进行过滤"
  106. v-model="filterText"
  107. clearable
  108. style="width: 65%; margin-right: 15px"
  109. @clear="clearSearch"
  110. ></el-input>
  111. <el-button type="primary" @click="searchTreeClick" v-if="isNodeType"
  112. >搜索</el-button
  113. >
  114. <el-input
  115. v-if="!isNodeType"
  116. placeholder="输入关键字进行过滤"
  117. v-model="filterText1"
  118. clearable
  119. style="width: 65%; margin-right: 15px"
  120. @clear="clearSearch1"
  121. ></el-input>
  122. <el-button type="primary" @click="searchTreeClick1" v-if="!isNodeType"
  123. >搜索</el-button
  124. >
  125. <el-tooltip content="查询工序节点无内业资料类型" placement="top">
  126. <el-button type="success" @click="filterSearchClick" v-if="isNodeType">过滤</el-button>
  127. </el-tooltip>
  128. </div>
  129. <div class="flex1 ov-hidden" v-if=isNodeType>
  130. <el-scrollbar class="h-100p" v-if="isShowTree">
  131. <div v-loading="treeLoad">
  132. <el-tree
  133. class="filter-tree"
  134. lazy
  135. :load="loadNode"
  136. @node-click="getNodeDetail"
  137. :props="defaultProps"
  138. :expand-on-click-node="false"
  139. highlight-current
  140. node-key="id"
  141. ref="tree"
  142. :default-expanded-keys="defaultExpandedKeys"
  143. v-show="!isSearch"
  144. >
  145. <span
  146. class="custom-tree-node"
  147. :class="data.moreShow ? 'show' : ''"
  148. slot-scope="{ node, data }"
  149. @mouseleave="mouseout(data)"
  150. >
  151. <div class="pd-r-20">
  152. {{ node.label }}
  153. <div class="normal-black">
  154. <div>
  155. <el-link :underline="false">
  156. <i
  157. class="el-icon-menu"
  158. @click.stop="showMenu($event, data, node)"
  159. v-if="node.level != 1"
  160. ></i>
  161. </el-link>
  162. <!-- 因右键自定义菜单事件需要获取当前点击的位置,所以此处绑定动态样式来控制菜单实时跟踪鼠标右键点击位置 -->
  163. <ul
  164. v-show="menuvisible"
  165. :style="{
  166. left: menuleft + 'px',
  167. top: menutop + 'px',
  168. }"
  169. class="contextmenu"
  170. >
  171. <li
  172. v-for="item in menusData"
  173. :key="item"
  174. @click="menuClick($event, item, data,node)"
  175. >
  176. <i :class="item.icon"></i>
  177. <el-tooltip
  178. class="item"
  179. effect="light"
  180. :content="item.content"
  181. placement="right-start"
  182. >
  183. <span>{{ item.label }}</span>
  184. </el-tooltip>
  185. </li>
  186. </ul>
  187. </div>
  188. </div>
  189. </div>
  190. </span>
  191. </el-tree>
  192. <el-tree
  193. :load="searchtreeLoad"
  194. :data="searchTreeData"
  195. @node-click="getNodeDetail"
  196. :props="defaultProps"
  197. :expand-on-click-node="false"
  198. highlight-current
  199. node-key="id"
  200. v-show="isSearch"
  201. default-expand-all
  202. >
  203. <span
  204. class="custom-tree-node"
  205. :class="data.moreShow ? 'show' : ''"
  206. slot-scope="{ node, data }"
  207. @mouseleave="mouseout(data)"
  208. >
  209. <div class="pd-r-20">
  210. {{ node.label }}
  211. <div class="normal-black">
  212. <div>
  213. <el-link :underline="false">
  214. <i
  215. class="el-icon-menu"
  216. @click="showMenu($event, data, node)"
  217. v-if="node.level != 1"
  218. ></i>
  219. </el-link>
  220. <ul
  221. v-show="menuvisible"
  222. :style="{
  223. left: menuleft + 'px',
  224. top: menutop + 'px',
  225. }"
  226. class="contextmenu"
  227. >
  228. <li
  229. v-for="item in menusData"
  230. :key="item"
  231. @click="menuClick($event, item, data,node)"
  232. >
  233. <i :class="item.icon"></i>{{ item.label }}
  234. </li>
  235. </ul>
  236. </div>
  237. </div>
  238. </div>
  239. </span>
  240. </el-tree>
  241. </div>
  242. </el-scrollbar>
  243. </div>
  244. <div v-else class="flex1 ov-hidden">
  245. <el-scrollbar class="h-100p" >
  246. <el-tree
  247. :default-expanded-keys="defaultExpandedKeysType"
  248. ref="treeByType"
  249. class="filter-tree"
  250. lazy
  251. :load="loadNodeByType"
  252. :props="defaultPropsByType"
  253. :expand-on-click-node="false"
  254. highlight-current
  255. node-key="id"
  256. @node-click="getNodeDetailByType"
  257. @node-expand="handleNodeExpand"
  258. @node-collapse="handleNodeCollapse"
  259. >
  260. <span class="custom-tree-node" slot-scope="{ node, data }">
  261. <div class="pd-r-20">
  262. {{ node.label }}
  263. </div>
  264. </span>
  265. </el-tree>
  266. </el-scrollbar>
  267. </div>
  268. </div>
  269. </el-col>
  270. <el-col :span="16" class="h-100p flex flex-d-c">
  271. <template v-if="leftType == 5">
  272. <div class="mg-b-10" v-if='isNodeType'>节点信息</div>
  273. <div v-if="isNodeType">
  274. <el-table :data="tableData" border style="width: 100%">
  275. <el-table-column
  276. align="center"
  277. prop="nodeName"
  278. label="当前节点"
  279. ></el-table-column>
  280. <el-table-column
  281. align="center"
  282. prop="nodeType"
  283. :formatter="formatCat"
  284. label="节点类型"
  285. width="180"
  286. ></el-table-column>
  287. <el-table-column
  288. align="center"
  289. prop="parentName"
  290. label="上级节点"
  291. ></el-table-column>
  292. <el-table-column
  293. align="center"
  294. prop="primaryKeyId"
  295. label="primaryKeyId"
  296. ></el-table-column>
  297. <el-table-column
  298. align="center"
  299. prop="id"
  300. label="id"
  301. ></el-table-column>
  302. <el-table-column
  303. align="center"
  304. prop="majorDataType"
  305. :formatter="formMajorType"
  306. label="内业资料类型"
  307. ></el-table-column>
  308. </el-table>
  309. </div>
  310. <div class="flex jc-sb">
  311. <p>
  312. <span>当前项目信息表</span>
  313. <el-button
  314. type="text"
  315. style="margin-left: 10px"
  316. icon="el-icon-edit-outline"
  317. class="text-icon"
  318. @click="editEditElementForm()"
  319. ></el-button>
  320. <el-button
  321. v-if="isNodeType"
  322. type="text"
  323. icon="el-icon-sort"
  324. class="text-icon"
  325. @click="privateTableSort()"
  326. ></el-button>
  327. </p>
  328. <div class="mg-t-10"></div>
  329. </div>
  330. <div style="flex: 1; position: relative">
  331. <el-table
  332. :data="formData"
  333. border
  334. height="100%"
  335. style="width: 100%; position: absolute"
  336. >
  337. <el-table-column
  338. align="center"
  339. prop="tableName"
  340. label="表单名称"
  341. ></el-table-column>
  342. <el-table-column
  343. align="center"
  344. prop="elementTotal"
  345. width="80"
  346. label="字段总量"
  347. ></el-table-column>
  348. <el-table-column
  349. align="center"
  350. prop="fillRate"
  351. width="80"
  352. label="填报率"
  353. ></el-table-column>
  354. <el-table-column
  355. align="center"
  356. prop="tableType"
  357. :formatter="formatTableType"
  358. width="100"
  359. label="表单类型"
  360. ></el-table-column>
  361. <el-table-column width="150"
  362. align="center"
  363. prop="tableOwner"
  364. :formatter="formatOwner"
  365. label="所属方"
  366. ></el-table-column>
  367. <el-table-column label="操作" >
  368. <template slot-scope="scope">
  369. <el-button
  370. size="mini"
  371. @click="handlePreview(scope.$index, scope.row)"
  372. >预览
  373. </el-button>
  374. <el-button
  375. size="mini"
  376. @click="handleEdit(scope.$index, scope.row)"
  377. >编辑
  378. </el-button>
  379. <el-button
  380. size="mini"
  381. type="success"
  382. v-throttle="3000"
  383. v-show="scope.row.status == 0"
  384. @click="hideMD(scope.row)"
  385. >取消隐藏
  386. </el-button>
  387. <el-button
  388. size="mini"
  389. type="primary"
  390. v-throttle="3000"
  391. v-show="scope.row.status == 1"
  392. @click="hideMD(scope.row)"
  393. >隐藏表单
  394. </el-button>
  395. <el-button
  396. v-if="isNodeType"
  397. size="mini"
  398. type="danger"
  399. @click="handleDelete(scope.$index, scope.row)"
  400. >删除
  401. </el-button>
  402. </template>
  403. </el-table-column>
  404. </el-table>
  405. </div>
  406. </template>
  407. <template v-if="leftType == 4">
  408. <div style="flex: 1; position: relative">
  409. <el-table
  410. :data="formData"
  411. border
  412. height="100%"
  413. style="width: 100%; position: absolute"
  414. >
  415. <el-table-column
  416. align="center"
  417. prop="tableName"
  418. label="表单名称"
  419. ></el-table-column>
  420. <el-table-column
  421. align="center"
  422. prop="tableType"
  423. :formatter="formatTableType"
  424. label="表单类型"
  425. ></el-table-column>
  426. <el-table-column
  427. align="center"
  428. prop="fillRate"
  429. label="填报率"
  430. ></el-table-column>
  431. <el-table-column
  432. label="是否关联清表"
  433. prop="isLinkTable"
  434. align="center"
  435. >
  436. <template slot-scope="scope">
  437. <span v-if="scope.row.isLinkTable == 2">是</span>
  438. <span v-else>否</span>
  439. </template>
  440. </el-table-column>
  441. <el-table-column
  442. align="center"
  443. prop="tableOwner"
  444. :formatter="formatOwner"
  445. label="所属方"
  446. ></el-table-column>
  447. <el-table-column label="操作" width="520" align="center">
  448. <template slot-scope="scope">
  449. <el-link type="primary" @click="Associationlist(scope)"
  450. >关联清表
  451. </el-link>
  452. <el-link
  453. class="mg-l-10"
  454. type="primary"
  455. :disabled="
  456. scope.row.excelId == -1 || scope.row.excelId == null
  457. "
  458. @click="
  459. rightClick(
  460. scope.row.pkeyId,
  461. scope.row.excelId,
  462. scope.row.id,
  463. scope.row.initTableName,
  464. scope.row.initTableId
  465. )
  466. "
  467. >编辑元素
  468. </el-link>
  469. <el-link
  470. class="mg-l-10"
  471. type="primary"
  472. :disabled="
  473. scope.row.excelId == -1 || scope.row.excelId == null
  474. "
  475. @click="adjustExcel(scope.row.pkeyId, scope.row.excelId)"
  476. >调整表单
  477. </el-link>
  478. <el-link
  479. class="mg-l-10"
  480. type="primary"
  481. @click="handleEditFormula(scope.$index, scope.row)"
  482. v-if="isNodeType"
  483. >编辑元素公式
  484. </el-link>
  485. <el-dropdown @command="handleCommand($event,scope.row)" v-if="isNodeType">
  486. <el-button type="text" class="mg-l-10">
  487. 表单同步<i class="el-icon-arrow-down el-icon--right"></i>
  488. </el-button>
  489. <el-dropdown-menu slot="dropdown">
  490. <el-dropdown-item command="a">同步到项目下所有表单</el-dropdown-item>
  491. <el-dropdown-item command="b">同步其他表单配置</el-dropdown-item>
  492. </el-dropdown-menu>
  493. </el-dropdown>
  494. <el-button
  495. class="mg-l-10"
  496. type="text"
  497. :loading="handlesyncLoad"
  498. @click="handleLinkNodes(scope.$index, scope.row)"
  499. v-if="
  500. curTreeData.nodeType === 1000 ||
  501. curTreeData.nodeType === 1001
  502. "
  503. >关联节点
  504. </el-button>
  505. <el-link
  506. class="mg-l-10"
  507. type="danger"
  508. @click="handleDelete(scope.$index, scope.row)"
  509. v-if="isNodeType"
  510. >删除表单
  511. </el-link>
  512. </template>
  513. </el-table-column>
  514. </el-table>
  515. </div>
  516. </template>
  517. </el-col>
  518. </el-row>
  519. </basic-container>
  520. <el-row class="h-100p" v-show="showType == 2">
  521. <el-col :span="6" class="h-100p">
  522. <basic-container>
  523. <el-scrollbar class="h-100p">
  524. <el-tree
  525. class="filter-tree"
  526. lazy
  527. :data="typeTreeData"
  528. :load="typeTreeLoadNode"
  529. @node-click="getTypeTreeDetail"
  530. :props="defaultProps"
  531. :expand-on-click-node="false"
  532. highlight-current
  533. node-key="id"
  534. >
  535. </el-tree>
  536. </el-scrollbar>
  537. </basic-container>
  538. </el-col>
  539. <el-col :span="18" class="h-100p">
  540. <basic-container>
  541. <div class="flex h-100p flex-d-c">
  542. <div style="flex: 1; position: relative">
  543. <el-table
  544. :data="formData"
  545. border
  546. height="100%"
  547. style="width: 100%; position: absolute"
  548. >
  549. <el-table-column
  550. align="center"
  551. prop="tableName"
  552. label="表单名称"
  553. ></el-table-column>
  554. <el-table-column
  555. align="center"
  556. prop="tableType"
  557. :formatter="formatTableType"
  558. label="表单类型"
  559. ></el-table-column>
  560. <el-table-column
  561. align="center"
  562. prop="fillRate"
  563. label="填报率"
  564. ></el-table-column>
  565. <el-table-column
  566. label="是否关联清表"
  567. prop="isLinkTable"
  568. align="center"
  569. >
  570. <template slot-scope="scope">
  571. <span v-if="scope.row.isLinkTable == 2">是</span>
  572. <span v-else>否</span>
  573. </template>
  574. </el-table-column>
  575. <el-table-column
  576. align="center"
  577. prop="tableOwner"
  578. :formatter="formatOwner"
  579. label="所属方"
  580. ></el-table-column>
  581. <el-table-column label="操作" align="center">
  582. <template slot-scope="scope">
  583. <el-link type="primary" @click="Associationlist(scope)"
  584. >关联清表
  585. </el-link>
  586. <el-link
  587. class="mg-l-10"
  588. type="primary"
  589. :disabled="
  590. scope.row.excelId == -1 || scope.row.excelId == null
  591. "
  592. @click="
  593. rightClick(
  594. scope.row.pkeyId,
  595. scope.row.excelId,
  596. scope.row.id,
  597. scope.row.initTableName,
  598. scope.row.initTableId
  599. )
  600. "
  601. >编辑元素
  602. </el-link>
  603. <el-link
  604. class="mg-l-10"
  605. type="primary"
  606. :disabled="
  607. scope.row.excelId == -1 || scope.row.excelId == null
  608. "
  609. @click="adjustExcel(scope.row.pkeyId, scope.row.excelId)"
  610. >调整表单
  611. </el-link>
  612. <el-link
  613. class="mg-l-10"
  614. type="primary"
  615. @click="handleEditFormula(scope.$index, scope.row)"
  616. >编辑元素公式
  617. </el-link>
  618. <el-link
  619. class="mg-l-10"
  620. type="danger"
  621. @click="handleDelete(scope.$index, scope.row)"
  622. >删除表单
  623. </el-link>
  624. </template>
  625. </el-table-column>
  626. </el-table>
  627. </div>
  628. <div class="mg-t-10 flex jc-sb">
  629. <div></div>
  630. <el-button size="medium" @click="showType = 1"
  631. >返回WBS树
  632. </el-button>
  633. </div>
  634. </div>
  635. </basic-container>
  636. </el-col>
  637. </el-row>
  638. <!-- 编辑元素表单信息 -->
  639. <el-dialog
  640. title="编辑元素表单信息"
  641. :visible.sync="editElementFormTag"
  642. width="60%"
  643. :modal-append-to-body="false"
  644. >
  645. <div>
  646. <el-table :data="formDatass" border style="width: 100%">
  647. <el-table-column prop="tableName" label="表名">
  648. <template slot-scope="scope">
  649. <el-input
  650. v-model="scope.row.tableName"
  651. placeholder="请输入表名称"
  652. ></el-input>
  653. </template>
  654. </el-table-column>
  655. <el-table-column prop="tableType" label="表类型">
  656. <template slot-scope="scope">
  657. <el-select v-model="scope.row.tableType" placeholder="请选择">
  658. <el-option
  659. v-for="(item, key) in tableTypelist"
  660. :key="key"
  661. :label="item.dictValue"
  662. :value="item.dictKey"
  663. >
  664. </el-option>
  665. </el-select>
  666. </template>
  667. </el-table-column>
  668. <el-table-column prop="tableOwner" label="所属方">
  669. <template slot-scope="scope">
  670. <el-select v-model="scope.row.tableOwner" placeholder="请选择">
  671. <el-option
  672. v-for="(item, key) in ownerTypeList"
  673. :key="key"
  674. :label="item.dictValue"
  675. :value="item.dictKey"
  676. >
  677. </el-option>
  678. </el-select>
  679. </template>
  680. </el-table-column>
  681. <el-table-column prop="fillRate" label="填报率">
  682. <template slot-scope="scope">
  683. <el-input
  684. v-model="scope.row.fillRate"
  685. placeholder="请输入填报率"
  686. ></el-input>
  687. </template>
  688. </el-table-column>
  689. <el-table-column prop="nodeType" label="节点类型" v-if="wbsType == 5">
  690. <template slot-scope="scope">
  691. <el-select v-model="scope.row.nodeType" placeholder="请选择" >
  692. <el-option
  693. v-for="item in nodeTypelist"
  694. :key="item.id"
  695. :label="item.dictValue"
  696. :value="item.dictKey"
  697. ></el-option>
  698. </el-select>
  699. </template>
  700. </el-table-column>
  701. </el-table>
  702. </div>
  703. <span slot="footer" class="dialog-footer">
  704. <el-button @click="editElementFormTag = false">取 消</el-button>
  705. <el-button
  706. type="primary"
  707. @click="editeditElementFormMF()"
  708. :loading="editeditElementFormMFLoading"
  709. >确 定</el-button
  710. >
  711. </span>
  712. </el-dialog>
  713. <!-- 调整表单模板 -->
  714. <div v-if="excelHtml" class="excelHtml">
  715. <dynamicExcel
  716. @remove="removeExcel"
  717. v-if="excelHtml"
  718. :pkeyId="GLExcelFrom.id"
  719. :excelId="GLExcelFrom.excelId"
  720. />
  721. </div>
  722. <el-dialog
  723. title="调整排序"
  724. :visible.sync="sortTag"
  725. width="50%"
  726. append-to-body
  727. >
  728. <ManualSorting v-if="sortTag2" @bianhua="bianhua()" :sort="sort" />
  729. <span slot="footer" class="dialog-footer">
  730. <el-button @click="(sortTag = false), (sortTag2 = false)"
  731. >取 消</el-button
  732. >
  733. <el-button type="primary" @click="editSort()" v-loading="sureSortload"
  734. >确 定</el-button
  735. >
  736. </span>
  737. </el-dialog>
  738. <!-- 元素表排序 -->
  739. <el-dialog
  740. title="调整排序"
  741. :visible.sync="excelSortTag"
  742. width="50%"
  743. append-to-body
  744. >
  745. <ManualSorting
  746. v-if="excelSortTag2"
  747. @bianhua="bianhua2()"
  748. :sort="tableSortList"
  749. />
  750. <span slot="footer" class="dialog-footer">
  751. <el-button @click="excelSortTag = false">取 消</el-button>
  752. <el-button
  753. type="primary"
  754. @click="editPrivateSort()"
  755. v-loading="surePrivateSortload"
  756. >确 定</el-button
  757. >
  758. </span>
  759. </el-dialog>
  760. <!-- 关联清表 -->
  761. <el-dialog
  762. title="关联清表"
  763. class="excelBox"
  764. :visible.sync="GLExcel"
  765. width="500px"
  766. modal-append-to-body
  767. append-to-body
  768. @close="GLExcelMD"
  769. >
  770. <div>
  771. <el-select
  772. style="width: 400px"
  773. v-model="GLExcelFrom.name"
  774. placeholder="请选择"
  775. @change="changetherr()"
  776. >
  777. <el-option
  778. v-for="(item, key) in GLExcelData"
  779. :key="key"
  780. :label="item.name"
  781. :value="item.id"
  782. >
  783. </el-option>
  784. </el-select>
  785. <el-scrollbar style="margin-top: 20px; height: 50vh">
  786. <el-input
  787. style="width: 400px"
  788. v-model.trim="GLExcelFrom.search"
  789. placeholder="请输入需要选择的内容"
  790. ></el-input>
  791. <el-tree
  792. :filter-node-method="filterNode222"
  793. ref="tree"
  794. class="filter-tree"
  795. style="margin-top: 10px"
  796. :props="GLExcelProps"
  797. :data="exceldata"
  798. node-key="id"
  799. accordion
  800. show-checkbox
  801. @check="checkchange"
  802. v-loading="GLExcelLoading"
  803. >
  804. </el-tree>
  805. </el-scrollbar>
  806. </div>
  807. <span
  808. slot="footer"
  809. class="dialog-footer"
  810. style="display: flex; justify-content: center; align-items: center"
  811. >
  812. <el-button @click="GLExcelMD()">取 消</el-button>
  813. <el-button
  814. style="margin-left: 30px"
  815. type="primary"
  816. v-throttle="2000"
  817. @click="saveLinkTab()"
  818. >确 定</el-button
  819. >
  820. </span>
  821. </el-dialog>
  822. <!-- 节点详情 -->
  823. <el-dialog
  824. :title="dialogTitle"
  825. :visible.sync="dialogVisible"
  826. width="50%"
  827. append-to-body
  828. :close-on-click-modal="false"
  829. @closed="saveNodeLoading = false"
  830. >
  831. <el-form
  832. ref="nodeDetail"
  833. :model="nodeDetail"
  834. :rules="rules"
  835. label-width="140px"
  836. >
  837. <el-form-item label="节点名称" prop="nodeName">
  838. <div class="flex">
  839. <el-input v-model="nodeDetail.nodeName"></el-input>
  840. <el-button class="mg-l-10" type="primary" @click="aliasShow"
  841. >添加别名
  842. </el-button>
  843. </div>
  844. </el-form-item>
  845. <el-form-item label="上级节点">
  846. <el-input v-model="nodeDetail.parentName" disabled></el-input>
  847. </el-form-item>
  848. <el-form-item label="节点类型" prop="nodeType">
  849. <el-select
  850. v-model="nodeDetail.nodeType"
  851. placeholder="请选择"
  852. class="w-100p"
  853. @change="nodeTypeChange"
  854. clearable
  855. >
  856. <el-option
  857. v-for="item in nodeTypelist"
  858. :key="item.id"
  859. :label="item.dictValue"
  860. :value="item.dictKey"
  861. ></el-option>
  862. </el-select>
  863. </el-form-item>
  864. <el-form-item label="划分编号" v-if="wbsType !== 2 && wbsType !== 5">
  865. <el-input v-model="nodeDetail.partitionCode"></el-input>
  866. </el-form-item>
  867. <!-- <el-form-item label="唯一编码" v-if="wbsType !== 5">
  868. <el-input v-model="nodeDetail.uniqueCode"></el-input>
  869. </el-form-item> -->
  870. <el-form-item label="参数掩码" v-if="wbsType !== 5">
  871. <el-input v-model="nodeDetail.uniqueCode" placeholder="可填写分部评定权值/试验编号配置"></el-input>
  872. </el-form-item>
  873. <template v-if="nodeDetail.nodeType == 6">
  874. <el-form-item label="是否有混凝土">
  875. <el-radio-group v-model="nodeDetail.isConcrete" size="small">
  876. <el-radio :label="0" border>无</el-radio>
  877. <el-radio :label="1" border>有</el-radio>
  878. </el-radio-group>
  879. </el-form-item>
  880. <el-form-item label="是否试验节点">
  881. <el-radio-group v-model="nodeDetail.isExpernode" size="small">
  882. <el-radio :label="0" border>否</el-radio>
  883. <el-radio :label="1" border>是</el-radio>
  884. </el-radio-group>
  885. </el-form-item>
  886. </template>
  887. <el-form-item
  888. label="内业资料类型"
  889. prop="majorDataType"
  890. v-if="wbsType !== 2 && wbsType !== 5"
  891. >
  892. <el-select
  893. v-model="nodeDetail.majorDataType"
  894. placeholder="请选择"
  895. class="w-100p"
  896. clearable
  897. >
  898. <el-option
  899. v-for="item in majorDataTypeList"
  900. :key="item.id"
  901. :label="item.dictValue"
  902. :value="item.dictKey"
  903. ></el-option>
  904. </el-select>
  905. </el-form-item>
  906. <el-form-item label="标准分类">
  907. <el-select
  908. v-model="nodeDetail.className"
  909. placeholder="请选择"
  910. class="w-100p"
  911. @change="changeStandType"
  912. clearable
  913. >
  914. <el-option
  915. v-for="item in standardTypeOptions"
  916. :key="item.id"
  917. :label="item.dictValue"
  918. :value="item.dictKey"
  919. ></el-option>
  920. </el-select>
  921. </el-form-item>
  922. <el-form-item label="单元名称">
  923. <el-select
  924. v-model="nodeDetail.unitName"
  925. placeholder="请选择"
  926. class="w-100p"
  927. clearable
  928. >
  929. <el-option
  930. v-for="item in unitOptions"
  931. :key="item.id"
  932. :label="item.dictValue"
  933. :value="item.dictKey"
  934. ></el-option>
  935. </el-select>
  936. </el-form-item>
  937. <el-form-item
  938. label="是否新增中隐藏"
  939. prop="isAddConceal"
  940. v-if="wbsType !== 2 && wbsType !== 5"
  941. >
  942. <el-radio-group v-model="nodeDetail.isAddConceal" size="small">
  943. <el-radio :label="1" border>是</el-radio>
  944. <el-radio :label="0" border>否</el-radio>
  945. </el-radio-group>
  946. </el-form-item>
  947. <el-form-item
  948. label="勾选相关联试验"
  949. prop="mixRatioTestIds"
  950. v-if="wbsType === 2 && nodeDetail.nodeType === 53"
  951. >
  952. <div
  953. style="position: relative; height: 300px; border: 1px solid #dddfe6"
  954. >
  955. <el-scrollbar class="h-100p">
  956. <div v-loading="testTreeLoad">
  957. <el-tree
  958. class="filter-tree"
  959. :data="testTreeData"
  960. :props="defaultProps"
  961. :expand-on-click-node="false"
  962. highlight-current
  963. node-key="id"
  964. ref="treeall"
  965. show-checkbox
  966. :default-checked-keys="mixRatioTestIds"
  967. @check="TestTreeCheckChange"
  968. />
  969. </div>
  970. </el-scrollbar>
  971. </div>
  972. </el-form-item>
  973. </el-form>
  974. <span slot="footer" class="dialog-footer">
  975. <el-button @click="dialogVisible = false">取 消</el-button>
  976. <el-button type="primary" @click="saveNode" :loading="saveNodeLoading"
  977. >确 定</el-button
  978. >
  979. </span>
  980. </el-dialog>
  981. <!-- 创建新的元素表 -->
  982. <el-dialog
  983. title="创建新的元素表"
  984. :visible.sync="eleVisible"
  985. width="80%"
  986. append-to-body
  987. :close-on-click-modal="false"
  988. >
  989. <el-form
  990. ref="eleDialog"
  991. :model="eleForm"
  992. :rules="eleRules"
  993. label-width="110px"
  994. >
  995. <el-form-item label="表名" prop="nodeName">
  996. <el-input v-model="eleForm.nodeName"></el-input>
  997. </el-form-item>
  998. <el-row>
  999. <el-col :span="12">
  1000. <el-form-item label="表类型" prop="tableType">
  1001. <el-select
  1002. v-model="eleForm.tableType"
  1003. placeholder="请选择"
  1004. class="w-100p"
  1005. >
  1006. <el-option
  1007. v-for="item in tableTypelist"
  1008. :key="item.id"
  1009. :label="item.dictValue"
  1010. :value="item.dictKey"
  1011. ></el-option>
  1012. </el-select>
  1013. </el-form-item>
  1014. </el-col>
  1015. <el-col :span="12">
  1016. <el-form-item label="所属方" prop="tableOwner">
  1017. <el-select
  1018. v-model="eleForm.tableOwner"
  1019. placeholder="请选择"
  1020. class="w-100p"
  1021. >
  1022. <el-option
  1023. v-for="item in ownerTypeList"
  1024. :key="item.id"
  1025. :label="item.dictValue"
  1026. :value="item.dictKey"
  1027. ></el-option>
  1028. </el-select>
  1029. </el-form-item>
  1030. </el-col>
  1031. </el-row>
  1032. </el-form>
  1033. <div class="flex jc-sb">
  1034. <div></div>
  1035. <div>
  1036. <el-link type="primary" @click="importVisible = true"
  1037. >快捷导入
  1038. </el-link>
  1039. <el-link type="primary" class="mg-l-20" @click="downloadTmp"
  1040. >下载导入模版
  1041. </el-link>
  1042. </div>
  1043. </div>
  1044. <div class="border-grey">
  1045. <p class="font-c-warning">编辑元素信息(请谨慎操作)</p>
  1046. <el-table
  1047. :data="eleForm.elementList"
  1048. border
  1049. style="width: 100%"
  1050. height="400px"
  1051. >
  1052. <el-table-column
  1053. align="center"
  1054. type="index"
  1055. width="50"
  1056. ></el-table-column>
  1057. <el-table-column align="center" prop="eName" label="字段名称">
  1058. <template slot-scope="scope">
  1059. <el-input
  1060. v-model="scope.row.eName"
  1061. size="small"
  1062. placeholder="请输入内容"
  1063. ></el-input>
  1064. </template>
  1065. </el-table-column>
  1066. <el-table-column
  1067. align="center"
  1068. prop="eType"
  1069. label="数据类型"
  1070. width="120"
  1071. >
  1072. <template slot-scope="scope">
  1073. <el-select
  1074. v-model="scope.row.eType"
  1075. size="small"
  1076. placeholder="请选择"
  1077. >
  1078. <el-option
  1079. v-for="item in dataTypeList"
  1080. :key="item.id"
  1081. :label="item.dictValue"
  1082. :value="item.dictKey"
  1083. ></el-option>
  1084. </el-select>
  1085. </template>
  1086. </el-table-column>
  1087. <el-table-column
  1088. align="center"
  1089. prop="eLength"
  1090. label="长度"
  1091. width="120"
  1092. >
  1093. <template slot-scope="scope">
  1094. <el-input
  1095. v-model="scope.row.eLength"
  1096. size="small"
  1097. placeholder="请输入内容"
  1098. :disabled="scope.row.eType == 4"
  1099. ></el-input>
  1100. </template>
  1101. </el-table-column>
  1102. <el-table-column
  1103. align="center"
  1104. prop="eAllowDeviation"
  1105. label="允许偏差值"
  1106. >
  1107. <template slot-scope="scope">
  1108. <div class="flex">
  1109. <el-select
  1110. v-model="scope.row.allow"
  1111. size="small"
  1112. placeholder="请选择"
  1113. style="width: 120px"
  1114. >
  1115. <el-option :key="1" label="≥" value="≥"></el-option>
  1116. <el-option :key="2" label="≤" value="≤"></el-option>
  1117. <el-option :key="3" label="±" value="±"></el-option>
  1118. <el-option :key="4" label="【】" value="【】"></el-option>
  1119. </el-select>
  1120. <el-input
  1121. v-model="scope.row.deviation"
  1122. size="small"
  1123. placeholder="请输入内容"
  1124. ></el-input>
  1125. </div>
  1126. </template>
  1127. </el-table-column>
  1128. <el-table-column
  1129. align="center"
  1130. prop="eInspectionMethod"
  1131. label="检查方法和频率"
  1132. >
  1133. <template slot-scope="scope">
  1134. <el-input
  1135. v-model="scope.row.eInspectionMethod"
  1136. size="small"
  1137. placeholder="请输入内容"
  1138. ></el-input>
  1139. </template>
  1140. </el-table-column>
  1141. <el-table-column align="center" label="操作" width="80">
  1142. <template slot="header">
  1143. <el-button
  1144. @click="addEleRow(eleForm.elementList)"
  1145. type="text"
  1146. icon="el-icon-circle-plus-outline"
  1147. class="text-icon"
  1148. ></el-button>
  1149. </template>
  1150. <template slot-scope="scope">
  1151. <el-button
  1152. icon="el-icon-remove-outline"
  1153. type="text"
  1154. @click="delEleRow(scope.$index, eleForm.elementList)"
  1155. class="text-icon text-icon-danger"
  1156. ></el-button>
  1157. </template>
  1158. </el-table-column>
  1159. </el-table>
  1160. </div>
  1161. <span slot="footer" class="dialog-footer">
  1162. <el-button @click="eleVisible = false">取 消</el-button>
  1163. <el-button type="primary" @click="saveFormAndElementHandle"
  1164. >保 存</el-button
  1165. >
  1166. </span>
  1167. </el-dialog>
  1168. <!-- 模板导入 -->
  1169. <el-dialog
  1170. title="模版导入"
  1171. :visible.sync="importVisible"
  1172. width="50%"
  1173. append-to-body
  1174. :close-on-click-modal="false"
  1175. >
  1176. <p>
  1177. 提示:必须按照系统要求的模版格式上传,否则系统识别无效
  1178. <el-link type="primary" @click="downloadTmp">下载导入模版</el-link>
  1179. </p>
  1180. <div>
  1181. <el-button size="small" type="primary" @click="fileClick2"
  1182. >本地上传
  1183. </el-button>
  1184. <input
  1185. @change="tmpImport"
  1186. type="file"
  1187. hidden
  1188. ref="file2"
  1189. accept=".xls, .xlsx"
  1190. />
  1191. </div>
  1192. <el-table :data="tempList" border style="width: 100%">
  1193. <el-table-column align="center" prop="eName" label="字段信息">
  1194. </el-table-column>
  1195. <el-table-column
  1196. align="center"
  1197. prop="eType"
  1198. label="数据类型"
  1199. width="120"
  1200. >
  1201. </el-table-column>
  1202. <el-table-column align="center" prop="eLength" label="长度" width="120">
  1203. </el-table-column>
  1204. <el-table-column
  1205. align="center"
  1206. prop="eAllowDeviation"
  1207. label="允许偏差值"
  1208. >
  1209. </el-table-column>
  1210. <el-table-column
  1211. align="center"
  1212. prop="eInspectionMethod"
  1213. label="检查方法和频率"
  1214. >
  1215. </el-table-column>
  1216. </el-table>
  1217. <span slot="footer" class="dialog-footer">
  1218. <el-button @click="importVisible = false">取 消</el-button>
  1219. <el-button type="primary" @click="importHandle">确 定</el-button>
  1220. </span>
  1221. </el-dialog>
  1222. <!-- 预览元素 -->
  1223. <el-dialog
  1224. :title="(curEleTable.tableName ? curEleTable.tableName : '') + ''"
  1225. :visible.sync="editEleVisible"
  1226. width="80%"
  1227. append-to-body
  1228. :close-on-click-modal="false"
  1229. >
  1230. <!-- <p class="font-c-warning">编辑元素信息(请谨慎操作)</p> -->
  1231. <el-table :data="editEleList" border style="width: 100%" height="400px">
  1232. <el-table-column
  1233. align="center"
  1234. type="index"
  1235. width="50"
  1236. ></el-table-column>
  1237. <el-table-column align="center" prop="eName" label="字段信息">
  1238. </el-table-column>
  1239. <el-table-column
  1240. align="center"
  1241. prop="eType"
  1242. label="数据类型"
  1243. width="120"
  1244. :formatter="eTypeFormatter"
  1245. >
  1246. </el-table-column>
  1247. <el-table-column align="center" prop="eLength" label="长度" width="120">
  1248. </el-table-column>
  1249. <el-table-column
  1250. align="center"
  1251. prop="eAllowDeviation"
  1252. label="允许偏差值"
  1253. >
  1254. </el-table-column>
  1255. <el-table-column
  1256. align="center"
  1257. prop="eInspectionMethod"
  1258. label="检查方法和频率"
  1259. >
  1260. </el-table-column>
  1261. </el-table>
  1262. <span slot="footer" class="dialog-footer">
  1263. <el-button @click="editEleVisible = false">取 消</el-button>
  1264. <!-- <el-button
  1265. type="primary"
  1266. @click="saveEles"
  1267. >确 定</el-button> -->
  1268. </span>
  1269. </el-dialog>
  1270. <!-- 元素公式 -->
  1271. <el-dialog
  1272. :title="
  1273. (curEleTable.tableName ? curEleTable.tableName : '') + ' 元素公式'
  1274. "
  1275. :visible.sync="editEleFormulaVisible"
  1276. width="800px"
  1277. append-to-body
  1278. :close-on-click-modal="false"
  1279. >
  1280. <div class="flex mg-b-10">
  1281. <el-input
  1282. v-model="formulaInput"
  1283. placeholder="请输入名称"
  1284. size="samll"
  1285. clearable
  1286. @clear="searchFormulaName"
  1287. ></el-input>
  1288. <el-button type="info" class="mg-l-10" @click="searchFormulaName"
  1289. >搜索
  1290. </el-button>
  1291. </div>
  1292. <el-table
  1293. :data="editEleListFilter"
  1294. border
  1295. style="width: 100%"
  1296. height="400px"
  1297. >
  1298. <el-table-column align="center" prop="eName" label="字段信息">
  1299. </el-table-column>
  1300. <el-table-column align="center" label="操作" width="200">
  1301. <template slot-scope="scope">
  1302. <el-link
  1303. :type="scope.row.globalFormula == 1 ? 'warning' : 'primary'"
  1304. @click="toFormulaEdit(scope.row, 10)"
  1305. >全局公式
  1306. </el-link>
  1307. <el-link
  1308. v-show="scope.row.hasPartFormula"
  1309. class="mg-l-10"
  1310. :type="scope.row.isSaveFormula == 1 ? 'warning' : 'primary'"
  1311. @click="toFormulaEdit(scope.row, 20)"
  1312. >节点公式
  1313. </el-link>
  1314. <!-- <el-link
  1315. class="mg-l-10"
  1316. type="danger"
  1317. @click="delEleRowHandle(scope.$index,editEleListFilter)"
  1318. >删除</el-link> -->
  1319. </template>
  1320. </el-table-column>
  1321. </el-table>
  1322. </el-dialog>
  1323. <!-- 导入划分 -->
  1324. <el-dialog
  1325. title="导入划分"
  1326. :visible.sync="importTemplateVisible"
  1327. width="800px"
  1328. append-to-body
  1329. :close-on-click-modal="false"
  1330. >
  1331. <div v-loading="importLoading">
  1332. <div>
  1333. <el-link type="primary" @click="handleDownload">下载导入模版</el-link>
  1334. </div>
  1335. <div class="mg-t-20">
  1336. <el-button type="primary" @click="fileClick">选择文件</el-button>
  1337. <span v-if="upFile" class="mg-l-20">{{ upFile.name }}</span>
  1338. <input
  1339. @change="fileChange"
  1340. type="file"
  1341. hidden
  1342. ref="file"
  1343. accept=".xls, .xlsx"
  1344. />
  1345. </div>
  1346. <div v-if="!upFile">当前还未选择文件,请选择需要导入的文件</div>
  1347. </div>
  1348. <span slot="footer" class="dialog-footer">
  1349. <el-button @click="importTemplateVisible = false">取 消</el-button>
  1350. <el-button
  1351. type="primary"
  1352. @click="importTemplateHandle"
  1353. :loading="importLoading"
  1354. >导 入</el-button
  1355. >
  1356. </span>
  1357. </el-dialog>
  1358. <!-- 节点参数 -->
  1359. <el-dialog
  1360. title="节点参数"
  1361. :visible.sync="nodeInfoVisible"
  1362. width="800px"
  1363. append-to-body
  1364. class="jiedian"
  1365. :close-on-click-modal="false"
  1366. :show-close="false"
  1367. @close="closenodeInfoVisible"
  1368. >
  1369. <div>
  1370. <el-button
  1371. type="text"
  1372. icon="el-icon-s-operation"
  1373. class="right-btn"
  1374. @click="setNodeParameters()"
  1375. ></el-button>
  1376. <div class="flexEnd">
  1377. <i
  1378. class="el-icon-circle-plus marbottom10"
  1379. @click="addNodeInfoTable()"
  1380. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1381. ></i>
  1382. <i
  1383. class="el-icon-refresh-right marbottom10"
  1384. @click="refreshnfoTable()"
  1385. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1386. ></i>
  1387. </div>
  1388. <el-table
  1389. :data="nodeInfoTable"
  1390. border
  1391. style="width: 100%"
  1392. height="400"
  1393. v-loading="nodeInfoTableLoad"
  1394. >
  1395. <el-table-column align="center" prop="name" label="参数名称">
  1396. <template slot-scope="scope">
  1397. <el-select
  1398. v-model="scope.row.k"
  1399. placeholder="请选择"
  1400. class="w-100p"
  1401. >
  1402. <el-option
  1403. v-for="item in namelist"
  1404. :key="item.k"
  1405. :label="item.name"
  1406. :value="item.k"
  1407. ></el-option>
  1408. </el-select>
  1409. </template>
  1410. </el-table-column>
  1411. <el-table-column align="center" prop="value" label="参数值设置">
  1412. <template slot-scope="scope">
  1413. <el-input v-model="scope.row.v"></el-input>
  1414. </template>
  1415. </el-table-column>
  1416. <el-table-column align="center" prop="describe" label="描述">
  1417. <template slot-scope="scope">
  1418. <el-input v-model="scope.row.remark"></el-input>
  1419. </template>
  1420. </el-table-column>
  1421. <el-table-column label="操作" width="120" align="center">
  1422. <template slot-scope="scope">
  1423. <el-button
  1424. type="text"
  1425. size="small"
  1426. class="text-icon-primary"
  1427. @click="linkEle(scope.row)"
  1428. >关联元素
  1429. </el-button>
  1430. <el-button
  1431. type="text"
  1432. size="small"
  1433. class="text-icon-danger"
  1434. @click="delNodeInfoss(scope.$index, scope.row)"
  1435. >删除
  1436. </el-button>
  1437. </template>
  1438. </el-table-column>
  1439. </el-table>
  1440. </div>
  1441. <span slot="footer" class="dialog-footer">
  1442. <el-button @click="nodeInfoVisible = false">取 消</el-button>
  1443. <el-button
  1444. type="primary"
  1445. @click="nodeInfoSave()"
  1446. :loading="nodeInfoSaveload"
  1447. >保 存</el-button
  1448. >
  1449. </span>
  1450. </el-dialog>
  1451. <!-- 设置参数名称 -->
  1452. <el-dialog
  1453. title="设置参数名称"
  1454. :visible.sync="infoNameVisible"
  1455. width="800px"
  1456. append-to-body
  1457. class="jiedian"
  1458. :close-on-click-modal="false"
  1459. >
  1460. <div>
  1461. <div class="flexEnd">
  1462. <i
  1463. class="el-icon-circle-plus marbottom10"
  1464. @click="setParameterName()"
  1465. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1466. ></i>
  1467. </div>
  1468. <el-table :data="namelists" border style="width: 100%" height="400">
  1469. <el-table-column align="center" prop="name" label="参数名称">
  1470. <template slot-scope="scope">
  1471. <el-input v-model="scope.row.name"></el-input>
  1472. </template>
  1473. </el-table-column>
  1474. <el-table-column align="center" prop="key" label="参数值KEY">
  1475. <template slot-scope="scope">
  1476. <el-input v-model="scope.row.k"></el-input>
  1477. </template>
  1478. </el-table-column>
  1479. <el-table-column align="center" prop="describe" label="描述">
  1480. <template slot-scope="scope">
  1481. <el-input v-model="scope.row.remark"></el-input>
  1482. </template>
  1483. </el-table-column>
  1484. <el-table-column label="操作" width="120" align="center">
  1485. <template slot-scope="scope">
  1486. <el-button
  1487. type="text"
  1488. size="small"
  1489. class="text-icon-danger"
  1490. @click="delNodeInfo(scope.$index, scope.row)"
  1491. >删除
  1492. </el-button>
  1493. </template>
  1494. </el-table-column>
  1495. </el-table>
  1496. </div>
  1497. <span slot="footer" class="dialog-footer">
  1498. <el-button @click="addParameterName()">保 存</el-button>
  1499. <el-button @click="closeParameter()">关 闭</el-button>
  1500. </span>
  1501. </el-dialog>
  1502. <el-dialog
  1503. title="别名"
  1504. :visible.sync="aliasVisible"
  1505. width="600px"
  1506. append-to-body
  1507. :close-on-click-modal="false"
  1508. >
  1509. <div>
  1510. <div class="flex">
  1511. <el-input
  1512. v-model="aliasInput"
  1513. placeholder="请输入节点别名"
  1514. ></el-input>
  1515. <el-button class="mg-l-20" type="primary" @click="addAlias"
  1516. >添加
  1517. </el-button>
  1518. </div>
  1519. <div class="flex" style="flex-wrap: wrap">
  1520. <div class="mg-t-10" v-for="(tag, index) in aliasArr" :key="index">
  1521. <el-tag closable @close="delAlias(index)">
  1522. {{ tag }}
  1523. </el-tag>
  1524. <span v-if="index != aliasArr.length - 1">、</span>
  1525. </div>
  1526. </div>
  1527. </div>
  1528. <span slot="footer" class="dialog-footer">
  1529. <el-button @click="aliasVisible = false">取 消</el-button>
  1530. <el-button type="primary" @click="saveAliasHandle">确 定</el-button>
  1531. </span>
  1532. </el-dialog>
  1533. <!-- 节点公式 -->
  1534. <el-dialog
  1535. :title="
  1536. (curEleTable.tableName ? curEleTable.tableName : '') +
  1537. ' 元素公式(元素库)'
  1538. "
  1539. :visible.sync="formulaCompVisible"
  1540. fullscreen
  1541. append-to-body
  1542. class="full-dialog"
  1543. @close="closeformulaComp"
  1544. >
  1545. <FormulaEdit
  1546. :istableType="!isNodeType"
  1547. :fromcurNode="curTreeData"
  1548. :projectid="projectid"
  1549. :wbsid="id"
  1550. :nodeid="curTreeData.id"
  1551. :eleid="formulaCurRow.id"
  1552. :globaltype="formulaCurRow.globaltype"
  1553. :iswbstype="0"
  1554. @hideDialog="formulaCompVisible = false"
  1555. v-if="formulaCompVisible"
  1556. ></FormulaEdit>
  1557. </el-dialog>
  1558. <!-- 全局公式 -->
  1559. <el-dialog
  1560. title=""
  1561. :visible.sync="formulaCompVisible1"
  1562. fullscreen
  1563. append-to-body
  1564. class="full-dialog"
  1565. @close="closeformulaComp1"
  1566. >
  1567. <FormulaEditone
  1568. :wbsid="id"
  1569. :nodeid="curTreeData.id"
  1570. :eleid="formulaCurRow.id"
  1571. :elementType="formulaCurRow.elementType"
  1572. :projectid="projectid"
  1573. :tableType="istableType"
  1574. :globaltype="formulaCurRow.globaltype"
  1575. @hideDialog="formulaCompVisible1 = false"
  1576. :fromcurNode="curEleTable"
  1577. :iswbstype="0"
  1578. v-if="formulaCompVisible1"
  1579. >
  1580. </FormulaEditone>
  1581. </el-dialog>
  1582. <!-- 编辑元素 -->
  1583. <el-dialog
  1584. title=" "
  1585. :visible.sync="editElementVisible"
  1586. fullscreen
  1587. append-to-body
  1588. class="full-dialog"
  1589. >
  1590. <EditElement
  1591. :editElementQuery="curTreeData"
  1592. :pkeyId="editElementQuery.pkeyId"
  1593. :excelId="editElementQuery.excelId"
  1594. :id="editElementQuery.id"
  1595. :initTableName="editElementQuery.initTableName"
  1596. :pid="editElementQuery.pid"
  1597. :wbsid="editElementQuery.wbsid"
  1598. :initTableId="editElementQuery.initTableId"
  1599. :nodeid="editElementQuery.nodeid"
  1600. @hideDialog="hideEditElementVisible"
  1601. @adjustExcel="adjustExcel"
  1602. v-if="editElementVisible"
  1603. ></EditElement>
  1604. </el-dialog>
  1605. <el-dialog
  1606. title="节点参数设置-关联元素"
  1607. :visible.sync="linkEleVisible"
  1608. width="800px"
  1609. append-to-body
  1610. class="jiedian"
  1611. :close-on-click-modal="false"
  1612. >
  1613. <div>
  1614. <el-table
  1615. :data="linkEleTableList"
  1616. border
  1617. style="width: 100%"
  1618. height="400"
  1619. >
  1620. <el-table-column align="center" prop="tableName" label="元素表名">
  1621. </el-table-column>
  1622. <el-table-column
  1623. align="center"
  1624. prop="elementName"
  1625. label="关联元素字段"
  1626. >
  1627. </el-table-column>
  1628. <el-table-column label="操作" width="160" align="center">
  1629. <template slot-scope="scope">
  1630. <el-button
  1631. v-if="!scope.row.mappingId"
  1632. type="text"
  1633. size="small"
  1634. class="text-icon-primary"
  1635. @click="tolinkEle(scope.row)"
  1636. >选择元素
  1637. </el-button>
  1638. <el-button
  1639. v-if="!!scope.row.mappingId"
  1640. type="text"
  1641. size="small"
  1642. class="text-icon-danger"
  1643. @click="delLink(scope.row)"
  1644. >删除关联
  1645. </el-button>
  1646. </template>
  1647. </el-table-column>
  1648. </el-table>
  1649. </div>
  1650. <span slot="footer" class="dialog-footer">
  1651. <!-- <el-button @click="saveLinks">保 存</el-button> -->
  1652. <el-button @click="linkEleVisible = false">关 闭</el-button>
  1653. </span>
  1654. </el-dialog>
  1655. <el-dialog
  1656. title="选择关联元素"
  1657. :visible.sync="linkCheckVisible"
  1658. width="600px"
  1659. append-to-body
  1660. class="jiedian"
  1661. :close-on-click-modal="false"
  1662. >
  1663. <div>
  1664. <div class="flex mg-b-20">
  1665. <el-input
  1666. v-model="linkEleKey"
  1667. placeholder="请输入元素关键字搜索"
  1668. ></el-input>
  1669. <el-link class="mg-l-20" :underline="false">
  1670. <i
  1671. class="el-icon-search"
  1672. style="font-size: 20px"
  1673. @click="searchEle"
  1674. ></i>
  1675. </el-link>
  1676. </div>
  1677. <el-table :data="linkEleList" border style="width: 100%" height="400">
  1678. <el-table-column align="center" prop="eName" label="元素名">
  1679. </el-table-column>
  1680. <el-table-column label="操作" width="55">
  1681. <template slot-scope="scope">
  1682. <el-checkbox
  1683. v-model="scope.row.checked"
  1684. @change="(value) => linkEleCheck(value, scope.$index)"
  1685. ></el-checkbox>
  1686. </template>
  1687. </el-table-column>
  1688. </el-table>
  1689. </div>
  1690. <span slot="footer" class="dialog-footer">
  1691. <el-button @click="saveLinkEle">保 存</el-button>
  1692. <el-button @click="linkCheckVisible = false">关 闭</el-button>
  1693. </span>
  1694. </el-dialog>
  1695. <!-- 关联节点 -->
  1696. <el-dialog
  1697. title="关联节点"
  1698. :visible="isLinkNodes"
  1699. append-to-body
  1700. center
  1701. destroy-on-close
  1702. custom-class="hc-link-nodes-dialog"
  1703. @close="linkNodesClose"
  1704. >
  1705. <el-tree
  1706. ref="tree2"
  1707. class="hc-link-nodes-tree"
  1708. lazy
  1709. :load="loadNode"
  1710. :props="defaultProps"
  1711. show-checkbox
  1712. check-strictly
  1713. :default-checked-keys="checkedLinkNodesKeys"
  1714. highlight-current
  1715. node-key="primaryKeyId"
  1716. />
  1717. <span slot="footer" class="dialog-footer">
  1718. <el-button @click="linkNodesClose">取 消</el-button>
  1719. <el-button
  1720. type="primary"
  1721. @click="linkNodesSave"
  1722. v-loading="linkNodesLoad"
  1723. >确 定</el-button
  1724. >
  1725. </span>
  1726. </el-dialog>
  1727. <!-- 编辑 -->
  1728. <el-dialog
  1729. :title="(curEleTable.tableName ? curEleTable.tableName : '') + ''"
  1730. :visible.sync="editDialogShow"
  1731. width="80%"
  1732. append-to-body
  1733. :close-on-click-modal="false"
  1734. >
  1735. <p class="font-c-warning">编辑元素信息(请谨慎操作)</p>
  1736. <div style="display: flex; margin-bottom: 10px">
  1737. <el-input
  1738. placeholder="请输入你想编辑的元素名称"
  1739. v-model="searchinput"
  1740. :size="size"
  1741. clearable
  1742. @clear="clearsearchinput"
  1743. >
  1744. </el-input>
  1745. <el-button
  1746. type="primary"
  1747. icon="el-icon-search"
  1748. size="small"
  1749. @click="searchinputChange"
  1750. >搜索</el-button
  1751. >
  1752. </div>
  1753. <el-table
  1754. :data="editTable"
  1755. border
  1756. style="width: 100%"
  1757. height="400px"
  1758. v-loading="editEleTableloading"
  1759. >
  1760. <el-table-column
  1761. align="center"
  1762. type="index"
  1763. width="50"
  1764. ></el-table-column>
  1765. <el-table-column align="center" prop="eName" label="元素名称">
  1766. <template slot="header">
  1767. <i class="required"></i>
  1768. <span>元素名称</span>
  1769. </template>
  1770. <template slot-scope="scope">
  1771. <el-input
  1772. v-model="scope.row.eName"
  1773. size="small"
  1774. placeholder="请输入内容"
  1775. ></el-input>
  1776. </template>
  1777. </el-table-column>
  1778. <el-table-column align="center" prop="dynamicDict" label="动态字典">
  1779. <template slot="header">
  1780. <span>动态字典</span>
  1781. </template>
  1782. <template slot-scope="scope">
  1783. <el-select
  1784. v-model="scope.row.dynamicDict"
  1785. filterable
  1786. size="small"
  1787. placeholder="请选择"
  1788. >
  1789. <el-option
  1790. v-for="item in dynamicDictList"
  1791. :key="item.id"
  1792. :label="item.dictValue"
  1793. :value="item.dictKey"
  1794. ></el-option>
  1795. </el-select>
  1796. </template>
  1797. </el-table-column>
  1798. </el-table>
  1799. <span slot="footer" class="dialog-footer">
  1800. <el-button @click="editDialogShow = false">取 消</el-button>
  1801. <el-button type="primary" @click="saveEles" :loading="saveLoading"
  1802. >确 定</el-button
  1803. >
  1804. </span>
  1805. </el-dialog>
  1806. <!-- 文件题名全局配置 -->
  1807. <el-dialog
  1808. title="文件题名全局配置"
  1809. :visible.sync="fileTitleVisible"
  1810. width="60%"
  1811. append-to-body
  1812. :close-on-click-modal="false"
  1813. >
  1814. <div class="flexEnd">
  1815. <i
  1816. class="el-icon-circle-plus "
  1817. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1818. @click="addRow"
  1819. ></i>
  1820. <i
  1821. class="el-icon-refresh "
  1822. style="font-size: 24px; color: rgb(37, 193, 99); cursor: pointer"
  1823. @click="refreshRow"
  1824. ></i>
  1825. </div>
  1826. <el-table
  1827. :data="fileTableData"
  1828. style="width: 100%;height: 500px;"
  1829. align="center"
  1830. v-loading="fileTableLoading"
  1831. >
  1832. <el-table-column
  1833. label="文件题名规则"
  1834. prop="roleNameVal">
  1835. <template #default="scope">
  1836. <el-select
  1837. :id="selectDiv"
  1838. v-if="scope.row.isEdit"
  1839. v-model="scope.row.ruleName"
  1840. multiple
  1841. placeholder="请选择"
  1842. style="width: 240px"
  1843. @change="changeRoleName($event,scope.row,scope.index)"
  1844. >
  1845. <el-option
  1846. v-for="item in nodeTypelist1"
  1847. :key="item.id"
  1848. :label="item.dictValue"
  1849. :value="item.dictKey"
  1850. ></el-option>
  1851. </el-select>
  1852. <span v-else>
  1853. <el-tag v-for="item in scope.row.roleNameVal" style="margin-right: 2px;">{{ item }}</el-tag>
  1854. </span>
  1855. </template>
  1856. </el-table-column>
  1857. <el-table-column
  1858. label="文件题名范围"
  1859. prop="ruleSizeVal"
  1860. >
  1861. <template #default="scope">
  1862. <div v-if="isShowSize">
  1863. <span v-if="scope.row.type===1" :class="{'orange': scope.row.isEdit}" @click="chooseFile(scope.$index, scope.row)">所有节点</span>
  1864. <div v-else>
  1865. <el-link type="warning" @click="chooseFile(scope.$index, scope.row)" v-if="!scope.row.ruleSizeVal">选择题名范围</el-link>
  1866. <span v-else @click="chooseFile(scope.$index, scope.row)" :class="{'orange': scope.row.isEdit}">{{ scope.row.ruleSizeVal }}</span>
  1867. </div>
  1868. </div>
  1869. </template>
  1870. </el-table-column>
  1871. <el-table-column
  1872. label="操作"
  1873. width="150px"
  1874. >
  1875. <template slot-scope="scope">
  1876. <el-link
  1877. v-if="!scope.row.isEdit"
  1878. type="primary"
  1879. class="mg-r-10"
  1880. @click="editRow(scope.$index, scope.row)">编辑</el-link>
  1881. <el-link
  1882. v-else
  1883. type="primary"
  1884. class="mg-r-10"
  1885. @click="saveRow(scope.$index, scope.row)">保存</el-link>
  1886. <el-link
  1887. @click="delRow(scope.$index, scope.row)"
  1888. type="danger"
  1889. >删除</el-link>
  1890. </template>
  1891. </el-table-column>
  1892. </el-table>
  1893. <template #footer>
  1894. <div class="dialog-footer">
  1895. <el-button @click="fileTitleVisible=false">取消</el-button>
  1896. <el-button type="primary" @click="batchsaveFileSize" :loading="saveFileLoading">
  1897. 保存
  1898. </el-button>
  1899. </div>
  1900. </template>
  1901. </el-dialog>
  1902. <!-- 选择题名范围i -->
  1903. <el-dialog
  1904. :visible.sync="chooseFileVisible"
  1905. title="选择题名范围"
  1906. width="500"
  1907. align-center
  1908. append-to-body
  1909. >
  1910. <el-form label-position="left" label-width="80px" :model="fileTitleModel" :rules="fileTitleRules" ref="fileTitleRef">
  1911. <el-form-item label="题名范围" prop="type">
  1912. <el-radio v-model="fileTitleModel.type" :label="1" @input="changeRadio">所有节点</el-radio><br/>
  1913. <el-radio v-model="fileTitleModel.type" :label="2" @input="changeRadio">部分节点</el-radio>
  1914. <div v-if="fileTitleModel.type==2" class="warning-text">请选择节点</div>
  1915. <el-scrollbar class="h-100p" style="height: 400px;" v-if="fileTitleModel.type==2" v-loading="fileTreeLoading">
  1916. <el-tree
  1917. :data="fileTreeData"
  1918. :props="filedefaultProps"
  1919. :expand-on-click-node="false"
  1920. highlight-current
  1921. node-key="id"
  1922. show-checkbox
  1923. @check="checkFileSize"
  1924. :default-checked-keys="deCheckTreeKeys"
  1925. >
  1926. </el-tree>
  1927. </el-scrollbar>
  1928. </el-form-item>
  1929. </el-form>
  1930. <template #footer>
  1931. <div class="dialog-footer">
  1932. <el-button @click="chooseFileVisible=false">取消</el-button>
  1933. <el-button type="primary" @click="saveFileSize">
  1934. 保存
  1935. </el-button>
  1936. </div>
  1937. </template>
  1938. </el-dialog>
  1939. <!-- 项目数据同步 -->
  1940. <el-dialog
  1941. :visible.sync="proSyncTag"
  1942. width="80%"
  1943. append-to-body
  1944. @close=closeProSyncTag
  1945. >
  1946. <span slot="title" class="dialog-title">
  1947. <div class="dialog-title-text">项目数据同步</div>
  1948. <span class="dialog-title-tip">重新同步项目下所有配置,不保留独有配置,慎重同步!!!</span>
  1949. </span>
  1950. <div class="sync-container">
  1951. <el-card class="box-card-1" :style="{ width: isShowLeft ? '40%' : '0%' }">
  1952. <el-scrollbar style="height: 100%;">
  1953. <div v-loading="treeLoad">
  1954. <el-tree
  1955. check-strictly
  1956. class="filter-tree"
  1957. lazy
  1958. :load="loadNode"
  1959. show-checkbox
  1960. :props="defaultProps"
  1961. :expand-on-click-node="false"
  1962. highlight-current
  1963. node-key="primaryKeyId"
  1964. @check="handleCheckChange"
  1965. @check-change="handleCheckChange1"
  1966. ref="syncProTree"
  1967. >
  1968. </el-tree>
  1969. </div>
  1970. </el-scrollbar>
  1971. </el-card>
  1972. <el-card class="box-card-2">
  1973. <el-form ref="syncForm" :model="syncForm" label-position="top">
  1974. <el-form-item label="同步范围" v-if="!isShowTable">
  1975. <el-radio-group v-model="syncForm.range">
  1976. <el-radio
  1977. v-for="item in rangeOptions"
  1978. :key="item.id"
  1979. :label="item.dictKey"
  1980. >{{ item.dictValue}}</el-radio>
  1981. </el-radio-group>
  1982. </el-form-item>
  1983. <el-form-item label="同步类型" prop="type">
  1984. <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
  1985. <div style="margin: 15px 0;"></div>
  1986. <el-checkbox-group v-model="syncForm.type" @change="handleCheckedTypeChange">
  1987. <el-checkbox v-for="item in typeOptions" :label="item.dictKey" :key="item.id">{{ item.dictValue}}</el-checkbox>
  1988. </el-checkbox-group>
  1989. </el-form-item>
  1990. <!-- <el-form-item label="选择同步范围(节点状态)" prop="contractRange" v-if="syncForm.range==='2'">
  1991. <el-checkbox-group v-model="syncForm.contractRange">
  1992. <el-checkbox label="全选" name="1"></el-checkbox>
  1993. <el-checkbox v-for="(item,index) in checkIdList" :label="item.dictKey" :key="item.id">{{ item.dictValue}}</el-checkbox>
  1994. </el-checkbox-group>
  1995. </el-form-item> -->
  1996. <el-form-item label="选择同步范围(节点状态)" prop="contractRange" v-if="syncForm.range==='2'">
  1997. <el-checkbox :indeterminate="isIndeterminate1" v-model="checkAll1" @change="handleCheckAllChange1">全选</el-checkbox>
  1998. <div style="margin: 15px 0;"></div>
  1999. <el-checkbox-group v-model="syncForm.contractRange" @change="handleCheckedTypeChange1">
  2000. <el-checkbox v-for="item in checkIdList" :label="item.dictKey" :key="item.id">{{ item.dictValue}}</el-checkbox>
  2001. </el-checkbox-group>
  2002. </el-form-item>
  2003. <el-form-item label="选择同步源" prop="templateId" v-else>
  2004. <el-select v-model="syncForm.templateId" placeholder="请选择同步源" style="width: 100%;" size="small" @change="changeTemplateId">
  2005. <el-option
  2006. v-for="item in templateIdList"
  2007. :key="item.id"
  2008. :label="item.name"
  2009. :value="item.id">
  2010. </el-option>
  2011. </el-select>
  2012. </el-form-item>
  2013. </el-form>
  2014. <div class="table-box" v-if="isShowTable">
  2015. <h4 style="margin-left: 4px;">表单预览</h4>
  2016. <el-table
  2017. size="small"
  2018. ref="proTable"
  2019. :data="preTableData"
  2020. stripe
  2021. style="width: 100%"
  2022. max-height="300"
  2023. @selection-change="handleSelectionChange"
  2024. >
  2025. <el-table-column
  2026. type="selection"
  2027. width="55">
  2028. </el-table-column>
  2029. <el-table-column
  2030. prop="tableName"
  2031. label="表单名称"
  2032. width="180">
  2033. </el-table-column>
  2034. <el-table-column
  2035. prop="tableType"
  2036. :formatter="formatTableType"
  2037. label="表单类型"
  2038. width="180">
  2039. </el-table-column>
  2040. <el-table-column
  2041. prop="tableOwner"
  2042. :formatter="formatOwner"
  2043. label="所属方">
  2044. </el-table-column>
  2045. </el-table>
  2046. </div>
  2047. </el-card>
  2048. </div>
  2049. <span slot="footer" class="dialog-footer">
  2050. <el-button @click="closeProSyncTag">取 消</el-button>
  2051. <el-button type="primary" @click="saveProTag" :loading="saveProTagLoading">确 定</el-button>
  2052. </span>
  2053. </el-dialog>
  2054. <!-- 同步队列 -->
  2055. <el-dialog
  2056. title="同步队列"
  2057. :visible.sync="syncListDialog"
  2058. width="30%"
  2059. append-to-body
  2060. :close-on-click-modal="false"
  2061. @close="closeSyncListTag"
  2062. >
  2063. <div class="content-box" v-loading="refreshLoading||refreshLoading1">
  2064. <el-image
  2065. style="width: 100px; height: 100px"
  2066. :src="require('@/assets/loader.svg')"
  2067. fit="contain"></el-image>
  2068. <div class="mt-14">同步中</div>
  2069. <div class="mt-14">
  2070. 同步数量{{ syncListData.nodeNum }} 剩余数量{{ syncListData.nodeNumEnd }}
  2071. </div>
  2072. <div class="mt-14">
  2073. <el-button type="primary" @click="syncListDialog=false">好的,我已知晓</el-button>
  2074. </div>
  2075. <div class="mt-14">
  2076. <el-link type="primary" @click="refreshData" v-loading="refreshLoading" v-if="!isAdd">刷新数据</el-link>
  2077. <el-link type="primary" @click="refreshData1" v-loading="refreshLoading1" v-else>刷新数据</el-link>
  2078. </div>
  2079. </div>
  2080. </el-dialog>
  2081. <!-- 同步表单其他配置 -->
  2082. <el-dialog
  2083. title="同步表单其他配置"
  2084. :visible.sync="syncTableDialog"
  2085. width="70%"
  2086. append-to-body
  2087. :close-on-click-modal="false"
  2088. >
  2089. <div class="sync-container">
  2090. <el-card class="box-card-1" :style="{ width: isShowLeft ? '40%' : '0%' }">
  2091. <el-scrollbar style="height: 100%;">
  2092. <div >
  2093. <el-tree
  2094. class="filter-tree"
  2095. lazy
  2096. :load="loadNode"
  2097. @node-click="handleNodeClick"
  2098. :default-expanded-keys="defaultExpandedKeys"
  2099. :props="defaultProps"
  2100. :expand-on-click-node="false"
  2101. highlight-current
  2102. node-key="primaryKeyId"
  2103. >
  2104. </el-tree>
  2105. </div>
  2106. </el-scrollbar>
  2107. </el-card>
  2108. <el-card class="box-card-2">
  2109. <div class="table-box">
  2110. <h4 style="margin-left: 4px;">表单预览</h4>
  2111. <el-table
  2112. size="small"
  2113. ref="proTable1"
  2114. :data="preTableData1"
  2115. stripe
  2116. style="width: 100%"
  2117. max-height="300"
  2118. @selection-change="handleSelectionChange1"
  2119. >
  2120. <el-table-column
  2121. type="selection"
  2122. width="55">
  2123. </el-table-column>
  2124. <el-table-column
  2125. prop="tableName"
  2126. label="表单名称"
  2127. width="180">
  2128. </el-table-column>
  2129. <el-table-column
  2130. prop="tableType"
  2131. :formatter="formatTableType"
  2132. label="表单类型"
  2133. width="180">
  2134. </el-table-column>
  2135. <el-table-column
  2136. prop="tableOwner"
  2137. :formatter="formatOwner"
  2138. label="所属方">
  2139. </el-table-column>
  2140. </el-table>
  2141. </div>
  2142. </el-card>
  2143. </div>
  2144. <span slot="footer" class="dialog-footer">
  2145. <el-button @click="syncTableDialog = false">取 消</el-button>
  2146. <el-button type="primary" @click="saveTableSync" :loading="saveTableSyncLoad">确 定</el-button>
  2147. </span>
  2148. </el-dialog>
  2149. <!-- 编号设置弹窗 -->
  2150. <CodeSet ref="codeSetRef" ></CodeSet>
  2151. </div>
  2152. </template>
  2153. <script>
  2154. import ManualSorting from "@/components/WbsTree/ManualSorting";
  2155. import dynamicExcel from "./treeTemplate/dynamicExcel.vue";
  2156. import FormulaEdit from "@/views/formula/edit.vue";
  2157. import FormulaEditone from "@/views/formula/edit1.vue";
  2158. import EditElement from "@/views/manager/projectinfo/editElement/editElement.vue";
  2159. import CodeSet from "./codeSet.vue";
  2160. import {
  2161. saveFormAndElement,
  2162. selectFormElements,
  2163. importWbsTree,
  2164. findWbsTreePrivateSameLevel,
  2165. wbsTreePrivateSort,
  2166. parameters,
  2167. saveOrUpdateBatch,
  2168. keymap,
  2169. updateBatchNodeTableInfo2,
  2170. updateStatus,
  2171. getParamElements,
  2172. specifiedParamElements,
  2173. delParamElements,
  2174. selectPrivateFormElements,
  2175. syncCurrentFormInProject,
  2176. getQueryValueByType,
  2177. getQueryValueByNodeType,
  2178. getTreeByType,
  2179. } from "@/api/manager/wbstree";
  2180. import {
  2181. saveElement,
  2182. remove as removeElement,
  2183. updateBatchElements,
  2184. getTemplate,
  2185. importWbsElement,
  2186. } from "@/api/manager/wbsformelement";
  2187. import {
  2188. getLazytree,
  2189. getDetail,
  2190. update,
  2191. findNodeTableByCondition as selectByNodeTable,
  2192. removeTableByCondition as removeTableById,
  2193. removePrivateTreeNode,
  2194. wbsTreePrivateTableSort,
  2195. privateSubmitFullName,
  2196. syncNodeParam,
  2197. syncProjecteVisa,
  2198. syncNodeTable,
  2199. syncNodeinfo,
  2200. tabTypeLazyTree,
  2201. syncContractTabSort,
  2202. linkNodeTree,
  2203. getLinekNodeTreelist,getNameRule,getTitleRange,saveOrUpdateNameRule,deletedNameRule,delTabInfoAll
  2204. } from "@/api/manager/wbsprivate";
  2205. import { findProjectTree as getAlltree } from "@/api/manager/projectinfo";
  2206. import { refrehPram } from "@/api/manager/wbstree";
  2207. import { getList as getAttchFromOriginalName } from "@/api/resource/attach";
  2208. import { getDictionary, getChildList } from "@/api/system/dict";
  2209. import { mapGetters } from "vuex";
  2210. import {
  2211. getList,
  2212. tabLazytreeAll,
  2213. saveLinkTab,
  2214. getExcelHtml,
  2215. } from "@/api/exctab/excelmodel";
  2216. import { getStore, setStore } from "@/util/store";
  2217. import { getTempProject,addSync,getNodeStatus,getById } from "@/api/manager/ledger";
  2218. import { selectByNodeTable as findNodeTableByCondition1 } from "@/api/manager/wbstree";
  2219. export default {
  2220. data() {
  2221. var checkMajorDataType = (rule, value, callback) => {
  2222. //console.log(this.nodeDetail.nodeType)
  2223. //console.log(this.nodeDetail.majorDataType)
  2224. if (this.nodeDetail.nodeType == 6) {
  2225. if (!this.nodeDetail.majorDataType) {
  2226. callback(new Error("工序节点必须选择内业资料类型"));
  2227. }
  2228. }
  2229. callback();
  2230. };
  2231. return {
  2232. isNodeType:true,
  2233. isRestoringSelection: false,
  2234. expandedKeysType: [],
  2235. defaultExpandedKeysType: [],
  2236. currentNodeKey: null, // 保存当前选中的节点key
  2237. fromcurNode: {},
  2238. formDatass: [],
  2239. editElementFormTag: false,
  2240. editeditElementFormMFLoading: false,
  2241. jiedianId: "",
  2242. //#region
  2243. sortTag: false,
  2244. sortTag2: false,
  2245. sureSortload: false,
  2246. surePrivateSortload: false,
  2247. sort: [],
  2248. //#endregion
  2249. //#region 关联清表
  2250. loading: false,
  2251. GLExcel: false,
  2252. GLExcelFrom: {
  2253. id: "",
  2254. name: "",
  2255. search: "", //搜素框舒服的值
  2256. ids: "",
  2257. excelId: "",
  2258. initTableName: "",
  2259. initTableId: "",
  2260. },
  2261. GLExcelData: [], //
  2262. GLExcelProps: {
  2263. label: "name",
  2264. children: "children",
  2265. disabled: "hasChildren",
  2266. isLeaf: function (data) {
  2267. let tag = false;
  2268. if (!data.hasChildren) {
  2269. tag = true;
  2270. }
  2271. if (data.isExistForm == 1) {
  2272. tag = true;
  2273. }
  2274. return tag;
  2275. },
  2276. },
  2277. exceldata: [], //清表模板
  2278. GLExcelLoading: false,
  2279. //#endregion
  2280. //#region 调整表单
  2281. adjustmentExcel: "",
  2282. excelHtml: false,
  2283. //#endregion
  2284. //#region
  2285. id: "",
  2286. projectid: "",
  2287. filterText: "",
  2288. filterText1: "",
  2289. isShowTree1:true,
  2290. treeData: [],
  2291. searchType: "1",
  2292. isSearch: false,
  2293. searchTreeData: [],
  2294. searchtreeLoad: false,
  2295. treeLoad: false,
  2296. isShowTree: true,
  2297. menuShow: false,
  2298. defaultProps: {
  2299. children: "children",
  2300. label: "title",
  2301. isLeaf: function (data) {
  2302. //console.log(data, !data.hasChildren, data.isExistForm);
  2303. let tag = false;
  2304. if (!data.hasChildren) {
  2305. tag = true;
  2306. }
  2307. /*if (data.isExistForm == 1) {
  2308. tag = true;
  2309. }*/
  2310. if (data.nodeType >= 6 && data.nodeType <= 13) {
  2311. tag = true;
  2312. }
  2313. //中间交工。开工报告、质量评定)
  2314. if (
  2315. data.majorDataType == 1 ||
  2316. data.majorDataType == 2 ||
  2317. data.majorDataType == 3
  2318. ) {
  2319. tag = true;
  2320. }
  2321. return tag;
  2322. // return !data.hasChildren || (data.isExistForm == 1);
  2323. },
  2324. },
  2325. defaultPropsByType:{
  2326. children: 'children',
  2327. label: 'title',
  2328. isLeaf:function (data) {
  2329. return !data.hasChildren
  2330. }
  2331. },
  2332. leftType: 5,
  2333. curTreeData: {},
  2334. curTreeNode: {},
  2335. tableData: [],
  2336. nodeDetail: {},
  2337. formData: [],
  2338. editType: 1,
  2339. dialogVisible: false,
  2340. saveNodeLoading: false,
  2341. nodeTypelist1: [],
  2342. majorDataTypeList: [],
  2343. rules: {
  2344. nodeName: [
  2345. { required: true, message: "请输入节点名称", trigger: "blur" },
  2346. ],
  2347. nodeType: [
  2348. { required: true, message: "请选择节点类型", trigger: "change" },
  2349. ],
  2350. majorDataType: [{ validator: checkMajorDataType, trigger: "change" }],
  2351. isAddConceal: [
  2352. {
  2353. required: true,
  2354. message: "请选择是否新增中隐藏",
  2355. trigger: "change",
  2356. },
  2357. ],
  2358. },
  2359. eleVisible: false,
  2360. tableTypelist: [],
  2361. dataTypeList: [],
  2362. ownerTypeList: [],
  2363. eleForm: {
  2364. elementList: [],
  2365. },
  2366. eleRules: {
  2367. nodeName: [
  2368. { required: true, message: "请输入表名称", trigger: "blur" },
  2369. ],
  2370. tableType: [
  2371. { required: true, message: "请选择表类型", trigger: "change" },
  2372. ],
  2373. tableOwner: [
  2374. { required: true, message: "请选择所属方", trigger: "change" },
  2375. ],
  2376. },
  2377. importVisible: false,
  2378. tempList: [],
  2379. curEleTable: {},
  2380. istableType: true,
  2381. editEleVisible: false,
  2382. editEleList: [],
  2383. eleReg: /(≥|≤|±|【】)?([^≥≤±【】]*)/,
  2384. editEleFormulaVisible: false,
  2385. isMeter: false,
  2386. formulaInput: "",
  2387. editEleListFilter: [],
  2388. editEleListAll: [],
  2389. importTemplateVisible: false,
  2390. fileUrl: "",
  2391. upFile: null,
  2392. importLoading: false,
  2393. nodeInfoVisible: false,
  2394. nodeInfoTable: [],
  2395. nodeInfoTableLoad: false,
  2396. namelist: [],
  2397. namelists: [],
  2398. delids: [],
  2399. infoNameVisible: false,
  2400. excelSortTag: false,
  2401. excelSortTag2: false,
  2402. tableSortList: [],
  2403. //#endregion
  2404. defaultExpandedKeys: [],
  2405. expandName: this.$route.fullPath,
  2406. aliasVisible: false, //别名
  2407. aliasInput: "",
  2408. aliasArr: [],
  2409. formulaCompVisible: false, //公式弹框
  2410. formulaCompVisible1: false,
  2411. formulaCurRow: {}, //当前元素
  2412. editElementVisible: false, //编辑元素弹框
  2413. editElementQuery: {
  2414. pkeyId: "",
  2415. excelId: "",
  2416. id: "",
  2417. initTableName: "",
  2418. initTableId: "",
  2419. pid: "",
  2420. wbsid: "",
  2421. nodeid: "",
  2422. }, //传参
  2423. syncBtnLoad: false,
  2424. syncElectricLoad: false,
  2425. showType: 1,
  2426. typeTreeData: [],
  2427. testTreeLoad: false,
  2428. testTreeData: [],
  2429. mixRatioTestIds: [],
  2430. //节点参数,关联元素
  2431. curParam: {}, //当前节点参数
  2432. linkEleVisible: false,
  2433. linkEleTableList: [], //元素表数组
  2434. curLinkEleTable: {}, //当前元素表
  2435. linkCheckVisible: false, //关联弹框
  2436. linkEleList: [], //元素数组
  2437. linkEleKey: "", //搜索关键字
  2438. menusData: [
  2439. // {icon: 'el-icon-s-promotion', label: '新增节点', key: "add"},
  2440. {
  2441. icon: "el-icon-s-promotion",
  2442. label: "编辑节点",
  2443. key: "edit",
  2444. content: "编辑节点",
  2445. },
  2446. {
  2447. icon: "el-icon-upload",
  2448. label: "后管数据同步",
  2449. key: "sync1",
  2450. content: "后管数据同步",
  2451. },
  2452. {
  2453. icon: "el-icon-upload",
  2454. label: "同步到合同段",
  2455. key: "sync3",
  2456. content: "同步到合同段",
  2457. },
  2458. {
  2459. icon: "el-icon-sort",
  2460. label: "调整排序",
  2461. key: "sort",
  2462. content: "调整排序",
  2463. },
  2464. {
  2465. icon: "el-icon-s-promotion",
  2466. label: "删除节点",
  2467. key: "del",
  2468. content: "删除节点",
  2469. },
  2470. ], //树组件操作菜单
  2471. menuvisible: false,
  2472. menuleft: 20,
  2473. menutop: 0,
  2474. //同步菜单按钮
  2475. menuoptions: [
  2476. {
  2477. value: "jdSync",
  2478. label: "节点参数同步",
  2479. load: false,
  2480. },
  2481. {
  2482. value: "dqSync",
  2483. label: "电签同步",
  2484. load: false,
  2485. },
  2486. {
  2487. value: "gsSync",
  2488. label: "公式同步",
  2489. load: false,
  2490. },
  2491. // {
  2492. // value: "zdSync",
  2493. // label: "字典同步",
  2494. // load: false,
  2495. // },
  2496. ],
  2497. menuvalue: "",
  2498. isshowSyncbtn: false,
  2499. projectName: "",
  2500. nodeInfoSaveload: false,
  2501. handlesyncLoad: false, //表单同步
  2502. isLinkNodes: false,
  2503. linkNodesLoad: false,
  2504. checkedLinkNodesKeys: [],
  2505. rowPkeyId: "",
  2506. nodesCheck: [],
  2507. standardTypeOptions: [], //标准分类
  2508. unitOptions: [], //单位名称
  2509. editDialogShow: false, //编辑元素
  2510. searchinput: "",
  2511. editTable: [],
  2512. editEleTableloading: false,
  2513. dynamicDictList: [],
  2514. saveLoading: false,
  2515. fileTitleVisible:false,
  2516. deCheckTreeKeys:[],
  2517. fileTableData:[
  2518. ],
  2519. fileTitleRef:null,
  2520. fileTitleModel:{
  2521. type:'',
  2522. },
  2523. fileTreeLoading:false,
  2524. fileTreeData:[],
  2525. filedefaultProps:{
  2526. children: 'children',
  2527. label: 'nodeName',
  2528. disabled:function (data) {
  2529. return data.status===11 ;
  2530. },
  2531. },
  2532. fileTitleRules:{
  2533. type: [
  2534. { required: true, message: '请选择题名范围', trigger: 'blur' },
  2535. ],
  2536. },
  2537. fileTableLoading:false,
  2538. chooseFileVisible:false,
  2539. chooseFileRow: {},
  2540. chooseFileIndex: -1,
  2541. isShowSize:true,
  2542. selectDiv:Math.random(),
  2543. saveFileLoading:false,
  2544. proSyncTag:false,
  2545. rangeOptions:[],
  2546. typeOptions:[],
  2547. checkAll: false,
  2548. checkAll1: false,
  2549. isIndeterminate: false,
  2550. isIndeterminate1: false,
  2551. syncForm:{
  2552. range:'',
  2553. rangeName:'',
  2554. type:[],
  2555. typeName:'',
  2556. templateId:'',
  2557. templateName:'',
  2558. contractRange:[],
  2559. contractRangeName:'',
  2560. formIds:''
  2561. },
  2562. preTableData:[],
  2563. multipleSelection: [],
  2564. checkIdList:[
  2565. ],
  2566. isShowLeft:false,
  2567. isShowTable:false,
  2568. templateIdList:[],//同步源
  2569. saveProTagLoading:false,
  2570. syncTableDialog:false,
  2571. preTableData1:[],
  2572. formIds:'',
  2573. saveTableSyncLoad:false,
  2574. checkRow:null,
  2575. syncListDialog:false,
  2576. refreshLoading:false,
  2577. syncListData:{
  2578. nodeNum:'',//同步节点数量
  2579. nodeNumEnd:''//已同步数量
  2580. },
  2581. isAdd:'',
  2582. refreshLoading1:false,
  2583. codeDialog:false,
  2584. codeSetRef: null,
  2585. typeTem:'',
  2586. isShowTree1:true,
  2587. cachedNodes: new Map(), // 缓存已加载的节点数据
  2588. };
  2589. },
  2590. computed: {
  2591. ...mapGetters(["userInfo"]),
  2592. },
  2593. created() {
  2594. this.init();
  2595. // 尝试恢复之前选中的节点
  2596. // // 尝试恢复之前的状态
  2597. // this.restoreTreeState();
  2598. // 从本地存储恢复展开的keys
  2599. // const savedExpandedKeys = JSON.parse(localStorage.getItem('treeExpandedKeys') || '[]');
  2600. // this.defaultExpandedKeysType = savedExpandedKeys;
  2601. },
  2602. methods: {
  2603. //#region
  2604. changeType(val){
  2605. console.log(val,'val');
  2606. this.isNodeType=val
  2607. this.formData=[]
  2608. localStorage.setItem('isNodeType',val);
  2609. this.filterText1=''
  2610. },
  2611. init() {
  2612. //this.id = this.$route.query.wbsid;
  2613. //this.projectid = this.$route.query.pid;
  2614. const { wbsid, pid, type } = this.$route.query;
  2615. this.id = wbsid;
  2616. this.projectid = pid;
  2617. this.wbsType = type ? Number(type) : 1;
  2618. this.getNodeTypelistData()
  2619. this.getNodeTypelist();
  2620. this.getTableTypelist();
  2621. this.getDataTypelist();
  2622. this.getOwnerTypelist();
  2623. this.getStandardTypeOptions();
  2624. this.getMajorDataTypeList();
  2625. this.defaultExpandedKeys = getStore({ name: this.expandName });
  2626. this.projectName = this.$route.query.projectName;
  2627. },
  2628. loadNode(node, resolve) {
  2629. let pid = 0;
  2630. if (node.level != 0) {
  2631. pid = node.data.id;
  2632. }
  2633. const type = this.wbsType;
  2634. getLazytree(this.id, pid, this.userInfo.tenant_id, this.projectid, {
  2635. wbsType: type,
  2636. }).then((res) => {
  2637. let arr = [];
  2638. if (Array.isArray(res.data.data)) {
  2639. arr = res.data.data;
  2640. }
  2641. return resolve(arr);
  2642. });
  2643. },
  2644. // 在 loadNodeByType 中恢复选中状态
  2645. loadNodeByType(node, resolve) {
  2646. // 如果有缓存且不是根节点,直接返回缓存
  2647. if (node.level !== 0 && this.cachedNodes.has(node.data.id)) {
  2648. return resolve(this.cachedNodes.get(node.data.id));
  2649. }
  2650. let pid = 12345678910;
  2651. if (node.level != 0) {
  2652. pid = node.data.id;
  2653. }
  2654. getTreeByType({
  2655. parentId: pid,
  2656. projectId: this.projectid,
  2657. current: 1,
  2658. size: 1000,
  2659. titleName: this.filterText1
  2660. }).then((res) => {
  2661. let arr = [];
  2662. if (Array.isArray(res.data.data['records'])) {
  2663. arr = res.data.data['records'];
  2664. }
  2665. resolve(arr);
  2666. // 恢复选中状态
  2667. this.$nextTick(() => {
  2668. if (this.currentNodeKey) {
  2669. this.$refs.treeByType.setCurrentKey(this.currentNodeKey);
  2670. }
  2671. });
  2672. }).catch(error => {
  2673. console.error('加载树节点失败:', error);
  2674. resolve([]);
  2675. });
  2676. },
  2677. saveTreeState() {
  2678. const tree = this.$refs.treeByType;
  2679. if (!tree) return;
  2680. // 保存当前选中节点
  2681. this.currentNodeKey = tree.getCurrentKey();
  2682. // 保存所有展开节点
  2683. this.defaultExpandedKeysType = [];
  2684. const traverse = (node) => {
  2685. if (node.expanded && node.data) {
  2686. this.defaultExpandedKeysType.push(node.data.id);
  2687. }
  2688. if (node.childNodes) {
  2689. node.childNodes.forEach(traverse);
  2690. }
  2691. };
  2692. traverse(tree.store.root);
  2693. },
  2694. // 节点展开时保存状态
  2695. handleNodeExpand(data) {
  2696. if (!this.defaultExpandedKeysType.includes(data.id)) {
  2697. this.defaultExpandedKeysType.push(data.id);
  2698. }
  2699. },
  2700. // 节点折叠时更新状态
  2701. handleNodeCollapse(data) {
  2702. const index = this.defaultExpandedKeysType.indexOf(data.id);
  2703. if (index > -1) {
  2704. this.defaultExpandedKeysType.splice(index, 1);
  2705. }
  2706. },
  2707. getNodeDetail(data, node) {
  2708. console.log("getNodeDetail", data);
  2709. let parentName = "";
  2710. if (node.parent.data) {
  2711. parentName = node.parent.data.title;
  2712. }
  2713. this.curTreeData = data;
  2714. this.curTreeNode = node;
  2715. this.curTreeData.parentName = parentName;
  2716. getDetail(data.id, this.id, this.projectid).then((res) => {
  2717. res.data.data.parentName = parentName;
  2718. let tableObj=res.data.data;
  2719. tableObj.primaryKeyId=data.primaryKeyId
  2720. this.tableData = [res.data.data];
  2721. this.nodeDetail = Object.assign({}, res.data.data);
  2722. });
  2723. this.updateNodeTable();
  2724. // this.nodeTypeChange(data.nodeType)
  2725. //获取节点展开路径
  2726. this.getExpandedKeys(node);
  2727. },
  2728. getNodeDetailByType(data, node) {
  2729. console.log(data, 'data');
  2730. // 保存当前选中的节点
  2731. this.currentNodeKey = data.id;
  2732. this.curTreeData = data;
  2733. this.curTreeNode = node;
  2734. data.tableName = data.title;
  2735. this.formData = [data];
  2736. // 只存储node对象中的必要信息,避免循环引用
  2737. const nodeInfo = {
  2738. id: node.data.id,
  2739. label: node.label,
  2740. level: node.level,
  2741. isLeaf: node.isLeaf,
  2742. expanded: node.expanded,
  2743. // 其他你需要的属性
  2744. };
  2745. localStorage.setItem('lastDataNode', JSON.stringify(nodeInfo));
  2746. },
  2747. saveNode() {
  2748. const type = this.wbsType;
  2749. this.$refs["nodeDetail"].validate((valid) => {
  2750. if (valid) {
  2751. const { mixRatioTestIds, nodeType } = this.nodeDetail;
  2752. if (type === 2 && nodeType === 53) {
  2753. if (mixRatioTestIds) {
  2754. if (this.editType == 1) {
  2755. this.addNode();
  2756. } else if (this.editType == 2) {
  2757. this.updateNode();
  2758. }
  2759. } else {
  2760. this.$message({
  2761. type: "error",
  2762. message: "请先选择节点",
  2763. });
  2764. return false;
  2765. }
  2766. } else {
  2767. if (this.editType == 1) {
  2768. this.addNode();
  2769. } else if (this.editType == 2) {
  2770. this.updateNode();
  2771. }
  2772. }
  2773. } else {
  2774. console.log("error submit!!");
  2775. return false;
  2776. }
  2777. });
  2778. },
  2779. addNode() {
  2780. this.saveNodeLoading = true;
  2781. update(this.nodeDetail).then(() => {
  2782. this.updateTreeNewNode();
  2783. this.dialogVisible = false;
  2784. this.$message({
  2785. type: "success",
  2786. message: "新增成功!",
  2787. });
  2788. });
  2789. },
  2790. updateNode() {
  2791. update(this.nodeDetail).then(() => {
  2792. let node = this.tableData[0];
  2793. node.nodeName = this.nodeDetail.nodeName;
  2794. node.nodeType = this.nodeDetail.nodeType;
  2795. this.curTreeData.title = this.nodeDetail.nodeName;
  2796. this.dialogVisible = false;
  2797. this.$message({
  2798. type: "success",
  2799. message: "修改成功!",
  2800. });
  2801. });
  2802. },
  2803. toSplit(val) {
  2804. return val ? String(val).split(",") : "";
  2805. },
  2806. setLeftType(type, data, node) {
  2807. this.jiedianId = data.id;
  2808. this.getNodeTypelistData()
  2809. if (type == 4 || type == 5) {
  2810. this.leftType = type;
  2811. }
  2812. this.curTreeData = data;
  2813. this.curTreeNode = node;
  2814. this.$refs.tree.setCurrentKey(data.id);
  2815. if (type == 1 || type == 2) {
  2816. this.getMajorDataTypeList();
  2817. this.dialogVisible = true;
  2818. this.editType = type;
  2819. }
  2820. getDetail(data.id, this.id, this.projectid).then((res) => {
  2821. let parentName = "";
  2822. if (node.parent.data) {
  2823. parentName = node.parent.data.title;
  2824. }
  2825. res.data.data.parentName = parentName;
  2826. this.tableData = [res.data.data];
  2827. if (type == 1) {
  2828. this.nodeDetail = {
  2829. parentId: res.data.data.id,
  2830. parentName: parentName,
  2831. projectId: res.data.data.projectId,
  2832. };
  2833. } else {
  2834. this.nodeDetail = Object.assign({}, res.data.data);
  2835. this.mixRatioTestIds = this.toSplit(res.data.data.mixRatioTestIds);
  2836. }
  2837. this.nodeDetail.type = 1; // '1'节点 '2'表单
  2838. this.nodeDetail.wbsId = this.id;
  2839. this.nodeDetail.tenantId = this.userInfo.tenant_id;
  2840. this.changeStandType(this.nodeDetail.className);
  2841. });
  2842. if (this.leftType == 4) {
  2843. selectByNodeTable(data.id, this.projectid, this.id).then((res) => {
  2844. if (res.data.data.length) {
  2845. this.formData = res.data.data;
  2846. } else {
  2847. this.formData = [];
  2848. }
  2849. });
  2850. }
  2851. //获取节点展开路径
  2852. this.getExpandedKeys(node);
  2853. },
  2854. showFormElement() {
  2855. if (!this.nodeDetail.id) {
  2856. this.$message({
  2857. type: "warning",
  2858. message: "请先选择在哪个节点下创建表",
  2859. });
  2860. return;
  2861. }
  2862. this.eleVisible = true;
  2863. },
  2864. addEleRow(list) {
  2865. list.push({});
  2866. },
  2867. delEleRow(index, list) {
  2868. list.splice(index, 1);
  2869. },
  2870. saveFormAndElementHandle() {
  2871. this.$refs["eleDialog"].validate((valid) => {
  2872. if (valid) {
  2873. this.eleForm.wbsId = this.id;
  2874. this.eleForm.tenantId = this.userInfo.tenant_id;
  2875. this.eleForm.nodeType = -1;
  2876. this.eleForm.type = 2; // '1'节点 '2'表单
  2877. this.eleForm.parentId = this.nodeDetail.id;
  2878. this.eleForm.elementList.forEach((element) => {
  2879. element.eAllowDeviation =
  2880. (element.allow ? element.allow : "") +
  2881. (element.deviation ? element.deviation : "");
  2882. if (element.eType == 4) {
  2883. element.eLength = 0;
  2884. }
  2885. });
  2886. saveFormAndElement(this.eleForm).then(() => {
  2887. //console.log(res)
  2888. this.updateTreeNewNode();
  2889. this.updateNodeTable();
  2890. this.eleVisible = false;
  2891. this.$message({
  2892. type: "success",
  2893. message: "新增成功!",
  2894. });
  2895. });
  2896. } else {
  2897. console.log("error submit!!");
  2898. return false;
  2899. }
  2900. });
  2901. },
  2902. updateTreeNewNode() {
  2903. getLazytree(
  2904. this.id,
  2905. this.nodeDetail.parentId,
  2906. this.userInfo.tenant_id,
  2907. this.projectid
  2908. ).then((res) => {
  2909. this.$refs.tree.updateKeyChildren(
  2910. this.nodeDetail.parentId,
  2911. res.data.data
  2912. );
  2913. });
  2914. },
  2915. updateNodeTable() {
  2916. if(this.isNodeType){
  2917. selectByNodeTable( this.curTreeData.id, this.projectid, this.id).then(
  2918. (res) => {
  2919. if (res.data.data && res.data.data.length) {
  2920. this.formData = res.data.data;
  2921. this.formData.forEach((ele) => {
  2922. ele.nodeType = Number(ele.nodeType);
  2923. });
  2924. } else {
  2925. this.formData = [];
  2926. }
  2927. }
  2928. );
  2929. }else{
  2930. console.log(8888888);
  2931. this.reloadEntireTree();
  2932. }
  2933. },
  2934. async reloadEntireTree() {
  2935. this.isNodeType = false;
  2936. // 1. 获取树组件引用和当前选中节点
  2937. const tree = this.$refs.treeByType;
  2938. if (!tree) return;
  2939. const currentKey = tree.getCurrentKey();
  2940. const currentPath = [];
  2941. // 2. 收集当前选中节点的路径和所有展开节点
  2942. const allExpandedNodes = [];
  2943. const traverseTree = (node) => {
  2944. if (node.expanded && node.level > 0) {
  2945. allExpandedNodes.push({
  2946. id: node.data.id,
  2947. node: node
  2948. });
  2949. }
  2950. if (node.childNodes) {
  2951. node.childNodes.forEach(traverseTree);
  2952. }
  2953. };
  2954. traverseTree(tree.store.root);
  2955. // 3. 获取选中节点的完整路径
  2956. if (currentKey) {
  2957. const currentNode = tree.getNode(currentKey);
  2958. if (currentNode) {
  2959. let parent = currentNode.parent;
  2960. while (parent && parent.level > 0) {
  2961. currentPath.unshift(parent.data.id);
  2962. parent = parent.parent;
  2963. }
  2964. currentPath.push(currentKey); // 包含当前节点本身
  2965. }
  2966. }
  2967. // 4. 清空缓存
  2968. this.cachedNodes.clear();
  2969. // 5. 强制重新加载当前路径上的所有节点
  2970. for (const nodeId of currentPath) {
  2971. const node = tree.getNode(nodeId);
  2972. if (node) {
  2973. node.loaded = false; // 标记为需要重新加载
  2974. // 从缓存中移除
  2975. this.cachedNodes.delete(nodeId);
  2976. }
  2977. }
  2978. // 6. 关闭所有非当前路径的展开节点
  2979. allExpandedNodes.forEach(({id, node}) => {
  2980. if (!currentPath.includes(id)) {
  2981. node.expanded = false;
  2982. node.loaded = false; // 标记为需要重新加载
  2983. this.cachedNodes.delete(id);
  2984. }
  2985. });
  2986. // 7. 重新加载根节点
  2987. const rootNode = tree.store.root;
  2988. const rootId = rootNode.childNodes[0].data.id || 'root';
  2989. await this.$nextTick();
  2990. tree.updateKeyChildren(rootId, []);
  2991. const root = tree.getNode(rootId);
  2992. if (root) {
  2993. root.loaded = false;
  2994. root.expand();
  2995. }
  2996. // 8. 等待树重新加载完成
  2997. await new Promise(resolve => {
  2998. const checkLoaded = () => {
  2999. if (root.loaded) {
  3000. resolve();
  3001. } else {
  3002. setTimeout(checkLoaded, 50);
  3003. }
  3004. };
  3005. checkLoaded();
  3006. });
  3007. // 9. 重新展开当前路径
  3008. this.defaultExpandedKeysType = [...currentPath];
  3009. for (const nodeId of currentPath) {
  3010. const node = tree.getNode(nodeId);
  3011. if (node && !node.expanded) {
  3012. node.expand();
  3013. // 等待节点加载
  3014. await new Promise(resolve => {
  3015. const checkNodeLoaded = () => {
  3016. if (node.loaded) {
  3017. resolve();
  3018. } else {
  3019. setTimeout(checkNodeLoaded, 50);
  3020. }
  3021. };
  3022. checkNodeLoaded();
  3023. });
  3024. }
  3025. }
  3026. // 10. 恢复选中状态
  3027. if (currentKey) {
  3028. // 检查节点是否仍然存在
  3029. const currentNode = tree.getNode(currentKey);
  3030. if (currentNode) {
  3031. tree.setCurrentKey(currentKey);
  3032. this.currentNodeData = currentNode.data;
  3033. this.formData = [{
  3034. ...this.currentNodeData,
  3035. tableName: this.currentNodeData.title
  3036. }];
  3037. } else {
  3038. // 节点已被删除
  3039. this.currentNodeKey = null;
  3040. this.currentNodeData = null;
  3041. this.formData = [];
  3042. // this.$message.warning('当前选中节点已被删除');
  3043. }
  3044. }
  3045. },
  3046. // 关闭所有非路径上的展开节点
  3047. closeOtherExpandedNodes(tree, keepOpenPath) {
  3048. const closeNodes = (node) => {
  3049. if (node.expanded && node.level > 0) {
  3050. const nodeId = node.data.id;
  3051. // 如果节点不在需要保持展开的路径中,则关闭它
  3052. if (!keepOpenPath.includes(nodeId)) {
  3053. node.expanded = false;
  3054. }
  3055. }
  3056. if (node.childNodes) {
  3057. node.childNodes.forEach(closeNodes);
  3058. }
  3059. };
  3060. // 从根节点开始遍历
  3061. closeNodes(tree.store.root);
  3062. },
  3063. deleNode(data, node) {
  3064. let pid = data.primaryKeyId ? data.primaryKeyId : data.pKeyId;
  3065. this.$confirm(
  3066. "此操作将删除节点【" + data.title + "】, 是否继续?",
  3067. "提示",
  3068. {
  3069. confirmButtonText: "确定",
  3070. cancelButtonText: "取消",
  3071. type: "warning",
  3072. }
  3073. )
  3074. .then(() => {
  3075. removePrivateTreeNode(pid).then(() => {
  3076. this.$refs.tree.remove(node);
  3077. this.$message({
  3078. type: "success",
  3079. message: "删除成功!",
  3080. });
  3081. });
  3082. })
  3083. .catch(() => {});
  3084. },
  3085. // 重新加载整棵树
  3086. importHandle() {},
  3087. handlePreview(index, row) {
  3088. this.curEleTable = row;
  3089. if(!this.curEleTable.initTableId){
  3090. this.$message({ type: "warning", message: '请先关联清表' })
  3091. return
  3092. }
  3093. selectPrivateFormElements(this.curEleTable.initTableId).then((res) => {
  3094. res.data.data.forEach((element) => {
  3095. this.eleReg.exec(element.eAllowDeviation);
  3096. element.allow = RegExp.$1 ? RegExp.$1 : "";
  3097. element.deviation = RegExp.$2 ? RegExp.$2 : "";
  3098. });
  3099. this.editEleList = res.data.data;
  3100. });
  3101. this.editEleVisible = true;
  3102. },
  3103. //关联节点
  3104. handleLinkNodes(index, row) {
  3105. this.rowPkeyId = row.pkeyId;
  3106. this.linkNodesLoad = false;
  3107. this.isLinkNodes = true;
  3108. getLinekNodeTreelist(row.pkeyId)
  3109. .then(({ data }) => {
  3110. const res = data.data;
  3111. if (res instanceof Array) {
  3112. this.checkedLinkNodesKeys = res;
  3113. } else {
  3114. this.checkedLinkNodesKeys = [];
  3115. }
  3116. })
  3117. .catch(() => {
  3118. this.checkedLinkNodesKeys = [];
  3119. });
  3120. },
  3121. //确定关联
  3122. linkNodesSave() {
  3123. const keys = this.$refs.tree2.getCheckedKeys();
  3124. // if (keys.length <= 0) {
  3125. // this.$message({
  3126. // type: "warning",
  3127. // message: "请先勾选节点",
  3128. // });
  3129. // return;
  3130. // }
  3131. const pkeyId = this.rowPkeyId;
  3132. this.linkNodesLoad = true;
  3133. linkNodeTree(keys.length >0?keys.join(","):'', pkeyId)
  3134. .then(() => {
  3135. this.$message({
  3136. type: "success",
  3137. message: "关联成功!",
  3138. });
  3139. this.linkNodesLoad = false;
  3140. this.linkNodesClose();
  3141. })
  3142. .catch(() => {
  3143. this.linkNodesLoad = false;
  3144. });
  3145. },
  3146. //关闭关联弹窗
  3147. linkNodesClose() {
  3148. this.isLinkNodes = false;
  3149. this.linkNodesLoad = false;
  3150. this.checkedLinkNodesKeys = [];
  3151. this.nodesCheck = [];
  3152. this.rowPkeyId = "";
  3153. },
  3154. handleDelete(index, row) {
  3155. this.$confirm("是否删除 " + row.tableName + " ?", "删除元素表", {
  3156. distinguishCancelAndClose: true,
  3157. confirmButtonText: "删除",
  3158. cancelButtonText: "取消",
  3159. }).then(() => {
  3160. if(this.isNodeType){
  3161. removeTableById(row.id, this.projectid, this.id).then(() => {
  3162. this.formData.splice(index, 1);
  3163. this.$message({
  3164. type: "success",
  3165. message: "删除成功!",
  3166. });
  3167. });
  3168. }else{
  3169. delTabInfoAll(row.pkeyId).then(() => {
  3170. this.formData.splice(index, 1);
  3171. this.$message({
  3172. type: "success",
  3173. message: "删除成功!",
  3174. });
  3175. });
  3176. }
  3177. });
  3178. },
  3179. async hideMD(row) {
  3180. //隐藏按钮
  3181. const code = await this.updateStatus(row.pkeyId, row.status);
  3182. if (code == 200) {
  3183. if (row.status == 0) {
  3184. row.status = 1;
  3185. } else {
  3186. row.status = 0;
  3187. }
  3188. }
  3189. },
  3190. async updateStatus(pKeyId, status) {
  3191. //隐藏功能激活
  3192. const { data: res } = await updateStatus({ pKeyId });
  3193. if (res.code == 200) {
  3194. this.$message({
  3195. type: "success",
  3196. message: status == 1 ? "隐藏成功" : "激活成功",
  3197. });
  3198. }
  3199. return res.code;
  3200. },
  3201. handleEditFormula(index, row) {
  3202. this.curEleTable = row;
  3203. selectFormElements(this.curEleTable.pkeyId, { type: 0 }).then((res) => {
  3204. this.editEleListFilter = res.data.data;
  3205. this.editEleListAll = [].concat(this.editEleListFilter);
  3206. });
  3207. this.editEleFormulaVisible = true;
  3208. },
  3209. //表单同步
  3210. handlesync(index, row) {
  3211. },
  3212. //搜索 筛选
  3213. searchFormulaName() {
  3214. this.editEleListFilter = this.editEleListAll.filter((ele) => {
  3215. return ele.eName.indexOf(this.formulaInput) > -1;
  3216. });
  3217. },
  3218. saveNewEle(row) {
  3219. row.eAllowDeviation =
  3220. (row.allow ? row.allow : "") + (row.deviation ? row.deviation : "");
  3221. row.fId = this.curEleTable.initTableId;
  3222. row.initTableName = this.curEleTable.initTableName;
  3223. if (row.eType == 4) {
  3224. row.eLength = 0;
  3225. }
  3226. saveElement(row).then((res) => {
  3227. if (res.data.data) {
  3228. this.$set(row, "id", res.data.data.id);
  3229. this.$set(row, "ekey", res.data.data.ekey);
  3230. this.$message({
  3231. type: "success",
  3232. message: "保存成功!",
  3233. });
  3234. }
  3235. });
  3236. },
  3237. delEleRowHandle(index, list) {
  3238. let row = list[index];
  3239. if (row.id) {
  3240. //有id需要请求删除
  3241. this.$confirm("是否确认删除?", "删除元素", {
  3242. distinguishCancelAndClose: true,
  3243. confirmButtonText: "删除",
  3244. cancelButtonText: "取消",
  3245. }).then(() => {
  3246. removeElement(row.id, this.curEleTable.initTableName, row.ekey).then(
  3247. () => {
  3248. list.splice(index, 1);
  3249. }
  3250. );
  3251. });
  3252. } else {
  3253. list.splice(index, 1);
  3254. }
  3255. },
  3256. nodeTypeChange(val) {
  3257. console.log(333333333);
  3258. if (val === 53) {
  3259. // if (this.testTreeData.length > 0) {
  3260. // return;
  3261. // }
  3262. this.testTreeLoad = true;
  3263. // getAlltreeTrial(this.projectid, this.id, this.curTreeData.primaryKeyId).then((res) => {
  3264. // this.testTreeLoad = false;
  3265. // console.log(res.data.data,'data');
  3266. // let trialdata=res.data.data
  3267. // if(trialdata&&trialdata.allTree){
  3268. // this.testTreeData = trialdata.allTree[0];
  3269. // if(trialdata.allStatusIds.length>0){
  3270. // //设置勾选相关联试验全选
  3271. // this.mixRatioTestIds =trialdata.allStatusIds[0];
  3272. // }
  3273. // }
  3274. // });
  3275. let pid = this.curTreeData.primaryKeyId
  3276. ? this.curTreeData.primaryKeyId
  3277. : this.curTreeData.pKeyId;
  3278. getAlltree(this.projectid, this.id, pid).then((res) => {
  3279. this.testTreeLoad = false;
  3280. console.log(res.data.data, "data");
  3281. this.testTreeData = res.data.data;
  3282. });
  3283. }
  3284. },
  3285. //根据逗号联合
  3286. toJoin(arr) {
  3287. return arr ? arr.join() : "";
  3288. },
  3289. TestTreeCheckChange(_, { checkedKeys, halfCheckedKeys }) {
  3290. // const newarr = [...checkedKeys, ...halfCheckedKeys];
  3291. const newarr = [...checkedKeys];
  3292. this.nodeDetail.mixRatioTestIds = this.toJoin(newarr);
  3293. },
  3294. // filterChange() {
  3295. // if (this.treeData.length > 0) {
  3296. // this.$refs.treeall.filter(this.filterText);
  3297. // return;
  3298. // }
  3299. // this.treeLoad = true;
  3300. // getAlltree(this.projectid, this.id).then((res) => {
  3301. // this.treeLoad = false;
  3302. // this.treeData = res.data.data;
  3303. // console.log(res.data.data,'res.data.data');
  3304. // this.$nextTick(() => {
  3305. // this.$refs.treeall.filter(this.filterText);
  3306. // });
  3307. // });
  3308. // },
  3309. //搜索树
  3310. //搜索树
  3311. searchTreeClick() {
  3312. if (this.filterText.length > 0) {
  3313. this.isSearch = true;
  3314. this.searchtreeLoad = true;
  3315. getQueryValueByType({
  3316. queryValue: this.filterText,
  3317. type: this.searchType,
  3318. wbsId: this.id,
  3319. projectId: this.projectid,
  3320. }).then((res) => {
  3321. let arr = [];
  3322. if (Array.isArray(res.data.data)) {
  3323. arr = res.data.data;
  3324. this.searchTreeData = arr;
  3325. } else {
  3326. this.searchTreeData = [];
  3327. }
  3328. });
  3329. } else {
  3330. this.isSearch = false;
  3331. }
  3332. this.searchtreeLoad = false;
  3333. },
  3334. searchTreeClick1() {
  3335. if(!this.curTreeData.hasChildren){
  3336. this.$message.warning('请先选择一个父节点');
  3337. return;
  3338. }
  3339. // if (!this.filterText1.trim()) {
  3340. // this.$message.warning('请输入搜索内容');
  3341. // return;
  3342. // }
  3343. // 保存当前状态
  3344. // 保存当前状态
  3345. this.saveTreeState();
  3346. // 清空缓存
  3347. this.cachedNodes.clear();
  3348. // 重新加载选中节点及其子节点
  3349. this.reloadSelectedNode();
  3350. },
  3351. // 清空搜索
  3352. clearSearch1() {
  3353. this.filterText1 = '';
  3354. this.searchTreeClick1();
  3355. },
  3356. // 重新加载选中节点
  3357. async reloadSelectedNode() {
  3358. const tree = this.$refs.treeByType;
  3359. if (!tree || !this.currentNodeKey) return;
  3360. // 获取当前节点
  3361. const currentNode = tree.getNode(this.currentNodeKey);
  3362. if (!currentNode) return;
  3363. // 标记为未加载,强制重新加载
  3364. currentNode.loaded = false;
  3365. currentNode.expand(); // 这会触发loadNodeByType
  3366. // 恢复状态
  3367. await this.$nextTick();
  3368. tree.setCurrentKey(this.currentNodeKey);
  3369. },
  3370. // 重新加载树
  3371. reloadTree() {
  3372. const tree = this.$refs.treeByType;
  3373. if (!tree) return;
  3374. // 清空根节点
  3375. const rootNode = tree.store.root;
  3376. const rootId = rootNode.childNodes[0].data.id || 'root';
  3377. tree.updateKeyChildren(rootId, []);
  3378. // 强制重新加载根节点
  3379. const root = tree.getNode(rootId);
  3380. if (root) {
  3381. root.loaded = false;
  3382. root.expand();
  3383. }
  3384. // 恢复状态
  3385. this.$nextTick(() => {
  3386. if (this.currentNodeKey) {
  3387. tree.setCurrentKey(this.currentNodeKey);
  3388. }
  3389. });
  3390. },
  3391. // 刷新树数据
  3392. filterSearchClick(){
  3393. this.isSearch = true;
  3394. this.searchtreeLoad = true;
  3395. getQueryValueByNodeType({
  3396. queryValue: this.filterText,
  3397. wbsId: this.id,
  3398. projectId: this.projectid,
  3399. }).then((res) => {
  3400. let arr = [];
  3401. if (Array.isArray(res.data.data)) {
  3402. arr = res.data.data;
  3403. this.searchTreeData = arr;
  3404. } else {
  3405. this.searchTreeData = [];
  3406. }
  3407. });
  3408. this.searchtreeLoad = false;
  3409. },
  3410. clearSearch() {
  3411. this.isSearch = false;
  3412. },
  3413. importTemplate(data) {
  3414. this.importTemplateVisible = true;
  3415. this.curTreeData = data;
  3416. if (!this.fileUrl) {
  3417. getAttchFromOriginalName(1, 20, {
  3418. originalName: "WBS划分模板.xls",
  3419. }).then((res) => {
  3420. if (res.data.data.records.length) {
  3421. this.fileUrl = res.data.data.records[0].link;
  3422. } else {
  3423. this.fileUrl = "";
  3424. }
  3425. });
  3426. }
  3427. },
  3428. importTemplateHandle() {
  3429. if (!this.upFile) {
  3430. this.$message({
  3431. type: "warning",
  3432. message: "请先选择文件再进行导入",
  3433. });
  3434. return;
  3435. }
  3436. let forms = new FormData();
  3437. forms.append("excelFile", this.upFile);
  3438. let wbsTreeFu = {
  3439. wbsId: this.id,
  3440. parentId: this.curTreeData.id,
  3441. // ancestors:'0,'+this.curTreeData.id,
  3442. };
  3443. let json = JSON.stringify(wbsTreeFu);
  3444. let blob = new Blob([json], { type: "application/json" });
  3445. forms.append("wbsTreeFu", blob);
  3446. this.importLoading = true;
  3447. importWbsTree(forms)
  3448. .then(() => {
  3449. //this.$router.go(0)
  3450. let node = this.$refs.tree.getNode(this.curTreeData.id);
  3451. node.isLeaf = false;
  3452. this.importTemplateVisible = false;
  3453. this.upFile = null;
  3454. })
  3455. .finally(() => {
  3456. this.importLoading = false;
  3457. });
  3458. },
  3459. handleDownload() {
  3460. if (this.fileUrl) {
  3461. window.open(this.fileUrl);
  3462. } else {
  3463. this.$message({
  3464. type: "warning",
  3465. message: "请先在附件管理上传【WBS划分模板.xls】文件",
  3466. });
  3467. }
  3468. },
  3469. fileClick() {
  3470. this.$refs.file.click();
  3471. },
  3472. fileChange(e) {
  3473. const file = e.target.files[0];
  3474. if (!file) {
  3475. // 如果用户没有选择图片,只是点了文件上传这个按钮
  3476. return;
  3477. }
  3478. //console.log(file)
  3479. this.upFile = file;
  3480. },
  3481. editNodeInfo(index, row) {
  3482. this.$set(row, "isEdit", true);
  3483. },
  3484. saveNodeInfoHandle(index, row) {
  3485. row.isEdit = false;
  3486. },
  3487. downloadTmp() {
  3488. getTemplate().then((res) => {
  3489. //console.log(res)
  3490. let blob = new Blob([res.data], {
  3491. type: "application/vnd.ms-excel",
  3492. });
  3493. //console.log(blob)
  3494. let filename = Date.parse(new Date()) + ".xls";
  3495. if (window.navigator.msSaveOrOpenBlob) {
  3496. // 兼容IE10
  3497. window.navigator.msSaveBlob(blob, filename);
  3498. } else {
  3499. // 兼容chrome/firefox
  3500. let aTag = document.createElement("a");
  3501. aTag.download = Date.parse(new Date()) + ".xls";
  3502. aTag.href = window.URL.createObjectURL(blob);
  3503. aTag.click();
  3504. URL.revokeObjectURL(aTag.href);
  3505. }
  3506. });
  3507. },
  3508. fileClick2() {
  3509. this.$refs.file2.click();
  3510. },
  3511. tmpImport(e) {
  3512. const file = e.target.files[0];
  3513. const formData = new FormData();
  3514. formData.append("file", file);
  3515. //console.log(file.name)
  3516. importWbsElement(formData)
  3517. .then((res) => {
  3518. res.data.data.forEach((element) => {
  3519. element.eName = element.elementName;
  3520. element.eLength = element.elementLength;
  3521. element.eType = Number(element.elementType);
  3522. element.eAllowDeviation = element.elementAllowDeviation;
  3523. element.eInspectionMethod = element.elementInspectionMethod;
  3524. this.eleReg.exec(element.eAllowDeviation);
  3525. // console.log(RegExp.$1)
  3526. // console.log(RegExp.$2)
  3527. element.allow = RegExp.$1 ? RegExp.$1 : "";
  3528. element.deviation = RegExp.$2 ? RegExp.$2 : "";
  3529. });
  3530. this.eleForm.elementList = res.data.data;
  3531. this.importVisible = false;
  3532. })
  3533. .finally(() => {
  3534. e.target.value = "";
  3535. });
  3536. },
  3537. visiblechange(value, data) {
  3538. this.$set(data, "moreShow", value);
  3539. },
  3540. bianhua2() {
  3541. this.excelSortTag2 = false;
  3542. this.$nextTick(() => {
  3543. this.excelSortTag2 = true;
  3544. });
  3545. },
  3546. //私有树的元素表修改排序
  3547. privateTableSort() {
  3548. if (!this.curTreeData.id) {
  3549. this.$message({
  3550. type: "warning",
  3551. message: "请先选择需要排序的节点",
  3552. });
  3553. return;
  3554. }
  3555. this.tableSortList = this.formData.map((form, index) => {
  3556. return {
  3557. sort: index + 1,
  3558. nodeName: form.tableName,
  3559. pkeyId: form.pkeyId,
  3560. };
  3561. });
  3562. this.excelSortTag = true;
  3563. this.excelSortTag2 = true;
  3564. },
  3565. editPrivateSort() {
  3566. this.surePrivateSortload = true;
  3567. wbsTreePrivateTableSort(this.tableSortList).then(() => {
  3568. this.$message({
  3569. type: "success",
  3570. message: "排序成功!",
  3571. });
  3572. this.updateNodeTable();
  3573. this.surePrivateSortload = false;
  3574. this.excelSortTag = false;
  3575. this.excelSortTag2 = false;
  3576. });
  3577. },
  3578. //解析元素数据类型
  3579. eTypeFormatter(row) {
  3580. let text = "";
  3581. for (let i = 0; i < this.dataTypeList.length; i++) {
  3582. if (this.dataTypeList[i].dictKey == row.eType) {
  3583. text = this.dataTypeList[i].dictValue;
  3584. break;
  3585. }
  3586. }
  3587. return text;
  3588. },
  3589. //跳转到公式配置页面
  3590. toFormulaEdit(row, type) {
  3591. this.curEleTable.hasPartFormula = row.hasPartFormula;
  3592. this.formulaCurRow = row;
  3593. this.formulaCurRow.globaltype = type;
  3594. if (type === 10) {
  3595. this.formulaCompVisible1 = true;
  3596. this.formulaCurRow.elementType = false;
  3597. this.istableType = true;
  3598. } else {
  3599. this.formulaCompVisible = true;
  3600. }
  3601. },
  3602. //关闭公式弹窗
  3603. closeformulaComp() {
  3604. console.log("关闭");
  3605. selectFormElements(this.curEleTable.pkeyId, { type: 0 }).then((res) => {
  3606. this.editEleListFilter = res.data.data;
  3607. this.editEleListAll = [].concat(this.editEleListFilter);
  3608. });
  3609. },
  3610. //关闭公式弹窗
  3611. closeformulaComp1() {
  3612. console.log("关闭");
  3613. selectFormElements(this.curEleTable.pkeyId, { type: 0 }).then((res) => {
  3614. this.editEleListFilter = res.data.data;
  3615. this.editEleListAll = [].concat(this.editEleListFilter);
  3616. });
  3617. },
  3618. getNodeTypelist() {
  3619. let code = "name_rule";
  3620. getDictionary({
  3621. code,
  3622. }).then((res) => {
  3623. this.nodeTypelist1 = res.data.data;
  3624. });
  3625. },
  3626. getNodeTypelistData() {
  3627. const type = this.wbsType;
  3628. let code = "";
  3629. if (type === 5) {
  3630. code = "lar_node_type"; //征拆
  3631. } else if (type === 2) {
  3632. code = "trial_node_type"; //试验
  3633. } else if (type === 3) {
  3634. code = "meter_node_type"; //计量
  3635. } else {
  3636. {
  3637. code = "wbs_node_type"; //质检
  3638. }
  3639. }
  3640. getDictionary({
  3641. code,
  3642. }).then((res) => {
  3643. this.nodeTypelist = res.data.data;
  3644. res.data.data.forEach((element) => {
  3645. element.dictKey = Number(element.dictKey);
  3646. });
  3647. this.nodeTypelist = res.data.data;
  3648. });
  3649. },
  3650. getMajorDataTypeList() {
  3651. // if (this.majorDataTypeList.length > 1) {
  3652. // return;
  3653. // }
  3654. getDictionary({
  3655. code: "major_data_type",
  3656. }).then((res) => {
  3657. res.data.data.forEach((element) => {
  3658. element.dictKey = Number(element.dictKey);
  3659. });
  3660. // this.majorDataTypeList = res.data.data;
  3661. this.majorDataTypeList = res.data.data.filter(
  3662. (item) => item.dictKey != 0
  3663. );
  3664. });
  3665. },
  3666. getTableTypelist() {
  3667. const type = this.wbsType;
  3668. if (this.tableTypelist.length > 1) {
  3669. return;
  3670. }
  3671. let code = "";
  3672. if (type === 5) {
  3673. code = "table_type"; //征拆
  3674. } else if (type === 2) {
  3675. code = "trial_table_type"; //试验
  3676. } else {
  3677. code = "table_type"; //质检
  3678. }
  3679. getDictionary({
  3680. // code: "table_type",
  3681. // code: type === 2 ? "trial_table_type" : "table_type",
  3682. code,
  3683. }).then((res) => {
  3684. res.data.data.forEach((element) => {
  3685. element.dictKey = Number(element.dictKey);
  3686. });
  3687. this.tableTypelist = res.data.data;
  3688. });
  3689. },
  3690. getDataTypelist() {
  3691. if (this.dataTypeList.length > 1) {
  3692. return;
  3693. }
  3694. getDictionary({
  3695. code: "data_type",
  3696. }).then((res) => {
  3697. res.data.data.forEach((element) => {
  3698. element.dictKey = Number(element.dictKey);
  3699. });
  3700. this.dataTypeList = res.data.data;
  3701. });
  3702. },
  3703. getOwnerTypelist() {
  3704. if (this.ownerTypeList.length > 1) {
  3705. return;
  3706. }
  3707. getDictionary({
  3708. code: "owner_type",
  3709. }).then((res) => {
  3710. res.data.data.forEach((element) => {
  3711. element.dictKey = Number(element.dictKey);
  3712. });
  3713. this.ownerTypeList = res.data.data;
  3714. });
  3715. },
  3716. getStandardTypeOptions() {
  3717. getDictionary({
  3718. code: "classification",
  3719. }).then((res) => {
  3720. res.data.data.forEach((element) => {
  3721. element.dictKey = Number(element.dictKey);
  3722. });
  3723. // 定义要过滤的 dictKey 值
  3724. const targetKeys = [1, 2, 3, 4, 5];
  3725. // 过滤数组
  3726. const filteredOptions = res.data.data.filter((item) =>
  3727. targetKeys.includes(item.dictKey)
  3728. );
  3729. this.standardTypeOptions = filteredOptions;
  3730. });
  3731. },
  3732. changeStandType(val) {
  3733. let parentId = "";
  3734. this.standardTypeOptions.forEach((item) => {
  3735. if (item.dictKey == val) {
  3736. parentId = item.id; // 找到匹配项,提取 parentId
  3737. }
  3738. });
  3739. getChildList(1, 10000, parentId).then((res) => {
  3740. res.data.data.forEach((element) => {
  3741. element.dictKey = Number(element.dictKey);
  3742. });
  3743. this.unitOptions = res.data.data;
  3744. this.unitOptions = this.unitOptions.filter(
  3745. (item) => item.dictKey != -1
  3746. );
  3747. });
  3748. },
  3749. formatCat(row, column, cellValue) {
  3750. for (let i = 0; i < this.nodeTypelist.length; i++) {
  3751. if (this.nodeTypelist[i].dictKey == cellValue) {
  3752. return this.nodeTypelist[i].dictValue;
  3753. }
  3754. }
  3755. return cellValue;
  3756. //console.log(cellValue)
  3757. },
  3758. formatTableType(row, column, cellValue) {
  3759. for (let i = 0; i < this.tableTypelist.length; i++) {
  3760. if (this.tableTypelist[i].dictKey == cellValue) {
  3761. return this.tableTypelist[i].dictValue;
  3762. }
  3763. }
  3764. return cellValue;
  3765. //console.log(cellValue)
  3766. },
  3767. formatOwner(row, column, cellValue) {
  3768. for (let i = 0; i < this.ownerTypeList.length; i++) {
  3769. if (this.ownerTypeList[i].dictKey == cellValue) {
  3770. return this.ownerTypeList[i].dictValue;
  3771. }
  3772. }
  3773. return cellValue;
  3774. //console.log(cellValue)
  3775. },
  3776. formatdataType(row, column, cellValue) {
  3777. for (let i = 0; i < this.dataTypeList.length; i++) {
  3778. if (this.dataTypeList[i].dictKey == cellValue) {
  3779. return this.dataTypeList[i].dictValue;
  3780. }
  3781. }
  3782. return cellValue;
  3783. },
  3784. formMajorType(row, column, cellValue) {
  3785. for (let i = 0; i < this.majorDataTypeList.length; i++) {
  3786. if (this.majorDataTypeList[i].dictKey == cellValue) {
  3787. return this.majorDataTypeList[i].dictValue;
  3788. }
  3789. }
  3790. return cellValue;
  3791. },
  3792. // filterNode(value, data) {
  3793. // if (!value) return true;
  3794. // return data.title.indexOf(value) !== -1;
  3795. // },
  3796. getReturnNode(node, _array, value) {
  3797. let isPass =
  3798. node.data && node.data.title && node.data.title.indexOf(value) !== -1;
  3799. isPass ? _array.push(isPass) : "";
  3800. if (!isPass && node.level != 1 && node.parent) {
  3801. this.getReturnNode(node.parent, _array, value);
  3802. }
  3803. },
  3804. filterNode(value, data, node) {
  3805. if (!value) {
  3806. return true;
  3807. }
  3808. let level = node.level;
  3809. let _array = []; //这里使用数组存储 只是为了存储值。
  3810. this.getReturnNode(node, _array, value);
  3811. let result = false;
  3812. _array.forEach((item) => {
  3813. result = result || item;
  3814. });
  3815. return result;
  3816. },
  3817. //#endregion
  3818. //#region wbs私有树排序
  3819. async sortpai(data) {
  3820. console.log(data);
  3821. await this.findWbsTreePrivateSameLevel({
  3822. parentId: data.parentId,
  3823. projectId: this.projectid,
  3824. wbsId: this.id,
  3825. });
  3826. this.sortTag = true;
  3827. this.sortTag2 = true;
  3828. },
  3829. editSort() {
  3830. this.wbsTreePrivateSort();
  3831. },
  3832. bianhua() {
  3833. this.sortTag2 = false;
  3834. this.$nextTick(() => {
  3835. this.sortTag2 = true;
  3836. });
  3837. },
  3838. async wbsTreePrivateSort() {
  3839. this.sureSortload = true;
  3840. //wbs私有树节点手动排序
  3841. const { data: res } = await wbsTreePrivateSort(this.sort);
  3842. console.log(res);
  3843. if (res.code == 200) {
  3844. this.sortTag = false;
  3845. this.sortTag2 = false;
  3846. this.$message({
  3847. type: "success",
  3848. message: "排序成功!",
  3849. });
  3850. this.sureSortload = false;
  3851. this.isShowTree = false;
  3852. setTimeout(() => {
  3853. this.isShowTree = true;
  3854. }, 100);
  3855. // window.location.reload();
  3856. // this.getLazytreessss();
  3857. }
  3858. },
  3859. async findWbsTreePrivateSameLevel(da) {
  3860. //wbs私有树同级节点接口
  3861. const { data: res } = await findWbsTreePrivateSameLevel(da);
  3862. if (res.code == 200) {
  3863. this.sort = res.data;
  3864. }
  3865. },
  3866. async getLazytreessss() {
  3867. const type = this.wbsType;
  3868. const { data: res } = await getLazytree(
  3869. this.id,
  3870. 0,
  3871. this.userInfo.tenant_id,
  3872. this.projectid,
  3873. { wbsType: type }
  3874. );
  3875. console.log(res);
  3876. if (res.code == 200) {
  3877. this.treeData = res.data;
  3878. }
  3879. },
  3880. //#endregion
  3881. //#region 关联清表
  3882. async getList(da) {
  3883. //获取清表模板信息
  3884. const { data: res } = await getList(da);
  3885. console.log(res);
  3886. if (res.code === 200 && res.msg === "操作成功") {
  3887. this.GLExcelData = res.data.records;
  3888. }
  3889. },
  3890. async tabLazytreeAll() {
  3891. //清表树信息
  3892. this.GLExcelLoading = true;
  3893. const { data: res } = await tabLazytreeAll({
  3894. modeId: this.GLExcelFrom.name,
  3895. name: this.GLExcelFrom.search,
  3896. });
  3897. this.GLExcelLoading = false;
  3898. console.log(res);
  3899. if (res.code === 200 && res.msg === "操作成功") {
  3900. this.exceldata = res.data;
  3901. }
  3902. },
  3903. Associationlist(scope) {
  3904. //关联清表点击事件
  3905. console.log(scope.row);
  3906. this.GLExcel = true;
  3907. this.getList({
  3908. current: 1,
  3909. size: 100000,
  3910. parentId: 0,
  3911. });
  3912. this.GLExcelFrom.name = scope.row.modeId;
  3913. setTimeout(() => {
  3914. this.$refs.tree.setCheckedKeys([scope.row.excelId]);
  3915. }, 2000);
  3916. this.GLExcelFrom.initTableId = scope.row.initTableId;
  3917. this.GLExcelFrom.id = scope.row.pkeyId;
  3918. this.GLExcelFrom.excelId = scope.row.excelId;
  3919. this.GLExcelFrom.ids = scope.row.id;
  3920. this.GLExcelFrom.initTableName = scope.row.initTableName;
  3921. console.log(this.GLExcelFrom, "this.GLExcelFrom");
  3922. },
  3923. changetherr() {
  3924. //清表类型选择框change事件
  3925. if (this.GLExcelFrom.name != "") {
  3926. this.GLExcelFrom.search = "";
  3927. this.tabLazytreeAll();
  3928. }
  3929. },
  3930. GLExcelMD() {
  3931. //弹框关闭事件
  3932. this.GLExcelFrom.name = "";
  3933. this.GLExcelFrom.search = "";
  3934. this.GLExcelFrom.id = "";
  3935. this.exceldata = [];
  3936. this.$refs.tree.setCheckedKeys([]);
  3937. this.GLExcel = false;
  3938. },
  3939. checkchange(data) {
  3940. //节点选中回调
  3941. if (this.$refs.tree.getCheckedNodes().length === 0) {
  3942. this.$refs.tree.setCheckedKeys([]);
  3943. } else if (this.$refs.tree.getCheckedNodes().length >= 1) {
  3944. this.$refs.tree.setCheckedKeys([data.id]);
  3945. }
  3946. },
  3947. async saveLinkTab() {
  3948. //保存按钮
  3949. let checkNodes = this.$refs.tree.getCheckedNodes();
  3950. if (checkNodes.length > 0) {
  3951. let node = checkNodes[checkNodes.length - 1];
  3952. if (node.fileType != 3) {
  3953. this.$message({
  3954. type: "warning",
  3955. message: "请先上传Excel表",
  3956. });
  3957. return;
  3958. }
  3959. const { data: res } = await saveLinkTab({
  3960. exceTabId: node.id,
  3961. tabId: this.GLExcelFrom.id,
  3962. });
  3963. console.log(res);
  3964. if (res.code === 200) {
  3965. this.$message({
  3966. type: "success",
  3967. message: "关联清表成功",
  3968. });
  3969. // selectByNodeTable刷新表单列表
  3970. // await this.updateNodeTable()
  3971. if(this.isNodeType){
  3972. selectByNodeTable( this.curTreeData.id, this.projectid, this.id).then(
  3973. (res) => {
  3974. if (res.data.data && res.data.data.length) {
  3975. this.formData = res.data.data;
  3976. this.GLExcel = false;
  3977. this.formData.forEach((ele) => {
  3978. if(ele.excelId = this.GLExcelFrom.excelId){
  3979. this.GLExcelFrom.initTableId=ele.initTableId
  3980. }
  3981. })
  3982. console.log( this.GLExcelFrom,' this.GLExcelFrom');
  3983. this.rightClick(
  3984. this.GLExcelFrom.id,
  3985. this.GLExcelFrom.excelId,
  3986. this.GLExcelFrom.ids,
  3987. this.GLExcelFrom.initTableName,
  3988. this.GLExcelFrom.initTableId
  3989. );
  3990. } else {
  3991. this.formData = [];
  3992. }
  3993. }
  3994. ).finally(() => {
  3995. this.GLExcel = false;
  3996. })
  3997. }else{
  3998. this.reloadEntireTree();
  3999. this.GLExcel = false;
  4000. }
  4001. }
  4002. } else {
  4003. this.$message({
  4004. type: "warning",
  4005. message: "请先设置清表",
  4006. });
  4007. }
  4008. },
  4009. getReturnNode2(node, _array, value) {
  4010. let isPass =
  4011. node.data && node.data.name && node.data.name.indexOf(value) !== -1;
  4012. isPass ? _array.push(isPass) : "";
  4013. if (!isPass && node.level != 1 && node.parent) {
  4014. this.getReturnNode2(node.parent, _array, value);
  4015. }
  4016. },
  4017. filterNode222(value, data, node) {
  4018. if (!value) {
  4019. return true;
  4020. }
  4021. let level = node.level;
  4022. let _array = []; //这里使用数组存储 只是为了存储值。
  4023. this.getReturnNode2(node, _array, value);
  4024. let result = false;
  4025. _array.forEach((item) => {
  4026. result = result || item;
  4027. });
  4028. return result;
  4029. },
  4030. //#endregion
  4031. //#region 节点参数
  4032. nodeInfo(data) {
  4033. //节点参数按钮
  4034. this.keymap();
  4035. //console.log(data)
  4036. let pid = data.primaryKeyId ? data.primaryKeyId : data.pKeyId;
  4037. this.jiedianId = pid;
  4038. this.parameters(pid);
  4039. this.nodeInfoVisible = true;
  4040. },
  4041. closenodeInfoVisible() {
  4042. this.nodeInfoTable = [];
  4043. this.nodeInfoVisible = false;
  4044. },
  4045. addNodeInfoTable() {
  4046. //添加节点参数数据
  4047. this.nodeInfoTable.unshift({
  4048. k: "",
  4049. v: "",
  4050. remark: "",
  4051. nodeId: this.jiedianId,
  4052. type: 1,
  4053. });
  4054. console.log(this.nodeInfoTable);
  4055. },
  4056. refreshnfoTable() {
  4057. //刷新表格
  4058. let prams = {
  4059. nodeId: this.jiedianId,
  4060. type: 1,
  4061. projectId: this.projectid,
  4062. };
  4063. this.nodeInfoTableLoad = true;
  4064. refrehPram(prams).then((res) => {
  4065. this.nodeInfoTableLoad = false;
  4066. if (res.data.code == 200) {
  4067. this.$message.success("刷新成功");
  4068. }
  4069. });
  4070. },
  4071. delNodeInfo(key, obj) {
  4072. this.delids.push(obj.id);
  4073. //设置参数名称中的删除按钮
  4074. this.namelists.splice(key, 1);
  4075. },
  4076. delNodeInfoss(key, obj) {
  4077. this.delids.push(obj.id);
  4078. //节点参数
  4079. this.nodeInfoTable.splice(key, 1);
  4080. },
  4081. setNodeParameters() {
  4082. //打开设置节点参数弹框按钮
  4083. this.infoNameVisible = true;
  4084. this.namelists = [...this.namelist];
  4085. },
  4086. async setParameterName() {
  4087. //设置参数名称中添加节点参数按钮
  4088. // wbsId: this.jiedianId
  4089. this.namelists.unshift({
  4090. name: "",
  4091. remark: "",
  4092. k: "",
  4093. type: 0,
  4094. nodeId: this.jiedianId,
  4095. });
  4096. },
  4097. async nodeInfoSave() {
  4098. //节点参数弹框保存按钮
  4099. if (this.nodeInfoTable) {
  4100. // if (this.nodeInfoTable.length == 0) {
  4101. // await this.saveOrUpdateBatch({projectId:this.projectid,nodeId:this.jiedianId,type:1,delIds:this.delids,wps:[
  4102. // {
  4103. // nodeId: this.jiedianId,
  4104. // type: -1,
  4105. // },
  4106. // ]});
  4107. // this.nodeInfoVisible = false;
  4108. // this.delIds=[];
  4109. // this.$message({
  4110. // type: "success",
  4111. // message: "保存参数节点成功!",
  4112. // });
  4113. // return;
  4114. // }
  4115. console.log(this.namelist);
  4116. let tag = true;
  4117. this.nodeInfoTable.forEach((val) => {
  4118. if (!val.k | !val.v) {
  4119. return (tag = false);
  4120. }
  4121. //if (!val.name) {
  4122. for (let i = 0; i < this.namelist.length; i++) {
  4123. if (this.namelist[i].k == val.k) {
  4124. val.name = this.namelist[i].name;
  4125. return;
  4126. }
  4127. }
  4128. //}
  4129. });
  4130. if (tag) {
  4131. this.nodeInfoSaveload = true;
  4132. await this.saveOrUpdateBatch({
  4133. scopeType: 10,
  4134. projectId: this.projectid,
  4135. nodeId: this.jiedianId,
  4136. wps: this.nodeInfoTable,
  4137. type: 1,
  4138. delIds: this.delids,
  4139. });
  4140. this.delIds = [];
  4141. this.$message({
  4142. type: "success",
  4143. message: "设置参数节点成功!",
  4144. });
  4145. this.nodeInfoSaveload = false;
  4146. this.parameters(this.jiedianId);
  4147. // this.nodeInfoVisible = false;
  4148. } else {
  4149. this.$message({
  4150. type: "error",
  4151. message: "请填写所有的参数名称和参数值!",
  4152. });
  4153. }
  4154. } else {
  4155. this.$message({
  4156. type: "error",
  4157. message: "请先设置参数节点!",
  4158. });
  4159. }
  4160. },
  4161. async addParameterName() {
  4162. //设置参数名称中的保存按钮
  4163. if (this.namelists.length) {
  4164. let tag = true;
  4165. this.namelists.forEach((val) => {
  4166. if (!val.name || !val.k) {
  4167. return (tag = false);
  4168. }
  4169. });
  4170. if (tag) {
  4171. await this.saveOrUpdateBatch({
  4172. scopeType: 10,
  4173. projectId: this.projectid,
  4174. nodeId: this.jiedianId,
  4175. wps: this.namelists,
  4176. type: 0,
  4177. delIds: this.delids,
  4178. }); //保存设置参数
  4179. this.infoNameVisible = false;
  4180. this.delIds = [];
  4181. this.keymap();
  4182. } else {
  4183. this.$message({
  4184. type: "error",
  4185. message: "请填写所有的参数名称和参数值KEY!",
  4186. });
  4187. }
  4188. } else {
  4189. this.$message({
  4190. type: "warning",
  4191. message: "请先添加参数",
  4192. });
  4193. }
  4194. },
  4195. closeParameter() {
  4196. //设置参数名称,关闭按钮
  4197. this.namelists = [];
  4198. this.infoNameVisible = false;
  4199. },
  4200. async parameters(wbsId) {
  4201. //获取接待你参数列表
  4202. const { data: res } = await parameters({ wbsId });
  4203. console.log(res);
  4204. if (res.code == 200) {
  4205. if (Array.isArray(res.data)) {
  4206. this.nodeInfoTable = res.data;
  4207. }
  4208. }
  4209. },
  4210. async saveOrUpdateBatch(da) {
  4211. //保存
  4212. const { data: res } = await saveOrUpdateBatch(da);
  4213. this.delids = [];
  4214. console.log(res);
  4215. },
  4216. async keymap() {
  4217. //节点参数枚举
  4218. const { data: res } = await keymap();
  4219. console.log(res);
  4220. if (res.code == 200) {
  4221. this.namelist = res.data;
  4222. }
  4223. },
  4224. //#endregion
  4225. //#region 调整表单
  4226. adjustExcel(pkeyId, excelId) {
  4227. //调整表单
  4228. this.GLExcelFrom.id = pkeyId;
  4229. this.GLExcelFrom.excelId = excelId;
  4230. this.getExcelHtml(pkeyId);
  4231. },
  4232. async getExcelHtml(pkeyId) {
  4233. const { data: res } = await getExcelHtml({ pkeyId });
  4234. console.log(res);
  4235. if (res.code === 200) {
  4236. localStorage.setItem("excelHtml", res.data);
  4237. this.adjustmentExcel = res.data;
  4238. this.excelHtml = true;
  4239. }
  4240. },
  4241. removeExcel() {
  4242. this.excelHtml = false;
  4243. },
  4244. //#endregion
  4245. //#region 编辑元素
  4246. async rightClick(pkeyId, excelId, id, initTableName, initTableId) {
  4247. await this.getExcelHtml2(pkeyId);
  4248. this.editElementQuery.pkeyId = pkeyId;
  4249. this.editElementQuery.excelId = excelId;
  4250. this.editElementQuery.id = id;
  4251. this.editElementQuery.initTableName = initTableName;
  4252. this.editElementQuery.initTableId = initTableId;
  4253. this.editElementQuery.pid = this.$route.query.pid;
  4254. this.editElementQuery.wbsid = this.$route.query.wbsid;
  4255. this.editElementQuery.nodeid = this.curTreeData.id;
  4256. this.editElementVisible = true;
  4257. },
  4258. hideEditElementVisible() {
  4259. this.editElementVisible = false;
  4260. // this.updateNodeTable();
  4261. if(this.isNodeType){
  4262. this.updateNodeTable();
  4263. }
  4264. },
  4265. async getExcelHtml2(pkeyId) {
  4266. const { data: res } = await getExcelHtml({ pkeyId });
  4267. console.log(res);
  4268. if (res.code === 200) {
  4269. localStorage.setItem("editElement", res.data);
  4270. }
  4271. },
  4272. //#endregion
  4273. //#region 元素表单信息
  4274. editEditElementForm() {
  4275. //标记元素
  4276. if (this.formData.length) {
  4277. let da = [];
  4278. this.formDatass = [...this.formData];
  4279. this.formDatass.forEach((val) => {
  4280. da.push({
  4281. tableType: val.tableType - 0,
  4282. tableOwner: val.tableOwner - 0,
  4283. pkeyId: val.pkeyId,
  4284. tableName: val.tableName,
  4285. fillRate: val.fillRate,
  4286. nodeType: val.nodeType - 0,
  4287. });
  4288. });
  4289. this.formDatass = da;
  4290. this.editElementFormTag = true;
  4291. }else{
  4292. this.$message({
  4293. type: "warning",
  4294. message: "当前列表无数据!",
  4295. });
  4296. }
  4297. },
  4298. editeditElementFormMF() {
  4299. //保存按钮
  4300. let da = [];
  4301. let tag = true;
  4302. this.formDatass.forEach((val) => {
  4303. if (!val.tableName || !val.tableType || !val.tableOwner) {
  4304. tag = false;
  4305. return;
  4306. } else {
  4307. da.push({
  4308. pkeyId: val.pkeyId,
  4309. nodeName: val.tableName,
  4310. tableType: val.tableType,
  4311. tableOwner: val.tableOwner,
  4312. fillRate: val.fillRate,
  4313. nodeType: val.nodeType,
  4314. });
  4315. }
  4316. });
  4317. if (tag) {
  4318. this.updateBatchNodeTableInfo2(da);
  4319. } else {
  4320. this.$message({
  4321. type: "success",
  4322. message: "请填写完整元素表单的所有信息!",
  4323. });
  4324. }
  4325. },
  4326. async updateBatchNodeTableInfo2(da) {
  4327. this.editeditElementFormMFLoading = true;
  4328. //共有编辑元素
  4329. const { data: res } = await updateBatchNodeTableInfo2(da);
  4330. if (res.code == 200) {
  4331. this.editElementFormTag = false;
  4332. this.updateNodeTable();
  4333. this.editeditElementFormMFLoading = false;
  4334. }
  4335. this.editeditElementFormMFLoading = false;
  4336. },
  4337. //#endregion
  4338. //获取节点展开路径
  4339. getExpandedKeys(node) {
  4340. //console.log(node)
  4341. let expandedKeys = [];
  4342. while (node.parent) {
  4343. expandedKeys.push(node.data.id);
  4344. node = node.parent;
  4345. }
  4346. setStore({
  4347. name: this.expandName,
  4348. content: expandedKeys,
  4349. type: true, //sessionStorage
  4350. });
  4351. //console.log(expandedKeys)
  4352. },
  4353. //触发节点参数
  4354. nodeInfoHandle() {
  4355. if (!this.curTreeData.id) {
  4356. this.$message({
  4357. type: "warning",
  4358. message: "请先选择节点",
  4359. });
  4360. return;
  4361. }
  4362. this.nodeInfo(this.curTreeData);
  4363. },
  4364. eleFormulaHandle() {
  4365. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4366. this.$message({
  4367. type: "warning",
  4368. message: "请先选择节点",
  4369. });
  4370. return;
  4371. }
  4372. this.setLeftType(4, this.curTreeData, this.curTreeNode);
  4373. // this.showType = 2;
  4374. },
  4375. editNodeHandle() {
  4376. console.log(this.curTreeData, "this.curTreeData.id ");
  4377. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4378. this.$message({
  4379. type: "warning",
  4380. message: "请先选择节点",
  4381. });
  4382. return;
  4383. }
  4384. this.mixRatioTestIds = [];
  4385. // this.nodeTypeChange(53);
  4386. this.nodeTypeChange(this.curTreeData.nodeType);
  4387. this.dialogTitle = "编辑节点";
  4388. this.setLeftType(2, this.curTreeData, this.curTreeNode);
  4389. },
  4390. addNodeHandle() {
  4391. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4392. this.$message({
  4393. type: "warning",
  4394. message: "请先选择节点",
  4395. });
  4396. return;
  4397. }
  4398. this.mixRatioTestIds = [];
  4399. // this.nodeTypeChange(53);
  4400. this.nodeTypeChange(this.curTreeData.nodeType);
  4401. this.dialogTitle = "新增节点";
  4402. this.setLeftType(1, this.curTreeData, this.curTreeNode);
  4403. },
  4404. copyNodeHandle() {
  4405. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4406. this.$message({
  4407. type: "warning",
  4408. message: "请先选择节点",
  4409. });
  4410. return;
  4411. }
  4412. },
  4413. delNodeHandle() {
  4414. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4415. this.$message({
  4416. type: "warning",
  4417. message: "请先选择节点",
  4418. });
  4419. return;
  4420. }
  4421. if (this.curTreeNode.level == 1) {
  4422. this.$message({
  4423. type: "warning",
  4424. message: "当前节点无法删除",
  4425. });
  4426. return;
  4427. }
  4428. this.deleNode(this.curTreeData, this.curTreeNode);
  4429. },
  4430. eleHandle() {
  4431. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4432. this.$message({
  4433. type: "warning",
  4434. message: "请先选择节点",
  4435. });
  4436. return;
  4437. }
  4438. this.setLeftType(5, this.curTreeData, this.curTreeNode);
  4439. },
  4440. syncInfoHandle(item) {
  4441. if (this.curTreeData.primaryKeyId || this.curTreeData.pKeyId) {
  4442. this.$confirm("是否同步节点参数?", "提示", {
  4443. confirmButtonText: "确定",
  4444. cancelButtonText: "取消",
  4445. type: "warning",
  4446. }).then(() => {
  4447. this.syncBtnLoad = true;
  4448. this.menuoptions.forEach((ele) => {
  4449. if (item.value == ele.value) {
  4450. ele.load = true;
  4451. }
  4452. });
  4453. let pid = this.curTreeData.primaryKeyId
  4454. ? this.curTreeData.primaryKeyId
  4455. : this.curTreeData.pKeyId;
  4456. syncNodeParam(this.projectid, pid)
  4457. .then(() => {
  4458. this.$message({
  4459. type: "success",
  4460. message: "同步成功!",
  4461. });
  4462. })
  4463. .finally(() => {
  4464. this.syncBtnLoad = false;
  4465. this.menuoptions.forEach((ele) => {
  4466. if (item.value == ele.value) {
  4467. ele.load = false;
  4468. }
  4469. });
  4470. });
  4471. });
  4472. } else {
  4473. this.$message.warning("请先选择左侧节点");
  4474. }
  4475. },
  4476. //显示别名弹窗
  4477. aliasShow() {
  4478. this.aliasVisible = true;
  4479. if (this.nodeDetail.fullName) {
  4480. this.aliasArr = this.nodeDetail.fullName.split(",");
  4481. } else {
  4482. this.aliasArr = [];
  4483. }
  4484. this.aliasInput = "";
  4485. },
  4486. addAlias() {
  4487. if (this.aliasInput) {
  4488. this.aliasArr.push(this.aliasInput);
  4489. this.aliasInput = "";
  4490. }
  4491. },
  4492. delAlias(index) {
  4493. this.aliasArr.splice(index, 1);
  4494. },
  4495. saveAliasHandle() {
  4496. this.nodeDetail.fullName = this.aliasArr.join(",");
  4497. if (this.editType == 1) {
  4498. //新增
  4499. this.aliasVisible = false;
  4500. } else if (this.editType == 2) {
  4501. //编辑 私有
  4502. privateSubmitFullName(
  4503. this.nodeDetail.pKeyId,
  4504. this.nodeDetail.fullName
  4505. ).then(() => {
  4506. this.$message({
  4507. type: "success",
  4508. message: "保存成功",
  4509. });
  4510. this.aliasVisible = false;
  4511. });
  4512. }
  4513. },
  4514. async syncNodeTableHandle(data) {
  4515. this.isAdd=''
  4516. console.log('后管数据同步',data);
  4517. this.curTreeData=data
  4518. this.isShowLeft=false
  4519. // await this.getNodeStatusData()
  4520. if(this.syncListDialog){
  4521. return
  4522. }
  4523. this.syncForm.range='1'
  4524. this.proSyncTag=true
  4525. if(this.$refs.syncProTree){
  4526. this.$refs.syncProTree.setCheckedKeys([])
  4527. }
  4528. if(this.$refs.proTable){
  4529. this.$refs.proTable.clearSelection()
  4530. }
  4531. this.isShowTable=true
  4532. this.getTypeOptions()
  4533. this.getRangeOptions()
  4534. this.getCheckIdList()
  4535. let pid=data.primaryKeyId?data.primaryKeyId:data.pKeyId
  4536. this.getTempProjectList(pid)
  4537. },
  4538. syncProjectHandle(data) {
  4539. this.$confirm("是否同步节点【" + data.title + "】到合同段?", "提示", {
  4540. confirmButtonText: "确定",
  4541. cancelButtonText: "取消",
  4542. type: "warning",
  4543. }).then(() => {
  4544. let notify = this.$notify({
  4545. title: "提示",
  4546. message: "节点数据同步中...",
  4547. duration: 0,
  4548. });
  4549. let pid = data.primaryKeyId ? data.primaryKeyId : data.pKeyId;
  4550. syncNodeinfo(pid)
  4551. .then(() => {
  4552. this.updateNodeTable();
  4553. this.$message({
  4554. type: "success",
  4555. message: "同步成功",
  4556. });
  4557. })
  4558. .catch(() => {
  4559. this.$message({
  4560. type: "error",
  4561. message: "同步失败",
  4562. });
  4563. })
  4564. .finally(() => {
  4565. notify.close();
  4566. });
  4567. });
  4568. },
  4569. //同步元素表单排序到合同段
  4570. async syncSortHandle(data) {
  4571. console.log('同步到合同');
  4572. this.isShowLeft=false
  4573. this.curTreeData=data
  4574. if(this.syncListDialog){
  4575. return
  4576. }
  4577. // await this.getNodeStatusData()
  4578. this.syncForm.range='2'
  4579. this.proSyncTag=true
  4580. this.isShowTable=true
  4581. this.getTypeOptions()
  4582. this.getRangeOptions()
  4583. this.getCheckIdList()
  4584. selectByNodeTable(data.id, this.projectid, this.id).then((res) => {
  4585. if (res.data.data.length>0) {
  4586. this.preTableData = res.data.data;
  4587. } else {
  4588. this.preTableData = [];
  4589. }
  4590. });
  4591. },
  4592. typeTreeLoadNode(node, resolve) {
  4593. let pid = 0;
  4594. if (node.level != 0) {
  4595. pid = node.data.id;
  4596. }
  4597. tabTypeLazyTree(pid, this.projectid).then((res) => {
  4598. let arr = [];
  4599. if (Array.isArray(res.data.data)) {
  4600. arr = res.data.data;
  4601. }
  4602. return resolve(arr);
  4603. });
  4604. },
  4605. getTypeTreeDetail() {},
  4606. independent() {
  4607. this.$router.push({
  4608. path: "/project/independent",
  4609. query: {
  4610. pid: this.projectid,
  4611. wbsid: this.$route.query.wbsid,
  4612. wbsType: this.wbsType,
  4613. },
  4614. });
  4615. },
  4616. archiveTimeClick() {
  4617. this.$router.push({
  4618. path: "/project/archiveTime",
  4619. query: { pid: this.projectid, wbsid: this.$route.query.wbsid },
  4620. });
  4621. },
  4622. syncElectric(item) {
  4623. if (this.curTreeData.primaryKeyId || this.curTreeData.pKeyId) {
  4624. console.log("同步电签默认信息");
  4625. this.$confirm("是否同步电签默认信息?", "提示", {
  4626. confirmButtonText: "确定",
  4627. cancelButtonText: "取消",
  4628. type: "warning",
  4629. }).then(() => {
  4630. this.syncElectricLoad = true;
  4631. this.menuoptions.forEach((ele) => {
  4632. if (item.value == ele.value) {
  4633. ele.load = true;
  4634. }
  4635. });
  4636. let pid = this.curTreeData.primaryKeyId
  4637. ? this.curTreeData.primaryKeyId
  4638. : this.curTreeData.pKeyId;
  4639. syncProjecteVisa(this.projectid, pid)
  4640. .then(() => {
  4641. this.$message({
  4642. type: "success",
  4643. message: "同步成功!",
  4644. });
  4645. })
  4646. .finally(() => {
  4647. this.syncElectricLoad = false;
  4648. this.menuoptions.forEach((ele) => {
  4649. if (item.value == ele.value) {
  4650. ele.load = false;
  4651. }
  4652. });
  4653. });
  4654. });
  4655. } else {
  4656. this.$message.warning("请先选择左侧节点");
  4657. }
  4658. },
  4659. //节点参数 关联元素
  4660. linkEle(row) {
  4661. console.log(row, "row");
  4662. if (!row.id) {
  4663. this.$message.warning("请先保存数据,再点击关联元素");
  4664. } else {
  4665. this.linkEleVisible = true;
  4666. this.curParam = row;
  4667. getParamElements({
  4668. nodeId: this.curTreeData.id,
  4669. projectId: this.projectid,
  4670. paramId: row.id,
  4671. scopeType: 10,
  4672. }).then((res) => {
  4673. if (res.data.data.length) {
  4674. this.linkEleTableList = res.data.data;
  4675. } else {
  4676. this.linkEleTableList = [];
  4677. }
  4678. });
  4679. }
  4680. },
  4681. //关联元素弹框
  4682. tolinkEle(row) {
  4683. this.curLinkEleTable = row;
  4684. this.linkCheckVisible = true;
  4685. let pid = this.curTreeData.primaryKeyId
  4686. ? this.curTreeData.primaryKeyId
  4687. : this.curTreeData.pKeyId;
  4688. selectFormElements(row.id, { type: 3, nodeId: pid }).then((res) => {
  4689. res.data.data.forEach((ele) => {
  4690. ele.checked = false;
  4691. ele.show = true;
  4692. });
  4693. this.linkEleList = res.data.data;
  4694. this.linkEleListAll = [].concat(this.linkEleList);
  4695. });
  4696. },
  4697. //删除关联
  4698. delLink(data) {
  4699. this.$confirm("删除关联, 是否继续?", "提示", {
  4700. confirmButtonText: "确定",
  4701. cancelButtonText: "取消",
  4702. type: "warning",
  4703. })
  4704. .then(() => {
  4705. console.log(data);
  4706. delParamElements(data).then(() => {
  4707. this.$message({
  4708. type: "success",
  4709. message: "删除成功!",
  4710. });
  4711. getParamElements({
  4712. nodeId: this.curTreeData.id,
  4713. projectId: this.projectid,
  4714. paramId: this.curParam.id,
  4715. scopeType: 10,
  4716. }).then((res) => {
  4717. if (res.data.data.length) {
  4718. this.linkEleTableList = res.data.data;
  4719. } else {
  4720. this.linkEleTableList = [];
  4721. }
  4722. });
  4723. });
  4724. })
  4725. .catch(() => {});
  4726. },
  4727. //筛选元素
  4728. searchEle() {
  4729. this.linkEleList = this.linkEleListAll.filter((ele) => {
  4730. return ele.eName.indexOf(this.linkEleKey) > -1;
  4731. });
  4732. },
  4733. linkEleCheck(value, index) {
  4734. //console.log(value)
  4735. if (value) {
  4736. this.linkEleList.forEach((ele, i) => {
  4737. if (i != index) {
  4738. ele.checked = false;
  4739. }
  4740. });
  4741. }
  4742. },
  4743. //关联元素
  4744. saveLinkEle() {
  4745. let target = {};
  4746. this.linkEleList.forEach((e) => {
  4747. if (e.checked == true) {
  4748. target = { elementId: e.id, paramId: this.curParam.id };
  4749. }
  4750. });
  4751. if (JSON.stringify(target) !== "{}") {
  4752. specifiedParamElements(target).then((data) => {
  4753. this.linkCheckVisible = false;
  4754. getParamElements({
  4755. nodeId: this.curTreeData.id,
  4756. projectId: this.projectid,
  4757. paramId: this.curParam.id,
  4758. scopeType: 10,
  4759. }).then((res) => {
  4760. if (res.data.data.length) {
  4761. this.linkEleTableList = res.data.data;
  4762. } else {
  4763. this.linkEleTableList = [];
  4764. }
  4765. });
  4766. });
  4767. } else {
  4768. this.$message.warning("请先选择关联元素");
  4769. }
  4770. },
  4771. //树形控件菜单相关方法
  4772. mouseout() {
  4773. this.menuvisible = false;
  4774. },
  4775. //展示菜单
  4776. showMenu(e, data, node) {
  4777. e.preventDefault();
  4778. console.log(e, "e");
  4779. var x = e.pageX; //这个应该是相对于整个浏览器页面的x坐标,左上角为坐标原点(0,0)
  4780. var y = e.pageY; //这个应该是相对于整个浏览器页面的y坐标,左上角为坐标原点(0,0)
  4781. this.menutop = y;
  4782. this.menuleft = x;
  4783. this.menuvisible = true;
  4784. },
  4785. menuClick(e, item, data,node) {
  4786. this.curTreeData = data; //当前节点数据
  4787. this.curTreeNode = node; //当前节点数据
  4788. e.preventDefault();
  4789. if (item.key === "sort") {
  4790. this.sortpai(data);
  4791. } else if (item.key === "sync1") {
  4792. this.syncNodeTableHandle(data);
  4793. } //
  4794. else if (item.key === "sync3") {
  4795. this.syncSortHandle(data);
  4796. } else if (item.key === "add") {
  4797. this.addNodeHandle();
  4798. } else if (item.key === "edit") {
  4799. this.editNodeHandle();
  4800. } else if (item.key === "del") {
  4801. this.delNodeHandle();
  4802. } else if (item.value === "jdSync") {
  4803. this.syncInfoHandle(item);
  4804. } else if (item.value === "gsSync") {
  4805. this.$message({
  4806. type: "info",
  4807. message: "暂无相关接口!",
  4808. });
  4809. } else if (item.value === "dqSync") {
  4810. this.syncElectric(item);
  4811. }
  4812. },
  4813. //展示数据同步下拉框
  4814. showSyncbtn() {
  4815. this.isshowSyncbtn = !this.isshowSyncbtn;
  4816. },
  4817. getDictTypelist() {
  4818. if (this.dynamicDictList.length > 1) {
  4819. return;
  4820. }
  4821. getDictionary({
  4822. code: "land_field_dict",
  4823. }).then((res) => {
  4824. res.data.data.forEach((element) => {
  4825. element.dictKey = Number(element.dictKey);
  4826. });
  4827. this.dynamicDictList = res.data.data;
  4828. const filteredList = this.dynamicDictList.filter(
  4829. (item) => item.dictKey === 600 || item.dictKey === 0
  4830. );
  4831. this.dynamicDictList = filteredList;
  4832. });
  4833. },
  4834. getSelectFormElements(id) {
  4835. this.editEleTableloading = true;
  4836. let finalId=this.isNodeType?this.curEleTable.pkeyId:this.curEleTable.id
  4837. selectFormElements(finalId, {
  4838. type: 0,
  4839. search: this.searchinput,
  4840. }).then((res) => {
  4841. this.editEleTableloading = false;
  4842. this.editTable = res.data.data;
  4843. });
  4844. },
  4845. //编辑
  4846. handleEdit(index, row) {
  4847. this.curEleTable = row;
  4848. this.getSelectFormElements();
  4849. this.editDialogShow = true;
  4850. this.getDictTypelist();
  4851. },
  4852. //编辑元素信息(请谨慎操作)
  4853. clearsearchinput() {
  4854. this.getSelectFormElements();
  4855. },
  4856. searchinputChange() {
  4857. this.getSelectFormElements();
  4858. },
  4859. saveEles() {
  4860. if (this.editTable.length > 0) {
  4861. console.log( this.curEleTable,' this.curEleTable');
  4862. this.saveLoading = true;
  4863. updateBatchElements(
  4864. this.editTable,
  4865. this.curEleTable.initTableName
  4866. ).then(() => {
  4867. this.saveLoading = false;
  4868. this.editDialogShow = false;
  4869. this.updateNodeTable();
  4870. this.$message({
  4871. type: "success",
  4872. message: "保存成功!",
  4873. });
  4874. });
  4875. } else {
  4876. this.editDialogShow = false;
  4877. this.updateNodeTable();
  4878. this.$message({
  4879. type: "success",
  4880. message: "保存成功!",
  4881. });
  4882. }
  4883. },
  4884. //文件题名(全局按钮)
  4885. fileTitleHandle(){
  4886. this.getFileTableData()
  4887. this.fileTitleVisible = true;
  4888. },
  4889. changeRadio(val){
  4890. console.log(val,'val');
  4891. const fileItem = this.fileTableData[this.chooseFileIndex];
  4892. this.$set(fileItem, 'type', val);
  4893. },
  4894. //获取文件题名规则
  4895. getFileTableData(){
  4896. this.fileTableLoading=true
  4897. getNameRule(
  4898. { projectId:this.projectid}
  4899. ).then((res) => {
  4900. this.fileTableLoading=false
  4901. if(res.data.data){
  4902. this.fileTableData = res.data.data;
  4903. this.fileTableData.forEach((element) => {
  4904. element.roleNameVal = element.nameRule.split(",");
  4905. element.ruleName=element.nameVaule.split("-")
  4906. if(element.type===2){
  4907. const list=element.list
  4908. let arr=[]
  4909. let arrId=[]
  4910. list.forEach((ele) => {
  4911. arr.push(ele.nodeName)
  4912. arrId.push(ele.nodeId)
  4913. });
  4914. element.ruleSizeVal = arr.join('、');
  4915. element.ruleSizeValId=arrId
  4916. }else{
  4917. element.ruleSizeVal=''
  4918. element.ruleSizeValId=''
  4919. }
  4920. });
  4921. }else{
  4922. this.fileTableData =[]
  4923. }
  4924. });
  4925. },
  4926. //获取文件题名范围
  4927. getTitleRangeData(row){
  4928. this.fileTreeLoading=true
  4929. getTitleRange(
  4930. { projectId:this.projectid,
  4931. nameId:row.nameId,
  4932. }
  4933. ).then((res) => {
  4934. this.fileTreeLoading=false
  4935. if(res.data.data){
  4936. this.fileTreeData = res.data.data;
  4937. // this.deCheckTreeKeys = this.fileTreeData.filter(node => node.status === 11).map(node => node.id);
  4938. }else{
  4939. this.fileTreeData =[]
  4940. }
  4941. });
  4942. },
  4943. //选择题名范围
  4944. chooseFile(index,row){
  4945. const {ruleName}=row
  4946. if(ruleName&&ruleName.length>0){
  4947. this.chooseFileVisible = true;
  4948. this.chooseFileIndex= index;
  4949. this.deCheckTreeKeys=row.ruleSizeValId
  4950. this.getTitleRangeData(row)
  4951. }else{
  4952. this.$message.warning('请先选择文件题名规则');
  4953. }
  4954. },
  4955. checkFileSize(data,{checkedNodes,checkedKeys}){
  4956. let checkedTitles = checkedNodes.map(node => node.nodeName).join('、');
  4957. this.fileTableData[this.chooseFileIndex].isEdit1=false
  4958. const fileItem = this.fileTableData[this.chooseFileIndex];
  4959. this.$set(fileItem, 'ruleSizeVal', checkedTitles);
  4960. this.$set(fileItem, 'ruleSizeValId', checkedKeys);
  4961. this.deCheckTreeKeys=checkedKeys
  4962. },
  4963. getCheckedNodes (treeData, checkedKeys) {
  4964. let result = []
  4965. treeData.forEach(node => {
  4966. if (checkedKeys&&checkedKeys.includes(node.id)) {
  4967. result.push(node)
  4968. }
  4969. if (node.children) {
  4970. result = result.concat(getCheckedNodes(node.children, checkedKeys))
  4971. }
  4972. })
  4973. return result
  4974. },
  4975. saveFileSize(){
  4976. // const checkedNodes = this.getCheckedNodes(this.fileTreeData, this.deCheckTreeKeys).filter(node => node.status !== 11)
  4977. const checkedNodes = this.getCheckedNodes(this.fileTreeData, this.deCheckTreeKeys)
  4978. this.fileTableData[this.chooseFileIndex].ruleSizeValId = checkedNodes.map(node => node.id)
  4979. this.fileTableData[this.chooseFileIndex].ruleSizeVal = checkedNodes.map(node => node.nodeName).join('、')
  4980. this.chooseFileVisible = false;
  4981. this.isShowSize=false
  4982. setTimeout(()=>{
  4983. this.isShowSize=true
  4984. },100)
  4985. },
  4986. editRow(index,row){
  4987. console.log(row,'row');
  4988. this.$set(row, "isEdit", true);
  4989. this.$set(row, "isEdit1", true);
  4990. this.fileTitleModel.type=row.type
  4991. },
  4992. //保存文件题名
  4993. saveRow(index,row){
  4994. if(row.ruleName.length<1){
  4995. this.$message.warning('请选择文件题名规则')
  4996. return
  4997. }
  4998. if(!row.type){
  4999. this.$message.warning('请选择文件题名范围')
  5000. return
  5001. }
  5002. this.$set(row, "isEdit", false);
  5003. this.$set(row, "isEdit1", false)
  5004. const ruleName=row.ruleName.join('-')
  5005. let ruleSizeVal=''
  5006. if(row.type==1){
  5007. ruleSizeVal=''
  5008. }else{
  5009. ruleSizeVal=row.ruleSizeValId.join(',')
  5010. }
  5011. let nameRuleDtos={
  5012. nameId:row.nameId,
  5013. nameRule:ruleName,
  5014. nodeId:ruleSizeVal,
  5015. projectId:this.projectid,
  5016. type:this.fileTitleModel.type
  5017. }
  5018. saveOrUpdateNameRule(
  5019. [nameRuleDtos]
  5020. ).then((res) => {
  5021. if(res.data.code==200){
  5022. this.$message.success(res.data.msg)
  5023. this.getFileTableData()
  5024. }else{
  5025. this.$message.error(res.data.msg)
  5026. }
  5027. });
  5028. },
  5029. changeRoleName(data,row){
  5030. const originalData=this.nodeTypelist
  5031. const dictKeyToDictValueMap = originalData.reduce((acc, item) => {
  5032. acc[item.dictKey] = item.dictValue;
  5033. return acc;
  5034. }, {});
  5035. const result = data.map(dictKey => dictKeyToDictValueMap[dictKey]);
  5036. this.$set(row, "roleNameVal", result);
  5037. this.selectDiv=Math.random()
  5038. },
  5039. addRow(){
  5040. this.fileTableData.unshift({isEdit:true,isEdit1:true,})
  5041. this.fileTitleModel.type=''
  5042. },
  5043. refreshRow(){
  5044. this.getFileTableData()
  5045. },
  5046. delRow(index,row){
  5047. if(!row.nameId){
  5048. this.fileTableData.splice(index,1)
  5049. }else{
  5050. this.$confirm("确定将选择数据删除?", {
  5051. confirmButtonText: "确定",
  5052. cancelButtonText: "取消",
  5053. type: "warning"
  5054. })
  5055. .then(() => {
  5056. return deletedNameRule(
  5057. {nameId:row.nameId}
  5058. ).then((res) => {
  5059. if(res.data.code==200){
  5060. this.$message.success(res.data.msg)
  5061. this.getFileTableData()
  5062. }else{
  5063. this.$message.error(res.data.msg)
  5064. }
  5065. });
  5066. });
  5067. }
  5068. },
  5069. batchsaveFileSize(){
  5070. let isCansave=true
  5071. let saveArr=[]
  5072. this.fileTableData.forEach((ele)=>{
  5073. if(ele.ruleName.length<1||!ele.type){
  5074. this.$message.warning('请先完善相关信息')
  5075. isCansave=false
  5076. return
  5077. }
  5078. let ruleSizeVal=''
  5079. if(ele.type==1){
  5080. ruleSizeVal=''
  5081. }else{
  5082. ruleSizeVal=ele.ruleSizeValId.join(',')
  5083. }
  5084. const ruleName=ele.ruleName.join('-')
  5085. saveArr.push({
  5086. nameId:ele.nameId||'',
  5087. nameRule:ruleName,
  5088. nodeId:ruleSizeVal,
  5089. projectId:this.projectid,
  5090. type:ele.type
  5091. })
  5092. })
  5093. if(!isCansave){
  5094. return
  5095. }
  5096. this.saveFileLoading=true
  5097. saveOrUpdateNameRule(
  5098. saveArr
  5099. ).then((res) => {
  5100. this.saveFileLoading=false
  5101. if(res.data.code==200){
  5102. this.$message.success(res.data.msg)
  5103. this.getFileTableData()
  5104. }else{
  5105. this.$message.error(res.data.msg)
  5106. }
  5107. });
  5108. },
  5109. async proSyncbtn(){
  5110. console.log('项目数据同步');
  5111. this.isAdd=''
  5112. this.getTypeOptions()
  5113. this.getRangeOptions()
  5114. this.getCheckIdList()
  5115. this.proSyncTag=true
  5116. if(this.$refs.syncProTree){
  5117. this.$refs.syncProTree.setCheckedKeys([])
  5118. }
  5119. if(this.$refs.proTable){
  5120. this.$refs.proTable.clearSelection()
  5121. }
  5122. this.isShowLeft=true
  5123. this.isShowTable=false
  5124. },
  5125. getRangeOptions(){
  5126. getDictionary({
  5127. code: "wbs_snyc_range",
  5128. }).then((res) => {
  5129. this.rangeOptions = res.data.data;
  5130. });
  5131. },
  5132. getTypeOptions(){
  5133. getDictionary({
  5134. code: "wbs_sync_type",
  5135. }).then((res) => {
  5136. this.typeOptions = res.data.data;
  5137. });
  5138. },
  5139. handleCheckChange1(data){
  5140. console.log(data,'data1111111111');
  5141. getNodeStatus({ id:data.primaryKeyId}).then((res) => {
  5142. if(res.data.code==200){
  5143. if(res.data.data){
  5144. this.$message.success('该节点有同步任务,请取消选择')
  5145. }
  5146. }else{
  5147. this.$message.error(res.data.msg)
  5148. }
  5149. });
  5150. },
  5151. async handleCheckChange(_,{checkedKeys,halfCheckedNodes}) {
  5152. let ids=checkedKeys && checkedKeys.length ? checkedKeys.join(',') : ''
  5153. // await this.getNodeStatusData()
  5154. this.getTempProjectList(ids)
  5155. },
  5156. async getTempProjectList(ids){
  5157. if(ids.length>0){
  5158. //分页获取证书列表数据
  5159. const { data: res } = await getTempProject({
  5160. nodeIds:ids
  5161. });
  5162. if (res.code == 200) {
  5163. this.templateIdList = res.data;
  5164. }
  5165. }
  5166. },
  5167. async changeTemplateId(val){
  5168. if(!this.isShowTable){
  5169. return
  5170. }
  5171. let type=''
  5172. let projectId=''
  5173. let wbsId=''
  5174. for (let index = 0; index < this.templateIdList.length; index++) {
  5175. const elemet = this.templateIdList[index];
  5176. if(elemet.id==val){
  5177. type = elemet.type;
  5178. this.typeTem=elemet.type
  5179. projectId=elemet.id
  5180. wbsId=elemet.wbsId
  5181. break
  5182. }
  5183. }
  5184. if(type===2){
  5185. selectByNodeTable(this.curTreeData.id, projectId, wbsId).then((res) => {
  5186. if (res.data.data&&res.data.data.length > 0) {
  5187. this.preTableData = res.data.data;
  5188. } else {
  5189. this.preTableData = [];
  5190. }
  5191. });
  5192. }else{
  5193. const { data: res } = await findNodeTableByCondition1( this.curTreeData.id )
  5194. if (res.code === 200) {
  5195. console.log(Array.isArray(res.data));
  5196. if (Array.isArray(res.data)) {
  5197. this.preTableData = res.data
  5198. } else {
  5199. this.preTableData = []
  5200. }
  5201. }
  5202. }
  5203. },
  5204. async getCheckIdList(){
  5205. let code=this.wbsType!==1?'wbs_sync_contract_range':'wbs_sync_contract_quality'
  5206. getDictionary({
  5207. code: code,
  5208. }).then((res) => {
  5209. this.checkIdList = res.data.data;
  5210. });
  5211. },
  5212. closeProSyncTag(){
  5213. this.proSyncTag=false
  5214. this.syncForm={
  5215. range:'',
  5216. rangeName:'',
  5217. type:[],
  5218. typeName:'',
  5219. templateId:'',
  5220. templateName:'',
  5221. contractRange:[],
  5222. contractRangeName:'',
  5223. nodeId:'',
  5224. formIds:''};
  5225. this.preTableData=[]
  5226. this.isShowLeft=false
  5227. },
  5228. async saveProTag(){
  5229. this.syncForm.projectId=this.projectid
  5230. if(this.isShowLeft){
  5231. let ids=this.$refs.syncProTree.getCheckedKeys()
  5232. this.syncForm.nodeId=ids.join(',')
  5233. if(this.syncForm.nodeId===''){
  5234. this.$message.warning('请选择节点')
  5235. return
  5236. }
  5237. }else{
  5238. this.syncForm.nodeId=this.curTreeData.primaryKeyId
  5239. }
  5240. // await this.getNodeStatusData()
  5241. if(this.syncListDialog){
  5242. return
  5243. }
  5244. if(this.syncForm.rangeName==''){
  5245. for (let index = 0; index < this.rangeOptions.length; index++) {
  5246. const element =this. rangeOptions[index];
  5247. if(element.dictKey==this.syncForm.range){
  5248. this.syncForm.rangeName=element.dictValue
  5249. break
  5250. }
  5251. }
  5252. }
  5253. console.log(this.syncForm.range,'this.syncForm.range=');
  5254. if(this.syncForm.range===''){
  5255. this.$message.warning('请选择同步范围')
  5256. return
  5257. }
  5258. this.saveProTagLoading=true
  5259. addSync({
  5260. ...this.syncForm,
  5261. type:this.syncForm.type.join(','),
  5262. contractRange:this.syncForm.contractRange.join(',')
  5263. }
  5264. ).then((res) => {
  5265. console.log(res,'res');
  5266. this.saveProTagLoading=false
  5267. if(res.data.code==200){
  5268. this.$message.success(res.data.msg)
  5269. //this.getNodeStatusData()
  5270. console.log(res.data,'res.data');
  5271. this.syncListData.nodeNum=res.data.data.nodeNum
  5272. this.syncListData.nodeNumEnd=res.data.data.nodeNumEnd
  5273. if(this.isShowLeft){
  5274. this.isAdd=res.data.data.id
  5275. }else{
  5276. this.isAdd=''
  5277. }
  5278. this.syncListDialog=true
  5279. this.closeProSyncTag()
  5280. }else{
  5281. this.$message.error(res.data.msg)
  5282. this.saveProTagLoading=false
  5283. }
  5284. })
  5285. .finally(() => {
  5286. this.saveProTagLoading = false;
  5287. });
  5288. },
  5289. closeSyncListTag(){
  5290. this.syncListDialog=false;
  5291. this.updateNodeTable()
  5292. },
  5293. handleCheckAllChange(val) {
  5294. this.syncForm.type = val ? this.typeOptions.map(item => item.dictKey) : [];
  5295. this.isIndeterminate = false;
  5296. },
  5297. handleCheckAllChange1(val) {
  5298. this.syncForm.contractRange = val ? this.checkIdList.map(item => item.dictKey) : [];
  5299. this.isIndeterminate1 = false;
  5300. },
  5301. handleCheckedTypeChange(value){
  5302. let checkedCount = value.length;
  5303. this.checkAll = checkedCount === this.typeOptions.length;
  5304. this.isIndeterminate = checkedCount > 0 && checkedCount < this.typeOptions.length;
  5305. },
  5306. handleCheckedTypeChange1(value){
  5307. let checkedCount = value.length;
  5308. this.checkAll1 = checkedCount === this.checkIdList.length;
  5309. this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.checkIdList.length;
  5310. },
  5311. handleSelectionChange(val) {
  5312. let arr = []
  5313. if(val.length>0){
  5314. if(this.syncForm.range==='2'){
  5315. for (let index = 0; index < val.length; index++) {
  5316. let i = val[index];
  5317. arr.push(i.pkeyId)
  5318. }
  5319. this.syncForm.formIds=arr.join(',')
  5320. }else{
  5321. for (let index = 0; index < val.length; index++) {
  5322. let i = val[index];
  5323. if( this.typeTem===2){
  5324. arr.push(i.pkeyId)
  5325. }else{
  5326. arr.push(i.id)
  5327. }
  5328. }
  5329. console.log(arr,'arr');
  5330. this.syncForm.formIds=arr.join(',')
  5331. }
  5332. }
  5333. },
  5334. async handleCommand(command,row){
  5335. // await this.getNodeStatusData()
  5336. if(this.syncListDialog){
  5337. return
  5338. }
  5339. this.checkRow=row
  5340. if(command==='a'){
  5341. this.$confirm("当前表单配置将同步到项目下所有相同表单,请谨慎同步!!!!!!", "表单同步提醒", {
  5342. distinguishCancelAndClose: true,
  5343. confirmButtonText: "确定",
  5344. cancelButtonText: "取消",
  5345. }).then(() => {
  5346. addSync({
  5347. projectId:this.projectid,
  5348. range:'3',
  5349. nodeId:row.pkeyId,
  5350. nodeName:this.curTreeData.title,
  5351. }
  5352. ).then((res) => {
  5353. if(res.data.code==200){
  5354. this.$message.success(res.data.msg)
  5355. }else{
  5356. this.$message.error(res.data.msg)
  5357. }
  5358. })
  5359. });
  5360. }else if(command==='b'){
  5361. this.syncTableDialog=true
  5362. this.isShowLeft=true
  5363. if(this.$refs.proTable1){
  5364. this.$refs.proTable1.clearSelection()
  5365. }
  5366. }
  5367. },
  5368. saveTableSync(){
  5369. this.saveTableSyncLoad=true
  5370. addSync({
  5371. projectId:this.projectid,
  5372. range:'4',
  5373. nodeId:this.checkRow.pkeyId,
  5374. nodeName:this.curTreeData.title,
  5375. formIds:this.formIds,
  5376. }
  5377. ).then((res) => {
  5378. this.saveTableSyncLoad=false
  5379. if(res.data.code==200){
  5380. this.$message.success(res.data.msg)
  5381. this.syncTableDialog=false
  5382. this.$refs.proTable1.clearSelection()
  5383. this.updateNodeTable()
  5384. }else{
  5385. this.$message.error(res.data.msg)
  5386. }
  5387. })
  5388. this.saveTableSyncLoad=false
  5389. },
  5390. handleNodeClick(data) {
  5391. selectByNodeTable(data.id, this.projectid, this.id).then((res) => {
  5392. if (res.data.data.length) {
  5393. this.preTableData1 = res.data.data;
  5394. } else {
  5395. this.preTableData1 = [];
  5396. }
  5397. });
  5398. },
  5399. handleSelectionChange1(val) {
  5400. if (val.length > 1) {
  5401. // 如果选择了多个,只保留最后一个
  5402. this.$nextTick(() => {
  5403. this.$refs.proTable1.clearSelection();
  5404. this.$refs.proTable1.toggleRowSelection(val.pop());
  5405. });
  5406. }
  5407. if(val.length>0){
  5408. this.formIds=val[0].pkeyId
  5409. }else{
  5410. this.formIds=''
  5411. }
  5412. },
  5413. async refreshData(){
  5414. this.refreshLoading=true
  5415. getNodeStatus({ id:this.curTreeData.primaryKeyId}).then((res) => {
  5416. this.refreshLoading=false
  5417. if(res.data.code==200){
  5418. if(res.data.data){
  5419. this.syncListData.nodeNum=res.data.data.nodeNum
  5420. this.syncListData.nodeNumEnd=res.data.data.nodeNumEnd
  5421. }else{
  5422. this.syncListData={
  5423. nodeNum:'',//同步节点数量
  5424. nodeNumEnd:''//已同步数量
  5425. }
  5426. }
  5427. }else{
  5428. this.syncListData={
  5429. nodeNum:'',//同步节点数量
  5430. nodeNumEnd:''//已同步数量
  5431. }
  5432. this.$message.error(res.data.msg)
  5433. }
  5434. }).finally(() => {
  5435. this.refreshLoading = false;
  5436. });
  5437. },
  5438. refreshData1(){
  5439. console.log('shuax');
  5440. this.refreshLoading1=true
  5441. getById({ id:this.isAdd}).then((res) => {
  5442. this.refreshLoading1=false
  5443. if(res.data.code==200){
  5444. if(res.data.data){
  5445. this.syncListData.nodeNum=res.data.data.nodeNum
  5446. this.syncListData.nodeNumEnd=res.data.data.nodeNumEnd
  5447. }else{
  5448. this.syncListData={
  5449. nodeNum:'',//同步节点数量
  5450. nodeNumEnd:''//已同步数量
  5451. }
  5452. }
  5453. }else{
  5454. this.syncListData={
  5455. nodeNum:'',//同步节点数量
  5456. nodeNumEnd:''//已同步数量
  5457. }
  5458. this.$message.error(res.data.msg)
  5459. }
  5460. });
  5461. },
  5462. getNodeStatusData(){
  5463. let ids=''
  5464. if(this.isShowLeft){
  5465. ids=this.$refs.syncProTree.getCheckedKeys()
  5466. ids=ids.join(',')
  5467. }
  5468. else{
  5469. ids=this.curTreeData.primaryKeyId
  5470. }
  5471. getNodeStatus({ id:ids}).then((res) => {
  5472. if(res.data.code==200){
  5473. if(res.data.data){
  5474. this.syncListData.nodeNum=res.data.data.nodeNum
  5475. this.syncListData.nodeNumEnd=res.data.data.nodeNumEnd
  5476. this.syncListDialog=true
  5477. }else{
  5478. this.syncListData={
  5479. nodeNum:'',//同步节点数量
  5480. nodeNumEnd:''//已同步数量
  5481. }
  5482. this.syncListDialog=false
  5483. }
  5484. }else{
  5485. this.syncListDialog=false
  5486. this.syncListData={
  5487. nodeNum:'',//同步节点数量
  5488. nodeNumEnd:''//已同步数量
  5489. }
  5490. this.$message.error(res.data.msg)
  5491. }
  5492. });
  5493. },
  5494. //基础数据管理
  5495. handleBasicClick(command) {
  5496. if (command === "code") {
  5497. this.codeDialog = true;
  5498. this.$refs.codeSetRef.show(this.projectid)
  5499. }else if(command === "rule") {
  5500. this.$router.push({
  5501. path: "/rule/manager",
  5502. query: {
  5503. id: this.id,
  5504. parentId:this.nodeDetail.parentId,
  5505. tenant_id: this.userInfo.tenant_id,
  5506. projectid: this.projectid,
  5507. },
  5508. });
  5509. }
  5510. }
  5511. },
  5512. watch: {
  5513. "GLExcelFrom.search"(val) {
  5514. console.log(val);
  5515. if (this.exceldata) {
  5516. this.$refs.tree.filter(val);
  5517. }
  5518. },
  5519. 'syncForm.contractRange': {
  5520. handler(newVal) {
  5521. if (newVal && newVal.length) {
  5522. const selectedValues = newVal.map(key => {
  5523. const item = this.checkIdList.find(item => item.dictKey === key);
  5524. return item ? item.dictValue : key;
  5525. });
  5526. this.syncForm.contractRangeName = selectedValues.join(',');
  5527. } else {
  5528. this.syncForm.contractRangeName = '';
  5529. }
  5530. },
  5531. immediate: true
  5532. },
  5533. 'syncForm.templateId': {
  5534. handler(newVal) {
  5535. if (newVal && newVal.length) {
  5536. for (let index = 0; index < this.templateIdList.length; index++) {
  5537. const elemet = this.templateIdList[index];
  5538. if(elemet.id==newVal){
  5539. this.syncForm.templateName = elemet.name;
  5540. break
  5541. }
  5542. }
  5543. } else {
  5544. this.syncForm.rangeName = '';
  5545. }
  5546. },
  5547. immediate: true
  5548. },
  5549. 'syncForm.type': {
  5550. handler(newVal) {
  5551. if (newVal && newVal.length) {
  5552. const selectedValues = newVal.map(key => {
  5553. const item = this.typeOptions.find(item => item.dictKey === key);
  5554. return item ? item.dictValue : key;
  5555. });
  5556. this.syncForm.typeName = selectedValues.join(',');
  5557. } else {
  5558. this.syncForm.typeName = '';
  5559. }
  5560. },
  5561. immediate: true
  5562. },
  5563. 'syncForm.range': {
  5564. handler(newVal) {
  5565. console.log(newVal,'newVal');
  5566. if (newVal && newVal.length) {
  5567. for (let index = 0; index < this.rangeOptions.length; index++) {
  5568. const elemet = this.rangeOptions[index];
  5569. if(elemet.dictKey==newVal){
  5570. this.syncForm.rangeName = elemet.dictValue;
  5571. break
  5572. }
  5573. }
  5574. } else {
  5575. this.syncForm.rangeName = '';
  5576. }
  5577. },
  5578. immediate: true
  5579. },
  5580. },
  5581. components: {
  5582. dynamicExcel,
  5583. ManualSorting,
  5584. FormulaEdit,
  5585. EditElement,
  5586. FormulaEditone,
  5587. CodeSet
  5588. },
  5589. };
  5590. </script>
  5591. <style scoped lang="scss">
  5592. .font-s-12 ::v-deep .iconfont {
  5593. font-size: 12px;
  5594. }
  5595. .el-popper[x-placement^="bottom"] {
  5596. margin-top: -6px;
  5597. }
  5598. .right-btn {
  5599. position: absolute;
  5600. right: 20px;
  5601. top: 10px;
  5602. font-size: 20px;
  5603. }
  5604. .custom-tree-node {
  5605. .normal-black {
  5606. display: none;
  5607. }
  5608. &:hover {
  5609. .normal-black {
  5610. display: inline-block;
  5611. }
  5612. }
  5613. &.show .normal-black {
  5614. display: inline-block;
  5615. }
  5616. }
  5617. .excelBox {
  5618. ::v-deep .el-dialog__body {
  5619. padding: 20px;
  5620. }
  5621. }
  5622. //调整表单样式
  5623. .excelHtml {
  5624. position: absolute;
  5625. z-index: 999999;
  5626. top: 50px;
  5627. left: 0px;
  5628. width: 100%;
  5629. height: 100%;
  5630. }
  5631. .jiedian {
  5632. ::v-deep .el-dialog__body {
  5633. padding: 10px 20px !important;
  5634. }
  5635. }
  5636. .filter-tree {
  5637. min-width: 100%;
  5638. display: inline-block;
  5639. }
  5640. .full-dialog {
  5641. ::v-deep .el-dialog__body {
  5642. padding-bottom: 0;
  5643. padding-top: 0;
  5644. }
  5645. ::v-deep .basic-container {
  5646. height: calc(100vh - 60px);
  5647. }
  5648. }
  5649. .my-basic-con {
  5650. padding: 6px 6px;
  5651. }
  5652. // 树形控件菜单样式
  5653. .contextmenu {
  5654. margin: 0;
  5655. background: #fff;
  5656. z-index: 1000;
  5657. position: fixed; //关键样式设置固定定位
  5658. list-style-type: none;
  5659. padding: 5px 0;
  5660. border-radius: 4px;
  5661. font-size: 12px;
  5662. font-weight: 400;
  5663. color: #333;
  5664. box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
  5665. }
  5666. .contextmenu li {
  5667. margin: 0;
  5668. padding: 7px 16px;
  5669. cursor: pointer;
  5670. }
  5671. .contextmenu li:hover {
  5672. background: #eee;
  5673. }
  5674. .selectBtn {
  5675. position: absolute;
  5676. top: 50px;
  5677. right: 585px;
  5678. z-index: 1000;
  5679. width: 140px;
  5680. text-align: left;
  5681. }
  5682. .titlerow {
  5683. // float: right;
  5684. background-color: rgba(31, 34, 41, 0.8);
  5685. // width:104%;
  5686. padding-left: 10px;
  5687. padding-right: 10px;
  5688. text-align: right;
  5689. margin-top: -20px;
  5690. margin-left: -20px;
  5691. margin-right: -20px;
  5692. }
  5693. .dialog-title{
  5694. display: flex;
  5695. }
  5696. .dialog-title-text{
  5697. flex: 0.4;
  5698. padding-left: 10px;
  5699. }
  5700. .dialog-title-tip{
  5701. flex: 0.6;
  5702. // position: absolute;
  5703. color:rgba(255, 125, 67, 1);
  5704. padding-left: 40px;
  5705. // right: 60px;
  5706. }
  5707. .sync-container{
  5708. margin-top: -30px;
  5709. display: flex;
  5710. height: 570px;
  5711. .box-card-1{
  5712. margin-right: 10px;
  5713. height: 100%;
  5714. overflow-y: auto;
  5715. }
  5716. .box-card-2{
  5717. flex: 1;
  5718. height: 100%;
  5719. overflow-y: auto;
  5720. .el-form-item {
  5721. border: 1px solid #dcdfe6;
  5722. padding: 0 10px 10px 10px;
  5723. border-radius: 4px;
  5724. font-weight: bold;
  5725. .el-form-item__label {
  5726. font-weight: bold;
  5727. padding-bottom: 0px;
  5728. }
  5729. .el-form--label-top .el-form-item__label{
  5730. padding: 0px !important;
  5731. }
  5732. }
  5733. }
  5734. }
  5735. .content-box{
  5736. display: flex;
  5737. flex-direction: column;
  5738. justify-content: center;
  5739. align-items: center;
  5740. font-weight: bolder;
  5741. .mt-14{
  5742. margin-top: 14px;
  5743. }
  5744. }
  5745. </style>
  5746. <style lang="scss">
  5747. .el-dialog.hc-link-nodes-dialog {
  5748. width: 500px;
  5749. margin-top: 50px !important;
  5750. height: calc(100% - 100px);
  5751. .el-dialog__body {
  5752. height: calc(100% - 154px);
  5753. border-top: 1px solid #eee;
  5754. border-bottom: 1px solid #eee;
  5755. padding: 14px;
  5756. overflow: auto;
  5757. }
  5758. }
  5759. .el-tree.hc-link-nodes-tree .el-tree-node .el-tree-node__content {
  5760. .el-checkbox {
  5761. display: none;
  5762. }
  5763. .is-leaf + .el-checkbox {
  5764. display: inline-block;
  5765. }
  5766. }
  5767. .warning-text{
  5768. color: orange;
  5769. font-weight: bold;
  5770. }
  5771. .orange {
  5772. color: orange;
  5773. }
  5774. .box-card-2{
  5775. .el-form-item {
  5776. .el-form-item__content {
  5777. line-height: 10px !important;
  5778. margin-top: -10px !important;
  5779. }
  5780. }
  5781. }
  5782. </style>