import{u as _}from"./useResponse.DqThFJSa.js";import{f as K,h as $,i as q}from"./api.BPEftIz6.js";import{F as z,G as A,h as O}from"./elementPlus.CqHltQSO.js";import{d as H,aJ as P,aK as Q,aI as W,r as c,E as X,ai as d,o as f,c as v,U as t,O as n,u,S as g,a as r,D as Y,F as M,a8 as h,M as B,T as Z}from"./vue.1RczIYhx.js";import{_ as ee}from"./_plugin-vue_export-helper.DlAUqK2U.js";import"./index.DoJnwA7v.js";const le={class:"flex flex-wrap gap-1.5 min-h-14"},oe=H({__name:"NoticeDialog",props:P({rowData:Object},{modelValue:{default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(b){const E=b,{rowData:o}=E,y=Q(b,"modelValue"),V=W("noticeDialog"),i=c(""),p=c([]),a=c([]),x=c(!1);c(null),X(()=>{F(),C()});function N(l){i.value="",a.value=[],l()}function T(){const l=p.value.find(e=>e.id===i.value);l&&!a.value.some(e=>e.id===l.id)&&a.value.push({id:l.id,username:l.username})}function w(l){return a.value.some(e=>e.id===l)}function D(l){a.value=a.value.filter(e=>e.id!==l.id),i.value=""}async function F(){const l=await _($);p.value=l.data}async function C(){const l=await _(K,{id:o!=null&&o.id?o==null?void 0:o.id:o==null?void 0:o.rowid});a.value=l.data}async function R(){const l={id:o==null?void 0:o.id,user_ids:a.value.map(e=>e.id)};try{(await _(q,l,x)).code===2e3&&(O.success({message:"操作成功",plain:!0}),C())}catch{O.error("操作失败！")}finally{i.value=""}}function U(){i.value="",a.value=[],V.value.visible=!1}return(l,e)=>{const I=d("el-option"),L=d("el-select"),m=d("el-col"),S=d("el-row"),j=d("el-tag"),G=d("el-divider"),k=d("el-button"),J=d("el-dialog");return f(),v("div",null,[t(J,{ref_key:"noticeDialog",ref:V,modelValue:y.value,"onUpdate:modelValue":e[1]||(e[1]=s=>y.value=s),"before-close":N,"close-on-click-modal":!1,"close-on-press-escape":!1,class:"notice-dialog",title:"变更通知",width:"35%"},{footer:n(()=>[t(k,{icon:u(z),onClick:U},{default:n(()=>e[4]||(e[4]=[g("取 消")])),_:1},8,["icon"]),t(k,{icon:u(A),loading:u(x),type:"primary",onClick:R},{default:n(()=>e[5]||(e[5]=[g("确 定")])),_:1},8,["icon","loading"])]),default:n(()=>[t(S,{class:"mb-2"},{default:n(()=>[t(m,null,{default:n(()=>[e[2]||(e[2]=r("span",{class:"mr-2 font-medium"},"人员选择",-1)),t(L,{modelValue:u(i),"onUpdate:modelValue":e[0]||(e[0]=s=>Y(i)?i.value=s:null),filterable:"",placeholder:"输入搜索",style:{width:"200px"},onChange:T},{default:n(()=>[(f(!0),v(M,null,h(u(p),s=>(f(),B(I,{key:s.id,disabled:w(s.id),label:s.username,value:s.id},null,8,["disabled","label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1}),t(S,{gutter:20,class:"mb-4"},{default:n(()=>[t(m,{span:2}),t(m,{span:20,class:"ml-4",style:{color:"#909399"}},{default:n(()=>e[3]||(e[3]=[r("i",{class:"bi bi-info-circle"},null,-1),r("span",{class:"ml-1"},"仅可添加已绑定邮箱的用户",-1)])),_:1})]),_:1}),r("div",le,[(f(!0),v(M,null,h(u(a),s=>(f(),B(j,{key:s.id,closable:"",effect:"plain",round:"",onClose:se=>D(s)},{default:n(()=>[g(Z(s.username),1)]),_:2},1032,["onClose"]))),128))]),t(G,{style:{margin:"12px 0 20px 0"}})]),_:1},8,["modelValue"])])}}}),ce=ee(oe,[["__scopeId","data-v-d36147de"]]);export{ce as default};
