(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[816],{35388:function(oe,E,a){"use strict";a.r(E),a.d(E,{default:function(){return ae}});var de=a(62350),b=a(75443),v=a(3182),h=a(11849),C=a(93224),z=a(94043),s=a.n(z),$=a(57337),F=a(4614);function W(u,r){return j.apply(this,arguments)}function j(){return j=(0,v.Z)(s().mark(function u(r,t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,F.WY)("/api/luigi/author/get",(0,h.Z)({method:"GET",params:(0,h.Z)({},r)},t||{})));case 1:case"end":return e.stop()}},u)})),j.apply(this,arguments)}function Y(u,r){return I.apply(this,arguments)}function I(){return I=(0,v.Z)(s().mark(function u(r,t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,F.WY)("/api/luigi/author/seek",(0,h.Z)({method:"GET",params:(0,h.Z)({},r)},t||{})));case 1:case"end":return e.stop()}},u)})),I.apply(this,arguments)}var T=a(67294),ce=a(43358),D=a(34041),pe=a(20228),N=a(11382),V=a(23279),K=a.n(V),l=a(85893);function L(u){var r=u.fetchOptions,t=u.debounceTimeout,i=t===void 0?800:t,e=u.initOption,d=(0,C.Z)(u,["fetchOptions","debounceTimeout","initOption"]),p=T.useState(!1),n=(0,$.Z)(p,2),o=n[0],c=n[1],f=[],g=null;e&&(f.push(e),g=e.value);var Z=T.useState(f),m=(0,$.Z)(Z,2),S=m[0],y=m[1],R=T.useRef(0),ne=T.useMemo(function(){var ue=function(se){R.current+=1;var ie=R.current;y([]),c(!0),r(se).then(function(le){ie===R.current&&(y(le),c(!1))})};return K()(ue,i)},[r,i]);return(0,l.jsx)(D.Z,(0,h.Z)((0,h.Z)({showSearch:!0,filterOption:!1,defaultValue:g,onSearch:ne,notFoundContent:o?(0,l.jsx)(N.Z,{size:"small"}):null},d),{},{options:S}))}var k=L,J=function(r){var t=T.useState(),i=(0,$.Z)(t,2),e=i[0],d=i[1];return T.useEffect(function(){if(!!r.value){var p=function(){var n=(0,v.Z)(s().mark(function o(){var c,f,g,Z,m;return s().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:return y.next=2,W({id:r.value});case 2:Z=y.sent,m={key:(c=Z.data)===null||c===void 0?void 0:c.id,label:(f=Z.data)===null||f===void 0?void 0:f.name,value:(g=Z.data)===null||g===void 0?void 0:g.id},d(m);case 5:case"end":return y.stop()}},o)}));return function(){return n.apply(this,arguments)}}();p()}},[r.value]),r.value&&!e?null:(0,l.jsx)(k,{initOption:e,fetchOptions:function(){var p=(0,v.Z)(s().mark(function n(o){var c,f,g;return s().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return m.next=2,Y({name:o});case 2:if(f=m.sent,!((c=f.data)!==null&&c!==void 0&&c.list)){m.next=5;break}return m.abrupt("return",(g=f.data.list)===null||g===void 0?void 0:g.map(function(S){var y={label:S.name,value:S.id,key:S.id};return y}));case 5:return m.abrupt("return",void 0);case 6:case"end":return m.stop()}},n)}));return function(n){return p.apply(this,arguments)}}(),onChange:r.onChange,style:{width:"100%"}})},U=J;function M(u,r){return x.apply(this,arguments)}function x(){return x=(0,v.Z)(s().mark(function u(r,t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,F.WY)("/api/luigi/poem/detail",(0,h.Z)({method:"GET",params:(0,h.Z)({},r)},t||{})));case 1:case"end":return e.stop()}},u)})),x.apply(this,arguments)}function H(u,r){return O.apply(this,arguments)}function O(){return O=(0,v.Z)(s().mark(function u(r,t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,F.WY)("/api/luigi/poem/list",(0,h.Z)({method:"POST",headers:{"Content-Type":"application/json"},data:r},t||{})));case 1:case"end":return e.stop()}},u)})),O.apply(this,arguments)}function w(u,r){return P.apply(this,arguments)}function P(){return P=(0,v.Z)(s().mark(function u(r,t){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(0,F.WY)("/api/luigi/poem/save",(0,h.Z)({method:"POST",headers:{"Content-Type":"application/json"},data:r},t||{})));case 1:case"end":return e.stop()}},u)})),P.apply(this,arguments)}var Q=a(37006),fe=a(9715),X=a(22712),he=a(34792),q=a(48086),me=a(57663),_=a(71577),ee=a(71975),A=a(5966),B=a(90672),te=function(r){var t=(0,T.useRef)();return(0,l.jsxs)(ee.a,{title:r.formTitle,formRef:t,layout:"horizontal",trigger:(0,l.jsx)(_.Z,{type:"primary",children:r.triggerText}),autoFocusFirstInput:!0,drawerProps:{destroyOnClose:!0},onVisibleChange:function(){var i=(0,v.Z)(s().mark(function e(d){var p,n;return s().wrap(function(c){for(;;)switch(c.prev=c.next){case 0:if(!(!d||!r.poemId)){c.next=2;break}return c.abrupt("return");case 2:return c.next=4,M({id:r.poemId});case 4:p=c.sent,p.data&&((n=t.current)===null||n===void 0||n.setFieldsValue(p.data));case 6:case"end":return c.stop()}},e)}));return function(e){return i.apply(this,arguments)}}(),onFinish:function(){var i=(0,v.Z)(s().mark(function e(d){var p;return s().wrap(function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,w((0,h.Z)((0,h.Z)({},d),{},{id:r.poemId}));case 2:if(p=o.sent,!p.code){o.next=7;break}return q.default.success("\u63D0\u4EA4\u6210\u529F"),r.refresh&&r.refresh(),o.abrupt("return",!0);case 7:return o.abrupt("return",!1);case 8:case"end":return o.stop()}},e)}));return function(e){return i.apply(this,arguments)}}(),children:[(0,l.jsx)(A.Z,{width:"md",name:"title",label:"\u6807\u9898",placeholder:"\u8BF7\u8F93\u5165"}),(0,l.jsx)(X.Z.Item,{style:{width:"40%"},label:(0,l.jsx)("span",{children:"\u4F5C\u8005"}),name:"authorId",shouldUpdate:!0,children:(0,l.jsx)(U,{})}),(0,l.jsx)(B.Z,{fieldProps:{autoSize:!0},width:"md",name:"content",label:"\u5185\u5BB9",placeholder:"\u8BF7\u8F93\u5165"}),(0,l.jsx)(A.Z,{width:"md",name:"line",label:"\u9996\u884C",placeholder:"\u8BF7\u8F93\u5165"}),(0,l.jsx)(B.Z,{fieldProps:{autoSize:!0},width:"md",name:"note",label:"\u89E3\u6790",placeholder:"\u8BF7\u8F93\u5165"}),(0,l.jsx)(B.Z,{fieldProps:{autoSize:!0},width:"md",name:"translation",label:"\u7FFB\u8BD1",placeholder:"\u8BF7\u8F93\u5165"})]})},G=te,re=[{dataIndex:"id",title:"id",hideInSearch:!0},{title:"\u6807\u9898",dataIndex:"title",ellipsis:!0,hideInSearch:!0,tip:"\u6807\u9898\u8FC7\u957F\u4F1A\u81EA\u52A8\u6536\u7F29",formItemProps:{rules:[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]}},{title:"\u72B6\u6001",dataIndex:"status",valueType:"select",valueEnum:{0:{text:"\u672A\u6821\u51C6",status:"Error"},1:{text:"\u5DF2\u6821\u51C6",status:"Success"}}},{title:"\u4F5C\u8005",dataIndex:"authorName",hideInSearch:!0},{title:"\u4F5C\u8005",dataIndex:"author",hideInTable:!0,formItemProps:{rules:[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879"}]},renderFormItem:function(r,t){var i=t.type,e=t.defaultRender,d=(0,C.Z)(t,["type","defaultRender"]);return(0,l.jsx)(U,(0,h.Z)({},d))}},{title:"\u64CD\u4F5C",valueType:"option",key:"option",render:function(r,t,i,e){return[(0,l.jsx)(G,{poemId:t.id,formTitle:t.title||"\u7F16\u8F91",triggerText:"\u7F16\u8F91",refresh:function(){return e==null?void 0:e.reload()}},t.id),(0,l.jsx)(b.Z,{title:"\u786E\u5B9A\u5220\u9664\u5417?",onConfirm:(0,v.Z)(s().mark(function d(){return s().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,w({id:t.id,status:-1});case 2:e==null||e.reload();case 3:case"end":return n.stop()}},d)})),okText:"Yes",cancelText:"No",children:(0,l.jsx)("a",{href:"#",children:"\u5220\u9664"})},t.id),(0,l.jsx)(b.Z,{title:"\u786E\u5B9A\u6807\u8BB0\u5417?",onConfirm:(0,v.Z)(s().mark(function d(){return s().wrap(function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,w({id:t.id,status:t.status==0?1:0});case 2:e==null||e.reload();case 3:case"end":return n.stop()}},d)})),okText:"Yes",cancelText:"No",children:(0,l.jsx)("a",{href:"#",children:t.status==0?"\u6821\u51C6":"\u53D6\u6D88\u6821\u51C6"})},t.id)]}}],ae=function(){var u=(0,T.useRef)();return(0,l.jsx)(Q.ZP,{columns:re,actionRef:u,cardBordered:!0,request:(0,v.Z)(s().mark(function r(){var t,i,e,d,p,n,o=arguments;return s().wrap(function(f){for(;;)switch(f.prev=f.next){case 0:return e=o.length>0&&o[0]!==void 0?o[0]:{},d=[],e.author&&(p=e.author,typeof e.author=="string"&&(p=JSON.parse(e.author)),d.push({key:"authorId",val:p})),e.status&&d.push({key:"status",val:e.status}),f.next=6,H({current:e.current,pageSize:e.pageSize,query:d});case 6:return n=f.sent,f.abrupt("return",{data:(t=n.data)===null||t===void 0?void 0:t.list,total:(i=n.data)===null||i===void 0?void 0:i.total});case 8:case"end":return f.stop()}},r)})),columnsState:{persistenceKey:"pro-table-singe-demos",persistenceType:"localStorage"},rowKey:"id",search:{labelWidth:"auto"},pagination:{pageSize:20},form:{syncToUrl:function(t,i){return i==="get"?(0,h.Z)((0,h.Z)({},t),{},{created_at:[t.startTime,t.endTime]}):t}},headerTitle:"\u5217\u8868",dateFormatter:"string",toolBarRender:function(){return[(0,l.jsx)(G,{triggerText:"\u65B0\u5EFA",formTitle:"\u521B\u5EFA"},"new")]}})}}}]);