更新对接

This commit is contained in:
24kycj
2024-11-25 22:09:56 +08:00
parent 8eb94d7c5d
commit 93212a8e96
4 changed files with 206 additions and 43 deletions
+147 -39
View File
@@ -48,7 +48,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>
@@ -62,19 +62,19 @@
<div class="device_info_option_cap">
<div
class="device_info_option_cap_box"
:class="{ 'device_info_option_cap_box1': printer_info.strongList[1].cd_num < 30, 'device_info_option_cap_box2': printer_info.strongList[1].cd_num < 10 }"
:style="{ height: $accDiv(printer_info.strongList[1].cd_num, 50) * 100 + '%' }"
:class="{ 'device_info_option_cap_box1': printer_info.strongList[2].cd_num < 30, 'device_info_option_cap_box2': printer_info.strongList[2].cd_num < 10 }"
:style="{ height: $accDiv(printer_info.strongList[2].cd_num, 50) * 100 + '%' }"
></div>
</div>
</div>
<div class="flex_box flex_row_center">
<el-dropdown trigger="click" :disabled="currentRunVal !== 6" @command="(e) => handleCommandCD(e, 0)">
<el-dropdown trigger="click" :disabled="currentRunVal !== 6" @command="(e) => handleCommandCD(e, 2)">
<div class="el-dropdown-link flex_box flex_row_center device_info_option_b">
<div class="device_info_option_b_text">{{ CDTypes[printer_info.strongList[1].cd_type] }} {{ printer_info.strongList[1].cd_num }}</div>
<div class="device_info_option_b_text">{{ CDTypes[printer_info.strongList[2].cd_type] }} {{ printer_info.strongList[2].cd_num }}</div>
<i v-if="currentRunVal === 6" class="el-icon-caret-bottom"></i>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(item, index) in CDTypes" :key="index" :command="index"><span :style="{'color': index === printer_info.strongList[1].cd_type ? '#409EFF' : '#000', 'font-weight': index === printer_info.strongList[1].cd_type ? '600' : '400' }">{{ item }}</span></el-dropdown-item>
<el-dropdown-item v-for="(item, index) in CDTypes" :key="index" :command="index"><span :style="{'color': index === printer_info.strongList[2].cd_type ? '#409EFF' : '#000', 'font-weight': index === printer_info.strongList[2].cd_type ? '600' : '400' }">{{ item }}</span></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
@@ -85,19 +85,19 @@
<div class="device_info_option_cap">
<div
class="device_info_option_cap_box"
:class="{ 'device_info_option_cap_box1': printer_info.strongList[2].cd_num < 30, 'device_info_option_cap_box2': printer_info.strongList[2].cd_num < 10 }"
:style="{ height: $accDiv(printer_info.strongList[2].cd_num, 50) * 100 + '%' }"
:class="{ 'device_info_option_cap_box1': printer_info.strongList[1].cd_num < 30, 'device_info_option_cap_box2': printer_info.strongList[1].cd_num < 10 }"
:style="{ height: $accDiv(printer_info.strongList[1].cd_num, 50) * 100 + '%' }"
></div>
</div>
</div>
<div class="flex_box flex_row_center">
<el-dropdown trigger="click" :disabled="currentRunVal !== 6" @command="(e) => handleCommandCD(e, 1)">
<div class="el-dropdown-link flex_box flex_row_center device_info_option_b">
<div class="device_info_option_b_text">{{ CDTypes[printer_info.strongList[2].cd_type] }} {{ printer_info.strongList[2].cd_num }}</div>
<div class="device_info_option_b_text">{{ CDTypes[printer_info.strongList[1].cd_type] }} {{ printer_info.strongList[1].cd_num }}</div>
<i v-if="currentRunVal === 6" class="el-icon-caret-bottom"></i>
</div>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item v-for="(item, index) in CDTypes" :key="index" :command="index"><span :style="{'color': index === printer_info.strongList[2].cd_type ? '#409EFF' : '#000', 'font-weight': index === printer_info.strongList[2].cd_type ? '600' : '400' }">{{ item }}</span></el-dropdown-item>
<el-dropdown-item v-for="(item, index) in CDTypes" :key="index" :command="index"><span :style="{'color': index === printer_info.strongList[1].cd_type ? '#409EFF' : '#000', 'font-weight': index === printer_info.strongList[1].cd_type ? '600' : '400' }">{{ item }}</span></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
@@ -141,7 +141,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 || !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 || !isConnect || !serviceStatus }">
<div class="device_status_dot"></div>
<div class="device_status_text">{{ runText }}</div>
</div>
@@ -161,7 +161,8 @@
<div class="device_right_top_img">
<img v-if="cd_list[0].cd_status == 4" src="@/assets/images/device3.png" />
<img v-if="cd_list[0].cd_status != 4" src="@/assets/images/device2.png" />
<div class="device_right_top_img_text" :class="{ 'device_right_top_img_text1': cd_list[0].cd_status == 4 }">{{ diskTypes[cd_list[0].dev_type] }}</div>
<div class="device_right_top_img_text" v-if="cd_list[0].cd_status != 4">{{ diskTypes[cd_list[0].dev_type] }}</div>
<div class="device_right_top_img_text device_right_top_img_text1" v-if="cd_list[0].cd_status !== 4">{{ CDTypes[cd_list[0].cd_type] }}</div>
</div>
<div class="device_right_top_content">
<div class="device_right_top_title">{{ cd_list[0].dev_path || '' }}({{ $store.state.chat.CDName[cd_list[0].cd_pos] }})</div>
@@ -169,7 +170,7 @@
<div class="flex_box device_right_top_progress">
<div class="device_right_top_progress_box" :style="{ 'width': cd_list[0].copy_scheduler + '%' }"></div>
</div>
<div class="device_right_top_text">{{ $filterSize($accSub(cd_list[0].total_size, cd_list[0].use_size)) }}可用{{ $filterSize(cd_list[0].total_size) }}</div>
<div class="device_right_top_text">已刻录{{ $filterSize(cd_list[0].use_size) }}{{ $filterSize(cd_list[0].total_size) }}{{ cd_list[0].burn_speed }}X</div>
</template>
<div class="device_right_top_text">状态{{ $store.state.chat.CDStatus[cd_list[0].cd_status] }}</div>
<div class="device_right_top_text">任务{{ cd_list[0].cd_taskid || '' }}</div>
@@ -181,7 +182,8 @@
<div class="device_right_top_img">
<img v-if="cd_list[1].cd_status == 4" src="@/assets/images/device3.png" />
<img v-if="cd_list[1].cd_status != 4" src="@/assets/images/device2.png" />
<div class="device_right_top_img_text" :class="{ 'device_right_top_img_text1': cd_list[1].cd_status == 4 }">{{ diskTypes[cd_list[1].dev_type] }}</div>
<div class="device_right_top_img_text" v-if="cd_list[1].cd_status != 4">{{ diskTypes[cd_list[1].dev_type] }}</div>
<div class="device_right_top_img_text device_right_top_img_text1" v-if="cd_list[1].cd_status !== 4">{{ CDTypes[cd_list[1].cd_type] }}</div>
</div>
<div class="device_right_top_content">
<div class="device_right_top_title">{{ cd_list[1].dev_path || '' }}({{ $store.state.chat.CDName[cd_list[1].cd_pos] }})</div>
@@ -189,7 +191,7 @@
<div class="flex_box device_right_top_progress">
<div class="device_right_top_progress_box" :style="{ 'width': cd_list[1].copy_scheduler + '%' }"></div>
</div>
<div class="device_right_top_text">{{ $filterSize($accSub(cd_list[1].total_size, cd_list[1].use_size)) }}可用{{ $filterSize(cd_list[1].total_size) }}</div>
<div class="device_right_top_text">已刻录{{ $filterSize(cd_list[1].use_size) }}{{ $filterSize(cd_list[1].total_size) }}{{ cd_list[1].burn_speed }}X</div>
</template>
<div class="device_right_top_text">状态{{ $store.state.chat.CDStatus[cd_list[1].cd_status] }}</div>
<div class="device_right_top_text">任务{{ cd_list[1].cd_taskid || '' }}</div>
@@ -236,7 +238,7 @@
<div class="flex_box work_top">
<div class="work_top_text">作业列表</div>
</div>
<el-table max-height="250" class="work_table" :data="task_list" empty-text="暂无作业列表">
<el-table default-expand-all max-height="250" class="work_table" :data="task_list" empty-text="暂无作业列表">
<el-table-column type="expand">
<template slot-scope="scope">
<el-table :show-header="false" max-height="250" :data="scope.row.ass_task">
@@ -344,14 +346,14 @@ export default {
// 工作状态
infoStatus: 0,
// 运行选项
runVal: 1,
currentRunVal: 0,
runVal: '',
currentRunVal: '',
sureText: '请设置左右盘仓类型并按确定键',
sureTime: 0,
runList: [
{
value: 1,
label: '重启设备'
label: '重启打印机'
},
{
value: 2,
@@ -359,7 +361,7 @@ export default {
},
{
value: 3,
label: '校准光盘桶'
label: '校准盘仓'
},
{
value: 4,
@@ -367,11 +369,15 @@ export default {
},
{
value: 5,
label: '自动设置刻录机'
label: '自动匹配光驱'
},
{
value: 6,
label: '设置左右盘仓'
},
{
value: 7,
label: '进入运输模式'
}
],
// 剩余容量
@@ -503,6 +509,10 @@ export default {
if (this.printer_info.cover_flag) {
text = '设备门盖被打开,请关闭门盖。'
}
if (this.printer_info.calibration_flag) {
text = '请先校准打印机'
this.runVal = 4
}
if (!this.isConnect) {
text = '服务已关闭'
}
@@ -539,43 +549,141 @@ export default {
})
return
}
const index = that.runList.findIndex((item) => item.value == that.runVal)
if (!that.runVal) {
that.$message({
message: '请先选择需要执行的操作',
type: 'warning'
})
return
}
// that.$message({
// message: that.runList[index].label,
// type: 'success'
// })
clearTimeout(outTimer)
if (this.runVal === 6) {
outTimer = setTimeout(() => {
this.currentRunVal = 0
this.printer_info.strongList = this.default_cd
}, 120000);
switch (that.runVal) {
case 1:
// 重启打印机
that.$store.dispatch('chat/websocketsend', {
req_name: 'resetPrinter',
req_type: 1,
req_info: {}
}).then(() => {
that.$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_info: {}
}).then(() => {
that.$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_info: {}
}).then(() => {
that.$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: '校准打印机执行成功',
type: 'success'
})
}).catch(() => {
that.$message({
message: '校准打印机执行失败,请重新尝试',
type: 'error'
})
})
break;
case 5:
// 自动匹配光驱
that.$store.dispatch('chat/websocketsend', {
req_name: 'autoSetCDDev',
req_type: 1,
req_info: {}
}).then(() => {
that.$message({
message: '自动匹配光驱执行成功',
type: 'success'
})
}).catch(() => {
that.$message({
message: '自动匹配光驱执行失败,请重新尝试',
type: 'error'
})
})
break;
case 6:
outTimer = setTimeout(() => {
that.currentRunVal = 0
that.printer_info.strongList = that.default_cd
}, 120000);
break;
}
that.currentRunVal = that.runVal
},
// 更换左右磁盘类型
handleCommandCD(e, type) {
this.printer_info.strongList[type].cd_type = e
this.changeCD.req_info.strong_list[type].strong_type = e
that.printer_info.strongList[type].cd_type = e
that.changeCD.req_info.strong_list[type-1].strong_type = e
},
sureCD() {
that.$store.dispatch('chat/websocketsend', this.changeCD).then(() => {
that.$store.dispatch('chat/websocketsend', that.changeCD).then(() => {
clearTimeout(outTimer)
this.currentRunVal = 0
that.currentRunVal = 0
}).catch(() => {
clearTimeout(outTimer)
this.currentRunVal = 0
that.currentRunVal = 0
})
},
// 新建作业
showWork() {
// if (!that.workStatus) {
// that.$message({
// message: '请先连接服务',
// type: 'warning'
// })
// return
// }
if (!that.workStatus) {
that.$message({
message: '请先连接服务',
type: 'warning'
})
return
}
that.workShow = true
that.$nextTick(() => {
that.$refs.workAdd.show()