mirror of
https://gitee.com/270580156/weiyu.git
synced 2026-05-19 05:37:53 +00:00
1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
"use strict";(self.webpackChunkadmin=self.webpackChunkadmin||[]).push([[8544],{41030:function(t,e,a){a.r(e);var i=a(90819),n=a.n(i),s=a(89933),r=a.n(s),o=a(45332),l=a.n(o),d=a(44194),c=a(41123),u=a(34251),g=a(8957),f=a(71373),h=a(63065),x=a(43413),v=a(10337),m=a(77407),p=a(59946),y=a(3867),j=a(5858),R=a(9248),M=a(14318),b=a(68525),k=a(47192),Y=a(35911),Z=a(94011),w=a(12201),C=a(3028),S=a(21474),D=a(20621),O=a(7999),U=a(28977),z=a.n(U),I=a(31881),B=a(75699),P=a(25191),F=a(32597),L=a(31549),E=c.default.RangePicker,H=u.Z.Option;e.default=function(){var t=(0,B.useIntl)(),e=(0,d.useState)(!1),a=l()(e,2),i=a[0],s=a[1],o=(0,I.u)((function(t){return t.currentOrg})),c=(0,d.useState)([]),U=l()(c,2),W=U[0],T=U[1],N=(0,d.useState)({totalRatings:0,avgRating:0,satisfactionRate:0,ratingRate:0,totalRatingCount:0,satisfiedRatingCount:0,verySatisfied:0,satisfied:0,neutral:0,dissatisfied:0}),Q=l()(N,2),q=Q[0],A=Q[1],G=(0,d.useState)(z()().startOf("day")),J=l()(G,2),_=J[0],K=J[1],V=(0,d.useState)(z()().endOf("day")),X=l()(V,2),$=X[0],tt=X[1],et=(0,d.useState)("today"),at=l()(et,2),it=at[0],nt=at[1],st=(0,d.useState)([z()().startOf("day"),z()().endOf("day")]),rt=l()(st,2),ot=rt[0],lt=rt[1],dt=(0,d.useState)({current:1,pageSize:20,total:0}),ct=l()(dt,2),ut=ct[0],gt=ct[1],ft=(0,d.useState)(P.whQ),ht=l()(ft,2),xt=ht[0],vt=ht[1],mt=(0,d.useState)(),pt=l()(mt,2),yt=pt[0],jt=pt[1],Rt=(0,d.useState)(),Mt=l()(Rt,2),bt=Mt[0],kt=Mt[1],Yt=(0,d.useState)([]),Zt=l()(Yt,2),wt=Zt[0],Ct=Zt[1],St=(0,d.useState)([]),Dt=l()(St,2),Ot=Dt[0],Ut=Dt[1],zt=[{label:(0,L.jsx)(B.FormattedMessage,{id:"ticket.statistic.timeRange.today"}),value:"today"},{label:(0,L.jsx)(B.FormattedMessage,{id:"ticket.statistic.timeRange.yesterday"}),value:"yesterday"},{label:(0,L.jsx)(B.FormattedMessage,{id:"ticket.statistic.timeRange.week"}),value:"week"},{label:(0,L.jsx)(B.FormattedMessage,{id:"ticket.statistic.timeRange.lastWeek"}),value:"lastWeek"},{label:(0,L.jsx)(B.FormattedMessage,{id:"ticket.statistic.timeRange.month"}),value:"month"},{label:(0,L.jsx)(B.FormattedMessage,{id:"ticket.statistic.timeRange.custom"}),value:"custom"}];(0,d.useEffect)((function(){null!=o&&o.uid&&((0,D.LE)({orgUid:o.uid,pageNumber:0,pageSize:100}).then((function(t){var e;200===t.code&&Ct((null===(e=t.data)||void 0===e?void 0:e.content)||[])})),(0,O._t)({orgUid:o.uid,pageNumber:0,pageSize:100}).then((function(t){var e;200===t.code&&Ut((null===(e=t.data)||void 0===e?void 0:e.content)||[])})))}),[o]);var It=function(){var t=r()(n()().mark((function t(){var e,a,i,r,l,d,c=arguments;return n()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=c.length>0&&void 0!==c[0]?c[0]:1,a=c.length>1&&void 0!==c[1]?c[1]:20,s(!0),t.prev=3,i={pageNumber:e-1,pageSize:a,orgUid:null==o?void 0:o.uid,startDate:ot[0].format("YYYY-MM-DD"),endDate:ot[1].format("YYYY-MM-DD"),type:xt,workgroupUid:xt===P.v5D?yt:void 0,agentUid:xt===P.fyH?bt:void 0},t.next=7,(0,S.RU)(i);case 7:r=t.sent,console.log("queryStatisticServiceByDate response:",r.data,i),200===r.code&&r.data&&(l=r.data,gt({current:e,pageSize:a,total:1}),d=[{key:l.date||z()().format("YYYY-MM-DD"),date:l.date||z()().format("YYYY-MM-DD"),totalRatingCount:l.totalRatingCount||0,satisfiedRatingCount:l.satisfiedRatingCount||0,satisfactionRate:l.satisfactionRate||0,ratingRate:l.ratingRate||0,acceptedThreadCount:l.acceptedThreadCount||0}],T(d)),t.next=16;break;case 12:t.prev=12,t.t0=t.catch(3),g.ZP.error("获取评价数据失败"),console.error("获取评价数据失败:",t.t0);case 16:return t.prev=16,s(!1),t.finish(16);case 19:case"end":return t.stop()}}),t,null,[[3,12,16,19]])})));return function(){return t.apply(this,arguments)}}();(0,d.useEffect)((function(){if("custom"===it)K(_),tt($);else{var t=z()();"today"===it?(K(t.startOf("day")),tt(t.endOf("day"))):"yesterday"===it?(K(t.subtract(1,"day").startOf("day")),tt(t.subtract(1,"day").endOf("day"))):"week"===it?(K(t.startOf("week")),tt(t.endOf("week"))):"lastWeek"===it?(K(t.subtract(1,"week").startOf("week")),tt(t.subtract(1,"week").endOf("week"))):"month"===it&&(K(t.startOf("month")),tt(t.endOf("month")))}}),[it]),(0,d.useEffect)((function(){lt([_,$])}),[_,$]);var Bt=function(){var t=r()(n()().mark((function t(){var e,a,i;return n()().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e={orgUid:null==o?void 0:o.uid,startDate:ot[0].format("YYYY-MM-DD"),endDate:ot[1].format("YYYY-MM-DD"),type:xt,workgroupUid:xt===P.v5D?yt:void 0,agentUid:xt===P.fyH?bt:void 0},t.next=4,(0,S.RU)(e);case 4:a=t.sent,console.log("queryStatisticServiceByDate response:",a.data,e),200===a.code&&a.data&&(i=a.data,A({totalRatings:i.totalRatingCount||0,avgRating:i.satisfactionRate||0,satisfactionRate:i.satisfactionRate||0,ratingRate:i.ratingRate||0,totalRatingCount:i.totalRatingCount||0,satisfiedRatingCount:i.satisfiedRatingCount||0,verySatisfied:Math.round(.4*(i.satisfiedRatingCount||0)),satisfied:Math.round(.6*(i.satisfiedRatingCount||0)),neutral:Math.round(.2*(i.totalRatingCount||0)),dissatisfied:Math.round(.1*(i.totalRatingCount||0))})),t.next=12;break;case 9:t.prev=9,t.t0=t.catch(0),console.error("获取统计数据失败:",t.t0);case 12:case"end":return t.stop()}}),t,null,[[0,9]])})));return function(){return t.apply(this,arguments)}}();(0,d.useEffect)((function(){Bt(),It()}),[ot,xt,yt,bt]);var Pt=[{title:t.formatMessage({id:"bi.rating.table.date"}),dataIndex:"date",key:"date"},{title:t.formatMessage({id:"bi.rating.table.totalRatings"}),dataIndex:"totalRatingCount",key:"totalRatingCount"},{title:t.formatMessage({id:"bi.rating.table.satisfiedRatings"}),dataIndex:"satisfiedRatingCount",key:"satisfiedRatingCount",render:function(t,e){return(0,L.jsxs)("div",{children:[(0,L.jsx)("span",{children:t}),(0,L.jsx)(f.Z,{percent:e.totalRatingCount>0?Math.round(t/e.totalRatingCount*100):0,size:"small",showInfo:!1,strokeColor:"#52c41a"})]})}},{title:t.formatMessage({id:"bi.rating.table.ratingRate"}),dataIndex:"ratingRate",key:"ratingRate",render:function(t){return(0,L.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,L.jsx)("span",{style:{marginRight:4},children:t}),(0,L.jsx)(k.Z,{style:{color:"#faad14"}})]})}}],Ft=[{type:t.formatMessage({id:"bi.rating.table.verySatisfied"}),value:q.verySatisfied,color:"#52c41a"},{type:t.formatMessage({id:"bi.rating.table.satisfied"}),value:q.satisfied,color:"#1890ff"},{type:t.formatMessage({id:"bi.rating.table.neutral"}),value:q.neutral,color:"#faad14"},{type:t.formatMessage({id:"bi.rating.table.dissatisfied"}),value:q.dissatisfied,color:"#ff4d4f"}];return(0,L.jsxs)("div",{style:{padding:"24px"},children:[(0,L.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,L.jsx)("h2",{children:t.formatMessage({id:"bi.rating.title"})}),(0,L.jsxs)("p",{children:[t.formatMessage({id:"bi.rating.description"}),"today"===it&&(0,L.jsxs)("span",{style:{color:"#666",marginLeft:8},children:["(",_.format("YYYY-MM-DD"),")"]}),"yesterday"===it&&(0,L.jsxs)("span",{style:{color:"#666",marginLeft:8},children:["(",_.format("YYYY-MM-DD"),")"]}),("week"===it||"lastWeek"===it||"month"===it||"custom"===it)&&(0,L.jsxs)("span",{style:{color:"#666",marginLeft:8},children:["(",_.format("YYYY-MM-DD")," ~ ",$.format("YYYY-MM-DD"),")"]})]})]}),(0,L.jsx)(h.Z,{style:{marginBottom:"24px"},children:(0,L.jsx)(x.Z,{direction:"vertical",style:{width:"100%"},children:(0,L.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,L.jsxs)(x.Z,{wrap:!0,children:[(0,L.jsx)(v.ZP.Group,{value:it,onChange:function(t){return nt(t.target.value)},children:zt.map((function(t){return(0,L.jsx)(v.ZP.Button,{value:t.value,children:t.label},t.value)}))}),"custom"===it&&(0,L.jsx)(E,{value:[_,$],onChange:function(t){K(t[0]),tt(t[1])}})]}),(0,L.jsxs)(x.Z,{wrap:!0,children:[(0,L.jsxs)(u.Z,{value:xt,style:{width:120},onChange:function(t){vt(t),jt(void 0),kt(void 0)},children:[(0,L.jsx)(H,{value:P.whQ,children:t.formatMessage({id:"bi.statistic.level.organization"})}),(0,L.jsx)(H,{value:P.v5D,children:t.formatMessage({id:"bi.statistic.level.workgroup"})}),(0,L.jsx)(H,{value:P.fyH,children:t.formatMessage({id:"bi.statistic.level.agent"})})]}),xt===P.v5D&&(0,L.jsx)(u.Z,{value:yt,style:{width:150},onChange:jt,placeholder:t.formatMessage({id:"bi.statistic.level.workgroup"}),allowClear:!0,children:wt.map((function(t){return(0,L.jsx)(H,{value:t.uid,children:t.nickname},t.uid)}))}),xt===P.fyH&&(0,L.jsx)(u.Z,{value:bt,style:{width:150},onChange:kt,placeholder:t.formatMessage({id:"bi.statistic.level.agent"}),allowClear:!0,children:Ot.map((function(t){return(0,L.jsx)(H,{value:t.uid,children:t.nickname},t.uid)}))}),(0,L.jsx)(m.ZP,{type:"primary",icon:(0,L.jsx)(Y.Z,{}),onClick:function(){return It()},loading:i,children:t.formatMessage({id:"bi.common.refresh"})}),(0,L.jsx)(p.Z,{title:t.formatMessage({id:"ticket.statistic.filter.export"}),children:(0,L.jsx)(m.ZP,{icon:(0,L.jsx)(Z.Z,{}),onClick:function(){var t=localStorage.getItem(P.LA8);window.open((0,F.kG)()+"/api/v1/service/statistic/export?"+new URLSearchParams({type:xt,startDate:ot[0].format("YYYY-MM-DD"),endDate:ot[1].format("YYYY-MM-DD"),workgroupUid:xt===P.v5D?yt:"",agentUid:xt===P.fyH?bt:"",orgUid:(null==o?void 0:o.uid)||"",accessToken:t||""}).toString())},children:t.formatMessage({id:"ticket.statistic.filter.export"})})})]})]})})}),(0,L.jsxs)(y.Z,{spinning:i,children:[(0,L.jsxs)(j.Z,{gutter:16,style:{marginBottom:"24px"},children:[(0,L.jsx)(R.Z,{span:6,children:(0,L.jsx)(h.Z,{children:(0,L.jsx)(M.Z,{title:t.formatMessage({id:"bi.rating.card.totalRatings"}),value:q.totalRatings,prefix:(0,L.jsx)(w.Z,{}),valueStyle:{color:"#3f8600"}})})}),(0,L.jsx)(R.Z,{span:6,children:(0,L.jsx)(h.Z,{children:(0,L.jsx)(M.Z,{title:t.formatMessage({id:"bi.rating.card.avgRating"}),value:q.avgRating,prefix:(0,L.jsx)(k.Z,{}),valueStyle:{color:"#1890ff"},suffix:"/5"})})}),(0,L.jsx)(R.Z,{span:6,children:(0,L.jsx)(h.Z,{children:(0,L.jsx)(M.Z,{title:t.formatMessage({id:"bi.rating.card.satisfactionRate"}),value:q.satisfactionRate,prefix:(0,L.jsx)(C.Z,{}),valueStyle:{color:"#722ed1"},suffix:"%"})})}),(0,L.jsx)(R.Z,{span:6,children:(0,L.jsx)(h.Z,{children:(0,L.jsx)(M.Z,{title:t.formatMessage({id:"bi.rating.card.ratingRate"}),value:q.ratingRate,prefix:(0,L.jsx)(k.Z,{}),valueStyle:{color:"#13c2c2"},suffix:"%"})})})]}),(0,L.jsxs)(j.Z,{gutter:16,style:{marginBottom:"24px"},children:[(0,L.jsx)(R.Z,{span:12,children:(0,L.jsx)(h.Z,{title:t.formatMessage({id:"bi.rating.distribution"}),children:(0,L.jsx)("div",{style:{height:300,display:"flex",justifyContent:"center",alignItems:"center"},children:(0,L.jsxs)("div",{style:{textAlign:"center"},children:[(0,L.jsxs)("div",{style:{fontSize:"24px",fontWeight:"bold",color:"#52c41a"},children:[q.satisfactionRate,"%"]}),(0,L.jsx)("div",{style:{color:"#666"},children:t.formatMessage({id:"bi.rating.overallSatisfaction"})})]})})})}),(0,L.jsx)(R.Z,{span:12,children:(0,L.jsx)(h.Z,{title:t.formatMessage({id:"bi.rating.ratingDistribution"}),children:(0,L.jsx)("div",{style:{height:300},children:Ft.map((function(t,e){return(0,L.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",marginBottom:8},children:[(0,L.jsx)("span",{children:t.type}),(0,L.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(0,L.jsx)("div",{style:{width:12,height:12,backgroundColor:t.color,marginRight:8,borderRadius:2}}),(0,L.jsx)("span",{children:t.value})]})]},e)}))})})})]}),(0,L.jsx)(h.Z,{title:t.formatMessage({id:"bi.rating.detailData"}),children:(0,L.jsx)(b.Z,{columns:Pt,dataSource:W,pagination:{current:ut.current,pageSize:ut.pageSize,total:ut.total,showSizeChanger:!0,showQuickJumper:!0,showTotal:function(t,e){return"".concat(e[0],"-").concat(e[1]," of ").concat(t," items")}},onChange:function(t){It(t.current,t.pageSize)},size:"middle"})})]})]})}}}]); |