import{a8 as u,W as i}from"./index.DeYmuSuw.js";import{aH as c,S as o,P as a,aj as s}from"./vue.YrNK8sx4.js";import{a as d,D as p,b as h,c as m,G as w}from"./api.CWht2tQC.js";const E=function({crudExpose:f}){return c(),{crudOptions:{request:{pageRequest:async e=>{console.log(e);const t={...e,tenant_id:"1",category:e.form&&e.form.category||e.category||"",job_id:e.job_id||1};return console.log("Request params:",t),w(t)},addRequest:async({form:e})=>await m(e),editRequest:async({form:e,row:t})=>await h({...e,id:t.id}),delRequest:async({row:e})=>await p({id:e.id})},actionbar:{buttons:{add:{show:!0,text:"新增职位问题",icon:"Plus",click:()=>{const e=new CustomEvent("openPositionQuestionDialog");window.dispatchEvent(e)}}}},search:{show:!0,onSearch:e=>(console.log("Search params:",e),e),columns:{category:{title:"分类",search:{show:!0,value:""},type:"text",column:{show:!1}}}},rowHandle:{width:350,buttons:{view:{size:"small",icon:"View",type:"text",click:({row:e})=>{const t=new CustomEvent("viewDocumentDetail",{detail:e});window.dispatchEvent(t)}},uploadVideo:{text:"上传视频",type:"text",icon:"upload",size:"small",click:({row:e})=>{const t=new CustomEvent("openVideoUploadDialog",{detail:e});window.dispatchEvent(t)}},edit:{type:"text",icon:"Edit",size:"small"},remove:{type:"text",icon:"Delete",size:"small"},sort:{type:"text",icon:"sort",size:"small",text:"修改排序",click:({row:e})=>{const t=new CustomEvent("openSortDialog",{detail:e});window.dispatchEvent(t)}}}},form:{view:{disabled:!0,display:"text"}},columns:{id:{title:"ID",column:{show:!0,width:80},search:{show:!1},form:{show:!1}},position_id:{title:"职位",search:{show:!0},type:"dict-select",dict:i({url({form:e}){return"/api/system/job/list?tenant_id=1"},label:"title",value:"id"}),column:{value:"1",minWidth:120,show:!1},form:{show:!0}},question_id:{title:"职位问题",search:{show:!1},type:"dict-select",dict:i({url:"/api/categories",getData:async()=>(await d({page:1,limit:200,tenant_id:1})).data.items,label:"question",value:"id"}),column:{value:"1",show:!1},form:{show:!0,component:{props:{filterable:!0,clearable:!0,placeholder:"请选择职位问题"}}}},question:{title:"题目内容",search:{show:!0},column:{sortable:"custom",showOverflowTooltip:!0,width:300},form:{rules:[{required:!0,message:"题目内容必填"}],component:{placeholder:"请输入题目内容"},show:!1}},question_form:{title:"题目形式",search:{show:!0},type:"dict-select",column:{minWidth:100},dict:i({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.options=[]}},helper:"选择题目的形式:开放问题、单选题或多选题",show:!1}},difficulty:{title:"难度等级",search:{show:!0},type:"dict-select",column:{minWidth:80},dict:i({data:[{value:1,label:"初级"},{value:2,label:"中级"},{value:3,label:"高级"}]}),form:{rules:[{required:!0,message:"难度等级必填"}],helper:"选择题目的难度级别",show:!1}},option_items:{title:"选项列表",search:{show:!1},column:{show:!1},form:{component:{name:"el-card",children:{default:({form:e})=>(e.options||(e.options=[]),o("div",null,[o("div",{class:"option-header",style:"display: flex; margin-bottom: 10px; font-weight: bold;"},[o("span",{style:"flex: 1;"},[a("选项内容")]),o("span",{style:"width: 80px; text-align: center;"},[a("是否正确")])]),e.options.map((t,l)=>o("div",{class:"option-item",key:l,style:"display: flex; align-items: center; margin-bottom: 10px;"},[o(s("el-input"),{modelValue:t.option_text,"onUpdate:modelValue":n=>t.option_text=n,placeholder:"请输入选项内容",style:"flex: 1; margin-right: 10px;"},null),o(s("el-tooltip"),{content:"设置为正确答案",placement:"top",effect:"light"},{default:()=>[o("div",{onClick:()=>{e.question_form===1?e.options.forEach((n,r)=>{n.is_correct=r===l}):t.is_correct=!t.is_correct},style:"cursor: pointer; width: 80px; text-align: center;"},[e.question_form===1?o(s("el-radio"),{modelValue:t.is_correct,label:!0},null):o(s("el-checkbox"),{modelValue:t.is_correct},null)])]})])),o("div",{style:"display: flex; justify-content: space-between; margin-top: 10px;"},[o(s("el-button"),{type:"primary",onClick:()=>{e.options||(e.options=[]);const t=e.options.length>0?Math.max(...e.options.map(l=>l.sort||0))+1:1;e.options.push({option_text:"",is_correct:!1,sort:t})}},{default:()=>[a("添加选项")]}),e.options.length>2&&o(s("el-button"),{type:"danger",onClick:()=>{e.options.pop()}},{default:()=>[a("删除最后一项")]})])]))}},show:!1,helper:u(({form:e})=>e.question_form===1?"添加单选题的选项,并标记正确答案(只能有一个正确答案)":e.question_form===2?"添加多选题的选项,并标记正确答案(可以有多个正确答案)":"")}},sequence_number:{title:"排序",search:{show:!1},column:{show:!0},form:{show:!0}},answer_explanation:{title:"答案解析",search:{show:!1},column:{show:!1},form:{component:{name:"el-input",type:"textarea",rows:4,placeholder:"请输入答案解析"},show:!1}},digital_human_video_url:{title:"视频链接",search:{show:!1},column:{show:!0,width:120,formatter:({row:e})=>e.digital_human_video_url?"已上传":"未上传"},form:{show:!1}},digital_human_video_subtitle:{title:"字幕",search:{show:!1},column:{show:!0,width:120,formatter:({row:e})=>e.digital_human_video_subtitle?"已上传":"未上传"},form:{show:!1}}}}}};export{E as createCrudOptions};