text: (self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[5349],{66640:function(L,R,e){"use strict";e.r(R),e.d(R,{Report:function(){return A},default:function(){return ht}});var o=e(67294),P=e(60674),C=e(77613),B=e(72706),p=(0,o.createContext)({}),F=p.Provider,jt=p.Consumer;function M(r){var a=["Radio","Multi","Cascader","Select","QuestionSet"];if(a.includes(r.type))return!0;if(r.type==="FillBlank"||r.type==="MultipleBlank"){var i;if((i=r.children)!==null&&i!==void 0&&i.find(function(n){var s;return((s=n.attribute)===null||s===void 0?void 0:s.dataType)==="number"}))return!0}return!1}var Q={Radio:"\u5355\u9009\u9898",Checkbox:"\u591A\u9009\u9898",Cascader:"\u7EA7\u8054\u9898",Select:"\u4E0B\u62C9\u9898",FillBlank:"\u5355\u884C\u6587\u672C\u9898",Textarea:"\u591A\u884C\u6587\u672C\u9898",MultipleBlank:"\u591A\u9879\u586B\u7A7A\u9898"},U=e(69610),W=e(54941),b=function(){function r(){(0,U.Z)(this,r),this._init=this._init.bind(this),this._cleanUp=this._cleanUp.bind(this),this.convertFromInput=this.convertFromInput.bind(this)}return(0,W.Z)(r,[{key:"_init",value:function(){this.canvas=document.createElement("canvas"),this.imgPreview=document.createElement("img"),this.imgPreview.style="position: absolute; top: -9999px",document.body.appendChild(this.imgPreview),this.canvasCtx=this.canvas.getContext("2d")}},{key:"_cleanUp",value:function(){document.body.removeChild(this.imgPreview)}},{key:"convertFromInput",value:function(i,n){this._init();var s=this;this.imgPreview.onload=function(){var h=new Image;s.canvas.width=s.imgPreview.clientWidth,s.canvas.height=s.imgPreview.clientHeight,h.crossOrigin="anonymous",h.src=s.imgPreview.src,h.onload=function(){s.canvasCtx.drawImage(h,0,0);var l=s.canvas.toDataURL("image/png");typeof n=="function"&&n(l),s._cleanUp()}},this.imgPreview.src=i}}]),r}(),T=e(11628),t=e(85893),w=function(a){var i;return a?(i=a.children)===null||i===void 0?void 0:i.filter(function(n){return M(n)}).map(function(n){return n.type==="QuestionSet"?(0,t.jsx)(H,{schema:n},n.id):(0,t.jsx)(at,{schema:n},n.id)}):(0,t.jsx)(t.Fragment,{})},z=(0,C.P)(function(){var r=(0,T.IE)(),a=r.schema;return(0,t.jsx)("div",{children:w(a)})}),H=function(a){return(0,t.jsx)("div",{children:w(a.schema)})},St=e(13062),E=e(71230),Ct=e(66456),G=e(48995),Ft=e(89032),y=e(15746),It=e(57663),j=e(71577),V=e(2824),K=e(3375),X=e(68023),J=e(96262),Y=e(24894),k=e(79110),q=e(8690),_=e(17813),tt=e(79164),et=e(19076),nt=e(23163);X.D([q.N,_.N,tt.N,Y.N,k.N,nt.N,et.N]);var rt=(0,o.forwardRef)(function(r,a){var i=r.data,n=r.labels,s=r.loading,h=r.name,l=r.type,I=(0,o.useRef)(null),d=(0,o.useRef)();return(0,o.useEffect)(function(){if(I.current){var x=J.S1(I.current);return d.current=x,function(){x.dispose()}}},[]),(0,o.useImperativeHandle)(a,function(){return{saveAsImage:function(){var m;return(m=d.current)===null||m===void 0?void 0:m.getDataURL({type:"png"})}}}),(0,o.useEffect)(function(){!s&&d.current?(d.current.hideLoading(),d.current.clear(),l==="horizontalBar"?d.current.setOption({title:{text:h},tooltip:{show:!0,trigger:"item"},xAxis:{show:!1},yAxis:{type:"category",data:n},series:[{data:i,type:"bar",barWidth:15,showBackground:!0,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)"}}]}):l==="pie"?d.current.setOption({title:{text:h},tooltip:{show:!0,trigger:"item"},series:[{name:h,type:"pie",radius:"60%",data:i==null?void 0:i.map(function(x,m){return{name:n[m],value:x}}),emphasis:{itemStyle:{shadowBlur:10,shadowOffsetX:0,shadowColor:"rgba(0, 0, 0, 0.5)"}},labelLine:{length:10,length2:25}}]}):l==="bar"&&d.current.setOption({title:{text:h},tooltip:{show:!0,trigger:"item"},xAxis:{type:"category",data:n,axisLabel:{interval:0,rotate:30}},yAxis:{show:!1},series:[{data:i,type:"bar",barWidth:15,showBackground:!0,backgroundStyle:{color:"rgba(180, 180, 180, 0.2)"}}]})):d.current&&d.current.showLoading()},[s,l,i]),(0,t.jsx)("div",{ref:I,style:{height:300}})}),N=e(76826),at=(0,C.P)(function(r){var a,i,n=r.schema,s=(0,o.useContext)(p),h=s.loading,l=s.reportData,I=(0,o.useState)("bar"),d=(0,V.Z)(I,2),x=d[0],m=d[1],$=(l==null||(a=l.statistics[n.id])===null||a===void 0?void 0:a.total)||0,O=(0,o.useRef)(null),mt=(0,o.useMemo)(function(){return n.type==="FillBlank"?[{title:"\u5408\u8BA1",dataIndex:"sum",width:"25%"},{title:"\u5E73\u5747\u503C",dataIndex:"average",width:"25%"},{title:"\u6700\u9AD8\u503C",dataIndex:"max",width:"25%"},{title:"\u6700\u4F4E\u503C",dataIndex:"min",width:"25%"}]:[{title:"\u9009\u9879",dataIndex:"title",width:"50%"},{title:"\u6570\u636E\u91CF",dataIndex:"total",width:"25%",sorter:function(u,v){return u.total-v.total},showSorterTooltip:!1},{title:"\u5360\u6BD4",dataIndex:"percent",width:"25%",sorter:function(u,v){return parseFloat(u.percent)-parseFloat(v.percent)},showSorterTooltip:!1}]},[n.type]),ft=function(){var u,v=(u=O.current)===null||u===void 0?void 0:u.saveAsImage();v&&new b().convertFromInput(v,function(g){var f=document.createElement("a");f.href=g,f.download="haha.png",f.click(),f.remove()})},xt=function(){var u;return(u=n.children)===null||u===void 0?void 0:u.map(function(v){var g=v.id,f=v.title,c=l==null?void 0:l.statistics[g];if(c){var S=c.total||0,yt=(S/($||1)*100).toFixed(2)+"%";return{id:g,title:(0,N.WO)(f),total:S,percent:yt,min:c.min,max:c.max,average:c.average,sum:c.sum}}return{id:g,title:(0,N.WO)(f),total:0,percent:"0%"}})},gt=function(){var u,v;if(n.type==="FillBlank"||n.type==="MatrixFillBlank")return(0,t.jsx)(t.Fragment,{});var g=((u=n.children)===null||u===void 0?void 0:u.map(function(c){return(0,N.WO)(c.title)}))||[],f=((v=n.children)===null||v===void 0?void 0:v.map(function(c){var S;return(l==null||(S=l.statistics[c.id])===null||S===void 0?void 0:S.total)||0}))||[];return(0,t.jsxs)(y.Z,{span:24,className:"question-chart",children:[(0,t.jsx)("div",{className:"question-chart-btns",children:(0,t.jsxs)(j.Z.Group,{size:"small",children:[(0,t.jsx)(j.Z,{type:"link",onClick:function(){return m("bar")},children:"\u6761\u5F62\u56FE"}),(0,t.jsx)(j.Z,{type:"link",onClick:function(){return m("horizontalBar")},children:"\u67F1\u5F62\u56FE"}),(0,t.jsx)(j.Z,{type:"link",onClick:function(){return m("pie")},children:"\u6247\u5F62\u56FE"}),(0,t.jsx)(j.Z,{type:"link",icon:(0,t.jsx)("div",{className:"divider"})}),(0,t.jsx)(j.Z,{type:"link",icon:(0,t.jsx)(K.Z,{}),onClick:ft})]})}),(0,t.jsx)("div",{children:(0,t.jsx)(rt,{type:x,loading:h,labels:g,data:f,ref:O})})]})},pt=function(){return(0,t.jsx)(y.Z,{span:24,children:(0,t.jsx)(G.Z,{pagination:!1,size:"small",bordered:!0,columns:mt,rowKey:"id",dataSource:xt()})})};return(0,t.jsx)("div",{className:"question-item",children:(0,t.jsxs)(E.Z,{gutter:[12,12],className:"question-content",children:[(0,t.jsx)(y.Z,{xs:24,sm:12,children:(0,t.jsxs)(E.Z,{children:[(0,t.jsx)(y.Z,{span:24,children:(0,t.jsx)("span",{className:"question-label",children:(0,N.WO)(n.title)})}),gt()]})}),(0,t.jsx)(y.Z,{xs:24,sm:12,children:(0,t.jsxs)(E.Z,{children:[(0,t.jsx)(y.Z,{span:24,children:(0,t.jsx)("div",{className:"question-title",children:(0,t.jsxs)("div",{className:"question-data-desc",children:[(0,t.jsxs)("div",{children:["\u7C7B\u578B\uFF1A",Q[n.type]]}),(0,t.jsxs)("div",{children:["\u5FC5\u586B\uFF1A",(i=n.attribute)!==null&&i!==void 0&&i.required?"\u662F":"\u5426"]}),(0,t.jsxs)("div",{children:[$,"\u6761\u6570\u636E"]})]})})}),pt()]})})]})})}),Zt=e(59250),it=e(13013),Rt=e(30887),D=e(54689),Pt=e(47673),st=e(4107),ot=e(19957),lt=e(83663),ut=st.Z.Search,dt=(0,C.P)(function(){var r=(0,o.useContext)(p),a=r.reportData,i=(0,t.jsxs)(D.Z,{children:[(0,t.jsx)(D.Z.Item,{children:"\u6309\u6570\u636E\u5185\u5BB9\u7B5B\u9009"}),(0,t.jsx)(D.Z.Item,{children:"\u6309\u63D0\u4EA4\u65E5\u671F\u7B5B\u9009"})]});return(0,t.jsxs)("div",{className:"report-header",children:[(0,t.jsxs)("span",{children:["\u5171",(a==null?void 0:a.total)||0,"\u6761\u6570\u636E"]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(ut,{size:"small",placeholder:"\u641C\u7D22",onSearch:function(s){r.loadReportData(s)},style:{width:200,marginRight:10}}),(0,t.jsx)(it.Z,{overlay:i,placement:"bottomRight",children:(0,t.jsx)(ot.Z,{style:{cursor:"pointer"}})})]}),(0,t.jsx)(lt.Z,{})]})}),vt=function(){return(0,t.jsx)(dt,{})},ct=function(){return(0,t.jsx)("div",{className:"report-container",children:(0,t.jsx)(z,{})})},A=(0,C.P)(function(){var r=(0,T.IE)(),a=(0,o.useMemo)(function(){return new B.Cu(r)},[r]);return(0,o.useEffect)(function(){a.loadReportData()},[]),(0,t.jsx)("div",{className:"survey-report",children:(0,t.jsxs)(F,{value:a,children:[(0,t.jsx)(vt,{}),(0,t.jsx)(ct,{})]})})}),ht=A},11628:function(L,R,e){"use strict";e.d(R,{xI:function(){return P},Ge:function(){return p},IE:function(){return B}});var o=e(67294),P=(0,o.createContext)({}),C=P.Provider;function B(){var F=(0,o.useContext)(P);return F.store}function p(){var F=B();return F.flowStore}}}]);
  