diff --git a/src/renderer/components/workAdd/files/calc.js b/src/renderer/components/workAdd/files/calc.js index 41f7e66..54ff7a6 100644 --- a/src/renderer/components/workAdd/files/calc.js +++ b/src/renderer/components/workAdd/files/calc.js @@ -46,7 +46,7 @@ export function getExtension(name) { export function bytesToSize(bytes) { if (bytes === 0) return "0 B"; - var k = process.platform === 'linux' ? 1000 : 1024, + var k = 1024, sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], i = Math.floor(Math.log(bytes) / Math.log(k)); return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i]; diff --git a/src/renderer/components/workAdd/files/file.vue b/src/renderer/components/workAdd/files/file.vue index 8526c86..4b03cfb 100644 --- a/src/renderer/components/workAdd/files/file.vue +++ b/src/renderer/components/workAdd/files/file.vue @@ -73,6 +73,10 @@ export default { saveWorkList: { type: Object | undefined, }, + copyType: { + type: Number, + default: 1, + }, }, components: { fileEmpty, @@ -140,9 +144,13 @@ export default { }, addFile() { const _this = this; + console.log(_this.copyType) + const properties = _this.copyType == 2 ? [] : ["multiSelections"]; + const filters = _this.copyType == 2 ? [{ name: '镜像文件', extensions: ['ISO', 'IMG'] }] : [{ name: '所有文件', extensions: ['*'] }] dialog .showOpenDialog({ - properties: ["multiSelections"], + filters, + properties }) .then(async (rel) => { console.log(rel); @@ -153,6 +161,17 @@ export default { if (err) { return false; } + if (_this.copyType == 2) { + _this.filesList = {} + _this.allNumber = 1; + _this.filesList[item] = { + name: getFileName(item), + path: item, + size: res.size, + folder: false, + }; + return + } _this.insertList({ name: getFileName(item), path: item, diff --git a/src/renderer/components/workAdd/workAdd.vue b/src/renderer/components/workAdd/workAdd.vue index 74d5b4f..e8f242d 100644 --- a/src/renderer/components/workAdd/workAdd.vue +++ b/src/renderer/components/workAdd/workAdd.vue @@ -124,7 +124,7 @@
内容
-
+
添加文件夹
@@ -142,7 +142,7 @@
- +
item.name.indexOf('ISO') > -1 || item.name.indexOf('IMG') > -1) + if (that.form.copy_type == 2) { + if (fileList.length != 1 || !isISO) { + this.$notify({ + message: '仅可上传一个类型为ISO/IMG的文件', + type: 'warning' + }) + return + } + } if (that.form.json_file === '' && fileList.length === 0 && that.form.copy_type !== 3 && that.form.copy_type !== 4) { this.$notify({ message: '请上传作业文件', diff --git a/src/renderer/store/modules/chat.js b/src/renderer/store/modules/chat.js index 956076f..9cdc64e 100644 --- a/src/renderer/store/modules/chat.js +++ b/src/renderer/store/modules/chat.js @@ -56,9 +56,14 @@ const Error = { 4: '墨盒容量低', 5: '机械臂移动错误,请按功能按钮重试。', 6: '设备处于离线状态', - 7: '设备门盖被打开', + 7: '设备门盖被打开,请关闭门盖。', 8: '从打印托盘上抓取光盘时错误,请手动将光盘取走再点击重试。', 9: '多张光盘被抓取或移动,请检查后手动将光盘放回原处再点重试,如重试后继续错误,则需校准设备后再来重试。', + 10: '从进盘仓到光驱的过程中,抓取错误,请手动将光盘放回进盘仓后重试。', + 11: '从进盘仓到打印托盘的过程中,抓取错误,请手动将光盘放回进盘仓后重试。', + 12: '从光驱到打印托盘的过程中,抓取错误,请手动将光盘放回光驱后重试。', + 13: '打印机需要校准', + 14: '检测墨盒错误', 15: '校准光盘桶失败', 16: '等待打印完成超时', 17: '从打印托盘抓取光盘时未找到光盘。', @@ -66,31 +71,31 @@ const Error = { 19: '从光驱上抓取光盘时错误,请手动将光盘取走再点击重试', 32: '其他错误', } -const Error1 = { - 0: '托盘移动错误', - 1: '墨盒类型错误', - 2: '抓取光盘时未检测到光盘光盘已用完', - 3: '光盘掉落', - 4: '墨水车空警告', - 5: '光盘抓手错误', - 6: '抓取多张光盘错误', - 7: '机械臂挂钩错误或者机械臂归位错误' -} +// const Error1 = { +// 0: '托盘移动错误', +// 1: '墨盒类型错误', +// 2: '抓取光盘时未检测到光盘光盘已用完', +// 3: '光盘掉落', +// 4: '墨水车空警告', +// 5: '光盘抓手错误', +// 6: '抓取多张光盘错误', +// 7: '机械臂挂钩错误或者机械臂归位错误' +// } -const Error2 = { - 0: '墨水车伺服系统错误', - 1: '墨水车失速错误', - 2: '墨盒数据读取错误', - 3: '打印图像超出范围', - 4: '环境温度超出正常使用范围', - 5: '墨盒短路', - 6: '型号错误', - 7: '缓冲区溢出错误' -} +// const Error2 = { +// 0: '墨水车伺服系统错误', +// 1: '墨水车失速错误', +// 2: '墨盒数据读取错误', +// 3: '打印图像超出范围', +// 4: '环境温度超出正常使用范围', +// 5: '墨盒短路', +// 6: '型号错误', +// 7: '缓冲区溢出错误' +// } -const Error3 = { - 0: '光盘已经打印' -} +// const Error3 = { +// 0: '光盘已经打印' +// } // 光驱信息 const CDName = { @@ -122,7 +127,7 @@ const CDTypes = { 6: 'BD_TL', 7: 'BD_QL' } -const size = process.platform === 'linux' ? 1000 : 1024 +const size = 1024 const cd_types = [ { value: 1, @@ -377,7 +382,7 @@ const actions = { } info.strongList = strong_list if (info.cover_flag && info.printer_name !== 'SE3') { - commit('setData', { name: 'printer_error', data: { type: 'error', notify: '设备门盖被打开,请关闭门盖。' } }) + // commit('setData', { name: 'printer_error', data: { type: 'error', notify: '设备门盖被打开,请关闭门盖。' } }) } if (info.calibration_flag) { commit('setData', { name: 'printer_error', data: { type: 'error', notify: '请校准打印机。' } }) @@ -469,36 +474,36 @@ const actions = { }, 500) } } - if (error.error1) { - let errors = error.error1.toString(2).split('').reverse() - 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) - } - } - } - if (error.error2) { - let errors = error.error2.toString(2).split('').reverse() - 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) - } - } - } - if (error.error3) { - let errors = error.error3.toString(2).split('').reverse() - 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) - } - } - } + // if (error.error1) { + // let errors = error.error1.toString(2).split('').reverse() + // 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) + // } + // } + // } + // if (error.error2) { + // let errors = error.error2.toString(2).split('').reverse() + // 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) + // } + // } + // } + // if (error.error3) { + // let errors = error.error3.toString(2).split('').reverse() + // 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) + // } + // } + // } if (error.printer_error) { error.printer_error = '0x' + error.printer_error.toString(16) let continues = ['0x11', '0x12', '0x13', '0x14', '0x15', '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f', '0x21'] diff --git a/src/renderer/utils/index.js b/src/renderer/utils/index.js index 329410f..f829da7 100644 --- a/src/renderer/utils/index.js +++ b/src/renderer/utils/index.js @@ -472,7 +472,7 @@ export const filterSize = (size) => { } export const pow1024 = (num) => { - const size = process.platform === 'linux' ? 1000 : 1024 + const size = 1024 return Math.pow(size, num) } diff --git a/src/renderer/views/dashboard/index.vue b/src/renderer/views/dashboard/index.vue index 7493fe6..d4d7eb4 100644 --- a/src/renderer/views/dashboard/index.vue +++ b/src/renderer/views/dashboard/index.vue @@ -901,7 +901,7 @@ export default { .then(() => { clearTimeout(outTimer) that.currentRunVal = 0 - const size = process.platform === 'linux' ? 1000 : 1024 + const size = 1024 let typeLists = [ { value: 1,