优化提交任务
This commit is contained in:
@@ -145,9 +145,9 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="work_right">
|
||||
<div v-if="form.copy_type == 3" class="flex_box flex_row_center work_no">
|
||||
<!-- <div v-if="form.copy_type == 3" class="flex_box flex_row_center work_no">
|
||||
<img src="@/assets/images/ElBanCircle.png" />
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="flex_box work_right_top">
|
||||
<div class="flex_box">
|
||||
<div class="work_right_top_label">标签</div>
|
||||
@@ -269,7 +269,6 @@ export default {
|
||||
ass_task: [],
|
||||
task_freq: 1,
|
||||
archive_path: '',
|
||||
finished_check: false
|
||||
},
|
||||
testForm: {
|
||||
req_name: 'submit_task',
|
||||
@@ -594,6 +593,8 @@ export default {
|
||||
// 提交
|
||||
workSubmit() {
|
||||
let that = this
|
||||
that.form.ass_task = []
|
||||
that.form.has_copy_task = false
|
||||
const diskSize = this.cd_types.find((item) => item.value === this.form.cd_type).size
|
||||
const files = this.$refs.files.getLists()
|
||||
let fileList = []
|
||||
@@ -619,7 +620,36 @@ export default {
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.setForm.isArrow) {
|
||||
if (that.form.copy_type == 3) {
|
||||
that.$alert('请将光盘装入打开的驱动器,然后手动关闭托盘后点击确定', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
showCancelButton: true,
|
||||
callback: (rel) => {
|
||||
if (rel === 'confirm') {
|
||||
that.form.ass_task = [
|
||||
{
|
||||
ass_task_index: 1
|
||||
}
|
||||
]
|
||||
that.form.has_copy_task = true
|
||||
submit()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
if (that.form.copy_type == 4) {
|
||||
that.$alert('请将需要读取的光盘放入右盘仓,然后点击确定', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
showCancelButton: true,
|
||||
callback: (rel) => {
|
||||
if (rel === 'confirm') {
|
||||
submit()
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function submit() {
|
||||
if (that.setForm.isArrow) {
|
||||
let overList = []
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
if (fileList[i].size > diskSize) {
|
||||
@@ -628,20 +658,20 @@ export default {
|
||||
}
|
||||
if (overList.length) {
|
||||
const fileNames = overList.join(',')
|
||||
this.$notify({
|
||||
message: `文件${fileNames} 大小超过磁盘容量${this.$filterSize(diskSize)},请重新选择文件!`,
|
||||
that.$notify({
|
||||
message: `文件${fileNames} 大小超过磁盘容量${that.$filterSize(diskSize)},请重新选择文件!`,
|
||||
type: 'warning'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.setForm.disk === 2) {
|
||||
if (that.setForm.disk === 2) {
|
||||
// 按文件名排序
|
||||
fileList.sort((a, b) => {
|
||||
if (a.name.toLowerCase() < b.name.toLowerCase()) return -1
|
||||
if (a.name.toLowerCase() > b.name.toLowerCase()) return 1
|
||||
return 0
|
||||
})
|
||||
} else if (this.setForm.disk === 3) {
|
||||
} else if (that.setForm.disk === 3) {
|
||||
// 按文件大小排序
|
||||
fileList.sort((a, b) => a.size - b.size)
|
||||
} else {
|
||||
@@ -657,7 +687,7 @@ export default {
|
||||
}
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
if (fileList[i].size > diskSize) {
|
||||
this.$notify({
|
||||
that.$notify({
|
||||
message: `文件${fileList[i].name} 大小超过设备容量,请重新选择文件!`,
|
||||
type: 'warning'
|
||||
})
|
||||
@@ -689,7 +719,7 @@ export default {
|
||||
task.task_size += fileList[i].size
|
||||
}
|
||||
if (task.task_size > diskSize) {
|
||||
this.$notify({
|
||||
that.$notify({
|
||||
message: `文件大小超过设备容量!`,
|
||||
type: 'warning'
|
||||
})
|
||||
@@ -698,7 +728,7 @@ export default {
|
||||
that.form.ass_task.push(task)
|
||||
}
|
||||
if (that.form.copy_type == 4 && !that.form.archive_path) {
|
||||
this.$notify({
|
||||
that.$notify({
|
||||
message: `请输入光盘数据恢复路径!`,
|
||||
type: 'warning'
|
||||
})
|
||||
@@ -747,29 +777,15 @@ export default {
|
||||
})
|
||||
that.submitLoading = false
|
||||
that.close()
|
||||
if (that.form.copy_type == 3) {
|
||||
that.$alert('请将光盘装入打开的驱动器,然后手动关闭托盘后点击确定', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: () => {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
if (that.form.copy_type == 4) {
|
||||
that.$alert('请将需要读取的光盘放入右盘仓,然后点击确定', '温馨提示', {
|
||||
confirmButtonText: '确定',
|
||||
callback: () => {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}, 1500)
|
||||
}).catch(() => {
|
||||
that.submitLoading = false
|
||||
})
|
||||
}
|
||||
},
|
||||
// 获取模板文件列表
|
||||
getTemplates() {
|
||||
let that = this
|
||||
const filePath = path.join(exePath, 'User Templates');
|
||||
fs.readdir(filePath, (err, files) => {
|
||||
if (err) {
|
||||
@@ -782,7 +798,7 @@ export default {
|
||||
value: path.join('User Templates', file)
|
||||
}
|
||||
})
|
||||
this.templates = fileList
|
||||
that.templates = fileList
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user