crud.D1as92hz.js 7.0 KB

1
  1. import{B as c,W as a}from"./index.DJRppC5x.js";import{aH as p,S as s,P as l,aj as i}from"./vue.D1BjjNmv.js";import{d,e as r,f as m,g as h,h as f,i as w,c as _}from"./api.CFtVpKtV.js";const D=function({crudExpose:g}){return p(),{crudOptions:{toolbar:{buttons:{search:{show:!1},refresh:{show:!1},compact:{show:!1},export:{text:"导出",type:"primary",size:"small",icon:"upload",circle:!1,display:!0,show:!1},columns:{show:!1}}},request:{pageRequest:async e=>{var o;console.log(e);const t={...e,limit:100,tenant_id:"1",question_category:e.form&&e.form.category||e.category||"",question_tags:e.form&&e.form.tag||e.tag||""};return t.question_category||t.question_tags?(t.question_category==5&&(t.question_form="4"),w(t)):_({...t,question_form:e.question_form,job_id:((o=e.form)==null?void 0:o.job_id)||e.job_id||1})},addRequest:async({form:e})=>await f(e),editRequest:async({form:e,row:t})=>await h({...e,id:t.id}),delRequest:async({row:e})=>await m({id:e.id})},pagination:{show:!1,pageSize:100,pageSizes:[50,100],showSizePicker:!0},actionbar:{buttons:{add:{show:!0,text:"新增职位问题",icon:"Plus",size:"small",click:()=>{const e=new CustomEvent("openPositionQuestionDialog");window.dispatchEvent(e)}}}},search:{show:!0,autoSearch:!1,buttons:{search:{size:"small"},reset:{size:"small"}},onSearch:e=>{},columns:{category:{title:"分类",search:{show:!0,value:""},type:"text",column:{show:!1}}}},rowHandle:{width:350,buttons:{view:{size:"small",icon:"View",type:"text",show:!1,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)}},bindParentQuestion:{text:"绑定开放问题",type:"text",icon:"Link",size:"small",show:!1,click:async({row:e})=>{const t=new CustomEvent("openBindParentQuestionDialog",{detail:e});window.dispatchEvent(t)}},edit:{show:!1,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:!1,size:"small",col:{span:3}},type:"dict-select",dict:a({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:a({url:"/api/categories",getData:async()=>(await r({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,size:"small",col:{span:3}},column:{sortable:"custom",showOverflowTooltip:!0,width:300},form:{rules:[{required:!0,message:"题目内容必填"}],component:{placeholder:"请输入题目内容"},show:!1}},parent_question_id:{title:"关联开放问题",search:{show:!1,size:"small",col:{span:3}},type:"dict-select",dict:a({getData:async()=>(await r({page:1,limit:200,tenant_id:1,question_form:0})).data.items,label:"question",value:"id"}),column:{minWidth:150,showOverflowTooltip:!0,formatter:({row:e})=>e.parent_question&&e.parent_question.question?e.parent_question.question:e.parent_question_id?`${e.parent_question_id}`:"无关联问题"},form:{show:!0,component:{props:{filterable:!0,clearable:!0,placeholder:"请选择关联的开放问题"}},helper:"关联到对应的开放问题,用于中文释义"}},question_form:{title:"题目形式",search:{show:!1,size:"small",col:{span:3}},type:"dict-select",column:{minWidth:100},dict:a({getData:async()=>(await d()).data.question_forms||[],label:"label",value:"value"}),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:!1,size:"small",col:{span:3}},type:"dict-select",column:{minWidth:80},dict:a({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=[]),s("div",null,[s("div",{class:"option-header",style:"display: flex; margin-bottom: 10px; font-weight: bold;"},[s("span",{style:"flex: 1;"},[l("选项内容")]),s("span",{style:"width: 80px; text-align: center;"},[l("是否正确")])]),e.options.map((t,o)=>s("div",{class:"option-item",key:o,style:"display: flex; align-items: center; margin-bottom: 10px;"},[s(i("el-input"),{modelValue:t.option_text,"onUpdate:modelValue":n=>t.option_text=n,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((n,u)=>{n.is_correct=u===o}):t.is_correct=!t.is_correct},style:"cursor: pointer; width: 80px; text-align: center;"},[e.question_form===1?s(i("el-radio"),{modelValue:t.is_correct,label:!0},null):s(i("el-checkbox"),{modelValue:t.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 t=e.options.length>0?Math.max(...e.options.map(o=>o.sort||0))+1:1;e.options.push({option_text:"",is_correct:!1,sort:t})}},{default:()=>[l("添加选项")]}),e.options.length>2&&s(i("el-button"),{type:"danger",onClick:()=>{e.options.pop()}},{default:()=>[l("删除最后一项")]})])]))}},show:!1,helper:c(({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{D as createCrudOptions};