Files
Sillyv2/core/admin/p__Task__index.0056ca3c.async.js
T
2023-07-16 19:28:38 +08:00

2 lines
9.8 KiB
JavaScript

"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[785],{59419:function(J,Z,e){var v=e(75782),p=e(58733),g=e(18518),P=e(50959),S=e(60061),r=e(72961),E=e(11527),u=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","showSearch","options"],k=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","options"],A=P.forwardRef(function(n,m){var W=n.fieldProps,B=n.children,y=n.params,j=n.proFieldProps,$=n.mode,b=n.valueEnum,C=n.request,V=n.showSearch,K=n.options,w=(0,p.Z)(n,u),_=(0,P.useContext)(S.Z);return(0,E.jsx)(r.Z,(0,v.Z)((0,v.Z)({valueEnum:(0,g.h)(b),request:C,params:y,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,v.Z)({options:K,mode:$,showSearch:V,getPopupContainer:_.getPopupContainer},W),ref:m,proFieldProps:j},w),{},{children:B}))}),x=P.forwardRef(function(n,m){var W=n.fieldProps,B=n.children,y=n.params,j=n.proFieldProps,$=n.mode,b=n.valueEnum,C=n.request,V=n.options,K=(0,p.Z)(n,k),w=(0,v.Z)({options:V,mode:$||"multiple",labelInValue:!0,showSearch:!0,showArrow:!1,autoClearSearchValue:!0,optionLabelProp:"label"},W),_=(0,P.useContext)(S.Z);return(0,E.jsx)(r.Z,(0,v.Z)((0,v.Z)({valueEnum:(0,g.h)(b),request:C,params:y,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,v.Z)({getPopupContainer:_.getPopupContainer},w),ref:m,proFieldProps:j},K),{},{children:B}))}),a=A,t=x,c=a;c.SearchSelect=t,c.displayName="ProFormComponent",Z.Z=c},66732:function(J,Z,e){var v=e(75782),p=e(58733),g=e(50959),P=e(72961),S=e(11527),r=["fieldProps","proFieldProps"],E=["fieldProps","proFieldProps"],u="text",k=function(t){var c=t.fieldProps,n=t.proFieldProps,m=(0,p.Z)(t,r);return(0,S.jsx)(P.Z,(0,v.Z)({valueType:u,fieldProps:c,filedConfig:{valueType:u},proFieldProps:n},m))},A=function(t){var c=t.fieldProps,n=t.proFieldProps,m=(0,p.Z)(t,E);return(0,S.jsx)(P.Z,(0,v.Z)({valueType:"password",fieldProps:c,proFieldProps:n,filedConfig:{valueType:u}},m))},x=k;x.Password=A,x.displayName="ProFormComponent",Z.Z=x},46271:function(J,Z,e){e.r(Z),e.d(Z,{default:function(){return ue}});var v=e(25359),p=e.n(v),g=e(49811),P=e.n(g),S=e(54306),r=e.n(S),E=e(45645),u=e(50959),k={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M719.4 499.1l-296.1-215A15.9 15.9 0 00398 297v430c0 13.1 14.8 20.5 25.3 12.9l296.1-215a15.9 15.9 0 000-25.8zm-257.6 134V390.9L628.5 512 461.8 633.1z"}}]},name:"play-circle",theme:"outlined"},A=k,x=e(26087),a=function(O,R){return u.createElement(x.Z,(0,E.Z)((0,E.Z)({},O),{},{ref:R,icon:A}))},t=u.forwardRef(a),c=e(27693),n=e(99168),m=e(12472),W=e(61643),B=e(81308),y=e(66732),j=e(59419),$=e(42096),b=e(24176),C=e(86195),V=e(833),K=e(31255),w=e(21362),_=e(68243),re=e(26572),oe=e(79112),o=e(11527),ue=function(){var i=(0,u.useRef)(),O=(0,u.useState)(H),R=r()(O,2),N=R[0],I=R[1],Q=[{title:"\u7F16\u53F7",dataIndex:"id",key:"id"},{title:"\u4EFB\u52A1ID",dataIndex:"task_id",key:"task_id",hideInTable:!0},{title:"\u4EFB\u52A1\u540D",dataIndex:"title",key:"title"},{title:"\u6267\u884C\u65F6\u95F4",dataIndex:"schedule",key:"schedule"},{title:"\u5907\u6CE8",dataIndex:"remark",key:"remark"},{title:"\u521B\u5EFA\u65E5\u671F",dataIndex:"created_at",key:"created_at",render:function(h,l){return(0,o.jsx)("span",{children:new Date(h*1e3).toLocaleDateString()})}},{title:"\u542F\u7528",dataIndex:"enable",key:"enable",renderFormItem:function(){return(0,o.jsx)(V.Z,{disabled:!0,defaultChecked:!1})},render:function(h,l){return(0,o.jsx)(V.Z,{onChange:function(d){(0,C.request)("/api/tasks",{method:"post",data:JSON.stringify({task_id:l.task_id,enable:d})})},defaultChecked:l==null?void 0:l.enable})}},{title:"\u64CD\u4F5C",valueType:"option",width:"130",render:function(h,l){return[(0,o.jsx)(K.Z,{title:"\u8FD0\u884C",children:(0,o.jsx)("a",{onClick:function(){(0,C.request)("/api/tasks/run?task_id="+l.task_id,{method:"get",data:JSON.stringify({task_id:l.task_id})}).finally(function(){w.ZP.success("\u8FD0\u884C\u6210\u529F\uFF01",1)})},children:(0,o.jsx)(t,{})},"run")}),(0,o.jsx)("a",{onClick:function(){return I(l)},children:"\u7F16\u8F91"},"more"),(0,o.jsx)("a",{onClick:function(){var d,L;(0,C.request)("/api/tasks",{method:"delete",data:JSON.stringify({task_id:l.task_id})}),(d=i.current)===null||d===void 0||(L=d.reloadAndRest)===null||L===void 0||L.call(d)},children:"\u5220\u9664"},"delete")]}}];return(0,o.jsxs)(m._z,{content:"\u8BA1\u5212\u4EFB\u52A1",children:[(0,o.jsx)(_.Z,{style:{marginBottom:10},children:(0,o.jsx)(re.ZP,{type:"primary",onClick:function(){I(le)},icon:(0,o.jsx)(c.Z,{}),children:"\u65B0\u5EFA\u4E00\u884C"})}),(0,o.jsx)(W.Z,{search:!1,actionRef:i,rowKey:function(h){return h.task_id},columns:Q,request:P()(p()().mark(function F(){var h,l=arguments;return p()().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return h=l.length>0&&l[0]!==void 0?l[0]:{},d.abrupt("return",(0,C.request)("/api/tasks",{params:h}));case 2:case"end":return d.stop()}},F)}))}),N.id!=-1&&(0,o.jsx)(ie,{open:N.id!=-1,data:N,onCancel:function(){return I(H)},onFinish:function(){var F=P()(p()().mark(function h(l){return p()().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:(0,C.request)("/api/tasks",{method:"post",data:JSON.stringify(l)}).then(function(L){var M,z;(M=i.current)===null||M===void 0||(z=M.reloadAndRest)===null||z===void 0||z.call(M),I(H)});case 1:case"end":return d.stop()}},h)}));return function(h){return F.apply(this,arguments)}}()})]})};function ie(i){var O,R,N=(0,u.useState)([]),I=r()(N,2),Q=I[0],F=I[1],h=(0,u.useState)({}),l=r()(h,2),T=l[0],d=l[1],L=(0,u.useState)(!1),M=r()(L,2),z=M[0],Ce=M[1],se=(0,u.useState)({}),X=r()(se,2),Fe=X[0],ge=X[1],de=(0,u.useState)([]),Y=r()(de,2),ce=Y[0],me=Y[1],ve=(0,u.useState)([]),q=r()(ve,2),pe=q[0],ee=q[1],he=(0,u.useState)([]),te=r()(he,2),fe=te[0],ae=te[1],Pe=(0,u.useState)([]),ne=r()(Pe,2),Ee=ne[0],Se=ne[1],U=(0,u.useRef)(),xe=function(f){var s;return(s=U.current)===null||s===void 0?void 0:s.getFieldValue(f)},ye=function(f,s){var G;return(G=U.current)===null||G===void 0?void 0:G.setFieldValue(f,s)};return i.data.task_id==""&&(i.data.task_id=(0,n.Z)()),(0,u.useEffect)(function(){var D,f=(D=U.current)===null||D===void 0?void 0:D.getFieldValue("platform");return(0,C.request)("/api/task/selects").then(function(s){s.data&&(d(s.data.scripts),ee(s.data.group_names),ae(s.data.user_names),me(s.data.platforms))}),function(){}},[z]),(0,o.jsx)(oe.Z,{title:i.data.id==0?"\u521B\u5EFA":"\u7F16\u8F91",open:!0,onCancel:i.onCancel,onOk:function(){var f;i.onFinish(U==null||(f=U.current)===null||f===void 0?void 0:f.getFieldsValue())},children:(0,o.jsxs)(B.A,{formRef:U,onValuesChange:function(f){},onFinish:i.onFinish,submitter:!1,children:[(0,o.jsx)(y.Z,{tooltip:"\u7CFB\u7EDF\u552F\u4E00\u4E0D\u53EF\u66F4\u6539\uFF0C\u53EA\u80FD\u5220\u9664\u3002",name:"task_id",initialValue:i.data.task_id,label:"\u4EFB\u52A1ID",disabled:!0,required:!0}),(0,o.jsxs)(B.A.Group,{children:[(0,o.jsx)(y.Z,{name:"title",initialValue:i.data.title,label:"\u4EFB\u52A1\u540D\u79F0"}),(0,o.jsx)(y.Z,{name:"remark",initialValue:i.data.remark,label:"\u4EFB\u52A1\u5907\u6CE8",rules:[{message:"\u8BF7\u586B\u5199\u4EFB\u52A1\u5907\u6CE8"}]})]}),(0,o.jsx)(y.Z,{name:"command",initialValue:i.data.command,tooltip:"\u811A\u672C\u9700\u8981\u53C2\u6570\u65F6\u586B\u5199",label:"\u4EFB\u52A1\u6307\u4EE4",rules:[{message:"\u8BF7\u586B\u5199\u4EFB\u52A1\u5907\u6CE8"}]}),(0,o.jsx)(y.Z,{name:"schedule",initialValue:i.data.schedule,tooltip:"\u811A\u672C\u9700\u8981\u53C2\u6570\u65F6\u586B\u5199",label:"\u8FD0\u884C\u65F6\u95F4"}),(0,o.jsx)(j.Z,{tooltip:"\u987A\u5E8F\u6267\u884C\u811A\u672C\u3002",name:"scripts",label:"\u6267\u884C\u811A\u672C",fieldProps:{mode:"multiple"},valueEnum:T,initialValue:(O=i.data.scripts)!==null&&O!==void 0?O:[]}),(0,o.jsx)($.u,{name:"senders",alwaysShowItemLabel:!0,initialValue:(R=i.data.senders)!==null&&R!==void 0?R:[],creatorButtonProps:{position:"top",creatorButtonText:"\u6DFB\u52A0\u6267\u884C\u73AF\u5883"},creatorRecord:{chat_id:"",user_id:""},children:(0,o.jsxs)(b.UW,{title:"\u6267\u884C\u73AF\u5883",children:[(0,o.jsx)(j.Z,{width:"lg",name:"user_id",label:"\u7528\u6237ID",fieldProps:{showSearch:!0,onSearch:function(f){(0,C.request)("/api/nickname/labels?ukeyword="+f).then(function(s){s&&s.data&&ae(s.data)})},notFoundContent:null},options:fe}),(0,o.jsx)(j.Z,{width:"lg",name:"chat_id",label:"\u7FA4\u804AID",fieldProps:{showSearch:!0,onSearch:function(f){(0,C.request)("/api/nickname/labels?gkeyword="+f).then(function(s){if(s&&s.data){var G=[{value:"",label:"\u79C1\u804A"}].concat(s.data);ee(G)}})},notFoundContent:null},options:pe}),(0,o.jsx)(j.Z,{width:"lg",label:"\u793E\u4EA4\u5A92\u4F53",name:"platform",options:ce})]})})]})},i.data.task_id)}var H={id:-1,task_id:""},le={id:0,task_id:"",schedule:"0 0 6 * * *"}},99168:function(J,Z,e){e.d(Z,{Z:function(){return x}});var p={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let g;const P=new Uint8Array(16);function S(){if(!g&&(g=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!g))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return g(P)}const r=[];for(let a=0;a<256;++a)r.push((a+256).toString(16).slice(1));function E(a,t=0){return(r[a[t+0]]+r[a[t+1]]+r[a[t+2]]+r[a[t+3]]+"-"+r[a[t+4]]+r[a[t+5]]+"-"+r[a[t+6]]+r[a[t+7]]+"-"+r[a[t+8]]+r[a[t+9]]+"-"+r[a[t+10]]+r[a[t+11]]+r[a[t+12]]+r[a[t+13]]+r[a[t+14]]+r[a[t+15]]).toLowerCase()}function u(a,t=0){const c=E(a,t);if(!validate(c))throw TypeError("Stringified UUID is invalid");return c}var k=null;function A(a,t,c){if(p.randomUUID&&!t&&!a)return p.randomUUID();a=a||{};const n=a.random||(a.rng||S)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){c=c||0;for(let m=0;m<16;++m)t[c+m]=n[m];return t}return E(n)}var x=A}}]);