"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[1817],{58503:function(fe,Y,t){t.r(Y),t.d(Y,{default:function(){return xe}});var q=t(26068),p=t.n(q),ee=t(90228),C=t.n(ee),K=t(87999),A=t.n(K),G=t(48305),Q=t.n(G),h=t(50959),L=t(50159),N=t(63463),ne=t(16030),W=t(88357),Z=t(959),$=t(56929),B=t(11642),v=t(73356),s=t(35361),me=t(14790),he=t(67129),ge=t(97128),ye=t(38292),le=t(19348),Re=t(14279),ue=t(89558),Ce=t(37581),be=t(50925),Te=t(3691),te=t(75124),ie=t(19134),Ze=t(35384),d=t(11527),pe=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue","onChange","editableFormRef"],je=["record","position","creatorButtonText","newRecordType","parentKey","style"],oe=h.createContext(void 0);function de(e){var j=e.children,S=e.record,V=e.position,I=e.newRecordType,P=e.parentKey,O=(0,h.useContext)(oe);return h.cloneElement(j,(0,s.Z)((0,s.Z)({},j.props),{},{onClick:function(){var F=(0,v.Z)((0,B.Z)().mark(function J(z){var M,U,E,y;return(0,B.Z)().wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,(M=(U=j.props).onClick)===null||M===void 0?void 0:M.call(U,z);case 2:if(y=r.sent,y!==!1){r.next=5;break}return r.abrupt("return");case 5:O==null||(E=O.current)===null||E===void 0||E.addEditRecord(S,{position:V,newRecordType:I,parentKey:P});case 6:case"end":return r.stop()}},J)}));function D(J){return F.apply(this,arguments)}return D}()}))}function se(e){var j,S,V=(0,ye.YB)(),I=e.onTableChange,P=e.maxLength,O=e.formItemProps,F=e.recordCreatorProps,D=e.rowKey,J=e.controlled,z=e.defaultValue,M=e.onChange,U=e.editableFormRef,E=(0,$.Z)(e,pe),y=(0,h.useRef)(void 0),g=(0,h.useRef)(),r=(0,h.useRef)();(0,h.useImperativeHandle)(E.actionRef,function(){return g.current},[g.current]);var R=(0,Te.Z)(function(){return e.value||z||[]},{value:e.value,onChange:e.onChange}),f=(0,Z.Z)(R,2),n=f[0],x=f[1],a=h.useMemo(function(){return typeof D=="function"?D:function(l,m){return l[D]||m}},[D]),_=(0,le.J)(function(l){if(typeof l=="number"&&!e.name){if(l>=n.length)return l;var m=n&&n[l];return a==null?void 0:a(m,l)}if((typeof l=="string"||l>=n.length)&&e.name){var u=n.findIndex(function(i,o){var c;return(a==null||(c=a(i,o))===null||c===void 0?void 0:c.toString())===(l==null?void 0:l.toString())});if(u!==-1)return u}return l});(0,h.useImperativeHandle)(U,function(){var l=function(i){var o,c;if(i==null)throw new Error("rowIndex is required");var T=_(i),w=[e.name,(o=T==null?void 0:T.toString())!==null&&o!==void 0?o:""].flat(1).filter(Boolean);return(c=r.current)===null||c===void 0?void 0:c.getFieldValue(w)},m=function(){var i,o=[e.name].flat(1).filter(Boolean);if(Array.isArray(o)&&o.length===0){var c,T=(c=r.current)===null||c===void 0?void 0:c.getFieldsValue();return Array.isArray(T)?T:Object.keys(T).map(function(w){return T[w]})}return(i=r.current)===null||i===void 0?void 0:i.getFieldValue(o)};return(0,s.Z)((0,s.Z)({},r.current),{},{getRowData:l,getRowsData:m,setRowData:function(i,o){var c,T;if(i==null)throw new Error("rowIndex is required");var w=_(i),X=[e.name,(c=w==null?void 0:w.toString())!==null&&c!==void 0?c:""].flat(1).filter(Boolean),Oe=Object.assign({},(0,s.Z)((0,s.Z)({},l(i)),o||{})),Ke=(0,ie.Z)({},X,Oe);return(T=r.current)===null||T===void 0||T.setFieldsValue(Ke),!0}})},[_,e.name,r.current]),(0,h.useEffect)(function(){e.controlled&&(n||[]).forEach(function(l,m){var u;(u=r.current)===null||u===void 0||u.setFieldsValue((0,W.Z)({},"".concat(a(l,m)),l))},{})},[(0,Re.ZP)(n),e.controlled]),(0,h.useEffect)(function(){if(e.name){var l;r.current=e==null||(l=e.editable)===null||l===void 0?void 0:l.form}},[(j=e.editable)===null||j===void 0?void 0:j.form,e.name]);var b=F||{},$e=b.record,re=b.position,De=b.creatorButtonText,Ee=b.newRecordType,we=b.parentKey,Se=b.style,Ve=(0,$.Z)(b,je),ve=re==="top",H=(0,h.useMemo)(function(){return typeof P=="number"&&P<=(n==null?void 0:n.length)?!1:F!==!1&&(0,d.jsx)(de,{record:(0,ue.h)($e,n==null?void 0:n.length,n)||{},position:re,parentKey:(0,ue.h)(we,n==null?void 0:n.length,n),newRecordType:Ee,children:(0,d.jsx)(L.ZP,(0,s.Z)((0,s.Z)({type:"dashed",style:(0,s.Z)({display:"block",margin:"10px 0",width:"100%"},Se),icon:(0,d.jsx)(me.Z,{})},Ve),{},{children:De||V.getMessage("editableTable.action.add","\u6DFB\u52A0\u4E00\u884C\u6570\u636E")}))})},[F==!1,P,n==null?void 0:n.length]),Fe=(0,h.useMemo)(function(){return H?ve?{components:{header:{wrapper:function(m){var u,i=m.className,o=m.children;return(0,d.jsxs)("thead",{className:i,children:[o,(0,d.jsxs)("tr",{style:{position:"relative"},children:[(0,d.jsx)("td",{colSpan:0,style:{visibility:"hidden"},children:H}),(0,d.jsx)("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(u=E.columns)===null||u===void 0?void 0:u.length,children:H})]})]})}}}}:{tableViewRender:function(m,u){var i,o;return(0,d.jsxs)(d.Fragment,{children:[(i=(o=e.tableViewRender)===null||o===void 0?void 0:o.call(e,m,u))!==null&&i!==void 0?i:u,H]})}}:{}},[ve,H]),ae=(0,s.Z)({},e.editable),Ae=(0,le.J)(function(l,m){var u,i,o;if((u=e.editable)===null||u===void 0||(i=u.onValuesChange)===null||i===void 0||i.call(u,l,m),(o=e.onValuesChange)===null||o===void 0||o.call(e,m,l),e.controlled){var c;e==null||(c=e.onChange)===null||c===void 0||c.call(e,m)}});return(e!=null&&e.onValuesChange||(S=e.editable)!==null&&S!==void 0&&S.onValuesChange||e.controlled&&e!==null&&e!==void 0&&e.onChange)&&(ae.onValuesChange=Ae),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(oe.Provider,{value:g,children:(0,d.jsx)(Ze.Z,(0,s.Z)((0,s.Z)((0,s.Z)({search:!1,options:!1,pagination:!1,rowKey:D,revalidateOnFocus:!1},E),Fe),{},{tableLayout:"fixed",actionRef:g,onChange:I,editable:(0,s.Z)((0,s.Z)({},ae),{},{formProps:(0,s.Z)({formRef:r},ae.formProps)}),dataSource:n,onDataSourceChange:function(m){if(x(m),e.name&&re==="top"){var u,i=(0,ie.Z)({},[e.name].flat(1).filter(Boolean),m);(u=r.current)===null||u===void 0||u.setFieldsValue(i)}}}))}),e.name?(0,d.jsx)(he.Z,{name:[e.name],children:function(m){var u,i;if(!y.current)return y.current=n,null;var o=(0,te.Z)(m,[e.name].flat(1)),c=o==null?void 0:o.find(function(T,w){var X;return!(0,Ce.A)(T,(X=y.current)===null||X===void 0?void 0:X[w])});return y.current=n,c&&(e==null||(u=e.editable)===null||u===void 0||(i=u.onValuesChange)===null||i===void 0||i.call(u,c,o)),null}}):null]})}function ce(e){var j=ge.ZP.useFormInstance();return e.name?(0,d.jsx)(be.Z.Item,(0,s.Z)((0,s.Z)({style:{maxWidth:"100%"}},e==null?void 0:e.formItemProps),{},{name:e.name,shouldUpdate:function(V,I){var P=[e.name].flat(1);try{return JSON.stringify((0,te.Z)(V,P))!==JSON.stringify((0,te.Z)(I,P))}catch(O){return!0}},children:(0,d.jsx)(se,(0,s.Z)((0,s.Z)({},e),{},{editable:(0,s.Z)((0,s.Z)({},e.editable),{},{form:j})}))})):(0,d.jsx)(se,(0,s.Z)({},e))}ce.RecordCreator=de;var Pe=ce,k=t(99570),xe=function(){var e=(0,h.useRef)(),j={id:"",name:"",level:"",num:"",note:"",fee:"",team_prize:""},S=(0,h.useState)(j),V=Q()(S,2),I=V[0],P=V[1],O=(0,h.useState)([]),F=Q()(O,2),D=F[0],J=F[1],z=function(){var y=A()(C()().mark(function g(r){var R,f,n;return C()().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,(0,k.bp)(r);case 2:R=a.sent,f=R.success,f&&(e.current.clearSelected(),(n=e.current)===null||n===void 0||n.reload());case 5:case"end":return a.stop()}},g)}));return function(r){return y.apply(this,arguments)}}(),M=function(){var y=A()(C()().mark(function g(r){var R,f,n;return C()().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return P(r),a.next=3,(0,k.bV)(p()({},r));case 3:R=a.sent,f=R.success,f&&(P(j),(n=e.current)===null||n===void 0||n.reload());case 6:case"end":return a.stop()}},g)}));return function(r){return y.apply(this,arguments)}}(),U=function(){var y=A()(C()().mark(function g(r){var R,f,n;return C()().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,(0,k.Xv)(p()({},r));case 2:R=a.sent,f=R.success,f&&((n=e.current)===null||n===void 0||n.reload());case 5:case"end":return a.stop()}},g)}));return function(r){return y.apply(this,arguments)}}(),E=[{title:"\u540D\u79F0",dataIndex:"name",search:!1},{title:"\u7B49\u7EA7",dataIndex:"level",search:!1},{title:"\u5206\u6210\u6BD4\u4F8B",dataIndex:"ratio",search:!1},{title:"\u64CD\u4F5C",dataIndex:"option",valueType:"option",render:function(g,r,R,f){return[(0,d.jsx)(L.ZP,{type:"link",onClick:function(){var x;P(r),f==null||(x=f.startEditable)===null||x===void 0||x.call(f,r.id)},children:"\u7F16\u8F91"},"editable"),(0,d.jsx)(N.Z,{title:"\u786E\u8BA4\u5220\u9664\uFF1F",onConfirm:function(){z([r.id])},children:(0,d.jsx)(L.ZP,{type:"link",danger:!0,children:"\u5220\u9664"},"delete")})]}}];return(0,d.jsx)(ne._z,{ghost:!0,children:(0,d.jsx)(d.Fragment,{children:(0,d.jsx)(Pe,{actionRef:e,rowKey:"id",search:!1,request:function(){var y=A()(C()().mark(function g(r,R,f){var n,x,a;return C()().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:return b.next=2,(0,k.lq)(p()({},r));case 2:return n=b.sent,x=n.data,a=n.success,b.abrupt("return",{data:x.records||[],total:0,success:a});case 6:case"end":return b.stop()}},g)}));return function(g,r,R){return y.apply(this,arguments)}}(),recordCreatorProps:{position:"bottom",record:function(){return{id:0}}},editable:{type:"multiple",editableKeys:D,onSave:function(){var y=A()(C()().mark(function r(R,f,n){return C()().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:R?U(f):M(f);case 1:case"end":return a.stop()}},r)}));function g(r,R,f){return y.apply(this,arguments)}return g}(),onChange:J},columns:E,pagination:!1})})})}},99570:function(fe,Y,t){t.d(Y,{Xv:function(){return L},bV:function(){return Q},bp:function(){return ne},lq:function(){return A}});var q=t(90228),p=t.n(q),ee=t(87999),C=t.n(ee),K=t(7485);function A(Z){return G.apply(this,arguments)}function G(){return G=C()(p()().mark(function Z($){return p()().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.abrupt("return",(0,K.request)("/api/userlevel/page",{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},data:$||{}}));case 1:case"end":return v.stop()}},Z)})),G.apply(this,arguments)}function Q(Z){return h.apply(this,arguments)}function h(){return h=C()(p()().mark(function Z($){return p()().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.abrupt("return",(0,K.request)("/api/userlevel/add",{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},data:$||{}}));case 1:case"end":return v.stop()}},Z)})),h.apply(this,arguments)}function L(Z){return N.apply(this,arguments)}function N(){return N=C()(p()().mark(function Z($){return p()().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.abrupt("return",(0,K.request)("/api/userlevel/update",{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},data:$||{}}));case 1:case"end":return v.stop()}},Z)})),N.apply(this,arguments)}function ne(Z){return W.apply(this,arguments)}function W(){return W=C()(p()().mark(function Z($){return p()().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:return v.abrupt("return",(0,K.request)("/api/userlevel/deleteBatchByIds",{method:"POST",headers:{"Content-Type":"application/json;charset=UTF-8"},data:$||{}}));case 1:case"end":return v.stop()}},Z)})),W.apply(this,arguments)}}}]);