tree.vue 180 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164
  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. class="filter-tree"
  1956. lazy
  1957. :load="loadNode"
  1958. show-checkbox
  1959. :props="defaultProps"
  1960. :expand-on-click-node="false"
  1961. highlight-current
  1962. node-key="primaryKeyId"
  1963. @check="handleCheckChange"
  1964. @check-change="handleCheckChange1"
  1965. ref="syncProTree"
  1966. >
  1967. </el-tree>
  1968. </div>
  1969. </el-scrollbar>
  1970. </el-card>
  1971. <el-card class="box-card-2">
  1972. <el-form ref="syncForm" :model="syncForm" label-position="top">
  1973. <el-form-item label="同步范围" v-if="!isShowTable">
  1974. <el-radio-group v-model="syncForm.range">
  1975. <el-radio
  1976. v-for="item in rangeOptions"
  1977. :key="item.id"
  1978. :label="item.dictKey"
  1979. >{{ item.dictValue}}</el-radio>
  1980. </el-radio-group>
  1981. </el-form-item>
  1982. <el-form-item label="同步类型" prop="type">
  1983. <el-checkbox :indeterminate="isIndeterminate" v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
  1984. <div style="margin: 15px 0;"></div>
  1985. <el-checkbox-group v-model="syncForm.type" @change="handleCheckedTypeChange">
  1986. <el-checkbox v-for="item in typeOptions" :label="item.dictKey" :key="item.id">{{ item.dictValue}}</el-checkbox>
  1987. </el-checkbox-group>
  1988. </el-form-item>
  1989. <!-- <el-form-item label="选择同步范围(节点状态)" prop="contractRange" v-if="syncForm.range==='2'">
  1990. <el-checkbox-group v-model="syncForm.contractRange">
  1991. <el-checkbox label="全选" name="1"></el-checkbox>
  1992. <el-checkbox v-for="(item,index) in checkIdList" :label="item.dictKey" :key="item.id">{{ item.dictValue}}</el-checkbox>
  1993. </el-checkbox-group>
  1994. </el-form-item> -->
  1995. <el-form-item label="选择同步范围(节点状态)" prop="contractRange" v-if="syncForm.range==='2'">
  1996. <el-checkbox :indeterminate="isIndeterminate1" v-model="checkAll1" @change="handleCheckAllChange1">全选</el-checkbox>
  1997. <div style="margin: 15px 0;"></div>
  1998. <el-checkbox-group v-model="syncForm.contractRange" @change="handleCheckedTypeChange1">
  1999. <el-checkbox v-for="item in checkIdList" :label="item.dictKey" :key="item.id">{{ item.dictValue}}</el-checkbox>
  2000. </el-checkbox-group>
  2001. </el-form-item>
  2002. <el-form-item label="选择同步源" prop="templateId" v-else>
  2003. <el-select v-model="syncForm.templateId" placeholder="请选择同步源" style="width: 100%;" size="small" @change="changeTemplateId">
  2004. <el-option
  2005. v-for="item in templateIdList"
  2006. :key="item.id"
  2007. :label="item.name"
  2008. :value="item.id">
  2009. </el-option>
  2010. </el-select>
  2011. </el-form-item>
  2012. </el-form>
  2013. <div class="table-box" v-if="isShowTable">
  2014. <h4 style="margin-left: 4px;">表单预览</h4>
  2015. <el-table
  2016. size="small"
  2017. ref="proTable"
  2018. :data="preTableData"
  2019. stripe
  2020. style="width: 100%"
  2021. max-height="300"
  2022. @selection-change="handleSelectionChange"
  2023. >
  2024. <el-table-column
  2025. type="selection"
  2026. width="55">
  2027. </el-table-column>
  2028. <el-table-column
  2029. prop="tableName"
  2030. label="表单名称"
  2031. width="180">
  2032. </el-table-column>
  2033. <el-table-column
  2034. prop="tableType"
  2035. :formatter="formatTableType"
  2036. label="表单类型"
  2037. width="180">
  2038. </el-table-column>
  2039. <el-table-column
  2040. prop="tableOwner"
  2041. :formatter="formatOwner"
  2042. label="所属方">
  2043. </el-table-column>
  2044. </el-table>
  2045. </div>
  2046. </el-card>
  2047. </div>
  2048. <span slot="footer" class="dialog-footer">
  2049. <el-button @click="closeProSyncTag">取 消</el-button>
  2050. <el-button type="primary" @click="saveProTag" :loading="saveProTagLoading">确 定</el-button>
  2051. </span>
  2052. </el-dialog>
  2053. <!-- 同步队列 -->
  2054. <el-dialog
  2055. title="同步队列"
  2056. :visible.sync="syncListDialog"
  2057. width="30%"
  2058. append-to-body
  2059. :close-on-click-modal="false"
  2060. @close="closeSyncListTag"
  2061. >
  2062. <div class="content-box" v-loading="refreshLoading||refreshLoading1">
  2063. <el-image
  2064. style="width: 100px; height: 100px"
  2065. :src="require('@/assets/loader.svg')"
  2066. fit="contain"></el-image>
  2067. <div class="mt-14">同步中</div>
  2068. <div class="mt-14">
  2069. 同步数量{{ syncListData.nodeNum }} 剩余数量{{ syncListData.nodeNumEnd }}
  2070. </div>
  2071. <div class="mt-14">
  2072. <el-button type="primary" @click="syncListDialog=false">好的,我已知晓</el-button>
  2073. </div>
  2074. <div class="mt-14">
  2075. <el-link type="primary" @click="refreshData" v-loading="refreshLoading" v-if="!isAdd">刷新数据</el-link>
  2076. <el-link type="primary" @click="refreshData1" v-loading="refreshLoading1" v-else>刷新数据</el-link>
  2077. </div>
  2078. </div>
  2079. </el-dialog>
  2080. <!-- 同步表单其他配置 -->
  2081. <el-dialog
  2082. title="同步表单其他配置"
  2083. :visible.sync="syncTableDialog"
  2084. width="70%"
  2085. append-to-body
  2086. :close-on-click-modal="false"
  2087. >
  2088. <div class="sync-container">
  2089. <el-card class="box-card-1" :style="{ width: isShowLeft ? '40%' : '0%' }">
  2090. <el-scrollbar style="height: 100%;">
  2091. <div >
  2092. <el-tree
  2093. class="filter-tree"
  2094. lazy
  2095. :load="loadNode"
  2096. @node-click="handleNodeClick"
  2097. :default-expanded-keys="defaultExpandedKeys"
  2098. :props="defaultProps"
  2099. :expand-on-click-node="false"
  2100. highlight-current
  2101. node-key="primaryKeyId"
  2102. >
  2103. </el-tree>
  2104. </div>
  2105. </el-scrollbar>
  2106. </el-card>
  2107. <el-card class="box-card-2">
  2108. <div class="table-box">
  2109. <h4 style="margin-left: 4px;">表单预览</h4>
  2110. <el-table
  2111. size="small"
  2112. ref="proTable1"
  2113. :data="preTableData1"
  2114. stripe
  2115. style="width: 100%"
  2116. max-height="300"
  2117. @selection-change="handleSelectionChange1"
  2118. >
  2119. <el-table-column
  2120. type="selection"
  2121. width="55">
  2122. </el-table-column>
  2123. <el-table-column
  2124. prop="tableName"
  2125. label="表单名称"
  2126. width="180">
  2127. </el-table-column>
  2128. <el-table-column
  2129. prop="tableType"
  2130. :formatter="formatTableType"
  2131. label="表单类型"
  2132. width="180">
  2133. </el-table-column>
  2134. <el-table-column
  2135. prop="tableOwner"
  2136. :formatter="formatOwner"
  2137. label="所属方">
  2138. </el-table-column>
  2139. </el-table>
  2140. </div>
  2141. </el-card>
  2142. </div>
  2143. <span slot="footer" class="dialog-footer">
  2144. <el-button @click="syncTableDialog = false">取 消</el-button>
  2145. <el-button type="primary" @click="saveTableSync" :loading="saveTableSyncLoad">确 定</el-button>
  2146. </span>
  2147. </el-dialog>
  2148. <!-- 编号设置弹窗 -->
  2149. <CodeSet ref="codeSetRef" ></CodeSet>
  2150. </div>
  2151. </template>
  2152. <script>
  2153. import ManualSorting from "@/components/WbsTree/ManualSorting";
  2154. import dynamicExcel from "./treeTemplate/dynamicExcel.vue";
  2155. import FormulaEdit from "@/views/formula/edit.vue";
  2156. import FormulaEditone from "@/views/formula/edit1.vue";
  2157. import EditElement from "@/views/manager/projectinfo/editElement/editElement.vue";
  2158. import CodeSet from "./codeSet.vue";
  2159. import {
  2160. saveFormAndElement,
  2161. selectFormElements,
  2162. importWbsTree,
  2163. findWbsTreePrivateSameLevel,
  2164. wbsTreePrivateSort,
  2165. parameters,
  2166. saveOrUpdateBatch,
  2167. keymap,
  2168. updateBatchNodeTableInfo2,
  2169. updateStatus,
  2170. getParamElements,
  2171. specifiedParamElements,
  2172. delParamElements,
  2173. selectPrivateFormElements,
  2174. syncCurrentFormInProject,
  2175. getQueryValueByType,
  2176. getQueryValueByNodeType,
  2177. getTreeByType,
  2178. } from "@/api/manager/wbstree";
  2179. import {
  2180. saveElement,
  2181. remove as removeElement,
  2182. updateBatchElements,
  2183. getTemplate,
  2184. importWbsElement,
  2185. } from "@/api/manager/wbsformelement";
  2186. import {
  2187. getLazytree,
  2188. getDetail,
  2189. update,
  2190. findNodeTableByCondition as selectByNodeTable,
  2191. removeTableByCondition as removeTableById,
  2192. removePrivateTreeNode,
  2193. wbsTreePrivateTableSort,
  2194. privateSubmitFullName,
  2195. syncNodeParam,
  2196. syncProjecteVisa,
  2197. syncNodeTable,
  2198. syncNodeinfo,
  2199. tabTypeLazyTree,
  2200. syncContractTabSort,
  2201. linkNodeTree,
  2202. getLinekNodeTreelist,getNameRule,getTitleRange,saveOrUpdateNameRule,deletedNameRule,delTabInfoAll
  2203. } from "@/api/manager/wbsprivate";
  2204. import { findProjectTree as getAlltree } from "@/api/manager/projectinfo";
  2205. import { refrehPram } from "@/api/manager/wbstree";
  2206. import { getList as getAttchFromOriginalName } from "@/api/resource/attach";
  2207. import { getDictionary, getChildList } from "@/api/system/dict";
  2208. import { mapGetters } from "vuex";
  2209. import {
  2210. getList,
  2211. tabLazytreeAll,
  2212. saveLinkTab,
  2213. getExcelHtml,
  2214. } from "@/api/exctab/excelmodel";
  2215. import { getStore, setStore } from "@/util/store";
  2216. import { getTempProject,addSync,getNodeStatus,getById } from "@/api/manager/ledger";
  2217. import { selectByNodeTable as findNodeTableByCondition1 } from "@/api/manager/wbstree";
  2218. export default {
  2219. data() {
  2220. var checkMajorDataType = (rule, value, callback) => {
  2221. //console.log(this.nodeDetail.nodeType)
  2222. //console.log(this.nodeDetail.majorDataType)
  2223. if (this.nodeDetail.nodeType == 6) {
  2224. if (!this.nodeDetail.majorDataType) {
  2225. callback(new Error("工序节点必须选择内业资料类型"));
  2226. }
  2227. }
  2228. callback();
  2229. };
  2230. return {
  2231. isNodeType:true,
  2232. isRestoringSelection: false,
  2233. expandedKeysType: [],
  2234. defaultExpandedKeysType: [],
  2235. currentNodeKey: null, // 保存当前选中的节点key
  2236. fromcurNode: {},
  2237. formDatass: [],
  2238. editElementFormTag: false,
  2239. editeditElementFormMFLoading: false,
  2240. jiedianId: "",
  2241. //#region
  2242. sortTag: false,
  2243. sortTag2: false,
  2244. sureSortload: false,
  2245. surePrivateSortload: false,
  2246. sort: [],
  2247. //#endregion
  2248. //#region 关联清表
  2249. loading: false,
  2250. GLExcel: false,
  2251. GLExcelFrom: {
  2252. id: "",
  2253. name: "",
  2254. search: "", //搜素框舒服的值
  2255. ids: "",
  2256. excelId: "",
  2257. initTableName: "",
  2258. initTableId: "",
  2259. },
  2260. GLExcelData: [], //
  2261. GLExcelProps: {
  2262. label: "name",
  2263. children: "children",
  2264. disabled: "hasChildren",
  2265. isLeaf: function (data) {
  2266. let tag = false;
  2267. if (!data.hasChildren) {
  2268. tag = true;
  2269. }
  2270. if (data.isExistForm == 1) {
  2271. tag = true;
  2272. }
  2273. return tag;
  2274. },
  2275. },
  2276. exceldata: [], //清表模板
  2277. GLExcelLoading: false,
  2278. //#endregion
  2279. //#region 调整表单
  2280. adjustmentExcel: "",
  2281. excelHtml: false,
  2282. //#endregion
  2283. //#region
  2284. id: "",
  2285. projectid: "",
  2286. filterText: "",
  2287. filterText1: "",
  2288. isShowTree1:true,
  2289. treeData: [],
  2290. searchType: "1",
  2291. isSearch: false,
  2292. searchTreeData: [],
  2293. searchtreeLoad: false,
  2294. treeLoad: false,
  2295. isShowTree: true,
  2296. menuShow: false,
  2297. defaultProps: {
  2298. children: "children",
  2299. label: "title",
  2300. isLeaf: function (data) {
  2301. //console.log(data, !data.hasChildren, data.isExistForm);
  2302. let tag = false;
  2303. if (!data.hasChildren) {
  2304. tag = true;
  2305. }
  2306. /*if (data.isExistForm == 1) {
  2307. tag = true;
  2308. }*/
  2309. if (data.nodeType >= 6 && data.nodeType <= 13) {
  2310. tag = true;
  2311. }
  2312. //中间交工。开工报告、质量评定)
  2313. if (
  2314. data.majorDataType == 1 ||
  2315. data.majorDataType == 2 ||
  2316. data.majorDataType == 3
  2317. ) {
  2318. tag = true;
  2319. }
  2320. return tag;
  2321. // return !data.hasChildren || (data.isExistForm == 1);
  2322. },
  2323. },
  2324. defaultPropsByType:{
  2325. children: 'children',
  2326. label: 'title',
  2327. isLeaf:function (data) {
  2328. return !data.hasChildren
  2329. }
  2330. },
  2331. leftType: 5,
  2332. curTreeData: {},
  2333. curTreeNode: {},
  2334. tableData: [],
  2335. nodeDetail: {},
  2336. formData: [],
  2337. editType: 1,
  2338. dialogVisible: false,
  2339. saveNodeLoading: false,
  2340. nodeTypelist1: [],
  2341. majorDataTypeList: [],
  2342. rules: {
  2343. nodeName: [
  2344. { required: true, message: "请输入节点名称", trigger: "blur" },
  2345. ],
  2346. nodeType: [
  2347. { required: true, message: "请选择节点类型", trigger: "change" },
  2348. ],
  2349. majorDataType: [{ validator: checkMajorDataType, trigger: "change" }],
  2350. isAddConceal: [
  2351. {
  2352. required: true,
  2353. message: "请选择是否新增中隐藏",
  2354. trigger: "change",
  2355. },
  2356. ],
  2357. },
  2358. eleVisible: false,
  2359. tableTypelist: [],
  2360. dataTypeList: [],
  2361. ownerTypeList: [],
  2362. eleForm: {
  2363. elementList: [],
  2364. },
  2365. eleRules: {
  2366. nodeName: [
  2367. { required: true, message: "请输入表名称", trigger: "blur" },
  2368. ],
  2369. tableType: [
  2370. { required: true, message: "请选择表类型", trigger: "change" },
  2371. ],
  2372. tableOwner: [
  2373. { required: true, message: "请选择所属方", trigger: "change" },
  2374. ],
  2375. },
  2376. importVisible: false,
  2377. tempList: [],
  2378. curEleTable: {},
  2379. istableType: true,
  2380. editEleVisible: false,
  2381. editEleList: [],
  2382. eleReg: /(≥|≤|±|【】)?([^≥≤±【】]*)/,
  2383. editEleFormulaVisible: false,
  2384. isMeter: false,
  2385. formulaInput: "",
  2386. editEleListFilter: [],
  2387. editEleListAll: [],
  2388. importTemplateVisible: false,
  2389. fileUrl: "",
  2390. upFile: null,
  2391. importLoading: false,
  2392. nodeInfoVisible: false,
  2393. nodeInfoTable: [],
  2394. nodeInfoTableLoad: false,
  2395. namelist: [],
  2396. namelists: [],
  2397. delids: [],
  2398. infoNameVisible: false,
  2399. excelSortTag: false,
  2400. excelSortTag2: false,
  2401. tableSortList: [],
  2402. //#endregion
  2403. defaultExpandedKeys: [],
  2404. expandName: this.$route.fullPath,
  2405. aliasVisible: false, //别名
  2406. aliasInput: "",
  2407. aliasArr: [],
  2408. formulaCompVisible: false, //公式弹框
  2409. formulaCompVisible1: false,
  2410. formulaCurRow: {}, //当前元素
  2411. editElementVisible: false, //编辑元素弹框
  2412. editElementQuery: {
  2413. pkeyId: "",
  2414. excelId: "",
  2415. id: "",
  2416. initTableName: "",
  2417. initTableId: "",
  2418. pid: "",
  2419. wbsid: "",
  2420. nodeid: "",
  2421. }, //传参
  2422. syncBtnLoad: false,
  2423. syncElectricLoad: false,
  2424. showType: 1,
  2425. typeTreeData: [],
  2426. testTreeLoad: false,
  2427. testTreeData: [],
  2428. mixRatioTestIds: [],
  2429. //节点参数,关联元素
  2430. curParam: {}, //当前节点参数
  2431. linkEleVisible: false,
  2432. linkEleTableList: [], //元素表数组
  2433. curLinkEleTable: {}, //当前元素表
  2434. linkCheckVisible: false, //关联弹框
  2435. linkEleList: [], //元素数组
  2436. linkEleKey: "", //搜索关键字
  2437. menusData: [
  2438. // {icon: 'el-icon-s-promotion', label: '新增节点', key: "add"},
  2439. {
  2440. icon: "el-icon-s-promotion",
  2441. label: "编辑节点",
  2442. key: "edit",
  2443. content: "编辑节点",
  2444. },
  2445. {
  2446. icon: "el-icon-upload",
  2447. label: "后管数据同步",
  2448. key: "sync1",
  2449. content: "后管数据同步",
  2450. },
  2451. {
  2452. icon: "el-icon-upload",
  2453. label: "同步到合同段",
  2454. key: "sync3",
  2455. content: "同步到合同段",
  2456. },
  2457. {
  2458. icon: "el-icon-sort",
  2459. label: "调整排序",
  2460. key: "sort",
  2461. content: "调整排序",
  2462. },
  2463. {
  2464. icon: "el-icon-s-promotion",
  2465. label: "删除节点",
  2466. key: "del",
  2467. content: "删除节点",
  2468. },
  2469. ], //树组件操作菜单
  2470. menuvisible: false,
  2471. menuleft: 20,
  2472. menutop: 0,
  2473. //同步菜单按钮
  2474. menuoptions: [
  2475. {
  2476. value: "jdSync",
  2477. label: "节点参数同步",
  2478. load: false,
  2479. },
  2480. {
  2481. value: "dqSync",
  2482. label: "电签同步",
  2483. load: false,
  2484. },
  2485. {
  2486. value: "gsSync",
  2487. label: "公式同步",
  2488. load: false,
  2489. },
  2490. // {
  2491. // value: "zdSync",
  2492. // label: "字典同步",
  2493. // load: false,
  2494. // },
  2495. ],
  2496. menuvalue: "",
  2497. isshowSyncbtn: false,
  2498. projectName: "",
  2499. nodeInfoSaveload: false,
  2500. handlesyncLoad: false, //表单同步
  2501. isLinkNodes: false,
  2502. linkNodesLoad: false,
  2503. checkedLinkNodesKeys: [],
  2504. rowPkeyId: "",
  2505. nodesCheck: [],
  2506. standardTypeOptions: [], //标准分类
  2507. unitOptions: [], //单位名称
  2508. editDialogShow: false, //编辑元素
  2509. searchinput: "",
  2510. editTable: [],
  2511. editEleTableloading: false,
  2512. dynamicDictList: [],
  2513. saveLoading: false,
  2514. fileTitleVisible:false,
  2515. deCheckTreeKeys:[],
  2516. fileTableData:[
  2517. ],
  2518. fileTitleRef:null,
  2519. fileTitleModel:{
  2520. type:'',
  2521. },
  2522. fileTreeLoading:false,
  2523. fileTreeData:[],
  2524. filedefaultProps:{
  2525. children: 'children',
  2526. label: 'nodeName',
  2527. disabled:function (data) {
  2528. return data.status===11 ;
  2529. },
  2530. },
  2531. fileTitleRules:{
  2532. type: [
  2533. { required: true, message: '请选择题名范围', trigger: 'blur' },
  2534. ],
  2535. },
  2536. fileTableLoading:false,
  2537. chooseFileVisible:false,
  2538. chooseFileRow: {},
  2539. chooseFileIndex: -1,
  2540. isShowSize:true,
  2541. selectDiv:Math.random(),
  2542. saveFileLoading:false,
  2543. proSyncTag:false,
  2544. rangeOptions:[],
  2545. typeOptions:[],
  2546. checkAll: false,
  2547. checkAll1: false,
  2548. isIndeterminate: false,
  2549. isIndeterminate1: false,
  2550. syncForm:{
  2551. range:'',
  2552. rangeName:'',
  2553. type:[],
  2554. typeName:'',
  2555. templateId:'',
  2556. templateName:'',
  2557. contractRange:[],
  2558. contractRangeName:'',
  2559. formIds:''
  2560. },
  2561. preTableData:[],
  2562. multipleSelection: [],
  2563. checkIdList:[
  2564. ],
  2565. isShowLeft:false,
  2566. isShowTable:false,
  2567. templateIdList:[],//同步源
  2568. saveProTagLoading:false,
  2569. syncTableDialog:false,
  2570. preTableData1:[],
  2571. formIds:'',
  2572. saveTableSyncLoad:false,
  2573. checkRow:null,
  2574. syncListDialog:false,
  2575. refreshLoading:false,
  2576. syncListData:{
  2577. nodeNum:'',//同步节点数量
  2578. nodeNumEnd:''//已同步数量
  2579. },
  2580. isAdd:'',
  2581. refreshLoading1:false,
  2582. codeDialog:false,
  2583. codeSetRef: null,
  2584. typeTem:'',
  2585. isShowTree1:true,
  2586. cachedNodes: new Map(), // 缓存已加载的节点数据
  2587. };
  2588. },
  2589. computed: {
  2590. ...mapGetters(["userInfo"]),
  2591. },
  2592. created() {
  2593. this.init();
  2594. // 尝试恢复之前选中的节点
  2595. // // 尝试恢复之前的状态
  2596. // this.restoreTreeState();
  2597. // 从本地存储恢复展开的keys
  2598. // const savedExpandedKeys = JSON.parse(localStorage.getItem('treeExpandedKeys') || '[]');
  2599. // this.defaultExpandedKeysType = savedExpandedKeys;
  2600. },
  2601. methods: {
  2602. //#region
  2603. changeType(val){
  2604. console.log(val,'val');
  2605. this.isNodeType=val
  2606. this.formData=[]
  2607. localStorage.setItem('isNodeType',val);
  2608. this.filterText1=''
  2609. },
  2610. init() {
  2611. //this.id = this.$route.query.wbsid;
  2612. //this.projectid = this.$route.query.pid;
  2613. const { wbsid, pid, type } = this.$route.query;
  2614. this.id = wbsid;
  2615. this.projectid = pid;
  2616. this.wbsType = type ? Number(type) : 1;
  2617. this.getNodeTypelistData()
  2618. this.getNodeTypelist();
  2619. this.getTableTypelist();
  2620. this.getDataTypelist();
  2621. this.getOwnerTypelist();
  2622. this.getStandardTypeOptions();
  2623. this.getMajorDataTypeList();
  2624. this.defaultExpandedKeys = getStore({ name: this.expandName });
  2625. this.projectName = this.$route.query.projectName;
  2626. },
  2627. loadNode(node, resolve) {
  2628. let pid = 0;
  2629. if (node.level != 0) {
  2630. pid = node.data.id;
  2631. }
  2632. const type = this.wbsType;
  2633. getLazytree(this.id, pid, this.userInfo.tenant_id, this.projectid, {
  2634. wbsType: type,
  2635. }).then((res) => {
  2636. let arr = [];
  2637. if (Array.isArray(res.data.data)) {
  2638. arr = res.data.data;
  2639. }
  2640. return resolve(arr);
  2641. });
  2642. },
  2643. // 在 loadNodeByType 中恢复选中状态
  2644. loadNodeByType(node, resolve) {
  2645. // 如果有缓存且不是根节点,直接返回缓存
  2646. if (node.level !== 0 && this.cachedNodes.has(node.data.id)) {
  2647. return resolve(this.cachedNodes.get(node.data.id));
  2648. }
  2649. let pid = 12345678910;
  2650. if (node.level != 0) {
  2651. pid = node.data.id;
  2652. }
  2653. getTreeByType({
  2654. parentId: pid,
  2655. projectId: this.projectid,
  2656. current: 1,
  2657. size: 1000,
  2658. titleName: this.filterText1
  2659. }).then((res) => {
  2660. let arr = [];
  2661. if (Array.isArray(res.data.data['records'])) {
  2662. arr = res.data.data['records'];
  2663. }
  2664. resolve(arr);
  2665. // 恢复选中状态
  2666. this.$nextTick(() => {
  2667. if (this.currentNodeKey) {
  2668. this.$refs.treeByType.setCurrentKey(this.currentNodeKey);
  2669. }
  2670. });
  2671. }).catch(error => {
  2672. console.error('加载树节点失败:', error);
  2673. resolve([]);
  2674. });
  2675. },
  2676. saveTreeState() {
  2677. const tree = this.$refs.treeByType;
  2678. if (!tree) return;
  2679. // 保存当前选中节点
  2680. this.currentNodeKey = tree.getCurrentKey();
  2681. // 保存所有展开节点
  2682. this.defaultExpandedKeysType = [];
  2683. const traverse = (node) => {
  2684. if (node.expanded && node.data) {
  2685. this.defaultExpandedKeysType.push(node.data.id);
  2686. }
  2687. if (node.childNodes) {
  2688. node.childNodes.forEach(traverse);
  2689. }
  2690. };
  2691. traverse(tree.store.root);
  2692. },
  2693. // 节点展开时保存状态
  2694. handleNodeExpand(data) {
  2695. if (!this.defaultExpandedKeysType.includes(data.id)) {
  2696. this.defaultExpandedKeysType.push(data.id);
  2697. }
  2698. },
  2699. // 节点折叠时更新状态
  2700. handleNodeCollapse(data) {
  2701. const index = this.defaultExpandedKeysType.indexOf(data.id);
  2702. if (index > -1) {
  2703. this.defaultExpandedKeysType.splice(index, 1);
  2704. }
  2705. },
  2706. getNodeDetail(data, node) {
  2707. console.log("getNodeDetail", data);
  2708. let parentName = "";
  2709. if (node.parent.data) {
  2710. parentName = node.parent.data.title;
  2711. }
  2712. this.curTreeData = data;
  2713. this.curTreeNode = node;
  2714. this.curTreeData.parentName = parentName;
  2715. getDetail(data.id, this.id, this.projectid).then((res) => {
  2716. res.data.data.parentName = parentName;
  2717. let tableObj=res.data.data;
  2718. tableObj.primaryKeyId=data.primaryKeyId
  2719. this.tableData = [res.data.data];
  2720. this.nodeDetail = Object.assign({}, res.data.data);
  2721. });
  2722. this.updateNodeTable();
  2723. // this.nodeTypeChange(data.nodeType)
  2724. //获取节点展开路径
  2725. this.getExpandedKeys(node);
  2726. },
  2727. getNodeDetailByType(data, node) {
  2728. console.log(data, 'data');
  2729. // 保存当前选中的节点
  2730. this.currentNodeKey = data.id;
  2731. this.curTreeData = data;
  2732. this.curTreeNode = node;
  2733. data.tableName = data.title;
  2734. this.formData = [data];
  2735. // 只存储node对象中的必要信息,避免循环引用
  2736. const nodeInfo = {
  2737. id: node.data.id,
  2738. label: node.label,
  2739. level: node.level,
  2740. isLeaf: node.isLeaf,
  2741. expanded: node.expanded,
  2742. // 其他你需要的属性
  2743. };
  2744. localStorage.setItem('lastDataNode', JSON.stringify(nodeInfo));
  2745. },
  2746. saveNode() {
  2747. const type = this.wbsType;
  2748. this.$refs["nodeDetail"].validate((valid) => {
  2749. if (valid) {
  2750. const { mixRatioTestIds, nodeType } = this.nodeDetail;
  2751. if (type === 2 && nodeType === 53) {
  2752. if (mixRatioTestIds) {
  2753. if (this.editType == 1) {
  2754. this.addNode();
  2755. } else if (this.editType == 2) {
  2756. this.updateNode();
  2757. }
  2758. } else {
  2759. this.$message({
  2760. type: "error",
  2761. message: "请先选择节点",
  2762. });
  2763. return false;
  2764. }
  2765. } else {
  2766. if (this.editType == 1) {
  2767. this.addNode();
  2768. } else if (this.editType == 2) {
  2769. this.updateNode();
  2770. }
  2771. }
  2772. } else {
  2773. console.log("error submit!!");
  2774. return false;
  2775. }
  2776. });
  2777. },
  2778. addNode() {
  2779. this.saveNodeLoading = true;
  2780. update(this.nodeDetail).then(() => {
  2781. this.updateTreeNewNode();
  2782. this.dialogVisible = false;
  2783. this.$message({
  2784. type: "success",
  2785. message: "新增成功!",
  2786. });
  2787. });
  2788. },
  2789. updateNode() {
  2790. update(this.nodeDetail).then(() => {
  2791. let node = this.tableData[0];
  2792. node.nodeName = this.nodeDetail.nodeName;
  2793. node.nodeType = this.nodeDetail.nodeType;
  2794. this.curTreeData.title = this.nodeDetail.nodeName;
  2795. this.dialogVisible = false;
  2796. this.$message({
  2797. type: "success",
  2798. message: "修改成功!",
  2799. });
  2800. });
  2801. },
  2802. toSplit(val) {
  2803. return val ? String(val).split(",") : "";
  2804. },
  2805. setLeftType(type, data, node) {
  2806. this.jiedianId = data.id;
  2807. this.getNodeTypelistData()
  2808. if (type == 4 || type == 5) {
  2809. this.leftType = type;
  2810. }
  2811. this.curTreeData = data;
  2812. this.curTreeNode = node;
  2813. this.$refs.tree.setCurrentKey(data.id);
  2814. if (type == 1 || type == 2) {
  2815. this.getMajorDataTypeList();
  2816. this.dialogVisible = true;
  2817. this.editType = type;
  2818. }
  2819. getDetail(data.id, this.id, this.projectid).then((res) => {
  2820. let parentName = "";
  2821. if (node.parent.data) {
  2822. parentName = node.parent.data.title;
  2823. }
  2824. res.data.data.parentName = parentName;
  2825. this.tableData = [res.data.data];
  2826. if (type == 1) {
  2827. this.nodeDetail = {
  2828. parentId: res.data.data.id,
  2829. parentName: parentName,
  2830. projectId: res.data.data.projectId,
  2831. };
  2832. } else {
  2833. this.nodeDetail = Object.assign({}, res.data.data);
  2834. this.mixRatioTestIds = this.toSplit(res.data.data.mixRatioTestIds);
  2835. }
  2836. this.nodeDetail.type = 1; // '1'节点 '2'表单
  2837. this.nodeDetail.wbsId = this.id;
  2838. this.nodeDetail.tenantId = this.userInfo.tenant_id;
  2839. this.changeStandType(this.nodeDetail.className);
  2840. });
  2841. if (this.leftType == 4) {
  2842. selectByNodeTable(data.id, this.projectid, this.id).then((res) => {
  2843. if (res.data.data.length) {
  2844. this.formData = res.data.data;
  2845. } else {
  2846. this.formData = [];
  2847. }
  2848. });
  2849. }
  2850. //获取节点展开路径
  2851. this.getExpandedKeys(node);
  2852. },
  2853. showFormElement() {
  2854. if (!this.nodeDetail.id) {
  2855. this.$message({
  2856. type: "warning",
  2857. message: "请先选择在哪个节点下创建表",
  2858. });
  2859. return;
  2860. }
  2861. this.eleVisible = true;
  2862. },
  2863. addEleRow(list) {
  2864. list.push({});
  2865. },
  2866. delEleRow(index, list) {
  2867. list.splice(index, 1);
  2868. },
  2869. saveFormAndElementHandle() {
  2870. this.$refs["eleDialog"].validate((valid) => {
  2871. if (valid) {
  2872. this.eleForm.wbsId = this.id;
  2873. this.eleForm.tenantId = this.userInfo.tenant_id;
  2874. this.eleForm.nodeType = -1;
  2875. this.eleForm.type = 2; // '1'节点 '2'表单
  2876. this.eleForm.parentId = this.nodeDetail.id;
  2877. this.eleForm.elementList.forEach((element) => {
  2878. element.eAllowDeviation =
  2879. (element.allow ? element.allow : "") +
  2880. (element.deviation ? element.deviation : "");
  2881. if (element.eType == 4) {
  2882. element.eLength = 0;
  2883. }
  2884. });
  2885. saveFormAndElement(this.eleForm).then(() => {
  2886. //console.log(res)
  2887. this.updateTreeNewNode();
  2888. this.updateNodeTable();
  2889. this.eleVisible = false;
  2890. this.$message({
  2891. type: "success",
  2892. message: "新增成功!",
  2893. });
  2894. });
  2895. } else {
  2896. console.log("error submit!!");
  2897. return false;
  2898. }
  2899. });
  2900. },
  2901. updateTreeNewNode() {
  2902. getLazytree(
  2903. this.id,
  2904. this.nodeDetail.parentId,
  2905. this.userInfo.tenant_id,
  2906. this.projectid
  2907. ).then((res) => {
  2908. this.$refs.tree.updateKeyChildren(
  2909. this.nodeDetail.parentId,
  2910. res.data.data
  2911. );
  2912. });
  2913. },
  2914. updateNodeTable() {
  2915. if(this.isNodeType){
  2916. selectByNodeTable( this.curTreeData.id, this.projectid, this.id).then(
  2917. (res) => {
  2918. if (res.data.data && res.data.data.length) {
  2919. this.formData = res.data.data;
  2920. this.formData.forEach((ele) => {
  2921. ele.nodeType = Number(ele.nodeType);
  2922. });
  2923. } else {
  2924. this.formData = [];
  2925. }
  2926. }
  2927. );
  2928. }else{
  2929. console.log(8888888);
  2930. this.reloadEntireTree();
  2931. }
  2932. },
  2933. async reloadEntireTree() {
  2934. this.isNodeType = false;
  2935. // 1. 获取树组件引用和当前选中节点
  2936. const tree = this.$refs.treeByType;
  2937. if (!tree) return;
  2938. const currentKey = tree.getCurrentKey();
  2939. const currentPath = [];
  2940. // 2. 收集当前选中节点的路径和所有展开节点
  2941. const allExpandedNodes = [];
  2942. const traverseTree = (node) => {
  2943. if (node.expanded && node.level > 0) {
  2944. allExpandedNodes.push({
  2945. id: node.data.id,
  2946. node: node
  2947. });
  2948. }
  2949. if (node.childNodes) {
  2950. node.childNodes.forEach(traverseTree);
  2951. }
  2952. };
  2953. traverseTree(tree.store.root);
  2954. // 3. 获取选中节点的完整路径
  2955. if (currentKey) {
  2956. const currentNode = tree.getNode(currentKey);
  2957. if (currentNode) {
  2958. let parent = currentNode.parent;
  2959. while (parent && parent.level > 0) {
  2960. currentPath.unshift(parent.data.id);
  2961. parent = parent.parent;
  2962. }
  2963. currentPath.push(currentKey); // 包含当前节点本身
  2964. }
  2965. }
  2966. // 4. 清空缓存
  2967. this.cachedNodes.clear();
  2968. // 5. 强制重新加载当前路径上的所有节点
  2969. for (const nodeId of currentPath) {
  2970. const node = tree.getNode(nodeId);
  2971. if (node) {
  2972. node.loaded = false; // 标记为需要重新加载
  2973. // 从缓存中移除
  2974. this.cachedNodes.delete(nodeId);
  2975. }
  2976. }
  2977. // 6. 关闭所有非当前路径的展开节点
  2978. allExpandedNodes.forEach(({id, node}) => {
  2979. if (!currentPath.includes(id)) {
  2980. node.expanded = false;
  2981. node.loaded = false; // 标记为需要重新加载
  2982. this.cachedNodes.delete(id);
  2983. }
  2984. });
  2985. // 7. 重新加载根节点
  2986. const rootNode = tree.store.root;
  2987. const rootId = rootNode.childNodes[0].data.id || 'root';
  2988. await this.$nextTick();
  2989. tree.updateKeyChildren(rootId, []);
  2990. const root = tree.getNode(rootId);
  2991. if (root) {
  2992. root.loaded = false;
  2993. root.expand();
  2994. }
  2995. // 8. 等待树重新加载完成
  2996. await new Promise(resolve => {
  2997. const checkLoaded = () => {
  2998. if (root.loaded) {
  2999. resolve();
  3000. } else {
  3001. setTimeout(checkLoaded, 50);
  3002. }
  3003. };
  3004. checkLoaded();
  3005. });
  3006. // 9. 重新展开当前路径
  3007. this.defaultExpandedKeysType = [...currentPath];
  3008. for (const nodeId of currentPath) {
  3009. const node = tree.getNode(nodeId);
  3010. if (node && !node.expanded) {
  3011. node.expand();
  3012. // 等待节点加载
  3013. await new Promise(resolve => {
  3014. const checkNodeLoaded = () => {
  3015. if (node.loaded) {
  3016. resolve();
  3017. } else {
  3018. setTimeout(checkNodeLoaded, 50);
  3019. }
  3020. };
  3021. checkNodeLoaded();
  3022. });
  3023. }
  3024. }
  3025. // 10. 恢复选中状态
  3026. if (currentKey) {
  3027. // 检查节点是否仍然存在
  3028. const currentNode = tree.getNode(currentKey);
  3029. if (currentNode) {
  3030. tree.setCurrentKey(currentKey);
  3031. this.currentNodeData = currentNode.data;
  3032. this.formData = [{
  3033. ...this.currentNodeData,
  3034. tableName: this.currentNodeData.title
  3035. }];
  3036. } else {
  3037. // 节点已被删除
  3038. this.currentNodeKey = null;
  3039. this.currentNodeData = null;
  3040. this.formData = [];
  3041. // this.$message.warning('当前选中节点已被删除');
  3042. }
  3043. }
  3044. },
  3045. // 关闭所有非路径上的展开节点
  3046. closeOtherExpandedNodes(tree, keepOpenPath) {
  3047. const closeNodes = (node) => {
  3048. if (node.expanded && node.level > 0) {
  3049. const nodeId = node.data.id;
  3050. // 如果节点不在需要保持展开的路径中,则关闭它
  3051. if (!keepOpenPath.includes(nodeId)) {
  3052. node.expanded = false;
  3053. }
  3054. }
  3055. if (node.childNodes) {
  3056. node.childNodes.forEach(closeNodes);
  3057. }
  3058. };
  3059. // 从根节点开始遍历
  3060. closeNodes(tree.store.root);
  3061. },
  3062. deleNode(data, node) {
  3063. let pid = data.primaryKeyId ? data.primaryKeyId : data.pKeyId;
  3064. this.$confirm(
  3065. "此操作将删除节点【" + data.title + "】, 是否继续?",
  3066. "提示",
  3067. {
  3068. confirmButtonText: "确定",
  3069. cancelButtonText: "取消",
  3070. type: "warning",
  3071. }
  3072. )
  3073. .then(() => {
  3074. removePrivateTreeNode(pid).then(() => {
  3075. this.$refs.tree.remove(node);
  3076. this.$message({
  3077. type: "success",
  3078. message: "删除成功!",
  3079. });
  3080. });
  3081. })
  3082. .catch(() => {});
  3083. },
  3084. // 重新加载整棵树
  3085. importHandle() {},
  3086. handlePreview(index, row) {
  3087. this.curEleTable = row;
  3088. if(!this.curEleTable.initTableId){
  3089. this.$message({ type: "warning", message: '请先关联清表' })
  3090. return
  3091. }
  3092. selectPrivateFormElements(this.curEleTable.initTableId).then((res) => {
  3093. res.data.data.forEach((element) => {
  3094. this.eleReg.exec(element.eAllowDeviation);
  3095. element.allow = RegExp.$1 ? RegExp.$1 : "";
  3096. element.deviation = RegExp.$2 ? RegExp.$2 : "";
  3097. });
  3098. this.editEleList = res.data.data;
  3099. });
  3100. this.editEleVisible = true;
  3101. },
  3102. //关联节点
  3103. handleLinkNodes(index, row) {
  3104. this.rowPkeyId = row.pkeyId;
  3105. this.linkNodesLoad = false;
  3106. this.isLinkNodes = true;
  3107. getLinekNodeTreelist(row.pkeyId)
  3108. .then(({ data }) => {
  3109. const res = data.data;
  3110. if (res instanceof Array) {
  3111. this.checkedLinkNodesKeys = res;
  3112. } else {
  3113. this.checkedLinkNodesKeys = [];
  3114. }
  3115. })
  3116. .catch(() => {
  3117. this.checkedLinkNodesKeys = [];
  3118. });
  3119. },
  3120. //确定关联
  3121. linkNodesSave() {
  3122. const keys = this.$refs.tree2.getCheckedKeys();
  3123. // if (keys.length <= 0) {
  3124. // this.$message({
  3125. // type: "warning",
  3126. // message: "请先勾选节点",
  3127. // });
  3128. // return;
  3129. // }
  3130. const pkeyId = this.rowPkeyId;
  3131. this.linkNodesLoad = true;
  3132. linkNodeTree(keys.length >0?keys.join(","):'', pkeyId)
  3133. .then(() => {
  3134. this.$message({
  3135. type: "success",
  3136. message: "关联成功!",
  3137. });
  3138. this.linkNodesLoad = false;
  3139. this.linkNodesClose();
  3140. })
  3141. .catch(() => {
  3142. this.linkNodesLoad = false;
  3143. });
  3144. },
  3145. //关闭关联弹窗
  3146. linkNodesClose() {
  3147. this.isLinkNodes = false;
  3148. this.linkNodesLoad = false;
  3149. this.checkedLinkNodesKeys = [];
  3150. this.nodesCheck = [];
  3151. this.rowPkeyId = "";
  3152. },
  3153. handleDelete(index, row) {
  3154. this.$confirm("是否删除 " + row.tableName + " ?", "删除元素表", {
  3155. distinguishCancelAndClose: true,
  3156. confirmButtonText: "删除",
  3157. cancelButtonText: "取消",
  3158. }).then(() => {
  3159. if(this.isNodeType){
  3160. removeTableById(row.id, this.projectid, this.id).then(() => {
  3161. this.formData.splice(index, 1);
  3162. this.$message({
  3163. type: "success",
  3164. message: "删除成功!",
  3165. });
  3166. });
  3167. }else{
  3168. delTabInfoAll(row.pkeyId).then(() => {
  3169. this.formData.splice(index, 1);
  3170. this.$message({
  3171. type: "success",
  3172. message: "删除成功!",
  3173. });
  3174. });
  3175. }
  3176. });
  3177. },
  3178. async hideMD(row) {
  3179. //隐藏按钮
  3180. const code = await this.updateStatus(row.pkeyId, row.status);
  3181. if (code == 200) {
  3182. if (row.status == 0) {
  3183. row.status = 1;
  3184. } else {
  3185. row.status = 0;
  3186. }
  3187. }
  3188. },
  3189. async updateStatus(pKeyId, status) {
  3190. //隐藏功能激活
  3191. const { data: res } = await updateStatus({ pKeyId });
  3192. if (res.code == 200) {
  3193. this.$message({
  3194. type: "success",
  3195. message: status == 1 ? "隐藏成功" : "激活成功",
  3196. });
  3197. }
  3198. return res.code;
  3199. },
  3200. handleEditFormula(index, row) {
  3201. this.curEleTable = row;
  3202. selectFormElements(this.curEleTable.pkeyId, { type: 0 }).then((res) => {
  3203. this.editEleListFilter = res.data.data;
  3204. this.editEleListAll = [].concat(this.editEleListFilter);
  3205. });
  3206. this.editEleFormulaVisible = true;
  3207. },
  3208. //表单同步
  3209. handlesync(index, row) {
  3210. },
  3211. //搜索 筛选
  3212. searchFormulaName() {
  3213. this.editEleListFilter = this.editEleListAll.filter((ele) => {
  3214. return ele.eName.indexOf(this.formulaInput) > -1;
  3215. });
  3216. },
  3217. saveNewEle(row) {
  3218. row.eAllowDeviation =
  3219. (row.allow ? row.allow : "") + (row.deviation ? row.deviation : "");
  3220. row.fId = this.curEleTable.initTableId;
  3221. row.initTableName = this.curEleTable.initTableName;
  3222. if (row.eType == 4) {
  3223. row.eLength = 0;
  3224. }
  3225. saveElement(row).then((res) => {
  3226. if (res.data.data) {
  3227. this.$set(row, "id", res.data.data.id);
  3228. this.$set(row, "ekey", res.data.data.ekey);
  3229. this.$message({
  3230. type: "success",
  3231. message: "保存成功!",
  3232. });
  3233. }
  3234. });
  3235. },
  3236. delEleRowHandle(index, list) {
  3237. let row = list[index];
  3238. if (row.id) {
  3239. //有id需要请求删除
  3240. this.$confirm("是否确认删除?", "删除元素", {
  3241. distinguishCancelAndClose: true,
  3242. confirmButtonText: "删除",
  3243. cancelButtonText: "取消",
  3244. }).then(() => {
  3245. removeElement(row.id, this.curEleTable.initTableName, row.ekey).then(
  3246. () => {
  3247. list.splice(index, 1);
  3248. }
  3249. );
  3250. });
  3251. } else {
  3252. list.splice(index, 1);
  3253. }
  3254. },
  3255. nodeTypeChange(val) {
  3256. console.log(333333333);
  3257. if (val === 53) {
  3258. // if (this.testTreeData.length > 0) {
  3259. // return;
  3260. // }
  3261. this.testTreeLoad = true;
  3262. // getAlltreeTrial(this.projectid, this.id, this.curTreeData.primaryKeyId).then((res) => {
  3263. // this.testTreeLoad = false;
  3264. // console.log(res.data.data,'data');
  3265. // let trialdata=res.data.data
  3266. // if(trialdata&&trialdata.allTree){
  3267. // this.testTreeData = trialdata.allTree[0];
  3268. // if(trialdata.allStatusIds.length>0){
  3269. // //设置勾选相关联试验全选
  3270. // this.mixRatioTestIds =trialdata.allStatusIds[0];
  3271. // }
  3272. // }
  3273. // });
  3274. let pid = this.curTreeData.primaryKeyId
  3275. ? this.curTreeData.primaryKeyId
  3276. : this.curTreeData.pKeyId;
  3277. getAlltree(this.projectid, this.id, pid).then((res) => {
  3278. this.testTreeLoad = false;
  3279. console.log(res.data.data, "data");
  3280. this.testTreeData = res.data.data;
  3281. });
  3282. }
  3283. },
  3284. //根据逗号联合
  3285. toJoin(arr) {
  3286. return arr ? arr.join() : "";
  3287. },
  3288. TestTreeCheckChange(_, { checkedKeys, halfCheckedKeys }) {
  3289. // const newarr = [...checkedKeys, ...halfCheckedKeys];
  3290. const newarr = [...checkedKeys];
  3291. this.nodeDetail.mixRatioTestIds = this.toJoin(newarr);
  3292. },
  3293. // filterChange() {
  3294. // if (this.treeData.length > 0) {
  3295. // this.$refs.treeall.filter(this.filterText);
  3296. // return;
  3297. // }
  3298. // this.treeLoad = true;
  3299. // getAlltree(this.projectid, this.id).then((res) => {
  3300. // this.treeLoad = false;
  3301. // this.treeData = res.data.data;
  3302. // console.log(res.data.data,'res.data.data');
  3303. // this.$nextTick(() => {
  3304. // this.$refs.treeall.filter(this.filterText);
  3305. // });
  3306. // });
  3307. // },
  3308. //搜索树
  3309. //搜索树
  3310. searchTreeClick() {
  3311. if (this.filterText.length > 0) {
  3312. this.isSearch = true;
  3313. this.searchtreeLoad = true;
  3314. getQueryValueByType({
  3315. queryValue: this.filterText,
  3316. type: this.searchType,
  3317. wbsId: this.id,
  3318. projectId: this.projectid,
  3319. }).then((res) => {
  3320. let arr = [];
  3321. if (Array.isArray(res.data.data)) {
  3322. arr = res.data.data;
  3323. this.searchTreeData = arr;
  3324. } else {
  3325. this.searchTreeData = [];
  3326. }
  3327. });
  3328. } else {
  3329. this.isSearch = false;
  3330. }
  3331. this.searchtreeLoad = false;
  3332. },
  3333. searchTreeClick1() {
  3334. if(!this.curTreeData.hasChildren){
  3335. this.$message.warning('请先选择一个父节点');
  3336. return;
  3337. }
  3338. // if (!this.filterText1.trim()) {
  3339. // this.$message.warning('请输入搜索内容');
  3340. // return;
  3341. // }
  3342. // 保存当前状态
  3343. // 保存当前状态
  3344. this.saveTreeState();
  3345. // 清空缓存
  3346. this.cachedNodes.clear();
  3347. // 重新加载选中节点及其子节点
  3348. this.reloadSelectedNode();
  3349. },
  3350. // 清空搜索
  3351. clearSearch1() {
  3352. this.filterText1 = '';
  3353. this.searchTreeClick1();
  3354. },
  3355. // 重新加载选中节点
  3356. async reloadSelectedNode() {
  3357. const tree = this.$refs.treeByType;
  3358. if (!tree || !this.currentNodeKey) return;
  3359. // 获取当前节点
  3360. const currentNode = tree.getNode(this.currentNodeKey);
  3361. if (!currentNode) return;
  3362. // 标记为未加载,强制重新加载
  3363. currentNode.loaded = false;
  3364. currentNode.expand(); // 这会触发loadNodeByType
  3365. // 恢复状态
  3366. await this.$nextTick();
  3367. tree.setCurrentKey(this.currentNodeKey);
  3368. },
  3369. // 重新加载树
  3370. reloadTree() {
  3371. const tree = this.$refs.treeByType;
  3372. if (!tree) return;
  3373. // 清空根节点
  3374. const rootNode = tree.store.root;
  3375. const rootId = rootNode.childNodes[0].data.id || 'root';
  3376. tree.updateKeyChildren(rootId, []);
  3377. // 强制重新加载根节点
  3378. const root = tree.getNode(rootId);
  3379. if (root) {
  3380. root.loaded = false;
  3381. root.expand();
  3382. }
  3383. // 恢复状态
  3384. this.$nextTick(() => {
  3385. if (this.currentNodeKey) {
  3386. tree.setCurrentKey(this.currentNodeKey);
  3387. }
  3388. });
  3389. },
  3390. // 刷新树数据
  3391. filterSearchClick(){
  3392. this.isSearch = true;
  3393. this.searchtreeLoad = true;
  3394. getQueryValueByNodeType({
  3395. queryValue: this.filterText,
  3396. wbsId: this.id,
  3397. projectId: this.projectid,
  3398. }).then((res) => {
  3399. let arr = [];
  3400. if (Array.isArray(res.data.data)) {
  3401. arr = res.data.data;
  3402. this.searchTreeData = arr;
  3403. } else {
  3404. this.searchTreeData = [];
  3405. }
  3406. });
  3407. this.searchtreeLoad = false;
  3408. },
  3409. clearSearch() {
  3410. this.isSearch = false;
  3411. },
  3412. importTemplate(data) {
  3413. this.importTemplateVisible = true;
  3414. this.curTreeData = data;
  3415. if (!this.fileUrl) {
  3416. getAttchFromOriginalName(1, 20, {
  3417. originalName: "WBS划分模板.xls",
  3418. }).then((res) => {
  3419. if (res.data.data.records.length) {
  3420. this.fileUrl = res.data.data.records[0].link;
  3421. } else {
  3422. this.fileUrl = "";
  3423. }
  3424. });
  3425. }
  3426. },
  3427. importTemplateHandle() {
  3428. if (!this.upFile) {
  3429. this.$message({
  3430. type: "warning",
  3431. message: "请先选择文件再进行导入",
  3432. });
  3433. return;
  3434. }
  3435. let forms = new FormData();
  3436. forms.append("excelFile", this.upFile);
  3437. let wbsTreeFu = {
  3438. wbsId: this.id,
  3439. parentId: this.curTreeData.id,
  3440. // ancestors:'0,'+this.curTreeData.id,
  3441. };
  3442. let json = JSON.stringify(wbsTreeFu);
  3443. let blob = new Blob([json], { type: "application/json" });
  3444. forms.append("wbsTreeFu", blob);
  3445. this.importLoading = true;
  3446. importWbsTree(forms)
  3447. .then(() => {
  3448. //this.$router.go(0)
  3449. let node = this.$refs.tree.getNode(this.curTreeData.id);
  3450. node.isLeaf = false;
  3451. this.importTemplateVisible = false;
  3452. this.upFile = null;
  3453. })
  3454. .finally(() => {
  3455. this.importLoading = false;
  3456. });
  3457. },
  3458. handleDownload() {
  3459. if (this.fileUrl) {
  3460. window.open(this.fileUrl);
  3461. } else {
  3462. this.$message({
  3463. type: "warning",
  3464. message: "请先在附件管理上传【WBS划分模板.xls】文件",
  3465. });
  3466. }
  3467. },
  3468. fileClick() {
  3469. this.$refs.file.click();
  3470. },
  3471. fileChange(e) {
  3472. const file = e.target.files[0];
  3473. if (!file) {
  3474. // 如果用户没有选择图片,只是点了文件上传这个按钮
  3475. return;
  3476. }
  3477. //console.log(file)
  3478. this.upFile = file;
  3479. },
  3480. editNodeInfo(index, row) {
  3481. this.$set(row, "isEdit", true);
  3482. },
  3483. saveNodeInfoHandle(index, row) {
  3484. row.isEdit = false;
  3485. },
  3486. downloadTmp() {
  3487. getTemplate().then((res) => {
  3488. //console.log(res)
  3489. let blob = new Blob([res.data], {
  3490. type: "application/vnd.ms-excel",
  3491. });
  3492. //console.log(blob)
  3493. let filename = Date.parse(new Date()) + ".xls";
  3494. if (window.navigator.msSaveOrOpenBlob) {
  3495. // 兼容IE10
  3496. window.navigator.msSaveBlob(blob, filename);
  3497. } else {
  3498. // 兼容chrome/firefox
  3499. let aTag = document.createElement("a");
  3500. aTag.download = Date.parse(new Date()) + ".xls";
  3501. aTag.href = window.URL.createObjectURL(blob);
  3502. aTag.click();
  3503. URL.revokeObjectURL(aTag.href);
  3504. }
  3505. });
  3506. },
  3507. fileClick2() {
  3508. this.$refs.file2.click();
  3509. },
  3510. tmpImport(e) {
  3511. const file = e.target.files[0];
  3512. const formData = new FormData();
  3513. formData.append("file", file);
  3514. //console.log(file.name)
  3515. importWbsElement(formData)
  3516. .then((res) => {
  3517. res.data.data.forEach((element) => {
  3518. element.eName = element.elementName;
  3519. element.eLength = element.elementLength;
  3520. element.eType = Number(element.elementType);
  3521. element.eAllowDeviation = element.elementAllowDeviation;
  3522. element.eInspectionMethod = element.elementInspectionMethod;
  3523. this.eleReg.exec(element.eAllowDeviation);
  3524. // console.log(RegExp.$1)
  3525. // console.log(RegExp.$2)
  3526. element.allow = RegExp.$1 ? RegExp.$1 : "";
  3527. element.deviation = RegExp.$2 ? RegExp.$2 : "";
  3528. });
  3529. this.eleForm.elementList = res.data.data;
  3530. this.importVisible = false;
  3531. })
  3532. .finally(() => {
  3533. e.target.value = "";
  3534. });
  3535. },
  3536. visiblechange(value, data) {
  3537. this.$set(data, "moreShow", value);
  3538. },
  3539. bianhua2() {
  3540. this.excelSortTag2 = false;
  3541. this.$nextTick(() => {
  3542. this.excelSortTag2 = true;
  3543. });
  3544. },
  3545. //私有树的元素表修改排序
  3546. privateTableSort() {
  3547. if (!this.curTreeData.id) {
  3548. this.$message({
  3549. type: "warning",
  3550. message: "请先选择需要排序的节点",
  3551. });
  3552. return;
  3553. }
  3554. this.tableSortList = this.formData.map((form, index) => {
  3555. return {
  3556. sort: index + 1,
  3557. nodeName: form.tableName,
  3558. pkeyId: form.pkeyId,
  3559. };
  3560. });
  3561. this.excelSortTag = true;
  3562. this.excelSortTag2 = true;
  3563. },
  3564. editPrivateSort() {
  3565. this.surePrivateSortload = true;
  3566. wbsTreePrivateTableSort(this.tableSortList).then(() => {
  3567. this.$message({
  3568. type: "success",
  3569. message: "排序成功!",
  3570. });
  3571. this.updateNodeTable();
  3572. this.surePrivateSortload = false;
  3573. this.excelSortTag = false;
  3574. this.excelSortTag2 = false;
  3575. });
  3576. },
  3577. //解析元素数据类型
  3578. eTypeFormatter(row) {
  3579. let text = "";
  3580. for (let i = 0; i < this.dataTypeList.length; i++) {
  3581. if (this.dataTypeList[i].dictKey == row.eType) {
  3582. text = this.dataTypeList[i].dictValue;
  3583. break;
  3584. }
  3585. }
  3586. return text;
  3587. },
  3588. //跳转到公式配置页面
  3589. toFormulaEdit(row, type) {
  3590. this.curEleTable.hasPartFormula = row.hasPartFormula;
  3591. this.formulaCurRow = row;
  3592. this.formulaCurRow.globaltype = type;
  3593. if (type === 10) {
  3594. this.formulaCompVisible1 = true;
  3595. this.formulaCurRow.elementType = false;
  3596. this.istableType = true;
  3597. } else {
  3598. this.formulaCompVisible = true;
  3599. }
  3600. },
  3601. //关闭公式弹窗
  3602. closeformulaComp() {
  3603. console.log("关闭");
  3604. selectFormElements(this.curEleTable.pkeyId, { type: 0 }).then((res) => {
  3605. this.editEleListFilter = res.data.data;
  3606. this.editEleListAll = [].concat(this.editEleListFilter);
  3607. });
  3608. },
  3609. //关闭公式弹窗
  3610. closeformulaComp1() {
  3611. console.log("关闭");
  3612. selectFormElements(this.curEleTable.pkeyId, { type: 0 }).then((res) => {
  3613. this.editEleListFilter = res.data.data;
  3614. this.editEleListAll = [].concat(this.editEleListFilter);
  3615. });
  3616. },
  3617. getNodeTypelist() {
  3618. let code = "name_rule";
  3619. getDictionary({
  3620. code,
  3621. }).then((res) => {
  3622. this.nodeTypelist1 = res.data.data;
  3623. });
  3624. },
  3625. getNodeTypelistData() {
  3626. const type = this.wbsType;
  3627. let code = "";
  3628. if (type === 5) {
  3629. code = "lar_node_type"; //征拆
  3630. } else if (type === 2) {
  3631. code = "trial_node_type"; //试验
  3632. } else if (type === 3) {
  3633. code = "meter_node_type"; //计量
  3634. } else {
  3635. {
  3636. code = "wbs_node_type"; //质检
  3637. }
  3638. }
  3639. getDictionary({
  3640. code,
  3641. }).then((res) => {
  3642. this.nodeTypelist = res.data.data;
  3643. res.data.data.forEach((element) => {
  3644. element.dictKey = Number(element.dictKey);
  3645. });
  3646. this.nodeTypelist = res.data.data;
  3647. });
  3648. },
  3649. getMajorDataTypeList() {
  3650. // if (this.majorDataTypeList.length > 1) {
  3651. // return;
  3652. // }
  3653. getDictionary({
  3654. code: "major_data_type",
  3655. }).then((res) => {
  3656. res.data.data.forEach((element) => {
  3657. element.dictKey = Number(element.dictKey);
  3658. });
  3659. // this.majorDataTypeList = res.data.data;
  3660. this.majorDataTypeList = res.data.data.filter(
  3661. (item) => item.dictKey != 0
  3662. );
  3663. });
  3664. },
  3665. getTableTypelist() {
  3666. const type = this.wbsType;
  3667. if (this.tableTypelist.length > 1) {
  3668. return;
  3669. }
  3670. let code = "";
  3671. if (type === 5) {
  3672. code = "table_type"; //征拆
  3673. } else if (type === 2) {
  3674. code = "trial_table_type"; //试验
  3675. } else {
  3676. code = "table_type"; //质检
  3677. }
  3678. getDictionary({
  3679. // code: "table_type",
  3680. // code: type === 2 ? "trial_table_type" : "table_type",
  3681. code,
  3682. }).then((res) => {
  3683. res.data.data.forEach((element) => {
  3684. element.dictKey = Number(element.dictKey);
  3685. });
  3686. this.tableTypelist = res.data.data;
  3687. });
  3688. },
  3689. getDataTypelist() {
  3690. if (this.dataTypeList.length > 1) {
  3691. return;
  3692. }
  3693. getDictionary({
  3694. code: "data_type",
  3695. }).then((res) => {
  3696. res.data.data.forEach((element) => {
  3697. element.dictKey = Number(element.dictKey);
  3698. });
  3699. this.dataTypeList = res.data.data;
  3700. });
  3701. },
  3702. getOwnerTypelist() {
  3703. if (this.ownerTypeList.length > 1) {
  3704. return;
  3705. }
  3706. getDictionary({
  3707. code: "owner_type",
  3708. }).then((res) => {
  3709. res.data.data.forEach((element) => {
  3710. element.dictKey = Number(element.dictKey);
  3711. });
  3712. this.ownerTypeList = res.data.data;
  3713. });
  3714. },
  3715. getStandardTypeOptions() {
  3716. getDictionary({
  3717. code: "classification",
  3718. }).then((res) => {
  3719. res.data.data.forEach((element) => {
  3720. element.dictKey = Number(element.dictKey);
  3721. });
  3722. // 定义要过滤的 dictKey 值
  3723. const targetKeys = [1, 2, 3, 4, 5];
  3724. // 过滤数组
  3725. const filteredOptions = res.data.data.filter((item) =>
  3726. targetKeys.includes(item.dictKey)
  3727. );
  3728. this.standardTypeOptions = filteredOptions;
  3729. });
  3730. },
  3731. changeStandType(val) {
  3732. let parentId = "";
  3733. this.standardTypeOptions.forEach((item) => {
  3734. if (item.dictKey == val) {
  3735. parentId = item.id; // 找到匹配项,提取 parentId
  3736. }
  3737. });
  3738. getChildList(1, 10000, parentId).then((res) => {
  3739. res.data.data.forEach((element) => {
  3740. element.dictKey = Number(element.dictKey);
  3741. });
  3742. this.unitOptions = res.data.data;
  3743. this.unitOptions = this.unitOptions.filter(
  3744. (item) => item.dictKey != -1
  3745. );
  3746. });
  3747. },
  3748. formatCat(row, column, cellValue) {
  3749. for (let i = 0; i < this.nodeTypelist.length; i++) {
  3750. if (this.nodeTypelist[i].dictKey == cellValue) {
  3751. return this.nodeTypelist[i].dictValue;
  3752. }
  3753. }
  3754. return cellValue;
  3755. //console.log(cellValue)
  3756. },
  3757. formatTableType(row, column, cellValue) {
  3758. for (let i = 0; i < this.tableTypelist.length; i++) {
  3759. if (this.tableTypelist[i].dictKey == cellValue) {
  3760. return this.tableTypelist[i].dictValue;
  3761. }
  3762. }
  3763. return cellValue;
  3764. //console.log(cellValue)
  3765. },
  3766. formatOwner(row, column, cellValue) {
  3767. for (let i = 0; i < this.ownerTypeList.length; i++) {
  3768. if (this.ownerTypeList[i].dictKey == cellValue) {
  3769. return this.ownerTypeList[i].dictValue;
  3770. }
  3771. }
  3772. return cellValue;
  3773. //console.log(cellValue)
  3774. },
  3775. formatdataType(row, column, cellValue) {
  3776. for (let i = 0; i < this.dataTypeList.length; i++) {
  3777. if (this.dataTypeList[i].dictKey == cellValue) {
  3778. return this.dataTypeList[i].dictValue;
  3779. }
  3780. }
  3781. return cellValue;
  3782. },
  3783. formMajorType(row, column, cellValue) {
  3784. for (let i = 0; i < this.majorDataTypeList.length; i++) {
  3785. if (this.majorDataTypeList[i].dictKey == cellValue) {
  3786. return this.majorDataTypeList[i].dictValue;
  3787. }
  3788. }
  3789. return cellValue;
  3790. },
  3791. // filterNode(value, data) {
  3792. // if (!value) return true;
  3793. // return data.title.indexOf(value) !== -1;
  3794. // },
  3795. getReturnNode(node, _array, value) {
  3796. let isPass =
  3797. node.data && node.data.title && node.data.title.indexOf(value) !== -1;
  3798. isPass ? _array.push(isPass) : "";
  3799. if (!isPass && node.level != 1 && node.parent) {
  3800. this.getReturnNode(node.parent, _array, value);
  3801. }
  3802. },
  3803. filterNode(value, data, node) {
  3804. if (!value) {
  3805. return true;
  3806. }
  3807. let level = node.level;
  3808. let _array = []; //这里使用数组存储 只是为了存储值。
  3809. this.getReturnNode(node, _array, value);
  3810. let result = false;
  3811. _array.forEach((item) => {
  3812. result = result || item;
  3813. });
  3814. return result;
  3815. },
  3816. //#endregion
  3817. //#region wbs私有树排序
  3818. async sortpai(data) {
  3819. console.log(data);
  3820. await this.findWbsTreePrivateSameLevel({
  3821. parentId: data.parentId,
  3822. projectId: this.projectid,
  3823. wbsId: this.id,
  3824. });
  3825. this.sortTag = true;
  3826. this.sortTag2 = true;
  3827. },
  3828. editSort() {
  3829. this.wbsTreePrivateSort();
  3830. },
  3831. bianhua() {
  3832. this.sortTag2 = false;
  3833. this.$nextTick(() => {
  3834. this.sortTag2 = true;
  3835. });
  3836. },
  3837. async wbsTreePrivateSort() {
  3838. this.sureSortload = true;
  3839. //wbs私有树节点手动排序
  3840. const { data: res } = await wbsTreePrivateSort(this.sort);
  3841. console.log(res);
  3842. if (res.code == 200) {
  3843. this.sortTag = false;
  3844. this.sortTag2 = false;
  3845. this.$message({
  3846. type: "success",
  3847. message: "排序成功!",
  3848. });
  3849. this.sureSortload = false;
  3850. this.isShowTree = false;
  3851. setTimeout(() => {
  3852. this.isShowTree = true;
  3853. }, 100);
  3854. // window.location.reload();
  3855. // this.getLazytreessss();
  3856. }
  3857. },
  3858. async findWbsTreePrivateSameLevel(da) {
  3859. //wbs私有树同级节点接口
  3860. const { data: res } = await findWbsTreePrivateSameLevel(da);
  3861. if (res.code == 200) {
  3862. this.sort = res.data;
  3863. }
  3864. },
  3865. async getLazytreessss() {
  3866. const type = this.wbsType;
  3867. const { data: res } = await getLazytree(
  3868. this.id,
  3869. 0,
  3870. this.userInfo.tenant_id,
  3871. this.projectid,
  3872. { wbsType: type }
  3873. );
  3874. console.log(res);
  3875. if (res.code == 200) {
  3876. this.treeData = res.data;
  3877. }
  3878. },
  3879. //#endregion
  3880. //#region 关联清表
  3881. async getList(da) {
  3882. //获取清表模板信息
  3883. const { data: res } = await getList(da);
  3884. console.log(res);
  3885. if (res.code === 200 && res.msg === "操作成功") {
  3886. this.GLExcelData = res.data.records;
  3887. }
  3888. },
  3889. async tabLazytreeAll() {
  3890. //清表树信息
  3891. this.GLExcelLoading = true;
  3892. const { data: res } = await tabLazytreeAll({
  3893. modeId: this.GLExcelFrom.name,
  3894. name: this.GLExcelFrom.search,
  3895. });
  3896. this.GLExcelLoading = false;
  3897. console.log(res);
  3898. if (res.code === 200 && res.msg === "操作成功") {
  3899. this.exceldata = res.data;
  3900. }
  3901. },
  3902. Associationlist(scope) {
  3903. //关联清表点击事件
  3904. console.log(scope.row);
  3905. this.GLExcel = true;
  3906. this.getList({
  3907. current: 1,
  3908. size: 100000,
  3909. parentId: 0,
  3910. });
  3911. this.GLExcelFrom.name = scope.row.modeId;
  3912. setTimeout(() => {
  3913. this.$refs.tree.setCheckedKeys([scope.row.excelId]);
  3914. }, 2000);
  3915. this.GLExcelFrom.initTableId = scope.row.initTableId;
  3916. this.GLExcelFrom.id = scope.row.pkeyId;
  3917. this.GLExcelFrom.excelId = scope.row.excelId;
  3918. this.GLExcelFrom.ids = scope.row.id;
  3919. this.GLExcelFrom.initTableName = scope.row.initTableName;
  3920. this.GLExcelFrom.pkeyId = scope.row.pkeyId;
  3921. },
  3922. changetherr() {
  3923. //清表类型选择框change事件
  3924. if (this.GLExcelFrom.name != "") {
  3925. this.GLExcelFrom.search = "";
  3926. this.tabLazytreeAll();
  3927. }
  3928. },
  3929. GLExcelMD() {
  3930. //弹框关闭事件
  3931. this.GLExcelFrom.name = "";
  3932. this.GLExcelFrom.search = "";
  3933. this.GLExcelFrom.id = "";
  3934. this.exceldata = [];
  3935. this.$refs.tree.setCheckedKeys([]);
  3936. this.GLExcel = false;
  3937. },
  3938. checkchange(data) {
  3939. //节点选中回调
  3940. if (this.$refs.tree.getCheckedNodes().length === 0) {
  3941. this.$refs.tree.setCheckedKeys([]);
  3942. } else if (this.$refs.tree.getCheckedNodes().length >= 1) {
  3943. this.$refs.tree.setCheckedKeys([data.id]);
  3944. }
  3945. },
  3946. async saveLinkTab() {
  3947. // 保存按钮
  3948. let checkNodes = this.$refs.tree.getCheckedNodes();
  3949. if (checkNodes.length > 0) {
  3950. let node = checkNodes[checkNodes.length - 1];
  3951. if (node.fileType != 3) {
  3952. this.$message({
  3953. type: "warning",
  3954. message: "请先上传Excel表",
  3955. });
  3956. return;
  3957. }
  3958. try {
  3959. const { data: res } = await saveLinkTab({
  3960. exceTabId: node.id,
  3961. tabId: this.GLExcelFrom.id,
  3962. });
  3963. if (res.code === 200) {
  3964. this.$message({
  3965. type: "success",
  3966. message: "关联清表成功",
  3967. });
  3968. // 保存原始的pkeyId
  3969. const originalPkeyId = this.GLExcelFrom.pkeyId;
  3970. if (this.isNodeType) {
  3971. // 加载节点类型的数据
  3972. const response = await selectByNodeTable(this.curTreeData.id, this.projectid, this.id);
  3973. if (response.data.data && response.data.data.length) {
  3974. this.formData = response.data.data;
  3975. // 查找并更新initTableId
  3976. const matchedItem = this.formData.find(ele => ele.pkeyId === originalPkeyId);
  3977. if (matchedItem) {
  3978. this.GLExcelFrom.initTableId = matchedItem.initTableId;
  3979. }
  3980. // 调用rightClick方法
  3981. this.rightClick(
  3982. this.GLExcelFrom.id,
  3983. this.GLExcelFrom.excelId,
  3984. this.GLExcelFrom.ids,
  3985. this.GLExcelFrom.initTableName,
  3986. this.GLExcelFrom.initTableId
  3987. );
  3988. } else {
  3989. this.formData = [];
  3990. }
  3991. } else {
  3992. // 非节点类型,重新加载整个树
  3993. await this.reloadEntireTree();
  3994. }
  3995. this.GLExcel = false;
  3996. }
  3997. } catch (error) {
  3998. console.error("关联清表失败:", error);
  3999. this.$message({
  4000. type: "error",
  4001. message: "关联清表失败",
  4002. });
  4003. }
  4004. } else {
  4005. this.$message({
  4006. type: "warning",
  4007. message: "请先设置清表",
  4008. });
  4009. }
  4010. },
  4011. getReturnNode2(node, _array, value) {
  4012. let isPass =
  4013. node.data && node.data.name && node.data.name.indexOf(value) !== -1;
  4014. isPass ? _array.push(isPass) : "";
  4015. if (!isPass && node.level != 1 && node.parent) {
  4016. this.getReturnNode2(node.parent, _array, value);
  4017. }
  4018. },
  4019. filterNode222(value, data, node) {
  4020. if (!value) {
  4021. return true;
  4022. }
  4023. let level = node.level;
  4024. let _array = []; //这里使用数组存储 只是为了存储值。
  4025. this.getReturnNode2(node, _array, value);
  4026. let result = false;
  4027. _array.forEach((item) => {
  4028. result = result || item;
  4029. });
  4030. return result;
  4031. },
  4032. //#endregion
  4033. //#region 节点参数
  4034. nodeInfo(data) {
  4035. //节点参数按钮
  4036. this.keymap();
  4037. //console.log(data)
  4038. let pid = data.primaryKeyId ? data.primaryKeyId : data.pKeyId;
  4039. this.jiedianId = pid;
  4040. this.parameters(pid);
  4041. this.nodeInfoVisible = true;
  4042. },
  4043. closenodeInfoVisible() {
  4044. this.nodeInfoTable = [];
  4045. this.nodeInfoVisible = false;
  4046. },
  4047. addNodeInfoTable() {
  4048. //添加节点参数数据
  4049. this.nodeInfoTable.unshift({
  4050. k: "",
  4051. v: "",
  4052. remark: "",
  4053. nodeId: this.jiedianId,
  4054. type: 1,
  4055. });
  4056. console.log(this.nodeInfoTable);
  4057. },
  4058. refreshnfoTable() {
  4059. //刷新表格
  4060. let prams = {
  4061. nodeId: this.jiedianId,
  4062. type: 1,
  4063. projectId: this.projectid,
  4064. };
  4065. this.nodeInfoTableLoad = true;
  4066. refrehPram(prams).then((res) => {
  4067. this.nodeInfoTableLoad = false;
  4068. if (res.data.code == 200) {
  4069. this.$message.success("刷新成功");
  4070. }
  4071. });
  4072. },
  4073. delNodeInfo(key, obj) {
  4074. this.delids.push(obj.id);
  4075. //设置参数名称中的删除按钮
  4076. this.namelists.splice(key, 1);
  4077. },
  4078. delNodeInfoss(key, obj) {
  4079. this.delids.push(obj.id);
  4080. //节点参数
  4081. this.nodeInfoTable.splice(key, 1);
  4082. },
  4083. setNodeParameters() {
  4084. //打开设置节点参数弹框按钮
  4085. this.infoNameVisible = true;
  4086. this.namelists = [...this.namelist];
  4087. },
  4088. async setParameterName() {
  4089. //设置参数名称中添加节点参数按钮
  4090. // wbsId: this.jiedianId
  4091. this.namelists.unshift({
  4092. name: "",
  4093. remark: "",
  4094. k: "",
  4095. type: 0,
  4096. nodeId: this.jiedianId,
  4097. });
  4098. },
  4099. async nodeInfoSave() {
  4100. //节点参数弹框保存按钮
  4101. if (this.nodeInfoTable) {
  4102. // if (this.nodeInfoTable.length == 0) {
  4103. // await this.saveOrUpdateBatch({projectId:this.projectid,nodeId:this.jiedianId,type:1,delIds:this.delids,wps:[
  4104. // {
  4105. // nodeId: this.jiedianId,
  4106. // type: -1,
  4107. // },
  4108. // ]});
  4109. // this.nodeInfoVisible = false;
  4110. // this.delIds=[];
  4111. // this.$message({
  4112. // type: "success",
  4113. // message: "保存参数节点成功!",
  4114. // });
  4115. // return;
  4116. // }
  4117. console.log(this.namelist);
  4118. let tag = true;
  4119. this.nodeInfoTable.forEach((val) => {
  4120. if (!val.k | !val.v) {
  4121. return (tag = false);
  4122. }
  4123. //if (!val.name) {
  4124. for (let i = 0; i < this.namelist.length; i++) {
  4125. if (this.namelist[i].k == val.k) {
  4126. val.name = this.namelist[i].name;
  4127. return;
  4128. }
  4129. }
  4130. //}
  4131. });
  4132. if (tag) {
  4133. this.nodeInfoSaveload = true;
  4134. await this.saveOrUpdateBatch({
  4135. scopeType: 10,
  4136. projectId: this.projectid,
  4137. nodeId: this.jiedianId,
  4138. wps: this.nodeInfoTable,
  4139. type: 1,
  4140. delIds: this.delids,
  4141. });
  4142. this.delIds = [];
  4143. this.$message({
  4144. type: "success",
  4145. message: "设置参数节点成功!",
  4146. });
  4147. this.nodeInfoSaveload = false;
  4148. this.parameters(this.jiedianId);
  4149. // this.nodeInfoVisible = false;
  4150. } else {
  4151. this.$message({
  4152. type: "error",
  4153. message: "请填写所有的参数名称和参数值!",
  4154. });
  4155. }
  4156. } else {
  4157. this.$message({
  4158. type: "error",
  4159. message: "请先设置参数节点!",
  4160. });
  4161. }
  4162. },
  4163. async addParameterName() {
  4164. //设置参数名称中的保存按钮
  4165. if (this.namelists.length) {
  4166. let tag = true;
  4167. this.namelists.forEach((val) => {
  4168. if (!val.name || !val.k) {
  4169. return (tag = false);
  4170. }
  4171. });
  4172. if (tag) {
  4173. await this.saveOrUpdateBatch({
  4174. scopeType: 10,
  4175. projectId: this.projectid,
  4176. nodeId: this.jiedianId,
  4177. wps: this.namelists,
  4178. type: 0,
  4179. delIds: this.delids,
  4180. }); //保存设置参数
  4181. this.infoNameVisible = false;
  4182. this.delIds = [];
  4183. this.keymap();
  4184. } else {
  4185. this.$message({
  4186. type: "error",
  4187. message: "请填写所有的参数名称和参数值KEY!",
  4188. });
  4189. }
  4190. } else {
  4191. this.$message({
  4192. type: "warning",
  4193. message: "请先添加参数",
  4194. });
  4195. }
  4196. },
  4197. closeParameter() {
  4198. //设置参数名称,关闭按钮
  4199. this.namelists = [];
  4200. this.infoNameVisible = false;
  4201. },
  4202. async parameters(wbsId) {
  4203. //获取接待你参数列表
  4204. const { data: res } = await parameters({ wbsId });
  4205. console.log(res);
  4206. if (res.code == 200) {
  4207. if (Array.isArray(res.data)) {
  4208. this.nodeInfoTable = res.data;
  4209. }
  4210. }
  4211. },
  4212. async saveOrUpdateBatch(da) {
  4213. //保存
  4214. const { data: res } = await saveOrUpdateBatch(da);
  4215. this.delids = [];
  4216. console.log(res);
  4217. },
  4218. async keymap() {
  4219. //节点参数枚举
  4220. const { data: res } = await keymap();
  4221. console.log(res);
  4222. if (res.code == 200) {
  4223. this.namelist = res.data;
  4224. }
  4225. },
  4226. //#endregion
  4227. //#region 调整表单
  4228. adjustExcel(pkeyId, excelId) {
  4229. //调整表单
  4230. this.GLExcelFrom.id = pkeyId;
  4231. this.GLExcelFrom.excelId = excelId;
  4232. this.getExcelHtml(pkeyId);
  4233. },
  4234. async getExcelHtml(pkeyId) {
  4235. const { data: res } = await getExcelHtml({ pkeyId });
  4236. console.log(res);
  4237. if (res.code === 200) {
  4238. localStorage.setItem("excelHtml", res.data);
  4239. this.adjustmentExcel = res.data;
  4240. this.excelHtml = true;
  4241. }
  4242. },
  4243. removeExcel() {
  4244. this.excelHtml = false;
  4245. },
  4246. //#endregion
  4247. //#region 编辑元素
  4248. async rightClick(pkeyId, excelId, id, initTableName, initTableId) {
  4249. await this.getExcelHtml2(pkeyId);
  4250. this.editElementQuery.pkeyId = pkeyId;
  4251. this.editElementQuery.excelId = excelId;
  4252. this.editElementQuery.id = id;
  4253. this.editElementQuery.initTableName = initTableName;
  4254. this.editElementQuery.initTableId = initTableId;
  4255. this.editElementQuery.pid = this.$route.query.pid;
  4256. this.editElementQuery.wbsid = this.$route.query.wbsid;
  4257. this.editElementQuery.nodeid = this.curTreeData.id;
  4258. this.editElementVisible = true;
  4259. },
  4260. hideEditElementVisible() {
  4261. this.editElementVisible = false;
  4262. // this.updateNodeTable();
  4263. if(this.isNodeType){
  4264. this.updateNodeTable();
  4265. }
  4266. },
  4267. async getExcelHtml2(pkeyId) {
  4268. const { data: res } = await getExcelHtml({ pkeyId });
  4269. console.log(res);
  4270. if (res.code === 200) {
  4271. localStorage.setItem("editElement", res.data);
  4272. }
  4273. },
  4274. //#endregion
  4275. //#region 元素表单信息
  4276. editEditElementForm() {
  4277. //标记元素
  4278. if (this.formData.length) {
  4279. let da = [];
  4280. this.formDatass = [...this.formData];
  4281. this.formDatass.forEach((val) => {
  4282. da.push({
  4283. tableType: val.tableType - 0,
  4284. tableOwner: val.tableOwner - 0,
  4285. pkeyId: val.pkeyId,
  4286. tableName: val.tableName,
  4287. fillRate: val.fillRate,
  4288. nodeType: val.nodeType - 0,
  4289. });
  4290. });
  4291. this.formDatass = da;
  4292. this.editElementFormTag = true;
  4293. }else{
  4294. this.$message({
  4295. type: "warning",
  4296. message: "当前列表无数据!",
  4297. });
  4298. }
  4299. },
  4300. editeditElementFormMF() {
  4301. //保存按钮
  4302. let da = [];
  4303. let tag = true;
  4304. this.formDatass.forEach((val) => {
  4305. if (!val.tableName || !val.tableType || !val.tableOwner) {
  4306. tag = false;
  4307. return;
  4308. } else {
  4309. da.push({
  4310. pkeyId: val.pkeyId,
  4311. nodeName: val.tableName,
  4312. tableType: val.tableType,
  4313. tableOwner: val.tableOwner,
  4314. fillRate: val.fillRate,
  4315. nodeType: val.nodeType,
  4316. });
  4317. }
  4318. });
  4319. if (tag) {
  4320. this.updateBatchNodeTableInfo2(da);
  4321. } else {
  4322. this.$message({
  4323. type: "success",
  4324. message: "请填写完整元素表单的所有信息!",
  4325. });
  4326. }
  4327. },
  4328. async updateBatchNodeTableInfo2(da) {
  4329. this.editeditElementFormMFLoading = true;
  4330. //共有编辑元素
  4331. const { data: res } = await updateBatchNodeTableInfo2(da);
  4332. if (res.code == 200) {
  4333. this.editElementFormTag = false;
  4334. this.updateNodeTable();
  4335. this.editeditElementFormMFLoading = false;
  4336. }
  4337. this.editeditElementFormMFLoading = false;
  4338. },
  4339. //#endregion
  4340. //获取节点展开路径
  4341. getExpandedKeys(node) {
  4342. //console.log(node)
  4343. let expandedKeys = [];
  4344. while (node.parent) {
  4345. expandedKeys.push(node.data.id);
  4346. node = node.parent;
  4347. }
  4348. setStore({
  4349. name: this.expandName,
  4350. content: expandedKeys,
  4351. type: true, //sessionStorage
  4352. });
  4353. //console.log(expandedKeys)
  4354. },
  4355. //触发节点参数
  4356. nodeInfoHandle() {
  4357. if (!this.curTreeData.id) {
  4358. this.$message({
  4359. type: "warning",
  4360. message: "请先选择节点",
  4361. });
  4362. return;
  4363. }
  4364. this.nodeInfo(this.curTreeData);
  4365. },
  4366. eleFormulaHandle() {
  4367. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4368. this.$message({
  4369. type: "warning",
  4370. message: "请先选择节点",
  4371. });
  4372. return;
  4373. }
  4374. this.setLeftType(4, this.curTreeData, this.curTreeNode);
  4375. // this.showType = 2;
  4376. },
  4377. editNodeHandle() {
  4378. console.log(this.curTreeData, "this.curTreeData.id ");
  4379. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4380. this.$message({
  4381. type: "warning",
  4382. message: "请先选择节点",
  4383. });
  4384. return;
  4385. }
  4386. this.mixRatioTestIds = [];
  4387. // this.nodeTypeChange(53);
  4388. this.nodeTypeChange(this.curTreeData.nodeType);
  4389. this.dialogTitle = "编辑节点";
  4390. this.setLeftType(2, this.curTreeData, this.curTreeNode);
  4391. },
  4392. addNodeHandle() {
  4393. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4394. this.$message({
  4395. type: "warning",
  4396. message: "请先选择节点",
  4397. });
  4398. return;
  4399. }
  4400. this.mixRatioTestIds = [];
  4401. // this.nodeTypeChange(53);
  4402. this.nodeTypeChange(this.curTreeData.nodeType);
  4403. this.dialogTitle = "新增节点";
  4404. this.setLeftType(1, this.curTreeData, this.curTreeNode);
  4405. },
  4406. copyNodeHandle() {
  4407. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4408. this.$message({
  4409. type: "warning",
  4410. message: "请先选择节点",
  4411. });
  4412. return;
  4413. }
  4414. },
  4415. delNodeHandle() {
  4416. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4417. this.$message({
  4418. type: "warning",
  4419. message: "请先选择节点",
  4420. });
  4421. return;
  4422. }
  4423. if (this.curTreeNode.level == 1) {
  4424. this.$message({
  4425. type: "warning",
  4426. message: "当前节点无法删除",
  4427. });
  4428. return;
  4429. }
  4430. this.deleNode(this.curTreeData, this.curTreeNode);
  4431. },
  4432. eleHandle() {
  4433. if (!this.curTreeData.id || !this.curTreeNode.id) {
  4434. this.$message({
  4435. type: "warning",
  4436. message: "请先选择节点",
  4437. });
  4438. return;
  4439. }
  4440. this.setLeftType(5, this.curTreeData, this.curTreeNode);
  4441. },
  4442. syncInfoHandle(item) {
  4443. if (this.curTreeData.primaryKeyId || this.curTreeData.pKeyId) {
  4444. this.$confirm("是否同步节点参数?", "提示", {
  4445. confirmButtonText: "确定",
  4446. cancelButtonText: "取消",
  4447. type: "warning",
  4448. }).then(() => {
  4449. this.syncBtnLoad = true;
  4450. this.menuoptions.forEach((ele) => {
  4451. if (item.value == ele.value) {
  4452. ele.load = true;
  4453. }
  4454. });
  4455. let pid = this.curTreeData.primaryKeyId
  4456. ? this.curTreeData.primaryKeyId
  4457. : this.curTreeData.pKeyId;
  4458. syncNodeParam(this.projectid, pid)
  4459. .then(() => {
  4460. this.$message({
  4461. type: "success",
  4462. message: "同步成功!",
  4463. });
  4464. })
  4465. .finally(() => {
  4466. this.syncBtnLoad = false;
  4467. this.menuoptions.forEach((ele) => {
  4468. if (item.value == ele.value) {
  4469. ele.load = false;
  4470. }
  4471. });
  4472. });
  4473. });
  4474. } else {
  4475. this.$message.warning("请先选择左侧节点");
  4476. }
  4477. },
  4478. //显示别名弹窗
  4479. aliasShow() {
  4480. this.aliasVisible = true;
  4481. if (this.nodeDetail.fullName) {
  4482. this.aliasArr = this.nodeDetail.fullName.split(",");
  4483. } else {
  4484. this.aliasArr = [];
  4485. }
  4486. this.aliasInput = "";
  4487. },
  4488. addAlias() {
  4489. if (this.aliasInput) {
  4490. this.aliasArr.push(this.aliasInput);
  4491. this.aliasInput = "";
  4492. }
  4493. },
  4494. delAlias(index) {
  4495. this.aliasArr.splice(index, 1);
  4496. },
  4497. saveAliasHandle() {
  4498. this.nodeDetail.fullName = this.aliasArr.join(",");
  4499. if (this.editType == 1) {
  4500. //新增
  4501. this.aliasVisible = false;
  4502. } else if (this.editType == 2) {
  4503. //编辑 私有
  4504. privateSubmitFullName(
  4505. this.nodeDetail.pKeyId,
  4506. this.nodeDetail.fullName
  4507. ).then(() => {
  4508. this.$message({
  4509. type: "success",
  4510. message: "保存成功",
  4511. });
  4512. this.aliasVisible = false;
  4513. });
  4514. }
  4515. },
  4516. async syncNodeTableHandle(data) {
  4517. this.isAdd=''
  4518. console.log('后管数据同步',data);
  4519. this.curTreeData=data
  4520. this.isShowLeft=false
  4521. // await this.getNodeStatusData()
  4522. if(this.syncListDialog){
  4523. return
  4524. }
  4525. this.syncForm.range='1'
  4526. this.proSyncTag=true
  4527. if(this.$refs.syncProTree){
  4528. this.$refs.syncProTree.setCheckedKeys([])
  4529. }
  4530. if(this.$refs.proTable){
  4531. this.$refs.proTable.clearSelection()
  4532. }
  4533. this.isShowTable=true
  4534. this.getTypeOptions()
  4535. this.getRangeOptions()
  4536. this.getCheckIdList()
  4537. let pid=data.primaryKeyId?data.primaryKeyId:data.pKeyId
  4538. this.getTempProjectList(pid)
  4539. },
  4540. syncProjectHandle(data) {
  4541. this.$confirm("是否同步节点【" + data.title + "】到合同段?", "提示", {
  4542. confirmButtonText: "确定",
  4543. cancelButtonText: "取消",
  4544. type: "warning",
  4545. }).then(() => {
  4546. let notify = this.$notify({
  4547. title: "提示",
  4548. message: "节点数据同步中...",
  4549. duration: 0,
  4550. });
  4551. let pid = data.primaryKeyId ? data.primaryKeyId : data.pKeyId;
  4552. syncNodeinfo(pid)
  4553. .then(() => {
  4554. this.updateNodeTable();
  4555. this.$message({
  4556. type: "success",
  4557. message: "同步成功",
  4558. });
  4559. })
  4560. .catch(() => {
  4561. this.$message({
  4562. type: "error",
  4563. message: "同步失败",
  4564. });
  4565. })
  4566. .finally(() => {
  4567. notify.close();
  4568. });
  4569. });
  4570. },
  4571. //同步元素表单排序到合同段
  4572. async syncSortHandle(data) {
  4573. console.log('同步到合同');
  4574. this.isShowLeft=false
  4575. this.curTreeData=data
  4576. if(this.syncListDialog){
  4577. return
  4578. }
  4579. // await this.getNodeStatusData()
  4580. this.syncForm.range='2'
  4581. this.proSyncTag=true
  4582. this.isShowTable=true
  4583. this.getTypeOptions()
  4584. this.getRangeOptions()
  4585. this.getCheckIdList()
  4586. selectByNodeTable(data.id, this.projectid, this.id).then((res) => {
  4587. if (res.data.data.length>0) {
  4588. this.preTableData = res.data.data;
  4589. } else {
  4590. this.preTableData = [];
  4591. }
  4592. });
  4593. },
  4594. typeTreeLoadNode(node, resolve) {
  4595. let pid = 0;
  4596. if (node.level != 0) {
  4597. pid = node.data.id;
  4598. }
  4599. tabTypeLazyTree(pid, this.projectid).then((res) => {
  4600. let arr = [];
  4601. if (Array.isArray(res.data.data)) {
  4602. arr = res.data.data;
  4603. }
  4604. return resolve(arr);
  4605. });
  4606. },
  4607. getTypeTreeDetail() {},
  4608. independent() {
  4609. this.$router.push({
  4610. path: "/project/independent",
  4611. query: {
  4612. pid: this.projectid,
  4613. wbsid: this.$route.query.wbsid,
  4614. wbsType: this.wbsType,
  4615. },
  4616. });
  4617. },
  4618. archiveTimeClick() {
  4619. this.$router.push({
  4620. path: "/project/archiveTime",
  4621. query: { pid: this.projectid, wbsid: this.$route.query.wbsid },
  4622. });
  4623. },
  4624. syncElectric(item) {
  4625. if (this.curTreeData.primaryKeyId || this.curTreeData.pKeyId) {
  4626. console.log("同步电签默认信息");
  4627. this.$confirm("是否同步电签默认信息?", "提示", {
  4628. confirmButtonText: "确定",
  4629. cancelButtonText: "取消",
  4630. type: "warning",
  4631. }).then(() => {
  4632. this.syncElectricLoad = true;
  4633. this.menuoptions.forEach((ele) => {
  4634. if (item.value == ele.value) {
  4635. ele.load = true;
  4636. }
  4637. });
  4638. let pid = this.curTreeData.primaryKeyId
  4639. ? this.curTreeData.primaryKeyId
  4640. : this.curTreeData.pKeyId;
  4641. syncProjecteVisa(this.projectid, pid)
  4642. .then(() => {
  4643. this.$message({
  4644. type: "success",
  4645. message: "同步成功!",
  4646. });
  4647. })
  4648. .finally(() => {
  4649. this.syncElectricLoad = false;
  4650. this.menuoptions.forEach((ele) => {
  4651. if (item.value == ele.value) {
  4652. ele.load = false;
  4653. }
  4654. });
  4655. });
  4656. });
  4657. } else {
  4658. this.$message.warning("请先选择左侧节点");
  4659. }
  4660. },
  4661. //节点参数 关联元素
  4662. linkEle(row) {
  4663. console.log(row, "row");
  4664. if (!row.id) {
  4665. this.$message.warning("请先保存数据,再点击关联元素");
  4666. } else {
  4667. this.linkEleVisible = true;
  4668. this.curParam = row;
  4669. getParamElements({
  4670. nodeId: this.curTreeData.id,
  4671. projectId: this.projectid,
  4672. paramId: row.id,
  4673. scopeType: 10,
  4674. }).then((res) => {
  4675. if (res.data.data.length) {
  4676. this.linkEleTableList = res.data.data;
  4677. } else {
  4678. this.linkEleTableList = [];
  4679. }
  4680. });
  4681. }
  4682. },
  4683. //关联元素弹框
  4684. tolinkEle(row) {
  4685. this.curLinkEleTable = row;
  4686. this.linkCheckVisible = true;
  4687. let pid = this.curTreeData.primaryKeyId
  4688. ? this.curTreeData.primaryKeyId
  4689. : this.curTreeData.pKeyId;
  4690. selectFormElements(row.id, { type: 3, nodeId: pid }).then((res) => {
  4691. res.data.data.forEach((ele) => {
  4692. ele.checked = false;
  4693. ele.show = true;
  4694. });
  4695. this.linkEleList = res.data.data;
  4696. this.linkEleListAll = [].concat(this.linkEleList);
  4697. });
  4698. },
  4699. //删除关联
  4700. delLink(data) {
  4701. this.$confirm("删除关联, 是否继续?", "提示", {
  4702. confirmButtonText: "确定",
  4703. cancelButtonText: "取消",
  4704. type: "warning",
  4705. })
  4706. .then(() => {
  4707. console.log(data);
  4708. delParamElements(data).then(() => {
  4709. this.$message({
  4710. type: "success",
  4711. message: "删除成功!",
  4712. });
  4713. getParamElements({
  4714. nodeId: this.curTreeData.id,
  4715. projectId: this.projectid,
  4716. paramId: this.curParam.id,
  4717. scopeType: 10,
  4718. }).then((res) => {
  4719. if (res.data.data.length) {
  4720. this.linkEleTableList = res.data.data;
  4721. } else {
  4722. this.linkEleTableList = [];
  4723. }
  4724. });
  4725. });
  4726. })
  4727. .catch(() => {});
  4728. },
  4729. //筛选元素
  4730. searchEle() {
  4731. this.linkEleList = this.linkEleListAll.filter((ele) => {
  4732. return ele.eName.indexOf(this.linkEleKey) > -1;
  4733. });
  4734. },
  4735. linkEleCheck(value, index) {
  4736. //console.log(value)
  4737. if (value) {
  4738. this.linkEleList.forEach((ele, i) => {
  4739. if (i != index) {
  4740. ele.checked = false;
  4741. }
  4742. });
  4743. }
  4744. },
  4745. //关联元素
  4746. saveLinkEle() {
  4747. let target = {};
  4748. this.linkEleList.forEach((e) => {
  4749. if (e.checked == true) {
  4750. target = { elementId: e.id, paramId: this.curParam.id };
  4751. }
  4752. });
  4753. if (JSON.stringify(target) !== "{}") {
  4754. specifiedParamElements(target).then((data) => {
  4755. this.linkCheckVisible = false;
  4756. getParamElements({
  4757. nodeId: this.curTreeData.id,
  4758. projectId: this.projectid,
  4759. paramId: this.curParam.id,
  4760. scopeType: 10,
  4761. }).then((res) => {
  4762. if (res.data.data.length) {
  4763. this.linkEleTableList = res.data.data;
  4764. } else {
  4765. this.linkEleTableList = [];
  4766. }
  4767. });
  4768. });
  4769. } else {
  4770. this.$message.warning("请先选择关联元素");
  4771. }
  4772. },
  4773. //树形控件菜单相关方法
  4774. mouseout() {
  4775. this.menuvisible = false;
  4776. },
  4777. //展示菜单
  4778. showMenu(e, data, node) {
  4779. e.preventDefault();
  4780. console.log(e, "e");
  4781. var x = e.pageX; //这个应该是相对于整个浏览器页面的x坐标,左上角为坐标原点(0,0)
  4782. var y = e.pageY; //这个应该是相对于整个浏览器页面的y坐标,左上角为坐标原点(0,0)
  4783. this.menutop = y;
  4784. this.menuleft = x;
  4785. this.menuvisible = true;
  4786. },
  4787. menuClick(e, item, data,node) {
  4788. this.curTreeData = data; //当前节点数据
  4789. this.curTreeNode = node; //当前节点数据
  4790. e.preventDefault();
  4791. if (item.key === "sort") {
  4792. this.sortpai(data);
  4793. } else if (item.key === "sync1") {
  4794. this.syncNodeTableHandle(data);
  4795. } //
  4796. else if (item.key === "sync3") {
  4797. this.syncSortHandle(data);
  4798. } else if (item.key === "add") {
  4799. this.addNodeHandle();
  4800. } else if (item.key === "edit") {
  4801. this.editNodeHandle();
  4802. } else if (item.key === "del") {
  4803. this.delNodeHandle();
  4804. } else if (item.value === "jdSync") {
  4805. this.syncInfoHandle(item);
  4806. } else if (item.value === "gsSync") {
  4807. this.$message({
  4808. type: "info",
  4809. message: "暂无相关接口!",
  4810. });
  4811. } else if (item.value === "dqSync") {
  4812. this.syncElectric(item);
  4813. }
  4814. },
  4815. //展示数据同步下拉框
  4816. showSyncbtn() {
  4817. this.isshowSyncbtn = !this.isshowSyncbtn;
  4818. },
  4819. getDictTypelist() {
  4820. if (this.dynamicDictList.length > 1) {
  4821. return;
  4822. }
  4823. getDictionary({
  4824. code: "land_field_dict",
  4825. }).then((res) => {
  4826. res.data.data.forEach((element) => {
  4827. element.dictKey = Number(element.dictKey);
  4828. });
  4829. this.dynamicDictList = res.data.data;
  4830. const filteredList = this.dynamicDictList.filter(
  4831. (item) => item.dictKey === 600 || item.dictKey === 0
  4832. );
  4833. this.dynamicDictList = filteredList;
  4834. });
  4835. },
  4836. getSelectFormElements(id) {
  4837. this.editEleTableloading = true;
  4838. let finalId=this.isNodeType?this.curEleTable.pkeyId:this.curEleTable.id
  4839. selectFormElements(finalId, {
  4840. type: 0,
  4841. search: this.searchinput,
  4842. }).then((res) => {
  4843. this.editEleTableloading = false;
  4844. this.editTable = res.data.data;
  4845. });
  4846. },
  4847. //编辑
  4848. handleEdit(index, row) {
  4849. this.curEleTable = row;
  4850. this.getSelectFormElements();
  4851. this.editDialogShow = true;
  4852. this.getDictTypelist();
  4853. },
  4854. //编辑元素信息(请谨慎操作)
  4855. clearsearchinput() {
  4856. this.getSelectFormElements();
  4857. },
  4858. searchinputChange() {
  4859. this.getSelectFormElements();
  4860. },
  4861. saveEles() {
  4862. if (this.editTable.length > 0) {
  4863. console.log( this.curEleTable,' this.curEleTable');
  4864. this.saveLoading = true;
  4865. updateBatchElements(
  4866. this.editTable,
  4867. this.curEleTable.initTableName
  4868. ).then(() => {
  4869. this.saveLoading = false;
  4870. this.editDialogShow = false;
  4871. this.updateNodeTable();
  4872. this.$message({
  4873. type: "success",
  4874. message: "保存成功!",
  4875. });
  4876. });
  4877. } else {
  4878. this.editDialogShow = false;
  4879. this.updateNodeTable();
  4880. this.$message({
  4881. type: "success",
  4882. message: "保存成功!",
  4883. });
  4884. }
  4885. },
  4886. //文件题名(全局按钮)
  4887. fileTitleHandle(){
  4888. this.getFileTableData()
  4889. this.fileTitleVisible = true;
  4890. },
  4891. changeRadio(val){
  4892. console.log(val,'val');
  4893. const fileItem = this.fileTableData[this.chooseFileIndex];
  4894. this.$set(fileItem, 'type', val);
  4895. },
  4896. //获取文件题名规则
  4897. getFileTableData(){
  4898. this.fileTableLoading=true
  4899. getNameRule(
  4900. { projectId:this.projectid}
  4901. ).then((res) => {
  4902. this.fileTableLoading=false
  4903. if(res.data.data){
  4904. this.fileTableData = res.data.data;
  4905. this.fileTableData.forEach((element) => {
  4906. element.roleNameVal = element.nameRule.split(",");
  4907. element.ruleName=element.nameVaule.split("-")
  4908. if(element.type===2){
  4909. const list=element.list
  4910. let arr=[]
  4911. let arrId=[]
  4912. list.forEach((ele) => {
  4913. arr.push(ele.nodeName)
  4914. arrId.push(ele.nodeId)
  4915. });
  4916. element.ruleSizeVal = arr.join('、');
  4917. element.ruleSizeValId=arrId
  4918. }else{
  4919. element.ruleSizeVal=''
  4920. element.ruleSizeValId=''
  4921. }
  4922. });
  4923. }else{
  4924. this.fileTableData =[]
  4925. }
  4926. });
  4927. },
  4928. //获取文件题名范围
  4929. getTitleRangeData(row){
  4930. this.fileTreeLoading=true
  4931. getTitleRange(
  4932. { projectId:this.projectid,
  4933. nameId:row.nameId,
  4934. }
  4935. ).then((res) => {
  4936. this.fileTreeLoading=false
  4937. if(res.data.data){
  4938. this.fileTreeData = res.data.data;
  4939. // this.deCheckTreeKeys = this.fileTreeData.filter(node => node.status === 11).map(node => node.id);
  4940. }else{
  4941. this.fileTreeData =[]
  4942. }
  4943. });
  4944. },
  4945. //选择题名范围
  4946. chooseFile(index,row){
  4947. const {ruleName}=row
  4948. if(ruleName&&ruleName.length>0){
  4949. this.chooseFileVisible = true;
  4950. this.chooseFileIndex= index;
  4951. this.deCheckTreeKeys=row.ruleSizeValId
  4952. this.getTitleRangeData(row)
  4953. }else{
  4954. this.$message.warning('请先选择文件题名规则');
  4955. }
  4956. },
  4957. checkFileSize(data,{checkedNodes,checkedKeys}){
  4958. let checkedTitles = checkedNodes.map(node => node.nodeName).join('、');
  4959. this.fileTableData[this.chooseFileIndex].isEdit1=false
  4960. const fileItem = this.fileTableData[this.chooseFileIndex];
  4961. this.$set(fileItem, 'ruleSizeVal', checkedTitles);
  4962. this.$set(fileItem, 'ruleSizeValId', checkedKeys);
  4963. this.deCheckTreeKeys=checkedKeys
  4964. },
  4965. getCheckedNodes (treeData, checkedKeys) {
  4966. let result = []
  4967. treeData.forEach(node => {
  4968. if (checkedKeys&&checkedKeys.includes(node.id)) {
  4969. result.push(node)
  4970. }
  4971. if (node.children) {
  4972. result = result.concat(getCheckedNodes(node.children, checkedKeys))
  4973. }
  4974. })
  4975. return result
  4976. },
  4977. saveFileSize(){
  4978. // const checkedNodes = this.getCheckedNodes(this.fileTreeData, this.deCheckTreeKeys).filter(node => node.status !== 11)
  4979. const checkedNodes = this.getCheckedNodes(this.fileTreeData, this.deCheckTreeKeys)
  4980. this.fileTableData[this.chooseFileIndex].ruleSizeValId = checkedNodes.map(node => node.id)
  4981. this.fileTableData[this.chooseFileIndex].ruleSizeVal = checkedNodes.map(node => node.nodeName).join('、')
  4982. this.chooseFileVisible = false;
  4983. this.isShowSize=false
  4984. setTimeout(()=>{
  4985. this.isShowSize=true
  4986. },100)
  4987. },
  4988. editRow(index,row){
  4989. console.log(row,'row');
  4990. this.$set(row, "isEdit", true);
  4991. this.$set(row, "isEdit1", true);
  4992. this.fileTitleModel.type=row.type
  4993. },
  4994. //保存文件题名
  4995. saveRow(index,row){
  4996. if(row.ruleName.length<1){
  4997. this.$message.warning('请选择文件题名规则')
  4998. return
  4999. }
  5000. if(!row.type){
  5001. this.$message.warning('请选择文件题名范围')
  5002. return
  5003. }
  5004. this.$set(row, "isEdit", false);
  5005. this.$set(row, "isEdit1", false)
  5006. const ruleName=row.ruleName.join('-')
  5007. let ruleSizeVal=''
  5008. if(row.type==1){
  5009. ruleSizeVal=''
  5010. }else{
  5011. ruleSizeVal=row.ruleSizeValId.join(',')
  5012. }
  5013. let nameRuleDtos={
  5014. nameId:row.nameId,
  5015. nameRule:ruleName,
  5016. nodeId:ruleSizeVal,
  5017. projectId:this.projectid,
  5018. type:this.fileTitleModel.type
  5019. }
  5020. saveOrUpdateNameRule(
  5021. [nameRuleDtos]
  5022. ).then((res) => {
  5023. if(res.data.code==200){
  5024. this.$message.success(res.data.msg)
  5025. this.getFileTableData()
  5026. }else{
  5027. this.$message.error(res.data.msg)
  5028. }
  5029. });
  5030. },
  5031. changeRoleName(data,row){
  5032. const originalData=this.nodeTypelist
  5033. const dictKeyToDictValueMap = originalData.reduce((acc, item) => {
  5034. acc[item.dictKey] = item.dictValue;
  5035. return acc;
  5036. }, {});
  5037. const result = data.map(dictKey => dictKeyToDictValueMap[dictKey]);
  5038. this.$set(row, "roleNameVal", result);
  5039. this.selectDiv=Math.random()
  5040. },
  5041. addRow(){
  5042. this.fileTableData.unshift({isEdit:true,isEdit1:true,})
  5043. this.fileTitleModel.type=''
  5044. },
  5045. refreshRow(){
  5046. this.getFileTableData()
  5047. },
  5048. delRow(index,row){
  5049. if(!row.nameId){
  5050. this.fileTableData.splice(index,1)
  5051. }else{
  5052. this.$confirm("确定将选择数据删除?", {
  5053. confirmButtonText: "确定",
  5054. cancelButtonText: "取消",
  5055. type: "warning"
  5056. })
  5057. .then(() => {
  5058. return deletedNameRule(
  5059. {nameId:row.nameId}
  5060. ).then((res) => {
  5061. if(res.data.code==200){
  5062. this.$message.success(res.data.msg)
  5063. this.getFileTableData()
  5064. }else{
  5065. this.$message.error(res.data.msg)
  5066. }
  5067. });
  5068. });
  5069. }
  5070. },
  5071. batchsaveFileSize(){
  5072. let isCansave=true
  5073. let saveArr=[]
  5074. this.fileTableData.forEach((ele)=>{
  5075. if(ele.ruleName.length<1||!ele.type){
  5076. this.$message.warning('请先完善相关信息')
  5077. isCansave=false
  5078. return
  5079. }
  5080. let ruleSizeVal=''
  5081. if(ele.type==1){
  5082. ruleSizeVal=''
  5083. }else{
  5084. ruleSizeVal=ele.ruleSizeValId.join(',')
  5085. }
  5086. const ruleName=ele.ruleName.join('-')
  5087. saveArr.push({
  5088. nameId:ele.nameId||'',
  5089. nameRule:ruleName,
  5090. nodeId:ruleSizeVal,
  5091. projectId:this.projectid,
  5092. type:ele.type
  5093. })
  5094. })
  5095. if(!isCansave){
  5096. return
  5097. }
  5098. this.saveFileLoading=true
  5099. saveOrUpdateNameRule(
  5100. saveArr
  5101. ).then((res) => {
  5102. this.saveFileLoading=false
  5103. if(res.data.code==200){
  5104. this.$message.success(res.data.msg)
  5105. this.getFileTableData()
  5106. }else{
  5107. this.$message.error(res.data.msg)
  5108. }
  5109. });
  5110. },
  5111. async proSyncbtn(){
  5112. console.log('项目数据同步');
  5113. this.isAdd=''
  5114. this.getTypeOptions()
  5115. this.getRangeOptions()
  5116. this.getCheckIdList()
  5117. this.proSyncTag=true
  5118. if(this.$refs.syncProTree){
  5119. this.$refs.syncProTree.setCheckedKeys([])
  5120. }
  5121. if(this.$refs.proTable){
  5122. this.$refs.proTable.clearSelection()
  5123. }
  5124. this.isShowLeft=true
  5125. this.isShowTable=false
  5126. },
  5127. getRangeOptions(){
  5128. getDictionary({
  5129. code: "wbs_snyc_range",
  5130. }).then((res) => {
  5131. this.rangeOptions = res.data.data;
  5132. });
  5133. },
  5134. getTypeOptions(){
  5135. getDictionary({
  5136. code: "wbs_sync_type",
  5137. }).then((res) => {
  5138. this.typeOptions = res.data.data;
  5139. });
  5140. },
  5141. handleCheckChange1(data){
  5142. console.log(data,'data1111111111');
  5143. getNodeStatus({ id:data.primaryKeyId}).then((res) => {
  5144. if(res.data.code==200){
  5145. if(res.data.data){
  5146. this.$message.success('该节点有同步任务,请取消选择')
  5147. }
  5148. }else{
  5149. this.$message.error(res.data.msg)
  5150. }
  5151. });
  5152. },
  5153. async handleCheckChange(_,{checkedKeys,halfCheckedNodes}) {
  5154. let ids=checkedKeys && checkedKeys.length ? checkedKeys.join(',') : ''
  5155. // await this.getNodeStatusData()
  5156. this.getTempProjectList(ids)
  5157. },
  5158. async getTempProjectList(ids){
  5159. if(ids.length>0){
  5160. //分页获取证书列表数据
  5161. const { data: res } = await getTempProject({
  5162. nodeIds:ids
  5163. });
  5164. if (res.code == 200) {
  5165. this.templateIdList = res.data;
  5166. }
  5167. }
  5168. },
  5169. async changeTemplateId(val){
  5170. if(!this.isShowTable){
  5171. return
  5172. }
  5173. let type=''
  5174. let projectId=''
  5175. let wbsId=''
  5176. for (let index = 0; index < this.templateIdList.length; index++) {
  5177. const elemet = this.templateIdList[index];
  5178. if(elemet.id==val){
  5179. type = elemet.type;
  5180. this.typeTem=elemet.type
  5181. projectId=elemet.id
  5182. wbsId=elemet.wbsId
  5183. break
  5184. }
  5185. }
  5186. if(type===2){
  5187. selectByNodeTable(this.curTreeData.id, projectId, wbsId).then((res) => {
  5188. if (res.data.data&&res.data.data.length > 0) {
  5189. this.preTableData = res.data.data;
  5190. } else {
  5191. this.preTableData = [];
  5192. }
  5193. });
  5194. }else{
  5195. const { data: res } = await findNodeTableByCondition1( this.curTreeData.id )
  5196. if (res.code === 200) {
  5197. console.log(Array.isArray(res.data));
  5198. if (Array.isArray(res.data)) {
  5199. this.preTableData = res.data
  5200. } else {
  5201. this.preTableData = []
  5202. }
  5203. }
  5204. }
  5205. },
  5206. async getCheckIdList(){
  5207. let code=this.wbsType!==1?'wbs_sync_contract_range':'wbs_sync_contract_quality'
  5208. getDictionary({
  5209. code: code,
  5210. }).then((res) => {
  5211. this.checkIdList = res.data.data;
  5212. });
  5213. },
  5214. closeProSyncTag(){
  5215. this.proSyncTag=false
  5216. this.syncForm={
  5217. range:'',
  5218. rangeName:'',
  5219. type:[],
  5220. typeName:'',
  5221. templateId:'',
  5222. templateName:'',
  5223. contractRange:[],
  5224. contractRangeName:'',
  5225. nodeId:'',
  5226. formIds:''};
  5227. this.preTableData=[]
  5228. this.isShowLeft=false
  5229. },
  5230. async saveProTag(){
  5231. this.syncForm.projectId=this.projectid
  5232. if(this.isShowLeft){
  5233. let ids=this.$refs.syncProTree.getCheckedKeys()
  5234. this.syncForm.nodeId=ids.join(',')
  5235. if(this.syncForm.nodeId===''){
  5236. this.$message.warning('请选择节点')
  5237. return
  5238. }
  5239. }else{
  5240. this.syncForm.nodeId=this.curTreeData.primaryKeyId
  5241. }
  5242. // await this.getNodeStatusData()
  5243. if(this.syncListDialog){
  5244. return
  5245. }
  5246. if(this.syncForm.rangeName==''){
  5247. for (let index = 0; index < this.rangeOptions.length; index++) {
  5248. const element =this. rangeOptions[index];
  5249. if(element.dictKey==this.syncForm.range){
  5250. this.syncForm.rangeName=element.dictValue
  5251. break
  5252. }
  5253. }
  5254. }
  5255. console.log(this.syncForm.range,'this.syncForm.range=');
  5256. if(this.syncForm.range===''){
  5257. this.$message.warning('请选择同步范围')
  5258. return
  5259. }
  5260. this.saveProTagLoading=true
  5261. addSync({
  5262. ...this.syncForm,
  5263. type:this.syncForm.type.join(','),
  5264. contractRange:this.syncForm.contractRange.join(',')
  5265. }
  5266. ).then((res) => {
  5267. console.log(res,'res');
  5268. this.saveProTagLoading=false
  5269. if(res.data.code==200){
  5270. this.$message.success(res.data.msg)
  5271. //this.getNodeStatusData()
  5272. console.log(res.data,'res.data');
  5273. this.syncListData.nodeNum=res.data.data.nodeNum
  5274. this.syncListData.nodeNumEnd=res.data.data.nodeNumEnd
  5275. if(this.isShowLeft){
  5276. this.isAdd=res.data.data.id
  5277. }else{
  5278. this.isAdd=''
  5279. }
  5280. this.syncListDialog=true
  5281. this.closeProSyncTag()
  5282. }else{
  5283. this.$message.error(res.data.msg)
  5284. this.saveProTagLoading=false
  5285. }
  5286. })
  5287. .finally(() => {
  5288. this.saveProTagLoading = false;
  5289. });
  5290. },
  5291. closeSyncListTag(){
  5292. this.syncListDialog=false;
  5293. this.updateNodeTable()
  5294. },
  5295. handleCheckAllChange(val) {
  5296. this.syncForm.type = val ? this.typeOptions.map(item => item.dictKey) : [];
  5297. this.isIndeterminate = false;
  5298. },
  5299. handleCheckAllChange1(val) {
  5300. this.syncForm.contractRange = val ? this.checkIdList.map(item => item.dictKey) : [];
  5301. this.isIndeterminate1 = false;
  5302. },
  5303. handleCheckedTypeChange(value){
  5304. let checkedCount = value.length;
  5305. this.checkAll = checkedCount === this.typeOptions.length;
  5306. this.isIndeterminate = checkedCount > 0 && checkedCount < this.typeOptions.length;
  5307. },
  5308. handleCheckedTypeChange1(value){
  5309. let checkedCount = value.length;
  5310. this.checkAll1 = checkedCount === this.checkIdList.length;
  5311. this.isIndeterminate1 = checkedCount > 0 && checkedCount < this.checkIdList.length;
  5312. },
  5313. handleSelectionChange(val) {
  5314. let arr = []
  5315. if(val.length>0){
  5316. if(this.syncForm.range==='2'){
  5317. for (let index = 0; index < val.length; index++) {
  5318. let i = val[index];
  5319. arr.push(i.pkeyId)
  5320. }
  5321. this.syncForm.formIds=arr.join(',')
  5322. }else{
  5323. for (let index = 0; index < val.length; index++) {
  5324. let i = val[index];
  5325. if( this.typeTem===2){
  5326. arr.push(i.pkeyId)
  5327. }else{
  5328. arr.push(i.id)
  5329. }
  5330. }
  5331. console.log(arr,'arr');
  5332. this.syncForm.formIds=arr.join(',')
  5333. }
  5334. }
  5335. },
  5336. async handleCommand(command,row){
  5337. // await this.getNodeStatusData()
  5338. if(this.syncListDialog){
  5339. return
  5340. }
  5341. this.checkRow=row
  5342. if(command==='a'){
  5343. this.$confirm("当前表单配置将同步到项目下所有相同表单,请谨慎同步!!!!!!", "表单同步提醒", {
  5344. distinguishCancelAndClose: true,
  5345. confirmButtonText: "确定",
  5346. cancelButtonText: "取消",
  5347. }).then(() => {
  5348. addSync({
  5349. projectId:this.projectid,
  5350. range:'3',
  5351. nodeId:row.pkeyId,
  5352. nodeName:this.curTreeData.title,
  5353. }
  5354. ).then((res) => {
  5355. if(res.data.code==200){
  5356. this.$message.success(res.data.msg)
  5357. }else{
  5358. this.$message.error(res.data.msg)
  5359. }
  5360. })
  5361. });
  5362. }else if(command==='b'){
  5363. this.syncTableDialog=true
  5364. this.isShowLeft=true
  5365. if(this.$refs.proTable1){
  5366. this.$refs.proTable1.clearSelection()
  5367. }
  5368. }
  5369. },
  5370. saveTableSync(){
  5371. this.saveTableSyncLoad=true
  5372. addSync({
  5373. projectId:this.projectid,
  5374. range:'4',
  5375. nodeId:this.checkRow.pkeyId,
  5376. nodeName:this.curTreeData.title,
  5377. formIds:this.formIds,
  5378. }
  5379. ).then((res) => {
  5380. this.saveTableSyncLoad=false
  5381. if(res.data.code==200){
  5382. this.$message.success(res.data.msg)
  5383. this.syncTableDialog=false
  5384. this.$refs.proTable1.clearSelection()
  5385. this.updateNodeTable()
  5386. }else{
  5387. this.$message.error(res.data.msg)
  5388. }
  5389. })
  5390. this.saveTableSyncLoad=false
  5391. },
  5392. handleNodeClick(data) {
  5393. selectByNodeTable(data.id, this.projectid, this.id).then((res) => {
  5394. if (res.data.data.length) {
  5395. this.preTableData1 = res.data.data;
  5396. } else {
  5397. this.preTableData1 = [];
  5398. }
  5399. });
  5400. },
  5401. handleSelectionChange1(val) {
  5402. if (val.length > 1) {
  5403. // 如果选择了多个,只保留最后一个
  5404. this.$nextTick(() => {
  5405. this.$refs.proTable1.clearSelection();
  5406. this.$refs.proTable1.toggleRowSelection(val.pop());
  5407. });
  5408. }
  5409. if(val.length>0){
  5410. this.formIds=val[0].pkeyId
  5411. }else{
  5412. this.formIds=''
  5413. }
  5414. },
  5415. async refreshData(){
  5416. this.refreshLoading=true
  5417. getNodeStatus({ id:this.curTreeData.primaryKeyId}).then((res) => {
  5418. this.refreshLoading=false
  5419. if(res.data.code==200){
  5420. if(res.data.data){
  5421. this.syncListData.nodeNum=res.data.data.nodeNum
  5422. this.syncListData.nodeNumEnd=res.data.data.nodeNumEnd
  5423. }else{
  5424. this.syncListData={
  5425. nodeNum:'',//同步节点数量
  5426. nodeNumEnd:''//已同步数量
  5427. }
  5428. }
  5429. }else{
  5430. this.syncListData={
  5431. nodeNum:'',//同步节点数量
  5432. nodeNumEnd:''//已同步数量
  5433. }
  5434. this.$message.error(res.data.msg)
  5435. }
  5436. }).finally(() => {
  5437. this.refreshLoading = false;
  5438. });
  5439. },
  5440. refreshData1(){
  5441. console.log('shuax');
  5442. this.refreshLoading1=true
  5443. getById({ id:this.isAdd}).then((res) => {
  5444. this.refreshLoading1=false
  5445. if(res.data.code==200){
  5446. if(res.data.data){
  5447. this.syncListData.nodeNum=res.data.data.nodeNum
  5448. this.syncListData.nodeNumEnd=res.data.data.nodeNumEnd
  5449. }else{
  5450. this.syncListData={
  5451. nodeNum:'',//同步节点数量
  5452. nodeNumEnd:''//已同步数量
  5453. }
  5454. }
  5455. }else{
  5456. this.syncListData={
  5457. nodeNum:'',//同步节点数量
  5458. nodeNumEnd:''//已同步数量
  5459. }
  5460. this.$message.error(res.data.msg)
  5461. }
  5462. });
  5463. },
  5464. getNodeStatusData(){
  5465. let ids=''
  5466. if(this.isShowLeft){
  5467. ids=this.$refs.syncProTree.getCheckedKeys()
  5468. ids=ids.join(',')
  5469. }
  5470. else{
  5471. ids=this.curTreeData.primaryKeyId
  5472. }
  5473. getNodeStatus({ id:ids}).then((res) => {
  5474. if(res.data.code==200){
  5475. if(res.data.data){
  5476. this.syncListData.nodeNum=res.data.data.nodeNum
  5477. this.syncListData.nodeNumEnd=res.data.data.nodeNumEnd
  5478. this.syncListDialog=true
  5479. }else{
  5480. this.syncListData={
  5481. nodeNum:'',//同步节点数量
  5482. nodeNumEnd:''//已同步数量
  5483. }
  5484. this.syncListDialog=false
  5485. }
  5486. }else{
  5487. this.syncListDialog=false
  5488. this.syncListData={
  5489. nodeNum:'',//同步节点数量
  5490. nodeNumEnd:''//已同步数量
  5491. }
  5492. this.$message.error(res.data.msg)
  5493. }
  5494. });
  5495. },
  5496. //基础数据管理
  5497. handleBasicClick(command) {
  5498. if (command === "code") {
  5499. this.codeDialog = true;
  5500. this.$refs.codeSetRef.show(this.projectid)
  5501. }else if(command === "rule") {
  5502. this.$router.push({
  5503. path: "/rule/manager",
  5504. query: {
  5505. id: this.id,
  5506. parentId:this.nodeDetail.parentId,
  5507. tenant_id: this.userInfo.tenant_id,
  5508. projectid: this.projectid,
  5509. },
  5510. });
  5511. }
  5512. }
  5513. },
  5514. watch: {
  5515. "GLExcelFrom.search"(val) {
  5516. console.log(val);
  5517. if (this.exceldata) {
  5518. this.$refs.tree.filter(val);
  5519. }
  5520. },
  5521. 'syncForm.contractRange': {
  5522. handler(newVal) {
  5523. if (newVal && newVal.length) {
  5524. const selectedValues = newVal.map(key => {
  5525. const item = this.checkIdList.find(item => item.dictKey === key);
  5526. return item ? item.dictValue : key;
  5527. });
  5528. this.syncForm.contractRangeName = selectedValues.join(',');
  5529. } else {
  5530. this.syncForm.contractRangeName = '';
  5531. }
  5532. },
  5533. immediate: true
  5534. },
  5535. 'syncForm.templateId': {
  5536. handler(newVal) {
  5537. if (newVal && newVal.length) {
  5538. for (let index = 0; index < this.templateIdList.length; index++) {
  5539. const elemet = this.templateIdList[index];
  5540. if(elemet.id==newVal){
  5541. this.syncForm.templateName = elemet.name;
  5542. break
  5543. }
  5544. }
  5545. } else {
  5546. this.syncForm.rangeName = '';
  5547. }
  5548. },
  5549. immediate: true
  5550. },
  5551. 'syncForm.type': {
  5552. handler(newVal) {
  5553. if (newVal && newVal.length) {
  5554. const selectedValues = newVal.map(key => {
  5555. const item = this.typeOptions.find(item => item.dictKey === key);
  5556. return item ? item.dictValue : key;
  5557. });
  5558. this.syncForm.typeName = selectedValues.join(',');
  5559. } else {
  5560. this.syncForm.typeName = '';
  5561. }
  5562. },
  5563. immediate: true
  5564. },
  5565. 'syncForm.range': {
  5566. handler(newVal) {
  5567. console.log(newVal,'newVal');
  5568. if (newVal && newVal.length) {
  5569. for (let index = 0; index < this.rangeOptions.length; index++) {
  5570. const elemet = this.rangeOptions[index];
  5571. if(elemet.dictKey==newVal){
  5572. this.syncForm.rangeName = elemet.dictValue;
  5573. break
  5574. }
  5575. }
  5576. } else {
  5577. this.syncForm.rangeName = '';
  5578. }
  5579. },
  5580. immediate: true
  5581. },
  5582. },
  5583. components: {
  5584. dynamicExcel,
  5585. ManualSorting,
  5586. FormulaEdit,
  5587. EditElement,
  5588. FormulaEditone,
  5589. CodeSet
  5590. },
  5591. };
  5592. </script>
  5593. <style scoped lang="scss">
  5594. .font-s-12 ::v-deep .iconfont {
  5595. font-size: 12px;
  5596. }
  5597. .el-popper[x-placement^="bottom"] {
  5598. margin-top: -6px;
  5599. }
  5600. .right-btn {
  5601. position: absolute;
  5602. right: 20px;
  5603. top: 10px;
  5604. font-size: 20px;
  5605. }
  5606. .custom-tree-node {
  5607. .normal-black {
  5608. display: none;
  5609. }
  5610. &:hover {
  5611. .normal-black {
  5612. display: inline-block;
  5613. }
  5614. }
  5615. &.show .normal-black {
  5616. display: inline-block;
  5617. }
  5618. }
  5619. .excelBox {
  5620. ::v-deep .el-dialog__body {
  5621. padding: 20px;
  5622. }
  5623. }
  5624. //调整表单样式
  5625. .excelHtml {
  5626. position: absolute;
  5627. z-index: 999999;
  5628. top: 50px;
  5629. left: 0px;
  5630. width: 100%;
  5631. height: 100%;
  5632. }
  5633. .jiedian {
  5634. ::v-deep .el-dialog__body {
  5635. padding: 10px 20px !important;
  5636. }
  5637. }
  5638. .filter-tree {
  5639. min-width: 100%;
  5640. display: inline-block;
  5641. }
  5642. .full-dialog {
  5643. ::v-deep .el-dialog__body {
  5644. padding-bottom: 0;
  5645. padding-top: 0;
  5646. }
  5647. ::v-deep .basic-container {
  5648. height: calc(100vh - 60px);
  5649. }
  5650. }
  5651. .my-basic-con {
  5652. padding: 6px 6px;
  5653. }
  5654. // 树形控件菜单样式
  5655. .contextmenu {
  5656. margin: 0;
  5657. background: #fff;
  5658. z-index: 1000;
  5659. position: fixed; //关键样式设置固定定位
  5660. list-style-type: none;
  5661. padding: 5px 0;
  5662. border-radius: 4px;
  5663. font-size: 12px;
  5664. font-weight: 400;
  5665. color: #333;
  5666. box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
  5667. }
  5668. .contextmenu li {
  5669. margin: 0;
  5670. padding: 7px 16px;
  5671. cursor: pointer;
  5672. }
  5673. .contextmenu li:hover {
  5674. background: #eee;
  5675. }
  5676. .selectBtn {
  5677. position: absolute;
  5678. top: 50px;
  5679. right: 585px;
  5680. z-index: 1000;
  5681. width: 140px;
  5682. text-align: left;
  5683. }
  5684. .titlerow {
  5685. // float: right;
  5686. background-color: rgba(31, 34, 41, 0.8);
  5687. // width:104%;
  5688. padding-left: 10px;
  5689. padding-right: 10px;
  5690. text-align: right;
  5691. margin-top: -20px;
  5692. margin-left: -20px;
  5693. margin-right: -20px;
  5694. }
  5695. .dialog-title{
  5696. display: flex;
  5697. }
  5698. .dialog-title-text{
  5699. flex: 0.4;
  5700. padding-left: 10px;
  5701. }
  5702. .dialog-title-tip{
  5703. flex: 0.6;
  5704. // position: absolute;
  5705. color:rgba(255, 125, 67, 1);
  5706. padding-left: 40px;
  5707. // right: 60px;
  5708. }
  5709. .sync-container{
  5710. margin-top: -30px;
  5711. display: flex;
  5712. height: 570px;
  5713. .box-card-1{
  5714. margin-right: 10px;
  5715. height: 100%;
  5716. overflow-y: auto;
  5717. }
  5718. .box-card-2{
  5719. flex: 1;
  5720. height: 100%;
  5721. overflow-y: auto;
  5722. .el-form-item {
  5723. border: 1px solid #dcdfe6;
  5724. padding: 0 10px 10px 10px;
  5725. border-radius: 4px;
  5726. font-weight: bold;
  5727. .el-form-item__label {
  5728. font-weight: bold;
  5729. padding-bottom: 0px;
  5730. }
  5731. .el-form--label-top .el-form-item__label{
  5732. padding: 0px !important;
  5733. }
  5734. }
  5735. }
  5736. }
  5737. .content-box{
  5738. display: flex;
  5739. flex-direction: column;
  5740. justify-content: center;
  5741. align-items: center;
  5742. font-weight: bolder;
  5743. .mt-14{
  5744. margin-top: 14px;
  5745. }
  5746. }
  5747. </style>
  5748. <style lang="scss">
  5749. .el-dialog.hc-link-nodes-dialog {
  5750. width: 500px;
  5751. margin-top: 50px !important;
  5752. height: calc(100% - 100px);
  5753. .el-dialog__body {
  5754. height: calc(100% - 154px);
  5755. border-top: 1px solid #eee;
  5756. border-bottom: 1px solid #eee;
  5757. padding: 14px;
  5758. overflow: auto;
  5759. }
  5760. }
  5761. .el-tree.hc-link-nodes-tree .el-tree-node .el-tree-node__content {
  5762. .el-checkbox {
  5763. display: none;
  5764. }
  5765. .is-leaf + .el-checkbox {
  5766. display: inline-block;
  5767. }
  5768. }
  5769. .warning-text{
  5770. color: orange;
  5771. font-weight: bold;
  5772. }
  5773. .orange {
  5774. color: orange;
  5775. }
  5776. .box-card-2{
  5777. .el-form-item {
  5778. .el-form-item__content {
  5779. line-height: 10px !important;
  5780. margin-top: -10px !important;
  5781. }
  5782. }
  5783. }
  5784. </style>