import{r as n,M as f,W as l,K as y,s as w}from"./index.D7Q8AwfO.js";import{a as d}from"./authFunction.BbTTQzhT.js";import{S as t,P as i,aj as o}from"./vue.YrNK8sx4.js";function _(s){return n({url:"/api/system/interview_question/list",method:"get",params:{...s,tenant_id:1}})}function b(s){return n({url:"/api/system/interview_question/create",method:"post",data:{...s,tenant_id:"1"}})}function x(s){return n({url:"/api/system/interview_question/update",method:"put",data:{...s,tenant_id:"1"}})}function q(s){return n({url:"/api/system/interview_question/delete",method:"delete",data:{id:s}})}function v(s){return n({url:"/api/system/question_tag/list",method:"get",params:{...s,tenant_id:1}})}function B(s){return n({url:"/api/system/question_category/list",method:"get",params:{...s,tenant_id:1}})}function R(s){return n({url:"/api/system/interview_question/batch_update_tags",method:"post",data:s})}const E=function({crudExpose:s,context:r}){return{crudOptions:{request:{pageRequest:async e=>await _(e),addRequest:async({form:e})=>await b(e),editRequest:async({form:e,row:a})=>(e.id=a.id,await x(e)),delRequest:async({row:e})=>await q(e.id)},pagination:{show:!0},actionbar:{buttons:{add:{show:d("role:Create")},batchBindTags:{text:"批量绑定标签",type:"primary",show:!0,order:2,click:()=>{const e=r.selectedRows||[];if(console.log("选中的行:",e),!e||e.length===0){y("请先选择要操作的题目");return}r.openBatchTagsDialog(e)}}}},rowHandle:{fixed:"right",width:259,buttons:{view:{show:!0,size:"small",icon:"View",type:"text"},edit:{show:d("role:Update"),size:"small",icon:"Edit",type:"text"},remove:{show:d("role:Delete"),size:"small",type:"text",icon:"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:l({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:l({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:l({data:[{value:"0",label:"技术"},{value:"1",label:"管理"}]}),form:{component:{props:{multiple:!0,filterable:!0,placeholder:"请选择适用职位类型"}},helper:"选择题目适用的职位类型,可多选"}},category:{title:"分类",search:{show:!0},type:"dict-select",column:{minWidth:120,component:{render:({row:e})=>!e.category||e.category.length===0?t("span",null,[i("-")]):t(o("el-tag"),{key:e.category.id,type:"warning",effect:"plain",size:"mini"},{default:()=>[e.category.name]})}},dict:l({getData:async()=>(await B({page:1,limit:1e3,tenant_id:1})).data.items,label:"name",value:"id"}),form:{rules:[{required:!0,message:"题目分类必填"}],component:{placeholder:"请选择题目分类"},helper:"选择所属的分类"}},tags:{title:"标签",search:{show:!0},type:"dict-select",column:{minWidth:150,component:{name:"fs-component",render:({row:e})=>!e.tags||e.tags.length===0?t("span",null,[i("-")]):t("div",{style:"display: flex; flex-wrap: wrap; gap: 4px;"},[e.tags.map(a=>t(o("el-tag"),{key:a.id,type:"warning",effect:"plain",size:"mini"},{default:()=>[a.name]}))])}},dict:l({getData:async()=>(await v({page:1,limit:1e3,tenant_id:1})).data.items,label:"name",value:"id"}),form:{component:{props:{multiple:!0,filterable:!0,placeholder:"请选择标签"}},helper:"选择题目关联的标签,可多选"}},recommended_duration:{title:"建议时长(秒)",search:{show:!1},column:{minWidth:100},form:{value:60,component:{name:"el-input-number",props:{min:10,max:600,step:10}},helper:"建议回答此题目的时长,单位为秒"}},is_system:{title:"系统题目",search:{show:!1},type:"dict-select",column:{width:100},dict:l({data:[{value:!0,label:"是"},{value:!1,label:"否"}]}),form:{value:!1,component:{placeholder:"请选择是否为系统题目"},helper:"是否为系统预设题目"}},status:{title:"状态",search:{show:!0},type:"dict-select",column:{width:80},dict:l({data:[{value:0,label:"停用"},{value:1,label:"启用"}]}),form:{value:1,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:f(({form:e})=>e&&(e.question_form===1||e.question_form===2)),component:{name:"el-card",children:{default:({form:e})=>(e.options||(e.options=[]),t("div",null,[t("div",{class:"option-header",style:"display: flex; margin-bottom: 10px; font-weight: bold;"},[t("span",{style:"flex: 1;"},[i("选项内容")]),t("span",{style:"width: 80px; text-align: center;"},[i("是否正确")])]),e.options.map((a,u)=>t("div",{class:"option-item",key:u,style:"display: flex; align-items: center; margin-bottom: 10px;"},[t(o("el-input"),{modelValue:a.option_text,"onUpdate:modelValue":p=>a.option_text=p,placeholder:"请输入选项内容",style:"flex: 1; margin-right: 10px;"},null),t(o("el-tooltip"),{content:"设置为正确答案",placement:"top",effect:"light"},{default:()=>[t("div",{onClick:()=>{e.question_form===1?e.options.forEach((p,g)=>{p.is_correct=g===u}):a.is_correct=!a.is_correct},style:"cursor: pointer; width: 80px; text-align: center;"},[e.question_form===1?t(o("el-radio"),{modelValue:a.is_correct,label:!0},null):t(o("el-checkbox"),{modelValue:a.is_correct},null)])]})])),t("div",{style:"display: flex; justify-content: space-between; margin-top: 10px;"},[t(o("el-button"),{type:"primary",onClick:()=>{e.options||(e.options=[]);const a=e.options.length>0?Math.max(...e.options.map(u=>u.sort||0))+1:1;e.options.push({option_text:"",is_correct:!1,sort:a})}},{default:()=>[i("添加选项")]}),e.options.length>2&&t(o("el-button"),{type:"danger",onClick:()=>{e.options.pop()}},{default:()=>[i("删除最后一项")]})])]))}},helper:f(({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:"请输入答案解析"}}}},table:{selection:!0,onSelectionChange:e=>{r.selectedRows=e}}}}},T=s=>({batchUpdateTags:async(m,h)=>{try{(await R({question_ids:m,tag_ids:h,tenant_id:1})).code===0&&(w("批量更新标签成功"),s.doRefresh())}catch(c){console.error("批量更新标签失败",c)}}}),O=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:E,useBatchUpdateTags:T},Symbol.toStringTag,{value:"Module"}));export{v as G,O as a,E as c,T as u};