优化弹窗提示
This commit is contained in:
@@ -484,6 +484,14 @@ export default {
|
||||
},
|
||||
'$store.state.chat.isConnect': {
|
||||
handler(val) {
|
||||
console.log(val, 'isConnect')
|
||||
if (val) {
|
||||
this.$message({
|
||||
message: '服务已连接',
|
||||
type: 'success'
|
||||
})
|
||||
this.serviceLoading = false
|
||||
}
|
||||
this.isConnect = val
|
||||
},
|
||||
deep: true,
|
||||
@@ -531,17 +539,17 @@ export default {
|
||||
methods: {
|
||||
// 服务打开/关闭
|
||||
serviceChange(e) {
|
||||
if (!that.serviceStatus) {
|
||||
return
|
||||
}
|
||||
// if (!that.serviceStatus) {
|
||||
// return
|
||||
// }
|
||||
console.log(e)
|
||||
that.serviceLoading = true
|
||||
if (e) {
|
||||
that.serviceTextex = '服务启动中'
|
||||
that.serviceText = '服务启动中'
|
||||
this.$runCmd(`bash ${shPath} start`).then(res => {
|
||||
that.$store.dispatch('chat/changeWorkStatus', true)
|
||||
setTimeout(() => {
|
||||
that.$store.dispatch('chat/initWebSocket')
|
||||
that.serviceLoading = false
|
||||
}, 500);
|
||||
}).catch(err => {
|
||||
that.$message({
|
||||
@@ -551,12 +559,16 @@ export default {
|
||||
that.serviceLoading = false
|
||||
})
|
||||
} else {
|
||||
that.serviceTextex = '服务关闭中'
|
||||
that.serviceText = '服务关闭中'
|
||||
this.$runCmd(`bash ${shPath} stop`).then(res => {
|
||||
that.$store.dispatch('chat/changeWorkStatus', false)
|
||||
setTimeout(() => {
|
||||
that.$store.dispatch('chat/closeWebsocket')
|
||||
that.serviceLoading = false
|
||||
that.$message({
|
||||
message: '服务已关闭',
|
||||
type: 'success'
|
||||
})
|
||||
}, 500);
|
||||
}).catch(err => {
|
||||
that.$message({
|
||||
@@ -591,19 +603,41 @@ export default {
|
||||
switch (that.runVal) {
|
||||
case 1:
|
||||
// 重启设备
|
||||
that.$store.dispatch('chat/websocketsend', {
|
||||
req_name: 'resetPrinter',
|
||||
req_type: 2,
|
||||
req_info: {}
|
||||
that.$confirm('确定执行重启设备操作吗?', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
that.$message({
|
||||
message: '执行成功',
|
||||
type: 'success'
|
||||
that.$store.dispatch('chat/websocketsend', {
|
||||
req_name: 'resetPrinter',
|
||||
req_type: 2,
|
||||
req_info: {}
|
||||
}).then(() => {
|
||||
that.$message({
|
||||
message: '执行成功',
|
||||
type: 'success'
|
||||
})
|
||||
})
|
||||
})
|
||||
break;
|
||||
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', {
|
||||
req_name: 'cleanError',
|
||||
req_type: 2,
|
||||
@@ -617,6 +651,22 @@ export default {
|
||||
break;
|
||||
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', {
|
||||
req_name: 'CaliCDStone',
|
||||
req_type: 2,
|
||||
@@ -630,6 +680,22 @@ export default {
|
||||
break;
|
||||
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', {
|
||||
req_name: 'CaliPrinter',
|
||||
req_type: 1,
|
||||
@@ -643,14 +709,20 @@ export default {
|
||||
break;
|
||||
case 5:
|
||||
// 自动匹配光驱
|
||||
that.$store.dispatch('chat/websocketsend', {
|
||||
req_name: 'autoSetCDDev',
|
||||
req_type: 2,
|
||||
req_info: {}
|
||||
that.$confirm('确定执行自动匹配光驱操作吗?', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
that.$message({
|
||||
message: '执行成功',
|
||||
type: 'success'
|
||||
that.$store.dispatch('chat/websocketsend', {
|
||||
req_name: 'autoSetCDDev',
|
||||
req_type: 2,
|
||||
req_info: {}
|
||||
}).then(() => {
|
||||
that.$message({
|
||||
message: '执行成功',
|
||||
type: 'success'
|
||||
})
|
||||
})
|
||||
})
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user