tree.vue 200 KB

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