ScopeSentry/static/assets/PortDictionary-C-NULnlx.js

2 lines
4.8 KiB
JavaScript

import{_ as e}from"./ContentWrap.vue_vue_type_script_setup_true_lang-BgCcO80c.js";import{d as t,r as a,s as l,e as o,H as i,F as s,C as r,o as n,c as p,w as u,a as m,y as d,L as c,M as g,f,t as v,N as _,O as y,l as j}from"./index-B4Nyjh3H.js";import{a as b,E as x}from"./el-col-ChTZtubL.js";import{_ as h}from"./Table.vue_vue_type_script_lang-DkXax4KK.js";import{_ as S}from"./Dialog.vue_vue_type_style_index_0_lang-bTolZCeI.js";import{u as w}from"./useIcon-DitchYFS.js";import{u as k}from"./useTable-CG-SPGP0.js";import{d as C,b as D}from"./index-Bm26evLc.js";import{_ as E}from"./PortDetail.vue_vue_type_script_setup_true_lang-CnUSGKC-.js";import"./el-card-wk8kGoMw.js";import"./el-tooltip-l0sNRNKZ.js";import"./el-popper-DBt0ZFPB.js";import"./el-table-column-D5fUDOpn.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-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"./index-CdbOSPly.js";import"./el-form-DDCfLIJB.js";import"./el-divider-C1wqG4VS.js";const z={class:"mb-10px"},P={class:"mb-10px"};function A(e){return"function"==typeof e||"[object Object]"===Object.prototype.toString.call(e)&&!y(e)}const U=t({__name:"PortDictionary",setup(t){const{t:y}=j(),U=w({icon:"iconoir:search"}),V=a(""),L=()=>{q()},R=l([{field:"selection",type:"selection",width:"55"},{field:"id",hidden:!0},{field:"name",label:y("portDict.name"),minWidth:40},{field:"value",label:y("portDict.value")},{field:"action",label:y("tableDemo.action"),minWidth:40,formatter:(e,t,a)=>{let l,r;return o(s,null,[o(i,{type:"primary",onClick:()=>Y(e)},A(l=y("common.edit"))?l:{default:()=>[l]}),o(i,{type:"danger",onClick:()=>$(e)},A(r=y("common.delete"))?r:{default:()=>[r]})])}}]),{tableRegister:T,tableState:F,tableMethods:I}=k({fetchDataApi:async()=>{const{currentPage:e,pageSize:t}=F,a=await D(V.value,e.value,t.value);return{list:a.data.list,total:a.data.total}}}),{loading:N,dataList:H,total:M,currentPage:O,pageSize:W}=F,{getList:q,getElTableExpose:B}=I;function X(){return{background:"var(--el-fill-color-light)"}}const G=a(!1),J=async()=>{Q.id="",Q.value="",Q.name="",G.value=!0},K=()=>{G.value=!1};let Q=l({id:"",name:"",value:""});const Y=e=>{Q.id=e.id,Q.value=e.value,Q.name=e.name,G.value=!0},Z=a(!1),$=async e=>{Z.value=!0;try{await C([e.id]);Z.value=!1,q()}catch(t){Z.value=!1,q()}},ee=a([]),te=async()=>{window.confirm("Are you sure you want to delete the selected data?")&&await(async()=>{const e=await B(),t=(null==e?void 0:e.getSelectionRows())||[];ee.value=t.map((e=>e.id)),Z.value=!0;try{await C(ee.value),Z.value=!1,q()}catch(a){Z.value=!1,q()}})()};return(t,a)=>{const l=r("ElText");return n(),p(s,null,[o(m(e),null,{default:u((()=>[o(m(b),{gutter:20,style:{"margin-bottom":"15px"}},{default:u((()=>[o(m(x),{span:1.5},{default:u((()=>[o(l,{class:"mx-1",style:{position:"relative",top:"8px"}},{default:u((()=>[d("Search :")])),_:1})])),_:1}),o(m(x),{span:5},{default:u((()=>[o(m(c),{modelValue:V.value,"onUpdate:modelValue":a[0]||(a[0]=e=>V.value=e),placeholder:m(y)("common.inputText"),style:{height:"38px"}},null,8,["modelValue","placeholder"])])),_:1}),o(m(x),{span:5},{default:u((()=>[o(m(g),{type:"primary",icon:m(U),style:{height:"38px"},onClick:L},{default:u((()=>[d("Search")])),_:1},8,["icon"])])),_:1})])),_:1}),o(m(b),{gutter:60},{default:u((()=>[o(m(x),{span:1},{default:u((()=>[f("div",z,[o(m(g),{type:"primary",onClick:J},{default:u((()=>[d(v(m(y)("common.new")),1)])),_:1})])])),_:1}),o(m(x),{span:1},{default:u((()=>[f("div",P,[o(m(i),{type:"danger",loading:Z.value,onClick:te},{default:u((()=>[d(v(m(y)("common.delete")),1)])),_:1},8,["loading"])])])),_:1})])),_:1}),o(m(h),{pageSize:m(W),"onUpdate:pageSize":a[1]||(a[1]=e=>_(W)?W.value=e:null),currentPage:m(O),"onUpdate:currentPage":a[2]||(a[2]=e=>_(O)?O.value=e:null),columns:R,data:m(H),stripe:"",border:!0,loading:m(N),resizable:!0,pagination:{total:m(M),pageSizes:[10,20,50,100,200,500,1e3]},onRegister:m(T),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(y)("common.new"),center:"",style:{"border-radius":"15px","box-shadow":"5px 5px 10px rgba(0, 0, 0, 0.3)"},maxHeight:400},{default:u((()=>[o(E,{closeDialog:K,portDictForm:m(Q),getList:m(q)},null,8,["portDictForm","getList"])])),_:1},8,["modelValue","title"])],64)}}});export{U as default};