优化弹窗提示

This commit is contained in:
24kycj
2024-12-08 10:27:05 +08:00
parent dddb5dd918
commit f933a19025
2 changed files with 251 additions and 108 deletions
+78 -6
View File
@@ -484,6 +484,14 @@ export default {
}, },
'$store.state.chat.isConnect': { '$store.state.chat.isConnect': {
handler(val) { handler(val) {
console.log(val, 'isConnect')
if (val) {
this.$message({
message: '服务已连接',
type: 'success'
})
this.serviceLoading = false
}
this.isConnect = val this.isConnect = val
}, },
deep: true, deep: true,
@@ -531,17 +539,17 @@ export default {
methods: { methods: {
// 服务打开/关闭 // 服务打开/关闭
serviceChange(e) { serviceChange(e) {
if (!that.serviceStatus) { // if (!that.serviceStatus) {
return // return
} // }
console.log(e)
that.serviceLoading = true that.serviceLoading = true
if (e) { if (e) {
that.serviceTextex = '服务启动中' that.serviceText = '服务启动中'
this.$runCmd(`bash ${shPath} start`).then(res => { this.$runCmd(`bash ${shPath} start`).then(res => {
that.$store.dispatch('chat/changeWorkStatus', true) that.$store.dispatch('chat/changeWorkStatus', true)
setTimeout(() => { setTimeout(() => {
that.$store.dispatch('chat/initWebSocket') that.$store.dispatch('chat/initWebSocket')
that.serviceLoading = false
}, 500); }, 500);
}).catch(err => { }).catch(err => {
that.$message({ that.$message({
@@ -551,12 +559,16 @@ export default {
that.serviceLoading = false that.serviceLoading = false
}) })
} else { } else {
that.serviceTextex = '服务关闭中' that.serviceText = '服务关闭中'
this.$runCmd(`bash ${shPath} stop`).then(res => { this.$runCmd(`bash ${shPath} stop`).then(res => {
that.$store.dispatch('chat/changeWorkStatus', false) that.$store.dispatch('chat/changeWorkStatus', false)
setTimeout(() => { setTimeout(() => {
that.$store.dispatch('chat/closeWebsocket') that.$store.dispatch('chat/closeWebsocket')
that.serviceLoading = false that.serviceLoading = false
that.$message({
message: '服务已关闭',
type: 'success'
})
}, 500); }, 500);
}).catch(err => { }).catch(err => {
that.$message({ that.$message({
@@ -591,6 +603,11 @@ export default {
switch (that.runVal) { switch (that.runVal) {
case 1: case 1:
// 重启设备 // 重启设备
that.$confirm('确定执行重启设备操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.$store.dispatch('chat/websocketsend', { that.$store.dispatch('chat/websocketsend', {
req_name: 'resetPrinter', req_name: 'resetPrinter',
req_type: 2, req_type: 2,
@@ -601,9 +618,26 @@ export default {
type: 'success' type: 'success'
}) })
}) })
})
break; break;
case 2: case 2:
// 清除错误 // 清除错误
that.$confirm('确定执行清除错误操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.$store.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev',
req_type: 2,
req_info: {}
}).then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
})
that.$store.dispatch('chat/websocketsend', { that.$store.dispatch('chat/websocketsend', {
req_name: 'cleanError', req_name: 'cleanError',
req_type: 2, req_type: 2,
@@ -617,6 +651,22 @@ export default {
break; break;
case 3: case 3:
// 校准盘仓 // 校准盘仓
that.$confirm('确定执行校准盘仓操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.$store.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev',
req_type: 2,
req_info: {}
}).then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
})
that.$store.dispatch('chat/websocketsend', { that.$store.dispatch('chat/websocketsend', {
req_name: 'CaliCDStone', req_name: 'CaliCDStone',
req_type: 2, req_type: 2,
@@ -630,6 +680,22 @@ export default {
break; break;
case 4: case 4:
// 校准设备 // 校准设备
that.$confirm('确定执行校准设备操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.$store.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev',
req_type: 2,
req_info: {}
}).then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
})
that.$store.dispatch('chat/websocketsend', { that.$store.dispatch('chat/websocketsend', {
req_name: 'CaliPrinter', req_name: 'CaliPrinter',
req_type: 1, req_type: 1,
@@ -643,6 +709,11 @@ export default {
break; break;
case 5: case 5:
// 自动匹配光驱 // 自动匹配光驱
that.$confirm('确定执行自动匹配光驱操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.$store.dispatch('chat/websocketsend', { that.$store.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev', req_name: 'autoSetCDDev',
req_type: 2, req_type: 2,
@@ -653,6 +724,7 @@ export default {
type: 'success' type: 'success'
}) })
}) })
})
break; break;
case 6: case 6:
outTimer = setTimeout(() => { outTimer = setTimeout(() => {
+98 -27
View File
@@ -162,7 +162,7 @@ export default {
{ {
id: 2, id: 2,
name: '自动设置光驱' name: '自动设置光驱'
}, }
], ],
serviceList: [ serviceList: [
{ {
@@ -176,7 +176,7 @@ export default {
{ {
id: 3, id: 3,
name: '进入运输模式' name: '进入运输模式'
}, }
], ],
refreshTime: 10, refreshTime: 10,
sleepTime: 300000, sleepTime: 300000,
@@ -239,10 +239,18 @@ export default {
methods: { methods: {
// 校准设备 // 校准设备
handleMove(e) { handleMove(e) {
let that = this
switch (e.id) { switch (e.id) {
case 1: case 1:
// 校准设备 // 校准设备
this.$store that
.$confirm('确定执行校准设备操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.$store
.dispatch('chat/websocketsend', { .dispatch('chat/websocketsend', {
req_name: 'CaliPrinter', req_name: 'CaliPrinter',
req_type: 2, req_type: 2,
@@ -251,15 +259,23 @@ export default {
} }
}) })
.then(() => { .then(() => {
this.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
})
break break
case 2: case 2:
// 校准上光驱 // 校准上光驱
this.$store that
.$confirm('确定执行校准上光驱操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.$store
.dispatch('chat/websocketsend', { .dispatch('chat/websocketsend', {
req_name: 'CaliPrinter', req_name: 'CaliPrinter',
req_type: 2, req_type: 2,
@@ -268,15 +284,23 @@ export default {
} }
}) })
.then(() => { .then(() => {
this.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
})
break break
case 3: case 3:
// 校准下光驱 // 校准下光驱
this.$store that
.$confirm('确定执行校准下光驱操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.$store
.dispatch('chat/websocketsend', { .dispatch('chat/websocketsend', {
req_name: 'CaliPrinter', req_name: 'CaliPrinter',
req_type: 2, req_type: 2,
@@ -285,99 +309,146 @@ export default {
} }
}) })
.then(() => { .then(() => {
this.$message({ that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
})
break break
case 4: case 4:
// 校准盘仓 // 校准盘仓
this.$store.dispatch('chat/websocketsend', { that
.$confirm('确定执行校准盘仓操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'CaliCDStone', req_name: 'CaliCDStone',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
this.$message({ .then(() => {
that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
})
break break
} }
}, },
// 设置设备 // 设置设备
handleAction(e) { handleAction(e) {
let that = this
switch (e.id) { switch (e.id) {
case 1: case 1:
// 手动设置光驱 // 手动设置光驱
this.$store that.$store
.dispatch('chat/websocketsend', { .dispatch('chat/websocketsend', {
req_name: 'get_all_cd', req_name: 'get_all_cd',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}) })
.then(() => { .then(() => {
this.cdShow = true that.cdShow = true
}) })
break break
case 2: case 2:
// 自动设置光驱 // 自动设置光驱
this.$store.dispatch('chat/websocketsend', { that
.$confirm('确定执行自动设置光驱操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev', req_name: 'autoSetCDDev',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
this.$message({ .then(() => {
that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
})
break break
} }
}, },
// 维护设备 // 维护设备
handleService(e) { handleService(e) {
let that = this
switch (e.id) { switch (e.id) {
case 1: case 1:
// 重启设备 // 重启设备
this.$store.dispatch('chat/websocketsend', { that
.$confirm('确定执行重启设备操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'resetPrinter', req_name: 'resetPrinter',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
this.$message({ .then(() => {
that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
})
break break
case 2: case 2:
// 清除错误 // 清除错误
this.$store.dispatch('chat/websocketsend', { that
.$confirm('确定执行清除错误操作吗?', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'cleanError', req_name: 'cleanError',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
this.$message({ .then(() => {
that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })
}) })
})
break break
case 3: case 3:
// 进入运输模式 // 进入运输模式
this.$confirm('请确保已经取掉左右光盘仓托架,再点击确定', '温馨提示', { that
.$confirm('请确保已经取掉左右光盘仓托架,再点击确定', '温馨提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { })
this.$store.dispatch('chat/websocketsend', { .then(() => {
that.$store
.dispatch('chat/websocketsend', {
req_name: 'TransportMode', req_name: 'TransportMode',
req_type: 2, req_type: 2,
req_info: {} req_info: {}
}).then(() => { })
this.$message({ .then(() => {
that.$message({
message: '执行成功', message: '执行成功',
type: 'success' type: 'success'
}) })