优化与对接接口

This commit is contained in:
24kycj
2024-12-05 15:25:51 +08:00
parent d8f155e940
commit e19de21de5
7 changed files with 590 additions and 185 deletions
+105 -61
View File
@@ -22,16 +22,16 @@
</div>
</el-tooltip>
<div class="flex_box top_left_option">
<div class="top_left_text">完成拷贝:</div>
<div class="top_left_num">{{ task_list.length }}</div>
<div class="top_left_text">完成刻录:</div>
<div class="top_left_num">{{ taskNum[0] }}</div>
</div>
<div class="flex_box top_left_option">
<div class="top_left_text">废弃拷贝:</div>
<div class="top_left_num top_left_num1">0</div>
<div class="top_left_text">废弃刻录:</div>
<div class="top_left_num top_left_num1">{{taskNum[1]}}</div>
</div>
<div class="flex_box top_left_option">
<div class="top_left_text">错误:</div>
<div class="top_left_num">0</div>
<div class="top_left_num">{{taskNum[2]}}</div>
</div>
<div class="top_left_line"></div>
</div>
@@ -49,7 +49,7 @@
<div class="device_info_box">
<div class="device_info_main" :class="{ device_info_main1: infoStatus === 1 }">
<div class="device_info_item">
<div class="device_info_title">卡树光盘刻录一体机{{ printer_info.printer_name }}</div>
<div class="device_info_title">光盘刻录一体机{{ printer_info.printer_name }}</div>
<div class="device_info_sure">
<div v-if="currentRunVal === 6" class="flex_box flex_row_between device_info_sure_box">
<div class="device_info_sure_text">{{ sureText }}</div>
@@ -145,7 +145,7 @@
</div>
</div>
<!-- <div class="flex_box device_status" :class="`flex_box device_status device_status${printer_info.printer_status} device_status${printer_info.cover_flag}`"> -->
<div class="flex_box device_status" :class="{ 'device_status1': printer_info.printer_status === 'I', 'device_status2': printer_info.printer_status === 'B' || printer_info.printer_status === 'P', 'device_status3': printer_info.cover_flag || printer_info.calibration_flag || !isConnect || !serviceStatus }">
<div class="flex_box device_status" :class="{ 'device_status1': printer_info.printer_status === 'I', 'device_status2': printer_info.printer_status === 'B' || printer_info.printer_status === 'P', 'device_status3': printer_info.cover_flag || printer_info.calibration_flag || printer_info.lack_ink || !isConnect || !serviceStatus }">
<div class="device_status_dot"></div>
<div class="device_status_text">{{ runText }}</div>
</div>
@@ -261,10 +261,20 @@
</el-table-column>
<el-table-column prop="task_status" label="状态">
<template slot-scope="scope">
<div class="flex_box work_status_box">
<div v-if="scope.row.task_status == 5&&scope.row.task_uuid">
<el-dropdown trigger="click" @command="(e) => workCommand(scope.$index, e)">
<div class="el-dropdown-link flex_box work_status_box">
<div>{{ statusList[scope.row.task_status] }}</div>
<i class="el-icon-caret-bottom"></i>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item icon="el-icon-refresh-right" command="retry">重试</el-dropdown-item>
<el-dropdown-item icon="el-icon-circle-close" command="cancel">取消</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
<div v-else class="flex_box work_status_box">
<div>{{ statusList[scope.row.task_status] }}</div>
<el-button v-if="scope.row.task_status == 5&&scope.row.task_uuid" @click="workRetry(scope.$index)" size="mini" type="primary" class="work_status_retry">重试</el-button>
<!-- <i class="el-icon-caret-bottom"></i> -->
</div>
</template>
</el-table-column>
@@ -312,7 +322,7 @@ export default {
runList: [
{
value: 1,
label: '重启打印机'
label: '重启设备'
},
{
value: 2,
@@ -322,10 +332,6 @@ export default {
value: 3,
label: '校准盘仓'
},
{
value: 4,
label: '校准打印机'
},
{
value: 5,
label: '自动匹配光驱'
@@ -342,15 +348,17 @@ export default {
// 剩余容量
progressW: 75,
// 作业列表
taskNum: [0,0,0],
task_list: [],
statusList: {
0: '新建中',
1: '准备中',
2: '等待中',
3: '正在拷贝',
3: '正在刻录',
4: '正在打印',
5: '已失败',
6: '运行中',
7: '已取消',
100: '已完成'
},
// 设备信息
@@ -393,7 +401,15 @@ export default {
if (val && val.length) {
let tasks = [...val]
let list = []
let nums = [0,0,0]
tasks.forEach((item, index) => {
if (item.task_status == 100) {
nums[0]++
} else if (item.task_status == 7) {
nums[1]++
} else if (item.task_status == 5) {
nums[2]++
}
if (item.ass_task&&item.ass_task.length) {
let task_size = 0
item.cdType = this.$store.state.chat.CDTypes[item.ass_task[0].cd_type]
@@ -407,6 +423,7 @@ export default {
}
list.push(item)
})
this.taskNum = nums
this.task_list = list
}
},
@@ -479,9 +496,12 @@ export default {
text = '设备门盖被打开,请关闭门盖。'
}
if (this.printer_info.calibration_flag) {
text = '请先校准打印机'
text = '请先校准设备'
this.runVal = 4
}
if (this.printer_info.lack_ink) {
text = '缺墨警告'
}
if (!this.isConnect) {
text = '服务已关闭'
}
@@ -538,93 +558,68 @@ export default {
clearTimeout(outTimer)
switch (that.runVal) {
case 1:
// 重启打印机
// 重启设备
that.$store.dispatch('chat/websocketsend', {
req_name: 'resetPrinter',
req_type: 1,
req_type: 2,
req_info: {}
}).then(() => {
that.$message({
message: '重启设备执行成功',
message: '执行成功',
type: 'success'
})
}).catch(() => {
that.$message({
message: '重启设备执行失败,请重新尝试',
type: 'error'
})
})
break;
case 2:
// 清除错误
that.$store.dispatch('chat/websocketsend', {
req_name: 'cleanError',
req_type: 1,
req_type: 2,
req_info: {}
}).then(() => {
that.$message({
message: '清除错误执行成功',
message: '执行成功',
type: 'success'
})
}).catch(() => {
that.$message({
message: '清除错误执行失败,请重新尝试',
type: 'error'
})
})
break;
case 3:
// 校准盘仓
that.$store.dispatch('chat/websocketsend', {
req_name: 'CaliCDStone',
req_type: 1,
req_type: 2,
req_info: {}
}).then(() => {
that.$message({
message: '校准盘仓执行成功',
message: '执行成功',
type: 'success'
})
}).catch(() => {
that.$message({
message: '校准盘仓执行失败,请重新尝试',
type: 'error'
})
})
break;
case 4:
// 校准打印机
// 校准设备
that.$store.dispatch('chat/websocketsend', {
req_name: 'CaliPrinter',
req_type: 1,
req_info: {}
}).then(() => {
that.$message({
message: '校准打印机执行成功',
message: '执行成功',
type: 'success'
})
}).catch(() => {
that.$message({
message: '校准打印机执行失败,请重新尝试',
type: 'error'
})
})
break;
case 5:
// 自动匹配光驱
that.$store.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev',
req_type: 1,
req_type: 2,
req_info: {}
}).then(() => {
that.$message({
message: '自动匹配光驱执行成功',
message: '执行成功',
type: 'success'
})
}).catch(() => {
that.$message({
message: '自动匹配光驱执行失败,请重新尝试',
type: 'error'
})
})
break;
case 6:
@@ -633,6 +628,24 @@ export default {
that.printer_info.strongList = that.default_cd
}, 120000);
break;
case 7:
that.$confirm('请确保已经取掉左右光盘仓托架,再点击确定', '温馨提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
that.$store.dispatch('chat/websocketsend', {
req_name: 'TransportMode',
req_type: 2,
req_info: {}
}).then(() => {
that.$message({
message: '执行成功',
type: 'success'
})
})
})
break;
}
that.currentRunVal = that.runVal
},
@@ -704,10 +717,19 @@ export default {
}
that.showAll = !that.showAll
},
// 下拉操作
workCommand(index, e) {
if (e === 'retry') {
that.workRetry(index)
}
if (e === 'cancel') {
that.workCancel(index)
}
},
// 作业重试
workRetry(e) {
that.$store.dispatch('chat/websocketsend', {
req_name: 'retry task',
req_name: 'retry_task',
req_type: 1,
req_info: {
task_uuid: that.task_list[e].task_uuid
@@ -725,6 +747,27 @@ export default {
}
})
},
// 作业取消
workCancel(e) {
that.$store.dispatch('chat/websocketsend', {
req_name: 'cancle_task',
req_type: 1,
req_info: {
task_uuid: that.task_list[e].task_uuid
}
}).then(() => {
that.$message({
message: '取消成功',
type: 'success'
})
that.task_list[e].task_status = 7
if (that.task_list[e].ass_task&&that.task_list[e].ass_task.length > 0) {
that.task_list[e].ass_task.forEach(item => {
item.task_status = 7
})
}
})
},
// 跳转设置
goSet(e) {
that.$router.push({ path: e })
@@ -1107,7 +1150,7 @@ $red: #ff0000;
.device_right {
width: 50%;
.device_right_top {
height: 200px;
height: 190px;
background: #ffffff;
border-radius: 4px;
margin-bottom: 18px;
@@ -1182,7 +1225,7 @@ $red: #ff0000;
background: #ffffff;
border-radius: 6px;
.notice_top {
height: 75px;
height: 50px;
padding: 0 30px;
border-bottom: 2px solid #e1f5e5;
.notice_title {
@@ -1274,13 +1317,13 @@ $red: #ff0000;
}
}
.work_box {
height: calc(100vh - 640px);
height: calc(100vh - 605px);
::-webkit-scrollbar {
width: 0; /* 设置滚动条的宽度 */
height: 0;
}
.el-table.work_table {
height: calc(100vh - 720px) !important;
height: calc(100vh - 665px) !important;
::v-deep .el-table__body-wrapper {
height: calc(100% - 48px) !important;
overflow: scroll!important;
@@ -1288,15 +1331,15 @@ $red: #ff0000;
}
.work_top {
background-color: #fff;
height: 72px;
height: 50px;
.work_top_text {
width: 132px;
height: 72px;
height: 50px;
background: linear-gradient(180deg, #c1ffcd 0%, #ffffff 100%);
font-weight: bold;
font-size: 19px;
color: #00c325;
line-height: 72px;
line-height: 50px;
text-align: center;
}
}
@@ -1344,6 +1387,7 @@ $red: #ff0000;
font-size: 14px;
color: #000000;
height: 30px;
cursor: pointer;
.work_status_retry {
width: 40px;
height: 22px;