import{k as L,p as T,q as b,t as V,z as q,S as z}from"./index.CL7yl-Wb.js";import{createCrudOptions as G}from"./crud.xRgrxpPv.js";import{g as M,a as H}from"./api.CUaNw7Gl.js";import{h as I}from"./columnPermission.Dp34cz6S.js";import{_ as J}from"./BatchTagsDialog.vue_vue_type_script_setup_true_lang.BGYKyeD8.js";import{_ as K}from"./BatchStatusDialog.vue_vue_type_script_setup_true_lang.WQL-gCa6.js";import{a as E,r,_ as Q,q as U,aj as S,J as W,o as u,K as d,b as a,S as o,c as _,M as k,u as l,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"},at={class:"tree-container"},ot={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:c,crudOptions:O,resetCrudOptions:D}=L({createCrudOptions:G,context:{openBatchTagsDialog:e=>{R.value.open(e)},openBatchStatusDialog:e=>{w.value.open(e)},selectedRows:r([])}}),R=r(),w=r(),h=r(!0),m=r([]),C=r(0),i=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=${z.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 M();t.code===2e3&&t.data?t.data.status_data&&Array.isArray(t.data.status_data)&&(C.value=0,t.data.status_data.forEach(s=>{s.status===6?i[6]=s.count:s.status===7?i[7]=s.count:s.status===1?i[1]=s.count:s.status===2&&(i[2]=s.count),C.value=i[6]+i[7]})):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=c.getSearchRef();t&&typeof t.resetFields=="function"&&t.resetFields()}catch(t){console.warn("重置表单失败:",t)}c.doSearch({form:{status:"6,7"}})}else e.type==="status"?c.doSearch({form:{status:e.value}}):e.type==="position"&&c.doSearch({form:{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=()=>{c.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),c.doSearch({form:{status:"6,7"}})}),(e,t)=>{const s=S("el-icon"),p=S("fs-crud"),F=S("fs-page");return u(),W(F,null,{default:d(()=>[a("div",et,[a("div",st,[a("div",at,[a("div",{class:"category-title",onClick:j},[o(s,null,{default:d(()=>[o(l(T))]),_:1}),t[4]||(t[4]=a("span",null,"职位",-1)),o(s,{class:v(["expand-icon",{"is-expanded":h.value}])},{default:d(()=>[o(l(b))]),_:1},8,["class"])]),h.value?(u(),_("div",ot,[a("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]=[a("div",{class:"item-content"},[a("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})},[a("div",it,[o(s,null,{default:d(()=>[o(l(b))]),_:1}),a("span",null,y(n.title),1)]),n.count?(u(),_("div",lt,y(n.count),1)):k("",!0)],10,nt))),128))])):k("",!0),a("div",{class:v(["tree-item",{active:f.value==="all"}]),onClick:t[1]||(t[1]=n=>g({type:"all"}))},[a("div",ct,[o(s,null,{default:d(()=>[o(l(V))]),_:1}),t[6]||(t[6]=a("span",null,"全部",-1))]),a("div",rt,y(C.value),1)],2),a("div",{class:v(["tree-item",{active:f.value==="status-6"}]),onClick:t[2]||(t[2]=n=>g({type:"status",value:6,id:"status-6"}))},[a("div",ut,[o(s,null,{default:d(()=>[o(l(q))]),_:1}),t[7]||(t[7]=a("span",null,"曾就职",-1))]),i[6]?(u(),_("div",dt,y(i[6]),1)):k("",!0)],2),a("div",{class:v(["tree-item",{active:f.value==="status-7"}]),onClick:t[3]||(t[3]=n=>g({type:"status",value:7,id:"status-7"}))},[a("div",ft,[o(s,null,{default:d(()=>[o(l(q))]),_:1}),t[8]||(t[8]=a("span",null,"具备潜力",-1))]),i[7]?(u(),_("div",pt,y(i[7]),1)):k("",!0)],2)])]),a("div",_t,[o(p,Z({ref_key:"crudRef",ref:B},l($)),null,16)])]),o(J,{ref_key:"batchTagsDialogRef",ref:R,crudExpose:l(c)},null,8,["crudExpose"]),o(K,{ref_key:"batchStatusDialogRef",ref:w,crudExpose:l(c),onSuccess:A},null,8,["crudExpose"])]),_:1})}}}),qt=tt(mt,[["__scopeId","data-v-d8f9e1e2"]]);export{qt as default};
