|
|
@ -80,6 +80,63 @@ |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<el-dialog |
|
|
|
|
|
title="真实数据预览参数" |
|
|
|
|
|
:visible.sync="realDataPreviewDialogVisible" |
|
|
|
|
|
width="460px" |
|
|
|
|
|
:close-on-click-modal="false" |
|
|
|
|
|
> |
|
|
|
|
|
<div class="real-preview-hint">外箱/内箱标签预览请先输入IFS查询参数</div> |
|
|
|
|
|
<el-form label-width="110px" size="mini"> |
|
|
|
|
|
<el-form-item label="consignmentId"> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model.trim="realDataPreviewParams.consignmentId" |
|
|
|
|
|
placeholder="请输入 consignmentId" |
|
|
|
|
|
clearable |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item label="jobNo"> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model.trim="realDataPreviewParams.jobNo" |
|
|
|
|
|
placeholder="请输入 jobNo" |
|
|
|
|
|
clearable |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item label="lineNo"> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model.trim="realDataPreviewParams.lineNo" |
|
|
|
|
|
placeholder="请输入 lineNo" |
|
|
|
|
|
clearable |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item label="relNo"> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model.trim="realDataPreviewParams.relNo" |
|
|
|
|
|
placeholder="请输入 relNo" |
|
|
|
|
|
clearable |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
<el-form-item label="lineItemNo"> |
|
|
|
|
|
<el-input |
|
|
|
|
|
v-model.trim="realDataPreviewParams.lineItemNo" |
|
|
|
|
|
placeholder="请输入 lineItemNo" |
|
|
|
|
|
clearable |
|
|
|
|
|
/> |
|
|
|
|
|
</el-form-item> |
|
|
|
|
|
</el-form> |
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
|
|
<el-button size="mini" @click="realDataPreviewDialogVisible = false">取消</el-button> |
|
|
|
|
|
<el-button |
|
|
|
|
|
type="primary" |
|
|
|
|
|
size="mini" |
|
|
|
|
|
:loading="realDataPreviewLoading" |
|
|
|
|
|
@click="handleRealDataPreviewConfirm" |
|
|
|
|
|
> |
|
|
|
|
|
确认预览 |
|
|
|
|
|
</el-button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
<!-- 预览图片 --> |
|
|
<!-- 预览图片 --> |
|
|
<div v-if="previewImage" class="preview-image"> |
|
|
<div v-if="previewImage" class="preview-image"> |
|
|
<img |
|
|
<img |
|
|
@ -149,6 +206,14 @@ export default { |
|
|
realDataPreviewLoading: false, |
|
|
realDataPreviewLoading: false, |
|
|
pdfExportLoading: false, |
|
|
pdfExportLoading: false, |
|
|
autoPreview: true, // 默认开启实时预览 |
|
|
autoPreview: true, // 默认开启实时预览 |
|
|
|
|
|
realDataPreviewDialogVisible: false, |
|
|
|
|
|
realDataPreviewParams: { |
|
|
|
|
|
consignmentId: '', |
|
|
|
|
|
jobNo: '', |
|
|
|
|
|
lineNo: '', |
|
|
|
|
|
relNo: '', |
|
|
|
|
|
lineItemNo: '' |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
computed: { |
|
|
computed: { |
|
|
@ -335,6 +400,60 @@ export default { |
|
|
console.log('预览已清除') |
|
|
console.log('预览已清除') |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getCurrentLabelType() { |
|
|
|
|
|
const labelSetting = this.$route.params.labelSetting || {} |
|
|
|
|
|
return (labelSetting.labelType || '').trim() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isBoxLabelType(labelType) { |
|
|
|
|
|
return ['外箱标签', '内箱标签'].includes(labelType) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
buildRealDataPreviewQueryParams() { |
|
|
|
|
|
const consignmentId = (this.realDataPreviewParams.consignmentId || '').trim() |
|
|
|
|
|
const jobNo = (this.realDataPreviewParams.jobNo || '').trim() |
|
|
|
|
|
const lineNo = (this.realDataPreviewParams.lineNo || '').trim() |
|
|
|
|
|
const relNo = (this.realDataPreviewParams.relNo || '').trim() |
|
|
|
|
|
const lineItemNo = (this.realDataPreviewParams.lineItemNo || '').toString().trim() |
|
|
|
|
|
|
|
|
|
|
|
if (!consignmentId || !jobNo || !lineNo || !relNo || lineItemNo === '') { |
|
|
|
|
|
this.$message.warning('请完整填写真实数据预览参数') |
|
|
|
|
|
return null |
|
|
|
|
|
} |
|
|
|
|
|
if (!/^\d+$/.test(consignmentId)) { |
|
|
|
|
|
this.$message.warning('发货单ID必须为整数') |
|
|
|
|
|
return null |
|
|
|
|
|
} |
|
|
|
|
|
if (!/^-?\d+$/.test(lineItemNo)) { |
|
|
|
|
|
this.$message.warning('行项目号必须为整数') |
|
|
|
|
|
return null |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return { |
|
|
|
|
|
consignmentId: Number(consignmentId), |
|
|
|
|
|
jobNo: jobNo, |
|
|
|
|
|
lineNo: lineNo, |
|
|
|
|
|
relNo: relNo, |
|
|
|
|
|
lineItemNo: Number(lineItemNo) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async handleRealDataPreviewConfirm() { |
|
|
|
|
|
const reportId = this.$route.params.labelSetting && this.$route.params.labelSetting.labelNo |
|
|
|
|
|
if (!reportId) { |
|
|
|
|
|
this.$message.warning('请先设置标签编号') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const queryParams = this.buildRealDataPreviewQueryParams() |
|
|
|
|
|
if (!queryParams) { |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.realDataPreviewDialogVisible = false |
|
|
|
|
|
await this.executeRealDataPreview(reportId, queryParams) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
async generateRealDataPreview() { |
|
|
async generateRealDataPreview() { |
|
|
const reportId = this.$route.params.labelSetting && this.$route.params.labelSetting.labelNo |
|
|
const reportId = this.$route.params.labelSetting && this.$route.params.labelSetting.labelNo |
|
|
if (!reportId) { |
|
|
if (!reportId) { |
|
|
@ -348,6 +467,16 @@ export default { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const labelType = this.getCurrentLabelType() |
|
|
|
|
|
if (this.isBoxLabelType(labelType)) { |
|
|
|
|
|
this.realDataPreviewDialogVisible = true |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await this.executeRealDataPreview(reportId) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
async executeRealDataPreview(reportId, queryParams = {}) { |
|
|
this.realDataPreviewLoading = true |
|
|
this.realDataPreviewLoading = true |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
@ -360,7 +489,8 @@ export default { |
|
|
|
|
|
|
|
|
// 3. 调用真实数据预览API |
|
|
// 3. 调用真实数据预览API |
|
|
const response = await previewLabelWithRealData({ |
|
|
const response = await previewLabelWithRealData({ |
|
|
reportId: reportId |
|
|
|
|
|
|
|
|
reportId: reportId, |
|
|
|
|
|
...queryParams |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
if (response && response.data && response.data.code === 200) { |
|
|
if (response && response.data && response.data.code === 200) { |
|
|
@ -598,6 +728,12 @@ export default { |
|
|
font-weight: 600; |
|
|
font-weight: 600; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
.real-preview-hint { |
|
|
|
|
|
margin-bottom: 10px; |
|
|
|
|
|
color: #606266; |
|
|
|
|
|
font-size: 12px; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
.preview-image { |
|
|
.preview-image { |
|
|
margin-bottom: 16px; |
|
|
margin-bottom: 16px; |
|
|
text-align: center; |
|
|
text-align: center; |
|
|
|