ScopeSentry/static/assets/Fingerprint-Cw7j-Uwl.js

2 lines
5.6 KiB
JavaScript

import{_ as e}from"./ContentWrap.vue_vue_type_script_setup_true_lang-DYamwFJW.js";import{d as t,r as a,s as l,e as o,I as i,H as r,F as n,o as s,c as p,w as u,a as m,y as d,t as c,L as g,M as f,f as y,N as _,O as j,l as v}from"./index-vMt5tOuI.js";import{E as b,a as h}from"./el-col-CK66atlO.js";import{E as x}from"./el-text-JTnFT2W3.js";import{_ as w}from"./Table.vue_vue_type_script_lang-kKqRQLK4.js";import{_ as S}from"./Dialog.vue_vue_type_style_index_0_lang-BoLcmuNj.js";import{u as k}from"./useTable-DO6t6Zuf.js";import{u as C}from"./useIcon-D1gqy2ud.js";import{d as z,_ as E,g as W}from"./Detail.vue_vue_type_script_setup_true_lang-Tt-QpHRy.js";import"./el-card-CiG9T01-.js";import"./el-tooltip-l0sNRNKZ.js";import"./el-popper-CJZHtU_A.js";import"./el-table-column-Ty7HKRWd.js";import"./index-DMmJY3Ph.js";import"./isEqual-D2Iw95Gj.js";import"./debounce-heHWUU1E.js";import"./el-checkbox-DZAdOJwr.js";import"./isArrayLikeObject-4WqnSTxS.js";import"./raf-RUFdlNuH.js";import"./el-tag-C3mt1pWb.js";import"./el-select-oq3jOrDj.js";import"./useInput-CPyPMgc8.js";import"./el-image-viewer-CkZtWhln.js";import"./tsxHelper-C3yG_Ynk.js";import"./el-dropdown-item-C2usTBce.js";import"./castArray-DsRHGUHq.js";import"./refs-B-F76yq7.js";import"./index-BjDunm1X.js";import"./el-form-CrZErb9v.js";import"./el-divider-RjUq80nQ.js";import"./el-switch-GToX5HcV.js";import"./index-znw49gEj.js";const A={class:"mb-10px"},U={class:"mb-10px"};function V(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!j(e)}const F=t({__name:"Fingerprint",setup(t){const j=C({icon:"iconoir:search"}),{t:F}=v(),I=a(""),L=()=>{B()},P=l([{field:"selection",type:"selection",width:"55"},{field:"id",hidden:!0},{field:"name",label:F("fingerprint.name"),minWidth:40},{field:"rule",label:F("fingerprint.rule"),minWidth:100},{field:"category",label:F("fingerprint.category"),minWidth:30},{field:"parent_category",label:F("fingerprint.parentCategory"),minWidth:30},{field:"amount",label:F("fingerprint.amount"),minWidth:20},{field:"state",label:F("common.state"),minWidth:30,formatter:(e,t,a)=>{if(null==a)return o("div",null,null);let l="",r="";return 1==a?(l="#2eb98a",r=F("common.on")):(l="red",r=F("common.off")),o(h,{gutter:20},{default:()=>[o(b,{span:1},{default:()=>[o(i,{icon:"clarity:circle-solid",color:l,size:10},null)]}),o(b,{span:5},{default:()=>[o(x,{type:"info"},V(r)?r:{default:()=>[r]})]})]})}},{field:"action",label:F("tableDemo.action"),minWidth:40,formatter:(e,t,a)=>{let l,i;return o(n,null,[o(r,{type:"primary",onClick:()=>Y(e)},V(l=F("common.edit"))?l:{default:()=>[l]}),o(r,{type:"danger",onClick:()=>ee(e)},V(i=F("common.delete"))?i:{default:()=>[i]})])}}]),{tableRegister:R,tableState:D,tableMethods:N}=k({fetchDataApi:async()=>{const{currentPage:e,pageSize:t}=D,a=await W(I.value,e.value,t.value);return{list:a.data.list,total:a.data.total}}}),{loading:T,dataList:H,total:M,currentPage:O,pageSize:q}=D,{getList:B,getElTableExpose:$}=N;function X(){return{background:"var(--el-fill-color-light)"}}const G=a(!1),J=async()=>{Q.id="",Q.rule="",Q.category="",Q.parent_category="",Q.name="",Q.state=!0,G.value=!0},K=()=>{G.value=!1};let Q=l({id:"",name:"",rule:"",category:"",parent_category:"",state:!0});const Y=e=>{Q.id=e.id,Q.rule=e.rule,Q.category=e.category,Q.parent_category=e.parent_category,Q.name=e.name,Q.state=e.state,G.value=!0},Z=a(!1),ee=async e=>{Z.value=!0;try{await z([e.id]);Z.value=!1,B()}catch(t){Z.value=!1,B()}},te=a([]),ae=async()=>{window.confirm("Are you sure you want to delete the selected data?")&&await(async()=>{const e=await $(),t=(null==e?void 0:e.getSelectionRows())||[];te.value=t.map((e=>e.id)),Z.value=!0;try{await z(te.value),Z.value=!1,B()}catch(a){Z.value=!1,B()}})()};return(t,a)=>(s(),p(n,null,[o(m(e),null,{default:u((()=>[o(m(h),{gutter:20,style:{"margin-bottom":"15px"}},{default:u((()=>[o(m(b),{span:1},{default:u((()=>[o(m(x),{class:"mx-1",style:{position:"relative",top:"8px",left:"30%"}},{default:u((()=>[d(c(m(F)("fingerprint.name"))+" :",1)])),_:1})])),_:1}),o(m(b),{span:5},{default:u((()=>[o(m(g),{modelValue:I.value,"onUpdate:modelValue":a[0]||(a[0]=e=>I.value=e),placeholder:m(F)("common.inputText"),style:{height:"38px"}},null,8,["modelValue","placeholder"])])),_:1}),o(m(b),{span:5},{default:u((()=>[o(m(f),{type:"primary",icon:m(j),style:{height:"38px"},onClick:L},{default:u((()=>[d("Search")])),_:1},8,["icon"])])),_:1})])),_:1}),o(m(h),{gutter:60},{default:u((()=>[o(m(b),{span:1},{default:u((()=>[y("div",A,[o(m(f),{type:"primary",onClick:J},{default:u((()=>[d(c(m(F)("common.new")),1)])),_:1})])])),_:1}),o(m(b),{span:1},{default:u((()=>[y("div",U,[o(m(r),{type:"danger",loading:Z.value,onClick:ae},{default:u((()=>[d(c(m(F)("common.delete")),1)])),_:1},8,["loading"])])])),_:1})])),_:1}),o(m(w),{pageSize:m(q),"onUpdate:pageSize":a[1]||(a[1]=e=>_(q)?q.value=e:null),currentPage:m(O),"onUpdate:currentPage":a[2]||(a[2]=e=>_(O)?O.value=e:null),columns:P,data:m(H),stripe:"",border:!0,loading:m(T),resizable:!0,pagination:{total:m(M),pageSizes:[10,20,50,100,200,500,1e3]},onRegister:m(R),headerCellStyle:X,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,["pageSize","currentPage","columns","data","loading","pagination","onRegister"])])),_:1}),o(m(S),{modelValue:G.value,"onUpdate:modelValue":a[3]||(a[3]=e=>G.value=e),title:m(Q).id?t.$t("common.edit"):t.$t("common.new"),center:"",style:{"border-radius":"15px","box-shadow":"5px 5px 10px rgba(0, 0, 0, 0.3)"},maxHeight:350},{default:u((()=>[o(E,{closeDialog:K,fingerprintForm:m(Q),getList:m(B)},null,8,["fingerprintForm","getList"])])),_:1},8,["modelValue","title"])],64))}});export{F as default};