| 1 |
- import{cV as ze,h2 as Se,h1 as Te,h4 as Re,fV as p,gC as _,h9 as Ie,fA as Pe,a3 as Ue,g2 as n,fC as s,cx as x,cB as t,hb as a,cA as d,gH as r,gY as v,cu as i,cv as u,F as B,f$ as F,cw as $,g1 as Le,eN as Ee,he as C,cI as ne,Y as se,aI as Be,ce as Fe,a as M,z as Me,G as Oe,B as De,fU as We,fH as He}from"./admin-KIlVrsVZ.js";import{_ as Je}from"./ResourceTriggerDrawer.vue_vue_type_script_setup_true_lang-FA9QBX2Z.js";import{l as Ye}from"./permission-api-DW0iUuqz.js";import"./TriggerDrawer.vue_vue_type_script_setup_true_lang-BrCV7GEi.js";import"./ApplicationDialog.vue_vue_type_style_index_0_lang-CdkyK4Bq.js";import"./v4-Dnyct6Ft.js";import"./workspace-BOg5VeYz.js";const qe={class:"p-16-24"},Ge={class:"ml-4 color-text-primary"},Ke={class:"flex-between mb-16"},je={class:"complex-search"},Qe=["src"],Xe={class:"ellipsis",style:{"max-width":"160px"}},Ze={class:"filter"},el={class:"form-item mb-16"},ll={class:"text-right"},tl={key:0,class:"flex align-center"},al={class:"color-text-primary"},ol={key:1,class:"flex align-center"},nl={class:"color-text-primary"},sl={class:"filter"},il={class:"form-item mb-16 ml-4"},rl={class:"text-right"},cl={class:"mr-8"},ul={class:"mr-8"},bl=ze({__name:"ApplicationResourceIndex",setup(pl){const ie=Se();Te();const{user:J,application:re}=Re(),m=Fe(()=>He.application.systemManage),ce=()=>m.value.overview_read()||m.value.access_read()||m.value.edit()||m.value.chat_log_read()||m.value.chat_user_read(),ue=()=>m.value.export()||m.value.delete()||m.value.auth()||m.value.trigger_read(),Y=p(),pe=e=>{Y.value?.open(e)},q=p();function me(e){q.value.open(e.id,void 0,e.workspace_id)}const O=p([]);function de(e){e?.work_flow?.nodes?.filter(c=>c.id==="base-node").map(c=>{O.value=c.properties.api_input_field_list?c.properties.api_input_field_list.map(g=>({name:g.variable,value:g.default_value})):c.properties.input_field_list?c.properties.input_field_list.filter(g=>g.assignment_method==="api_input").map(g=>({name:g.variable,value:g.default_value})):[]});const o=G(O.value)?"?"+G(O.value):"";M.getAccessToken(e.id,z).then(c=>{window.open(re.location+c?.data?.access_token+o)})}function G(e){const o=new URLSearchParams;return e.forEach(c=>{o.append(encodeURIComponent(c.name),encodeURIComponent(c.value))}),o.toString()}function _e(e){Me(`${_("views.application.delete.confirmTitle")}${e.name} ?`,e.resource_count>0?_("views.application.delete.resourceCountMessage",e.resource_count):"",{confirmButtonText:_("common.confirm"),cancelButtonText:_("common.cancel"),confirmButtonClass:"danger"}).then(()=>{M.delApplication(e.id,z).then(()=>{const o=R.value.findIndex(c=>c.id===e.id);R.value.splice(o,1),Oe(_("common.deleteSuccess"))})}).catch(()=>{})}const ve=e=>{M.exportApplication(e.id,e.name,z).catch(o=>{o.response.status!==403&&o.response.data.text().then(c=>{De(`${_("views.application.tip.ExportError")}:${JSON.parse(c).message}`)})})},b=p("name"),f=p({name:"",create_user:"",type:""}),K=p([]),fe=p([{label:_("views.application.senior"),value:"WORK_FLOW"},{label:_("views.application.simple"),value:"SIMPLE"}]),z=p(!1),R=p([]),D=We({current_page:1,page_size:20,total:0}),I=p([]),P=p(!1),V=p([]),U=p(!1),A=p([]),ge=p([{label:_("common.status.published"),value:!0},{label:_("common.status.unpublished"),value:!1}]),N=p(""),L=p([]);Ie([()=>I.value,()=>N.value],()=>{N.value.length||(L.value=I.value),L.value=I.value.filter(e=>e.label.toLowerCase().includes(N.value.toLowerCase()))},{immediate:!0});function j(e){e==="clear"&&(V.value=[]),N.value="",y(),P.value=!1}function Q(e){e==="clear"&&(A.value=[]),y(),U.value=!1}async function he(){if(J.isEE()){const e=await Ye("workspace").getSystemWorkspaceList(z);I.value=e.data.map(o=>({label:o.name,value:o.id}))}}const be=()=>{f.value={name:"",create_user:"",type:""}};function y(){const e={};f.value[b.value]&&(e[b.value]=f.value[b.value]),V.value.length>0&&(e.workspace_ids=JSON.stringify(V.value)),A.value.length>0&&(e.status=JSON.stringify(A.value)),M.getApplication(D,e,z).then(o=>{D.total=o.data?.total,R.value=o.data?.records})}return Pe(()=>{he(),y(),Ue.getAllMemberList("").then(e=>{K.value=e.data})}),(e,o)=>{const c=n("el-breadcrumb-item"),g=n("el-breadcrumb"),S=n("el-option"),W=n("el-select"),X=n("el-input"),ye=n("el-avatar"),ke=n("el-space"),k=n("el-table-column"),Z=n("el-tag"),ee=n("Filter"),H=n("el-icon"),h=n("el-button"),le=n("el-checkbox"),te=n("el-checkbox-group"),ae=n("el-popover"),we=n("SuccessFilled"),w=n("AppIcon"),$e=n("el-scrollbar"),Ce=n("el-empty"),oe=n("el-tooltip"),E=n("el-dropdown-item"),Ve=n("el-dropdown-menu"),Ae=n("el-dropdown"),xe=n("app-table"),Ne=n("el-card");return s(),x("div",qe,[t(g,{"separator-icon":"ArrowRight"},{default:a(()=>[t(c,null,{default:a(()=>[d(r(v(_)("views.system.resource_management.label")),1)]),_:1}),t(c,null,{default:a(()=>[i("h5",Ge,r(v(_)("views.application.title")),1)]),_:1})]),_:1}),t(Ne,{class:"mt-16",style:{height:"calc(var(--app-main-height) + 20px)"}},{default:a(()=>[i("div",Ke,[i("div",je,[t(W,{class:"complex-search__left",modelValue:b.value,"onUpdate:modelValue":o[0]||(o[0]=l=>b.value=l),style:{width:"120px"},onChange:be},{default:a(()=>[t(S,{label:e.$t("common.creator"),value:"create_user"},null,8,["label"]),t(S,{label:e.$t("common.name"),value:"name"},null,8,["label"]),t(S,{label:e.$t("common.type"),value:"type"},null,8,["label"])]),_:1},8,["modelValue"]),b.value==="name"?(s(),u(X,{key:0,modelValue:f.value.name,"onUpdate:modelValue":o[1]||(o[1]=l=>f.value.name=l),onChange:y,placeholder:e.$t("common.searchBar.placeholder"),style:{width:"220px"},clearable:""},null,8,["modelValue","placeholder"])):b.value==="create_user"?(s(),u(W,{key:1,modelValue:f.value.create_user,"onUpdate:modelValue":o[2]||(o[2]=l=>f.value.create_user=l),onChange:y,clearable:"",filterable:"",style:{width:"220px"}},{default:a(()=>[(s(!0),x(B,null,F(K.value,l=>(s(),u(S,{key:l.id,value:l.id,label:l.nick_name},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])):b.value==="type"?(s(),u(W,{key:2,modelValue:f.value.type,"onUpdate:modelValue":o[3]||(o[3]=l=>f.value.type=l),onChange:y,clearable:"",filterable:"",style:{width:"220px"}},{default:a(()=>[(s(!0),x(B,null,F(fe.value,l=>(s(),u(S,{key:l.id,value:l.value,label:l.label},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])):$("",!0)])]),t(xe,{data:R.value,"pagination-config":D,onSizeChange:y,onChangePage:y,maxTableHeight:260},{default:a(()=>[t(k,{width:"220",label:e.$t("common.name"),"show-overflow-tooltip":""},{default:a(({row:l})=>[t(ke,{size:8},{default:a(()=>[t(ye,{shape:"square",size:24,style:{background:"none"}},{default:a(()=>[i("img",{src:v(Le)(l?.icon),alt:""},null,8,Qe)]),_:2},1024),i("span",Xe,r(l.name),1)]),_:2},1024)]),_:1},8,["label"]),t(k,{prop:"tool_type",label:e.$t("common.type"),width:"100"},{default:a(l=>[v(Ee)(l.row.type)?(s(),u(Z,{key:0,size:"small",class:"warning-tag"},{default:a(()=>[d(r(e.$t("views.application.senior")),1)]),_:1})):(s(),u(Z,{key:1,size:"small",class:"blue-tag"},{default:a(()=>[d(r(e.$t("views.application.simple")),1)]),_:1}))]),_:1},8,["label"]),t(k,{width:"150",prop:"is_publish",label:e.$t("common.status.label"),"show-overflow-tooltip":""},{header:a(()=>[i("div",null,[i("span",null,r(e.$t("common.status.label")),1),t(ae,{width:100,trigger:"click",visible:U.value,persistent:!1},{reference:a(()=>[t(h,{style:{"margin-top":"-2px"},type:A.value&&A.value.length>0?"primary":"",link:"",onClick:o[4]||(o[4]=l=>U.value=!U.value)},{default:a(()=>[t(H,null,{default:a(()=>[t(ee)]),_:1})]),_:1},8,["type"])]),default:a(()=>[i("div",Ze,[i("div",el,[i("div",{onClick:o[6]||(o[6]=C(()=>{},["stop"]))},[t(te,{modelValue:A.value,"onUpdate:modelValue":o[5]||(o[5]=l=>A.value=l),style:{display:"flex","flex-direction":"column"}},{default:a(()=>[(s(!0),x(B,null,F(ge.value,l=>(s(),u(le,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])])]),i("div",ll,[t(h,{size:"small",onClick:o[7]||(o[7]=l=>Q("clear"))},{default:a(()=>[d(r(e.$t("common.clear")),1)]),_:1}),t(h,{type:"primary",onClick:Q,size:"small"},{default:a(()=>[d(r(e.$t("common.confirm")),1)]),_:1})])]),_:1},8,["visible"])])]),default:a(l=>[l.row.is_publish?(s(),x("div",tl,[t(H,{class:"color-success mr-8",style:{"font-size":"16px"}},{default:a(()=>[t(we)]),_:1}),i("span",al,r(e.$t("common.status.published")),1)])):(s(),x("div",ol,[t(w,{iconName:"app-disabled",class:"color-secondary mr-8"}),i("span",nl,r(e.$t("common.status.unpublished")),1)]))]),_:1},8,["label"]),v(J).isEE()?(s(),u(k,{key:0,width:"150",prop:"workspace_name",label:e.$t("views.workspace.title"),"show-overflow-tooltip":""},{header:a(()=>[i("div",null,[i("span",null,r(e.$t("views.workspace.title")),1),t(ae,{width:200,trigger:"click",visible:P.value,persistent:!1},{reference:a(()=>[t(h,{style:{"margin-top":"-2px"},type:V.value&&V.value.length>0?"primary":"",link:"",onClick:o[8]||(o[8]=l=>P.value=!P.value)},{default:a(()=>[t(H,null,{default:a(()=>[t(ee)]),_:1})]),_:1},8,["type"])]),default:a(()=>[i("div",sl,[i("div",il,[i("div",{onClick:o[11]||(o[11]=C(()=>{},["stop"]))},[t(X,{modelValue:N.value,"onUpdate:modelValue":o[9]||(o[9]=l=>N.value=l),placeholder:e.$t("common.search"),"prefix-icon":"Search",clearable:""},null,8,["modelValue","placeholder"]),L.value.length?(s(),u($e,{key:0,height:"300"},{default:a(()=>[t(te,{modelValue:V.value,"onUpdate:modelValue":o[10]||(o[10]=l=>V.value=l),style:{display:"flex","flex-direction":"column"}},{default:a(()=>[(s(!0),x(B,null,F(L.value,l=>(s(),u(le,{key:l.value,label:l.label,value:l.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1})):(s(),u(Ce,{key:1,description:e.$t("common.noData")},null,8,["description"]))])])]),i("div",rl,[t(h,{size:"small",onClick:o[12]||(o[12]=l=>j("clear"))},{default:a(()=>[d(r(e.$t("common.clear")),1)]),_:1}),t(h,{type:"primary",onClick:j,size:"small"},{default:a(()=>[d(r(e.$t("common.confirm")),1)]),_:1})])]),_:1},8,["visible"])])]),_:1},8,["label"])):$("",!0),t(k,{prop:"nick_name",label:e.$t("common.creator"),"show-overflow-tooltip":""},null,8,["label"]),t(k,{label:e.$t("views.application.publishTime"),width:"180"},{default:a(({row:l})=>[d(r(v(ne)(l.update_time)),1)]),_:1},8,["label"]),t(k,{label:e.$t("common.createTime"),width:"180"},{default:a(({row:l})=>[d(r(v(ne)(l.create_time)),1)]),_:1},8,["label"]),t(k,{label:e.$t("common.operation"),align:"left",width:"120",fixed:"right"},{default:a(({row:l})=>[t(oe,{effect:"dark",content:e.$t("views.application.operation.toChat"),placement:"top"},{default:a(()=>[i("span",cl,[t(h,{type:"primary",text:"",title:e.$t("views.application.operation.toChat"),onClick:C(T=>de(l),["stop"])},{default:a(()=>[t(w,{iconName:"app-create-chat"})]),_:1},8,["title","onClick"])])]),_:2},1032,["content"]),ce()?(s(),u(oe,{key:0,effect:"dark",content:e.$t("views.system.resource_management.management"),placement:"top"},{default:a(()=>[i("span",ul,[t(h,{type:"primary",text:"",title:e.$t("views.system.resource_management.management"),onClick:T=>v(ie).push({path:`/application/resource-management/${l.id}/${l.type}/overview`})},{default:a(()=>[t(w,{iconName:"app-admin-operation"})]),_:1},8,["title","onClick"])])]),_:2},1032,["content"])):$("",!0),ue()?(s(),u(Ae,{key:1,trigger:"click"},{dropdown:a(()=>[t(Ve,null,{default:a(()=>[m.value.auth()?(s(),u(E,{key:0,onClick:C(T=>me(l),["stop"])},{default:a(()=>[t(w,{iconName:"app-resource-authorization",class:"color-secondary"}),d(" "+r(e.$t("views.system.resourceAuthorization.title")),1)]),_:1},8,["onClick"])):$("",!0),m.value.export()?(s(),u(E,{key:1,onClick:C(T=>ve(l),["stop"])},{default:a(()=>[t(w,{iconName:"app-export",class:"color-secondary"}),d(" "+r(e.$t("common.export")),1)]),_:1},8,["onClick"])):$("",!0),m.value.trigger_read()?(s(),u(E,{key:2,onClick:C(T=>pe(l),["stop"])},{default:a(()=>[t(w,{iconName:"app-trigger",class:"color-secondary"}),d(" "+r(e.$t("views.trigger.title")),1)]),_:1},8,["onClick"])):$("",!0),m.value.delete()?(s(),u(E,{key:3,onClick:C(T=>_e(l),["stop"])},{default:a(()=>[t(w,{iconName:"app-delete",class:"color-secondary"}),d(" "+r(e.$t("common.delete")),1)]),_:1},8,["onClick"])):$("",!0)]),_:2},1024)]),default:a(()=>[t(h,{text:"",onClick:o[13]||(o[13]=C(()=>{},["stop"])),type:"primary"},{default:a(()=>[t(w,{iconName:"app-more"})]),_:1})]),_:2},1024)):$("",!0)]),_:1},8,["label"])]),_:1},8,["data","pagination-config"])]),_:1}),t(Be,{type:v(se).APPLICATION,ref_key:"ResourceAuthorizationDrawerRef",ref:q},null,8,["type"]),t(Je,{ref_key:"resourceTriggerDrawerRef",ref:Y,source:v(se).APPLICATION},null,8,["source"])])}}});export{bl as default};
|