Merge branch 'build' of http://git.sinoecare.com/sinoecare/digital_village_v2/dvcp_v2_webapp into build
This commit is contained in:
@@ -6,10 +6,12 @@
|
|||||||
<ai-search-bar>
|
<ai-search-bar>
|
||||||
<template #left>
|
<template #left>
|
||||||
<el-button type="primary" icon="iconfont iconAdd" @click="handleAdd()">添加</el-button>
|
<el-button type="primary" icon="iconfont iconAdd" @click="handleAdd()">添加</el-button>
|
||||||
<ai-select placeholder="系统类型" v-model="search.type" :selectList="dict.getDict('systemType')" @change="page.current=1,getTableData()"/>
|
<ai-select placeholder="系统类型" v-model="search.type" :selectList="dict.getDict('systemType')"
|
||||||
|
@change="page.current=1,getTableData()"/>
|
||||||
</template>
|
</template>
|
||||||
<template #right>
|
<template #right>
|
||||||
<el-input size="small" placeholder="搜索" v-model="search.name" clearable @change="page.current=1,getTableData()"/>
|
<el-input size="small" placeholder="搜索" v-model="search.name" clearable
|
||||||
|
@change="page.current=1,getTableData()"/>
|
||||||
</template>
|
</template>
|
||||||
</ai-search-bar>
|
</ai-search-bar>
|
||||||
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
|
<ai-table :tableData="tableData" :total="page.total" :current.sync="page.current" :size.sync="page.size"
|
||||||
@@ -57,7 +59,7 @@ export default {
|
|||||||
{prop: "dist", label: "更新路径"},
|
{prop: "dist", label: "更新路径"},
|
||||||
{slot: 'process'},
|
{slot: 'process'},
|
||||||
],
|
],
|
||||||
ws: {}
|
ws: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -108,31 +110,10 @@ export default {
|
|||||||
},
|
},
|
||||||
handleUpdate(row) {
|
handleUpdate(row) {
|
||||||
let {id} = row
|
let {id} = row
|
||||||
if (!this.ws[id]) {
|
if (!this.ws) {
|
||||||
this.ws[id] = new WebSocket(`ws://192.168.1.87:12525/custom/getZip?id=${id}`)
|
this.initWs()
|
||||||
this.ws[id].onmessage = res => {
|
}
|
||||||
if (res?.data) {
|
this.ws?.send(JSON.stringify({action: "/custom/getZip", id}))
|
||||||
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}))
|
|
||||||
},
|
},
|
||||||
refreshRow(row, v) {
|
refreshRow(row, v) {
|
||||||
row.error = v.error
|
row.error = v.error
|
||||||
@@ -146,9 +127,10 @@ export default {
|
|||||||
},
|
},
|
||||||
handleCancelUpdate(row) {
|
handleCancelUpdate(row) {
|
||||||
let {id} = row
|
let {id} = row
|
||||||
this.ws[id].send(JSON.stringify({
|
if (!this.ws) {
|
||||||
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, {
|
||||||
@@ -165,13 +147,38 @@ export default {
|
|||||||
this.$message.success("消息发送成功!")
|
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() {
|
created() {
|
||||||
this.getTableData()
|
this.getTableData()
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
Object.values(this.ws).map(t => t.close())
|
this.ws?.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user