import{d as G,r as n,x as K,u as X,w as Y,a3 as Z,o as u,c as q,f as a,B as o,E as p,a as e,k as g,A as m,D as v,G as Q,F as V,_ as W,K as H,L as J,X as $,Y as aa,Z as ta,__tla as ea}from"./index-92ad187a.js";import{_ as sa,__tla as ra}from"./ContentWrap.vue_vue_type_script_setup_true_lang-c7ede7df.js";import{_ as la,__tla as oa}from"./index.vue_vue_type_script_setup_true_lang-6fbe4cc3.js";import{E as ca,__tla as ia}from"./el-link-3ccf1de9.js";import{g as na,a as _a,__tla as ua}from"./index-fed01cbc.js";import{c as pa,d as ma,__tla as da}from"./index-4d6f5b36.js";import{_ as fa,__tla as ya}from"./BusinessForm.vue_vue_type_script_setup_true_lang-24e6251f.js";import{B as S,__tla as ba}from"./index-a4b5469a.js";import{f as Ia,__tla as ha}from"./formatter-732f7466.js";import{_ as ga,__tla as va}from"./BusinessListModal.vue_vue_type_script_setup_true_lang-de68c898.js";import{u as ka,__tla as wa}from"./useMessage-d9788660.js";let x,za=Promise.all([(()=>{try{return ea}catch{}})(),(()=>{try{return ra}catch{}})(),(()=>{try{return oa}catch{}})(),(()=>{try{return ia}catch{}})(),(()=>{try{return ua}catch{}})(),(()=>{try{return da}catch{}})(),(()=>{try{return ya}catch{}})(),(()=>{try{return ba}catch{}})(),(()=>{try{return ha}catch{}})(),(()=>{try{return va}catch{}})(),(()=>{try{return wa}catch{}})()]).then(async()=>{x=G({name:"CrmBusinessList",__name:"BusinessList",props:{bizType:{},bizId:{},customerId:{}},setup(T){const d=ka(),l=T,f=n(!0),k=n(0),w=n([]),t=K({pageNo:1,pageSize:10,customerId:void 0,contactId:void 0}),y=async()=>{f.value=!0;try{t.customerId=void 0,t.contactId=void 0;let s={list:[],total:0};switch(l.bizType){case S.CRM_CUSTOMER:t.customerId=l.bizId,s=await _a(t);break;case S.CRM_CONTACT:t.contactId=l.bizId,s=await na(t);break;default:return}w.value=s.list,k.value=s.total}finally{f.value=!1}},b=()=>{t.pageNo=1,y()},z=n(),B=()=>{z.value.open("create")},{push:E}=X(),C=n(),L=()=>{C.value.open()},M=async s=>{const r={contactId:l.bizId,businessIds:s};I.value.getSelectionRows().forEach(_=>{r.businessIds.push(_.id)}),await pa(r),d.success("\u5173\u8054\u5546\u673A\u6210\u529F"),b()},I=n(),P=async()=>{const s={contactId:l.bizId,businessIds:I.value.getSelectionRows().map(r=>r.id)};if(s.businessIds.length===0)return d.error("\u672A\u9009\u62E9\u5546\u673A");await ma(s),d.success("\u53D6\u5173\u5546\u673A\u6210\u529F"),b()};return Y(()=>[l.bizId,l.bizType],()=>{b()},{immediate:!0,deep:!0}),(s,r)=>{const _=W,h=H,U=J,c=$,A=ca,D=aa,O=la,j=sa,N=Z("hasPermi"),F=ta;return u(),q(V,null,[a(U,{justify:"end"},{default:o(()=>[a(h,{onClick:B},{default:o(()=>[a(_,{class:"mr-5px",icon:"ep:opportunity"}),p(" \u521B\u5EFA\u5546\u673A ")]),_:1}),e(t).contactId?g((u(),m(h,{key:0,onClick:L},{default:o(()=>[a(_,{class:"mr-5px",icon:"ep:circle-plus"}),p("\u5173\u8054 ")]),_:1})),[[N,["crm:contact:create-business"]]]):v("",!0),e(t).contactId?g((u(),m(h,{key:1,onClick:P},{default:o(()=>[a(_,{class:"mr-5px",icon:"ep:remove"}),p("\u89E3\u9664\u5173\u8054 ")]),_:1})),[[N,["crm:contact:delete-business"]]]):v("",!0)]),_:1}),a(j,{class:"mt-10px"},{default:o(()=>[g((u(),m(D,{ref_key:"businessRef",ref:I,data:e(w),stripe:!0,"show-overflow-tooltip":!0},{default:o(()=>[e(t).contactId?(u(),m(c,{key:0,type:"selection",width:"55"})):v("",!0),a(c,{label:"\u5546\u673A\u540D\u79F0",fixed:"left",align:"center",prop:"name"},{default:o(i=>[a(A,{type:"primary",underline:!1,onClick:Ca=>{return R=i.row.id,void E({name:"CrmBusinessDetail",params:{id:R}});var R}},{default:o(()=>[p(Q(i.row.name),1)]),_:2},1032,["onClick"])]),_:1}),a(c,{label:"\u5546\u673A\u91D1\u989D",align:"center",prop:"price",formatter:e(Ia)},null,8,["formatter"]),a(c,{label:"\u5BA2\u6237\u540D\u79F0",align:"center",prop:"customerName"}),a(c,{label:"\u5546\u673A\u7EC4",align:"center",prop:"statusTypeName"}),a(c,{label:"\u5546\u673A\u9636\u6BB5",align:"center",prop:"statusName"})]),_:1},8,["data"])),[[F,e(f)]]),a(O,{total:e(k),page:e(t).pageNo,"onUpdate:page":r[0]||(r[0]=i=>e(t).pageNo=i),limit:e(t).pageSize,"onUpdate:limit":r[1]||(r[1]=i=>e(t).pageSize=i),onPagination:y},null,8,["total","page","limit"])]),_:1}),a(fa,{ref_key:"formRef",ref:z,onSuccess:y},null,512),a(ga,{ref_key:"businessModalRef",ref:C,"customer-id":l.customerId,onSuccess:M},null,8,["customer-id"])],64)}}})});export{x as _,za as __tla};
