修复打包的问题
This commit is contained in:
@@ -39,6 +39,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {resolve} from "../../../../../../dvcp_v2_wechat_app/dist/dev/mp-weixin/common/vendor";
|
||||
|
||||
export default {
|
||||
name: "list",
|
||||
props: {
|
||||
@@ -110,10 +112,7 @@ export default {
|
||||
},
|
||||
handleUpdate(row) {
|
||||
let {id} = row
|
||||
if (!this.ws) {
|
||||
this.initWs()
|
||||
}
|
||||
this.ws?.send(JSON.stringify({action: "/custom/getZip", id}))
|
||||
this.initWs().then(() => this.ws?.send(JSON.stringify({action: "/custom/getZip", id})))
|
||||
},
|
||||
refreshRow(row, v) {
|
||||
row.error = v.error
|
||||
@@ -127,10 +126,7 @@ export default {
|
||||
},
|
||||
handleCancelUpdate(row) {
|
||||
let {id} = row
|
||||
if (!this.ws) {
|
||||
this.initWs()
|
||||
}
|
||||
this.ws.send(JSON.stringify({action: "/custom/getZip", cid: id}))
|
||||
this.initWs().then(() => this.ws.send(JSON.stringify({action: "/custom/getZip", cid: id})))
|
||||
},
|
||||
getRowById(id) {
|
||||
return this.instance.post("/node/custom/detail", null, {
|
||||
@@ -149,29 +145,35 @@ export default {
|
||||
})
|
||||
},
|
||||
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) {
|
||||
return !this.ws ? new Promise(resolve => {
|
||||
this.ws = new WebSocket(`ws://localhost:12525/ws`)
|
||||
this.ws.onopen = () => resolve()
|
||||
this.ws.onmessage = res => {
|
||||
if (this.$checkJson(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.success("打包成功!")
|
||||
this.$message.error("打包失败!")
|
||||
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()
|
||||
}
|
||||
this.ws.onclose = () => {
|
||||
this.tableData.map(e => e.count = 0)
|
||||
this.ws.close()
|
||||
}
|
||||
this.ws.onerror = () => {
|
||||
this.ws.close()
|
||||
}
|
||||
}) : Promise.resolve()
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
Reference in New Issue
Block a user