提交
This commit is contained in:
1 parent
427bcb1551
commit
31b04575e2
247 files changed
+39284
-20367
No files matched your search
@@ -253,9 +253,15 @@
|
||||
<el-form-item label="产品类型" prop="productTypeId">
|
||||
<el-select
|
||||
v-model="formData.productTypeId"
|
||||
placeholder="请选择产品类型"
|
||||
placeholder="输入名称检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
style="width: 100%"
|
||||
:loading="productTypeOptionsLoading"
|
||||
:remote-method="remoteSearchProductTypes"
|
||||
@visible-change="onProductTypeSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in productTypeOptions"
|
||||
@@ -268,9 +274,15 @@
|
||||
<el-form-item label="规格" prop="specId">
|
||||
<el-select
|
||||
v-model="formData.specId"
|
||||
placeholder="请选择规格"
|
||||
placeholder="输入名称检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
style="width: 100%"
|
||||
:loading="specOptionsLoading"
|
||||
:remote-method="remoteSearchSpecs"
|
||||
@visible-change="onSpecSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in specOptions"
|
||||
@@ -296,9 +308,15 @@
|
||||
<el-form-item v-if="isEdit" label="储物格位置" prop="storageSlotId">
|
||||
<el-select
|
||||
v-model="formData.storageSlotId"
|
||||
placeholder="请选择储物格"
|
||||
placeholder="输入编号检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
style="width: 100%"
|
||||
:loading="storageSlotOptionsLoading"
|
||||
:remote-method="remoteSearchStorageSlots"
|
||||
@visible-change="onStorageSlotSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storageSlotOptions"
|
||||
@@ -475,10 +493,15 @@
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-model="row.storageSlotId"
|
||||
placeholder="请选择储物格"
|
||||
placeholder="输入编号检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
style="width: 100%"
|
||||
:loading="storageSlotOptionsLoading"
|
||||
:remote-method="remoteSearchStorageSlots"
|
||||
@visible-change="onStorageSlotSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storageSlotOptions"
|
||||
@@ -604,11 +627,13 @@
|
||||
import {
|
||||
fetchCellProductTypeList,
|
||||
fetchCellProductSpecList,
|
||||
fetchStorageFacilityList,
|
||||
fetchStorageSlotList,
|
||||
fetchItemUnitList
|
||||
} from '@/api/admin'
|
||||
import { loadStorageSlotSelectOptions, validateUniqueStorageSlotIds } from '@/utils/storage-slot-options'
|
||||
import {
|
||||
remoteSearchStorageSlotSelectOptions,
|
||||
ensureStorageSlotsInOptions,
|
||||
validateUniqueStorageSlotIds
|
||||
} from '@/utils/storage-slot-options'
|
||||
import { fetchUploadAttachment } from '@/api/business'
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
|
||||
@@ -678,9 +703,13 @@
|
||||
const viewRow = ref<any>(null)
|
||||
|
||||
/* ---- 下拉选项 ---- */
|
||||
const productTypeOptions = ref<Array<{ id: string; name: string }>>([])
|
||||
const specOptions = ref<Array<{ id: string; name: string }>>([])
|
||||
const productTypeOptions = ref<Array<{ id: string; productTypeName: string }>>([])
|
||||
const specOptions = ref<Array<{ id: string; specName: string }>>([])
|
||||
const storageSlotOptions = ref<Array<{ id: string; name: string }>>([])
|
||||
const productTypeOptionsLoading = ref(false)
|
||||
const specOptionsLoading = ref(false)
|
||||
const storageSlotOptionsLoading = ref(false)
|
||||
const storageSlotSearchOpts = ref<{ includeSlotIds?: string[] }>({})
|
||||
|
||||
/* ---- 编辑时状态选项 ---- */
|
||||
const editStatusOptions = [
|
||||
@@ -926,33 +955,77 @@
|
||||
}
|
||||
}
|
||||
|
||||
const facilityFlatList = ref<any[]>([])
|
||||
|
||||
async function loadStorageSlotOptions(opts?: { includeSlotIds?: string[] }) {
|
||||
storageSlotOptions.value = await loadStorageSlotSelectOptions(
|
||||
facilityFlatList.value,
|
||||
fetchStorageSlotList,
|
||||
{ availableOnly: true, includeSlotIds: opts?.includeSlotIds }
|
||||
)
|
||||
async function remoteSearchProductTypes(query: string) {
|
||||
productTypeOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchCellProductTypeList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
productTypeOptions.value = res?.list || res || []
|
||||
} catch {
|
||||
productTypeOptions.value = []
|
||||
} finally {
|
||||
productTypeOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadDropdownData() {
|
||||
function ensureProductTypeInOptions(id: string, name?: string) {
|
||||
if (!id) return
|
||||
if (productTypeOptions.value.some((o) => o.id === id)) return
|
||||
productTypeOptions.value = [{ id, productTypeName: name || id }, ...productTypeOptions.value]
|
||||
}
|
||||
|
||||
async function remoteSearchSpecs(query: string) {
|
||||
specOptionsLoading.value = true
|
||||
try {
|
||||
const [typeRes, specRes, facilityRes] = await Promise.all([
|
||||
fetchCellProductTypeList({ page: 1, pageSize: 100 }),
|
||||
fetchCellProductSpecList({ page: 1, pageSize: 100 }),
|
||||
fetchStorageFacilityList()
|
||||
])
|
||||
productTypeOptions.value = typeRes?.list || typeRes || []
|
||||
specOptions.value = specRes?.list || specRes || []
|
||||
const facilities = facilityRes?.list || facilityRes || []
|
||||
facilityFlatList.value = facilities
|
||||
await loadStorageSlotOptions()
|
||||
const res = await fetchCellProductSpecList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
specOptions.value = res?.list || res || []
|
||||
} catch {
|
||||
/* 下拉数据加载失败不阻塞页面 */
|
||||
specOptions.value = []
|
||||
} finally {
|
||||
specOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function ensureSpecInOptions(id: string, name?: string) {
|
||||
if (!id) return
|
||||
if (specOptions.value.some((o) => o.id === id)) return
|
||||
specOptions.value = [{ id, specName: name || id }, ...specOptions.value]
|
||||
}
|
||||
|
||||
async function remoteSearchStorageSlots(query: string) {
|
||||
storageSlotOptionsLoading.value = true
|
||||
try {
|
||||
const list = await remoteSearchStorageSlotSelectOptions(query, {
|
||||
availableOnly: true,
|
||||
includeSlotIds: storageSlotSearchOpts.value.includeSlotIds
|
||||
})
|
||||
storageSlotOptions.value = list
|
||||
} catch {
|
||||
storageSlotOptions.value = []
|
||||
} finally {
|
||||
storageSlotOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onStorageSlotSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchStorageSlots('')
|
||||
}
|
||||
|
||||
function onProductTypeSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchProductTypes('')
|
||||
}
|
||||
|
||||
function onSpecSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchSpecs('')
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
@@ -1092,7 +1165,10 @@
|
||||
dialogTitle.value = '新增产品'
|
||||
resetForm()
|
||||
formData.quantity = 1
|
||||
await loadStorageSlotOptions()
|
||||
storageSlotSearchOpts.value = {}
|
||||
await remoteSearchStorageSlots('')
|
||||
void remoteSearchProductTypes('')
|
||||
void remoteSearchSpecs('')
|
||||
dialogVisible.value = true
|
||||
void searchUnitOptions('')
|
||||
formRef.value?.clearValidate?.()
|
||||
@@ -1122,9 +1198,17 @@
|
||||
formData.passage = row.passage || ''
|
||||
formData.batchNo = row.batchNo || ''
|
||||
formData.storageSlotId = row.storageSlotId || ''
|
||||
await loadStorageSlotOptions({
|
||||
storageSlotSearchOpts.value = {
|
||||
includeSlotIds: row.storageSlotId ? [row.storageSlotId] : undefined
|
||||
})
|
||||
}
|
||||
ensureProductTypeInOptions(row.productTypeId, row.productTypeName)
|
||||
ensureSpecInOptions(row.specId, row.specName)
|
||||
storageSlotOptions.value = ensureStorageSlotsInOptions([], [
|
||||
{ id: row.storageSlotId, name: row.storageSlotName }
|
||||
])
|
||||
await remoteSearchStorageSlots('')
|
||||
void remoteSearchProductTypes('')
|
||||
void remoteSearchSpecs('')
|
||||
formData.expectedCellCount = row.expectedCellCount ?? undefined
|
||||
formData.viability = row.viability ?? undefined
|
||||
formData.freezeDate = row.freezeDate || ''
|
||||
@@ -1247,7 +1331,6 @@
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
loadDropdownData()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -501,6 +501,7 @@
|
||||
ShoppingBag
|
||||
} from '@element-plus/icons-vue'
|
||||
import { watchDebounced } from '@vueuse/core'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
|
||||
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
|
||||
import { garmentStatusLabel, garmentStatusTagType } from '@/utils/status-tag-registry'
|
||||
|
||||
@@ -457,7 +457,17 @@
|
||||
<el-input v-model="formData.standardUsage" placeholder="请输入标准用量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位">
|
||||
<el-select v-model="formData.unit" placeholder="请选择单位" clearable filterable>
|
||||
<el-select
|
||||
v-model="formData.unit"
|
||||
placeholder="输入单位检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
:loading="unitOptionsLoading"
|
||||
:remote-method="remoteSearchUnits"
|
||||
@visible-change="onUnitSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in unitOptions"
|
||||
:key="item.value"
|
||||
@@ -1177,6 +1187,7 @@
|
||||
const activeTab = ref('list')
|
||||
const tableRef = ref()
|
||||
const unitOptions = ref<{ label: string; value: string }[]>([])
|
||||
const unitOptionsLoading = ref(false)
|
||||
|
||||
const searchForm = reactive({ keyword: '', status: '' })
|
||||
const tableData = ref<any[]>([])
|
||||
@@ -1496,6 +1507,37 @@
|
||||
loadData()
|
||||
}
|
||||
|
||||
function ensureUnitInOptions(unitName: string) {
|
||||
const n = (unitName || '').trim()
|
||||
if (!n || unitOptions.value.some((o) => o.value === n)) return
|
||||
unitOptions.value = [{ label: n, value: n }, ...unitOptions.value]
|
||||
}
|
||||
|
||||
async function remoteSearchUnits(query: string) {
|
||||
unitOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchItemUnitList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
unitOptions.value = (res.list || []).map((u: any) => ({
|
||||
label: u.unitName,
|
||||
value: u.unitName
|
||||
}))
|
||||
ensureUnitInOptions(formData.unit)
|
||||
} catch {
|
||||
unitOptions.value = []
|
||||
ensureUnitInOptions(formData.unit)
|
||||
} finally {
|
||||
unitOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onUnitSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchUnits('')
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
formData.consumableCode = ''
|
||||
formData.consumableName = ''
|
||||
@@ -1515,6 +1557,7 @@
|
||||
resetForm()
|
||||
dialogVisible.value = true
|
||||
formRef.value?.clearValidate?.()
|
||||
void remoteSearchUnits('')
|
||||
}
|
||||
|
||||
function handleEdit(row: any) {
|
||||
@@ -1532,6 +1575,7 @@
|
||||
formData.remark = row.remark || ''
|
||||
dialogVisible.value = true
|
||||
formRef.value?.clearValidate?.()
|
||||
void remoteSearchUnits('')
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
@@ -1979,8 +2023,6 @@
|
||||
activeTab.value = tab
|
||||
}
|
||||
loadData()
|
||||
const res = await fetchItemUnitList({ page: 1, pageSize: 100 })
|
||||
unitOptions.value = (res.list || []).map((u: any) => ({ label: u.unitName, value: u.unitName }))
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<!-- 生产管理 — 我的生产任务 -->
|
||||
<!-- 生产管理 — 我的生产任务(复制生产工单页改造:三 Tab + 完整筛选,仅展示本人任务) -->
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<div ref="pageRef" class="page-container my-production-task-page" :style="pageStyle">
|
||||
<section class="panel my-production-task-panel">
|
||||
<div class="page-container">
|
||||
<section class="panel">
|
||||
<div class="panel-top">
|
||||
<h2 class="title-bar-heading">我的生产任务</h2>
|
||||
</div>
|
||||
@@ -9,14 +10,14 @@
|
||||
<div class="panel-pill-tabs">
|
||||
<div class="panel-pill-tabs__track" role="tablist">
|
||||
<button
|
||||
v-for="tab in TASK_TABS"
|
||||
v-for="tab in WORK_ORDER_TYPE_TABS"
|
||||
:key="tab.name"
|
||||
type="button"
|
||||
role="tab"
|
||||
class="panel-pill-tabs__btn"
|
||||
:class="{ 'is-active': activeTab === tab.name }"
|
||||
:aria-selected="activeTab === tab.name"
|
||||
@click="switchTab(tab.name)"
|
||||
:class="{ 'is-active': activeTypeTab === tab.name }"
|
||||
:aria-selected="activeTypeTab === tab.name"
|
||||
@click="handleTabChange(tab.name)"
|
||||
>
|
||||
{{ tab.label }}
|
||||
</button>
|
||||
@@ -24,33 +25,88 @@
|
||||
</div>
|
||||
|
||||
<div class="filter-block">
|
||||
<el-form :model="searchForm" class="filter-form" @submit.prevent>
|
||||
<div class="filter-grid">
|
||||
<el-form :model="searchForm" class="filter-form" label-position="top" @submit.prevent>
|
||||
<p class="filter-hint">{{ filterHint }}</p>
|
||||
<div class="filter-grid my-production-task-filter-main-grid">
|
||||
<el-form-item label="关键词">
|
||||
<el-input
|
||||
v-model="searchForm.keyword"
|
||||
placeholder="任务号 / 任务名称 / 工单号 / 样本编码"
|
||||
:placeholder="
|
||||
activeTypeTab === 'temporary'
|
||||
? '工单号'
|
||||
: activeTypeTab === 'outbound'
|
||||
? '工单号/申请单号/申请单名称'
|
||||
: '工单号/样本编码/入库编码'
|
||||
"
|
||||
clearable
|
||||
@keyup.enter="handleSearch"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="工单状态">
|
||||
<el-select
|
||||
v-model="searchForm.workOrderStatus"
|
||||
placeholder="全部"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option label="待配置" value="dpz" />
|
||||
<el-option label="进行中" value="jxz" />
|
||||
<el-option label="已完成" value="ywc" />
|
||||
<el-option label="已作废" value="yzf" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="任务状态">
|
||||
<el-select v-model="searchForm.taskStatus" clearable placeholder="全部">
|
||||
<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-select v-model="searchForm.workOrderType" clearable placeholder="全部">
|
||||
<el-option label="入库生产" value="inbound" />
|
||||
<el-option label="出库生产" value="outbound" />
|
||||
<el-option label="临时生产" value="temporary" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<div class="filter-actions-row">
|
||||
<span class="filter-hint">{{ filterHint }}</span>
|
||||
|
||||
<div v-show="filterExpanded" id="my-production-task-filter-extra" class="filter-extra">
|
||||
<div class="filter-grid my-production-task-filter-extra-grid">
|
||||
<el-form-item v-if="activeTypeTab === 'outbound'" label="业务类型">
|
||||
<el-select v-model="searchForm.bizType" placeholder="全部" clearable style="width: 100%">
|
||||
<el-option label="中试服务" value="pilot_service" />
|
||||
<el-option label="临床应用" value="clinical_application" />
|
||||
<el-option label="基础实验" value="basic_experiment" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="filterTimeLabel">
|
||||
<el-date-picker
|
||||
v-model="createTimeRange"
|
||||
type="daterange"
|
||||
range-separator="至"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filter-actions">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
class="btn-filter-toggle"
|
||||
:aria-expanded="String(filterExpanded)"
|
||||
aria-controls="my-production-task-filter-extra"
|
||||
@click="filterExpanded = !filterExpanded"
|
||||
>
|
||||
<el-icon class="btn-filter-toggle-ic">
|
||||
<ArrowDown v-if="!filterExpanded" />
|
||||
<ArrowUp v-else />
|
||||
</el-icon>
|
||||
{{ filterExpanded ? '收起更多条件' : '展开更多条件' }}
|
||||
</el-button>
|
||||
<div class="filter-actions-end">
|
||||
<el-button class="btn-ghost" @click="handleReset"
|
||||
><el-icon><RefreshLeft /></el-icon>重置</el-button
|
||||
@@ -63,166 +119,255 @@
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-body list-wrap my-production-task-list">
|
||||
<WorkOrderTaskSubList
|
||||
:list-mode="activeTab === 'current' ? 'mine-current' : 'mine-history'"
|
||||
:mine-filters="appliedFilters"
|
||||
:page="pagination.page"
|
||||
:page-size="pagination.pageSize"
|
||||
:refresh-token="refreshToken"
|
||||
embedded
|
||||
@update:total="pagination.total = $event"
|
||||
/>
|
||||
<div class="pagination list-pager-bar">
|
||||
<el-pagination
|
||||
v-model:current-page="pagination.page"
|
||||
v-model:page-size="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:page-sizes="[30, 60, 100]"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
background
|
||||
@current-change="handlePageChange"
|
||||
@size-change="handleSizeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<ProductionWorkOrderCardList
|
||||
page-mode="mine"
|
||||
:rows="tableData"
|
||||
:loading="loading"
|
||||
:active-type-tab="activeTypeTab"
|
||||
:page="pagination.page"
|
||||
:page-size="pagination.pageSize"
|
||||
:total="pagination.total"
|
||||
:task-refresh-token="taskSubListRefreshToken"
|
||||
:preset-tasks-by-work-order-id="presetTasksByWorkOrderId"
|
||||
@view="handleView"
|
||||
@tasks-changed="handleWorkOrderTasksChanged"
|
||||
@page-change="onWorkOrderPageChange"
|
||||
@page-size-change="onWorkOrderPageSizeChange"
|
||||
/>
|
||||
|
||||
<ProductionWorkOrderViewDialogHost ref="viewDialogHostRef" />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, computed, onMounted, onUnmounted, nextTick } from 'vue'
|
||||
import { Search, RefreshLeft } from '@element-plus/icons-vue'
|
||||
import WorkOrderTaskSubList from '../production-work-order/WorkOrderTaskSubList.vue'
|
||||
import { ref, reactive, computed, onMounted } from 'vue'
|
||||
import { Search, RefreshLeft, ArrowDown, ArrowUp } from '@element-plus/icons-vue'
|
||||
import type { ProductionWorkOrderItem } from '@/api/production-work-order'
|
||||
import {
|
||||
fetchAllMineProductionTasks,
|
||||
groupMineTasksByWorkOrder,
|
||||
enrichMineEntriesWithWorkOrders,
|
||||
filterMineEntriesByWorkOrderSearch,
|
||||
paginateMineEntries,
|
||||
buildMineTableRows
|
||||
} from '@/utils/production-mine-task-groups'
|
||||
import ProductionWorkOrderCardList from '../production-work-order/ProductionWorkOrderCardList.vue'
|
||||
import ProductionWorkOrderViewDialogHost from '../production-work-order/ProductionWorkOrderViewDialogHost.vue'
|
||||
|
||||
defineOptions({ name: 'ProductionMyProductionTask' })
|
||||
|
||||
const PAGE_BOTTOM_GAP = 20
|
||||
const TASK_TABS = [
|
||||
{ name: 'current', label: '当前任务' },
|
||||
{ name: 'history', label: '历史执行' }
|
||||
const taskSubListRefreshToken = ref(0)
|
||||
const viewDialogHostRef = ref<InstanceType<typeof ProductionWorkOrderViewDialogHost> | null>(null)
|
||||
|
||||
type WorkOrderTypeTab = 'inbound' | 'temporary' | 'outbound'
|
||||
|
||||
const WORK_ORDER_TYPE_TABS = [
|
||||
{ name: 'inbound', label: '入库生产工单' },
|
||||
{ name: 'outbound', label: '出库生产工单' },
|
||||
{ name: 'temporary', label: '临时生产工单' }
|
||||
] as const
|
||||
|
||||
const activeTab = ref<'current' | 'history'>('current')
|
||||
|
||||
const pageRef = ref<HTMLElement>()
|
||||
const pageStyle = ref<Record<string, string>>({})
|
||||
let pageResizeObserver: ResizeObserver | undefined
|
||||
|
||||
const filterHint = computed(() =>
|
||||
activeTab.value === 'current'
|
||||
? '仅展示当前指派给您的生产任务。'
|
||||
: '展示您曾负责并已转出的任务,仅可查看。'
|
||||
const activeTypeTab = ref<WorkOrderTypeTab>('inbound')
|
||||
const filterExpanded = ref(false)
|
||||
const filterTimeLabel = computed(() =>
|
||||
activeTypeTab.value === 'outbound' ? '输注时间' : '创建时间'
|
||||
)
|
||||
const filterHint = computed(() => {
|
||||
const timeHint =
|
||||
activeTypeTab.value === 'outbound'
|
||||
? '默认展示近 30 天内输注的工单。'
|
||||
: '默认展示近 30 天内创建的工单。'
|
||||
return `仅展示指派给当前登录人的生产任务(含已转出记录,转出任务仅可查看)。${timeHint}`
|
||||
})
|
||||
|
||||
function updatePageHeight() {
|
||||
const el = pageRef.value
|
||||
if (!el) return
|
||||
const top = el.getBoundingClientRect().top
|
||||
const layoutContent = el.closest('.layout-content') as HTMLElement | null
|
||||
const paddingBottom = layoutContent
|
||||
? Number.parseInt(getComputedStyle(layoutContent).paddingBottom, 10) || 0
|
||||
: 0
|
||||
const height = Math.max(200, window.innerHeight - top - paddingBottom - PAGE_BOTTOM_GAP)
|
||||
pageStyle.value = { height: `${height}px`, overflow: 'hidden' }
|
||||
function formatLocalDate(d: Date): string {
|
||||
const y = d.getFullYear()
|
||||
const m = String(d.getMonth() + 1).padStart(2, '0')
|
||||
const day = String(d.getDate()).padStart(2, '0')
|
||||
return `${y}-${m}-${day}`
|
||||
}
|
||||
|
||||
function bindPageHeightListeners() {
|
||||
updatePageHeight()
|
||||
window.addEventListener('resize', updatePageHeight)
|
||||
pageResizeObserver?.disconnect()
|
||||
pageResizeObserver = new ResizeObserver(() => updatePageHeight())
|
||||
const panel = pageRef.value?.querySelector('.my-production-task-panel')
|
||||
const filterBlock = pageRef.value?.querySelector('.filter-block')
|
||||
const pagerBar = pageRef.value?.querySelector('.list-pager-bar')
|
||||
if (panel) pageResizeObserver.observe(panel)
|
||||
if (filterBlock) pageResizeObserver.observe(filterBlock)
|
||||
if (pagerBar) pageResizeObserver.observe(pagerBar)
|
||||
function getDefaultLast30DaysRange(): [string, string] {
|
||||
const end = new Date()
|
||||
const start = new Date()
|
||||
start.setDate(start.getDate() - 30)
|
||||
return [formatLocalDate(start), formatLocalDate(end)]
|
||||
}
|
||||
|
||||
function unbindPageHeightListeners() {
|
||||
window.removeEventListener('resize', updatePageHeight)
|
||||
pageResizeObserver?.disconnect()
|
||||
pageResizeObserver = undefined
|
||||
}
|
||||
|
||||
onMounted(() => nextTick(bindPageHeightListeners))
|
||||
onUnmounted(unbindPageHeightListeners)
|
||||
|
||||
const searchForm = reactive({
|
||||
keyword: '',
|
||||
workOrderStatus: '',
|
||||
taskStatus: '',
|
||||
workOrderType: ''
|
||||
bizType: ''
|
||||
})
|
||||
const createTimeRange = ref<[string, string] | null>(getDefaultLast30DaysRange())
|
||||
const tableData = ref<ProductionWorkOrderItem[]>([])
|
||||
const presetTasksByWorkOrderId = ref<Record<string, Record<string, any>[]>>({})
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
|
||||
const appliedFilters = reactive({
|
||||
keyword: '',
|
||||
taskStatus: '',
|
||||
workOrderType: ''
|
||||
})
|
||||
function buildWorkOrderSearchFilters() {
|
||||
const timeParams =
|
||||
activeTypeTab.value === 'outbound'
|
||||
? {
|
||||
infusionTimeStart: createTimeRange.value?.[0] || undefined,
|
||||
infusionTimeEnd: createTimeRange.value?.[1] || undefined
|
||||
}
|
||||
: {
|
||||
createTimeStart: createTimeRange.value?.[0] || undefined,
|
||||
createTimeEnd: createTimeRange.value?.[1] || undefined
|
||||
}
|
||||
return {
|
||||
keyword: searchForm.keyword || undefined,
|
||||
workOrderStatus: searchForm.workOrderStatus || undefined,
|
||||
bizType: searchForm.bizType || undefined,
|
||||
activeTypeTab: activeTypeTab.value,
|
||||
...timeParams
|
||||
}
|
||||
}
|
||||
|
||||
const refreshToken = ref(0)
|
||||
const pagination = reactive({ page: 1, pageSize: 30, total: 0 })
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
const tasks = await fetchAllMineProductionTasks({
|
||||
keyword: searchForm.keyword || undefined,
|
||||
taskStatus: searchForm.taskStatus || undefined,
|
||||
workOrderType: activeTypeTab.value
|
||||
})
|
||||
let entries = groupMineTasksByWorkOrder(tasks)
|
||||
entries = await enrichMineEntriesWithWorkOrders(entries)
|
||||
entries = filterMineEntriesByWorkOrderSearch(entries, buildWorkOrderSearchFilters())
|
||||
const pageResult = paginateMineEntries(entries, pagination.page, pagination.pageSize)
|
||||
const tableModel = buildMineTableRows(pageResult.items)
|
||||
tableData.value = tableModel.rows
|
||||
presetTasksByWorkOrderId.value = tableModel.presetTasksByWorkOrderId
|
||||
pagination.total = pageResult.total
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
appliedFilters.keyword = searchForm.keyword
|
||||
appliedFilters.taskStatus = searchForm.taskStatus
|
||||
appliedFilters.workOrderType = searchForm.workOrderType
|
||||
pagination.page = 1
|
||||
refreshToken.value += 1
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
searchForm.keyword = ''
|
||||
searchForm.workOrderStatus = ''
|
||||
searchForm.taskStatus = ''
|
||||
searchForm.workOrderType = ''
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
function handleTabChange() {
|
||||
searchForm.bizType = ''
|
||||
createTimeRange.value = getDefaultLast30DaysRange()
|
||||
filterExpanded.value = false
|
||||
pagination.page = 1
|
||||
refreshToken.value += 1
|
||||
nextTick(updatePageHeight)
|
||||
loadData()
|
||||
}
|
||||
|
||||
function switchTab(name: 'current' | 'history') {
|
||||
if (activeTab.value === name) return
|
||||
activeTab.value = name
|
||||
handleTabChange()
|
||||
}
|
||||
|
||||
function handlePageChange() {
|
||||
refreshToken.value += 1
|
||||
}
|
||||
|
||||
function handleSizeChange() {
|
||||
function handleTypeTabChange() {
|
||||
pagination.page = 1
|
||||
refreshToken.value += 1
|
||||
filterExpanded.value = false
|
||||
if (activeTypeTab.value !== 'outbound') {
|
||||
searchForm.bizType = ''
|
||||
}
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleTabChange(name: WorkOrderTypeTab) {
|
||||
if (activeTypeTab.value === name) return
|
||||
activeTypeTab.value = name
|
||||
handleTypeTabChange()
|
||||
}
|
||||
|
||||
async function handleWorkOrderTasksChanged() {
|
||||
taskSubListRefreshToken.value += 1
|
||||
await loadData()
|
||||
}
|
||||
|
||||
function onWorkOrderPageChange(page: number) {
|
||||
pagination.page = page
|
||||
loadData()
|
||||
}
|
||||
|
||||
function onWorkOrderPageSizeChange(size: number) {
|
||||
pagination.page = 1
|
||||
pagination.pageSize = size
|
||||
loadData()
|
||||
}
|
||||
|
||||
function handleView(row: ProductionWorkOrderItem) {
|
||||
viewDialogHostRef.value?.openView(row)
|
||||
}
|
||||
|
||||
watchDebounced(
|
||||
[searchForm, createTimeRange],
|
||||
() => {
|
||||
pagination.page = 1
|
||||
loadData()
|
||||
},
|
||||
{ debounce: 300, deep: true }
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.my-production-task-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.my-production-task-filter-main-grid,
|
||||
.my-production-task-filter-extra-grid {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.my-production-task-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
@media (max-width: 1100px) {
|
||||
.my-production-task-filter-main-grid,
|
||||
.my-production-task-filter-extra-grid {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
.my-production-task-list {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@media (max-width: 560px) {
|
||||
.my-production-task-filter-main-grid,
|
||||
.my-production-task-filter-extra-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-form :deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.filter-hint {
|
||||
margin: 0 0 10px;
|
||||
font-size: 12px;
|
||||
color: var(--mint-text-muted, #64748b);
|
||||
}
|
||||
|
||||
.filter-extra {
|
||||
padding-top: 10px;
|
||||
margin-top: 8px;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.filter-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 10px;
|
||||
padding-top: 10px;
|
||||
margin-top: 10px;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.btn-filter-toggle {
|
||||
height: 36px;
|
||||
padding: 0 4px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.btn-filter-toggle-ic {
|
||||
margin-right: 4px;
|
||||
}
|
||||
</style>
|
||||
@@ -21,7 +21,17 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="产品类型">
|
||||
<el-select v-model="searchForm.productTypeId" placeholder="全部" clearable filterable>
|
||||
<el-select
|
||||
v-model="searchForm.productTypeId"
|
||||
placeholder="输入名称检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
:loading="productTypeOptionsLoading"
|
||||
:remote-method="remoteSearchProductTypes"
|
||||
@visible-change="onProductTypeSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="pt in productTypeOptions"
|
||||
:key="pt.id"
|
||||
@@ -210,9 +220,14 @@
|
||||
<el-form-item label="产品类型">
|
||||
<el-select
|
||||
v-model="formData.productTypeId"
|
||||
placeholder="请选择产品类型"
|
||||
placeholder="输入名称检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
:loading="productTypeOptionsLoading"
|
||||
:remote-method="remoteSearchProductTypes"
|
||||
@visible-change="onProductTypeSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="pt in productTypeOptions"
|
||||
@@ -1103,11 +1118,13 @@
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const productTypeOptions = ref<Record<string, any>[]>([])
|
||||
const productTypeOptionsLoading = ref(false)
|
||||
const productTypeNameById = ref<Record<string, string>>({})
|
||||
|
||||
const productTypeMap = computed(() => {
|
||||
const map: Record<string, string> = {}
|
||||
const map: Record<string, string> = { ...productTypeNameById.value }
|
||||
productTypeOptions.value.forEach((pt: Record<string, any>) => {
|
||||
map[pt.id] = pt.productTypeName || ''
|
||||
if (pt.id) map[pt.id] = pt.productTypeName || map[pt.id] || ''
|
||||
})
|
||||
return map
|
||||
})
|
||||
@@ -1116,15 +1133,37 @@
|
||||
selectedRows.value = rows
|
||||
}
|
||||
|
||||
async function loadProductTypes() {
|
||||
async function remoteSearchProductTypes(query: string) {
|
||||
productTypeOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchCellProductTypeList({ page: 1, pageSize: 100 })
|
||||
const res = await fetchCellProductTypeList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
productTypeOptions.value = res.list || res || []
|
||||
for (const pt of productTypeOptions.value) {
|
||||
if (pt.id) productTypeNameById.value[pt.id] = pt.productTypeName || ''
|
||||
}
|
||||
} catch {
|
||||
/* ignore */
|
||||
productTypeOptions.value = []
|
||||
} finally {
|
||||
productTypeOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onProductTypeSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchProductTypes('')
|
||||
}
|
||||
|
||||
function ensureProductTypeInOptions(id: string) {
|
||||
if (!id) return
|
||||
if (productTypeOptions.value.some((pt) => pt.id === id)) return
|
||||
const name = productTypeNameById.value[id] || id
|
||||
productTypeOptions.value = [...productTypeOptions.value, { id, productTypeName: name }]
|
||||
if (!productTypeNameById.value[id]) productTypeNameById.value[id] = name
|
||||
}
|
||||
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -1202,6 +1241,7 @@
|
||||
formData.routeCode = row.routeCode || ''
|
||||
formData.routeName = row.routeName || ''
|
||||
formData.productTypeId = row.productTypeId || ''
|
||||
ensureProductTypeInOptions(row.productTypeId)
|
||||
formData.version = row.version || ''
|
||||
formData.remark = row.remark || ''
|
||||
dialogVisible.value = true
|
||||
@@ -2161,7 +2201,7 @@
|
||||
)
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
loadProductTypes()
|
||||
void remoteSearchProductTypes('')
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
+63
-10
@@ -59,9 +59,14 @@
|
||||
<el-select
|
||||
v-model="row.componentMaterialId"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
clearable
|
||||
placeholder="选择试剂/耗材"
|
||||
placeholder="输入名称检索试剂/耗材"
|
||||
class="inner-cell-select"
|
||||
:loading="componentOptionsLoading"
|
||||
:remote-method="remoteSearchComponents"
|
||||
@visible-change="onComponentSelectVisible"
|
||||
@change="(id: string) => onComponentSelect(row, id)"
|
||||
>
|
||||
<el-option
|
||||
@@ -117,7 +122,6 @@
|
||||
fetchUpdateProductionMaterial,
|
||||
fetchProductionMaterialFormula,
|
||||
fetchReplaceProductionMaterialFormula,
|
||||
fetchProductionMaterialOptions,
|
||||
fetchProductionMaterialList,
|
||||
type ProductionMaterialFormulaLine,
|
||||
type ProductionMaterialOption
|
||||
@@ -150,13 +154,61 @@
|
||||
|
||||
const formulaLines = ref<ProductionMaterialFormulaLine[]>([])
|
||||
const componentOptions = ref<ProductionMaterialOption[]>([])
|
||||
const componentOptionsLoading = ref(false)
|
||||
|
||||
async function loadComponentOptions() {
|
||||
const [reagents, consumables] = await Promise.all([
|
||||
fetchProductionMaterialOptions({ materialType: 'reagent' }),
|
||||
fetchProductionMaterialOptions({ materialType: 'consumable' })
|
||||
])
|
||||
componentOptions.value = [...(reagents || []), ...(consumables || [])]
|
||||
function mapProductionMaterialListToOptions(list: Array<Record<string, any>>): ProductionMaterialOption[] {
|
||||
return (list || []).map((m) => ({
|
||||
id: String(m.id || ''),
|
||||
label: `${m.materialName || ''}(${m.materialCode || ''})`.trim(),
|
||||
materialCode: String(m.materialCode || ''),
|
||||
materialName: String(m.materialName || ''),
|
||||
materialType: String(m.materialType || ''),
|
||||
specModel: String(m.specModel || ''),
|
||||
unit: String(m.unit || ''),
|
||||
stockQty: Number(m.stockQty ?? 0)
|
||||
}))
|
||||
}
|
||||
|
||||
function ensureComponentsInOptions(lines: ProductionMaterialFormulaLine[]) {
|
||||
for (const ln of lines) {
|
||||
if (!ln.componentMaterialId) continue
|
||||
if (componentOptions.value.some((o) => o.id === ln.componentMaterialId)) continue
|
||||
componentOptions.value.push({
|
||||
id: ln.componentMaterialId,
|
||||
label: `${ln.componentMaterialName || ''}(${ln.componentMaterialCode || ''})`.trim(),
|
||||
materialCode: ln.componentMaterialCode || '',
|
||||
materialName: ln.componentMaterialName || '',
|
||||
materialType: ln.componentMaterialType || 'reagent',
|
||||
specModel: '',
|
||||
unit: ln.usageUnit || '',
|
||||
stockQty: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function remoteSearchComponents(query: string) {
|
||||
componentOptionsLoading.value = true
|
||||
try {
|
||||
const keyword = query?.trim() || undefined
|
||||
const [reagentRes, consumableRes] = await Promise.all([
|
||||
fetchProductionMaterialList({ page: 1, pageSize: 100, keyword, materialType: 'reagent' }),
|
||||
fetchProductionMaterialList({ page: 1, pageSize: 100, keyword, materialType: 'consumable' })
|
||||
])
|
||||
componentOptions.value = [
|
||||
...mapProductionMaterialListToOptions(reagentRes.list || []),
|
||||
...mapProductionMaterialListToOptions(consumableRes.list || [])
|
||||
]
|
||||
ensureComponentsInOptions(formulaLines.value)
|
||||
} catch {
|
||||
componentOptions.value = []
|
||||
ensureComponentsInOptions(formulaLines.value)
|
||||
} finally {
|
||||
componentOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onComponentSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchComponents('')
|
||||
}
|
||||
|
||||
function addFormulaLine() {
|
||||
@@ -190,14 +242,14 @@
|
||||
remark: ''
|
||||
})
|
||||
formulaLines.value = []
|
||||
await loadComponentOptions()
|
||||
await remoteSearchComponents('')
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
async function openEdit(id: string) {
|
||||
isEdit.value = true
|
||||
materialId.value = id
|
||||
await loadComponentOptions()
|
||||
await remoteSearchComponents('')
|
||||
const res = await fetchProductionMaterialList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
@@ -218,6 +270,7 @@
|
||||
remark: cfg.remark || ''
|
||||
})
|
||||
formulaLines.value = (await fetchProductionMaterialFormula(id)) || []
|
||||
ensureComponentsInOptions(formulaLines.value)
|
||||
visible.value = true
|
||||
}
|
||||
|
||||
|
||||
@@ -106,8 +106,13 @@
|
||||
<el-select
|
||||
v-model="formData.configuredMaterialId"
|
||||
filterable
|
||||
placeholder="请选择配置试剂"
|
||||
remote
|
||||
reserve-keyword
|
||||
placeholder="输入名称检索配置试剂"
|
||||
style="width: 100%"
|
||||
:loading="configuredOptionsLoading"
|
||||
:remote-method="remoteSearchConfiguredMaterials"
|
||||
@visible-change="onConfiguredSelectVisible"
|
||||
@change="onConfiguredChange"
|
||||
>
|
||||
<el-option
|
||||
@@ -263,12 +268,13 @@
|
||||
fetchUpdateProductionMaterialPrep,
|
||||
fetchCompleteProductionMaterialPrep,
|
||||
fetchDeleteProductionMaterialPrep,
|
||||
fetchProductionMaterialOptions,
|
||||
fetchProductionMaterialList,
|
||||
fetchProductionMaterialFormula,
|
||||
fetchProductionMaterialRequisitionOptions,
|
||||
type ProductionMaterialPrep,
|
||||
type ProductionMaterialPrepLine,
|
||||
type ProductionMaterialFormulaLine,
|
||||
type ProductionMaterialOption,
|
||||
type ProductionMaterialRequisitionOption
|
||||
} from '@/api/production-material'
|
||||
|
||||
@@ -302,7 +308,8 @@
|
||||
expireDate: [{ required: true, message: '请选择过期日期', trigger: 'change' }]
|
||||
}
|
||||
|
||||
const configuredOptions = ref<Awaited<ReturnType<typeof fetchProductionMaterialOptions>>>([])
|
||||
const configuredOptions = ref<ProductionMaterialOption[]>([])
|
||||
const configuredOptionsLoading = ref(false)
|
||||
const formulaComponentOptions = ref<ProductionMaterialFormulaLine[]>([])
|
||||
const requisitionOptions = ref<ProductionMaterialRequisitionOption[]>([])
|
||||
|
||||
@@ -343,9 +350,62 @@
|
||||
handleSearch()
|
||||
}
|
||||
|
||||
async function loadConfiguredOptions() {
|
||||
configuredOptions.value =
|
||||
(await fetchProductionMaterialOptions({ materialType: 'configured_reagent' })) || []
|
||||
function mapProductionMaterialListToOptions(list: Array<Record<string, any>>): ProductionMaterialOption[] {
|
||||
return (list || []).map((m) => ({
|
||||
id: String(m.id || ''),
|
||||
label: `${m.materialName || ''}(${m.materialCode || ''})`.trim(),
|
||||
materialCode: String(m.materialCode || ''),
|
||||
materialName: String(m.materialName || ''),
|
||||
materialType: String(m.materialType || ''),
|
||||
specModel: String(m.specModel || ''),
|
||||
unit: String(m.unit || ''),
|
||||
stockQty: Number(m.stockQty ?? 0)
|
||||
}))
|
||||
}
|
||||
|
||||
function ensureConfiguredInOptions(id: string, name?: string, code?: string) {
|
||||
if (!id) return
|
||||
if (configuredOptions.value.some((o) => o.id === id)) return
|
||||
configuredOptions.value.push({
|
||||
id,
|
||||
label: name && code ? `${name}(${code})` : name || code || id,
|
||||
materialCode: code || '',
|
||||
materialName: name || '',
|
||||
materialType: 'configured_reagent',
|
||||
specModel: '',
|
||||
unit: '',
|
||||
stockQty: 0
|
||||
})
|
||||
}
|
||||
|
||||
async function remoteSearchConfiguredMaterials(query: string) {
|
||||
configuredOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchProductionMaterialList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined,
|
||||
materialType: 'configured_reagent'
|
||||
})
|
||||
configuredOptions.value = mapProductionMaterialListToOptions(res.list || [])
|
||||
if (formData.configuredMaterialId) {
|
||||
const opt = configuredOptions.value.find((o) => o.id === formData.configuredMaterialId)
|
||||
if (!opt) {
|
||||
ensureConfiguredInOptions(formData.configuredMaterialId)
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
configuredOptions.value = []
|
||||
if (formData.configuredMaterialId) {
|
||||
ensureConfiguredInOptions(formData.configuredMaterialId)
|
||||
}
|
||||
} finally {
|
||||
configuredOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onConfiguredSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchConfiguredMaterials('')
|
||||
}
|
||||
|
||||
async function onConfiguredChange(id: string) {
|
||||
@@ -418,7 +478,7 @@
|
||||
dialogIsEdit.value = false
|
||||
editingId.value = ''
|
||||
resetForm()
|
||||
await loadConfiguredOptions()
|
||||
await remoteSearchConfiguredMaterials('')
|
||||
formData.prepTime = new Date().toISOString().slice(0, 19).replace('T', ' ')
|
||||
dialogVisible.value = true
|
||||
}
|
||||
@@ -435,6 +495,11 @@
|
||||
remark: detail.remark,
|
||||
lines: (detail.lines || []).map((ln) => ({ ...ln }))
|
||||
})
|
||||
ensureConfiguredInOptions(
|
||||
detail.configuredMaterialId,
|
||||
detail.configuredMaterialName,
|
||||
detail.configuredMaterialCode
|
||||
)
|
||||
await onConfiguredChange(detail.configuredMaterialId)
|
||||
}
|
||||
|
||||
@@ -443,7 +508,7 @@
|
||||
dialogIsEdit.value = true
|
||||
editingId.value = row.id
|
||||
resetForm()
|
||||
await loadConfiguredOptions()
|
||||
await remoteSearchConfiguredMaterials('')
|
||||
const detail = await fetchProductionMaterialPrepDetail(row.id)
|
||||
await fillFormFromDetail(detail)
|
||||
dialogVisible.value = true
|
||||
@@ -454,7 +519,7 @@
|
||||
dialogIsEdit.value = false
|
||||
editingId.value = row.id
|
||||
resetForm()
|
||||
await loadConfiguredOptions()
|
||||
await remoteSearchConfiguredMaterials('')
|
||||
const detail = await fetchProductionMaterialPrepDetail(row.id)
|
||||
await fillFormFromDetail(detail)
|
||||
dialogVisible.value = true
|
||||
|
||||
@@ -15,9 +15,14 @@
|
||||
<el-form-item label="物料筛选">
|
||||
<el-select
|
||||
v-model="searchForm.materialId"
|
||||
placeholder="全部物料"
|
||||
placeholder="输入物料名称检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
:loading="materialOptionsLoading"
|
||||
:remote-method="remoteSearchMaterials"
|
||||
@visible-change="onMaterialSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="m in materialOptions"
|
||||
@@ -364,7 +369,7 @@
|
||||
fetchMarkProductionMaterialUsageFullyUsed
|
||||
} from '@/api/production-material'
|
||||
import type { ProductionMaterialUsage } from '@/api/production-material'
|
||||
import { fetchProductionMaterialOptions } from '@/api/production-material'
|
||||
import { fetchProductionMaterialList } from '@/api/production-material'
|
||||
import type { ProductionMaterialOption } from '@/api/production-material'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import {
|
||||
@@ -405,6 +410,7 @@
|
||||
const loading = ref(false)
|
||||
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
|
||||
const materialOptions = ref<ProductionMaterialOption[]>([])
|
||||
const materialOptionsLoading = ref(false)
|
||||
|
||||
function isManualOutRow(row: ProductionMaterialUsage) {
|
||||
if (row.sourceType === 'manual_out') return true
|
||||
@@ -512,17 +518,40 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function loadMaterialOptions() {
|
||||
function mapProductionMaterialListToOptions(list: Array<Record<string, any>>): ProductionMaterialOption[] {
|
||||
return (list || []).map((m) => ({
|
||||
id: String(m.id || ''),
|
||||
label: `${m.materialName || ''}${m.materialCode ? ` (${m.materialCode})` : ''}`.trim(),
|
||||
materialCode: String(m.materialCode || ''),
|
||||
materialName: String(m.materialName || ''),
|
||||
materialType: String(m.materialType || ''),
|
||||
specModel: String(m.specModel || ''),
|
||||
unit: String(m.unit || ''),
|
||||
stockQty: Number(m.stockQty ?? 0)
|
||||
}))
|
||||
}
|
||||
|
||||
async function remoteSearchMaterials(query: string) {
|
||||
materialOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchProductionMaterialOptions({
|
||||
const res = await fetchProductionMaterialList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined,
|
||||
materialType: searchForm.materialType || undefined
|
||||
})
|
||||
materialOptions.value = res || []
|
||||
materialOptions.value = mapProductionMaterialListToOptions(res.list || [])
|
||||
} catch {
|
||||
materialOptions.value = []
|
||||
} finally {
|
||||
materialOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onMaterialSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchMaterials('')
|
||||
}
|
||||
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
@@ -679,7 +708,7 @@
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
await loadMaterialOptions()
|
||||
await remoteSearchMaterials('')
|
||||
if (route.query.materialId) {
|
||||
searchForm.materialId = route.query.materialId as string
|
||||
}
|
||||
|
||||
@@ -36,9 +36,14 @@
|
||||
<el-select
|
||||
v-model="form.assigneeUserId"
|
||||
filterable
|
||||
placeholder="请选择负责人"
|
||||
remote
|
||||
reserve-keyword
|
||||
clearable
|
||||
placeholder="输入姓名检索负责人"
|
||||
style="width: 100%"
|
||||
:loading="userLoading"
|
||||
:remote-method="remoteSearchUsers"
|
||||
@visible-change="onUserSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="u in userOptions"
|
||||
@@ -54,10 +59,15 @@
|
||||
>
|
||||
<el-select
|
||||
v-model="form.routeId"
|
||||
placeholder="请选择工艺路线(可选)"
|
||||
placeholder="输入路线名称检索(可选)"
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
clearable
|
||||
style="width: 100%"
|
||||
:loading="routeLoading"
|
||||
:remote-method="remoteSearchRoutes"
|
||||
@visible-change="onRouteSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="route in routeOptions"
|
||||
@@ -215,7 +225,7 @@
|
||||
import { Rank, Plus, CopyDocument, Delete } from '@element-plus/icons-vue'
|
||||
import { VueDraggable as draggable } from 'vue-draggable-plus'
|
||||
import { fetchCreateProductionTask } from '@/api/production-task'
|
||||
import { fetchUserOptions } from '@/api/admin'
|
||||
import { fetchUserList } from '@/api/admin'
|
||||
import { productionTaskTypeForWorkOrder } from '@/utils/production-labels'
|
||||
import { fetchProcessRouteList } from '@/api/production'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
@@ -247,8 +257,9 @@
|
||||
|
||||
const formRef = ref<FormInstance>()
|
||||
const routeOptions = ref<any[]>([])
|
||||
const userOptions = ref<Array<{ id: string; nickName: string; userNo: string }>>([])
|
||||
const userOptions = ref<Api.User.UserItem[]>([])
|
||||
const userLoading = ref(false)
|
||||
const routeLoading = ref(false)
|
||||
const form = reactive({
|
||||
taskName: '',
|
||||
assigneeUserId: '',
|
||||
@@ -263,24 +274,48 @@
|
||||
|
||||
const editor = useTaskStepEditor()
|
||||
|
||||
async function loadUserOptions() {
|
||||
async function remoteSearchUsers(query: string) {
|
||||
userLoading.value = true
|
||||
try {
|
||||
userOptions.value = (await fetchUserOptions().catch(() => [])) as any[]
|
||||
const res = await fetchUserList({
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
keyword: query?.trim() || undefined,
|
||||
status: '1'
|
||||
})
|
||||
userOptions.value = res.list || []
|
||||
} catch {
|
||||
userOptions.value = []
|
||||
} finally {
|
||||
userLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function loadRouteOptions() {
|
||||
function onUserSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchUsers('')
|
||||
}
|
||||
|
||||
async function remoteSearchRoutes(query: string) {
|
||||
routeLoading.value = true
|
||||
try {
|
||||
const res = await fetchProcessRouteList({ page: 1, pageSize: 100 })
|
||||
const kw = query?.trim()
|
||||
const res = await fetchProcessRouteList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
routeName: kw || undefined
|
||||
})
|
||||
routeOptions.value = res.list || []
|
||||
} catch {
|
||||
routeOptions.value = []
|
||||
} finally {
|
||||
routeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onRouteSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchRoutes('')
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
dialogVisible.value = false
|
||||
phase.value = 'form'
|
||||
@@ -343,8 +378,8 @@
|
||||
) {
|
||||
form.taskName = `${props.workOrderRow.workOrderNo}任务`
|
||||
}
|
||||
loadRouteOptions()
|
||||
loadUserOptions()
|
||||
void remoteSearchRoutes('')
|
||||
void remoteSearchUsers('')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,14 @@
|
||||
<el-select
|
||||
v-model="form.toUserId"
|
||||
filterable
|
||||
placeholder="请选择用户"
|
||||
remote
|
||||
reserve-keyword
|
||||
clearable
|
||||
placeholder="输入姓名检索用户"
|
||||
style="width: 100%"
|
||||
:loading="userLoading"
|
||||
:remote-method="remoteSearchUsers"
|
||||
@visible-change="onUserSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="u in userOptions"
|
||||
@@ -54,7 +59,7 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { Close, Check } from '@element-plus/icons-vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
import { fetchUserOptions } from '@/api/admin'
|
||||
import { fetchUserList } from '@/api/admin'
|
||||
import {
|
||||
fetchForwardProductionTask,
|
||||
fetchReassignProductionTask,
|
||||
@@ -81,22 +86,34 @@
|
||||
const formRef = ref<FormInstance>()
|
||||
const submitting = ref(false)
|
||||
const userLoading = ref(false)
|
||||
const userOptions = ref<Array<{ id: string; nickName: string; userNo: string }>>([])
|
||||
const userOptions = ref<Api.User.UserItem[]>([])
|
||||
|
||||
const form = reactive({ toUserId: '', remark: '' })
|
||||
const rules: FormRules = {
|
||||
toUserId: [{ required: true, message: '请选择负责人', trigger: 'change' }]
|
||||
}
|
||||
|
||||
async function loadUsers() {
|
||||
async function remoteSearchUsers(query: string) {
|
||||
userLoading.value = true
|
||||
try {
|
||||
userOptions.value = (await fetchUserOptions().catch(() => [])) as any[]
|
||||
const res = await fetchUserList({
|
||||
page: 1,
|
||||
pageSize: 50,
|
||||
keyword: query?.trim() || undefined,
|
||||
status: '1'
|
||||
})
|
||||
userOptions.value = res.list || []
|
||||
} catch {
|
||||
userOptions.value = []
|
||||
} finally {
|
||||
userLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onUserSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchUsers('')
|
||||
}
|
||||
|
||||
function handleClose() {
|
||||
dialogVisible.value = false
|
||||
form.toUserId = ''
|
||||
@@ -132,7 +149,7 @@
|
||||
watch(
|
||||
() => props.visible,
|
||||
(val) => {
|
||||
if (val) loadUsers()
|
||||
if (val) void remoteSearchUsers('')
|
||||
}
|
||||
)
|
||||
</script>
|
||||
+60
-20
@@ -7,6 +7,7 @@
|
||||
<div class="production-work-order-card__head-main">
|
||||
<div class="production-work-order-card__title-row">
|
||||
<el-checkbox
|
||||
v-if="!isMineMode"
|
||||
:model-value="isSelected(row.id)"
|
||||
class="production-work-order-card__checkbox"
|
||||
@change="(val) => handleCardSelect(row, Boolean(val))"
|
||||
@@ -151,20 +152,32 @@
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="production-work-order-card__ops">
|
||||
<div v-if="showCardOpsRow" class="production-work-order-card__ops">
|
||||
<el-button
|
||||
v-if="canDispatchTask(row)"
|
||||
v-if="isMineMode"
|
||||
class="btn-op-item primary"
|
||||
type="primary"
|
||||
@click="emit('view', row)"
|
||||
>
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else-if="showCardDispatchComplete && canDispatchTask(row)"
|
||||
class="btn-op-item primary"
|
||||
type="primary"
|
||||
@click="emit('dispatch', row)"
|
||||
>
|
||||
<el-icon><Position /></el-icon>派发任务
|
||||
</el-button>
|
||||
<el-button v-else class="btn-op-item primary" @click="emit('view', row)">
|
||||
<el-button
|
||||
v-else-if="!canDispatchTask(row)"
|
||||
class="btn-op-item primary"
|
||||
@click="emit('view', row)"
|
||||
>
|
||||
<el-icon><View /></el-icon>查看
|
||||
</el-button>
|
||||
<el-tooltip
|
||||
v-if="activeTypeTab === 'inbound'"
|
||||
v-if="!isMineMode && activeTypeTab === 'inbound'"
|
||||
:content="dispatchQcTooltip(row)"
|
||||
:disabled="canDispatchQc(row)"
|
||||
placement="top"
|
||||
@@ -179,11 +192,15 @@
|
||||
</el-button>
|
||||
</span>
|
||||
</el-tooltip>
|
||||
<el-button v-if="canComplete(row)" class="btn-op-item" @click="emit('complete', row)">
|
||||
<el-button
|
||||
v-if="!isMineMode && showCardDispatchComplete && canComplete(row)"
|
||||
class="btn-op-item"
|
||||
@click="emit('complete', row)"
|
||||
>
|
||||
<el-icon><Check /></el-icon>完成工单
|
||||
</el-button>
|
||||
<el-dropdown
|
||||
v-if="hasMoreActions(row)"
|
||||
v-if="!isMineMode && hasMoreActions(row)"
|
||||
trigger="hover"
|
||||
@command="(cmd) => emit('command', cmd, row)"
|
||||
>
|
||||
@@ -222,6 +239,8 @@
|
||||
<WorkOrderTaskSubList
|
||||
embedded
|
||||
:work-order="row"
|
||||
:list-mode="isMineMode ? 'mine' : 'workOrder'"
|
||||
:preset-tasks="isMineMode ? presetTasksByWorkOrderId?.[row.id] : undefined"
|
||||
:refresh-token="taskRefreshToken"
|
||||
@changed="emit('tasks-changed')"
|
||||
/>
|
||||
@@ -230,7 +249,7 @@
|
||||
<el-empty
|
||||
v-if="!loading && !rows.length"
|
||||
class="production-work-order-cards-empty"
|
||||
description="暂无生产工单"
|
||||
:description="isMineMode ? '暂无指派给您的生产任务' : '暂无生产工单'"
|
||||
:image-size="72"
|
||||
/>
|
||||
</div>
|
||||
@@ -248,6 +267,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { View, Position, Document, Check, More, EditPen, Delete } from '@element-plus/icons-vue'
|
||||
import type { ProductionWorkOrderItem } from '@/api/production-work-order'
|
||||
import { receptionSourceLabel } from '@/utils/qc-labels'
|
||||
@@ -266,16 +286,26 @@
|
||||
|
||||
type WorkOrderTypeTab = 'inbound' | 'temporary' | 'outbound'
|
||||
|
||||
const props = defineProps<{
|
||||
rows: ProductionWorkOrderItem[]
|
||||
loading: boolean
|
||||
activeTypeTab: WorkOrderTypeTab
|
||||
page: number
|
||||
pageSize: number
|
||||
total: number
|
||||
taskRefreshToken: number
|
||||
selectedIds: string[]
|
||||
}>()
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
rows: ProductionWorkOrderItem[]
|
||||
loading: boolean
|
||||
activeTypeTab: WorkOrderTypeTab
|
||||
page: number
|
||||
pageSize: number
|
||||
total: number
|
||||
taskRefreshToken: number
|
||||
selectedIds?: string[]
|
||||
pageMode?: 'manage' | 'mine'
|
||||
presetTasksByWorkOrderId?: Record<string, Record<string, any>[]>
|
||||
}>(),
|
||||
{
|
||||
selectedIds: () => [],
|
||||
pageMode: 'manage'
|
||||
}
|
||||
)
|
||||
|
||||
const isMineMode = computed(() => props.pageMode === 'mine')
|
||||
|
||||
const emit = defineEmits<{
|
||||
view: [row: ProductionWorkOrderItem]
|
||||
@@ -291,6 +321,16 @@
|
||||
|
||||
const RECEPTION_OVER_HOURS_MS = 24 * 60 * 60 * 1000
|
||||
|
||||
/** 我的任务:仅查看;管理端入库/出库隐藏操作行,临时保留 */
|
||||
const showCardOpsRow = computed(
|
||||
() => isMineMode.value || props.activeTypeTab === 'temporary'
|
||||
)
|
||||
|
||||
/** 入库/出库 Tab 展示派发/完成;临时 Tab 隐藏 */
|
||||
const showCardDispatchComplete = computed(
|
||||
() => !isMineMode.value && props.activeTypeTab !== 'temporary'
|
||||
)
|
||||
|
||||
function protocolStatusLabelBySource(status: string, source: string): string {
|
||||
return source === 'research_donation' ? donationStatusLabel(status) : protocolStatusLabel(status)
|
||||
}
|
||||
@@ -515,9 +555,9 @@
|
||||
|
||||
.production-work-order-card__fee-in-head {
|
||||
align-self: stretch;
|
||||
width: calc(100% + 32px);
|
||||
margin: 0 -16px;
|
||||
border-top: 1px solid #d1fae5;
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
<!-- 生产工单 · 查看详情弹窗宿主 -->
|
||||
<!-- eslint-disable vue/no-v-model-argument -->
|
||||
<template>
|
||||
<SystemViewDialog
|
||||
v-model:visible="viewVisible"
|
||||
title="工单详情"
|
||||
:width="viewDialogWidth"
|
||||
:grid-columns="viewDialogGridColumns"
|
||||
:compact="viewDialogCompact"
|
||||
:loading="viewLoading"
|
||||
:icon="Document"
|
||||
:meta="detail?.workOrderNo || ''"
|
||||
:sections="viewSections"
|
||||
modal-class="protocol-dialog-mask"
|
||||
>
|
||||
<template #protocol-payment-details>
|
||||
<QcWorkOrderProtocolPaymentPanel :summary="detail?.paymentSummary" embedded />
|
||||
</template>
|
||||
<template #diagnosis-attachments>
|
||||
<ProtocolAttachmentReadonly
|
||||
:files="viewDiagnosisAttachmentFiles"
|
||||
@preview="handleReceptionAttachmentPreview"
|
||||
@download="handleReceptionAttachmentDownload"
|
||||
/>
|
||||
</template>
|
||||
<template #product-table>
|
||||
<div v-if="detail?.products?.length" class="view-subtable-wrap">
|
||||
<el-table
|
||||
:data="detail?.products || []"
|
||||
stripe
|
||||
size="small"
|
||||
class="list-table view-subtable"
|
||||
>
|
||||
<el-table-column type="index" label="序号" min-width="60" align="center" />
|
||||
<el-table-column
|
||||
prop="projectCode"
|
||||
label="项目编码"
|
||||
min-width="120"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="projectName"
|
||||
label="项目名称"
|
||||
min-width="120"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="cellTypeName"
|
||||
label="细胞类型"
|
||||
min-width="100"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column
|
||||
prop="specText"
|
||||
label="规格"
|
||||
min-width="100"
|
||||
align="center"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column prop="quantity" label="数量" min-width="70" align="center" />
|
||||
<el-table-column label="产品状态" min-width="100" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="productStatusTag(row.productStatus || '')" size="small">
|
||||
{{ productStatusLabel(row.productStatus || '') }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<p v-else class="view-empty-hint">暂无产品明细</p>
|
||||
</template>
|
||||
<template #reception-extra>
|
||||
<div class="view-reception-attachments">
|
||||
<div class="view-kv view-kv-span-2">
|
||||
<dt>接收附件</dt>
|
||||
<dd>
|
||||
<ProtocolAttachmentReadonly
|
||||
:files="viewReceptionAttachmentFiles"
|
||||
@preview="handleReceptionAttachmentPreview"
|
||||
@download="handleReceptionAttachmentDownload"
|
||||
/>
|
||||
</dd>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</SystemViewDialog>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Document } from '@element-plus/icons-vue'
|
||||
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
|
||||
import ProtocolAttachmentReadonly from '@/views/cell-storage/protocol/ProtocolAttachmentReadonly.vue'
|
||||
import QcWorkOrderProtocolPaymentPanel from '@/views/quality-inspection/qc-work-order/QcWorkOrderProtocolPaymentPanel.vue'
|
||||
import { productStatusLabel, productStatusTagType } from '@/utils/status-tag-registry'
|
||||
import type { TagType } from '@/utils/status-tag-registry'
|
||||
import { useProductionWorkOrderViewDialog } from './useProductionWorkOrderViewDialog'
|
||||
|
||||
defineOptions({ name: 'ProductionWorkOrderViewDialogHost' })
|
||||
|
||||
function productStatusTag(status: string): TagType {
|
||||
return productStatusTagType(status) as TagType
|
||||
}
|
||||
|
||||
const {
|
||||
viewVisible,
|
||||
viewLoading,
|
||||
detail,
|
||||
viewDialogWidth,
|
||||
viewDialogGridColumns,
|
||||
viewDialogCompact,
|
||||
viewSections,
|
||||
viewReceptionAttachmentFiles,
|
||||
viewDiagnosisAttachmentFiles,
|
||||
handleReceptionAttachmentPreview,
|
||||
handleReceptionAttachmentDownload,
|
||||
openView
|
||||
} = useProductionWorkOrderViewDialog()
|
||||
|
||||
defineExpose({ openView })
|
||||
</script>
|
||||
@@ -314,9 +314,6 @@
|
||||
<TaskOutputList
|
||||
:items="editor.taskOutputs.value"
|
||||
:loading="false"
|
||||
:product-type-options="editor.productTypeOptions.value"
|
||||
:spec-options="editor.specOptions.value"
|
||||
:storage-slot-options="editor.storageSlotOptions.value"
|
||||
:unit-options="editor.itemUnitOptions.value"
|
||||
:unit-options-loading="editor.itemUnitOptionsLoading.value"
|
||||
:disabled="readonly"
|
||||
|
||||
@@ -93,9 +93,6 @@
|
||||
<TaskOutputProductDialog
|
||||
v-model="dialogVisible"
|
||||
:edit-item="editingItem"
|
||||
:product-type-options="productTypeOptions"
|
||||
:spec-options="specOptions"
|
||||
:storage-slot-options="storageSlotOptions"
|
||||
:unit-options="unitOptions"
|
||||
:unit-options-loading="unitOptionsLoading"
|
||||
@confirm="handleDialogConfirm"
|
||||
@@ -114,9 +111,6 @@
|
||||
defineProps<{
|
||||
items: Record<string, any>[]
|
||||
loading: boolean
|
||||
productTypeOptions: Array<{ id: string; productTypeName: string }>
|
||||
specOptions: Array<{ id: string; specName: string }>
|
||||
storageSlotOptions: Array<{ id: string; name: string }>
|
||||
unitOptions: { label: string; value: string }[]
|
||||
unitOptionsLoading: boolean
|
||||
disabled?: boolean
|
||||
@@ -182,9 +176,6 @@
|
||||
}
|
||||
|
||||
function enrichOutputRow(row: Record<string, any>) {
|
||||
const productType = props.productTypeOptions.find((o) => o.id === row.productTypeId)
|
||||
const spec = props.specOptions.find((o) => o.id === row.specId)
|
||||
const slot = props.storageSlotOptions.find((o) => o.id === row.storageSlotId)
|
||||
const productCode = row.productCode || row.outputBarcode || ''
|
||||
const productName = row.productName || row.outputName || ''
|
||||
return {
|
||||
@@ -193,9 +184,9 @@
|
||||
productName,
|
||||
outputBarcode: productCode,
|
||||
outputName: productName,
|
||||
productTypeName: row.productTypeName || productType?.productTypeName || '',
|
||||
specName: row.specName || spec?.specName || '',
|
||||
storageSlotName: row.storageSlotName || slot?.name || ''
|
||||
productTypeName: row.productTypeName || '',
|
||||
specName: row.specName || '',
|
||||
storageSlotName: row.storageSlotName || ''
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,9 +38,15 @@
|
||||
<el-form-item label="产品类型">
|
||||
<el-select
|
||||
v-model="formData.productTypeId"
|
||||
placeholder="请选择产品类型"
|
||||
placeholder="输入名称检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
style="width: 100%"
|
||||
:loading="productTypeOptionsLoading"
|
||||
:remote-method="remoteSearchProductTypes"
|
||||
@visible-change="onProductTypeSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in productTypeOptions"
|
||||
@@ -54,9 +60,15 @@
|
||||
<el-form-item label="规格">
|
||||
<el-select
|
||||
v-model="formData.specId"
|
||||
placeholder="请选择规格"
|
||||
placeholder="输入名称检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
style="width: 100%"
|
||||
:loading="specOptionsLoading"
|
||||
:remote-method="remoteSearchSpecs"
|
||||
@visible-change="onSpecSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in specOptions"
|
||||
@@ -85,10 +97,15 @@
|
||||
<el-form-item v-if="isEdit" label="储物格位置">
|
||||
<el-select
|
||||
v-model="formData.storageSlotId"
|
||||
placeholder="请选择储物格"
|
||||
placeholder="输入编号检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
style="width: 100%"
|
||||
:loading="storageSlotOptionsLoading"
|
||||
:remote-method="remoteSearchStorageSlots"
|
||||
@visible-change="onStorageSlotSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storageSlotSelectOptions"
|
||||
@@ -275,10 +292,15 @@
|
||||
<template #default="{ row }">
|
||||
<el-select
|
||||
v-model="row.storageSlotId"
|
||||
placeholder="请选择储物格"
|
||||
placeholder="输入编号检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
style="width: 100%"
|
||||
:loading="storageSlotOptionsLoading"
|
||||
:remote-method="remoteSearchStorageSlots"
|
||||
@visible-change="onStorageSlotSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storageSlotSelectOptions"
|
||||
@@ -329,8 +351,13 @@
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { fetchUploadAttachment } from '@/api/business'
|
||||
import { fetchNextCellProductCode } from '@/api/cell-product'
|
||||
import { fetchCellProductTypeList, fetchCellProductSpecList } from '@/api/admin'
|
||||
import {
|
||||
remoteSearchStorageSlotSelectOptions,
|
||||
ensureStorageSlotsInOptions,
|
||||
validateUniqueStorageSlotIds
|
||||
} from '@/utils/storage-slot-options'
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
import { validateUniqueStorageSlotIds } from '@/utils/storage-slot-options'
|
||||
|
||||
defineOptions({ name: 'TaskOutputProductDialog' })
|
||||
|
||||
@@ -347,9 +374,6 @@
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
editItem?: Record<string, any> | null
|
||||
productTypeOptions: Array<{ id: string; productTypeName: string }>
|
||||
specOptions: Array<{ id: string; specName: string }>
|
||||
storageSlotOptions: Array<{ id: string; name: string }>
|
||||
unitOptions: { label: string; value: string }[]
|
||||
unitOptionsLoading: boolean
|
||||
}>()
|
||||
@@ -381,8 +405,86 @@
|
||||
|
||||
const isEdit = computed(() => !!props.editItem)
|
||||
|
||||
const productTypeOptions = ref<Array<{ id: string; productTypeName: string }>>([])
|
||||
const specOptions = ref<Array<{ id: string; specName: string }>>([])
|
||||
const storageSlotOptions = ref<Array<{ id: string; name: string }>>([])
|
||||
const productTypeOptionsLoading = ref(false)
|
||||
const specOptionsLoading = ref(false)
|
||||
const storageSlotOptionsLoading = ref(false)
|
||||
const storageSlotSearchOpts = ref<{ includeSlotIds?: string[] }>({})
|
||||
|
||||
async function remoteSearchProductTypes(query: string) {
|
||||
productTypeOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchCellProductTypeList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
productTypeOptions.value = res?.list || res || []
|
||||
} catch {
|
||||
productTypeOptions.value = []
|
||||
} finally {
|
||||
productTypeOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function ensureProductTypeInOptions(id: string, name?: string) {
|
||||
if (!id) return
|
||||
if (productTypeOptions.value.some((o) => o.id === id)) return
|
||||
productTypeOptions.value = [{ id, productTypeName: name || id }, ...productTypeOptions.value]
|
||||
}
|
||||
|
||||
async function remoteSearchSpecs(query: string) {
|
||||
specOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchCellProductSpecList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
specOptions.value = res?.list || res || []
|
||||
} catch {
|
||||
specOptions.value = []
|
||||
} finally {
|
||||
specOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function ensureSpecInOptions(id: string, name?: string) {
|
||||
if (!id) return
|
||||
if (specOptions.value.some((o) => o.id === id)) return
|
||||
specOptions.value = [{ id, specName: name || id }, ...specOptions.value]
|
||||
}
|
||||
|
||||
async function remoteSearchStorageSlots(query: string) {
|
||||
storageSlotOptionsLoading.value = true
|
||||
try {
|
||||
storageSlotOptions.value = await remoteSearchStorageSlotSelectOptions(query, {
|
||||
availableOnly: true,
|
||||
includeSlotIds: storageSlotSearchOpts.value.includeSlotIds
|
||||
})
|
||||
} catch {
|
||||
storageSlotOptions.value = []
|
||||
} finally {
|
||||
storageSlotOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onStorageSlotSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchStorageSlots('')
|
||||
}
|
||||
|
||||
function onProductTypeSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchProductTypes('')
|
||||
}
|
||||
|
||||
function onSpecSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchSpecs('')
|
||||
}
|
||||
|
||||
const storageSlotSelectOptions = computed(() => {
|
||||
const base = props.storageSlotOptions || []
|
||||
const base = storageSlotOptions.value || []
|
||||
if (!isEdit.value || !formData.storageSlotId) return base
|
||||
if (base.some((o) => o.id === formData.storageSlotId)) return base
|
||||
const label =
|
||||
@@ -456,7 +558,13 @@
|
||||
async function initAddForm() {
|
||||
resetForm()
|
||||
formData.quantity = 1
|
||||
storageSlotSearchOpts.value = {}
|
||||
emit('searchUnit', '')
|
||||
await Promise.all([
|
||||
remoteSearchProductTypes(''),
|
||||
remoteSearchSpecs(''),
|
||||
remoteSearchStorageSlots('')
|
||||
])
|
||||
await nextTick()
|
||||
formRef.value?.clearValidate?.()
|
||||
try {
|
||||
@@ -479,6 +587,7 @@
|
||||
function onDialogOpened() {
|
||||
if (props.editItem) {
|
||||
populateFormFromEditItem(props.editItem)
|
||||
void hydrateLookupOptionsFromEdit(props.editItem)
|
||||
emit('searchUnit', props.editItem.unit || '')
|
||||
nextTick(() => formRef.value?.clearValidate?.())
|
||||
} else {
|
||||
@@ -579,10 +688,14 @@
|
||||
}
|
||||
|
||||
function buildSharedResult(): Record<string, any> {
|
||||
const productType = productTypeOptions.value.find((o) => o.id === formData.productTypeId)
|
||||
const spec = specOptions.value.find((o) => o.id === formData.specId)
|
||||
return {
|
||||
productName: formData.productName.trim(),
|
||||
productTypeId: formData.productTypeId || undefined,
|
||||
productTypeName: productType?.productTypeName || props.editItem?.productTypeName || '',
|
||||
specId: formData.specId || undefined,
|
||||
specName: spec?.specName || props.editItem?.specName || '',
|
||||
passage: formData.passage || undefined,
|
||||
batchNo: formData.batchNo.trim(),
|
||||
expectedCellCount: formData.expectedCellCount ?? undefined,
|
||||
@@ -596,6 +709,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
function resolveSlotName(slotId: string) {
|
||||
return storageSlotOptions.value.find((o) => o.id === slotId)?.name || ''
|
||||
}
|
||||
|
||||
async function hydrateLookupOptionsFromEdit(item: Record<string, any>) {
|
||||
ensureProductTypeInOptions(item.productTypeId, item.productTypeName)
|
||||
ensureSpecInOptions(item.specId, item.specName)
|
||||
storageSlotSearchOpts.value = {
|
||||
includeSlotIds: item.storageSlotId ? [item.storageSlotId] : undefined
|
||||
}
|
||||
storageSlotOptions.value = ensureStorageSlotsInOptions([], [
|
||||
{ id: item.storageSlotId, name: item.storageSlotName || item.storage_slot_name }
|
||||
])
|
||||
await Promise.all([
|
||||
remoteSearchProductTypes(''),
|
||||
remoteSearchSpecs(''),
|
||||
remoteSearchStorageSlots('')
|
||||
])
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
formData.cellProductId = ''
|
||||
formData.productCode = ''
|
||||
@@ -712,6 +845,10 @@
|
||||
cellProductId: formData.cellProductId || undefined,
|
||||
productCode: formData.productCode.trim(),
|
||||
storageSlotId: formData.storageSlotId || undefined,
|
||||
storageSlotName:
|
||||
resolveSlotName(formData.storageSlotId) ||
|
||||
props.editItem?.storageSlotName ||
|
||||
'',
|
||||
quantity: formData.quantity
|
||||
})
|
||||
} else {
|
||||
@@ -719,6 +856,7 @@
|
||||
...shared,
|
||||
productCode: line.productCode.trim(),
|
||||
storageSlotId: line.storageSlotId,
|
||||
storageSlotName: resolveSlotName(line.storageSlotId),
|
||||
quantity: 1
|
||||
}))
|
||||
emit('confirm', results)
|
||||
|
||||
@@ -60,8 +60,8 @@
|
||||
<el-tag :type="productionTaskTypeTag(row.taskType, row.orderSource).type" size="small">
|
||||
{{ productionTaskTypeTag(row.taskType, row.orderSource).label }}
|
||||
</el-tag>
|
||||
<span v-if="isMineHistory && row.handoverTime" class="work-order-task-card__sep">·</span>
|
||||
<span v-if="isMineHistory && row.handoverTime" class="work-order-task-card__handover"
|
||||
<span v-if="isMineHistoryRow(row) && row.handoverTime" class="work-order-task-card__sep">·</span>
|
||||
<span v-if="isMineHistoryRow(row) && row.handoverTime" class="work-order-task-card__handover"
|
||||
>转出 {{ row.handoverTime }}</span
|
||||
>
|
||||
<div class="work-order-task-sublist__ops">
|
||||
@@ -72,7 +72,7 @@
|
||||
size="small"
|
||||
@click.stop="handleEnterExecution(row)"
|
||||
>
|
||||
<el-icon><VideoPlay /></el-icon>{{ isMineHistory ? '查看' : '进入执行' }}
|
||||
<el-icon><VideoPlay /></el-icon>{{ isMineHistoryRow(row) ? '查看' : '进入执行' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else
|
||||
@@ -229,7 +229,7 @@
|
||||
|
||||
const props = defineProps<{
|
||||
workOrder?: Record<string, any>
|
||||
listMode?: 'workOrder' | 'mine-current' | 'mine-history'
|
||||
listMode?: 'workOrder' | 'mine' | 'mine-current' | 'mine-history'
|
||||
mineFilters?: {
|
||||
keyword?: string
|
||||
taskStatus?: string
|
||||
@@ -239,6 +239,7 @@
|
||||
pageSize?: number
|
||||
refreshToken?: number
|
||||
embedded?: boolean
|
||||
presetTasks?: Record<string, any>[]
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -248,7 +249,7 @@
|
||||
|
||||
const userStore = useUserStore()
|
||||
const isMineMode = computed(() => (props.listMode || 'workOrder').startsWith('mine'))
|
||||
const isMineHistory = computed(() => props.listMode === 'mine-history')
|
||||
const usesPresetTasks = computed(() => props.presetTasks !== undefined)
|
||||
const operateScope = computed<ProductionTaskOperateScope>(() =>
|
||||
isMineMode.value ? 'mine' : 'manage'
|
||||
)
|
||||
@@ -276,15 +277,21 @@
|
||||
return uid && String(row.currentAssigneeUserId || '') === uid
|
||||
}
|
||||
|
||||
function isMineHistoryRow(row: Record<string, any>) {
|
||||
if (!isMineMode.value) return false
|
||||
if (props.listMode === 'mine-history') return true
|
||||
return !isCurrentAssignee(row)
|
||||
}
|
||||
|
||||
function canEnterExecution(row: Record<string, any>) {
|
||||
if (isMineHistory.value) return false
|
||||
if (isMineHistoryRow(row)) return false
|
||||
if (row.taskStatus === 'ywc') return false
|
||||
if (isMineMode.value) return isCurrentAssignee(row)
|
||||
return row.taskStatus === 'dpz' || row.taskStatus === 'jxz'
|
||||
}
|
||||
|
||||
function canForwardTask(row: Record<string, any>) {
|
||||
if (isMineHistory.value) return false
|
||||
if (isMineHistoryRow(row)) return false
|
||||
if (isMineMode.value) return isCurrentAssignee(row)
|
||||
return operateScope.value === 'manage'
|
||||
}
|
||||
@@ -294,7 +301,7 @@
|
||||
}
|
||||
|
||||
function canEditTask(row: Record<string, any>) {
|
||||
if (isMineHistory.value) return false
|
||||
if (isMineHistoryRow(row)) return false
|
||||
if (isMineMode.value) return isCurrentAssignee(row)
|
||||
return row.taskStatus === 'dpz' || row.taskStatus === 'jxz'
|
||||
}
|
||||
@@ -312,6 +319,10 @@
|
||||
async function loadData() {
|
||||
loading.value = true
|
||||
try {
|
||||
if (usesPresetTasks.value) {
|
||||
tableData.value = props.presetTasks || []
|
||||
return
|
||||
}
|
||||
if (isMineMode.value) {
|
||||
const res = await fetchMyProductionTasks({
|
||||
scope: props.listMode === 'mine-history' ? 'history' : 'current',
|
||||
@@ -338,7 +349,9 @@
|
||||
}
|
||||
|
||||
function handleTaskMutationSuccess() {
|
||||
loadData()
|
||||
if (!usesPresetTasks.value) {
|
||||
loadData()
|
||||
}
|
||||
emit('changed')
|
||||
}
|
||||
|
||||
@@ -430,6 +443,7 @@
|
||||
props.listMode,
|
||||
props.page,
|
||||
props.pageSize,
|
||||
props.presetTasks,
|
||||
props.mineFilters?.keyword,
|
||||
props.mineFilters?.taskStatus,
|
||||
props.mineFilters?.workOrderType
|
||||
|
||||
@@ -69,33 +69,13 @@
|
||||
</el-form>
|
||||
</div>
|
||||
|
||||
<div class="list-toolbar">
|
||||
<div v-if="activeTypeTab === 'temporary'" class="list-toolbar">
|
||||
<div class="list-toolbar-row">
|
||||
<div class="list-toolbar-selected">
|
||||
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
|
||||
</div>
|
||||
<el-button
|
||||
v-if="activeTypeTab !== 'outbound'"
|
||||
class="btn-main"
|
||||
type="primary"
|
||||
@click="handleAdd"
|
||||
>
|
||||
<el-icon><Plus /></el-icon
|
||||
>{{ activeTypeTab === 'temporary' ? '新增临时工单' : '新增生产工单' }}
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="!canToolbarDispatch"
|
||||
@click="handleToolbarDispatch"
|
||||
>
|
||||
<el-icon><Position /></el-icon>派发任务
|
||||
</el-button>
|
||||
<el-button
|
||||
class="btn-ghost"
|
||||
:disabled="!canToolbarComplete"
|
||||
@click="handleToolbarComplete"
|
||||
>
|
||||
<el-icon><Check /></el-icon>完成工单
|
||||
<el-button class="btn-main" type="primary" @click="handleAdd">
|
||||
<el-icon><Plus /></el-icon>新增临时工单
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+343
@@ -0,0 +1,343 @@
|
||||
import { ref, computed } from 'vue'
|
||||
import {
|
||||
fetchProductionWorkOrderDetail,
|
||||
type ProductionWorkOrderDetail,
|
||||
type ProductionWorkOrderItem
|
||||
} from '@/api/production-work-order'
|
||||
import type { OutboundQcDetail } from '@/api/qc-work-order'
|
||||
import {
|
||||
receptionSourceLabel,
|
||||
acceptConclusionLabel,
|
||||
transportTypeLabel
|
||||
} from '@/utils/qc-labels'
|
||||
import {
|
||||
protocolStatusLabel,
|
||||
protocolStatusTagType,
|
||||
donationStatusLabel,
|
||||
donationStatusTagType,
|
||||
bizTypeLabel,
|
||||
bizTypeTagType,
|
||||
payStatusTagType
|
||||
} from '@/utils/status-tag-registry'
|
||||
import type { TagType } from '@/utils/status-tag-registry'
|
||||
import {
|
||||
buildOutboundPilotContextSections,
|
||||
resolveOutboundViewVariant
|
||||
} from '@/utils/outbound-qc-pilot-view-sections'
|
||||
import type { ViewSection } from '@/components/business/system-view-dialog/index.vue'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
|
||||
function protocolStatusLabelBySource(status: string, source: string): string {
|
||||
return source === 'research_donation' ? donationStatusLabel(status) : protocolStatusLabel(status)
|
||||
}
|
||||
|
||||
function protocolStatusTagTypeBySource(status: string, source: string): TagType {
|
||||
return source === 'research_donation' ? donationStatusTagType(status) : protocolStatusTagType(status)
|
||||
}
|
||||
|
||||
function woStatusTag(status: string) {
|
||||
const map: Record<string, { label: string; type: string }> = {
|
||||
dpz: { label: '待配置', type: 'info' },
|
||||
jxz: { label: '进行中', type: 'warning' },
|
||||
ywc: { label: '已完成', type: 'success' },
|
||||
yzf: { label: '已作废', type: 'danger' }
|
||||
}
|
||||
return map[status] || { label: status, type: 'info' }
|
||||
}
|
||||
|
||||
function sourceTag(source: string) {
|
||||
const map: Record<string, { label: string; type: string }> = {
|
||||
cell_storage: { label: '细胞存储', type: 'success' },
|
||||
research_donation: { label: '科研捐赠', type: 'warning' }
|
||||
}
|
||||
return map[source] || { label: source, type: 'info' }
|
||||
}
|
||||
|
||||
export function useProductionWorkOrderViewDialog() {
|
||||
const viewVisible = ref(false)
|
||||
const viewLoading = ref(false)
|
||||
const detail = ref<ProductionWorkOrderDetail | null>(null)
|
||||
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
|
||||
|
||||
const isOutboundContextView = computed(
|
||||
() =>
|
||||
detail.value?.workOrderType === 'outbound' &&
|
||||
(detail.value?.bizType === 'pilot_service' ||
|
||||
detail.value?.bizType === 'clinical_application' ||
|
||||
detail.value?.bizType === 'basic_experiment')
|
||||
)
|
||||
const viewDialogWidth = computed(() => (isOutboundContextView.value ? '1200px' : '720px'))
|
||||
const viewDialogGridColumns = computed<2 | 3 | 4>(() => (isOutboundContextView.value ? 4 : 2))
|
||||
const viewDialogCompact = computed(() => isOutboundContextView.value)
|
||||
|
||||
const viewReceptionAttachmentFiles = computed(() => {
|
||||
const r = detail.value?.reception
|
||||
if (!r) return []
|
||||
if (Array.isArray(r.receiveAttachmentFiles) && r.receiveAttachmentFiles.length) {
|
||||
return r.receiveAttachmentFiles as Array<Record<string, unknown>>
|
||||
}
|
||||
const urls = String(r.receiveAttachments || '')
|
||||
if (!urls.trim()) return []
|
||||
return urls
|
||||
.split(',')
|
||||
.map((u, i) => {
|
||||
const url = u.trim()
|
||||
if (!url) return null
|
||||
const name = url.includes('/') ? url.split('/').pop() || `附件${i + 1}` : url
|
||||
return { id: `url_${i}`, fileUrl: url, fileName: name }
|
||||
})
|
||||
.filter(Boolean) as Array<Record<string, unknown>>
|
||||
})
|
||||
|
||||
const viewDiagnosisAttachmentFiles = computed(() => {
|
||||
const urls = detail.value?.patient?.diagnosisAttachments || ''
|
||||
if (!urls.trim()) return []
|
||||
return urls
|
||||
.split(',')
|
||||
.map((u, i) => {
|
||||
const url = u.trim()
|
||||
if (!url) return null
|
||||
const name = url.includes('/') ? url.split('/').pop() || `附件${i + 1}` : url
|
||||
return { id: `url_${i}`, fileUrl: receptionAttachmentFullUrl(url), fileName: name }
|
||||
})
|
||||
.filter(Boolean) as Array<Record<string, unknown>>
|
||||
})
|
||||
|
||||
function receptionAttachmentFullUrl(url: string) {
|
||||
const u = String(url || '').trim()
|
||||
if (!u) return ''
|
||||
if (/^https?:\/\//i.test(u)) return u
|
||||
return minioBaseUrl ? `${minioBaseUrl}/${u.replace(/^\//, '')}` : u
|
||||
}
|
||||
|
||||
function handleReceptionAttachmentPreview(file: Record<string, unknown>) {
|
||||
const url = receptionAttachmentFullUrl(String(file.fileUrl || ''))
|
||||
if (url) window.open(url, '_blank')
|
||||
}
|
||||
|
||||
function handleReceptionAttachmentDownload(file: Record<string, unknown>) {
|
||||
downloadAttachmentFile(file, { fullFileUrl: receptionAttachmentFullUrl })
|
||||
}
|
||||
|
||||
function formatMetric(v: unknown) {
|
||||
if (v === null || v === undefined || v === '') return '—'
|
||||
return String(v)
|
||||
}
|
||||
|
||||
function formatCheckResults(items?: Array<{ itemName?: string; checked?: boolean }>) {
|
||||
if (!items?.length) return '—'
|
||||
return items.map((x) => `${x.itemName || ''}${x.checked ? '(✓)' : '(×)'}`).join('、')
|
||||
}
|
||||
|
||||
const viewSections = computed<ViewSection[]>(() => {
|
||||
if (!detail.value) return []
|
||||
const d = detail.value
|
||||
const isTemp = d.workOrderType === 'temporary'
|
||||
const isOutbound = d.workOrderType === 'outbound'
|
||||
const r = d.reception || {}
|
||||
|
||||
const baseFields: ViewSection['fields'] = [
|
||||
{ label: '工单号', value: d.workOrderNo },
|
||||
{
|
||||
label: '工单类型',
|
||||
value: isTemp ? '临时' : isOutbound ? '出库' : '入库',
|
||||
tagType: isTemp ? 'warning' : isOutbound ? 'primary' : 'success'
|
||||
}
|
||||
]
|
||||
|
||||
if (isOutbound) {
|
||||
baseFields.push({
|
||||
label: '业务类型',
|
||||
value: d.bizTypeLabel || bizTypeLabel(d.bizType || '') || '—',
|
||||
tagType: bizTypeTagType(d.bizType || '') as TagType
|
||||
})
|
||||
}
|
||||
|
||||
if (!isTemp && !isOutbound) {
|
||||
baseFields.push(
|
||||
{
|
||||
label: '协议状态',
|
||||
value: protocolStatusLabelBySource(
|
||||
String(d.protocolStatus || ''),
|
||||
d.receptionSource || 'cell_storage'
|
||||
),
|
||||
tagType: protocolStatusTagTypeBySource(
|
||||
String(d.protocolStatus || ''),
|
||||
d.receptionSource || 'cell_storage'
|
||||
)
|
||||
},
|
||||
{ label: '样本编码', value: d.sampleCode },
|
||||
{
|
||||
label: '来源类型',
|
||||
value:
|
||||
r.sourceTypeLabel ||
|
||||
d.receptionSourceLabel ||
|
||||
receptionSourceLabel(d.receptionSource || ''),
|
||||
tagType: sourceTag(d.receptionSource || '').type as TagType
|
||||
},
|
||||
{ label: '样本类型', value: r.sampleTypeName || d.sampleTypeName || '—' }
|
||||
)
|
||||
}
|
||||
|
||||
baseFields.push(
|
||||
{
|
||||
label: '工单状态',
|
||||
value: woStatusTag(d.workOrderStatus).label,
|
||||
tagType: woStatusTag(d.workOrderStatus).type as TagType
|
||||
},
|
||||
{ label: '备注', value: d.remark || '—', span: true },
|
||||
{ label: '创建时间', value: d.createTime || '—' }
|
||||
)
|
||||
|
||||
const sections: ViewSection[] = [{ title: '基本信息', fields: baseFields }]
|
||||
|
||||
if (
|
||||
isOutbound &&
|
||||
(d.bizType === 'pilot_service' ||
|
||||
d.bizType === 'clinical_application' ||
|
||||
d.bizType === 'basic_experiment')
|
||||
) {
|
||||
const outboundDetail: OutboundQcDetail = {
|
||||
workOrder: {} as OutboundQcDetail['workOrder'],
|
||||
application: d.application,
|
||||
patient: d.patient,
|
||||
infusionPlan: d.infusionPlan,
|
||||
infusionSchedule: d.infusionSchedule,
|
||||
products: d.products
|
||||
}
|
||||
const variant = resolveOutboundViewVariant(d.bizType)
|
||||
sections.push(...buildOutboundPilotContextSections(outboundDetail, variant))
|
||||
const feeSummary = d.feeSummary
|
||||
if (variant === 'basic_experiment' || variant === 'clinical_application') {
|
||||
sections.push({
|
||||
title: '缴费信息',
|
||||
fields: feeSummary
|
||||
? [
|
||||
{
|
||||
label: '售卖金额(元)',
|
||||
value:
|
||||
feeSummary.saleAmount != null ? formatMoneyDisplay(feeSummary.saleAmount) : '—'
|
||||
},
|
||||
{
|
||||
label: '应缴金额(元)',
|
||||
value:
|
||||
feeSummary.paymentAmount != null
|
||||
? formatMoneyDisplay(feeSummary.paymentAmount)
|
||||
: '—'
|
||||
},
|
||||
{
|
||||
label: '实收金额(元)',
|
||||
value:
|
||||
feeSummary.transferAmount != null
|
||||
? formatMoneyDisplay(feeSummary.transferAmount)
|
||||
: '—'
|
||||
},
|
||||
{
|
||||
label: '缴费状态',
|
||||
value: feeSummary.payStatusLabel || '—',
|
||||
tagType: payStatusTagType(feeSummary.payStatus || '') as TagType
|
||||
}
|
||||
]
|
||||
: [{ label: '缴费信息', value: '暂无缴费记录', span: true }]
|
||||
})
|
||||
}
|
||||
return sections
|
||||
}
|
||||
|
||||
const transportFields: ViewSection['fields'] = [
|
||||
{ label: '运输方式', value: transportTypeLabel(String(r.transportType || '')) }
|
||||
]
|
||||
if (r.transportType === 'kdys') {
|
||||
transportFields.push(
|
||||
{ label: '快递公司', value: r.expressCompanyName || '—' },
|
||||
{ label: '快递单号', value: r.waybillNo || '—' }
|
||||
)
|
||||
} else if (r.transportType === 'ryxd') {
|
||||
transportFields.push(
|
||||
{ label: '携带人', value: r.carrierName || '—' },
|
||||
{ label: '携带人电话', value: r.carrierPhone || '—' }
|
||||
)
|
||||
}
|
||||
if (r.etaTime) transportFields.push({ label: '预计到达', value: r.etaTime })
|
||||
const transportSection =
|
||||
transportFields.length > 1 || r.transportType
|
||||
? [{ title: '运输信息', fields: transportFields }]
|
||||
: []
|
||||
const paymentSection =
|
||||
!isTemp && (d.receptionSource || 'cell_storage') === 'cell_storage'
|
||||
? [{ title: '协议缴费信息', fields: [], slot: 'protocol-payment-details' }]
|
||||
: []
|
||||
|
||||
return [
|
||||
{ title: '基本信息', fields: baseFields },
|
||||
...transportSection,
|
||||
...paymentSection,
|
||||
...(!isTemp
|
||||
? [
|
||||
{
|
||||
title: '样本接收',
|
||||
slot: 'reception-extra',
|
||||
fields: [
|
||||
{ label: '接收时间', value: r.receptionTime || d.receptionTime || '—' },
|
||||
{ label: '接收经手人', value: r.handlerName || d.handlerName || '—' },
|
||||
...(String(r.acceptConclusion || '') === 'js'
|
||||
? [
|
||||
{
|
||||
label: '实验室入库编码',
|
||||
value: r.labStorageCode || d.labStorageCode || '—'
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: '接收温度(℃)',
|
||||
value: r.receiveTemperature ? `${r.receiveTemperature}℃` : '—'
|
||||
},
|
||||
{ label: '体积(ml)', value: formatMetric(r.volumeMl) },
|
||||
{ label: '净重(g)', value: formatMetric(r.netWeightG) },
|
||||
{
|
||||
label: '结论',
|
||||
value:
|
||||
r.acceptConclusionLabel ||
|
||||
acceptConclusionLabel(String(r.acceptConclusion || '')),
|
||||
tagType:
|
||||
r.acceptConclusion === 'js'
|
||||
? 'success'
|
||||
: r.acceptConclusion === 'jj'
|
||||
? 'danger'
|
||||
: 'info'
|
||||
},
|
||||
{ label: '检查项', value: formatCheckResults(r.checkResults), span: true },
|
||||
{ label: '备注', value: r.remark || '—', span: true }
|
||||
]
|
||||
}
|
||||
]
|
||||
: [])
|
||||
]
|
||||
})
|
||||
|
||||
async function openView(row: ProductionWorkOrderItem) {
|
||||
viewLoading.value = true
|
||||
viewVisible.value = true
|
||||
try {
|
||||
detail.value = await fetchProductionWorkOrderDetail(row.id)
|
||||
} finally {
|
||||
viewLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
viewVisible,
|
||||
viewLoading,
|
||||
detail,
|
||||
viewDialogWidth,
|
||||
viewDialogGridColumns,
|
||||
viewDialogCompact,
|
||||
viewSections,
|
||||
viewReceptionAttachmentFiles,
|
||||
viewDiagnosisAttachmentFiles,
|
||||
handleReceptionAttachmentPreview,
|
||||
handleReceptionAttachmentDownload,
|
||||
openView
|
||||
}
|
||||
}
|
||||
@@ -24,13 +24,6 @@ import {
|
||||
} from '@/api/production'
|
||||
import { fetchItemUnitList, fetchSampleCodeList } from '@/api/admin'
|
||||
import { fetchCellProductList } from '@/api/cell-product'
|
||||
import {
|
||||
fetchCellProductTypeList,
|
||||
fetchCellProductSpecList,
|
||||
fetchStorageFacilityList,
|
||||
fetchStorageSlotList
|
||||
} from '@/api/admin'
|
||||
import { loadStorageSlotSelectOptions } from '@/utils/storage-slot-options'
|
||||
import {
|
||||
fetchProductionMaterialRequisitionOptions,
|
||||
fetchProductionMaterialOptions,
|
||||
@@ -138,9 +131,6 @@ export function useTaskStepEditor() {
|
||||
const cellProductMasterById = ref<Record<string, Record<string, any>>>({})
|
||||
const sampleCodeOptions = ref<Api.BizSampleCode.SampleCodeItem[]>([])
|
||||
const sampleCodeOptionsLoading = ref(false)
|
||||
const productTypeOptions = ref<Array<{ id: string; productTypeName: string }>>([])
|
||||
const specOptions = ref<Array<{ id: string; specName: string }>>([])
|
||||
const storageSlotOptions = ref<Array<{ id: string; name: string }>>([])
|
||||
|
||||
function mapItemUnitOption(u: { unitName?: string; unitCode?: string }) {
|
||||
const name = (u.unitName || '').trim()
|
||||
@@ -563,31 +553,6 @@ export function useTaskStepEditor() {
|
||||
.filter((group) => group.processes.length > 0)
|
||||
})
|
||||
|
||||
async function loadProductTypeAndSpecOptions() {
|
||||
try {
|
||||
const [typeRes, specRes] = await Promise.all([
|
||||
fetchCellProductTypeList({ page: 1, pageSize: 100 }),
|
||||
fetchCellProductSpecList({ page: 1, pageSize: 100 })
|
||||
])
|
||||
productTypeOptions.value = typeRes?.list || typeRes || []
|
||||
specOptions.value = specRes?.list || specRes || []
|
||||
} catch {
|
||||
/* dropdown data failure is non-blocking */
|
||||
}
|
||||
}
|
||||
async function loadStorageSlotOptions() {
|
||||
try {
|
||||
const facilityRes = await fetchStorageFacilityList()
|
||||
const facilities = facilityRes?.list || facilityRes || []
|
||||
storageSlotOptions.value = await loadStorageSlotSelectOptions(
|
||||
facilities,
|
||||
fetchStorageSlotList,
|
||||
{ availableOnly: true }
|
||||
)
|
||||
} catch {
|
||||
storageSlotOptions.value = []
|
||||
}
|
||||
}
|
||||
async function loadConfigReferenceData() {
|
||||
const [processes, categories, sops, outputTypes] = await Promise.all([
|
||||
fetchAllProcesses(),
|
||||
@@ -625,16 +590,11 @@ export function useTaskStepEditor() {
|
||||
searchReagentOptions(''),
|
||||
searchConsumableOptions(''),
|
||||
searchCellProductOptions(''),
|
||||
searchSampleCodeOptions(''),
|
||||
loadProductTypeAndSpecOptions(),
|
||||
loadStorageSlotOptions()
|
||||
searchSampleCodeOptions('')
|
||||
])
|
||||
}
|
||||
|
||||
function enrichTaskOutputRow(row: Record<string, any>) {
|
||||
const productType = productTypeOptions.value.find((o) => o.id === row.productTypeId)
|
||||
const spec = specOptions.value.find((o) => o.id === row.specId)
|
||||
const slot = storageSlotOptions.value.find((o) => o.id === row.storageSlotId)
|
||||
const productCode = row.productCode || row.outputBarcode || ''
|
||||
const productName = row.productName || row.outputName || ''
|
||||
return {
|
||||
@@ -643,9 +603,9 @@ export function useTaskStepEditor() {
|
||||
productName,
|
||||
outputBarcode: productCode,
|
||||
outputName: productName,
|
||||
productTypeName: row.productTypeName || productType?.productTypeName || '',
|
||||
specName: row.specName || spec?.specName || '',
|
||||
storageSlotName: row.storageSlotName || slot?.name || ''
|
||||
productTypeName: row.productTypeName || '',
|
||||
specName: row.specName || '',
|
||||
storageSlotName: row.storageSlotName || ''
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1530,9 +1490,6 @@ export function useTaskStepEditor() {
|
||||
cellProductOptionsLoading,
|
||||
sampleCodeOptions,
|
||||
sampleCodeOptionsLoading,
|
||||
productTypeOptions,
|
||||
specOptions,
|
||||
storageSlotOptions,
|
||||
sopIdsArr,
|
||||
onDragStart,
|
||||
onDropToCenter,
|
||||
|
||||
@@ -470,7 +470,17 @@
|
||||
<el-input v-model="formData.standardUsage" placeholder="请输入标准用量" />
|
||||
</el-form-item>
|
||||
<el-form-item label="单位">
|
||||
<el-select v-model="formData.unit" placeholder="请选择单位" clearable filterable>
|
||||
<el-select
|
||||
v-model="formData.unit"
|
||||
placeholder="输入单位检索"
|
||||
clearable
|
||||
filterable
|
||||
remote
|
||||
reserve-keyword
|
||||
:loading="unitOptionsLoading"
|
||||
:remote-method="remoteSearchUnits"
|
||||
@visible-change="onUnitSelectVisible"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in unitOptions"
|
||||
:key="item.value"
|
||||
@@ -1263,6 +1273,7 @@
|
||||
|
||||
const activeTab = ref('list')
|
||||
const unitOptions = ref<{ label: string; value: string }[]>([])
|
||||
const unitOptionsLoading = ref(false)
|
||||
|
||||
const searchForm = reactive<{ keyword: string; status: string }>({ keyword: '', status: '' })
|
||||
const tableRef = ref()
|
||||
@@ -1532,6 +1543,37 @@
|
||||
loadData()
|
||||
}
|
||||
|
||||
function ensureUnitInOptions(unitName: string) {
|
||||
const n = (unitName || '').trim()
|
||||
if (!n || unitOptions.value.some((o) => o.value === n)) return
|
||||
unitOptions.value = [{ label: n, value: n }, ...unitOptions.value]
|
||||
}
|
||||
|
||||
async function remoteSearchUnits(query: string) {
|
||||
unitOptionsLoading.value = true
|
||||
try {
|
||||
const res = await fetchItemUnitList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
unitOptions.value = (res.list || []).map((u: any) => ({
|
||||
label: u.unitName,
|
||||
value: u.unitName
|
||||
}))
|
||||
ensureUnitInOptions(formData.unit)
|
||||
} catch {
|
||||
unitOptions.value = []
|
||||
ensureUnitInOptions(formData.unit)
|
||||
} finally {
|
||||
unitOptionsLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function onUnitSelectVisible(visible: boolean) {
|
||||
if (visible) void remoteSearchUnits('')
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
formData.reagentCode = ''
|
||||
formData.reagentName = ''
|
||||
@@ -1551,6 +1593,7 @@
|
||||
resetForm()
|
||||
dialogVisible.value = true
|
||||
formRef.value?.clearValidate?.()
|
||||
void remoteSearchUnits('')
|
||||
}
|
||||
|
||||
function handleEdit(row: any) {
|
||||
@@ -1568,6 +1611,7 @@
|
||||
formData.remark = row.remark || ''
|
||||
dialogVisible.value = true
|
||||
formRef.value?.clearValidate?.()
|
||||
void remoteSearchUnits('')
|
||||
}
|
||||
|
||||
async function handleSubmit() {
|
||||
@@ -2041,10 +2085,8 @@
|
||||
{ debounce: 300, deep: true }
|
||||
)
|
||||
|
||||
onMounted(async () => {
|
||||
onMounted(() => {
|
||||
loadData()
|
||||
const res = await fetchItemUnitList({ page: 1, pageSize: 100 })
|
||||
unitOptions.value = (res.list || []).map((u: any) => ({ label: u.unitName, value: u.unitName }))
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in new issue
Block a user