2 lines
17 KiB
JavaScript
2 lines
17 KiB
JavaScript
import{a as be,N as _e,b as ve}from"./search-form.vue_vue_type_script_setup_true_lang-B9DCSIZj.js";import{d as ae,Z as ee,r as A,a0 as te,a4 as z,z as he,A as Se,a as Te,$ as a,i as Ne,ao as we,p as ke,q as Ce,o as N,c as R,w as n,f as t,g as I,t as U,h as e,aO as De,ai as K,b as le,a1 as re,aH as se,a3 as ie,ab as fe,E as Ie,aa as de,H as Ue,aG as Le,D as Re,I as $e,B as X,aP as ue,aQ as Ve,aR as Oe,ac as O,aS as me,aI as xe,aT as ce,aU as ye,Y as q,L as je,ag as Be,ah as H,aV as Fe,at as Ge,F as Me,aj as Ae}from"./index-D11HRvLC.js";import{f as ze,a as Pe,b as Ee,c as He,d as pe,e as qe}from"./notify-BogCsml_.js";import{_ as Ke,u as We,a as Je}from"./table-oGN68_Ra.js";import{f as Qe,_ as Ye}from"./select-scene.vue_vue_type_script_setup_true_lang-UmFWq9QR.js";import{f as Ze}from"./workflow-B_Ogzjxw.js";import{h as Xe}from"./job-DWJU1EVy.js";import{_ as ge}from"./select-group.vue_vue_type_script_setup_true_lang-BV1AXeAr.js";import{_ as et,d as tt,c as at,a as nt,b as ot}from"./Grid-BEQeOJ6_.js";import{_ as lt,a as st}from"./DescriptionsItem-QSQ4JSXU.js";import{_ as it}from"./status-switch.vue_vue_type_script_setup_true_lang-Cv5sP_Gc.js";import{u as rt}from"./auth-B9UptQv2.js";import"./group-DBuDE6uz.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(z(ue)),{formRef:d,validate:j,restoreValidation:$}=he(),{defaultRequiredRule:C}=Se(),ne=Te(()=>({add:a("page.notifyConfig.addNotifyConfig"),edit:a("page.notifyConfig.editNotifyConfig")})[_.operateType]);Ne(()=>{we(()=>{oe()})});async function oe(){const m=await ze();f.value=m.data}const o=ke(W());function W(){return{groupName:null,businessId:"",recipientIds:[],systemTaskType:null,notifyStatus:1,notifyScene:null,notifyThreshold:16,rateLimiterStatus:0,rateLimiterThreshold:100,description:""}}const B={groupName:C,businessId:C,systemTaskType:C,notifyStatus:C,notifyScene:C,recipientIds:C,rateLimiterStatus:C,notifyThreshold:C};function J(){if(_.operateType==="add"){Object.assign(o,W()),c.value=!0;return}_.operateType==="edit"&&_.rowData&&(Object.assign(o,_.rowData),r(o.systemTaskType),l(o.notifyScene))}function Q(){v.value=!1}async function Y(){var m;if(await j(),_.operateType==="add"){const{groupName:s,businessId:u,recipientIds:T,systemTaskType:V,notifyStatus:L,notifyScene:D,notifyThreshold:b,rateLimiterStatus:F,rateLimiterThreshold:G,description:P}=o,{error:E}=await Pe({groupName:s,businessId:u,recipientIds:T,systemTaskType:V,notifyStatus:L,notifyScene:D,notifyThreshold:b,rateLimiterStatus:F,rateLimiterThreshold:G,description:P});if(E)return}if(_.operateType==="edit"){const{id:s,groupName:u,businessId:T,recipientIds:V,notifyStatus:L,systemTaskType:D,notifyScene:b,notifyThreshold:F,rateLimiterStatus:G,rateLimiterThreshold:P,description:E}=o,{error:Z}=await Ee({id:s,groupName:u,businessId:T,recipientIds:V,systemTaskType:D,notifyStatus:L,notifyScene:b,notifyThreshold:F,rateLimiterStatus:G,rateLimiterThreshold:P,description:E});if(Z)return}(m=window.$message)==null||m.success(a("common.updateSuccess")),Q(),S("submitted")}async function r(m){var s,u,T,V,L;if(m===1){const D=await Qe({groupName:o.groupName});g.value=D.data,i.value=z(ue)}else if(m===3){const D=await Xe({groupName:o.groupName});y.value=(s=D.data)==null?void 0:s.map(b=>(b.id=String(b.id),b)),i.value=z(Ve)}else if(m===4){const D=await Ze({groupName:o.groupName});k.value=(u=D.data)==null?void 0:u.map(b=>(b.id=String(b.id),b)),i.value=z(Oe)}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=(L=_.rowData)==null?void 0:L.notifyScene)}async function l(m){c.value=!(m===5||m===6)}function h(m){J(),o.groupName=m,r(1),l(1)}return Ce(v,()=>{v.value&&(J(),$())}),(m,s)=>{const u=Ie,T=de,V=nt,L=Ue,D=et,b=tt,F=Le,G=at,P=Re,E=$e,Z=X;return N(),R(fe,{modelValue:v.value,"onUpdate:modelValue":s[12]||(s[12]=p=>v.value=p),title:ne.value,"min-size":480,onHandleSubmit:Y},{footer:n(()=>[t(L,{size:16},{default:n(()=>[t(Z,{onClick:Q},{default:n(()=>[I(U(e(a)("common.cancel")),1)]),_:1}),t(Z,{type:"primary",onClick:Y},{default:n(()=>[I(U(e(a)("common.save")),1)]),_:1})]),_:1})]),default:n(()=>[t(E,{ref_key:"formRef",ref:d,model:o,rules:B},{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(z)(e(De))},null,8,["value","placeholder","options"])]),_:1},8,["label"]),o.systemTaskType===1?(N(),R(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"])):K("",!0),o.systemTaskType===3?(N(),R(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"])):K("",!0),o.systemTaskType===4?(N(),R(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"])):K("",!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(G,{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(L,null,{default:n(()=>[(N(!0),le(ie,null,re(e(se),p=>(N(),R(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(F,{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(G,{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(L,null,{default:n(()=>[(N(!0),le(ie,null,re(e(se),p=>(N(),R(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(F,{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(P,{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=Ke,i=Ye,d=de,j=be;return N(),R(j,{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]=$=>g.value.groupName=$),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]=$=>g.value.notifyScene=$),"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]=$=>g.value.notifyStatus=$),placeholder:e(a)("page.notifyConfig.notifyStatus"),options:e(z)(e(se)),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(),R(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(xe)[(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(),R(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"])):K("",!0),((c=f.rowData)==null?void 0:c.systemTaskType)===3?(N(),R(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"])):K("",!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 M(w){return typeof w=="function"||Object.prototype.toString.call(w)==="[object Object]"&&!Ae(w)}const Ct=ae({name:"notify_config",__name:"index",setup(w){const{hasAuth:x}=rt(),f=je(),g=A(),{bool:y,setTrue:k}=Be(!1),{columns:_,columnChecks:S,data:v,getData:c,loading:i,mobilePagination:d,searchParams:j,resetSearchParams:$}=We({apiFn:He,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(X,{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)},M(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)},M(l)?l:{default:()=>[l]})}if(r.systemTaskType===3){const l=a(ye[r.notifyScene]);return t(q,{type:O(r.notifyScene)},M(l)?l:{default:()=>[l]})}if(r.systemTaskType===4){const l=a(Fe[r.notifyScene]);return t(q,{type:O(r.notifyScene)},M(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(X,{type:"primary",ghost:!0,text:!0,size:"small",onClick:()=>Y(r.id)},M(l=a("common.edit"))?l:{default:()=>[l]}),x("R_ADMIN")?t(ie,null,[t(Ge,{vertical:!0},null),t(_e,{onPositiveClick:()=>Q(r.id)},{default:()=>a("common.confirmDelete"),trigger:()=>{let h;return t("span",null,[t(X,{type:"error",text:!0,ghost:!0,size:"small"},M(h=a("common.delete"))?h:{default:()=>[h]})])}})]):""])}}]}),{drawerVisible:C,operateType:ne,editingData:oe,handleAdd:o,handleEdit:W,checkedRowKeys:B}=Je(v,c);async function J(){var l;const{error:r}=await pe(B.value);r||((l=window.$message)==null||l.success(a("common.deleteSuccess")),c())}async function Q(r){var h;const{error:l}=await pe([r]);l||((h=window.$message)==null||h.success(a("common.deleteSuccess")),c())}function Y(r){W(r)}return(r,l)=>{const h=ve,m=ot,s=Me;return N(),le("div",dt,[t(pt,{model:e(j),"onUpdate:model":l[0]||(l[0]=u=>H(j)?j.value=u:null),onReset:e($),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=>H(S)?S.value=u:null),"disabled-delete":e(B).length===0,loading:e(i),onAdd:e(o),onDelete:J,onRefresh:e(c)},null,8,["columns","disabled-delete","loading","onAdd","onRefresh"])]),default:n(()=>[t(m,{"checked-row-keys":e(B),"onUpdate:checkedRowKeys":l[2]||(l[2]=u=>H(B)?B.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=>H(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=>H(y)?y.value=u:null),"row-data":g.value},null,8,["visible","row-data"])]),_:1},8,["title"])])}}});export{Ct as default};
|