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