提交
This commit is contained in:
1 parent
4ff289a8cf
commit
2020f371f4
17 files changed
+1804
-1992
No files matched your search
+1
@@ -0,0 +1 @@
|
||||
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_workordertasksublist_vue", "label": "WorkOrderTaskSubList.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/WorkOrderTaskSubList.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_task_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-task/index.vue", "source_location": "L1"}], "edges": [], "raw_calls": []}
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"nodes": [{"id": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_index_vue", "label": "index.vue", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L1"}, {"id": "production_work_order_index_protocolstatuslabelbysource", "label": "protocolStatusLabelBySource()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L557"}, {"id": "production_work_order_index_protocolstatustagtypebysource", "label": "protocolStatusTagTypeBySource()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L562"}, {"id": "production_work_order_index_shouldshowtempemptyfield", "label": "shouldShowTempEmptyField()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L569"}, {"id": "production_work_order_index_formattempemptyfield", "label": "formatTempEmptyField()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L572"}, {"id": "production_work_order_index_formatoutboundschedulesortno", "label": "formatOutboundScheduleSortNo()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L576"}, {"id": "production_work_order_index_formatoutboundscheduletotalcount", "label": "formatOutboundScheduleTotalCount()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L582"}, {"id": "production_work_order_index_handleadd", "label": "handleAdd()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L631"}, {"id": "production_work_order_index_handletypetabchange", "label": "handleTypeTabChange()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L640"}, {"id": "production_work_order_index_submitadd", "label": "submitAdd()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L646"}, {"id": "production_work_order_index_handlereceptionattachmentpreview", "label": "handleReceptionAttachmentPreview()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L910"}, {"id": "production_work_order_index_handlereceptionattachmentdownload", "label": "handleReceptionAttachmentDownload()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L914"}, {"id": "production_work_order_index_appstatuslabel", "label": "appStatusLabel()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L1028"}, {"id": "production_work_order_index_appstatustagtype", "label": "appStatusTagType()", "file_type": "code", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L1037"}], "edges": [{"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_index_vue", "target": "element_plus", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L515", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_index_vue", "target": "element_plus", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L516", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_index_vue", "target": "icons_vue", "relation": "imports_from", "confidence": "EXTRACTED", "source_file": "/Users/wuzilong/work/00code/zkxw/web-admin/src/views/production/production-work-order/index.vue", "source_location": "L517", "weight": 1.0}, {"source": "users_wuzilong_work_00code_zkxw_web_admin_src_views_production_production_work_order_index_vue", "target": "users_wuzilong_work_00code_zkxw_web_admin_src_api_production_work_order", "relation": "imports_from", "confidence": "EXTRACTLine truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
<!-- 旧「生产任务」菜单入口:重定向至生产管理 · 生产任务 Tab -->
|
||||
<!-- 旧「生产任务」菜单入口:重定向至生产工单(层级列表) -->
|
||||
<template>
|
||||
<div />
|
||||
</template>
|
||||
@@ -10,9 +10,10 @@
|
||||
const route = useRoute()
|
||||
|
||||
onMounted(() => {
|
||||
const { tab: _tab, ...rest } = route.query
|
||||
router.replace({
|
||||
name: 'ProductionWorkOrder',
|
||||
query: { ...route.query, tab: 'task' }
|
||||
query: rest
|
||||
})
|
||||
})
|
||||
</script>
|
||||
@@ -8,6 +8,7 @@
|
||||
:width="phase === 'form' ? '560px' : '90vw'"
|
||||
:class="phase === 'edit' ? 'dialog-form-layout dispatch-route-dialog' : 'dispatch-dialog'"
|
||||
align-center
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
width="560px"
|
||||
destroy-on-close
|
||||
align-center
|
||||
append-to-body
|
||||
:close-on-click-modal="false"
|
||||
@close="handleClose"
|
||||
>
|
||||
|
||||
@@ -1,638 +0,0 @@
|
||||
<!-- 生产管理 · 生产任务 Tab -->
|
||||
<template>
|
||||
<div class="production-task-tab">
|
||||
<div class="filter-block">
|
||||
<el-form :model="searchForm" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form-item label="关键词">
|
||||
<el-input
|
||||
v-model="searchForm.keyword"
|
||||
placeholder="任务号/所属工单号/协议号/申请单号/样本编码"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务状态">
|
||||
<el-select
|
||||
v-model="searchForm.taskStatus"
|
||||
placeholder="全部"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option label="待配置" value="dpz" />
|
||||
<el-option label="进行中" value="jxz" />
|
||||
<el-option label="已完成" value="ywc" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="开始时间">
|
||||
<el-date-picker
|
||||
v-model="startedTimeRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">可按任务开始时间筛选;不选日期则展示全部任务。</span>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
>
|
||||
<el-button class="btn-main" type="primary" @click="handleSearch"
|
||||
><el-icon><Search /></el-icon>搜索</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
class="list-table"
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
@row-dblclick="handleViewDetail"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
min-width="68"
|
||||
align="center"
|
||||
: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 }">
|
||||
<el-tag :type="productionOrderSourceTag(row.orderSource).type" size="small">
|
||||
{{ productionOrderSourceTag(row.orderSource).label }}
|
||||
</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="receptionSourceTypeTag(row)" size="small">
|
||||
{{ receptionSourceTypeLabel(row) }}
|
||||
</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>
|
||||
<el-table-column prop="protocolStatus" label="协议状态" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<span v-if="shouldShowTempEmptyField(row, row.protocolStatus)">—</span>
|
||||
<el-tag
|
||||
v-else
|
||||
:type="
|
||||
protocolStatusTagTypeBySource(
|
||||
String(row.protocolStatus || ''),
|
||||
row.receptionSource || 'cell_storage',
|
||||
row.orderSource
|
||||
)
|
||||
"
|
||||
size="small"
|
||||
>{{
|
||||
protocolStatusLabelBySource(
|
||||
String(row.protocolStatus || ''),
|
||||
row.receptionSource || 'cell_storage',
|
||||
row.orderSource
|
||||
)
|
||||
}}</el-tag
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sampleCode" label="样本编码" min-width="130" align="center">
|
||||
<template #default="{ row }">{{ row.sampleCode || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sampleTypeName" label="样本类型" min-width="110" align="center">
|
||||
<template #default="{ row }">{{ row.sampleTypeName || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="receiverName" label="接收人" min-width="100" align="center">
|
||||
<template #default="{ row }">{{ row.receiverName || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="receptionTime" label="接收时间" min-width="170" align="center">
|
||||
<template #default="{ row }">{{ row.receptionTime || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="taskStatus" label="任务状态" min-width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="taskStatusTag(row.taskStatus).type" size="small">{{
|
||||
taskStatusTag(row.taskStatus).label
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="conclusion" label="生产结论" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
v-if="productionConclusionTagType(row.conclusion)"
|
||||
:type="productionConclusionTagType(row.conclusion)"
|
||||
size="small"
|
||||
>
|
||||
{{ row.conclusionLabel || productionConclusionLabel(row.conclusion) }}
|
||||
</el-tag>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="startedTime" label="开始时间" min-width="170" align="center">
|
||||
<template #default="{ row }">{{ row.startedTime || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="completedTime" label="完成时间" min-width="170" align="center">
|
||||
<template #default="{ row }">{{ row.completedTime || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="260" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<div style="display: flex; justify-content: center; gap: 8px">
|
||||
<el-button
|
||||
v-if="canEnterExecution(row)"
|
||||
class="btn-op-item primary"
|
||||
type="primary"
|
||||
@click="handleEnterExecution(row)"
|
||||
>
|
||||
<el-icon><VideoPlay /></el-icon>进入执行
|
||||
</el-button>
|
||||
<el-button v-else class="btn-op-item primary" @click="handleViewDetail(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-dropdown
|
||||
v-if="hasMoreTaskActions(row)"
|
||||
trigger="hover"
|
||||
@command="(cmd) => handleDropdownCommand(cmd, row)"
|
||||
>
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-if="canEnterExecution(row)" command="view">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="canEditTask(row)" command="edit">
|
||||
<el-icon><EditPen /></el-icon>编辑
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="canDeleteTask(row)" command="delete" divided>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
:current-page="pagination.page"
|
||||
:page-size="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
layout="total, sizes, prev, pager, next"
|
||||
@size-change="
|
||||
(val: number) => ((pagination.page = 1), (pagination.pageSize = val), loadData())
|
||||
"
|
||||
@current-change="(val: number) => ((pagination.page = val), loadData())"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 任务执行弹窗 -->
|
||||
<TaskExecutionDialog
|
||||
v-model:visible="executionDialogVisible"
|
||||
:task-id="executionTaskId"
|
||||
:task-name="executionTaskName"
|
||||
:readonly="executionReadonly"
|
||||
@success="loadData"
|
||||
/>
|
||||
|
||||
<el-dialog
|
||||
v-model="addSelectWoVisible"
|
||||
title="选择生产工单"
|
||||
width="800px"
|
||||
align-center
|
||||
destroy-on-close
|
||||
>
|
||||
<div style="margin-bottom: 12px">
|
||||
<el-input
|
||||
v-model="addSelectWoKeyword"
|
||||
placeholder="搜索工单号/协议号/样本编码"
|
||||
clearable
|
||||
@keyup.enter="searchWorkOrders"
|
||||
>
|
||||
<template #append>
|
||||
<el-button @click="searchWorkOrders"
|
||||
><el-icon><Search /></el-icon
|
||||
></el-button>
|
||||
</template>
|
||||
</el-input>
|
||||
</div>
|
||||
<el-table
|
||||
:data="addSelectWoList"
|
||||
v-loading="addSelectWoLoading"
|
||||
stripe
|
||||
style="width: 100%"
|
||||
max-height="400"
|
||||
@row-click="selectWorkOrder"
|
||||
highlight-current-row
|
||||
>
|
||||
<el-table-column prop="workOrderNo" label="工单号" min-width="150" align="center" />
|
||||
<el-table-column prop="protocolNo" label="协议号" min-width="140" align="center">
|
||||
<template #default="{ row }">{{ row.protocolNo || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="sampleCode" label="样本编码" min-width="120" align="center">
|
||||
<template #default="{ row }">{{ row.sampleCode || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="receptionSource" label="来源" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
:type="row.receptionSource === 'research_donation' ? 'warning' : 'success'"
|
||||
size="small"
|
||||
>
|
||||
{{
|
||||
row.receptionSourceLabel ||
|
||||
(row.receptionSource === 'research_donation' ? '科研捐赠' : '细胞存储')
|
||||
}}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="workOrderStatus" label="状态" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="row.workOrderStatus === 'jxz' ? 'warning' : 'info'" size="small">
|
||||
{{ row.workOrderStatus === 'jxz' ? '进行中' : '待配置' }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="100" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" size="small" @click.stop="selectWorkOrder(row)"
|
||||
>选择</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty
|
||||
v-if="!addSelectWoLoading && !addSelectWoList.length"
|
||||
description="暂无可选工单"
|
||||
:image-size="48"
|
||||
/>
|
||||
</el-dialog>
|
||||
|
||||
<DispatchTaskDialog
|
||||
v-model:visible="addDispatchVisible"
|
||||
:work-order-row="addDispatchRow"
|
||||
@success="loadData"
|
||||
/>
|
||||
|
||||
<EditTaskInfoDialog
|
||||
v-model:visible="editTaskInfoVisible"
|
||||
:task-id="editTaskInfoId"
|
||||
@success="loadData"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
RefreshLeft,
|
||||
Search,
|
||||
VideoPlay,
|
||||
View,
|
||||
Plus,
|
||||
Close,
|
||||
Check,
|
||||
EditPen,
|
||||
More,
|
||||
Delete
|
||||
} from '@element-plus/icons-vue'
|
||||
import { fetchProductionTaskList, fetchDeleteProductionTask } from '@/api/production-task'
|
||||
import { fetchProductionWorkOrderList } from '@/api/production-work-order'
|
||||
import {
|
||||
protocolStatusLabel,
|
||||
protocolStatusTagType,
|
||||
donationStatusLabel,
|
||||
donationStatusTagType,
|
||||
receptionSourceLabel,
|
||||
receptionSourceTagType,
|
||||
applicationStatusLabel,
|
||||
applicationStatusTagType,
|
||||
bizTypeLabel,
|
||||
bizTypeTagType
|
||||
} from '@/utils/status-tag-registry'
|
||||
import type { TagType } from '@/utils/status-tag-registry'
|
||||
import TaskExecutionDialog from './TaskExecutionDialog.vue'
|
||||
import DispatchTaskDialog from './DispatchTaskDialog.vue'
|
||||
import EditTaskInfoDialog from './EditTaskInfoDialog.vue'
|
||||
import {
|
||||
productionConclusionLabel,
|
||||
productionConclusionTagType,
|
||||
productionOrderSourceTag,
|
||||
productionTaskTypeTag
|
||||
} from '@/utils/production-labels'
|
||||
|
||||
/** 根据来源类型返回协议状态标签(出库任务按申请单状态展示) */
|
||||
function isOutboundBizSource(row: { orderSource?: string }) {
|
||||
return row.orderSource === 'outbound'
|
||||
}
|
||||
|
||||
function isApplicationBizSource(source: string, orderSource?: string) {
|
||||
return (
|
||||
orderSource === 'outbound' ||
|
||||
source === 'pilot_service' ||
|
||||
source === 'clinical_application'
|
||||
)
|
||||
}
|
||||
|
||||
function protocolStatusLabelBySource(
|
||||
status: string,
|
||||
source: string,
|
||||
orderSource?: string
|
||||
): string {
|
||||
if (isApplicationBizSource(source, orderSource)) {
|
||||
return applicationStatusLabel(status)
|
||||
}
|
||||
return source === 'research_donation'
|
||||
? donationStatusLabel(status)
|
||||
: protocolStatusLabel(status)
|
||||
}
|
||||
|
||||
function protocolStatusTagTypeBySource(
|
||||
status: string,
|
||||
source: string,
|
||||
orderSource?: string
|
||||
): TagType {
|
||||
if (isApplicationBizSource(source, orderSource)) {
|
||||
return applicationStatusTagType(status) as TagType
|
||||
}
|
||||
return source === 'research_donation'
|
||||
? donationStatusTagType(status)
|
||||
: protocolStatusTagType(status)
|
||||
}
|
||||
|
||||
function receptionSourceTypeLabel(row: {
|
||||
orderSource?: string
|
||||
bizType?: string
|
||||
bizTypeLabel?: string
|
||||
receptionSource?: string
|
||||
receptionSourceLabel?: string
|
||||
}) {
|
||||
if (isOutboundBizSource(row)) {
|
||||
return row.bizTypeLabel || bizTypeLabel(row.bizType || row.receptionSource || '')
|
||||
}
|
||||
return row.receptionSourceLabel || receptionSourceLabel(row.receptionSource || '')
|
||||
}
|
||||
|
||||
function receptionSourceTypeTag(row: {
|
||||
orderSource?: string
|
||||
bizType?: string
|
||||
receptionSource?: string
|
||||
}) {
|
||||
if (isOutboundBizSource(row)) {
|
||||
return bizTypeTagType(row.bizType || row.receptionSource || '')
|
||||
}
|
||||
return receptionSourceTagType(row.receptionSource || '')
|
||||
}
|
||||
|
||||
/** 临时工单无关联协议/样本时,空字段展示为 — */
|
||||
function shouldShowTempEmptyField(row: { orderSource?: string }, value?: string | null) {
|
||||
return row.orderSource === 'temporary' && !String(value || '').trim()
|
||||
}
|
||||
|
||||
/** 入库任务展示工单来源类型;出库任务展示业务类型 */
|
||||
function showReceptionSourceType(row: {
|
||||
orderSource?: string
|
||||
receptionSource?: string
|
||||
bizType?: string
|
||||
}) {
|
||||
if (row.orderSource === 'temporary') return false
|
||||
if (row.orderSource === 'outbound') {
|
||||
return !!(row.bizType || row.receptionSource)
|
||||
}
|
||||
const src = (row.receptionSource || '').trim()
|
||||
return src === 'cell_storage' || src === 'research_donation'
|
||||
}
|
||||
|
||||
defineOptions({ name: 'ProductionTaskTab' })
|
||||
|
||||
// ── 新增任务(工单选择 → 复用 DispatchTaskDialog) ──
|
||||
const addSelectWoVisible = ref(false)
|
||||
const addSelectWoList = ref<Record<string, any>[]>([])
|
||||
const addSelectWoLoading = ref(false)
|
||||
const addSelectWoKeyword = ref('')
|
||||
const addDispatchVisible = ref(false)
|
||||
const addDispatchRow = ref<Record<string, any> | null>(null)
|
||||
|
||||
async function handleAdd() {
|
||||
addSelectWoKeyword.value = ''
|
||||
addSelectWoVisible.value = true
|
||||
addSelectWoLoading.value = true
|
||||
try {
|
||||
const res = await fetchProductionWorkOrderList({ pageSize: 100 })
|
||||
addSelectWoList.value = (res.list || []).filter(
|
||||
(wo: Record<string, any>) => wo.workOrderStatus === 'dpz' || wo.workOrderStatus === 'jxz'
|
||||
)
|
||||
} catch {
|
||||
addSelectWoList.value = []
|
||||
} finally {
|
||||
addSelectWoLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function searchWorkOrders() {
|
||||
addSelectWoLoading.value = true
|
||||
try {
|
||||
const res = await fetchProductionWorkOrderList({
|
||||
keyword: addSelectWoKeyword.value || undefined,
|
||||
pageSize: 100
|
||||
})
|
||||
addSelectWoList.value = (res.list || []).filter(
|
||||
(wo: Record<string, any>) => wo.workOrderStatus === 'dpz' || wo.workOrderStatus === 'jxz'
|
||||
)
|
||||
} catch {
|
||||
addSelectWoList.value = []
|
||||
} finally {
|
||||
addSelectWoLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function selectWorkOrder(row: Record<string, any>) {
|
||||
addDispatchRow.value = row
|
||||
addSelectWoVisible.value = false
|
||||
addDispatchVisible.value = true
|
||||
}
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 状态标签映射
|
||||
// ---------------------------------------------------------------------------
|
||||
function taskStatusTag(status: string) {
|
||||
const map: Record<string, { label: string; type: string }> = {
|
||||
dpz: { label: '待配置', type: 'info' },
|
||||
jxz: { label: '进行中', type: 'warning' },
|
||||
ywc: { label: '已完成', type: 'success' }
|
||||
}
|
||||
return map[status] || { label: status, type: 'info' }
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 列表视图
|
||||
// ---------------------------------------------------------------------------
|
||||
const searchForm = reactive({ keyword: '', taskStatus: '' })
|
||||
const startedTimeRange = ref<[string, string] | null>(null)
|
||||
const tableData = ref<Record<string, any>[]>([])
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
|
||||
async function handleDelete(row: any) {
|
||||
await ElMessageBox.confirm('确定要删除该生产任务吗?', '提示', { type: 'warning' })
|
||||
await fetchDeleteProductionTask(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
await loadData()
|
||||
}
|
||||
|
||||
/** 待配置、进行中时可进入执行 */
|
||||
function canEnterExecution(row: Record<string, any>) {
|
||||
return row.taskStatus === 'dpz' || row.taskStatus === 'jxz'
|
||||
}
|
||||
|
||||
/** 待配置、进行中时可编辑 */
|
||||
function canEditTask(row: Record<string, any>) {
|
||||
return row.taskStatus === 'dpz' || row.taskStatus === 'jxz'
|
||||
}
|
||||
|
||||
/** 待配置时可删除 */
|
||||
function canDeleteTask(row: Record<string, any>) {
|
||||
return row.taskStatus === 'dpz'
|
||||
}
|
||||
|
||||
/** 更多菜单是否展示 */
|
||||
function hasMoreTaskActions(row: Record<string, any>) {
|
||||
if (canEnterExecution(row)) {
|
||||
return true
|
||||
}
|
||||
return canEditTask(row) || canDeleteTask(row)
|
||||
}
|
||||
|
||||
function handleDropdownCommand(command: string, row: Record<string, any>) {
|
||||
switch (command) {
|
||||
case 'view':
|
||||
handleViewDetail(row)
|
||||
break
|
||||
case 'edit':
|
||||
handleEditTask(row)
|
||||
break
|
||||
case 'delete':
|
||||
handleDelete(row)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await fetchProductionTaskList({
|
||||
page: pagination.page,
|
||||
pageSize: pagination.pageSize,
|
||||
keyword: searchForm.keyword || undefined,
|
||||
taskStatus: searchForm.taskStatus || undefined,
|
||||
startedTimeStart: startedTimeRange.value?.[0] || undefined,
|
||||
startedTimeEnd: startedTimeRange.value?.[1] || undefined
|
||||
})
|
||||
tableData.value = res.list || []
|
||||
pagination.total = res.total ?? 0
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
searchForm.keyword = ''
|
||||
searchForm.taskStatus = ''
|
||||
startedTimeRange.value = null
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 任务执行弹窗
|
||||
// ---------------------------------------------------------------------------
|
||||
const executionDialogVisible = ref(false)
|
||||
const executionTaskId = ref('')
|
||||
const executionTaskName = ref('')
|
||||
const executionReadonly = ref(false)
|
||||
|
||||
function handleEnterExecution(row: Record<string, any>) {
|
||||
executionTaskId.value = row.id
|
||||
executionTaskName.value = row.taskName || ''
|
||||
executionReadonly.value = false
|
||||
executionDialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleViewDetail(row: Record<string, any>) {
|
||||
executionTaskId.value = row.id
|
||||
executionTaskName.value = row.taskName || ''
|
||||
executionReadonly.value = true
|
||||
executionDialogVisible.value = true
|
||||
}
|
||||
|
||||
const editTaskInfoVisible = ref(false)
|
||||
const editTaskInfoId = ref('')
|
||||
|
||||
function handleEditTask(row: Record<string, any>) {
|
||||
editTaskInfoId.value = row.id
|
||||
editTaskInfoVisible.value = true
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 初始化(支持从工单页面跳转带 keyword 筛选)
|
||||
// ---------------------------------------------------------------------------
|
||||
// 输入检索条件时自动搜索(防抖 300ms)
|
||||
watchDebounced(
|
||||
[searchForm, startedTimeRange],
|
||||
() => {
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
},
|
||||
{ debounce: 300, deep: true }
|
||||
)
|
||||
onMounted(() => {
|
||||
const qKeyword = (route.query.keyword || route.query.workOrderNo) as string
|
||||
if (qKeyword) {
|
||||
searchForm.keyword = qKeyword
|
||||
}
|
||||
loadData()
|
||||
})
|
||||
</script>
|
||||
@@ -348,14 +348,19 @@
|
||||
import CompleteProductionTaskDialog from './CompleteProductionTaskDialog.vue'
|
||||
import { productionConclusionLabel, productionConclusionTagType } from '@/utils/production-labels'
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean
|
||||
taskId: string
|
||||
taskName: string
|
||||
readonly?: boolean
|
||||
/** 嵌套在其他弹窗内打开时挂到 body,避免层级被遮挡 */
|
||||
appendToBody?: boolean
|
||||
}>()
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
visible: boolean
|
||||
taskId: string
|
||||
taskName: string
|
||||
readonly?: boolean
|
||||
/** 挂到 body,避免表格展开行 / fixed 列层叠遮挡 */
|
||||
appendToBody?: boolean
|
||||
}>(),
|
||||
{
|
||||
appendToBody: true
|
||||
}
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:visible', val: boolean): void
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
width="1400px"
|
||||
class="dialog-form-layout"
|
||||
align-center
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
width="1080px"
|
||||
class="dialog-form-layout task-output-product-dialog"
|
||||
align-center
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
:close-on-click-modal="false"
|
||||
@update:model-value="emit('update:modelValue', $event)"
|
||||
@@ -305,7 +306,14 @@
|
||||
</el-dialog>
|
||||
|
||||
<!-- 图片预览弹窗 -->
|
||||
<el-dialog v-model="previewVisible" title="图片预览" width="800px" align-center destroy-on-close>
|
||||
<el-dialog
|
||||
v-model="previewVisible"
|
||||
title="图片预览"
|
||||
width="800px"
|
||||
align-center
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
>
|
||||
<div class="preview-container">
|
||||
<img
|
||||
:src="previewUrl"
|
||||
|
||||
@@ -0,0 +1,365 @@
|
||||
<!-- 生产工单展开行 · 生产任务子列表 -->
|
||||
<template>
|
||||
<div class="work-order-task-sublist">
|
||||
<div class="panel-top work-order-task-sublist__head">
|
||||
<h3 class="work-order-task-sublist__title title-bar-heading">生产任务</h3>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar work-order-task-sublist__toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<el-button
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
:disabled="!canDispatch"
|
||||
@click="handleDispatch"
|
||||
>
|
||||
<el-icon><Position /></el-icon>派发任务
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :loading="loading" @click="loadData">
|
||||
<el-icon><RefreshLeft /></el-icon>刷新
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="work-order-task-sublist__body sqxp-subtable-wrap">
|
||||
<el-table
|
||||
class="list-table work-order-task-sublist__table sqxp-subtable"
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
size="small"
|
||||
@row-dblclick="handleViewDetail"
|
||||
>
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
min-width="68"
|
||||
align="center"
|
||||
:index="(i) => 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="taskStatus" label="任务状态" min-width="110" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="taskStatusTag(row.taskStatus).type" size="small">{{
|
||||
taskStatusTag(row.taskStatus).label
|
||||
}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="conclusion" label="生产结论" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
v-if="productionConclusionTagType(row.conclusion)"
|
||||
:type="productionConclusionTagType(row.conclusion)"
|
||||
size="small"
|
||||
>
|
||||
{{ row.conclusionLabel || productionConclusionLabel(row.conclusion) }}
|
||||
</el-tag>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="startedTime" label="开始时间" min-width="170" align="center">
|
||||
<template #default="{ row }">{{ row.startedTime || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="completedTime" label="完成时间" min-width="170" align="center">
|
||||
<template #default="{ row }">{{ row.completedTime || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="260" fixed="right" align="center">
|
||||
<template #default="{ row }">
|
||||
<div class="work-order-task-sublist__ops">
|
||||
<el-button
|
||||
v-if="canEnterExecution(row)"
|
||||
class="btn-op-item primary"
|
||||
type="primary"
|
||||
@click="handleEnterExecution(row)"
|
||||
>
|
||||
<el-icon><VideoPlay /></el-icon>进入执行
|
||||
</el-button>
|
||||
<el-button v-else class="btn-op-item primary" @click="handleViewDetail(row)">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-dropdown
|
||||
v-if="hasMoreTaskActions(row)"
|
||||
trigger="hover"
|
||||
@command="(cmd) => handleDropdownCommand(cmd, row)"
|
||||
>
|
||||
<el-button class="btn-op-item">
|
||||
<el-icon><More /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item v-if="canEnterExecution(row)" command="view">
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="canEditTask(row)" command="editInfo">
|
||||
<el-icon><EditPen /></el-icon>编辑信息
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="canEditTask(row)" command="editRoute">
|
||||
<el-icon><EditPen /></el-icon>编辑工艺
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item v-if="canDeleteTask(row)" command="delete" divided>
|
||||
<el-icon><Delete /></el-icon>删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty
|
||||
v-if="!loading && !tableData.length"
|
||||
description="暂无任务,可点击「派发任务」创建"
|
||||
:image-size="72"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<TaskExecutionDialog
|
||||
v-model:visible="executionDialogVisible"
|
||||
:task-id="executionTaskId"
|
||||
:task-name="executionTaskName"
|
||||
:readonly="executionReadonly"
|
||||
append-to-body
|
||||
@success="handleTaskMutationSuccess"
|
||||
/>
|
||||
|
||||
<DispatchTaskDialog
|
||||
v-model:visible="dispatchVisible"
|
||||
:work-order-row="workOrder"
|
||||
@success="handleTaskMutationSuccess"
|
||||
/>
|
||||
|
||||
<DispatchTaskDialog
|
||||
v-model:visible="editRouteVisible"
|
||||
:work-order-row="workOrder"
|
||||
:edit-task-id="editRouteTaskId"
|
||||
:edit-task-name="editRouteTaskName"
|
||||
@success="handleTaskMutationSuccess"
|
||||
/>
|
||||
|
||||
<EditTaskInfoDialog
|
||||
v-model:visible="editInfoVisible"
|
||||
:task-id="editInfoTaskId"
|
||||
@success="handleTaskMutationSuccess"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import {
|
||||
RefreshLeft,
|
||||
VideoPlay,
|
||||
View,
|
||||
Position,
|
||||
EditPen,
|
||||
More,
|
||||
Delete
|
||||
} from '@element-plus/icons-vue'
|
||||
import { fetchProductionTaskList, fetchDeleteProductionTask } from '@/api/production-task'
|
||||
import TaskExecutionDialog from './TaskExecutionDialog.vue'
|
||||
import DispatchTaskDialog from './DispatchTaskDialog.vue'
|
||||
import EditTaskInfoDialog from './EditTaskInfoDialog.vue'
|
||||
import {
|
||||
productionConclusionLabel,
|
||||
productionConclusionTagType,
|
||||
productionTaskTypeTag
|
||||
} from '@/utils/production-labels'
|
||||
|
||||
defineOptions({ name: 'WorkOrderTaskSubList' })
|
||||
|
||||
const props = defineProps<{
|
||||
workOrder: Record<string, any>
|
||||
/** 父级派发/完成工单后递增,用于刷新已展开子列表 */
|
||||
refreshToken?: number
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
changed: []
|
||||
}>()
|
||||
|
||||
const tableData = ref<Record<string, any>[]>([])
|
||||
const loading = ref(false)
|
||||
|
||||
const canDispatch = computed(() => {
|
||||
const status = props.workOrder?.workOrderStatus
|
||||
return status === 'dpz' || status === 'jxz'
|
||||
})
|
||||
|
||||
function taskStatusTag(status: string) {
|
||||
const map: Record<string, { label: string; type: string }> = {
|
||||
dpz: { label: '待配置', type: 'info' },
|
||||
jxz: { label: '进行中', type: 'warning' },
|
||||
ywc: { label: '已完成', type: 'success' }
|
||||
}
|
||||
return map[status] || { label: status, type: 'info' }
|
||||
}
|
||||
|
||||
function canEnterExecution(row: Record<string, any>) {
|
||||
return row.taskStatus === 'dpz' || row.taskStatus === 'jxz'
|
||||
}
|
||||
|
||||
function canEditTask(row: Record<string, any>) {
|
||||
return row.taskStatus === 'dpz' || row.taskStatus === 'jxz'
|
||||
}
|
||||
|
||||
function canDeleteTask(row: Record<string, any>) {
|
||||
return row.taskStatus === 'dpz'
|
||||
}
|
||||
|
||||
function hasMoreTaskActions(row: Record<string, any>) {
|
||||
if (canEnterExecution(row)) return true
|
||||
return canEditTask(row) || canDeleteTask(row)
|
||||
}
|
||||
|
||||
async function loadData() {
|
||||
const workOrderId = props.workOrder?.id
|
||||
if (!workOrderId) {
|
||||
tableData.value = []
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await fetchProductionTaskList({ workOrderId, pageSize: 100 })
|
||||
tableData.value = res.list || []
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleTaskMutationSuccess() {
|
||||
loadData()
|
||||
emit('changed')
|
||||
}
|
||||
|
||||
function handleDispatch() {
|
||||
if (!canDispatch.value) {
|
||||
ElMessage.warning('仅待配置或进行中的工单可派发任务')
|
||||
return
|
||||
}
|
||||
dispatchVisible.value = true
|
||||
}
|
||||
|
||||
const dispatchVisible = ref(false)
|
||||
|
||||
const executionDialogVisible = ref(false)
|
||||
const executionTaskId = ref('')
|
||||
const executionTaskName = ref('')
|
||||
const executionReadonly = ref(false)
|
||||
|
||||
function handleEnterExecution(row: Record<string, any>) {
|
||||
executionTaskId.value = row.id
|
||||
executionTaskName.value = row.taskName || ''
|
||||
executionReadonly.value = false
|
||||
executionDialogVisible.value = true
|
||||
}
|
||||
|
||||
function handleViewDetail(row: Record<string, any>) {
|
||||
executionTaskId.value = row.id
|
||||
executionTaskName.value = row.taskName || ''
|
||||
executionReadonly.value = true
|
||||
executionDialogVisible.value = true
|
||||
}
|
||||
|
||||
const editInfoVisible = ref(false)
|
||||
const editInfoTaskId = ref('')
|
||||
|
||||
const editRouteVisible = ref(false)
|
||||
const editRouteTaskId = ref('')
|
||||
const editRouteTaskName = ref('')
|
||||
|
||||
function handleDropdownCommand(command: string, row: Record<string, any>) {
|
||||
switch (command) {
|
||||
case 'view':
|
||||
handleViewDetail(row)
|
||||
break
|
||||
case 'editInfo':
|
||||
editInfoTaskId.value = row.id
|
||||
editInfoVisible.value = true
|
||||
break
|
||||
case 'editRoute':
|
||||
editRouteTaskId.value = row.id
|
||||
editRouteTaskName.value = row.taskName || ''
|
||||
editRouteVisible.value = true
|
||||
break
|
||||
case 'delete':
|
||||
handleDelete(row)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDelete(row: Record<string, any>) {
|
||||
await ElMessageBox.confirm('确定要删除该生产任务吗?', '提示', { type: 'warning' })
|
||||
await fetchDeleteProductionTask(row.id)
|
||||
ElMessage.success('删除成功')
|
||||
handleTaskMutationSuccess()
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.workOrder?.id, props.refreshToken] as const,
|
||||
() => {
|
||||
loadData()
|
||||
},
|
||||
{ immediate: true }
|
||||
)
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.work-order-task-sublist {
|
||||
padding: 12px 16px 16px 40px;
|
||||
background: #f8fafc;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.work-order-task-sublist__head {
|
||||
padding: 0 0 10px;
|
||||
margin: 0;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.work-order-task-sublist__title {
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.work-order-task-sublist__toolbar {
|
||||
padding: 0 0 10px;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.work-order-task-sublist__body {
|
||||
display: block;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.work-order-task-sublist__ops {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
}
|
||||
</style>
|
||||
@@ -3,38 +3,10 @@
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-entity-switch" role="tablist" aria-label="视图类型">
|
||||
<button
|
||||
type="button"
|
||||
class="entity-switch-card"
|
||||
:class="{ 'is-active': mainTab === 'work-order' }"
|
||||
role="tab"
|
||||
:aria-selected="mainTab === 'work-order'"
|
||||
@click="mainTab = 'work-order'"
|
||||
>
|
||||
<span class="entity-switch-card__icon"><el-icon><Document /></el-icon></span>
|
||||
<span class="entity-switch-card__main">
|
||||
<span class="entity-switch-card__title">生产工单</span>
|
||||
<span class="entity-switch-card__desc">工单创建、配置与跟踪</span>
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="entity-switch-card"
|
||||
:class="{ 'is-active': mainTab === 'task' }"
|
||||
role="tab"
|
||||
:aria-selected="mainTab === 'task'"
|
||||
@click="mainTab = 'task'"
|
||||
>
|
||||
<span class="entity-switch-card__icon"><el-icon><Tickets /></el-icon></span>
|
||||
<span class="entity-switch-card__main">
|
||||
<span class="entity-switch-card__title">生产任务</span>
|
||||
<span class="entity-switch-card__desc">任务派发、执行与完成</span>
|
||||
</span>
|
||||
</button>
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">生产工单</h2>
|
||||
</div>
|
||||
|
||||
<div v-show="mainTab === 'work-order'" class="panel-entity-body">
|
||||
<el-tabs
|
||||
v-model="activeTypeTab"
|
||||
class="work-order-type-tabs"
|
||||
@@ -104,13 +76,6 @@
|
||||
<el-icon><Plus /></el-icon
|
||||
>{{ activeTypeTab === 'temporary' ? '新增临时工单' : '新增生产工单' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="selectedRows.length !== 1"
|
||||
@click="handleToolbarEditTask"
|
||||
>
|
||||
<el-icon><EditPen /></el-icon>编辑任务
|
||||
</el-button>
|
||||
<el-button class="btn-ghost" :disabled="!canToolbarDispatch" @click="handleToolbarDispatch">
|
||||
<el-icon><Position /></el-icon>派发任务
|
||||
</el-button>
|
||||
@@ -123,13 +88,14 @@
|
||||
<div class="list-body list-wrap">
|
||||
<el-table
|
||||
ref="workOrderListTableRef"
|
||||
class="list-table"
|
||||
class="production-work-order-table list-table"
|
||||
:data="tableData"
|
||||
v-loading="loading"
|
||||
stripe
|
||||
row-key="id"
|
||||
@selection-change="handleSelectionChange"
|
||||
@row-dblclick="handleView"
|
||||
@expand-change="handleWorkOrderRowExpand"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
@@ -137,6 +103,15 @@
|
||||
align="center"
|
||||
header-align="center"
|
||||
/>
|
||||
<el-table-column type="expand" min-width="48">
|
||||
<template #default="{ row }">
|
||||
<WorkOrderTaskSubList
|
||||
:work-order="row"
|
||||
:refresh-token="taskSubListRefreshToken"
|
||||
@changed="handleWorkOrderTasksChanged"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
@@ -458,91 +433,9 @@
|
||||
<DispatchTaskDialog
|
||||
v-model:visible="dispatchVisible"
|
||||
:work-order-row="dispatchRow"
|
||||
@success="loadData"
|
||||
@success="handleDispatchSuccess"
|
||||
/>
|
||||
|
||||
<!-- 编辑已有任务弹窗 -->
|
||||
<DispatchTaskDialog
|
||||
v-model:visible="editTaskVisible"
|
||||
:work-order-row="editTaskRow"
|
||||
:edit-task-id="editTaskId"
|
||||
:edit-task-name="editTaskName"
|
||||
@success="loadData"
|
||||
/>
|
||||
|
||||
<!-- 编辑任务基本信息弹窗 -->
|
||||
<EditTaskInfoDialog
|
||||
v-model:visible="editTaskInfoVisible"
|
||||
:task-id="editTaskInfoId"
|
||||
@success="handleEditTaskInfoSuccess"
|
||||
/>
|
||||
|
||||
<!-- 任务列表弹窗 -->
|
||||
<el-dialog
|
||||
v-model="taskSelectVisible"
|
||||
title="生产任务列表"
|
||||
width="980px"
|
||||
destroy-on-close
|
||||
align-center
|
||||
>
|
||||
<div v-loading="taskSelectLoading" style="max-height: 60vh; overflow-y: auto">
|
||||
<el-table :data="taskSelectList" stripe style="width: 100%">
|
||||
<el-table-column
|
||||
type="index"
|
||||
label="序号"
|
||||
min-width="68"
|
||||
align="center"
|
||||
:index="(i) => i + 1"
|
||||
/>
|
||||
<el-table-column prop="taskName" label="任务名称" min-width="140" />
|
||||
<el-table-column prop="routeName" label="工艺路线" min-width="140">
|
||||
<template #default="{ row }">{{ row.routeName || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="taskStatus" label="任务状态" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="taskStatusLabel(row.taskStatus).type" size="small">
|
||||
{{ taskStatusLabel(row.taskStatus).label }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="conclusion" label="生产结论" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
v-if="productionConclusionTagType(row.conclusion)"
|
||||
:type="productionConclusionTagType(row.conclusion)"
|
||||
size="small"
|
||||
>
|
||||
{{ row.conclusionLabel || productionConclusionLabel(row.conclusion) }}
|
||||
</el-tag>
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="remark" label="备注" min-width="140">
|
||||
<template #default="{ row }">{{ row.remark || '—' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center" />
|
||||
<el-table-column label="操作" min-width="250" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" size="small" @click="openEditTaskInfo(row)"
|
||||
>编辑信息</el-button
|
||||
>
|
||||
<el-button link type="primary" size="small" @click="openTaskEditor(row)"
|
||||
>编辑工艺</el-button
|
||||
>
|
||||
<el-button link type="danger" size="small" @click="handleDeleteTask(row)"
|
||||
>删除</el-button
|
||||
>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-empty
|
||||
v-if="!taskSelectLoading && !taskSelectList.length"
|
||||
description="暂无任务,请先派发任务"
|
||||
:image-size="48"
|
||||
/>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 新增生产工单弹窗 -->
|
||||
<el-dialog
|
||||
v-model="addVisible"
|
||||
@@ -613,9 +506,6 @@
|
||||
:submitting="remarkEditLoading"
|
||||
@submit="submitRemarkEdit"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<ProductionTaskTab v-if="mainTab === 'task'" />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
@@ -635,8 +525,7 @@
|
||||
Position,
|
||||
EditPen,
|
||||
Delete,
|
||||
More,
|
||||
Tickets
|
||||
More
|
||||
} from '@element-plus/icons-vue'
|
||||
import {
|
||||
fetchProductionWorkOrderList,
|
||||
@@ -700,17 +589,11 @@
|
||||
import type { ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
import DispatchTaskDialog from './DispatchTaskDialog.vue'
|
||||
import EditTaskInfoDialog from './EditTaskInfoDialog.vue'
|
||||
import WorkOrderRemarkDialog from '@/components/business/work-order-remark-dialog/index.vue'
|
||||
import { productionConclusionLabel, productionConclusionTagType } from '@/utils/production-labels'
|
||||
import { fetchProductionTaskList, fetchDeleteProductionTask } from '@/api/production-task'
|
||||
import ProductionTaskTab from './ProductionTaskTab.vue'
|
||||
import WorkOrderTaskSubList from './WorkOrderTaskSubList.vue'
|
||||
|
||||
defineOptions({ name: 'ProductionProductionWorkOrder' })
|
||||
|
||||
const route = useRoute()
|
||||
const mainTab = ref('work-order')
|
||||
|
||||
type WorkOrderTypeTab = 'inbound' | 'temporary' | 'outbound'
|
||||
const activeTypeTab = ref<WorkOrderTypeTab>('inbound')
|
||||
const showReceptionCols = computed(
|
||||
@@ -831,14 +714,6 @@
|
||||
}
|
||||
return map[status] || { label: status, type: 'info' }
|
||||
}
|
||||
const taskStatusLabel = (status: string) => {
|
||||
const map: Record<string, { label: string; type: string }> = {
|
||||
dpz: { label: '待配置', type: 'info' },
|
||||
jxz: { label: '进行中', type: 'warning' },
|
||||
ywc: { label: '已完成', type: 'success' }
|
||||
}
|
||||
return map[status] || { label: status, type: 'info' }
|
||||
}
|
||||
const sourceTag = (source: string) => {
|
||||
const map: Record<string, { label: string; type: string }> = {
|
||||
cell_storage: { label: '细胞存储', type: 'success' },
|
||||
@@ -867,6 +742,7 @@
|
||||
const workOrderListTableRef = ref<TableInstance>()
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const taskSubListRefreshToken = ref(0)
|
||||
|
||||
const canToolbarDispatch = computed(() => {
|
||||
if (selectedRows.value.length !== 1) return false
|
||||
@@ -898,11 +774,6 @@
|
||||
return selectedRows.value[0]
|
||||
}
|
||||
|
||||
function handleToolbarEditTask() {
|
||||
const row = requireSingleSelection('编辑任务')
|
||||
if (row) handleEditTask(row)
|
||||
}
|
||||
|
||||
function handleToolbarDispatch() {
|
||||
const row = requireSingleSelection('派发任务')
|
||||
if (!row) return
|
||||
@@ -931,13 +802,29 @@
|
||||
}
|
||||
ElMessage.success(rows.length === 1 ? '工单已完成' : `已完成 ${rows.length} 个工单`)
|
||||
clearSelection()
|
||||
loadData()
|
||||
taskSubListRefreshToken.value += 1
|
||||
await loadData()
|
||||
}
|
||||
|
||||
async function layoutWorkOrderTable() {
|
||||
await nextTick()
|
||||
workOrderListTableRef.value?.doLayout?.()
|
||||
}
|
||||
|
||||
async function handleWorkOrderRowExpand(_row: any, _expandedRows: any[]) {
|
||||
await layoutWorkOrderTable()
|
||||
}
|
||||
|
||||
async function handleWorkOrderTasksChanged() {
|
||||
taskSubListRefreshToken.value += 1
|
||||
await loadData()
|
||||
await layoutWorkOrderTable()
|
||||
}
|
||||
|
||||
async function handleDispatchSuccess() {
|
||||
taskSubListRefreshToken.value += 1
|
||||
await loadData()
|
||||
}
|
||||
async function handleDelete(row: any) {
|
||||
await ElMessageBox.confirm('确定要删除该生产工单吗?', '提示', { type: 'warning' })
|
||||
await fetchDeleteProductionWorkOrder(row.id)
|
||||
@@ -1255,65 +1142,6 @@
|
||||
dispatchVisible.value = true
|
||||
}
|
||||
|
||||
// ── 编辑已有任务 ──────────────────────────────────────
|
||||
const editTaskVisible = ref(false)
|
||||
const editTaskRow = ref<any>(null)
|
||||
const editTaskId = ref('')
|
||||
const editTaskName = ref('')
|
||||
|
||||
// 任务选择弹窗
|
||||
const taskSelectVisible = ref(false)
|
||||
const taskSelectList = ref<any[]>([])
|
||||
const taskSelectLoading = ref(false)
|
||||
const currentWorkOrderRow = ref<any>(null)
|
||||
|
||||
async function handleEditTask(row: any) {
|
||||
currentWorkOrderRow.value = row
|
||||
taskSelectLoading.value = true
|
||||
taskSelectVisible.value = true
|
||||
taskSelectList.value = []
|
||||
try {
|
||||
const res = await fetchProductionTaskList({ workOrderId: row.id, pageSize: 100 })
|
||||
taskSelectList.value = res.list || []
|
||||
} catch {
|
||||
taskSelectList.value = []
|
||||
} finally {
|
||||
taskSelectLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function openTaskEditor(task: any) {
|
||||
editTaskId.value = task.id
|
||||
editTaskName.value = task.taskName || ''
|
||||
editTaskRow.value = null
|
||||
editTaskVisible.value = true
|
||||
taskSelectVisible.value = false
|
||||
}
|
||||
|
||||
// ── 编辑任务基本信息 ──────────────────────────────────
|
||||
const editTaskInfoVisible = ref(false)
|
||||
const editTaskInfoId = ref('')
|
||||
|
||||
function openEditTaskInfo(task: any) {
|
||||
editTaskInfoId.value = task.id
|
||||
editTaskInfoVisible.value = true
|
||||
}
|
||||
|
||||
function handleEditTaskInfoSuccess() {
|
||||
if (currentWorkOrderRow.value) {
|
||||
handleEditTask(currentWorkOrderRow.value)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleDeleteTask(task: any) {
|
||||
await ElMessageBox.confirm('确定要删除该任务吗?删除后不可恢复。', '提示', { type: 'warning' })
|
||||
await fetchDeleteProductionTask(task.id)
|
||||
ElMessage.success('任务已删除')
|
||||
await loadData()
|
||||
if (currentWorkOrderRow.value) {
|
||||
handleEditTask(currentWorkOrderRow.value)
|
||||
}
|
||||
}
|
||||
// 输入检索条件时自动搜索(防抖 300ms)
|
||||
watchDebounced(
|
||||
[searchForm, createTimeRange],
|
||||
@@ -1325,96 +1153,47 @@
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
const tab = route.query.tab
|
||||
if (tab === 'task') {
|
||||
mainTab.value = 'task'
|
||||
}
|
||||
loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.panel-entity-switch {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
padding: 16px 16px 12px;
|
||||
.production-work-order-table :deep(td.el-table__expanded-cell) {
|
||||
padding: 0 !important;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
.entity-switch-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
min-width: 220px;
|
||||
max-width: 280px;
|
||||
flex: 1;
|
||||
padding: 14px 18px;
|
||||
.production-work-order-table :deep(td.el-table__expanded-cell > .cell) {
|
||||
display: block !important;
|
||||
padding: 0 !important;
|
||||
text-align: left !important;
|
||||
}
|
||||
|
||||
.production-work-order-table :deep(.el-table__expand-icon) {
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--mint-border, #d9e8e2);
|
||||
border-radius: 10px;
|
||||
background: var(--surface, #fff);
|
||||
cursor: pointer;
|
||||
text-align: left;
|
||||
transition:
|
||||
border-color 0.2s ease,
|
||||
background-color 0.2s ease,
|
||||
box-shadow 0.2s ease;
|
||||
|
||||
&:hover:not(.is-active) {
|
||||
border-color: #a7f3d0;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
border-color: var(--primary, #10b981);
|
||||
background: var(--primary-bg, #ecfdf5);
|
||||
box-shadow: 0 0 0 1px rgb(16 185 129 / 12%);
|
||||
}
|
||||
}
|
||||
|
||||
.entity-switch-card__icon {
|
||||
display: flex;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
flex-shrink: 0;
|
||||
border-radius: 8px;
|
||||
background: #f1f5f9;
|
||||
color: #64748b;
|
||||
font-size: 20px;
|
||||
|
||||
.entity-switch-card.is-active & {
|
||||
background: #fff;
|
||||
color: var(--primary-dark, #059669);
|
||||
}
|
||||
}
|
||||
|
||||
.entity-switch-card__main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.entity-switch-card__title {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--text, #1e293b);
|
||||
line-height: 1.4;
|
||||
|
||||
.entity-switch-card.is-active & {
|
||||
color: var(--primary-dark, #059669);
|
||||
}
|
||||
}
|
||||
|
||||
.entity-switch-card__desc {
|
||||
font-size: 12px;
|
||||
transition:
|
||||
background 0.15s ease,
|
||||
border-color 0.15s ease;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
line-height: 1.4;
|
||||
background: var(--mint-surface, #fff);
|
||||
}
|
||||
|
||||
.panel-entity-body {
|
||||
min-width: 0;
|
||||
.production-work-order-table :deep(.el-table__expand-icon:hover) {
|
||||
background: var(--mint-primary-bg, #ecfdf5);
|
||||
border-color: #10b981;
|
||||
color: var(--mint-primary-dark, #059669);
|
||||
}
|
||||
|
||||
.production-work-order-table :deep(.el-table__expand-icon--expanded) {
|
||||
background: var(--mint-primary-bg, #ecfdf5);
|
||||
border-color: #10b981;
|
||||
color: var(--mint-primary-dark, #059669);
|
||||
}
|
||||
|
||||
.work-order-type-tabs {
|
||||
|
||||
Reference in new issue
Block a user