import{c as e,bT as t,e as s,m as a,aX as n,i,s as r,j as l,r as o,C as c,F as d,w as u,v as p,x as m,B as x,z as f,A as _,y as v,D as h}from"./base-lib.js?v=1761009159";import{_ as b}from"./index401.js?v=1761009159";import{_ as w}from"./version-compare.vue_vue_type_script_setup_true_lang.js?v=1761009159";import{x as g,gc as k,gd as j,b as y,fX as C,R as q,u as D,fO as H}from"./utils-lib.js?v=1761009159";import{u as O}from"./column.js?v=1761009159";import{A as T}from"./validator.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";const S=e({name:"BtCard",props:{...t},setup:(e,{attrs:t,slots:r})=>()=>{return s(n,a(t,e),"function"==typeof(l=r)||"[object Object]"===Object.prototype.toString.call(l)&&!i(l)?r:{default:()=>[r]});var l}}),{request:W}=y(),F=l("VHOST-STORAGE-STORE",()=>{const e=o({device:"",mountpoint:"",fstype:"",total:0,used:0,free:0,used_percent:0,inodes_total:0,inodes_used:0,inodes_free:0,inodes_used_percent:0,is_group_quota:!1,is_user_quota:!1,is_default:!1,account_allocate:0,account_percent:0}),t=o(0),a=o(!1),n=o([{label:"挂载点",prop:"mountpoint",minWidth:120},{label:"装置",prop:"device",minWidth:120},{label:"磁盘配额",prop:"is_group_quota",minWidth:140,render:e=>e.is_user_quota?s("span",null,[c("是")]):s("div",null,[s("span",{class:"text-warning"},[c("否")]),c(" |")," ",s("span",{class:"text-primary cursor-pointer",onClick:()=>l(e)},[c("设置磁盘配额")])])},{label:"总大小",prop:"total",minWidth:60,render:e=>g(e.total)},{label:"已使用",prop:"used",minWidth:180,render:e=>{const t=Math.round(e.used_percent);return s(d,null,[s("div",{class:"mr-[10px]"},[t,c("% / "),g(e.used)]),s(b,{class:"w-[100px]",percentage:Number(t.toFixed(2)),"text-inside":!0,"stroke-width":14,status:i(t)},null)])}},O([{width:100,disabled:!0,isHide:e=>e.is_default&&!a.value,render:()=>s("span",null,[c("默认磁盘")])},{title:"重启服务",width:100,onClick:()=>T(),isHide:e=>e.is_default&&!a.value},{title:"设置默认磁盘",width:100,onClick:e=>u(e),isHide:e=>e.is_default&&!a.value}])]),i=e=>{const t=Math.round(e);return t>80?"exception":t>60?"warning":"success"},r=()=>{t.value=(new Date).getTime()},l=async e=>{const t=await k(e.mountpoint);await W(t),r()},u=async e=>{const t=await j({mountpoint:e.mountpoint});await W(t),r(),a.value=!0};return{defaultDiskInfo:e,columns:n,diskColor:i,refreshInfo:t,refreshList:r,getDiskList:async()=>{const{data:t}=await C();if(q(t)){const s=t.find(e=>e.is_default);if(s){const t={...s};t.account_percent=Math.round(t.account_allocate/t.total*100),e.value=t}return{data:t,total:t.length}}return{data:[],total:0}}}}),I={class:"p-[10px]"},A={class:"flex items-center mb-[16px]"},B={class:"flex-1"},L={class:"flex items-center mb-[16px]"},M={class:"flex-1"},N={class:"flex items-center mb-[16px]"},R={class:"flex w-[50rem]"},E={class:"mr-[2rem] max-w-[20rem] w-[16rem]"},X={class:"flex-1"},z={class:"flex items-center mb-[16px]"},G={class:"flex w-[50rem]"},P={class:"mr-[2rem] max-w-[20rem] w-[16rem]"},V={class:"flex-1"},J={key:0,class:"text-center text-danger"},K=e({__name:"index",setup(e){const{mainHeight:t}=D(),{columns:a,getDiskList:n,defaultDiskInfo:i,diskColor:l,refreshInfo:o}=(()=>{const e=F(),t=r(e);return{...e,...t}})(),{BtTable:c,refresh:d}=H({request:n,columns:a.value});return u(()=>o.value,d),(e,a)=>{const n=b,r=S;return p(),m("div",null,[s(w),s(r,{class:"!border-none mb-[20px]"},{header:x(()=>a[0]||(a[0]=[f("div",{class:"card-header"},[f("span",null,"预设存储盘")],-1)])),default:x(()=>[a[5]||(a[5]=f("div",{class:"p-[16px] text-base"},"创建用户时，用户信息将存储在此空间中",-1)),f("div",I,[f("div",A,[a[1]||(a[1]=f("div",{class:"w-[150px] font-black text-base text-right h-[24px]"},"默认磁盘配额：",-1)),f("div",B,_(v(i).mountpoint),1)]),f("div",L,[a[2]||(a[2]=f("div",{class:"w-[150px] font-black text-base text-right h-[24px]"},"装配：",-1)),f("div",M,_(v(i).device),1)]),f("div",N,[a[3]||(a[3]=f("div",{class:"w-[150px] font-black text-base text-right h-[24px]"},"已使用：",-1)),f("div",R,[f("div",E,_(v(g)(v(i).used))+"/ "+_(v(g)(v(i).total)),1),f("div",X,[s(n,{percentage:Number(v(i).used_percent.toFixed(2)),"text-inside":"","stroke-width":18,status:v(l)(v(i).used_percent)},null,8,["percentage","status"])])])]),f("div",z,[a[4]||(a[4]=f("div",{class:"w-[150px] font-black text-base text-right h-[24px]"},"已分配：",-1)),f("div",G,[f("div",P,_(v(g)(v(i).account_allocate))+"/ "+_(v(g)(v(i).total)),1),f("div",V,[s(n,{percentage:Number((v(i).account_allocate/v(i).total*100).toFixed(2)),"text-inside":"","stroke-width":18,status:v(l)(v(i).account_percent)},null,8,["percentage","status"]),v(i).account_percent>100?(p(),m("div",J,"PS:您的空间分配已达上限")):h("",!0)])])])])]),_:1,__:[5]}),s(r,{class:"!border-none"},{header:x(()=>a[6]||(a[6]=[f("div",{class:"card-header"},[f("span",null,"可用存储盘")],-1)])),default:x(()=>[s(v(c),{class:"mt-[16px]","min-height":v(t)},null,8,["min-height"])]),_:1})])}}});export{K as default};
