Files
aiot-platform-ui/apps/web-antd/dist/js/index-CUQbTBqr.js

2 lines
12 KiB
JavaScript

var W=Object.defineProperty;var C=Object.getOwnPropertySymbols;var S=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var g=(i,t,e)=>t in i?W(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,v=(i,t)=>{for(var e in t||(t={}))S.call(t,e)&&g(i,e,t[e]);if(C)for(var e of C(t))U.call(t,e)&&g(i,e,t[e]);return i};var p=(i,t,e)=>new Promise((a,r)=>{var y=l=>{try{s(e.next(l))}catch(n){r(n)}},f=l=>{try{s(e.throw(l))}catch(n){r(n)}},s=l=>l.done?a(l.value):Promise.resolve(l.value).then(y,f);s((e=e.apply(i,t)).next())});import{aB as _,at as T,bF as k,ar as N,$ as L,av as w}from"./bootstrap-DsjPfOC_.js";import"./vxe-table-C9eY8pUC.js";import{g as R}from"./customer-DEQmQyD_.js";import{D as d}from"./dict-enum-DRf9W45H.js";import{g as B}from"./index-DC7CUIeC.js";import{g as O}from"./index-0DmMEJMD.js";import{g as F}from"./rangePickerProps-CXRhwW6k.js";import{cS as A,di as E,dj as q,d8 as V,dk as x,m as X,b9 as D,v as M,ab as I,b2 as h,bJ as b,j as u,u as o,ad as Z,I as G,bb as $}from"../jse/index-index-CO0ZsLf2.js";import{_ as Y}from"./content-wrap.vue_vue_type_script_setup_true_lang-BpjRsiVS.js";import{u as j,_ as H}from"./use-echarts-DBBPKzKQ.js";import{_ as J}from"./page.vue_vue_type_script_setup_true_lang-BL-xU9lB.js";import{u as K}from"./use-vxe-grid-z_YbcgDZ.js";import"./dict-tag.vue_vue_type_script_setup_true_lang-BZwqGgTH.js";function Q(i,t){switch(i){case"conversionStat":return{grid:{left:20,right:40,bottom:20,containLabel:!0},legend:{},series:[{name:"客户转化率",type:"line",data:t.map(e=>({name:e.time,value:e.customerCreateCount?(e.customerDealCount/e.customerCreateCount*100).toFixed(2):0}))}],toolbox:{feature:{dataZoom:{xAxisIndex:!1},brush:{type:["lineX","clear"]},saveAsImage:{show:!0,name:"客户转化率分析"}}},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},yAxis:{type:"value",name:"转化率(%)"},xAxis:{type:"category",name:"日期",data:t.map(e=>e.time)}};case"customerSummary":return{grid:{bottom:"5%",containLabel:!0,left:"5%",right:"5%",top:"5 %"},legend:{},series:[{name:"新增客户数",type:"bar",yAxisIndex:0,data:t.map(e=>e.customerCreateCount)},{name:"成交客户数",type:"bar",yAxisIndex:1,data:t.map(e=>e.customerDealCount)}],toolbox:{feature:{dataZoom:{xAxisIndex:!1},brush:{type:["lineX","clear"]},saveAsImage:{show:!0,name:"客户总量分析"}}},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},yAxis:[{type:"value",name:"新增客户数",min:0,minInterval:1},{type:"value",name:"成交客户数",min:0,minInterval:1,splitLine:{lineStyle:{type:"dotted",opacity:.7}}}],xAxis:{type:"category",name:"日期",data:t.map(e=>e.time)}};case"dealCycleByArea":{const e=t.map(a=>({areaName:a.areaName,customerDealCycle:a.customerDealCycle,customerDealCount:a.customerDealCount}));return{grid:{left:20,right:40,bottom:20,containLabel:!0},legend:{},series:[{name:"成交周期(天)",type:"bar",data:e.map(a=>a.customerDealCycle),yAxisIndex:0},{name:"成交客户数",type:"bar",data:e.map(a=>a.customerDealCount),yAxisIndex:1}],toolbox:{feature:{dataZoom:{xAxisIndex:!1},brush:{type:["lineX","clear"]},saveAsImage:{show:!0,name:"成交周期分析"}}},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},yAxis:[{type:"value",name:"成交周期(天)",min:0,minInterval:1},{type:"value",name:"成交客户数",min:0,minInterval:1,splitLine:{lineStyle:{type:"dotted",opacity:.7}}}],xAxis:{type:"category",name:"区域",data:e.map(a=>a.areaName)}}}case"dealCycleByProduct":{const e=t.map(a=>{var r;return{productName:(r=a.productName)!=null?r:"未知",customerDealCycle:a.customerDealCount,customerDealCount:a.customerDealCount}});return{grid:{left:20,right:40,bottom:20,containLabel:!0},legend:{},series:[{name:"成交周期(天)",type:"bar",data:e.map(a=>a.customerDealCycle),yAxisIndex:0},{name:"成交客户数",type:"bar",data:e.map(a=>a.customerDealCount),yAxisIndex:1}],toolbox:{feature:{dataZoom:{xAxisIndex:!1},brush:{type:["lineX","clear"]},saveAsImage:{show:!0,name:"成交周期分析"}}},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},yAxis:[{type:"value",name:"成交周期(天)",min:0,minInterval:1},{type:"value",name:"成交客户数",min:0,minInterval:1,splitLine:{lineStyle:{type:"dotted",opacity:.7}}}],xAxis:{type:"category",name:"产品名称",data:e.map(a=>a.productName)}}}case"dealCycleByUser":{const e=t.customerDealCycleByDate,a=t.customerDealCycleByUser;return{grid:{left:20,right:40,bottom:20,containLabel:!0},legend:{},series:[{name:"成交周期(天)",type:"bar",data:e.map(r=>r.customerDealCycle),yAxisIndex:0},{name:"成交客户数",type:"bar",data:a.map(r=>r.customerDealCount),yAxisIndex:1}],toolbox:{feature:{dataZoom:{xAxisIndex:!1},brush:{type:["lineX","clear"]},saveAsImage:{show:!0,name:"成交周期分析"}}},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},yAxis:[{type:"value",name:"成交周期(天)",min:0,minInterval:1},{type:"value",name:"成交客户数",min:0,minInterval:1,splitLine:{lineStyle:{type:"dotted",opacity:.7}}}],xAxis:{type:"category",name:"日期",data:e.map(r=>r.time)}}}case"followUpSummary":return{grid:{left:20,right:30,bottom:20,containLabel:!0},legend:{},series:[{name:"跟进客户数",type:"bar",yAxisIndex:0,data:t.map(e=>e.followUpCustomerCount)},{name:"跟进次数",type:"bar",yAxisIndex:1,data:t.map(e=>e.followUpRecordCount)}],toolbox:{feature:{dataZoom:{xAxisIndex:!1},brush:{type:["lineX","clear"]},saveAsImage:{show:!0,name:"客户跟进次数分析"}}},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},yAxis:[{type:"value",name:"跟进客户数",min:0,minInterval:1},{type:"value",name:"跟进次数",min:0,minInterval:1,splitLine:{lineStyle:{type:"dotted",opacity:.7}}}],xAxis:{type:"category",name:"日期",axisTick:{alignWithLabel:!0},data:t.map(e=>e.time)}};case"followUpType":return{title:{text:"客户跟进方式分析",left:"center"},legend:{orient:"vertical",left:"left"},tooltip:{trigger:"item",formatter:"{b} : {c}% "},toolbox:{feature:{saveAsImage:{show:!0,name:"客户跟进方式分析"}}},series:[{name:"跟进方式",type:"pie",radius:"50%",data:t.map(e=>({name:_(d.CRM_FOLLOW_UP_TYPE,e.followUpType),value:e.followUpRecordCount})),emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}}}]};case"poolSummary":return{grid:{left:20,right:40,bottom:20,containLabel:!0},legend:{},series:[{name:"进入公海客户数",type:"bar",yAxisIndex:0,data:t.map(e=>e.customerPutCount)},{name:"公海领取客户数",type:"bar",yAxisIndex:1,data:t.map(e=>e.customerTakeCount)}],toolbox:{feature:{dataZoom:{xAxisIndex:!1},brush:{type:["lineX","clear"]},saveAsImage:{show:!0,name:"公海客户分析"}}},tooltip:{trigger:"axis",axisPointer:{type:"shadow"}},yAxis:[{type:"value",name:"进入公海客户数",min:0,minInterval:1},{type:"value",name:"公海领取客户数",min:0,minInterval:1,splitLine:{lineStyle:{type:"dotted",opacity:.7}}}],xAxis:{type:"category",name:"日期",data:t.map(e=>e.time)}};default:return{}}}const z=k(),ee=[{tab:"客户总量分析",key:"customerSummary"},{tab:"客户跟进次数分析",key:"followUpSummary"},{tab:"客户跟进方式分析",key:"followUpType"},{tab:"客户转化率分析",key:"conversionStat"},{tab:"公海客户分析",key:"poolSummary"},{tab:"员工客户成交周期分析",key:"dealCycleByUser"},{tab:"地区客户成交周期分析",key:"dealCycleByArea"},{tab:"产品客户成交周期分析",key:"dealCycleByProduct"}];function te(){var i;return[{fieldName:"times",label:"时间范围",component:"RangePicker",componentProps:v({},F()),defaultValue:[A(E(new Date(Date.now()-3600*1e3*24*7))),A(q(new Date(Date.now()-3600*1e3*24)))]},{fieldName:"interval",label:"时间间隔",component:"Select",componentProps:{allowClear:!0,placeholder:"请选择时间间隔",options:T(d.DATE_INTERVAL,"number")},defaultValue:2},{fieldName:"deptId",label:"归属部门",component:"ApiTreeSelect",componentProps:{api:()=>p(null,null,function*(){const t=yield B();return V(t)}),labelField:"name",valueField:"id",childrenField:"children",treeDefaultExpandAll:!0,placeholder:"请选择归属部门"},defaultValue:(i=z.userInfo)==null?void 0:i.deptId},{fieldName:"userId",label:"员工",component:"ApiSelect",componentProps:{api:O,labelField:"nickname",valueField:"id",placeholder:"请选择员工",allowClear:!0}}]}function P(i){switch(i){case"conversionStat":return[{type:"seq",title:"序号"},{field:"customerName",title:"客户名称",minWidth:100},{field:"contractName",title:"合同名称",minWidth:200},{field:"totalPrice",title:"合同总金额",minWidth:200,formatter:"formatAmount2"},{field:"receivablePrice",title:"回款金额",minWidth:200,formatter:"formatAmount2"},{field:"source",title:"客户来源",minWidth:100,cellRender:{name:"CellDict",props:{type:d.CRM_CUSTOMER_SOURCE}}},{field:"industryId",title:"客户行业",minWidth:100,cellRender:{name:"CellDict",props:{type:d.CRM_CUSTOMER_INDUSTRY}}},{field:"ownerUserName",title:"负责人",minWidth:200},{field:"creatorUserName",title:"创建人",minWidth:200},{field:"createTime",title:"创建时间",minWidth:200,formatter:"formatDateTime"},{field:"orderDate",title:"下单日期",minWidth:200,formatter:"formatDateTime"}];case"customerSummary":return[{type:"seq",title:"序号"},{field:"ownerUserName",title:"员工姓名",minWidth:100},{field:"customerCreateCount",title:"新增客户数",minWidth:200},{field:"customerDealCount",title:"成交客户数",minWidth:200},{field:"customerDealRate",title:"客户成交率(%)",minWidth:200,formatter:({row:t})=>x(t.customerDealCount,t.customerCreateCount)},{field:"contractPrice",title:"合同总金额",minWidth:200,formatter:"formatAmount2"},{field:"receivablePrice",title:"回款金额",minWidth:200,formatter:"formatAmount2"},{field:"creceivablePrice",title:"未回款金额",minWidth:200,formatter:({row:t})=>x(t.receivablePrice,t.contractPrice)},{field:"ccreceivablePrice",title:"回款完成率(%)",formatter:({row:t})=>x(t.receivablePrice,t.contractPrice)}];case"dealCycleByArea":return[{type:"seq",title:"序号"},{field:"areaName",title:"区域",minWidth:200},{field:"customerDealCycle",title:"成交周期(天)",minWidth:200},{field:"customerDealCount",title:"成交客户数",minWidth:200}];case"dealCycleByProduct":return[{type:"seq",title:"序号"},{field:"productName",title:"产品名称",minWidth:200},{field:"customerDealCycle",title:"成交周期(天)",minWidth:200},{field:"customerDealCount",title:"成交客户数",minWidth:200}];case"dealCycleByUser":return[{type:"seq",title:"序号"},{field:"ownerUserName",title:"日期",minWidth:200},{field:"customerDealCycle",title:"成交周期(天)",minWidth:200},{field:"customerDealCount",title:"成交客户数",minWidth:200}];case"followUpSummary":return[{type:"seq",title:"序号"},{field:"ownerUserName",title:"员工姓名",minWidth:200},{field:"followUpRecordCount",title:"跟进次数",minWidth:200},{field:"followUpCustomerCount",title:"跟进客户数",minWidth:200}];case"followUpType":return[{type:"seq",title:"序号"},{field:"followUpType",title:"跟进方式",cellRender:{name:"CellDict",props:{type:d.CRM_FOLLOW_UP_TYPE}}},{field:"followUpRecordCount",title:"个数",minWidth:200},{field:"portion",title:"占比(%)",minWidth:200}];case"poolSummary":return[{type:"seq",title:"序号"},{field:"ownerUserName",title:"员工姓名",minWidth:200},{field:"customerPutCount",title:"进入公海客户数",minWidth:200},{field:"customerTakeCount",title:"公海领取客户数",minWidth:200}];default:return[]}}const xe=X({__name:"index",setup(i){const t=D("customerSummary"),e=D(),{renderEcharts:a}=j(e),[r,y]=N({commonConfig:{componentProps:{class:"w-full"}},schema:te(),showCollapseButton:!0,submitButtonOptions:{content:L("common.query")},wrapperClass:"grid-cols-1 md:grid-cols-2",handleSubmit:()=>p(null,null,function*(){yield l(t.value)})}),[f,s]=K({gridOptions:{columns:P(t.value),height:"auto",keepSource:!0,pagerConfig:{enabled:!1},rowConfig:{keyField:"id",isHover:!0},toolbarConfig:{enabled:!1}}});function l(n){return p(this,null,function*(){t.value=n,s.setGridOptions({columns:P(n)});const c=yield y.getValues(),m=yield R(t.value,c);yield a(Q(t.value,m)),yield s.grid.reloadData(m)})}return M(()=>{l(t.value)}),(n,c)=>(h(),I(o(J),{"auto-content-height":""},{default:b(()=>[u(o(Y),null,{default:b(()=>[u(o(r)),u(o(w),{"active-key":t.value,"onUpdate:activeKey":c[0]||(c[0]=m=>t.value=m),class:"w-full",onChange:l},{default:b(()=>[(h(!0),Z(G,null,$(o(ee),m=>(h(),I(o(w).TabPane,{key:m.key,tab:m.tab,"force-render":!0},null,8,["tab"]))),128))]),_:1},8,["active-key"]),u(o(H),{class:"mb-20 h-full w-full",ref_key:"chartRef",ref:e},null,512),u(o(f))]),_:1})]),_:1}))}});export{xe as default};