UnisKB/static/chat/assets/ApplicationResourceIndex-Cl...

2 lines
12 KiB
JavaScript
Raw Normal View History

import{ay as Ve,az as Ae,b7 as xe,aA as Se,b8 as ze,b9 as Ne,aB as p,aC as _,bd as Le,be as Re,br as Ue,aL as Ee,aD as n,aE as s,bf as S,aH as a,aG as t,aK as v,aJ as r,bn as y,aI as i,aF as u,bg as M,bh as B,bm as z,c1 as Pe,c2 as Te,bb as N,c3 as oe,c0 as Ie,c4 as Fe,c5 as O,c6 as Me,bo as Be,c7 as Oe}from"./chat-u6cKkSMp.js";import{l as De}from"./permission-api-BCzde5j1.js";import"./workspace--1HHfS5D.js";const We={class:"p-16-24"},Je={class:"ml-4 color-text-primary"},He={class:"flex-between mb-16"},Ke={class:"complex-search"},qe={class:"table-name flex align-center"},Ge=["src"],je={class:"filter"},Qe={class:"form-item mb-16"},Xe={class:"text-right"},Ye={key:0,class:"flex align-center"},Ze={class:"color-text-primary"},el={key:1,class:"flex align-center"},ll={class:"color-text-primary"},al={class:"filter"},tl={class:"form-item mb-16 ml-4"},ol={class:"text-right"},nl={class:"mr-8"},sl={class:"mr-8"},pl=Ve({__name:"ApplicationResourceIndex",setup(il){const ne=Ae();xe();const{user:H,application:se}=Se(),f=ze(()=>Ne.application.systemManage),ie=()=>f.value.overview_read()||f.value.access_read()||f.value.edit()||f.value.chat_log_read()||f.value.chat_user_read(),re=()=>f.value.export()||f.value.delete()||f.value.auth(),K=p();function ue(e){K.value.open(e.id)}const D=p([]);function ce(e){var m,V;(V=(m=e==null?void 0:e.work_flow)==null?void 0:m.nodes)==null||V.filter(c=>c.id==="base-node").map(c=>{D.value=c.properties.api_input_field_list?c.properties.api_input_field_list.map(d=>({name:d.variable,value:d.default_value})):c.properties.input_field_list?c.properties.input_field_list.filter(d=>d.assignment_method==="api_input").map(d=>({name:d.variable,value:d.default_value})):[]});const o=q(D.value)?"?"+q(D.value):"";O.getAccessToken(e.id,R).then(c=>{var d;window.open(se.location+((d=c==null?void 0:c.data)==null?void 0:d.access_token)+o)})}function q(e){const o=new URLSearchParams;return e.forEach(m=>{o.append(encodeURIComponent(m.name),encodeURIComponent(m.value))}),o.toString()}function pe(e){Me(`${_("views.application.delete.confirmTitle")}${e.name} ?`,_("views.application.delete.confirmMessage"),{confirmButtonText:_("common.confirm"),cancelButtonText:_("common.cancel"),confirmButtonClass:"danger"}).then(()=>{O.delApplication(e.id,R).then(()=>{const o=U.value.findIndex(m=>m.id===e.id);U.value.splice(o,1),Be(_("common.deleteSuccess"))})}).catch(()=>{})}const me=e=>{O.exportApplication(e.id,e.name,R).catch(o=>{o.response.status!==403&&o.response.data.text().then(m=>{Oe(`${_("views.application.tip.ExportError")}:${JSON.parse(m).message}`)})})},g=p("name"),b=p({name:"",create_user:"",type:""}),G=p([]),de=p([{label:_("views.application.workflow"),value:"WORK_FLOW"},{label:_("views.application.simple"),value:"SIMPLE"}]),R=p(!1),U=p([]),W=Le({current_page:1,page_size:20,total:0}),E=p([]),P=p(!1),$=p([]),T=p(!1),C=p([]),ve=p([{label:_("views.application.status.published"),value:!0},{label:_("views.application.status.unpublished"),value:!1}]),L=p(""),I=p([]);Re([()=>E.value,()=>L.value],()=>{L.value.length||(I.value=E.value),I.value=E.value.filter(e=>e.label.toLowerCase().includes(L.value.toLowerCase()))},{immediate:!0});function j(e){e==="clear"&&($.value=[]),L.value="",w(),P.value=!1}function Q(e){e==="clear"&&(C.value=[]),w(),T.value=!1}async function _e(){if(H.isEE()){const e=await De("workspace").getSystemWorkspaceList(R);E.value=e.data.map(o=>({label:o.name,value:o.id}))}}const fe=()=>{b.value={name:"",create_user:"",type:""}};function w(){const e={};b.value[g.value]&&(e[g.value]=b.value[g.value]),$.value.length>0&&(e.workspace_ids=JSON.stringify($.value)),C.value.length>0&&(e.status=JSON.stringify(C.value)),O.getApplication(W,e,R).then(o=>{var m,V;W.total=(m=o.data)==null?void 0:m.total,U.value=(V=o.data)==null?void 0:V.records})}return Ue(()=>{_e(),w(),Ee.getAllMemberList("").then(e=>{G.value=e.data})}),(e,o)=>{const m=n("el-breadcrumb-item"),V=n("el-breadcrumb"),c=n("el-option"),d=n("el-select"),X=n("el-input"),be=n("el-avatar"),F=n("el-icon"),k=n("el-table-column"),Y=n("el-tag"),Z=n("Filter"),h=n("el-button"),ee=n("el-checkb