import{d as F,r as _,f as G,u as H,aP as J,P as K,o as u,c as Q,i as t,w as o,j as m,a as e,C as g,l as p,a2 as v,t as V,F as W,v as Z,J as X,s as Y,L as $,M as tt,N as at,_ as et,__tla as rt}from"./index-2c56227b.js";import{_ as st,__tla as lt}from"./ContentWrap-f1610353.js";import{_ as ot,__tla as ct}from"./index-8106be8e.js";import{E as it,__tla as _t}from"./el-link-dfb00afa.js";import{g as nt,a as ut,__tla as mt}from"./index-a94bc895.js";import{c as pt,d as dt,__tla as ft}from"./index-92395a4e.js";import yt,{__tla as bt}from"./BusinessForm-64ccd1b2.js";import{B as S,__tla as ht}from"./index-ed7289d5.js";import{f as It,__tla as gt}from"./formatter-5fb9b459.js";import vt,{__tla as kt}from"./BusinessListModal-c43e9722.js";import{u as wt,__tla as Ct}from"./useMessage-96878a4a.js";import{__tla as Nt}from"./el-card-9c148b4f.js";import{__tla as zt}from"./index-d17bd909.js";import{__tla as Rt}from"./Dialog-1050d437.js";import{__tla as St}from"./DictTag-cfe1898d.js";import"./color-6e929987.js";import{__tla as Pt}from"./dict-763dd292.js";import{__tla as Tt}from"./index-bee53bdb.js";import{__tla as xt}from"./index-ba7a3d71.js";let P,Bt=Promise.all([(()=>{try{return rt}catch{}})(),(()=>{try{return lt}catch{}})(),(()=>{try{return ct}catch{}})(),(()=>{try{return _t}catch{}})(),(()=>{try{return mt}catch{}})(),(()=>{try{return ft}catch{}})(),(()=>{try{return bt}catch{}})(),(()=>{try{return ht}catch{}})(),(()=>{try{return gt}catch{}})(),(()=>{try{return kt}catch{}})(),(()=>{try{return Ct}catch{}})(),(()=>{try{return Nt}catch{}})(),(()=>{try{return zt}catch{}})(),(()=>{try{return Rt}catch{}})(),(()=>{try{return St}catch{}})(),(()=>{try{return Pt}catch{}})(),(()=>{try{return Tt}catch{}})(),(()=>{try{return xt}catch{}})()]).then(async()=>{P=et(F({name:"CrmBusinessList",__name:"BusinessList",props:{bizType:{type:Number,required:!0},bizId:{type:Number,required:!0},customerId:{type:Number,required:!1}},setup(T){const d=wt(),l=T,f=_(!0),k=_(0),w=_([]),a=G({pageNo:1,pageSize:10,customerId:void 0,contactId:void 0}),y=async()=>{f.value=!0;try{a.customerId=void 0,a.contactId=void 0;let r={list:[],total:0};switch(l.bizType){case S.CRM_CUSTOMER:a.customerId=l.bizId,r=await ut(a);break;case S.CRM_CONTACT:a.contactId=l.bizId,r=await nt(a);break;default:return}w.value=r.list,k.value=r.total}finally{f.value=!1}},b=()=>{a.pageNo=1,y()},C=_(),x=()=>{C.value.open("create")},{push:B}=H(),N=_(),E=()=>{N.value.open()},M=async r=>{const s={contactId:l.bizId,businessIds:r};h.value.getSelectionRows().forEach(n=>{s.businessIds.push(n.id)}),await pt(s),d.success("\u5173\u8054\u5546\u673A\u6210\u529F"),b()},h=_(),L=async()=>{const r={contactId:l.bizId,businessIds:h.value.getSelectionRows().map(s=>s.id)};if(r.businessIds.length===0)return d.error("\u672A\u9009\u62E9\u5546\u673A");await dt(r),d.success("\u53D6\u5173\u5546\u673A\u6210\u529F"),b()};return J(()=>[l.bizId,l.bizType],()=>{b()},{immediate:!0,deep:!0}),(r,s)=>{const n=Z,I=X,q=Y,c=$,O=it,U=tt,j=ot,A=st,z=K("hasPermi"),D=at;return u(),Q(W,null,[t(q,{justify:"end"},{default:o(()=>[t(I,{onClick:x},{default:o(()=>[t(n,{class:"mr-5px",icon:"ep:opportunity"}),m(" \u521B\u5EFA\u5546\u673A ")]),_:1}),e(a).contactId?g((u(),p(I,{key:0,onClick:E},{default:o(()=>[t(n,{class:"mr-5px",icon:"ep:circle-plus"}),m("\u5173\u8054 ")]),_:1})),[[z,["crm:contact:create-business"]]]):v("",!0),e(a).contactId?g((u(),p(I,{key:1,onClick:L},{default:o(()=>[t(n,{class:"mr-5px",icon:"ep:remove"}),m("\u89E3\u9664\u5173\u8054 ")]),_:1})),[[z,["crm:contact:delete-business"]]]):v("",!0)]),_:1}),t(A,{class:"mt-10px"},{default:o(()=>[g((u(),p(U,{ref_key:"businessRef",ref:h,data:e(w),stripe:!0,"show-overflow-tooltip":!0},{default:o(()=>[e(a).contactId?(u(),p(c,{key:0,type:"selection",width:"55"})):v("",!0),t(c,{label:"\u5546\u673A\u540D\u79F0",fixed:"left",align:"center",prop:"name"},{default:o(i=>[t(O,{type:"primary",underline:!1,onClick:Et=>{return R=i.row.id,void B({name:"CrmBusinessDetail",params:{id:R}});var R}},{default:o(()=>[m(V(i.row.name),1)]),_:2},1032,["onClick"])]),_:1}),t(c,{label:"\u5546\u673A\u91D1\u989D",align:"center",prop:"price",formatter:e(It)},null,8,["formatter"]),t(c,{label:"\u5BA2\u6237\u540D\u79F0",align:"center",prop:"customerName"}),t(c,{label:"\u5546\u673A\u7EC4",align:"center",prop:"statusTypeName"}),t(c,{label:"\u5546\u673A\u9636\u6BB5",align:"center",prop:"statusName"})]),_:1},8,["data"])),[[D,e(f)]]),t(j,{total:e(k),page:e(a).pageNo,"onUpdate:page":s[0]||(s[0]=i=>e(a).pageNo=i),limit:e(a).pageSize,"onUpdate:limit":s[1]||(s[1]=i=>e(a).pageSize=i),onPagination:y},null,8,["total","page","limit"])]),_:1}),t(yt,{ref_key:"formRef",ref:C,onSuccess:y},null,512),t(vt,{ref_key:"businessModalRef",ref:N,"customer-id":l.customerId,onSuccess:M},null,8,["customer-id"])],64)}}}),[["__file","E:/GAOHP_2023/mall/newfeifan-front/yudao-ui-admin-vue3/src/views/crm/business/components/BusinessList.vue"]])});export{Bt as __tla,P as default};
