← Back
Editing: index89.js
import{c as e,bR as t,e as s,m as a,aV as n,i,s as r,j as l,r as o,B as c,F as d,w as u,q as p,v as m,A as x,y as f,z as _,x as v,C as h}from"./base-lib.js?v=VERSION_NUMBER";import{_ as b}from"./index399.js?v=VERSION_NUMBER";import{_ as w}from"./version-compare.vue_vue_type_script_setup_true_lang.js?v=VERSION_NUMBER";import{w as g,fI as k,fJ as j,b as y,fr as q,N as C,u as H,fj as D}from"./utils-lib.js?v=VERSION_NUMBER";import{u as I}from"./column.js?v=VERSION_NUMBER";import{A as O}from"./validator.js?v=VERSION_NUMBER";import"./__commonjsHelpers__.js?v=VERSION_NUMBER";import"./index104.js?v=VERSION_NUMBER";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:T}=y(),W=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)])}},I([{width:100,disabled:!0,isHide:e=>e.is_default&&!a.value,render:()=>s("span",null,[c("默认磁盘")])},{title:"重启服务",width:100,onClick:()=>O(),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 T(t),r()},u=async e=>{const t=await j({mountpoint:e.mountpoint});await T(t),r(),a.value=!0};return{defaultDiskInfo:e,columns:n,diskColor:i,refreshInfo:t,refreshList:r,getDiskList:async()=>{const{data:t}=await q();if(C(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}}}})),F={class:"p-[10px]"},N={class:"flex items-center mb-[16px]"},A={class:"flex-1"},B={class:"flex items-center mb-[16px]"},L={class:"flex-1"},M={class:"flex items-center mb-[16px]"},R={class:"flex w-[50rem]"},E={class:"mr-[2rem] max-w-[20rem] w-[16rem]"},V={class:"flex-1"},z={class:"flex items-center mb-[16px]"},G={class:"flex w-[50rem]"},J={class:"mr-[2rem] max-w-[20rem] w-[16rem]"},P={class:"flex-1"},K={key:0,class:"text-center text-danger"},Q=e({__name:"index",setup(e){const{mainHeight:t}=H(),{columns:a,getDiskList:n,defaultDiskInfo:i,diskColor:l,refreshInfo:o}=(()=>{const e=W(),t=r(e);return{...e,...t}})(),{BtTable:c,refresh:d}=D({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-[14px]"},"创建用户时,用户信息将存储在此空间中",-1)),f("div",F,[f("div",N,[a[1]||(a[1]=f("div",{class:"w-[150px] font-black text-[14px] text-right h-[24px]"},"默认磁盘配额:",-1)),f("div",A,_(v(i).mountpoint),1)]),f("div",B,[a[2]||(a[2]=f("div",{class:"w-[150px] font-black text-[14px] text-right h-[24px]"},"装配:",-1)),f("div",L,_(v(i).device),1)]),f("div",M,[a[3]||(a[3]=f("div",{class:"w-[150px] font-black text-[14px] text-right h-[24px]"},"已使用:",-1)),f("div",R,[f("div",E,_(v(g)(v(i).used))+"/ "+_(v(g)(v(i).total)),1),f("div",V,[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-[14px] text-right h-[24px]"},"已分配:",-1)),f("div",G,[f("div",J,_(v(g)(v(i).account_allocate))+"/ "+_(v(g)(v(i).total)),1),f("div",P,[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",K,"PS:您的空间分配已达上限")):h("",!0)])])])])])),_:1}),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{Q as default};
Save File
Cancel