ScopeSentry/static/assets/Service-BeCwXX-L.js

2 lines
4.7 KiB
JavaScript

import{d as e,B as l,K as t,r as a,s,e as i,y as o,F as n,L as r,o as m,i as d,w as p,a as c,M as u,j as h,O as v,l as f,J as g,Q as j,_ as y}from"./index-B4Nyjh3H.js";import{u as b}from"./useTable-CG-SPGP0.js";import{E as x}from"./el-card-wk8kGoMw.js";import{E as _,a as w}from"./el-col-ChTZtubL.js";import{E as S}from"./el-text-D_MjvMVh.js";import{_ as C}from"./Table.vue_vue_type_script_lang-DkXax4KK.js";import{u as E}from"./useCrudSchemas-C24QrNmN.js";import{f as W}from"./index-DMq61pjZ.js";import{r as V}from"./index-BS_iuBaF.js";import"./el-table-column-D5fUDOpn.js";import"./el-popper-DBt0ZFPB.js";import"./index-ThnV7dxG.js";import"./isEqual-DFD3TClT.js";import"./debounce-4WtFbZlf.js";import"./el-checkbox-DAPJr8Xi.js";import"./isArrayLikeObject-CWayLN3s.js";import"./raf-jjs8tbGM.js";import"./el-tooltip-l0sNRNKZ.js";import"./el-tag-DS_6W9-f.js";import"./el-select-ErNzBCXo.js";import"./useInput-Drsa8fv-.js";import"./el-image-viewer-CLYRUyY9.js";import"./tsxHelper-TQdELaO0.js";import"./el-dropdown-item-BheZ-il5.js";import"./castArray-BrlE0VBR.js";import"./refs-CGmkSrb7.js";import"./index-xQ3iUQKd.js";import"./tree-BfZhwLPs.js";import"./index-CdbOSPly.js";function z(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!v(e)}const I=y(e({__name:"Service",setup(e){const{t:v}=f(),{query:y}=l();t((()=>{U(),window.addEventListener("resize",U)}));const I=a(0),U=()=>{const e=window.innerHeight||document.documentElement.clientHeight;I.value=.8*e};a("");const k=s({});k.project=[y.id];const A=async e=>{Object.assign(k,e),H()},O=s([{field:"selection",type:"selection",minWidth:"55"},{field:"index",label:v("tableDemo.index"),type:"index",minWidth:"30"},{field:"service",label:v("asset.service"),minWidth:"100",formatter:(e,l,t)=>e.count?i(n,null,[i(S,null,z(t)?t:{default:()=>[t]}),i(S,{type:"info"},{default:()=>[o("("),e.count,o(")")]})]):i(S,null,z(t)?t:{default:()=>[t]}),slots:{header:()=>i("div",null,[i("span",null,[v("asset.service")]),i(r,{modelValue:J.value,"onUpdate:modelValue":e=>J.value=e,placeholder:"Search",style:"width: 80px; margin-left: 10px;",size:"small",onChange:()=>X("service_service")},null)])}},{field:"domain",label:v("asset.domain"),minWidth:"200",slots:{header:()=>i("div",null,[i("span",null,[v("asset.domain")]),i(r,{modelValue:K.value,"onUpdate:modelValue":e=>K.value=e,placeholder:"Search",style:"width: 80px; margin-left: 10px;",size:"small",onChange:()=>X("service_domain")},null)])}},{field:"ip",label:"IP",minWidth:"250",slots:{header:()=>i("div",null,[i("span",null,[o("IP")]),i(r,{modelValue:P.value,"onUpdate:modelValue":e=>P.value=e,placeholder:"Search",style:"width: 200px; margin-left: 10px;",size:"small",onChange:()=>X("service_ip")},null)])}},{field:"port",label:v("asset.port"),minWidth:"250",slots:{header:()=>i("div",null,[i("span",null,[v("asset.port")]),i(r,{modelValue:q.value,"onUpdate:modelValue":e=>q.value=e,placeholder:"Search",style:"width: 200px; margin-left: 10px;",size:"small",onChange:()=>X("service_port")},null)])}},{field:"timestamp",label:v("asset.time"),minWidth:"200"}]),{allSchemas:R}=E(O),{tableRegister:T,tableState:L,tableMethods:B}=b({fetchDataApi:async()=>({list:(await W("",k,Q)).data.list}),immediate:!0}),{loading:D,dataList:F}=L,{getList:H,getElTableExpose:M}=B;function N(){return{background:"var(--el-fill-color-light)"}}const q=a(""),K=a(""),P=a(""),J=a(""),Q=s({}),X=async e=>{let l="";"service_port"==e&&(l=q.value),"service_domain"==e&&(l=K.value),"service_ip"==e&&(l=P.value),"service_service"==e&&(l=J.value),Q[e]=l,H()},G=a([]),Y=async()=>{g.confirm("Whether to delete?","Warning",{confirmButtonText:"OK",cancelButtonText:"Cancel",type:"warning"}).then((async()=>{const e=await M(),l=(null==e?void 0:e.getSelectionRows())||[];G.value=l.map((e=>e.id)),await V(G.value,"asset"),H()})).catch((()=>{j({type:"info",message:"Delete canceled"})}))};let Z=a(!1);const $=async()=>{const e=await M(),l=(null==e?void 0:e.getSelectionRows())||[];G.value=l.map((e=>e.id)),0!=G.value.length?Z.value=!0:Z.value=!1};return(e,l)=>(m(),d(c(w),null,{default:p((()=>[i(c(_),null,{default:p((()=>[i(c(x),{style:{height:"min-content"}},{default:p((()=>[c(Z)?(m(),d(c(u),{key:0,onClick:Y,type:"danger",size:"small"},{default:p((()=>[o("Dlete")])),_:1})):h("",!0),i(c(C),{columns:c(R).tableColumns,data:c(F),"max-height":I.value,border:!0,loading:c(D),onSelectionChange:$,rowKey:"id",resizable:!0,onRegister:c(T),onFilterChange:A,headerCellStyle:N,style:{fontFamily:"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji"}},null,8,["columns","data","max-height","loading","onRegister"])])),_:1})])),_:1})])),_:1}))}}),[["__scopeId","data-v-f8969d6a"]]);export{I as default};