2 lines
3.1 KiB
JavaScript
2 lines
3.1 KiB
JavaScript
import{_ as k,V as N,o as _,c as v,e,f as o,j as a,k as b,F as I,r as B,g as C,h as O,a as x,d as D,q as J,E as g}from"./index-C1KISTGN.js";const M={class:"expert-random"},T={key:0},U={__name:"Random",setup(j){const c=b(!1),f=b([]),m=b([]),l=J({category:"",count:3,avoidExperts:[]}),w=()=>{const u=localStorage.getItem("experts");f.value=u?JSON.parse(u):[]};N(()=>{w()});const h=()=>{if(!l.category){g.warning("请选择专业分类");return}c.value=!0,setTimeout(()=>{let u=f.value.filter(p=>p.field===l.category&&!l.avoidExperts.includes(p.id));if(u.length<l.count){g.warning(`该分类可用专家不足${l.count}人`),c.value=!1;return}const t=u.sort(()=>.5-Math.random());m.value=t.slice(0,l.count);const r={id:Date.now(),category:l.category,count:l.count,experts:m.value.map(p=>p.name).join("、"),date:new Date().toISOString().split("T")[0]},i=localStorage.getItem("expertRandomRecords"),s=i?JSON.parse(i):[];s.push(r),localStorage.setItem("expertRandomRecords",JSON.stringify(s)),g.success("抽取完成"),c.value=!1},1e3)};return(u,t)=>{const r=a("el-option"),i=a("el-select"),s=a("el-form-item"),p=a("el-input-number"),y=a("el-button"),V=a("el-form"),E=a("el-divider"),d=a("el-table-column"),R=a("el-table"),S=a("el-card");return _(),v("div",M,[e(S,null,{header:o(()=>[...t[3]||(t[3]=[x("span",null,"专家随机抽取",-1)])]),default:o(()=>[e(V,{model:l,"label-width":"120px",style:{"max-width":"600px"}},{default:o(()=>[e(s,{label:"专业分类"},{default:o(()=>[e(i,{modelValue:l.category,"onUpdate:modelValue":t[0]||(t[0]=n=>l.category=n),placeholder:"请选择"},{default:o(()=>[e(r,{label:"药学",value:"药学"}),e(r,{label:"医疗器械",value:"医疗器械"}),e(r,{label:"临床医学",value:"临床医学"}),e(r,{label:"中医药",value:"中医药"}),e(r,{label:"质量管理",value:"质量管理"})]),_:1},8,["modelValue"])]),_:1}),e(s,{label:"抽取数量"},{default:o(()=>[e(p,{modelValue:l.count,"onUpdate:modelValue":t[1]||(t[1]=n=>l.count=n),min:1,max:10},null,8,["modelValue"])]),_:1}),e(s,{label:"回避专家"},{default:o(()=>[e(i,{modelValue:l.avoidExperts,"onUpdate:modelValue":t[2]||(t[2]=n=>l.avoidExperts=n),multiple:"",placeholder:"请选择需要回避的专家"},{default:o(()=>[(_(!0),v(I,null,B(f.value,n=>(_(),C(r,{key:n.id,label:n.name,value:n.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1}),e(s,null,{default:o(()=>[e(y,{type:"primary",onClick:h,loading:c.value},{default:o(()=>[...t[4]||(t[4]=[O("开始抽取",-1)])]),_:1},8,["loading"])]),_:1})]),_:1},8,["model"]),e(E),m.value.length>0?(_(),v("div",T,[t[5]||(t[5]=x("h3",null,"抽取结果",-1)),e(R,{data:m.value,border:"",style:{"margin-top":"20px"}},{default:o(()=>[e(d,{prop:"name",label:"专家姓名",width:"100"}),e(d,{prop:"gender",label:"性别",width:"80"}),e(d,{prop:"title",label:"职称",width:"120"}),e(d,{prop:"field",label:"专业领域",width:"120"}),e(d,{prop:"phone",label:"联系电话",width:"130"}),e(d,{prop:"email",label:"邮箱",width:"180","show-overflow-tooltip":""}),e(d,{prop:"organization",label:"所属单位","min-width":"200","show-overflow-tooltip":""})]),_:1},8,["data"])])):D("",!0)]),_:1})])}}},q=k(U,[["__scopeId","data-v-204f2210"]]);export{q as default};
|