index.vue 239 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424
  1. <template>
  2. <div class="position-detail-container">
  3. <div class="header-container">
  4. <page-header title="测试" @back="goBack" />
  5. <div class="header-actions">
  6. <el-button type="primary" @click="handleEdit">保存</el-button>
  7. <el-button @click="handleShare">分享职位</el-button>
  8. </div>
  9. </div>
  10. <div class="detail-content">
  11. <!-- 左侧详情信息 -->
  12. <el-card class="detail-card">
  13. <div class="section-title">
  14. <div class="section-line"></div>
  15. <span>职位详情</span>
  16. </div>
  17. <div class="detail-item">
  18. <div class="detail-label">职位名称</div>
  19. <div class="detail-value" v-if="!isEditingTitle">
  20. {{ positionData.title }}
  21. <el-button type="text" class="edit-title-btn" @click="startEditTitle">
  22. <el-icon><Edit /></el-icon>
  23. </el-button>
  24. </div>
  25. <div class="title-edit-container" v-else>
  26. <el-input
  27. v-model="editingTitle"
  28. placeholder="请输入职位名称"
  29. maxlength="20"
  30. show-word-limit
  31. />
  32. <div class="title-edit-actions">
  33. <el-button size="small" @click="cancelEditTitle">取消</el-button>
  34. <el-button size="small" type="primary" @click="saveTitle">保存</el-button>
  35. </div>
  36. </div>
  37. </div>
  38. <!-- 工作地点 -->
  39. <div class="detail-item">
  40. <div class="detail-label">工作地点</div>
  41. <div class="detail-value" v-if="!isEditingLocation">
  42. {{
  43. (() => {
  44. if (!positionData.location) return '暂无';
  45. if (Array.isArray(positionData.location)) return positionData.location.join(',');
  46. if (typeof positionData.location === 'string') {
  47. try {
  48. // 移除方括号并分割字符串
  49. const cleanStr = positionData.location.replace(/[\[\]']/g, '');
  50. return cleanStr.split(',').map(item => item.trim()).join(',');
  51. } catch (e) {
  52. return positionData.location;
  53. }
  54. }
  55. return positionData.location;
  56. })()
  57. }}
  58. <el-button type="text" class="edit-title-btn" @click="startEditLocation">
  59. <el-icon><Edit /></el-icon>
  60. </el-button>
  61. </div>
  62. <div class="title-edit-container" v-else>
  63. <!-- <el-input
  64. v-model="editingLocation"
  65. placeholder="请输入工作地点"
  66. maxlength="50"
  67. show-word-limit
  68. /> -->
  69. <el-cascader
  70. v-model="editingLocation"
  71. :options="locationOptions"
  72. :props="{
  73. expandTrigger: 'hover',
  74. checkStrictly: false,
  75. value: 'code',
  76. label: 'name'
  77. }"
  78. style="width: 100%"
  79. placeholder="请选择工作地点"
  80. clearable
  81. @change="handleLocationChange"
  82. />
  83. <div class="title-edit-actions">
  84. <el-button size="small" @click="cancelEditLocation">取消</el-button>
  85. <el-button size="small" type="primary" @click="saveLocation">保存</el-button>
  86. </div>
  87. </div>
  88. </div>
  89. <!-- 职位薪资 -->
  90. <div class="detail-item">
  91. <div class="detail-label">职位薪资</div>
  92. <div class="detail-value" v-if="!isEditingSalary">
  93. {{ positionData.salary_range || '暂无' }}
  94. <el-button type="text" class="edit-title-btn" @click="startEditSalary">
  95. <el-icon><Edit /></el-icon>
  96. </el-button>
  97. </div>
  98. <div class="title-edit-container" v-else>
  99. <el-input
  100. v-model="editingSalary"
  101. placeholder="请输入职位薪资"
  102. maxlength="30"
  103. show-word-limit
  104. />
  105. <div class="title-edit-actions">
  106. <el-button size="small" @click="cancelEditSalary">取消</el-button>
  107. <el-button size="small" type="primary" @click="saveSalary">保存</el-button>
  108. </div>
  109. </div>
  110. </div>
  111. <!-- 工作经验 -->
  112. <div class="detail-item">
  113. <div class="detail-label">工作经验</div>
  114. <div class="detail-value" v-if="!isEditingExperience">
  115. {{ positionData.work_experience_required || '暂无' }}
  116. <el-button type="text" class="edit-title-btn" @click="startEditExperience">
  117. <el-icon><Edit /></el-icon>
  118. </el-button>
  119. </div>
  120. <div class="title-edit-container" v-else>
  121. <el-select v-model="editingExperience" placeholder="请选择工作经验" style="width: 100%">
  122. <el-option label="不限" value="不限" />
  123. <el-option label="应届毕业生" value="应届毕业生" />
  124. <el-option label="1年以下" value="1年以下" />
  125. <el-option label="1-3年" value="1-3年" />
  126. <el-option label="3-5年" value="3-5年" />
  127. <el-option label="5-10年" value="5-10年" />
  128. <el-option label="10年以上" value="10年以上" />
  129. </el-select>
  130. <div class="title-edit-actions">
  131. <el-button size="small" @click="cancelEditExperience">取消</el-button>
  132. <el-button size="small" type="primary" @click="saveExperience">保存</el-button>
  133. </div>
  134. </div>
  135. </div>
  136. <!-- 学历要求 -->
  137. <div class="detail-item">
  138. <div class="detail-label">学历要求</div>
  139. <div class="detail-value" v-if="!isEditingEducation">
  140. {{ positionData.education_required || '暂无' }}
  141. <el-button type="text" class="edit-title-btn" @click="startEditEducation">
  142. <el-icon><Edit /></el-icon>
  143. </el-button>
  144. </div>
  145. <div class="title-edit-container" v-else>
  146. <el-select v-model="editingEducation" placeholder="请选择学历要求" style="width: 100%">
  147. <el-option label="不限" value="不限" />
  148. <el-option label="高中" value="高中" />
  149. <el-option label="大专" value="大专" />
  150. <el-option label="本科" value="本科" />
  151. <el-option label="硕士" value="硕士" />
  152. <el-option label="博士" value="博士" />
  153. </el-select>
  154. <div class="title-edit-actions">
  155. <el-button size="small" @click="cancelEditEducation">取消</el-button>
  156. <el-button size="small" type="primary" @click="saveEducation">保存</el-button>
  157. </div>
  158. </div>
  159. </div>
  160. <!-- 所属部门 -->
  161. <div class="detail-item">
  162. <div class="detail-label">所属部门</div>
  163. <div class="detail-value" v-if="!isEditingDepartment">
  164. {{ positionData.department || '暂无' }}
  165. <el-button type="text" class="edit-title-btn" @click="startEditDepartment">
  166. <el-icon><Edit /></el-icon>
  167. </el-button>
  168. </div>
  169. <div class="title-edit-container" v-else>
  170. <el-input
  171. v-model="editingDepartment"
  172. placeholder="请输入所属部门"
  173. maxlength="30"
  174. show-word-limit
  175. />
  176. <div class="title-edit-actions">
  177. <el-button size="small" @click="cancelEditDepartment">取消</el-button>
  178. <el-button size="small" type="primary" @click="saveDepartment">保存</el-button>
  179. </div>
  180. </div>
  181. </div>
  182. <div class="detail-item">
  183. <div class="detail-label">职位状态</div>
  184. <div class="detail-value">
  185. <el-tag :type="getStatusType(positionData.status)">
  186. {{ getStatusText(positionData.status) }}
  187. </el-tag>
  188. </div>
  189. </div>
  190. <div class="detail-item">
  191. <div class="detail-label">截止日期</div>
  192. <div class="detail-value" v-if="!isEditingEndDate">
  193. {{ positionData.end_date || '暂无' }}
  194. <el-button type="text" class="edit-title-btn" @click="startEditEndDate">
  195. <el-icon><Edit /></el-icon>
  196. </el-button>
  197. </div>
  198. <div class="title-edit-container" v-else>
  199. <el-date-picker
  200. v-model="editingEndDate"
  201. type="date"
  202. placeholder="请选择截止日期"
  203. format="YYYY-MM-DD"
  204. value-format="YYYY-MM-DD"
  205. style="width: 100%"
  206. />
  207. <div class="title-edit-actions">
  208. <el-button size="small" @click="cancelEditEndDate">取消</el-button>
  209. <el-button size="small" type="primary" @click="saveEndDate">保存</el-button>
  210. </div>
  211. </div>
  212. </div>
  213. <div class="detail-item" >
  214. <div class="detail-label">职位要求</div>
  215. <div class="detail-value html-content" v-if="!isEditingRequirements" v-html="positionData.requirements"></div>
  216. <el-button type="text" class="edit-title-btn" @click="startEditRequirements" v-if="!isEditingRequirements">
  217. <el-icon><Edit /></el-icon>
  218. </el-button>
  219. <div class="title-edit-container" v-else>
  220. <el-input
  221. v-model="editingRequirements"
  222. type="textarea"
  223. rows="6"
  224. placeholder="请输入职位要求"
  225. maxlength="1000"
  226. show-word-limit
  227. />
  228. <div class="title-edit-actions">
  229. <el-button size="small" @click="cancelEditRequirements">取消</el-button>
  230. <el-button size="small" type="primary" @click="saveRequirements">保存</el-button>
  231. </div>
  232. </div>
  233. </div>
  234. <div style="width: 100%; border-bottom: 1px solid #e5e5e5;"></div>
  235. <div class="detail-item">
  236. <div class="detail-label">职位描述</div>
  237. <div class="detail-value html-content" v-if="!isEditingDescription" v-html="positionData.description"></div>
  238. <el-button type="text" class="edit-title-btn" @click="startEditDescription" v-if="!isEditingDescription">
  239. <el-icon><Edit /></el-icon>
  240. </el-button>
  241. <div class="title-edit-container" v-else>
  242. <el-input
  243. v-model="editingDescription"
  244. type="textarea"
  245. rows="6"
  246. placeholder="请输入职位描述"
  247. maxlength="1000"
  248. show-word-limit
  249. />
  250. <div class="title-edit-actions">
  251. <el-button size="small" @click="cancelEditDescription">取消</el-button>
  252. <el-button size="small" type="primary" @click="saveDescription">保存</el-button>
  253. </div>
  254. </div>
  255. </div>
  256. <!-- 在 detail-item 列表中添加能力标签部分 -->
  257. <div class="detail-item">
  258. <div class="detail-label">能力标签</div>
  259. <div class="detail-value" v-if="!isEditingCompetency">
  260. <el-tag
  261. v-for="tag in positionData.competency_tags"
  262. :key="tag.id"
  263. effect="plain"
  264. class="competency-tag"
  265. >
  266. {{ tag.name }}
  267. </el-tag>
  268. <el-button type="text" class="edit-title-btn" @click="startEditCompetency">
  269. <el-icon><Edit /></el-icon>
  270. </el-button>
  271. </div>
  272. <div class="title-edit-container" v-else>
  273. <el-select
  274. v-model="selectedCompetencies"
  275. multiple
  276. filterable
  277. placeholder="请选择能力标签"
  278. style="width: 100%"
  279. >
  280. <el-option
  281. v-for="tag in competencyTagOptions"
  282. :key="tag.id"
  283. :label="tag.name"
  284. :value="tag.id"
  285. >
  286. </el-option>
  287. </el-select>
  288. <div class="title-edit-actions">
  289. <el-button size="small" @click="cancelEditCompetency">取消</el-button>
  290. <el-button size="small" type="primary" @click="saveCompetency">保存</el-button>
  291. </div>
  292. </div>
  293. </div>
  294. </el-card>
  295. <!-- 右侧状态信息 -->
  296. <div class="status-cards">
  297. <el-card class="status-card">
  298. <div class="section-title">
  299. <div class="section-line"></div>
  300. <span>职位状态</span>
  301. </div>
  302. <div class="status-switch">
  303. <el-switch
  304. v-model="positionStatus"
  305. inactive-text=""
  306. @change="handleStatusChange"
  307. />
  308. <span class="status-text">{{ positionStatus ? '已启用' : '待启用' }}</span>
  309. </div>
  310. </el-card>
  311. <el-card class="status-card">
  312. <div class="section-title">
  313. <div class="section-line"></div>
  314. <span>职位性质</span>
  315. <el-button type="text" class="edit-btn" @click="startEditJobType" v-if="!isEditingJobType">编辑</el-button>
  316. </div>
  317. <div class="usage-content">
  318. <!-- <div class="usage-label">职位用途</div> -->
  319. <div class="usage-value" v-if="!isEditingJobType">{{ getJobTypeText(positionData.job_type) }}</div>
  320. <!-- 编辑模式 -->
  321. <div v-if="isEditingJobType" class="title-edit-container">
  322. <el-select v-model="editingJobType" placeholder="请选择职位性质" style="width: 100%;">
  323. <el-option label="全职" :value="0"></el-option>
  324. <el-option label="兼职" :value="1"></el-option>
  325. <el-option label="实习" :value="2"></el-option>
  326. <el-option label="其他" :value="3"></el-option>
  327. </el-select>
  328. <div class="title-edit-actions">
  329. <el-button size="small" @click="cancelEditJobType">取消</el-button>
  330. <el-button size="small" type="primary" @click="saveEditJobType">保存</el-button>
  331. </div>
  332. </div>
  333. </div>
  334. </el-card>
  335. <el-card class="status-card">
  336. <div class="section-title">
  337. <div class="section-line"></div>
  338. <span>招聘流程</span>
  339. <el-button type="text" class="edit-btn" @click="handleEditProcess">设置流程</el-button>
  340. </div>
  341. <div class="process-steps">
  342. <div
  343. v-for="(step, index) in recruitmentProcess"
  344. :key="step.id"
  345. class="process-step"
  346. :class="{ 'disabled': !step.active }"
  347. v-show="step.visible"
  348. >
  349. <div class="step-number">{{ index + 1 }}</div>
  350. <div class="step-content">
  351. <div class="step-title">{{ step.name }}</div>
  352. <!-- <div class="step-desc">{{ step.description }}</div> -->
  353. </div>
  354. </div>
  355. </div>
  356. </el-card>
  357. <el-card class="status-card">
  358. <div class="section-title">
  359. <div class="section-line"></div>
  360. <span>面试设置</span>
  361. <el-button type="text" class="edit-btn" @click="handleEditInterview">编辑</el-button>
  362. </div>
  363. </el-card>
  364. </div>
  365. </div>
  366. <!-- 添加招聘流程编辑对话框 -->
  367. <el-dialog
  368. title="设置招聘流程"
  369. v-model="showProcessDialog"
  370. width="500px"
  371. :close-on-click-modal="false"
  372. >
  373. <div class="process-dialog-content">
  374. <div v-for="(step, index) in recruitmentProcess" :key="step.id" v-show="step.visible">
  375. <!-- 添加在每个步骤上方的加号按钮,最后两个步骤不显示加号 -->
  376. <div class="add-process-btn-top" v-if="index < recruitmentProcess.length - 1">
  377. <el-button type="text" @click="showStepOptions(index, $event)">
  378. <el-icon><Plus /></el-icon>
  379. </el-button>
  380. </div>
  381. <div
  382. class="process-edit-item"
  383. :class="{ 'highlight': step.active }"
  384. >
  385. <div class="process-number">{{ index + 1 }}</div>
  386. <div class="process-edit-content">
  387. <div>{{ step.name }}</div>
  388. <div class="process-edit-desc">{{ step.description }}</div>
  389. </div><!-- v-if="step.name=='AI考察'" -->
  390. <div class="process-edit-btn">
  391. <el-button
  392. type="info"
  393. size="small"
  394. plain
  395. @click="editProcessStep(step, index)"
  396. >
  397. 修改
  398. </el-button>
  399. <el-button
  400. type="danger"
  401. size="small"
  402. plain
  403. style="margin-top: 10px;margin-left: 0px;"
  404. @click="deleteProcessStep(step,index)"
  405. >
  406. 删除
  407. </el-button>
  408. </div>
  409. </div>
  410. </div>
  411. <!-- 最后一个步骤下方的加号按钮 -->
  412. <div class="add-process-btn">
  413. <!-- <el-button type="text" @click="showStepOptions(recruitmentProcess.length, $event)">
  414. <el-icon><Plus /></el-icon>
  415. </el-button> -->
  416. </div>
  417. </div>
  418. <!-- 添加选项菜单 -->
  419. <div
  420. v-if="showOptionsMenu"
  421. class="process-options-menu"
  422. :style="{ top: menuPosition.top, left: menuPosition.left }"
  423. @click.stop
  424. >
  425. <div class="close-btn" @click="showOptionsMenu = false">
  426. <el-icon><Close /></el-icon>
  427. </div>
  428. <div
  429. v-for="option in processStepOptions"
  430. :key="option.value"
  431. class="process-option-item"
  432. @click="addSelectedStepType(option.value, option.label)"
  433. >
  434. {{ option.label }}
  435. </div>
  436. </div>
  437. <template #footer>
  438. <span class="dialog-footer">
  439. <el-button @click="cancelEditProcess">取消</el-button>
  440. <el-button type="primary" @click="saveProcess">确定</el-button>
  441. </span>
  442. </template>
  443. </el-dialog>
  444. <!-- AI考察配置对话框 -->
  445. <el-drawer
  446. title="AI考察"
  447. v-model="showAIVideoDialog"
  448. direction="rtl"
  449. size="60%"
  450. :close-on-click-modal="false"
  451. class="ai-video-drawer"
  452. :destroy-on-close="false"
  453. >
  454. <!-- 步骤指示器 -->
  455. <div class="ai-video-steps">
  456. <div class="step-item" :class="{ 'active': currentStep === 1 }" @click="jumpToStep(1)">
  457. <div class="step-number">1</div>
  458. <div class="step-title" :class="{ 'active-title': currentStep === 1 }">考察能力</div>
  459. </div>
  460. <div class="step-line" :class="{ 'active-line': currentStep >= 2 }"></div>
  461. <div class="step-item" :class="{ 'active': currentStep === 2 }" @click="jumpToStep(2)">
  462. <div class="step-number">2</div>
  463. <div class="step-title" :class="{ 'active-title': currentStep === 2 }">面试题目</div>
  464. </div>
  465. <div class="step-line" :class="{ 'active-line': currentStep >= 3 }"></div>
  466. <div class="step-item" :class="{ 'active': currentStep === 3 }" @click="jumpToStep(3)">
  467. <div class="step-number">3</div>
  468. <div class="step-title" :class="{ 'active-title': currentStep === 3 }">系统设置</div>
  469. </div>
  470. </div>
  471. <!-- 步骤1:考察能力 -->
  472. <div v-if="currentStep === 1" class="ai-video-content" v-loading="competencyLoading" element-loading-text="正在生成能力标签...">
  473. <div class="ai-video-options">
  474. <div class="ai-video-options-header">
  475. <div class="ai-video-options-header-title">
  476. <span>AI根据岗位信息生成的能力,创建完步骤后,会自动将选择的胜任力考核维度加入到该职位的考察能力列表中。</span>
  477. </div>
  478. <!-- <div class="right_btn">
  479. <el-button type="primary" class="custom-btn" plain size="small" @click="handleAddCompetency">重新生成</el-button>
  480. </div> -->
  481. </div>
  482. <!-- <p class="option-tip">AI根据岗位信息生成的能力,创建完步骤后,会自动将选择的新智能能力加入到该职位的考察能力列表中。</p> -->
  483. <!-- <div class="new-feature-tip">
  484. 下面是奇才智能算法推荐的胜任力考核维度,请结合您的需求增删,确认后点击「下一步」出题
  485. <span class="new-tag">NEW</span>
  486. AI根据岗位信息生成的能力,创建完步骤后,会自动将选择的新智能能力加入到该职位的考察能力列表中。
  487. </div> -->
  488. <!-- 推荐的考核维度 -->
  489. <div class="recommended-dimensions">
  490. <!-- <h3>推荐考核维度</h3> -->
  491. <div class="dimension-grid" >
  492. <el-checkbox
  493. v-for="item in competencyTags.slice(0,10)"
  494. :key="item.id"
  495. v-model="item.selected"
  496. @change="(val: boolean) => handleCompetencyChange(item, val)"
  497. class="custom-checkbox"
  498. >
  499. <div class="ability-label">
  500. <span>{{ item.name }}</span>
  501. <img src="../../../assets/sheng.png" alt="" class="sheng">
  502. </div>
  503. </el-checkbox>
  504. </div>
  505. </div>
  506. <!-- 备选考核维度 -->
  507. <div class="optional-dimensions">
  508. <div class="header-row">
  509. <h3 style="color: #808080;">备选考核维度</h3>
  510. <div class="right_btn">
  511. <el-button type="primary" class="custom-btn" plain size="small" @click="handleAddCompetency">重新生成</el-button>
  512. </div>
  513. </div>
  514. <div class="dimension-grid">
  515. <el-checkbox
  516. v-for="item in competencyTags.slice(10,50)"
  517. :key="item.id"
  518. v-model="item.selected"
  519. @change="(val: boolean) => handleCompetencyChange(item, val)"
  520. class="custom-checkbox">
  521. <div class="ability-label">
  522. <span>{{ item.name }}</span>
  523. <!-- <span v-if="item.isCustom" class="custom-tag">自定义</span> -->
  524. <!-- <el-tooltip content="考察候选人的XXXX能力" placement="top">
  525. <el-icon><QuestionFilled /></el-icon>
  526. </el-tooltip> -->
  527. </div>
  528. </el-checkbox>
  529. <!-- 显示自定义维度 -->
  530. <!-- <div
  531. v-for="item in competencyTags.filter(tag => tag.isCustom)"
  532. :key="'custom-' + item.id"
  533. class="custom-dimension-item">
  534. <el-checkbox
  535. v-model="item.selected"
  536. @change="(val: boolean) => handleCompetencyChange(item, val)"
  537. class="custom-checkbox">
  538. <div class="ability-label">
  539. <span>{{ item.name }}</span>
  540. <span class="custom-tag">自定义</span>
  541. <el-tooltip :content="item.description" placement="top" v-if="item.description">
  542. <el-icon><QuestionFilled /></el-icon>
  543. </el-tooltip>
  544. </div>
  545. </el-checkbox>
  546. <el-button
  547. type="text"
  548. size="small"
  549. class="delete-custom-btn"
  550. @click="deleteCustomDimension(item)"
  551. title="删除自定义维度">
  552. <el-icon><Close /></el-icon>
  553. </el-button>
  554. </div> -->
  555. </div>
  556. </div>
  557. <!-- 自定义维度 -->
  558. <div class="custom-dimensions">
  559. <h3 style="color: #808080;">自定义维度</h3>
  560. <div class="dimension-form">
  561. <div class="dimension-row">
  562. <div class="dimension-input">
  563. <!-- <div class="input-label">维度名称:</div> -->
  564. <el-input style="width: 150px;" v-model="customDimension" placeholder="请输入维度名称" />
  565. </div>
  566. <div class="dimension-input">
  567. <div class="input-label">特征描述:</div>
  568. <el-input v-model="customDescription" style="width: 500px;" type="textarea" placeholder="请输入特征描述" />
  569. </div>
  570. </div>
  571. <div class="dimension-actions">
  572. <!-- <el-checkbox v-model="continueAdd" class="custom-checkbox">
  573. <div class="ability-label">
  574. <span>继续新增</span>
  575. </div>
  576. </el-checkbox> -->
  577. <el-button type="primary" @click="addDimension" >添加</el-button>
  578. </div>
  579. </div>
  580. </div>
  581. </div>
  582. </div>
  583. <!-- 步骤2:面试题目 -->
  584. <div v-if="currentStep === 2" class="ai-video-content">
  585. <div class="interview-settings">
  586. <div class="interview-header">
  587. <div class="interview-actions">
  588. <el-button plain class="custom-btn" @click="handleImportQuestion"><!-- @click="handleAddQuestion" -->
  589. <el-icon><Plus /></el-icon>
  590. 自定义题目
  591. </el-button>
  592. <el-button plain class="custom-btn" >
  593. <el-icon><Document /></el-icon>
  594. 导入题目
  595. </el-button>
  596. <el-button
  597. v-if="chatQuestions.length > 0"
  598. type="primary"
  599. plain
  600. class="custom-btn"
  601. :loading="autoGenerateLoading"
  602. @click="handleAutoGenerate"
  603. >
  604. <el-icon><Refresh /></el-icon>
  605. 重新生成
  606. </el-button>
  607. <!-- 添加得分题和色盲题开关 -->
  608. <div class="question-switches">
  609. <!-- 添加题目数量控制 -->
  610. <div class="switch-item">
  611. <span class="switch-label">开放题数量</span>
  612. <el-input-number
  613. v-model="questionCountSettings.openQuestionsCount"
  614. :min="1"
  615. :max="10"
  616. size="small"
  617. @change="handleQuestionCountChange"
  618. />
  619. </div>
  620. <div class="switch-item">
  621. <span class="switch-label">选择题数量</span>
  622. <el-input-number
  623. v-model="questionCountSettings.choiceQuestionsCount"
  624. :min="1"
  625. :max="20"
  626. size="small"
  627. @change="handleQuestionCountChange"
  628. />
  629. </div>
  630. <!-- <div class="switch-item">
  631. <span class="switch-label">得分题</span>
  632. <el-switch
  633. style="margin-top:0px;"
  634. v-model="questionSettings.enableScoreQuestions"
  635. @change="handleScoreQuestionsChange"
  636. />
  637. </div>
  638. <div class="switch-item">
  639. <span class="switch-label">色盲题</span>
  640. <el-switch
  641. style="margin-top:0px;"
  642. v-model="questionSettings.enableColorBlindQuestions"
  643. @change="handleColorBlindQuestionsChange"
  644. />
  645. </div> -->
  646. </div>
  647. </div>
  648. <div class="interview-duration">
  649. <span>预计面试时长: </span>
  650. <span class="duration-value">{{ formatDuration }}</span>
  651. <span class="duration-tip">拖动试题卡片可改变试题顺序</span>
  652. </div>
  653. </div>
  654. <!-- <div class="interview-mode">
  655. <span>面试问答方式: </span>
  656. <span class="mode-value">传统读题模式</span>
  657. <el-button type="primary" plain size="small" class="customize-btn">定制面试间</el-button>
  658. </div> -->
  659. <div class="interview-content">
  660. <div class="interview-questions-container" v-loading="autoGenerateLoading" element-loading-text="AI正在生成题目...">
  661. <div class="no-questions" v-if="chatQuestions.length === 0">
  662. <p>暂无题目</p>
  663. <p class="ai-tip">点击"AI自动组题"按钮</p>
  664. <p class="ai-tip">可根据您选择的能力类型一键组题</p>
  665. <el-button
  666. type="success"
  667. class="auto-generate-btn"
  668. :loading="autoGenerateLoading"
  669. @click="handleAutoGenerate"
  670. >
  671. AI自动组题
  672. </el-button>
  673. <el-button
  674. v-if="autoGenerateLoading && pollingController"
  675. type="warning"
  676. plain
  677. size="small"
  678. @click="handleCancelGenerate"
  679. style="margin-left: 10px;"
  680. >
  681. 取消生成
  682. </el-button>
  683. </div>
  684. <!-- :component-data="{
  685. tag: 'transition-group',
  686. name: !drag ? 'flip-list' : null
  687. }" -->
  688. <div class="question-list" v-else>
  689. <draggable
  690. v-model="chatQuestions"
  691. item-key="id"
  692. handle=".drag-handle"
  693. @start="handleDragStart"
  694. @end="handleDragEnd"
  695. animation="200"
  696. ghost-class="sortable-ghost"
  697. chosen-class="sortable-chosen"
  698. drag-class="sortable-drag"
  699. >
  700. <template #item="{ element }">
  701. <div class="question-card">
  702. <div class="drag-handle">
  703. <img src="../../../assets/dorp.png" alt="" class="dorp">
  704. </div>
  705. <div class="question-header">
  706. <div class="question-title">
  707. <div class="title-content">
  708. <div class="question-content">
  709. <span class="question-number">题目{{ chatQuestions.indexOf(element) + 1 }}</span>
  710. <span><span style="color: #0017ab;">{{ '「'+element.question_form_name +'」'}}</span>{{ element.title }}</span>
  711. </div>
  712. <div class="question-tags">
  713. <el-tag
  714. v-for="(tag, index) in (element.competency_tag_info || element.competency_tags || []).slice(0, 2)"
  715. :key="tag.id"
  716. effect="plain"
  717. class="competency-tag"
  718. size="small"
  719. >
  720. {{ tag.name }}
  721. </el-tag>
  722. <span
  723. v-if="(element.competency_tag_info ||element.competency_tags || []).length > 2"
  724. class="more-tags-indicator"
  725. >
  726. +{{ (element.competency_tag_info || element.competency_tags || []).length - 2 }}
  727. </span>
  728. </div>
  729. </div>
  730. </div>
  731. <div class="question-actions" style="margin-top: 0px;">
  732. <el-button type="text" @click="editQuestion(chatQuestions.indexOf(element))">
  733. <el-icon><Edit /></el-icon>
  734. </el-button>
  735. <el-button type="text" @click="deleteQuestion(chatQuestions.indexOf(element))">
  736. <el-icon><Delete /></el-icon>
  737. </el-button>
  738. </div>
  739. </div>
  740. <div class="question-info">
  741. <div class="info-item">
  742. <!-- <span class="info-label">考察能力:</span> -->
  743. <span>{{ element.scoring_reference }}</span>
  744. </div>
  745. <!-- <div class="info-item">
  746. <span class="info-label">面试内容:</span>
  747. <span>{{ element.content }}</span>
  748. </div>
  749. <div class="info-item">
  750. <span class="info-label">对话目标:</span>
  751. <span>{{ element.target }}</span>
  752. </div> -->
  753. </div>
  754. <div class="question-actions" v-if="element.question_form==0">
  755. <!-- <div class="weight-control">
  756. <span class="weight-label">权重占比:</span>
  757. <el-input-number
  758. v-model="element.weight"
  759. :min="0"
  760. :max="100"
  761. :step="1"
  762. size="small"
  763. controls-position="right"
  764. >
  765. <template #suffix>%</template>
  766. </el-input-number>
  767. </div> -->
  768. <div class="answer-limit">
  769. <el-switch
  770. style="margin-top:0px; "
  771. v-model="element.enable_follow_up"
  772. @change="handleFollowUpChange"
  773. />
  774. <span class="answer-label">回答不充分追问</span>
  775. </div>
  776. <div class="answer-limit">
  777. <span class="answer-label">追问轮数</span>
  778. <el-select v-model="element.maxAnswers" size="small" placeholder="请选择">
  779. <el-option label="1次" :value="1" />
  780. <!-- <el-option label="2次" :value="2" />
  781. <el-option label="3次" :value="3" /> -->
  782. </el-select>
  783. </div>
  784. </div>
  785. <div class="question-actions" v-if="element.question_form==1">
  786. <div class="answer-limit">
  787. <span class="answer-label">是否为红线题:</span>
  788. <el-select v-model="element.is_required_correct" @change="handleIsRequiredCorrectChange(element.id,element.is_required_correct)" size="small" placeholder="请选择">
  789. <el-option label="是" :value="true" />
  790. <el-option label="否" :value="false" />
  791. </el-select>
  792. </div>
  793. </div>
  794. </div>
  795. </template>
  796. </draggable>
  797. </div>
  798. </div>
  799. <div class="multi-dimension-questions">
  800. <div class="dimension-title">已选胜任力考核维度</div>
  801. <div class="dimension-list">
  802. <div v-for="(ability, index) in selectedAbilities" :key="ability.value" class="dimension-item">
  803. <div class="dimension-header">
  804. <div class="dimension-info">
  805. <span class="ability-name">{{ ability.label }}</span>
  806. <img src="../../../assets/sheng.png" alt=""class="sheng">
  807. </div>
  808. </div>
  809. <div class="dimension-content" @click="removeSelectedAbility(index)" title="点击删除此胜任力标签">
  810. <div class="ability-description">{{ "—" }}</div>
  811. <!-- <el-icon class="delete-icon"><Delete /></el-icon> -->
  812. </div>
  813. </div>
  814. </div>
  815. </div>
  816. </div>
  817. </div>
  818. </div>
  819. <!-- 步骤3:系统设置 -->
  820. <div v-if="currentStep === 3" class="ai-video-content">
  821. <div class="system-settings">
  822. <!-- 面试官形象设置 -->
  823. <div class="setting-section">
  824. <div class="section-header">请选择面试官形象</div>
  825. <div style=" display: flex;align-items: flex-start;">
  826. <div style="width: 100px;height: 170px;background-color: #f2f2f2; margin-right: 30px;border-radius: 10px;overflow: hidden;">
  827. <img v-if="interviewerAvatar"
  828. :src="interviewerAvatar"
  829. alt=""
  830. style="width: 100%;height: 100%;object-fit: cover;transform: translateZ(0);backface-visibility: hidden;">
  831. </div>
  832. <div>
  833. <div class="interviewer-avatars">
  834. <div
  835. v-for="avatar in interviewerAvatars"
  836. :key="avatar.id"
  837. class="avatar-item"
  838. :class="{ active: selectedInterviewer.id === avatar.id }"
  839. @click="handleInterviewerSelect(avatar)"
  840. >
  841. <div class="avatar-wrapper">
  842. <div class="avatar-circle" :class="{ selected: selectedInterviewer.id === avatar.id }">
  843. <img :src="avatar.avatar_url || avatar.image" :alt="avatar.name" />
  844. </div>
  845. <div class="avatar-name" :title="avatar.name">{{ avatar.name }}</div>
  846. </div>
  847. </div>
  848. </div>
  849. <div class="setting-item" style="border: none;">
  850. <div class="setting-label">「追问风格」</div>
  851. <div class="setting-options">
  852. <el-select v-model="settings.followUpStyle" placeholder="请选择" @change="handleSettingChange('followUpStyle', settings.followUpStyle)">
  853. <el-option label="温和" value="1" />
  854. <el-option label="严厉" value="2" />
  855. <el-option label="严谨" value="3" />
  856. </el-select>
  857. </div>
  858. <div class="setting-desc"></div>
  859. </div>
  860. </div>
  861. </div>
  862. <!-- 面试设置选项 -->
  863. <div class="interview-settings">
  864. <div class="setting-item">
  865. <div class="setting-label">
  866. <p>「回答视频保留」</p>
  867. </div>
  868. <div class="setting-desc">
  869. <p>选取后,将在报告中展示候选人的回答视频</p>
  870. </div>
  871. <el-switch
  872. v-model="settings.keepVideo"
  873. @change="(value: boolean) => handleSettingChange('keepVideo', value)"
  874. />
  875. </div>
  876. <div class="setting-item">
  877. <div class="setting-label">
  878. <p>「中断后作答限制」</p>
  879. </div>
  880. <div class="setting-options">
  881. <el-radio
  882. v-model="settings.interruptionMode"
  883. label="current"
  884. @change="handleSettingChange('interruptionMode', settings.interruptionMode)"
  885. >
  886. 从当前问题重新作答
  887. </el-radio>
  888. <el-radio
  889. v-model="settings.interruptionMode"
  890. label="previous"
  891. @change="handleSettingChange('interruptionMode', settings.interruptionMode)"
  892. >
  893. 从头作答
  894. </el-radio>
  895. </div>
  896. <div class="setting-desc" style="width: 40px;"></div>
  897. </div>
  898. <div class="setting-item">
  899. <div class="setting-label">
  900. <p>「智慧追问」</p>
  901. </div>
  902. <div class="setting-desc">
  903. <p>追问将结合候选人资料情况,综合分析发问</p>
  904. </div>
  905. <el-switch
  906. v-model="settings.smartFollowUp"
  907. @change="(value: boolean) => handleSettingChange('smartFollowUp', value)"
  908. />
  909. </div>
  910. </div>
  911. </div>
  912. </div>
  913. </div>
  914. <template #footer>
  915. <div class="drawer-footer">
  916. <el-button v-if="currentStep > 1" size="small" @click="prevStep">上一步</el-button>
  917. <el-button @click="cancelAIVideoConfig" size="small">取消</el-button>
  918. <el-button v-if="currentStep < 3" type="primary" size="small" @click="nextStep" style="background-color: #0419a3;border-color: #0419a3;">下一步</el-button>
  919. <el-button v-else type="success" @click="finishConfig" size="small" style="background-color: #0419a3;border-color: #0419a3;">新增</el-button>
  920. </div>
  921. </template>
  922. </el-drawer>
  923. <!-- 在 template 中添加视频宣讲弹窗 -->
  924. <el-dialog
  925. title="新增视频宣讲"
  926. v-model="showVideoLectureDialog"
  927. width="35%"
  928. :close-on-click-modal="false"
  929. class="video-lecture-dialog"
  930. >
  931. <div class="video-lecture-form">
  932. <!-- <div class="form-item">
  933. <div class="form-label">步骤名称</div>
  934. <el-input
  935. v-model="videoLectureForm.title"
  936. placeholder="请输入步骤名称"
  937. maxlength="30"
  938. show-word-limit
  939. />
  940. </div> -->
  941. <div class="form-item">
  942. <div class="form-label">上传视频</div>
  943. <el-upload
  944. class="video-uploader"
  945. action="#"
  946. :auto-upload="false"
  947. :show-file-list="false"
  948. accept="video/*"
  949. >
  950. <div class="upload-area">
  951. <el-icon><Plus /></el-icon>
  952. <div class="upload-text">上传文件大小不超过500M</div>
  953. </div>
  954. </el-upload>
  955. </div>
  956. <div class="form-item">
  957. <div class="form-label">视频简介</div>
  958. <el-input
  959. v-model="videoLectureForm.description"
  960. type="textarea"
  961. rows="4"
  962. placeholder="视频简介会显示在视频下方的标题下方"
  963. maxlength="200"
  964. show-word-limit
  965. />
  966. </div>
  967. <!-- <div class="form-item">
  968. <div class="form-label">播放设置</div>
  969. <el-radio-group v-model="videoLectureForm.broadcastType">
  970. <el-radio label="required">必须看完</el-radio>
  971. <el-radio label="optional">看过即可</el-radio>
  972. </el-radio-group>
  973. </div> -->
  974. </div>
  975. <template #footer>
  976. <span class="dialog-footer">
  977. <el-button @click="cancelVideoLecture">取消</el-button>
  978. <el-button type="primary" @click="confirmVideoLecture">确认</el-button>
  979. </span>
  980. </template>
  981. </el-dialog>
  982. <!-- AI实时对话抽屉 -->
  983. <el-drawer
  984. title="AI实时对话"
  985. v-model="showAIChatDialog"
  986. direction="rtl"
  987. size="60%"
  988. :close-on-click-modal="false"
  989. class="ai-chat-drawer"
  990. :destroy-on-close="false"
  991. >
  992. <div class="ai-chat-content">
  993. <!-- AI实时对话的配置内容 -->
  994. <div class="chat-settings">
  995. <div class="section-title">
  996. <div class="section-line"></div>
  997. <span>对话设置</span>
  998. </div>
  999. <!-- 添加按钮组 -->
  1000. <div class="chat-actions">
  1001. <el-button type="primary" plain @click="handleAddQuestion">
  1002. <el-icon><Plus /></el-icon>
  1003. 添加问题
  1004. </el-button>
  1005. <el-button type="success" plain @click="handleImportQuestion">
  1006. <el-icon><Document /></el-icon>
  1007. 导入问题
  1008. </el-button>
  1009. </div>
  1010. <!-- 添加问题列表容器 -->
  1011. <div class="chat-questions">
  1012. <div v-if="chatQuestions.length === 0" class="empty-questions">
  1013. <p>暂无问题</p>
  1014. <p class="tip-text">点击"添加问题"或"导入问题"添加面试问题</p>
  1015. </div>
  1016. <div v-else class="question-list">
  1017. <draggable v-model="chatQuestions" item-key="id" handle=".drag-handle">
  1018. <template #item="{ element, index }">
  1019. {{ element }}
  1020. <div class="question-card">
  1021. <div class="question-header">
  1022. <div class="question-title">
  1023. <span class="question-number">题目{{ index + 1 }}</span>
  1024. <span>{{ element.question }}</span>
  1025. </div>
  1026. <div class="question-actions">
  1027. <div class="weight-control">
  1028. <span class="weight-label">权重占比:</span>
  1029. <el-input-number
  1030. v-model="element.weight"
  1031. :min="0"
  1032. :max="100"
  1033. :step="1"
  1034. size="small"
  1035. controls-position="right"
  1036. >
  1037. <template #suffix>%</template>
  1038. </el-input-number>
  1039. </div>
  1040. <div class="answer-limit">
  1041. <span class="answer-label">最多回答次数</span>
  1042. <el-select v-model="element.maxAnswers" size="small" placeholder="请选择">
  1043. <el-option label="1次" :value="1" />
  1044. <el-option label="2次" :value="2" />
  1045. <el-option label="3次" :value="3" />
  1046. </el-select>
  1047. </div>
  1048. <el-button type="text" @click="editQuestion(index)">
  1049. <el-icon><Edit /></el-icon>
  1050. </el-button>
  1051. <el-button type="text" @click="deleteQuestion(index)">
  1052. <el-icon><Delete /></el-icon>
  1053. </el-button>
  1054. </div>
  1055. </div>
  1056. <div class="question-info">
  1057. <div class="info-item">
  1058. <span class="info-label">考察能力:</span>
  1059. <span>{{ element.ability }}</span>
  1060. </div>
  1061. <div class="info-item">
  1062. <span class="info-label">面试内容:</span>
  1063. <span>{{ element.content }}</span>
  1064. </div>
  1065. <div class="info-item">
  1066. <span class="info-label">对话目标:</span>
  1067. <span>{{ element.target }}</span>
  1068. </div>
  1069. </div>
  1070. </div>
  1071. </template>
  1072. </draggable>
  1073. </div>
  1074. </div>
  1075. </div>
  1076. </div>
  1077. <template #footer>
  1078. <div class="drawer-footer">
  1079. <el-button @click="cancelAIChatConfig">取消</el-button>
  1080. <el-button type="primary" @click="handleAIChatConfig">确认</el-button>
  1081. </div>
  1082. </template>
  1083. </el-drawer>
  1084. <!-- 在 template 中添加问题编辑弹框 -->
  1085. <el-dialog
  1086. title="编辑问题"
  1087. v-model="showQuestionDialog"
  1088. width="500px"
  1089. :close-on-click-modal="false"
  1090. class="question-dialog"
  1091. >
  1092. <div class="question-form">
  1093. <div class="form-item">
  1094. <div class="form-label">
  1095. 题目内容<span class="required">*</span>
  1096. </div>
  1097. <el-input
  1098. v-model="questionForm.content"
  1099. type="textarea"
  1100. rows="4"
  1101. placeholder="请描述一次你如何在紧迫的时间内完成一个复杂的后端开发任务的经历"
  1102. maxlength="300"
  1103. show-word-limit
  1104. />
  1105. </div>
  1106. <div class="form-item">
  1107. <div class="form-label">胜任力标签</div>
  1108. <el-select
  1109. v-model="competencyTagsValue"
  1110. placeholder="请选择胜任力标签"
  1111. class="full-width"
  1112. multiple
  1113. >
  1114. <el-option
  1115. v-for="tag in competencyTagOptions"
  1116. :key="tag.id"
  1117. :label="tag.name"
  1118. :value="tag.id"
  1119. />
  1120. </el-select>
  1121. <div class="form-tip">选择胜任力标签和胜任力标签,可多选</div>
  1122. </div>
  1123. <div class="form-item">
  1124. <div class="form-label">
  1125. 胜任力配置
  1126. </div>
  1127. <div class="competency-config">
  1128. <div class="config-row">
  1129. <span class="config-label">标签</span>
  1130. <span class="config-label">权重</span>
  1131. <!-- <el-button
  1132. type="text"
  1133. size="small"
  1134. @click="distributeWeightsEvenly"
  1135. style="color: #409eff; font-size: 12px;"
  1136. >
  1137. 平均分配
  1138. </el-button> -->
  1139. <!-- <span class="config-label">级别</span> -->
  1140. </div>
  1141. <div class="config-row" v-for="(tag, index) in questionForm.competency_tags" :key="tag.id">
  1142. <span class="tag-name">{{ tag.name }}</span>
  1143. <el-input-number
  1144. v-model="tag.weight"
  1145. :min="0"
  1146. :max="100"
  1147. :step="1"
  1148. controls-position="right"
  1149. @change="(value) => handleWeightChange(index, value)"
  1150. /> %
  1151. <!-- <el-input-number v-model="tag.importance" :min="1" :max="5" :step="1" controls-position="right" /> -->
  1152. </div>
  1153. </div>
  1154. <div class="form-tip">
  1155. 配置各个胜任力标签的权重,总和需要100%
  1156. <span class="weight-sum" :class="{ 'weight-error': getTotalWeight() !== 100 }">
  1157. (当前总计: {{ getTotalWeight() }}%)
  1158. </span>
  1159. <br/>
  1160. <el-icon style="color: #409eff; margin-right: 4px; margin-top: 4px;"><InfoFilled /></el-icon>
  1161. <span style="color: #909399; font-size: 11px;">
  1162. 修改任意权重时,其他权重会自动按比例调整以保持总和为100%。点击"平均分配"可快速平均分配所有权重。
  1163. </span>
  1164. </div>
  1165. </div>
  1166. <div class="form-item">
  1167. <div class="form-label">题目形式</div>
  1168. <el-select
  1169. v-model="questionForm.type"
  1170. placeholder="开放问题"
  1171. class="full-width"
  1172. @change="handleQuestionTypeChange"
  1173. >
  1174. <el-option label="开放问题" value="open" />
  1175. <el-option label="单选题" value="single" />
  1176. <el-option label="多选题" value="multiple" />
  1177. <el-option label="填空题" value="fill" />
  1178. <el-option label="自言语" value="self" />
  1179. </el-select>
  1180. <div class="form-tip">选择题目的形式:开放问题、单选题、多选题、填空题、自言语</div>
  1181. </div>
  1182. <div class="form-item">
  1183. <div class="form-label">适用职位</div>
  1184. <el-select
  1185. v-model="questionForm.position"
  1186. placeholder="请选择适用职位类型"
  1187. class="full-width"
  1188. multiple
  1189. >
  1190. <el-option
  1191. v-for="pos in positionOptions"
  1192. :key="pos.value"
  1193. :label="pos.label"
  1194. :value="pos.value"
  1195. />
  1196. </el-select>
  1197. <div class="form-tip">选择题目适用的职位类型,可多选</div>
  1198. </div>
  1199. <div class="form-item" v-if="questionForm.question_form === 1 || questionForm.question_form === 2">
  1200. <div class="form-label">选项</div>
  1201. <div>
  1202. <div class="option-header" style="display: flex; margin-bottom: 10px; font-weight: bold;">
  1203. <span style="flex: 1;">选项内容</span>
  1204. <span style="width: 80px; text-align: center;">是否正确</span>
  1205. </div>
  1206. <div
  1207. v-for="(option, index) in questionForm.options"
  1208. :key="index"
  1209. class="option-item"
  1210. style="display: flex; align-items: center; margin-bottom: 10px;"
  1211. >
  1212. <el-input
  1213. v-model="option.text"
  1214. placeholder="请输入选项内容"
  1215. style="flex: 1; margin-right: 10px;"
  1216. />
  1217. <el-tooltip
  1218. content="设置为正确答案"
  1219. placement="top"
  1220. effect="light"
  1221. >
  1222. <div
  1223. @click="() => {
  1224. if (questionForm.question_form === 1) {
  1225. // 单选题:只能有一个正确答案
  1226. questionForm.options.forEach((item, idx) => {
  1227. item.is_correct = (idx === index);
  1228. });
  1229. } else {
  1230. // 多选题:可以有多个正确答案
  1231. option.is_correct = !option.is_correct;
  1232. }
  1233. }"
  1234. style="cursor: pointer; width: 80px; text-align: center;"
  1235. >
  1236. <template v-if="questionForm.question_form === 1">
  1237. <!-- 单选题使用单选按钮 -->
  1238. <el-radio
  1239. v-model="option.is_correct"
  1240. :label="true"
  1241. />
  1242. </template>
  1243. <template v-else>
  1244. <!-- 多选题使用复选框 -->
  1245. <el-checkbox
  1246. v-model="option.is_correct"
  1247. />
  1248. </template>
  1249. </div>
  1250. </el-tooltip>
  1251. </div>
  1252. <div style="display: flex; justify-content: space-between; margin-top: 10px;">
  1253. <el-button
  1254. type="primary"
  1255. @click="() => {
  1256. // 确保options数组已初始化
  1257. if (!questionForm.options) {
  1258. questionForm.options = [];
  1259. }
  1260. // 添加新选项时自动设置排序值
  1261. const sort = questionForm.options.length > 0 ?
  1262. Math.max(...questionForm.options.map(o => o.sort || 0)) + 1 : 1;
  1263. questionForm.options.push({ option_text: '', is_correct: false, sort });
  1264. }"
  1265. >
  1266. 添加选项
  1267. </el-button>
  1268. <el-button
  1269. v-if="questionForm.options && questionForm.options.length > 2"
  1270. type="danger"
  1271. @click="() => {
  1272. questionForm.options.pop();
  1273. }"
  1274. >
  1275. 删除最后一项
  1276. </el-button>
  1277. </div>
  1278. </div>
  1279. <div class="form-tip">添加选项并设置正确答案,单选题只能有一个正确答案,多选题可以有多个正确答案</div>
  1280. </div>
  1281. <div class="form-item">
  1282. <div class="form-label">分类</div>
  1283. <el-select
  1284. v-model="questionForm.category"
  1285. placeholder="请选择题目分类"
  1286. class="full-width"
  1287. >
  1288. <el-option
  1289. v-for="cat in categoryOptions"
  1290. :key="cat.value"
  1291. :label="cat.label"
  1292. :value="cat.value"
  1293. />
  1294. </el-select>
  1295. <div class="form-tip">选择题目所属分类</div>
  1296. </div>
  1297. <div class="form-item">
  1298. <div class="form-label">标签</div>
  1299. <el-select
  1300. v-model="questionForm.tags"
  1301. placeholder="请选择标签"
  1302. class="full-width"
  1303. multiple
  1304. >
  1305. <el-option
  1306. v-for="tag in tagOptions"
  1307. :key="tag.value"
  1308. :label="tag.label"
  1309. :value="tag.value"
  1310. />
  1311. </el-select>
  1312. <div class="form-tip">选择题目相关标签,可多选</div>
  1313. </div>
  1314. <div class="form-item">
  1315. <div class="form-label">建议时长(秒)</div>
  1316. <el-input-number
  1317. v-model="questionForm.suggestedDuration"
  1318. :min="0"
  1319. :step="1"
  1320. controls-position="right"
  1321. placeholder="请输入建议回答时长"
  1322. class="full-width"
  1323. />
  1324. <div class="form-tip">建议回答题目的时长,单位为秒</div>
  1325. </div>
  1326. <div class="form-item">
  1327. <div class="form-label">评价标准</div>
  1328. <el-input v-model="questionForm.scoring_reference" type="textarea"
  1329. rows="4" placeholder="评分标准说明,例如:【团队协作能力】1.优秀:xxxxxx。2.xxxx。3.一般:xxxxx。" class="full-width" />
  1330. <div class="form-tip">评分标准说明,例如:【团队协作能力】1.优秀:xxxxxx。2.xxxx。3.一般:xxxxx。</div>
  1331. </div>
  1332. </div>
  1333. <template #footer>
  1334. <span class="dialog-footer">
  1335. <el-button @click="cancelAddQuestion">取消</el-button>
  1336. <el-button type="primary" @click="confirmAddQuestion">确认</el-button>
  1337. </span>
  1338. </template>
  1339. </el-dialog>
  1340. <!-- 添加心理题选择对话框 -->
  1341. <el-dialog
  1342. title="选择题目"
  1343. v-model="showQuestionSelectDialog"
  1344. width="30%"
  1345. :close-on-click-modal="false"
  1346. class="question-select-dialog"
  1347. >
  1348. <div class="question-select-content">
  1349. <!-- 搜索栏 -->
  1350. <!-- <div class="search-bar">
  1351. <div class="search-inputs">
  1352. <el-input
  1353. v-model="questionSearchKeyword"
  1354. placeholder="请输入关键词搜索题目"
  1355. clearable
  1356. @clear="handleQuestionSearch"
  1357. @keyup.enter="handleQuestionSearch"
  1358. style="width: 300px; margin-right: 10px;"
  1359. >
  1360. <template #append>
  1361. <el-button @click="handleQuestionSearch">
  1362. <el-icon><Search /></el-icon>
  1363. </el-button>
  1364. </template>
  1365. </el-input>
  1366. <el-select
  1367. v-model="questionListQuery.question_form"
  1368. placeholder="题目类型"
  1369. clearable
  1370. @change="handleQuestionSearch"
  1371. style="width: 120px;"
  1372. >
  1373. <el-option label="开放问题" :value="0" />
  1374. <el-option label="单选题" :value="1" />
  1375. </el-select>
  1376. </div>
  1377. </div> -->
  1378. <!-- 题目列表 -->
  1379. <!-- <div class="question-lists">
  1380. <el-table
  1381. :data="questionList"
  1382. style="width: 100%"
  1383. @selection-change="handleQuestionSelectionChange"
  1384. >
  1385. <el-table-column type="selection" width="55" />
  1386. <el-table-column prop="question" label="题目标题" />
  1387. <el-table-column prop="question_form_name" label="题目类型" width="100"/>
  1388. </el-table>
  1389. <div class="pagination-container">
  1390. <el-pagination
  1391. v-model:current-page="questionListQuery.page"
  1392. v-model:page-size="questionListQuery.pageSize"
  1393. :total="totalQuestions"
  1394. :page-sizes="[10, 20, 50, 100]"
  1395. layout="total, sizes, prev, pager, next"
  1396. @size-change="handleQuestionSizeChange"
  1397. @current-change="handleQuestionPageChange"
  1398. />
  1399. </div>
  1400. </div> -->
  1401. <el-tree
  1402. ref="treeRef"
  1403. :data="treeData"
  1404. node-key="id"
  1405. :props="defaultProps"
  1406. default-expand-all
  1407. highlight-current
  1408. @node-click="handleNodeClick"
  1409. >
  1410. <template #default="{ node, data }">
  1411. <div class="custom-tree-node">
  1412. <div class="node-label" style="display: flex;align-items: center;">
  1413. <el-icon><Folder /></el-icon>
  1414. <span class="ml-2">{{ data.title }}</span>
  1415. </div>
  1416. </div>
  1417. </template>
  1418. </el-tree>
  1419. </div>
  1420. <template #footer>
  1421. <span class="dialog-footer">
  1422. <el-button @click="cancelQuestionSelect">取消</el-button>
  1423. <el-button type="primary" @click="confirmQuestionSelect" style="background-color: #ed7d31;border-color: #ed7d31;">确定</el-button>
  1424. </span>
  1425. </template>
  1426. </el-dialog>
  1427. <!-- 自定义题目创建对话框 -->
  1428. <el-dialog
  1429. title="创建自定义题目"
  1430. v-model="showQuestionBankFormDialog"
  1431. width="40%"
  1432. :close-on-click-modal="false"
  1433. class="question-bank-form-dialog"
  1434. :before-close="handleQuestionBankFormCancel"
  1435. >
  1436. <QuestionBankForm
  1437. v-model="questionBankFormData"
  1438. :is-edit="isEditingQuestion"
  1439. @submit="handleQuestionBankFormSubmit"
  1440. @cancel="handleQuestionBankFormCancel"
  1441. />
  1442. </el-dialog>
  1443. <!-- 修改资料收集对话框模板 -->
  1444. <el-dialog
  1445. title="资料收集"
  1446. v-model="showDataCollectionDialog"
  1447. width="900px"
  1448. :close-on-click-modal="false"
  1449. class="data-collection-dialog"
  1450. >
  1451. <div class="data-collection-form">
  1452. <!-- 字段配置面板 -->
  1453. <div class="field-config-panel">
  1454. <div class="panel-header">
  1455. <h3>字段显示配置</h3>
  1456. <!-- <el-button type="primary" size="small" @click="saveFieldConfig">保存配置</el-button> -->
  1457. </div>
  1458. <div class="field-config-list">
  1459. <!-- 基本信息部分 -->
  1460. <div class="section-title">基本信息</div>
  1461. <el-row :gutter="20">
  1462. <el-col :span="8" v-for="(field, key) in getBasicFields()" :key="key">
  1463. <div class="field-config-item">
  1464. <span class="field-label">
  1465. {{ field.label }}
  1466. <!-- <el-tag v-if="field.required" size="small" type="danger" class="required-tag">必填</el-tag> -->
  1467. </span>
  1468. <el-tooltip
  1469. content="切换显示/隐藏"
  1470. placement="top"
  1471. >
  1472. <el-switch
  1473. v-model="field.visible"
  1474. class="custom-switch"
  1475. />
  1476. </el-tooltip>
  1477. </div>
  1478. </el-col>
  1479. </el-row>
  1480. <!-- 家庭成员信息部分 -->
  1481. <div class="section-title">家庭成员信息</div>
  1482. <el-row :gutter="20">
  1483. <el-col :span="24">
  1484. <div class="field-config-item">
  1485. <span class="field-label">
  1486. {{ fieldConfig.family_member.label }}
  1487. <el-tag v-if="fieldConfig.family_member.visible" size="small" type="success">已启用</el-tag>
  1488. </span>
  1489. <el-switch v-model="fieldConfig.family_member.visible" class="custom-switch" />
  1490. </div>
  1491. </el-col>
  1492. </el-row>
  1493. <el-row :gutter="20" v-if="fieldConfig.family_member.visible">
  1494. <el-col :span="8" v-for="(field, key) in fieldConfig.family_member.fields" :key="key">
  1495. <div class="field-config-item sub-field">
  1496. <span class="field-label">
  1497. {{ field.label }}
  1498. <!-- <el-tag v-if="field.required" size="small" type="danger" class="required-tag">必填</el-tag> -->
  1499. </span>
  1500. <el-tooltip
  1501. content="切换显示/隐藏"
  1502. placement="top"
  1503. >
  1504. <el-switch
  1505. v-model="field.visible"
  1506. class="custom-switch"
  1507. />
  1508. </el-tooltip>
  1509. </div>
  1510. </el-col>
  1511. </el-row>
  1512. <!-- 教育经历部分 -->
  1513. <div class="section-title">教育经历</div>
  1514. <el-row :gutter="20">
  1515. <el-col :span="24">
  1516. <div class="field-config-item">
  1517. <span class="field-label">
  1518. {{ fieldConfig.education.label }}
  1519. <el-tag v-if="fieldConfig.education.visible" size="small" type="success">已启用</el-tag>
  1520. </span>
  1521. <el-switch v-model="fieldConfig.education.visible" class="custom-switch" />
  1522. </div>
  1523. </el-col>
  1524. </el-row>
  1525. <el-row :gutter="20" v-if="fieldConfig.education.visible">
  1526. <el-col :span="8" v-for="(field, key) in fieldConfig.education.fields" :key="key">
  1527. <div class="field-config-item sub-field">
  1528. <span class="field-label">
  1529. {{ field.label }}
  1530. <!-- <el-tag v-if="field.required" size="small" type="danger" class="required-tag">必填</el-tag> -->
  1531. </span>
  1532. <el-tooltip
  1533. content="切换显示/隐藏"
  1534. placement="top"
  1535. >
  1536. <el-switch
  1537. v-model="field.visible"
  1538. class="custom-switch"
  1539. />
  1540. </el-tooltip>
  1541. </div>
  1542. </el-col>
  1543. </el-row>
  1544. <!-- 专业技能部分 -->
  1545. <div class="section-title">专业技能</div>
  1546. <el-row :gutter="20">
  1547. <el-col :span="8" v-for="(field, key) in getSkillFields()" :key="key">
  1548. <div class="field-config-item">
  1549. <span class="field-label">
  1550. {{ field.label }}
  1551. <!-- <el-tag v-if="field.required" size="small" type="danger" class="required-tag">必填</el-tag> -->
  1552. </span>
  1553. <el-tooltip
  1554. content="切换显示/隐藏"
  1555. placement="top"
  1556. >
  1557. <el-switch
  1558. v-model="field.visible"
  1559. class="custom-switch"
  1560. />
  1561. </el-tooltip>
  1562. </div>
  1563. </el-col>
  1564. </el-row>
  1565. <!-- 工作经历部分 -->
  1566. <div class="section-title">工作经历</div>
  1567. <el-row :gutter="20">
  1568. <el-col :span="24">
  1569. <div class="field-config-item">
  1570. <span class="field-label">
  1571. {{ fieldConfig.work_experience.label }}
  1572. <el-tag v-if="fieldConfig.work_experience.visible" size="small" type="success">已启用</el-tag>
  1573. </span>
  1574. <el-switch v-model="fieldConfig.work_experience.visible" class="custom-switch" />
  1575. </div>
  1576. </el-col>
  1577. </el-row>
  1578. <el-row :gutter="20" v-if="fieldConfig.work_experience.visible">
  1579. <el-col :span="8" v-for="(field, key) in fieldConfig.work_experience.fields" :key="key">
  1580. <div class="field-config-item sub-field">
  1581. <span class="field-label">
  1582. {{ field.label }}
  1583. <!-- <el-tag v-if="field.required" size="small" type="danger" class="required-tag">必填</el-tag> -->
  1584. </span>
  1585. <el-tooltip
  1586. content="切换显示/隐藏"
  1587. placement="top"
  1588. >
  1589. <el-switch
  1590. v-model="field.visible"
  1591. class="custom-switch"
  1592. />
  1593. </el-tooltip>
  1594. </div>
  1595. </el-col>
  1596. </el-row>
  1597. </div>
  1598. </div>
  1599. </div>
  1600. <template #footer>
  1601. <span class="dialog-footer">
  1602. <el-button @click="cancelDataCollection">取消</el-button>
  1603. <el-button type="primary" @click="saveFieldConfig">确认</el-button><!-- confirmDataCollection -->
  1604. </span>
  1605. </template>
  1606. </el-dialog>
  1607. <!-- 添加简历收集对话框 -->
  1608. <el-dialog
  1609. title="简历收集"
  1610. v-model="showResumeCollectionDialog"
  1611. width="500px"
  1612. :close-on-click-modal="false"
  1613. class="resume-collection-dialog"
  1614. >
  1615. <div class="resume-collection-form">
  1616. <div class="form-item">
  1617. <div class="form-label">步骤名称</div>
  1618. <el-input
  1619. v-model="resumeCollectionForm.title"
  1620. placeholder="请输入步骤名称"
  1621. maxlength="30"
  1622. show-word-limit
  1623. />
  1624. </div>
  1625. <!-- <div class="form-item">
  1626. <div class="form-label">必填项</div>
  1627. <el-switch v-model="resumeCollectionForm.isRequired" />
  1628. <span class="switch-label">{{ resumeCollectionForm.isRequired ? '开启' : '关闭' }}</span>
  1629. </div>
  1630. <div class="resume-preview">
  1631. <div class="preview-title">简历收集预览</div>
  1632. <div class="preview-content">
  1633. <div class="preview-item">
  1634. <div class="item-label">姓名</div>
  1635. <div class="item-input"></div>
  1636. <div class="item-required" v-if="resumeCollectionForm.isRequired">*</div>
  1637. </div>
  1638. <div class="preview-item">
  1639. <div class="item-label">手机号</div>
  1640. <div class="item-input"></div>
  1641. <div class="item-required" v-if="resumeCollectionForm.isRequired">*</div>
  1642. </div>
  1643. <div class="preview-item">
  1644. <div class="item-label">邮箱</div>
  1645. <div class="item-input"></div>
  1646. <div class="item-required" v-if="resumeCollectionForm.isRequired">*</div>
  1647. </div>
  1648. <div class="preview-item">
  1649. <div class="item-label">上传简历</div>
  1650. <div class="item-upload">
  1651. <el-icon><Plus /></el-icon>
  1652. </div>
  1653. <div class="item-required" v-if="resumeCollectionForm.isRequired">*</div>
  1654. </div>
  1655. </div>
  1656. </div> -->
  1657. </div>
  1658. <template #footer>
  1659. <span class="dialog-footer">
  1660. <el-button @click="cancelResumeCollection">取消</el-button>
  1661. <el-button type="primary" @click="confirmResumeCollection">确认</el-button>
  1662. </span>
  1663. </template>
  1664. </el-dialog>
  1665. <!-- 添加代码测试对话框 -->
  1666. <el-dialog
  1667. title="添加代码笔试步骤"
  1668. v-model="showCodeTestDialog"
  1669. width="500px"
  1670. :close-on-click-modal="false"
  1671. class="code-test-dialog"
  1672. >
  1673. <div class="code-test-form">
  1674. <div class="form-item">
  1675. <div class="form-label">步骤名称</div>
  1676. <el-input
  1677. v-model="codeTestForm.title"
  1678. placeholder="请输入步骤名称"
  1679. maxlength="30"
  1680. show-word-limit
  1681. />
  1682. </div>
  1683. <div class="form-item">
  1684. <div class="form-label">自动评判试卷</div>
  1685. <el-switch v-model="codeTestForm.autoJudge" />
  1686. <span class="switch-label">{{ codeTestForm.autoJudge ? '开启' : '关闭' }}</span>
  1687. </div>
  1688. <div class="form-item">
  1689. <div class="form-label">添加考试试卷</div>
  1690. <div class="test-paper-selector">
  1691. <div class="empty-paper" v-if="!codeTestForm.selectedPaper">
  1692. <el-button type="primary" plain @click="handleSelectPaper">
  1693. <el-icon><Plus /></el-icon>
  1694. 添加考卷
  1695. </el-button>
  1696. <p class="tip-text">多选时,考生会随机分配到一套试卷</p>
  1697. </div>
  1698. <div class="selected-paper" v-else>
  1699. <div class="paper-info">
  1700. <div class="paper-title">{{ codeTestForm.selectedPaper.title }}</div>
  1701. <div class="paper-meta">
  1702. <span>{{ codeTestForm.selectedPaper.questionCount }}道题</span>
  1703. <span>{{ codeTestForm.selectedPaper.duration }}分钟</span>
  1704. <span>{{ codeTestForm.selectedPaper.difficulty }}</span>
  1705. </div>
  1706. </div>
  1707. <div class="paper-actions">
  1708. <el-button type="text" @click="handleViewPaper">查看</el-button>
  1709. <el-button type="text" @click="handleChangePaper">更换</el-button>
  1710. <el-button type="text" @click="handleRemovePaper">删除</el-button>
  1711. </div>
  1712. </div>
  1713. </div>
  1714. </div>
  1715. </div>
  1716. <template #footer>
  1717. <span class="dialog-footer">
  1718. <el-button @click="cancelCodeTest">取消</el-button>
  1719. <el-button type="primary" @click="confirmCodeTest">确认</el-button>
  1720. </span>
  1721. </template>
  1722. </el-dialog>
  1723. <!-- 添加打字测试对话框 -->
  1724. <el-drawer
  1725. title="添加打字测试步骤"
  1726. v-model="showTypingTestDialog"
  1727. size="60%"
  1728. :close-on-click-modal="false"
  1729. class="typing-test-dialog"
  1730. :destroy-on-close="false"
  1731. >
  1732. <div class="typing-test-form">
  1733. <div class="form-item">
  1734. <div class="form-label">选择文章</div>
  1735. <div class="article-selection">
  1736. <el-button type="primary" size="small" class="add-article-btn">
  1737. <el-icon><Plus /></el-icon>
  1738. 添加文章
  1739. </el-button>
  1740. </div>
  1741. </div>
  1742. <div class="form-item">
  1743. <div class="form-label">候选人选择文章方式</div>
  1744. <el-radio-group v-model="typingTestForm.selectionMode">
  1745. <el-radio label="random">随机抽取</el-radio>
  1746. <el-radio label="self">候选人自主选择</el-radio>
  1747. </el-radio-group>
  1748. </div>
  1749. <div class="form-item">
  1750. <div class="form-label">测试时间</div>
  1751. <div class="time-input-container">
  1752. <el-input v-model="typingTestForm.duration" class="time-input" />
  1753. <span class="time-unit">分钟</span>
  1754. </div>
  1755. </div>
  1756. <div class="form-item">
  1757. <div class="form-label">登录界面预览图(建议尺寸1024*768像素,最大不要超过5M)</div>
  1758. <el-upload
  1759. class="preview-uploader"
  1760. action="#"
  1761. :auto-upload="false"
  1762. :show-file-list="false"
  1763. accept="image/*"
  1764. >
  1765. <div class="upload-area">
  1766. <el-icon><Plus /></el-icon>
  1767. <div class="upload-text">添加图片</div>
  1768. </div>
  1769. </el-upload>
  1770. </div>
  1771. <div class="form-item">
  1772. <div class="form-label">注意事项内容(在登录界面显示)</div>
  1773. <el-input
  1774. v-model="typingTestForm.notes"
  1775. type="textarea"
  1776. rows="4"
  1777. placeholder="请输入注意事项内容"
  1778. maxlength="300"
  1779. show-word-limit
  1780. />
  1781. </div>
  1782. <div class="form-item">
  1783. <div class="form-label">测试页面标题</div>
  1784. <el-input
  1785. v-model="typingTestForm.pageTitle"
  1786. placeholder="测试页面标题"
  1787. />
  1788. </div>
  1789. <div class="form-item">
  1790. <div class="form-label">视频监控</div>
  1791. <el-checkbox v-model="typingTestForm.videoMonitoring">视频监控</el-checkbox>
  1792. </div>
  1793. <div class="form-item">
  1794. <div class="form-label">通过标准</div>
  1795. <div class="criteria-options">
  1796. <el-checkbox v-model="typingTestForm.passCriteria.speed">速度</el-checkbox>
  1797. <el-checkbox v-model="typingTestForm.passCriteria.accuracy">正确率</el-checkbox>
  1798. </div>
  1799. </div>
  1800. </div>
  1801. <template #footer>
  1802. <span class="dialog-footer">
  1803. <el-button @click="cancelTypingTest">取消</el-button>
  1804. <el-button type="primary" @click="confirmTypingTest">保存</el-button>
  1805. </span>
  1806. </template>
  1807. </el-drawer>
  1808. <!-- 面试设置弹窗 -->
  1809. <el-dialog
  1810. title="面试设置"
  1811. v-model="showInterviewSettingsDialog"
  1812. width="60%"
  1813. :close-on-click-modal="false"
  1814. class="interview-settings-dialog"
  1815. >
  1816. <div class="interview-settings-content">
  1817. <!-- 防作弊设置 -->
  1818. <div class="settings-section">
  1819. <div class="section-header">
  1820. <span class="section-title">防作弊设置</span>
  1821. </div>
  1822. <div class="setting-item">
  1823. <div class="setting-info">
  1824. <span class="setting-name">「人脸一致性检测」</span>
  1825. <p class="setting-desc">该强调,非本人操作人脸可视化提醒和警示,默认开启</p>
  1826. </div>
  1827. <el-switch v-model="interviewSettings.faceConsistency" :disabled="true"/>
  1828. </div>
  1829. <div class="setting-item">
  1830. <div class="setting-info">
  1831. <span class="setting-name">「 防截屏 / 录屏 」</span>
  1832. <p class="setting-desc">该强调,非本人前来体验截屏录屏以上行为,为防止提醒</p>
  1833. </div>
  1834. <el-switch v-model="interviewSettings.preventScreenshot" :disabled="true"/>
  1835. </div>
  1836. <div class="setting-item">
  1837. <div class="setting-info">
  1838. <span class="setting-name">「 切 屏 预 制 」</span>
  1839. <p class="setting-desc">该强调,非本人前使用切屏处理用页面,为防作弊警示</p>
  1840. </div>
  1841. <el-switch v-model="interviewSettings.screenSwitchAlert" :disabled="true">
  1842. <span class="switch-desc">切屏超过 2 次关闭,作答本关面试</span>
  1843. </el-switch>
  1844. </div>
  1845. <div class="setting-item">
  1846. <div class="setting-info">
  1847. <span class="setting-name">「 情 绪 识 别」</span>
  1848. <p class="setting-desc">该现已,条件较差以及入侵过程中的作弊,条件等好等</p>
  1849. </div>
  1850. <el-switch v-model="interviewSettings.positionDetection" />
  1851. </div>
  1852. <div class="setting-item">
  1853. <div class="setting-info">
  1854. <span class="setting-name">「 眼 动 检 测 」</span>
  1855. <p class="setting-desc">视实检测候选人的眼动频率进行分析,页面等较等</p>
  1856. </div>
  1857. <el-switch v-model="interviewSettings.eyeMovementDetection" />
  1858. </div>
  1859. </div>
  1860. <!-- 其他设置 -->
  1861. <div class="settings-section">
  1862. <div class="section-header">
  1863. <span class="section-title">其他设置</span>
  1864. </div>
  1865. <div class="setting-item">
  1866. <div class="setting-info">
  1867. <span class="setting-name">重复面试</span>
  1868. <div class="setting-desc-container">
  1869. <p class="setting-desc" style="">选取后,将允许面试者进行重复面试</p>
  1870. <el-switch v-model="interviewSettings.reviewInterview" />
  1871. </div>
  1872. </div>
  1873. </div>
  1874. <div class="setting-item">
  1875. <div class="setting-info">
  1876. <span class="setting-name">开场词</span>
  1877. <div v-if="!isEditingBeforeStart" class="setting-desc-container">
  1878. <p class="setting-desc">{{ interviewSettings.beforeStartText }}</p>
  1879. <el-button type="text" class="edit-desc-btn" @click="startEditBeforeStart">
  1880. <el-icon><Edit /></el-icon>
  1881. </el-button>
  1882. </div>
  1883. <div v-else class="desc-edit-container">
  1884. <el-input
  1885. v-model="editingBeforeStartText"
  1886. type="textarea"
  1887. rows="2"
  1888. placeholder="请输入开始前提示内容"
  1889. show-word-limit
  1890. /><!-- maxlength="100" -->
  1891. <div class="desc-edit-actions">
  1892. <el-button size="small" @click="cancelEditBeforeStart">取消</el-button>
  1893. <el-button size="small" type="primary" @click="saveBeforeStart">保存</el-button>
  1894. </div>
  1895. </div>
  1896. </div>
  1897. <!-- <el-switch v-model="interviewSettings.beforeStart" /> -->
  1898. </div>
  1899. <div class="setting-item">
  1900. <div class="setting-info">
  1901. <span class="setting-name">开始后提醒</span>
  1902. <div v-if="!isEditingAfterStart" class="setting-desc-container">
  1903. <p class="setting-desc">{{ interviewSettings.afterStartText }}</p>
  1904. <el-button type="text" class="edit-desc-btn" @click="startEditAfterStart">
  1905. <el-icon><Edit /></el-icon>
  1906. </el-button>
  1907. </div>
  1908. <div v-else class="desc-edit-container">
  1909. <el-input
  1910. v-model="editingAfterStartText"
  1911. type="textarea"
  1912. rows="2"
  1913. placeholder="请输入开始后提醒内容"
  1914. maxlength="100"
  1915. show-word-limit
  1916. />
  1917. <div class="desc-edit-actions">
  1918. <el-button size="small" @click="cancelEditAfterStart">取消</el-button>
  1919. <el-button size="small" type="primary" @click="saveAfterStart">保存</el-button>
  1920. </div>
  1921. </div>
  1922. </div>
  1923. <!-- <el-switch v-model="interviewSettings.afterStartReminder" /> -->
  1924. </div>
  1925. <div class="setting-item">
  1926. <div class="setting-info">
  1927. <span class="setting-name">结束语</span>
  1928. <div v-if="!isEditingDisclaimer" class="setting-desc-container">
  1929. <p class="setting-desc">{{ interviewSettings.disclaimerText }}</p>
  1930. <el-button type="text" class="edit-desc-btn" @click="startEditDisclaimer">
  1931. <el-icon><Edit /></el-icon>
  1932. </el-button>
  1933. </div>
  1934. <div v-else class="desc-edit-container">
  1935. <el-input
  1936. v-model="editingDisclaimerText"
  1937. type="textarea"
  1938. rows="2"
  1939. placeholder="请输入免责声明内容"
  1940. maxlength="200"
  1941. show-word-limit
  1942. />
  1943. <div class="desc-edit-actions">
  1944. <el-button size="small" @click="cancelEditDisclaimer">取消</el-button>
  1945. <el-button size="small" type="primary" @click="saveDisclaimer">保存</el-button>
  1946. </div>
  1947. </div>
  1948. </div>
  1949. <!-- <el-switch v-model="interviewSettings.disclaimer" /> -->
  1950. </div>
  1951. </div>
  1952. </div>
  1953. <template #footer>
  1954. <span class="dialog-footer">
  1955. <el-button @click="cancelInterviewSettings">取消</el-button>
  1956. <el-button type="primary" @click="confirmInterviewSettings">完成</el-button>
  1957. </span>
  1958. </template>
  1959. </el-dialog>
  1960. <!-- 绑定综合素质问题 -->
  1961. <el-dialog
  1962. title="选择题目"
  1963. v-model="QuestionSelectDialog"
  1964. width="70%"
  1965. :close-on-click-modal="false"
  1966. class="question-select-dialog"
  1967. >
  1968. <div class="question-select-content">
  1969. <el-row class="document-el-row">
  1970. <el-col :span="3">
  1971. <div class="document-box document-left-box">
  1972. <TreeList ref="treeListRef" :treeData="documentTreeData"
  1973. @treeClick="handleTreeClick"
  1974. @updateDocument="handleUpdateDocument"
  1975. @deleteDocument="handleDeleteDocument" />
  1976. </div>
  1977. </el-col>
  1978. <el-col :span="21">
  1979. <!-- 搜索栏 -->
  1980. <div class="search-bar">
  1981. <div class="search-inputs">
  1982. <el-input
  1983. v-model="questionSearchKeyword"
  1984. placeholder="请输入关键词搜索题目"
  1985. clearable
  1986. @clear="handleQuestionSearch"
  1987. @keyup.enter="handleQuestionSearch"
  1988. style="width: 300px; margin-right: 10px;"
  1989. >
  1990. <template #append>
  1991. <el-button @click="handleQuestionSearch">
  1992. <el-icon><Search /></el-icon>
  1993. </el-button>
  1994. </template>
  1995. </el-input>
  1996. <el-select
  1997. v-model="questionListQuery.question_form"
  1998. placeholder="题目类型"
  1999. clearable
  2000. @change="handleQuestionSearch"
  2001. style="width: 120px;"
  2002. >
  2003. <el-option label="开放问题" :value="0" />
  2004. <el-option label="单选题" :value="1" />
  2005. <el-option label="多选题" :value="2" />
  2006. <el-option label="看图选答案" :value="3" />
  2007. <el-option label="得分题" :value="4" />
  2008. <el-option label="追加型开放问题" :value="5" />
  2009. <el-option label="填空题" :value="6" />
  2010. </el-select>
  2011. </div>
  2012. </div>
  2013. <!-- 题目列表 -->
  2014. <div class="question-lists">
  2015. <el-table
  2016. :data="questionList"
  2017. style="width: 100%"
  2018. @selection-change="handleQuestionSelectionChange"
  2019. >
  2020. <el-table-column type="selection" width="55" />
  2021. <el-table-column prop="question" label="题目标题" />
  2022. <el-table-column prop="question_form_name" label="题目类型" width="100"/>
  2023. <!-- <el-table-column prop="content" label="面试内容" show-overflow-tooltip />
  2024. <el-table-column prop="target" label="对话目标" show-overflow-tooltip /> -->
  2025. </el-table>
  2026. <!-- 分页 -->
  2027. <div class="pagination-container">
  2028. <el-pagination
  2029. v-model:current-page="questionListQuery.page"
  2030. v-model:page-size="questionListQuery.pageSize"
  2031. :total="totalQuestions2"
  2032. :page-sizes="[10, 20, 50, 100]"
  2033. layout="total, sizes, prev, pager, next"
  2034. @size-change="handleQSizeChange"
  2035. @current-change="handleQPageChange"
  2036. />
  2037. </div>
  2038. </div>
  2039. </el-col>
  2040. </el-row>
  2041. </div>
  2042. <template #footer>
  2043. <span class="dialog-footer">
  2044. <el-button @click="cancelQuestionSelect">取消</el-button>
  2045. <el-button type="primary" @click="confirmSelect" style="background-color: #ed7d31;border-color: #ed7d31;">确定</el-button>
  2046. </span>
  2047. </template>
  2048. </el-dialog>
  2049. <!-- 候选人提问环节配置弹窗 -->
  2050. <el-dialog
  2051. :title="editingCandidateQuestionsIndex >= 0 ? '编辑候选人提问环节' : '配置候选人提问环节'"
  2052. v-model="showCandidateQuestionsDialog"
  2053. width="600px"
  2054. :close-on-click-modal="false"
  2055. class="candidate-questions-dialog"
  2056. >
  2057. <div class="candidate-questions-form">
  2058. <div class="form-item">
  2059. <div class="form-label">
  2060. 环节名称<span class="required">*</span>
  2061. </div>
  2062. <el-input
  2063. v-model="candidateQuestionsForm.title"
  2064. placeholder="请输入环节名称"
  2065. maxlength="30"
  2066. show-word-limit
  2067. />
  2068. </div>
  2069. <div class="form-item">
  2070. <div class="form-label">
  2071. 提问时长<span class="required">*</span>
  2072. </div>
  2073. <el-input-number
  2074. v-model="candidateQuestionsForm.duration"
  2075. :min="1"
  2076. :max="30"
  2077. :step="1"
  2078. controls-position="right"
  2079. style="width: 200px"
  2080. />
  2081. <span class="form-unit">分钟</span>
  2082. <div class="form-tip">候选人可用于提问的总时长</div>
  2083. </div>
  2084. <!-- <div class="form-item">
  2085. <div class="form-label">
  2086. 最多提问数量<span class="required">*</span>
  2087. </div>
  2088. <el-input-number
  2089. v-model="candidateQuestionsForm.maxQuestions"
  2090. :min="1"
  2091. :max="10"
  2092. :step="1"
  2093. controls-position="right"
  2094. style="width: 200px"
  2095. />
  2096. <span class="form-unit">个</span>
  2097. <div class="form-tip">候选人最多可以提出的问题数量</div>
  2098. </div> -->
  2099. <div class="form-item">
  2100. <div class="form-label">环节描述</div>
  2101. <el-input
  2102. v-model="candidateQuestionsForm.description"
  2103. type="textarea"
  2104. rows="3"
  2105. placeholder="请输入环节描述"
  2106. maxlength="200"
  2107. show-word-limit
  2108. />
  2109. <div class="form-tip">向候选人说明此环节的目的和意义</div>
  2110. </div>
  2111. <!-- <div class="form-item">
  2112. <div class="form-label">环节设置</div>
  2113. <div class="form-checkboxes">
  2114. <el-checkbox v-model="candidateQuestionsForm.isRequired">
  2115. 必须环节(候选人必须完成此环节)
  2116. </el-checkbox>
  2117. <el-checkbox v-model="candidateQuestionsForm.allowSkip">
  2118. 允许跳过(候选人可选择跳过此环节)
  2119. </el-checkbox>
  2120. </div>
  2121. </div>
  2122. <div class="form-item">
  2123. <div class="form-label">提问指引</div>
  2124. <div class="guidelines-list">
  2125. <div
  2126. v-for="(guideline, index) in candidateQuestionsForm.guidelines"
  2127. :key="index"
  2128. class="guideline-item"
  2129. >
  2130. <el-input
  2131. v-model="candidateQuestionsForm.guidelines[index]"
  2132. placeholder="请输入提问指引"
  2133. maxlength="100"
  2134. >
  2135. <template #append>
  2136. <el-button
  2137. type="danger"
  2138. @click="removeGuideline(index)"
  2139. v-if="candidateQuestionsForm.guidelines.length > 1"
  2140. >
  2141. 删除
  2142. </el-button>
  2143. </template>
  2144. </el-input>
  2145. </div>
  2146. <el-button
  2147. type="primary"
  2148. plain
  2149. @click="addGuideline"
  2150. v-if="candidateQuestionsForm.guidelines.length < 5"
  2151. >
  2152. <el-icon><Plus /></el-icon>
  2153. 添加指引
  2154. </el-button>
  2155. </div>
  2156. <div class="form-tip">为候选人提供提问的指导建议,最多5条</div>
  2157. </div> -->
  2158. </div>
  2159. <template #footer>
  2160. <span class="dialog-footer">
  2161. <el-button @click="cancelCandidateQuestions">取消</el-button>
  2162. <el-button type="primary" @click="confirmCandidateQuestions">确认</el-button>
  2163. </span>
  2164. </template>
  2165. </el-dialog>
  2166. <!-- 肢体检测配置对话框 -->
  2167. <el-dialog
  2168. v-model="bodyDetectionConfigVisible"
  2169. title="肢体检测配置"
  2170. width="600px"
  2171. :close-on-click-modal="false"
  2172. >
  2173. <el-form :model="bodyDetectionConfig" label-width="120px">
  2174. <el-form-item label="检测时长">
  2175. <el-input-number
  2176. v-model="bodyDetectionConfig.duration"
  2177. :min="1"
  2178. :max="30"
  2179. :step="1"
  2180. controls-position="right"
  2181. /> 分钟
  2182. </el-form-item>
  2183. <el-form-item label="检测项目">
  2184. <el-checkbox-group v-model="bodyDetectionConfig.detectionItems">
  2185. <el-checkbox label="face">面部表情</el-checkbox>
  2186. <el-checkbox label="pose">肢体姿态</el-checkbox>
  2187. <el-checkbox label="gesture">手势动作</el-checkbox>
  2188. </el-checkbox-group>
  2189. </el-form-item>
  2190. <el-form-item label="提示文本">
  2191. <el-input
  2192. v-model="bodyDetectionConfig.promptText"
  2193. type="textarea"
  2194. :rows="3"
  2195. placeholder="请输入提示文本"
  2196. />
  2197. </el-form-item>
  2198. </el-form>
  2199. <template #footer>
  2200. <span class="dialog-footer">
  2201. <el-button @click="cancelBodyDetectionConfig" size="small">取消</el-button>
  2202. <el-button type="primary" @click="saveBodyDetectionConfig" size="small">确定</el-button>
  2203. </span>
  2204. </template>
  2205. </el-dialog>
  2206. </div>
  2207. </template>
  2208. <script setup lang="ts">
  2209. import { ref, reactive, onMounted, onUnmounted, computed, watch } from 'vue';
  2210. import { useRouter, useRoute } from 'vue-router';
  2211. import { ElMessage, ElMessageBox, ElDrawer } from 'element-plus';
  2212. import * as api from '../list/api';
  2213. import { Plus, Document, ArrowDown, Edit, Delete, InfoFilled, QuestionFilled, Search, Rank, Close } from '@element-plus/icons-vue';
  2214. import { GetList } from '../../questionBank/classList/api';
  2215. import { GetCompetencyList,GetQuestionList,GenerateQuestions,
  2216. GetDraftList,SaveDraft,GetDigitalList,
  2217. CreateConfig,GetConfig,UpdateConfig,AddDocument,
  2218. GetOpeningSpeech,GetVideo,BatchBind,BatchUnbind,UpdateObj,
  2219. GenerateCompetency,SaveCompetency,GetPositionTags,
  2220. UpdateQuestion,GetPositionQuestions,CreateCompetency,
  2221. BatchUpdateTags} from './api';
  2222. import draggable from 'vuedraggable';
  2223. import { updateFieldConfig } from './utils';
  2224. import type { ProfileFieldsConfig } from './types';
  2225. import { getPCAData } from '../../../utils/pcaData';
  2226. import QuestionBankForm from '../../questionBank/list/components/QuestionBankForm.vue';
  2227. import * as questionBankApi from '../../questionBank/list/api';
  2228. import TreeList from './treeList.vue';
  2229. import { GetDocumentTree, GetCategoryList, GetTagList,DeleteDocumentCategory } from '../../questionBank/positionList/api';
  2230. import { Session } from '/@/utils/storage';
  2231. // 添加 CompetencyTag 接口定义
  2232. interface CompetencyTag {
  2233. id: number;
  2234. name: string;
  2235. selected?: boolean;
  2236. weight?: number;
  2237. }
  2238. // 添加 InterviewerAvatar 接口定义
  2239. interface InterviewerAvatar {
  2240. id: number;
  2241. name: string;
  2242. image?: string;
  2243. avatar_url?: string;
  2244. }
  2245. // 添加选项接口定义
  2246. interface QuestionOption {
  2247. id?: number;
  2248. text: string;
  2249. is_correct: boolean;
  2250. sort?: number;
  2251. }
  2252. // 添加 ChatQuestion 接口定义
  2253. interface ChatQuestion {
  2254. id?: number;
  2255. title: string;
  2256. ability: string;
  2257. content: string;
  2258. target: string;
  2259. weight: number;
  2260. maxAnswers: number;
  2261. source: 'ai_generated' | 'custom_selected'; // 添加题目来源标识
  2262. question_form?: number;
  2263. question_form_name?: string;
  2264. scoring_reference?: string;
  2265. competency_tags?: CompetencyTag[];
  2266. enable_follow_up?: boolean;
  2267. options?: QuestionOption[];
  2268. }
  2269. // 添加 Paper 接口定义
  2270. interface Paper {
  2271. id: number;
  2272. title: string;
  2273. questionCount: number;
  2274. duration: number;
  2275. difficulty: string;
  2276. }
  2277. interface AIVideoStep {
  2278. name: string;
  2279. id: string | number;
  2280. aiConfig?: {
  2281. abilities: string[];
  2282. };
  2283. }
  2284. const router = useRouter();
  2285. const route = useRoute();
  2286. const positionId = ref(route.query.id as string);
  2287. const positionStatus = ref(false);
  2288. const drag = ref(false); // 添加拖拽状态变量
  2289. // 职位数据
  2290. const positionData = reactive({
  2291. title: '',
  2292. job_category: '',
  2293. job_type_display: '',
  2294. city: '',
  2295. location: [] as string[] | string, // 修改类型定义
  2296. location_str: '',
  2297. address_detail: '',
  2298. benefits: [],
  2299. requirements: '',
  2300. job_type: 0,
  2301. salary_range: '',
  2302. department: '',
  2303. end_date: '',
  2304. description: '',
  2305. work_experience_required: '',
  2306. education_required: '',
  2307. competency_tags: [],
  2308. options: [],
  2309. status: 0
  2310. });
  2311. // 招聘流程数据 - 修改为普通数组而非 ref 对象,添加type字段用于重复检查
  2312. const recruitmentProcess = reactive([
  2313. { id: 6, name: '简历收集', description: '简历收集', active: true, type: 'resume_collection',visible:true },
  2314. { id: 5, name: '资料收集', description: '资料收集', active: true, type: 'data_collection',visible:true },
  2315. { id: 2, name: 'AI考察', description: 'AI考察', active: true, type: 'ai_video',visible:true },
  2316. { id: 8, name: '综合素质考察', description: '综合素质考察', active: true, type: 'common_sense',visible:true },
  2317. { id: 9, name: '心理问题', description: '心理问题', active: true, type: 'psychological_problem',visible:true },
  2318. { id: 7, name: '候选人提问', description: '时长5分钟,最多3个问题', active: true, type: 'candidate_questions', visible:true,
  2319. config: {
  2320. title: '候选人提问',
  2321. duration: 5,
  2322. maxQuestions: 3,
  2323. description: '候选人可以向面试官提问关于公司、职位或团队的问题',
  2324. isRequired: true,
  2325. allowSkip: false,
  2326. guidelines: [
  2327. '请提出与职位、公司文化或团队相关的问题',
  2328. '避免询问已在职位描述中明确说明的信息',
  2329. '可以询问职业发展机会和团队工作方式'
  2330. ]
  2331. }
  2332. },
  2333. /* { id: 1, name: '待核验', description: '待核验', active: true, type: 'pending_verification' }, */
  2334. { id: 3, name: '已通过', description: '已通过', active: true, type: 'passed',visible:true },
  2335. { id: 4, name: '已淘汰', description: '已淘汰', active: false, type: 'rejected',visible:true },
  2336. ]);
  2337. // 是否显示流程编辑对话框
  2338. const showProcessDialog = ref(false);
  2339. // 定义可选的流程步骤类型
  2340. const processStepOptions = [
  2341. { label: 'AI考察', value: 'ai_video' },
  2342. { label: '视频宣讲', value: 'video_presentation' },
  2343. { label: '肢体检测', value: 'body_detection' }, // 新增肢体检测选项
  2344. /* { label: 'AI实时对话', value: 'ai_chat' },*/
  2345. { label: '资料收集', value: 'data_collection' },
  2346. { label: '简历收集', value: 'resume_collection' },
  2347. { label: '候选人提问', value: 'candidate_questions' },
  2348. { label: '心理问题', value: 'psychological_problem' },
  2349. { label: '综合素质考察', value: 'common_sense' },
  2350. /* { label: '代码测试', value: 'code_test' },
  2351. { label: '打字测试', value: 'typing_test' } */
  2352. ];
  2353. /* 选择问题 */
  2354. const QuestionSelectDialog = ref(false);
  2355. const handleQSizeChange = (size: number) => {
  2356. questionList.pageSize = size;
  2357. GetQuestionList({page:questionList.page,limit:questionList.pageSize,question_form:questionListQuery.question_form}).then((res:any)=>{
  2358. if(res.data){
  2359. questionList.value = res.data.items;
  2360. questionListpage.page=res.data.page;
  2361. questionListpage.pageSize=res.data.limit;
  2362. totalQuestions2.value=res.data.total;
  2363. }
  2364. })
  2365. };
  2366. const handleQPageChange = (page: number) => {
  2367. questionList.page = page;
  2368. GetQuestionList({page:questionList.page,limit:questionList.pageSize,question_form:questionListQuery.question_form}).then((res:any)=>{
  2369. if(res.data){
  2370. questionList.value = res.data.items;
  2371. questionListpage.page=res.data.page;
  2372. questionListpage.pageSize=res.data.limit;
  2373. totalQuestions2.value=res.data.total;
  2374. }
  2375. })
  2376. };
  2377. const confirmSelect = async () => {
  2378. const selectedQuestionIds =selectedQuestions.value.map((item:any) => item.id);
  2379. console.log('selectedQuestionIds', selectedQuestionIds);
  2380. if (selectedQuestionIds.length === 0) {
  2381. ElMessage.warning('请至少选择一个问题');
  2382. return;
  2383. }
  2384. try {
  2385. await AddDocument({
  2386. position_id: route.query.id,
  2387. question_id: selectedQuestionIds,
  2388. duration: 60, // 默认时长,您可以根据需求调整
  2389. tenant_id: Session.get('tenant_id')
  2390. });
  2391. // 更新已选择的问题列表
  2392. const newSelectedQuestions = questionList.value.filter((item: any) => item.selected);
  2393. selectedQuestions.value.push(...newSelectedQuestions);
  2394. ElMessage.success('问题添加成功');
  2395. QuestionSelectDialog.value = false;
  2396. } catch (error: any) {
  2397. console.error('添加问题失败:', error);
  2398. if (error.code === 4000) {
  2399. ElMessage.warning('该题目已绑定,请选择其他题目');
  2400. } else {
  2401. ElMessage.error('添加问题失败,请重试');
  2402. }
  2403. }
  2404. }
  2405. const handleAddCompetency = () => {
  2406. competencyLoading.value = true;
  2407. GenerateCompetency({
  2408. position_id:route.query.id,
  2409. }).then((res:any) => {
  2410. res.data.forEach((item:any) => {
  2411. item.selected = false;
  2412. });
  2413. competencyTags.value = res.data;
  2414. console.log('res', res);
  2415. competencyLoading.value = false;
  2416. }).catch((err:any) => {
  2417. console.log('err', err);
  2418. competencyLoading.value = false;
  2419. })
  2420. };
  2421. /* 工作地点 */
  2422. // 工作地点选项
  2423. const locationOptions = getPCAData();
  2424. // 修改处理地点选择变化的函数
  2425. const handleLocationChange = (value: any) => {
  2426. console.log('地址选择变化:', value);
  2427. if (value && Array.isArray(value) && value.length > 0) {
  2428. const [provinceCode, cityCode, districtCode] = value;
  2429. const province = locationOptions.find(p => p.code === provinceCode);
  2430. let city, district;
  2431. if (province && province.children) {
  2432. city = province.children.find(c => c.code === cityCode);
  2433. if (city && city.children) {
  2434. district = city.children.find(d => d.code === districtCode);
  2435. }
  2436. }
  2437. /* // 保存名称
  2438. formData.location_names = [
  2439. province?.name || '',
  2440. city?.name || '',
  2441. district?.name || ''
  2442. ].filter(Boolean);
  2443. // 更新各个字段
  2444. formData.province = province?.name || '';
  2445. formData.city = city?.name || '';
  2446. formData.district = district?.name || '';
  2447. formData.location_str = formData.location_names.join('/'); */
  2448. } else {
  2449. /* formData.location_names = [];
  2450. formData.province = '';
  2451. formData.city = '';
  2452. formData.district = '';
  2453. formData.location_str = ''; */
  2454. }
  2455. };
  2456. const handleIsRequiredCorrectChange = (id: number, value: boolean) => {
  2457. // UpdateObj({
  2458. // id: id,
  2459. // is_required_correct: value
  2460. // }).then((res:any) => {
  2461. // console.log('res', res);
  2462. // })
  2463. };
  2464. // 当前选择的添加位置
  2465. const currentAddIndex = ref(-1);
  2466. // 是否显示选项菜单
  2467. const showOptionsMenu = ref(false);
  2468. // 选项菜单的位置
  2469. const menuPosition = reactive({ top: '0px', left: '0px' });
  2470. // AI考察对话框显示状态
  2471. const showAIVideoDialog = ref(false);
  2472. // AI考察配置选项
  2473. const aiVideoOptions = reactive({
  2474. qualityControl: false,
  2475. teamwork: false,
  2476. problemSolving: false,
  2477. dataAnalysis: false,
  2478. positionMatch: false,
  2479. proactiveness: false,
  2480. basicAbility: false,
  2481. communication: false,
  2482. serviceAwareness: false,
  2483. xxxx: false
  2484. });
  2485. // 当前步骤
  2486. const currentStep = ref(1);
  2487. // 选中的能力列表
  2488. const selectedAbilities = ref([
  2489. {
  2490. label: '沟通能力',
  2491. value: 'communication',
  2492. level: 'CC',
  2493. description: '能够清晰、准确地表达想法,善于倾听和理解他人的观点,具备良好的书面和口头表达能力。',
  2494. expanded: false,
  2495. isNew: true
  2496. },
  2497. {
  2498. label: '团队协作',
  2499. value: 'teamwork',
  2500. level: 'CC',
  2501. description: '能够与团队成员有效合作,共同完成目标,具备良好的团队精神和协作意识。',
  2502. expanded: false,
  2503. isNew: false
  2504. }
  2505. ]);
  2506. const toggleAbilityExpand = (ability:any) => {
  2507. ability.expanded = !ability.expanded;
  2508. };
  2509. // 获取能力标签
  2510. const getAbilityLabel = (key: string) => {
  2511. const abilityMap: Record<string, string> = {
  2512. qualityControl: '质量控制',
  2513. teamwork: '团队协作',
  2514. problemSolving: '问题解决',
  2515. dataAnalysis: '问题分析',
  2516. taskManagement: '分析问题',
  2517. productivity: '生产效率',
  2518. manufacturingSkills: '制造制作技能',
  2519. customerService: '客户服务技能',
  2520. resistanceToPressure: '抗压能力-客户服务',
  2521. workDefinition: '工作稳定-宣誓',
  2522. selfIntroduction: '自我介绍-宣誓',
  2523. detailOrientation: '细节关注',
  2524. logicalThinking: '清晰逻辑思维',
  2525. safetyAwareness: '安全意识',
  2526. customerServiceAwareness: '客户服务意识',
  2527. timeManagement: '时间管理',
  2528. teamCooperation: '团队合作',
  2529. timeManagementSkills: '时间管理能力',
  2530. productEvaluation: '品鉴评估能力',
  2531. basicQualifications: '基本素质',
  2532. networkDeployment: '网位布署',
  2533. remoteCooperation: '泡通协作',
  2534. executionAbility: '执行能力',
  2535. selfDiscipline: '自驱力',
  2536. managementAbility: '管理能力',
  2537. customerOrientation: '客户导向',
  2538. stability: '稳定性',
  2539. salesSkills: '销售技巧',
  2540. responseAbility: '应变能力'
  2541. };
  2542. return abilityMap[key] || key;
  2543. };
  2544. // 排名设置
  2545. const rankSettings = reactive({
  2546. min: 0,
  2547. max: 100,
  2548. minScore: 0.00,
  2549. maxScore: 0.00
  2550. });
  2551. /* 回答不充分追问 */
  2552. const handleFollowUpChange = (value: boolean) => {
  2553. console.log(value);
  2554. };
  2555. // AI模型版本
  2556. const aiModelVersion = ref('standard');
  2557. // 是否启用有效期
  2558. const validityEnabled = ref(false);
  2559. // 在 script setup 部分添加以下响应式变量
  2560. const showVideoLectureDialog = ref(false); // 控制视频宣讲弹窗显示
  2561. const videoLectureForm = reactive({
  2562. title: '', // 步骤名称
  2563. videoFile: null, // 视频文件
  2564. description: '', // 视频简介
  2565. broadcastType: 'required', // 播放设置:必须看完/看过即可
  2566. });
  2567. // 在 script setup 部分添加新的响应式变量
  2568. const showAIChatDialog = ref(false); // 控制AI实时对话抽屉显示
  2569. // 添加 AI 实时对话配置相关的响应式变量
  2570. const chatDuration = ref(15); // 默认15分钟
  2571. const maxQuestions = ref(5); // 默认5个问题
  2572. // 在 script setup 部分添加以下响应式变量
  2573. const showQuestionDialog = ref(false); // 控制添加问题弹框显示
  2574. const questionForm = reactive({
  2575. id: '',
  2576. content: '', // 题目内容
  2577. competency_tags: [], // 胜任力标签
  2578. weight: 100, // 权重占比,默认100%
  2579. level: 1, // 胜任力级别,默认1级
  2580. type: 'open', // 题目形式:开放问题/单选题/多选题/填空题/自言语
  2581. question_form: 0, // 题目类型:0-开放问题,1-单选题,2-多选题
  2582. options: [], // 选项列表
  2583. position: [], // 适用职位
  2584. category: '', // 分类
  2585. tags: [], // 标签
  2586. suggestedDuration: 60, // 建议时长,默认60秒
  2587. scoring_reference: '' // 评分标准
  2588. });
  2589. // 定义胜任力标签类型
  2590. interface CompetencyTagItem {
  2591. id: string;
  2592. name: string;
  2593. weight: number;
  2594. }
  2595. const getcompetency_tags = (value:any)=>{
  2596. return value.map((item:any)=>{
  2597. return item.id
  2598. })
  2599. }
  2600. // 胜任力标签选项
  2601. const competencyTagOptions = ref<CompetencyTag[]>([]);
  2602. // 职位类型选项
  2603. const positionOptions = ref([
  2604. { label: '后端开发', value: 'backend' },
  2605. { label: '前端开发', value: 'frontend' },
  2606. { label: '产品经理', value: 'product_manager' },
  2607. { label: '项目经理', value: 'project_manager' },
  2608. { label: '测试工程师', value: 'test_engineer' }
  2609. ]);
  2610. // 题目分类选项
  2611. const categoryOptions = ref([
  2612. { label: '技术能力', value: 'tech' },
  2613. { label: '管理能力', value: 'management' },
  2614. { label: '沟通能力', value: 'communication' },
  2615. { label: '专业知识', value: 'professional' },
  2616. { label: '个人素质', value: 'personal' }
  2617. ]);
  2618. // 标签选项
  2619. const tagOptions = ref([
  2620. { label: '时间管理', value: 'time_management' },
  2621. { label: '压力处理', value: 'pressure_handling' },
  2622. { label: '团队合作', value: 'team_cooperation' },
  2623. { label: '问题分析', value: 'problem_analysis' },
  2624. { label: '创新思维', value: 'innovative_thinking' }
  2625. ]);
  2626. // 重置问题表单
  2627. const resetQuestionForm = () => {
  2628. Object.assign(questionForm, {
  2629. id: '',
  2630. content: '',
  2631. competency_tags: [],
  2632. weight: 100,
  2633. level: 1,
  2634. type: 'open',
  2635. question_form: 0,
  2636. options: [],
  2637. position: [],
  2638. category: '',
  2639. tags: [],
  2640. suggestedDuration: 60,
  2641. scoring_reference: ''
  2642. });
  2643. };
  2644. // 取消添加问题
  2645. const cancelAddQuestion = () => {
  2646. showQuestionDialog.value = false;
  2647. resetQuestionForm();
  2648. };
  2649. // 确认修改问题
  2650. const confirmAddQuestion = async () => {
  2651. // 表单验证
  2652. if (!questionForm.content) {
  2653. ElMessage.error('请输入题目内容');
  2654. return;
  2655. }
  2656. // 验证胜任力配置
  2657. if (!validateCompetencyConfig()) {
  2658. return;
  2659. }
  2660. try {
  2661. // 创建新的问题对象
  2662. const newQuestion = {
  2663. id: questionForm.id,
  2664. content: questionForm.content,
  2665. competency_tags: questionForm.competency_tags,
  2666. options: questionForm.options,
  2667. weight: questionForm.weight,
  2668. level: questionForm.level,
  2669. question_form: questionForm.question_form,
  2670. position: questionForm.position,
  2671. category: questionForm.category,
  2672. suggestedDuration: questionForm.suggestedDuration,
  2673. scoring_reference: questionForm.scoring_reference,
  2674. };
  2675. console.log(newQuestion);
  2676. // TODO: 调用API保存问题
  2677. /* const response = await UpdateQuestion(newQuestion);
  2678. console.log(response);
  2679. if(response.code === 200){
  2680. ElMessage.success('问题修改成功');
  2681. }else{
  2682. ElMessage.error('问题修改失败');
  2683. } */
  2684. // 关闭弹窗
  2685. showQuestionDialog.value = false;
  2686. // 重置表单
  2687. resetQuestionForm();
  2688. // 提示成功
  2689. /* ElMessage.success('问题修改成功'); */
  2690. // 刷新问题列表
  2691. // await loadQuestions();
  2692. } catch (error) {
  2693. console.error('添加问题失败:', error);
  2694. ElMessage.error('添加问题失败,请重试');
  2695. }
  2696. };
  2697. // 在 script setup 中添加以下响应式变量
  2698. const showDataCollectionDialog = ref(false); // 控制资料收集对话框显示
  2699. const dataCollectionForm = reactive({
  2700. isRequired: false, // 开启评分开关
  2701. questions: [] // 问题列表
  2702. });
  2703. // 修改问题类型定义
  2704. interface QuestionType {
  2705. label: string;
  2706. value: string;
  2707. isVisible?: boolean;
  2708. enableScoring?: boolean;
  2709. isRequired?: boolean;
  2710. }
  2711. // 定义问题列表
  2712. const questionTypes = ref<QuestionType[]>([
  2713. {
  2714. label: 'Q1',
  2715. value: 'q1',
  2716. isVisible: true,
  2717. enableScoring: false,
  2718. isRequired: false
  2719. },
  2720. {
  2721. label: '请问你的毕业院校是哪里?',
  2722. value: 'school',
  2723. isVisible: true,
  2724. enableScoring: false,
  2725. isRequired: true
  2726. }
  2727. ]);
  2728. // 添加简历收集相关的状态和方法
  2729. const showResumeCollectionDialog = ref(false);
  2730. const resumeCollectionForm = reactive({
  2731. title: '简历收集',
  2732. isRequired: true,
  2733. steps: 4, // 默认步骤数
  2734. });
  2735. // 显示简历收集弹窗
  2736. const showResumeCollectionConfig = () => {
  2737. showResumeCollectionDialog.value = true;
  2738. };
  2739. // 取消简历收集配置
  2740. const cancelResumeCollection = () => {
  2741. showResumeCollectionDialog.value = false;
  2742. // 重置表单
  2743. Object.assign(resumeCollectionForm, {
  2744. title: '简历收集',
  2745. isRequired: true,
  2746. steps: 4
  2747. });
  2748. };
  2749. // 确认添加简历收集
  2750. const confirmResumeCollection = () => {
  2751. // 创建新的简历收集步骤
  2752. const newStep = {
  2753. id: Date.now(),
  2754. name: resumeCollectionForm.title,
  2755. description: '简历收集',
  2756. active: true,
  2757. type: 'resume_collection',
  2758. config: {
  2759. ...resumeCollectionForm
  2760. }
  2761. };
  2762. // 添加到流程中
  2763. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  2764. // 关闭弹窗
  2765. showResumeCollectionDialog.value = false;
  2766. // 提示成功
  2767. ElMessage.success('简历收集步骤已添加');
  2768. // 重置表单
  2769. cancelResumeCollection();
  2770. };
  2771. // AI自动组题loading状态
  2772. const autoGenerateLoading = ref(false);
  2773. // 题目设置选项
  2774. const questionSettings = reactive({
  2775. enableScoreQuestions: false, // 得分题开关
  2776. enableColorBlindQuestions: false, // 色盲题开关
  2777. enableOpenQuestions: false // 开放问题开关
  2778. });
  2779. // 获取职位详情
  2780. const getPositionDetail = async () => {
  2781. try {
  2782. const id = route.query.id;
  2783. if (!id) {
  2784. ElMessage.error('职位ID不存在');
  2785. return;
  2786. }
  2787. // 修复类型错误,创建符合InfoReq类型的对象
  2788. const idValue = Array.isArray(id) ? id[0] : id;
  2789. // 创建一个符合API要求的请求对象
  2790. const infoReq = id
  2791. const response = await api.GetObj(id); // 使用 infoReq 而不是 id
  2792. if (response && response.data) {
  2793. Object.assign(positionData, response.data);
  2794. competencyTagOptions.value=response.data.competency_tags
  2795. const config = await GetConfig(id);
  2796. if (config && config.data) {
  2797. getConfigId.value=config.data.id;
  2798. // 根据配置状态初始化得分题和色盲题开关
  2799. if (config.data.enable_psychological_test !== undefined) {
  2800. questionSettings.enableScoreQuestions = config.data.enable_psychological_test;
  2801. }
  2802. if (config.data.enable_color_blind_test !== undefined) {
  2803. questionSettings.enableColorBlindQuestions = config.data.enable_color_blind_test;
  2804. }
  2805. }
  2806. // 设置职位状态
  2807. positionStatus.value = positionData.status === 1;
  2808. }
  2809. } catch (error) {
  2810. console.error('获取职位详情失败:', error);
  2811. ElMessage.error('获取职位详情失败');
  2812. }
  2813. };
  2814. // 返回列表页
  2815. const goBack = () => {
  2816. router.push('/position/list');
  2817. };
  2818. // 编辑职位
  2819. const handleEdit = () => {
  2820. router.push(`/position/list`);
  2821. };
  2822. // 分享职位
  2823. const handleShare = () => {
  2824. ElMessage.success('分享链接已复制到剪贴板');
  2825. };
  2826. // 修改职位状态
  2827. const handleStatusChange = async (value: boolean) => {
  2828. const id = route.query.id;
  2829. try {
  2830. const newStatus = value ? 1 : 0;
  2831. // 如果是要开启职位,需要先检查视频状态
  2832. if (value) {
  2833. // 检查视频状态
  2834. const videoStatusResponse = await api.CheckQuestionVideosStatus({
  2835. position_id: id,
  2836. tenant_id:Session.get('tenant_id')
  2837. });
  2838. if (videoStatusResponse.code === 2000) {
  2839. const { is_all_completed, total_questions } = videoStatusResponse.data;
  2840. // 检查视频是否全部完成且存在题目
  2841. if (!is_all_completed || total_questions <= 0) {
  2842. ElMessage.warning(`无法开启职位,原因:${total_questions <= 0 ? '当前职位没有设置面试题目' : '面试题目视频未全部生成完成'}`);
  2843. // 恢复原状态
  2844. positionStatus.value = !value;
  2845. return;
  2846. }
  2847. } else {
  2848. ElMessage.error('检查视频状态失败,请稍后重试');
  2849. // 恢复原状态
  2850. positionStatus.value = !value;
  2851. return;
  2852. }
  2853. }
  2854. await api.UpdateObj({
  2855. id: id,
  2856. status: newStatus
  2857. });
  2858. positionData.status = newStatus;
  2859. ElMessage.success(`职位已${value ? '开启' : '关闭'}`);
  2860. } catch (error) {
  2861. console.error('修改状态失败:', error);
  2862. ElMessage.error('修改状态失败');
  2863. // 恢复原状态
  2864. positionStatus.value = !value;
  2865. }
  2866. };
  2867. // 编辑招聘流程
  2868. const handleEditProcess = () => {
  2869. showProcessDialog.value = true;
  2870. };
  2871. // 保存招聘流程
  2872. const saveProcess = () => {
  2873. showProcessDialog.value = false;
  2874. ElMessage.success('招聘流程已更新');
  2875. };
  2876. // 取消编辑
  2877. const cancelEditProcess = () => {
  2878. showProcessDialog.value = false;
  2879. };
  2880. // 删除流程步骤 - 删除后允许重新添加相同类型的步骤
  2881. const deleteProcessStep = (step: any,index: number) => {
  2882. if(step.type=='ai_video'){
  2883. showAIVideoDialog.value = false;
  2884. }
  2885. if(step.type=='ai_chat'){
  2886. showAIChatDialog.value = false;
  2887. }
  2888. if(step.type=='ai_video'){
  2889. UpdateConfig({
  2890. id: getConfigId.value,
  2891. enable_open_questions: false // 如果删除后还有AI考察,则保持为true,否则设为false
  2892. }).then((res:any) => {
  2893. if(res.code == 2000) {
  2894. ElMessage.success('删除成功');
  2895. } else {
  2896. ElMessage.error('删除失败');
  2897. }
  2898. })
  2899. }
  2900. if(step.type=='psychological_problem'){ // 处理综合素质考察删除
  2901. UpdateConfig({
  2902. id: getConfigId.value,
  2903. enable_scoring_questions: false // 删除综合素质考察时,将enable_scoring_questions设置为false
  2904. }).then((res:any) => {
  2905. if(res.code == 2000) {
  2906. ElMessage.success('删除成功');
  2907. } else {
  2908. ElMessage.error('删除失败');
  2909. }
  2910. })
  2911. }
  2912. if(step.type=='common_sense'){ // 处理综合素质考察删除
  2913. UpdateConfig({
  2914. id: getConfigId.value,
  2915. enable_single_choice: false, // 删除综合素质考察时,将enable_scoring_questions设置为false
  2916. enable_multiple_choice: false,
  2917. enable_image_choice: false,
  2918. enable_fill_blank:false,
  2919. }).then((res:any) => {
  2920. if(res.code == 2000) {
  2921. ElMessage.success('删除成功');
  2922. } else {
  2923. ElMessage.error('删除失败');
  2924. }
  2925. })
  2926. }
  2927. recruitmentProcess.splice(index, 1);
  2928. };
  2929. // 在特定位置添加流程步骤
  2930. const addProcessStepAt = (index: number) => {
  2931. /* if (recruitmentProcess.length >= 6) {
  2932. ElMessage.warning('最多只能添加6个流程步骤');
  2933. return;
  2934. } */
  2935. const newStep = {
  2936. id: Date.now(),
  2937. name: '新步骤',
  2938. description: '新步骤',
  2939. active: true,
  2940. type: 'custom' // 自定义步骤类型
  2941. };
  2942. recruitmentProcess.splice(index, 0, newStep);
  2943. };
  2944. // 修改原有的添加方法,调用新方法
  2945. const addProcessStep = () => {
  2946. addProcessStepAt(recruitmentProcess.length);
  2947. };
  2948. // 获取状态文本
  2949. const getStatusText = (status: number) => {
  2950. const statusMap: Record<number, string> = {
  2951. 0: '未发布',
  2952. 1: '已发布',
  2953. 2: '已结束'
  2954. };
  2955. return statusMap[status] || '未知状态';
  2956. };
  2957. // 获取状态类型
  2958. const getStatusType = (status: number) => {
  2959. const typeMap: Record<number, string> = {
  2960. 0: 'info',
  2961. 1: 'success',
  2962. 2: 'danger'
  2963. };
  2964. return typeMap[status] || 'info';
  2965. };
  2966. // 获取职位性质文本
  2967. const getJobTypeText = (type: number) => {
  2968. const typeMap: Record<number, string> = {
  2969. 0: '全职',
  2970. 1: '兼职',
  2971. 2: '实习',
  2972. 3: '其他'
  2973. };
  2974. return typeMap[type] || '未知';
  2975. };
  2976. // 显示选项菜单 - 用于在指定位置添加招聘流程步骤
  2977. const showStepOptions = (index: number, event: MouseEvent) => {
  2978. currentAddIndex.value = index;
  2979. showOptionsMenu.value = true;
  2980. // 计算菜单位置 - 获取按钮元素
  2981. const button = event.currentTarget as HTMLElement;
  2982. // 获取对话框元素,作为相对定位的参考
  2983. const dialogContent = button.closest('.process-dialog-content');
  2984. if (dialogContent) {
  2985. // 获取按钮和对话框的位置信息
  2986. const buttonRect = button.getBoundingClientRect();
  2987. const dialogRect = dialogContent.getBoundingClientRect();
  2988. // 计算相对于对话框的位置
  2989. const top = buttonRect.bottom - dialogRect.top + 5; // 按钮下方5px
  2990. const left = buttonRect.left - dialogRect.left;
  2991. // 设置菜单位置
  2992. menuPosition.top = `${top}px`;
  2993. menuPosition.left = `${left}px`;
  2994. }
  2995. // 阻止事件冒泡
  2996. event.stopPropagation();
  2997. };
  2998. // 修改添加选定类型的步骤方法
  2999. const addSelectedStepType = async (type: string, label: string) => {
  3000. // 检查是否已存在相同类型的步骤,防止重复添加
  3001. if (type === 'ai_video') {
  3002. UpdateConfig({
  3003. id: getConfigId.value,
  3004. enable_open_questions: true
  3005. }).then((res:any) => {
  3006. if(res.code == 2000) {
  3007. recruitmentProcess[2].visible = true;
  3008. showOptionsMenu.value = false;
  3009. /* initializeConfigState(); */// 添加初始化调用
  3010. } else {
  3011. ElMessage.error('更新配置失败');
  3012. }
  3013. })
  3014. }
  3015. // 添加综合素质考察类型的处理
  3016. if (type === 'common_sense') {
  3017. UpdateConfig({
  3018. id: getConfigId.value,
  3019. enable_single_choice: true,
  3020. enable_multiple_choice: true,
  3021. enable_image_choice: true,
  3022. enable_fill_blank:true,
  3023. }).then((res:any) => {
  3024. if(res.code == 2000) {
  3025. recruitmentProcess[3].visible = true;
  3026. console.log('recruitmentProcess',recruitmentProcess);
  3027. showOptionsMenu.value = false;
  3028. /* initializeConfigState(); */// 添加初始化调用
  3029. } else {
  3030. ElMessage.error('更新配置失败');
  3031. }
  3032. })
  3033. }
  3034. // 添加心理问题类型的处理
  3035. if (type === 'psychological_problem') {
  3036. UpdateConfig({
  3037. id: getConfigId.value,
  3038. enable_scoring_questions: true
  3039. }).then((res:any) => {
  3040. if(res.code == 2000) {
  3041. recruitmentProcess[4].visible = true;
  3042. showOptionsMenu.value = false;
  3043. /* initializeConfigState(); */
  3044. } else {
  3045. ElMessage.error('更新配置失败');
  3046. }
  3047. })
  3048. }
  3049. // 添加后渲染提问类型的处理
  3050. if (type === 'post_render_questions') {
  3051. showPostRenderDialog.value = true;
  3052. showOptionsMenu.value = false;
  3053. return;
  3054. }
  3055. const existingStep = recruitmentProcess.find(step => {
  3056. if (step.type && step.type === type) {
  3057. return true;
  3058. }
  3059. if (step.name === label) {
  3060. return true;
  3061. }
  3062. return false;
  3063. });
  3064. if (existingStep) {
  3065. ElMessage.warning(`"${label}"步骤已存在,不能重复添加`);
  3066. showOptionsMenu.value = false;
  3067. return;
  3068. }
  3069. // 添加 AI 实时对话类型的处理
  3070. if (type === 'ai_chat') {
  3071. showAIChatDialog.value = true;
  3072. showOptionsMenu.value = false;
  3073. return;
  3074. }
  3075. // 添加视频宣讲类型的处理
  3076. if (type === 'video_presentation') {
  3077. showVideoLectureConfig();
  3078. showOptionsMenu.value = false;
  3079. return;
  3080. }
  3081. // 添加资料收集类型的处理
  3082. if (type === 'data_collection') {
  3083. const response = await GetConfig(route.query.id);
  3084. if (response && response.data) {
  3085. getConfigId.value=response.data.id;
  3086. updateFieldConfig(fieldConfig, response.data.profile_fields_config as ProfileFieldsConfig);
  3087. showDataCollectionDialog.value = true;
  3088. showOptionsMenu.value = false;
  3089. }else{
  3090. showDataCollectionDialog.value = true;
  3091. showOptionsMenu.value = false;
  3092. }
  3093. return;
  3094. }
  3095. // 添加简历收集类型的处理
  3096. if (type === 'resume_collection') {
  3097. showResumeCollectionConfig();
  3098. showOptionsMenu.value = false;
  3099. return;
  3100. }
  3101. // 添加代码测试类型的处理
  3102. if (type === 'code_test') {
  3103. showCodeTestConfig();
  3104. showOptionsMenu.value = false;
  3105. return;
  3106. }
  3107. // 添加打字测试类型的处理
  3108. if (type === 'typing_test') {
  3109. showTypingTestDialog.value = true;
  3110. showOptionsMenu.value = false;
  3111. return;
  3112. }
  3113. // 添加候选人提问环节的处理
  3114. if (type === 'candidate_questions') {
  3115. showCandidateQuestionsDialog.value = true;
  3116. showOptionsMenu.value = false;
  3117. return;
  3118. }
  3119. // 创建新的招聘流程步骤,包含type字段用于重复检查
  3120. const newStep = {
  3121. id: Date.now(),
  3122. name: label,
  3123. description: label,
  3124. active: true,
  3125. type: type,
  3126. visible:true
  3127. };
  3128. console.log('newStep',newStep);
  3129. // 在指定位置插入新步骤
  3130. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  3131. showOptionsMenu.value = false;
  3132. };
  3133. // 下一步
  3134. const nextStep = async () => {
  3135. if (currentStep.value < 3) {
  3136. // 如果从第一步进入第二步,更新已选维度到 selectedAbilities
  3137. if (currentStep.value === 1) {
  3138. // 校验是否选择了胜任力标签
  3139. const selectedTags = competencyTags.value.filter(tag => tag.selected);
  3140. if (selectedTags.length === 0) {
  3141. ElMessage.warning('请至少选择一个胜任力考核维度');
  3142. return; // 阻止进入下一步
  3143. }
  3144. try {
  3145. // 直接使用选中的标签数据构建selectedAbilities数组
  3146. selectedAbilities.value = selectedTags.map((tag) => ({
  3147. label: tag.name,
  3148. value: tag.name.toLowerCase().replace(/\s+/g, '_'),
  3149. id: tag.id, // 使用标签原有的ID
  3150. description: tag.description || '', // 如果没有描述则使用空字符串
  3151. level: 'CC', // 默认等级
  3152. expanded: false,
  3153. isNew: true
  3154. }));
  3155. } catch (error) {
  3156. console.error('处理胜任力标签失败:', error);
  3157. ElMessage.error('处理胜任力标签失败');
  3158. return; // 如果处理失败,不进入下一步
  3159. }
  3160. }
  3161. // 如果从第二步进入第三步,分别处理AI生成和自定义选择的题目
  3162. if (currentStep.value === 2) {
  3163. // 校验是否选择了面试题目
  3164. if (chatQuestions.value.length === 0) {
  3165. ElMessage.warning('请至少添加一个面试题目');
  3166. return; // 阻止进入下一步
  3167. }
  3168. try{
  3169. // 分别处理AI生成的题目和自定义选择的题目
  3170. await handleQuestionsSeparately();
  3171. } catch (error) {
  3172. console.error('保存题目失败:', error);
  3173. ElMessage.error('保存题目失败');
  3174. return; // 如果保存失败,不进入下一步
  3175. }
  3176. }
  3177. // 如果从第三步完成配置,验证面试设置
  3178. if (currentStep.value === 3) {
  3179. const validation = validateInterviewSettings();
  3180. if (!validation.isValid) {
  3181. validation.messages.forEach(message => {
  3182. ElMessage.warning(message);
  3183. });
  3184. return;
  3185. }
  3186. // 打印完整的配置信息
  3187. const completeConfig = getCompleteInterviewConfig();
  3188. console.log('完整的面试配置:', completeConfig);
  3189. }
  3190. currentStep.value++;
  3191. } else {
  3192. finishConfig();
  3193. }
  3194. };
  3195. // 上一步
  3196. const prevStep = () => {
  3197. if (currentStep.value > 1) {
  3198. currentStep.value--;
  3199. }
  3200. };
  3201. // 完成配置
  3202. const finishConfig = async () => {
  3203. // 验证是否选择了面试官
  3204. if (!selectedInterviewer.value || !selectedInterviewer.value.id) {
  3205. ElMessage.warning('请选择面试官形象');
  3206. return; // 阻止继续执行保存操作
  3207. }
  3208. // 获取选中的面试官信息
  3209. const selectedInterviewerInfo = {
  3210. id: selectedInterviewer.value.id,
  3211. name: selectedInterviewer.value.name,
  3212. avatar_url: selectedInterviewer.value.avatar_url || selectedInterviewer.value.image
  3213. };
  3214. // 获取面试设置选项
  3215. const interviewSettings = getInterviewSettings();
  3216. // 获取题目设置选项
  3217. const currentQuestionSettings = {
  3218. enableScoreQuestions: questionSettings.enableScoreQuestions,
  3219. enableColorBlindQuestions: questionSettings.enableColorBlindQuestions
  3220. };
  3221. try {
  3222. // 更新职位状态为未发布
  3223. await api.UpdateObj({
  3224. id: route.query.id,
  3225. status: 0
  3226. });
  3227. // 更新本地状态
  3228. positionData.status = 0;
  3229. positionStatus.value=false;
  3230. if(getConfigId.value==0){
  3231. const response = await CreateConfig({
  3232. position_id:route.query.id,
  3233. digital_human_id:selectedInterviewer.value.id,
  3234. })
  3235. if(response.code==2000){
  3236. ElMessage.success('配置保存成功');
  3237. // 调用获取开场白和视频接口 - 顺序执行,间隔3-5秒
  3238. try {
  3239. const params = { config_id: response.data?.id || response.data };
  3240. // 检查是否有开场白配置
  3241. const hasOpeningSpeech = interviewSettings.beforeStartText &&
  3242. interviewSettings.beforeStartText.trim() !== '';
  3243. if (hasOpeningSpeech) {
  3244. // 有开场白配置,先请求获取开场白接口
  3245. await GetOpeningSpeech(params);
  3246. console.log('开场白生成成功');
  3247. showAIVideoDialog.value = false;
  3248. currentStep.value = 1;
  3249. // 等待3-5秒(这里设置为4秒)
  3250. await new Promise(resolve => setTimeout(resolve, 4000));
  3251. } else {
  3252. console.log('无开场白配置,跳过开场白生成');
  3253. }
  3254. // 请求获取视频接口
  3255. await GetVideo(params);
  3256. ElMessage.success('视频开始生成');
  3257. } catch (error) {
  3258. console.error('获取开场白和视频失败:', error);
  3259. ElMessage.warning('视频生成中,请稍后');
  3260. }
  3261. }else{
  3262. ElMessage.error('配置保存失败');
  3263. }
  3264. }else{
  3265. const response = await UpdateConfig({
  3266. id:getConfigId.value,
  3267. digital_human_id:selectedInterviewer.value.id,
  3268. })
  3269. if(response.code==2000){
  3270. ElMessage.success('配置保存成功');
  3271. // 调用获取开场白和视频接口 - 顺序执行,间隔3-5秒
  3272. try {
  3273. const params = { config_id: getConfigId.value };
  3274. // 第一步:请求获取开场白接口
  3275. console.log('开始生成开场白...');
  3276. await GetOpeningSpeech(params);
  3277. console.log('开场白生成成功');
  3278. showAIVideoDialog.value = false;
  3279. currentStep.value = 1;
  3280. // 第二步:等待3-5秒(这里设置为4秒)
  3281. console.log('等待4秒后开始生成视频...');
  3282. await delay(4000);
  3283. // 第三步:请求获取视频接口
  3284. console.log('开始生成视频...');
  3285. await GetVideo(params);
  3286. console.log('视频生成请求已发送');
  3287. ElMessage.success('视频开始生成');
  3288. } catch (error) {
  3289. console.error('获取开场白和视频失败:', error);
  3290. ElMessage.warning('视频生成中,请稍后');
  3291. }
  3292. }else{
  3293. ElMessage.error('配置保存失败');
  3294. }
  3295. }
  3296. } catch (error) {
  3297. console.error('更新职位状态失败:', error);
  3298. ElMessage.error('更新职位状态失败');
  3299. return;
  3300. }
  3301. console.log('保存时选中的面试官:', selectedInterviewerInfo);
  3302. console.log('保存时的面试设置:', interviewSettings);
  3303. console.log('保存时的题目设置:', currentQuestionSettings);
  3304. // 创建新的AI考察步骤
  3305. const newStep = {
  3306. id: Date.now(),
  3307. name: 'AI考察',
  3308. description: `已选择${selectedAbilities.value.length}项能力测评`,
  3309. active: true,
  3310. type: 'ai_video',
  3311. abilities: selectedAbilities.value.map(a => a.value),
  3312. // 添加面试官信息
  3313. interviewer: selectedInterviewerInfo,
  3314. // 添加面试设置信息
  3315. settings: interviewSettings
  3316. };
  3317. // 添加到流程中
  3318. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  3319. // 关闭对话框
  3320. showAIVideoDialog.value = false;
  3321. // 重置当前步骤
  3322. currentStep.value = 1;
  3323. // 提示成功
  3324. ElMessage.success('AI考察步骤已添加');
  3325. };
  3326. // 取消AI考察配置
  3327. const cancelAIVideoConfig = () => {
  3328. showAIVideoDialog.value = false;
  3329. currentStep.value = 1; // 重置步骤
  3330. };
  3331. // 跳转到指定步骤
  3332. const jumpToStep = (step: number) => {
  3333. // 确保步骤在有效范围内
  3334. /* if (step >= 1 && step <= 3) {
  3335. currentStep.value = step;
  3336. } */
  3337. };
  3338. // 显示视频宣讲配置弹窗
  3339. const showVideoLectureConfig = () => {
  3340. showVideoLectureDialog.value = true;
  3341. };
  3342. // 取消视频宣讲配置
  3343. const cancelVideoLecture = () => {
  3344. showVideoLectureDialog.value = false;
  3345. // 重置表单
  3346. Object.assign(videoLectureForm, {
  3347. title: '',
  3348. videoFile: null,
  3349. description: '',
  3350. broadcastType: 'required'
  3351. });
  3352. };
  3353. // 确认添加视频宣讲
  3354. const confirmVideoLecture = () => {
  3355. // 创建新的视频宣讲步骤
  3356. const newStep = {
  3357. id: Date.now(),
  3358. name: videoLectureForm.title || '视频宣讲',
  3359. description: videoLectureForm.description || '视频宣讲',
  3360. active: true,
  3361. type: 'video_presentation',
  3362. config: {
  3363. ...videoLectureForm
  3364. }
  3365. };
  3366. // 添加到流程中
  3367. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  3368. // 关闭弹窗
  3369. showVideoLectureDialog.value = false;
  3370. // 提示成功
  3371. ElMessage.success('视频宣讲步骤已添加');
  3372. // 重置表单
  3373. cancelVideoLecture();
  3374. };
  3375. // 添加 AI 实时对话相关方法
  3376. const handleAIChatConfig = () => {
  3377. // 这里添加确认配置的逻辑
  3378. const newStep = {
  3379. id: Date.now(),
  3380. name: 'AI实时对话',
  3381. description: 'AI实时对话',
  3382. active: true,
  3383. type: 'ai_chat'
  3384. };
  3385. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  3386. showAIChatDialog.value = false;
  3387. ElMessage.success('AI实时对话步骤已添加');
  3388. };
  3389. const cancelAIChatConfig = () => {
  3390. showAIChatDialog.value = false;
  3391. };
  3392. // 候选人提问环节相关方法 - 用于配置候选人提问环节
  3393. const confirmCandidateQuestions = () => {
  3394. // 验证表单数据
  3395. if (!candidateQuestionsForm.title.trim()) {
  3396. ElMessage.warning('请输入环节名称');
  3397. return;
  3398. }
  3399. if (candidateQuestionsForm.duration <= 0) {
  3400. ElMessage.warning('提问时长必须大于0分钟');
  3401. return;
  3402. }
  3403. if (candidateQuestionsForm.maxQuestions <= 0) {
  3404. ElMessage.warning('最多提问数量必须大于0');
  3405. return;
  3406. }
  3407. // 判断是编辑模式还是新增模式
  3408. if (editingCandidateQuestionsIndex.value >= 0) {
  3409. // 编辑模式:更新现有步骤
  3410. const existingStep = recruitmentProcess[editingCandidateQuestionsIndex.value];
  3411. existingStep.name = candidateQuestionsForm.title;
  3412. existingStep.description = `时长${candidateQuestionsForm.duration}分钟,最多${candidateQuestionsForm.maxQuestions}个问题`;
  3413. existingStep.config = { ...candidateQuestionsForm };
  3414. ElMessage.success('候选人提问环节已更新');
  3415. } else {
  3416. // 新增模式:创建新的候选人提问步骤
  3417. const newStep = {
  3418. id: Date.now(),
  3419. name: candidateQuestionsForm.title,
  3420. description: `时长${candidateQuestionsForm.duration}分钟,最多${candidateQuestionsForm.maxQuestions}个问题`,
  3421. active: true,
  3422. type: 'candidate_questions',
  3423. config: {
  3424. ...candidateQuestionsForm
  3425. }
  3426. };
  3427. // 添加到流程中
  3428. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  3429. ElMessage.success('候选人提问环节已添加');
  3430. }
  3431. // 关闭弹窗
  3432. showCandidateQuestionsDialog.value = false;
  3433. // 重置表单为默认值
  3434. resetCandidateQuestionsForm();
  3435. };
  3436. const cancelCandidateQuestions = () => {
  3437. showCandidateQuestionsDialog.value = false;
  3438. resetCandidateQuestionsForm();
  3439. };
  3440. // 重置候选人提问表单为默认值
  3441. const resetCandidateQuestionsForm = () => {
  3442. editingCandidateQuestionsIndex.value = -1; // 重置编辑索引
  3443. Object.assign(candidateQuestionsForm, {
  3444. title: '候选人提问',
  3445. duration: 5,
  3446. maxQuestions: 3,
  3447. description: '候选人可以向面试官提问关于公司、职位或团队的问题',
  3448. isRequired: true,
  3449. allowSkip: false,
  3450. guidelines: [
  3451. '请提出与职位、公司文化或团队相关的问题',
  3452. '避免询问已在职位描述中明确说明的信息',
  3453. '可以询问职业发展机会和团队工作方式'
  3454. ]
  3455. });
  3456. };
  3457. // 添加问题列表数据
  3458. const chatQuestions = ref<ChatQuestion[]>([]);
  3459. // 计算面试总时长
  3460. const totalInterviewDuration = computed(() => {
  3461. return chatQuestions.value.reduce((total, question) => {
  3462. // 根据问题类型分配时长
  3463. switch (question.question_form) {
  3464. case 0: // 开放题
  3465. return total + 60;
  3466. case 1: // 单选题
  3467. return total + 30;
  3468. case 2: // 多选题
  3469. return total + 30;
  3470. default: // 其他类型默认30秒
  3471. return total + 30;
  3472. }
  3473. }, 0);
  3474. });
  3475. // 格式化时长显示(将秒数转换为分钟和秒的格式)
  3476. const formatDuration = computed(() => {
  3477. const seconds = totalInterviewDuration.value;
  3478. if (seconds < 60) {
  3479. return `${seconds}秒`;
  3480. }
  3481. const minutes = Math.floor(seconds / 60);
  3482. const remainingSeconds = seconds % 60;
  3483. return remainingSeconds > 0 ? `${minutes}分${remainingSeconds}秒` : `${minutes}分钟`;
  3484. });
  3485. // 添加问题处理方法
  3486. const handleAddQuestion = () => {
  3487. showQuestionDialog.value = true;
  3488. };
  3489. /* // 取消添加问题
  3490. const cancelAddQuestion = () => {
  3491. showQuestionDialog.value = false;
  3492. // 重置表单
  3493. Object.assign(questionForm, {
  3494. title: '',
  3495. ability: '',
  3496. content: '',
  3497. target: '',
  3498. weight: 100,
  3499. maxAnswers: 1
  3500. });
  3501. }; */
  3502. /* // 确认添加问题
  3503. const confirmAddQuestion = () => {
  3504. if (!questionForm.title || !questionForm.content) {
  3505. ElMessage.warning('请填写必填项');
  3506. return;
  3507. }
  3508. // 创建新问题对象
  3509. const newQuestion = {
  3510. id: Date.now(), // 添加唯一ID
  3511. title: questionForm.title,
  3512. ability: questionForm.ability,
  3513. content: questionForm.content,
  3514. target: questionForm.target,
  3515. weight: questionForm.weight,
  3516. maxAnswers: questionForm.maxAnswers,
  3517. source: 'custom_selected' as const // 标识为自定义题目
  3518. };
  3519. // 添加到问题列表
  3520. chatQuestions.value.push(newQuestion);
  3521. // 关闭弹框
  3522. showQuestionDialog.value = false;
  3523. // 重置表单
  3524. cancelAddQuestion();
  3525. // 提示成功
  3526. ElMessage.success('问题添加成功');
  3527. }; */
  3528. // 导入问题处理方法 - 修改为打开QuestionBankForm
  3529. const handleImportQuestion = () => {
  3530. // 重置表单数据
  3531. questionBankFormData.value = {
  3532. question: '',
  3533. question_form: null,
  3534. competency_tags: [],
  3535. position_types: [],
  3536. category_id: null,
  3537. tags: [],
  3538. recommended_duration: 60,
  3539. status: 1,
  3540. is_required_correct: false,
  3541. is_system: false,
  3542. sort: 1,
  3543. options: [],
  3544. scoring_reference: '',
  3545. blank_answer_template: []
  3546. };
  3547. isEditingQuestion.value = false;
  3548. showQuestionBankFormDialog.value = true;
  3549. };
  3550. // QuestionBankForm 提交处理
  3551. const handleQuestionBankFormSubmit = async (formData: any) => {
  3552. try {
  3553. // 调用题库API创建题目
  3554. const response = await questionBankApi.AddObj({
  3555. ...formData,
  3556. tenant_id: Session.get('tenant_id')
  3557. });
  3558. if (response && response.code === 2000) {
  3559. ElMessage.success('题目创建成功');
  3560. console.log(response);
  3561. // 将创建的题目添加到当前职位的题目列表中
  3562. if (response.data) {
  3563. const newQuestion = {
  3564. id: response.data.id || response.data,
  3565. title: formData.question,
  3566. question_form: formData.question_form,
  3567. question_form_name: getQuestionFormName(formData.question_form),
  3568. scoring_reference: formData.scoring_reference || '',
  3569. competency_tags: formData.competency_tags || [],
  3570. options: formData.options || [],
  3571. enable_follow_up: false,
  3572. maxAnswers: 1,
  3573. weight: 100,
  3574. source: 'custom_selected' as const
  3575. };
  3576. // 添加到题目列表
  3577. chatQuestions.value.push(newQuestion);
  3578. }
  3579. // 关闭对话框
  3580. showQuestionBankFormDialog.value = false;
  3581. } else {
  3582. ElMessage.error('题目创建失败,请重试');
  3583. }
  3584. } catch (error) {
  3585. console.error('创建题目失败:', error);
  3586. ElMessage.error('题目创建失败,请重试');
  3587. }
  3588. };
  3589. // QuestionBankForm 取消处理
  3590. const handleQuestionBankFormCancel = () => {
  3591. showQuestionBankFormDialog.value = false;
  3592. questionBankFormData.value = {};
  3593. };
  3594. // 获取题目形式名称的辅助函数
  3595. const getQuestionFormName = (questionForm: number) => {
  3596. const formMap: { [key: number]: string } = {
  3597. 0: '开放问题',
  3598. 1: '单选题',
  3599. 2: '多选题',
  3600. 3: '色盲题',
  3601. 4: '得分题',
  3602. 5: '判断题',
  3603. 6: '填空题'
  3604. };
  3605. return formMap[questionForm] || '未知类型';
  3606. };
  3607. // 在 script setup 中添加
  3608. const editQuestion = (index: number) => {
  3609. // 编辑问题的逻辑
  3610. const question = chatQuestions.value[index];
  3611. console.log(question);
  3612. Object.assign(questionForm, question);
  3613. showQuestionDialog.value = true;
  3614. distributeWeightsEvenly()
  3615. };
  3616. const deleteQuestion = (index: number) => {
  3617. ElMessageBox.confirm('确认删除该问题?', '提示', {
  3618. confirmButtonText: '确定',
  3619. cancelButtonText: '取消',
  3620. type: 'warning'
  3621. }).then(() => {
  3622. chatQuestions.value.splice(index, 1);
  3623. ElMessage.success('删除成功');
  3624. });
  3625. };
  3626. // 取消资料收集配置
  3627. const cancelDataCollection = () => {
  3628. showDataCollectionDialog.value = false;
  3629. // 重置表单
  3630. Object.assign(dataCollectionForm, {
  3631. isRequired: false,
  3632. questions: []
  3633. });
  3634. };
  3635. // 确认添加资料收集
  3636. const confirmDataCollection = () => {
  3637. /* if (dataCollectionForm.questions.length === 0) {
  3638. ElMessage.warning('请至少选择一个问题');
  3639. return;
  3640. } */
  3641. // 创建新的资料收集步骤
  3642. const newStep = {
  3643. id: Date.now(),
  3644. name: '资料收集',
  3645. description: `已选择${dataCollectionForm.questions.length}个问题`,
  3646. active: true,
  3647. type: 'data_collection',
  3648. config: {
  3649. ...dataCollectionForm,
  3650. questions: dataCollectionForm.questions.map(q => {
  3651. // 修复 find 方法的使用
  3652. const question = questionTypes.value.find(type => type.value === q);
  3653. return {
  3654. type: q,
  3655. title: question?.label || '',
  3656. required: dataCollectionForm.isRequired
  3657. };
  3658. })
  3659. }
  3660. };
  3661. // 添加到流程中
  3662. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  3663. // 关闭弹窗
  3664. showDataCollectionDialog.value = false;
  3665. // 提示成功
  3666. ElMessage.success('资料收集步骤已添加');
  3667. // 重置表单
  3668. cancelDataCollection();
  3669. };
  3670. // 使用 onMounted 和 onUnmounted 钩子
  3671. onMounted(() => {
  3672. getPositionDetail();
  3673. getCompetencyList();
  3674. getDigitalList();
  3675. // 初始化配置状态
  3676. initializeConfigState();
  3677. });
  3678. // 组件销毁时清理轮询
  3679. onUnmounted(() => {
  3680. // 取消正在进行的轮询
  3681. cancelPolling();
  3682. });
  3683. // 初始化配置状态
  3684. const initializeConfigState = async () => {
  3685. try {
  3686. const id = route.query.id;
  3687. if (id) {
  3688. const config = await GetConfig(id);
  3689. if (config && config.data) {
  3690. // 同步得分题开关状态
  3691. if (config.data.enable_psychological_test !== undefined) {
  3692. questionSettings.enableScoreQuestions = config.data.enable_psychological_test;
  3693. }
  3694. // 同步色盲题开关状态
  3695. if (config.data.enable_color_blind_test !== undefined) {
  3696. questionSettings.enableColorBlindQuestions = config.data.enable_color_blind_test;
  3697. }
  3698. // 同步AI考察(开放问题)开关状态
  3699. recruitmentProcess[2].visible = config.data.question_form_switches.enable_open_questions;
  3700. recruitmentProcess[3].visible = config.data.question_form_switches.enable_single_choice ||
  3701. config.data.question_form_switches.enable_multiple_choice ||
  3702. config.data.question_form_switches.enable_image_choice ||
  3703. config.data.question_form_switches.enable_fill_blank;
  3704. recruitmentProcess[4].visible = config.data.question_form_switches.enable_scoring_questions;
  3705. // 可以在这里添加其他配置状态的同步
  3706. }
  3707. }
  3708. } catch (error) {
  3709. console.error('初始化配置状态失败:', error);
  3710. }
  3711. };
  3712. // 添加代码测试相关的状态和方法
  3713. const showCodeTestDialog = ref(false);
  3714. const codeTestForm = reactive({
  3715. title: '代码笔试',
  3716. autoJudge: true,
  3717. selectedPaper: null as Paper | null,
  3718. });
  3719. // 显示代码测试弹窗
  3720. const showCodeTestConfig = () => {
  3721. showCodeTestDialog.value = true;
  3722. };
  3723. // 取消代码测试配置
  3724. const cancelCodeTest = () => {
  3725. showCodeTestDialog.value = false;
  3726. // 重置表单
  3727. Object.assign(codeTestForm, {
  3728. title: '代码笔试',
  3729. autoJudge: true,
  3730. selectedPaper: null
  3731. });
  3732. };
  3733. // 确认添加代码测试
  3734. const confirmCodeTest = () => {
  3735. if (!codeTestForm.selectedPaper) {
  3736. ElMessage.warning('请添加考试试卷');
  3737. return;
  3738. }
  3739. // 创建新的代码测试步骤
  3740. const newStep = {
  3741. id: Date.now(),
  3742. name: codeTestForm.title,
  3743. description: `${codeTestForm.selectedPaper.title}`,
  3744. active: true,
  3745. type: 'code_test',
  3746. config: {
  3747. ...codeTestForm
  3748. }
  3749. };
  3750. // 添加到流程中
  3751. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  3752. // 关闭弹窗
  3753. showCodeTestDialog.value = false;
  3754. // 提示成功
  3755. ElMessage.success('代码笔试步骤已添加');
  3756. // 重置表单
  3757. cancelCodeTest();
  3758. };
  3759. // 选择试卷
  3760. const handleSelectPaper = () => {
  3761. // 模拟选择试卷
  3762. codeTestForm.selectedPaper = {
  3763. id: 1,
  3764. title: '前端开发工程师笔试',
  3765. questionCount: 4,
  3766. duration: 60,
  3767. difficulty: '中等难度'
  3768. } as Paper;
  3769. };
  3770. // 查看试卷
  3771. const handleViewPaper = () => {
  3772. ElMessage.info('查看试卷功能开发中');
  3773. };
  3774. // 更换试卷
  3775. const handleChangePaper = () => {
  3776. ElMessage.info('更换试卷功能开发中');
  3777. };
  3778. // 删除试卷
  3779. const handleRemovePaper = () => {
  3780. codeTestForm.selectedPaper = null;
  3781. };
  3782. // 添加打字测试对话框
  3783. const showTypingTestDialog = ref(false);
  3784. const typingTestForm = reactive({
  3785. title: '', // 步骤名称
  3786. duration: 5, // 测试时间,默认5分钟
  3787. content: '', // 测试页面标题
  3788. notes: '', // 注意事项内容
  3789. videoMonitoring: false, // 是否启用视频监控
  3790. passCriteria: {
  3791. speed: false, // 是否通过速度标准
  3792. accuracy: true, // 是否通过正确率标准,默认选中
  3793. },
  3794. selectionMode: 'random', // 文章选择方式:random-随机抽取,self-候选人自主选择
  3795. pageTitle: '', // 测试页面标题
  3796. previewImage: null, // 登录界面预览图
  3797. articles: [] // 文章列表
  3798. });
  3799. // 取消打字测试配置
  3800. const cancelTypingTest = () => {
  3801. showTypingTestDialog.value = false;
  3802. // 重置表单
  3803. Object.assign(typingTestForm, {
  3804. title: '',
  3805. duration: 5,
  3806. content: '',
  3807. notes: '',
  3808. videoMonitoring: false,
  3809. passCriteria: {
  3810. speed: false,
  3811. accuracy: true,
  3812. },
  3813. selectionMode: 'random',
  3814. pageTitle: '',
  3815. previewImage: null,
  3816. articles: []
  3817. });
  3818. };
  3819. // 确认添加打字测试
  3820. const confirmTypingTest = () => {
  3821. // 创建新的打字测试步骤
  3822. const newStep = {
  3823. id: Date.now(),
  3824. name: typingTestForm.title,
  3825. description: `打字测试 ${typingTestForm.duration}分钟`,
  3826. active: true,
  3827. type: 'typing_test',
  3828. config: {
  3829. ...typingTestForm
  3830. }
  3831. };
  3832. // 添加到流程中
  3833. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  3834. // 关闭弹窗
  3835. showTypingTestDialog.value = false;
  3836. // 提示成功
  3837. ElMessage.success('打字测试步骤已添加');
  3838. // 重置表单
  3839. cancelTypingTest();
  3840. };
  3841. // 添加职位名称编辑功能
  3842. const isEditingTitle = ref(false);
  3843. const editingTitle = ref('');
  3844. // 开始编辑职位名称
  3845. const startEditTitle = () => {
  3846. editingTitle.value = positionData.title;
  3847. isEditingTitle.value = true;
  3848. };
  3849. // 取消编辑职位名称
  3850. const cancelEditTitle = () => {
  3851. isEditingTitle.value = false;
  3852. };
  3853. // 保存编辑后的职位名称
  3854. const saveTitle = async () => {
  3855. if (!editingTitle.value.trim()) {
  3856. ElMessage.warning('职位名称不能为空');
  3857. return;
  3858. }
  3859. try {
  3860. const id = route.query.id;
  3861. await api.UpdateObj({
  3862. id: id,
  3863. title: editingTitle.value.trim()
  3864. });
  3865. // 更新本地数据
  3866. positionData.title = editingTitle.value.trim();
  3867. isEditingTitle.value = false;
  3868. ElMessage.success('职位名称已更新');
  3869. } catch (error) {
  3870. console.error('更新职位名称失败:', error);
  3871. ElMessage.error('更新职位名称失败');
  3872. }
  3873. };
  3874. // 工作地点编辑
  3875. const isEditingLocation = ref(false);
  3876. const editingLocation = ref('');
  3877. // 开始编辑工作地点
  3878. const startEditLocation = () => {
  3879. if (!positionData.location) {
  3880. editingLocation.value = '';
  3881. } else if (Array.isArray(positionData.location)) {
  3882. editingLocation.value = positionData.location;
  3883. } else if (typeof positionData.location === 'string') {
  3884. try {
  3885. // 移除方括号和单引号,并分割成数组
  3886. const cleanStr = positionData.location.replace(/[\[\]']/g, '');
  3887. const locationArray = cleanStr.split(',').map(item => item.trim());
  3888. // 根据地址数据查找对应的code
  3889. const province = locationOptions.find(p => p.name === locationArray[0]);
  3890. let city, district;
  3891. if (province && province.children) {
  3892. city = province.children.find(c => c.name === locationArray[1]);
  3893. if (city && city.children) {
  3894. district = city.children.find(d => d.name === locationArray[2]);
  3895. }
  3896. }
  3897. editingLocation.value = [
  3898. province?.code,
  3899. city?.code,
  3900. district?.code
  3901. ].filter(Boolean);
  3902. } catch (e) {
  3903. console.error('解析地址失败:', e);
  3904. editingLocation.value = '';
  3905. }
  3906. }
  3907. isEditingLocation.value = true;
  3908. };
  3909. // 取消编辑工作地点
  3910. const cancelEditLocation = () => {
  3911. isEditingLocation.value = false;
  3912. };
  3913. // 保存工作地点
  3914. const saveLocation = async () => {
  3915. try {
  3916. const id = route.query.id;
  3917. // 获取选中地址的名称
  3918. const locationNames = [];
  3919. if (editingLocation.value && Array.isArray(editingLocation.value)) {
  3920. const [provinceCode, cityCode, districtCode] = editingLocation.value;
  3921. const province = locationOptions.find(p => p.code === provinceCode);
  3922. let city, district;
  3923. if (province) {
  3924. locationNames.push(province.name);
  3925. if (province.children) {
  3926. city = province.children.find(c => c.code === cityCode);
  3927. if (city) {
  3928. locationNames.push(city.name);
  3929. if (city.children) {
  3930. district = city.children.find(d => d.code === districtCode);
  3931. if (district) {
  3932. locationNames.push(district.name);
  3933. }
  3934. }
  3935. }
  3936. }
  3937. }
  3938. }
  3939. await api.UpdateObj({
  3940. id: id,
  3941. location: locationNames
  3942. });
  3943. // 更新本地数据
  3944. positionData.location = locationNames;
  3945. isEditingLocation.value = false;
  3946. ElMessage.success('工作地点已更新');
  3947. } catch (error) {
  3948. console.error('更新工作地点失败:', error);
  3949. ElMessage.error('更新工作地点失败');
  3950. }
  3951. };
  3952. // 职位薪资编辑
  3953. const isEditingSalary = ref(false);
  3954. const editingSalary = ref('');
  3955. // 开始编辑职位薪资
  3956. const startEditSalary = () => {
  3957. editingSalary.value = positionData.salary_range || '';
  3958. isEditingSalary.value = true;
  3959. };
  3960. // 取消编辑职位薪资
  3961. const cancelEditSalary = () => {
  3962. isEditingSalary.value = false;
  3963. };
  3964. // 保存职位薪资
  3965. const saveSalary = async () => {
  3966. try {
  3967. const id = route.query.id;
  3968. await api.UpdateObj({
  3969. id: id,
  3970. salary_range: editingSalary.value.trim()
  3971. });
  3972. // 更新本地数据
  3973. positionData.salary_range = editingSalary.value.trim();
  3974. isEditingSalary.value = false;
  3975. ElMessage.success('职位薪资已更新');
  3976. } catch (error) {
  3977. console.error('更新职位薪资失败:', error);
  3978. ElMessage.error('更新职位薪资失败');
  3979. }
  3980. };
  3981. // 工作经验编辑
  3982. const isEditingExperience = ref(false);
  3983. const editingExperience = ref('');
  3984. // 开始编辑工作经验
  3985. const startEditExperience = () => {
  3986. editingExperience.value = positionData.work_experience_required || '';
  3987. isEditingExperience.value = true;
  3988. };
  3989. // 取消编辑工作经验
  3990. const cancelEditExperience = () => {
  3991. isEditingExperience.value = false;
  3992. };
  3993. // 保存工作经验
  3994. const saveExperience = async () => {
  3995. try {
  3996. const id = route.query.id;
  3997. await api.UpdateObj({
  3998. id: id,
  3999. work_experience_required: editingExperience.value
  4000. });
  4001. // 更新本地数据
  4002. positionData.work_experience_required = editingExperience.value;
  4003. isEditingExperience.value = false;
  4004. ElMessage.success('工作经验已更新');
  4005. } catch (error) {
  4006. console.error('更新工作经验失败:', error);
  4007. ElMessage.error('更新工作经验失败');
  4008. }
  4009. };
  4010. // 学历要求编辑
  4011. const isEditingEducation = ref(false);
  4012. const editingEducation = ref('');
  4013. // 开始编辑学历要求
  4014. const startEditEducation = () => {
  4015. editingEducation.value = positionData.education_required || '';
  4016. isEditingEducation.value = true;
  4017. };
  4018. // 取消编辑学历要求
  4019. const cancelEditEducation = () => {
  4020. isEditingEducation.value = false;
  4021. };
  4022. // 保存学历要求
  4023. const saveEducation = async () => {
  4024. try {
  4025. const id = route.query.id;
  4026. await api.UpdateObj({
  4027. id: id,
  4028. education_required: editingEducation.value
  4029. });
  4030. // 更新本地数据
  4031. positionData.education_required = editingEducation.value;
  4032. isEditingEducation.value = false;
  4033. ElMessage.success('学历要求已更新');
  4034. } catch (error) {
  4035. console.error('更新学历要求失败:', error);
  4036. ElMessage.error('更新学历要求失败');
  4037. }
  4038. };
  4039. // 所属部门编辑
  4040. const isEditingDepartment = ref(false);
  4041. const editingDepartment = ref('');
  4042. // 开始编辑所属部门
  4043. const startEditDepartment = () => {
  4044. editingDepartment.value = positionData.department || '';
  4045. isEditingDepartment.value = true;
  4046. };
  4047. // 取消编辑所属部门
  4048. const cancelEditDepartment = () => {
  4049. isEditingDepartment.value = false;
  4050. };
  4051. // 保存所属部门
  4052. const saveDepartment = async () => {
  4053. try {
  4054. const id = route.query.id;
  4055. await api.UpdateObj({
  4056. id: id,
  4057. department: editingDepartment.value.trim()
  4058. });
  4059. // 更新本地数据
  4060. positionData.department = editingDepartment.value.trim();
  4061. isEditingDepartment.value = false;
  4062. ElMessage.success('所属部门已更新');
  4063. } catch (error) {
  4064. console.error('更新所属部门失败:', error);
  4065. ElMessage.error('更新所属部门失败');
  4066. }
  4067. };
  4068. // 截止日期编辑
  4069. const isEditingEndDate = ref(false);
  4070. const editingEndDate = ref('');
  4071. // 开始编辑截止日期
  4072. const startEditEndDate = () => {
  4073. editingEndDate.value = positionData.end_date || '';
  4074. isEditingEndDate.value = true;
  4075. };
  4076. // 取消编辑截止日期
  4077. const cancelEditEndDate = () => {
  4078. isEditingEndDate.value = false;
  4079. };
  4080. // 保存截止日期
  4081. const saveEndDate = async () => {
  4082. try {
  4083. const id = route.query.id;
  4084. await api.UpdateObj({
  4085. id: id,
  4086. end_date: editingEndDate.value
  4087. });
  4088. // 更新本地数据
  4089. positionData.end_date = editingEndDate.value;
  4090. isEditingEndDate.value = false;
  4091. ElMessage.success('截止日期已更新');
  4092. } catch (error) {
  4093. console.error('更新截止日期失败:', error);
  4094. ElMessage.error('更新截止日期失败');
  4095. }
  4096. };
  4097. // 职位要求编辑
  4098. const isEditingRequirements = ref(false);
  4099. const editingRequirements = ref('');
  4100. // 开始编辑职位要求
  4101. const startEditRequirements = () => {
  4102. editingRequirements.value = positionData.requirements || '';
  4103. isEditingRequirements.value = true;
  4104. };
  4105. // 取消编辑职位要求
  4106. const cancelEditRequirements = () => {
  4107. isEditingRequirements.value = false;
  4108. };
  4109. // 保存职位要求
  4110. const saveRequirements = async () => {
  4111. try {
  4112. const id = route.query.id;
  4113. await api.UpdateObj({
  4114. id: id,
  4115. requirements: editingRequirements.value
  4116. });
  4117. // 更新本地数据
  4118. positionData.requirements = editingRequirements.value;
  4119. isEditingRequirements.value = false;
  4120. ElMessage.success('职位要求已更新');
  4121. } catch (error) {
  4122. console.error('更新职位要求失败:', error);
  4123. ElMessage.error('更新职位要求失败');
  4124. }
  4125. };
  4126. // 职位描述编辑
  4127. const isEditingDescription = ref(false);
  4128. const editingDescription = ref('');
  4129. // 开始编辑职位描述
  4130. const startEditDescription = () => {
  4131. editingDescription.value = positionData.description || '';
  4132. isEditingDescription.value = true;
  4133. };
  4134. // 取消编辑职位描述
  4135. const cancelEditDescription = () => {
  4136. isEditingDescription.value = false;
  4137. };
  4138. // 保存职位描述
  4139. const saveDescription = async () => {
  4140. try {
  4141. const id = route.query.id;
  4142. await api.UpdateObj({
  4143. id: id,
  4144. description: editingDescription.value
  4145. });
  4146. // 更新本地数据
  4147. positionData.description = editingDescription.value;
  4148. isEditingDescription.value = false;
  4149. ElMessage.success('职位描述已更新');
  4150. } catch (error) {
  4151. console.error('更新职位描述失败:', error);
  4152. ElMessage.error('更新职位描述失败');
  4153. }
  4154. };
  4155. // 职位性质编辑
  4156. const isEditingJobType = ref(false);
  4157. const editingJobType = ref(0);
  4158. // 开始编辑职位性质
  4159. const startEditJobType = () => {
  4160. editingJobType.value = positionData.job_type || 0;
  4161. isEditingJobType.value = true;
  4162. };
  4163. // 取消编辑职位性质
  4164. const cancelEditJobType = () => {
  4165. isEditingJobType.value = false;
  4166. };
  4167. // 保存职位性质
  4168. const saveEditJobType = async () => {
  4169. try {
  4170. const id = route.query.id;
  4171. await api.UpdateObj({
  4172. id: id,
  4173. job_type: editingJobType.value
  4174. });
  4175. // 更新本地数据
  4176. positionData.job_type = editingJobType.value;
  4177. isEditingJobType.value = false;
  4178. ElMessage.success('职位性质已更新');
  4179. } catch (error) {
  4180. console.error('更新职位性质失败:', error);
  4181. ElMessage.error('更新职位性质失败');
  4182. }
  4183. };
  4184. // 添加能力标签相关的响应式变量
  4185. const competencyTags = ref<CompetencyTag[]>([]);
  4186. const isEditingCompetency = ref(false);
  4187. const selectedCompetencies = ref([]);
  4188. // 获取能力标签列表
  4189. const getCompetencyList = async () => {
  4190. try {
  4191. const response = await GetCompetencyList({page:1,pageSize:1000});
  4192. if (response && response.data) {
  4193. /* competencyTagOptions.value = response.data.items.map((item: any) => ({
  4194. id: item.id,
  4195. name: item.name,
  4196. selected: false
  4197. })); */
  4198. }
  4199. } catch (error) {
  4200. console.error('获取能力标签列表失败:', error);
  4201. ElMessage.error('获取能力标签列表失败');
  4202. }
  4203. };
  4204. // 开始编辑能力标签
  4205. const startEditCompetency = async () => {
  4206. // 先获取所有可用的胜任力标签
  4207. await getCompetencyList();
  4208. // 设置已选中的标签
  4209. selectedCompetencies.value = positionData.competency_tags?.map((tag: any) => tag.id) || [];
  4210. // 标记已选中的标签
  4211. competencyTagOptions.value.forEach(tag => {
  4212. tag.selected = selectedCompetencies.value.includes(tag.id);
  4213. });
  4214. isEditingCompetency.value = true;
  4215. };
  4216. // 取消编辑能力标签
  4217. const cancelEditCompetency = () => {
  4218. isEditingCompetency.value = false;
  4219. };
  4220. // 保存能力标签
  4221. const saveCompetency = async () => {
  4222. try {
  4223. const id = route.query.id;
  4224. await api.UpdateObj({
  4225. id: id,
  4226. competency_tags: selectedCompetencies.value
  4227. });
  4228. // 更新本地数据
  4229. positionData.competency_tags = competencyTagOptions.value
  4230. .filter(tag => selectedCompetencies.value.includes(tag.id))
  4231. .map(tag => ({
  4232. id: tag.id,
  4233. name: tag.name
  4234. }));
  4235. isEditingCompetency.value = false;
  4236. ElMessage.success('能力标签已更新');
  4237. } catch (error) {
  4238. console.error('更新能力标签失败:', error);
  4239. ElMessage.error('更新能力标签失败');
  4240. }
  4241. };
  4242. // 在setup中添加
  4243. const currentEditingStep = ref<AIVideoStep | null>(null);
  4244. /* 获取已配置ID */
  4245. const getConfigId =ref(0)
  4246. // 编辑AI考察
  4247. const editAIVideo = async (step: AIVideoStep) => {
  4248. // 添加资料收集类型的处理
  4249. if (step.name === '资料收集') {
  4250. const response = await GetConfig(route.query.id);
  4251. if (response && response.data) {
  4252. getConfigId.value=response.data.id;
  4253. updateFieldConfig(fieldConfig, response.data.profile_fields_config as ProfileFieldsConfig);
  4254. showDataCollectionDialog.value = true;
  4255. showOptionsMenu.value = false;
  4256. }else{
  4257. showDataCollectionDialog.value = true;
  4258. showOptionsMenu.value = false;
  4259. }
  4260. return;
  4261. }
  4262. if (step.name === 'AI考察') {
  4263. // 如果是删除操作,先删除相关的AI考察问题
  4264. if (step.action === 'delete') {
  4265. await handleDeleteAIQuestions();
  4266. return;
  4267. }
  4268. const response = await GetConfig(route.query.id);
  4269. competencyLoading.value = true;
  4270. currentEditingStep.value = step;
  4271. showAIVideoDialog.value = true;
  4272. currentStep.value = 1;
  4273. try {
  4274. // 获取当前职位下已生成的问题
  4275. const questionResponse = await GetDraftList({
  4276. position_id: route.query.id,
  4277. page: 1,
  4278. limit: 20
  4279. });
  4280. if (questionResponse && questionResponse.data && questionResponse.data.dataList) {
  4281. chatQuestions.value = questionResponse.data.dataList.map((item:any)=>{
  4282. item.content=item.question;
  4283. item.title=item.question;
  4284. item.competency_tags=item.competency_tag_info
  4285. item.source='ai_generated';
  4286. return item;
  4287. });
  4288. }
  4289. // 首先尝试获取已有的职位标签
  4290. const existingTags = await GetPositionTags({position_id:route.query.id,page:1,limit:50});
  4291. console.log('existingTags', existingTags);
  4292. if (existingTags && existingTags.data && existingTags.data.items.length > 0) {
  4293. // 如果存在已有标签,直接使用
  4294. existingTags.data.items.forEach((item: any) => {
  4295. // 设置默认值
  4296. item.importance = 1;
  4297. item.selected = false;
  4298. // 如果存在competency快照数据,则更新选中状态
  4299. if (positionData.latest_competency_snapshot && Array.isArray(positionData.latest_competency_snapshot)) {
  4300. // 使用some方法替代内部循环,提高代码可读性
  4301. item.selected = positionData.latest_competency_snapshot.some(
  4302. (snapshot: any) => snapshot.id === item.id
  4303. );
  4304. }
  4305. });
  4306. competencyTags.value = existingTags.data.items;
  4307. } else {
  4308. // 如果没有已有标签,则生成新的标签
  4309. const response2 = await GenerateCompetency({position_id: route.query.id});
  4310. if (response2 && response2.data) {
  4311. response2.data.forEach((item: any) => {
  4312. item.selected = false;
  4313. });
  4314. competencyTags.value = response2.data;
  4315. // 保存生成的胜任力标签
  4316. try {
  4317. await SaveCompetency({
  4318. position_id: route.query.id,
  4319. tags: competencyTags.value
  4320. });
  4321. ElMessage.success('胜任力标签保存成功');
  4322. } catch (error) {
  4323. console.error('保存胜任力标签失败:', error);
  4324. ElMessage.error('胜任力标签保存失败');
  4325. }
  4326. }
  4327. }
  4328. if (response && response.data) {
  4329. getConfigId.value = response.data.id;
  4330. }
  4331. } catch (error) {
  4332. console.error('获取或生成能力标签失败:', error);
  4333. ElMessage.error('获取或生成能力标签失败');
  4334. } finally {
  4335. competencyLoading.value = false;
  4336. }
  4337. // 重置选项
  4338. (Object.keys(aiVideoOptions) as Array<keyof typeof aiVideoOptions>).forEach(key => {
  4339. aiVideoOptions[key] = false;
  4340. });
  4341. }
  4342. if(step.name === '综合素质考察'){
  4343. GetQuestionList({page:1,limit:20}).then((res:any)=>{
  4344. if(res.data){
  4345. questionList.value = res.data.items;
  4346. questionListpage.page=res.data.page;
  4347. questionListpage.pageSize=res.data.limit;
  4348. totalQuestions2.value=res.data.total;
  4349. getTreeData();
  4350. QuestionSelectDialog.value = true;
  4351. }
  4352. })
  4353. }
  4354. if(step.name === '心理问题'){
  4355. GetQuestionList({page:1,limit:30,question_form:4}).then((res:any)=>{
  4356. if(res.data){
  4357. questionListQuery.question_form=4
  4358. questionList.value = res.data.items;
  4359. questionListpage.page=res.data.page;
  4360. questionListpage.pageSize=res.data.limit;
  4361. totalQuestions2.value=res.data.total;
  4362. getDFTreeData();
  4363. showQuestionSelectDialog.value = true;
  4364. }
  4365. })
  4366. }
  4367. };
  4368. // 保存AI考察配置
  4369. const saveAIVideoConfig = async () => {
  4370. try {
  4371. // 获取选中的能力标签
  4372. const selectedAbilities = Object.entries(aiVideoOptions)
  4373. .filter(([_, value]) => value)
  4374. .map(([key]) => key);
  4375. // 更新当前编辑的步骤
  4376. if (currentEditingStep.value) {
  4377. currentEditingStep.value.aiConfig = {
  4378. abilities: selectedAbilities,
  4379. // 可以根据需要添加其他配置
  4380. };
  4381. }
  4382. // 关闭对话框
  4383. showAIVideoDialog.value = false;
  4384. ElMessage.success('AI考察配置已保存');
  4385. } catch (error) {
  4386. console.error('保存AI考察配置失败:', error);
  4387. ElMessage.error('保存失败,请重试');
  4388. }
  4389. };
  4390. // 在 script setup 部分添加以下响应式变量
  4391. const customDimension = ref('');
  4392. const customDescription = ref('');
  4393. const continueAdd = ref(false);
  4394. // 添加新的维度
  4395. const addDimension = async () => {
  4396. // 验证输入
  4397. if (!customDimension.value.trim()) {
  4398. ElMessage.warning('请输入维度名称');
  4399. return;
  4400. }
  4401. // 检查维度名称是否已存在
  4402. const existingDimension = competencyTags.value.find(tag => tag.name === customDimension.value.trim());
  4403. if (existingDimension) {
  4404. ElMessage.warning('该维度名称已存在,请重新输入');
  4405. return;
  4406. }
  4407. try {
  4408. // 1. 首先调用创建标签接口
  4409. const createResponse = await CreateCompetency({
  4410. name: customDimension.value.trim(),
  4411. description: customDescription.value.trim(),
  4412. importance: 1,
  4413. weight: 0
  4414. });
  4415. if (!createResponse.data) {
  4416. throw new Error('创建标签失败');
  4417. }
  4418. const newTagId = createResponse.data.id;
  4419. // 2. 调用绑定接口,将新创建的标签绑定到当前职位
  4420. await BatchUpdateTags({
  4421. tag_ids: [newTagId],
  4422. position_ids: [positionId.value]
  4423. });
  4424. // 创建新的维度对象
  4425. const newDimension = {
  4426. id: newTagId, // 使用API返回的真实ID
  4427. name: customDimension.value.trim(),
  4428. description: customDescription.value.trim(),
  4429. selected: false,
  4430. importance: 1,
  4431. weight: 0,
  4432. isCustom: true // 标记为自定义维度
  4433. };
  4434. // 将新维度添加到competencyTags数组中(添加到备选维度区域)
  4435. competencyTags.value.push(newDimension);
  4436. /* ElMessage.success(`自定义维度"${newDimension.name}"已添加并绑定到当前职位`); */
  4437. // 如果不是继续新增,则重置表单
  4438. if (!continueAdd.value) {
  4439. customDimension.value = '';
  4440. customDescription.value = '';
  4441. } else {
  4442. // 继续新增时只清空输入框,保持焦点便于继续输入
  4443. customDimension.value = '';
  4444. customDescription.value = '';
  4445. }
  4446. console.log('添加新维度成功:', newDimension);
  4447. console.log('当前备选维度列表:', competencyTags.value);
  4448. } catch (error) {
  4449. console.error('添加自定义维度失败:', error);
  4450. ElMessage.error('添加自定义维度失败,请重试');
  4451. }
  4452. }
  4453. // 删除自定义维度
  4454. const deleteCustomDimension = (dimension: any) => {
  4455. ElMessageBox.confirm(
  4456. `确认删除自定义维度"${dimension.name}"吗?`,
  4457. '删除确认',
  4458. {
  4459. confirmButtonText: '确定',
  4460. cancelButtonText: '取消',
  4461. type: 'warning',
  4462. }
  4463. ).then(() => {
  4464. // 从competencyTags数组中移除
  4465. const index = competencyTags.value.findIndex(tag => tag.id === dimension.id && tag.isCustom);
  4466. if (index > -1) {
  4467. competencyTags.value.splice(index, 1);
  4468. // 如果该维度已被选中,也要从已选维度列表中移除
  4469. const selectedIndex = selectedDimensions.value.findIndex(item => item.name === dimension.name);
  4470. if (selectedIndex > -1) {
  4471. selectedDimensions.value.splice(selectedIndex, 1);
  4472. }
  4473. ElMessage.success(`自定义维度"${dimension.name}"已删除`);
  4474. console.log('删除自定义维度成功:', dimension);
  4475. } else {
  4476. ElMessage.error('删除失败,未找到该维度');
  4477. }
  4478. }).catch(() => {
  4479. // 用户取消删除
  4480. console.log('用户取消删除自定义维度');
  4481. });
  4482. };
  4483. const settings = reactive({
  4484. keepVideo: false,
  4485. interruptionMode: '',
  4486. smartFollowUp: false,
  4487. followUpStyle: ''
  4488. });
  4489. interface InterviewerAvatar {
  4490. id: number;
  4491. name: string;
  4492. image: string;
  4493. }
  4494. const interviewerAvatars = ref<InterviewerAvatar[]>([
  4495. {
  4496. id: 1,
  4497. name: 'Jessica',
  4498. image: '/avatars/jessica.png'
  4499. },
  4500. {
  4501. id: 2,
  4502. name: 'Mike',
  4503. image: '/avatars/mike.png'
  4504. },
  4505. {
  4506. id: 3,
  4507. name: 'Sarah',
  4508. image: '/avatars/sarah.png'
  4509. }
  4510. ]);
  4511. const selectedInterviewer = ref(interviewerAvatars.value[0]);
  4512. const interviewerAvatar = ref('');
  4513. // 添加面试官选择处理函数
  4514. const handleInterviewerSelect = (avatar: any) => {
  4515. // 更新选中的面试官
  4516. selectedInterviewer.value = avatar;
  4517. // 打印选中的面试官信息(调试用)
  4518. console.log('选中的面试官信息:', {
  4519. id: avatar.id,
  4520. name: avatar.name,
  4521. avatar_url: avatar.avatar_url || avatar.image
  4522. });
  4523. interviewerAvatar.value = avatar.avatar_url;
  4524. // 可以在这里添加其他处理逻辑
  4525. // 比如:保存到后端、触发其他事件等
  4526. // 提示用户
  4527. ElMessage.success(`已选择面试官:${avatar.name}`);
  4528. };
  4529. // 分别处理AI生成的题目和自定义选择的题目
  4530. const handleQuestionsSeparately = async () => {
  4531. // 分离AI生成的题目和自定义选择的题目
  4532. const aiGeneratedQuestions = chatQuestions.value.filter(q => q.source === 'ai_generated');
  4533. const customSelectedQuestions = chatQuestions.value.filter(q => q.source === 'custom_selected');
  4534. console.log('AI生成的题目:', aiGeneratedQuestions);
  4535. console.log('自定义选择的题目:', customSelectedQuestions);
  4536. // 处理AI生成的题目 - 调用SaveDraft接口
  4537. if (aiGeneratedQuestions.length > 0) {
  4538. await SaveDraft({
  4539. draft_ids: aiGeneratedQuestions.map((draft: any) => draft.id)
  4540. });
  4541. console.log('AI生成的题目已保存到草稿');
  4542. }
  4543. // 处理自定义选择的题目 - 调用其他接口(这里需要根据实际需求调整)
  4544. if (customSelectedQuestions.length > 0) {
  4545. // 构建API请求数据 - 修改为符合API期望的格式
  4546. const requestData = {
  4547. position_id: route.query.id,
  4548. question_id: {
  4549. question_id: customSelectedQuestions
  4550. },
  4551. duration:60,
  4552. tenant_id:Session.get('tenant_id')
  4553. };
  4554. // 这里可以调用专门处理自定义题目的接口
  4555. // 例如:await SaveCustomQuestions({ question_ids: customSelectedQuestions.map(q => q.id) });
  4556. console.log('自定义选择的题目需要调用专门的接口处理');
  4557. // 临时处理:也使用SaveDraft接口,但可以在后端根据source字段区分处理
  4558. const response = await AddDocument(requestData);
  4559. if (response && response.code === 2000) {
  4560. ElMessage.success('自定义选择的题目已保存');
  4561. }else{
  4562. ElMessage.error('自定义选择的题目保存失败');
  4563. }
  4564. }
  4565. };
  4566. // 获取面试设置选项的函数
  4567. const getInterviewSettings = () => {
  4568. const interviewSettings = {
  4569. // 回答视频保留设置
  4570. keepVideo: settings.keepVideo,
  4571. // 中断后作答限制模式
  4572. interruptionMode: settings.interruptionMode,
  4573. // 追问风格设置
  4574. followUpStyle: settings.followUpStyle,
  4575. // 智慧追问设置
  4576. smartFollowUp: settings.smartFollowUp
  4577. };
  4578. console.log('当前面试设置:', interviewSettings);
  4579. return interviewSettings;
  4580. };
  4581. // 处理面试设置变化的函数
  4582. const handleSettingChange = (settingType: string, value: any) => {
  4583. console.log(`面试设置 ${settingType} 已更改为:`, value);
  4584. // 根据不同的设置类型进行处理
  4585. switch (settingType) {
  4586. case 'keepVideo':
  4587. console.log('回答视频保留设置:', value ? '开启' : '关闭');
  4588. break;
  4589. case 'interruptionMode':
  4590. console.log('中断后作答限制模式:', value === 'previous' ? '从上一问重新作答' : '从当前问题作答');
  4591. break;
  4592. case 'followUpStyle':
  4593. console.log('追问风格:', value);
  4594. break;
  4595. case 'smartFollowUp':
  4596. console.log('智慧追问设置:', value ? '开启' : '关闭');
  4597. break;
  4598. }
  4599. // 可以在这里添加其他处理逻辑
  4600. // 比如:实时保存到后端、触发相关事件等
  4601. };
  4602. // 验证面试设置配置完整性
  4603. const validateInterviewSettings = () => {
  4604. const currentSettings = getInterviewSettings();
  4605. // 检查必要设置是否已配置
  4606. const validation = {
  4607. isValid: true,
  4608. messages: [] as string[]
  4609. };
  4610. // 这里可以添加具体的验证逻辑
  4611. if (currentSettings.interruptionMode === '') {
  4612. validation.isValid = false;
  4613. validation.messages.push('请选择中断后作答限制模式');
  4614. }
  4615. return validation;
  4616. };
  4617. // 拖拽开始处理
  4618. const handleDragStart = (evt: any) => {
  4619. drag.value = true;
  4620. console.log('开始拖拽题目:', evt);
  4621. };
  4622. // 拖拽结束处理
  4623. const handleDragEnd = (evt: any) => {
  4624. drag.value = false;
  4625. console.log('拖拽结束:', evt);
  4626. console.log('当前题目顺序:', chatQuestions.value);
  4627. // 这里可以调用API保存新的题目顺序
  4628. // await saveQuestionOrder(chatQuestions.value);
  4629. ElMessage.success('题目顺序已更新');
  4630. };
  4631. // 获取完整的面试配置信息
  4632. const getCompleteInterviewConfig = () => {
  4633. return {
  4634. // 面试官信息
  4635. interviewer: {
  4636. id: selectedInterviewer.value.id,
  4637. name: selectedInterviewer.value.name,
  4638. avatar_url: selectedInterviewer.value.avatar_url || selectedInterviewer.value.image
  4639. },
  4640. // 面试设置
  4641. settings: getInterviewSettings(),
  4642. // 题目设置
  4643. questionSettings: {
  4644. enableScoreQuestions: questionSettings.enableScoreQuestions,
  4645. enableColorBlindQuestions: questionSettings.enableColorBlindQuestions
  4646. },
  4647. // 选中的能力标签
  4648. abilities: selectedAbilities.value,
  4649. // 题目列表
  4650. questions: chatQuestions.value,
  4651. // 当前步骤
  4652. currentStep: currentStep.value
  4653. };
  4654. };
  4655. /* 获取数字人列表 */
  4656. const getDigitalList = async () => {
  4657. const response = await GetDigitalList({page:1,pageSize:1000});
  4658. if (response && response.data) {
  4659. interviewerAvatars.value = response.data;
  4660. }
  4661. };
  4662. const handleCompetencyChange = (item: any, val: boolean) => {
  4663. if (val) {
  4664. // 当选中时,添加到已选维度列表
  4665. selectedDimensions.value.push({
  4666. name: item.name,
  4667. description: item.description || '暂无描述' // 如果没有描述则显示默认值
  4668. });
  4669. } else {
  4670. // 当取消选中时,从已选维度列表中移除
  4671. selectedDimensions.value = selectedDimensions.value.filter(
  4672. dimension => dimension.name !== item.name
  4673. );
  4674. }
  4675. };
  4676. // 删除选中的胜任力标签
  4677. const removeSelectedAbility = (index: number) => {
  4678. ElMessageBox.confirm('确认删除这个胜任力标签吗?', '提示', {
  4679. confirmButtonText: '确定',
  4680. cancelButtonText: '取消',
  4681. type: 'warning'
  4682. }).then(() => {
  4683. // 获取被删除的能力标签
  4684. const removedAbility = selectedAbilities.value[index];
  4685. // 从 selectedAbilities 数组中移除
  4686. selectedAbilities.value.splice(index, 1);
  4687. // 同时从 selectedDimensions 数组中移除对应项
  4688. selectedDimensions.value = selectedDimensions.value.filter(
  4689. dimension => dimension.name !== removedAbility.label
  4690. );
  4691. // 更新对应的checkbox状态 - 将对应的competencyTags项的selected设为false
  4692. const competencyTag = competencyTags.value.find((tag: any) => tag.name === removedAbility.label);
  4693. if (competencyTag) {
  4694. competencyTag.selected = false;
  4695. }
  4696. ElMessage.success('胜任力标签已删除');
  4697. }).catch(() => {
  4698. // 用户取消删除
  4699. });
  4700. };
  4701. // 在 script setup 部分添加以下代码
  4702. const selectedDimensions = ref<Array<{name: string, description: string}>>([]);
  4703. // 创建延迟函数
  4704. const delay = (ms: number): Promise<void> => {
  4705. return new Promise(resolve => setTimeout(resolve, ms));
  4706. };
  4707. // 轮询控制器,用于取消轮询
  4708. let pollingController: { cancelled: boolean } | null = null;
  4709. // 轮询获取草稿列表的函数
  4710. const pollForDraftList = async (params: { tenant_id: number; page: number; limit: number; position_id: string }, maxAttempts: number = 300, interval: number = 2000): Promise<any> => {
  4711. let attempts = 0;
  4712. // 创建轮询控制器
  4713. pollingController = { cancelled: false };
  4714. const currentController = pollingController;
  4715. return new Promise((resolve, reject) => {
  4716. const poll = async () => {
  4717. try {
  4718. // 检查是否已取消轮询
  4719. if (currentController.cancelled) {
  4720. console.log('轮询已被取消');
  4721. resolve(null);
  4722. return;
  4723. }
  4724. attempts++;
  4725. console.log(`第${attempts}次轮询获取草稿列表...`);
  4726. const response = await GetDraftList(params);
  4727. // 再次检查是否已取消轮询(防止在异步请求期间被取消)
  4728. if (currentController.cancelled) {
  4729. console.log('轮询已被取消');
  4730. resolve(null);
  4731. return;
  4732. }
  4733. // 检查是否有数据
  4734. if (response && response.data && response.data.dataList && response.data.dataList.length > 0) {
  4735. console.log('轮询成功,获取到草稿列表数据');
  4736. pollingController = null; // 清理控制器
  4737. resolve(response);
  4738. return;
  4739. }
  4740. // 如果超过最大尝试次数,停止轮询
  4741. if (attempts >= maxAttempts) {
  4742. console.log('轮询达到最大次数,停止轮询');
  4743. pollingController = null; // 清理控制器
  4744. resolve(response); // 返回最后一次的响应,即使没有数据
  4745. return;
  4746. }
  4747. // 继续轮询
  4748. setTimeout(poll, interval);
  4749. } catch (error) {
  4750. console.error(`第${attempts}次轮询失败:`, error);
  4751. // 检查是否已取消轮询
  4752. if (currentController.cancelled) {
  4753. console.log('轮询已被取消');
  4754. resolve(null);
  4755. return;
  4756. }
  4757. // 如果是网络错误且还没超过最大尝试次数,继续尝试
  4758. if (attempts < maxAttempts) {
  4759. setTimeout(poll, interval);
  4760. } else {
  4761. pollingController = null; // 清理控制器
  4762. reject(error);
  4763. }
  4764. }
  4765. };
  4766. // 开始第一次轮询
  4767. poll();
  4768. });
  4769. };
  4770. // 取消轮询的函数
  4771. const cancelPolling = () => {
  4772. if (pollingController) {
  4773. pollingController.cancelled = true;
  4774. pollingController = null;
  4775. console.log('轮询已被手动取消');
  4776. }
  4777. };
  4778. // 处理取消生成题目
  4779. const handleCancelGenerate = () => {
  4780. cancelPolling();
  4781. autoGenerateLoading.value = false;
  4782. ElMessage.info('已取消AI自动组题');
  4783. };
  4784. // 处理得分题开关变化
  4785. const handleScoreQuestionsChange = async (value: boolean) => {
  4786. console.log('得分题开关状态:', value ? '开启' : '关闭');
  4787. if (value) {
  4788. const response = await GetQuestionList({page:1,limit:1000,question_form:4,tenant_id:Session.get('tenant_id')});
  4789. console.log(response);
  4790. if (response && response.data) {
  4791. BatchBind({
  4792. position_id: route.query.id,
  4793. question_id: {question_id:response.data.items.map((item: any) => item.id)},
  4794. tenant_id: Session.get('tenant_id')
  4795. }).then(async (res:any)=>{
  4796. if(res.code===2000){
  4797. // 绑定成功后更新配置中的enable_psychological_test字段
  4798. try {
  4799. if (getConfigId.value > 0) {
  4800. await UpdateConfig({
  4801. id: getConfigId.value,
  4802. enable_psychological_test: true
  4803. });
  4804. console.log('配置中的enable_psychological_test字段已更新为true');
  4805. }else{
  4806. const createResponse = await CreateConfig({
  4807. position_id: route.query.id,
  4808. enable_psychological_test: true,
  4809. tenant_id:Session.get('tenant_id')
  4810. });
  4811. if (createResponse && createResponse.code === 2000) {
  4812. getConfigId.value = createResponse.data?.id || createResponse.data;
  4813. console.log('配置创建成功,enable_psychological_test字段已设置为true');
  4814. }
  4815. }
  4816. } catch (error) {
  4817. console.error('更新enable_psychological_test字段失败:', error);
  4818. // 不显示错误消息给用户,避免影响主要功能的用户体验
  4819. }
  4820. ElMessage.success('得分题功能已开启');
  4821. }else{
  4822. ElMessage.error('得分题功能开启失败');
  4823. }
  4824. })
  4825. } else {
  4826. ElMessage.error('获取题目列表失败');
  4827. }
  4828. // 可以在这里添加开启得分题时的特殊逻辑
  4829. // 比如:自动添加得分相关的题目类型、更新界面显示等
  4830. } else {
  4831. try {
  4832. const response = await GetQuestionList({page:1,limit:1000,question_form:4,tenant_id:1});
  4833. if (response && response.data) {
  4834. await BatchUnbind({
  4835. position_id: route.query.id,
  4836. question_id:response.data.items.map((item: any) => item.id),
  4837. tenant_id: Session.get('tenant_id')
  4838. });
  4839. // 解绑成功后更新配置中的enable_psychological_test字段
  4840. if (getConfigId.value > 0) {
  4841. await UpdateConfig({
  4842. id: getConfigId.value,
  4843. enable_psychological_test: false
  4844. });
  4845. console.log('配置中的enable_psychological_test字段已更新为false');
  4846. } else {
  4847. // 如果没有配置ID,创建新配置并设置为false
  4848. const createResponse = await CreateConfig({
  4849. position_id: route.query.id,
  4850. enable_psychological_test: false,
  4851. tenant_id: Session.get('tenant_id')
  4852. });
  4853. if (createResponse && createResponse.code === 2000) {
  4854. getConfigId.value = createResponse.data?.id || createResponse.data;
  4855. console.log('配置创建成功,enable_psychological_test字段已设置为false');
  4856. }
  4857. }
  4858. ElMessage.info('得分题功能已关闭');
  4859. }
  4860. } catch (error) {
  4861. console.error('关闭得分题功能失败:', error);
  4862. ElMessage.error('关闭得分题功能失败');
  4863. }
  4864. // 可以在这里添加关闭得分题时的清理逻辑
  4865. }
  4866. // 可以在这里调用API保存设置状态
  4867. // await saveQuestionSettings(questionSettings);
  4868. };
  4869. // 处理色盲题开关变化
  4870. const handleColorBlindQuestionsChange = async (value: boolean) => {
  4871. console.log('色盲题开关状态:', value ? '开启' : '关闭');
  4872. if (value) {
  4873. // 开启色盲题
  4874. const response = await GetQuestionList({page:1,limit:1000,question_form:3,tenant_id:1}); // 假设色盲题的question_form为5
  4875. console.log(response);
  4876. if (response && response.data) {
  4877. BatchBind({
  4878. position_id: route.query.id,
  4879. question_id: {question_id:response.data.items.map((item: any) => item.id)},
  4880. tenant_id: Session.get('tenant_id')
  4881. }).then(async (res:any)=>{
  4882. if(res.code===2000){
  4883. // 绑定成功后更新配置中的enable_color_blind_test字段
  4884. try {
  4885. if (getConfigId.value > 0) {
  4886. await UpdateConfig({
  4887. id: getConfigId.value,
  4888. enable_color_blind_test: true
  4889. });
  4890. console.log('配置中的enable_color_blind_test字段已更新为true');
  4891. }else{
  4892. const createResponse = await CreateConfig({
  4893. position_id: route.query.id,
  4894. enable_color_blind_test: true,
  4895. tenant_id:Session.get('tenant_id')
  4896. });
  4897. if (createResponse && createResponse.code === 2000) {
  4898. getConfigId.value = createResponse.data?.id || createResponse.data;
  4899. console.log('配置创建成功,enable_color_blind_test字段已设置为true');
  4900. }
  4901. }
  4902. } catch (error) {
  4903. console.error('更新enable_color_blind_test字段失败:', error);
  4904. // 不显示错误消息给用户,避免影响主要功能的用户体验
  4905. }
  4906. ElMessage.success('色盲题功能已开启');
  4907. }else{
  4908. ElMessage.error('色盲题功能开启失败');
  4909. }
  4910. })
  4911. } else {
  4912. ElMessage.error('获取色盲题目列表失败');
  4913. }
  4914. // 可以在这里添加开启色盲题时的特殊逻辑
  4915. // 比如:自动添加色盲测试相关题目、设置特殊的评分标准等
  4916. } else {
  4917. // 关闭色盲题
  4918. try {
  4919. const response = await GetQuestionList({page:1,limit:1000,question_form:3,tenant_id:1}); // 假设色盲题的question_form为5
  4920. if (response && response.data) {
  4921. await BatchUnbind({
  4922. position_id: route.query.id,
  4923. question_id:response.data.items.map((item: any) => item.id),
  4924. tenant_id: Session.get('tenant_id')
  4925. });
  4926. // 解绑成功后更新配置中的enable_color_blind_test字段
  4927. if (getConfigId.value > 0) {
  4928. await UpdateConfig({
  4929. id: getConfigId.value,
  4930. enable_color_blind_test: false
  4931. });
  4932. console.log('配置中的enable_color_blind_test字段已更新为false');
  4933. } else {
  4934. // 如果没有配置ID,创建新配置并设置为false
  4935. const createResponse = await CreateConfig({
  4936. position_id: route.query.id,
  4937. enable_color_blind_test: false,
  4938. tenant_id:Session.get('tenant_id')
  4939. });
  4940. if (createResponse && createResponse.code === 2000) {
  4941. getConfigId.value = createResponse.data?.id || createResponse.data;
  4942. console.log('配置创建成功,enable_color_blind_test字段已设置为false');
  4943. }
  4944. }
  4945. ElMessage.info('色盲题功能已关闭');
  4946. }
  4947. } catch (error) {
  4948. console.error('关闭色盲题功能失败:', error);
  4949. ElMessage.error('关闭色盲题功能失败');
  4950. }
  4951. // 可以在这里添加关闭色盲题时的清理逻辑
  4952. }
  4953. };
  4954. // 在 script setup 中添加以下内容
  4955. // 题目选择相关的响应式变量
  4956. const showQuestionSelectDialog = ref(false);
  4957. const questionSearchKeyword = ref('');
  4958. const questionList = ref([]);
  4959. const selectedQuestions = ref([]);
  4960. // QuestionBankForm 相关的状态管理
  4961. const showQuestionBankFormDialog = ref(false);
  4962. const questionBankFormData = ref({});
  4963. const isEditingQuestion = ref(false);
  4964. const totalQuestions = ref(0);
  4965. const totalQuestions2 = ref(0);
  4966. const questionListQuery = reactive({
  4967. page: 1,
  4968. pageSize: 10,
  4969. keyword: '',
  4970. question_form: null as number | null
  4971. });
  4972. const questionListpage = reactive({
  4973. page: 1,
  4974. limit: 20,
  4975. keyword: '',
  4976. question_form: null as number | null
  4977. });
  4978. // 获取题目列表
  4979. const fetchQuestionList = async () => {
  4980. try {
  4981. const params = {
  4982. ...questionListQuery,
  4983. keyword: questionSearchKeyword.value,
  4984. // 只有当选择了题目类型时才传递该参数
  4985. ...(questionListQuery.question_form !== null && { question_form: questionListQuery.question_form })
  4986. };
  4987. const response = await GetQuestionList(params);
  4988. if (response && response.data) {
  4989. questionList.value = response.data.items;
  4990. totalQuestions.value = response.data.total;
  4991. }
  4992. } catch (error) {
  4993. console.error('获取题目列表失败:', error);
  4994. ElMessage.error('获取题目列表失败');
  4995. }
  4996. };
  4997. // 处理题目搜索
  4998. const handleQuestionSearch = () => {
  4999. questionListQuery.page = 1;
  5000. fetchQuestionList();
  5001. };
  5002. // 处理分页大小变化
  5003. const handleQuestionSizeChange = (val: number) => {
  5004. questionListQuery.pageSize = val;
  5005. fetchQuestionList();
  5006. };
  5007. // 处理页码变化
  5008. const handleQuestionPageChange = (val: number) => {
  5009. questionListQuery.page = val;
  5010. fetchQuestionList();
  5011. };
  5012. // 处理题目选择变化
  5013. const handleQuestionSelectionChange = (selection: any[]) => {
  5014. selectedQuestions.value = selection;
  5015. };
  5016. // 取消选择题目
  5017. const cancelQuestionSelect = () => {
  5018. showQuestionSelectDialog.value = false;
  5019. selectedQuestions.value = [];
  5020. questionSearchKeyword.value = '';
  5021. };
  5022. const confirmQuestionSelect = async () => {
  5023. // 1. 验证是否选择了题目
  5024. if (selectedQuestions.value.length === 0) {
  5025. ElMessage.warning('请至少选择一个题目');
  5026. return;
  5027. }
  5028. try {
  5029. // 2. 获取选中题目的ID列表
  5030. const selectedQuestionIds = selectedQuestions.value.map(item => item.id);
  5031. // 3. 调用AddDocument接口进行绑定
  5032. await AddDocument({
  5033. position_id: route.query.id,
  5034. question_id: selectedQuestionIds,
  5035. duration: 60, // 默认时长
  5036. tenant_id:Session.get('tenant_id')
  5037. });
  5038. // 4. 将选中的题目添加到本地列表中
  5039. const formattedQuestions = selectedQuestions.value.map((question: any) => ({
  5040. id: question.id,
  5041. title: question.question || question.title,
  5042. ability: question.ability || '未设置',
  5043. content: question.content || question.question,
  5044. target: question.target || '未设置',
  5045. competency_tags: question.competency_tags || [],
  5046. question_form_name: question.question_form_name,
  5047. scoring_reference: question.scoring_reference,
  5048. question_form: question.question_form,
  5049. is_required_correct: question.is_required_correct,
  5050. weight: 100,
  5051. maxAnswers: 1,
  5052. enable_follow_up: true,
  5053. options: question.options || [],
  5054. source: 'custom_selected' as const
  5055. }));
  5056. chatQuestions.value.push(...formattedQuestions);
  5057. // 5. 关闭对话框并重置状态
  5058. showQuestionSelectDialog.value = false;
  5059. selectedQuestions.value = [];
  5060. questionSearchKeyword.value = '';
  5061. // 6. 显示成功提示
  5062. ElMessage.success('题目添加成功');
  5063. } catch (error: any) {
  5064. console.error('添加题目失败:', error);
  5065. showQuestionSelectDialog.value = false;
  5066. if (error.code === 4000) {
  5067. ElMessage.warning('该题目已绑定,请选择其他题目');
  5068. } else {
  5069. ElMessage.error('添加题目失败,请重试');
  5070. }
  5071. }
  5072. };
  5073. // 字段配置数据
  5074. const fieldConfig = reactive({
  5075. // 基本信息
  5076. name: { visible: true, label: '姓名', required: true },
  5077. gender: { visible: true, label: '性别', required: true },
  5078. three_period: { visible: true, label: '是否为三期', required: true },
  5079. phone: { visible: true, label: '手机号', required: true },
  5080. id_card: { visible: true, label: '身份证号', required: true },
  5081. ethnicity: { visible: true, label: '民族', required: true },
  5082. height: { visible: true, label: '身高(cm)', required: false },
  5083. weight: { visible: true, label: '体重(kg)', required: false },
  5084. current_address: { visible: true, label: '现居住地址', required: true },
  5085. household_location: { visible: true, label: '户口所在地', required: false },
  5086. marital_status: { visible: true, label: '婚育状况', required: false },
  5087. expected_salary: { visible: true, label: '期望薪资(元/月)', required: false },
  5088. // 家庭成员信息
  5089. family_member: {
  5090. visible: true,
  5091. label: '家庭成员',
  5092. fields: {
  5093. relation: { visible: true, label: '称谓', required: true },
  5094. name: { visible: true, label: '姓名', required: true },
  5095. workplace_address: { visible: true, label: '工作单位/家庭地址', required: false },
  5096. position: { visible: true, label: '职务', required: false },
  5097. phone: { visible: true, label: '联系电话', required: true },
  5098. is_emergency_contact: { visible: true, label: '是否为紧急联系人', required: false }
  5099. }
  5100. },
  5101. // 教育经历
  5102. education: {
  5103. visible: true,
  5104. label: '教育经历',
  5105. fields: {
  5106. start_time: { visible: true, label: '开始时间', required: true },
  5107. end_time: { visible: true, label: '结束时间', required: true },
  5108. school_name: { visible: true, label: '学校名称', required: true },
  5109. major: { visible: true, label: '专业', required: true },
  5110. degree: { visible: true, label: '学历', required: true }
  5111. }
  5112. },
  5113. // 专业技能
  5114. require_professional_skills: { visible: true, label: '专业技能', required: true },
  5115. training_fields_config: { visible: true, label: '受过的培训', required: true },
  5116. // 工作经历
  5117. work_experience: {
  5118. visible: true,
  5119. label: '工作经历',
  5120. fields: {
  5121. start_time: { visible: true, label: '开始时间', required: true },
  5122. end_time: { visible: true, label: '结束时间', required: true },
  5123. company_name: { visible: true, label: '单位名称', required: true },
  5124. employee_count: { visible: true, label: '单位人数', required: true },
  5125. department: { visible: true, label: '任职部门', required: true },
  5126. position: { visible: true, label: '担任职务', required: true },
  5127. monthly_salary: { visible: true, label: '月总收入', required: true },
  5128. supervisor: { visible: true, label: '直接领导', required: true },
  5129. supervisor_phone: { visible: true, label: '领导电话', required: true }
  5130. }
  5131. },
  5132. question_form_switches:{
  5133. enable_open_questions: true, // 0: 开放问题
  5134. enable_single_choice: true, // 1: 单选题
  5135. enable_multiple_choice: true, // 2: 多选题
  5136. enable_image_choice: true, // 3: 看图选答案
  5137. enable_scoring_questions: true, // 4: 得分题
  5138. enable_follow_up_questions: true, // 5: 追加型开放问题
  5139. enable_fill_blank: true // 6: 填空题
  5140. }
  5141. });
  5142. // 保存字段配置
  5143. const saveFieldConfig = async () => {
  5144. try {
  5145. // 构建配置数据
  5146. const configData = {
  5147. position_id: route.query.id, // 职位ID
  5148. /* config_name: "咖啡师配置", // 配置名称
  5149. digital_human_id: 4, // 数字人ID */
  5150. // 简历上传配置
  5151. require_resume_upload: true, // 是否要求上传简历
  5152. resume_file_types: ["pdf", "docx", "doc"], // 允许的文件类型
  5153. max_resume_size_mb: 10, // 最大文件大小(MB)
  5154. digital_human_opening_speech:'你好,我是本次面试的面试官,欢迎参加本公司的线上面试!面试预计需要15分钟,请你提前安排在网络良好、光线亮度合适、且相对安静的环境参加这次面试以免影响本次面试的结果。如果你在面试过程中遇到问题,请与我们的招聘人员联系。',
  5155. // 个人信息配置
  5156. require_basic_info: true, // 是否要求填写基本信息
  5157. profile_fields_config: {
  5158. name: { required: fieldConfig.name.required, visible: fieldConfig.name.visible },
  5159. phone: { required: fieldConfig.phone.required, visible: fieldConfig.phone.visible },
  5160. id_card: { required: fieldConfig.id_card.required, visible: fieldConfig.id_card.visible },
  5161. gender: { required: fieldConfig.gender.required, visible: fieldConfig.gender.visible },
  5162. birth_date: { required: false, visible: true },
  5163. political_status: { required: false, visible: true },
  5164. ethnicity: { required: fieldConfig.ethnicity.required, visible: fieldConfig.ethnicity.visible },
  5165. height: { required: fieldConfig.height.required, visible: fieldConfig.height.visible },
  5166. weight: { required: fieldConfig.weight.required, visible: fieldConfig.weight.visible },
  5167. marital_status: { required: fieldConfig.marital_status.required, visible: fieldConfig.marital_status.visible }
  5168. },
  5169. // 教育信息配置
  5170. require_education_info: fieldConfig.education.visible, // 是否要求填写教育信息
  5171. education_fields_config: {
  5172. school_name: { required: fieldConfig.education.fields.school_name.required, visible: fieldConfig.education.fields.school_name.visible },
  5173. major: { required: fieldConfig.education.fields.major.required, visible: fieldConfig.education.fields.major.visible },
  5174. degree: { required: fieldConfig.education.fields.degree.required, visible: fieldConfig.education.fields.degree.visible },
  5175. start_date: { required: fieldConfig.education.fields.start_time.required, visible: fieldConfig.education.fields.start_time.visible },
  5176. end_date: { required: fieldConfig.education.fields.end_time.required, visible: fieldConfig.education.fields.end_time.visible }
  5177. },
  5178. // 工作经验配置
  5179. require_work_experience: fieldConfig.work_experience.visible, // 是否要求填写工作经验
  5180. work_experience_fields_config: {
  5181. company_name: { required: fieldConfig.work_experience.fields.company_name.required, visible: fieldConfig.work_experience.fields.company_name.visible },
  5182. position: { required: fieldConfig.work_experience.fields.position.required, visible: fieldConfig.work_experience.fields.position.visible },
  5183. department: { required: fieldConfig.work_experience.fields.department.required, visible: fieldConfig.work_experience.fields.department.visible },
  5184. start_date: { required: fieldConfig.work_experience.fields.start_time.required, visible: fieldConfig.work_experience.fields.start_time.visible },
  5185. end_date: { required: fieldConfig.work_experience.fields.end_time.required, visible: fieldConfig.work_experience.fields.end_time.visible },
  5186. job_description: { required: true, visible: true },
  5187. achievements: { required: false, visible: true },
  5188. resignation_reason: { required: false, visible: true }
  5189. },
  5190. // 家庭信息配置
  5191. require_family_info: fieldConfig.family_member.visible, // 是否要求填写家庭信息
  5192. family_fields_config: {
  5193. relation: { required: fieldConfig.family_member.fields.relation.required, visible: fieldConfig.family_member.fields.relation.visible },
  5194. name: { required: fieldConfig.family_member.fields.name.required, visible: fieldConfig.family_member.fields.name.visible },
  5195. workplace: { required: fieldConfig.family_member.fields.workplace_address.required, visible: fieldConfig.family_member.fields.workplace_address.visible },
  5196. position: { required: fieldConfig.family_member.fields.position.required, visible: fieldConfig.family_member.fields.position.visible },
  5197. phone: { required: fieldConfig.family_member.fields.phone.required, visible: fieldConfig.family_member.fields.phone.visible }
  5198. },
  5199. // 培训经历配置
  5200. require_training_info: fieldConfig.training_fields_config.visible,
  5201. require_professional_skills: fieldConfig.require_professional_skills.visible,
  5202. /* training_fields_config: {
  5203. training_name: { required: true, visible: true },
  5204. institution: { required: true, visible: true },
  5205. start_date: { required: true, visible: true },
  5206. end_date: { required: false, visible: true },
  5207. certificate: { required: false, visible: true }
  5208. },
  5209. */
  5210. // 姿态配置
  5211. enable_posture_check: true,
  5212. posture_check_config: {
  5213. required_photos: ["front", "side", "back"],
  5214. instructions: "请按照提示上传您的全身照片,确保光线充足,背景简洁"
  5215. },
  5216. // 面试配置
  5217. interview_duration_minutes: 45,
  5218. enable_video_recording: true,
  5219. enable_face_recognition: true,
  5220. // 评分配置
  5221. scoring_method: "hybrid",
  5222. auto_analysis_enabled: true,
  5223. // 其他配置
  5224. custom_welcome_message: "欢迎参加咖啡师岗位的面试,请放松心情,准备好开始面试吧!",
  5225. custom_instructions: "本次面试共有10个问题,每个问题有60秒的回答时间,请简洁明了地表达您的观点。",
  5226. notification_config: {
  5227. send_email: true,
  5228. send_sms: false,
  5229. notify_hr: true,
  5230. completion_message: "感谢您完成面试,我们将在3个工作日内给您回复。"
  5231. },
  5232. is_active: true,
  5233. is_template: false
  5234. };
  5235. if(getConfigId.value==0){
  5236. }else{
  5237. configData.id=getConfigId.value;
  5238. }
  5239. // 调用后端 API
  5240. if(getConfigId.value==0){
  5241. const response = await CreateConfig(configData);
  5242. if(response.code==2000){
  5243. ElMessage.success('配置保存成功');
  5244. showDataCollectionDialog.value = false;
  5245. showOptionsMenu.value = false;
  5246. }else{
  5247. ElMessage.error('配置保存失败');
  5248. }
  5249. }else{
  5250. //configData.digital_human_opening_speech='你好,我是本次面试的面试官,欢迎参加本公司的线上面试!面试预计需要15分钟,请你提前安排在网络良好、光线亮度合适、且相对安静的环境参加这次面试以免影响本次面试的结果。如果你在面试过程中遇到问题,请与我们的招聘人员联系。'
  5251. const response = await UpdateConfig(configData);
  5252. if(response.code==2000){
  5253. ElMessage.success('配置保存成功');
  5254. showDataCollectionDialog.value = false;
  5255. showOptionsMenu.value = false;
  5256. }else{
  5257. ElMessage.error('配置保存失败');
  5258. }
  5259. }
  5260. } catch (error) {
  5261. console.error('保存配置失败:', error);
  5262. ElMessage.error('配置保存失败');
  5263. }
  5264. };
  5265. // 获取基本信息字段
  5266. const getBasicFields = () => {
  5267. const basicFields = {
  5268. name: fieldConfig.name,
  5269. gender: fieldConfig.gender,
  5270. three_period: fieldConfig.three_period,
  5271. phone: fieldConfig.phone,
  5272. id_card: fieldConfig.id_card,
  5273. ethnicity: fieldConfig.ethnicity,
  5274. height: fieldConfig.height,
  5275. weight: fieldConfig.weight,
  5276. current_address: fieldConfig.current_address,
  5277. household_location: fieldConfig.household_location,
  5278. marital_status: fieldConfig.marital_status,
  5279. expected_salary: fieldConfig.expected_salary
  5280. };
  5281. return basicFields;
  5282. };
  5283. // 获取专业技能字段
  5284. const getSkillFields = () => {
  5285. const skillFields = {
  5286. skills: fieldConfig.require_professional_skills,
  5287. training: fieldConfig.training_fields_config
  5288. };
  5289. return skillFields;
  5290. };
  5291. // 面试设置弹窗
  5292. const showInterviewSettingsDialog = ref(false);
  5293. const interviewSettings = reactive({
  5294. faceConsistency: true,
  5295. preventScreenshot: true,
  5296. screenSwitchAlert: true,
  5297. positionDetection: true,
  5298. eyeMovementDetection: true,
  5299. reviewInterview: false,
  5300. beforeStart: true,
  5301. beforeStartText: '你好,我是本次面试的面试官,欢迎参加本公司的线上面试!面试预计需要15分钟,请你提前安排在网络良好、光线亮度合适、且相对安静的环境参加这次面试以免影响本次面试的结果。如果你在面试过程中遇到问题,请与我们的招聘人员联系。',
  5302. afterStartReminder: false,
  5303. afterStartText: '本次面试如有15分钟,高效调前后流程,安静好心理',
  5304. disclaimer: false,
  5305. disclaimerText: '本次面试已全部结束,感谢您的参与,请等待后续通知。'
  5306. });
  5307. // 编辑状态变量
  5308. const isEditingBeforeStart = ref(false);
  5309. const isEditingAfterStart = ref(false);
  5310. const isEditingDisclaimer = ref(false);
  5311. // 编辑中的文本内容
  5312. const editingBeforeStartText = ref('');
  5313. const editingAfterStartText = ref('');
  5314. const editingDisclaimerText = ref('');
  5315. // 取消面试设置
  5316. const cancelInterviewSettings = () => {
  5317. showInterviewSettingsDialog.value = false;
  5318. // 重置编辑状态
  5319. isEditingBeforeStart.value = false;
  5320. isEditingAfterStart.value = false;
  5321. isEditingDisclaimer.value = false;
  5322. // 重置表单
  5323. Object.assign(interviewSettings, {
  5324. faceConsistency: true,
  5325. preventScreenshot: true,
  5326. screenSwitchAlert: true,
  5327. positionDetection: true,
  5328. eyeMovementDetection: true,
  5329. reviewInterview: false,
  5330. beforeStart: true,
  5331. beforeStartText: '你好,我想咨询其间的面试,欢迎来到大面试',
  5332. afterStartReminder: false,
  5333. afterStartText: '本次面试如有15分钟,高效调前后流程,安静好心理',
  5334. disclaimer: false,
  5335. disclaimerText: '本次面试已全部流程拍摄,面试者同意可为今后资讯调研'
  5336. });
  5337. };
  5338. // 确认面试设置
  5339. const confirmInterviewSettings = () => {
  5340. // 这里可以添加保存面试设置的API调用
  5341. console.log('保存面试设置:', interviewSettings);
  5342. ElMessage.success('面试设置已保存');
  5343. showInterviewSettingsDialog.value = false;
  5344. };
  5345. // 编辑面试设置
  5346. const handleEditInterview = () => {
  5347. GetConfig(route.query.id).then((res:any)=>{
  5348. showInterviewSettingsDialog.value = true;
  5349. getConfigId.value=res.data.id;
  5350. interviewSettings.beforeStartText = res.data.digital_human_opening_speech;
  5351. })
  5352. };
  5353. // 开始前文本编辑方法
  5354. const startEditBeforeStart = () => {
  5355. editingBeforeStartText.value = interviewSettings.beforeStartText;
  5356. isEditingBeforeStart.value = true;
  5357. };
  5358. const cancelEditBeforeStart = () => {
  5359. isEditingBeforeStart.value = false;
  5360. editingBeforeStartText.value = '';
  5361. };
  5362. const saveBeforeStart = async () => {
  5363. if (!editingBeforeStartText.value.trim()) {
  5364. ElMessage.warning('开始前提示内容不能为空');
  5365. return;
  5366. }
  5367. interviewSettings.beforeStartText = editingBeforeStartText.value.trim();
  5368. try {
  5369. let response;
  5370. console.log(getConfigId.value);
  5371. // 根据getConfigId的值决定调用哪个接口
  5372. if (getConfigId.value == 0) {
  5373. // getConfigId不等于0时,调用CreateConfig接口
  5374. response = await CreateConfig({
  5375. position_id: route.query.id,
  5376. digital_human_opening_speech: editingBeforeStartText.value.trim()
  5377. });
  5378. if (response.code === 2000) {
  5379. // 创建成功后更新getConfigId
  5380. getConfigId.value = response.data?.id || response.data;
  5381. ElMessage.success('开始前提示内容已创建');
  5382. isEditingBeforeStart.value = false;
  5383. } else {
  5384. ElMessage.error('开始前提示内容创建失败');
  5385. }
  5386. } else {
  5387. // getConfigId等于0时,调用UpdateConfig接口
  5388. response = await UpdateConfig({
  5389. id: getConfigId.value,
  5390. digital_human_opening_speech: editingBeforeStartText.value.trim()
  5391. });
  5392. if (response.code === 2000) {
  5393. ElMessage.success('开始前提示内容已更新');
  5394. isEditingBeforeStart.value = false;
  5395. // 调用GetOpeningSpeech接口
  5396. try {
  5397. const params = { config_id: getConfigId.value };
  5398. await GetOpeningSpeech(params);
  5399. console.log('开场白生成成功');
  5400. } catch (error) {
  5401. console.error('获取开场白失败:', error);
  5402. ElMessage.warning('开场白生成中,请稍后');
  5403. }
  5404. } else {
  5405. ElMessage.error('开始前提示内容更新失败');
  5406. }
  5407. }
  5408. } catch (error) {
  5409. console.error('保存开始前提示内容失败:', error);
  5410. ElMessage.error('保存失败,请重试');
  5411. }
  5412. };
  5413. // 开始后提醒编辑方法
  5414. const startEditAfterStart = () => {
  5415. editingAfterStartText.value = interviewSettings.afterStartText;
  5416. isEditingAfterStart.value = true;
  5417. };
  5418. const cancelEditAfterStart = () => {
  5419. isEditingAfterStart.value = false;
  5420. editingAfterStartText.value = '';
  5421. };
  5422. const saveAfterStart = () => {
  5423. if (!editingAfterStartText.value.trim()) {
  5424. ElMessage.warning('开始后提醒内容不能为空');
  5425. return;
  5426. }
  5427. interviewSettings.afterStartText = editingAfterStartText.value.trim();
  5428. isEditingAfterStart.value = false;
  5429. ElMessage.success('开始后提醒内容已更新');
  5430. };
  5431. // 免责声明编辑方法
  5432. const startEditDisclaimer = () => {
  5433. editingDisclaimerText.value = interviewSettings.disclaimerText;
  5434. isEditingDisclaimer.value = true;
  5435. };
  5436. const cancelEditDisclaimer = () => {
  5437. isEditingDisclaimer.value = false;
  5438. editingDisclaimerText.value = '';
  5439. };
  5440. const saveDisclaimer = () => {
  5441. if (!editingDisclaimerText.value.trim()) {
  5442. ElMessage.warning('免责声明内容不能为空');
  5443. return;
  5444. }
  5445. interviewSettings.disclaimerText = editingDisclaimerText.value.trim();
  5446. isEditingDisclaimer.value = false;
  5447. ElMessage.success('免责声明内容已更新');
  5448. };
  5449. // 题目数量设置
  5450. const questionCountSettings = reactive({
  5451. openQuestionsCount: 5,
  5452. choiceQuestionsCount: 10
  5453. });
  5454. // 处理题目数量变化
  5455. const handleQuestionCountChange = () => {
  5456. // 这里可以添加其他逻辑,比如保存到本地存储等
  5457. console.log('题目数量已更新:', questionCountSettings);
  5458. };
  5459. // 修改自动生成题目的方法
  5460. const handleAutoGenerate = async () => {
  5461. try {
  5462. autoGenerateLoading.value = true;
  5463. // 获取选中的能力标签ID
  5464. const competencyTagIds = selectedAbilities.value.map(ability => {
  5465. return ability.id;
  5466. });/* selectedDimensions.value.map(dimension => {
  5467. const tag = competencyTags.value.find(tag => tag.name === dimension.name);
  5468. return tag ? tag.id : null;
  5469. }).filter(id => id !== null); */
  5470. if (competencyTagIds.length === 0) {
  5471. ElMessage.warning('请先选择能力标签');
  5472. return;
  5473. }
  5474. const params = {
  5475. position_id: route.query.id,
  5476. competency_tag_ids: competencyTagIds,
  5477. open_questions_count: questionCountSettings.openQuestionsCount, // 使用设置的开放题数量
  5478. choice_questions_count: questionCountSettings.choiceQuestionsCount, // 使用设置的选择题数量
  5479. auto_save: true,
  5480. tenant_id: Session.get('tenant_id')
  5481. };
  5482. // 调用生成题目的接口
  5483. const response = await GenerateQuestions(params);
  5484. if (response && response.data) {
  5485. // 生成成功后,使用轮询获取最新生成的题目
  5486. const draftResponse = await pollForDraftList({
  5487. tenant_id:Session.get('tenant_id'),
  5488. page: 1,
  5489. limit: 30,
  5490. position_id: route.query.id as string
  5491. });
  5492. console.log(draftResponse);
  5493. // 检查轮询是否被取消
  5494. if (draftResponse === null) {
  5495. console.log('轮询被取消,停止处理');
  5496. return;
  5497. }
  5498. if (draftResponse && draftResponse.data && draftResponse.data.dataList) {
  5499. // 将获取到的题目格式化并添加到 chatQuestions 列表中
  5500. const formattedQuestions = draftResponse.data.dataList.map((question: any) => ({
  5501. id: question.id || Date.now(),
  5502. title: question.question || question.title,
  5503. ability: question.ability || '未设置',
  5504. content: question.content || question.question,
  5505. target: question.target || '未设置',
  5506. competency_tags: question.competency_tag_info || [],
  5507. question_form_name: question.question_form_name,
  5508. scoring_reference: question.scoring_reference,
  5509. question_form: question.question_form,
  5510. is_required_correct: question.is_required_correct,
  5511. weight: 100,
  5512. maxAnswers: 1,
  5513. enable_follow_up:true,
  5514. options: question.options || [],
  5515. source: 'ai_generated' as const // 标识为AI生成的题目
  5516. }));
  5517. // 清空现有题目并添加新生成的题目
  5518. chatQuestions.value = formattedQuestions;
  5519. ElMessage.success(`已成功生成${formattedQuestions.length}个面试题目`);
  5520. } else {
  5521. ElMessage.warning('AI生成题目中,请稍后再试');
  5522. }
  5523. }
  5524. } catch (error) {
  5525. console.error('AI自动组题失败:', error);
  5526. ElMessage.error('AI自动组题失败,请重试');
  5527. } finally {
  5528. // 无论成功或失败都要关闭loading状态
  5529. autoGenerateLoading.value = false;
  5530. }
  5531. };
  5532. // 处理胜任力标签变化
  5533. const handleCompetencyTagsChange = (value: string[]) => {
  5534. // 更新选中的标签ID
  5535. questionForm.competency_tags = [];
  5536. if (value.length > 0) {
  5537. // 计算每个标签的均分权重
  5538. const averageWeight = Math.floor(100 / value.length);
  5539. const remainder = 100 % value.length;
  5540. // 根据选中的标签ID,从competencyTagOptions中获取完整的标签信息
  5541. questionForm.competency_tags = value.map((tagId, index) => {
  5542. const tagOption = competencyTagOptions.value.find(option => option.id === tagId);
  5543. return {
  5544. id: tagId,
  5545. name: tagOption ? tagOption.name : `标签${tagId}`,
  5546. // 均分权重,余数分配给前几个标签
  5547. weight: averageWeight + (index < remainder ? 1 : 0)
  5548. };
  5549. });
  5550. }
  5551. };
  5552. // 验证胜任力配置
  5553. const validateCompetencyConfig = () => {
  5554. if (questionForm.competency_tags.length === 0) {
  5555. ElMessage.warning('请至少选择一个胜任力标签');
  5556. return false;
  5557. }
  5558. if (questionForm.weight <= 0 || questionForm.weight > 100) {
  5559. ElMessage.warning('权重必须在1-100之间');
  5560. return false;
  5561. }
  5562. return true;
  5563. };
  5564. // 处理题目形式变化
  5565. const handleQuestionTypeChange = (value: string) => {
  5566. questionForm.type = value;
  5567. // 根据题目形式设置默认建议时长
  5568. switch (value) {
  5569. case 'open':
  5570. questionForm.suggestedDuration = 120; // 开放题默认2分钟
  5571. break;
  5572. case 'single':
  5573. case 'multiple':
  5574. questionForm.suggestedDuration = 60; // 选择题默认1分钟
  5575. break;
  5576. case 'fill':
  5577. questionForm.suggestedDuration = 30; // 填空题默认30秒
  5578. break;
  5579. case 'self':
  5580. questionForm.suggestedDuration = 180; // 自言语默认3分钟
  5581. break;
  5582. default:
  5583. questionForm.suggestedDuration = 60;
  5584. }
  5585. };
  5586. // 添加状态变量
  5587. const competencyLoading = ref(false);
  5588. // 候选人提问环节相关变量 - 用于候选人向面试官提问的环节配置
  5589. const showCandidateQuestionsDialog = ref(false); // 控制候选人提问弹窗显示
  5590. const editingCandidateQuestionsIndex = ref(-1); // 编辑候选人提问环节的索引
  5591. const candidateQuestionsForm = reactive({
  5592. title: '候选人提问', // 环节名称
  5593. duration: 5, // 提问时长(分钟)
  5594. maxQuestions: 3, // 最多提问数量
  5595. description: '候选人可以向面试官提问关于公司、职位或团队的问题', // 环节描述
  5596. isRequired: true, // 是否必须环节
  5597. allowSkip: false, // 是否允许跳过
  5598. guidelines: [ // 提问指引
  5599. '请提出与职位、公司文化或团队相关的问题',
  5600. '避免询问已在职位描述中明确说明的信息',
  5601. '可以询问职业发展机会和团队工作方式'
  5602. ]
  5603. });
  5604. const removeGuideline = (index: number) => {
  5605. candidateQuestionsForm.guidelines.splice(index, 1);
  5606. };
  5607. const addGuideline = () => {
  5608. candidateQuestionsForm.guidelines.push('');
  5609. };
  5610. // 编辑候选人提问环节
  5611. const editCandidateQuestions = (step: any, index: number) => {
  5612. editingCandidateQuestionsIndex.value = index;
  5613. // 如果步骤有配置信息,加载到表单中
  5614. if (step.config) {
  5615. Object.assign(candidateQuestionsForm, step.config);
  5616. } else {
  5617. // 如果没有配置信息,从步骤的基本信息推断
  5618. candidateQuestionsForm.title = step.name;
  5619. candidateQuestionsForm.description = step.description || '候选人可以向面试官提问关于公司、职位或团队的问题';
  5620. candidateQuestionsForm.duration = 5;
  5621. candidateQuestionsForm.maxQuestions = 3;
  5622. candidateQuestionsForm.isRequired = step.active;
  5623. candidateQuestionsForm.allowSkip = false;
  5624. candidateQuestionsForm.guidelines = [
  5625. '请提出与职位、公司文化或团队相关的问题',
  5626. '避免询问已在职位描述中明确说明的信息',
  5627. '可以询问职业发展机会和团队工作方式'
  5628. ];
  5629. }
  5630. showCandidateQuestionsDialog.value = true;
  5631. };
  5632. // 统一的编辑流程步骤方法
  5633. const editProcessStep = (step: any, index: number) => {
  5634. switch (step.type) {
  5635. case 'ai_video':
  5636. editAIVideo(step);
  5637. break;
  5638. case 'candidate_questions':
  5639. editCandidateQuestions(step, index);
  5640. break;
  5641. case 'data_collection':
  5642. // TODO: 添加资料收集编辑功能
  5643. editAIVideo(step);
  5644. /* ElMessage.info('资料收集编辑功能开发中'); */
  5645. break;
  5646. case 'resume_collection':
  5647. // TODO: 添加简历收集编辑功能
  5648. editAIVideo(step);
  5649. break;
  5650. default:
  5651. editAIVideo(step);
  5652. break;
  5653. }
  5654. };
  5655. // 权重变化处理函数
  5656. const handleWeightChange = (index: number, value: number | null) => {
  5657. if (value === null || value < 0) value = 0;
  5658. if (value > 100) value = 100;
  5659. const tags = questionForm.competency_tags as CompetencyTagItem[];
  5660. const oldWeight = tags[index].weight;
  5661. const newWeight = Math.round(value);
  5662. // 更新当前标签权重
  5663. tags[index].weight = newWeight;
  5664. // 如果只有一个标签,直接设置为100
  5665. if (tags.length === 1) {
  5666. tags[0].weight = 100;
  5667. return;
  5668. }
  5669. // 计算权重差值
  5670. const weightDiff = newWeight - oldWeight;
  5671. const otherTags = tags.filter((_, i) => i !== index);
  5672. const totalOtherWeight = otherTags.reduce((sum, tag) => sum + tag.weight, 0);
  5673. // 如果其他标签总权重为0,则平均分配剩余权重
  5674. if (totalOtherWeight === 0) {
  5675. const remainingWeight = 100 - newWeight;
  5676. const averageWeight = Math.floor(remainingWeight / otherTags.length);
  5677. const remainder = remainingWeight % otherTags.length;
  5678. otherTags.forEach((tag, i) => {
  5679. const tagIndex = tags.findIndex(t => t.id === tag.id);
  5680. tags[tagIndex].weight = averageWeight + (i < remainder ? 1 : 0);
  5681. });
  5682. } else {
  5683. // 按比例调整其他标签权重
  5684. const targetTotalOther = 100 - newWeight;
  5685. if (targetTotalOther > 0) {
  5686. otherTags.forEach(tag => {
  5687. const tagIndex = tags.findIndex(t => t.id === tag.id);
  5688. const proportion = tag.weight / totalOtherWeight;
  5689. tags[tagIndex].weight = Math.round(targetTotalOther * proportion);
  5690. });
  5691. // 处理舍入误差
  5692. const currentTotal = getTotalWeight();
  5693. if (currentTotal !== 100) {
  5694. const diff = 100 - currentTotal;
  5695. // 找到最大权重的其他标签进行调整
  5696. const maxOtherTag = otherTags.reduce((max, tag) =>
  5697. tag.weight > max.weight ? tag : max
  5698. );
  5699. const maxTagIndex = tags.findIndex(t => t.id === maxOtherTag.id);
  5700. tags[maxTagIndex].weight += diff;
  5701. }
  5702. } else {
  5703. // 如果当前权重已经是100%,其他标签设为0
  5704. otherTags.forEach(tag => {
  5705. const tagIndex = tags.findIndex(t => t.id === tag.id);
  5706. tags[tagIndex].weight = 0;
  5707. });
  5708. }
  5709. }
  5710. };
  5711. // 获取总权重
  5712. const getTotalWeight = (): number => {
  5713. const tags = questionForm.competency_tags as CompetencyTagItem[];
  5714. return tags.reduce((total, tag) => total + (tag.weight || 0), 0);
  5715. };
  5716. // 平均分配权重
  5717. const distributeWeightsEvenly = () => {
  5718. const tags = questionForm.competency_tags as CompetencyTagItem[];
  5719. if (tags.length === 0) return;
  5720. const averageWeight = Math.floor(100 / tags.length);
  5721. const remainder = 100 % tags.length;
  5722. tags.forEach((tag, index) => {
  5723. tag.weight = averageWeight + (index < remainder ? 1 : 0);
  5724. });
  5725. };
  5726. const competencyTagsValue = computed({
  5727. get: () => getcompetency_tags(questionForm.competency_tags),
  5728. set: (value) => {
  5729. questionForm.competency_tags = value;
  5730. handleCompetencyTagsChange(value);
  5731. }
  5732. });
  5733. // 删除AI考察相关问题
  5734. const handleDeleteAIQuestions = async () => {
  5735. try {
  5736. // 获取当前职位下的所有AI生成的问题
  5737. const response = await GetPositionQuestions({
  5738. position_id: route.query.id,
  5739. tenant_id: Session.get('tenant_id'),
  5740. is_ai_generated: true // 只获取AI生成的问题
  5741. });
  5742. if (response && response.data && response.data.length > 0) {
  5743. // 批量解绑AI生成的问题
  5744. await BatchUnbind({
  5745. position_id: route.query.id,
  5746. question_id: response.data.map((item: any) => item.id),
  5747. tenant_id:Session.get('tenant_id')
  5748. });
  5749. // 更新配置
  5750. if (getConfigId.value > 0) {
  5751. await UpdateConfig({
  5752. id: getConfigId.value,
  5753. enable_ai_questions: false
  5754. });
  5755. }
  5756. ElMessage.success('AI考察问题已删除');
  5757. }
  5758. } catch (error) {
  5759. console.error('删除AI考察问题失败:', error);
  5760. ElMessage.error('删除AI考察问题失败');
  5761. }
  5762. };
  5763. // 在setup部分添加以下代码
  5764. // ... existing code ...
  5765. // 监听enable_open_questions的变化
  5766. watch(
  5767. () => fieldConfig.question_form_switches.enable_open_questions,
  5768. (newVal) => {
  5769. if (!newVal) {
  5770. // 如果禁用了AI考察,隐藏相关内容
  5771. recruitmentProcess.forEach((process) => {
  5772. if (process.type === 'ai_interview') {
  5773. process.visible = false;
  5774. }
  5775. });
  5776. } else {
  5777. // 如果启用了AI考察,显示相关内容
  5778. recruitmentProcess.forEach((process) => {
  5779. if (process.type === 'ai_interview') {
  5780. process.visible = true;
  5781. }
  5782. });
  5783. }
  5784. },
  5785. { immediate: true }
  5786. );
  5787. // 修改添加AI考察的方法
  5788. const addAIInterview = () => {
  5789. // 添加AI考察时,自动启用enable_open_questions
  5790. UpdateConfig({
  5791. id: route.query.id,
  5792. question_form_switches: {
  5793. ...fieldConfig.question_form_switches,
  5794. enable_open_questions: true
  5795. }
  5796. }).then((res:any) => {
  5797. if(res.code == 2000) {
  5798. // 添加AI考察的其他逻辑...
  5799. }
  5800. });
  5801. };
  5802. // ... existing code ...
  5803. // 新增对话框控制变量
  5804. const showCommonSenseDialog = ref(false);
  5805. const showPsychologicalDialog = ref(false);
  5806. const showPostRenderDialog = ref(false);
  5807. // 在setup中添加相关变量和方法
  5808. const bodyDetectionConfigVisible = ref(false)
  5809. const bodyDetectionConfig = ref({
  5810. duration: 5,
  5811. detectionItems: ['face', 'pose'],
  5812. promptText: '请按照提示完成相应的动作,系统将自动进行检测。'
  5813. })
  5814. // 打开肢体检测配置
  5815. const openBodyDetectionConfig = () => {
  5816. bodyDetectionConfigVisible.value = true
  5817. }
  5818. // 取消肢体检测配置
  5819. const cancelBodyDetectionConfig = () => {
  5820. bodyDetectionConfigVisible.value = false
  5821. }
  5822. // 保存肢体检测配置
  5823. const saveBodyDetectionConfig = async () => {
  5824. try {
  5825. // TODO: 调用API保存配置
  5826. await saveProcessConfig({
  5827. position_id: route.params.id,
  5828. process_type: 'body_detection',
  5829. config: bodyDetectionConfig.value
  5830. })
  5831. ElMessage.success('配置保存成功')
  5832. bodyDetectionConfigVisible.value = false
  5833. } catch (error) {
  5834. console.error('保存肢体检测配置失败:', error)
  5835. ElMessage.error('配置保存失败')
  5836. }
  5837. }
  5838. // 在handleProcessConfig方法中添加肢体检测的处理
  5839. const handleProcessConfig = (type: string) => {
  5840. switch (type) {
  5841. // ... existing code ...
  5842. case 'body_detection':
  5843. openBodyDetectionConfig()
  5844. break
  5845. // ... existing code ...
  5846. }
  5847. }
  5848. /* 树状 */
  5849. const documentTreeData = ref([]);
  5850. const treeListRef = ref();
  5851. const handleTreeClick = (data: any) => {
  5852. console.log(data)
  5853. // 获取点击的节点信息
  5854. const { firstLevel, secondLevel, currentNode } = data;
  5855. // 如果点击的是二级节点(标签)
  5856. if (secondLevel) {
  5857. // 根据标签ID搜索题目
  5858. GetQuestionList({
  5859. page: 1,
  5860. limit: 20,
  5861. question_tags: secondLevel.id.replace('tag_', ''), // 移除前缀获取真实ID
  5862. question_form: questionListQuery.question_form
  5863. }).then((res: any) => {
  5864. if (res.data) {
  5865. questionList.value = res.data.items;
  5866. questionListpage.page = res.data.page;
  5867. questionListpage.pageSize = res.data.limit;
  5868. totalQuestions2.value = res.data.total;
  5869. }
  5870. });
  5871. }
  5872. // 如果点击的是一级节点(分类)
  5873. else if (firstLevel) {
  5874. // 根据分类ID搜索题目
  5875. GetQuestionList({
  5876. page: 1,
  5877. limit: 20,
  5878. question_category: firstLevel.id.replace('category_', ''), // 移除前缀获取真实ID
  5879. question_form: questionListQuery.question_form
  5880. }).then((res: any) => {
  5881. if (res.data) {
  5882. questionList.value = res.data.items;
  5883. questionListpage.page = res.data.page;
  5884. questionListpage.pageSize = res.data.limit;
  5885. totalQuestions2.value = res.data.total;
  5886. }
  5887. });
  5888. }
  5889. }
  5890. const handleUpdateDocument = (data: any) => {
  5891. console.log(data)
  5892. }
  5893. const handleDeleteDocument = (data: any) => {
  5894. console.log(data)
  5895. }
  5896. // 获取文档树数据
  5897. const getTreeData = () => {
  5898. GetDocumentTree({}).then((ret: any) => {
  5899. console.log('ret', ret);
  5900. const responseData = ret.data;
  5901. GetCategoryList({}).then((res: any) => {
  5902. console.log('res', res);
  5903. const categoryList = res.data.items.filter((item: any) =>
  5904. !['技术能力', '服务意识', '职业素质','基本常识','色盲检测','内容铺垫'].includes(item.name)
  5905. );
  5906. GetTagList({}).then((res: any) => {
  5907. console.log('res', res);
  5908. const tagList = res.data.items;
  5909. // 创建根节点
  5910. const rootNode = [
  5911. /* {
  5912. id: 'root',
  5913. title: '职位开放题',
  5914. children: responseData.map((item: any) => ({
  5915. ...item,
  5916. id: `open_${item.id}`,
  5917. title: item.name || item.title,
  5918. question_type: 'open',
  5919. chinese_explanation: item.chinese_explanation || ''
  5920. }))
  5921. },
  5922. {
  5923. id: 'professional_questions',
  5924. title: '专业考察题库',
  5925. children: responseData.map((item: any) => ({
  5926. ...item,
  5927. id: `prof_${item.id}`,
  5928. title: item.name || item.title,
  5929. question_type: 'professional',
  5930. chinese_explanation: item.chinese_explanation || ''
  5931. }))
  5932. }, */
  5933. ...categoryList.map((item: any) => ({
  5934. id: `category_${item.id}`,
  5935. title: item.name,
  5936. children: tagList.filter((tag: any) => tag.category_id === item.id).map((tag: any) => ({
  5937. id: `tag_${tag.id}`,
  5938. title: tag.name,
  5939. chinese_explanation: tag.chinese_explanation || ''
  5940. }))
  5941. }))
  5942. ];
  5943. documentTreeData.value = rootNode;
  5944. });
  5945. });
  5946. });
  5947. };
  5948. /* 得分题 */
  5949. const treeData = ref([]);
  5950. const defaultProps = {
  5951. children: 'children',
  5952. label: 'title'
  5953. }
  5954. const handleNodeClick = async (data: any) => {
  5955. try {
  5956. // 如果点击的是分类节点(没有 tag_ 前缀的 id)
  5957. if (data.id.startsWith('category_')) {
  5958. const categoryId = data.id.replace('category_', '');
  5959. const response = await GetQuestionList({
  5960. page: 1,
  5961. limit: 1000, // 设置较大的限制以获取所有题目
  5962. question_category: categoryId,
  5963. question_form: questionListQuery.question_form
  5964. });
  5965. if (response && response.data) {
  5966. // 更新题目列表显示
  5967. questionList.value = response.data.items;
  5968. questionListpage.page = response.data.page;
  5969. questionListpage.pageSize = response.data.limit;
  5970. totalQuestions2.value = response.data.total;
  5971. // 自动选中所有题目
  5972. const table = document.querySelector('.el-table__header-wrapper');
  5973. if (table) {
  5974. const checkAll = table.querySelector('.el-checkbox');
  5975. if (checkAll) {
  5976. (checkAll as any).__vueParentComponent.emit('change', true);
  5977. }
  5978. }
  5979. // 更新选中的题目列表
  5980. selectedQuestions.value = response.data.items;
  5981. }
  5982. }
  5983. // 如果点击的是标签节点
  5984. else if (data.id.startsWith('tag_')) {
  5985. const tagId = data.id.replace('tag_', '');
  5986. const response = await GetQuestionList({
  5987. page: 1,
  5988. limit: 1000,
  5989. question_tags: tagId,
  5990. question_form: questionListQuery.question_form
  5991. });
  5992. if (response && response.data) {
  5993. // 更新题目列表显示
  5994. questionList.value = response.data.items;
  5995. questionListpage.page = response.data.page;
  5996. questionListpage.pageSize = response.data.limit;
  5997. totalQuestions2.value = response.data.total;
  5998. // 自动选中所有题目
  5999. const table = document.querySelector('.el-table__header-wrapper');
  6000. if (table) {
  6001. const checkAll = table.querySelector('.el-checkbox');
  6002. if (checkAll) {
  6003. (checkAll as any).__vueParentComponent.emit('change', true);
  6004. }
  6005. }
  6006. // 更新选中的题目列表
  6007. selectedQuestions.value = response.data.items;
  6008. }
  6009. }
  6010. } catch (error) {
  6011. console.error('获取题目列表失败:', error);
  6012. ElMessage.error('获取题目列表失败');
  6013. }
  6014. }
  6015. const getDFTreeData = () => {
  6016. GetDocumentTree({}).then((ret: any) => {
  6017. console.log('ret', ret);
  6018. const responseData = ret.data;
  6019. GetCategoryList({}).then((res: any) => {
  6020. console.log('res', res);
  6021. const categoryList = res.data.items.filter((item: any) =>
  6022. !['技术能力', '服务意识', '职业素质','基本常识','色盲检测','内容铺垫','红线题','健康情况','综合素质题'].includes(item.name)
  6023. );
  6024. GetTagList({}).then((res: any) => {
  6025. console.log('res', res);
  6026. const tagList = res.data.items;
  6027. // 创建根节点
  6028. const rootNode = [
  6029. ...categoryList.map((item: any) => ({
  6030. id: `category_${item.id}`,
  6031. title: item.name,
  6032. children: tagList.filter((tag: any) => tag.category_id === item.id).map((tag: any) => ({
  6033. id: `tag_${tag.id}`,
  6034. title: tag.name,
  6035. chinese_explanation: tag.chinese_explanation || ''
  6036. }))
  6037. }))
  6038. ];
  6039. treeData.value = rootNode;
  6040. });
  6041. });
  6042. });
  6043. }
  6044. </script>
  6045. <style scoped>
  6046. @import './index.css';
  6047. </style>
  6048. <style lang="scss" scoped>
  6049. /* 修改 checkbox 选中颜色 */
  6050. :deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
  6051. background-color: #0419a3 !important; /* 选中背景色 */
  6052. border-color: #0419a3 !important; /* 选中边框色 */
  6053. }
  6054. /* 修改 checkbox 选中时的勾选标记颜色 */
  6055. :deep(.el-checkbox__input.is-checked .el-checkbox__inner::after) {
  6056. border-color: #ffffff !important; /* 勾选标记颜色,通常为白色 */
  6057. }
  6058. /* 修改 checkbox hover 状态颜色 */
  6059. :deep(.el-checkbox__inner:hover) {
  6060. border-color: #0419a3 !important;
  6061. }
  6062. /* 修改 checkbox focus 状态颜色 */
  6063. :deep(.el-checkbox__input.is-focus .el-checkbox__inner) {
  6064. border-color: #0419a3 !important;
  6065. }
  6066. /* 如果需要修改半选中状态的颜色 */
  6067. :deep(.el-checkbox__input.is-indeterminate .el-checkbox__inner) {
  6068. background-color: #0419a3 !important;
  6069. border-color: #0419a3 !important;
  6070. }
  6071. /* 为特定的 checkbox 组件自定义样式 */
  6072. :deep(.custom-checkbox .el-checkbox__input.is-checked .el-checkbox__inner) {
  6073. background-color: #548235 !important;
  6074. border-color: #548235 !important;
  6075. }
  6076. :deep(.custom-checkbox .el-checkbox__inner:hover) {
  6077. border-color: #0419a3 !important;
  6078. }
  6079. /* 自定义维度标签样式 */
  6080. .custom-tag {
  6081. display: inline-block;
  6082. background-color: #409eff;
  6083. color: white;
  6084. font-size: 10px;
  6085. padding: 2px 6px;
  6086. border-radius: 4px;
  6087. margin-left: 8px;
  6088. font-weight: 500;
  6089. transform: scale(0.8);
  6090. transform-origin: left center;
  6091. }
  6092. /* 自定义维度项容器样式 */
  6093. .custom-dimension-item {
  6094. display: flex;
  6095. align-items: center;
  6096. justify-content: space-between;
  6097. position: relative;
  6098. padding: 4px 8px;
  6099. border-radius: 4px;
  6100. margin: 2px 0;
  6101. transition: background-color 0.2s;
  6102. &:hover {
  6103. background-color: #f5f7fa;
  6104. .delete-custom-btn {
  6105. opacity: 1;
  6106. }
  6107. }
  6108. .delete-custom-btn {
  6109. opacity: 0;
  6110. transition: opacity 0.2s;
  6111. color: #f56c6c;
  6112. margin-left: 8px;
  6113. padding: 4px;
  6114. &:hover {
  6115. background-color: #fef0f0;
  6116. color: #f56c6c;
  6117. }
  6118. }
  6119. }
  6120. /* 添加题目选择对话框样式 */
  6121. .question-select-dialog {
  6122. :deep(.el-dialog__body) {
  6123. padding: 20px;
  6124. }
  6125. }
  6126. .question-select-content {
  6127. .search-bar {
  6128. margin-bottom: 20px;
  6129. .search-inputs {
  6130. display: flex;
  6131. align-items: center;
  6132. gap: 10px;
  6133. }
  6134. }
  6135. .question-list {
  6136. margin-top: 20px;
  6137. }
  6138. .pagination-container {
  6139. margin-top: 20px;
  6140. display: flex;
  6141. justify-content: flex-end;
  6142. }
  6143. }
  6144. /* 添加拖拽相关样式 */
  6145. .question-card {
  6146. position: relative;
  6147. border: 1px solid #e4e7ed;
  6148. border-radius: 4px;
  6149. padding: 16px;
  6150. margin-bottom: 12px;
  6151. background: #fff;
  6152. transition: all 0.3s;
  6153. &:hover {
  6154. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  6155. }
  6156. }
  6157. /* 拖拽状态样式 */
  6158. .sortable-ghost {
  6159. opacity: 0.5;
  6160. background: #f5f7fa;
  6161. border: 2px dashed #c0c4cc;
  6162. }
  6163. // .sortable-chosen {
  6164. // cursor: grabbing;
  6165. // transform: rotate(5deg);
  6166. // }
  6167. .sortable-drag {
  6168. cursor: grabbing;
  6169. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  6170. transform: rotate(5deg);
  6171. }
  6172. .question-header {
  6173. display: flex;
  6174. justify-content: space-between;
  6175. align-items: flex-start;
  6176. margin-bottom: 12px;
  6177. .question-title {
  6178. display: flex;
  6179. align-items: flex-start;
  6180. gap: 12px;
  6181. flex: 1;
  6182. .title-content {
  6183. flex: 1;
  6184. display: flex;
  6185. align-items: center;
  6186. justify-content: space-between;
  6187. gap: 20px;
  6188. .question-content {
  6189. flex: 1;
  6190. display: flex;
  6191. align-items: flex-start;
  6192. gap: 10px;
  6193. flex-direction: column;
  6194. .question-number {
  6195. color: #909399;
  6196. font-size: 12px;
  6197. }
  6198. }
  6199. .question-tags {
  6200. margin-top: 20px;
  6201. flex-shrink: 0;
  6202. display: flex;
  6203. flex-wrap: nowrap;
  6204. gap: 8px;
  6205. align-items: center;
  6206. max-width: 300px;
  6207. .competency-tag {
  6208. margin: 0;
  6209. border-color: #ed7d31;
  6210. color: #fff;
  6211. background-color: #ed7d31;
  6212. font-size: 12px;
  6213. white-space: nowrap;
  6214. &:hover {
  6215. background-color: #ed7d31;
  6216. border-color: #ed7d31;
  6217. color: #fff;
  6218. }
  6219. }
  6220. .more-tags-indicator {
  6221. font-size: 12px;
  6222. color: #909399;
  6223. background-color: #f0f2f5;
  6224. padding: 2px 6px;
  6225. border-radius: 3px;
  6226. white-space: nowrap;
  6227. flex-shrink: 0;
  6228. &:hover {
  6229. color: #409eff;
  6230. background-color: #ecf5ff;
  6231. }
  6232. }
  6233. }
  6234. }
  6235. }
  6236. .question-actions {
  6237. display: flex;
  6238. gap: 4px;
  6239. }
  6240. }
  6241. .question-info {
  6242. .info-item {
  6243. margin-bottom: 8px;
  6244. &:last-child {
  6245. margin-bottom: 0;
  6246. }
  6247. .info-label {
  6248. color: #909399;
  6249. margin-right: 8px;
  6250. }
  6251. }
  6252. }
  6253. .field-config-panel {
  6254. background: #fff;
  6255. border-radius: 8px;
  6256. padding: 24px;
  6257. margin-bottom: 20px;
  6258. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  6259. .panel-header {
  6260. display: flex;
  6261. justify-content: space-between;
  6262. align-items: center;
  6263. margin-bottom: 24px;
  6264. h3 {
  6265. margin: 0;
  6266. font-size: 18px;
  6267. color: #303133;
  6268. font-weight: 600;
  6269. }
  6270. }
  6271. .section-title {
  6272. font-size: 16px;
  6273. font-weight: 500;
  6274. color: #303133;
  6275. margin: 24px 0 16px;
  6276. padding-left: 10px;
  6277. border-left: 4px solid #0419a3;
  6278. }
  6279. .field-config-item {
  6280. display: flex;
  6281. align-items: center;
  6282. justify-content: space-between;
  6283. margin-bottom: 12px;
  6284. padding: 12px 16px;
  6285. background: #f5f7fa;
  6286. border-radius: 6px;
  6287. transition: all 0.3s ease;
  6288. &:hover {
  6289. background: #eef1f6;
  6290. }
  6291. &.sub-field {
  6292. background: #fff;
  6293. border: 1px solid #e4e7ed;
  6294. margin-left: 12px;
  6295. &:hover {
  6296. border-color: #0419a3;
  6297. }
  6298. }
  6299. .field-label {
  6300. flex: 1;
  6301. font-size: 14px;
  6302. color: #606266;
  6303. display: flex;
  6304. align-items: center;
  6305. gap: 8px;
  6306. }
  6307. .required-tag {
  6308. font-size: 12px;
  6309. padding: 0 6px;
  6310. height: 20px;
  6311. line-height: 18px;
  6312. }
  6313. :deep(.el-switch.is-checked .el-switch__core) {
  6314. border-color: #0419a3;
  6315. background-color: #0419a3;
  6316. }
  6317. }
  6318. }
  6319. :deep(.el-switch.is-checked .el-switch__core) {
  6320. border-color: #0419a3;
  6321. background-color: #0419a3;
  6322. }
  6323. .el-row {
  6324. margin-bottom: 12px;
  6325. }
  6326. /* 题目开关样式 */
  6327. .question-switches {
  6328. display: flex;
  6329. align-items: center;
  6330. gap: 20px;
  6331. margin-left: auto;
  6332. padding-left: 20px;
  6333. border-left: 1px solid #e4e7ed;
  6334. .switch-item {
  6335. display: flex;
  6336. align-items: center;
  6337. gap: 8px;
  6338. .switch-label {
  6339. font-size: 14px;
  6340. color: #606266;
  6341. white-space: nowrap;
  6342. }
  6343. .el-input-number {
  6344. width: 100px;
  6345. }
  6346. }
  6347. }
  6348. /* 确保interview-actions布局正确 */
  6349. .interview-actions {
  6350. display: flex;
  6351. align-items: center;
  6352. gap: 12px;
  6353. margin-bottom: 16px;
  6354. .import-btn, .custom-btn {
  6355. flex-shrink: 0;
  6356. }
  6357. .import-btn,.custom-btn:hover{
  6358. color: #0419a3;
  6359. border-color: #0419a3;
  6360. }
  6361. }
  6362. /* 面试设置弹窗样式 */
  6363. .interview-settings-dialog {
  6364. :deep(.el-dialog__body) {
  6365. padding: 20px;
  6366. }
  6367. }
  6368. .interview-settings-content {
  6369. .settings-section {
  6370. margin-bottom: 24px;
  6371. &:last-child {
  6372. margin-bottom: 0;
  6373. }
  6374. .section-header {
  6375. margin-bottom: 16px;
  6376. .section-title {
  6377. font-size: 16px;
  6378. font-weight: 500;
  6379. color: #303133;
  6380. padding-left: 10px;
  6381. border-left: 4px solid #0419a3;
  6382. }
  6383. }
  6384. .setting-item {
  6385. display: flex;
  6386. align-items: center;
  6387. justify-content: space-between;
  6388. padding: 0 30px;
  6389. border-radius: 20px;
  6390. border: 1px solid #f0f0f0;
  6391. .setting-label{
  6392. min-width: 150px;
  6393. text-align: justify;
  6394. text-align-last: justify;
  6395. text-justify: inter-character;
  6396. }
  6397. &:last-child {
  6398. border-bottom: none;
  6399. }
  6400. .setting-info {
  6401. display: flex;
  6402. align-items: center;
  6403. flex: 1;
  6404. // margin-right: 16px;
  6405. .setting-name {
  6406. width: 150px;
  6407. font-size: 14px;
  6408. font-weight: 500;
  6409. margin-right: 100px;
  6410. color: #808080;
  6411. display: block;
  6412. margin-bottom: 4px;
  6413. text-align: justify;
  6414. text-align-last: justify;
  6415. text-justify: inter-character;
  6416. }
  6417. .setting-desc {
  6418. width: 390px;
  6419. font-size: 12px;
  6420. color: #909399;
  6421. margin: 0;
  6422. line-height: 1.4;
  6423. text-align: justify;
  6424. text-align-last: justify;
  6425. text-justify: inter-character;
  6426. }
  6427. }
  6428. :deep(.el-switch.is-checked .el-switch__core) {
  6429. border-color: #0419a3;
  6430. background-color: #0419a3;
  6431. }
  6432. .switch-desc {
  6433. font-size: 12px;
  6434. color: #909399;
  6435. margin-left: 8px;
  6436. }
  6437. .setting-desc-container {
  6438. display: flex;
  6439. align-items: center;
  6440. justify-content: space-between;
  6441. gap: 8px;
  6442. /* flex: 1; */
  6443. width: 80%;
  6444. .setting-desc {
  6445. width:390px;
  6446. margin: 0;
  6447. }
  6448. .edit-desc-btn {
  6449. padding: 4px;
  6450. min-height: auto;
  6451. &:hover {
  6452. color: #0419a3;
  6453. }
  6454. }
  6455. }
  6456. .desc-edit-container {
  6457. display: flex;
  6458. align-items: center;
  6459. justify-content: space-between;
  6460. flex: 1;
  6461. .desc-edit-actions {
  6462. display: flex;
  6463. gap: 8px;
  6464. margin-left: 15px;
  6465. margin-top: 8px;
  6466. justify-content: flex-end;
  6467. }
  6468. }
  6469. }
  6470. }
  6471. }
  6472. .avatar-name {
  6473. margin-top: 8px;
  6474. font-size: 14px;
  6475. color: #333;
  6476. width: 100%;
  6477. text-align: center;
  6478. overflow: hidden;
  6479. white-space: nowrap;
  6480. text-overflow: ellipsis;
  6481. }
  6482. .avatar-wrapper {
  6483. display: flex;
  6484. flex-direction: column;
  6485. align-items: center;
  6486. width: 80px; // 设置一个固定宽度
  6487. }
  6488. .question-form {
  6489. .form-item {
  6490. margin-bottom: 20px;
  6491. .form-label {
  6492. font-size: 14px;
  6493. color: #333;
  6494. margin-bottom: 8px;
  6495. font-weight: 500;
  6496. .required {
  6497. color: #f56c6c;
  6498. margin-left: 4px;
  6499. }
  6500. }
  6501. .form-tip {
  6502. font-size: 12px;
  6503. color: #999;
  6504. margin-top: 4px;
  6505. }
  6506. .competency-config {
  6507. border: 1px solid #dcdfe6;
  6508. border-radius: 4px;
  6509. padding: 12px;
  6510. .config-row {
  6511. display: flex;
  6512. align-items: center;
  6513. margin-bottom: 8px;
  6514. &:last-child {
  6515. margin-bottom: 0;
  6516. }
  6517. .config-label {
  6518. flex: 1;
  6519. font-size: 14px;
  6520. color: #666;
  6521. text-align: center;
  6522. }
  6523. .tag-name {
  6524. flex: 1;
  6525. font-size: 14px;
  6526. color: #333;
  6527. text-align: center;
  6528. }
  6529. .el-input-number {
  6530. flex: 1;
  6531. margin: 0 10px;
  6532. }
  6533. }
  6534. }
  6535. .full-width {
  6536. width: 100%;
  6537. }
  6538. }
  6539. }
  6540. /* 标题和按钮左右布局样式 */
  6541. .header-row {
  6542. display: flex;
  6543. justify-content: space-between;
  6544. align-items: center;
  6545. margin-bottom: 16px;
  6546. h3 {
  6547. margin: 0;
  6548. flex: 1;
  6549. }
  6550. .right_btn {
  6551. flex-shrink: 0;
  6552. }
  6553. }
  6554. /* QuestionBankForm 对话框样式 */
  6555. :deep(.question-bank-form-dialog) {
  6556. .el-dialog__header {
  6557. padding: 20px 20px 10px 20px;
  6558. border-bottom: 1px solid #ebeef5;
  6559. .el-dialog__title {
  6560. font-size: 18px;
  6561. font-weight: 600;
  6562. color: #303133;
  6563. }
  6564. }
  6565. .el-dialog__body {
  6566. padding: 0;
  6567. max-height: 70vh;
  6568. overflow-y: auto;
  6569. }
  6570. .el-dialog__footer {
  6571. padding: 10px 20px 20px 20px;
  6572. border-top: 1px solid #ebeef5;
  6573. }
  6574. }
  6575. /* 权重配置增强样式 */
  6576. .competency-config {
  6577. .config-row {
  6578. &:first-child {
  6579. background-color: #f8f9fa;
  6580. border-radius: 4px 4px 0 0;
  6581. font-weight: 600;
  6582. color: #409eff;
  6583. }
  6584. /* 平均分配按钮样式 */
  6585. .el-button--text {
  6586. padding: 4px 8px;
  6587. margin-left: auto;
  6588. font-size: 12px;
  6589. &:hover {
  6590. background-color: #ecf5ff;
  6591. color: #409eff;
  6592. }
  6593. }
  6594. }
  6595. .tag-name {
  6596. font-weight: 500;
  6597. color: #303133;
  6598. }
  6599. }
  6600. .weight-sum {
  6601. font-weight: bold;
  6602. color: #67c23a;
  6603. margin-left: 8px;
  6604. font-size: 13px;
  6605. &.weight-error {
  6606. color: #f56c6c;
  6607. animation: shake 0.5s ease-in-out;
  6608. }
  6609. }
  6610. /* 输入框优化样式 */
  6611. :deep(.el-input-number) {
  6612. .el-input__inner {
  6613. text-align: center;
  6614. font-weight: 500;
  6615. }
  6616. &.is-focus .el-input__inner {
  6617. border-color: #409eff;
  6618. box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
  6619. }
  6620. }
  6621. /* 权重错误提示动画 */
  6622. @keyframes shake {
  6623. 0%, 100% { transform: translateX(0); }
  6624. 25% { transform: translateX(-2px); }
  6625. 75% { transform: translateX(2px); }
  6626. }
  6627. /* 权重配置增强样式 */
  6628. .competency-config {
  6629. .config-row {
  6630. &:first-child {
  6631. background-color: #f8f9fa;
  6632. border-radius: 4px 4px 0 0;
  6633. font-weight: 600;
  6634. color: #409eff;
  6635. }
  6636. /* 平均分配按钮样式 */
  6637. .el-button--text {
  6638. padding: 4px 8px;
  6639. margin-left: auto;
  6640. font-size: 12px;
  6641. &:hover {
  6642. background-color: #ecf5ff;
  6643. color: #409eff;
  6644. }
  6645. }
  6646. }
  6647. .tag-name {
  6648. font-weight: 500;
  6649. color: #303133;
  6650. }
  6651. }
  6652. .weight-sum {
  6653. font-weight: bold;
  6654. color: #67c23a;
  6655. margin-left: 8px;
  6656. font-size: 13px;
  6657. &.weight-error {
  6658. color: #f56c6c;
  6659. animation: shake 0.5s ease-in-out;
  6660. }
  6661. }
  6662. /* 输入框优化样式 */
  6663. :deep(.el-input-number) {
  6664. .el-input__inner {
  6665. text-align: center;
  6666. font-weight: 500;
  6667. }
  6668. &.is-focus .el-input__inner {
  6669. border-color: #409eff;
  6670. box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.2);
  6671. }
  6672. }
  6673. /* 权重错误提示动画 */
  6674. @keyframes shake {
  6675. 0%, 100% { transform: translateX(0); }
  6676. 25% { transform: translateX(-2px); }
  6677. 75% { transform: translateX(2px); }
  6678. }
  6679. </style>