"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[966],{81734:function(H,O,e){e.r(O);var B=e(25359),C=e.n(B),I=e(49811),R=e.n(I),T=e(54306),m=e.n(T),x=e(25367),K=e(34316),M=e(87474),U=e(12472),L=e(12817),j=e(64619),c=e(86195),S=e(833),W=e(46370),p=e(50959),o=e(11527),E="listenOnGroups";O.default=function(){var f,Z=(0,p.useState)([]),g=m()(Z,2),k=g[0],G=g[1],$=(0,p.useState)([{id:"empty"}]),h=m()($,2),d=h[0],v=h[1],J=(0,p.useState)("bottom"),A=m()(J,2),D=A[0],N=A[1],P=(0,c.useRequest)(function(){return(0,c.request)("/api/storage",{params:{keys:[E].join(",")}})}),y=P.data,z=P.error,V=P.loading;if(V)return(0,o.jsx)(x.Z,{});if(z)return(0,K.Z)(),null;if(((f=d[0])===null||f===void 0?void 0:f.id)=="empty"){var b=[],i=Object.keys(y).map(function(n){var a=n.split(".")[1];b.push("nickname."+a);try{n=JSON.parse(y[n])}catch(_){n={}}return n.id=a,n});(0,c.request)("/api/storage",{params:{keys:b.join(",")}}).then(function(n){if(n.data)for(var a in n.data){var _=a.split(".")[1];for(var u in i)if(i[u].id==_)try{var t=JSON.parse(n.data[a]),r=t.v,s=t.p;r&&(i[u].nickname=r,i[u].platform=s)}catch(l){}}v(i)})}var w=[{title:"\u7FA4\u53F7",dataIndex:"id",width:"15%"},{title:"\u7FA4\u79F0",dataIndex:"nickname",width:"15%",readonly:!0},{title:"\u5E73\u53F0",width:"15%",dataIndex:"platform",readonly:!0},{title:"\u5907\u6CE8",dataIndex:"decs",fieldProps:function(a,_){var u=_.rowKey,t=_.rowIndex;return a.getFieldValue([u||"","title"])==="\u4E0D\u597D\u73A9"?{disabled:!0}:t>9?{disabled:!0}:{}}},{title:"\u72B6\u6001",dataIndex:"enable",valueType:"switch",width:"10%",render:function(a,_){var u;return(0,o.jsx)(S.Z,{disabled:!0,defaultChecked:(u=d.find(function(t){return t.id==_.id}))===null||u===void 0?void 0:u.enable})}},{title:"\u64CD\u4F5C",valueType:"option",width:200,render:function(a,_,u,t){return[(0,o.jsx)("a",{onClick:function(){var s;t==null||(s=t.startEditable)===null||s===void 0||s.call(t,_.id)},children:"\u7F16\u8F91"},"editable"),(0,o.jsx)("a",{onClick:function(){v(d.filter(function(l){return l.id!==_.id}));var s={};s[E+"."+_.id]="",(0,M.Z)(s)},children:"\u5220\u9664"},"delete")]}}];return(0,o.jsxs)(U._z,{children:[(0,o.jsx)(W.Z,{style:{marginBottom:"10px"},message:"\u5B89\u5168\u8D77\u89C1\uFF0C\u7FA4\u804A\u6D88\u606F\u9ED8\u8BA4\u4E0D\u4F1A\u88AB\u76D1\u542C\u5904\u7406\uFF0C\u4F60\u53EF\u4EE5\u5728\u8FD9\u91CC\u6DFB\u52A0\u4F60\u60F3\u8981\u63A5\u6536\u5904\u7406\u6D88\u606F\u7684\u7FA4\u804A\uFF0C\u4E5F\u53EF\u4EE5\u76F4\u63A5\u5728\u7FA4\u804A\u4E2D\u4F7F\u7528listen\u548Cunlisten\u5F00\u542F\u548C\u5173\u95ED\u3002",type:"info",closeText:"\u5173\u95ED"}),(0,o.jsx)(L.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,o.jsx)(j.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=R()(C()().mark(function _(u,t){var r;return C()().wrap(function(l){for(;;)switch(l.prev=l.next){case 0:r={},u!=t.id&&(r[E+"."+u]=""),r[E+"."+t.id]=JSON.stringify(t),(0,M.Z)(r),v(d.map(function(F){return F.id==u?t:F}));case 5:case"end":return l.stop()}},_)}));function a(_,u){return n.apply(this,arguments)}return a}(),onChange:G}})]})}}}]);
