import{r as i,a9 as d,W as c,F as f,s as y}from"./index.Cep9aVOj.js";import{a as g}from"./authFunction.DYW8BxI3.js";import{S as t,P as n,aj as a}from"./vue.YrNK8sx4.js";function w(o){return i({url:"/api/system/interview_question/list",method:"get",params:{...o,tenant_id:1}})}function x(o){return i({url:"/api/system/interview_question/create",method:"post",data:{...o,tenant_id:"1"}})}function b(o){return i({url:"/api/system/interview_question/update",method:"put",data:{...o,tenant_id:"1"}})}function q(o){return i({url:"/api/system/interview_question/delete",method:"delete",data:{id:o}})}function v(o){return i({url:"/api/system/question_tag/list",method:"get",params:{...o,tenant_id:1}})}function B(o){return i({url:"/api/system/question_category/list",method:"get",params:{...o,tenant_id:1}})}function C(o){return i({url:"/api/system/interview_question/batch_update_tags",method:"post",data:o})}function R(o){return i({url:"/api/system/job/list",method:"get",params:o})}function U(o){return i({url:"/api/system/interview_question/batch_update_category",method:"post",data:o})}const k=function({crudExpose:o,context:r}){return{crudOptions:{request:{pageRequest:async e=>await w(e),addRequest:async({form:e})=>await x(e),editRequest:async({form:e,row:s})=>(e.id=s.id,await b(e)),delRequest:async({row:e})=>await q(e.id)},pagination:{show:!0},actionbar:{buttons:{add:{show:g("role:Create")},batchBindTags:{text:"批量绑定标签",type:"primary",show:!0,order:2,click:()=>{const e=r.selectedRows||[];if(console.log("选中的行:",e),!e||e.length===0){f("请先选择要操作的题目");return}r.openBatchTagsDialog(e)}},batchSetCategory:{text:"批量设置分类",type:"primary",show:!0,order:3,click:()=>{const e=r.selectedRows||[];if(console.log("选中的行:",e),!e||e.length===0){f("请先选择要操作的题目");return}r.openBatchCategoryDialog(e)}}}},rowHandle:{fixed:"right",width:259,buttons:{view:{show:!0,size:"small",icon:"View",type:"text"},edit:{show:g("role:Update"),size:"small",icon:"Edit",type:"text"},remove:{show:g("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_form:{title:"题目形式",search:{show:!0},type:"dict-select",column:{minWidth:100},dict:c({data:[{value:0,label:"开放问题"},{value:1,label:"单选题"},{value:2,label:"多选题"},{value:3,label:"色盲题"},{value:4,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.question_form===4?(e.options=[{option_text:"无",score:0,sort:1},{option_text:"轻度",score:1,sort:2},{option_text:"中度",score:2,sort:3},{option_text:"偏重",score:3,sort:4},{option_text:"严重",score:4,sort:5}],e.scoring_reference||(e.scoring_reference="该评分反映了症状表现的频率与严重程度。")):e.options=[]}},helper:"选择题目的形式:开放问题、单选题、多选题、色盲题或心理评估题"}},position_types:{title:"适用职位",search:{show:!0},type:"dict-select",column:{minWidth:120},dict:c({getData:async()=>{const e=await R({page:1,limit:1e3,tenant_id:1});return console.log(e.data),e.data||[]},label:"title",value:"id"}),form:{component:{props:{multiple:!0,filterable:!0,placeholder:"请选择适用职位类型"}},helper:"选择题目适用的职位类型,可多选"}},category_id:{title:"分类",search:{show:!0},type:"dict-select",column:{minWidth:120,component:{render:({row:e})=>!e.category||e.category.length===0?t("span",null,[n("-")]):t(a("el-tag"),{key:e.category.id,type:"warning",effect:"plain",size:"mini"},{default:()=>[e.category.name]})}},dict:c({getData:async()=>(await B({page:1,limit:1e3,tenant_id:1})).data.items,label:"name",value:"id"}),form:{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,[n("-")]):t("div",{style:"display: flex; flex-wrap: wrap; gap: 4px;"},[e.tags.map(s=>t(a("el-tag"),{key:s.id,type:"warning",effect:"plain",size:"mini"},{default:()=>[s.name]}))])}},dict:c({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:c({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:c({data:[{value:0,label:"停用"},{value:1,label:"启用"}]}),form:{value:1,rules:[{required:!0,message:"状态必填"}],component:{placeholder:"请选择状态"},helper:"题目的启用状态"}},is_required_correct:{title:"红线问题",search:{show:!0},type:"dict-select",column:{width:100,component:{name:"fs-component",render:({row:e})=>e.question_form!==1&&e.question_form!==2?t("span",null,[n("-")]):e.is_required_correct?t(a("el-tag"),{type:"danger",size:"small"},{default:()=>[n("是")]}):t(a("el-tag"),{type:"info",size:"small"},{default:()=>[n("否")]})}},dict:c({data:[{value:!0,label:"是"},{value:!1,label:"否"}]}),form:{value:!1,show:d(({form:e})=>e&&(e.question_form===1||e.question_form===2)),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:d(({form:e})=>e&&(e.question_form===1||e.question_form===2||e.question_form===4)),component:{name:"el-card",children:{default:({form:e})=>(e.options||(e.options=[]),e.question_form===4?t("div",null,[t("div",{class:"option-header",style:"display: flex; margin-bottom: 10px; font-weight: bold;"},[t("span",{style:"flex: 1;"},[n("选项内容")]),t("span",{style:"width: 120px; text-align: center;"},[n("分值")])]),e.options.map((s,l)=>t("div",{class:"option-item",key:l,style:"display: flex; align-items: center; margin-bottom: 10px;"},[t(a("el-input"),{modelValue:s.option_text,"onUpdate:modelValue":u=>s.option_text=u,placeholder:"请输入选项内容",style:"flex: 1; margin-right: 10px;"},null),t(a("el-input-number"),{modelValue:s.score,"onUpdate:modelValue":u=>s.score=u,min:0,max:10,style:"width: 120px;",placeholder:"分值"},null)])),t("div",{style:"display: flex; justify-content: space-between; margin-top: 10px;"},[t(a("el-button"),{type:"primary",onClick:()=>{e.options||(e.options=[]);const s=e.options.length>0?Math.max(...e.options.map(l=>l.sort||0))+1:1;e.options.push({option_text:"",score:0,sort:s})}},{default:()=>[n("添加选项")]}),e.options.length>2&&t(a("el-button"),{type:"danger",onClick:()=>{e.options.pop()}},{default:()=>[n("删除最后一项")]})])]):t("div",null,[t("div",{class:"option-header",style:"display: flex; margin-bottom: 10px; font-weight: bold;"},[t("span",{style:"flex: 1;"},[n("选项内容")]),t("span",{style:"width: 80px; text-align: center;"},[n("是否正确")])]),e.options.map((s,l)=>t("div",{class:"option-item",key:l,style:"display: flex; align-items: center; margin-bottom: 10px;"},[t(a("el-input"),{modelValue:s.option_text,"onUpdate:modelValue":u=>s.option_text=u,placeholder:"请输入选项内容",style:"flex: 1; margin-right: 10px;"},null),t(a("el-tooltip"),{content:"设置为正确答案",placement:"top",effect:"light"},{default:()=>[t("div",{onClick:()=>{e.question_form===1?e.options.forEach((u,_)=>{u.is_correct=_===l}):s.is_correct=!s.is_correct},style:"cursor: pointer; width: 80px; text-align: center;"},[e.question_form===1?t(a("el-radio"),{modelValue:s.is_correct,label:!0},null):t(a("el-checkbox"),{modelValue:s.is_correct},null)])]})])),t("div",{style:"display: flex; justify-content: space-between; margin-top: 10px;"},[t(a("el-button"),{type:"primary",onClick:()=>{e.options||(e.options=[]);const s=e.options.length>0?Math.max(...e.options.map(l=>l.sort||0))+1:1;e.options.push({option_text:"",is_correct:!1,sort:s})}},{default:()=>[n("添加选项")]}),e.options.length>2&&t(a("el-button"),{type:"danger",onClick:()=>{e.options.pop()}},{default:()=>[n("删除最后一项")]})])]))}},helper:d(({form:e})=>e.question_form===1?"添加单选题的选项,并标记正确答案(只能有一个正确答案)":e.question_form===2?"添加多选题的选项,并标记正确答案(可以有多个正确答案)":e.question_form===4?"添加心理评估题的选项,并设置每个选项的分值":"")}},scoring_reference:{title:"备注",search:{show:!1},column:{show:!1},form:{component:{name:"el-input",type:"textarea",rows:4,placeholder:d(({form:e})=>e&&e.question_form===4?"请输入评分标准说明":"请输入答案解析")},helper:d(({form:e})=>e&&e.question_form===4?"评分标准说明,例如:该评分反映了症状表现的频率与严重程度。":"题目的答案解析或备注信息")}}},table:{selection:!0,onSelectionChange:e=>{r.selectedRows=e}}}}},D=o=>({batchUpdateTags:async(m,h)=>{try{(await C({question_ids:m,tag_ids:h,tenant_id:1})).code===0&&(y("批量更新标签成功"),o.doRefresh())}catch(p){console.error("批量更新标签失败",p)}}}),E=o=>({batchUpdateCategory:async(m,h)=>{try{(await U({question_ids:m,category_id:h,tenant_id:"1"})).code===0&&(y("批量更新分类成功"),o.doRefresh())}catch(p){console.error("批量更新分类失败",p)}}}),z=Object.freeze(Object.defineProperty({__proto__:null,createCrudOptions:k,useBatchUpdateCategory:E,useBatchUpdateTags:D},Symbol.toStringTag,{value:"Module"}));export{B as G,D as a,v as b,k as c,z as d,E as u};