1、调整导入运单

2、调整对账
This commit is contained in:
2026-09-10 02:01:28 +08:00
parent 70bb94a2e6
commit 6ff672211f
9 changed files with 272 additions and 38 deletions
+100 -12
View File
@@ -90,9 +90,9 @@
width="100"
/><el-table-column
prop="relatedWaybillCount"
label="已关联运单"
width="115"
/><el-table-column prop="unRelatedWaybillCount" label="未关联运单" width="115" />
label="凭证已关联数量"
width="125"
/><el-table-column prop="unRelatedWaybillCount" label="凭证未关联数量" width="125" />
<el-table-column prop="createTime" label="创建时间" min-width="170" />
<el-table-column
prop="auditStatus"
@@ -100,7 +100,16 @@
width="120"
fixed="right"
align="center"
/><el-table-column label="操作" width="320" fixed="right" align="left"
><template #default="{ row }"
><span class="voucher-manage-page__audit-status"
><span>{{ row.auditStatus }}</span
><el-tooltip
v-if="row.auditStatus === '审核驳回' && hasRejectReason(row)"
:content="row.rejectReason"
placement="top"
><el-icon class="voucher-manage-page__audit-reject-icon"><WarnTriangleFilled /></el-icon
></el-tooltip></span></template
></el-table-column><el-table-column label="操作" width="320" fixed="right" align="center"
><template #default="{ row }"
><div class="voucher-manage-page__actions">
<el-link
@@ -128,12 +137,12 @@
><el-link
v-if="row.auditStatus === '审核驳回'"
type="primary"
@click="openUpload(row, 'changeBatch')"
@click="openBatchDialog(row)"
>更换运单批次</el-link
><el-link
v-if="row.processStatus !== '处理完成' || row.auditStatus === '待审核'"
v-if="(row.processStatus !== '处理完成' || row.auditStatus === '待审核') && row.auditStatus !== '审核驳回'"
type="primary"
@click="openUpload(row)"
@click="openBatchDialog(row)"
>更换运单批次</el-link
><el-link
v-if="row.processStatus === '上传中' || row.auditStatus === '审核驳回'"
@@ -328,7 +337,11 @@
placeholder="请输入" /></el-form-item></el-col
><el-col :span="12"
><el-form-item label="运单数"
><el-input-number v-model="batchQuery.waybillCount" :min="0" /></el-form-item></el-col
><el-input
v-model="batchQuery.waybillCount"
clearable
placeholder="请输入"
@input="handleWaybillCountInput" /></el-form-item></el-col
></el-row>
<div class="voucher-manage-page__search-actions">
<el-button type="primary" @click="loadBatches">查询</el-button
@@ -373,7 +386,7 @@
</div>
<template #footer
><el-button @click="batchVisible = false">取消</el-button
><el-button type="primary" @click="confirmBatches">确认</el-button></template
><el-button type="primary" :loading="batchSaving" @click="confirmBatches">确认</el-button></template
>
</el-dialog>
@@ -484,6 +497,7 @@ import { useRouter } from 'vue-router';
import { useStore } from 'vuex';
import md5 from 'js-md5';
import { ElMessage, ElMessageBox } from 'element-plus';
import { WarnTriangleFilled } from '@element-plus/icons-vue';
import { getList as getProjectList } from '@/api/business/project-apply';
import * as api from '@/api/business/voucher-manage';
import SectionCard from '@/components/section-card/main.vue';
@@ -499,6 +513,12 @@ const hasPermission = code => {
if (isAdmin.value) return true;
return permission.value?.[code] === true;
};
const hasRejectReason = row => {
const reason = row?.rejectReason;
return typeof reason === 'string'
? reason.trim().length > 0
: reason !== undefined && reason !== null;
};
// 判断当前用户是否为承运商(顶级组织是否为"外部组织")
const isCarrier = ref(false);
@@ -521,6 +541,9 @@ const loading = ref(false),
detailRow = ref({}),
uploadVisible = ref(false),
batchVisible = ref(false),
batchDialogMode = ref('upload'),
batchTarget = ref(),
batchSaving = ref(false),
progressVisible = ref(false),
uploadFormRef = ref(),
uploading = ref(false),
@@ -862,9 +885,16 @@ watch(uploadVisible, visible => {
// 兜底处理:右上角、遮罩、Esc 直接修改 v-model 时仍必须停止上传。
if (!visible && !closingUploadDialog.value) void stopCurrentUpload(editing.fileTaskId);
});
const openBatchDialog = async () => {
const openBatchDialog = async row => {
batchDialogMode.value = row ? 'change' : 'upload';
batchTarget.value = row;
batchSelection.value = [];
batchVisible.value = true;
await loadBatches();
if (row?.waybillBatchNo) {
const currentBatch = batchRows.value.find(item => item.batchNo === row.waybillBatchNo);
if (currentBatch) batchSelection.value = [currentBatch];
}
};
const loadBatches = async () => {
const res = await api.getWaybillBatches(batchPage.current, batchPage.size, {
@@ -878,13 +908,56 @@ const loadBatches = async () => {
batchRows.value = data.records || [];
batchPage.total = data.total || 0;
};
const handleWaybillCountInput = value => {
// 只允许输入正整数
const filtered = value.replace(/[^\d]/g, '');
if (filtered !== value) {
batchQuery.waybillCount = filtered;
}
// 移除前导零
if (filtered.length > 1 && filtered.startsWith('0')) {
batchQuery.waybillCount = filtered.replace(/^0+/, '');
}
};
const resetBatchQuery = () => {
Object.assign(batchQuery, { batchNo: '', createUser: '', waybillCount: undefined });
batchCreateRange.value = [];
batchPage.current = 1;
loadBatches();
};
const selectBatch = row => {
const updateWaybillBatch = async (target, selected) => {
if (!target?.id) {
ElMessage.error('缺少凭证批次信息');
return false;
}
if (!selected?.batchNo) {
ElMessage.warning('请选择运单批次');
return false;
}
batchSaving.value = true;
try {
await api.changeWaybillBatch({
voucherId: target.id,
waybillImportBatchIds: [selected.id],
});
target.waybillBatchNo = selected.batchNo;
batchVisible.value = false;
ElMessage.success('运单批次更换成功,已提交重新匹配任务');
await load();
return true;
} catch (error) {
ElMessage.error(error.message || '运单批次更换失败');
return false;
} finally {
batchSaving.value = false;
}
};
const selectBatch = async row => {
if (batchDialogMode.value === 'change') {
batchSelection.value = [row];
await updateWaybillBatch(batchTarget.value, row);
return;
}
const batches = new Map();
selectedBatches.value.forEach(item => {
if (!batches.has(item.batchNo)) batches.set(item.batchNo, item);
@@ -894,7 +967,12 @@ const selectBatch = row => {
editing.waybillImportBatchIds = selectedBatches.value.map(item => item.id);
batchVisible.value = false;
};
const confirmBatches = () => {
const confirmBatches = async () => {
if (batchDialogMode.value === 'change') {
const selected = batchSelection.value[0];
await updateWaybillBatch(batchTarget.value, selected);
return;
}
const batches = new Map();
batchSelection.value.forEach(item => {
if (!batches.has(item.batchNo)) batches.set(item.batchNo, item);
@@ -1240,9 +1318,19 @@ load();
padding: 0;
min-height: auto;
}
&__audit-status {
display: inline-flex;
align-items: center;
}
&__audit-reject-icon {
margin-left: 4px;
color: #f56c6c;
cursor: help;
}
&__actions {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 2px 12px;
}
&__pagination {