import{d as p,a as m}from"./index.DLhCD1Qz.js";import{_ as c}from"./yb_admin_plugin.DNFUAscl.js";import{aZ as r,aL as f,u as _,I as i,bJ as s,H as a,bb as u,v as g}from"./@vue.Da0bZ210.js";import"./vue.Bj6dTZYa.js";import"./@element-plus.pQhr8KT1.js";import"./echarts.Dms41JYJ.js";import"./tslib.BDyQ-Jie.js";import"./zrender.BueMfJu3.js";import"./axios.BjtuyMK1.js";import"./pinia.Tngw-S_5.js";import"./vue-router.DaVMGKLh.js";import"./element-plus.DC208N5p.js";import"./lodash-es.DVGGNlzX.js";import"./@vueuse.BhH-hw9p.js";import"./async-validator.9PlIezaS.js";import"./@popperjs.C5az9QE8.js";import"./@ctrl.C4Rzlq_k.js";import"./dayjs.BLMYetss.js";import"./memoize-one.BdPwpGay.js";import"./normalize-wheel-es.BQoi3Ox2.js";import"./@floating-ui.DCXYYTka.js";import"./vue-i18n.C7BagGww.js";import"./@intlify.TnaUIxGf.js";import"./moment.C5S46NFB.js";const h={name:"Download",components:{},props:{edit:{type:Object,default:()=>({id:0})},type:{type:String,default:()=>""}},data(){return{key:"",file_size:0,percent:0}},computed:{},created(){this.download("prepare-download")},methods:{download(t){m({file_action:t,plugin_flag:this.edit.plugin_flag,cur_version:this.edit.cur_version,key:this.key}).then(e=>{console.log(e),t=="prepare-download"?(this.key=e.data.key,this.file_size=e.data.file_size,this.download("start-download")):t=="start-download"?this.download("get-file-size"):t=="get-file-size"&&(this.percent=Number((Number(e.data.size)/this.file_size*100).toFixed(2)),Number(e.data.size)===this.file_size?this.downloadUpdate():this.timer=setTimeout(()=>{this.download("get-file-size")},300))})},downloadUpdate(){this.$baseLoading("正在升级数据库,请等待..."),this.edit,p({plugin_flag:this.edit.plugin_flag,plugin_file:this.edit.plugin_file,version:this.edit.version,key:this.key,type:this.type}).then(t=>{this.$baseLoadingClose(),this.callBack&&this.callBack()}).catch(t=>{this.$baseLoadingClose(),this.callBack&&this.callBack()})}}},w={style:{"margin-left":"10px",flex:"1"}};function y(t,e,l,k,d,b){const o=r("el-tag"),n=r("el-progress");return f(),_("div",null,[i(o,{class:"el_tag",style:{"font-size":"16px"},type:"success"},{default:s(()=>[a(" 应用名称:"+u(l.edit.name),1)]),_:1}),i(o,{class:"el_tag",type:"warning"},{default:s(()=>[...e[0]||(e[0]=[a(" 正在更新系统文件,请不要关闭窗口 ",-1)])]),_:1}),i(o,{class:"el_tag progress",color:"#d4eaf6"},{default:s(()=>[e[1]||(e[1]=a(" 下载进度 ",-1)),g("div",w,[i(n,{percentage:d.percent,"stroke-width":24,"text-inside":!0,status:"success"},null,8,["percentage"])])]),_:1})])}const K=c(h,[["render",y],["__scopeId","data-v-9a3b251d"]]);export{K as default};
