import{d,n as P,o as C,p as v,c as e,q as g,s as z,v as V,F as x,w as b,N as w,M as k,f as A,x as O,I as _,B as m,k as f,l as R}from"./main-4801cc52.js";import{a as j,b as E,u as G}from"./index-5086680f.js";import{C as c,F as N,P as U,a as B,T}from"./index-0c31c85b.js";import{F as u}from"./Form-46ad1153.js";import{S as q}from"./index-33c9ec48.js";import"./index-b08a7613.js";import"./useFlexGapSupport-310043de.js";import"./collapseMotion-14d9ada7.js";import"./index-00053b44.js";import"./Col-7508b53a.js";var $=function(){return{prefixCls:String,title:g.any,description:g.any,avatar:g.any}};const D=d({compatConfig:{MODE:3},name:"ACardMeta",props:$(),slots:["title","description","avatar"],setup:function(o,n){var i=n.slots,a=P("card",o),s=a.prefixCls;return function(){var l=C({},"".concat(s.value,"-meta"),!0),r=v(i,o,"avatar"),p=v(i,o,"title"),I=v(i,o,"description"),S=r?e("div",{class:"".concat(s.value,"-meta-avatar")},[r]):null,y=p?e("div",{class:"".concat(s.value,"-meta-title")},[p]):null,F=I?e("div",{class:"".concat(s.value,"-meta-description")},[I]):null,M=y||F?e("div",{class:"".concat(s.value,"-meta-detail")},[y,F]):null;return e("div",{class:l},[S,M])}}});var L=function(){return{prefixCls:String,hoverable:{type:Boolean,default:!0}}};const h=d({compatConfig:{MODE:3},name:"ACardGrid",__ANT_CARD_GRID:!0,props:L(),setup:function(o,n){var i=n.slots,a=P("card",o),s=a.prefixCls,l=z(function(){var r;return r={},C(r,"".concat(s.value,"-grid"),!0),C(r,"".concat(s.value,"-grid-hoverable"),o.hoverable),r});return function(){var r;return e("div",{class:l.value},[(r=i.default)===null||r===void 0?void 0:r.call(i)])}}});c.Meta=D;c.Grid=h;c.install=function(t){return t.component(c.name,c),t.component(D.name,D),t.component(h.name,h),t};u.useInjectFormItemContext=V;u.ItemRest=x;u.install=function(t){return t.component(u.name,u),t.component(u.Item.name,u.Item),t.component(x.name,x),t};const H=d({props:{text:b(),data:b()},emits:["change"],setup(t,{emit:o}){const n=async()=>{const[a]=await j.selectFile({accept:"*"});o("change",a)},i=a=>{if(typeof a=="string"){const s=a.lastIndexOf("/");return s==-1?"":a.substring(s+1)}return a.name};return()=>e("div",{class:J,onClick:n},[e("div",{class:"wapper"},[t.data?e("div",{class:"file"},[e(N,null,null),e("div",{class:"up_txt"},[i(t.data)])]):e("div",{class:"no_value"},[e(U,null,null),e("div",{class:"up_txt"},[t.text])])])])}}),J="iv8jxc8";const K=d({props:{data:w()},setup(t){const o=k.use(),n=A({formData:{name:"",size:0,url:"",version:"",file:"",...t.data}}),i=O(),a=()=>{var l;(l=i.value)==null||l.validate().then(async()=>{const r=n.formData.url;if(typeof r=="string"){o.submit(n.formData);return}new FormData().append("file",r),n.formData.size=r.size+"",n.formData.file=r,n.formData.url="",o.submit(n.formData)})},s=l=>{n.formData.url=l};return()=>e("div",null,[e("div",{class:Q},[e("div",{class:"form_box"},[e(u,{ref:i,layout:"vertical",model:n.formData,labelCol:{span:24},wrapperCol:{span:24}},{default:()=>[e(u.Item,{label:"压缩包",name:"url",rules:[{required:!0,message:"请上传压缩包",trigger:"change"}]},{default:()=>[e("div",{class:"h-100px"},[e(H,{data:n.formData.url,text:"上传压缩包",onChange:s},null)])]}),e(u.Item,{label:"版本名称",name:"name",rules:[{required:!0,message:"版本名称不能为空",trigger:"change"}]},{default:()=>[e(_,{placeholder:"请输入版本名称",value:n.formData.name,"onUpdate:value":l=>n.formData.name=l},null)]}),e(u.Item,{label:"版本号",name:"version",rules:[{required:!0,message:"版本号不能为空",trigger:"change"}]},{default:()=>[e(_,{placeholder:"请输入版本号",value:n.formData.version,"onUpdate:value":l=>n.formData.version=l},null)]})]})]),e("div",{class:"footer"},[e(m,{type:"primary",block:!0,onClick:a},{default:()=>[f("保存")]})])])])}}),Q="m53krek";const oe=d({setup(){const t=E(),o=G();t.getVersionList();const n=[{title:"版本名称",dataIndex:"name"},{title:"版本号",dataIndex:"version"},{title:"压缩包地址",dataIndex:"url",customRender:({record:a})=>e("a",{href:a.url,title:"点击下载",type:"download"},[a.url])},{title:"操作",customRender:({record:a})=>e(q,null,{default:()=>[e(m,{type:"link",onClick:()=>{i(a)}},{default:()=>[f("编辑")]}),e(m,{danger:!0,type:"link",onClick:()=>{t.deleteVersion(a)}},{default:()=>[f("删除")]})]})}],i=async a=>{const s=R.cloneDeep(a),l=await k.show(e(K,{data:s},null),{title:a._id?"编辑版本":"添加版本"});t.addOrUpdateVersion(l)};return()=>e(c,{class:W},{default:()=>[e(B,{title:"版本管理"},{extra:()=>{if(o.isAdmin)return e(m,{type:"primary",onClick:()=>{i({})}},{default:()=>[f("＋ 上传版本")]})}}),e(T,{class:"banner_table",bordered:!0,size:"small",pagination:{size:"small",showSizeChanger:!1,hideOnSinglePage:!0,pageSize:t.$state.size,total:t.$state.total,onChange:a=>t.getVersionList(a)},columns:n,dataSource:t.$state.list},null)]})}}),W="pfvoc72";export{oe as default};
