Files
weiyu/deploy/server/admin/p__Dashboard__Bi__Ticket__CustomReport.e25285f5.async.js
jack ning 4c7623244a update
2025-07-30 11:08:35 +08:00

1 line
9.8 KiB
JavaScript

"use strict";(self.webpackChunkadmin=self.webpackChunkadmin||[]).push([[674],{91323:function(e,t,a){a.r(t);var i=a(90819),s=a.n(i),n=a(89933),r=a.n(n),o=a(45332),l=a.n(o),c=a(44194),d=a(41123),u=a(34251),f=a(63065),m=a(43413),g=a(10337),k=a(77407),p=a(5858),v=a(9248),x=a(14318),y=a(68525),h=a(35911),b=a(33e3),j=a(16829),M=a(12201),w=a(14546),T=a(75699),Z=a(61628),R=a(31756),Y=a(31881),D=a(76001),C=a(7999),S=a(30234),O=a(25191),I=a(28977),F=a.n(I),B=a(89295),E=a(54693),P=a(31549),U=d.default.RangePicker,z=u.Z.Option;t.default=function(){var e,t,a=(0,T.useIntl)(),i=(0,S.Z)().translateStringTranct,n=(0,c.useState)(F()().startOf("day")),o=l()(n,2),d=o[0],I=o[1],W=(0,c.useState)(F()().endOf("day")),H=l()(W,2),L=H[0],A=H[1],N=(0,c.useState)("today"),Q=l()(N,2),q=Q[0],G=Q[1],_=(0,c.useState)(O.whQ),J=l()(_,2),K=J[0],V=J[1],X=(0,c.useState)(),$=l()(X,2),ee=$[0],te=$[1],ae=(0,c.useState)(),ie=l()(ae,2),se=ie[0],ne=ie[1],re=(0,Y.u)((function(e){return e.currentOrg})),oe=(0,D.E)((function(e){return e})),le=oe.agentResult,ce=oe.setAgentResult,de=(0,E.H)((function(e){return e})),ue=de.departmentResult,fe=de.setDepartmentResult,me=(0,c.useState)(),ge=l()(me,2),ke=ge[0],pe=ge[1],ve=(0,c.useState)(!1),xe=l()(ve,2),ye=xe[0],he=xe[1],be=[{label:(0,P.jsx)(T.FormattedMessage,{id:"bi.ticket.timeRange.today"}),value:"today"},{label:(0,P.jsx)(T.FormattedMessage,{id:"bi.ticket.timeRange.yesterday"}),value:"yesterday"},{label:(0,P.jsx)(T.FormattedMessage,{id:"bi.ticket.timeRange.week"}),value:"week"},{label:(0,P.jsx)(T.FormattedMessage,{id:"bi.ticket.timeRange.lastWeek"}),value:"lastWeek"},{label:(0,P.jsx)(T.FormattedMessage,{id:"bi.ticket.timeRange.month"}),value:"month"},{label:(0,P.jsx)(T.FormattedMessage,{id:"bi.ticket.timeRange.custom"}),value:"custom"}];(0,c.useEffect)((function(){if("custom"===q)I(d),A(L);else{var e=F()();"today"===q?(I(e),A(e)):"yesterday"===q?(I(e.subtract(1,"day")),A(e.subtract(1,"day"))):"week"===q?(I(e.startOf("week")),A(e.endOf("week"))):"lastWeek"===q?(I(e.subtract(1,"week").startOf("week")),A(e.subtract(1,"week").endOf("week"))):"month"===q&&(I(e.startOf("month")),A(e.endOf("month")))}}),[q]);var je=function(){var e=r()(s()().mark((function e(){var t,a;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R.yw.loading("loading"),t={pageNumber:0,pageSize:100,orgUid:null==re?void 0:re.uid},e.next=4,(0,B.dF)(t);case 4:200===(a=e.sent).code?(R.yw.destroy(),fe(a),a.data.content.length>0&&ne(a.data.content[0].uid)):(R.yw.destroy(),R.yw.error(a.message));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),Me=function(){var e=r()(s()().mark((function e(){var t,a;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return R.yw.loading("loading"),t={pageNumber:0,pageSize:50,orgUid:null==re?void 0:re.uid},e.next=4,(0,C._t)(t);case 4:200===(a=e.sent).code?(R.yw.destroy(),ce(a),a.data.content.length>0&&te(a.data.content[0].uid)):(R.yw.destroy(),R.yw.error(i(a.message)));case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),we=function(){var e=r()(s()().mark((function e(){var t,i;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return he(!0),e.prev=1,R.yw.loading("loading"),t={type:K,startDate:null==d?void 0:d.format("YYYY-MM-DD"),endDate:null==L?void 0:L.format("YYYY-MM-DD"),departmentUid:se,assigneeUid:ee,orgUid:null==re?void 0:re.uid},e.next=6,(0,Z.AD)(t);case 6:i=e.sent,console.log("queryStatisticTicketByDate response:",i.data,t),200===i.code?(R.yw.destroy(),pe(i.data)):(R.yw.destroy(),R.yw.error(i.message)),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(1),R.yw.error(a.formatMessage({id:"ticket.message.operation.failed"}));case 14:return e.prev=14,he(!1),e.finish(14);case 17:case"end":return e.stop()}}),e,null,[[1,11,14,17]])})));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){je(),Me()}),[]),(0,c.useEffect)((function(){we()}),[K,ee,se]),(0,c.useEffect)((function(){we()}),[d,L]);var Te=[{key:"1",date:null==d?void 0:d.format("YYYY-MM-DD"),totalTickets:(null==ke?void 0:ke.totalTickets)||0,resolvedTickets:(null==ke?void 0:ke.resolvedTickets)||0,openTickets:(null==ke?void 0:ke.openTickets)||0,closedTickets:(null==ke?void 0:ke.closedTickets)||0,satisfactionRate:(null==ke?void 0:ke.customerSatisfactionRate)||0,avgResolutionTime:"".concat((null==ke?void 0:ke.averageResolutionTime)||0,"小时"),avgResponseTime:"".concat((null==ke?void 0:ke.averageFirstResponseTime)||0,"分钟"),slaComplianceRate:(null==ke?void 0:ke.slaComplianceRate)||0}],Ze=[{title:a.formatMessage({id:"bi.ticket.table.date"}),dataIndex:"date",key:"date"},{title:a.formatMessage({id:"bi.ticket.table.totalTickets"}),dataIndex:"totalTickets",key:"totalTickets"},{title:a.formatMessage({id:"bi.ticket.table.resolvedTickets"}),dataIndex:"resolvedTickets",key:"resolvedTickets"},{title:a.formatMessage({id:"bi.ticket.table.processingTickets"}),dataIndex:"openTickets",key:"openTickets"},{title:a.formatMessage({id:"bi.ticket.table.closedTickets"}),dataIndex:"closedTickets",key:"closedTickets"},{title:a.formatMessage({id:"bi.ticket.table.satisfactionRate"}),dataIndex:"satisfactionRate",key:"satisfactionRate",render:function(e){return"".concat(e,"%")}},{title:a.formatMessage({id:"bi.ticket.table.avgResolutionTime"}),dataIndex:"avgResolutionTime",key:"avgResolutionTime",render:function(e){return"".concat(e).concat(a.formatMessage({id:"bi.ticket.unit.minute"}))}},{title:a.formatMessage({id:"bi.ticket.table.avgResponseTime"}),dataIndex:"avgResponseTime",key:"avgResponseTime",render:function(e){return"".concat(e).concat(a.formatMessage({id:"bi.ticket.unit.minute"}))}},{title:a.formatMessage({id:"bi.ticket.table.slaComplianceRate"}),dataIndex:"slaComplianceRate",key:"slaComplianceRate",render:function(e){return"".concat(e,"%")}}];return(0,P.jsxs)("div",{style:{padding:"24px"},children:[(0,P.jsxs)("div",{style:{marginBottom:"24px"},children:[(0,P.jsx)("h2",{children:a.formatMessage({id:"bi.ticket.title.customReport"})}),(0,P.jsxs)("p",{children:[a.formatMessage({id:"bi.ticket.description.customReport"}),"today"===q&&(0,P.jsxs)("span",{style:{color:"#666",marginLeft:8},children:["(",d.format("YYYY-MM-DD"),")"]}),"yesterday"===q&&(0,P.jsxs)("span",{style:{color:"#666",marginLeft:8},children:["(",d.format("YYYY-MM-DD"),")"]}),("week"===q||"lastWeek"===q||"month"===q||"custom"===q)&&(0,P.jsxs)("span",{style:{color:"#666",marginLeft:8},children:["(",d.format("YYYY-MM-DD")," ~ ",L.format("YYYY-MM-DD"),")"]})]})]}),(0,P.jsx)(f.Z,{style:{marginBottom:16},children:(0,P.jsx)(m.Z,{direction:"vertical",style:{width:"100%"},children:(0,P.jsxs)(m.Z,{wrap:!0,style:{width:"100%",justifyContent:"space-between"},children:[(0,P.jsxs)(m.Z,{wrap:!0,children:[(0,P.jsx)(g.ZP.Group,{value:q,onChange:function(e){return G(e.target.value)},children:be.map((function(e){return(0,P.jsx)(g.ZP.Button,{value:e.value,children:e.label},e.value)}))}),"custom"===q&&(0,P.jsx)(U,{value:[d,L],onChange:function(e){I(e[0]),A(e[1])}})]}),(0,P.jsxs)(m.Z,{wrap:!0,children:[(0,P.jsxs)(u.Z,{value:K,onChange:V,style:{width:120},placeholder:a.formatMessage({id:"bi.ticket.filter.type"}),children:[(0,P.jsx)(z,{value:O.whQ,children:a.formatMessage({id:"bi.ticket.filterType.organization"})}),(0,P.jsx)(z,{value:O.fyH,children:a.formatMessage({id:"bi.ticket.filterType.agent"})}),(0,P.jsx)(z,{value:O.nYM,children:a.formatMessage({id:"bi.ticket.filterType.department"})})]}),K===O.fyH&&(0,P.jsx)(u.Z,{value:ee,onChange:te,style:{width:150},placeholder:a.formatMessage({id:"bi.ticket.filter.agent"}),allowClear:!0,children:null===(e=le.data)||void 0===e||null===(e=e.content)||void 0===e?void 0:e.map((function(e){return(0,P.jsx)(z,{value:e.uid,children:i(e.nickname)},e.uid)}))}),K===O.nYM&&(0,P.jsx)(u.Z,{value:se,onChange:ne,style:{width:150},placeholder:a.formatMessage({id:"bi.ticket.filter.department"}),allowClear:!0,children:null===(t=ue.data)||void 0===t||null===(t=t.content)||void 0===t?void 0:t.map((function(e){return(0,P.jsx)(z,{value:e.uid,children:i(e.name)},e.uid)}))}),(0,P.jsx)(k.ZP,{type:"primary",icon:(0,P.jsx)(h.Z,{}),onClick:function(){return we()},children:(0,P.jsx)(T.FormattedMessage,{id:"bi.common.refresh"})}),(0,P.jsx)(k.ZP,{type:"default",onClick:function(){R.yw.warning("TODO: 待实现导出功能")},children:a.formatMessage({id:"bi.ticket.filter.export"})})]})]})})}),(0,P.jsxs)(p.Z,{gutter:16,style:{marginBottom:"24px"},children:[(0,P.jsx)(v.Z,{span:6,children:(0,P.jsx)(f.Z,{children:(0,P.jsx)(x.Z,{title:a.formatMessage({id:"bi.ticket.card.totalTickets"}),value:(null==ke?void 0:ke.totalTickets)||0,prefix:(0,P.jsx)(b.Z,{}),valueStyle:{color:"#3f8600"}})})}),(0,P.jsx)(v.Z,{span:6,children:(0,P.jsx)(f.Z,{children:(0,P.jsx)(x.Z,{title:a.formatMessage({id:"bi.ticket.card.resolutionRate"}),value:null!=ke&&ke.totalTickets?Math.round(ke.resolvedTickets/ke.totalTickets*100):0,prefix:(0,P.jsx)(j.Z,{}),valueStyle:{color:"#1890ff"},suffix:a.formatMessage({id:"bi.ticket.unit.percent"})})})}),(0,P.jsx)(v.Z,{span:6,children:(0,P.jsx)(f.Z,{children:(0,P.jsx)(x.Z,{title:a.formatMessage({id:"bi.ticket.card.satisfactionRate"}),value:(null==ke?void 0:ke.customerSatisfactionRate)||0,prefix:(0,P.jsx)(M.Z,{}),valueStyle:{color:"#722ed1"},suffix:a.formatMessage({id:"bi.ticket.unit.percent"})})})}),(0,P.jsx)(v.Z,{span:6,children:(0,P.jsx)(f.Z,{children:(0,P.jsx)(x.Z,{title:a.formatMessage({id:"bi.ticket.card.slaComplianceRate"}),value:(null==ke?void 0:ke.slaComplianceRate)||0,prefix:(0,P.jsx)(w.Z,{}),valueStyle:{color:"#eb2f96"},suffix:a.formatMessage({id:"bi.ticket.unit.percent"})})})})]}),(0,P.jsxs)(p.Z,{gutter:16,style:{marginBottom:"24px"},children:[(0,P.jsx)(v.Z,{span:12,children:(0,P.jsx)(f.Z,{title:a.formatMessage({id:"bi.ticket.workloadEfficiency"})})}),(0,P.jsx)(v.Z,{span:12,children:(0,P.jsx)(f.Z,{title:a.formatMessage({id:"bi.ticket.statusDistribution"})})})]}),(0,P.jsx)(f.Z,{title:"综合报表数据",loading:ye,children:(0,P.jsx)(y.Z,{columns:Ze,dataSource:Te,pagination:!1,size:"middle"})})]})}}}]);