var l=(e,t,r)=>new Promise((i,c)=>{var u=o=>{try{d(r.next(o))}catch(b){c(b)}},w=o=>{try{d(r.throw(o))}catch(b){c(b)}},d=o=>o.done?i(o.value):Promise.resolve(o.value).then(u,w);d((r=r.apply(e,t)).next())});import{i as W}from"./index-CmHCevOz.js";import{B as q,u as H}from"./useTable-BfBUHulV.js";import{T as J}from"./index-aybT_Y4v.js";import{ao as P,v as Q,_ as X}from"./entry/index-J3oNdpPM-1725854857151.js";import{g as Y}from"./label-DqS-FuCI.js";import{u as T}from"./index-psQvanR4.js";import Z from"./GroupLabelDrawer-D-8oZFoN.js";import x from"./ContactDrawer-CvGnUP99.js";import ee from"./SendMsgDrawer-Cf3ApO6I.js";import{c as ae,s as te}from"./contact.data-BCEGM1fG.js";import{g as oe,d as L,u as B}from"./contact-BR6AKozE.js";import{M as F,am as ne,aa as le,bp as se,T as re,j as I}from"./antd-DubAfnNp.js";import{d as ie,f as h,r as _,o as ce,k as n,a5 as s,_ as M,$ as ue,a7 as f,G as E,a6 as de,a9 as me}from"./vue-Ba_NIFIa.js";import"./ExclamationCircleOutlined-CfCFlzTg.js";import"./useForm-Djppl_MV.js";import"./index-n-UgBTsO.js";import"./tree-Dhx73awc.js";import"./copyTextToClipboard-BG9-7yqE.js";import"./index-DjbzqzJs.js";import"./index-a2RDnbRa.js";import"./index-K1arWPmu.js";import"./index-ADuKtuEb.js";import"./index-C598-cfU.js";import"./useWindowSizeFn-BzWD8RX1.js";import"./plugin-4Lbo649h.js";import"./uuid-BUBnBT7J.js";import"./onMountedOrActivated-BsbclbaU.js";import"./sortable.esm-CnNXHMH-.js";import"./useSortable-B_4FgPKl.js";import"./labelRelationship-DwYvdwrT.js";const pe=ie({name:"ContactManagement",components:{BasicTable:q,SendMsgDrawer:ee,ContactDrawer:x,GroupLabelDrawer:Z,TableAction:J,Button:P,Modal:F,Select:ne,Form:le,FormItem:se,Tooltip:re},setup(){const{t:e}=Q.useI18n(),t=h([]),r=h(!1),i=h(!1),c=h("增加标签"),u=_({lableName:[]}),w=_({lableName:[]}),d=h([]),[o,{openGroupLabelDrawer:b}]=T(),[D,{openDrawer:C}]=T(),[S,{openDrawerMsg:y}]=T(),[k,{reload:m,clearSelectedRowKeys:p}]=H({title:e("wechat.contact.contactList"),api:oe,columns:ae,formConfig:{labelWidth:120,schemas:te},useSearchForm:!0,showTableSetting:!0,bordered:!1,showIndexColumn:!1,clickToRowSelect:!1,actionColumn:{width:80,title:e("common.action"),dataIndex:"action",fixed:void 0},rowKey:"id",rowSelection:{type:"checkbox",onChange:(a,g)=>{t.value=a,r.value=a.length>0}}});ce(()=>l(this,null,function*(){let a=yield Y({page:1,pageSize:1e3,type:1});d.value=a.data}));function v(){C(!0,{isUpdate:!1})}function N(){return l(this,null,function*(){i.value=!0,c.value="增加标签"})}function R(){i.value=!0,c.value="移除标签"}function G(a){a.type==1?C(!0,{record:a,isUpdate:!0}):b(!0,{record:a,isUpdate:!0})}function O(a){y(!0,{record:a})}function A(a){return l(this,null,function*(){(yield L({ids:[a.id]})).code===0&&(yield m())})}function V(){return l(this,null,function*(){F.confirm({title:e("common.deleteConfirm"),icon:n(W.ExclamationCircleOutlined),onOk(){return l(this,null,function*(){(yield L({ids:t.value})).code===0&&(r.value=!1,yield m())})},onCancel(){}})})}function U(){return l(this,null,function*(){yield m()})}function $(){return l(this,null,function*(){yield m()})}function j(){return l(this,null,function*(){let a=t.value,g=u.lableName;c.value==="增加标签"?(yield B({updateType:1,contactIds:a,labelIds:g})).code===0&&(I.success("标签添加成功"),i.value=!1,yield m(),t.value=[],u.lableName=[],p()):(yield B({updateType:-1,contactIds:a,labelIds:g})).code===0&&(I.success("标签移除成功"),i.value=!1,yield m(),t.value=[],u.lableName=[],p())})}function z(){return l(this,null,function*(){Object.assign(u,w)})}return{t:e,registerTable:k,registerGroupLabelDrawer:o,registerDrawer:D,registerDrawerMsg:S,handleCreate:v,handleMsg:O,handleEdit:G,handleDelete:A,handleSuccess:U,handleSuccess1:$,handleBatchDelete:V,showDeleteButton:r,handleDeleteLabel:R,handleAddLabel:N,handleOk:j,handleCancel:z,form:u,modalVisible:i,modal_title:c,actionLabel:d,selectedIds:t}}});function fe(e,t,r,i,c,u){const w=s("a-button"),d=s("TableAction"),o=s("BasicTable"),b=s("Select"),D=s("FormItem"),C=s("Form"),S=s("Modal"),y=s("GroupLabelDrawer"),k=s("ContactDrawer"),m=s("SendMsgDrawer");return M(),ue("div",null,[n(o,{onRegister:e.registerTable},{tableTitle:f(()=>[n(w,{onClick:e.handleAddLabel,style:{position:"absolute",left:"0px"},disabled:e.selectedIds&&!e.selectedIds.length},{default:f(()=>[E(" + 增加标签 ")]),_:1},8,["onClick","disabled"]),n(w,{onClick:e.handleDeleteLabel,style:{position:"absolute",left:"110px"},disabled:e.selectedIds&&!e.selectedIds.length},{default:f(()=>[E(" - 移除标签 ")]),_:1},8,["onClick","disabled"])]),toolbar:f(()=>[]),bodyCell:f(({column:p,record:v})=>[p.key==="action"?(M(),de(d,{key:0,actions:[{label:"发信息",onClick:e.handleMsg.bind(null,v)},{label:"编辑",onClick:e.handleEdit.bind(null,v)}]},null,8,["actions"])):me("",!0)]),_:1},8,["onRegister"]),n(S,{width:"700px",height:"500px",open:e.modalVisible,"onUpdate:open":t[1]||(t[1]=p=>e.modalVisible=p),title:e.modal_title,onOk:e.handleOk,onCancel:e.handleCancel,class:"custom-modal"},{default:f(()=>[n(C,{model:e.form,layout:"inline",style:{height:"300px"}},{default:f(()=>[n(D,{name:"lableName",label:"选择标签",style:{"margin-left":"30px"}},{default:f(()=>[n(b,{value:e.form.lableName,"onUpdate:value":t[0]||(t[0]=p=>e.form.lableName=p),options:e.actionLabel,allowClear:"",mode:"multiple",size:"middle",placeholder:"请选择",style:{width:"560px",margin:"0 5px"}},null,8,["value","options"])]),_:1})]),_:1},8,["model"])]),_:1},8,["open","title","onOk","onCancel"]),n(y,{onRegister:e.registerGroupLabelDrawer,onSuccess:e.handleSuccess},null,8,["onRegister","onSuccess"]),n(k,{onRegister:e.registerDrawer,onSuccess:e.handleSuccess},null,8,["onRegister","onSuccess"]),n(m,{onRegister:e.registerDrawerMsg,onSuccess:e.handleSuccess1},null,8,["onRegister","onSuccess"])])}const He=X(pe,[["render",fe],["__scopeId","data-v-2467eef5"]]);export{He as default};