import{G as U}from"./api.Chpe9Vbl.js";import{useBatchUpdateTags as D}from"./crud.DG1LiiRE.js";import{B as E}from"./index.D93ign_E.js";import{a as N,r as i,_ as j,q as G,aj as s,J as _,o as c,K as a,S as n,b as I,Q as L,c as M,a9 as O,R as Q,P as g}from"./vue.D1BjjNmv.js";import{_ as S}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./api.DFVyvDs2.js";import"./authFunction.BLxX_QUS.js";const F={class:"selected-count"},J=N({__name:"BatchTagsDialog",props:{crudExpose:{type:Object,required:!0}},setup(v,{expose:b}){const y=v,{batchUpdateTags:x}=D(y.crudExpose),r=i(!1),u=i(!1),d=i([]),m=i([]),l=j({tags:[]}),V=async()=>{try{const e=await U({page:1,limit:1e3,tenant_id:1});console.log("res",e),e.code===2e3&&e.data&&e.data.items&&(m.value=e.data.items)}catch(e){console.error("获取标签数据失败",e)}},B=e=>{d.value=e,r.value=!0,l.tags=[]},C=async()=>{if(l.tags.length===0){E("请至少选择一个标签");return}u.value=!0;try{const e=d.value.map(t=>t.id);await x(e,l.tags),r.value=!1}finally{u.value=!1}},h=()=>{l.tags=[],d.value=[]};return G(()=>{V()}),b({open:B}),(e,t)=>{const p=s("el-form-item"),k=s("el-option"),w=s("el-select"),T=s("el-form"),f=s("el-button"),q=s("el-dialog");return c(),_(q,{modelValue:r.value,"onUpdate:modelValue":t[2]||(t[2]=o=>r.value=o),title:"批量绑定标签",width:"500px","close-on-click-modal":!1,onClosed:h},{footer:a(()=>[n(f,{onClick:t[1]||(t[1]=o=>r.value=!1)},{default:a(()=>t[3]||(t[3]=[g("取消")])),_:1}),n(f,{type:"primary",onClick:C,loading:u.value},{default:a(()=>t[4]||(t[4]=[g("确认绑定")])),_:1},8,["loading"])]),default:a(()=>[n(T,{model:l,"label-width":"100px"},{default:a(()=>[n(p,{label:"选中职位"},{default:a(()=>[I("div",F,"已选择 "+L(d.value.length)+" 个职位",1)]),_:1}),n(p,{label:"选择标签",required:""},{default:a(()=>[n(w,{modelValue:l.tags,"onUpdate:modelValue":t[0]||(t[0]=o=>l.tags=o),multiple:"",filterable:"",placeholder:"请选择要绑定的标签",style:{width:"100%"}},{default:a(()=>[(c(!0),M(Q,null,O(m.value,o=>(c(),_(k,{key:o.id,label:o.name,value:o.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["modelValue"])}}}),W=S(J,[["__scopeId","data-v-2600e19d"]]);export{W as default};
