tree.vue 182 KB

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