优化打包流程

This commit is contained in:
aixianling
2022-03-31 18:23:20 +08:00
parent 3c8988afe2
commit fe10a5870c

View File

@@ -18,7 +18,8 @@
<template slot-scope="{row}"> <template slot-scope="{row}">
<el-button type="text" @click="handleEdit(row)">编辑</el-button> <el-button type="text" @click="handleEdit(row)">编辑</el-button>
<el-button type="text" @click="handleDelete(row.id)">删除</el-button> <el-button type="text" @click="handleDelete(row.id)">删除</el-button>
<el-button type="text" @click="handleDownload(row)">下载部署</el-button> <el-button type="text" @click="handleZip(row)"></el-button>
<el-button type="text" v-if="row.download" @click="handleDownload(row)">下载</el-button>
<el-button v-if="row.target" type="text" @click="handleDownload(row)">部署</el-button> <el-button v-if="row.target" type="text" @click="handleDownload(row)">部署</el-button>
</template> </template>
</el-table-column> </el-table-column>
@@ -91,6 +92,9 @@ export default {
}) })
}, },
handleDownload(row) { handleDownload(row) {
},
handleZip(row) {
let loading = this.$loading({ let loading = this.$loading({
lock: true, text: "正在打包文件...", lock: true, text: "正在打包文件...",
spinner: 'el-icon-loading', spinner: 'el-icon-loading',
@@ -99,11 +103,22 @@ export default {
this.instance.post("/node/autodeploy/getZip", null, { this.instance.post("/node/autodeploy/getZip", null, {
params: {id} params: {id}
}).then(res => { }).then(res => {
loading.close()
if (res?.code == 0) { if (res?.code == 0) {
let count = 0, timer = setInterval(() => {
if (count == 30) {
clearInterval(timer)
loading.close()
} else this.instance.post("/node/autodeploy/confirmZip", null, {
params: {id}
}).then(res => {
if (res?.code == 0) {
clearInterval(timer)
loading.close()
} else count++
}, 10000)
})
} }
}) }).catch(() => loading.close())
}, },
handleEdit(row) { handleEdit(row) {
this.form = JSON.parse(JSON.stringify(row)) this.form = JSON.parse(JSON.stringify(row))