import{u as U}from"./api.Cv-V8Qbc.js";import{E as p}from"./index.D93ign_E.js";import{a as h,r as m,_ as j,aj as s,J as q,o as N,K as a,S as t,P as f}from"./vue.D1BjjNmv.js";const K=h({__name:"BatchStatusDialog",props:{crudExpose:{type:Object,required:!0}},emits:["success"],setup(v,{expose:w,emit:b}){const r=m(!1),d=m(!1),u=m(),o=j({new_status:void 0,note:"",application_ids:[]}),g={new_status:[{required:!0,message:"请选择新状态",trigger:"change"}]},V=b,x=v,y=i=>{r.value=!0,o.application_ids=i.map(e=>e.id),o.new_status=void 0,o.note=""},C=async()=>{u.value&&await u.value.validate(async i=>{if(i){d.value=!0;try{const e={application_ids:o.application_ids,new_status:o.new_status,note:o.note,tenant_id:"1"},l=await U(e);l.code===2e3?(p.success("批量修改状态成功"),r.value=!1,V("success"),x.crudExpose.doRefresh()):p.error(l.msg||"操作失败")}catch(e){console.error("批量修改状态失败:",e),p.error("操作失败，请重试")}finally{d.value=!1}}})},k=()=>{u.value&&u.value.resetFields()};return w({open:y}),(i,e)=>{const l=s("el-option"),B=s("el-select"),c=s("el-form-item"),E=s("el-input"),S=s("el-form"),_=s("el-button"),R=s("el-dialog");return N(),q(R,{modelValue:r.value,"onUpdate:modelValue":e[3]||(e[3]=n=>r.value=n),title:"批量修改申请状态",width:"500px","close-on-click-modal":!1,onClosed:k},{footer:a(()=>[t(_,{onClick:e[2]||(e[2]=n=>r.value=!1)},{default:a(()=>e[4]||(e[4]=[f("取消")])),_:1}),t(_,{type:"primary",onClick:C,loading:d.value},{default:a(()=>e[5]||(e[5]=[f("确认")])),_:1},8,["loading"])]),default:a(()=>[t(S,{model:o,"label-width":"100px",ref_key:"formRef",ref:u,rules:g},{default:a(()=>[t(c,{label:"新状态",prop:"new_status"},{default:a(()=>[t(B,{modelValue:o.new_status,"onUpdate:modelValue":e[0]||(e[0]=n=>o.new_status=n),placeholder:"请选择新状态",style:{width:"100%"}},{default:a(()=>[t(l,{value:0,label:"待面试"}),t(l,{value:1,label:"已通知面试"}),t(l,{value:2,label:"已面试"}),t(l,{value:3,label:"已录用"}),t(l,{value:4,label:"已拒绝"})]),_:1},8,["modelValue"])]),_:1}),t(c,{label:"备注",prop:"note"},{default:a(()=>[t(E,{modelValue:o.note,"onUpdate:modelValue":e[1]||(e[1]=n=>o.note=n),type:"textarea",placeholder:"请输入备注信息",rows:3},null,8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}});export{K as _};
