import{r as l,W as a,F as h,s as w}from"./index.BWgjyHe-.js";import{a as p}from"./authFunction.CIlWa-bR.js";import{S as s,P as n,aj as i}from"./vue.YrNK8sx4.js";function g(t){return l({url:"/api/system/interview_question/list",method:"get",params:{...t,tenant_id:1}})}function y(t){return l({url:"/api/system/interview_question/create",method:"post",data:{...t,tenant_id:"1"}})}function b(t){return l({url:"/api/system/interview_question/update",method:"put",data:{...t,tenant_id:"1"}})}function q(t){return l({url:"/api/system/interview_question/delete",method:"delete",data:{id:t}})}function x(t){return l({url:"/api/system/question_tag/list",method:"get",params:{...t,tenant_id:1}})}function v(t){return l({url:"/api/system/question_category/list",method:"get",params:{...t,tenant_id:1}})}function B(t){return l({url:"/api/system/interview_question/batch_update_tags",method:"get",data:t})}const T=function({crudExpose:t,context:f}){return{crudOptions:{request:{pageRequest:async e=>await g(e),addRequest:async({form:e})=>await y(e),editRequest:async({form:e,row:o})=>(e.id=o.id,await b(e)),delRequest:async({row:e})=>await q(e.id)},pagination:{show:!0},actionbar:{buttons:{add:{show:p("role:Create")}}},rowHandle:{fixed:"right",width:320,buttons:{view:{show:!0},edit:{show:p("role:Update")},remove:{show:p("role:Delete")}}},form:{col:{span:24},labelWidth:"100px",wrapper:{is:"el-dialog",width:"600px"}},columns:{_selection:{title:"选择",form:{show:!1},column:{type:"selection",align:"center",width:50,fixed:"left",columnSetDisabled:!0}},id:{title:"ID",column:{show:!0,width:80},search:{show:!1},form:{show:!1}},question:{title:"题目内容",search:{show:!0},column:{showOverflowTooltip:!0,width:300,sortable:"custom"},form:{rules:[{required:!0,message:"题目内容必填"}],component:{placeholder:"请输入题目内容"}}},question_type:{title:"问题类型",search:{show:!0},type:"dict-select",column:{minWidth:100},dict:a({data:[{value:1,label:"专业技能"},{value:2,label:"通用能力"},{value:3,label:"个人特质"}]}),form:{rules:[{required:!0,message:"问题类型必填"}],component:{placeholder:"请选择问题类型"},helper:"选择问题的类型分类"}},question_form:{title:"题目形式",search:{show:!0},type:"dict-select",column:{minWidth:100},dict:a({data:[{value:0,label:"开放问题"},{value:1,label:"单选题"},{value:2,label:"多选题"}]}),form:{rules:[{required:!0,message:"题目形式必填"}],component:{placeholder:"请选择题目形式",onChange:({form:e})=>{e.question_form===1?e.options=[{option_text:"",is_correct:!1,sort:1},{option_text:"",is_correct:!1,sort:2}]:e.question_form===2?e.options=[{option_text:"",is_correct:!1,sort:1},{option_text:"",is_correct:!1,sort:2}]:e.options=[]}},helper:"选择题目的形式:开放问题、单选题或多选题"}},position_types:{title:"适用职位",search:{show:!0},type:"dict-select",column:{minWidth:120},dict:a({data:[{value:"0",label:"技术"},{value:"1",label:"管理"}]}),form:{component:{props:{multiple:!0,filterable:!0,placeholder:"请选择适用职位类型"}},helper:"选择题目适用的职位类型,可多选"}},recommended_duration:{title:"建议时长(秒)",search:{show:!1},column:{minWidth:100},form:{component:{name:"el-input-number",props:{min:10,max:600,step:10}},helper:"建议回答此题目的时长,单位为秒"}},difficulty:{title:"难度等级",search:{show:!0},type:"dict-select",column:{minWidth:80},dict:a({data:[{value:1,label:"初级"},{value:2,label:"中级"},{value:3,label:"高级"}]}),form:{rules:[{required:!0,message:"难度等级必填"}],helper:"选择题目的难度级别"}},is_system:{title:"系统题目",search:{show:!0},column:{width:80,component:{name:"el-switch"}},form:{component:{name:"el-switch",props:{activeText:"是",inactiveText:"否"}},helper:"是否为系统预设题目"}},status:{title:"状态",search:{show:!0},type:"dict-select",column:{width:80},dict:a({data:[{value:0,label:"停用"},{value:1,label:"启用"}]}),form:{rules:[{required:!0,message:"状态必填"}],component:{placeholder:"请选择状态"},helper:"题目的启用状态"}},sort:{title:"排序",search:{show:!1},column:{width:80},form:{component:{name:"el-input-number",props:{min:1,max:999}},helper:"题目的排序值,值越小排序越靠前"}},option_items:{title:"选项列表",search:{show:!1},column:{show:!1},form:{show:h(({form:e})=>e&&(e.question_form===1||e.question_form===2)),component:{name:"el-card",children:{default:({form:e})=>(e.options||(e.options=[]),s("div",null,[s("div",{class:"option-header",style:"display: flex; margin-bottom: 10px; font-weight: bold;"},[s("span",{style:"flex: 1;"},[n("选项内容")]),s("span",{style:"width: 80px; text-align: center;"},[n("是否正确")])]),e.options.map((o,r)=>s("div",{class:"option-item",key:r,style:"display: flex; align-items: center; margin-bottom: 10px;"},[s(i("el-input"),{modelValue:o.option_text,"onUpdate:modelValue":c=>o.option_text=c,placeholder:"请输入选项内容",style:"flex: 1; margin-right: 10px;"},null),s(i("el-tooltip"),{content:"设置为正确答案",placement:"top",effect:"light"},{default:()=>[s("div",{onClick:()=>{e.question_form===1?e.options.forEach((c,_)=>{c.is_correct=_===r}):o.is_correct=!o.is_correct},style:"cursor: pointer; width: 80px; text-align: center;"},[e.question_form===1?s(i("el-radio"),{modelValue:o.is_correct,label:!0},null):s(i("el-checkbox"),{modelValue:o.is_correct},null)])]})])),s("div",{style:"display: flex; justify-content: space-between; margin-top: 10px;"},[s(i("el-button"),{type:"primary",onClick:()=>{e.options||(e.options=[]);const o=e.options.length>0?Math.max(...e.options.map(r=>r.sort||0))+1:1;e.options.push({option_text:"",is_correct:!1,sort:o})}},{default:()=>[n("添加选项")]}),e.options.length>2&&s(i("el-button"),{type:"danger",onClick:()=>{e.options.pop()}},{default:()=>[n("删除最后一项")]})])]))}},helper:h(({form:e})=>e.question_form===1?"添加单选题的选项,并标记正确答案(只能有一个正确答案)":e.question_form===2?"添加多选题的选项,并标记正确答案(可以有多个正确答案)":"")}},scoring_reference:{title:"备注",search:{show:!1},column:{show:!1},form:{component:{name:"el-input",type:"textarea",rows:4,placeholder:"请输入答案解析"}}},category_id:{title:"题目分类",search:{show:!0},type:"dict-select",column:{minWidth:120},dict:a({getData:async()=>(await v({page:1,limit:1e3,tenant_id:1})).data.items,label:"name",value:"id"}),form:{rules:[{required:!0,message:"题目分类必填"}],component:{placeholder:"请选择题目分类"},helper:"选择题目所属的分类"}},tag_ids:{title:"题目标签",search:{show:!0},type:"dict-select",column:{minWidth:150,component:{name:"fs-dict-label",props:{multiple:!0}}},dict:a({getData:async()=>(await x({page:1,limit:1e3,tenant_id:1})).data.items,label:"name",value:"id"}),form:{component:{props:{multiple:!0,filterable:!0,placeholder:"请选择题目标签"}},helper:"选择题目关联的标签,可多选"}}},table:{selection:!0}}}},W=t=>({batchUpdateTags:async(d,m)=>{try{(await B({question_ids:d,tag_ids:m,tenant_id:1})).code===0&&(w("批量更新标签成功"),t.doRefresh())}catch(u){console.error("批量更新标签失败",u)}}}),C=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:T,useBatchUpdateTags:W},Symbol.toStringTag,{value:"Module"}));export{x as G,C as a,T as c,W as u};