gtsoft-snail-job-server/snail-job-server/snail-job-server-ui/src/main/resources/admin/assets/index-DWyLBvsm.js

2 lines
17 KiB
JavaScript

import{a as be,b as _e,u as ve,c as he,N as Se,d as Te}from"./search-form.vue_vue_type_script_setup_true_lang-xYfW9G7N.js";import{d as ae,Q as ee,z as A,R as te,X as P,m as Ne,n as we,a as ke,$ as a,i as Ce,an as De,r as Ie,S as Ue,o as N,c as $,w as n,f as t,g as I,t as U,h as e,aU as Re,af as H,b as le,U as se,V as re,aN as ie,a8 as fe,v as $e,a6 as de,a1 as Le,x as Ve,a2 as Oe,aM as xe,s as Be,y as Me,B as Z,aV as ue,aW as je,aX as Fe,a9 as O,aY as me,aP as Ge,aZ as ce,a_ as ye,P as q,C as Ae,ad as Pe,ae as W,a$ as ze,av as Ee,O as We,ag as qe}from"./index-D3rICic-.js";import{f as He,a as Ke,b as Xe,c as Je,d as pe,e as Qe}from"./notify-BmtrPduQ.js";import{f as Ye,_ as Ze}from"./select-scene.vue_vue_type_script_setup_true_lang-DxzzLcAX.js";import{f as et}from"./workflow-DX1Amij-.js";import{i as tt}from"./job-8-wbHxv4.js";import{_ as ge}from"./select-group.vue_vue_type_script_setup_true_lang-Bk3YnuuX.js";import{a as at,b as nt,_ as ot}from"./Grid-CRDcRyPk.js";import{_ as lt,a as st}from"./DescriptionsItem-LhWljJnV.js";import{_ as it}from"./status-switch.vue_vue_type_script_setup_true_lang-DuU56cot.js";import{u as rt}from"./auth-C5d9H5Pz.js";import"./group-frwXGSCG.js";const ut=ae({name:"NotifyConfigOperateDrawer",__name:"notify-config-operate-drawer",props:ee({operateType:{},rowData:{}},{visible:{type:Boolean,default:!1},visibleModifiers:{},retrySceneDisable:{type:Boolean,default:!0},retrySceneDisableModifiers:{}}),emits:ee(["update:value","submitted"],["update:visible","update:retrySceneDisable"]),setup(w,{emit:x}){const f=A([]),g=A([]),y=A([]),k=A([]),_=w,S=x,v=te(w,"visible"),c=te(w,"retrySceneDisable"),i=A(P(ue)),{formRef:d,validate:B,restoreValidation:L}=Ne(),{defaultRequiredRule:C}=we(),ne=ke(()=>({add:a("page.notifyConfig.addNotifyConfig"),edit:a("page.notifyConfig.editNotifyConfig")})[_.operateType]);Ce(()=>{De(()=>{oe()})});async function oe(){const m=await He();f.value=m.data}const o=Ie(K());function K(){return{groupName:null,businessId:"",recipientIds:[],systemTaskType:null,notifyStatus:1,notifyScene:null,notifyThreshold:16,rateLimiterStatus:0,rateLimiterThreshold:100,description:""}}const M={groupName:C,businessId:C,systemTaskType:C,notifyStatus:C,notifyScene:C,recipientIds:C,rateLimiterStatus:C,notifyThreshold:C};function X(){if(_.operateType==="add"){Object.assign(o,K()),c.value=!0;return}_.operateType==="edit"&&_.rowData&&(Object.assign(o,_.rowData),r(o.systemTaskType),l(o.notifyScene))}function J(){v.value=!1}async function Q(){var m;if(await B(),_.operateType==="add"){const{groupName:s,businessId:u,recipientIds:T,systemTaskType:V,notifyStatus:R,notifyScene:D,notifyThreshold:b,rateLimiterStatus:j,rateLimiterThreshold:F,description:z}=o,{error:E}=await Ke({groupName:s,businessId:u,recipientIds:T,systemTaskType:V,notifyStatus:R,notifyScene:D,notifyThreshold:b,rateLimiterStatus:j,rateLimiterThreshold:F,description:z});if(E)return}if(_.operateType==="edit"){const{id:s,groupName:u,businessId:T,recipientIds:V,notifyStatus:R,systemTaskType:D,notifyScene:b,notifyThreshold:j,rateLimiterStatus:F,rateLimiterThreshold:z,description:E}=o,{error:Y}=await Xe({id:s,groupName:u,businessId:T,recipientIds:V,systemTaskType:D,notifyStatus:R,notifyScene:b,notifyThreshold:j,rateLimiterStatus:F,rateLimiterThreshold:z,description:E});if(Y)return}(m=window.$message)==null||m.success(a("common.updateSuccess")),J(),S("submitted")}async function r(m){var s,u,T,V,R;if(m===1){const D=await Ye({groupName:o.groupName});g.value=D.data,i.value=P(ue)}else if(m===3){const D=await tt({groupName:o.groupName});y.value=(s=D.data)==null?void 0:s.map(b=>(b.id=String(b.id),b)),i.value=P(je)}else if(m===4){const D=await et({groupName:o.groupName});k.value=(u=D.data)==null?void 0:u.map(b=>(b.id=String(b.id),b)),i.value=P(Fe)}m!==((T=_.rowData)==null?void 0:T.systemTaskType)?(o.businessId=null,o.notifyScene=null):(o.businessId=(V=_.rowData)==null?void 0:V.businessId,o.notifyScene=(R=_.rowData)==null?void 0:R.notifyScene)}async function l(m){c.value=!(m===5||m===6)}function h(m){X(),o.groupName=m,r(1),l(1)}return Ue(v,()=>{v.value&&(X(),L())}),(m,s)=>{const u=$e,T=de,V=Le,R=Ve,D=Oe,b=at,j=xe,F=nt,z=Be,E=Me,Y=Z;return N(),$(fe,{modelValue:v.value,"onUpdate:modelValue":s[12]||(s[12]=p=>v.value=p),title:ne.value,"min-size":480,onHandleSubmit:Q},{footer:n(()=>[t(R,{size:16},{default:n(()=>[t(Y,{onClick:J},{default:n(()=>[I(U(e(a)("common.cancel")),1)]),_:1}),t(Y,{type:"primary",onClick:Q},{default:n(()=>[I(U(e(a)("common.save")),1)]),_:1})]),_:1})]),default:n(()=>[t(E,{ref_key:"formRef",ref:d,model:o,rules:M},{default:n(()=>[t(u,{label:e(a)("page.notifyConfig.groupName"),path:"groupName"},{default:n(()=>[t(ge,{modelValue:o.groupName,"onUpdate:modelValue":[s[0]||(s[0]=p=>o.groupName=p),h]},null,8,["modelValue"])]),_:1},8,["label"]),t(u,{label:e(a)("page.notifyConfig.systemTaskType"),path:"systemTaskType"},{default:n(()=>[t(T,{value:o.systemTaskType,"onUpdate:value":[s[1]||(s[1]=p=>o.systemTaskType=p),r],placeholder:e(a)("page.notifyConfig.form.systemTaskType"),options:e(P)(e(Re))},null,8,["value","placeholder","options"])]),_:1},8,["label"]),o.systemTaskType===1?(N(),$(u,{key:0,label:e(a)("page.notifyConfig.retryScene"),path:"businessId"},{default:n(()=>[t(T,{value:o.businessId,"onUpdate:value":s[2]||(s[2]=p=>o.businessId=p),placeholder:e(a)("page.notifyConfig.form.sceneName"),options:g.value,"label-field":"sceneName","value-field":"sceneName"},null,8,["value","placeholder","options"])]),_:1},8,["label"])):H("",!0),o.systemTaskType===3?(N(),$(u,{key:1,label:e(a)("page.notifyConfig.job"),path:"businessId"},{default:n(()=>[t(T,{value:o.businessId,"onUpdate:value":s[3]||(s[3]=p=>o.businessId=p),placeholder:e(a)("page.notifyConfig.form.jobName"),options:y.value,"label-field":"jobName","value-field":"id"},null,8,["value","placeholder","options"])]),_:1},8,["label"])):H("",!0),o.systemTaskType===4?(N(),$(u,{key:2,label:e(a)("page.notifyConfig.workflow"),path:"businessId"},{default:n(()=>[t(T,{value:o.businessId,"onUpdate:value":s[4]||(s[4]=p=>o.businessId=p),placeholder:e(a)("page.notifyConfig.form.workflowName"),options:k.value,"label-field":"workflowName","value-field":"id"},null,8,["value","placeholder","options"])]),_:1},8,["label"])):H("",!0),t(u,{label:e(a)("page.notifyConfig.notifyScene"),path:"notifyScene"},{default:n(()=>[t(T,{value:o.notifyScene,"onUpdate:value":[s[5]||(s[5]=p=>o.notifyScene=p),l],placeholder:e(a)("page.notifyConfig.form.notifyScene"),options:i.value},null,8,["value","placeholder","options"])]),_:1},8,["label"]),t(u,{label:e(a)("page.notifyConfig.notifyRecipient"),path:"recipientIds"},{default:n(()=>[t(T,{value:o.recipientIds,"onUpdate:value":s[6]||(s[6]=p=>o.recipientIds=p),placeholder:e(a)("page.notifyConfig.form.notifyRecipient"),options:f.value,clearable:"",multiple:""},null,8,["value","placeholder","options"])]),_:1},8,["label"]),t(F,{cols:"2 s:1 m:2",responsive:"screen","x-gap":"20"},{default:n(()=>[t(b,null,{default:n(()=>[t(u,{label:e(a)("page.notifyConfig.notifyStatus"),path:"notifyStatus"},{default:n(()=>[t(D,{value:o.notifyStatus,"onUpdate:value":s[7]||(s[7]=p=>o.notifyStatus=p),name:"notifyStatus"},{default:n(()=>[t(R,null,{default:n(()=>[(N(!0),le(se,null,re(e(ie),p=>(N(),$(V,{key:p.value,value:p.value,label:e(a)(p.label)},null,8,["value","label"]))),128))]),_:1})]),_:1},8,["value"])]),_:1},8,["label"])]),_:1}),t(b,null,{default:n(()=>[t(u,{label:e(a)("page.notifyConfig.notifyThreshold"),path:"notifyThreshold"},{default:n(()=>[t(j,{value:o.notifyThreshold,"onUpdate:value":s[8]||(s[8]=p=>o.notifyThreshold=p),min:1,placeholder:e(a)("page.notifyConfig.form.notifyThreshold"),disabled:c.value},null,8,["value","placeholder","disabled"])]),_:1},8,["label"])]),_:1})]),_:1}),t(F,{cols:"2 s:1 m:2",responsive:"screen","x-gap":"20"},{default:n(()=>[t(b,null,{default:n(()=>[t(u,{label:e(a)("page.notifyConfig.rateLimiterStatus"),path:"rateLimiterStatus"},{default:n(()=>[t(D,{value:o.rateLimiterStatus,"onUpdate:value":s[9]||(s[9]=p=>o.rateLimiterStatus=p),name:"rateLimiterStatus",disabled:c.value},{default:n(()=>[t(R,null,{default:n(()=>[(N(!0),le(se,null,re(e(ie),p=>(N(),$(V,{key:p.value,value:p.value,label:e(a)(p.label)},null,8,["value","label"]))),128))]),_:1})]),_:1},8,["value","disabled"])]),_:1},8,["label"])]),_:1}),t(b,null,{default:n(()=>[t(u,{label:e(a)("page.notifyConfig.rateLimiterThreshold"),path:"notifyThreshold"},{default:n(()=>[t(j,{value:o.rateLimiterThreshold,"onUpdate:value":s[10]||(s[10]=p=>o.rateLimiterThreshold=p),min:1,placeholder:e(a)("page.notifyConfig.form.notifyThreshold"),disabled:c.value},null,8,["value","placeholder","disabled"])]),_:1},8,["label"])]),_:1})]),_:1}),t(u,{label:e(a)("page.notifyConfig.description"),path:"description"},{default:n(()=>[t(z,{value:o.description,"onUpdate:value":s[11]||(s[11]=p=>o.description=p),type:"textarea",placeholder:e(a)("page.notifyConfig.form.description")},null,8,["value","placeholder"])]),_:1},8,["label"])]),_:1},8,["model"])]),_:1},8,["modelValue","title"])}}}),pt=ae({name:"NotifyConfigSearch",__name:"notify-config-search",props:{model:{required:!0},modelModifiers:{}},emits:ee(["reset","search"],["update:model"]),setup(w,{emit:x}){const f=x,g=te(w,"model");function y(){f("reset")}function k(){f("search")}return(_,S)=>{const v=ge,c=be,i=Ze,d=de,B=_e;return N(),$(B,{model:g.value,onSearch:k,onReset:y},{default:n(()=>[t(c,{span:"24 s:12 m:6",label:e(a)("page.notifyConfig.groupName"),path:"groupName",class:"pr-24px"},{default:n(()=>[t(v,{value:g.value.groupName,"onUpdate:value":S[0]||(S[0]=L=>g.value.groupName=L),clearable:""},null,8,["value"])]),_:1},8,["label"]),t(c,{span:"24 s:12 m:6",label:e(a)("page.notifyConfig.notifyScene"),path:"notifyScene",class:"pr-24px"},{default:n(()=>[t(i,{value:g.value.notifyScene,"onUpdate:value":S[1]||(S[1]=L=>g.value.notifyScene=L),"group-name":g.value.groupName,clearable:""},null,8,["value","group-name"])]),_:1},8,["label"]),t(c,{span:"24 s:12 m:6",label:e(a)("page.notifyConfig.notifyStatus"),path:"notifyStatus",class:"pr-24px"},{default:n(()=>[t(d,{value:g.value.notifyStatus,"onUpdate:value":S[2]||(S[2]=L=>g.value.notifyStatus=L),placeholder:e(a)("page.notifyConfig.notifyStatus"),options:e(P)(e(ie)),clearable:""},null,8,["value","placeholder","options"])]),_:1},8,["label"])]),_:1},8,["model"])}}}),ft=ae({name:"NotifyConfigDetailDrawer",__name:"notify-config-detail-drawer",props:ee({rowData:{}},{visible:{type:Boolean,default:!1},visibleModifiers:{}}),emits:["update:visible"],setup(w){const x=te(w,"visible");return(f,g)=>{const y=lt,k=q,_=st,S=fe;return N(),$(S,{modelValue:x.value,"onUpdate:modelValue":g[0]||(g[0]=v=>x.value=v),title:e(a)("page.groupConfig.detail")},{default:n(()=>[t(_,{"label-placement":"top",bordered:"",column:2},{default:n(()=>{var v,c;return[t(y,{label:e(a)("page.notifyConfig.businessName"),span:2},{default:n(()=>{var i;return[I(U((i=f.rowData)==null?void 0:i.businessName),1)]}),_:1},8,["label"]),t(y,{label:e(a)("page.groupConfig.groupName"),span:2},{default:n(()=>{var i;return[I(U((i=f.rowData)==null?void 0:i.groupName),1)]}),_:1},8,["label"]),t(y,{label:e(a)("page.notifyConfig.systemTaskType"),span:1},{default:n(()=>{var i;return[t(k,{type:e(O)((i=f.rowData)==null?void 0:i.systemTaskType)},{default:n(()=>{var d;return[I(U(e(a)(e(me)[(d=f.rowData)==null?void 0:d.systemTaskType])),1)]}),_:1},8,["type"])]}),_:1},8,["label"]),t(y,{label:e(a)("page.notifyConfig.notifyStatus"),span:1},{default:n(()=>{var i;return[t(k,{type:e(O)((i=f.rowData)==null?void 0:i.notifyStatus)},{default:n(()=>{var d;return[I(U(e(a)(e(Ge)[(d=f.rowData)==null?void 0:d.notifyStatus])),1)]}),_:1},8,["type"])]}),_:1},8,["label"]),((v=f.rowData)==null?void 0:v.systemTaskType)===1?(N(),$(y,{key:0,label:e(a)("page.notifyConfig.notifyScene"),span:1},{default:n(()=>{var i;return[t(k,{type:e(O)((i=f.rowData)==null?void 0:i.notifyScene)},{default:n(()=>{var d;return[I(U(e(a)(e(ce)[(d=f.rowData)==null?void 0:d.notifyScene])),1)]}),_:1},8,["type"])]}),_:1},8,["label"])):H("",!0),((c=f.rowData)==null?void 0:c.systemTaskType)===3?(N(),$(y,{key:1,label:e(a)("page.notifyConfig.notifyScene"),span:1},{default:n(()=>{var i;return[t(k,{type:e(O)((i=f.rowData)==null?void 0:i.notifyScene)},{default:n(()=>{var d;return[I(U(e(a)(e(ye)[(d=f.rowData)==null?void 0:d.notifyScene])),1)]}),_:1},8,["type"])]}),_:1},8,["label"])):H("",!0),t(y,{label:e(a)("page.notifyConfig.notifyThreshold"),span:1},{default:n(()=>{var i;return[t(k,{type:e(O)((i=f.rowData)==null?void 0:i.notifyThreshold)},{default:n(()=>{var d;return[I(U((d=f.rowData)==null?void 0:d.notifyThreshold),1)]}),_:1},8,["type"])]}),_:1},8,["label"]),t(y,{label:e(a)("common.createDt"),span:2},{default:n(()=>{var i;return[I(U((i=f.rowData)==null?void 0:i.createDt),1)]}),_:1},8,["label"]),t(y,{label:e(a)("page.notifyConfig.description"),span:2},{default:n(()=>{var i;return[I(U((i=f.rowData)==null?void 0:i.description),1)]}),_:1},8,["label"])]}),_:1})]),_:1},8,["modelValue","title"])}}}),dt={class:"min-h-500px flex-col-stretch gap-16px overflow-hidden lt-sm:overflow-auto"};function G(w){return typeof w=="function"||Object.prototype.toString.call(w)==="[object Object]"&&!qe(w)}const kt=ae({name:"notify_config",__name:"index",setup(w){const{hasAuth:x}=rt(),f=Ae(),g=A(),{bool:y,setTrue:k}=Pe(!1),{columns:_,columnChecks:S,data:v,getData:c,loading:i,mobilePagination:d,searchParams:B,resetSearchParams:L}=ve({apiFn:Je,apiParams:{page:1,size:10,groupName:null,notifyStatus:null,notifyScene:null},columns:()=>[{type:"selection",align:"center",width:48},{key:"id",title:a("common.index"),align:"center",width:64},{key:"businessName",title:a("page.notifyConfig.businessName"),align:"left",width:120,render:r=>{function l(){g.value=r||null,k()}return t(Z,{text:!0,tag:"a",type:"primary",onClick:l,class:"ws-normal"},{default:()=>[r.businessName]})}},{key:"groupName",title:a("page.notifyConfig.groupName"),align:"left",width:120},{key:"systemTaskType",title:a("page.notifyConfig.systemTaskType"),align:"left",width:120,render:r=>{if(r.systemTaskType===null)return null;const l=a(me[r.systemTaskType]);return t(q,{type:O(r.systemTaskType)},G(l)?l:{default:()=>[l]})}},{key:"notifyStatus",title:a("page.notifyConfig.notifyStatus"),align:"left",width:120,render:r=>{const l=async(h,m)=>{var u;const{error:s}=await Qe(r.id,h);s||(r.notifyStatus=h,(u=window.$message)==null||u.success(a("common.updateSuccess"))),m()};return t(it,{value:r.notifyStatus,"onUpdate:value":h=>r.notifyStatus=h,onFetch:l},null)}},{key:"notifyScene",title:a("page.notifyConfig.notifyScene"),align:"left",width:160,render:r=>{if(r.notifyScene===null)return null;if(r.systemTaskType===1){const l=a(ce[r.notifyScene]);return t(q,{type:O(r.notifyScene)},G(l)?l:{default:()=>[l]})}if(r.systemTaskType===3){const l=a(ye[r.notifyScene]);return t(q,{type:O(r.notifyScene)},G(l)?l:{default:()=>[l]})}if(r.systemTaskType===4){const l=a(ze[r.notifyScene]);return t(q,{type:O(r.notifyScene)},G(l)?l:{default:()=>[l]})}return null}},{key:"notifyThreshold",title:a("page.notifyConfig.notifyThreshold"),align:"left",width:120},{key:"createDt",title:a("common.createDt"),align:"left",width:120},{key:"description",title:a("page.notifyConfig.description"),align:"left",width:120},{key:"operate",title:a("common.operate"),align:"center",width:130,fixed:"right",render:r=>{let l;return t("div",{class:"flex-center gap-8px"},[t(Z,{type:"primary",ghost:!0,text:!0,size:"small",onClick:()=>Q(r.id)},G(l=a("common.edit"))?l:{default:()=>[l]}),x("R_ADMIN")?t(se,null,[t(Ee,{vertical:!0},null),t(Se,{onPositiveClick:()=>J(r.id)},{default:()=>a("common.confirmDelete"),trigger:()=>{let h;return t("span",null,[t(Z,{type:"error",text:!0,ghost:!0,size:"small"},G(h=a("common.delete"))?h:{default:()=>[h]})])}})]):""])}}]}),{drawerVisible:C,operateType:ne,editingData:oe,handleAdd:o,handleEdit:K,checkedRowKeys:M}=he(v,c);async function X(){var l;const{error:r}=await pe(M.value);r||((l=window.$message)==null||l.success(a("common.deleteSuccess")),c())}async function J(r){var h;const{error:l}=await pe([r]);l||((h=window.$message)==null||h.success(a("common.deleteSuccess")),c())}function Q(r){K(r)}return(r,l)=>{const h=Te,m=ot,s=We;return N(),le("div",dt,[t(pt,{model:e(B),"onUpdate:model":l[0]||(l[0]=u=>W(B)?B.value=u:null),onReset:e(L),onSearch:e(c)},null,8,["model","onReset","onSearch"]),t(s,{title:e(a)("page.notifyConfig.title"),bordered:!1,size:"small",class:"sm:flex-1-hidden card-wrapper","header-class":"view-card-header"},{"header-extra":n(()=>[t(h,{columns:e(S),"onUpdate:columns":l[1]||(l[1]=u=>W(S)?S.value=u:null),"disabled-delete":e(M).length===0,loading:e(i),onAdd:e(o),onDelete:X,onRefresh:e(c)},null,8,["columns","disabled-delete","loading","onAdd","onRefresh"])]),default:n(()=>[t(m,{"checked-row-keys":e(M),"onUpdate:checkedRowKeys":l[2]||(l[2]=u=>W(M)?M.value=u:null),columns:e(_),data:e(v),"flex-height":!e(f).isMobile,"scroll-x":962,loading:e(i),remote:"","row-key":u=>u.id,pagination:e(d),class:"sm:h-full"},null,8,["checked-row-keys","columns","data","flex-height","loading","row-key","pagination"]),t(ut,{visible:e(C),"onUpdate:visible":l[3]||(l[3]=u=>W(C)?C.value=u:null),"operate-type":e(ne),"row-data":e(oe),onSubmitted:e(c)},null,8,["visible","operate-type","row-data","onSubmitted"]),t(ft,{visible:e(y),"onUpdate:visible":l[4]||(l[4]=u=>W(y)?y.value=u:null),"row-data":g.value},null,8,["visible","row-data"])]),_:1},8,["title"])])}}});export{kt as default};