import{k as L,p as T,q as b,t as V,y as q,S as G}from"./index.DbBdG0ey.js";import{createCrudOptions as M}from"./crud.DZJyIh4T.js";import{g as z,a as H}from"./api.C6vHKHUJ.js";import{h as I}from"./columnPermission.CkVziPJb.js";import{_ as J}from"./BatchTagsDialog.vue_vue_type_script_setup_true_lang.5Mhnk_GX.js";import{_ as K}from"./BatchStatusDialog.vue_vue_type_script_setup_true_lang.C5jlfWgI.js";import{a as E,r,_ as Q,q as U,aj as C,J as W,o as u,K as d,b as o,S as a,c as _,M as k,u as i,G as v,R as X,a9 as Y,Q as y,H as Z}from"./vue.D1BjjNmv.js";import{_ as tt}from"./_plugin-vue_export-helper.DlAUqK2U.js";const et={class:"job-application-container"},st={class:"sidebar"},ot={class:"tree-container"},at={key:0,class:"position-list"},nt=["onClick"],it={class:"item-content"},lt={key:0,class:"item-count"},ct={class:"item-content"},rt={class:"item-count"},ut={class:"item-content"},dt={key:0,class:"item-count"},ft={class:"item-content"},pt={key:0,class:"item-count"},_t={class:"content"},vt=E({name:"areas"}),mt=E({...vt,setup(gt){const{crudBinding:$,crudRef:B,crudExpose:l,crudOptions:O,resetCrudOptions:D}=L({createCrudOptions:M,context:{openBatchTagsDialog:e=>{S.value.open(e)},openBatchStatusDialog:e=>{R.value.open(e)},selectedRows:r([])}}),S=r(),R=r(),h=r(!0),m=r([]),w=r(0),c=Q({6:0,7:0,1:0,2:0}),P=async()=>{try{const t=await(await fetch(`https://backend.qicai321.com/api/system/job/list?page=1&limit=100&tenant_id=${G.get("tenant_id")}`)).json();t.code===2e3&&t.data?m.value=t.data.map(s=>({id:s.id,title:s.title||s.name||s.job_name,count:0})):console.error("获取职位列表失败:",t.msg||"未知错误")}catch(e){console.error("获取职位列表异常:",e),m.value=[{id:1,title:"流水线操作工",count:0}]}},x=async()=>{try{const t=await z();t.code===2e3&&t.data?(w.value=t.data.total||0,t.data.status_data&&Array.isArray(t.data.status_data)&&t.data.status_data.forEach(s=>{s.status===6?c[6]=s.count:s.status===7?c[7]=s.count:s.status===1?c[1]=s.count:s.status===2&&(c[2]=s.count)})):console.error("获取申请状态统计失败:",t.message||"未知错误")}catch(e){console.error("获取申请状态统计异常:",e)}},j=()=>{h.value=!h.value},f=r("all"),g=e=>{if(f.value=e.id||"all",e.type==="all"){try{const t=l.getSearchRef();t&&typeof t.resetFields=="function"&&t.resetFields()}catch(t){console.warn("重置表单失败:",t)}l.doSearch({form:{status:"6,7"}})}else e.type==="status"?l.doSearch({form:{status:e.value}}):e.type==="position"&&l.doSearch({form:{position_title:e.value}})},N=e=>{!e||!e.records||(m.value.forEach(t=>{t.count=0}),e.records.forEach(t=>{if(t.position_title){const s=m.value.find(p=>p.title===t.position_title);s&&(s.count=(s.count||0)+1)}}))},A=()=>{l.doRefresh(),x()};return U(async()=>{await P(),await x();const e=await I(H,O);if(e&&e.crudOptions&&e.crudOptions.request){const t=e.crudOptions.request.pageRequest;e.crudOptions.request.pageRequest=async s=>{const p=await t(s);return N(p.data),p}}D(e),l.doSearch({form:{status:"6,7"}})}),(e,t)=>{const s=C("el-icon"),p=C("fs-crud"),F=C("fs-page");return u(),W(F,null,{default:d(()=>[o("div",et,[o("div",st,[o("div",ot,[o("div",{class:"category-title",onClick:j},[a(s,null,{default:d(()=>[a(i(T))]),_:1}),t[4]||(t[4]=o("span",null,"职位",-1)),a(s,{class:v(["expand-icon",{"is-expanded":h.value}])},{default:d(()=>[a(i(b))]),_:1},8,["class"])]),h.value?(u(),_("div",at,[o("div",{class:v(["tree-item",{active:f.value==="position-all"}]),onClick:t[0]||(t[0]=n=>g({type:"all",id:"position-all"}))},t[5]||(t[5]=[o("div",{class:"item-content"},[o("span",null,"全部")],-1)]),2),(u(!0),_(X,null,Y(m.value,n=>(u(),_("div",{key:"position-"+n.id,class:v(["tree-item",{active:f.value==="position-"+n.id}]),onClick:yt=>g({type:"position",value:n.title,id:"position-"+n.id})},[o("div",it,[a(s,null,{default:d(()=>[a(i(b))]),_:1}),o("span",null,y(n.title),1)]),n.count?(u(),_("div",lt,y(n.count),1)):k("",!0)],10,nt))),128))])):k("",!0),o("div",{class:v(["tree-item",{active:f.value==="all"}]),onClick:t[1]||(t[1]=n=>g({type:"all"}))},[o("div",ct,[a(s,null,{default:d(()=>[a(i(V))]),_:1}),t[6]||(t[6]=o("span",null,"全部",-1))]),o("div",rt,y(w.value)+"人",1)],2),o("div",{class:v(["tree-item",{active:f.value==="status-6"}]),onClick:t[2]||(t[2]=n=>g({type:"status",value:7,id:"status-6"}))},[o("div",ut,[a(s,null,{default:d(()=>[a(i(q))]),_:1}),t[7]||(t[7]=o("span",null,"曾就职",-1))]),c[7]?(u(),_("div",dt,y(c[7]),1)):k("",!0)],2),o("div",{class:v(["tree-item",{active:f.value==="status-7"}]),onClick:t[3]||(t[3]=n=>g({type:"status",value:6,id:"status-7"}))},[o("div",ft,[a(s,null,{default:d(()=>[a(i(q))]),_:1}),t[8]||(t[8]=o("span",null,"面试未通过",-1))]),c[6]?(u(),_("div",pt,y(c[6]),1)):k("",!0)],2)])]),o("div",_t,[a(p,Z({ref_key:"crudRef",ref:B},i($)),null,16)])]),a(J,{ref_key:"batchTagsDialogRef",ref:S,crudExpose:i(l)},null,8,["crudExpose"]),a(K,{ref_key:"batchStatusDialogRef",ref:R,crudExpose:i(l),onSuccess:A},null,8,["crudExpose"])]),_:1})}}}),qt=tt(mt,[["__scopeId","data-v-c2476c39"]]);export{qt as default};
