import{useBatchUpdateStatus as E}from"./crud.COkqkfA3.js";import{J as k,S as g,F as M,E as b,s as U}from"./index.CL7yl-Wb.js";import{C as j,d as q}from"./api.BDfMoSGE.js";import{a as D,r as v,_ as N,aj as n,J as R,o as $,K as s,S as t,b as I,Q as J,P as x}from"./vue.D1BjjNmv.js";import{_ as P}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./authFunction.D75vbqds.js";const Q={class:"selected-count"},T=D({__name:"BatchStatusDialog",props:{crudExpose:{type:Object,required:!0}},setup(V,{expose:h}){const m=V,{batchUpdateStatus:w}=E(m.crudExpose),a=v(!1),i=v(!1),u=v([]),o=N({status:null}),C=r=>{u.value=r,a.value=!0,o.status=null},y=async()=>{if(o.status===null){k("请选择要修改的状态");return}i.value=!0;try{const r=u.value.map(e=>e.id);if(o.status===1){for(const d of u.value){const l=await j({position_id:d.id,tenant_id:g.get("tenant_id")});if(l.code===2e3){const{is_all_completed:_,total_questions:c}=l.data;if(!_||c<=0){const p=c<=0?"当前职位没有设置面试题目":"面试题目视频未全部生成完成";await M.alert(`无法发布职位 "${d.title}"，原因：
${p}`,"无法发布",{confirmButtonText:"确定",type:"warning"}),i.value=!1;return}}else{b.error("检查视频状态失败，请稍后重试"),i.value=!1;return}}const e=await q({job_ids:r,tenant_id:g.get("tenant_id")});e.code===2e3?(U("职位批量发布成功"),a.value=!1,m.crudExpose.doRefresh()):b.error(e.msg||"发布失败")}else await w(r,o.status),a.value=!1,m.crudExpose.doRefresh()}finally{i.value=!1}},S=()=>{o.status=null,u.value=[]};return h({open:C}),(r,e)=>{const d=n("el-form-item"),l=n("el-option"),_=n("el-select"),c=n("el-form"),p=n("el-button"),B=n("el-dialog");return $(),R(B,{modelValue:a.value,"onUpdate:modelValue":e[2]||(e[2]=f=>a.value=f),title:"批量修改状态",width:"500px","close-on-click-modal":!1,onClosed:S},{footer:s(()=>[t(p,{onClick:e[1]||(e[1]=f=>a.value=!1)},{default:s(()=>e[3]||(e[3]=[x("取消")])),_:1}),t(p,{type:"primary",onClick:y,loading:i.value},{default:s(()=>e[4]||(e[4]=[x("确认修改")])),_:1},8,["loading"])]),default:s(()=>[t(c,{model:o,"label-width":"100px"},{default:s(()=>[t(d,{label:"选中职位"},{default:s(()=>[I("div",Q,"已选择 "+J(u.value.length)+" 个职位",1)]),_:1}),t(d,{label:"修改状态",required:""},{default:s(()=>[t(_,{modelValue:o.status,"onUpdate:modelValue":e[0]||(e[0]=f=>o.status=f),placeholder:"请选择状态",style:{width:"100%"}},{default:s(()=>[t(l,{label:"未发布",value:0}),t(l,{label:"已发布",value:1}),t(l,{label:"已过期",value:2})]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}}),H=P(T,[["__scopeId","data-v-283eaa00"]]);export{H as default};
