更新对接

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
+27 -3
View File
@@ -23,9 +23,9 @@
</div>
</div>
<div class="flex_box work_top_item">
<div class="work_top_label">拷贝类型</div>
<div class="work_top_label">刻录类型</div>
<div class="work_top_val">
<el-select v-model="form.copy" placeholder="请选择">
<el-select v-model="form.copy_type" placeholder="请选择">
<el-option v-for="item in copyList" :key="item.value" :label="item.label" :value="item.value"> </el-option>
</el-select>
</div>
@@ -236,6 +236,7 @@ export default {
form: {
task_uuid: '',
cd_type: 2,
copy_type: 2,
json_file: '',
udf_file: '',
label: '2024-10-17',
@@ -253,6 +254,7 @@ export default {
udf_file: '/home/test/temp.csv',
label: '2024-11-07',
cd_type: 1,
copy_type: 2,
has_copy_task: true,
has_print_task: true,
ass_task: [
@@ -271,7 +273,29 @@ export default {
// CD类型:CD 700MB1DVD 4.7GB2 DVD_DL 8.5GB:3BD 25GB4,BD_DL 50GB:5,BD_TL 100GB:6,BD_QL 128GB:7
CDTypes: [],
cd_types: [],
copyList: [],
copyList: [
{
value: 1,
label: '文件文件夹刻录',
disabled: true
},
{
value: 2,
label: 'ISO文件刻录'
},
// {
// value: 3,
// label: '复制光盘'
// },
// {
// value: 4,
// label: '自动批量读取光盘'
// },
// {
// value: 5,
// label: '自动归档任务'
// },
],
fileProgess: 30,
// 模板列表
templates: [],
+31
View File
@@ -10,6 +10,23 @@ const PrinterStatus = {
P: '正在打印'
}
// 提交任务报错
const submitErros = {
'0x00001': '读取任务JSON失败',
'0x00003': '新建任务失败',
'0x00004': '新建任务文件夹失败',
'0x00005': '没有任务数量',
'0x00006': '打印参数错误',
'0x00007': '刻录参数错误',
'0x00008': '没有任务',
'0x00009': '模板文件解析失败',
'0x0000A': '打印类型错误',
'0x0000B': 'csv文件读取失败',
'0x0000C': '拷贝路径错误',
'0x0000D': '新建ISO文件失败',
'0x0000E': '更新任务数据失败',
}
// 错误状态
const Error1 = {
0: '托盘移动错误',
@@ -49,6 +66,8 @@ const CDStatus = {
3: '光驱未准备好',
4: '光盘状态正常,光盘已插入'
}
// 光盘类型
// CD类型:CD1DVD2 DVD_DL:3BD4,BD_DL:5,BD_TL:6,BD_QL:7
const diskTypes = {
1: 'CD',
@@ -126,6 +145,7 @@ const defaultData = {
// 打印机信息
printer_info: {
blue_last: 0, //蓝色墨盒遗留
calibration_flag: 0, // 是否校验打印机
cover_flag: false, //是否盖盖
printer_name: '', //打印机名称
printer_status: 'I', //打印机状态 数字转成字符为I
@@ -201,6 +221,7 @@ const getDefaultState = () => {
Error1,
Error2,
Error3,
submitErros,
CDName,
CDStatus,
diskTypes,
@@ -246,8 +267,10 @@ const actions = {
websocketonmessage({ state, commit, dispatch }, e) {
const data = JSON.parse(e.data) // 转json对象
if (data.resp_name) {
// 作业列表
if (data.resp_name === 'task_list') {
commit('setData', { name: 'task_list', data: data.resp_info.task_list })
// 打印机信息
} else if (data.resp_name === 'printer_info') {
let info = data.resp_info
info.printer_status = String.fromCharCode(info.printer_status)
@@ -258,6 +281,7 @@ const actions = {
}
info.strongList = strong_list
commit('setData', { name: 'printer_info', data: info })
// 驱动信息
} else if (data.resp_name === 'cd_info') {
const list = data.resp_info.cd_list
let cds = [{}, {}]
@@ -279,6 +303,7 @@ const actions = {
commit('setData', { name: 'CDTypes', data: types })
commit('setData', { name: 'cd_types', data: typeLists })
commit('setData', { name: 'cd_list', data: cds })
// 新增日志
} else if (data.resp_name === 'add_log') {
let logs = data.resp_info.add_log
let loglist = []
@@ -294,6 +319,7 @@ const actions = {
}
let list = [...loglist, ...logLists]
commit('setData', { name: 'logList', data: list })
// 全部日志
} else if (data.resp_name === 'all_log') {
let logs = data.resp_info.add_log
let loglist = []
@@ -306,6 +332,11 @@ const actions = {
})
}
commit('setData', { name: 'logList', data: loglist })
// 提交任务报错处理
} else if (data.resp_name === 'submit_task_res') {
let error = data.resp_info
commit('setData', { name: 'printer_error', data: {type: 'error', notify: '任务' + error.task_uuid + '提交失败:' + this.$store.state.submitErros[error.task_res], message: '' } })
// 打印报错处理
} else if (data.resp_name === 'printer_error') {
let error = data.resp_info
let info = {
+1 -1
View File
@@ -463,7 +463,7 @@ export function accSub(arg1, arg2) {
}
/** * 文件大小 字节转换单位 * @param size * @returns {string|*} */
export const filterSize = (size) => {
if (!size) return '0kb';
if (!size || size < 0) return '0kb';
if (size < pow1024(1)) return size + ' B';
if (size < pow1024(2)) return (size / pow1024(1)).toFixed(2) + ' KB';
if (size < pow1024(3)) return (size / pow1024(2)).toFixed(2) + ' MB';
+145 -37
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) {
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(() => {
this.currentRunVal = 0
this.printer_info.strongList = this.default_cd
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()