index.vue 176 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468
  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 competencyTags"
  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="handleEditUsage">编辑</el-button>
  316. </div>
  317. <div class="usage-content">
  318. <div class="usage-label">职位用途</div>
  319. <div class="usage-value">正式招聘</div>
  320. </div>
  321. </el-card>
  322. <el-card class="status-card">
  323. <div class="section-title">
  324. <div class="section-line"></div>
  325. <span>招聘流程</span>
  326. <el-button type="text" class="edit-btn" @click="handleEditProcess">设置流程</el-button>
  327. </div>
  328. <div class="process-steps">
  329. <div
  330. v-for="(step, index) in recruitmentProcess"
  331. :key="step.id"
  332. class="process-step"
  333. :class="{ 'disabled': !step.active }"
  334. >
  335. <div class="step-number">{{ index + 1 }}</div>
  336. <div class="step-content">
  337. <div class="step-title">{{ step.name }}</div>
  338. <!-- <div class="step-desc">{{ step.description }}</div> -->
  339. </div>
  340. </div>
  341. </div>
  342. </el-card>
  343. <el-card class="status-card">
  344. <div class="section-title">
  345. <div class="section-line"></div>
  346. <span>面试设置</span>
  347. <el-button type="text" class="edit-btn" @click="handleEditInterview">编辑</el-button>
  348. </div>
  349. </el-card>
  350. </div>
  351. </div>
  352. <!-- 添加招聘流程编辑对话框 -->
  353. <el-dialog
  354. title="设置招聘流程"
  355. v-model="showProcessDialog"
  356. width="500px"
  357. :close-on-click-modal="false"
  358. >
  359. <div class="process-dialog-content">
  360. <div v-for="(step, index) in recruitmentProcess" :key="step.id">
  361. <!-- 添加在每个步骤上方的加号按钮 -->
  362. <div class="add-process-btn-top" v-if="index === 0 || true">
  363. <!-- <el-button type="text" @click="showStepOptions(index, $event)">
  364. <el-icon><Plus /></el-icon>
  365. </el-button> -->
  366. </div>
  367. <div
  368. class="process-edit-item"
  369. :class="{ 'highlight': step.active }"
  370. >
  371. <div class="process-number">{{ index + 1 }}</div>
  372. <div class="process-edit-content">
  373. <div>{{ step.name }}</div>
  374. <div class="process-edit-desc">{{ step.description }}</div>
  375. </div><!-- v-if="step.name=='AI视频'" -->
  376. <div class="process-edit-btn">
  377. <el-button
  378. type="info"
  379. size="small"
  380. plain
  381. @click="editAIVideo(step)"
  382. >
  383. 修改
  384. </el-button>
  385. <el-button
  386. type="danger"
  387. size="small"
  388. plain
  389. style="margin-top: 10px;margin-left: 0px;"
  390. @click="deleteProcessStep(index)"
  391. >
  392. 删除
  393. </el-button>
  394. </div>
  395. </div>
  396. </div>
  397. <!-- 最后一个步骤下方的加号按钮 -->
  398. <div class="add-process-btn">
  399. <!-- <el-button type="text" @click="showStepOptions(recruitmentProcess.length, $event)">
  400. <el-icon><Plus /></el-icon>
  401. </el-button> -->
  402. </div>
  403. </div>
  404. <!-- 添加选项菜单 -->
  405. <div
  406. v-if="showOptionsMenu"
  407. class="process-options-menu"
  408. :style="{ top: menuPosition.top, left: menuPosition.left }"
  409. @click.stop
  410. >
  411. <div
  412. v-for="option in processStepOptions"
  413. :key="option.value"
  414. class="process-option-item"
  415. @click="addSelectedStepType(option.value, option.label)"
  416. >
  417. {{ option.label }}
  418. </div>
  419. </div>
  420. <template #footer>
  421. <span class="dialog-footer">
  422. <el-button @click="cancelEditProcess">取消</el-button>
  423. <el-button type="primary" @click="saveProcess">确定</el-button>
  424. </span>
  425. </template>
  426. </el-dialog>
  427. <!-- AI视频配置对话框 -->
  428. <el-drawer
  429. title="AI视频"
  430. v-model="showAIVideoDialog"
  431. direction="rtl"
  432. size="60%"
  433. :close-on-click-modal="false"
  434. class="ai-video-drawer"
  435. :destroy-on-close="false"
  436. >
  437. <!-- 步骤指示器 -->
  438. <div class="ai-video-steps">
  439. <div class="step-item" :class="{ 'active': currentStep === 1 }" @click="jumpToStep(1)">
  440. <div class="step-number">1</div>
  441. <div class="step-title" :class="{ 'active-title': currentStep === 1 }">考察能力</div>
  442. </div>
  443. <div class="step-line" :class="{ 'active-line': currentStep >= 2 }"></div>
  444. <div class="step-item" :class="{ 'active': currentStep === 2 }" @click="jumpToStep(2)">
  445. <div class="step-number">2</div>
  446. <div class="step-title" :class="{ 'active-title': currentStep === 2 }">面试题目</div>
  447. </div>
  448. <div class="step-line" :class="{ 'active-line': currentStep >= 3 }"></div>
  449. <div class="step-item" :class="{ 'active': currentStep === 3 }" @click="jumpToStep(3)">
  450. <div class="step-number">3</div>
  451. <div class="step-title" :class="{ 'active-title': currentStep === 3 }">系统设置</div>
  452. </div>
  453. </div>
  454. <!-- 步骤1:考察能力 -->
  455. <div v-if="currentStep === 1" class="ai-video-content" v-loading="competencyLoading" element-loading-text="正在生成能力标签...">
  456. <div class="ai-video-options">
  457. <div class="ai-video-options-header">
  458. <div class="ai-video-options-header-title">
  459. <span>AI根据岗位信息生成的能力,创建完步骤后,会自动将选择的新智能能力加入到该职位的考察能力列表中。</span>
  460. </div>
  461. <div class="right_btn">
  462. <el-button type="primary" class="custom-btn" plain size="small" @click="handleAddCompetency">重新生成</el-button>
  463. </div>
  464. </div>
  465. <!-- <p class="option-tip">AI根据岗位信息生成的能力,创建完步骤后,会自动将选择的新智能能力加入到该职位的考察能力列表中。</p> -->
  466. <!-- <div class="new-feature-tip">
  467. 下面是奇才智能算法推荐的胜任力考核维度,请结合您的需求增删,确认后点击「下一步」出题
  468. <span class="new-tag">NEW</span>
  469. AI根据岗位信息生成的能力,创建完步骤后,会自动将选择的新智能能力加入到该职位的考察能力列表中。
  470. </div> -->
  471. <!-- 推荐的考核维度 -->
  472. <div class="recommended-dimensions">
  473. <!-- <h3>推荐考核维度</h3> -->
  474. <div class="dimension-grid" >
  475. <el-checkbox
  476. v-for="item in competencyTags.slice(0,10)"
  477. :key="item.id"
  478. v-model="item.selected"
  479. @change="(val: boolean) => handleCompetencyChange(item, val)"
  480. class="custom-checkbox"
  481. >
  482. <div class="ability-label">
  483. <span>{{ item.name }}</span>
  484. <img src="../../../assets/sheng.png" alt="" class="sheng">
  485. </div>
  486. </el-checkbox>
  487. </div>
  488. </div>
  489. <!-- 备选考核维度 -->
  490. <div class="optional-dimensions">
  491. <h3 style="color: #808080;">备选考核维度</h3>
  492. <div class="dimension-grid">
  493. <el-checkbox
  494. v-for="item in competencyTags.slice(10,20)"
  495. :key="item.id"
  496. v-model="item.selected"
  497. @change="(val: boolean) => handleCompetencyChange(item, val)"
  498. class="custom-checkbox">
  499. <div class="ability-label">
  500. <span>{{ item.name }}</span>
  501. <img src="../../../assets/sheng.png" alt="" class="sheng">
  502. <!-- <el-tooltip content="考察候选人的XXXX能力" placement="top">
  503. <el-icon><QuestionFilled /></el-icon>
  504. </el-tooltip> -->
  505. </div>
  506. </el-checkbox>
  507. <!-- 可以添加更多备选维度 -->
  508. </div>
  509. </div>
  510. <!-- 自定义维度 -->
  511. <div class="custom-dimensions">
  512. <h3 style="color: #808080;">自定义维度</h3>
  513. <div class="dimension-form">
  514. <div class="dimension-row">
  515. <div class="dimension-input">
  516. <!-- <div class="input-label">维度名称:</div> -->
  517. <el-input style="width: 150px;" v-model="customDimension" placeholder="请输入维度名称" />
  518. </div>
  519. <div class="dimension-input">
  520. <div class="input-label">特征描述:</div>
  521. <el-input v-model="customDescription" style="width: 500px;" type="textarea" placeholder="请输入特征描述" />
  522. </div>
  523. </div>
  524. <div class="dimension-actions">
  525. <el-checkbox v-model="continueAdd" class="custom-checkbox">
  526. <div class="ability-label">
  527. <span>继续新增</span>
  528. </div>
  529. </el-checkbox>
  530. <!-- <el-button type="primary" @click="addDimension">添加</el-button> -->
  531. </div>
  532. </div>
  533. </div>
  534. </div>
  535. </div>
  536. <!-- 步骤2:面试题目 -->
  537. <div v-if="currentStep === 2" class="ai-video-content">
  538. <div class="interview-settings">
  539. <div class="interview-header">
  540. <div class="interview-actions">
  541. <el-button plain class="custom-btn" @click="handleImportQuestion"><!-- @click="handleAddQuestion" -->
  542. <el-icon><Plus /></el-icon>
  543. 自定义题目
  544. </el-button>
  545. <el-button plain class="custom-btn" >
  546. <el-icon><Document /></el-icon>
  547. 导入题目
  548. </el-button>
  549. <!-- 添加得分题和色盲题开关 -->
  550. <div class="question-switches">
  551. <!-- 添加题目数量控制 -->
  552. <div class="switch-item">
  553. <span class="switch-label">开放题数量</span>
  554. <el-input-number
  555. v-model="questionCountSettings.openQuestionsCount"
  556. :min="1"
  557. :max="20"
  558. size="small"
  559. @change="handleQuestionCountChange"
  560. />
  561. </div>
  562. <div class="switch-item">
  563. <span class="switch-label">选择题数量</span>
  564. <el-input-number
  565. v-model="questionCountSettings.choiceQuestionsCount"
  566. :min="1"
  567. :max="20"
  568. size="small"
  569. @change="handleQuestionCountChange"
  570. />
  571. </div>
  572. <div class="switch-item">
  573. <span class="switch-label">得分题</span>
  574. <el-switch
  575. style="margin-top:0px;"
  576. v-model="questionSettings.enableScoreQuestions"
  577. @change="handleScoreQuestionsChange"
  578. />
  579. </div>
  580. <div class="switch-item">
  581. <span class="switch-label">色盲题</span>
  582. <el-switch
  583. style="margin-top:0px;"
  584. v-model="questionSettings.enableColorBlindQuestions"
  585. @change="handleColorBlindQuestionsChange"
  586. />
  587. </div>
  588. </div>
  589. </div>
  590. <div class="interview-duration">
  591. <span>预计面试时长: </span>
  592. <span class="duration-value">0秒</span>
  593. <span class="duration-tip">拖动试题卡片可改变试题顺序</span>
  594. </div>
  595. </div>
  596. <!-- <div class="interview-mode">
  597. <span>面试问答方式: </span>
  598. <span class="mode-value">传统读题模式</span>
  599. <el-button type="primary" plain size="small" class="customize-btn">定制面试间</el-button>
  600. </div> -->
  601. <div class="interview-content">
  602. <div class="interview-questions-container" v-loading="autoGenerateLoading" element-loading-text="AI正在生成题目...">
  603. <div class="no-questions" v-if="chatQuestions.length === 0">
  604. <p>暂无题目</p>
  605. <p class="ai-tip">点击"AI自动组题"按钮</p>
  606. <p class="ai-tip">可根据您选择的能力类型一键组题</p>
  607. <el-button
  608. type="success"
  609. class="auto-generate-btn"
  610. :loading="autoGenerateLoading"
  611. @click="handleAutoGenerate"
  612. >
  613. AI自动组题
  614. </el-button>
  615. <el-button
  616. v-if="autoGenerateLoading && pollingController"
  617. type="warning"
  618. plain
  619. size="small"
  620. @click="handleCancelGenerate"
  621. style="margin-left: 10px;"
  622. >
  623. 取消生成
  624. </el-button>
  625. </div>
  626. <!-- :component-data="{
  627. tag: 'transition-group',
  628. name: !drag ? 'flip-list' : null
  629. }" -->
  630. <div class="question-list" v-else>
  631. <draggable
  632. v-model="chatQuestions"
  633. item-key="id"
  634. handle=".drag-handle"
  635. @start="handleDragStart"
  636. @end="handleDragEnd"
  637. animation="200"
  638. ghost-class="sortable-ghost"
  639. chosen-class="sortable-chosen"
  640. drag-class="sortable-drag"
  641. >
  642. <template #item="{ element }">
  643. <div class="question-card">
  644. <div class="drag-handle">
  645. <img src="../../../assets/dorp.png" alt="" class="dorp">
  646. </div>
  647. <div class="question-header">
  648. <div class="question-title">
  649. <div class="title-content">
  650. <div class="question-content">
  651. <span class="question-number">题目{{ chatQuestions.indexOf(element) + 1 }}</span>
  652. <span><span style="color: #0017ab;">{{ '「'+element.question_form_name +'」'}}</span>{{ element.title }}</span>
  653. </div>
  654. <div class="question-tags">
  655. <el-tag
  656. v-for="(tag, index) in (element.competency_tags || []).slice(0, 2)"
  657. :key="tag.id"
  658. effect="plain"
  659. class="competency-tag"
  660. size="small"
  661. >
  662. {{ tag.name }}
  663. </el-tag>
  664. <span
  665. v-if="(element.competency_tags || []).length > 2"
  666. class="more-tags-indicator"
  667. >
  668. +{{ (element.competency_tags || []).length - 2 }}
  669. </span>
  670. </div>
  671. </div>
  672. </div>
  673. <div class="question-actions" style="margin-top: 0px;">
  674. <el-button type="text" @click="editQuestion(chatQuestions.indexOf(element))">
  675. <el-icon><Edit /></el-icon>
  676. </el-button>
  677. <el-button type="text" @click="deleteQuestion(chatQuestions.indexOf(element))">
  678. <el-icon><Delete /></el-icon>
  679. </el-button>
  680. </div>
  681. </div>
  682. <div class="question-info">
  683. <div class="info-item">
  684. <!-- <span class="info-label">考察能力:</span> -->
  685. <span>{{ element.scoring_reference }}</span>
  686. </div>
  687. <!-- <div class="info-item">
  688. <span class="info-label">面试内容:</span>
  689. <span>{{ element.content }}</span>
  690. </div>
  691. <div class="info-item">
  692. <span class="info-label">对话目标:</span>
  693. <span>{{ element.target }}</span>
  694. </div> -->
  695. </div>
  696. <div class="question-actions" v-if="element.question_form==0">
  697. <!-- <div class="weight-control">
  698. <span class="weight-label">权重占比:</span>
  699. <el-input-number
  700. v-model="element.weight"
  701. :min="0"
  702. :max="100"
  703. :step="1"
  704. size="small"
  705. controls-position="right"
  706. >
  707. <template #suffix>%</template>
  708. </el-input-number>
  709. </div> -->
  710. <div class="answer-limit">
  711. <el-switch
  712. style="margin-top:0px; "
  713. v-model="element.enable_follow_up"
  714. @change="handleFollowUpChange"
  715. />
  716. <span class="answer-label">回答不充分追问</span>
  717. </div>
  718. <div class="answer-limit">
  719. <span class="answer-label">追问轮数</span>
  720. <el-select v-model="element.maxAnswers" size="small" placeholder="请选择">
  721. <el-option label="1次" :value="1" />
  722. <el-option label="2次" :value="2" />
  723. <el-option label="3次" :value="3" />
  724. </el-select>
  725. </div>
  726. </div>
  727. <div class="question-actions" v-if="element.question_form==1">
  728. <div class="answer-limit">
  729. <span class="answer-label">是否为红线题:</span>
  730. <el-select v-model="element.is_required_correct" @change="handleIsRequiredCorrectChange(element.id,element.is_required_correct)" size="small" placeholder="请选择">
  731. <el-option label="是" :value="true" />
  732. <el-option label="否" :value="false" />
  733. </el-select>
  734. </div>
  735. </div>
  736. </div>
  737. </template>
  738. </draggable>
  739. </div>
  740. </div>
  741. <div class="multi-dimension-questions">
  742. <div class="dimension-title">已选胜任力考核维度</div>
  743. <div class="dimension-list">
  744. <div v-for="(ability, index) in selectedAbilities" :key="ability.value" class="dimension-item">
  745. <div class="dimension-header">
  746. <div class="dimension-info">
  747. <span class="ability-name">{{ ability.label }}</span>
  748. <img src="../../../assets/sheng.png" alt=""class="sheng">
  749. </div>
  750. </div>
  751. <div class="dimension-content" @click="removeSelectedAbility(index)" title="点击删除此胜任力标签">
  752. <div class="ability-description">{{ "—" }}</div>
  753. <!-- <el-icon class="delete-icon"><Delete /></el-icon> -->
  754. </div>
  755. </div>
  756. </div>
  757. </div>
  758. </div>
  759. </div>
  760. </div>
  761. <!-- 步骤3:系统设置 -->
  762. <div v-if="currentStep === 3" class="ai-video-content">
  763. <div class="system-settings">
  764. <!-- 面试官形象设置 -->
  765. <div class="setting-section">
  766. <div class="section-header">请选择面试官形象</div>
  767. <div style=" display: flex;align-items: flex-start;">
  768. <div style="width: 100px;height: 170px;background-color: #f2f2f2; margin-right: 30px;border-radius: 10px;">
  769. <img v-if="interviewerAvatar" :src="interviewerAvatar" alt="" style="width: 100%;height: 100%;">
  770. </div>
  771. <div>
  772. <div class="interviewer-avatars">
  773. <div
  774. v-for="avatar in interviewerAvatars"
  775. :key="avatar.id"
  776. class="avatar-item"
  777. :class="{ active: selectedInterviewer.id === avatar.id }"
  778. @click="handleInterviewerSelect(avatar)"
  779. >
  780. <div class="avatar-wrapper">
  781. <div class="avatar-circle" :class="{ selected: selectedInterviewer.id === avatar.id }">
  782. <img :src="avatar.avatar_url || avatar.image" :alt="avatar.name" />
  783. </div>
  784. <div class="avatar-name" :title="avatar.name">{{ avatar.name }}</div>
  785. </div>
  786. </div>
  787. </div>
  788. <div>追问风格:
  789. <el-select v-model="settings.interruptionMode" placeholder="请选择">
  790. <el-option label="温和" value="1" />
  791. <el-option label="严厉" value="2" />
  792. <el-option label="严谨" value="3" />
  793. </el-select></div>
  794. </div>
  795. </div>
  796. <!-- 面试设置选项 -->
  797. <div class="interview-settings">
  798. <div class="setting-item">
  799. <div class="setting-label">「回答视频保留」</div>
  800. <div class="setting-desc">选取后,将在报告中展示候选人的回答视频</div>
  801. <el-switch
  802. v-model="settings.keepVideo"
  803. @change="(value: boolean) => handleSettingChange('keepVideo', value)"
  804. />
  805. </div>
  806. <div class="setting-item">
  807. <div class="setting-label">「中断后作答限制」</div>
  808. <div class="setting-options">
  809. <el-radio
  810. v-model="settings.interruptionMode"
  811. label="current"
  812. @change="handleSettingChange('interruptionMode', settings.interruptionMode)"
  813. >
  814. 从当前问题重新作答
  815. </el-radio>
  816. <el-radio
  817. v-model="settings.interruptionMode"
  818. label="previous"
  819. @change="handleSettingChange('interruptionMode', settings.interruptionMode)"
  820. >
  821. 从头作答
  822. </el-radio>
  823. </div>
  824. <div class="setting-desc"></div>
  825. </div>
  826. <div class="setting-item">
  827. <div class="setting-label">「智慧追问」</div>
  828. <div class="setting-desc">* 追问将结合候选人资料情况,综合分析发问</div>
  829. <el-switch
  830. v-model="settings.smartFollowUp"
  831. @change="(value: boolean) => handleSettingChange('smartFollowUp', value)"
  832. />
  833. </div>
  834. </div>
  835. </div>
  836. </div>
  837. </div>
  838. <template #footer>
  839. <div class="drawer-footer">
  840. <el-button v-if="currentStep > 1" size="small" @click="prevStep">上一步</el-button>
  841. <el-button @click="cancelAIVideoConfig" size="small">取消</el-button>
  842. <el-button v-if="currentStep < 3" type="primary" size="small" @click="nextStep" style="background-color: #0419a3;border-color: #0419a3;">下一步</el-button>
  843. <el-button v-else type="success" @click="finishConfig" size="small" style="background-color: #0419a3;border-color: #0419a3;">新增</el-button>
  844. </div>
  845. </template>
  846. </el-drawer>
  847. <!-- 在 template 中添加视频宣讲弹窗 -->
  848. <el-dialog
  849. title="新增视频宣讲"
  850. v-model="showVideoLectureDialog"
  851. width="35%"
  852. :close-on-click-modal="false"
  853. class="video-lecture-dialog"
  854. >
  855. <div class="video-lecture-form">
  856. <!-- <div class="form-item">
  857. <div class="form-label">步骤名称</div>
  858. <el-input
  859. v-model="videoLectureForm.title"
  860. placeholder="请输入步骤名称"
  861. maxlength="30"
  862. show-word-limit
  863. />
  864. </div> -->
  865. <div class="form-item">
  866. <div class="form-label">上传视频</div>
  867. <el-upload
  868. class="video-uploader"
  869. action="#"
  870. :auto-upload="false"
  871. :show-file-list="false"
  872. accept="video/*"
  873. >
  874. <div class="upload-area">
  875. <el-icon><Plus /></el-icon>
  876. <div class="upload-text">上传文件大小不超过500M</div>
  877. </div>
  878. </el-upload>
  879. </div>
  880. <div class="form-item">
  881. <div class="form-label">视频简介</div>
  882. <el-input
  883. v-model="videoLectureForm.description"
  884. type="textarea"
  885. rows="4"
  886. placeholder="视频简介会显示在视频下方的标题下方"
  887. maxlength="200"
  888. show-word-limit
  889. />
  890. </div>
  891. <div class="form-item">
  892. <div class="form-label">播放设置</div>
  893. <el-radio-group v-model="videoLectureForm.broadcastType">
  894. <el-radio label="required">必须看完</el-radio>
  895. <el-radio label="optional">看过即可</el-radio>
  896. </el-radio-group>
  897. </div>
  898. </div>
  899. <template #footer>
  900. <span class="dialog-footer">
  901. <el-button @click="cancelVideoLecture">取消</el-button>
  902. <el-button type="primary" @click="confirmVideoLecture">确认</el-button>
  903. </span>
  904. </template>
  905. </el-dialog>
  906. <!-- AI实时对话抽屉 -->
  907. <el-drawer
  908. title="AI实时对话"
  909. v-model="showAIChatDialog"
  910. direction="rtl"
  911. size="60%"
  912. :close-on-click-modal="false"
  913. class="ai-chat-drawer"
  914. :destroy-on-close="false"
  915. >
  916. <div class="ai-chat-content">
  917. <!-- AI实时对话的配置内容 -->
  918. <div class="chat-settings">
  919. <div class="section-title">
  920. <div class="section-line"></div>
  921. <span>对话设置</span>
  922. </div>
  923. <!-- 添加按钮组 -->
  924. <div class="chat-actions">
  925. <el-button type="primary" plain @click="handleAddQuestion">
  926. <el-icon><Plus /></el-icon>
  927. 添加问题
  928. </el-button>
  929. <el-button type="success" plain @click="handleImportQuestion">
  930. <el-icon><Document /></el-icon>
  931. 导入问题
  932. </el-button>
  933. </div>
  934. <!-- 添加问题列表容器 -->
  935. <div class="chat-questions">
  936. <div v-if="chatQuestions.length === 0" class="empty-questions">
  937. <p>暂无问题</p>
  938. <p class="tip-text">点击"添加问题"或"导入问题"添加面试问题</p>
  939. </div>
  940. <div v-else class="question-list">
  941. <draggable v-model="chatQuestions" item-key="id" handle=".drag-handle">
  942. <template #item="{ element, index }">
  943. {{ element }}
  944. <div class="question-card">
  945. <div class="question-header">
  946. <div class="question-title">
  947. <span class="question-number">题目{{ index + 1 }}</span>
  948. <span>{{ element.question }}</span>
  949. </div>
  950. <div class="question-actions">
  951. <div class="weight-control">
  952. <span class="weight-label">权重占比:</span>
  953. <el-input-number
  954. v-model="element.weight"
  955. :min="0"
  956. :max="100"
  957. :step="1"
  958. size="small"
  959. controls-position="right"
  960. >
  961. <template #suffix>%</template>
  962. </el-input-number>
  963. </div>
  964. <div class="answer-limit">
  965. <span class="answer-label">最多回答次数</span>
  966. <el-select v-model="element.maxAnswers" size="small" placeholder="请选择">
  967. <el-option label="1次" :value="1" />
  968. <el-option label="2次" :value="2" />
  969. <el-option label="3次" :value="3" />
  970. </el-select>
  971. </div>
  972. <el-button type="text" @click="editQuestion(index)">
  973. <el-icon><Edit /></el-icon>
  974. </el-button>
  975. <el-button type="text" @click="deleteQuestion(index)">
  976. <el-icon><Delete /></el-icon>
  977. </el-button>
  978. </div>
  979. </div>
  980. <div class="question-info">
  981. <div class="info-item">
  982. <span class="info-label">考察能力:</span>
  983. <span>{{ element.ability }}</span>
  984. </div>
  985. <div class="info-item">
  986. <span class="info-label">面试内容:</span>
  987. <span>{{ element.content }}</span>
  988. </div>
  989. <div class="info-item">
  990. <span class="info-label">对话目标:</span>
  991. <span>{{ element.target }}</span>
  992. </div>
  993. </div>
  994. </div>
  995. </template>
  996. </draggable>
  997. </div>
  998. </div>
  999. </div>
  1000. </div>
  1001. <template #footer>
  1002. <div class="drawer-footer">
  1003. <el-button @click="cancelAIChatConfig">取消</el-button>
  1004. <el-button type="primary" @click="handleAIChatConfig">确认</el-button>
  1005. </div>
  1006. </template>
  1007. </el-drawer>
  1008. <!-- 在 template 中添加问题编辑弹框 -->
  1009. <el-dialog
  1010. title="编辑问题"
  1011. v-model="showQuestionDialog"
  1012. width="500px"
  1013. :close-on-click-modal="false"
  1014. class="question-dialog"
  1015. >
  1016. <div class="question-form">
  1017. <div class="form-item">
  1018. <div class="form-label">
  1019. 题目内容<span class="required">*</span>
  1020. </div>
  1021. <el-input
  1022. v-model="questionForm.content"
  1023. type="textarea"
  1024. rows="4"
  1025. placeholder="请描述一次你如何在紧迫的时间内完成一个复杂的后端开发任务的经历"
  1026. maxlength="300"
  1027. show-word-limit
  1028. />
  1029. </div>
  1030. <div class="form-item">
  1031. <div class="form-label">胜任力标签</div>
  1032. <el-select
  1033. v-model="questionForm.competencyTags"
  1034. placeholder="请选择胜任力标签"
  1035. class="full-width"
  1036. multiple
  1037. @change="handleCompetencyTagsChange"
  1038. >
  1039. <el-option
  1040. v-for="tag in competencyTagOptions"
  1041. :key="tag.value"
  1042. :label="tag.label"
  1043. :value="tag.value"
  1044. />
  1045. </el-select>
  1046. <div class="form-tip">选择胜任力标签和胜任力标签,可多选</div>
  1047. </div>
  1048. <div class="form-item">
  1049. <div class="form-label">
  1050. 胜任力配置
  1051. </div>
  1052. <div class="competency-config">
  1053. <div class="config-row">
  1054. <span class="config-label">标签</span>
  1055. <span class="config-label">权重</span>
  1056. <span class="config-label">级别</span>
  1057. </div>
  1058. <div class="config-row">
  1059. <span class="tag-name">时间管理</span>
  1060. <el-input-number v-model="questionForm.weight" :min="0" :max="100" :step="1" controls-position="right" /> %
  1061. <el-input-number v-model="questionForm.level" :min="1" :max="5" :step="1" controls-position="right" />
  1062. </div>
  1063. </div>
  1064. <div class="form-tip">配置各个胜任力标签的权重,总和需要100%</div>
  1065. </div>
  1066. <div class="form-item">
  1067. <div class="form-label">题目形式</div>
  1068. <el-select
  1069. v-model="questionForm.type"
  1070. placeholder="开放问题"
  1071. class="full-width"
  1072. @change="handleQuestionTypeChange"
  1073. >
  1074. <el-option label="开放问题" value="open" />
  1075. <el-option label="单选题" value="single" />
  1076. <el-option label="多选题" value="multiple" />
  1077. <el-option label="填空题" value="fill" />
  1078. <el-option label="自言语" value="self" />
  1079. </el-select>
  1080. <div class="form-tip">选择题目的形式:开放问题、单选题、多选题、填空题、自言语</div>
  1081. </div>
  1082. <div class="form-item">
  1083. <div class="form-label">适用职位</div>
  1084. <el-select
  1085. v-model="questionForm.position"
  1086. placeholder="请选择适用职位类型"
  1087. class="full-width"
  1088. multiple
  1089. >
  1090. <el-option
  1091. v-for="pos in positionOptions"
  1092. :key="pos.value"
  1093. :label="pos.label"
  1094. :value="pos.value"
  1095. />
  1096. </el-select>
  1097. <div class="form-tip">选择题目适用的职位类型,可多选</div>
  1098. </div>
  1099. <div class="form-item">
  1100. <div class="form-label">分类</div>
  1101. <el-select
  1102. v-model="questionForm.category"
  1103. placeholder="请选择题目分类"
  1104. class="full-width"
  1105. >
  1106. <el-option
  1107. v-for="cat in categoryOptions"
  1108. :key="cat.value"
  1109. :label="cat.label"
  1110. :value="cat.value"
  1111. />
  1112. </el-select>
  1113. <div class="form-tip">选择题目所属分类</div>
  1114. </div>
  1115. <div class="form-item">
  1116. <div class="form-label">标签</div>
  1117. <el-select
  1118. v-model="questionForm.tags"
  1119. placeholder="请选择标签"
  1120. class="full-width"
  1121. multiple
  1122. >
  1123. <el-option
  1124. v-for="tag in tagOptions"
  1125. :key="tag.value"
  1126. :label="tag.label"
  1127. :value="tag.value"
  1128. />
  1129. </el-select>
  1130. <div class="form-tip">选择题目相关标签,可多选</div>
  1131. </div>
  1132. <div class="form-item">
  1133. <div class="form-label">建议时长(秒)</div>
  1134. <el-input-number
  1135. v-model="questionForm.suggestedDuration"
  1136. :min="0"
  1137. :step="1"
  1138. controls-position="right"
  1139. placeholder="请输入建议回答时长"
  1140. class="full-width"
  1141. />
  1142. <div class="form-tip">建议回答题目的时长,单位为秒</div>
  1143. </div>
  1144. </div>
  1145. <template #footer>
  1146. <span class="dialog-footer">
  1147. <el-button @click="cancelAddQuestion">取消</el-button>
  1148. <el-button type="primary" @click="confirmAddQuestion">确认</el-button>
  1149. </span>
  1150. </template>
  1151. </el-dialog>
  1152. <!-- 添加题目选择对话框 -->
  1153. <el-dialog
  1154. title="选择题目"
  1155. v-model="showQuestionSelectDialog"
  1156. width="70%"
  1157. :close-on-click-modal="false"
  1158. class="question-select-dialog"
  1159. >
  1160. <div class="question-select-content">
  1161. <!-- 搜索栏 -->
  1162. <div class="search-bar">
  1163. <div class="search-inputs">
  1164. <el-input
  1165. v-model="questionSearchKeyword"
  1166. placeholder="请输入关键词搜索题目"
  1167. clearable
  1168. @clear="handleQuestionSearch"
  1169. @keyup.enter="handleQuestionSearch"
  1170. style="width: 300px; margin-right: 10px;"
  1171. >
  1172. <template #append>
  1173. <el-button @click="handleQuestionSearch">
  1174. <el-icon><Search /></el-icon>
  1175. </el-button>
  1176. </template>
  1177. </el-input>
  1178. <el-select
  1179. v-model="questionListQuery.question_form"
  1180. placeholder="题目类型"
  1181. clearable
  1182. @change="handleQuestionSearch"
  1183. style="width: 120px;"
  1184. >
  1185. <el-option label="开放问题" :value="0" />
  1186. <el-option label="单选题" :value="1" />
  1187. </el-select>
  1188. </div>
  1189. </div>
  1190. <!-- 题目列表 -->
  1191. <div class="question-lists">
  1192. <el-table
  1193. :data="questionList"
  1194. style="width: 100%"
  1195. @selection-change="handleQuestionSelectionChange"
  1196. >
  1197. <el-table-column type="selection" width="55" />
  1198. <el-table-column prop="question" label="题目标题" />
  1199. <el-table-column prop="question_form_name" label="题目类型" width="100"/>
  1200. <!-- <el-table-column prop="content" label="面试内容" show-overflow-tooltip />
  1201. <el-table-column prop="target" label="对话目标" show-overflow-tooltip /> -->
  1202. </el-table>
  1203. <!-- 分页 -->
  1204. <div class="pagination-container">
  1205. <el-pagination
  1206. v-model:current-page="questionListQuery.page"
  1207. v-model:page-size="questionListQuery.pageSize"
  1208. :total="totalQuestions"
  1209. :page-sizes="[10, 20, 50, 100]"
  1210. layout="total, sizes, prev, pager, next"
  1211. @size-change="handleQuestionSizeChange"
  1212. @current-change="handleQuestionPageChange"
  1213. />
  1214. </div>
  1215. </div>
  1216. </div>
  1217. <template #footer>
  1218. <span class="dialog-footer">
  1219. <el-button @click="cancelQuestionSelect">取消</el-button>
  1220. <el-button type="primary" @click="confirmQuestionSelect" style="background-color: #ed7d31;border-color: #ed7d31;">确定</el-button>
  1221. </span>
  1222. </template>
  1223. </el-dialog>
  1224. <!-- 修改资料收集对话框模板 -->
  1225. <el-dialog
  1226. title="资料收集"
  1227. v-model="showDataCollectionDialog"
  1228. width="900px"
  1229. :close-on-click-modal="false"
  1230. class="data-collection-dialog"
  1231. >
  1232. <div class="data-collection-form">
  1233. <!-- 字段配置面板 -->
  1234. <div class="field-config-panel">
  1235. <div class="panel-header">
  1236. <h3>字段显示配置</h3>
  1237. <!-- <el-button type="primary" size="small" @click="saveFieldConfig">保存配置</el-button> -->
  1238. </div>
  1239. <div class="field-config-list">
  1240. <!-- 基本信息部分 -->
  1241. <div class="section-title">基本信息</div>
  1242. <el-row :gutter="20">
  1243. <el-col :span="8" v-for="(field, key) in getBasicFields()" :key="key">
  1244. <div class="field-config-item">
  1245. <span class="field-label">
  1246. {{ field.label }}
  1247. <!-- <el-tag v-if="field.required" size="small" type="danger" class="required-tag">必填</el-tag> -->
  1248. </span>
  1249. <el-tooltip
  1250. content="切换显示/隐藏"
  1251. placement="top"
  1252. >
  1253. <el-switch
  1254. v-model="field.visible"
  1255. class="custom-switch"
  1256. />
  1257. </el-tooltip>
  1258. </div>
  1259. </el-col>
  1260. </el-row>
  1261. <!-- 家庭成员信息部分 -->
  1262. <div class="section-title">家庭成员信息</div>
  1263. <el-row :gutter="20">
  1264. <el-col :span="24">
  1265. <div class="field-config-item">
  1266. <span class="field-label">
  1267. {{ fieldConfig.family_member.label }}
  1268. <el-tag v-if="fieldConfig.family_member.visible" size="small" type="success">已启用</el-tag>
  1269. </span>
  1270. <el-switch v-model="fieldConfig.family_member.visible" class="custom-switch" />
  1271. </div>
  1272. </el-col>
  1273. </el-row>
  1274. <el-row :gutter="20" v-if="fieldConfig.family_member.visible">
  1275. <el-col :span="8" v-for="(field, key) in fieldConfig.family_member.fields" :key="key">
  1276. <div class="field-config-item sub-field">
  1277. <span class="field-label">
  1278. {{ field.label }}
  1279. <!-- <el-tag v-if="field.required" size="small" type="danger" class="required-tag">必填</el-tag> -->
  1280. </span>
  1281. <el-tooltip
  1282. content="切换显示/隐藏"
  1283. placement="top"
  1284. >
  1285. <el-switch
  1286. v-model="field.visible"
  1287. class="custom-switch"
  1288. />
  1289. </el-tooltip>
  1290. </div>
  1291. </el-col>
  1292. </el-row>
  1293. <!-- 教育经历部分 -->
  1294. <div class="section-title">教育经历</div>
  1295. <el-row :gutter="20">
  1296. <el-col :span="24">
  1297. <div class="field-config-item">
  1298. <span class="field-label">
  1299. {{ fieldConfig.education.label }}
  1300. <el-tag v-if="fieldConfig.education.visible" size="small" type="success">已启用</el-tag>
  1301. </span>
  1302. <el-switch v-model="fieldConfig.education.visible" class="custom-switch" />
  1303. </div>
  1304. </el-col>
  1305. </el-row>
  1306. <el-row :gutter="20" v-if="fieldConfig.education.visible">
  1307. <el-col :span="8" v-for="(field, key) in fieldConfig.education.fields" :key="key">
  1308. <div class="field-config-item sub-field">
  1309. <span class="field-label">
  1310. {{ field.label }}
  1311. <!-- <el-tag v-if="field.required" size="small" type="danger" class="required-tag">必填</el-tag> -->
  1312. </span>
  1313. <el-tooltip
  1314. content="切换显示/隐藏"
  1315. placement="top"
  1316. >
  1317. <el-switch
  1318. v-model="field.visible"
  1319. class="custom-switch"
  1320. />
  1321. </el-tooltip>
  1322. </div>
  1323. </el-col>
  1324. </el-row>
  1325. <!-- 专业技能部分 -->
  1326. <div class="section-title">专业技能</div>
  1327. <el-row :gutter="20">
  1328. <el-col :span="8" v-for="(field, key) in getSkillFields()" :key="key">
  1329. <div class="field-config-item">
  1330. <span class="field-label">
  1331. {{ field.label }}
  1332. <!-- <el-tag v-if="field.required" size="small" type="danger" class="required-tag">必填</el-tag> -->
  1333. </span>
  1334. <el-tooltip
  1335. content="切换显示/隐藏"
  1336. placement="top"
  1337. >
  1338. <el-switch
  1339. v-model="field.visible"
  1340. class="custom-switch"
  1341. />
  1342. </el-tooltip>
  1343. </div>
  1344. </el-col>
  1345. </el-row>
  1346. <!-- 工作经历部分 -->
  1347. <div class="section-title">工作经历</div>
  1348. <el-row :gutter="20">
  1349. <el-col :span="24">
  1350. <div class="field-config-item">
  1351. <span class="field-label">
  1352. {{ fieldConfig.work_experience.label }}
  1353. <el-tag v-if="fieldConfig.work_experience.visible" size="small" type="success">已启用</el-tag>
  1354. </span>
  1355. <el-switch v-model="fieldConfig.work_experience.visible" class="custom-switch" />
  1356. </div>
  1357. </el-col>
  1358. </el-row>
  1359. <el-row :gutter="20" v-if="fieldConfig.work_experience.visible">
  1360. <el-col :span="8" v-for="(field, key) in fieldConfig.work_experience.fields" :key="key">
  1361. <div class="field-config-item sub-field">
  1362. <span class="field-label">
  1363. {{ field.label }}
  1364. <!-- <el-tag v-if="field.required" size="small" type="danger" class="required-tag">必填</el-tag> -->
  1365. </span>
  1366. <el-tooltip
  1367. content="切换显示/隐藏"
  1368. placement="top"
  1369. >
  1370. <el-switch
  1371. v-model="field.visible"
  1372. class="custom-switch"
  1373. />
  1374. </el-tooltip>
  1375. </div>
  1376. </el-col>
  1377. </el-row>
  1378. </div>
  1379. </div>
  1380. </div>
  1381. <template #footer>
  1382. <span class="dialog-footer">
  1383. <el-button @click="cancelDataCollection">取消</el-button>
  1384. <el-button type="primary" @click="saveFieldConfig">确认</el-button><!-- confirmDataCollection -->
  1385. </span>
  1386. </template>
  1387. </el-dialog>
  1388. <!-- 添加简历收集对话框 -->
  1389. <el-dialog
  1390. title="简历收集"
  1391. v-model="showResumeCollectionDialog"
  1392. width="500px"
  1393. :close-on-click-modal="false"
  1394. class="resume-collection-dialog"
  1395. >
  1396. <div class="resume-collection-form">
  1397. <div class="form-item">
  1398. <div class="form-label">步骤名称</div>
  1399. <el-input
  1400. v-model="resumeCollectionForm.title"
  1401. placeholder="请输入步骤名称"
  1402. maxlength="30"
  1403. show-word-limit
  1404. />
  1405. </div>
  1406. <!-- <div class="form-item">
  1407. <div class="form-label">必填项</div>
  1408. <el-switch v-model="resumeCollectionForm.isRequired" />
  1409. <span class="switch-label">{{ resumeCollectionForm.isRequired ? '开启' : '关闭' }}</span>
  1410. </div>
  1411. <div class="resume-preview">
  1412. <div class="preview-title">简历收集预览</div>
  1413. <div class="preview-content">
  1414. <div class="preview-item">
  1415. <div class="item-label">姓名</div>
  1416. <div class="item-input"></div>
  1417. <div class="item-required" v-if="resumeCollectionForm.isRequired">*</div>
  1418. </div>
  1419. <div class="preview-item">
  1420. <div class="item-label">手机号</div>
  1421. <div class="item-input"></div>
  1422. <div class="item-required" v-if="resumeCollectionForm.isRequired">*</div>
  1423. </div>
  1424. <div class="preview-item">
  1425. <div class="item-label">邮箱</div>
  1426. <div class="item-input"></div>
  1427. <div class="item-required" v-if="resumeCollectionForm.isRequired">*</div>
  1428. </div>
  1429. <div class="preview-item">
  1430. <div class="item-label">上传简历</div>
  1431. <div class="item-upload">
  1432. <el-icon><Plus /></el-icon>
  1433. </div>
  1434. <div class="item-required" v-if="resumeCollectionForm.isRequired">*</div>
  1435. </div>
  1436. </div>
  1437. </div> -->
  1438. </div>
  1439. <template #footer>
  1440. <span class="dialog-footer">
  1441. <el-button @click="cancelResumeCollection">取消</el-button>
  1442. <el-button type="primary" @click="confirmResumeCollection">确认</el-button>
  1443. </span>
  1444. </template>
  1445. </el-dialog>
  1446. <!-- 添加代码测试对话框 -->
  1447. <el-dialog
  1448. title="添加代码笔试步骤"
  1449. v-model="showCodeTestDialog"
  1450. width="500px"
  1451. :close-on-click-modal="false"
  1452. class="code-test-dialog"
  1453. >
  1454. <div class="code-test-form">
  1455. <div class="form-item">
  1456. <div class="form-label">步骤名称</div>
  1457. <el-input
  1458. v-model="codeTestForm.title"
  1459. placeholder="请输入步骤名称"
  1460. maxlength="30"
  1461. show-word-limit
  1462. />
  1463. </div>
  1464. <div class="form-item">
  1465. <div class="form-label">自动评判试卷</div>
  1466. <el-switch v-model="codeTestForm.autoJudge" />
  1467. <span class="switch-label">{{ codeTestForm.autoJudge ? '开启' : '关闭' }}</span>
  1468. </div>
  1469. <div class="form-item">
  1470. <div class="form-label">添加考试试卷</div>
  1471. <div class="test-paper-selector">
  1472. <div class="empty-paper" v-if="!codeTestForm.selectedPaper">
  1473. <el-button type="primary" plain @click="handleSelectPaper">
  1474. <el-icon><Plus /></el-icon>
  1475. 添加考卷
  1476. </el-button>
  1477. <p class="tip-text">多选时,考生会随机分配到一套试卷</p>
  1478. </div>
  1479. <div class="selected-paper" v-else>
  1480. <div class="paper-info">
  1481. <div class="paper-title">{{ codeTestForm.selectedPaper.title }}</div>
  1482. <div class="paper-meta">
  1483. <span>{{ codeTestForm.selectedPaper.questionCount }}道题</span>
  1484. <span>{{ codeTestForm.selectedPaper.duration }}分钟</span>
  1485. <span>{{ codeTestForm.selectedPaper.difficulty }}</span>
  1486. </div>
  1487. </div>
  1488. <div class="paper-actions">
  1489. <el-button type="text" @click="handleViewPaper">查看</el-button>
  1490. <el-button type="text" @click="handleChangePaper">更换</el-button>
  1491. <el-button type="text" @click="handleRemovePaper">删除</el-button>
  1492. </div>
  1493. </div>
  1494. </div>
  1495. </div>
  1496. </div>
  1497. <template #footer>
  1498. <span class="dialog-footer">
  1499. <el-button @click="cancelCodeTest">取消</el-button>
  1500. <el-button type="primary" @click="confirmCodeTest">确认</el-button>
  1501. </span>
  1502. </template>
  1503. </el-dialog>
  1504. <!-- 添加打字测试对话框 -->
  1505. <el-drawer
  1506. title="添加打字测试步骤"
  1507. v-model="showTypingTestDialog"
  1508. size="60%"
  1509. :close-on-click-modal="false"
  1510. class="typing-test-dialog"
  1511. :destroy-on-close="false"
  1512. >
  1513. <div class="typing-test-form">
  1514. <div class="form-item">
  1515. <div class="form-label">选择文章</div>
  1516. <div class="article-selection">
  1517. <el-button type="primary" size="small" class="add-article-btn">
  1518. <el-icon><Plus /></el-icon>
  1519. 添加文章
  1520. </el-button>
  1521. </div>
  1522. </div>
  1523. <div class="form-item">
  1524. <div class="form-label">候选人选择文章方式</div>
  1525. <el-radio-group v-model="typingTestForm.selectionMode">
  1526. <el-radio label="random">随机抽取</el-radio>
  1527. <el-radio label="self">候选人自主选择</el-radio>
  1528. </el-radio-group>
  1529. </div>
  1530. <div class="form-item">
  1531. <div class="form-label">测试时间</div>
  1532. <div class="time-input-container">
  1533. <el-input v-model="typingTestForm.duration" class="time-input" />
  1534. <span class="time-unit">分钟</span>
  1535. </div>
  1536. </div>
  1537. <div class="form-item">
  1538. <div class="form-label">登录界面预览图(建议尺寸1024*768像素,最大不要超过5M)</div>
  1539. <el-upload
  1540. class="preview-uploader"
  1541. action="#"
  1542. :auto-upload="false"
  1543. :show-file-list="false"
  1544. accept="image/*"
  1545. >
  1546. <div class="upload-area">
  1547. <el-icon><Plus /></el-icon>
  1548. <div class="upload-text">添加图片</div>
  1549. </div>
  1550. </el-upload>
  1551. </div>
  1552. <div class="form-item">
  1553. <div class="form-label">注意事项内容(在登录界面显示)</div>
  1554. <el-input
  1555. v-model="typingTestForm.notes"
  1556. type="textarea"
  1557. rows="4"
  1558. placeholder="请输入注意事项内容"
  1559. maxlength="300"
  1560. show-word-limit
  1561. />
  1562. </div>
  1563. <div class="form-item">
  1564. <div class="form-label">测试页面标题</div>
  1565. <el-input
  1566. v-model="typingTestForm.pageTitle"
  1567. placeholder="测试页面标题"
  1568. />
  1569. </div>
  1570. <div class="form-item">
  1571. <div class="form-label">视频监控</div>
  1572. <el-checkbox v-model="typingTestForm.videoMonitoring">视频监控</el-checkbox>
  1573. </div>
  1574. <div class="form-item">
  1575. <div class="form-label">通过标准</div>
  1576. <div class="criteria-options">
  1577. <el-checkbox v-model="typingTestForm.passCriteria.speed">速度</el-checkbox>
  1578. <el-checkbox v-model="typingTestForm.passCriteria.accuracy">正确率</el-checkbox>
  1579. </div>
  1580. </div>
  1581. </div>
  1582. <template #footer>
  1583. <span class="dialog-footer">
  1584. <el-button @click="cancelTypingTest">取消</el-button>
  1585. <el-button type="primary" @click="confirmTypingTest">保存</el-button>
  1586. </span>
  1587. </template>
  1588. </el-drawer>
  1589. <!-- 面试设置弹窗 -->
  1590. <el-dialog
  1591. title="面试设置"
  1592. v-model="showInterviewSettingsDialog"
  1593. width="60%"
  1594. :close-on-click-modal="false"
  1595. class="interview-settings-dialog"
  1596. >
  1597. <div class="interview-settings-content">
  1598. <!-- 防作弊设置 -->
  1599. <div class="settings-section">
  1600. <div class="section-header">
  1601. <span class="section-title">防作弊设置</span>
  1602. </div>
  1603. <div class="setting-item">
  1604. <div class="setting-info">
  1605. <span class="setting-name">「人脸一致性检测」</span>
  1606. <p class="setting-desc">该强调,非本人操作人脸可视化提醒和警示,默认开启</p>
  1607. </div>
  1608. <!-- <el-switch v-model="interviewSettings.faceConsistency" /> -->
  1609. </div>
  1610. <div class="setting-item">
  1611. <div class="setting-info">
  1612. <span class="setting-name">「 防截屏 / 录屏 」</span>
  1613. <p class="setting-desc">该强调,非本人前来体验截屏录屏以上行为,为防止提醒</p>
  1614. </div>
  1615. <!-- <el-switch v-model="interviewSettings.preventScreenshot" /> -->
  1616. </div>
  1617. <div class="setting-item">
  1618. <div class="setting-info">
  1619. <span class="setting-name">「 切 屏 预 制 」</span>
  1620. <p class="setting-desc">该强调,非本人前使用切屏处理用页面,为防作弊警示</p>
  1621. </div>
  1622. <!-- <el-switch v-model="interviewSettings.screenSwitchAlert">
  1623. <span class="switch-desc">切屏超过 2 次关闭,作答本关面试</span>
  1624. </el-switch> -->
  1625. </div>
  1626. <div class="setting-item">
  1627. <div class="setting-info">
  1628. <span class="setting-name">「 情 绪 识 别」</span>
  1629. <p class="setting-desc">该现已,条件较差以及入侵过程中的作弊,条件等好等</p>
  1630. </div>
  1631. <!-- <el-switch v-model="interviewSettings.positionDetection" /> -->
  1632. </div>
  1633. <div class="setting-item">
  1634. <div class="setting-info">
  1635. <span class="setting-name">「 眼 动 检 测 」</span>
  1636. <p class="setting-desc">视实检测候选人的眼动频率进行分析,页面等较等</p>
  1637. </div>
  1638. <!-- <el-switch v-model="interviewSettings.eyeMovementDetection" /> -->
  1639. </div>
  1640. </div>
  1641. <!-- 其他设置 -->
  1642. <div class="settings-section">
  1643. <div class="section-header">
  1644. <span class="section-title">其他设置</span>
  1645. </div>
  1646. <div class="setting-item">
  1647. <div class="setting-info">
  1648. <span class="setting-name">复习面试</span>
  1649. <p class="setting-desc">选取后,将允许面试者进行重复面试</p>
  1650. <el-switch v-model="interviewSettings.reviewInterview" />
  1651. </div>
  1652. </div>
  1653. <div class="setting-item">
  1654. <div class="setting-info">
  1655. <span class="setting-name">开场词</span>
  1656. <div v-if="!isEditingBeforeStart" class="setting-desc-container">
  1657. <p class="setting-desc">{{ interviewSettings.beforeStartText }}</p>
  1658. <el-button type="text" class="edit-desc-btn" @click="startEditBeforeStart">
  1659. <el-icon><Edit /></el-icon>
  1660. </el-button>
  1661. </div>
  1662. <div v-else class="desc-edit-container">
  1663. <el-input
  1664. v-model="editingBeforeStartText"
  1665. type="textarea"
  1666. rows="2"
  1667. placeholder="请输入开始前提示内容"
  1668. show-word-limit
  1669. /><!-- maxlength="100" -->
  1670. <div class="desc-edit-actions">
  1671. <el-button size="small" @click="cancelEditBeforeStart">取消</el-button>
  1672. <el-button size="small" type="primary" @click="saveBeforeStart">保存</el-button>
  1673. </div>
  1674. </div>
  1675. </div>
  1676. <!-- <el-switch v-model="interviewSettings.beforeStart" /> -->
  1677. </div>
  1678. <div class="setting-item">
  1679. <div class="setting-info">
  1680. <span class="setting-name">开始后提醒</span>
  1681. <div v-if="!isEditingAfterStart" class="setting-desc-container">
  1682. <p class="setting-desc">{{ interviewSettings.afterStartText }}</p>
  1683. <el-button type="text" class="edit-desc-btn" @click="startEditAfterStart">
  1684. <el-icon><Edit /></el-icon>
  1685. </el-button>
  1686. </div>
  1687. <div v-else class="desc-edit-container">
  1688. <el-input
  1689. v-model="editingAfterStartText"
  1690. type="textarea"
  1691. rows="2"
  1692. placeholder="请输入开始后提醒内容"
  1693. maxlength="100"
  1694. show-word-limit
  1695. />
  1696. <div class="desc-edit-actions">
  1697. <el-button size="small" @click="cancelEditAfterStart">取消</el-button>
  1698. <el-button size="small" type="primary" @click="saveAfterStart">保存</el-button>
  1699. </div>
  1700. </div>
  1701. </div>
  1702. <!-- <el-switch v-model="interviewSettings.afterStartReminder" /> -->
  1703. </div>
  1704. <div class="setting-item">
  1705. <div class="setting-info">
  1706. <span class="setting-name">结束语</span>
  1707. <div v-if="!isEditingDisclaimer" class="setting-desc-container">
  1708. <p class="setting-desc">{{ interviewSettings.disclaimerText }}</p>
  1709. <el-button type="text" class="edit-desc-btn" @click="startEditDisclaimer">
  1710. <el-icon><Edit /></el-icon>
  1711. </el-button>
  1712. </div>
  1713. <div v-else class="desc-edit-container">
  1714. <el-input
  1715. v-model="editingDisclaimerText"
  1716. type="textarea"
  1717. rows="2"
  1718. placeholder="请输入免责声明内容"
  1719. maxlength="200"
  1720. show-word-limit
  1721. />
  1722. <div class="desc-edit-actions">
  1723. <el-button size="small" @click="cancelEditDisclaimer">取消</el-button>
  1724. <el-button size="small" type="primary" @click="saveDisclaimer">保存</el-button>
  1725. </div>
  1726. </div>
  1727. </div>
  1728. <!-- <el-switch v-model="interviewSettings.disclaimer" /> -->
  1729. </div>
  1730. </div>
  1731. </div>
  1732. <template #footer>
  1733. <span class="dialog-footer">
  1734. <el-button @click="cancelInterviewSettings">取消</el-button>
  1735. <el-button type="primary" @click="confirmInterviewSettings">完成</el-button>
  1736. </span>
  1737. </template>
  1738. </el-dialog>
  1739. </div>
  1740. </template>
  1741. <script setup lang="ts">
  1742. import { ref, reactive, onMounted, onUnmounted, computed } from 'vue';
  1743. import { useRouter, useRoute } from 'vue-router';
  1744. import { ElMessage, ElMessageBox, ElDrawer } from 'element-plus';
  1745. import * as api from '../list/api';
  1746. import { Plus, Document, ArrowDown, Edit, Delete, InfoFilled, QuestionFilled, Search, Rank } from '@element-plus/icons-vue';
  1747. import { GetList } from '../../questionBank/classList/api';
  1748. import { GetCompetencyList,GetQuestionList,GenerateQuestions,
  1749. GetDraftList,SaveDraft,GetDigitalList,
  1750. CreateConfig,GetConfig,UpdateConfig,AddDocument,
  1751. GetOpeningSpeech,GetVideo,BatchBind,BatchUnbind,UpdateObj,GenerateCompetency,SaveCompetency } from './api';
  1752. import draggable from 'vuedraggable';
  1753. import { updateFieldConfig } from './utils';
  1754. import type { ProfileFieldsConfig } from './types';
  1755. import { getPCAData } from '../../../utils/pcaData';
  1756. // 添加 CompetencyTag 接口定义
  1757. interface CompetencyTag {
  1758. id: number;
  1759. name: string;
  1760. selected?: boolean;
  1761. }
  1762. // 添加 InterviewerAvatar 接口定义
  1763. interface InterviewerAvatar {
  1764. id: number;
  1765. name: string;
  1766. image?: string;
  1767. avatar_url?: string;
  1768. }
  1769. // 添加 ChatQuestion 接口定义
  1770. interface ChatQuestion {
  1771. id?: number;
  1772. title: string;
  1773. ability: string;
  1774. content: string;
  1775. target: string;
  1776. weight: number;
  1777. maxAnswers: number;
  1778. source: 'ai_generated' | 'custom_selected'; // 添加题目来源标识
  1779. question_form?: number;
  1780. question_form_name?: string;
  1781. scoring_reference?: string;
  1782. competency_tags?: CompetencyTag[];
  1783. enable_follow_up?: boolean;
  1784. }
  1785. // 添加 Paper 接口定义
  1786. interface Paper {
  1787. id: number;
  1788. title: string;
  1789. questionCount: number;
  1790. duration: number;
  1791. difficulty: string;
  1792. }
  1793. interface AIVideoStep {
  1794. name: string;
  1795. id: string | number;
  1796. aiConfig?: {
  1797. abilities: string[];
  1798. };
  1799. }
  1800. const router = useRouter();
  1801. const route = useRoute();
  1802. const positionId = ref(route.params.id as string);
  1803. const positionStatus = ref(false);
  1804. const drag = ref(false); // 添加拖拽状态变量
  1805. // 职位数据
  1806. const positionData = reactive({
  1807. title: '',
  1808. job_category: '',
  1809. job_type_display: '',
  1810. city: '',
  1811. location: [] as string[] | string, // 修改类型定义
  1812. location_str: '',
  1813. address_detail: '',
  1814. benefits: [],
  1815. requirements: '',
  1816. job_type: 0,
  1817. salary_range: '',
  1818. department: '',
  1819. end_date: '',
  1820. description: '',
  1821. work_experience_required: '',
  1822. education_required: '',
  1823. competency_tags: [],
  1824. status: 0
  1825. });
  1826. // 招聘流程数据 - 修改为普通数组而非 ref 对象
  1827. const recruitmentProcess = reactive([
  1828. { id: 5, name: '资料收集', description: '资料收集', active: true },
  1829. { id: 2, name: 'AI视频', description: 'AI视频', active: true },
  1830. { id: 1, name: '待核验', description: '待核验', active: true },
  1831. { id: 3, name: '已通过', description: '已通过', active: true },
  1832. { id: 4, name: '已淘汰', description: '已淘汰', active: false },
  1833. ]);
  1834. // 是否显示流程编辑对话框
  1835. const showProcessDialog = ref(false);
  1836. // 定义可选的流程步骤类型
  1837. const processStepOptions = [
  1838. { label: 'AI视频', value: 'ai_video' },
  1839. { label: '视频宣讲', value: 'video_presentation' },
  1840. { label: 'AI实时对话', value: 'ai_chat' },
  1841. { label: '资料收集', value: 'data_collection' },
  1842. { label: '简历收集', value: 'resume_collection' },
  1843. /* { label: '代码测试', value: 'code_test' },
  1844. { label: '打字测试', value: 'typing_test' } */
  1845. ];
  1846. const handleAddCompetency = () => {
  1847. competencyLoading.value = true;
  1848. GenerateCompetency({
  1849. position_id: positionId.value,
  1850. }).then((res:any) => {
  1851. res.data.forEach((item:any) => {
  1852. item.selected = false;
  1853. });
  1854. competencyTags.value = res.data;
  1855. console.log('res', res);
  1856. competencyLoading.value = false;
  1857. }).catch((err:any) => {
  1858. console.log('err', err);
  1859. competencyLoading.value = false;
  1860. })
  1861. };
  1862. /* 工作地点 */
  1863. // 工作地点选项
  1864. const locationOptions = getPCAData();
  1865. // 修改处理地点选择变化的函数
  1866. const handleLocationChange = (value: any) => {
  1867. console.log('地址选择变化:', value);
  1868. if (value && Array.isArray(value) && value.length > 0) {
  1869. const [provinceCode, cityCode, districtCode] = value;
  1870. const province = locationOptions.find(p => p.code === provinceCode);
  1871. let city, district;
  1872. if (province && province.children) {
  1873. city = province.children.find(c => c.code === cityCode);
  1874. if (city && city.children) {
  1875. district = city.children.find(d => d.code === districtCode);
  1876. }
  1877. }
  1878. /* // 保存名称
  1879. formData.location_names = [
  1880. province?.name || '',
  1881. city?.name || '',
  1882. district?.name || ''
  1883. ].filter(Boolean);
  1884. // 更新各个字段
  1885. formData.province = province?.name || '';
  1886. formData.city = city?.name || '';
  1887. formData.district = district?.name || '';
  1888. formData.location_str = formData.location_names.join('/'); */
  1889. } else {
  1890. /* formData.location_names = [];
  1891. formData.province = '';
  1892. formData.city = '';
  1893. formData.district = '';
  1894. formData.location_str = ''; */
  1895. }
  1896. };
  1897. const handleIsRequiredCorrectChange = (id: number, value: boolean) => {
  1898. UpdateObj({
  1899. id: id,
  1900. is_required_correct: value
  1901. }).then((res:any) => {
  1902. console.log('res', res);
  1903. })
  1904. };
  1905. // 当前选择的添加位置
  1906. const currentAddIndex = ref(-1);
  1907. // 是否显示选项菜单
  1908. const showOptionsMenu = ref(false);
  1909. // 选项菜单的位置
  1910. const menuPosition = reactive({ top: '0px', left: '0px' });
  1911. // AI视频对话框显示状态
  1912. const showAIVideoDialog = ref(false);
  1913. // AI视频配置选项
  1914. const aiVideoOptions = reactive({
  1915. qualityControl: false,
  1916. teamwork: false,
  1917. problemSolving: false,
  1918. dataAnalysis: false,
  1919. positionMatch: false,
  1920. proactiveness: false,
  1921. basicAbility: false,
  1922. communication: false,
  1923. serviceAwareness: false,
  1924. xxxx: false
  1925. });
  1926. // 当前步骤
  1927. const currentStep = ref(1);
  1928. // 选中的能力列表
  1929. const selectedAbilities = ref([
  1930. {
  1931. label: '沟通能力',
  1932. value: 'communication',
  1933. level: 'CC',
  1934. description: '能够清晰、准确地表达想法,善于倾听和理解他人的观点,具备良好的书面和口头表达能力。',
  1935. expanded: false,
  1936. isNew: true
  1937. },
  1938. {
  1939. label: '团队协作',
  1940. value: 'teamwork',
  1941. level: 'CC',
  1942. description: '能够与团队成员有效合作,共同完成目标,具备良好的团队精神和协作意识。',
  1943. expanded: false,
  1944. isNew: false
  1945. }
  1946. ]);
  1947. const toggleAbilityExpand = (ability:any) => {
  1948. ability.expanded = !ability.expanded;
  1949. };
  1950. // 获取能力标签
  1951. const getAbilityLabel = (key: string) => {
  1952. const abilityMap: Record<string, string> = {
  1953. qualityControl: '质量控制',
  1954. teamwork: '团队协作',
  1955. problemSolving: '问题解决',
  1956. dataAnalysis: '问题分析',
  1957. taskManagement: '分析问题',
  1958. productivity: '生产效率',
  1959. manufacturingSkills: '制造制作技能',
  1960. customerService: '客户服务技能',
  1961. resistanceToPressure: '抗压能力-客户服务',
  1962. workDefinition: '工作稳定-宣誓',
  1963. selfIntroduction: '自我介绍-宣誓',
  1964. detailOrientation: '细节关注',
  1965. logicalThinking: '清晰逻辑思维',
  1966. safetyAwareness: '安全意识',
  1967. customerServiceAwareness: '客户服务意识',
  1968. timeManagement: '时间管理',
  1969. teamCooperation: '团队合作',
  1970. timeManagementSkills: '时间管理能力',
  1971. productEvaluation: '品鉴评估能力',
  1972. basicQualifications: '基本素质',
  1973. networkDeployment: '网位布署',
  1974. remoteCooperation: '泡通协作',
  1975. executionAbility: '执行能力',
  1976. selfDiscipline: '自驱力',
  1977. managementAbility: '管理能力',
  1978. customerOrientation: '客户导向',
  1979. stability: '稳定性',
  1980. salesSkills: '销售技巧',
  1981. responseAbility: '应变能力'
  1982. };
  1983. return abilityMap[key] || key;
  1984. };
  1985. // 排名设置
  1986. const rankSettings = reactive({
  1987. min: 0,
  1988. max: 100,
  1989. minScore: 0.00,
  1990. maxScore: 0.00
  1991. });
  1992. /* 回答不充分追问 */
  1993. const handleFollowUpChange = (value: boolean) => {
  1994. console.log(value);
  1995. };
  1996. // AI模型版本
  1997. const aiModelVersion = ref('standard');
  1998. // 是否启用有效期
  1999. const validityEnabled = ref(false);
  2000. // 在 script setup 部分添加以下响应式变量
  2001. const showVideoLectureDialog = ref(false); // 控制视频宣讲弹窗显示
  2002. const videoLectureForm = reactive({
  2003. title: '', // 步骤名称
  2004. videoFile: null, // 视频文件
  2005. description: '', // 视频简介
  2006. broadcastType: 'required', // 播放设置:必须看完/看过即可
  2007. });
  2008. // 在 script setup 部分添加新的响应式变量
  2009. const showAIChatDialog = ref(false); // 控制AI实时对话抽屉显示
  2010. // 添加 AI 实时对话配置相关的响应式变量
  2011. const chatDuration = ref(15); // 默认15分钟
  2012. const maxQuestions = ref(5); // 默认5个问题
  2013. // 在 script setup 部分添加以下响应式变量
  2014. const showQuestionDialog = ref(false); // 控制添加问题弹框显示
  2015. const questionForm = reactive({
  2016. content: '', // 题目内容
  2017. competencyTags: [], // 胜任力标签
  2018. weight: 100, // 权重占比,默认100%
  2019. level: 1, // 胜任力级别,默认1级
  2020. type: 'open', // 题目形式:开放问题/单选题/多选题/填空题/自言语
  2021. position: [], // 适用职位
  2022. category: '', // 分类
  2023. tags: [], // 标签
  2024. suggestedDuration: 60 // 建议时长,默认60秒
  2025. });
  2026. // 胜任力标签选项
  2027. const competencyTagOptions = ref([
  2028. { label: '时间管理', value: 'time_management' },
  2029. { label: '沟通能力', value: 'communication' },
  2030. { label: '团队协作', value: 'teamwork' },
  2031. { label: '问题解决', value: 'problem_solving' },
  2032. { label: '抗压能力', value: 'pressure_resistance' }
  2033. ]);
  2034. // 职位类型选项
  2035. const positionOptions = ref([
  2036. { label: '后端开发', value: 'backend' },
  2037. { label: '前端开发', value: 'frontend' },
  2038. { label: '产品经理', value: 'product_manager' },
  2039. { label: '项目经理', value: 'project_manager' },
  2040. { label: '测试工程师', value: 'test_engineer' }
  2041. ]);
  2042. // 题目分类选项
  2043. const categoryOptions = ref([
  2044. { label: '技术能力', value: 'tech' },
  2045. { label: '管理能力', value: 'management' },
  2046. { label: '沟通能力', value: 'communication' },
  2047. { label: '专业知识', value: 'professional' },
  2048. { label: '个人素质', value: 'personal' }
  2049. ]);
  2050. // 标签选项
  2051. const tagOptions = ref([
  2052. { label: '时间管理', value: 'time_management' },
  2053. { label: '压力处理', value: 'pressure_handling' },
  2054. { label: '团队合作', value: 'team_cooperation' },
  2055. { label: '问题分析', value: 'problem_analysis' },
  2056. { label: '创新思维', value: 'innovative_thinking' }
  2057. ]);
  2058. // 重置问题表单
  2059. const resetQuestionForm = () => {
  2060. Object.assign(questionForm, {
  2061. content: '',
  2062. competencyTags: [],
  2063. weight: 100,
  2064. level: 1,
  2065. type: 'open',
  2066. position: [],
  2067. category: '',
  2068. tags: [],
  2069. suggestedDuration: 60
  2070. });
  2071. };
  2072. // 取消添加问题
  2073. const cancelAddQuestion = () => {
  2074. showQuestionDialog.value = false;
  2075. resetQuestionForm();
  2076. };
  2077. // 确认添加问题
  2078. const confirmAddQuestion = async () => {
  2079. // 表单验证
  2080. if (!questionForm.content) {
  2081. ElMessage.error('请输入题目内容');
  2082. return;
  2083. }
  2084. // 验证胜任力配置
  2085. if (!validateCompetencyConfig()) {
  2086. return;
  2087. }
  2088. // 验证其他必填项
  2089. if (!questionForm.type) {
  2090. ElMessage.error('请选择题目形式');
  2091. return;
  2092. }
  2093. if (questionForm.position.length === 0) {
  2094. ElMessage.error('请选择适用职位');
  2095. return;
  2096. }
  2097. if (!questionForm.category) {
  2098. ElMessage.error('请选择题目分类');
  2099. return;
  2100. }
  2101. if (questionForm.suggestedDuration <= 0) {
  2102. ElMessage.error('请设置有效的建议时长');
  2103. return;
  2104. }
  2105. try {
  2106. // 创建新的问题对象
  2107. const newQuestion = {
  2108. content: questionForm.content,
  2109. competencyTags: questionForm.competencyTags,
  2110. weight: questionForm.weight,
  2111. level: questionForm.level,
  2112. type: questionForm.type,
  2113. position: questionForm.position,
  2114. category: questionForm.category,
  2115. tags: questionForm.tags,
  2116. suggestedDuration: questionForm.suggestedDuration
  2117. };
  2118. // TODO: 调用API保存问题
  2119. // const response = await api.saveQuestion(newQuestion);
  2120. // 关闭弹窗
  2121. showQuestionDialog.value = false;
  2122. // 重置表单
  2123. resetQuestionForm();
  2124. // 提示成功
  2125. ElMessage.success('问题添加成功');
  2126. // 刷新问题列表
  2127. // await loadQuestions();
  2128. } catch (error) {
  2129. console.error('添加问题失败:', error);
  2130. ElMessage.error('添加问题失败,请重试');
  2131. }
  2132. };
  2133. // 在 script setup 中添加以下响应式变量
  2134. const showDataCollectionDialog = ref(false); // 控制资料收集对话框显示
  2135. const dataCollectionForm = reactive({
  2136. isRequired: false, // 开启评分开关
  2137. questions: [] // 问题列表
  2138. });
  2139. // 修改问题类型定义
  2140. interface QuestionType {
  2141. label: string;
  2142. value: string;
  2143. isVisible?: boolean;
  2144. enableScoring?: boolean;
  2145. isRequired?: boolean;
  2146. }
  2147. // 定义问题列表
  2148. const questionTypes = ref<QuestionType[]>([
  2149. {
  2150. label: 'Q1',
  2151. value: 'q1',
  2152. isVisible: true,
  2153. enableScoring: false,
  2154. isRequired: false
  2155. },
  2156. {
  2157. label: '请问你的毕业院校是哪里?',
  2158. value: 'school',
  2159. isVisible: true,
  2160. enableScoring: false,
  2161. isRequired: true
  2162. }
  2163. ]);
  2164. // 添加简历收集相关的状态和方法
  2165. const showResumeCollectionDialog = ref(false);
  2166. const resumeCollectionForm = reactive({
  2167. title: '简历收集',
  2168. isRequired: true,
  2169. steps: 4, // 默认步骤数
  2170. });
  2171. // 显示简历收集弹窗
  2172. const showResumeCollectionConfig = () => {
  2173. showResumeCollectionDialog.value = true;
  2174. };
  2175. // 取消简历收集配置
  2176. const cancelResumeCollection = () => {
  2177. showResumeCollectionDialog.value = false;
  2178. // 重置表单
  2179. Object.assign(resumeCollectionForm, {
  2180. title: '简历收集',
  2181. isRequired: true,
  2182. steps: 4
  2183. });
  2184. };
  2185. // 确认添加简历收集
  2186. const confirmResumeCollection = () => {
  2187. // 创建新的简历收集步骤
  2188. const newStep = {
  2189. id: Date.now(),
  2190. name: resumeCollectionForm.title,
  2191. description: '简历收集',
  2192. active: true,
  2193. type: 'resume_collection',
  2194. config: {
  2195. ...resumeCollectionForm
  2196. }
  2197. };
  2198. // 添加到流程中
  2199. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  2200. // 关闭弹窗
  2201. showResumeCollectionDialog.value = false;
  2202. // 提示成功
  2203. ElMessage.success('简历收集步骤已添加');
  2204. // 重置表单
  2205. cancelResumeCollection();
  2206. };
  2207. // AI自动组题loading状态
  2208. const autoGenerateLoading = ref(false);
  2209. // 题目设置选项
  2210. const questionSettings = reactive({
  2211. enableScoreQuestions: false, // 得分题开关
  2212. enableColorBlindQuestions: false // 色盲题开关
  2213. });
  2214. // 获取职位详情
  2215. const getPositionDetail = async () => {
  2216. try {
  2217. const id = route.query.id;
  2218. if (!id) {
  2219. ElMessage.error('职位ID不存在');
  2220. return;
  2221. }
  2222. // 修复类型错误,创建符合InfoReq类型的对象
  2223. const idValue = Array.isArray(id) ? id[0] : id;
  2224. // 创建一个符合API要求的请求对象
  2225. const infoReq = id
  2226. const response = await api.GetObj(id); // 使用 infoReq 而不是 id
  2227. if (response && response.data) {
  2228. Object.assign(positionData, response.data);
  2229. const config = await GetConfig(id);
  2230. if (config && config.data) {
  2231. getConfigId.value=config.data.id;
  2232. // 根据配置状态初始化得分题和色盲题开关
  2233. if (config.data.enable_psychological_test !== undefined) {
  2234. questionSettings.enableScoreQuestions = config.data.enable_psychological_test;
  2235. }
  2236. if (config.data.enable_color_blind_test !== undefined) {
  2237. questionSettings.enableColorBlindQuestions = config.data.enable_color_blind_test;
  2238. }
  2239. }
  2240. // 设置职位状态
  2241. positionStatus.value = positionData.status === 1;
  2242. }
  2243. } catch (error) {
  2244. console.error('获取职位详情失败:', error);
  2245. ElMessage.error('获取职位详情失败');
  2246. }
  2247. };
  2248. // 返回列表页
  2249. const goBack = () => {
  2250. router.push('/position/list');
  2251. };
  2252. // 编辑职位
  2253. const handleEdit = () => {
  2254. router.push(`/position/list`);
  2255. };
  2256. // 分享职位
  2257. const handleShare = () => {
  2258. ElMessage.success('分享链接已复制到剪贴板');
  2259. };
  2260. // 修改职位状态
  2261. const handleStatusChange = async (value: boolean) => {
  2262. const id = route.query.id;
  2263. try {
  2264. const newStatus = value ? 1 : 0;
  2265. await api.UpdateObj({
  2266. id: id,
  2267. status: newStatus
  2268. });
  2269. positionData.status = newStatus;
  2270. ElMessage.success(`职位已${value ? '开启' : '关闭'}`);
  2271. } catch (error) {
  2272. console.error('修改状态失败:', error);
  2273. ElMessage.error('修改状态失败');
  2274. // 恢复原状态
  2275. positionStatus.value = !value;
  2276. }
  2277. };
  2278. // 编辑职位用途
  2279. const handleEditUsage = () => {
  2280. ElMessage.info('编辑职位用途功能开发中');
  2281. };
  2282. // 编辑招聘流程
  2283. const handleEditProcess = () => {
  2284. showProcessDialog.value = true;
  2285. };
  2286. // 保存招聘流程
  2287. const saveProcess = () => {
  2288. showProcessDialog.value = false;
  2289. ElMessage.success('招聘流程已更新');
  2290. };
  2291. // 取消编辑
  2292. const cancelEditProcess = () => {
  2293. showProcessDialog.value = false;
  2294. };
  2295. // 删除流程步骤
  2296. const deleteProcessStep = (index: number) => {
  2297. recruitmentProcess.splice(index, 1);
  2298. };
  2299. // 在特定位置添加流程步骤
  2300. const addProcessStepAt = (index: number) => {
  2301. if (recruitmentProcess.length >= 6) {
  2302. ElMessage.warning('最多只能添加6个流程步骤');
  2303. return;
  2304. }
  2305. const newStep = {
  2306. id: Date.now(),
  2307. name: '新步骤',
  2308. description: '新步骤',
  2309. active: true
  2310. };
  2311. recruitmentProcess.splice(index, 0, newStep);
  2312. };
  2313. // 修改原有的添加方法,调用新方法
  2314. const addProcessStep = () => {
  2315. addProcessStepAt(recruitmentProcess.length);
  2316. };
  2317. // 获取状态文本
  2318. const getStatusText = (status: number) => {
  2319. const statusMap: Record<number, string> = {
  2320. 0: '未发布',
  2321. 1: '已发布',
  2322. 2: '已结束'
  2323. };
  2324. return statusMap[status] || '未知状态';
  2325. };
  2326. // 获取状态类型
  2327. const getStatusType = (status: number) => {
  2328. const typeMap: Record<number, string> = {
  2329. 0: 'info',
  2330. 1: 'success',
  2331. 2: 'danger'
  2332. };
  2333. return typeMap[status] || 'info';
  2334. };
  2335. // 获取职位性质文本
  2336. const getJobTypeText = (type: number) => {
  2337. const typeMap: Record<number, string> = {
  2338. 0: '全职',
  2339. 1: '兼职',
  2340. 2: '实习',
  2341. 3: '其他'
  2342. };
  2343. return typeMap[type] || '未知';
  2344. };
  2345. // 显示选项菜单
  2346. const showStepOptions = (index: number, event: MouseEvent) => {
  2347. currentAddIndex.value = index;
  2348. showOptionsMenu.value = true;
  2349. // 计算菜单位置 - 获取按钮元素
  2350. const button = event.currentTarget as HTMLElement;
  2351. // 获取对话框元素,作为相对定位的参考
  2352. const dialogContent = button.closest('.process-dialog-content');
  2353. if (dialogContent) {
  2354. // 获取按钮和对话框的位置信息
  2355. const buttonRect = button.getBoundingClientRect();
  2356. const dialogRect = dialogContent.getBoundingClientRect();
  2357. // 计算相对于对话框的位置
  2358. const top = buttonRect.bottom - dialogRect.top + 5; // 按钮下方5px
  2359. const left = buttonRect.left - dialogRect.left;
  2360. // 设置菜单位置
  2361. menuPosition.top = `${top}px`;
  2362. menuPosition.left = `${left}px`;
  2363. }
  2364. // 阻止事件冒泡
  2365. event.stopPropagation();
  2366. };
  2367. // 修改添加选定类型的步骤方法
  2368. const addSelectedStepType = async (type: string, label: string) => {
  2369. if (type === 'ai_video') {
  2370. showAIVideoDialog.value = true;
  2371. showOptionsMenu.value = false;
  2372. return;
  2373. }
  2374. // 添加 AI 实时对话类型的处理
  2375. if (type === 'ai_chat') {
  2376. showAIChatDialog.value = true;
  2377. showOptionsMenu.value = false;
  2378. return;
  2379. }
  2380. // 添加视频宣讲类型的处理
  2381. if (type === 'video_presentation') {
  2382. showVideoLectureConfig();
  2383. showOptionsMenu.value = false;
  2384. return;
  2385. }
  2386. // 添加资料收集类型的处理
  2387. if (type === 'data_collection') {
  2388. const response = await GetConfig(route.query.id);
  2389. if (response && response.data) {
  2390. getConfigId.value=response.data.id;
  2391. updateFieldConfig(fieldConfig, response.data.profile_fields_config as ProfileFieldsConfig);
  2392. showDataCollectionDialog.value = true;
  2393. showOptionsMenu.value = false;
  2394. }else{
  2395. showDataCollectionDialog.value = true;
  2396. showOptionsMenu.value = false;
  2397. }
  2398. return;
  2399. }
  2400. // 添加简历收集类型的处理
  2401. if (type === 'resume_collection') {
  2402. showResumeCollectionConfig();
  2403. showOptionsMenu.value = false;
  2404. return;
  2405. }
  2406. // 添加代码测试类型的处理
  2407. if (type === 'code_test') {
  2408. showCodeTestConfig();
  2409. showOptionsMenu.value = false;
  2410. return;
  2411. }
  2412. // 添加打字测试类型的处理
  2413. if (type === 'typing_test') {
  2414. showTypingTestDialog.value = true;
  2415. showOptionsMenu.value = false;
  2416. return;
  2417. }
  2418. // 其他类型的处理保持不变
  2419. if (recruitmentProcess.length >= 6) {
  2420. ElMessage.warning('最多只能添加6个流程步骤');
  2421. return;
  2422. }
  2423. const newStep = {
  2424. id: Date.now(),
  2425. name: label,
  2426. description: label,
  2427. active: true,
  2428. type: type
  2429. };
  2430. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  2431. showOptionsMenu.value = false;
  2432. };
  2433. // 下一步
  2434. const nextStep = async () => {
  2435. if (currentStep.value < 3) {
  2436. // 如果从第一步进入第二步,更新已选维度到 selectedAbilities
  2437. if (currentStep.value === 1) {
  2438. // 校验是否选择了胜任力标签
  2439. const selectedTags = competencyTags.value.filter(tag => tag.selected);
  2440. if (selectedTags.length === 0) {
  2441. ElMessage.warning('请至少选择一个胜任力考核维度');
  2442. return; // 阻止进入下一步
  2443. }
  2444. try {
  2445. // 准备要保存的标签数据
  2446. const tagsToSave = selectedTags.map(tag => ({
  2447. name: tag.name,
  2448. description: tag.description, // 如果有描述字段可以添加
  2449. importance: tag.importance // 默认重要性
  2450. }));
  2451. // 调用保存接口
  2452. await SaveCompetency({
  2453. position_id: route.query.id,
  2454. tenant_id: "1",
  2455. tags: tagsToSave
  2456. });
  2457. selectedAbilities.value = selectedTags.map(tag => ({
  2458. label: tag.name,
  2459. value: tag.name.toLowerCase().replace(/\s+/g, '_'),
  2460. description: tag.description, // 如果有描述字段可以添加
  2461. level: 'CC', // 默认等级
  2462. expanded: false,
  2463. isNew: true
  2464. }));
  2465. } catch (error) {
  2466. console.error('保存胜任力标签失败:', error);
  2467. ElMessage.error('保存胜任力标签失败');
  2468. return; // 如果保存失败,不进入下一步
  2469. }
  2470. }
  2471. // 如果从第二步进入第三步,分别处理AI生成和自定义选择的题目
  2472. if (currentStep.value === 2) {
  2473. // 校验是否选择了面试题目
  2474. if (chatQuestions.value.length === 0) {
  2475. ElMessage.warning('请至少添加一个面试题目');
  2476. return; // 阻止进入下一步
  2477. }
  2478. try{
  2479. // 分别处理AI生成的题目和自定义选择的题目
  2480. await handleQuestionsSeparately();
  2481. } catch (error) {
  2482. console.error('保存题目失败:', error);
  2483. ElMessage.error('保存题目失败');
  2484. return; // 如果保存失败,不进入下一步
  2485. }
  2486. }
  2487. // 如果从第三步完成配置,验证面试设置
  2488. if (currentStep.value === 3) {
  2489. const validation = validateInterviewSettings();
  2490. if (!validation.isValid) {
  2491. validation.messages.forEach(message => {
  2492. ElMessage.warning(message);
  2493. });
  2494. return;
  2495. }
  2496. // 打印完整的配置信息
  2497. const completeConfig = getCompleteInterviewConfig();
  2498. console.log('完整的面试配置:', completeConfig);
  2499. }
  2500. currentStep.value++;
  2501. } else {
  2502. finishConfig();
  2503. }
  2504. };
  2505. // 上一步
  2506. const prevStep = () => {
  2507. if (currentStep.value > 1) {
  2508. currentStep.value--;
  2509. }
  2510. };
  2511. // 完成配置
  2512. const finishConfig = async () => {
  2513. // 验证是否选择了面试官
  2514. if (!selectedInterviewer.value || !selectedInterviewer.value.id) {
  2515. ElMessage.warning('请选择面试官形象');
  2516. return; // 阻止继续执行保存操作
  2517. }
  2518. // 获取选中的面试官信息
  2519. const selectedInterviewerInfo = {
  2520. id: selectedInterviewer.value.id,
  2521. name: selectedInterviewer.value.name,
  2522. avatar_url: selectedInterviewer.value.avatar_url || selectedInterviewer.value.image
  2523. };
  2524. // 获取面试设置选项
  2525. const interviewSettings = getInterviewSettings();
  2526. // 获取题目设置选项
  2527. const currentQuestionSettings = {
  2528. enableScoreQuestions: questionSettings.enableScoreQuestions,
  2529. enableColorBlindQuestions: questionSettings.enableColorBlindQuestions
  2530. };
  2531. if(getConfigId.value==0){
  2532. const response = await CreateConfig({
  2533. position_id:route.query.id,
  2534. digital_human_id:selectedInterviewer.value.id,
  2535. })
  2536. if(response.code==2000){
  2537. ElMessage.success('配置保存成功');
  2538. // 调用获取开场白和视频接口 - 顺序执行,间隔3-5秒
  2539. try {
  2540. const params = { config_id: response.data?.id || response.data };
  2541. // 检查是否有开场白配置
  2542. const hasOpeningSpeech = interviewSettings.beforeStartText &&
  2543. interviewSettings.beforeStartText.trim() !== '';
  2544. if (hasOpeningSpeech) {
  2545. // 有开场白配置,先请求获取开场白接口
  2546. await GetOpeningSpeech(params);
  2547. console.log('开场白生成成功');
  2548. showAIVideoDialog.value = false;
  2549. currentStep.value = 1;
  2550. // 等待3-5秒(这里设置为4秒)
  2551. await new Promise(resolve => setTimeout(resolve, 4000));
  2552. } else {
  2553. console.log('无开场白配置,跳过开场白生成');
  2554. }
  2555. // 请求获取视频接口
  2556. await GetVideo(params);
  2557. ElMessage.success('视频开始生成');
  2558. } catch (error) {
  2559. console.error('获取开场白和视频失败:', error);
  2560. ElMessage.warning('视频生成中,请稍后');
  2561. }
  2562. }else{
  2563. ElMessage.error('配置保存失败');
  2564. }
  2565. }else{
  2566. const response = await UpdateConfig({
  2567. id:getConfigId.value,
  2568. digital_human_id:selectedInterviewer.value.id,
  2569. })
  2570. if(response.code==2000){
  2571. ElMessage.success('配置保存成功');
  2572. // 调用获取开场白和视频接口 - 顺序执行,间隔3-5秒
  2573. try {
  2574. const params = { config_id: getConfigId.value };
  2575. // 第一步:请求获取开场白接口
  2576. console.log('开始生成开场白...');
  2577. await GetOpeningSpeech(params);
  2578. console.log('开场白生成成功');
  2579. showAIVideoDialog.value = false;
  2580. currentStep.value = 1;
  2581. // 第二步:等待3-5秒(这里设置为4秒)
  2582. console.log('等待4秒后开始生成视频...');
  2583. await delay(4000);
  2584. // 第三步:请求获取视频接口
  2585. console.log('开始生成视频...');
  2586. await GetVideo(params);
  2587. console.log('视频生成请求已发送');
  2588. ElMessage.success('视频开始生成');
  2589. } catch (error) {
  2590. console.error('获取开场白和视频失败:', error);
  2591. ElMessage.warning('视频生成中,请稍后');
  2592. }
  2593. }else{
  2594. ElMessage.error('配置保存失败');
  2595. }
  2596. }
  2597. console.log('保存时选中的面试官:', selectedInterviewerInfo);
  2598. console.log('保存时的面试设置:', interviewSettings);
  2599. console.log('保存时的题目设置:', currentQuestionSettings);
  2600. // 创建新的AI视频步骤
  2601. const newStep = {
  2602. id: Date.now(),
  2603. name: 'AI视频',
  2604. description: `已选择${selectedAbilities.value.length}项能力测评`,
  2605. active: true,
  2606. type: 'ai_video',
  2607. abilities: selectedAbilities.value.map(a => a.value),
  2608. // 添加面试官信息
  2609. interviewer: selectedInterviewerInfo,
  2610. // 添加面试设置信息
  2611. settings: interviewSettings
  2612. };
  2613. // 添加到流程中
  2614. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  2615. // 关闭对话框
  2616. showAIVideoDialog.value = false;
  2617. // 重置当前步骤
  2618. currentStep.value = 1;
  2619. // 提示成功
  2620. ElMessage.success('AI视频步骤已添加');
  2621. };
  2622. // 取消AI视频配置
  2623. const cancelAIVideoConfig = () => {
  2624. showAIVideoDialog.value = false;
  2625. currentStep.value = 1; // 重置步骤
  2626. };
  2627. // 跳转到指定步骤
  2628. const jumpToStep = (step: number) => {
  2629. // 确保步骤在有效范围内
  2630. /* if (step >= 1 && step <= 3) {
  2631. currentStep.value = step;
  2632. } */
  2633. };
  2634. // 显示视频宣讲配置弹窗
  2635. const showVideoLectureConfig = () => {
  2636. showVideoLectureDialog.value = true;
  2637. };
  2638. // 取消视频宣讲配置
  2639. const cancelVideoLecture = () => {
  2640. showVideoLectureDialog.value = false;
  2641. // 重置表单
  2642. Object.assign(videoLectureForm, {
  2643. title: '',
  2644. videoFile: null,
  2645. description: '',
  2646. broadcastType: 'required'
  2647. });
  2648. };
  2649. // 确认添加视频宣讲
  2650. const confirmVideoLecture = () => {
  2651. // 创建新的视频宣讲步骤
  2652. const newStep = {
  2653. id: Date.now(),
  2654. name: videoLectureForm.title || '视频宣讲',
  2655. description: videoLectureForm.description || '视频宣讲',
  2656. active: true,
  2657. type: 'video_presentation',
  2658. config: {
  2659. ...videoLectureForm
  2660. }
  2661. };
  2662. // 添加到流程中
  2663. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  2664. // 关闭弹窗
  2665. showVideoLectureDialog.value = false;
  2666. // 提示成功
  2667. ElMessage.success('视频宣讲步骤已添加');
  2668. // 重置表单
  2669. cancelVideoLecture();
  2670. };
  2671. // 添加 AI 实时对话相关方法
  2672. const handleAIChatConfig = () => {
  2673. // 这里添加确认配置的逻辑
  2674. const newStep = {
  2675. id: Date.now(),
  2676. name: 'AI实时对话',
  2677. description: 'AI实时对话',
  2678. active: true,
  2679. type: 'ai_chat'
  2680. };
  2681. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  2682. showAIChatDialog.value = false;
  2683. ElMessage.success('AI实时对话步骤已添加');
  2684. };
  2685. const cancelAIChatConfig = () => {
  2686. showAIChatDialog.value = false;
  2687. };
  2688. // 添加问题列表数据
  2689. const chatQuestions = ref<ChatQuestion[]>([]);
  2690. // 添加问题处理方法
  2691. const handleAddQuestion = () => {
  2692. showQuestionDialog.value = true;
  2693. };
  2694. /* // 取消添加问题
  2695. const cancelAddQuestion = () => {
  2696. showQuestionDialog.value = false;
  2697. // 重置表单
  2698. Object.assign(questionForm, {
  2699. title: '',
  2700. ability: '',
  2701. content: '',
  2702. target: '',
  2703. weight: 100,
  2704. maxAnswers: 1
  2705. });
  2706. }; */
  2707. /* // 确认添加问题
  2708. const confirmAddQuestion = () => {
  2709. if (!questionForm.title || !questionForm.content) {
  2710. ElMessage.warning('请填写必填项');
  2711. return;
  2712. }
  2713. // 创建新问题对象
  2714. const newQuestion = {
  2715. id: Date.now(), // 添加唯一ID
  2716. title: questionForm.title,
  2717. ability: questionForm.ability,
  2718. content: questionForm.content,
  2719. target: questionForm.target,
  2720. weight: questionForm.weight,
  2721. maxAnswers: questionForm.maxAnswers,
  2722. source: 'custom_selected' as const // 标识为自定义题目
  2723. };
  2724. // 添加到问题列表
  2725. chatQuestions.value.push(newQuestion);
  2726. // 关闭弹框
  2727. showQuestionDialog.value = false;
  2728. // 重置表单
  2729. cancelAddQuestion();
  2730. // 提示成功
  2731. ElMessage.success('问题添加成功');
  2732. }; */
  2733. // 导入问题处理方法
  2734. const handleImportQuestion = () => {
  2735. showQuestionSelectDialog.value = true;
  2736. fetchQuestionList(); // 打开对话框时获取题目列表
  2737. };
  2738. // 在 script setup 中添加
  2739. const editQuestion = (index: number) => {
  2740. // 编辑问题的逻辑
  2741. const question = chatQuestions.value[index];
  2742. Object.assign(questionForm, question);
  2743. showQuestionDialog.value = true;
  2744. };
  2745. const deleteQuestion = (index: number) => {
  2746. ElMessageBox.confirm('确认删除该问题?', '提示', {
  2747. confirmButtonText: '确定',
  2748. cancelButtonText: '取消',
  2749. type: 'warning'
  2750. }).then(() => {
  2751. chatQuestions.value.splice(index, 1);
  2752. ElMessage.success('删除成功');
  2753. });
  2754. };
  2755. // 取消资料收集配置
  2756. const cancelDataCollection = () => {
  2757. showDataCollectionDialog.value = false;
  2758. // 重置表单
  2759. Object.assign(dataCollectionForm, {
  2760. isRequired: false,
  2761. questions: []
  2762. });
  2763. };
  2764. // 确认添加资料收集
  2765. const confirmDataCollection = () => {
  2766. /* if (dataCollectionForm.questions.length === 0) {
  2767. ElMessage.warning('请至少选择一个问题');
  2768. return;
  2769. } */
  2770. // 创建新的资料收集步骤
  2771. const newStep = {
  2772. id: Date.now(),
  2773. name: '资料收集',
  2774. description: `已选择${dataCollectionForm.questions.length}个问题`,
  2775. active: true,
  2776. type: 'data_collection',
  2777. config: {
  2778. ...dataCollectionForm,
  2779. questions: dataCollectionForm.questions.map(q => {
  2780. // 修复 find 方法的使用
  2781. const question = questionTypes.value.find(type => type.value === q);
  2782. return {
  2783. type: q,
  2784. title: question?.label || '',
  2785. required: dataCollectionForm.isRequired
  2786. };
  2787. })
  2788. }
  2789. };
  2790. // 添加到流程中
  2791. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  2792. // 关闭弹窗
  2793. showDataCollectionDialog.value = false;
  2794. // 提示成功
  2795. ElMessage.success('资料收集步骤已添加');
  2796. // 重置表单
  2797. cancelDataCollection();
  2798. };
  2799. // 使用 onMounted 和 onUnmounted 钩子
  2800. onMounted(() => {
  2801. getPositionDetail();
  2802. getCompetencyList();
  2803. getDigitalList();
  2804. // 初始化配置状态
  2805. initializeConfigState();
  2806. });
  2807. // 组件销毁时清理轮询
  2808. onUnmounted(() => {
  2809. // 取消正在进行的轮询
  2810. cancelPolling();
  2811. });
  2812. // 初始化配置状态
  2813. const initializeConfigState = async () => {
  2814. try {
  2815. const id = route.query.id;
  2816. if (id) {
  2817. const config = await GetConfig(id);
  2818. if (config && config.data) {
  2819. // 同步得分题开关状态
  2820. if (config.data.enable_psychological_test !== undefined) {
  2821. questionSettings.enableScoreQuestions = config.data.enable_psychological_test;
  2822. }
  2823. // 同步色盲题开关状态
  2824. if (config.data.enable_color_blind_test !== undefined) {
  2825. questionSettings.enableColorBlindQuestions = config.data.enable_color_blind_test;
  2826. }
  2827. // 可以在这里添加其他配置状态的同步
  2828. }
  2829. }
  2830. } catch (error) {
  2831. console.error('初始化配置状态失败:', error);
  2832. }
  2833. };
  2834. // 添加代码测试相关的状态和方法
  2835. const showCodeTestDialog = ref(false);
  2836. const codeTestForm = reactive({
  2837. title: '代码笔试',
  2838. autoJudge: true,
  2839. selectedPaper: null as Paper | null,
  2840. });
  2841. // 显示代码测试弹窗
  2842. const showCodeTestConfig = () => {
  2843. showCodeTestDialog.value = true;
  2844. };
  2845. // 取消代码测试配置
  2846. const cancelCodeTest = () => {
  2847. showCodeTestDialog.value = false;
  2848. // 重置表单
  2849. Object.assign(codeTestForm, {
  2850. title: '代码笔试',
  2851. autoJudge: true,
  2852. selectedPaper: null
  2853. });
  2854. };
  2855. // 确认添加代码测试
  2856. const confirmCodeTest = () => {
  2857. if (!codeTestForm.selectedPaper) {
  2858. ElMessage.warning('请添加考试试卷');
  2859. return;
  2860. }
  2861. // 创建新的代码测试步骤
  2862. const newStep = {
  2863. id: Date.now(),
  2864. name: codeTestForm.title,
  2865. description: `${codeTestForm.selectedPaper.title}`,
  2866. active: true,
  2867. type: 'code_test',
  2868. config: {
  2869. ...codeTestForm
  2870. }
  2871. };
  2872. // 添加到流程中
  2873. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  2874. // 关闭弹窗
  2875. showCodeTestDialog.value = false;
  2876. // 提示成功
  2877. ElMessage.success('代码笔试步骤已添加');
  2878. // 重置表单
  2879. cancelCodeTest();
  2880. };
  2881. // 选择试卷
  2882. const handleSelectPaper = () => {
  2883. // 模拟选择试卷
  2884. codeTestForm.selectedPaper = {
  2885. id: 1,
  2886. title: '前端开发工程师笔试',
  2887. questionCount: 4,
  2888. duration: 60,
  2889. difficulty: '中等难度'
  2890. } as Paper;
  2891. };
  2892. // 查看试卷
  2893. const handleViewPaper = () => {
  2894. ElMessage.info('查看试卷功能开发中');
  2895. };
  2896. // 更换试卷
  2897. const handleChangePaper = () => {
  2898. ElMessage.info('更换试卷功能开发中');
  2899. };
  2900. // 删除试卷
  2901. const handleRemovePaper = () => {
  2902. codeTestForm.selectedPaper = null;
  2903. };
  2904. // 添加打字测试对话框
  2905. const showTypingTestDialog = ref(false);
  2906. const typingTestForm = reactive({
  2907. title: '', // 步骤名称
  2908. duration: 5, // 测试时间,默认5分钟
  2909. content: '', // 测试页面标题
  2910. notes: '', // 注意事项内容
  2911. videoMonitoring: false, // 是否启用视频监控
  2912. passCriteria: {
  2913. speed: false, // 是否通过速度标准
  2914. accuracy: true, // 是否通过正确率标准,默认选中
  2915. },
  2916. selectionMode: 'random', // 文章选择方式:random-随机抽取,self-候选人自主选择
  2917. pageTitle: '', // 测试页面标题
  2918. previewImage: null, // 登录界面预览图
  2919. articles: [] // 文章列表
  2920. });
  2921. // 取消打字测试配置
  2922. const cancelTypingTest = () => {
  2923. showTypingTestDialog.value = false;
  2924. // 重置表单
  2925. Object.assign(typingTestForm, {
  2926. title: '',
  2927. duration: 5,
  2928. content: '',
  2929. notes: '',
  2930. videoMonitoring: false,
  2931. passCriteria: {
  2932. speed: false,
  2933. accuracy: true,
  2934. },
  2935. selectionMode: 'random',
  2936. pageTitle: '',
  2937. previewImage: null,
  2938. articles: []
  2939. });
  2940. };
  2941. // 确认添加打字测试
  2942. const confirmTypingTest = () => {
  2943. // 创建新的打字测试步骤
  2944. const newStep = {
  2945. id: Date.now(),
  2946. name: typingTestForm.title,
  2947. description: `打字测试 ${typingTestForm.duration}分钟`,
  2948. active: true,
  2949. type: 'typing_test',
  2950. config: {
  2951. ...typingTestForm
  2952. }
  2953. };
  2954. // 添加到流程中
  2955. recruitmentProcess.splice(currentAddIndex.value, 0, newStep);
  2956. // 关闭弹窗
  2957. showTypingTestDialog.value = false;
  2958. // 提示成功
  2959. ElMessage.success('打字测试步骤已添加');
  2960. // 重置表单
  2961. cancelTypingTest();
  2962. };
  2963. // 添加职位名称编辑功能
  2964. const isEditingTitle = ref(false);
  2965. const editingTitle = ref('');
  2966. // 开始编辑职位名称
  2967. const startEditTitle = () => {
  2968. editingTitle.value = positionData.title;
  2969. isEditingTitle.value = true;
  2970. };
  2971. // 取消编辑职位名称
  2972. const cancelEditTitle = () => {
  2973. isEditingTitle.value = false;
  2974. };
  2975. // 保存编辑后的职位名称
  2976. const saveTitle = async () => {
  2977. if (!editingTitle.value.trim()) {
  2978. ElMessage.warning('职位名称不能为空');
  2979. return;
  2980. }
  2981. try {
  2982. const id = route.query.id;
  2983. await api.UpdateObj({
  2984. id: id,
  2985. title: editingTitle.value.trim()
  2986. });
  2987. // 更新本地数据
  2988. positionData.title = editingTitle.value.trim();
  2989. isEditingTitle.value = false;
  2990. ElMessage.success('职位名称已更新');
  2991. } catch (error) {
  2992. console.error('更新职位名称失败:', error);
  2993. ElMessage.error('更新职位名称失败');
  2994. }
  2995. };
  2996. // 工作地点编辑
  2997. const isEditingLocation = ref(false);
  2998. const editingLocation = ref('');
  2999. // 开始编辑工作地点
  3000. const startEditLocation = () => {
  3001. if (!positionData.location) {
  3002. editingLocation.value = '';
  3003. } else if (Array.isArray(positionData.location)) {
  3004. editingLocation.value = positionData.location;
  3005. } else if (typeof positionData.location === 'string') {
  3006. try {
  3007. // 移除方括号和单引号,并分割成数组
  3008. const cleanStr = positionData.location.replace(/[\[\]']/g, '');
  3009. const locationArray = cleanStr.split(',').map(item => item.trim());
  3010. // 根据地址数据查找对应的code
  3011. const province = locationOptions.find(p => p.name === locationArray[0]);
  3012. let city, district;
  3013. if (province && province.children) {
  3014. city = province.children.find(c => c.name === locationArray[1]);
  3015. if (city && city.children) {
  3016. district = city.children.find(d => d.name === locationArray[2]);
  3017. }
  3018. }
  3019. editingLocation.value = [
  3020. province?.code,
  3021. city?.code,
  3022. district?.code
  3023. ].filter(Boolean);
  3024. } catch (e) {
  3025. console.error('解析地址失败:', e);
  3026. editingLocation.value = '';
  3027. }
  3028. }
  3029. isEditingLocation.value = true;
  3030. };
  3031. // 取消编辑工作地点
  3032. const cancelEditLocation = () => {
  3033. isEditingLocation.value = false;
  3034. };
  3035. // 保存工作地点
  3036. const saveLocation = async () => {
  3037. try {
  3038. const id = route.query.id;
  3039. // 获取选中地址的名称
  3040. const locationNames = [];
  3041. if (editingLocation.value && Array.isArray(editingLocation.value)) {
  3042. const [provinceCode, cityCode, districtCode] = editingLocation.value;
  3043. const province = locationOptions.find(p => p.code === provinceCode);
  3044. let city, district;
  3045. if (province) {
  3046. locationNames.push(province.name);
  3047. if (province.children) {
  3048. city = province.children.find(c => c.code === cityCode);
  3049. if (city) {
  3050. locationNames.push(city.name);
  3051. if (city.children) {
  3052. district = city.children.find(d => d.code === districtCode);
  3053. if (district) {
  3054. locationNames.push(district.name);
  3055. }
  3056. }
  3057. }
  3058. }
  3059. }
  3060. }
  3061. await api.UpdateObj({
  3062. id: id,
  3063. location: locationNames
  3064. });
  3065. // 更新本地数据
  3066. positionData.location = locationNames;
  3067. isEditingLocation.value = false;
  3068. ElMessage.success('工作地点已更新');
  3069. } catch (error) {
  3070. console.error('更新工作地点失败:', error);
  3071. ElMessage.error('更新工作地点失败');
  3072. }
  3073. };
  3074. // 职位薪资编辑
  3075. const isEditingSalary = ref(false);
  3076. const editingSalary = ref('');
  3077. // 开始编辑职位薪资
  3078. const startEditSalary = () => {
  3079. editingSalary.value = positionData.salary_range || '';
  3080. isEditingSalary.value = true;
  3081. };
  3082. // 取消编辑职位薪资
  3083. const cancelEditSalary = () => {
  3084. isEditingSalary.value = false;
  3085. };
  3086. // 保存职位薪资
  3087. const saveSalary = async () => {
  3088. try {
  3089. const id = route.query.id;
  3090. await api.UpdateObj({
  3091. id: id,
  3092. salary_range: editingSalary.value.trim()
  3093. });
  3094. // 更新本地数据
  3095. positionData.salary_range = editingSalary.value.trim();
  3096. isEditingSalary.value = false;
  3097. ElMessage.success('职位薪资已更新');
  3098. } catch (error) {
  3099. console.error('更新职位薪资失败:', error);
  3100. ElMessage.error('更新职位薪资失败');
  3101. }
  3102. };
  3103. // 工作经验编辑
  3104. const isEditingExperience = ref(false);
  3105. const editingExperience = ref('');
  3106. // 开始编辑工作经验
  3107. const startEditExperience = () => {
  3108. editingExperience.value = positionData.work_experience_required || '';
  3109. isEditingExperience.value = true;
  3110. };
  3111. // 取消编辑工作经验
  3112. const cancelEditExperience = () => {
  3113. isEditingExperience.value = false;
  3114. };
  3115. // 保存工作经验
  3116. const saveExperience = async () => {
  3117. try {
  3118. const id = route.query.id;
  3119. await api.UpdateObj({
  3120. id: id,
  3121. work_experience_required: editingExperience.value
  3122. });
  3123. // 更新本地数据
  3124. positionData.work_experience_required = editingExperience.value;
  3125. isEditingExperience.value = false;
  3126. ElMessage.success('工作经验已更新');
  3127. } catch (error) {
  3128. console.error('更新工作经验失败:', error);
  3129. ElMessage.error('更新工作经验失败');
  3130. }
  3131. };
  3132. // 学历要求编辑
  3133. const isEditingEducation = ref(false);
  3134. const editingEducation = ref('');
  3135. // 开始编辑学历要求
  3136. const startEditEducation = () => {
  3137. editingEducation.value = positionData.education_required || '';
  3138. isEditingEducation.value = true;
  3139. };
  3140. // 取消编辑学历要求
  3141. const cancelEditEducation = () => {
  3142. isEditingEducation.value = false;
  3143. };
  3144. // 保存学历要求
  3145. const saveEducation = async () => {
  3146. try {
  3147. const id = route.query.id;
  3148. await api.UpdateObj({
  3149. id: id,
  3150. education_required: editingEducation.value
  3151. });
  3152. // 更新本地数据
  3153. positionData.education_required = editingEducation.value;
  3154. isEditingEducation.value = false;
  3155. ElMessage.success('学历要求已更新');
  3156. } catch (error) {
  3157. console.error('更新学历要求失败:', error);
  3158. ElMessage.error('更新学历要求失败');
  3159. }
  3160. };
  3161. // 所属部门编辑
  3162. const isEditingDepartment = ref(false);
  3163. const editingDepartment = ref('');
  3164. // 开始编辑所属部门
  3165. const startEditDepartment = () => {
  3166. editingDepartment.value = positionData.department || '';
  3167. isEditingDepartment.value = true;
  3168. };
  3169. // 取消编辑所属部门
  3170. const cancelEditDepartment = () => {
  3171. isEditingDepartment.value = false;
  3172. };
  3173. // 保存所属部门
  3174. const saveDepartment = async () => {
  3175. try {
  3176. const id = route.query.id;
  3177. await api.UpdateObj({
  3178. id: id,
  3179. department: editingDepartment.value.trim()
  3180. });
  3181. // 更新本地数据
  3182. positionData.department = editingDepartment.value.trim();
  3183. isEditingDepartment.value = false;
  3184. ElMessage.success('所属部门已更新');
  3185. } catch (error) {
  3186. console.error('更新所属部门失败:', error);
  3187. ElMessage.error('更新所属部门失败');
  3188. }
  3189. };
  3190. // 截止日期编辑
  3191. const isEditingEndDate = ref(false);
  3192. const editingEndDate = ref('');
  3193. // 开始编辑截止日期
  3194. const startEditEndDate = () => {
  3195. editingEndDate.value = positionData.end_date || '';
  3196. isEditingEndDate.value = true;
  3197. };
  3198. // 取消编辑截止日期
  3199. const cancelEditEndDate = () => {
  3200. isEditingEndDate.value = false;
  3201. };
  3202. // 保存截止日期
  3203. const saveEndDate = async () => {
  3204. try {
  3205. const id = route.query.id;
  3206. await api.UpdateObj({
  3207. id: id,
  3208. end_date: editingEndDate.value
  3209. });
  3210. // 更新本地数据
  3211. positionData.end_date = editingEndDate.value;
  3212. isEditingEndDate.value = false;
  3213. ElMessage.success('截止日期已更新');
  3214. } catch (error) {
  3215. console.error('更新截止日期失败:', error);
  3216. ElMessage.error('更新截止日期失败');
  3217. }
  3218. };
  3219. // 职位要求编辑
  3220. const isEditingRequirements = ref(false);
  3221. const editingRequirements = ref('');
  3222. // 开始编辑职位要求
  3223. const startEditRequirements = () => {
  3224. editingRequirements.value = positionData.requirements || '';
  3225. isEditingRequirements.value = true;
  3226. };
  3227. // 取消编辑职位要求
  3228. const cancelEditRequirements = () => {
  3229. isEditingRequirements.value = false;
  3230. };
  3231. // 保存职位要求
  3232. const saveRequirements = async () => {
  3233. try {
  3234. const id = route.query.id;
  3235. await api.UpdateObj({
  3236. id: id,
  3237. requirements: editingRequirements.value
  3238. });
  3239. // 更新本地数据
  3240. positionData.requirements = editingRequirements.value;
  3241. isEditingRequirements.value = false;
  3242. ElMessage.success('职位要求已更新');
  3243. } catch (error) {
  3244. console.error('更新职位要求失败:', error);
  3245. ElMessage.error('更新职位要求失败');
  3246. }
  3247. };
  3248. // 职位描述编辑
  3249. const isEditingDescription = ref(false);
  3250. const editingDescription = ref('');
  3251. // 开始编辑职位描述
  3252. const startEditDescription = () => {
  3253. editingDescription.value = positionData.description || '';
  3254. isEditingDescription.value = true;
  3255. };
  3256. // 取消编辑职位描述
  3257. const cancelEditDescription = () => {
  3258. isEditingDescription.value = false;
  3259. };
  3260. // 保存职位描述
  3261. const saveDescription = async () => {
  3262. try {
  3263. const id = route.query.id;
  3264. await api.UpdateObj({
  3265. id: id,
  3266. description: editingDescription.value
  3267. });
  3268. // 更新本地数据
  3269. positionData.description = editingDescription.value;
  3270. isEditingDescription.value = false;
  3271. ElMessage.success('职位描述已更新');
  3272. } catch (error) {
  3273. console.error('更新职位描述失败:', error);
  3274. ElMessage.error('更新职位描述失败');
  3275. }
  3276. };
  3277. // 添加能力标签相关的响应式变量
  3278. const competencyTags = ref<CompetencyTag[]>([]);
  3279. const isEditingCompetency = ref(false);
  3280. const selectedCompetencies = ref([]);
  3281. // 获取能力标签列表
  3282. const getCompetencyList = async () => {
  3283. try {
  3284. const response = await GetCompetencyList({page:1,pageSize:1000});
  3285. if (response && response.data) {
  3286. // 为每个标签添加选中状态属性
  3287. /* competencyTags.value = response.data.items.map((item:any) => ({
  3288. ...item,
  3289. selected: false
  3290. })); */
  3291. }
  3292. } catch (error) {
  3293. console.error('获取能力标签列表失败:', error);
  3294. ElMessage.error('获取能力标签列表失败');
  3295. }
  3296. };
  3297. // 开始编辑能力标签
  3298. const startEditCompetency = () => {
  3299. selectedCompetencies.value = positionData.competency_tags?.map((tag:any) => tag.id) || [];
  3300. isEditingCompetency.value = true;
  3301. };
  3302. // 取消编辑能力标签
  3303. const cancelEditCompetency = () => {
  3304. isEditingCompetency.value = false;
  3305. };
  3306. // 保存能力标签
  3307. const saveCompetency = async () => {
  3308. try {
  3309. const id = route.query.id;
  3310. await api.UpdateObj({
  3311. id: id,
  3312. competency_tags: selectedCompetencies.value
  3313. });
  3314. // 更新本地数据
  3315. positionData.competency_tags = competencyTags.value.filter(tag =>
  3316. selectedCompetencies.value.includes(tag.id)
  3317. );
  3318. isEditingCompetency.value = false;
  3319. ElMessage.success('能力标签已更新');
  3320. } catch (error) {
  3321. console.error('更新能力标签失败:', error);
  3322. ElMessage.error('更新能力标签失败');
  3323. }
  3324. };
  3325. // 在setup中添加
  3326. const currentEditingStep = ref<AIVideoStep | null>(null);
  3327. /* 获取已配置ID */
  3328. const getConfigId =ref(0)
  3329. // 编辑AI视频
  3330. const editAIVideo = async (step: AIVideoStep) => {
  3331. // 添加资料收集类型的处理
  3332. if (step.name === '资料收集') {
  3333. const response = await GetConfig(route.query.id);
  3334. if (response && response.data) {
  3335. getConfigId.value=response.data.id;
  3336. updateFieldConfig(fieldConfig, response.data.profile_fields_config as ProfileFieldsConfig);
  3337. showDataCollectionDialog.value = true;
  3338. showOptionsMenu.value = false;
  3339. }else{
  3340. showDataCollectionDialog.value = true;
  3341. showOptionsMenu.value = false;
  3342. }
  3343. return;
  3344. }
  3345. if (step.name === 'AI视频') {
  3346. const response = await GetConfig(route.query.id);
  3347. competencyLoading.value = true;
  3348. currentEditingStep.value = step;
  3349. showAIVideoDialog.value = true;
  3350. currentStep.value = 1;
  3351. try {
  3352. const response2 = await GenerateCompetency({position_id:route.query.id});
  3353. console.log('response2', response2);
  3354. if (response && response.data) {
  3355. getConfigId.value=response.data.id;
  3356. }
  3357. if(response2 && response2.data){
  3358. response2.data.forEach((item:any) => {
  3359. item.selected = false;
  3360. });
  3361. competencyTags.value = response2.data;
  3362. }
  3363. } catch (error) {
  3364. console.error('生成能力标签失败:', error);
  3365. ElMessage.error('生成能力标签失败');
  3366. } finally {
  3367. competencyLoading.value = false;
  3368. }
  3369. // 重置选项
  3370. (Object.keys(aiVideoOptions) as Array<keyof typeof aiVideoOptions>).forEach(key => {
  3371. aiVideoOptions[key] = false;
  3372. });
  3373. }
  3374. };
  3375. // 保存AI视频配置
  3376. const saveAIVideoConfig = async () => {
  3377. try {
  3378. // 获取选中的能力标签
  3379. const selectedAbilities = Object.entries(aiVideoOptions)
  3380. .filter(([_, value]) => value)
  3381. .map(([key]) => key);
  3382. // 更新当前编辑的步骤
  3383. if (currentEditingStep.value) {
  3384. currentEditingStep.value.aiConfig = {
  3385. abilities: selectedAbilities,
  3386. // 可以根据需要添加其他配置
  3387. };
  3388. }
  3389. // 关闭对话框
  3390. showAIVideoDialog.value = false;
  3391. ElMessage.success('AI视频配置已保存');
  3392. } catch (error) {
  3393. console.error('保存AI视频配置失败:', error);
  3394. ElMessage.error('保存失败,请重试');
  3395. }
  3396. };
  3397. // 在 script setup 部分添加以下响应式变量
  3398. const customDimension = ref('');
  3399. const customDescription = ref('');
  3400. const continueAdd = ref(false);
  3401. // 添加新的维度
  3402. const addDimension = () => {
  3403. // 在这里添加添加新维度的逻辑
  3404. console.log('添加新维度:', customDimension.value, customDescription.value);
  3405. // 重置表单
  3406. customDimension.value = '';
  3407. customDescription.value = '';
  3408. continueAdd.value = false;
  3409. };
  3410. const settings = reactive({
  3411. keepVideo: false,
  3412. interruptionMode: '',
  3413. smartFollowUp: false
  3414. });
  3415. interface InterviewerAvatar {
  3416. id: number;
  3417. name: string;
  3418. image: string;
  3419. }
  3420. const interviewerAvatars = ref<InterviewerAvatar[]>([
  3421. {
  3422. id: 1,
  3423. name: 'Jessica',
  3424. image: '/avatars/jessica.png'
  3425. },
  3426. {
  3427. id: 2,
  3428. name: 'Mike',
  3429. image: '/avatars/mike.png'
  3430. },
  3431. {
  3432. id: 3,
  3433. name: 'Sarah',
  3434. image: '/avatars/sarah.png'
  3435. }
  3436. ]);
  3437. const selectedInterviewer = ref(interviewerAvatars.value[0]);
  3438. const interviewerAvatar = ref('');
  3439. // 添加面试官选择处理函数
  3440. const handleInterviewerSelect = (avatar: any) => {
  3441. // 更新选中的面试官
  3442. selectedInterviewer.value = avatar;
  3443. // 打印选中的面试官信息(调试用)
  3444. console.log('选中的面试官信息:', {
  3445. id: avatar.id,
  3446. name: avatar.name,
  3447. avatar_url: avatar.avatar_url || avatar.image
  3448. });
  3449. interviewerAvatar.value = avatar.avatar_url;
  3450. // 可以在这里添加其他处理逻辑
  3451. // 比如:保存到后端、触发其他事件等
  3452. // 提示用户
  3453. ElMessage.success(`已选择面试官:${avatar.name}`);
  3454. };
  3455. // 分别处理AI生成的题目和自定义选择的题目
  3456. const handleQuestionsSeparately = async () => {
  3457. // 分离AI生成的题目和自定义选择的题目
  3458. const aiGeneratedQuestions = chatQuestions.value.filter(q => q.source === 'ai_generated');
  3459. const customSelectedQuestions = chatQuestions.value.filter(q => q.source === 'custom_selected');
  3460. console.log('AI生成的题目:', aiGeneratedQuestions);
  3461. console.log('自定义选择的题目:', customSelectedQuestions);
  3462. // 处理AI生成的题目 - 调用SaveDraft接口
  3463. if (aiGeneratedQuestions.length > 0) {
  3464. await SaveDraft({
  3465. draft_ids: aiGeneratedQuestions.map((draft: any) => draft.id)
  3466. });
  3467. console.log('AI生成的题目已保存到草稿');
  3468. }
  3469. // 处理自定义选择的题目 - 调用其他接口(这里需要根据实际需求调整)
  3470. if (customSelectedQuestions.length > 0) {
  3471. // 构建API请求数据 - 修改为符合API期望的格式
  3472. const requestData = {
  3473. position_id: route.query.id,
  3474. question_id: {
  3475. question_id: customSelectedQuestions
  3476. },
  3477. duration:60,
  3478. tenant_id: 1
  3479. };
  3480. // 这里可以调用专门处理自定义题目的接口
  3481. // 例如:await SaveCustomQuestions({ question_ids: customSelectedQuestions.map(q => q.id) });
  3482. console.log('自定义选择的题目需要调用专门的接口处理');
  3483. // 临时处理:也使用SaveDraft接口,但可以在后端根据source字段区分处理
  3484. const response = await AddDocument(requestData);
  3485. if (response && response.code === 2000) {
  3486. ElMessage.success('自定义选择的题目已保存');
  3487. }else{
  3488. ElMessage.error('自定义选择的题目保存失败');
  3489. }
  3490. }
  3491. };
  3492. // 获取面试设置选项的函数
  3493. const getInterviewSettings = () => {
  3494. const interviewSettings = {
  3495. // 回答视频保留设置
  3496. keepVideo: settings.keepVideo,
  3497. // 中断后作答限制模式
  3498. interruptionMode: settings.interruptionMode,
  3499. // 智慧追问设置
  3500. smartFollowUp: settings.smartFollowUp
  3501. };
  3502. console.log('当前面试设置:', interviewSettings);
  3503. return interviewSettings;
  3504. };
  3505. // 处理面试设置变化的函数
  3506. const handleSettingChange = (settingType: string, value: any) => {
  3507. console.log(`面试设置 ${settingType} 已更改为:`, value);
  3508. // 根据不同的设置类型进行处理
  3509. switch (settingType) {
  3510. case 'keepVideo':
  3511. console.log('回答视频保留设置:', value ? '开启' : '关闭');
  3512. break;
  3513. case 'interruptionMode':
  3514. console.log('中断后作答限制模式:', value === 'previous' ? '从上一问重新作答' : '从当前问题作答');
  3515. break;
  3516. case 'smartFollowUp':
  3517. console.log('智慧追问设置:', value ? '开启' : '关闭');
  3518. break;
  3519. }
  3520. // 可以在这里添加其他处理逻辑
  3521. // 比如:实时保存到后端、触发相关事件等
  3522. };
  3523. // 验证面试设置配置完整性
  3524. const validateInterviewSettings = () => {
  3525. const currentSettings = getInterviewSettings();
  3526. // 检查必要设置是否已配置
  3527. const validation = {
  3528. isValid: true,
  3529. messages: [] as string[]
  3530. };
  3531. // 这里可以添加具体的验证逻辑
  3532. if (currentSettings.interruptionMode === '') {
  3533. validation.isValid = false;
  3534. validation.messages.push('请选择中断后作答限制模式');
  3535. }
  3536. return validation;
  3537. };
  3538. // 拖拽开始处理
  3539. const handleDragStart = (evt: any) => {
  3540. drag.value = true;
  3541. console.log('开始拖拽题目:', evt);
  3542. };
  3543. // 拖拽结束处理
  3544. const handleDragEnd = (evt: any) => {
  3545. drag.value = false;
  3546. console.log('拖拽结束:', evt);
  3547. console.log('当前题目顺序:', chatQuestions.value);
  3548. // 这里可以调用API保存新的题目顺序
  3549. // await saveQuestionOrder(chatQuestions.value);
  3550. ElMessage.success('题目顺序已更新');
  3551. };
  3552. // 获取完整的面试配置信息
  3553. const getCompleteInterviewConfig = () => {
  3554. return {
  3555. // 面试官信息
  3556. interviewer: {
  3557. id: selectedInterviewer.value.id,
  3558. name: selectedInterviewer.value.name,
  3559. avatar_url: selectedInterviewer.value.avatar_url || selectedInterviewer.value.image
  3560. },
  3561. // 面试设置
  3562. settings: getInterviewSettings(),
  3563. // 题目设置
  3564. questionSettings: {
  3565. enableScoreQuestions: questionSettings.enableScoreQuestions,
  3566. enableColorBlindQuestions: questionSettings.enableColorBlindQuestions
  3567. },
  3568. // 选中的能力标签
  3569. abilities: selectedAbilities.value,
  3570. // 题目列表
  3571. questions: chatQuestions.value,
  3572. // 当前步骤
  3573. currentStep: currentStep.value
  3574. };
  3575. };
  3576. /* 获取数字人列表 */
  3577. const getDigitalList = async () => {
  3578. const response = await GetDigitalList({page:1,pageSize:1000});
  3579. if (response && response.data) {
  3580. interviewerAvatars.value = response.data;
  3581. }
  3582. };
  3583. const handleCompetencyChange = (item: any, val: boolean) => {
  3584. if (val) {
  3585. // 当选中时,添加到已选维度列表
  3586. selectedDimensions.value.push({
  3587. name: item.name,
  3588. description: item.description || '暂无描述' // 如果没有描述则显示默认值
  3589. });
  3590. } else {
  3591. // 当取消选中时,从已选维度列表中移除
  3592. selectedDimensions.value = selectedDimensions.value.filter(
  3593. dimension => dimension.name !== item.name
  3594. );
  3595. }
  3596. };
  3597. // 删除选中的胜任力标签
  3598. const removeSelectedAbility = (index: number) => {
  3599. ElMessageBox.confirm('确认删除这个胜任力标签吗?', '提示', {
  3600. confirmButtonText: '确定',
  3601. cancelButtonText: '取消',
  3602. type: 'warning'
  3603. }).then(() => {
  3604. // 获取被删除的能力标签
  3605. const removedAbility = selectedAbilities.value[index];
  3606. // 从 selectedAbilities 数组中移除
  3607. selectedAbilities.value.splice(index, 1);
  3608. // 同时从 selectedDimensions 数组中移除对应项
  3609. selectedDimensions.value = selectedDimensions.value.filter(
  3610. dimension => dimension.name !== removedAbility.label
  3611. );
  3612. // 更新对应的checkbox状态 - 将对应的competencyTags项的selected设为false
  3613. const competencyTag = competencyTags.value.find((tag: any) => tag.name === removedAbility.label);
  3614. if (competencyTag) {
  3615. competencyTag.selected = false;
  3616. }
  3617. ElMessage.success('胜任力标签已删除');
  3618. }).catch(() => {
  3619. // 用户取消删除
  3620. });
  3621. };
  3622. // 在 script setup 部分添加以下代码
  3623. const selectedDimensions = ref<Array<{name: string, description: string}>>([]);
  3624. // 创建延迟函数
  3625. const delay = (ms: number): Promise<void> => {
  3626. return new Promise(resolve => setTimeout(resolve, ms));
  3627. };
  3628. // 轮询控制器,用于取消轮询
  3629. let pollingController: { cancelled: boolean } | null = null;
  3630. // 轮询获取草稿列表的函数
  3631. const pollForDraftList = async (params: { tenant_id: number; position_id: string }, maxAttempts: number = 30, interval: number = 2000): Promise<any> => {
  3632. let attempts = 0;
  3633. // 创建轮询控制器
  3634. pollingController = { cancelled: false };
  3635. const currentController = pollingController;
  3636. return new Promise((resolve, reject) => {
  3637. const poll = async () => {
  3638. try {
  3639. // 检查是否已取消轮询
  3640. if (currentController.cancelled) {
  3641. console.log('轮询已被取消');
  3642. resolve(null);
  3643. return;
  3644. }
  3645. attempts++;
  3646. console.log(`第${attempts}次轮询获取草稿列表...`);
  3647. const response = await GetDraftList(params);
  3648. // 再次检查是否已取消轮询(防止在异步请求期间被取消)
  3649. if (currentController.cancelled) {
  3650. console.log('轮询已被取消');
  3651. resolve(null);
  3652. return;
  3653. }
  3654. // 检查是否有数据
  3655. if (response && response.data && response.data.dataList && response.data.dataList.length > 0) {
  3656. console.log('轮询成功,获取到草稿列表数据');
  3657. pollingController = null; // 清理控制器
  3658. resolve(response);
  3659. return;
  3660. }
  3661. // 如果超过最大尝试次数,停止轮询
  3662. if (attempts >= maxAttempts) {
  3663. console.log('轮询达到最大次数,停止轮询');
  3664. pollingController = null; // 清理控制器
  3665. resolve(response); // 返回最后一次的响应,即使没有数据
  3666. return;
  3667. }
  3668. // 继续轮询
  3669. setTimeout(poll, interval);
  3670. } catch (error) {
  3671. console.error(`第${attempts}次轮询失败:`, error);
  3672. // 检查是否已取消轮询
  3673. if (currentController.cancelled) {
  3674. console.log('轮询已被取消');
  3675. resolve(null);
  3676. return;
  3677. }
  3678. // 如果是网络错误且还没超过最大尝试次数,继续尝试
  3679. if (attempts < maxAttempts) {
  3680. setTimeout(poll, interval);
  3681. } else {
  3682. pollingController = null; // 清理控制器
  3683. reject(error);
  3684. }
  3685. }
  3686. };
  3687. // 开始第一次轮询
  3688. poll();
  3689. });
  3690. };
  3691. // 取消轮询的函数
  3692. const cancelPolling = () => {
  3693. if (pollingController) {
  3694. pollingController.cancelled = true;
  3695. pollingController = null;
  3696. console.log('轮询已被手动取消');
  3697. }
  3698. };
  3699. // 处理取消生成题目
  3700. const handleCancelGenerate = () => {
  3701. cancelPolling();
  3702. autoGenerateLoading.value = false;
  3703. ElMessage.info('已取消AI自动组题');
  3704. };
  3705. // 处理得分题开关变化
  3706. const handleScoreQuestionsChange = async (value: boolean) => {
  3707. console.log('得分题开关状态:', value ? '开启' : '关闭');
  3708. if (value) {
  3709. const response = await GetQuestionList({page:1,limit:1000,question_form:4,tenant_id:1});
  3710. console.log(response);
  3711. if (response && response.data) {
  3712. BatchBind({
  3713. position_id: route.query.id,
  3714. question_id: {question_id:response.data.items.map((item: any) => item.id)},
  3715. tenant_id: 1
  3716. }).then(async (res:any)=>{
  3717. if(res.code===2000){
  3718. // 绑定成功后更新配置中的enable_psychological_test字段
  3719. try {
  3720. if (getConfigId.value > 0) {
  3721. await UpdateConfig({
  3722. id: getConfigId.value,
  3723. enable_psychological_test: true
  3724. });
  3725. console.log('配置中的enable_psychological_test字段已更新为true');
  3726. }else{
  3727. const createResponse = await CreateConfig({
  3728. position_id: route.query.id,
  3729. enable_psychological_test: true,
  3730. tenant_id: 1
  3731. });
  3732. if (createResponse && createResponse.code === 2000) {
  3733. getConfigId.value = createResponse.data?.id || createResponse.data;
  3734. console.log('配置创建成功,enable_psychological_test字段已设置为true');
  3735. }
  3736. }
  3737. } catch (error) {
  3738. console.error('更新enable_psychological_test字段失败:', error);
  3739. // 不显示错误消息给用户,避免影响主要功能的用户体验
  3740. }
  3741. ElMessage.success('得分题功能已开启');
  3742. }else{
  3743. ElMessage.error('得分题功能开启失败');
  3744. }
  3745. })
  3746. } else {
  3747. ElMessage.error('获取题目列表失败');
  3748. }
  3749. // 可以在这里添加开启得分题时的特殊逻辑
  3750. // 比如:自动添加得分相关的题目类型、更新界面显示等
  3751. } else {
  3752. try {
  3753. const response = await GetQuestionList({page:1,limit:1000,question_form:4,tenant_id:1});
  3754. if (response && response.data) {
  3755. await BatchUnbind({
  3756. position_id: route.query.id,
  3757. question_id:response.data.items.map((item: any) => item.id),
  3758. tenant_id: 1
  3759. });
  3760. // 解绑成功后更新配置中的enable_psychological_test字段
  3761. if (getConfigId.value > 0) {
  3762. await UpdateConfig({
  3763. id: getConfigId.value,
  3764. enable_psychological_test: false
  3765. });
  3766. console.log('配置中的enable_psychological_test字段已更新为false');
  3767. } else {
  3768. // 如果没有配置ID,创建新配置并设置为false
  3769. const createResponse = await CreateConfig({
  3770. position_id: route.query.id,
  3771. enable_psychological_test: false,
  3772. tenant_id: 1
  3773. });
  3774. if (createResponse && createResponse.code === 2000) {
  3775. getConfigId.value = createResponse.data?.id || createResponse.data;
  3776. console.log('配置创建成功,enable_psychological_test字段已设置为false');
  3777. }
  3778. }
  3779. ElMessage.info('得分题功能已关闭');
  3780. }
  3781. } catch (error) {
  3782. console.error('关闭得分题功能失败:', error);
  3783. ElMessage.error('关闭得分题功能失败');
  3784. }
  3785. // 可以在这里添加关闭得分题时的清理逻辑
  3786. }
  3787. // 可以在这里调用API保存设置状态
  3788. // await saveQuestionSettings(questionSettings);
  3789. };
  3790. // 处理色盲题开关变化
  3791. const handleColorBlindQuestionsChange = async (value: boolean) => {
  3792. console.log('色盲题开关状态:', value ? '开启' : '关闭');
  3793. if (value) {
  3794. // 开启色盲题
  3795. const response = await GetQuestionList({page:1,limit:1000,question_form:3,tenant_id:1}); // 假设色盲题的question_form为5
  3796. console.log(response);
  3797. if (response && response.data) {
  3798. BatchBind({
  3799. position_id: route.query.id,
  3800. question_id: {question_id:response.data.items.map((item: any) => item.id)},
  3801. tenant_id: 1
  3802. }).then(async (res:any)=>{
  3803. if(res.code===2000){
  3804. // 绑定成功后更新配置中的enable_color_blind_test字段
  3805. try {
  3806. if (getConfigId.value > 0) {
  3807. await UpdateConfig({
  3808. id: getConfigId.value,
  3809. enable_color_blind_test: true
  3810. });
  3811. console.log('配置中的enable_color_blind_test字段已更新为true');
  3812. }else{
  3813. const createResponse = await CreateConfig({
  3814. position_id: route.query.id,
  3815. enable_color_blind_test: true,
  3816. tenant_id: 1
  3817. });
  3818. if (createResponse && createResponse.code === 2000) {
  3819. getConfigId.value = createResponse.data?.id || createResponse.data;
  3820. console.log('配置创建成功,enable_color_blind_test字段已设置为true');
  3821. }
  3822. }
  3823. } catch (error) {
  3824. console.error('更新enable_color_blind_test字段失败:', error);
  3825. // 不显示错误消息给用户,避免影响主要功能的用户体验
  3826. }
  3827. ElMessage.success('色盲题功能已开启');
  3828. }else{
  3829. ElMessage.error('色盲题功能开启失败');
  3830. }
  3831. })
  3832. } else {
  3833. ElMessage.error('获取色盲题目列表失败');
  3834. }
  3835. // 可以在这里添加开启色盲题时的特殊逻辑
  3836. // 比如:自动添加色盲测试相关题目、设置特殊的评分标准等
  3837. } else {
  3838. // 关闭色盲题
  3839. try {
  3840. const response = await GetQuestionList({page:1,limit:1000,question_form:3,tenant_id:1}); // 假设色盲题的question_form为5
  3841. if (response && response.data) {
  3842. await BatchUnbind({
  3843. position_id: route.query.id,
  3844. question_id:response.data.items.map((item: any) => item.id),
  3845. tenant_id: 1
  3846. });
  3847. // 解绑成功后更新配置中的enable_color_blind_test字段
  3848. if (getConfigId.value > 0) {
  3849. await UpdateConfig({
  3850. id: getConfigId.value,
  3851. enable_color_blind_test: false
  3852. });
  3853. console.log('配置中的enable_color_blind_test字段已更新为false');
  3854. } else {
  3855. // 如果没有配置ID,创建新配置并设置为false
  3856. const createResponse = await CreateConfig({
  3857. position_id: route.query.id,
  3858. enable_color_blind_test: false,
  3859. tenant_id: 1
  3860. });
  3861. if (createResponse && createResponse.code === 2000) {
  3862. getConfigId.value = createResponse.data?.id || createResponse.data;
  3863. console.log('配置创建成功,enable_color_blind_test字段已设置为false');
  3864. }
  3865. }
  3866. ElMessage.info('色盲题功能已关闭');
  3867. }
  3868. } catch (error) {
  3869. console.error('关闭色盲题功能失败:', error);
  3870. ElMessage.error('关闭色盲题功能失败');
  3871. }
  3872. // 可以在这里添加关闭色盲题时的清理逻辑
  3873. }
  3874. };
  3875. // 在 script setup 中添加以下内容
  3876. // 题目选择相关的响应式变量
  3877. const showQuestionSelectDialog = ref(false);
  3878. const questionSearchKeyword = ref('');
  3879. const questionList = ref([]);
  3880. const selectedQuestions = ref([]);
  3881. const totalQuestions = ref(0);
  3882. const questionListQuery = reactive({
  3883. page: 1,
  3884. pageSize: 10,
  3885. keyword: '',
  3886. question_form: null as number | null
  3887. });
  3888. // 获取题目列表
  3889. const fetchQuestionList = async () => {
  3890. try {
  3891. const params = {
  3892. ...questionListQuery,
  3893. keyword: questionSearchKeyword.value,
  3894. // 只有当选择了题目类型时才传递该参数
  3895. ...(questionListQuery.question_form !== null && { question_form: questionListQuery.question_form })
  3896. };
  3897. const response = await GetQuestionList(params);
  3898. if (response && response.data) {
  3899. questionList.value = response.data.items;
  3900. totalQuestions.value = response.data.total;
  3901. }
  3902. } catch (error) {
  3903. console.error('获取题目列表失败:', error);
  3904. ElMessage.error('获取题目列表失败');
  3905. }
  3906. };
  3907. // 处理题目搜索
  3908. const handleQuestionSearch = () => {
  3909. questionListQuery.page = 1;
  3910. fetchQuestionList();
  3911. };
  3912. // 处理分页大小变化
  3913. const handleQuestionSizeChange = (val: number) => {
  3914. questionListQuery.pageSize = val;
  3915. fetchQuestionList();
  3916. };
  3917. // 处理页码变化
  3918. const handleQuestionPageChange = (val: number) => {
  3919. questionListQuery.page = val;
  3920. fetchQuestionList();
  3921. };
  3922. // 处理题目选择变化
  3923. const handleQuestionSelectionChange = (selection: any[]) => {
  3924. selectedQuestions.value = selection;
  3925. };
  3926. // 取消选择题目
  3927. const cancelQuestionSelect = () => {
  3928. showQuestionSelectDialog.value = false;
  3929. selectedQuestions.value = [];
  3930. questionSearchKeyword.value = '';
  3931. };
  3932. // 确认选择题目
  3933. const confirmQuestionSelect = () => {
  3934. if (selectedQuestions.value.length === 0) {
  3935. ElMessage.warning('请至少选择一个题目');
  3936. return;
  3937. }
  3938. console.log(selectedQuestions.value);
  3939. // 将选中的题目转换为正确的数据结构后添加到chatQuestions列表中
  3940. const formattedQuestions = selectedQuestions.value.map((question:any) => ({
  3941. id: question.id || Date.now(), // 确保有唯一ID
  3942. title: question.question || question.title,
  3943. ability: question.ability || '未设置',
  3944. content: question.content || question.question,
  3945. target: question.target || '未设置',
  3946. competency_tags: question.competency_tags || [],
  3947. question_form_name: question.question_form_name,
  3948. scoring_reference: question.scoring_reference,
  3949. question_form: question.question_form,
  3950. is_required_correct: question.is_required_correct,
  3951. weight: 100, // 默认权重
  3952. maxAnswers: 1, // 默认最多回答次数
  3953. source: 'custom_selected' as const // 标识为自定义选择的题目
  3954. }));
  3955. chatQuestions.value.push(...formattedQuestions);
  3956. // 关闭对话框并重置状态
  3957. showQuestionSelectDialog.value = false;
  3958. selectedQuestions.value = [];
  3959. questionSearchKeyword.value = '';
  3960. /* ElMessage.success(`已添加${selectedQuestions.value.length}个题目`); */
  3961. };
  3962. // 字段配置数据
  3963. const fieldConfig = reactive({
  3964. // 基本信息
  3965. name: { visible: true, label: '姓名', required: true },
  3966. gender: { visible: true, label: '性别', required: true },
  3967. three_period: { visible: true, label: '是否为三期', required: true },
  3968. phone: { visible: true, label: '手机号', required: true },
  3969. id_card: { visible: true, label: '身份证号', required: true },
  3970. ethnicity: { visible: true, label: '民族', required: true },
  3971. height: { visible: true, label: '身高(cm)', required: false },
  3972. weight: { visible: true, label: '体重(kg)', required: false },
  3973. current_address: { visible: true, label: '现居住地址', required: true },
  3974. household_location: { visible: true, label: '户口所在地', required: false },
  3975. marital_status: { visible: true, label: '婚育状况', required: false },
  3976. expected_salary: { visible: true, label: '期望薪资(元/月)', required: false },
  3977. // 家庭成员信息
  3978. family_member: {
  3979. visible: true,
  3980. label: '家庭成员',
  3981. fields: {
  3982. relation: { visible: true, label: '称谓', required: true },
  3983. name: { visible: true, label: '姓名', required: true },
  3984. workplace_address: { visible: true, label: '工作单位/家庭地址', required: false },
  3985. position: { visible: true, label: '职务', required: false },
  3986. phone: { visible: true, label: '联系电话', required: true },
  3987. is_emergency_contact: { visible: true, label: '是否为紧急联系人', required: false }
  3988. }
  3989. },
  3990. // 教育经历
  3991. education: {
  3992. visible: true,
  3993. label: '教育经历',
  3994. fields: {
  3995. start_time: { visible: true, label: '开始时间', required: true },
  3996. end_time: { visible: true, label: '结束时间', required: true },
  3997. school_name: { visible: true, label: '学校名称', required: true },
  3998. major: { visible: true, label: '专业', required: true },
  3999. degree: { visible: true, label: '学历', required: true }
  4000. }
  4001. },
  4002. // 专业技能
  4003. skills: { visible: true, label: '专业技能', required: true },
  4004. training: { visible: true, label: '受过的培训', required: true },
  4005. // 工作经历
  4006. work_experience: {
  4007. visible: true,
  4008. label: '工作经历',
  4009. fields: {
  4010. start_time: { visible: true, label: '开始时间', required: true },
  4011. end_time: { visible: true, label: '结束时间', required: true },
  4012. company_name: { visible: true, label: '单位名称', required: true },
  4013. employee_count: { visible: true, label: '单位人数', required: true },
  4014. department: { visible: true, label: '任职部门', required: true },
  4015. position: { visible: true, label: '担任职务', required: true },
  4016. monthly_salary: { visible: true, label: '月总收入', required: true },
  4017. supervisor: { visible: true, label: '直接领导', required: true },
  4018. supervisor_phone: { visible: true, label: '领导电话', required: true }
  4019. }
  4020. }
  4021. });
  4022. // 保存字段配置
  4023. const saveFieldConfig = async () => {
  4024. try {
  4025. // 构建配置数据
  4026. const configData = {
  4027. position_id: route.query.id, // 职位ID
  4028. /* config_name: "咖啡师配置", // 配置名称
  4029. digital_human_id: 4, // 数字人ID */
  4030. // 简历上传配置
  4031. require_resume_upload: true, // 是否要求上传简历
  4032. resume_file_types: ["pdf", "docx", "doc"], // 允许的文件类型
  4033. max_resume_size_mb: 10, // 最大文件大小(MB)
  4034. // 个人信息配置
  4035. require_basic_info: true, // 是否要求填写基本信息
  4036. profile_fields_config: {
  4037. name: { required: fieldConfig.name.required, visible: fieldConfig.name.visible },
  4038. phone: { required: fieldConfig.phone.required, visible: fieldConfig.phone.visible },
  4039. id_card: { required: fieldConfig.id_card.required, visible: fieldConfig.id_card.visible },
  4040. gender: { required: fieldConfig.gender.required, visible: fieldConfig.gender.visible },
  4041. birth_date: { required: false, visible: true },
  4042. political_status: { required: false, visible: true },
  4043. ethnicity: { required: fieldConfig.ethnicity.required, visible: fieldConfig.ethnicity.visible },
  4044. height: { required: fieldConfig.height.required, visible: fieldConfig.height.visible },
  4045. weight: { required: fieldConfig.weight.required, visible: fieldConfig.weight.visible },
  4046. marital_status: { required: fieldConfig.marital_status.required, visible: fieldConfig.marital_status.visible }
  4047. },
  4048. // 教育信息配置
  4049. require_education_info: fieldConfig.education.visible, // 是否要求填写教育信息
  4050. education_fields_config: {
  4051. school_name: { required: fieldConfig.education.fields.school_name.required, visible: fieldConfig.education.fields.school_name.visible },
  4052. major: { required: fieldConfig.education.fields.major.required, visible: fieldConfig.education.fields.major.visible },
  4053. degree: { required: fieldConfig.education.fields.degree.required, visible: fieldConfig.education.fields.degree.visible },
  4054. start_date: { required: fieldConfig.education.fields.start_time.required, visible: fieldConfig.education.fields.start_time.visible },
  4055. end_date: { required: fieldConfig.education.fields.end_time.required, visible: fieldConfig.education.fields.end_time.visible }
  4056. },
  4057. // 工作经验配置
  4058. require_work_experience: fieldConfig.work_experience.visible, // 是否要求填写工作经验
  4059. work_experience_fields_config: {
  4060. company_name: { required: fieldConfig.work_experience.fields.company_name.required, visible: fieldConfig.work_experience.fields.company_name.visible },
  4061. position: { required: fieldConfig.work_experience.fields.position.required, visible: fieldConfig.work_experience.fields.position.visible },
  4062. department: { required: fieldConfig.work_experience.fields.department.required, visible: fieldConfig.work_experience.fields.department.visible },
  4063. start_date: { required: fieldConfig.work_experience.fields.start_time.required, visible: fieldConfig.work_experience.fields.start_time.visible },
  4064. end_date: { required: fieldConfig.work_experience.fields.end_time.required, visible: fieldConfig.work_experience.fields.end_time.visible },
  4065. job_description: { required: true, visible: true },
  4066. achievements: { required: false, visible: true },
  4067. resignation_reason: { required: false, visible: true }
  4068. },
  4069. // 家庭信息配置
  4070. require_family_info: fieldConfig.family_member.visible, // 是否要求填写家庭信息
  4071. family_fields_config: {
  4072. relation: { required: fieldConfig.family_member.fields.relation.required, visible: fieldConfig.family_member.fields.relation.visible },
  4073. name: { required: fieldConfig.family_member.fields.name.required, visible: fieldConfig.family_member.fields.name.visible },
  4074. workplace: { required: fieldConfig.family_member.fields.workplace_address.required, visible: fieldConfig.family_member.fields.workplace_address.visible },
  4075. position: { required: fieldConfig.family_member.fields.position.required, visible: fieldConfig.family_member.fields.position.visible },
  4076. phone: { required: fieldConfig.family_member.fields.phone.required, visible: fieldConfig.family_member.fields.phone.visible }
  4077. },
  4078. // 培训经历配置
  4079. require_training_info: false,
  4080. training_fields_config: {
  4081. training_name: { required: true, visible: true },
  4082. institution: { required: true, visible: true },
  4083. start_date: { required: true, visible: true },
  4084. end_date: { required: false, visible: true },
  4085. certificate: { required: false, visible: true }
  4086. },
  4087. // 姿态配置
  4088. enable_posture_check: true,
  4089. posture_check_config: {
  4090. required_photos: ["front", "side", "back"],
  4091. instructions: "请按照提示上传您的全身照片,确保光线充足,背景简洁"
  4092. },
  4093. // 面试配置
  4094. interview_duration_minutes: 45,
  4095. enable_video_recording: true,
  4096. enable_face_recognition: true,
  4097. // 评分配置
  4098. scoring_method: "hybrid",
  4099. auto_analysis_enabled: true,
  4100. // 其他配置
  4101. custom_welcome_message: "欢迎参加咖啡师岗位的面试,请放松心情,准备好开始面试吧!",
  4102. custom_instructions: "本次面试共有10个问题,每个问题有60秒的回答时间,请简洁明了地表达您的观点。",
  4103. notification_config: {
  4104. send_email: true,
  4105. send_sms: false,
  4106. notify_hr: true,
  4107. completion_message: "感谢您完成面试,我们将在3个工作日内给您回复。"
  4108. },
  4109. is_active: true,
  4110. is_template: false
  4111. };
  4112. if(getConfigId.value==0){
  4113. }else{
  4114. configData.id=getConfigId.value;
  4115. }
  4116. // 调用后端 API
  4117. if(getConfigId.value==0){
  4118. const response = await CreateConfig(configData);
  4119. if(response.code==2000){
  4120. ElMessage.success('配置保存成功');
  4121. showDataCollectionDialog.value = false;
  4122. showOptionsMenu.value = false;
  4123. }else{
  4124. ElMessage.error('配置保存失败');
  4125. }
  4126. }else{
  4127. //configData.digital_human_opening_speech='你好,我是本次面试的面试官,欢迎参加本公司的线上面试!面试预计需要15分钟,请你提前安排在网络良好、光线亮度合适、且相对安静的环境参加这次面试以免影响本次面试的结果。如果你在面试过程中遇到问题,请与我们的招聘人员联系。'
  4128. const response = await UpdateConfig(configData);
  4129. if(response.code==2000){
  4130. ElMessage.success('配置保存成功');
  4131. showDataCollectionDialog.value = false;
  4132. showOptionsMenu.value = false;
  4133. }else{
  4134. ElMessage.error('配置保存失败');
  4135. }
  4136. }
  4137. } catch (error) {
  4138. console.error('保存配置失败:', error);
  4139. ElMessage.error('配置保存失败');
  4140. }
  4141. };
  4142. // 获取基本信息字段
  4143. const getBasicFields = () => {
  4144. const basicFields = {
  4145. name: fieldConfig.name,
  4146. gender: fieldConfig.gender,
  4147. three_period: fieldConfig.three_period,
  4148. phone: fieldConfig.phone,
  4149. id_card: fieldConfig.id_card,
  4150. ethnicity: fieldConfig.ethnicity,
  4151. height: fieldConfig.height,
  4152. weight: fieldConfig.weight,
  4153. current_address: fieldConfig.current_address,
  4154. household_location: fieldConfig.household_location,
  4155. marital_status: fieldConfig.marital_status,
  4156. expected_salary: fieldConfig.expected_salary
  4157. };
  4158. return basicFields;
  4159. };
  4160. // 获取专业技能字段
  4161. const getSkillFields = () => {
  4162. const skillFields = {
  4163. skills: fieldConfig.skills,
  4164. training: fieldConfig.training
  4165. };
  4166. return skillFields;
  4167. };
  4168. // 面试设置弹窗
  4169. const showInterviewSettingsDialog = ref(false);
  4170. const interviewSettings = reactive({
  4171. faceConsistency: true,
  4172. preventScreenshot: true,
  4173. screenSwitchAlert: true,
  4174. positionDetection: true,
  4175. eyeMovementDetection: true,
  4176. reviewInterview: false,
  4177. beforeStart: true,
  4178. beforeStartText: '你好,我是本次面试的面试官,欢迎参加本公司的线上面试!面试预计需要15分钟,请你提前安排在网络良好、光线亮度合适、且相对安静的环境参加这次面试以免影响本次面试的结果。如果你在面试过程中遇到问题,请与我们的招聘人员联系。',
  4179. afterStartReminder: false,
  4180. afterStartText: '本次面试如有15分钟,高效调前后流程,安静好心理',
  4181. disclaimer: false,
  4182. disclaimerText: '本次面试已全部结束,感谢您的参与,请等待后续通知。'
  4183. });
  4184. // 编辑状态变量
  4185. const isEditingBeforeStart = ref(false);
  4186. const isEditingAfterStart = ref(false);
  4187. const isEditingDisclaimer = ref(false);
  4188. // 编辑中的文本内容
  4189. const editingBeforeStartText = ref('');
  4190. const editingAfterStartText = ref('');
  4191. const editingDisclaimerText = ref('');
  4192. // 取消面试设置
  4193. const cancelInterviewSettings = () => {
  4194. showInterviewSettingsDialog.value = false;
  4195. // 重置编辑状态
  4196. isEditingBeforeStart.value = false;
  4197. isEditingAfterStart.value = false;
  4198. isEditingDisclaimer.value = false;
  4199. // 重置表单
  4200. Object.assign(interviewSettings, {
  4201. faceConsistency: true,
  4202. preventScreenshot: true,
  4203. screenSwitchAlert: true,
  4204. positionDetection: true,
  4205. eyeMovementDetection: true,
  4206. reviewInterview: false,
  4207. beforeStart: true,
  4208. beforeStartText: '你好,我想咨询其间的面试,欢迎来到大面试',
  4209. afterStartReminder: false,
  4210. afterStartText: '本次面试如有15分钟,高效调前后流程,安静好心理',
  4211. disclaimer: false,
  4212. disclaimerText: '本次面试已全部流程拍摄,面试者同意可为今后资讯调研'
  4213. });
  4214. };
  4215. // 确认面试设置
  4216. const confirmInterviewSettings = () => {
  4217. // 这里可以添加保存面试设置的API调用
  4218. console.log('保存面试设置:', interviewSettings);
  4219. ElMessage.success('面试设置已保存');
  4220. showInterviewSettingsDialog.value = false;
  4221. };
  4222. // 编辑面试设置
  4223. const handleEditInterview = () => {
  4224. GetConfig(route.query.id).then((res:any)=>{
  4225. showInterviewSettingsDialog.value = true;
  4226. getConfigId.value=res.data.id;
  4227. interviewSettings.beforeStartText = res.data.digital_human_opening_speech;
  4228. })
  4229. };
  4230. // 开始前文本编辑方法
  4231. const startEditBeforeStart = () => {
  4232. editingBeforeStartText.value = interviewSettings.beforeStartText;
  4233. isEditingBeforeStart.value = true;
  4234. };
  4235. const cancelEditBeforeStart = () => {
  4236. isEditingBeforeStart.value = false;
  4237. editingBeforeStartText.value = '';
  4238. };
  4239. const saveBeforeStart = async () => {
  4240. if (!editingBeforeStartText.value.trim()) {
  4241. ElMessage.warning('开始前提示内容不能为空');
  4242. return;
  4243. }
  4244. interviewSettings.beforeStartText = editingBeforeStartText.value.trim();
  4245. try {
  4246. let response;
  4247. console.log(getConfigId.value);
  4248. // 根据getConfigId的值决定调用哪个接口
  4249. if (getConfigId.value == 0) {
  4250. // getConfigId不等于0时,调用CreateConfig接口
  4251. response = await CreateConfig({
  4252. position_id: route.query.id,
  4253. digital_human_opening_speech: editingBeforeStartText.value.trim()
  4254. });
  4255. if (response.code === 2000) {
  4256. // 创建成功后更新getConfigId
  4257. getConfigId.value = response.data?.id || response.data;
  4258. ElMessage.success('开始前提示内容已创建');
  4259. isEditingBeforeStart.value = false;
  4260. } else {
  4261. ElMessage.error('开始前提示内容创建失败');
  4262. }
  4263. } else {
  4264. // getConfigId等于0时,调用UpdateConfig接口
  4265. response = await UpdateConfig({
  4266. id: getConfigId.value,
  4267. digital_human_opening_speech: editingBeforeStartText.value.trim()
  4268. });
  4269. if (response.code === 2000) {
  4270. ElMessage.success('开始前提示内容已更新');
  4271. isEditingBeforeStart.value = false;
  4272. // 调用GetOpeningSpeech接口
  4273. try {
  4274. const params = { config_id: getConfigId.value };
  4275. await GetOpeningSpeech(params);
  4276. console.log('开场白生成成功');
  4277. } catch (error) {
  4278. console.error('获取开场白失败:', error);
  4279. ElMessage.warning('开场白生成中,请稍后');
  4280. }
  4281. } else {
  4282. ElMessage.error('开始前提示内容更新失败');
  4283. }
  4284. }
  4285. } catch (error) {
  4286. console.error('保存开始前提示内容失败:', error);
  4287. ElMessage.error('保存失败,请重试');
  4288. }
  4289. };
  4290. // 开始后提醒编辑方法
  4291. const startEditAfterStart = () => {
  4292. editingAfterStartText.value = interviewSettings.afterStartText;
  4293. isEditingAfterStart.value = true;
  4294. };
  4295. const cancelEditAfterStart = () => {
  4296. isEditingAfterStart.value = false;
  4297. editingAfterStartText.value = '';
  4298. };
  4299. const saveAfterStart = () => {
  4300. if (!editingAfterStartText.value.trim()) {
  4301. ElMessage.warning('开始后提醒内容不能为空');
  4302. return;
  4303. }
  4304. interviewSettings.afterStartText = editingAfterStartText.value.trim();
  4305. isEditingAfterStart.value = false;
  4306. ElMessage.success('开始后提醒内容已更新');
  4307. };
  4308. // 免责声明编辑方法
  4309. const startEditDisclaimer = () => {
  4310. editingDisclaimerText.value = interviewSettings.disclaimerText;
  4311. isEditingDisclaimer.value = true;
  4312. };
  4313. const cancelEditDisclaimer = () => {
  4314. isEditingDisclaimer.value = false;
  4315. editingDisclaimerText.value = '';
  4316. };
  4317. const saveDisclaimer = () => {
  4318. if (!editingDisclaimerText.value.trim()) {
  4319. ElMessage.warning('免责声明内容不能为空');
  4320. return;
  4321. }
  4322. interviewSettings.disclaimerText = editingDisclaimerText.value.trim();
  4323. isEditingDisclaimer.value = false;
  4324. ElMessage.success('免责声明内容已更新');
  4325. };
  4326. // 题目数量设置
  4327. const questionCountSettings = reactive({
  4328. openQuestionsCount: 5,
  4329. choiceQuestionsCount: 10
  4330. });
  4331. // 处理题目数量变化
  4332. const handleQuestionCountChange = () => {
  4333. // 这里可以添加其他逻辑,比如保存到本地存储等
  4334. console.log('题目数量已更新:', questionCountSettings);
  4335. };
  4336. // 修改自动生成题目的方法
  4337. const handleAutoGenerate = async () => {
  4338. try {
  4339. autoGenerateLoading.value = true;
  4340. // 获取选中的能力标签ID
  4341. const competencyTagIds = selectedDimensions.value.map(dimension => {
  4342. const tag = competencyTags.value.find(tag => tag.name === dimension.name);
  4343. return tag ? tag.id : null;
  4344. }).filter(id => id !== null);
  4345. if (competencyTagIds.length === 0) {
  4346. ElMessage.warning('请先选择能力标签');
  4347. return;
  4348. }
  4349. const params = {
  4350. position_id: route.query.id,
  4351. competency_tag_ids: competencyTagIds,
  4352. open_questions_count: questionCountSettings.openQuestionsCount, // 使用设置的开放题数量
  4353. choice_questions_count: questionCountSettings.choiceQuestionsCount, // 使用设置的选择题数量
  4354. auto_save: true,
  4355. tenant_id: 1
  4356. };
  4357. // 调用生成题目的接口
  4358. const response = await GenerateQuestions(params);
  4359. if (response && response.data) {
  4360. // 生成成功后,使用轮询获取最新生成的题目
  4361. const draftResponse = await pollForDraftList({
  4362. tenant_id: 1,
  4363. position_id: route.query.id as string
  4364. });
  4365. console.log(draftResponse);
  4366. // 检查轮询是否被取消
  4367. if (draftResponse === null) {
  4368. console.log('轮询被取消,停止处理');
  4369. return;
  4370. }
  4371. if (draftResponse && draftResponse.data && draftResponse.data.dataList) {
  4372. // 将获取到的题目格式化并添加到 chatQuestions 列表中
  4373. const formattedQuestions = draftResponse.data.dataList.map((question: any) => ({
  4374. id: question.id || Date.now(),
  4375. title: question.question || question.title,
  4376. ability: question.ability || '未设置',
  4377. content: question.content || question.question,
  4378. target: question.target || '未设置',
  4379. competency_tags: question.competency_tags || [],
  4380. question_form_name: question.question_form_name,
  4381. scoring_reference: question.scoring_reference,
  4382. question_form: question.question_form,
  4383. is_required_correct: question.is_required_correct,
  4384. weight: 100,
  4385. maxAnswers: 1,
  4386. source: 'ai_generated' as const // 标识为AI生成的题目
  4387. }));
  4388. // 清空现有题目并添加新生成的题目
  4389. chatQuestions.value = formattedQuestions;
  4390. ElMessage.success(`已成功生成${formattedQuestions.length}个面试题目`);
  4391. } else {
  4392. ElMessage.warning('AI生成题目中,请稍后再试');
  4393. }
  4394. }
  4395. } catch (error) {
  4396. console.error('AI自动组题失败:', error);
  4397. ElMessage.error('AI自动组题失败,请重试');
  4398. } finally {
  4399. // 无论成功或失败都要关闭loading状态
  4400. autoGenerateLoading.value = false;
  4401. }
  4402. };
  4403. // 处理胜任力标签变化
  4404. const handleCompetencyTagsChange = (value: string[]) => {
  4405. questionForm.competencyTags = value;
  4406. // 如果只有一个标签,自动设置权重为100%
  4407. if (value.length === 1) {
  4408. questionForm.weight = 100;
  4409. }
  4410. };
  4411. // 验证胜任力配置
  4412. const validateCompetencyConfig = () => {
  4413. if (questionForm.competencyTags.length === 0) {
  4414. ElMessage.warning('请至少选择一个胜任力标签');
  4415. return false;
  4416. }
  4417. if (questionForm.weight <= 0 || questionForm.weight > 100) {
  4418. ElMessage.warning('权重必须在1-100之间');
  4419. return false;
  4420. }
  4421. if (questionForm.level < 1 || questionForm.level > 5) {
  4422. ElMessage.warning('级别必须在1-5之间');
  4423. return false;
  4424. }
  4425. return true;
  4426. };
  4427. // 处理题目形式变化
  4428. const handleQuestionTypeChange = (value: string) => {
  4429. questionForm.type = value;
  4430. // 根据题目形式设置默认建议时长
  4431. switch (value) {
  4432. case 'open':
  4433. questionForm.suggestedDuration = 120; // 开放题默认2分钟
  4434. break;
  4435. case 'single':
  4436. case 'multiple':
  4437. questionForm.suggestedDuration = 60; // 选择题默认1分钟
  4438. break;
  4439. case 'fill':
  4440. questionForm.suggestedDuration = 30; // 填空题默认30秒
  4441. break;
  4442. case 'self':
  4443. questionForm.suggestedDuration = 180; // 自言语默认3分钟
  4444. break;
  4445. default:
  4446. questionForm.suggestedDuration = 60;
  4447. }
  4448. };
  4449. // 添加状态变量
  4450. const competencyLoading = ref(false);
  4451. </script>
  4452. <style scoped>
  4453. @import './index.css';
  4454. </style>
  4455. <style lang="scss" scoped>
  4456. /* 修改 checkbox 选中颜色 */
  4457. :deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
  4458. background-color: #0419a3 !important; /* 选中背景色 */
  4459. border-color: #0419a3 !important; /* 选中边框色 */
  4460. }
  4461. /* 修改 checkbox 选中时的勾选标记颜色 */
  4462. :deep(.el-checkbox__input.is-checked .el-checkbox__inner::after) {
  4463. border-color: #ffffff !important; /* 勾选标记颜色,通常为白色 */
  4464. }
  4465. /* 修改 checkbox hover 状态颜色 */
  4466. :deep(.el-checkbox__inner:hover) {
  4467. border-color: #0419a3 !important;
  4468. }
  4469. /* 修改 checkbox focus 状态颜色 */
  4470. :deep(.el-checkbox__input.is-focus .el-checkbox__inner) {
  4471. border-color: #0419a3 !important;
  4472. }
  4473. /* 如果需要修改半选中状态的颜色 */
  4474. :deep(.el-checkbox__input.is-indeterminate .el-checkbox__inner) {
  4475. background-color: #0419a3 !important;
  4476. border-color: #0419a3 !important;
  4477. }
  4478. /* 为特定的 checkbox 组件自定义样式 */
  4479. :deep(.custom-checkbox .el-checkbox__input.is-checked .el-checkbox__inner) {
  4480. background-color: #548235 !important;
  4481. border-color: #548235 !important;
  4482. }
  4483. :deep(.custom-checkbox .el-checkbox__inner:hover) {
  4484. border-color: #0419a3 !important;
  4485. }
  4486. /* 添加题目选择对话框样式 */
  4487. .question-select-dialog {
  4488. :deep(.el-dialog__body) {
  4489. padding: 20px;
  4490. }
  4491. }
  4492. .question-select-content {
  4493. .search-bar {
  4494. margin-bottom: 20px;
  4495. .search-inputs {
  4496. display: flex;
  4497. align-items: center;
  4498. gap: 10px;
  4499. }
  4500. }
  4501. .question-list {
  4502. margin-top: 20px;
  4503. }
  4504. .pagination-container {
  4505. margin-top: 20px;
  4506. display: flex;
  4507. justify-content: flex-end;
  4508. }
  4509. }
  4510. /* 添加拖拽相关样式 */
  4511. .question-card {
  4512. position: relative;
  4513. border: 1px solid #e4e7ed;
  4514. border-radius: 4px;
  4515. padding: 16px;
  4516. margin-bottom: 12px;
  4517. background: #fff;
  4518. transition: all 0.3s;
  4519. &:hover {
  4520. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  4521. }
  4522. }
  4523. /* 拖拽状态样式 */
  4524. .sortable-ghost {
  4525. opacity: 0.5;
  4526. background: #f5f7fa;
  4527. border: 2px dashed #c0c4cc;
  4528. }
  4529. // .sortable-chosen {
  4530. // cursor: grabbing;
  4531. // transform: rotate(5deg);
  4532. // }
  4533. .sortable-drag {
  4534. cursor: grabbing;
  4535. box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  4536. transform: rotate(5deg);
  4537. }
  4538. .question-header {
  4539. display: flex;
  4540. justify-content: space-between;
  4541. align-items: flex-start;
  4542. margin-bottom: 12px;
  4543. .question-title {
  4544. display: flex;
  4545. align-items: flex-start;
  4546. gap: 12px;
  4547. flex: 1;
  4548. .title-content {
  4549. flex: 1;
  4550. display: flex;
  4551. align-items: center;
  4552. justify-content: space-between;
  4553. gap: 20px;
  4554. .question-content {
  4555. flex: 1;
  4556. display: flex;
  4557. align-items: flex-start;
  4558. gap: 10px;
  4559. flex-direction: column;
  4560. .question-number {
  4561. color: #909399;
  4562. font-size: 12px;
  4563. }
  4564. }
  4565. .question-tags {
  4566. margin-top: 5px;
  4567. flex-shrink: 0;
  4568. display: flex;
  4569. flex-wrap: nowrap;
  4570. gap: 8px;
  4571. align-items: center;
  4572. max-width: 300px;
  4573. .competency-tag {
  4574. margin: 0;
  4575. border-color: #ed7d31;
  4576. color: #fff;
  4577. background-color: #ed7d31;
  4578. font-size: 12px;
  4579. white-space: nowrap;
  4580. &:hover {
  4581. background-color: #ed7d31;
  4582. border-color: #ed7d31;
  4583. color: #fff;
  4584. }
  4585. }
  4586. .more-tags-indicator {
  4587. font-size: 12px;
  4588. color: #909399;
  4589. background-color: #f0f2f5;
  4590. padding: 2px 6px;
  4591. border-radius: 3px;
  4592. white-space: nowrap;
  4593. flex-shrink: 0;
  4594. &:hover {
  4595. color: #409eff;
  4596. background-color: #ecf5ff;
  4597. }
  4598. }
  4599. }
  4600. }
  4601. }
  4602. .question-actions {
  4603. display: flex;
  4604. gap: 4px;
  4605. }
  4606. }
  4607. .question-info {
  4608. .info-item {
  4609. margin-bottom: 8px;
  4610. &:last-child {
  4611. margin-bottom: 0;
  4612. }
  4613. .info-label {
  4614. color: #909399;
  4615. margin-right: 8px;
  4616. }
  4617. }
  4618. }
  4619. .field-config-panel {
  4620. background: #fff;
  4621. border-radius: 8px;
  4622. padding: 24px;
  4623. margin-bottom: 20px;
  4624. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  4625. .panel-header {
  4626. display: flex;
  4627. justify-content: space-between;
  4628. align-items: center;
  4629. margin-bottom: 24px;
  4630. h3 {
  4631. margin: 0;
  4632. font-size: 18px;
  4633. color: #303133;
  4634. font-weight: 600;
  4635. }
  4636. }
  4637. .section-title {
  4638. font-size: 16px;
  4639. font-weight: 500;
  4640. color: #303133;
  4641. margin: 24px 0 16px;
  4642. padding-left: 10px;
  4643. border-left: 4px solid #0419a3;
  4644. }
  4645. .field-config-item {
  4646. display: flex;
  4647. align-items: center;
  4648. justify-content: space-between;
  4649. margin-bottom: 12px;
  4650. padding: 12px 16px;
  4651. background: #f5f7fa;
  4652. border-radius: 6px;
  4653. transition: all 0.3s ease;
  4654. &:hover {
  4655. background: #eef1f6;
  4656. }
  4657. &.sub-field {
  4658. background: #fff;
  4659. border: 1px solid #e4e7ed;
  4660. margin-left: 12px;
  4661. &:hover {
  4662. border-color: #0419a3;
  4663. }
  4664. }
  4665. .field-label {
  4666. flex: 1;
  4667. font-size: 14px;
  4668. color: #606266;
  4669. display: flex;
  4670. align-items: center;
  4671. gap: 8px;
  4672. }
  4673. .required-tag {
  4674. font-size: 12px;
  4675. padding: 0 6px;
  4676. height: 20px;
  4677. line-height: 18px;
  4678. }
  4679. :deep(.el-switch.is-checked .el-switch__core) {
  4680. border-color: #0419a3;
  4681. background-color: #0419a3;
  4682. }
  4683. }
  4684. }
  4685. :deep(.el-switch.is-checked .el-switch__core) {
  4686. border-color: #0419a3;
  4687. background-color: #0419a3;
  4688. }
  4689. .el-row {
  4690. margin-bottom: 12px;
  4691. }
  4692. /* 题目开关样式 */
  4693. .question-switches {
  4694. display: flex;
  4695. align-items: center;
  4696. gap: 20px;
  4697. margin-left: auto;
  4698. padding-left: 20px;
  4699. border-left: 1px solid #e4e7ed;
  4700. .switch-item {
  4701. display: flex;
  4702. align-items: center;
  4703. gap: 8px;
  4704. .switch-label {
  4705. font-size: 14px;
  4706. color: #606266;
  4707. white-space: nowrap;
  4708. }
  4709. .el-input-number {
  4710. width: 100px;
  4711. }
  4712. }
  4713. }
  4714. /* 确保interview-actions布局正确 */
  4715. .interview-actions {
  4716. display: flex;
  4717. align-items: center;
  4718. gap: 12px;
  4719. margin-bottom: 16px;
  4720. .import-btn, .custom-btn {
  4721. flex-shrink: 0;
  4722. }
  4723. .import-btn,.custom-btn:hover{
  4724. color: #0419a3;
  4725. border-color: #0419a3;
  4726. }
  4727. }
  4728. /* 面试设置弹窗样式 */
  4729. .interview-settings-dialog {
  4730. :deep(.el-dialog__body) {
  4731. padding: 20px;
  4732. }
  4733. }
  4734. .interview-settings-content {
  4735. .settings-section {
  4736. margin-bottom: 24px;
  4737. &:last-child {
  4738. margin-bottom: 0;
  4739. }
  4740. .section-header {
  4741. margin-bottom: 16px;
  4742. .section-title {
  4743. font-size: 16px;
  4744. font-weight: 500;
  4745. color: #303133;
  4746. padding-left: 10px;
  4747. border-left: 4px solid #0419a3;
  4748. }
  4749. }
  4750. .setting-item {
  4751. display: flex;
  4752. align-items: center;
  4753. justify-content: space-between;
  4754. padding: 0 30px;
  4755. border-radius: 20px;
  4756. border: 1px solid #f0f0f0;
  4757. &:last-child {
  4758. border-bottom: none;
  4759. }
  4760. .setting-info {
  4761. display: flex;
  4762. align-items: center;
  4763. flex: 1;
  4764. margin-right: 16px;
  4765. .setting-name {
  4766. width: 30%;
  4767. font-size: 14px;
  4768. font-weight: 500;
  4769. color: #808080;
  4770. display: block;
  4771. margin-bottom: 4px;
  4772. }
  4773. .setting-desc {
  4774. width: 66%;
  4775. font-size: 12px;
  4776. color: #909399;
  4777. margin: 0;
  4778. line-height: 1.4;
  4779. }
  4780. }
  4781. :deep(.el-switch.is-checked .el-switch__core) {
  4782. border-color: #0419a3;
  4783. background-color: #0419a3;
  4784. }
  4785. .switch-desc {
  4786. font-size: 12px;
  4787. color: #909399;
  4788. margin-left: 8px;
  4789. }
  4790. .setting-desc-container {
  4791. display: flex;
  4792. align-items: center;
  4793. gap: 8px;
  4794. flex: 1;
  4795. .setting-desc {
  4796. flex: 1;
  4797. margin: 0;
  4798. }
  4799. .edit-desc-btn {
  4800. padding: 4px;
  4801. min-height: auto;
  4802. &:hover {
  4803. color: #0419a3;
  4804. }
  4805. }
  4806. }
  4807. .desc-edit-container {
  4808. display: flex;
  4809. align-items: center;
  4810. justify-content: space-between;
  4811. flex: 1;
  4812. .desc-edit-actions {
  4813. display: flex;
  4814. gap: 8px;
  4815. margin-left: 15px;
  4816. margin-top: 8px;
  4817. justify-content: flex-end;
  4818. }
  4819. }
  4820. }
  4821. }
  4822. }
  4823. .avatar-name {
  4824. margin-top: 8px;
  4825. font-size: 14px;
  4826. color: #333;
  4827. width: 100%;
  4828. text-align: center;
  4829. overflow: hidden;
  4830. white-space: nowrap;
  4831. text-overflow: ellipsis;
  4832. }
  4833. .avatar-wrapper {
  4834. display: flex;
  4835. flex-direction: column;
  4836. align-items: center;
  4837. width: 80px; // 设置一个固定宽度
  4838. }
  4839. .question-form {
  4840. .form-item {
  4841. margin-bottom: 20px;
  4842. .form-label {
  4843. font-size: 14px;
  4844. color: #333;
  4845. margin-bottom: 8px;
  4846. font-weight: 500;
  4847. .required {
  4848. color: #f56c6c;
  4849. margin-left: 4px;
  4850. }
  4851. }
  4852. .form-tip {
  4853. font-size: 12px;
  4854. color: #999;
  4855. margin-top: 4px;
  4856. }
  4857. .competency-config {
  4858. border: 1px solid #dcdfe6;
  4859. border-radius: 4px;
  4860. padding: 12px;
  4861. .config-row {
  4862. display: flex;
  4863. align-items: center;
  4864. margin-bottom: 8px;
  4865. &:last-child {
  4866. margin-bottom: 0;
  4867. }
  4868. .config-label {
  4869. flex: 1;
  4870. font-size: 14px;
  4871. color: #666;
  4872. text-align: center;
  4873. }
  4874. .tag-name {
  4875. flex: 1;
  4876. font-size: 14px;
  4877. color: #333;
  4878. text-align: center;
  4879. }
  4880. .el-input-number {
  4881. flex: 1;
  4882. margin: 0 10px;
  4883. }
  4884. }
  4885. }
  4886. .full-width {
  4887. width: 100%;
  4888. }
  4889. }
  4890. }
  4891. </style>