✨ 导入运单支持未结算整批删除,结算导入运输方式取业务字典
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -96,22 +96,12 @@
|
||||
prop="carrierName"
|
||||
label="承运商"
|
||||
min-width="140"
|
||||
/><el-table-column
|
||||
v-if="columnVisible.carrierType"
|
||||
prop="carrierType"
|
||||
label="承运类型"
|
||||
min-width="120"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="columnVisible.waybillCount"
|
||||
prop="waybillCount"
|
||||
label="运单数"
|
||||
width="90"
|
||||
/> <el-table-column
|
||||
v-if="columnVisible.importTypeName"
|
||||
prop="importTypeName"
|
||||
label="导入方式"
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="columnVisible.statusName"
|
||||
@@ -119,6 +109,12 @@
|
||||
label="状态"
|
||||
width="100"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="columnVisible.settlementStatusName"
|
||||
prop="settlementStatusName"
|
||||
label="结算状态"
|
||||
width="110"
|
||||
/>
|
||||
<el-table-column
|
||||
v-if="columnVisible.createUserName"
|
||||
prop="createUserName"
|
||||
@@ -159,7 +155,7 @@
|
||||
>编辑</el-link
|
||||
>
|
||||
<el-link
|
||||
v-if="row.importStatus === 'draft'"
|
||||
v-if="canRemoveBatch(row)"
|
||||
type="danger"
|
||||
@click="removeBatch(row)"
|
||||
>删除</el-link
|
||||
@@ -641,10 +637,9 @@ const columnOptions = [
|
||||
{ prop: 'batchNo', label: '运单批次号' },
|
||||
{ prop: 'projectName', label: '项目名称' },
|
||||
{ prop: 'carrierName', label: '承运商' },
|
||||
{ prop: 'carrierType', label: '承运类型' },
|
||||
{ prop: 'waybillCount', label: '运单数' },
|
||||
{ prop: 'importTypeName', label: '导入方式' },
|
||||
{ prop: 'statusName', label: '状态' },
|
||||
{ prop: 'settlementStatusName', label: '结算状态' },
|
||||
{ prop: 'createUserName', label: '创建人' },
|
||||
{ prop: 'createTime', label: '创建时间' },
|
||||
{ prop: 'updateTime', label: '更新时间' },
|
||||
@@ -1266,26 +1261,46 @@ const fillEditForm = async row => {
|
||||
if (carrierValue) carrierChange(carrierValue);
|
||||
await loadBatchRows(snapshot.id);
|
||||
};
|
||||
/** 与行操作一致:仅草稿可删除 */
|
||||
const canRemoveBatch = row => String(row?.importStatus || '') === 'draft';
|
||||
const removeBatches = () => {
|
||||
/** 与后端一致:仅未结算批次可整批删除 */
|
||||
const canRemoveBatch = row => String(row?.settlementStatus || 'unsettled') === 'unsettled';
|
||||
const removeBatches = async () => {
|
||||
if (!selected.value.length) {
|
||||
ElMessage.warning('请选择至少一条数据');
|
||||
return;
|
||||
}
|
||||
// 选中含不可删条目时整批拦截(含已完成/进行中),不静默跳过
|
||||
// 选中含部分结算/已结算时整批拦截,不静默跳过
|
||||
if (selected.value.some(row => !canRemoveBatch(row))) {
|
||||
ElMessage.warning('已完成运单不可删除');
|
||||
ElMessage.warning('仅未结算的运单批次可以删除');
|
||||
return;
|
||||
}
|
||||
return api.removeImportBatches(selected.value.map(item => item.id).join(',')).then(loadBatches);
|
||||
try {
|
||||
await ElMessageBox.confirm('确认删除选中的运单批次?删除后不可恢复。', '提示', {
|
||||
type: 'warning',
|
||||
});
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await api.removeImportBatches(selected.value.map(item => item.id).join(','));
|
||||
ElMessage.success('删除成功');
|
||||
return loadBatches();
|
||||
};
|
||||
const removeBatch = row => {
|
||||
const removeBatch = async row => {
|
||||
if (!canRemoveBatch(row)) {
|
||||
ElMessage.warning('已完成运单不可删除');
|
||||
ElMessage.warning('仅未结算的运单批次可以删除');
|
||||
return;
|
||||
}
|
||||
return api.removeImportBatches(row.id).then(loadBatches);
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
`确认删除运单批次「${row.batchNo || ''}」?删除后不可恢复。`,
|
||||
'提示',
|
||||
{ type: 'warning' }
|
||||
);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await api.removeImportBatches(row.id);
|
||||
ElMessage.success('删除成功');
|
||||
return loadBatches();
|
||||
};
|
||||
const projectChange = async id => {
|
||||
const requestId = ++projectRequestId;
|
||||
|
||||
@@ -1378,22 +1378,18 @@ const confirmImport = async () => {
|
||||
|
||||
const loadTransportTypeOptions = async () => {
|
||||
try {
|
||||
// 运输方式取业务字典 transport_type 的字典名称(dictValue),不写死枚举
|
||||
const response = await getDictionary({ code: 'transport_type' });
|
||||
const list = unwrapData(response) || [];
|
||||
transportTypeOptions.value = (Array.isArray(list) ? list : [])
|
||||
.map(item => {
|
||||
const label = item.dictValue || item.label || item.name || '';
|
||||
const value = item.dictValue || item.dictKey || item.value || label;
|
||||
return label ? { label, value } : null;
|
||||
const label = String(item.dictValue || item.label || item.name || '').trim();
|
||||
if (!label || String(item.dictKey) === '-1') return null;
|
||||
return { label, value: label };
|
||||
})
|
||||
.filter(Boolean);
|
||||
} catch (error) {
|
||||
transportTypeOptions.value = [
|
||||
{ label: '公路运输', value: '公路运输' },
|
||||
{ label: '铁路运输', value: '铁路运输' },
|
||||
{ label: '水路运输', value: '水路运输' },
|
||||
{ label: '航空运输', value: '航空运输' },
|
||||
];
|
||||
transportTypeOptions.value = [];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user