diff --git a/project/oms/apps/develop/AppDeployCustom/list.vue b/project/oms/apps/develop/AppDeployCustom/list.vue
index e7793204..eeb1259c 100644
--- a/project/oms/apps/develop/AppDeployCustom/list.vue
+++ b/project/oms/apps/develop/AppDeployCustom/list.vue
@@ -6,10 +6,12 @@
添加
-
+
-
+
{
- if (res?.data) {
- const data = JSON.parse(res.data)
- if (data.code == '0') {
- row.count = data.progress
- if (row.count == 100) {
- row.count = 0
- this.$message.success("打包成功!")
- this.refreshRow(row, data.remark)
- }
- } else if (data.code == 1) {
- row.count = 0
- this.$message.error("打包失败!")
- this.refreshRow(row, data.row)
- }
- }
- }
- this.ws[id].onclose = () => {
- row.count = 0
- this.ws[id].close()
- delete this.ws[id]
- }
- } else this.ws[id]?.send(JSON.stringify({id}))
+ if (!this.ws) {
+ this.initWs()
+ }
+ this.ws?.send(JSON.stringify({action: "/custom/getZip", id}))
},
refreshRow(row, v) {
row.error = v.error
@@ -146,9 +127,10 @@ export default {
},
handleCancelUpdate(row) {
let {id} = row
- this.ws[id].send(JSON.stringify({
- cid: id
- }))
+ if (!this.ws) {
+ this.initWs()
+ }
+ this.ws.send(JSON.stringify({action: "/custom/getZip", cid: id}))
},
getRowById(id) {
return this.instance.post("/node/custom/detail", null, {
@@ -165,13 +147,38 @@ export default {
this.$message.success("消息发送成功!")
}
})
+ },
+ initWs() {
+ this.ws = new WebSocket(`ws://192.168.1.87:12525/ws`)
+ this.ws.onmessage = res => {
+ if (res?.data) {
+ const data = JSON.parse(res.data),
+ row = this.tableData.find(e => e.id == data?.row.id)
+ if (data.code == '0') {
+ row.count = data.progress
+ if (row.count == 100) {
+ row.count = 0
+ this.$message.success("打包成功!")
+ this.refreshRow(row, data.row)
+ }
+ } else if (data.code == 1) {
+ row.count = 0
+ this.$message.error("打包失败!")
+ this.refreshRow(row, data.row)
+ }
+ }
+ }
+ this.ws.onclose = () => {
+ this.tableData.map(e => e.count = 0)
+ this.ws.close()
+ }
}
},
created() {
this.getTableData()
},
beforeDestroy() {
- Object.values(this.ws).map(t => t.close())
+ this.ws?.close()
}
}