|
|
@@ -79,15 +79,7 @@
|
|
|
@click="handleBatchUnlink"
|
|
|
>
|
|
|
<el-icon><Link /></el-icon>
|
|
|
- 取消运费
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- class="btn-ghost"
|
|
|
- :disabled="selectedFreightIds.length !== 1"
|
|
|
- @click="openEditSelected"
|
|
|
- >
|
|
|
- <el-icon><Edit /></el-icon>
|
|
|
- 编辑运费
|
|
|
+ 取消样本关联
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -126,9 +118,14 @@
|
|
|
header-align="center"
|
|
|
>
|
|
|
<template #default="{ row }">
|
|
|
- <el-tag type="primary" size="small" effect="plain">
|
|
|
- {{ row.transportModeLabel || row.transportMode || '—' }}
|
|
|
+ <el-tag
|
|
|
+ v-if="row.transportMode || row.transportModeLabel"
|
|
|
+ :type="transportTypeTagType(String(row.transportMode || ''))"
|
|
|
+ size="small"
|
|
|
+ >
|
|
|
+ {{ row.transportModeLabel || transportTypeLabel(String(row.transportMode || '')) || '—' }}
|
|
|
</el-tag>
|
|
|
+ <span v-else class="muted">—</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
@@ -151,10 +148,10 @@
|
|
|
<template #default="{ row }">
|
|
|
<el-tag
|
|
|
v-if="row.sampleSource"
|
|
|
- :type="row.sampleSource === 'cell_storage' ? 'success' : 'warning'"
|
|
|
+ :type="receptionSourceTagType(String(row.sampleSource || ''))"
|
|
|
size="small"
|
|
|
>
|
|
|
- {{ row.sampleSource === 'cell_storage' ? '细胞存储' : '科研捐赠' }}
|
|
|
+ {{ receptionSourceLabel(String(row.sampleSource || '')) }}
|
|
|
</el-tag>
|
|
|
<span v-else class="muted">—</span>
|
|
|
</template>
|
|
|
@@ -225,7 +222,7 @@
|
|
|
<el-table-column
|
|
|
prop="actions"
|
|
|
label="操作"
|
|
|
- min-width="180"
|
|
|
+ min-width="280"
|
|
|
fixed="right"
|
|
|
align="center"
|
|
|
header-align="center"
|
|
|
@@ -238,7 +235,11 @@
|
|
|
</el-button>
|
|
|
<el-button class="btn-op-item" @click="openUnlinkDialog(row.freightId)">
|
|
|
<el-icon><Link /></el-icon>
|
|
|
- 取消运费
|
|
|
+ 取消样本关联
|
|
|
+ </el-button>
|
|
|
+ <el-button class="btn-op-item" type="danger" plain @click="handleDelete(row)">
|
|
|
+ <el-icon><Delete /></el-icon>
|
|
|
+ 删除
|
|
|
</el-button>
|
|
|
</div>
|
|
|
</template>
|
|
|
@@ -263,6 +264,9 @@
|
|
|
|
|
|
<FreightUnlinkDialog
|
|
|
v-model="unlinkVisible"
|
|
|
+ title="取消样本关联"
|
|
|
+ hint="勾选要取消关联的样本:"
|
|
|
+ empty-warning="请勾选要取消关联的样本"
|
|
|
:items="unlinkDialogItems"
|
|
|
:default-selected-keys="unlinkDefaultKeys"
|
|
|
:submitting="unlinkSubmitting"
|
|
|
@@ -272,9 +276,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
- import { Edit, Link, Plus, RefreshLeft, Search } from '@element-plus/icons-vue'
|
|
|
+ import { Delete, Edit, Link, Plus, RefreshLeft, Search } from '@element-plus/icons-vue'
|
|
|
import { fetchDictDataOptions } from '@/api/admin'
|
|
|
import {
|
|
|
+ fetchDeleteSampleFreight,
|
|
|
fetchSampleFreightDetail,
|
|
|
fetchSampleFreightList,
|
|
|
fetchUnlinkSampleFreight,
|
|
|
@@ -285,6 +290,12 @@
|
|
|
} from '@/components/business/freight-unlink-dialog/index.vue'
|
|
|
import { formatDisplayOrDash } from '@/utils/datetime-display'
|
|
|
import { formatMoneyDisplay } from '@/utils/money-format'
|
|
|
+ import {
|
|
|
+ receptionSourceLabel,
|
|
|
+ receptionSourceTagType,
|
|
|
+ transportTypeLabel,
|
|
|
+ transportTypeTagType
|
|
|
+ } from '@/utils/status-tag-registry'
|
|
|
import {
|
|
|
flattenSampleFreights,
|
|
|
sampleFreightSpanMethod,
|
|
|
@@ -411,9 +422,23 @@
|
|
|
editDialogRef.value?.open(f)
|
|
|
}
|
|
|
|
|
|
- function openEditSelected() {
|
|
|
- if (selectedFreightIds.value.length !== 1) return
|
|
|
- openEditById(selectedFreightIds.value[0])
|
|
|
+ function handleDelete(row: FlatRow) {
|
|
|
+ const freightId = String(row.freightId || '').trim()
|
|
|
+ if (!freightId) return
|
|
|
+ const batchNo = String(row.batchNo || freightId).trim()
|
|
|
+ const linked = Number(row.linkedSampleCount || 0)
|
|
|
+ const linkHint =
|
|
|
+ linked > 0 ? `将解除其全部 ${linked} 条关联样本,并删除该运费单。` : '将删除该运费单。'
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ `确认删除运费批次「${batchNo}」吗?${linkHint}`,
|
|
|
+ '删除确认',
|
|
|
+ { type: 'warning', confirmButtonText: '删除', cancelButtonText: '取消' }
|
|
|
+ )
|
|
|
+ .then(async () => {
|
|
|
+ await fetchDeleteSampleFreight(freightId)
|
|
|
+ await loadData()
|
|
|
+ })
|
|
|
+ .catch(() => undefined)
|
|
|
}
|
|
|
|
|
|
function toUnlinkRow(it: NonNullable<SampleFreight['items']>[number], freightId: string): FreightUnlinkRow {
|
|
|
@@ -460,7 +485,7 @@
|
|
|
unlinkVisible.value = false
|
|
|
await loadData()
|
|
|
} catch (e: any) {
|
|
|
- ElMessage.error(e?.message || '取消运费失败')
|
|
|
+ ElMessage.error(e?.message || '取消样本关联失败')
|
|
|
} finally {
|
|
|
unlinkSubmitting.value = false
|
|
|
}
|