const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RoleDrawer.CHlZ3W6S.js","assets/index.CL7yl-Wb.js","assets/vue.D1BjjNmv.js","assets/index.DgHxlRHa.css","assets/splitpanes.DuIxzowM.js","assets/splitpanes.C2zCCjIY.css","assets/RoleDrawerStores.Bmochpay.js","assets/RoleUsersStores.D6nDYbwL.js","assets/api.B3kiuYtw.js","assets/_plugin-vue_export-helper.DlAUqK2U.js","assets/RoleDrawer.ClKFTd_V.css"])))=>i.map(i=>d[i]);
import{k as A,_ as F,s as v,S as d,j as L,E as u,F as p}from"./index.CL7yl-Wb.js";import{a as D,r as a,aH as O,q as H,aj as g,J as I,o as h,K as C,S as n,H as N,u as m,aA as Q,b as J,c as $}from"./vue.D1BjjNmv.js";import{createCrudOptions as K}from"./crud.COkqkfA3.js";import{R as z}from"./RoleDrawerStores.Bmochpay.js";import{R as G}from"./RoleMenuBtnStores.Ds74f0Jk.js";import{R as W}from"./RoleMenuFieldStores.1tuZt4kb.js";import{R as X}from"./RoleUsersStores.D6nDYbwL.js";import Y from"./BatchTagsDialog.DJAaGHSB.js";import Z from"./BatchStatusDialog.BmfFJcCG.js";import{C as ee,P as te}from"./api.BDfMoSGE.js";import{_ as oe}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./authFunction.D75vbqds.js";import"./api.B3kiuYtw.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(()=>F(()=>import("./RoleDrawer.CHlZ3W6S.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]))),r=a(!1),i=a(""),S=z(),T=G(),w=W(),E=X(),f=O(),R=a(),x=a(),q=a([]);async function P(e){console.log(d.get("tenant_id"));try{r.value=!0,i.value="";const t=await L.post("https://backend.qicai321.com/api/system/wechat/qrcode",{scene:`${d.get("tenant_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 p.alert(`职位信息不完整，缺少以下必填信息：
${o.join("、")}

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