import{j as g,S as i,J as u,s as M}from"./index.CL7yl-Wb.js";import{a as N,r as d,_ as R,q as S,aj as l,J as v,o as p,K as o,S as r,c as $,a9 as z,R as L,b as O,P as b}from"./vue.D1BjjNmv.js";const U={class:"dialog-footer"},F=N({__name:"BatchTagsDialog",props:{crudExpose:{type:Object,required:!0}},emits:["success"],setup(y,{expose:k,emit:h}){const x=y,n=d(!1),c=d(!1),m=d([]),f=d([]),s=R({tags:[]}),V=h,w=async()=>{try{const t=await g.get("https://backend.qicai321.com/api/system/talent_tag/",{params:{page:1,limit:50,employment_status:1,tenant_id:i.get("tenant_id")},headers:{authorization:"JWT "+i.get("token")}});t.data.code===2e3&&(f.value=t.data.data.map(e=>({value:e.id,label:e.name})))}catch(t){console.error("获取标签列表失败:",t)}},C=t=>{m.value=t,n.value=!0,s.tags=[]},B=async()=>{if(!s.tags.length){u("请选择标签");return}c.value=!0;try{const t=await g.post("https://backend.qicai321.com/api/system/talent_pool/batch-bind-tags/",{ids:m.value.map(e=>e.id),tag_ids:s.tags,tenant_id:i.get("tenant_id")},{headers:{authorization:"JWT "+i.get("token")}});t.data.code===2e3?(M("标签添加成功"),n.value=!1,V("success"),x.crudExpose.doRefresh()):u(t.data.message||"操作失败")}catch(t){console.error("批量添加标签失败:",t),u("操作失败")}finally{c.value=!1}};return S(()=>{w()}),k({open:C}),(t,e)=>{const T=l("el-option"),q=l("el-select"),J=l("el-form-item"),j=l("el-form"),_=l("el-button"),E=l("el-dialog");return p(),v(E,{modelValue:n.value,"onUpdate:modelValue":e[2]||(e[2]=a=>n.value=a),title:"批量添加标签",width:"500px","close-on-click-modal":!1,"close-on-press-escape":!1},{footer:o(()=>[O("span",U,[r(_,{onClick:e[1]||(e[1]=a=>n.value=!1)},{default:o(()=>e[3]||(e[3]=[b("取消")])),_:1}),r(_,{type:"primary",onClick:B,loading:c.value},{default:o(()=>e[4]||(e[4]=[b(" 确认 ")])),_:1},8,["loading"])])]),default:o(()=>[r(j,{model:s,"label-width":"100px"},{default:o(()=>[r(J,{label:"选择标签"},{default:o(()=>[r(q,{modelValue:s.tags,"onUpdate:modelValue":e[0]||(e[0]=a=>s.tags=a),multiple:"",filterable:"","allow-create":"","default-first-option":"",placeholder:"请选择标签",style:{width:"100%"}},{default:o(()=>[(p(!0),$(L,null,z(f.value,a=>(p(),v(T,{key:a.value,label:a.label,value:a.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}});export{F as _};
