This commit is contained in:
zlwu committed 2026-05-28 00:15:29 +08:00
1 parent c137b46939
commit b6c63591ea
126 files changed
+41593 -22990

No files matched your search

@@ -20,6 +20,10 @@
<span class="label-k">工单</span>
<span class="label-v wo" :title="workOrderLabel">{{ workOrderLabel }}</span>
</div>
<div v-if="workOrderTypeLabel" class="label-line">
<span class="label-k">类型</span>
<span class="label-v wo-type" :title="workOrderTypeLabel">{{ workOrderTypeLabel }}</span>
</div>
<div v-if="taskLabel" class="label-line">
<span class="label-k">任务</span>
<span class="label-v task" :title="taskLabel">{{ taskLabel }}</span>
@@ -84,8 +88,11 @@
const labelY = computed(() => path.value[2])
const workOrderLabel = computed(() => props.data?.workOrderNo?.trim() || '')
const workOrderTypeLabel = computed(() => props.data?.workOrderTypeLabel?.trim() || '')
const taskLabel = computed(() => props.data?.taskNo?.trim() || '')
const hasLabel = computed(() => Boolean(workOrderLabel.value || taskLabel.value))
const hasLabel = computed(
() => Boolean(workOrderLabel.value || workOrderTypeLabel.value || taskLabel.value)
)
const labelStyle = computed(() => ({
transform: `translate(-50%, -50%) translate(${labelX.value}px, ${labelY.value}px)`
@@ -155,6 +162,10 @@
color: #059669;
}
&.wo-type {
color: #0f766e;
}
&.task {
color: #64748b;
font-weight: 500;
@@ -26,7 +26,9 @@ export interface ChainNode {
export interface ChainEdgeMeta {
workOrderNo: string
/** inbound / temporary / outbound */
workOrderType: string
workOrderTypeLabel?: string
taskNo: string
taskName: string
taskId?: string
@@ -57,9 +59,10 @@ export interface ChainNodeData {
export interface ChainEdgeData {
workOrderNo?: string
workOrderTypeLabel?: string
taskNo?: string
taskId?: string
taskName?: string
/** 同源分叉子节点连线使用贝塞尔曲线 */
/** 同源分叉 / 多源汇聚连线使用贝塞尔曲线 */
curved?: boolean
}
@@ -13,12 +13,6 @@ import type {
export const CHAIN_NODE_WIDTH = 148
export const CHAIN_NODE_HEIGHT = 100
export function nextAncestorLink(parent: AncestorItem['parent']): AncestorItem | null {
if (!parent) return null
if (Array.isArray(parent)) return parent[0] ?? null
return parent
}
function makeFlowNode(n: ChainNode, isCurrent: boolean): Node<ChainNodeData> {
return {
id: n.id,
@@ -41,6 +35,7 @@ function makeFlowEdge(
type: 'chainLink',
data: {
workOrderNo: edge.workOrderNo || undefined,
workOrderTypeLabel: edge.workOrderTypeLabel || undefined,
taskNo: edge.taskNo || undefined,
taskId: edge.taskId || undefined,
taskName: edge.taskName || undefined
@@ -48,6 +43,30 @@ function makeFlowEdge(
}
}
function walkAncestorParents(
parent: AncestorItem | AncestorItem[] | null | undefined,
downstreamId: string,
addNode: (n: ChainNode, isCurrent?: boolean) => void,
addEdge: (source: string, target: string, meta: ChainEdgeMeta) => void
) {
if (!parent) return
const items = Array.isArray(parent) ? parent : [parent]
for (const link of items) {
walkAncestorBranch(link, downstreamId, addNode, addEdge)
}
}
function walkAncestorBranch(
link: AncestorItem,
downstreamId: string,
addNode: (n: ChainNode, isCurrent?: boolean) => void,
addEdge: (source: string, target: string, meta: ChainEdgeMeta) => void
) {
addNode(link.node)
addEdge(link.node.id, downstreamId, link.edge)
walkAncestorParents(link.parent, link.node.id, addNode, addEdge)
}
/** 将 /chain API 数据转为 Vue Flow 节点与边(未布局) */
export function chainApiToElements(data: ChainApiData): {
nodes: Node<ChainNodeData>[]
@@ -73,16 +92,8 @@ export function chainApiToElements(data: ChainApiData): {
const current = data.current
addNode(current, true)
if (data.ancestors.length) {
let link: AncestorItem | null = data.ancestors[0]
let downstreamId = current.id
while (link) {
addNode(link.node)
addEdge(link.node.id, downstreamId, link.edge)
downstreamId = link.node.id
link = nextAncestorLink(link.parent)
}
for (const link of data.ancestors) {
walkAncestorBranch(link, current.id, addNode, addEdge)
}
const walkDescendants = (items: DescendantItem[], sourceId: string) => {
@@ -103,14 +114,18 @@ export function chainApiToElements(data: ChainApiData): {
}
}
/** 同一源节点连出 2 条及以上边时标记为分叉曲线 */
/** 同源分叉 / 多源汇聚时使用贝塞尔曲线 */
function annotateForkEdges(edges: Edge<ChainEdgeData>[]): Edge<ChainEdgeData>[] {
const outCount = new Map<string, number>()
const inCount = new Map<string, number>()
for (const e of edges) {
outCount.set(e.source, (outCount.get(e.source) || 0) + 1)
inCount.set(e.target, (inCount.get(e.target) || 0) + 1)
}
return edges.map((e) => {
if ((outCount.get(e.source) || 0) < 2) {
const fork = (outCount.get(e.source) || 0) >= 2
const merge = (inCount.get(e.target) || 0) >= 2
if (!fork && !merge) {
return e
}
return {
@@ -66,6 +66,29 @@
:index="(i: number) => (pagination.page - 1) * pagination.pageSize + i + 1"
/>
<el-table-column prop="taskNo" label="任务号" min-width="150" align="center" />
<el-table-column prop="taskType" label="任务类型" min-width="120" align="center">
<template #default="{ row }">
<el-tag :type="productionTaskTypeTag(row.taskType, row.orderSource).type" size="small">
{{ productionTaskTypeTag(row.taskType, row.orderSource).label }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="taskName"
label="任务名称"
min-width="160"
align="center"
show-overflow-tooltip
/>
<el-table-column
prop="routeName"
label="工艺路线"
min-width="140"
align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.routeName || '—' }}</template>
</el-table-column>
<el-table-column prop="workOrderNo" label="所属工单号" min-width="140" align="center" />
<el-table-column prop="orderSource" label="来源" min-width="100" align="center">
<template #default="{ row }">
@@ -74,6 +97,14 @@
</el-tag>
</template>
</el-table-column>
<el-table-column prop="receptionSource" label="来源类型" min-width="110" align="center">
<template #default="{ row }">
<span v-if="!showReceptionSourceType(row)">—</span>
<el-tag v-else :type="receptionSourceTagType(row.receptionSource)" size="small">
{{ row.receptionSourceLabel || receptionSourceLabel(row.receptionSource) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="protocolNo" label="协议号" min-width="140" align="center">
<template #default="{ row }">{{ row.protocolNo || '—' }}</template>
</el-table-column>
@@ -104,29 +135,6 @@
<el-table-column prop="sampleTypeName" label="样本类型" min-width="110" align="center">
<template #default="{ row }">{{ row.sampleTypeName || '—' }}</template>
</el-table-column>
<el-table-column prop="taskType" label="任务类型" min-width="120" align="center">
<template #default="{ row }">
<el-tag :type="productionTaskTypeTag(row.taskType, row.orderSource).type" size="small">
{{ productionTaskTypeTag(row.taskType, row.orderSource).label }}
</el-tag>
</template>
</el-table-column>
<el-table-column
prop="taskName"
label="任务名称"
min-width="160"
align="center"
show-overflow-tooltip
/>
<el-table-column
prop="routeName"
label="工艺路线"
min-width="140"
align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.routeName || '—' }}</template>
</el-table-column>
<el-table-column prop="receiverName" label="接收人" min-width="100" align="center">
<template #default="{ row }">{{ row.receiverName || '—' }}</template>
</el-table-column>
@@ -328,7 +336,9 @@
protocolStatusLabel,
protocolStatusTagType,
donationStatusLabel,
donationStatusTagType
donationStatusTagType,
receptionSourceLabel,
receptionSourceTagType
} from '@/utils/status-tag-registry'
import type { TagType } from '@/utils/status-tag-registry'
import TaskExecutionDialog from './TaskExecutionDialog.vue'
@@ -358,6 +368,13 @@
return row.orderSource === 'temporary' && !String(value || '').trim()
}
/** 入库任务展示工单来源类型(细胞存储 / 科研捐赠) */
function showReceptionSourceType(row: { orderSource?: string; receptionSource?: string }) {
if (row.orderSource === 'temporary' || row.orderSource === 'outbound') return false
const src = (row.receptionSource || '').trim()
return src === 'cell_storage' || src === 'research_donation'
}
defineOptions({ name: 'ProductionTaskTab' })
// ── 新增任务(工单选择 → 复用 DispatchTaskDialog) ──
@@ -41,9 +41,8 @@
@tab-change="handleTypeTabChange"
>
<el-tab-pane label="入库生产工单" name="inbound" />
<el-tab-pane label="临时生产工单" name="temporary" />
<el-tab-pane label="出库生产工单" name="outbound" />
<el-tab-pane label="全部生产工单" name="all" />
<el-tab-pane label="临时生产工单" name="temporary" />
</el-tabs>
<div class="filter-block">
@@ -91,7 +90,7 @@
</el-form>
</div>
<div v-if="activeTypeTab !== 'all'" class="list-toolbar">
<div class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
@@ -124,7 +123,7 @@
<div class="list-body list-wrap">
<el-table
ref="workOrderListTableRef"
:class="['list-table', { 'list-table--no-action-col list-table--all-tab': activeTypeTab === 'all' }]"
class="list-table"
:data="tableData"
v-loading="loading"
stripe
@@ -133,7 +132,6 @@
@row-dblclick="handleView"
>
<el-table-column
v-if="activeTypeTab !== 'all'"
type="selection"
min-width="55"
align="center"
@@ -160,19 +158,6 @@
</el-tag>
</template>
</el-table-column>
<el-table-column
v-if="activeTypeTab === 'all'"
prop="workOrderType"
label="工单类型"
min-width="100"
align="center"
>
<template #default="{ row }">
<el-tag :type="woTypeTag(row.workOrderType).type" size="small">
{{ woTypeTag(row.workOrderType).label }}
</el-tag>
</template>
</el-table-column>
<!-- 出库工单专属列 -->
<el-table-column
v-if="activeTypeTab === 'outbound'"
@@ -309,7 +294,6 @@
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" />
<el-table-column
v-if="activeTypeTab !== 'all'"
label="操作"
min-width="160"
fixed="right"
@@ -690,7 +674,7 @@
const route = useRoute()
const mainTab = ref('work-order')
type WorkOrderTypeTab = 'inbound' | 'temporary' | 'outbound' | 'all'
type WorkOrderTypeTab = 'inbound' | 'temporary' | 'outbound'
const activeTypeTab = ref<WorkOrderTypeTab>('inbound')
const showReceptionCols = computed(
() => activeTypeTab.value !== 'temporary' && activeTypeTab.value !== 'outbound'
@@ -813,19 +797,10 @@
const sourceTag = (source: string) => {
const map: Record<string, { label: string; type: string }> = {
cell_storage: { label: '细胞存储', type: 'success' },
research_donation: { label: '科研捐赠', type: 'primary' }
research_donation: { label: '科研捐赠', type: 'warning' }
}
return map[source] || { label: source, type: 'info' }
}
const woTypeTag = (type: string) => {
const map: Record<string, { label: string; type: string }> = {
inbound: { label: '入库', type: 'success' },
temporary: { label: '临时', type: 'warning' },
outbound: { label: '出库', type: 'primary' }
}
return map[type] || { label: type, type: 'info' }
}
function formatLocalDate(d: Date): string {
const y = d.getFullYear()
const m = String(d.getMonth() + 1).padStart(2, '0')
@@ -933,7 +908,7 @@
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
workOrderStatus: searchForm.workOrderStatus || undefined,
workOrderType: activeTypeTab.value === 'all' ? undefined : activeTypeTab.value,
workOrderType: activeTypeTab.value,
createTimeStart: createTimeRange.value?.[0] || undefined,
createTimeEnd: createTimeRange.value?.[1] || undefined
})
@@ -1077,7 +1052,7 @@
r.sourceTypeLabel ||
d.receptionSourceLabel ||
receptionSourceLabel(d.receptionSource || ''),
tagType: 'primary' as const
tagType: sourceTag(d.receptionSource || '').type as TagType
},
{ label: '样本类型', value: r.sampleTypeName || d.sampleTypeName || '—' }
)
@@ -1388,14 +1363,6 @@
min-width: 0;
}
/* 全部工单 Tab 无操作列,略增高行高便于阅读多列信息 */
:deep(.list-table.list-table--all-tab) {
td.el-table__cell > .cell {
min-height: 36px;
line-height: 36px;
}
}
.work-order-type-tabs {
padding: 0 16px;
margin-bottom: 4px;