From e19de21de563ecfda826b7328720d291cc769417 Mon Sep 17 00:00:00 2001 From: 24kycj <1637269896@qq.com> Date: Thu, 5 Dec 2024 15:25:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8E=E5=AF=B9=E6=8E=A5?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/renderer/components/tabBar/tabBar.vue | 10 +- src/renderer/components/workAdd/workAdd.vue | 54 +-- src/renderer/store/modules/chat.js | 101 ++++-- src/renderer/views/dashboard/index.vue | 166 +++++---- src/renderer/views/manage/index.vue | 356 ++++++++++++++++++-- src/renderer/views/set/index.vue | 86 +++-- src/renderer/views/user/index.vue | 2 +- 7 files changed, 590 insertions(+), 185 deletions(-) diff --git a/src/renderer/components/tabBar/tabBar.vue b/src/renderer/components/tabBar/tabBar.vue index 5edeb4c..a9772a2 100644 --- a/src/renderer/components/tabBar/tabBar.vue +++ b/src/renderer/components/tabBar/tabBar.vue @@ -39,11 +39,11 @@ name: '系统管理', path: '/manage' }, - { - id: 2, - name: '用户管理', - path: '/user' - }, + // { + // id: 2, + // name: '用户管理', + // path: '/user' + // }, { id: 3, name: '系统配置', diff --git a/src/renderer/components/workAdd/workAdd.vue b/src/renderer/components/workAdd/workAdd.vue index 994249e..e841ef0 100644 --- a/src/renderer/components/workAdd/workAdd.vue +++ b/src/renderer/components/workAdd/workAdd.vue @@ -34,7 +34,7 @@
-
+
刻录速率:
@@ -291,18 +291,18 @@ export default { value: 2, label: 'ISO文件刻录' }, - { - value: 3, - label: '复制光盘' - }, - { - value: 4, - label: '自动批量读取光盘' - }, - { - value: 5, - label: '自动归档任务' - }, + // { + // value: 3, + // label: '复制光盘' + // }, + // { + // value: 4, + // label: '自动批量读取光盘' + // }, + // { + // value: 5, + // label: '自动归档任务' + // }, ], fileProgess: 30, // 模板列表 @@ -361,10 +361,10 @@ export default { } ], speedList: [ - { - value: 0, - label: 'Auto' - }, + // { + // value: 0, + // label: 'Auto' + // }, { value: 1, label: '低' @@ -543,9 +543,13 @@ export default { filters: [{ name: 'Soon Work', extensions: ['dwk'] }] }) .then((result) => { + if (result.filePath == "") { return; } + if (result.filePath.substring(result.filePath.length - 5).indexOf('.') == -1) { + result.filePath += '.dwk'; + } fs.writeFileSync(result.filePath, v) that.$message({ - message: '保存成功', + message: '保存成功至'+result.filePath, type: 'success' }) }) @@ -657,8 +661,20 @@ export default { task.path_file.push(fileList[i].path) task.task_size += fileList[i].size } + if (task.task_size > diskSize) { + this.$notify({ + message: `文件大小超过设备容量!`, + type: 'warning' + }) + return + } that.form.ass_task.push(task) } + that.form.burn_speed = that.setForm.speed + that.form.is_finished_check = that.setForm.isCheck + that.form.is_finished_close = that.setForm.isClose + that.form.is_finished_delete = that.setForm.isDel + that.form.is_printer_labal_failed = that.setForm.isPrint // csv文件处理 if (!that.form.udf_file && that.soonList.length > 0) { that.soonList.forEach((item) => { diff --git a/src/renderer/store/modules/chat.js b/src/renderer/store/modules/chat.js index bf0bc2c..1669b54 100644 --- a/src/renderer/store/modules/chat.js +++ b/src/renderer/store/modules/chat.js @@ -3,14 +3,14 @@ let timeouter = null let websock = null // 状态JSON -// 打印机状态 +// 设备状态 const PrinterStatus = { I: '空闲', B: '忙碌', P: '正在打印' } -// 打印机报错 +// 设备报错 const printer_errors = { '0x11': '从盘仓到光驱时,光盘仓为空', '0x12': '从盘仓到光驱时,抓取光盘错误', @@ -27,6 +27,8 @@ const printer_errors = { '0x1d': '从光驱到弃置位时,光盘仓为空', '0x1e': '从光驱到弃置位时,抓取光盘错误', '0x1f': '从光驱到弃置位时,其他错误', + '0x21': '作业开始时设备错误,请清除故障后点击重试', + '0x10001': '通讯失败,请检查设备' } // 提交任务报错 @@ -41,12 +43,11 @@ const submitErros = { '0x9': '模板文件解析失败', '0xa': '打印类型错误', '0xb': 'csv文件读取失败', - '0xc': '拷贝路径错误', + '0xc': '刻录路径错误', '0xd': '新建ISO文件失败', - '0xe': '更新任务数据失败', + '0xe': '更新任务数据失败' } - // 错误状态 const Error1 = { 0: '托盘移动错误', @@ -149,21 +150,21 @@ const defaultData = { // task_name: '复制任务', // finish_freq: 2, // total_freq: 10, - // task_status: 2, + // task_status: 5, // ass_task: [ // { // task_size: 100000, // cd_type: 2, // start_time: '2024-04-01 12:00:00', // finish_time: '2024-04-01 12:00:00', - // task_status: 2 + // task_status: 5 // }, // { // task_size: 100000, // cd_type: 2, // start_time: '2024-04-01 12:00:00', // finish_time: '2024-04-01 12:00:00', - // task_status: 2 + // task_status: 5 // } // ] // }, @@ -191,14 +192,15 @@ const defaultData = { // ] // } ], - // 打印机信息 + // 设备信息 printer_info: { blue_last: 0, //蓝色墨盒遗留 - calibration_flag: 0, // 是否校验打印机 + calibration_flag: 0, // 是否校验设备 + lack_ink: 0, // 缺墨警告 cover_flag: false, //是否盖盖 - printer_name: '', //打印机名称 - printer_status: 'I', //打印机状态 数字转成字符为I - printer_tray: 'I', //打印机托盘状态 数字转成字符为I + printer_name: '', //设备名称 + printer_status: 'I', //设备状态 数字转成字符为I + printer_tray: 'I', //设备托盘状态 数字转成字符为I red_last: 0, //红色墨盒遗留 yellow_last: 0, //黄色墨盒遗留 system_ip: '', //主机IP @@ -258,7 +260,28 @@ const defaultData = { // status: 'INFO' // } ], - allLogList: [] + allLogList: [], + // 手动设置光驱 + cdList: [ + // { + // "dev_path":"/dev/sre", + // "dev_name":"Finger Module 0110" + // }, + // { + // "dev_path":"/dev/sre", + // "dev_name":"PIONEER BD-RW BDR-289M 1.54" + // }, + // { + // "dev_path":"/dev/sre", + // "dev_name":"PIONEER BD-RW BDR-1313M 3.54" + // } + ], + // 系统配置 + settings: { + log_level: 1, + retry_freq: 2, + cache_path: '/home/test/CDFile' + } } const getDefaultState = () => { @@ -318,7 +341,7 @@ const actions = { // 作业列表 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) @@ -329,7 +352,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 = [{}, {}] @@ -351,7 +374,13 @@ 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 === 'get_all_cdlist') { + commit('setData', { name: 'cdList', data: data.resp_info.cd_list }) + // 系统配置 + } else if (data.resp_name === 'get_system_config') { + commit('setData', { name: 'settings', data: data.resp_info }) + // 新增日志 } else if (data.resp_name === 'add_log') { let logs = data.resp_info.add_log let loglist = [] @@ -360,32 +389,32 @@ const actions = { let texts = logs[i].split('|') if (logLists.length > 20) logLists.splice(logLists.length - 1, 1) loglist.unshift({ - time: texts[0].replace(/\//g, "-").replace(/时/g, ':').replace(/分/g, ':').replace(/秒/g, ''), + time: texts[0].replace(/\//g, '-').replace(/时/g, ':').replace(/分/g, ':').replace(/秒/g, ''), text: texts[2], status: texts[1] }) } 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 = [] for (let i = 0; i < logs.length; i++) { let texts = logs[i].split('|') loglist.unshift({ - time: texts[0].replace(/\//g, "-").replace(/时/g, ':').replace(/分/g, ':').replace(/秒/g, ''), + time: texts[0].replace(/\//g, '-').replace(/时/g, ':').replace(/分/g, ':').replace(/秒/g, ''), text: texts[2], status: texts[1] }) } commit('setData', { name: 'logList', data: loglist }) - // 提交任务报错处理 + // 提交任务报错处理 } else if (data.resp_name === 'submit_task_res') { let error = data.resp_info - let task_res = "0x" + error.task_res.toString(16) - commit('setData', { name: 'printer_error', data: {type: 'error', notify: '任务' + error.task_uuid + '提交失败:' + submitErros[task_res], } }) - // 打印报错处理 + let task_res = '0x' + error.task_res.toString(16) + commit('setData', { name: 'printer_error', data: { type: 'error', notify: '任务' + error.task_uuid + '提交失败:' + submitErros[task_res] } }) + // 打印报错处理 } else if (data.resp_name === 'printer_error') { let error = data.resp_info if (error.error1) { @@ -394,8 +423,8 @@ const actions = { for (let i = 0; i < errors.length; i++) { if (errors[i] == 1) { setTimeout(() => { - commit('setData', { name: 'printer_error', data: {type: 'error', notify: Error1[i] } }) - }, 500); + commit('setData', { name: 'printer_error', data: { type: 'error', notify: Error1[i] } }) + }, 500) } } } @@ -404,8 +433,8 @@ const actions = { for (let i = 0; i < errors.length; i++) { if (errors[i] == 1) { setTimeout(() => { - commit('setData', { name: 'printer_error', data: {type: 'error', notify: Error2[i] } }) - }, 500); + commit('setData', { name: 'printer_error', data: { type: 'error', notify: Error2[i] } }) + }, 500) } } } @@ -414,14 +443,14 @@ const actions = { for (let i = 0; i < errors.length; i++) { if (errors[i] == 1) { setTimeout(() => { - commit('setData', { name: 'printer_error', data: {type: 'error', notify: Error3[i] } }) - }, 500); + commit('setData', { name: 'printer_error', data: { type: 'error', notify: Error3[i] } }) + }, 500) } } } if (error.printer_error) { - error.printer_error = "0x" + error.printer_error.toString(16) - commit('setData', { name: 'printer_error', data: {type: 'error', confirm: printer_errors[error.printer_error], req: 'continue_task' } }) + error.printer_error = '0x' + error.printer_error.toString(16) + commit('setData', { name: 'printer_error', data: { type: 'error', confirm: printer_errors[error.printer_error], req: 'continue_task' } }) } } } else { @@ -444,12 +473,12 @@ const actions = { websocketsend({ commit, dispatch }, res) { return new Promise((resolve, reject) => { if (!state.serviceStatus) { - commit('setData', { name: 'printer_error', data: {type: 'warning', message: '服务连接中,请耐心等待' } }) + commit('setData', { name: 'printer_error', data: { type: 'warning', message: '服务连接中,请耐心等待' } }) reject() return } if (!state.isConnect) { - commit('setData', { name: 'printer_error', data: {type: 'warning', message: '请先打开服务' } }) + commit('setData', { name: 'printer_error', data: { type: 'warning', message: '请先打开服务' } }) reject() return } @@ -474,7 +503,7 @@ const actions = { commit('setData', { name: key, data: defaultData[key] }) } if (state.workStatus) { - const refreshTime = parseInt(state.refreshTime)*1000 + const refreshTime = parseInt(state.refreshTime) * 1000 setTimeout(() => { dispatch('initWebSocket') }, refreshTime) @@ -486,7 +515,7 @@ const actions = { commit('setData', { name: 'isConnect', data: false }) commit('setData', { name: 'serviceStatus', data: false }) state.reconnections += 1 - const refreshTime = parseInt(state.refreshTime)*1000 + const refreshTime = parseInt(state.refreshTime) * 1000 setTimeout(() => { dispatch('initWebSocket') }, refreshTime) diff --git a/src/renderer/views/dashboard/index.vue b/src/renderer/views/dashboard/index.vue index 4e4e105..805c85e 100644 --- a/src/renderer/views/dashboard/index.vue +++ b/src/renderer/views/dashboard/index.vue @@ -22,16 +22,16 @@
-
完成拷贝数:
-
{{ task_list.length }}
+
完成刻录数:
+
{{ taskNum[0] }}
-
废弃拷贝数:
-
0
+
废弃刻录数:
+
{{taskNum[1]}}
错误:
-
0
+
{{taskNum[2]}}
@@ -49,7 +49,7 @@
-
卡树光盘刻录一体机{{ printer_info.printer_name }}
+
光盘刻录一体机{{ printer_info.printer_name }}
{{ sureText }}
@@ -145,7 +145,7 @@
-
+
{{ runText }}
@@ -261,10 +261,20 @@ @@ -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; diff --git a/src/renderer/views/manage/index.vue b/src/renderer/views/manage/index.vue index 497a930..ae23b31 100644 --- a/src/renderer/views/manage/index.vue +++ b/src/renderer/views/manage/index.vue @@ -13,21 +13,21 @@
-
移动卡片到
+
校准设备
-
{{ item.name }}
+
{{ item.name }}
-
+
@@ -66,7 +66,7 @@
-
+
+ + +
+
请通过点击按钮弹出光驱托盘判断并设置光驱。
+
需对光驱进行手动设置!
+
使用下拉方框来指定设备中的哪个光驱是上光驱、哪个是下光驱。
+
+
+
{{ item.dev_name }}
+
+ + + + 打开 + 关闭 +
+
+
+ +
+
diff --git a/src/renderer/views/user/index.vue b/src/renderer/views/user/index.vue index 5656c53..00565a1 100644 --- a/src/renderer/views/user/index.vue +++ b/src/renderer/views/user/index.vue @@ -37,7 +37,7 @@ export default { }, { ID: '2', - userName: '卡树测试', + userName: '测试', role: 'test', logintime: '2024-10-05 19:06:45', status: 0