优化错误提示,ios文件刻录

This commit is contained in:
24kycj
2025-06-09 18:18:50 +08:00
parent 91e19e4780
commit 0ee97073c0
6 changed files with 98 additions and 64 deletions
@@ -46,7 +46,7 @@ export function getExtension(name) {
export function bytesToSize(bytes) { export function bytesToSize(bytes) {
if (bytes === 0) return "0 B"; 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"], sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
i = Math.floor(Math.log(bytes) / Math.log(k)); i = Math.floor(Math.log(bytes) / Math.log(k));
return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i]; return (bytes / Math.pow(k, i)).toPrecision(3) + " " + sizes[i];
+20 -1
View File
@@ -73,6 +73,10 @@ export default {
saveWorkList: { saveWorkList: {
type: Object | undefined, type: Object | undefined,
}, },
copyType: {
type: Number,
default: 1,
},
}, },
components: { components: {
fileEmpty, fileEmpty,
@@ -140,9 +144,13 @@ export default {
}, },
addFile() { addFile() {
const _this = this; 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 dialog
.showOpenDialog({ .showOpenDialog({
properties: ["multiSelections"], filters,
properties
}) })
.then(async (rel) => { .then(async (rel) => {
console.log(rel); console.log(rel);
@@ -153,6 +161,17 @@ export default {
if (err) { if (err) {
return false; 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({ _this.insertList({
name: getFileName(item), name: getFileName(item),
path: item, path: item,
+14 -4
View File
@@ -124,7 +124,7 @@
<div class="flex_box flex_row_between work_left_top"> <div class="flex_box flex_row_between work_left_top">
<div class="flex_box"> <div class="flex_box">
<div class="work_left_top_label">内容</div> <div class="work_left_top_label">内容</div>
<div @click="addFolder" class="flex_box work_left_top_btn"> <div v-if="form.copy_type !== 2" @click="addFolder" class="flex_box work_left_top_btn">
<img src="@/assets/images/file_icon.png" /> <img src="@/assets/images/file_icon.png" />
<div>添加文件夹</div> <div>添加文件夹</div>
</div> </div>
@@ -142,7 +142,7 @@
<div class="work_files"> <div class="work_files">
<div class="work_files_box"> <div class="work_files_box">
<!-- 文件列表 --> <!-- 文件列表 -->
<files ref="files" :onSizechange="sizeChange" :complete="upload_over"></files> <files ref="files" :copyType="form.copy_type" :onSizechange="sizeChange" :complete="upload_over"></files>
</div> </div>
<div class="work_files_progress"> <div class="work_files_progress">
<el-progress :text-inside="true" :percentage="file_percent" :format="format" <el-progress :text-inside="true" :percentage="file_percent" :format="format"
@@ -270,7 +270,7 @@ export default {
form: { form: {
task_uuid: '', task_uuid: '',
cd_type: 2, cd_type: 2,
copy_type: 2, copy_type: 1,
json_file: '', json_file: '',
udf_file: '', udf_file: '',
label: '2024-10-17', label: '2024-10-17',
@@ -290,7 +290,7 @@ export default {
udf_file: '/home/test/temp.csv', udf_file: '/home/test/temp.csv',
label: '2024-11-07', label: '2024-11-07',
cd_type: 1, cd_type: 1,
copy_type: 2, copy_type: 1,
has_copy_task: true, has_copy_task: true,
has_print_task: true, has_print_task: true,
ass_task: [ ass_task: [
@@ -635,6 +635,16 @@ export default {
console.error('Error reading file:', error) console.error('Error reading file:', error)
} }
} }
let isISO = fileList.every(item => 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) { if (that.form.json_file === '' && fileList.length === 0 && that.form.copy_type !== 3 && that.form.copy_type !== 4) {
this.$notify({ this.$notify({
message: '请上传作业文件', message: '请上传作业文件',
+61 -56
View File
@@ -56,9 +56,14 @@ const Error = {
4: '墨盒容量低', 4: '墨盒容量低',
5: '机械臂移动错误,请按功能按钮重试。', 5: '机械臂移动错误,请按功能按钮重试。',
6: '设备处于离线状态', 6: '设备处于离线状态',
7: '设备门盖被打开', 7: '设备门盖被打开,请关闭门盖。',
8: '从打印托盘上抓取光盘时错误,请手动将光盘取走再点击重试。', 8: '从打印托盘上抓取光盘时错误,请手动将光盘取走再点击重试。',
9: '多张光盘被抓取或移动,请检查后手动将光盘放回原处再点重试,如重试后继续错误,则需校准设备后再来重试。', 9: '多张光盘被抓取或移动,请检查后手动将光盘放回原处再点重试,如重试后继续错误,则需校准设备后再来重试。',
10: '从进盘仓到光驱的过程中,抓取错误,请手动将光盘放回进盘仓后重试。',
11: '从进盘仓到打印托盘的过程中,抓取错误,请手动将光盘放回进盘仓后重试。',
12: '从光驱到打印托盘的过程中,抓取错误,请手动将光盘放回光驱后重试。',
13: '打印机需要校准',
14: '检测墨盒错误',
15: '校准光盘桶失败', 15: '校准光盘桶失败',
16: '等待打印完成超时', 16: '等待打印完成超时',
17: '从打印托盘抓取光盘时未找到光盘。', 17: '从打印托盘抓取光盘时未找到光盘。',
@@ -66,31 +71,31 @@ const Error = {
19: '从光驱上抓取光盘时错误,请手动将光盘取走再点击重试', 19: '从光驱上抓取光盘时错误,请手动将光盘取走再点击重试',
32: '其他错误', 32: '其他错误',
} }
const Error1 = { // const Error1 = {
0: '托盘移动错误', // 0: '托盘移动错误',
1: '墨盒类型错误', // 1: '墨盒类型错误',
2: '抓取光盘时未检测到光盘光盘已用完', // 2: '抓取光盘时未检测到光盘光盘已用完',
3: '光盘掉落', // 3: '光盘掉落',
4: '墨水车空警告', // 4: '墨水车空警告',
5: '光盘抓手错误', // 5: '光盘抓手错误',
6: '抓取多张光盘错误', // 6: '抓取多张光盘错误',
7: '机械臂挂钩错误或者机械臂归位错误' // 7: '机械臂挂钩错误或者机械臂归位错误'
} // }
const Error2 = { // const Error2 = {
0: '墨水车伺服系统错误', // 0: '墨水车伺服系统错误',
1: '墨水车失速错误', // 1: '墨水车失速错误',
2: '墨盒数据读取错误', // 2: '墨盒数据读取错误',
3: '打印图像超出范围', // 3: '打印图像超出范围',
4: '环境温度超出正常使用范围', // 4: '环境温度超出正常使用范围',
5: '墨盒短路', // 5: '墨盒短路',
6: '型号错误', // 6: '型号错误',
7: '缓冲区溢出错误' // 7: '缓冲区溢出错误'
} // }
const Error3 = { // const Error3 = {
0: '光盘已经打印' // 0: '光盘已经打印'
} // }
// 光驱信息 // 光驱信息
const CDName = { const CDName = {
@@ -122,7 +127,7 @@ const CDTypes = {
6: 'BD_TL', 6: 'BD_TL',
7: 'BD_QL' 7: 'BD_QL'
} }
const size = process.platform === 'linux' ? 1000 : 1024 const size = 1024
const cd_types = [ const cd_types = [
{ {
value: 1, value: 1,
@@ -377,7 +382,7 @@ const actions = {
} }
info.strongList = strong_list info.strongList = strong_list
if (info.cover_flag && info.printer_name !== 'SE3') { 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) { if (info.calibration_flag) {
commit('setData', { name: 'printer_error', data: { type: 'error', notify: '请校准打印机。' } }) commit('setData', { name: 'printer_error', data: { type: 'error', notify: '请校准打印机。' } })
@@ -469,36 +474,36 @@ const actions = {
}, 500) }, 500)
} }
} }
if (error.error1) { // if (error.error1) {
let errors = error.error1.toString(2).split('').reverse() // let errors = error.error1.toString(2).split('').reverse()
for (let i = 0; i < errors.length; i++) { // for (let i = 0; i < errors.length; i++) {
if (errors[i] == 1) { // if (errors[i] == 1) {
setTimeout(() => { // setTimeout(() => {
commit('setData', { name: 'printer_error', data: { type: 'error', notify: Error1[i] } }) // commit('setData', { name: 'printer_error', data: { type: 'error', notify: Error1[i] } })
}, 500) // }, 500)
} // }
} // }
} // }
if (error.error2) { // if (error.error2) {
let errors = error.error2.toString(2).split('').reverse() // let errors = error.error2.toString(2).split('').reverse()
for (let i = 0; i < errors.length; i++) { // for (let i = 0; i < errors.length; i++) {
if (errors[i] == 1) { // if (errors[i] == 1) {
setTimeout(() => { // setTimeout(() => {
commit('setData', { name: 'printer_error', data: { type: 'error', notify: Error2[i] } }) // commit('setData', { name: 'printer_error', data: { type: 'error', notify: Error2[i] } })
}, 500) // }, 500)
} // }
} // }
} // }
if (error.error3) { // if (error.error3) {
let errors = error.error3.toString(2).split('').reverse() // let errors = error.error3.toString(2).split('').reverse()
for (let i = 0; i < errors.length; i++) { // for (let i = 0; i < errors.length; i++) {
if (errors[i] == 1) { // if (errors[i] == 1) {
setTimeout(() => { // setTimeout(() => {
commit('setData', { name: 'printer_error', data: { type: 'error', notify: Error3[i] } }) // commit('setData', { name: 'printer_error', data: { type: 'error', notify: Error3[i] } })
}, 500) // }, 500)
} // }
} // }
} // }
if (error.printer_error) { if (error.printer_error) {
error.printer_error = '0x' + error.printer_error.toString(16) 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'] let continues = ['0x11', '0x12', '0x13', '0x14', '0x15', '0x16', '0x17', '0x18', '0x19', '0x1a', '0x1b', '0x1c', '0x1d', '0x1e', '0x1f', '0x21']
+1 -1
View File
@@ -472,7 +472,7 @@ export const filterSize = (size) => {
} }
export const pow1024 = (num) => { export const pow1024 = (num) => {
const size = process.platform === 'linux' ? 1000 : 1024 const size = 1024
return Math.pow(size, num) return Math.pow(size, num)
} }
+1 -1
View File
@@ -901,7 +901,7 @@ export default {
.then(() => { .then(() => {
clearTimeout(outTimer) clearTimeout(outTimer)
that.currentRunVal = 0 that.currentRunVal = 0
const size = process.platform === 'linux' ? 1000 : 1024 const size = 1024
let typeLists = [ let typeLists = [
{ {
value: 1, value: 1,