"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[538],{29620:function(H,C,e){e.r(C);var I=e(25359),O=e.n(I),R=e(49811),U=e.n(R),x=e(54306),c=e.n(x),B=e(25367),K=e(34316),M=e(87474),L=e(12472),j=e(12817),S=e(64619),m=e(86195),W=e(833),F=e(46370),p=e(50959),l=e(11527),E="noListenUsers";C.default=function(){var f,Z=(0,p.useState)([]),g=c()(Z,2),k=g[0],G=g[1],$=(0,p.useState)([{id:"empty"}]),h=c()($,2),d=h[0],v=h[1],J=(0,p.useState)("bottom"),y=c()(J,2),D=y[0],N=y[1],P=(0,m.useRequest)(function(){return(0,m.request)("/api/storage",{params:{keys:[E].join(",")}})}),b=P.data,z=P.error,V=P.loading;if(V)return(0,l.jsx)(B.Z,{});if(z)return(0,K.Z)(),null;if(((f=d[0])===null||f===void 0?void 0:f.id)=="empty"){var A=[],i=Object.keys(b).map(function(n){var u=n.split(".")[1];A.push("nickname."+u);try{n=JSON.parse(b[n])}catch(_){n={}}return n.id=u,n});(0,m.request)("/api/storage",{params:{keys:A.join(",")}}).then(function(n){if(n.data)for(var u in n.data){var _=u.split(".")[1];for(var a in i)if(i[a].id==_)try{var t=JSON.parse(n.data[u]),r=t.v,s=t.p;r&&(i[a].nickname=r,i[a].platform=s)}catch(o){}}v(i)})}var w=[{title:"\u8D26\u53F7",dataIndex:"id",width:"15%"},{title:"\u6635\u79F0",dataIndex:"nickname",width:"15%",readonly:!0},{title:"\u5E73\u53F0",width:"15%",dataIndex:"platform",valueType:"select",readonly:!0},{title:"\u5907\u6CE8",dataIndex:"decs",fieldProps:function(u,_){var a=_.rowKey,t=_.rowIndex;return u.getFieldValue([a||"","title"])==="\u4E0D\u597D\u73A9"?{disabled:!0}:t>9?{disabled:!0}:{}}},{title:"\u72B6\u6001",dataIndex:"enable",valueType:"switch",width:"10%",render:function(u,_){var a;return(0,l.jsx)(W.Z,{disabled:!0,defaultChecked:(a=d.find(function(t){return t.id==_.id}))===null||a===void 0?void 0:a.enable})}},{title:"\u64CD\u4F5C",valueType:"option",width:200,render:function(u,_,a,t){return[(0,l.jsx)("a",{onClick:function(){var s;t==null||(s=t.startEditable)===null||s===void 0||s.call(t,_.id)},children:"\u7F16\u8F91"},"editable"),(0,l.jsx)("a",{onClick:function(){v(d.filter(function(o){return o.id!==_.id}));var s={};s[E+"."+_.id]="",(0,M.Z)(s)},children:"\u5220\u9664"},"delete")]}}];return(0,l.jsxs)(L._z,{children:[(0,l.jsx)(F.Z,{style:{marginBottom:"10px"},message:"\u9ED8\u8BA4\u76D1\u542C\u56DE\u590D\u6240\u6709\u79C1\u804A\uFF0C\u4F7F\u7528unlisten\u53E3\u4EE4\u5C4F\u853D\u79C1\u804A\uFF0Clisten\u53E3\u4EE4\u6062\u590D\u79C1\u804A\u3002\u7528\u6237\u88AB\u5C4F\u853D\u540E\u5C06\u4E0D\u518D\u63A5\u6536\u6709\u5173\u7528\u6237\u7684\u4EFB\u4F55\u6D88\u606F\u3002",type:"info",closeText:"\u5173\u95ED"}),(0,l.jsx)(j.Z,{rowKey:"id",maxLength:1005,scroll:{x:960},recordCreatorProps:D!=="hidden"?{position:D,record:function(){return{id:""+(Math.random()*1e6).toFixed(0)}}}:!1,loading:!1,toolBarRender:function(){return[(0,l.jsx)(S.Z.Group,{fieldProps:{value:D,onChange:function(_){N(_.target.value)}},options:[{label:"\u6DFB\u52A0\u5230\u9876\u90E8",value:"top"},{label:"\u6DFB\u52A0\u5230\u5E95\u90E8",value:"bottom"},{label:"\u9690\u85CF",value:"hidden"}]},"render")]},columns:w,value:d,onChange:v,editable:{type:"multiple",editableKeys:k,onSave:function(){var n=U()(O()().mark(function _(a,t){var r;return O()().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:r={},a!=t.id&&(r[E+"."+a]=""),r[E+"."+t.id]=JSON.stringify(t),(0,M.Z)(r),v(d.map(function(T){return T.id==a?t:T}));case 5:case"end":return o.stop()}},_)}));function u(_,a){return n.apply(this,arguments)}return u}(),onChange:G}})]})}}}]);
