|
|
|
@ -272,6 +272,9 @@ |
|
|
|
<i class="el-icon-warning" style="margin-right: 8px;"></i> |
|
|
|
Sheet处理警告 (共{{ sheetErrors.length }}个Sheet存在问题) |
|
|
|
</span> |
|
|
|
<div v-if="hasReadyDateEmptyError" style="margin-top: 6px; color: #F56C6C; font-size: 12px;"> |
|
|
|
Sheet [{{ readyDateEmptySheetNames.join('、') }}] 存在 Cargo Ready Date 为空,修正后才可提交 |
|
|
|
</div> |
|
|
|
<el-table :data="sheetErrors" border style="width: 100%" max-height="400" class="delClass warning-table"> |
|
|
|
<el-table-column prop="sheetName" label="Sheet名称" width="150" fixed="left" > |
|
|
|
<template slot-scope="scope"> |
|
|
|
@ -670,6 +673,27 @@ |
|
|
|
// 物料不存在的发票 |
|
|
|
invalidInvoices() { |
|
|
|
return this.previewData.filter(item => item.hasInvalidMaterials) |
|
|
|
}, |
|
|
|
// 存在Cargo Ready Date空值的Sheet |
|
|
|
readyDateEmptySheetNames() { |
|
|
|
const readyDateEmptyKeyword = '[Cargo Ready Date] 列不能为空' |
|
|
|
const sheetNames = [] |
|
|
|
const errors = Array.isArray(this.sheetErrors) ? this.sheetErrors : [] |
|
|
|
errors.forEach(item => { |
|
|
|
if (!item || !item.sheetName || !Array.isArray(item.errorDetails)) { |
|
|
|
return |
|
|
|
} |
|
|
|
const hasReadyDateEmptyError = item.errorDetails.some(detail => |
|
|
|
detail && detail.indexOf(readyDateEmptyKeyword) !== -1 |
|
|
|
) |
|
|
|
if (hasReadyDateEmptyError && sheetNames.indexOf(item.sheetName) === -1) { |
|
|
|
sheetNames.push(item.sheetName) |
|
|
|
} |
|
|
|
}) |
|
|
|
return sheetNames |
|
|
|
}, |
|
|
|
hasReadyDateEmptyError() { |
|
|
|
return this.readyDateEmptySheetNames.length > 0 |
|
|
|
} |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
@ -735,6 +759,7 @@ |
|
|
|
} : null, |
|
|
|
showPreview: this.showPreview, |
|
|
|
previewData: this.previewData, |
|
|
|
sheetErrors: this.sheetErrors, |
|
|
|
deletedInvoices: this.deletedInvoices, |
|
|
|
fileList: this.fileList.map(file => ({ |
|
|
|
name: file.name, |
|
|
|
@ -764,6 +789,7 @@ |
|
|
|
if (parsedData.previewData && parsedData.previewData.length > 0) { |
|
|
|
this.previewData = parsedData.previewData; |
|
|
|
this.showPreview = parsedData.showPreview || false; |
|
|
|
this.sheetErrors = parsedData.sheetErrors || []; |
|
|
|
} |
|
|
|
|
|
|
|
// 恢复删除的发票号列表 |
|
|
|
@ -1193,7 +1219,14 @@ |
|
|
|
message += `${skippedCount > 0 ? ',' : '('}${errorCount}个处理失败` |
|
|
|
} |
|
|
|
message += '),请查看详细信息' |
|
|
|
this.$message.warning(message) |
|
|
|
if (this.hasReadyDateEmptyError) { |
|
|
|
message += `。Sheet [${this.readyDateEmptySheetNames.join('、')}] 存在 Cargo Ready Date 为空,暂不允许提交` |
|
|
|
} |
|
|
|
this.$message({ |
|
|
|
type: 'warning', |
|
|
|
message: message, |
|
|
|
duration: 2000 |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// 为每个发票号初始化客户信息 |
|
|
|
@ -1223,6 +1256,11 @@ |
|
|
|
|
|
|
|
// 从预览数据保存 |
|
|
|
saveFromPreview() { |
|
|
|
if (this.hasReadyDateEmptyError) { |
|
|
|
this.$message.error(this.getReadyDateEmptySubmitMessage()) |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
// 检查是否有可导入的发票 |
|
|
|
if (this.validInvoices.length === 0) { |
|
|
|
this.$message.warning('没有可导入的发票!') |
|
|
|
@ -1344,6 +1382,13 @@ |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
getReadyDateEmptySubmitMessage() { |
|
|
|
if (!this.readyDateEmptySheetNames.length) { |
|
|
|
return '存在Cargo Ready Date为空的数据,请修正后再提交' |
|
|
|
} |
|
|
|
return `提交失败:Sheet [${this.readyDateEmptySheetNames.join('、')}] 存在 Cargo Ready Date 为空,请修正Excel后重新上传` |
|
|
|
}, |
|
|
|
|
|
|
|
// 取消预览 |
|
|
|
cancelPreview() { |
|
|
|
this.showPreview = false |
|
|
|
@ -1698,9 +1743,9 @@ |
|
|
|
* @return {boolean} 是否可以保存 |
|
|
|
*/ |
|
|
|
isRowReadyForSave(row) { |
|
|
|
return !!(row.selectedTemplate && |
|
|
|
row.selectedTemplate.trim() && |
|
|
|
row.selectedCustomer && |
|
|
|
return !!(row.selectedTemplate && |
|
|
|
row.selectedTemplate.trim() && |
|
|
|
row.selectedCustomer && |
|
|
|
row.selectedCustomer.trim()) |
|
|
|
}, |
|
|
|
|
|
|
|
@ -1730,7 +1775,7 @@ |
|
|
|
// 判断操作类型,给用户明确提示 |
|
|
|
const isNewTemplate = !row.originalTemplateName || row.originalTemplateName === '' |
|
|
|
const isNameChanged = row.originalTemplateName && row.selectedTemplate !== row.originalTemplateName |
|
|
|
|
|
|
|
|
|
|
|
let confirmMessage = '' |
|
|
|
if (isNewTemplate) { |
|
|
|
// 手动输入的新模板名 |
|
|
|
@ -1789,7 +1834,7 @@ |
|
|
|
} else { |
|
|
|
this.$message.success(`模板"${row.selectedTemplate}"更新成功!`) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 保存成功后更新缓存 |
|
|
|
this.saveToCache() |
|
|
|
} else { |
|
|
|
|