const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RoleDrawer.Dp5Nt-uV.js","assets/index.DbBdG0ey.js","assets/vue.D1BjjNmv.js","assets/index.4Qdovvko.css","assets/splitpanes.DuIxzowM.js","assets/splitpanes.C2zCCjIY.css","assets/RoleDrawerStores.Bmochpay.js","assets/RoleUsersStores.C79MIgyv.js","assets/api.DnurR5DI.js","assets/_plugin-vue_export-helper.DlAUqK2U.js","assets/RoleDrawer.ClKFTd_V.css"])))=>i.map(i=>d[i]);
import{k as A,_ as L,s as B,j as O,E as u,Z as d,S as v}from"./index.DbBdG0ey.js";import{a as D,r as a,aH as F,q as H,aj as _,J as I,o as g,K as C,S as n,H as N,u as p,aA as Q,b as J,c as $}from"./vue.D1BjjNmv.js";import{createCrudOptions as K}from"./crud.BebDi9Ev.js";import{R as Z}from"./RoleDrawerStores.Bmochpay.js";import{R as z}from"./RoleMenuBtnStores.Ds74f0Jk.js";import{R as G}from"./RoleMenuFieldStores.1tuZt4kb.js";import{R as W}from"./RoleUsersStores.C79MIgyv.js";import X from"./BatchTagsDialog.B_j7nYei.js";import Y from"./BatchStatusDialog.RqVs8pGc.js";import{C as ee,P as te}from"./api.DG8VhOBG.js";import{_ as oe}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./authFunction.BxREwNvp.js";import"./api.DnurR5DI.js";const se={class:"qrcode-container"},ae=["src"],ne={key:1,class:"loading"},re=D({name:"role"}),ie=D({...re,setup(ce){const k=Q(()=>L(()=>import("./RoleDrawer.Dp5Nt-uV.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),r=a(!1),i=a(""),S=Z(),T=z(),E=G(),w=W(),m=F(),h=a(),R=a(),q=a([]);async function P(e){try{r.value=!0,i.value="";const t=await O.post("https://backend.qicai321.com/api/system/wechat/qrcode",{scene:`${e.id}`,page:"pages/index/index",width:430,auto_color:!1,is_hyaline:!1},{responseType:"blob"}),s=new Blob([t.data],{type:"image/png"});i.value=URL.createObjectURL(s)}catch(t){console.error("生成小程序码失败:",t),u.error("生成小程序二维码失败，请稍后重试"),r.value=!1}}function M(e){const s=[{field:"title",name:"职位名称"}].filter(({field:o})=>!e[o]||typeof e[o]=="string"&&e[o].trim()==="").map(({name:o})=>o);return{isComplete:s.length===0,missing:s}}async function V(e){try{const t=e.status===2?"重新发布":"发布",{isComplete:s,missing:o}=M(e);if(!s){await d.alert(`职位信息不完整，缺少以下必填信息：
${o.join("、")}

请先完善职位信息后再发布。`,"职位信息不完整",{confirmButtonText:"去完善",type:"warning"}),m.push(`/position/detail?id=${e.id}`);return}if(e.end_date&&new Date(e.end_date)<new Date&&await d.confirm(`职位截止日期已过期（${e.end_date}），是否要更新截止日期后再发布？`,"截止日期已过期",{confirmButtonText:"更新并发布",cancelButtonText:"仍要发布",distinguishCancelAndClose:!0,type:"warning"})==="confirm"){m.push(`/position/detail?id=${e.id}`);return}const l=await ee({position_id:e.id,tenant_id:v.get("tenant_id")});if(l.code===2e3){const{is_all_completed:y,total_questions:b}=l.data;if(!y||b<=0){await d.alert(`无法${t}职位，原因：
${b<=0?"当前职位没有设置面试题目":"面试题目视频未全部生成完成"}`,"无法发布",{confirmButtonText:"确定",type:"warning"});return}}else{u.error("检查视频状态失败，请稍后重试");return}const f=e.status===2?`确定要重新发布职位 "${e.title}" 吗？`:`确定要发布职位 "${e.title}" 吗？发布后求职者即可看到此职位。`;await d.confirm(f,`确认${t}`,{confirmButtonText:`确定${t}`,cancelButtonText:"取消",type:"warning"});const x=await te({job_id:e.id,tenant_id:v.get("tenant_id")});x.code===2e3?(B(`职位${t}成功`),c.doRefresh()):u.error(x.msg||`${t}失败`)}catch(t){t!=="cancel"&&t!=="close"&&(console.error("发布职位失败:",t),u.error("操作失败，请稍后重试"))}}const{crudBinding:U,crudRef:j,crudExpose:c}=A({createCrudOptions:K,context:{RoleDrawer:S,RoleMenuBtn:T,RoleMenuField:E,generateQRCode:P,publishPosition:V,router:m,$message:{warning:e=>B(e)},selectedRows:q,openBatchTagsDialog:e=>{h.value.open(e)},openBatchStatusDialog:e=>{R.value.open(e)}}});return H(async()=>{c.doRefresh(),w.get_all_users()}),(e,t)=>{const s=_("fs-crud"),o=_("el-dialog"),l=_("fs-page");return g(),I(l,null,{default:C(()=>[n(s,N({ref_key:"crudRef",ref:j},p(U)),null,16),n(p(k)),n(o,{modelValue:r.value,"onUpdate:modelValue":t[0]||(t[0]=f=>r.value=f),title:"小程序二维码",width:"400px","align-center":""},{default:C(()=>[J("div",se,[i.value?(g(),$("img",{key:0,src:i.value,alt:"小程序二维码"},null,8,ae)):(g(),$("div",ne,"生成中..."))])]),_:1},8,["modelValue"]),n(X,{ref_key:"batchTagsDialogRef",ref:h,crudExpose:p(c)},null,8,["crudExpose"]),n(Y,{ref_key:"batchStatusDialogRef",ref:R,crudExpose:p(c)},null,8,["crudExpose"])]),_:1})}}}),Be=oe(ie,[["__scopeId","data-v-1bb3f40b"]]);export{Be as default};
