Files
Sillyv2/core/admin/p__Reply__index.bf015c15.async.js
T
cdle 1ee28c45c4 x
2023-06-01 14:18:56 +08:00

2 lines
9.8 KiB
JavaScript

"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[402],{3176:function(se,W,n){var F=n(75782),y=n(58733),j=n(50959),K=n(46227),w=n(11527),l=["fieldProps","proFieldProps"],k=function(A,T){var N=A.fieldProps,L=A.proFieldProps,G=(0,y.Z)(A,l);return(0,w.jsx)(K.Z,(0,F.Z)({ref:T,valueType:"textarea",fieldProps:N,proFieldProps:L},G))};W.Z=j.forwardRef(k)},12817:function(se,W,n){var F=n(24572),y=n(91600),j=n(58733),K=n(99932),w=n(78450),l=n(75782),k=n(27693),q=n(55585),A=n(31479),T=n(35276),N=n(88648),L=n(18518),G=n(88938),H=n(89839),ae=n(26572),x=n(40870),h=n(95027),le=n(53068),ee=n(38365),P=n(50959),ve=n(66922),s=n(11527),ne=["onTableChange","maxLength","formItemProps","recordCreatorProps","rowKey","controlled","defaultValue","onChange","editableFormRef"],oe=["record","position","creatorButtonText","newRecordType","parentKey","style"],te=P.createContext(void 0);function Z(e){var D=e.children,B=e.record,S=e.position,J=e.newRecordType,U=e.parentKey,$=(0,P.useContext)(te);return P.cloneElement(D,(0,l.Z)((0,l.Z)({},D.props),{},{onClick:function(){var I=(0,w.Z)((0,K.Z)().mark(function Y(Q){var E,f,d,M;return(0,K.Z)().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,(E=(f=D.props).onClick)===null||E===void 0?void 0:E.call(f,Q);case 2:if(M=t.sent,M!==!1){t.next=5;break}return t.abrupt("return");case 5:$==null||(d=$.current)===null||d===void 0||d.addEditRecord(B,{position:S,newRecordType:J,parentKey:U});case 6:case"end":return t.stop()}},Y)}));function b(Y){return I.apply(this,arguments)}return b}()}))}function re(e){var D,B,S=(0,T.YB)(),J=e.onTableChange,U=e.maxLength,$=e.formItemProps,I=e.recordCreatorProps,b=e.rowKey,Y=e.controlled,Q=e.defaultValue,E=e.onChange,f=e.editableFormRef,d=(0,j.Z)(e,ne),M=(0,N.D)(e.value),m=(0,P.useRef)(),t=(0,P.useRef)();(0,P.useImperativeHandle)(d.actionRef,function(){return m.current});var R=(0,h.Z)(function(){return e.value||Q||[]},{value:e.value,onChange:e.onChange}),g=(0,y.Z)(R,2),_=g[0],V=g[1],O=P.useMemo(function(){return typeof b=="function"?b:function(v,r){return v[b]||r}},[b]),ce=function(r){if(typeof r=="number"&&!e.name){if(r>=_.length)return r;var a=_&&_[r];return O==null?void 0:O(a,r)}if((typeof r=="string"||r>=_.length)&&e.name){var o=_.findIndex(function(i,u){var c;return(O==null||(c=O(i,u))===null||c===void 0?void 0:c.toString())===(r==null?void 0:r.toString())});return o}return r};(0,P.useImperativeHandle)(f,function(){var v=function(o){var i,u;if(o==null)throw new Error("rowIndex is required");var c=ce(o),C=[e.name,(i=c==null?void 0:c.toString())!==null&&i!==void 0?i:""].flat(1).filter(Boolean);return(u=t.current)===null||u===void 0?void 0:u.getFieldValue(C)},r=function(){var o,i=[e.name].flat(1).filter(Boolean);if(Array.isArray(i)&&i.length===0){var u,c=(u=t.current)===null||u===void 0?void 0:u.getFieldsValue();return Array.isArray(c)?c:Object.keys(c).map(function(C){return c[C]})}return(o=t.current)===null||o===void 0?void 0:o.getFieldValue(i)};return(0,l.Z)((0,l.Z)({},t.current),{},{getRowData:v,getRowsData:r,setRowData:function(o,i){var u,c,C,de;if(o==null)throw new Error("rowIndex is required");var ue=ce(o),Re=[e.name,(u=ue==null?void 0:ue.toString())!==null&&u!==void 0?u:""].flat(1).filter(Boolean),be=((c=t.current)===null||c===void 0||(C=c.getFieldsValue)===null||C===void 0?void 0:C.call(c))||{},Ce=(0,ee.Z)(be,Re,(0,l.Z)((0,l.Z)({},v(o)),i||{}));return(de=t.current)===null||de===void 0||de.setFieldsValue(Ce),!0}})}),(0,P.useEffect)(function(){e.controlled&&_.forEach(function(v,r){var a;(a=t.current)===null||a===void 0||a.setFieldsValue((0,F.Z)({},O(v,r),v))},{})},[_,e.controlled]),(0,P.useEffect)(function(){if(e.name){var v;t.current=e==null||(v=e.editable)===null||v===void 0?void 0:v.form}},[(D=e.editable)===null||D===void 0?void 0:D.form,e.name]);var p=I||{},fe=p.record,_e=p.position,Ee=p.creatorButtonText,Pe=p.newRecordType,De=p.parentKey,he=p.style,Me=(0,j.Z)(p,oe),me=_e==="top",X=(0,P.useMemo)(function(){return typeof U=="number"&&U<=(_==null?void 0:_.length)?!1:I!==!1&&(0,s.jsx)(Z,{record:(0,L.h)(fe,_==null?void 0:_.length,_)||{},position:_e,parentKey:(0,L.h)(De,_==null?void 0:_.length,_),newRecordType:Pe,children:(0,s.jsx)(ae.ZP,(0,l.Z)((0,l.Z)({type:"dashed",style:(0,l.Z)({display:"block",margin:"10px 0",width:"100%"},he),icon:(0,s.jsx)(k.Z,{})},Me),{},{children:Ee||S.getMessage("editableTable.action.add","\u6DFB\u52A0\u4E00\u884C\u6570\u636E")}))})},[I,U,_==null?void 0:_.length]),ge=(0,P.useMemo)(function(){return X?me?{components:{header:{wrapper:function(r){var a,o=r.className,i=r.children;return(0,s.jsxs)("thead",{className:o,children:[i,(0,s.jsxs)("tr",{style:{position:"relative"},children:[(0,s.jsx)("td",{colSpan:0,style:{visibility:"hidden"},children:X}),(0,s.jsx)("td",{style:{position:"absolute",left:0,width:"100%"},colSpan:(a=d.columns)===null||a===void 0?void 0:a.length,children:X})]})]})}}}}:{tableViewRender:function(r,a){var o,i;return(0,s.jsxs)(s.Fragment,{children:[(o=(i=e.tableViewRender)===null||i===void 0?void 0:i.call(e,r,a))!==null&&o!==void 0?o:a,X]})}}:{}},[me,X]),ie=(0,l.Z)({},e.editable),Oe=(0,G.J)(function(v,r){var a,o,i;if((a=e.editable)===null||a===void 0||(o=a.onValuesChange)===null||o===void 0||o.call(a,v,r),(i=e.onValuesChange)===null||i===void 0||i.call(e,r,v),e.controlled){var u;e==null||(u=e.onChange)===null||u===void 0||u.call(e,r)}});return(e!=null&&e.onValuesChange||(B=e.editable)!==null&&B!==void 0&&B.onValuesChange||e.controlled&&e!==null&&e!==void 0&&e.onChange)&&(ie.onValuesChange=Oe),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(te.Provider,{value:m,children:(0,s.jsx)(ve.Z,(0,l.Z)((0,l.Z)((0,l.Z)({search:!1,options:!1,pagination:!1,rowKey:b,revalidateOnFocus:!1},d),ge),{},{tableLayout:"fixed",actionRef:m,onChange:J,editable:(0,l.Z)((0,l.Z)({},ie),{},{formProps:(0,l.Z)({formRef:t},ie.formProps)}),dataSource:_,onDataSourceChange:function(r){if(V(r),e.name&&_e==="top"){var a,o=(0,ee.Z)({},[e.name].flat(1).filter(Boolean),r);(a=t.current)===null||a===void 0||a.setFieldsValue(o)}}}))}),e.name?(0,s.jsx)(q.Z,{name:[e.name],children:function(r){var a,o,i=(0,le.Z)(r,[e.name].flat(1)),u=i==null?void 0:i.find(function(c,C){return!(0,H.A)(c,M==null?void 0:M[C])});return u&&M&&(e==null||(a=e.editable)===null||a===void 0||(o=a.onValuesChange)===null||o===void 0||o.call(a,u,i)),null}}):null]})}function z(e){var D=A.ZP.useFormInstance();return e.name?(0,s.jsx)(x.Z.Item,(0,l.Z)((0,l.Z)({style:{maxWidth:"100%"}},e==null?void 0:e.formItemProps),{},{name:e.name,children:(0,s.jsx)(re,(0,l.Z)((0,l.Z)({},e),{},{editable:(0,l.Z)((0,l.Z)({},e.editable),{},{form:D})}))})):(0,s.jsx)(re,(0,l.Z)({},e))}z.RecordCreator=Z,W.Z=z},41300:function(se,W,n){n.r(W);var F=n(25359),y=n.n(F),j=n(49811),K=n.n(j),w=n(57213),l=n.n(w),k=n(12342),q=n.n(k),A=n(54306),T=n.n(A),N=n(12472),L=n(3176),G=n(12817),H=n(86195),ae=n(79112),x=n(50959),h=n(11527),le=["rowData"];W.default=function(){return(0,h.jsx)(N._z,{content:"\u56DE\u590D\u5217\u8868",children:(0,h.jsx)(ee,{})})};var ee=function(ve){var s=(0,x.useState)([]),ne=T()(s,2),oe=ne[0],te=ne[1],Z=(0,x.useRef)(),re=(0,x.useState)(!1),z=T()(re,2),e=z[0],D=z[1],B=(0,x.useState)(""),S=T()(B,2),J=S[0],U=S[1],$=(0,x.useState)([]),I=T()($,2),b=I[0],Y=I[1],Q=[{title:"\u5E8F\u53F7",dataIndex:"index",key:"index",editable:!1,readonly:!0,width:"5%"},{title:"ID",dataIndex:"id",key:"id",editable:!1,readonly:!0,hideInTable:!0},{title:"\u6635\u79F0",dataIndex:"nickname",key:"nickname"},{title:"\u5E73\u53F0",dataIndex:"platforms",key:"platforms",fieldProps:{mode:"multiple",options:b},valueType:"select"},{title:"\u53F7\u7801",dataIndex:"number",key:"number",width:"13%"},{title:"\u89E6\u53D1\u8BCD",tooltip:"\u652F\u6301\u6B63\u5219\u8868\u8FBE\u5F0F\u3002",dataIndex:"keyword",key:"keyword",width:"15%"},{title:"\u81EA\u52A8\u56DE\u590D\u5185\u5BB9",tooltip:"\u652F\u6301\u4F7F\u7528${b.\u6876.\u952E}\u65B9\u5F0F\u8BBF\u95EE\u5B58\u50A8\uFF0C\u4F8B\uFF1A\u50BB\u599E\u7AEF\u53E3\u662F${b.app.name}\u3002",dataIndex:"value",key:"value",render:function(f){return f.length>30?(0,h.jsx)("a",{onClick:function(){U(f),D(!0)},children:"".concat(f.slice(0,30),"...")}):f},valueType:"textarea",renderFormItem:function(f,d){var M=d.rowData,m=q()(d,le);return(0,h.jsx)(L.Z,l()(l()({},m),{},{defaultValue:f}))},width:"18%"},{title:"\u4F18\u5148",tooltip:"\u4F18\u5148\u7EA7\uFF0C\u8D8A\u9AD8\u8D8A\u9760\u524D\u5339\u914D\u3002",dataIndex:"priority",key:"priority",valueType:"digit"},{title:"\u64CD\u4F5C",valueType:"option",width:200,render:function(f,d,M,m){return[(0,h.jsx)("a",{onClick:function(){var R;m==null||(R=m.startEditable)===null||R===void 0||R.call(m,d.id)},children:"\u7F16\u8F91"},"editable"),(0,h.jsx)("a",{onClick:function(){(0,H.request)("/api/reply?id="+d.id,{method:"delete"}).then(function(R){var g,_;(g=Z.current)===null||g===void 0||(_=g.reloadAndRest)===null||_===void 0||_.call(g)})},children:"\u5220\u9664"},"delete")]}}];return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(ae.Z,{title:"",open:e,footer:[],onOk:function(){D(!1)},onCancel:function(){D(!1)},children:J}),(0,h.jsx)(G.Z,{actionRef:Z,pagination:{},rowKey:"id",columns:Q,recordCreatorProps:{position:"top",record:function(){return{id:-1,index:0,class:"0"}}},editable:{type:"single",editableKeys:oe,onSave:function(){var E=K()(y()().mark(function d(M,m){var t;return y()().wrap(function(g){for(;;)switch(g.prev=g.next){case 0:t=m,t.class&&(t.class=+t.class),(0,H.request)("/api/reply",{method:"post",data:t}).then(function(_){var V,O;(V=Z.current)===null||V===void 0||(O=V.reloadAndRest)===null||O===void 0||O.call(V)});case 3:case"end":return g.stop()}},d)}));function f(d,M){return E.apply(this,arguments)}return f}(),onChange:te},request:K()(y()().mark(function E(){var f,d=arguments;return y()().wrap(function(m){for(;;)switch(m.prev=m.next){case 0:return f=d.length>0&&d[0]!==void 0?d[0]:{},m.abrupt("return",(0,H.request)("/api/reply/list",{params:f}).then(function(t){if(t.data)for(var R in t.data)t.data[R].class=""+t.data[R].class;return t.platforms&&Y(t.platforms),t}));case 2:case"end":return m.stop()}},E)}))})]})}}}]);