1 |
- import{r as n,C as p,W as i}from"./index.BsmLRken.js";import{a as c}from"./authFunction.Btaz6jXy.js";import{S as t,P as a,aj as s}from"./vue.YrNK8sx4.js";function m(l){return n({url:"/api/system/interview_question/list",method:"get",params:{...l,tenant_id:1}})}function h(l){return n({url:"/api/system/interview_question/create",method:"post",data:{...l,tenant_id:"1"}})}function f(l){return n({url:"/api/system/interview_question/update",method:"put",data:{...l,tenant_id:"1"}})}function w(l){return n({url:"/api/system/interview_question/delete",method:"delete",data:{id:l}})}const E=function({crudExpose:l,context:_}){return{crudOptions:{request:{pageRequest:async e=>await m(e),addRequest:async({form:e})=>await h(e),editRequest:async({form:e,row:o})=>(e.id=o.id,await f(e)),delRequest:async({row:e})=>await w(e.id)},pagination:{show:!0},actionbar:{buttons:{add:{show:c("role:Create")}}},rowHandle:{fixed:"right",width:320,buttons:{view:{show:!0},edit:{show:c("role:Update")},remove:{show:c("role:Delete")}}},form:{col:{span:24},labelWidth:"100px",wrapper:{is:"el-dialog",width:"600px"}},columns:{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:i({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:i({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:i({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:i({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:i({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:p(({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;"},[a("选项内容")]),t("span",{style:"width: 80px; text-align: center;"},[a("是否正确")])]),e.options.map((o,r)=>t("div",{class:"option-item",key:r,style:"display: flex; align-items: center; margin-bottom: 10px;"},[t(s("el-input"),{modelValue:o.option_text,"onUpdate:modelValue":u=>o.option_text=u,placeholder:"请输入选项内容",style:"flex: 1; margin-right: 10px;"},null),t(s("el-tooltip"),{content:"设置为正确答案",placement:"top",effect:"light"},{default:()=>[t("div",{onClick:()=>{e.question_form===1?e.options.forEach((u,d)=>{u.is_correct=d===r}):o.is_correct=!o.is_correct},style:"cursor: pointer; width: 80px; text-align: center;"},[e.question_form===1?t(s("el-radio"),{modelValue:o.is_correct,label:!0},null):t(s("el-checkbox"),{modelValue:o.is_correct},null)])]})])),t("div",{style:"display: flex; justify-content: space-between; margin-top: 10px;"},[t(s("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:()=>[a("添加选项")]}),e.options.length>2&&t(s("el-button"),{type:"danger",onClick:()=>{e.options.pop()}},{default:()=>[a("删除最后一项")]})])]))}},helper:p(({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:"请输入答案解析"}}}}}}};export{E as createCrudOptions};
|