feat(market): 完善临床科研与委托加工上线能力

补齐项目组负责人审批、费用信息、合作客户、生产出库菜单、申请单号 LCKY 前缀及配套 SQL 迁移,并同步相关前后端与单测。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cykjandCursor committed 2026-11-30 18:51:37 +08:00
1 parent 7a3c58ed99
commit c22a0d1eb0
77 files changed
+8375 -1869

No files matched your search

+74
View File
@@ -940,6 +940,73 @@ export function fetchCustomerRelations(id: string) {
})
}
export function fetchPartnerCustomerList(params?: {
page?: number
pageSize?: number
keyword?: string
}) {
return request.get<PageResult<Api.PartnerCustomer.Item>>({
url: '/web/admin/partner-customers',
params
})
}
export function fetchCreatePartnerCustomer(data: {
customerName: string
customerContact: string
customerPhone: string
remark?: string
}) {
return request.post({ url: '/web/admin/partner-customers', params: data })
}
export function fetchUpdatePartnerCustomer(
id: string,
data: Partial<{
customerName: string
customerContact: string
customerPhone: string
remark: string
}>
) {
return request.put({ url: `/web/admin/partner-customers/${id}`, params: data })
}
export function fetchDeletePartnerCustomer(id: string) {
return request.del({ url: `/web/admin/partner-customers/${id}` })
}
export function fetchContractProcessingCategoryList(params: {
page?: number
pageSize?: number
keyword?: string
bizType: 'basic_experiment' | 'contract_processing'
}) {
return request.get<PageResult<Api.ContractProcessingCategory.Item>>({
url: '/web/admin/contract-processing-categories',
params
})
}
export function fetchCreateContractProcessingCategory(data: {
categoryName: string
remark?: string
bizType: 'basic_experiment' | 'contract_processing'
}) {
return request.post({ url: '/web/admin/contract-processing-categories', params: data })
}
export function fetchUpdateContractProcessingCategory(
id: string,
data: Partial<{ categoryName: string; remark: string }>
) {
return request.put({ url: `/web/admin/contract-processing-categories/${id}`, params: data })
}
export function fetchDeleteContractProcessingCategory(id: string) {
return request.del({ url: `/web/admin/contract-processing-categories/${id}` })
}
export function fetchCellSampleTypeList(params?: {
page?: number
pageSize?: number
@@ -2269,6 +2336,13 @@ export function voidPilotApplication(data: any) {
export function savePilotApplication(data: any) {
return request.post({ url: '/web/admin/pilot-application/save', params: data })
}
export function approvePilotApplication(data: {
id: string
approvalStatus: 'ytg' | 'yth'
approvalRemark?: string
}) {
return request.post({ url: '/web/admin/pilot-application/approve', params: data })
}
export function createBasicExperimentSaleSchedules(
applicationId: string,
data: { productLines: any[] }
@@ -316,45 +316,3 @@ export function fetchMineProductionWorkOrderTabStepCountsDeduped() {
}
return mineTabStepCountsInflight
}
/** 临床科研出库工单 — 交付出库细胞 */
export type ProductionDeliveryCellOutbound = {
workOrderId?: string
workOrderNo?: string
infusionScheduleId?: string
scheduleSummary?: {
applicationNo?: string
patientName?: string
infusionTime?: string
projectTitle?: string
customerName?: string
}
cells?: Array<{
cellProductId?: string
productCode?: string
productName?: string
productTypeName?: string
specName?: string
passage?: string
batchNo?: string
storageSlotName?: string
productStatus?: string
remark?: string
}>
}
export function fetchProductionDeliveryCellOutbound(workOrderId: string) {
return request.get<ProductionDeliveryCellOutbound>({
url: `/web/admin/production-work-orders/${workOrderId}/delivery-cell-outbound`
})
}
export function saveProductionDeliveryCellOutbound(
workOrderId: string,
data: { cells: Array<{ cellProductId: string; remark?: string }> }
) {
return request.put<ProductionDeliveryCellOutbound>({
url: `/web/admin/production-work-orders/${workOrderId}/delivery-cell-outbound`,
data
})
}
+8
View File
@@ -14,6 +14,14 @@ export const bizLabels: Record<BizType, string> = {
basic_experiment: '临床科研',
contract_processing: '委托加工'
}
/** 项目管理界面暂不展示;保留枚举与历史数据兼容 */
export const hiddenProjectBizTypes: readonly BizType[] = ['pilot_service']
export function isProjectBizTypeVisible(bizType: BizType): boolean {
return !hiddenProjectBizTypes.includes(bizType)
}
export const visibleBizLabels = Object.fromEntries(
Object.entries(bizLabels).filter(([key]) => isProjectBizTypeVisible(key as BizType))
) as Partial<Record<BizType, string>>
export type ProjectOption = {
id: string
projectName: string
@@ -24,7 +24,7 @@
class="list-table inner-table"
stripe
max-height="280"
:empty-text="cellsReadonly ? '暂无生产确认的出库细胞' : '请从细胞产品库勾选'"
:empty-text="cellsReadonly ? '暂无出库细胞' : '请从细胞产品库勾选'"
>
<el-table-column type="index" label="序号" min-width="56" align="center" />
<el-table-column
@@ -63,7 +63,7 @@
</template>
</el-table-column>
<el-table-column
v-if="!cellsReadonly"
v-if="!cellsReadonly && !hideCellOps"
label="操作"
min-width="80"
align="center"
@@ -436,8 +436,10 @@
defineProps<{
/** 出库交接等需扣库存场景:仅允许选择已冻存细胞,且已选行保留可选 */
requireFrozenCellProduct?: boolean
/** 临床科研市场交接:细胞由生产确认,仅只读展示 */
/** 出库细胞只读展示(隐藏添加/删除) */
cellsReadonly?: boolean
/** 隐藏细胞行操作列(仍可显示添加) */
hideCellOps?: boolean
showCells?: boolean
showMaterials?: boolean
showPapers?: boolean
@@ -446,6 +448,7 @@
{
requireFrozenCellProduct: false,
cellsReadonly: false,
hideCellOps: false,
showCells: true,
showMaterials: true,
showPapers: true,
@@ -56,6 +56,20 @@
</el-tag>
</template>
</el-table-column>
<el-table-column
label="操作"
min-width="110"
align="center"
header-align="center"
fixed="right"
>
<template #default="{ row }">
<el-button type="primary" link @click="openLineageQc(row)">
<el-icon><View /></el-icon>
查看质检
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
@@ -210,11 +224,14 @@
/>
</div>
</el-dialog>
<CellProductLineageQcDialog v-model="lineageQcVisible" :product-id="lineageQcProductId" />
</div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { ElMessage } from 'element-plus'
import { Document, Download, View, VideoPlay } from '@element-plus/icons-vue'
import type {
OutboundReleaseCellRow,
@@ -227,6 +244,7 @@
} from '@/utils/status-tag-registry'
import { downloadAttachmentFile } from '@/utils/download-attachment'
import { resolveCellProductSpecDisplay } from '@/utils/cell-product-spec'
import CellProductLineageQcDialog from '@/components/business/cell-product-lineage-qc-dialog/index.vue'
defineOptions({ name: 'OutboundMaterialReadonlyPanel' })
@@ -253,6 +271,8 @@
const previewVisible = ref(false)
const previewUrl = ref('')
const previewType = ref<'image' | 'video'>('image')
const lineageQcVisible = ref(false)
const lineageQcProductId = ref('')
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
const cells = computed<OutboundReleaseCellRow[]>(() => props.material?.cells || [])
@@ -356,6 +376,16 @@
{ fullFileUrl: attachmentFullUrl }
)
}
function openLineageQc(row: OutboundReleaseCellRow) {
const id = String(row.cellProductId || '')
if (!id) {
ElMessage.warning('缺少细胞产品信息')
return
}
lineageQcProductId.value = id
lineageQcVisible.value = true
}
</script>
<style lang="scss" scoped>
+3 -3
View File
@@ -26,7 +26,7 @@ export interface PilotBizTypeConfig {
const RESEARCH_LIKE_CONFIG: PilotBizTypeConfig = {
label: '临床科研',
applicationNoPrefix: 'JCSY',
applicationNoPrefix: 'LCKY',
showChannel: true,
showPatient: false,
showConsent: false,
@@ -35,7 +35,7 @@ const RESEARCH_LIKE_CONFIG: PilotBizTypeConfig = {
showCheckup: false,
showInfusionConfirm: false,
showDelivery: true,
showPayment: true,
showPayment: false,
planLabel: '交付计划',
scheduleLabel: '交付计划',
pickupTimeLabel: '交付时间',
@@ -86,7 +86,7 @@ export const PILOT_BIZ_TYPE_CONFIG: Record<PilotBizType, PilotBizTypeConfig> = {
basic_experiment: {
...RESEARCH_LIKE_CONFIG,
label: '临床科研',
applicationNoPrefix: 'JCSY'
applicationNoPrefix: 'LCKY'
},
contract_processing: {
...RESEARCH_LIKE_CONFIG,
@@ -19,7 +19,7 @@ export const CONTRACT_PROCESSING_CATEGORY_OPTIONS = [
export type ContractProcessingCategory =
(typeof CONTRACT_PROCESSING_CATEGORY_OPTIONS)[number]['value']
/** 前端「其他」占位,提交时改为自定义文本 */
/** @deprecated 已由维护弹窗自定义类型取代,保留兼容旧数据回显 */
export const RESEARCH_CATEGORY_OTHER_VALUE = '__other__'
const LABEL_MAP = Object.fromEntries(
@@ -34,16 +34,34 @@ export function clinicalResearchCategoryLabel(code?: string | null): string {
return LABEL_MAP[code] || code
}
export function researchCategoryOptionsForBiz(bizType?: string | null) {
if (bizType === 'contract_processing') {
return [
...CONTRACT_PROCESSING_CATEGORY_OPTIONS,
{ value: RESEARCH_CATEGORY_OTHER_VALUE, label: '其他' }
]
}
return [...CLINICAL_RESEARCH_CATEGORY_OPTIONS]
export type ResearchCategoryOption = { value: string; label: string }
export function researchCategoryOptionsForBiz(
bizType?: string | null,
customOptions: ResearchCategoryOption[] = []
): ResearchCategoryOption[] {
const fixedSource =
bizType === 'contract_processing'
? CONTRACT_PROCESSING_CATEGORY_OPTIONS
: CLINICAL_RESEARCH_CATEGORY_OPTIONS
const fixed = fixedSource.map((o) => ({
value: o.value,
label: o.label
}))
const seen = new Set(fixed.map((o) => o.value))
const customs = customOptions.filter((o) => o.value && !seen.has(o.value))
return [...fixed, ...customs]
}
export function isFixedContractProcessingCategory(code?: string | null): boolean {
return CONTRACT_PROCESSING_CATEGORY_OPTIONS.some((o) => o.value === code)
}
export function isFixedClinicalResearchCategory(code?: string | null): boolean {
return CLINICAL_RESEARCH_CATEGORY_OPTIONS.some((o) => o.value === code)
}
export function isFixedResearchCategory(bizType?: string | null, code?: string | null): boolean {
if (bizType === 'contract_processing') return isFixedContractProcessingCategory(code)
return isFixedClinicalResearchCategory(code)
}
+151
View File
@@ -553,6 +553,75 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
]
},
// ── 中试服务(侧栏隐藏;菜单定义保留为「隐藏」,角色授权已收回)────────
{
id: 'PIL00000000000000000000000000001',
name: 'PilotService',
path: 'pilot-service',
component: '',
meta: {
title: '中试服务',
icon: 'ri:flask-line',
keepAlive: false,
isHide: true,
roles: ['admin']
},
children: [
{
id: '80000000000000000000000000000010',
name: 'PilotApplication',
path: 'pilot-application',
component: '/pilot-service/pilot-application/index',
meta: {
title: '中试服务申请单',
keepAlive: true,
isHide: true,
menuCode: 'pilot-service:pilot-application:list'
},
props: { bizType: 'pilot_service' }
},
{
id: 'PIL00000000000000000000000000002',
name: 'PilotCheckupManagement',
path: 'checkup-management',
component: '/pilot-service/checkup-management/index',
meta: {
title: '体检管理',
keepAlive: false,
isHide: true,
menuCode: 'pilot-service:checkup-management:list'
},
props: { bizType: 'pilot_service' }
},
{
id: 'PIL00000000000000000000000000003',
name: 'PilotInfusionSchedule',
path: 'infusion-schedule-management',
component: '/pilot-service/infusion-schedule-management/index',
meta: {
title: '输注计划管理',
keepAlive: false,
isHide: true,
menuCode: 'pilot-service:infusion-schedule-management:list'
},
props: { bizType: 'pilot_service' }
},
{
id: 'PIL00000000000000000000000000004',
name: 'PilotOutboundRelease',
path: 'outbound-release-review',
component: '/pilot-service/outbound-release-review/index',
meta: {
title: '出库放行审核',
keepAlive: true,
isHide: true,
menuCode: 'pilot-service:outbound-release-review:list'
},
props: { bizType: 'pilot_service' }
}
]
},
// ── 临床科研 ──────────────────────────────────────────────────────────
{
id: 'BEX00000000000000000000000000001',
@@ -578,6 +647,32 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
},
props: { bizType: 'basic_experiment' }
},
{
id: 'BEX00000000000000000000000000006',
name: 'BasicExperimentApproval',
path: 'approval',
component: '/pilot-service/pilot-application/index',
meta: {
title: '临床科研审批',
keepAlive: true,
menuCode: 'basic-experiment:approval:list',
bizType: 'basic_experiment',
approvalOnly: true
},
props: { bizType: 'basic_experiment', approvalOnly: true }
},
{
id: 'BEX00000000000000000000000000005',
name: 'BasicExperimentFeeInfo',
path: 'fee-info',
component: '/pilot-service/fee-info/index',
meta: {
title: '费用信息',
keepAlive: true,
menuCode: 'basic-experiment:fee-info:list'
},
props: { bizType: 'basic_experiment' }
},
{
id: 'BEX00000000000000000000000000003',
name: 'BasicExperimentPaymentConfirm',
@@ -586,6 +681,7 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
meta: {
title: '缴退费财务确认',
keepAlive: true,
isHide: true,
menuCode: 'basic-experiment:payment-confirm:list'
},
props: { bizType: 'basic_experiment' }
@@ -630,6 +726,32 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
},
props: { bizType: 'contract_processing' }
},
{
id: 'CPG00000000000000000000000000006',
name: 'ContractProcessingApproval',
path: 'approval',
component: '/pilot-service/pilot-application/index',
meta: {
title: '委托加工审批',
keepAlive: true,
menuCode: 'contract-processing:approval:list',
bizType: 'contract_processing',
approvalOnly: true
},
props: { bizType: 'contract_processing', approvalOnly: true }
},
{
id: 'CPG00000000000000000000000000005',
name: 'ContractProcessingFeeInfo',
path: 'fee-info',
component: '/pilot-service/fee-info/index',
meta: {
title: '费用信息',
keepAlive: true,
menuCode: 'contract-processing:fee-info:list'
},
props: { bizType: 'contract_processing' }
},
{
id: 'CPG00000000000000000000000000003',
name: 'ContractProcessingPaymentConfirm',
@@ -638,6 +760,7 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
meta: {
title: '缴退费财务确认',
keepAlive: true,
isHide: true,
menuCode: 'contract-processing:payment-confirm:list'
},
props: { bizType: 'contract_processing' }
@@ -969,6 +1092,34 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
menuCode: 'production:waste-output:list'
}
},
{
id: 'PRD00000000000000000000000000001',
name: 'ProductionBasicExperimentOutbound',
path: 'basic-experiment-outbound',
component: '/pilot-service/pilot-application/index',
meta: {
title: '临床科研出库',
keepAlive: true,
menuCode: 'production:basic-experiment-outbound:list',
bizType: 'basic_experiment',
productionOutbound: true
},
props: { bizType: 'basic_experiment', productionOutbound: true }
},
{
id: 'PRD00000000000000000000000000002',
name: 'ProductionContractProcessingOutbound',
path: 'contract-processing-outbound',
component: '/pilot-service/pilot-application/index',
meta: {
title: '委托加工出库',
keepAlive: true,
menuCode: 'production:contract-processing-outbound:list',
bizType: 'contract_processing',
productionOutbound: true
},
props: { bizType: 'contract_processing', productionOutbound: true }
},
{
id: 'PRM0000000000000000000000000LSP1',
name: 'ProductionLabSampleProcess',
+31
View File
@@ -495,6 +495,33 @@ declare namespace Api {
}
}
namespace PartnerCustomer {
interface Item {
id: string
customerName: string
customerContact: string
customerPhone: string
tenantNo: string
orderNum: number
remark: string
createTime: string
updateTime: string
}
}
namespace ContractProcessingCategory {
interface Item {
id: string
categoryName: string
bizType?: string
tenantNo: string
orderNum: number
remark: string
createTime: string
updateTime: string
}
}
namespace BizCustomer {
interface CustomerItem {
id: string
@@ -857,6 +884,10 @@ declare namespace Api {
id: string
specCode: string
specName: string
/** 细胞数量(单位:千万),存量可为空 */
cellCountQianwan: number | null
/** 分装体积(单位:ml),存量可为空 */
fillVolumeMl: number | null
tenantNo: string
orderNum: number
remark: string
@@ -55,7 +55,7 @@ export const PRODUCTION_WORK_ORDER_TABS: ProductionWorkOrderTabConfig[] = [
workOrderType: 'outbound',
bizType: 'pilot_service',
listLayout: 'standalone',
/** 客户已下线中试业务:侧栏不展示,路由 key 保留供历史解析 */
/** 与市场中试菜单一致:侧栏 Tab 隐藏,保留 key 供历史工单解析 */
hidden: true
},
{
+1 -1
View File
@@ -55,7 +55,7 @@ export const QC_WORK_ORDER_TABS: QcWorkOrderTabConfig[] = [
workOrderType: 'outbound',
bizType: 'pilot_service',
listLayout: 'outbound-grouped',
/** 客户已下线中试业务:侧栏不展示,路由 key 保留供历史解析 */
/** 与市场中试菜单一致:侧栏 Tab 隐藏,保留 key 供历史工单解析 */
hidden: true
},
{
@@ -654,6 +654,26 @@ export function applicationStatusTagType(
return map[status] || 'info'
}
/** 临床科研/委托加工申请单审批状态 */
export function applicationApprovalStatusLabel(status: string): string {
const map: Record<string, string> = {
dsp: '待审批',
ytg: '已通过',
yth: '已驳回'
}
return map[status] || status || '-'
}
export function applicationApprovalStatusTagType(
status: string
): '' | 'success' | 'warning' | 'danger' | 'info' {
const map: Record<string, '' | 'success' | 'warning' | 'danger' | 'info'> = {
dsp: 'warning',
ytg: 'success',
yth: 'danger'
}
return map[status] || 'info'
}
// ========== 中试服务体检状态 ==========
export function checkupStatusLabel(status: string): string {
const map: Record<string, string> = {
@@ -0,0 +1,433 @@
<!-- 合作客户基础信息 -->
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="partner-customer-tab">
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input
v-model="searchForm.keyword"
placeholder="客户名称/联系人/联系方式"
clearable
@keyup.enter="handleSearch"
/>
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<el-button class="btn-main" type="primary" @click="handleAdd">
<el-icon><Plus /></el-icon>
新增合作客户
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="id"
@selection-change="handleSelectionChange"
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index: number) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="customerName"
label="客户名称"
min-width="160"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="customerContact"
label="客户联系人"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="customerPhone"
label="客户联系方式"
min-width="140"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="remark"
label="备注"
min-width="160"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.remark || '—' }}</template>
</el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
min-width="180"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatDisplayOrDash(row.createTime) }}</template>
</el-table-column>
<el-table-column
label="操作"
min-width="120"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-dropdown
trigger="hover"
@command="(cmd: string) => handleDropdownCommand(cmd, row)"
>
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided>
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="
(val: number) => ((pagination.page = 1), (pagination.pageSize = val), loadData())
"
@current-change="(val: number) => ((pagination.page = val), loadData())"
/>
</div>
</div>
<el-dialog
v-model="dialogVisible"
:title="dialogTitle"
width="640px"
class="dialog-form-layout"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
>
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-position="top"
class="biz-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
<div class="form-grid-2">
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="formData.customerName" placeholder="必填" />
</el-form-item>
<el-form-item label="客户联系人" prop="customerContact">
<el-input v-model="formData.customerContact" placeholder="必填" />
</el-form-item>
<el-form-item label="客户联系方式" prop="customerPhone" class="form-col-span-2">
<el-input v-model="formData.customerPhone" placeholder="必填" />
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
<el-input v-model="formData.remark" type="textarea" :rows="2" placeholder="可选" />
</el-form-item>
</div>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="dialogVisible = false">
<el-icon><Close /></el-icon>
取消
</el-button>
<el-button class="btn-main" type="primary" :loading="submitLoading" @click="handleSubmit">
<el-icon><Check /></el-icon>
确定
</el-button>
</template>
</el-dialog>
<SystemViewDialog
v-model:visible="viewVisible"
:title="viewRow?.customerName || '合作客户详情'"
:icon="User"
:meta="viewRow?.createTime ? `创建时间:${viewRow.createTime}` : ''"
:sections="viewSections"
width="720px"
:grid-columns="2"
/>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import {
Check,
Close,
Delete,
Edit,
More,
Plus,
RefreshLeft,
Search,
User,
View
} from '@element-plus/icons-vue'
import {
fetchCreatePartnerCustomer,
fetchDeletePartnerCustomer,
fetchPartnerCustomerList,
fetchUpdatePartnerCustomer
} from '@/api/admin'
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
defineOptions({ name: 'PartnerCustomerTab' })
type PartnerRow = Api.PartnerCustomer.Item
const searchForm = reactive({ keyword: '' })
const tableData = ref<PartnerRow[]>([])
const selectedRows = ref<PartnerRow[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const dialogVisible = ref(false)
const dialogTitle = ref('新增合作客户')
const isEdit = ref(false)
const submitLoading = ref(false)
const formRef = ref()
const editingId = ref<string | null>(null)
const formData = reactive({
customerName: '',
customerContact: '',
customerPhone: '',
remark: ''
})
const formRules = {
customerName: [{ required: true, message: '请填写客户名称', trigger: 'blur' }],
customerContact: [{ required: true, message: '请填写客户联系人', trigger: 'blur' }],
customerPhone: [{ required: true, message: '请填写客户联系方式', trigger: 'blur' }]
}
const viewVisible = ref(false)
const viewRow = ref<PartnerRow | null>(null)
const viewSections = computed(() => {
const row = viewRow.value
if (!row) return []
return [
{
title: '基本信息',
fields: [
{ label: '客户名称', value: row.customerName },
{ label: '客户联系人', value: row.customerContact },
{ label: '客户联系方式', value: row.customerPhone },
{ label: '创建时间', value: row.createTime },
{ label: '备注', value: row.remark, span: true }
]
}
]
})
async function loadData() {
loading.value = true
try {
const res: any = await fetchPartnerCustomerList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined
})
const data = res?.data ?? res
tableData.value = data?.list ?? []
pagination.total = data?.total ?? 0
} catch (e) {
console.error(e)
tableData.value = []
pagination.total = 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
searchForm.keyword = ''
pagination.page = 1
loadData()
}
function handleSelectionChange(rows: PartnerRow[]) {
selectedRows.value = rows
}
function resetForm() {
formData.customerName = ''
formData.customerContact = ''
formData.customerPhone = ''
formData.remark = ''
editingId.value = null
}
function handleAdd() {
isEdit.value = false
dialogTitle.value = '新增合作客户'
resetForm()
dialogVisible.value = true
}
function handleEdit(row: PartnerRow) {
isEdit.value = true
dialogTitle.value = '编辑合作客户'
editingId.value = row.id
formData.customerName = row.customerName || ''
formData.customerContact = row.customerContact || ''
formData.customerPhone = row.customerPhone || ''
formData.remark = row.remark || ''
dialogVisible.value = true
}
function handleView(row: PartnerRow) {
viewRow.value = row
viewVisible.value = true
}
function handleDropdownCommand(cmd: string, row: PartnerRow) {
if (cmd === 'edit') handleEdit(row)
if (cmd === 'delete') handleDelete(row)
}
async function handleSubmit() {
await formRef.value?.validate()
submitLoading.value = true
try {
const payload = {
customerName: formData.customerName.trim(),
customerContact: formData.customerContact.trim(),
customerPhone: formData.customerPhone.trim(),
remark: formData.remark.trim() || undefined
}
if (isEdit.value && editingId.value) {
await fetchUpdatePartnerCustomer(editingId.value, payload)
ElMessage.success('更新成功')
} else {
await fetchCreatePartnerCustomer(payload)
ElMessage.success('创建成功')
}
dialogVisible.value = false
loadData()
} catch (e: any) {
if (e !== false && e?.message) {
// request util already toasts most errors
}
} finally {
submitLoading.value = false
}
}
async function handleDelete(row: PartnerRow) {
try {
await ElMessageBox.confirm(`确定删除合作客户「${row.customerName}」吗?`, '提示', {
type: 'warning'
})
await withFullscreenLoading(() => fetchDeletePartnerCustomer(row.id), {
text: fullscreenLoadingText.delete
})
ElMessage.success('已删除')
loadData()
} catch (e) {
if (e !== 'cancel') console.error(e)
}
}
async function handleBatchDelete() {
if (!selectedRows.value.length) return
try {
await ElMessageBox.confirm(
`确定删除选中的 ${selectedRows.value.length} 个合作客户吗?`,
'提示',
{ type: 'warning' }
)
await withFullscreenLoading(
async () => {
for (const row of selectedRows.value) {
await fetchDeletePartnerCustomer(row.id)
}
},
{ text: fullscreenLoadingText.delete }
)
ElMessage.success('已删除')
selectedRows.value = []
loadData()
} catch (e) {
if (e !== 'cancel') console.error(e)
}
}
onMounted(() => {
loadData()
})
</script>
@@ -0,0 +1,847 @@
<!-- 存储客户基础信息 -->
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="storage-customer-tab">
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input
v-model="searchForm.keyword"
placeholder="姓名/电话/身份证/标签"
clearable
/>
</el-form-item>
<el-form-item label="创建时间">
<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 class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
</div>
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<el-button class="btn-main" type="primary" @click="handleAdd">
<el-icon><Plus /></el-icon>
新增客户
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
</div>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="id"
@selection-change="handleSelectionChange"
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="customerName"
label="客户姓名"
min-width="120"
align="center"
header-align="center"
/>
<el-table-column
prop="sex"
label="性别"
min-width="72"
align="center"
header-align="center"
>
<template #default="{ row }">{{ sexLabel(row.sex) }}</template>
</el-table-column>
<el-table-column
prop="idCardNo"
label="身份证号"
min-width="160"
align="center"
header-align="center"
/>
<el-table-column
prop="age"
label="年龄"
min-width="72"
align="center"
header-align="center"
/>
<el-table-column
prop="phoneNo"
label="联系电话"
min-width="140"
align="center"
header-align="center"
/>
<el-table-column
prop="birthYm"
label="出生年月"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatBirthYm(row.birthYm) }}</template>
</el-table-column>
<el-table-column
prop="ethnic"
label="民族"
min-width="90"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.ethnic || '—' }}</template>
</el-table-column>
<el-table-column
prop="email"
label="邮箱"
min-width="160"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.email || '—' }}</template>
</el-table-column>
<el-table-column
prop="address"
label="家庭住址"
min-width="180"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.address || '—' }}</template>
</el-table-column>
<el-table-column
prop="customerTags"
label="客户标签"
min-width="140"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.customerTags || '—' }}</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="140"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.remark || '—' }}</template>
</el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
min-width="180"
align="center"
header-align="center">
<template #default="{ row }">{{ formatDisplayOrDash(row.createTime) }}</template>
</el-table-column>
<el-table-column
label="操作"
min-width="120"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided>
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
@current-change="(val) => ((pagination.page = val), loadData())"
/>
</div>
</div>
<el-dialog
v-model="dialogVisible"
:title="dialogTitle"
width="720px"
class="dialog-form-layout"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
>
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-position="top"
class="biz-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
<div class="form-grid-2">
<el-form-item label="客户姓名" prop="customerName">
<el-input v-model="formData.customerName" placeholder="必填" />
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-select v-model="formData.sex" placeholder="选择" style="width: 100%">
<el-option label="男" value="0" />
<el-option label="女" value="1" />
<el-option label="未知" value="2" />
</el-select>
</el-form-item>
<el-form-item label="身份证号" prop="idCardNo">
<el-input
v-model="formData.idCardNo"
placeholder="可选;填写后租户内不可重复"
clearable
/>
</el-form-item>
<el-form-item label="年龄">
<el-input
type="number"
step="any"
v-model="formData.age"
:min="0"
:max="150"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="联系电话">
<el-input v-model="formData.phoneNo" placeholder="可选" clearable />
</el-form-item>
<el-form-item label="出生年月">
<el-date-picker
v-model="formData.birthYm"
type="month"
value-format="YYYYMM"
format="YYYY-MM"
placeholder="选择月份"
clearable
style="width: 100%"
/>
</el-form-item>
<el-form-item label="民族">
<el-select
v-model="formData.ethnic"
class="w-full"
filterable
clearable
:loading="ethnicLoading"
placeholder="请选择或检索民族"
style="width: 100%"
>
<el-option
v-for="e in ethnicOptions"
:key="e.ethnicCode || e.ethnicName"
:label="e.ethnicName"
:value="e.ethnicName"
/>
</el-select>
</el-form-item>
<el-form-item label="邮箱">
<el-input v-model="formData.email" placeholder="可选" clearable />
</el-form-item>
<el-form-item label="家庭住址" class="form-col-span-2">
<el-input v-model="formData.address" placeholder="可选" />
</el-form-item>
<el-form-item label="客户标签" class="form-col-span-2">
<el-input v-model="formData.customerTags" placeholder="多个标签用英文逗号分隔" />
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
<el-input v-model="formData.remark" type="textarea" :rows="2" placeholder="可选" />
</el-form-item>
</div>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="dialogVisible = false">
<el-icon><Close /></el-icon>
取消
</el-button>
<el-button class="btn-main" type="primary" @click="handleSubmit" :loading="submitLoading">
<el-icon><Check /></el-icon>
确定
</el-button>
</template>
</el-dialog>
<SystemViewDialog
v-model:visible="viewVisible"
:title="viewRow?.customerName || '客户详情'"
:icon="User"
:meta="`身份证:${viewRow?.idCardNo || '—'}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
:sections="viewSections"
:loading="relationsLoading"
width="1100px"
:grid-columns="5"
>
<template #related-customers>
<div class="customer-relations">
<p v-if="!(relations?.relatedGroups || []).length" class="view-empty-hint">暂无关联客户</p>
<div
v-for="group in relations?.relatedGroups || []"
:key="`${group.bizType}-${group.protocolId}`"
class="rel-group"
>
<div class="rel-group-head">
<el-tag size="small" :type="group.bizType === 'cell_storage' ? 'primary' : 'success'">
{{ bizTypeLabel(group.bizType) }}
</el-tag>
<button type="button" class="rel-link" @click="openProtocol(group)">
{{ group.protocolNo || '—' }}
</button>
<span class="rel-muted">本客户角色:{{ roleLabel(group.myRole) }}</span>
</div>
<div class="view-subtable-wrap">
<el-table :data="group.members" stripe class="list-table view-subtable">
<el-table-column label="角色" min-width="90" align="center" header-align="center">
<template #default="{ row }">
{{ roleLabel(row.role) }}
<el-tag v-if="row.customerId && row.customerId === viewRow?.id" size="small" type="info">
本人
</el-tag>
</template>
</el-table-column>
<el-table-column label="姓名" min-width="110" align="center" header-align="center">
<template #default="{ row }">
<button
v-if="row.customerId && row.customerId !== viewRow?.id"
type="button"
class="rel-link"
@click="openRelatedCustomer(row)"
>
{{ row.name || '—' }}
</button>
<span v-else>{{ row.name || '—' }}</span>
</template>
</el-table-column>
<el-table-column prop="phone" label="电话" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{ row.phone || '—' }}</template>
</el-table-column>
<el-table-column prop="idCardNo" label="身份证" min-width="160" align="center" header-align="center">
<template #default="{ row }">{{ row.idCardNo || '—' }}</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</template>
<template #related-protocols>
<div class="customer-relations">
<p v-if="!(relations?.protocols || []).length" class="view-empty-hint">暂无关联协议</p>
<div v-else class="view-subtable-wrap">
<el-table :data="relations?.protocols || []" stripe class="list-table view-subtable">
<el-table-column label="协议号" min-width="140" align="center" header-align="center">
<template #default="{ row }">
<button type="button" class="rel-link" @click="openProtocol(row)">
{{ row.protocolNo || '—' }}
</button>
</template>
</el-table-column>
<el-table-column label="类型" min-width="110" align="center" header-align="center">
<template #default="{ row }">
<el-tag size="small" :type="row.bizType === 'cell_storage' ? 'primary' : 'success'">
{{ bizTypeLabel(row.bizType) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag size="small" :type="protocolTagType(row)">
{{ protocolLabel(row) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="日期" min-width="110" align="center" header-align="center">
<template #default="{ row }">{{ formatRegisterDate(row.registerDate) }}</template>
</el-table-column>
<el-table-column label="本客户角色" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ roleLabel(row.myRole) }}</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
</SystemViewDialog>
<ProtocolViewDialog
v-model="protocolViewVisible"
:protocol-id="viewProtocolId"
show-audit-history
/>
<DonationViewDialog
v-model="donationViewVisible"
:donation-id="viewDonationId"
show-audit-history
/>
</div>
</template>
<script setup lang="ts">
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { ref, reactive, computed, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus, Close, Check, View, User, RefreshLeft, Search, More, Edit, Delete } from '@element-plus/icons-vue'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import {
fetchCustomerList,
fetchCreateCustomer,
fetchUpdateCustomer,
fetchDeleteCustomer,
fetchCustomerRelations
} from '@/api/admin'
import { fetchEthnicList, type EthnicOption } from '@/api/ethnic'
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
import ProtocolViewDialog from '@/views/cell-storage/protocol/ProtocolViewDialog.vue'
import DonationViewDialog from '@/views/research-donation/list/DonationViewDialog.vue'
import {
sexLabel,
protocolStatusDisplayLabel,
protocolStatusTagType,
donationStatusDisplayLabel,
donationStatusTagType
} from '@/utils/status-tag-registry'
defineOptions({ name: 'StorageCustomerTab' })
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
const createTimeRange = ref<[string, string] | null>(null)
const tableData = ref<Api.BizCustomer.CustomerItem[]>([])
const selectedRows = ref<Api.BizCustomer.CustomerItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const dialogVisible = ref(false)
const dialogTitle = ref('新增客户')
const isEdit = ref(false)
const submitLoading = ref(false)
const formRef = ref()
const editingId = ref<string | null>(null)
// ---- 查看弹窗 ----
const viewVisible = ref(false)
const viewRow = ref<Api.BizCustomer.CustomerItem | null>(null)
const relationsLoading = ref(false)
const relations = ref<Api.BizCustomer.CustomerRelations | null>(null)
const protocolViewVisible = ref(false)
const viewProtocolId = ref<string | null>(null)
const donationViewVisible = ref(false)
const viewDonationId = ref<string | null>(null)
function formatBirthYm(ym: string | undefined | null) {
const s = String(ym || '').trim()
if (/^\d{6}$/.test(s)) return `${s.slice(0, 4)}-${s.slice(4, 6)}`
return s || '—'
}
const viewSections = computed(() => {
const row = viewRow.value
if (!row) return []
return [
{
title: '基本信息',
fields: [
{ label: '客户姓名', value: row.customerName },
{ label: '性别', value: sexLabel(row.sex) },
{ label: '身份证号', value: row.idCardNo },
{ label: '年龄', value: row.age },
{ label: '联系电话', value: row.phoneNo },
{ label: '出生年月', value: formatBirthYm(row.birthYm) },
{ label: '民族', value: row.ethnic },
{ label: '邮箱', value: row.email },
{ label: '家庭住址', value: row.address },
{ label: '客户标签', value: row.customerTags },
{ label: '创建时间', value: row.createTime },
{ label: '备注', value: row.remark }
]
},
{
title: '关联客户',
fields: [],
slot: 'related-customers'
},
{
title: '关联协议',
fields: [],
slot: 'related-protocols'
}
]
})
function roleLabel(role: string) {
if (role === 'mother') return '母亲'
if (role === 'father') return '父亲'
if (role === 'newborn') return '子女'
return role || '—'
}
function bizTypeLabel(bizType: string) {
return bizType === 'research_donation' ? '科研捐赠' : '细胞存储'
}
function protocolLabel(row: Api.BizCustomer.ProtocolSummary) {
return row.bizType === 'research_donation'
? donationStatusDisplayLabel(row.protocolStatus)
: protocolStatusDisplayLabel(row.protocolStatus)
}
function protocolTagType(row: Api.BizCustomer.ProtocolSummary) {
return row.bizType === 'research_donation'
? donationStatusTagType(row.protocolStatus)
: protocolStatusTagType(row.protocolStatus)
}
function formatRegisterDate(val: string) {
const s = (val || '').trim()
if (/^\d{8}$/.test(s)) return `${s.slice(0, 4)}-${s.slice(4, 6)}-${s.slice(6, 8)}`
return formatDisplayOrDash(s)
}
async function handleView(row: Api.BizCustomer.CustomerItem) {
viewRow.value = row
viewVisible.value = true
relationsLoading.value = true
relations.value = null
try {
const data = await fetchCustomerRelations(row.id)
relations.value = data
if (data?.customer) viewRow.value = data.customer
} catch {
/* 全局处理 */
} finally {
relationsLoading.value = false
}
}
function openRelatedCustomer(member: Api.BizCustomer.RelationMember) {
if (!member.customerId) return
void handleView({
id: member.customerId,
customerName: member.name || '',
sex: '2',
idCardNo: member.idCardNo || '',
age: null,
phoneNo: member.phone || '',
customerTags: '',
tenantNo: '',
orderNum: 0,
remark: '',
createTime: '',
updateTime: ''
})
}
function openProtocol(
row: Pick<Api.BizCustomer.ProtocolSummary, 'bizType' | 'protocolId'>
) {
if (!row.protocolId) return
if (row.bizType === 'research_donation') {
viewDonationId.value = row.protocolId
donationViewVisible.value = true
return
}
viewProtocolId.value = row.protocolId
protocolViewVisible.value = true
}
const formData = reactive({
customerName: '',
sex: '0',
idCardNo: '',
age: null as number | null,
birthYm: '',
ethnic: '',
email: '',
address: '',
phoneNo: '',
customerTags: '',
orderNum: 0,
remark: ''
})
const ethnicOptions = ref<EthnicOption[]>([])
const ethnicLoading = ref(false)
async function loadEthnicOptions() {
if (ethnicOptions.value.length) return
ethnicLoading.value = true
try {
const res = await fetchEthnicList({ limit: 200 })
ethnicOptions.value = res.list || []
} finally {
ethnicLoading.value = false
}
}
function ensureEthnicOptionInList(name: string) {
const n = (name || '').trim()
if (!n) return
if (ethnicOptions.value.some((e) => e.ethnicName === n)) return
ethnicOptions.value = [
{ id: '', ethnicName: n, ethnicCode: '', orderNum: null },
...ethnicOptions.value
]
}
const formRules = {
customerName: [{ required: true, message: '请输入客户姓名', trigger: 'blur' }]
}
const handleSelectionChange = (rows: Api.BizCustomer.CustomerItem[]) => {
selectedRows.value = rows
}
async function loadData() {
loading.value = true
try {
const res = await fetchCustomerList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
createTimeStart: createTimeRange.value?.[0] || undefined,
createTimeEnd: createTimeRange.value?.[1] || undefined
})
tableData.value = res.list || []
pagination.total = res.total ?? 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
searchForm.keyword = ''
createTimeRange.value = null
pagination.page = 1
loadData()
}
function resetForm() {
formData.customerName = ''
formData.sex = '0'
formData.idCardNo = ''
formData.age = null
formData.birthYm = ''
formData.ethnic = ''
formData.email = ''
formData.address = ''
formData.phoneNo = ''
formData.customerTags = ''
formData.orderNum = 0
formData.remark = ''
editingId.value = null
}
function handleAdd() {
isEdit.value = false
dialogTitle.value = '新增客户'
resetForm()
void loadEthnicOptions()
dialogVisible.value = true
formRef.value?.clearValidate?.()
}
function handleEdit(row: Api.BizCustomer.CustomerItem) {
isEdit.value = true
dialogTitle.value = '编辑客户'
editingId.value = row.id
formData.customerName = row.customerName || ''
formData.sex = row.sex || '2'
formData.idCardNo = row.idCardNo || ''
formData.age = row.age ?? null
formData.birthYm = row.birthYm || ''
formData.ethnic = row.ethnic || ''
formData.email = row.email || ''
formData.address = row.address || ''
formData.phoneNo = row.phoneNo || ''
formData.customerTags = row.customerTags || ''
formData.orderNum = row.orderNum ?? 0
formData.remark = row.remark || ''
void loadEthnicOptions().then(() => ensureEthnicOptionInList(formData.ethnic))
dialogVisible.value = true
formRef.value?.clearValidate?.()
}
async function handleSubmit() {
await formRef.value?.validate?.()
submitLoading.value = true
try {
const payload = {
customerName: formData.customerName.trim(),
sex: formData.sex,
idCardNo: formData.idCardNo?.trim() || undefined,
age: formData.age,
birthYm: formData.birthYm?.trim() || undefined,
ethnic: formData.ethnic?.trim() || undefined,
email: formData.email?.trim() || undefined,
address: formData.address?.trim() || undefined,
phoneNo: formData.phoneNo?.trim() || undefined,
customerTags: formData.customerTags?.trim() || undefined,
orderNum: formData.orderNum,
remark: formData.remark?.trim() || undefined
}
if (isEdit.value && editingId.value) {
await fetchUpdateCustomer(editingId.value, payload)
} else {
await fetchCreateCustomer(payload)
}
ElMessage.success(isEdit.value ? '更新成功' : '创建成功')
dialogVisible.value = false
await loadData()
} catch {
/* 全局处理 */
} finally {
submitLoading.value = false
}
}
function handleDropdownCommand(command: string, row: any) {
switch (command) {
case 'edit': handleEdit(row); break
case 'delete': handleDelete(row); break
}
}
async function handleDelete(row: Api.BizCustomer.CustomerItem) {
await ElMessageBox.confirm('确定要删除该客户吗?', '提示', { type: 'warning' })
await fetchDeleteCustomer(row.id)
ElMessage.success('删除成功')
await loadData()
}
async function handleBatchDelete() {
const ids = selectedRows.value.map((r) => r.id)
if (!ids.length) return
await ElMessageBox.confirm(`确定删除选中的 ${ids.length} 条客户吗?`, '提示', {
type: 'warning'
})
await withFullscreenLoading(async () => {
for (const id of ids) {
await fetchDeleteCustomer(id)
}
ElMessage.success('批量删除成功')
selectedRows.value = []
await loadData()
}, fullscreenLoadingText.batchDelete)
}
// 输入检索条件时自动搜索(防抖 300ms)
watchDebounced(
[searchForm, createTimeRange],
() => {
pagination.page = 1
loadData()
},
{ debounce: 300, deep: true }
)
onMounted(() => {
loadData()
})
</script>
<style scoped lang="scss">
.biz-dialog-form {
:deep(.el-form-item) {
margin-bottom: 0;
}
}
.customer-relations {
.rel-group {
margin-bottom: 14px;
&:last-child {
margin-bottom: 0;
}
}
.rel-group-head {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-bottom: 8px;
}
.rel-muted {
color: var(--mint-text-muted, #64748b);
font-size: 13px;
}
.rel-link {
padding: 0;
border: 0;
background: transparent;
color: var(--primary, #10b981);
cursor: pointer;
font: inherit;
text-decoration: underline;
text-underline-offset: 2px;
}
}
</style>
+31 -828
View File
@@ -1,849 +1,52 @@
<!-- 客户基础信息 -->
<!-- eslint-disable vue/no-v-model-argument -->
<!-- 客户基础信息:存储客户 / 合作客户 -->
<template>
<div class="page-container">
<section class="panel">
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input
v-model="searchForm.keyword"
placeholder="姓名/电话/身份证/标签"
clearable
/>
</el-form-item>
<el-form-item label="创建时间">
<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 class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset"
><el-icon><RefreshLeft /></el-icon>重置</el-button
>
<el-button class="btn-main" type="primary" @click="handleSearch"
><el-icon><Search /></el-icon>搜索</el-button
>
</div>
</div>
</el-form>
</div>
<div class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<el-button class="btn-main" type="primary" @click="handleAdd">
<el-icon><Plus /></el-icon>
新增客户
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="selectedRows.length === 0"
@click="handleBatchDelete"
<div class="panel-pill-tabs panel-pill-tabs--lg">
<div class="panel-pill-tabs__track" role="tablist" aria-label="客户类型">
<button
v-for="item in tabCards"
:key="item.key"
type="button"
role="tab"
class="panel-pill-tabs__btn"
:class="{ 'is-active': activeTab === item.key }"
:aria-selected="activeTab === item.key"
@click="activeTab = item.key"
>
<el-icon><Delete /></el-icon>
批量删除
</el-button>
{{ item.title }}
</button>
</div>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="id"
@selection-change="handleSelectionChange"
@row-dblclick="handleView"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="customerName"
label="客户姓名"
min-width="120"
align="center"
header-align="center"
/>
<el-table-column
prop="sex"
label="性别"
min-width="72"
align="center"
header-align="center"
>
<template #default="{ row }">{{ sexLabel(row.sex) }}</template>
</el-table-column>
<el-table-column
prop="idCardNo"
label="身份证号"
min-width="160"
align="center"
header-align="center"
/>
<el-table-column
prop="age"
label="年龄"
min-width="72"
align="center"
header-align="center"
/>
<el-table-column
prop="phoneNo"
label="联系电话"
min-width="140"
align="center"
header-align="center"
/>
<el-table-column
prop="birthYm"
label="出生年月"
min-width="110"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatBirthYm(row.birthYm) }}</template>
</el-table-column>
<el-table-column
prop="ethnic"
label="民族"
min-width="90"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.ethnic || '—' }}</template>
</el-table-column>
<el-table-column
prop="email"
label="邮箱"
min-width="160"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.email || '—' }}</template>
</el-table-column>
<el-table-column
prop="address"
label="家庭住址"
min-width="180"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.address || '—' }}</template>
</el-table-column>
<el-table-column
prop="customerTags"
label="客户标签"
min-width="140"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.customerTags || '—' }}</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="140"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.remark || '—' }}</template>
</el-table-column>
<el-table-column
prop="createTime"
label="创建时间"
min-width="180"
align="center"
header-align="center">
<template #default="{ row }">{{ formatDisplayOrDash(row.createTime) }}</template>
</el-table-column>
<el-table-column
label="操作"
min-width="120"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-dropdown trigger="hover" @command="(cmd: string) => handleDropdownCommand(cmd, row)">
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item command="edit">
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item command="delete" divided>
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
@current-change="(val) => ((pagination.page = val), loadData())"
/>
</div>
</div>
<el-dialog
v-model="dialogVisible"
:title="dialogTitle"
width="720px"
class="dialog-form-layout"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
>
<el-form
ref="formRef"
:model="formData"
:rules="formRules"
label-position="top"
class="biz-dialog-form"
scroll-to-error
:scroll-into-view-options="{ behavior: 'smooth', block: 'center' }"
>
<div class="form-grid-2">
<el-form-item label="客户姓名" prop="customerName">
<el-input v-model="formData.customerName" placeholder="必填" />
</el-form-item>
<el-form-item label="性别" prop="sex">
<el-select v-model="formData.sex" placeholder="选择" style="width: 100%">
<el-option label="男" value="0" />
<el-option label="女" value="1" />
<el-option label="未知" value="2" />
</el-select>
</el-form-item>
<el-form-item label="身份证号" prop="idCardNo">
<el-input
v-model="formData.idCardNo"
placeholder="可选;填写后租户内不可重复"
clearable
/>
</el-form-item>
<el-form-item label="年龄">
<el-input
type="number"
step="any"
v-model="formData.age"
:min="0"
:max="150"
style="width: 100%"
/>
</el-form-item>
<el-form-item label="联系电话">
<el-input v-model="formData.phoneNo" placeholder="可选" clearable />
</el-form-item>
<el-form-item label="出生年月">
<el-date-picker
v-model="formData.birthYm"
type="month"
value-format="YYYYMM"
format="YYYY-MM"
placeholder="选择月份"
clearable
style="width: 100%"
/>
</el-form-item>
<el-form-item label="民族">
<el-select
v-model="formData.ethnic"
class="w-full"
filterable
clearable
:loading="ethnicLoading"
placeholder="请选择或检索民族"
style="width: 100%"
>
<el-option
v-for="e in ethnicOptions"
:key="e.ethnicCode || e.ethnicName"
:label="e.ethnicName"
:value="e.ethnicName"
/>
</el-select>
</el-form-item>
<el-form-item label="邮箱">
<el-input v-model="formData.email" placeholder="可选" clearable />
</el-form-item>
<el-form-item label="家庭住址" class="form-col-span-2">
<el-input v-model="formData.address" placeholder="可选" />
</el-form-item>
<el-form-item label="客户标签" class="form-col-span-2">
<el-input v-model="formData.customerTags" placeholder="多个标签用英文逗号分隔" />
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
<el-input v-model="formData.remark" type="textarea" :rows="2" placeholder="可选" />
</el-form-item>
</div>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="dialogVisible = false">
<el-icon><Close /></el-icon>
取消
</el-button>
<el-button class="btn-main" type="primary" @click="handleSubmit" :loading="submitLoading">
<el-icon><Check /></el-icon>
确定
</el-button>
</template>
</el-dialog>
<SystemViewDialog
v-model:visible="viewVisible"
:title="viewRow?.customerName || '客户详情'"
:icon="User"
:meta="`身份证:${viewRow?.idCardNo || '—'}${viewRow?.createTime ? ' · ' + viewRow.createTime : ''}`"
:sections="viewSections"
:loading="relationsLoading"
width="1100px"
:grid-columns="5"
>
<template #related-customers>
<div class="customer-relations">
<p v-if="!(relations?.relatedGroups || []).length" class="view-empty-hint">暂无关联客户</p>
<div
v-for="group in relations?.relatedGroups || []"
:key="`${group.bizType}-${group.protocolId}`"
class="rel-group"
>
<div class="rel-group-head">
<el-tag size="small" :type="group.bizType === 'cell_storage' ? 'primary' : 'success'">
{{ bizTypeLabel(group.bizType) }}
</el-tag>
<button type="button" class="rel-link" @click="openProtocol(group)">
{{ group.protocolNo || '—' }}
</button>
<span class="rel-muted">本客户角色:{{ roleLabel(group.myRole) }}</span>
</div>
<div class="view-subtable-wrap">
<el-table :data="group.members" stripe class="list-table view-subtable">
<el-table-column label="角色" min-width="90" align="center" header-align="center">
<template #default="{ row }">
{{ roleLabel(row.role) }}
<el-tag v-if="row.customerId && row.customerId === viewRow?.id" size="small" type="info">
本人
</el-tag>
</template>
</el-table-column>
<el-table-column label="姓名" min-width="110" align="center" header-align="center">
<template #default="{ row }">
<button
v-if="row.customerId && row.customerId !== viewRow?.id"
type="button"
class="rel-link"
@click="openRelatedCustomer(row)"
>
{{ row.name || '—' }}
</button>
<span v-else>{{ row.name || '—' }}</span>
</template>
</el-table-column>
<el-table-column prop="phone" label="电话" min-width="120" align="center" header-align="center">
<template #default="{ row }">{{ row.phone || '—' }}</template>
</el-table-column>
<el-table-column prop="idCardNo" label="身份证" min-width="160" align="center" header-align="center">
<template #default="{ row }">{{ row.idCardNo || '—' }}</template>
</el-table-column>
</el-table>
</div>
</div>
</div>
</template>
<template #related-protocols>
<div class="customer-relations">
<p v-if="!(relations?.protocols || []).length" class="view-empty-hint">暂无关联协议</p>
<div v-else class="view-subtable-wrap">
<el-table :data="relations?.protocols || []" stripe class="list-table view-subtable">
<el-table-column label="协议号" min-width="140" align="center" header-align="center">
<template #default="{ row }">
<button type="button" class="rel-link" @click="openProtocol(row)">
{{ row.protocolNo || '—' }}
</button>
</template>
</el-table-column>
<el-table-column label="类型" min-width="110" align="center" header-align="center">
<template #default="{ row }">
<el-tag size="small" :type="row.bizType === 'cell_storage' ? 'primary' : 'success'">
{{ bizTypeLabel(row.bizType) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="状态" min-width="100" align="center" header-align="center">
<template #default="{ row }">
<el-tag size="small" :type="protocolTagType(row)">
{{ protocolLabel(row) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="日期" min-width="110" align="center" header-align="center">
<template #default="{ row }">{{ formatRegisterDate(row.registerDate) }}</template>
</el-table-column>
<el-table-column label="本客户角色" min-width="100" align="center" header-align="center">
<template #default="{ row }">{{ roleLabel(row.myRole) }}</template>
</el-table-column>
</el-table>
</div>
</div>
</template>
</SystemViewDialog>
<ProtocolViewDialog
v-model="protocolViewVisible"
:protocol-id="viewProtocolId"
show-audit-history
/>
<DonationViewDialog
v-model="donationViewVisible"
:donation-id="viewDonationId"
show-audit-history
/>
<StorageCustomerTab v-if="activeTab === 'storage'" />
<PartnerCustomerTab v-else-if="activeTab === 'partner'" />
</section>
</div>
</template>
<script setup lang="ts">
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { ref, reactive, computed, onMounted } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Plus, Close, Check, View, User, RefreshLeft, Search, More, Edit, Delete } from '@element-plus/icons-vue'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
import {
fetchCustomerList,
fetchCreateCustomer,
fetchUpdateCustomer,
fetchDeleteCustomer,
fetchCustomerRelations
} from '@/api/admin'
import { fetchEthnicList, type EthnicOption } from '@/api/ethnic'
import SystemViewDialog from '@/components/business/system-view-dialog/index.vue'
import ProtocolViewDialog from '@/views/cell-storage/protocol/ProtocolViewDialog.vue'
import DonationViewDialog from '@/views/research-donation/list/DonationViewDialog.vue'
import {
sexLabel,
protocolStatusDisplayLabel,
protocolStatusTagType,
donationStatusDisplayLabel,
donationStatusTagType
} from '@/utils/status-tag-registry'
import { onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import StorageCustomerTab from './StorageCustomerTab.vue'
import PartnerCustomerTab from './PartnerCustomerTab.vue'
defineOptions({ name: 'BizCustomer' })
const searchForm = reactive<{ keyword: string }>({ keyword: '' })
const createTimeRange = ref<[string, string] | null>(null)
const tableData = ref<Api.BizCustomer.CustomerItem[]>([])
const selectedRows = ref<Api.BizCustomer.CustomerItem[]>([])
const loading = ref(false)
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const dialogVisible = ref(false)
const dialogTitle = ref('新增客户')
const isEdit = ref(false)
const submitLoading = ref(false)
const formRef = ref()
const editingId = ref<string | null>(null)
type TabKey = 'storage' | 'partner'
// ---- 查看弹窗 ----
const viewVisible = ref(false)
const viewRow = ref<Api.BizCustomer.CustomerItem | null>(null)
const relationsLoading = ref(false)
const relations = ref<Api.BizCustomer.CustomerRelations | null>(null)
const protocolViewVisible = ref(false)
const viewProtocolId = ref<string | null>(null)
const donationViewVisible = ref(false)
const viewDonationId = ref<string | null>(null)
const tabCards: Array<{ key: TabKey; title: string }> = [
{ key: 'storage', title: '存储客户基础信息' },
{ key: 'partner', title: '合作客户基础信息' }
]
function formatBirthYm(ym: string | undefined | null) {
const s = String(ym || '').trim()
if (/^\d{6}$/.test(s)) return `${s.slice(0, 4)}-${s.slice(4, 6)}`
return s || '—'
}
const viewSections = computed(() => {
const row = viewRow.value
if (!row) return []
return [
{
title: '基本信息',
fields: [
{ label: '客户姓名', value: row.customerName },
{ label: '性别', value: sexLabel(row.sex) },
{ label: '身份证号', value: row.idCardNo },
{ label: '年龄', value: row.age },
{ label: '联系电话', value: row.phoneNo },
{ label: '出生年月', value: formatBirthYm(row.birthYm) },
{ label: '民族', value: row.ethnic },
{ label: '邮箱', value: row.email },
{ label: '家庭住址', value: row.address },
{ label: '客户标签', value: row.customerTags },
{ label: '创建时间', value: row.createTime },
{ label: '备注', value: row.remark }
]
},
{
title: '关联客户',
fields: [],
slot: 'related-customers'
},
{
title: '关联协议',
fields: [],
slot: 'related-protocols'
}
]
})
function roleLabel(role: string) {
if (role === 'mother') return '母亲'
if (role === 'father') return '父亲'
if (role === 'newborn') return '子女'
return role || '—'
}
function bizTypeLabel(bizType: string) {
return bizType === 'research_donation' ? '科研捐赠' : '细胞存储'
}
function protocolLabel(row: Api.BizCustomer.ProtocolSummary) {
return row.bizType === 'research_donation'
? donationStatusDisplayLabel(row.protocolStatus)
: protocolStatusDisplayLabel(row.protocolStatus)
}
function protocolTagType(row: Api.BizCustomer.ProtocolSummary) {
return row.bizType === 'research_donation'
? donationStatusTagType(row.protocolStatus)
: protocolStatusTagType(row.protocolStatus)
}
function formatRegisterDate(val: string) {
const s = (val || '').trim()
if (/^\d{8}$/.test(s)) return `${s.slice(0, 4)}-${s.slice(4, 6)}-${s.slice(6, 8)}`
return formatDisplayOrDash(s)
}
async function handleView(row: Api.BizCustomer.CustomerItem) {
viewRow.value = row
viewVisible.value = true
relationsLoading.value = true
relations.value = null
try {
const data = await fetchCustomerRelations(row.id)
relations.value = data
if (data?.customer) viewRow.value = data.customer
} catch {
/* 全局处理 */
} finally {
relationsLoading.value = false
}
}
function openRelatedCustomer(member: Api.BizCustomer.RelationMember) {
if (!member.customerId) return
void handleView({
id: member.customerId,
customerName: member.name || '',
sex: '2',
idCardNo: member.idCardNo || '',
age: null,
phoneNo: member.phone || '',
customerTags: '',
tenantNo: '',
orderNum: 0,
remark: '',
createTime: '',
updateTime: ''
})
}
function openProtocol(
row: Pick<Api.BizCustomer.ProtocolSummary, 'bizType' | 'protocolId'>
) {
if (!row.protocolId) return
if (row.bizType === 'research_donation') {
viewDonationId.value = row.protocolId
donationViewVisible.value = true
return
}
viewProtocolId.value = row.protocolId
protocolViewVisible.value = true
}
const formData = reactive({
customerName: '',
sex: '0',
idCardNo: '',
age: null as number | null,
birthYm: '',
ethnic: '',
email: '',
address: '',
phoneNo: '',
customerTags: '',
orderNum: 0,
remark: ''
})
const ethnicOptions = ref<EthnicOption[]>([])
const ethnicLoading = ref(false)
async function loadEthnicOptions() {
if (ethnicOptions.value.length) return
ethnicLoading.value = true
try {
const res = await fetchEthnicList({ limit: 200 })
ethnicOptions.value = res.list || []
} finally {
ethnicLoading.value = false
}
}
function ensureEthnicOptionInList(name: string) {
const n = (name || '').trim()
if (!n) return
if (ethnicOptions.value.some((e) => e.ethnicName === n)) return
ethnicOptions.value = [
{ id: '', ethnicName: n, ethnicCode: '', orderNum: null },
...ethnicOptions.value
]
}
const formRules = {
customerName: [{ required: true, message: '请输入客户姓名', trigger: 'blur' }]
}
const handleSelectionChange = (rows: Api.BizCustomer.CustomerItem[]) => {
selectedRows.value = rows
}
async function loadData() {
loading.value = true
try {
const res = await fetchCustomerList({
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
createTimeStart: createTimeRange.value?.[0] || undefined,
createTimeEnd: createTimeRange.value?.[1] || undefined
})
tableData.value = res.list || []
pagination.total = res.total ?? 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
searchForm.keyword = ''
createTimeRange.value = null
pagination.page = 1
loadData()
}
function resetForm() {
formData.customerName = ''
formData.sex = '0'
formData.idCardNo = ''
formData.age = null
formData.birthYm = ''
formData.ethnic = ''
formData.email = ''
formData.address = ''
formData.phoneNo = ''
formData.customerTags = ''
formData.orderNum = 0
formData.remark = ''
editingId.value = null
}
function handleAdd() {
isEdit.value = false
dialogTitle.value = '新增客户'
resetForm()
void loadEthnicOptions()
dialogVisible.value = true
formRef.value?.clearValidate?.()
}
function handleEdit(row: Api.BizCustomer.CustomerItem) {
isEdit.value = true
dialogTitle.value = '编辑客户'
editingId.value = row.id
formData.customerName = row.customerName || ''
formData.sex = row.sex || '2'
formData.idCardNo = row.idCardNo || ''
formData.age = row.age ?? null
formData.birthYm = row.birthYm || ''
formData.ethnic = row.ethnic || ''
formData.email = row.email || ''
formData.address = row.address || ''
formData.phoneNo = row.phoneNo || ''
formData.customerTags = row.customerTags || ''
formData.orderNum = row.orderNum ?? 0
formData.remark = row.remark || ''
void loadEthnicOptions().then(() => ensureEthnicOptionInList(formData.ethnic))
dialogVisible.value = true
formRef.value?.clearValidate?.()
}
async function handleSubmit() {
await formRef.value?.validate?.()
submitLoading.value = true
try {
const payload = {
customerName: formData.customerName.trim(),
sex: formData.sex,
idCardNo: formData.idCardNo?.trim() || undefined,
age: formData.age,
birthYm: formData.birthYm?.trim() || undefined,
ethnic: formData.ethnic?.trim() || undefined,
email: formData.email?.trim() || undefined,
address: formData.address?.trim() || undefined,
phoneNo: formData.phoneNo?.trim() || undefined,
customerTags: formData.customerTags?.trim() || undefined,
orderNum: formData.orderNum,
remark: formData.remark?.trim() || undefined
}
if (isEdit.value && editingId.value) {
await fetchUpdateCustomer(editingId.value, payload)
} else {
await fetchCreateCustomer(payload)
}
ElMessage.success(isEdit.value ? '更新成功' : '创建成功')
dialogVisible.value = false
await loadData()
} catch {
/* 全局处理 */
} finally {
submitLoading.value = false
}
}
function handleDropdownCommand(command: string, row: any) {
switch (command) {
case 'edit': handleEdit(row); break
case 'delete': handleDelete(row); break
}
}
async function handleDelete(row: Api.BizCustomer.CustomerItem) {
await ElMessageBox.confirm('确定要删除该客户吗?', '提示', { type: 'warning' })
await fetchDeleteCustomer(row.id)
ElMessage.success('删除成功')
await loadData()
}
async function handleBatchDelete() {
const ids = selectedRows.value.map((r) => r.id)
if (!ids.length) return
await ElMessageBox.confirm(`确定删除选中的 ${ids.length} 条客户吗?`, '提示', {
type: 'warning'
})
await withFullscreenLoading(async () => {
for (const id of ids) {
await fetchDeleteCustomer(id)
}
ElMessage.success('批量删除成功')
selectedRows.value = []
await loadData()
}, fullscreenLoadingText.batchDelete)
}
// 输入检索条件时自动搜索(防抖 300ms)
watchDebounced(
[searchForm, createTimeRange],
() => {
pagination.page = 1
loadData()
},
{ debounce: 300, deep: true }
)
const route = useRoute()
const activeTab = ref<TabKey>('storage')
onMounted(() => {
loadData()
const tab = String(route.query.tab || '')
if (tab === 'partner' || tab === 'storage') {
activeTab.value = tab
}
})
</script>
<style scoped lang="scss">
.biz-dialog-form {
:deep(.el-form-item) {
margin-bottom: 0;
}
}
.customer-relations {
.rel-group {
margin-bottom: 14px;
&:last-child {
margin-bottom: 0;
}
}
.rel-group-head {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 8px;
margin-bottom: 8px;
}
.rel-muted {
color: var(--mint-text-muted, #64748b);
font-size: 13px;
}
.rel-link {
padding: 0;
border: 0;
background: transparent;
color: var(--primary, #10b981);
cursor: pointer;
font: inherit;
text-decoration: underline;
text-underline-offset: 2px;
}
}
</style>
@@ -76,6 +76,24 @@
align="center"
header-align="center"
/>
<el-table-column
prop="cellCountQianwan"
label="细胞数量(千万)"
min-width="140"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatNumberOrDash(row.cellCountQianwan) }}</template>
</el-table-column>
<el-table-column
prop="fillVolumeMl"
label="分装体积(ml)"
min-width="130"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatNumberOrDash(row.fillVolumeMl) }}</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
@@ -166,7 +184,27 @@
<el-form-item label="规格名称" prop="specName">
<el-input v-model="formData.specName" placeholder="请输入规格名称" />
</el-form-item>
<el-form-item label="备注">
<el-form-item label="细胞数量(千万)" prop="cellCountQianwan">
<el-input-number
v-model="formData.cellCountQianwan"
:min="0.0001"
:precision="4"
:controls="false"
placeholder="请输入细胞数量"
class="w-full"
/>
</el-form-item>
<el-form-item label="分装体积(ml)" prop="fillVolumeMl">
<el-input-number
v-model="formData.fillVolumeMl"
:min="0.0001"
:precision="4"
:controls="false"
placeholder="请输入分装体积"
class="w-full"
/>
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
<el-input v-model="formData.remark" placeholder="可选" />
</el-form-item>
</div>
@@ -235,15 +273,46 @@
const viewVisible = ref(false)
const viewRow = ref<Api.CellProductSpec.CellProductSpecItem | null>(null)
const formData = reactive({
const formData = reactive<{
specCode: string
specName: string
cellCountQianwan: number | undefined
fillVolumeMl: number | undefined
remark: string
}>({
specCode: '',
specName: '',
cellCountQianwan: undefined,
fillVolumeMl: undefined,
remark: ''
})
const positiveNumberRule = (label: string) => ({
required: true,
validator: (_: unknown, value: number | undefined, callback: (e?: Error) => void) => {
if (value === undefined || value === null || Number.isNaN(Number(value))) {
callback(new Error(`请填写${label}`))
return
}
if (Number(value) <= 0) {
callback(new Error(`${label}必须大于0`))
return
}
callback()
},
trigger: 'blur'
})
const formRules = {
specCode: [{ required: true, message: '请输入规格编码', trigger: 'blur' }],
specName: [{ required: true, message: '请输入规格名称', trigger: 'blur' }]
specName: [{ required: true, message: '请输入规格名称', trigger: 'blur' }],
cellCountQianwan: [positiveNumberRule('细胞数量(千万)')],
fillVolumeMl: [positiveNumberRule('分装体积(ml)')]
}
function formatNumberOrDash(value: number | null | undefined) {
if (value === null || value === undefined || Number.isNaN(Number(value))) return '—'
return String(value)
}
const handleSelectionChange = (rows: Api.CellProductSpec.CellProductSpecItem[]) => {
@@ -259,6 +328,8 @@
fields: [
{ label: '规格编码', value: row.specCode },
{ label: '规格名称', value: row.specName },
{ label: '细胞数量(千万)', value: formatNumberOrDash(row.cellCountQianwan) },
{ label: '分装体积(ml)', value: formatNumberOrDash(row.fillVolumeMl) },
{ label: '备注', value: row.remark, span: true }
]
}
@@ -294,6 +365,8 @@
function resetForm() {
formData.specCode = ''
formData.specName = ''
formData.cellCountQianwan = undefined
formData.fillVolumeMl = undefined
formData.remark = ''
editingId.value = null
}
@@ -312,6 +385,14 @@
editingId.value = row.id
formData.specCode = row.specCode || ''
formData.specName = row.specName || ''
formData.cellCountQianwan =
row.cellCountQianwan === null || row.cellCountQianwan === undefined
? undefined
: Number(row.cellCountQianwan)
formData.fillVolumeMl =
row.fillVolumeMl === null || row.fillVolumeMl === undefined
? undefined
: Number(row.fillVolumeMl)
formData.remark = row.remark || ''
dialogVisible.value = true
formRef.value?.clearValidate?.()
@@ -324,6 +405,8 @@
const payload = {
specCode: formData.specCode.trim(),
specName: formData.specName.trim(),
cellCountQianwan: Number(formData.cellCountQianwan),
fillVolumeMl: Number(formData.fillVolumeMl),
remark: formData.remark?.trim() || undefined
}
if (isEdit.value && editingId.value) {
@@ -401,5 +484,17 @@
:deep(.el-form-item) {
margin-bottom: 0;
}
:deep(.el-input-number.w-full) {
width: 100%;
.el-input__inner {
text-align: left;
}
}
:deep(.el-form-item__error) {
text-align: left;
}
}
</style>
@@ -0,0 +1,277 @@
<!-- 临床科研 / 委托加工 · 费用信息(申请单交付计划费用只读列表) -->
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="page-container">
<section class="panel">
<div class="panel-top">
<h2 class="title-bar-heading">费用信息</h2>
</div>
<div class="filter-block">
<el-form :model="searchForm" class="filter-form" @submit.prevent>
<div class="filter-grid">
<el-form-item label="关键词">
<el-input
v-model="searchForm.keyword"
placeholder="申请单号/课题名称/客户名称"
clearable
@keyup.enter="handleSearch"
/>
</el-form-item>
<el-form-item :label="pickupTimeLabel">
<el-date-picker
v-model="searchForm.infusionTimeRange"
type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss"
start-placeholder="开始时间"
end-placeholder="结束时间"
style="width: 100%"
/>
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
<el-button class="btn-ghost" @click="handleReset">
<el-icon><RefreshLeft /></el-icon>重置
</el-button>
<el-button class="btn-main" type="primary" @click="handleSearch">
<el-icon><Search /></el-icon>搜索
</el-button>
</div>
</div>
</el-form>
</div>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="tableData"
v-loading="loading"
stripe
row-key="id"
@row-dblclick="handleView"
>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index: number) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column
prop="applicationNo"
label="申请单号"
min-width="150"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
prop="projectTitle"
label="课题名称"
min-width="160"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.projectTitle || '—' }}</template>
</el-table-column>
<el-table-column
prop="customerName"
label="客户名称"
min-width="130"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.customerName || '—' }}</template>
</el-table-column>
<el-table-column
label="细胞产品"
min-width="150"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ cellProductLabel(row) }}</template>
</el-table-column>
<el-table-column
prop="specText"
label="规格"
min-width="100"
align="center"
header-align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.specText || '—' }}</template>
</el-table-column>
<el-table-column
label="参考单价(元)"
min-width="120"
align="right"
header-align="center"
>
<template #default="{ row }">{{ moneyOrDash(row.agreementPrice) }}</template>
</el-table-column>
<el-table-column
label="实际单价(元)"
min-width="120"
align="right"
header-align="center"
>
<template #default="{ row }">{{ moneyOrDash(row.actualPrice) }}</template>
</el-table-column>
<el-table-column label="份数" min-width="80" align="center" header-align="center">
<template #default="{ row }">{{
row.quantity != null && row.quantity !== '' ? row.quantity : '—'
}}</template>
</el-table-column>
<el-table-column label="金额(元)" min-width="120" align="right" header-align="center">
<template #default="{ row }">{{ moneyOrDash(resolveFeeAmount(row)) }}</template>
</el-table-column>
<el-table-column
prop="infusionTime"
:label="pickupTimeLabel"
min-width="160"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatDisplayOrDash(row.infusionTime) }}</template>
</el-table-column>
<el-table-column
label="操作"
min-width="120"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:page-sizes="[10, 20, 50, 100]"
layout="total, sizes, prev, pager, next, jumper"
@update:current-page="(val: number) => (pagination.page = val)"
@update:page-size="(val: number) => (pagination.pageSize = val)"
@size-change="loadData"
@current-change="loadData"
/>
</div>
</div>
</section>
<ApplicationViewDialog v-model="viewDialogVisible" :application-id="viewApplicationId" />
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, reactive, ref } from 'vue'
import { RefreshLeft, Search, View } from '@element-plus/icons-vue'
import { fetchInfusionScheduleMgmtList } from '@/api/admin'
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { formatMoneyDisplay } from '@/utils/money-format'
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
import ApplicationViewDialog from '../pilot-application/ApplicationViewDialog.vue'
defineOptions({ name: 'PilotFeeInfo' })
const props = defineProps<{ bizType?: string }>()
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
const pickupTimeLabel = computed(() => bizConfig.value.pickupTimeLabel)
const searchForm = reactive({
keyword: '',
infusionTimeRange: null as string[] | null
})
const loading = ref(false)
const tableData = ref<any[]>([])
const pagination = reactive({ page: 1, pageSize: 10, total: 0 })
const viewDialogVisible = ref(false)
const viewApplicationId = ref('')
function moneyOrDash(value: unknown) {
if (value === null || value === undefined || value === '') return '—'
const text = formatMoneyDisplay(value as string | number, 2)
return text ? text : '—'
}
function cellProductLabel(row: Record<string, unknown>) {
const name = String(row.projectName || '').trim()
if (name) return name
const cell = String(row.cellType || row.cellTypeName || '').trim()
return cell || '—'
}
function resolveFeeAmount(row: Record<string, unknown>) {
if (row.feeAmount != null && row.feeAmount !== '') return row.feeAmount
const price = Number(row.actualPrice)
const qty = Number(row.quantity)
if (!Number.isNaN(price) && !Number.isNaN(qty) && qty > 0) {
return Math.round(price * qty * 100) / 100
}
return null
}
async function loadData() {
loading.value = true
try {
const params: Record<string, unknown> = {
page: pagination.page,
pageSize: pagination.pageSize,
keyword: searchForm.keyword || undefined,
bizType: resolvePilotBizType(props.bizType)
}
if (searchForm.infusionTimeRange?.length === 2) {
params.infusionTimeStart = searchForm.infusionTimeRange[0]
params.infusionTimeEnd = searchForm.infusionTimeRange[1]
}
const res: any = await fetchInfusionScheduleMgmtList(params)
const data = res?.data ?? res
tableData.value = data?.list ?? data?.records ?? []
pagination.total = data?.pagination?.total ?? data?.total ?? 0
} catch (e) {
console.error('加载费用信息失败:', e)
tableData.value = []
pagination.total = 0
} finally {
loading.value = false
}
}
function handleSearch() {
pagination.page = 1
loadData()
}
function handleReset() {
searchForm.keyword = ''
searchForm.infusionTimeRange = null
pagination.page = 1
loadData()
}
function handleView(row: Record<string, unknown>) {
const appId = String(row.pilotApplicationId || '').trim()
if (!appId) return
viewApplicationId.value = appId
viewDialogVisible.value = true
}
onMounted(() => {
loadData()
})
</script>
@@ -15,7 +15,7 @@
@update:model-value="emit('update:modelValue', $event)"
@closed="handleClosed"
>
<div v-if="scheduleSummary" class="material-summary">
<div v-if="scheduleSummary && !cellsOnly" class="material-summary">
<div class="material-summary-row">
<span class="material-summary-label">申请单号</span>
<span class="material-summary-value">{{ scheduleSummary.applicationNo || '—' }}</span>
@@ -31,13 +31,215 @@
</div>
<div v-loading="loading" class="handover-body">
<template v-if="cellsOnly">
<section class="section-card section-card--white">
<div class="section-title section-title--banner"><h3>申请单信息</h3></div>
<div class="data-grid data-grid--5">
<div class="data-item">
<div class="data-label">所属项目</div>
<div class="data-value">{{ applicationDetail.projectName || '未归属' }}</div>
</div>
<div class="data-item">
<div class="data-label">项目组</div>
<div class="data-value">{{ applicationDetail.teamName || '—' }}</div>
</div>
<div class="data-item">
<div class="data-label">申请单名称</div>
<div class="data-value">{{ dash(applicationDetail.applicationName) }}</div>
</div>
<div class="data-item">
<div class="data-label">业务类型</div>
<div class="data-value">
{{ dash(clinicalResearchCategoryLabel(applicationDetail.researchCategory)) }}
</div>
</div>
<div class="data-item">
<div class="data-label">课题名称</div>
<div class="data-value">{{ dash(applicationDetail.projectTitle) }}</div>
</div>
<div class="data-item">
<div class="data-label">客户名称</div>
<div class="data-value">{{ dash(applicationDetail.customerName) }}</div>
</div>
<div class="data-item">
<div class="data-label">客户联系人</div>
<div class="data-value">{{ dash(applicationDetail.customerContact) }}</div>
</div>
<div class="data-item">
<div class="data-label">客户联系方式</div>
<div class="data-value">{{ dash(applicationDetail.customerPhone) }}</div>
</div>
<div class="data-item">
<div class="data-label">审批状态</div>
<div class="data-value">
<el-tag
v-if="applicationDetail.approvalStatus"
:type="applicationApprovalStatusTagType(applicationDetail.approvalStatus)"
size="small"
>
{{ applicationApprovalStatusLabel(applicationDetail.approvalStatus) }}
</el-tag>
<span v-else>—</span>
</div>
</div>
<div class="data-item">
<div class="data-label">创建时间</div>
<div class="data-value">{{ dash(applicationDetail.createTime) }}</div>
</div>
</div>
<div v-if="applicationDetail.remark" class="data-item data-item--remark">
<div class="data-label">备注</div>
<div class="data-value data-value--muted">{{ dash(applicationDetail.remark) }}</div>
</div>
</section>
<section class="section-card section-card--white">
<div class="section-title section-title--banner"><h3>{{ deliveryPlanLabel }}</h3></div>
<div v-if="deliveryPlanRows.length" class="schedule-details">
<div
v-for="(schedule, sIdx) in deliveryPlanRows"
:key="schedule.id || sIdx"
class="schedule-card"
:class="{ expanded: schedule._expanded }"
>
<div class="schedule-header" @click="toggleDeliveryExpand(sIdx)">
<span class="schedule-chevron">▶</span>
<span class="schedule-title">{{ deliveryPlanLabel }} #{{ sIdx + 1 }}</span>
</div>
<div v-show="schedule._expanded" class="schedule-body">
<div class="schedule-body-inner">
<div class="data-grid data-grid--3">
<div class="data-item">
<div class="data-label">{{ pickupTimeLabel }}</div>
<div class="data-value">{{ dash(schedule.infusionTime) }}</div>
</div>
</div>
<div class="data-grid data-grid--3 schedule-status-grid">
<div class="data-item">
<div class="data-label">计划生产状态</div>
<div class="data-value">
<el-tag
v-if="schedule.scheduleStatus"
:type="scheduleStatusTagType(schedule.scheduleStatus)"
size="small"
>
{{ scheduleStatusLabel(schedule.scheduleStatus) }}
</el-tag>
<span v-else>—</span>
</div>
</div>
<div class="data-item">
<div class="data-label">质检状态</div>
<div class="data-value">
<el-tag
v-if="schedule.qcStatus"
:type="qcStatusTagType(schedule.qcStatus)"
size="small"
>
{{ qcStatusLabel(schedule.qcStatus) }}
</el-tag>
<span v-else>—</span>
</div>
</div>
</div>
<div class="cell-product-block">
<div class="section-subtitle">细胞产品</div>
<div
v-if="scheduleCellProducts(schedule).length"
class="list-body list-wrap view-inner-table-wrap"
>
<el-table
:data="scheduleCellProducts(schedule)"
stripe
class="list-table inner-table"
>
<el-table-column
prop="projectName"
label="细胞项目名称"
min-width="150"
show-overflow-tooltip
>
<template #default="{ row }">
{{ formatDeliveryProduct(row) }}
</template>
</el-table-column>
<el-table-column
prop="cellTypeName"
label="细胞类型"
min-width="100"
show-overflow-tooltip
>
<template #default="{ row }">
{{ row.cellTypeName || row.cellType || '—' }}
</template>
</el-table-column>
<el-table-column
prop="specText"
label="规格"
min-width="100"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.specText || '—' }}</template>
</el-table-column>
<el-table-column
label="协议单价(元)"
min-width="130"
align="center"
header-align="center"
>
<template #default="{ row }">
¥{{ formatMoneyDisplay(row.agreementPrice, 2) }}
</template>
</el-table-column>
<el-table-column
label="实际单价(元)"
min-width="130"
align="center"
header-align="center"
>
<template #default="{ row }">
¥{{ formatMoneyDisplay(row.actualPrice, 2) }}
</template>
</el-table-column>
<el-table-column
prop="quantity"
label="份数"
min-width="80"
align="center"
header-align="center"
>
<template #default="{ row }">{{ row.quantity ?? '—' }}</template>
</el-table-column>
<el-table-column
prop="remark"
label="备注"
min-width="120"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.remark || '—' }}</template>
</el-table-column>
</el-table>
</div>
<el-empty v-else description="暂无细胞产品" :image-size="32" />
</div>
</div>
</div>
</div>
</div>
<el-empty v-else description="暂无交付计划" :image-size="48" />
</section>
</template>
<OutboundMaterialFormSections
ref="materialSectionsRef"
require-frozen-cell-product
:cells-readonly="isBasicExperiment"
:cells-readonly="cellsSectionReadonly"
:hide-cell-ops="!!cellsOnly"
:show-materials="!cellsOnly"
:show-papers="!cellsOnly"
/>
<section class="section-card handover-form-section">
<section v-if="!cellsOnly" class="section-card handover-form-section">
<h3 class="section-title section-title--mint-bar">交接信息</h3>
<el-form label-position="top" class="biz-dialog-form">
<div class="form-grid-3">
@@ -51,6 +253,7 @@
placeholder="搜索并选择用户"
:remote-method="remoteSearchHandoverUsers"
:loading="handoverUserLoading"
:disabled="handoverFieldsReadonly"
class="w-full"
@change="onHandoverUserChange"
>
@@ -69,6 +272,7 @@
value-format="YYYY-MM-DD HH:mm:ss"
format="YYYY-MM-DD HH:mm:ss"
placeholder="选择交接时间"
:disabled="handoverFieldsReadonly"
style="width: 100%"
/>
</el-form-item>
@@ -78,6 +282,7 @@
placeholder="可选"
maxlength="200"
clearable
:disabled="handoverFieldsReadonly"
/>
</el-form-item>
<el-form-item label="接收人" required>
@@ -86,6 +291,7 @@
placeholder="请输入接收人"
maxlength="200"
clearable
:disabled="handoverFieldsReadonly"
/>
</el-form-item>
<el-form-item label="细胞用途">
@@ -94,6 +300,7 @@
placeholder="请输入细胞用途"
maxlength="200"
clearable
:disabled="handoverFieldsReadonly"
/>
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
@@ -104,16 +311,18 @@
placeholder="可选"
maxlength="512"
show-word-limit
:disabled="handoverFieldsReadonly"
/>
</el-form-item>
<el-form-item label="附件" class="form-col-span-2">
<div
class="attachment-upload"
:class="{ 'is-dragover': isHandoverAttachDragover }"
v-bind="handoverAttachDropHandlers"
:class="{ 'is-dragover': isHandoverAttachDragover && !handoverFieldsReadonly }"
v-bind="handoverFieldsReadonly ? {} : handoverAttachDropHandlers"
>
<div class="attachment-list">
<el-upload
v-if="!handoverFieldsReadonly"
ref="attachmentUploadRef"
:auto-upload="false"
:show-file-list="false"
@@ -166,6 +375,7 @@
<Download />
</el-icon>
<el-icon
v-if="!handoverFieldsReadonly"
class="action-btn action-btn--danger"
title="删除"
@click.stop="removeAttachment(fIdx)"
@@ -176,7 +386,7 @@
</div>
</div>
</div>
<span class="upload-hint"
<span v-if="!handoverFieldsReadonly" class="upload-hint"
>支持拖拽或点击上传图片、视频、PDF、Word、Excel 等文件,单文件不超过 20MB</span
>
</div>
@@ -236,7 +446,7 @@
Loading,
VideoPlay
} from '@element-plus/icons-vue'
import { fetchUserList } from '@/api/admin'
import { fetchUserList, fetchPilotApplicationDetail } from '@/api/admin'
import { fetchUploadAttachment } from '@/api/business'
import { useAttachmentDropZone } from '@/composables/useAttachmentDropZone'
import {
@@ -248,6 +458,16 @@
import { downloadAttachmentFile } from '@/utils/download-attachment'
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
import { isResearchLikeBiz } from '@/utils/research-like-biz'
import { clinicalResearchCategoryLabel } from '@/constants/clinical-research-category'
import { formatMoneyDisplay } from '@/utils/money-format'
import {
applicationApprovalStatusLabel,
applicationApprovalStatusTagType,
scheduleStatusLabel,
scheduleStatusTagType,
qcStatusLabel,
qcStatusTagType
} from '@/utils/status-tag-registry'
type AttachmentItem = {
id: string
@@ -263,15 +483,117 @@
modelValue: boolean
scheduleId: string
scheduleRow?: Record<string, any> | null
applicationId?: string
bizType?: string
/** 生产出库:隐藏物料/纸质材料;仅可添加出库细胞 */
cellsOnly?: boolean
}>()
const pickupTimeLabel = computed(
() => getPilotBizConfig(resolvePilotBizType(props.bizType)).pickupTimeLabel
)
const isBasicExperiment = computed(
() => isResearchLikeBiz(props.bizType)
const deliveryPlanLabel = computed(
() => getPilotBizConfig(resolvePilotBizType(props.bizType)).planLabel
)
/** 市场科研 / 委托加工(非生产出库):出库细胞只读 */
const isResearchLikeHandover = computed(() => isResearchLikeBiz(props.bizType))
const cellsSectionReadonly = computed(
() => isResearchLikeHandover.value && !props.cellsOnly
)
/** 生产出库:交接信息等只读,仅可添加出库细胞 */
const handoverFieldsReadonly = computed(() => !!props.cellsOnly)
const applicationDetail = reactive({
teamName: '',
projectName: '',
applicationName: '',
researchCategory: '',
projectTitle: '',
customerName: '',
customerContact: '',
customerPhone: '',
approvalStatus: '',
createTime: '',
remark: ''
})
const deliveryPlanRows = ref<any[]>([])
const dash = (v: unknown) => {
const s = v == null ? '' : String(v).trim()
return s || '—'
}
function resetApplicationPanels() {
applicationDetail.teamName = ''
applicationDetail.projectName = ''
applicationDetail.applicationName = ''
applicationDetail.researchCategory = ''
applicationDetail.projectTitle = ''
applicationDetail.customerName = ''
applicationDetail.customerContact = ''
applicationDetail.customerPhone = ''
applicationDetail.approvalStatus = ''
applicationDetail.createTime = ''
applicationDetail.remark = ''
deliveryPlanRows.value = []
}
function formatDeliveryProduct(row: any) {
const name = row.projectName || row.cellType || row.cellTypeName || ''
const cell = row.cellTypeName || row.cellType || ''
if (name && cell && name !== cell) return `${name}(${cell})`
return name || cell || '—'
}
function scheduleCellProducts(schedule: any): any[] {
if (Array.isArray(schedule?.cellProducts) && schedule.cellProducts.length) {
return schedule.cellProducts
}
// 科研类交付计划常为单产品行挂在计划上
if (schedule?.projectName || schedule?.priceId || schedule?.specText) {
return [schedule]
}
return []
}
function toggleDeliveryExpand(index: number) {
const row = deliveryPlanRows.value[index]
if (!row) return
row._expanded = !row._expanded
}
async function loadApplicationPanels() {
if (!props.cellsOnly) {
resetApplicationPanels()
return
}
const appId = (props.applicationId || '').trim()
if (!appId) {
resetApplicationPanels()
return
}
try {
const res: any = await fetchPilotApplicationDetail({ id: appId })
const detail = res?.data ?? res
applicationDetail.teamName = String(detail?.teamName || '')
applicationDetail.projectName = String(detail?.projectName || '')
applicationDetail.applicationName = String(detail?.applicationName || '')
applicationDetail.researchCategory = String(detail?.researchCategory || '')
applicationDetail.projectTitle = String(detail?.projectTitle || '')
applicationDetail.customerName = String(detail?.customerName || '')
applicationDetail.customerContact = String(detail?.customerContact || '')
applicationDetail.customerPhone = String(detail?.customerPhone || '')
applicationDetail.approvalStatus = String(detail?.approvalStatus || '')
applicationDetail.createTime = String(detail?.createTime || '')
applicationDetail.remark = String(detail?.remark || '')
deliveryPlanRows.value = (detail?.infusionSchedules || [])
.filter((s: any) => String(s.infusionStatus || '') !== 'yqx')
.map((s: any) => ({ ...s, _expanded: true }))
} catch (e) {
console.error(e)
resetApplicationPanels()
}
}
const emit = defineEmits<{
(e: 'update:modelValue', val: boolean): void
@@ -542,6 +864,7 @@
patientName: props.scheduleRow?.patientName,
infusionTime: props.scheduleRow?.infusionTime
}
await loadApplicationPanels()
await materialSectionsRef.value?.remoteSearchMaterials('')
await materialSectionsRef.value?.loadFromApiData({
remark: data.outboundMaterial?.remark,
@@ -550,13 +873,18 @@
paperMaterials: data.outboundMaterial?.paperMaterials
})
fillHandoverFromApi(data.handover)
if (props.cellsOnly) {
// 生产出库:交接信息只读,缺省时补默认交接人/时间以便保存
if (!handoverUserId.value) applyDefaultHandoverUser()
if (!handoverTime.value) handoverTime.value = formatNowDatetime()
}
} finally {
loading.value = false
}
}
watch(
() => [props.modelValue, props.scheduleId] as const,
() => [props.modelValue, props.scheduleId, props.applicationId] as const,
([vis, id]) => {
if (vis && id) {
nextTick(() => loadData())
@@ -568,6 +896,7 @@
function handleClosed() {
materialSectionsRef.value?.resetState()
scheduleSummary.value = null
resetApplicationPanels()
resetHandoverForm()
}
@@ -576,6 +905,11 @@
const sections = materialSectionsRef.value
if (!sections?.validateMaterial()) return
if (props.cellsOnly) {
if (!handoverUserId.value) applyDefaultHandoverUser()
if (!handoverTime.value) handoverTime.value = formatNowDatetime()
}
if (!handoverUserId.value?.trim()) {
ElMessage.warning('请选择交接人')
return
@@ -584,7 +918,7 @@
ElMessage.warning('请选择交接时间')
return
}
if (!receiverPerson.value?.trim()) {
if (!props.cellsOnly && !receiverPerson.value?.trim()) {
ElMessage.warning('请填写接收人')
return
}
@@ -606,7 +940,7 @@
handoverUserId: handoverUserId.value.trim(),
handoverTime: handoverTime.value.trim(),
handoverLocation: handoverLocation.value.trim() || undefined,
receiverPerson: receiverPerson.value.trim(),
receiverPerson: receiverPerson.value.trim() || (props.cellsOnly ? '—' : ''),
cellPurpose: cellPurpose.value.trim() || undefined,
attachments: attachmentUrls || undefined,
remark: handoverRemark.value.trim() || undefined
@@ -837,4 +1171,134 @@
color: #dc2626;
}
}
.section-card--white {
background: #fff;
}
.section-title--banner {
margin: 0 0 14px;
padding: 8px 12px;
border-radius: 8px;
background: linear-gradient(90deg, #ecfdf5 0%, #f0fdf4 100%);
border: 1px solid #d1fae5;
h3 {
margin: 0;
font-size: 14px;
font-weight: 600;
color: var(--primary-dark, #059669);
}
}
.data-grid {
display: grid;
gap: 14px 20px;
&--3 {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
&--5 {
grid-template-columns: repeat(5, minmax(0, 1fr));
}
}
.data-item {
min-width: 0;
&--remark {
margin-top: 14px;
}
}
.data-label {
font-size: 12px;
color: var(--mint-text-muted, #334155);
margin-bottom: 3px;
}
.data-value {
font-size: 14px;
color: #1e293b;
font-weight: 500;
word-break: break-word;
&--muted {
color: var(--mint-text-muted, #334155);
font-weight: 400;
}
}
.schedule-details {
display: flex;
flex-direction: column;
gap: 12px;
}
.schedule-card {
border: 1px solid #e2e8f0;
border-radius: 10px;
overflow: hidden;
&.expanded {
border-color: #a8d4c4;
}
}
.schedule-header {
display: flex;
align-items: center;
gap: 10px;
padding: 14px 18px;
cursor: pointer;
background: #f8fafc;
&:hover {
background: #f0fdf4;
}
}
.schedule-chevron {
font-size: 12px;
color: var(--mint-text-muted, #334155);
transition: transform 0.3s;
}
.expanded .schedule-chevron {
transform: rotate(90deg);
}
.schedule-title {
font-size: 14px;
font-weight: 500;
color: #1e293b;
}
.schedule-body-inner {
padding: 18px;
}
.schedule-status-grid {
margin-top: 12px;
}
.cell-product-block {
margin-top: 14px;
}
.section-subtitle {
font-size: 13px;
font-weight: 600;
color: #334155;
margin-bottom: 8px;
}
.view-inner-table-wrap {
margin-top: 4px;
border: 1px solid #e2e8f0;
border-radius: 10px;
overflow: hidden;
background: #fff;
}
</style>
@@ -48,7 +48,13 @@
<section class="section-card">
<div class="section-head">
<h3 class="section-title section-title--mint-bar">出库细胞</h3>
<el-button type="primary" size="small" class="btn-main" @click="openCellSelect">
<el-button
v-if="!hideAddCellProduct"
type="primary"
size="small"
class="btn-main"
@click="openCellSelect"
>
<el-icon><Plus /></el-icon>
添加细胞产品
</el-button>
@@ -59,7 +65,7 @@
class="list-table inner-table"
stripe
max-height="280"
empty-text="请从细胞产品库勾选"
:empty-text="hideAddCellProduct ? '暂无出库细胞' : '请从细胞产品库勾选'"
>
<el-table-column
type="index"
@@ -452,6 +458,7 @@
import { cellProductStatusLabel, cellProductStatusTagType } from '@/utils/status-tag-registry'
import { resolveCellProductSpecDisplay } from '@/utils/cell-product-spec'
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
import { isResearchLikeBiz } from '@/utils/research-like-biz'
import CellProductLineageQcDialog from '@/components/business/cell-product-lineage-qc-dialog/index.vue'
type AttachmentLike = {
@@ -501,6 +508,8 @@
const bizConfig = computed(() => getPilotBizConfig(resolvePilotBizType(props.bizType)))
const pickupTimeLabel = computed(() => bizConfig.value.pickupTimeLabel)
const showPatient = computed(() => bizConfig.value.showPatient)
/** 临床科研/委托加工:出库细胞由生产部交接添加,市场出库物料不提供添加入口 */
const hideAddCellProduct = computed(() => isResearchLikeBiz(props.bizType))
const emit = defineEmits<{
(e: 'update:modelValue', val: boolean): void
@@ -0,0 +1,187 @@
<!-- 出库放行审核 · 表格列表(临床科研 / 委托加工) -->
<template>
<div class="list-body list-wrap">
<el-table
class="list-table"
:data="rows"
v-loading="loading"
stripe
:row-key="rowKeyOf"
@selection-change="handleSelectionChange"
@row-dblclick="(row) => emit('view', row)"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
header-align="center"
:index="(index) => (page - 1) * pageSize + index + 1"
/>
<el-table-column
prop="applicationNo"
label="申请单号"
min-width="180"
show-overflow-tooltip
>
<template #default="{ row }">
<el-button link type="primary" @click="emit('view', row)">
{{ row.applicationNo || '—' }}
</el-button>
</template>
</el-table-column>
<el-table-column
prop="projectTitle"
label="课题名称"
min-width="160"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.projectTitle || '—' }}</template>
</el-table-column>
<el-table-column
prop="customerName"
label="客户名称"
min-width="140"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.customerName || '—' }}</template>
</el-table-column>
<el-table-column
prop="infusionTime"
:label="pickupTimeLabel"
min-width="160"
align="center"
>
<template #default="{ row }">{{ formatDisplayOrDash(row.infusionTime) }}</template>
</el-table-column>
<el-table-column prop="scheduleStatus" label="计划状态" min-width="110" align="center">
<template #default="{ row }">
<el-tag
v-if="row.scheduleStatus"
:type="scheduleStatusTagType(row.scheduleStatus)"
size="small"
>
{{ scheduleStatusLabel(row.scheduleStatus) }}
</el-tag>
<span v-else>—</span>
</template>
</el-table-column>
<el-table-column prop="qcStatus" label="质检状态" min-width="110" align="center">
<template #default="{ row }">
<el-tag v-if="row.qcStatus" :type="qcStatusTagType(row.qcStatus)" size="small">
{{ qcStatusLabel(row.qcStatus) }}
</el-tag>
<span v-else>—</span>
</template>
</el-table-column>
<el-table-column prop="reviewConclusion" label="审核结论" min-width="110" align="center">
<template #default="{ row }">
<el-tag
v-if="row.reviewConclusion"
:type="storageReleaseConclusionTagType(row.reviewConclusion)"
size="small"
>
{{ storageReleaseConclusionLabel(row.reviewConclusion) }}
</el-tag>
<el-tag v-else type="info" size="small">待审核</el-tag>
</template>
</el-table-column>
<el-table-column
prop="reviewByName"
label="审核人"
min-width="100"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.reviewByName || '—' }}</template>
</el-table-column>
<el-table-column prop="reviewTime" label="审核时间" min-width="160" align="center">
<template #default="{ row }">{{ formatDisplayOrDash(row.reviewTime) }}</template>
</el-table-column>
<el-table-column
label="操作"
min-width="280"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div class="op-actions">
<el-button class="btn-op-item primary" type="primary" @click="emit('review', row)">
<el-icon><CircleCheck /></el-icon>审核
</el-button>
<el-button class="btn-op-item" @click="emit('view', row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-button class="btn-op-item" @click="emit('material', row)">
<el-icon><Box /></el-icon>出库物料
</el-button>
</div>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="page"
:page-size="pageSize"
:total="total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="(v) => emit('page-size-change', v)"
@current-change="(v) => emit('page-change', v)"
/>
</div>
</div>
</template>
<script setup lang="ts">
import { formatDisplayOrDash } from '@/utils/datetime-display'
import { View, CircleCheck, Box } from '@element-plus/icons-vue'
import type { OutboundReleaseReview } from '@/api/outbound-release-review'
import {
storageReleaseConclusionLabel,
storageReleaseConclusionTagType,
scheduleStatusLabel,
scheduleStatusTagType,
qcStatusLabel,
qcStatusTagType
} from '@/utils/status-tag-registry'
defineOptions({ name: 'OutboundReleaseReviewTableList' })
defineProps<{
rows: OutboundReleaseReview[]
loading: boolean
page: number
pageSize: number
total: number
pickupTimeLabel: string
}>()
const emit = defineEmits<{
view: [row: OutboundReleaseReview]
material: [row: OutboundReleaseReview]
review: [row: OutboundReleaseReview]
'selection-change': [rows: OutboundReleaseReview[]]
'page-change': [page: number]
'page-size-change': [size: number]
}>()
function rowKeyOf(row: OutboundReleaseReview) {
return String(row.scheduleId || row.id || '')
}
function handleSelectionChange(selection: OutboundReleaseReview[]) {
emit('selection-change', selection)
}
</script>
<style scoped lang="scss">
.op-actions {
display: flex;
justify-content: center;
gap: 8px;
flex-wrap: wrap;
}
</style>
@@ -95,7 +95,23 @@
</div>
</div>
<OutboundReleaseReviewTableList
v-if="isBasicExperiment"
:rows="tableData"
:loading="loading"
:page="pagination.page"
:page-size="pagination.pageSize"
:total="pagination.total"
:pickup-time-label="pickupTimeLabel"
@selection-change="handleSelectionChange"
@view="handleView"
@material="openMaterialDialog"
@review="openReviewDialog"
@page-change="(val) => ((pagination.page = val), loadData())"
@page-size-change="(val) => ((pagination.page = 1), (pagination.pageSize = val), loadData())"
/>
<OutboundReleaseReviewCardList
v-else
:rows="tableData"
:loading="loading"
:page="pagination.page"
@@ -145,6 +161,7 @@
import OutboundReleaseReviewDialog from './OutboundReleaseReviewDialog.vue'
import OutboundReleaseMaterialDialog from './OutboundReleaseMaterialDialog.vue'
import OutboundReleaseReviewCardList from './OutboundReleaseReviewCardList.vue'
import OutboundReleaseReviewTableList from './OutboundReleaseReviewTableList.vue'
import {
fetchOutboundReleaseReviewList,
type OutboundReleaseReview
@@ -210,6 +227,10 @@
selectedRows.value = selectedRows.value.filter((r) => rowId(r) !== id)
}
function handleSelectionChange(rows: OutboundReleaseReview[]) {
selectedRows.value = rows
}
const canBatchReview = computed(() => selectedRows.value.length > 0)
async function loadData() {
@@ -0,0 +1,244 @@
<!-- 临床科研/委托加工申请单 — 项目负责人审批 -->
<template>
<el-dialog
:model-value="modelValue"
title="申请单审批"
width="560px"
class="dialog-form-layout"
align-center
append-to-body
destroy-on-close
:close-on-click-modal="false"
@update:model-value="emit('update:modelValue', $event)"
@closed="resetForm"
>
<p v-if="targets.length" class="audit-target-hint">
<template v-if="targets.length === 1">
申请单号:
<strong>{{ targets[0].applicationNo || '-' }}</strong>
<template v-if="targets[0].projectTitle">
· {{ targets[0].projectTitle }}
</template>
</template>
<template v-else>
已选 <strong>{{ targets.length }}</strong> 条,将一并提交相同审批结论:
<span class="audit-target-list">{{ targetNosPreview }}</span>
</template>
</p>
<el-form
ref="formRef"
:model="form"
:rules="rules"
label-position="top"
class="biz-dialog-form"
@submit.prevent
>
<el-form-item label="审批结论" prop="approvalStatus">
<div class="approval-conclusion-group">
<el-button
:type="form.approvalStatus === 'ytg' ? 'primary' : 'default'"
class="approval-conclusion-btn"
@click="selectConclusion('ytg')"
>
通过
</el-button>
<el-button
:type="form.approvalStatus === 'yth' ? 'danger' : 'default'"
class="approval-conclusion-btn"
@click="selectConclusion('yth')"
>
驳回
</el-button>
</div>
</el-form-item>
<el-form-item label="审批备注">
<el-input
v-model="form.approvalRemark"
type="textarea"
:rows="3"
placeholder="可选;驳回时建议填写原因"
maxlength="1000"
show-word-limit
/>
</el-form-item>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
<el-icon><Close /></el-icon>
取消
</el-button>
<el-button
class="btn-main"
type="primary"
:loading="submitting"
@click="handleSubmit"
>
<el-icon><Check /></el-icon>
确定
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import type { FormInstance, FormRules } from 'element-plus'
import { ElMessage } from 'element-plus'
import { Check, Close } from '@element-plus/icons-vue'
import { approvePilotApplication } from '@/api/admin'
import { withFullscreenLoading, fullscreenLoadingText } from '@/utils/fullscreen-loading'
defineOptions({ name: 'ApplicationApproveDialog' })
const props = defineProps<{
modelValue: boolean
/** 单条审批兼容 */
target?: Record<string, any> | null
/** 批量审批;优先于 target */
targets?: Record<string, any>[]
/** 工具栏「审批/驳回」预填结论 */
initialConclusion?: '' | 'ytg' | 'yth'
}>()
const emit = defineEmits<{
(e: 'update:modelValue', val: boolean): void
(e: 'submitted'): void
}>()
const formRef = ref<FormInstance>()
const submitting = ref(false)
const form = reactive({
approvalStatus: '' as '' | 'ytg' | 'yth',
approvalRemark: ''
})
const targets = computed(() => {
if (props.targets?.length) return props.targets
return props.target?.id ? [props.target] : []
})
const targetNosPreview = computed(() => {
const nos = targets.value.map((row) => row.applicationNo || row.id || '-').filter(Boolean)
if (nos.length <= 5) return nos.join('、')
return `${nos.slice(0, 5).join('、')} 等`
})
const rules: FormRules = {
approvalStatus: [{ required: true, message: '请选择审批结论', trigger: 'change' }]
}
const selectConclusion = (value: 'ytg' | 'yth') => {
form.approvalStatus = value
formRef.value?.clearValidate('approvalStatus')
}
const syncFromTargets = () => {
const list = targets.value
const preset = props.initialConclusion
if (preset === 'ytg' || preset === 'yth') {
form.approvalStatus = preset
form.approvalRemark =
list.length === 1 ? String(list[0]?.approvalRemark || '') : ''
} else if (list.length === 1) {
const status = String(list[0]?.approvalStatus || '')
form.approvalStatus = status === 'ytg' || status === 'yth' ? status : 'ytg'
form.approvalRemark = String(list[0]?.approvalRemark || '')
} else {
form.approvalStatus = 'ytg'
form.approvalRemark = ''
}
formRef.value?.clearValidate()
}
const resetForm = () => {
form.approvalStatus = ''
form.approvalRemark = ''
formRef.value?.clearValidate()
}
watch(
() =>
[props.modelValue, props.target, props.targets, props.initialConclusion] as const,
([visible]) => {
if (visible) syncFromTargets()
},
{ immediate: true }
)
const handleSubmit = async () => {
const ok = await formRef.value?.validate().catch(() => false)
const list = targets.value.filter((row) => row?.id)
if (!ok || !list.length) return
if (form.approvalStatus !== 'ytg' && form.approvalStatus !== 'yth') {
ElMessage.warning('请选择通过或驳回')
return
}
submitting.value = true
try {
await withFullscreenLoading(async () => {
const failures: string[] = []
for (const row of list) {
try {
await approvePilotApplication({
id: row.id,
approvalStatus: form.approvalStatus as 'ytg' | 'yth',
approvalRemark: form.approvalRemark || undefined
})
} catch (e: any) {
failures.push(
`${row.applicationNo || row.id}:${e?.message || '失败'}`
)
}
}
if (failures.length === list.length) {
throw new Error(failures.join(';') || '审批失败')
}
if (failures.length) {
ElMessage.warning(
`成功 ${list.length - failures.length} 条,失败 ${failures.length} 条:${failures.join(';')}`
)
} else {
ElMessage.success(
list.length > 1
? form.approvalStatus === 'ytg'
? `已通过 ${list.length} 条`
: `已驳回 ${list.length} 条`
: form.approvalStatus === 'ytg'
? '已通过'
: '已驳回'
)
}
}, fullscreenLoadingText.save)
emit('update:modelValue', false)
emit('submitted')
} catch (e: any) {
ElMessage.error(e?.message || '审批失败')
} finally {
submitting.value = false
}
}
</script>
<style scoped>
.audit-target-hint {
margin: 0 0 16px;
color: var(--el-text-color-regular);
line-height: 1.5;
}
.audit-target-list {
display: inline;
word-break: break-all;
}
.approval-conclusion-group {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.approval-conclusion-btn {
min-width: 96px;
}
</style>
@@ -47,6 +47,20 @@
class="form-grid form-grid--col4"
:class="{ 'clinical-application-info-grid': isClinical }"
>
<el-form-item
v-if="!isClinical && isBasicExperiment"
label="所属项目组"
prop="teamId"
:required="!isEdit && projectRequired"
>
<ProjectSelect
v-model="formData.teamId"
team
:biz-type="props.bizType || 'basic_experiment'"
:disabled="isEdit"
@update:model-value="onTeamChange"
/>
</el-form-item>
<el-form-item
v-if="!isClinical"
label="所属项目"
@@ -55,13 +69,14 @@
><ProjectSelect
v-model="formData.projectId"
:biz-type="isBasicExperiment ? props.bizType || 'basic_experiment' : 'pilot_service'"
:disabled="isEdit"
:team-id="isBasicExperiment ? formData.teamId : undefined"
:disabled="isEdit || (isBasicExperiment && !isEdit && !formData.teamId)"
:project-name="formData.projectName"
@required="projectRequired = $event"
@ready="projectReady = $event"
/>
<div v-if="isEdit" class="form-tip">
{{ formData.teamName || '未归属项目组' }} · 归属调整请使用项目归属维护
归属调整请使用项目归属维护
</div></el-form-item
>
<el-form-item label="申请单名称" prop="applicationName">
@@ -72,63 +87,64 @@
</el-form-item>
<template v-if="isBasicExperiment">
<el-form-item label="业务类型" prop="researchCategorySelect">
<el-select
v-model="researchCategorySelect"
class="w-full"
clearable
placeholder="请选择业务类型"
@change="onResearchCategorySelectChange"
>
<el-option
v-for="opt in researchCategoryOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</el-form-item>
<el-form-item
v-if="showResearchCategoryOther"
label="自定义业务类型"
prop="researchCategoryCustom"
>
<el-input
v-model="researchCategoryCustom"
maxlength="64"
show-word-limit
placeholder="请输入业务类型"
@input="syncResearchCategoryFromOther"
/>
</el-form-item>
<el-form-item label="渠道" prop="channelId">
<el-select
v-model="formData.channelId"
class="w-full"
filterable
clearable
placeholder="请选择渠道"
:loading="channelLoading"
@change="onChannelChange"
>
<el-option
v-for="ch in channelOptions"
:key="ch.id"
:label="ch.channelName"
:value="ch.id"
/>
</el-select>
<div class="field-with-action">
<el-select
v-model="researchCategorySelect"
class="field-with-action__main"
clearable
filterable
placeholder="请选择业务类型"
@change="onResearchCategorySelectChange"
>
<el-option
v-for="opt in researchCategoryOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
<el-button
class="field-with-action__btn"
@click="categoryMaintainVisible = true"
>
<el-icon><Setting /></el-icon>维护
</el-button>
</div>
</el-form-item>
<el-form-item label="课题名称" prop="projectTitle">
<el-input v-model="formData.projectTitle" placeholder="请输入课题名称" />
</el-form-item>
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="formData.customerName" placeholder="请输入客户名称" />
<div class="field-with-action">
<el-select
v-model="partnerCustomerId"
class="field-with-action__main"
filterable
clearable
placeholder="请选择合作客户"
:loading="partnerCustomerLoading"
@change="onPartnerCustomerChange"
>
<el-option
v-for="c in partnerCustomerOptions"
:key="c.id"
:label="formatPartnerCustomerLabel(c)"
:value="c.id"
/>
</el-select>
<el-button
class="field-with-action__btn"
@click="openPartnerCustomerCreate"
>
<el-icon><Plus /></el-icon>新增
</el-button>
</div>
</el-form-item>
<el-form-item label="客户联系人" prop="customerContact">
<el-input v-model="formData.customerContact" placeholder="请输入客户联系人" />
<el-input v-model="formData.customerContact" placeholder="选择客户后自动带出" readonly />
</el-form-item>
<el-form-item label="客户联系方式" prop="customerPhone">
<el-input v-model="formData.customerPhone" placeholder="请输入客户联系方式" />
<el-input v-model="formData.customerPhone" placeholder="选择客户后自动带出" readonly />
</el-form-item>
<el-form-item label="备注" class="form-col-full">
<el-input
@@ -592,14 +608,16 @@
编辑模式下仅更新申请单信息;新增交付计划请在创建时维护,或于「交付计划管理」Tab 查看。
</p>
<p v-else class="section-title-hint">
每行细胞产品将独立生成一条交付计划(含交付时间与金额)。
每行细胞产品将独立生成一条交付计划(含交付时间{{
hideSalePriceColumns ? '' : '与金额'
}})。
</p>
</div>
</div>
<div class="cell-product-toolbar">
<div class="section-subtitle">细胞产品</div>
<el-button
v-if="!isEdit"
v-if="!isEdit && !hideSaleOpsColumn"
type="primary"
:disabled="!canAddCellProduct"
@click="addSaleProductLine"
@@ -662,10 +680,22 @@
<span v-else>{{ row.packageText || '—' }}</span>
</template>
</el-table-column>
<el-table-column label="参考单价(元)" min-width="120" align="right">
<el-table-column
v-if="!hideSalePriceColumns"
label="参考单价(元)"
min-width="120"
align="center"
header-align="center"
>
<template #default="{ row }">{{ formatMoneyDisplay(row.agreementPrice, 2) }}</template>
</el-table-column>
<el-table-column label="实际单价(元)" min-width="130">
<el-table-column
v-if="!hideSalePriceColumns"
label="实际单价(元)"
min-width="130"
align="center"
header-align="center"
>
<template #default="{ row }">
<DecimalInput
v-if="!isEdit"
@@ -685,7 +715,7 @@
v-model="row.quantity"
:min="1"
:max="9999"
controls-position="right"
:controls="false"
style="width: 100%"
@change="syncSaleLineAmount(row)"
/>
@@ -705,7 +735,11 @@
<span v-else>{{ row.pickupTime || '—' }}</span>
</template>
</el-table-column>
<el-table-column label="金额(元)" min-width="120">
<el-table-column
v-if="!hideSalePriceColumns"
label="金额(元)"
min-width="120"
>
<template #default="{ row }">
<DecimalInput
v-if="!isEdit"
@@ -717,7 +751,12 @@
<span v-else>{{ formatMoneyDisplay(row.amount, 2) }}</span>
</template>
</el-table-column>
<el-table-column v-if="!isEdit" label="操作" min-width="80" align="center">
<el-table-column
v-if="!isEdit && !hideSaleOpsColumn"
label="操作"
min-width="80"
align="center"
>
<template #default="{ $index }">
<el-button link type="danger" @click="removeSaleProductLine($index)">
<el-icon><Delete /></el-icon>
@@ -1275,10 +1314,74 @@
</div>
</template>
</SystemViewDialog>
<ContractProcessingCategoryDialog
v-model="categoryMaintainVisible"
:biz-type="categoryBizType"
@changed="loadCustomResearchCategories"
/>
<!-- 委托加工:新增合作客户 -->
<el-dialog
v-model="partnerCustomerCreateVisible"
title="新增合作客户"
width="640px"
class="dialog-form-layout"
align-center
append-to-body
destroy-on-close
modal-class="protocol-dialog-mask"
:close-on-click-modal="false"
>
<el-form
ref="partnerCustomerCreateFormRef"
:model="partnerCustomerCreateForm"
:rules="partnerCustomerCreateRules"
label-position="top"
class="biz-dialog-form"
@submit.prevent
>
<div class="form-grid-2">
<el-form-item label="客户名称" prop="customerName">
<el-input v-model="partnerCustomerCreateForm.customerName" placeholder="必填" />
</el-form-item>
<el-form-item label="客户联系人" prop="customerContact">
<el-input v-model="partnerCustomerCreateForm.customerContact" placeholder="必填" />
</el-form-item>
<el-form-item label="客户联系方式" prop="customerPhone" class="form-col-span-2">
<el-input v-model="partnerCustomerCreateForm.customerPhone" placeholder="必填" />
</el-form-item>
<el-form-item label="备注" class="form-col-span-2">
<el-input
v-model="partnerCustomerCreateForm.remark"
type="textarea"
:rows="2"
placeholder="可选"
/>
</el-form-item>
</div>
</el-form>
<template #footer>
<el-button class="btn-ghost" @click="partnerCustomerCreateVisible = false">
<el-icon><Close /></el-icon>
取消
</el-button>
<el-button
class="btn-main"
type="primary"
:loading="partnerCustomerCreateSaving"
@click="submitPartnerCustomerCreate"
>
<el-icon><Check /></el-icon>
确定
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import ProjectSelect from '@/components/business/ProjectSelect.vue'
import ContractProcessingCategoryDialog from './ContractProcessingCategoryDialog.vue'
const projectRequired = ref(false)
const projectReady = ref(false)
import type { FormInstance } from 'element-plus'
@@ -1291,7 +1394,8 @@
Document,
VideoPlay,
Loading,
View
View,
Setting
} from '@element-plus/icons-vue'
import {
savePilotApplication,
@@ -1307,7 +1411,10 @@
fetchCellProductPackageList,
fetchDictDataOptions,
fetchCustomerList,
fetchCreateCustomer
fetchCreateCustomer,
fetchPartnerCustomerList,
fetchCreatePartnerCustomer,
fetchContractProcessingCategoryList
} from '@/api/admin'
import { fetchUploadAttachment } from '@/api/business'
import { useAttachmentDropZone } from '@/composables/useAttachmentDropZone'
@@ -1337,8 +1444,9 @@
import { getPilotBizConfig } from '@/config/pilot-biz-type'
import {
RESEARCH_CATEGORY_OTHER_VALUE,
isFixedContractProcessingCategory,
researchCategoryOptionsForBiz
isFixedResearchCategory,
researchCategoryOptionsForBiz,
type ResearchCategoryOption
} from '@/constants/clinical-research-category'
import { isResearchLikeBiz } from '@/utils/research-like-biz'
@@ -1349,7 +1457,11 @@
editId: string | null
listRow?: any
bizType?: string
/** 生产出库入口:隐藏交付计划单价/金额与行操作列 */
productionOutbound?: boolean
}>()
const hideSalePriceColumns = computed(() => !!props.productionOutbound)
const hideSaleOpsColumn = computed(() => !!props.productionOutbound)
const emit = defineEmits<{
(e: 'update:modelValue', val: boolean): void
@@ -1360,51 +1472,89 @@
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
const isClinical = computed(() => props.bizType === 'clinical_application')
const isBasicExperiment = computed(() => isResearchLikeBiz(props.bizType))
const researchCategoryOptions = computed(() => researchCategoryOptionsForBiz(props.bizType))
const researchCategorySelect = ref('')
const researchCategoryCustom = ref('')
const showResearchCategoryOther = computed(
() =>
props.bizType === 'contract_processing' &&
researchCategorySelect.value === RESEARCH_CATEGORY_OTHER_VALUE
const isContractProcessing = computed(() => props.bizType === 'contract_processing')
watch(
isBasicExperiment,
(yes) => {
if (yes) projectRequired.value = true
},
{ immediate: true }
)
const customCategoryOptions = ref<ResearchCategoryOption[]>([])
const categoryMaintainVisible = ref(false)
const categoryBizType = computed<'basic_experiment' | 'contract_processing'>(() =>
props.bizType === 'contract_processing' ? 'contract_processing' : 'basic_experiment'
)
const researchCategoryOptions = computed(() =>
researchCategoryOptionsForBiz(categoryBizType.value, customCategoryOptions.value)
)
const researchCategorySelect = ref('')
function applyResearchCategoryToForm() {
if (showResearchCategoryOther.value) {
formData.researchCategory = (researchCategoryCustom.value || '').trim()
} else {
formData.researchCategory = researchCategorySelect.value || ''
}
formData.researchCategory = researchCategorySelect.value || ''
}
function onResearchCategorySelectChange() {
if (!showResearchCategoryOther.value) {
researchCategoryCustom.value = ''
}
applyResearchCategoryToForm()
}
function syncResearchCategoryFromOther() {
applyResearchCategoryToForm()
async function loadCustomResearchCategories() {
if (!isBasicExperiment.value) {
customCategoryOptions.value = []
return
}
const bizType = categoryBizType.value
customCategoryOptions.value = []
try {
const rows = await fetchAllPagedRecords((page, pageSize) =>
fetchContractProcessingCategoryList({ page, pageSize, bizType })
)
// 必须带 bizType;缺字段的旧响应直接丢弃,避免串业务线
customCategoryOptions.value = rows
.filter((r) => r.bizType === bizType)
.map((r) => ({
value: r.categoryName,
label: r.categoryName
}))
} catch (e) {
console.error(e)
customCategoryOptions.value = []
}
}
watch(
() => categoryBizType.value,
() => {
customCategoryOptions.value = []
researchCategorySelect.value = ''
if (isBasicExperiment.value) {
loadCustomResearchCategories()
}
}
)
function hydrateResearchCategorySelect(code?: string | null) {
const value = (code || '').trim()
if (!value) {
researchCategorySelect.value = ''
researchCategoryCustom.value = ''
formData.researchCategory = ''
return
}
if (props.bizType === 'contract_processing' && !isFixedContractProcessingCategory(value)) {
researchCategorySelect.value = RESEARCH_CATEGORY_OTHER_VALUE
researchCategoryCustom.value = value
formData.researchCategory = value
return
// 历史「其他」占位或未入库自定义:并入下拉选项以便回显
if (
isBasicExperiment.value &&
!isFixedResearchCategory(categoryBizType.value, value) &&
value !== RESEARCH_CATEGORY_OTHER_VALUE &&
!customCategoryOptions.value.some((o) => o.value === value)
) {
customCategoryOptions.value = [
...customCategoryOptions.value,
{ value, label: value }
]
}
researchCategorySelect.value = value
researchCategoryCustom.value = ''
formData.researchCategory = value
researchCategorySelect.value =
value === RESEARCH_CATEGORY_OTHER_VALUE ? '' : value
formData.researchCategory = researchCategorySelect.value
}
// ── Tabs ───────────────────────────────────────────────────────────────
@@ -1437,6 +1587,7 @@
const formData = reactive({
projectId: '',
projectName: '',
teamId: '',
teamName: '',
applicationName: '',
channelId: '',
@@ -1449,6 +1600,127 @@
researchCategory: ''
})
const onTeamChange = () => {
formData.projectId = ''
formData.projectName = ''
}
const partnerCustomerId = ref('')
const partnerCustomerOptions = ref<Api.PartnerCustomer.Item[]>([])
const partnerCustomerLoading = ref(false)
function formatPartnerCustomerLabel(c: Api.PartnerCustomer.Item) {
const name = (c.customerName || '').trim()
const contact = (c.customerContact || '').trim()
if (name && contact) return `${name}(${contact})`
return name || contact || c.id
}
async function loadPartnerCustomers() {
if (!isBasicExperiment.value) return
partnerCustomerLoading.value = true
try {
partnerCustomerOptions.value = await fetchAllPagedRecords((page, pageSize) =>
fetchPartnerCustomerList({ page, pageSize })
)
} catch (e) {
console.error(e)
partnerCustomerOptions.value = []
} finally {
partnerCustomerLoading.value = false
}
}
function onPartnerCustomerChange(id: string) {
if (!id) {
formData.customerName = ''
formData.customerContact = ''
formData.customerPhone = ''
return
}
const hit = partnerCustomerOptions.value.find((c) => c.id === id)
if (!hit) return
formData.customerName = hit.customerName || ''
formData.customerContact = hit.customerContact || ''
formData.customerPhone = hit.customerPhone || ''
}
function syncPartnerCustomerSelection() {
const name = (formData.customerName || '').trim()
const contact = (formData.customerContact || '').trim()
const phone = (formData.customerPhone || '').trim()
if (!name) {
partnerCustomerId.value = ''
return
}
const hit = partnerCustomerOptions.value.find(
(c) =>
(c.customerName || '').trim() === name &&
(c.customerContact || '').trim() === contact &&
(c.customerPhone || '').trim() === phone
)
partnerCustomerId.value = hit?.id || ''
}
const partnerCustomerCreateVisible = ref(false)
const partnerCustomerCreateSaving = ref(false)
const partnerCustomerCreateFormRef = ref<FormInstance>()
const partnerCustomerCreateForm = reactive({
customerName: '',
customerContact: '',
customerPhone: '',
remark: ''
})
const partnerCustomerCreateRules = {
customerName: [{ required: true, message: '请填写客户名称', trigger: 'blur' }],
customerContact: [{ required: true, message: '请填写客户联系人', trigger: 'blur' }],
customerPhone: [{ required: true, message: '请填写客户联系方式', trigger: 'blur' }]
}
function openPartnerCustomerCreate() {
partnerCustomerCreateForm.customerName = ''
partnerCustomerCreateForm.customerContact = ''
partnerCustomerCreateForm.customerPhone = ''
partnerCustomerCreateForm.remark = ''
partnerCustomerCreateVisible.value = true
nextTick(() => partnerCustomerCreateFormRef.value?.clearValidate())
}
async function submitPartnerCustomerCreate() {
const ok = await partnerCustomerCreateFormRef.value?.validate().catch(() => false)
if (!ok) return
partnerCustomerCreateSaving.value = true
try {
const payload = {
customerName: partnerCustomerCreateForm.customerName.trim(),
customerContact: partnerCustomerCreateForm.customerContact.trim(),
customerPhone: partnerCustomerCreateForm.customerPhone.trim(),
remark: partnerCustomerCreateForm.remark.trim() || undefined
}
const res: any = await fetchCreatePartnerCustomer(payload)
const created = (res?.data ?? res) as Api.PartnerCustomer.Item | undefined
ElMessage.success('合作客户已创建')
partnerCustomerCreateVisible.value = false
await loadPartnerCustomers()
const newId =
created?.id ||
partnerCustomerOptions.value.find(
(c) =>
(c.customerName || '').trim() === payload.customerName &&
(c.customerContact || '').trim() === payload.customerContact &&
(c.customerPhone || '').trim() === payload.customerPhone
)?.id
if (newId) {
partnerCustomerId.value = newId
onPartnerCustomerChange(newId)
}
} catch (e: any) {
if (e?.message) ElMessage.error(e.message)
} finally {
partnerCustomerCreateSaving.value = false
}
}
type SaleProductLine = {
_localId: number
priceId: string
@@ -1471,6 +1743,8 @@
const formRules = reactive({
applicationName: [{ required: true, message: '请输入申请单名称', trigger: 'blur' }],
teamId: [{ required: false, message: '请选择所属项目组', trigger: 'change' }],
projectId: [{ required: false, message: '请选择所属项目', trigger: 'change' }],
channelId: [{ required: true, message: '请选择渠道', trigger: 'change' }],
channelServiceOrderId: [
{ required: true, message: '请选择服务订单', trigger: 'change' }
@@ -1486,40 +1760,26 @@
callback(new Error('请选择业务类型'))
return
}
if (showResearchCategoryOther.value && !(researchCategoryCustom.value || '').trim()) {
callback(new Error('请填写自定义业务类型'))
return
}
callback()
},
trigger: 'change'
}
],
researchCategoryCustom: [
{
validator: (_rule: any, _value: any, callback: (e?: Error) => void) => {
if (!showResearchCategoryOther.value) {
callback()
return
}
if (!(researchCategoryCustom.value || '').trim()) {
callback(new Error('请填写自定义业务类型'))
return
}
callback()
},
trigger: 'blur'
}
],
projectTitle: [{ required: true, message: '请填写课题名称', trigger: 'blur' }],
customerName: [{ required: true, message: '请填写客户名称', trigger: 'blur' }],
customerContact: [{ required: true, message: '请填写客户联系人', trigger: 'blur' }],
customerPhone: [{ required: true, message: '请填写客户联系方式', trigger: 'blur' }]
customerName: [{ required: true, message: '请选择合作客户', trigger: 'change' }],
customerContact: [{ required: true, message: '请选择合作客户', trigger: 'change' }],
customerPhone: [{ required: true, message: '请选择合作客户', trigger: 'change' }]
})
watchEffect(() => {
formRules.applicationName[0].required = !isBasicExperiment.value
formRules.channelId[0].required = bizConfig.value.showChannel
formRules.teamId[0].required =
isBasicExperiment.value && !isEdit.value && projectRequired.value
formRules.projectId[0].required =
!isClinical.value && !isEdit.value && projectRequired.value
// 临床科研/委托加工申请单信息已去掉渠道,不再校验
formRules.channelId[0].required =
bizConfig.value.showChannel && !isBasicExperiment.value
const orderRule = formRules.channelServiceOrderId
if (Array.isArray(orderRule)) {
orderRule[0].required = !isClinical.value && !isBasicExperiment.value
@@ -2909,7 +3169,7 @@
}
// ── 弹窗打开 ───────────────────────────────────────────────────────────
const handleOpen = () => {
const handleOpen = async () => {
resetForm()
loadChannels()
loadInfusionMethodOptions()
@@ -2919,8 +3179,10 @@
}
if (isBasicExperiment.value) {
loadPackageOptions()
await loadPartnerCustomers()
await loadCustomResearchCategories()
}
if (isBasicExperiment.value && !isEdit.value) {
if (isBasicExperiment.value && !isEdit.value && !props.productionOutbound) {
addSaleProductLine()
}
if (isEdit.value && props.editId) {
@@ -2931,6 +3193,7 @@
const resetForm = () => {
formData.projectId = ''
formData.projectName = ''
formData.teamId = ''
formData.teamName = ''
formData.applicationName = ''
formData.channelId = ''
@@ -2940,6 +3203,10 @@
formData.customerName = ''
formData.customerContact = ''
formData.customerPhone = ''
partnerCustomerId.value = ''
partnerCustomerOptions.value = []
customCategoryOptions.value = []
categoryMaintainVisible.value = false
hydrateResearchCategorySelect('')
saleProductLines.value = []
saleLineSeq = 0
@@ -2983,9 +3250,10 @@
const detail = res?.data ?? res
if (detail) {
formData.applicationName = detail.applicationName || ''
formData.projectId = String((detail).projectId || '')
formData.projectName = String((detail).projectName || '')
formData.teamName = String((detail).teamName || '')
formData.projectId = String(detail.projectId || '')
formData.projectName = String(detail.projectName || '')
formData.teamId = String(detail.teamId || '')
formData.teamName = String(detail.teamName || '')
formData.channelId = detail.channelId || ''
formData.channelServiceOrderId = detail.channelServiceOrderId || ''
formData.remark = detail.remark || ''
@@ -2993,6 +3261,7 @@
formData.customerName = detail.customerName || ''
formData.customerContact = detail.customerContact || ''
formData.customerPhone = detail.customerPhone || ''
syncPartnerCustomerSelection()
hydrateResearchCategorySelect(detail.researchCategory || '')
if (detail.consentAttachmentFiles?.length) {
@@ -3153,8 +3422,22 @@
ElMessage.warning('项目选项尚未加载成功,请稍候或重试')
return
}
if (!isClinical.value && !isEdit.value && projectRequired.value && !formData.projectId) {
ElMessage.warning('请选择所属项目')
if (
isBasicExperiment.value &&
!isEdit.value &&
(projectRequired.value || isBasicExperiment.value) &&
!formData.teamId
) {
ElMessage.warning('请选择所属项目组')
return
}
if (
!isClinical.value &&
!isEdit.value &&
(projectRequired.value || isBasicExperiment.value) &&
!formData.projectId
) {
ElMessage.warning('请选择所属项目(须有项目负责人以便审批)')
return
}
try {
@@ -3163,7 +3446,7 @@
return
}
if (isBasicExperiment.value && !isEdit.value) {
if (isBasicExperiment.value && !isEdit.value && !props.productionOutbound) {
if (!saleProductLines.value.length) {
ElMessage.warning('请至少添加一行售卖产品')
return
@@ -3208,7 +3491,6 @@
if (isBasicExperiment.value) {
applyResearchCategoryToForm()
payload.researchCategory = formData.researchCategory || undefined
payload.channelId = formData.channelId || undefined
payload.projectTitle = formData.projectTitle || undefined
payload.customerName = formData.customerName || undefined
payload.customerContact = formData.customerContact || undefined
@@ -3282,7 +3564,12 @@
const saved = res?.data ?? res
const appId = (isEdit.value ? props.editId : saved?.id) as string
if (isBasicExperiment.value && !isEdit.value && appId) {
if (
isBasicExperiment.value &&
!isEdit.value &&
appId &&
saleProductLines.value.length > 0
) {
await createBasicExperimentSaleSchedules(appId, {
productLines: saleProductLines.value.map((line) => ({
priceId: line.priceId,
@@ -3301,7 +3588,11 @@
})
}
ElMessage.success(isEdit.value ? '保存成功' : '创建成功')
if (!isEdit.value && isBasicExperiment.value) {
ElMessage.success('创建成功,已提交项目负责人审批;通过后将派发生产/质检工单')
} else {
ElMessage.success(isEdit.value ? '保存成功' : '创建成功')
}
emit('update:modelValue', false)
emit('saved')
} catch (e: any) {
@@ -82,7 +82,7 @@
<div class="kpi-value">{{ dash(applicationDetail.customerName) }}</div>
</div>
</div>
<div class="kpi-card">
<div v-if="!isBasicExperiment" class="kpi-card">
<div class="kpi-card__icon" aria-hidden="true">
<el-icon><User /></el-icon>
</div>
@@ -105,7 +105,10 @@
<!-- 申请单信息 -->
<div id="view-section-application" class="section-card section-card--white">
<div class="section-title section-title--banner"><h3>申请单信息</h3></div>
<div v-if="applicationDetail.bizType !== 'clinical_application'" class="data-grid data-grid--2">
<div
v-if="!isBasicExperiment && applicationDetail.bizType !== 'clinical_application'"
class="data-grid data-grid--2"
>
<div class="data-item">
<div class="data-label">所属项目</div>
<div class="data-value">{{ applicationDetail.projectName || '未归属' }}</div>
@@ -117,6 +120,14 @@
</div>
<template v-if="isBasicExperiment">
<div class="data-grid data-grid--5">
<div class="data-item">
<div class="data-label">所属项目</div>
<div class="data-value">{{ applicationDetail.projectName || '未归属' }}</div>
</div>
<div class="data-item">
<div class="data-label">项目组</div>
<div class="data-value">{{ applicationDetail.teamName || '—' }}</div>
</div>
<div class="data-item">
<div class="data-label">申请单名称</div>
<div class="data-value">{{ dash(applicationDetail.applicationName) }}</div>
@@ -127,10 +138,6 @@
{{ dash(clinicalResearchCategoryLabel(applicationDetail.researchCategory)) }}
</div>
</div>
<div class="data-item">
<div class="data-label">渠道名称</div>
<div class="data-value">{{ dash(applicationDetail.channelName) }}</div>
</div>
<div class="data-item">
<div class="data-label">课题名称</div>
<div class="data-value">{{ dash(applicationDetail.projectTitle) }}</div>
@@ -147,6 +154,23 @@
<div class="data-label">客户联系方式</div>
<div class="data-value">{{ dash(applicationDetail.customerPhone) }}</div>
</div>
<div class="data-item">
<div class="data-label">审批状态</div>
<div class="data-value">
<el-tag
v-if="applicationDetail.approvalStatus"
:type="applicationApprovalStatusTagType(applicationDetail.approvalStatus)"
size="small"
>
{{ applicationApprovalStatusLabel(applicationDetail.approvalStatus) }}
</el-tag>
<span v-else>—</span>
</div>
</div>
<div class="data-item">
<div class="data-label">创建时间</div>
<div class="data-value">{{ dash(applicationDetail.createTime) }}</div>
</div>
</div>
<div v-if="applicationDetail.remark" class="data-item data-item--remark">
<div class="data-label">备注</div>
@@ -617,7 +641,7 @@
<el-table-column
label="协议单价(元)"
min-width="130"
align="right"
align="center"
header-align="center"
>
<template #default="{ row }">
@@ -627,7 +651,7 @@
<el-table-column
label="实际单价(元)"
min-width="130"
align="right"
align="center"
header-align="center"
>
<template #default="{ row }">
@@ -903,6 +927,8 @@
import {
applicationStatusLabel,
applicationStatusTagType,
applicationApprovalStatusLabel,
applicationApprovalStatusTagType,
channelServiceOrderTypeLabel,
channelServiceOrderTypeTagType,
channelServiceOrderStatusLabel,
@@ -1,4 +1,4 @@
<!-- 临床申请单 · 缴费信息 Tab(五列看板) -->
<!-- 临床申请单 · 缴费信息 Tab(临床科研=列表;其余=看板) -->
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<div class="clinical-payment-tab">
@@ -8,11 +8,22 @@
<el-form-item label="关键词">
<el-input
v-model="searchForm.keyword"
placeholder="申请单号"
:placeholder="keywordPlaceholder"
clearable
@keyup.enter="handleSearch"
/>
</el-form-item>
<el-form-item v-if="isBasicExperiment" label="缴费状态">
<el-select v-model="searchForm.payStatus" placeholder="全部" clearable style="width: 100%">
<el-option label="全部" value="" />
<el-option
v-for="col in kanbanColumns"
:key="col.key"
:label="col.label"
:value="col.key"
/>
</el-select>
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
@@ -27,7 +38,133 @@
</el-form>
</div>
<div class="payment-kanban-board">
<!-- 临床科研:标准列表 -->
<div v-if="isBasicExperiment" class="list-body list-wrap payment-list-wrap">
<el-table
class="list-table"
:data="listData"
v-loading="listLoading"
stripe
row-key="id"
@row-dblclick="handleView"
>
<el-table-column
type="index"
label="序号"
min-width="68"
align="center"
:index="(index) => (listPagination.page - 1) * listPagination.pageSize + index + 1"
/>
<el-table-column
prop="applicationNo"
label="申请单号"
min-width="150"
align="center"
show-overflow-tooltip
/>
<el-table-column
prop="projectTitle"
label="课题名称"
min-width="160"
align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.projectTitle || '—' }}</template>
</el-table-column>
<el-table-column
prop="customerName"
label="客户名称"
min-width="130"
align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.customerName || '—' }}</template>
</el-table-column>
<el-table-column
prop="cellTypeSpec"
label="细胞类型/规格"
min-width="140"
align="center"
show-overflow-tooltip
>
<template #default="{ row }">{{ row.cellTypeSpec || '—' }}</template>
</el-table-column>
<el-table-column
prop="infusionTime"
:label="pickupTimeLabel"
min-width="160"
align="center"
>
<template #default="{ row }">{{ formatDisplayOrDash(row.infusionTime) }}</template>
</el-table-column>
<el-table-column prop="paymentAmount" label="缴费金额" min-width="120" align="center">
<template #default="{ row }">
<span class="amount-text">{{ formatAmount(row.paymentAmount ?? row.amount) }}</span>
</template>
</el-table-column>
<el-table-column prop="transferAmount" label="实缴金额" min-width="120" align="center">
<template #default="{ row }">
<span class="amount-text">{{
formatAmount(row.transferAmount ?? row.paymentAmount ?? row.amount)
}}</span>
</template>
</el-table-column>
<el-table-column prop="refundAmount" label="退费金额" min-width="120" align="center">
<template #default="{ row }">
<span class="amount-text">{{ formatAmount(row.refundAmount) }}</span>
</template>
</el-table-column>
<el-table-column prop="transferType" label="转账方式" min-width="110" align="center">
<template #default="{ row }">{{
transferTypeLabel(String(row.transferType || '')) || '—'
}}</template>
</el-table-column>
<el-table-column prop="payStatus" label="状态" min-width="110" align="center">
<template #default="{ row }">
<el-tag :type="payStatusTagType(String(row.payStatus || ''))" size="small">
{{ payStatusLabel(String(row.payStatus || '')) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="170" align="center">
<template #default="{ row }">{{ formatDisplayOrDash(row.createTime) }}</template>
</el-table-column>
<el-table-column label="操作" min-width="280" fixed="right" align="center">
<template #default="{ row }">
<el-button class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-button
v-if="String(row.payStatus || '') === 'dfj'"
class="btn-op-item primary"
@click="openReceiptDialog(row)"
>
<el-icon><Check /></el-icon>缴费确认
</el-button>
<el-button
v-if="String(row.payStatus || '') === 'yjf'"
class="btn-op-item primary"
@click="openRefundDialog(row)"
>
<el-icon><RefreshLeft /></el-icon>退费确认
</el-button>
</template>
</el-table-column>
</el-table>
<div class="pagination list-pager-bar">
<el-pagination
:current-page="listPagination.page"
:page-size="listPagination.pageSize"
:total="listPagination.total"
:page-sizes="[10, 20, 50]"
layout="total, sizes, prev, pager, next"
@size-change="onListPageSizeChange"
@current-change="onListPageChange"
/>
</div>
</div>
<div v-else class="payment-kanban-board">
<div
v-for="col in kanbanColumns"
:key="col.key"
@@ -552,6 +689,9 @@
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
const isBasicExperiment = computed(() => isResearchLikeBiz(props.bizType))
const pickupTimeLabel = computed(() => bizConfig.value.pickupTimeLabel)
const keywordPlaceholder = computed(() =>
isBasicExperiment.value ? '申请单号/课题名称/客户名称' : '申请单号'
)
type PayStatusKey = 'dfj' | 'jfqrz' | 'yjf' | 'tfqrz' | 'ytf'
@@ -580,7 +720,7 @@
return { list: [], total: 0, page: 1, pageSize: 10, loading: false }
}
const searchForm = reactive({ keyword: '' })
const searchForm = reactive({ keyword: '', payStatus: '' as string })
const columnStates = reactive<Record<PayStatusKey, KanbanColumnState>>({
dfj: createColumnState(),
jfqrz: createColumnState(),
@@ -590,6 +730,10 @@
})
const expandedCardIds = ref<Set<string>>(new Set())
const listData = ref<Record<string, unknown>[]>([])
const listLoading = ref(false)
const listPagination = reactive({ page: 1, pageSize: 20, total: 0 })
const receiptDialogVisible = ref(false)
const receiptSubmitLoading = ref(false)
const receiptTargetIds = ref<string[]>([])
@@ -730,7 +874,30 @@
}
}
async function loadList(resetPage = false) {
if (resetPage) listPagination.page = 1
const requestId = ++loadRequestId
listLoading.value = true
try {
const res = await fetchClinicalPayments({
page: listPagination.page,
pageSize: listPagination.pageSize,
payStatus: searchForm.payStatus || undefined,
...listQueryParams()
})
if (requestId !== loadRequestId) return
listData.value = res.list || []
listPagination.total = res.total ?? 0
} finally {
if (requestId === loadRequestId) listLoading.value = false
}
}
async function loadAllColumns(resetPage = false) {
if (isBasicExperiment.value) {
await loadList(resetPage)
return
}
const requestId = ++loadRequestId
if (resetPage) {
kanbanColumns.forEach((col) => {
@@ -742,6 +909,17 @@
pruneExpandedCards()
}
function onListPageChange(page: number) {
listPagination.page = page
loadList()
}
function onListPageSizeChange(pageSize: number) {
listPagination.page = 1
listPagination.pageSize = pageSize
loadList()
}
function pruneExpandedCards() {
const allIds = new Set(
kanbanColumns.flatMap((col) => columnStates[col.key].list.map((r) => String(r.id)))
@@ -961,6 +1139,7 @@
function handleReset() {
searchForm.keyword = ''
searchForm.payStatus = ''
loadAllColumns(true)
}
@@ -982,6 +1161,15 @@
<style scoped lang="scss">
@import '@/views/cell-storage/protocol-audit/payment-info-kanban.scss';
.payment-list-wrap {
margin-top: 0;
}
.amount-text {
font-weight: 600;
color: var(--primary-dark, #065f46);
}
.filter-form--inline-label :deep(.el-form-item) {
margin-bottom: 0;
min-width: 0;
@@ -0,0 +1,298 @@
<!-- 委托加工 · 维护业务类型 -->
<!-- eslint-disable vue/no-v-model-argument -->
<template>
<el-dialog
:model-value="modelValue"
title="维护业务类型"
width="720px"
class="dialog-form-layout"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
@open="handleOpen"
@update:model-value="emit('update:modelValue', $event)"
>
<div class="list-toolbar" style="margin-bottom: 12px">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
预置 {{ fixedOptions.length }} 项不可删;自定义类型会出现在申请单下拉中
</div>
<el-button class="btn-main" type="primary" @click="openEdit()">
<el-icon><Plus /></el-icon>
新增自定义
</el-button>
</div>
</div>
<el-table v-loading="loading" :data="tableRows" class="list-table" stripe max-height="420">
<el-table-column
type="index"
label="序号"
min-width="56"
align="center"
header-align="center"
/>
<el-table-column
label="来源"
min-width="88"
align="center"
header-align="center"
>
<template #default="{ row }">
<el-tag size="small" :type="row.fixed ? 'info' : 'success'">
{{ row.fixed ? '预置' : '自定义' }}
</el-tag>
</template>
</el-table-column>
<el-table-column
label="业务类型"
prop="label"
min-width="200"
align="center"
header-align="center"
show-overflow-tooltip
/>
<el-table-column
label="操作"
min-width="180"
fixed="right"
align="center"
header-align="center"
>
<template #default="{ row }">
<div v-if="!row.fixed" style="display: flex; justify-content: center; gap: 8px">
<el-button class="btn-op-item" @click="openEdit(row)">
<el-icon><Edit /></el-icon>编辑
</el-button>
<el-button class="btn-op-item" @click="handleDelete(row)">
<el-icon><Delete /></el-icon>删除
</el-button>
</div>
<span v-else class="form-tip">—</span>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button @click="emit('update:modelValue', false)">
<el-icon><Close /></el-icon>关闭
</el-button>
</template>
</el-dialog>
<el-dialog
v-model="editVisible"
:title="editId ? '编辑自定义业务类型' : '新增自定义业务类型'"
width="480px"
class="dialog-form-layout"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
>
<el-form
ref="editFormRef"
:model="editForm"
:rules="editRules"
label-position="top"
class="protocol-form"
>
<el-form-item label="业务类型名称" prop="categoryName">
<el-input
v-model="editForm.categoryName"
maxlength="64"
show-word-limit
placeholder="请输入业务类型名称"
/>
</el-form-item>
<el-form-item label="备注">
<el-input
v-model="editForm.remark"
type="textarea"
:rows="2"
maxlength="200"
show-word-limit
placeholder="选填"
/>
</el-form-item>
</el-form>
<template #footer>
<el-button @click="editVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button type="primary" :loading="saving" @click="handleSave">
<el-icon><Check /></el-icon>确定
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { Check, Close, Delete, Edit, Plus } from '@element-plus/icons-vue'
import type { FormInstance, FormRules } from 'element-plus'
import {
fetchContractProcessingCategoryList,
fetchCreateContractProcessingCategory,
fetchDeleteContractProcessingCategory,
fetchUpdateContractProcessingCategory
} from '@/api/admin'
import {
CLINICAL_RESEARCH_CATEGORY_OPTIONS,
CONTRACT_PROCESSING_CATEGORY_OPTIONS
} from '@/constants/clinical-research-category'
import { fetchAllPagedRecords } from '@/utils/fetch-paged-list'
defineOptions({ name: 'ContractProcessingCategoryDialog' })
const props = withDefaults(
defineProps<{
modelValue: boolean
bizType?: 'basic_experiment' | 'contract_processing'
}>(),
{ bizType: 'contract_processing' }
)
const emit = defineEmits<{
(e: 'update:modelValue', val: boolean): void
(e: 'changed'): void
}>()
type Row = {
id: string
label: string
fixed: boolean
remark?: string
}
const loading = ref(false)
const customItems = ref<Api.ContractProcessingCategory.Item[]>([])
const fixedOptions = computed(() =>
props.bizType === 'basic_experiment'
? CLINICAL_RESEARCH_CATEGORY_OPTIONS
: CONTRACT_PROCESSING_CATEGORY_OPTIONS
)
const tableRows = computed<Row[]>(() => [
...fixedOptions.value.map((o) => ({
id: `fixed:${o.value}`,
label: o.label,
fixed: true
})),
...customItems.value.map((c) => ({
id: c.id,
label: c.categoryName,
fixed: false,
remark: c.remark
}))
])
const editVisible = ref(false)
const editId = ref('')
const saving = ref(false)
const editFormRef = ref<FormInstance>()
const editForm = reactive({ categoryName: '', remark: '' })
const editRules: FormRules = {
categoryName: [{ required: true, message: '请输入业务类型名称', trigger: 'blur' }]
}
async function loadList() {
loading.value = true
customItems.value = []
const bizType = props.bizType
try {
const rows = await fetchAllPagedRecords((page, pageSize) =>
fetchContractProcessingCategoryList({ page, pageSize, bizType })
)
// 必须带 bizType;缺字段的旧响应直接丢弃,避免串业务线
customItems.value = rows.filter((r) => r.bizType === bizType)
} catch (e) {
console.error(e)
customItems.value = []
ElMessage.error('加载业务类型失败')
} finally {
loading.value = false
}
}
function handleOpen() {
loadList()
}
watch(
() => props.bizType,
() => {
customItems.value = []
if (props.modelValue) loadList()
}
)
function openEdit(row?: Row) {
if (row?.fixed) return
editId.value = row?.id || ''
editForm.categoryName = row?.label || ''
editForm.remark = row?.remark || ''
editVisible.value = true
}
async function handleSave() {
try {
await editFormRef.value?.validate()
} catch {
return
}
saving.value = true
try {
const payload = {
categoryName: editForm.categoryName.trim(),
remark: editForm.remark.trim() || undefined
}
if (editId.value) {
await fetchUpdateContractProcessingCategory(editId.value, payload)
ElMessage.success('已更新')
} else {
await fetchCreateContractProcessingCategory({
...payload,
bizType: props.bizType
})
ElMessage.success('已新增')
}
editVisible.value = false
await loadList()
emit('changed')
} catch (e: any) {
ElMessage.error(e?.message || '保存失败')
} finally {
saving.value = false
}
}
async function handleDelete(row: Row) {
if (row.fixed) return
try {
await ElMessageBox.confirm(`确定删除业务类型「${row.label}」?`, '提示', {
type: 'warning',
confirmButtonText: '删除',
cancelButtonText: '取消'
})
} catch {
return
}
try {
await fetchDeleteContractProcessingCategory(row.id)
ElMessage.success('已删除')
await loadList()
emit('changed')
} catch (e: any) {
ElMessage.error(e?.message || '删除失败')
}
}
watch(
() => props.modelValue,
(v) => {
if (!v) editVisible.value = false
}
)
</script>
@@ -9,24 +9,20 @@
team
v-model="teamFilter"
:biz-type="
isResearchLikeBiz(props.bizType)
? 'basic_experiment'
: 'pilot_service'
isResearchLikeBiz(props.bizType) ? props.bizType : 'pilot_service'
"
/></el-form-item>
<el-form-item v-if="!isClinical" label="项目"
><ProjectSelect filter
v-model="projectFilter"
:biz-type="
isResearchLikeBiz(props.bizType)
? 'basic_experiment'
: 'pilot_service'
isResearchLikeBiz(props.bizType) ? props.bizType : 'pilot_service'
"
/></el-form-item>
<el-form-item label="关键词">
<el-input v-model="searchForm.keyword" :placeholder="keywordPlaceholder" clearable />
</el-form-item>
<el-form-item v-if="bizConfig.showChannel" label="渠道">
<el-form-item v-if="bizConfig.showChannel && !isBasicExperiment" label="渠道">
<el-select
v-model="searchForm.channelId"
placeholder="全部"
@@ -48,9 +44,19 @@
<el-option label="待开始" value="dks" />
<el-option label="进行中" value="jxz" />
<el-option label="已完成" value="ywc" />
<el-option label="已作废" value="yzf" />
<el-option v-if="!approvalOnly" label="已作废" value="yzf" />
</el-select>
</el-form-item>
<el-form-item v-if="isBasicExperiment" label="审批状态">
<el-select v-model="searchForm.approvalStatus" placeholder="全部" clearable>
<el-option label="待审批" value="dsp" />
<el-option label="已通过" value="ytg" />
<el-option label="已驳回" value="yth" />
</el-select>
</el-form-item>
<el-form-item v-if="isBasicExperiment" label="待我审批">
<el-switch v-model="searchForm.pendingMine" />
</el-form-item>
</div>
<div class="filter-actions-row">
<div class="filter-actions-end">
@@ -65,7 +71,7 @@
</el-form>
</div>
<div class="list-toolbar">
<div v-if="!productionOutbound && !approvalOnly" class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
@@ -105,6 +111,32 @@
</div>
</div>
<div v-if="approvalOnly" class="list-toolbar">
<div class="list-toolbar-row">
<div class="list-toolbar-selected">
已选 <span class="sel-num">{{ selectedRows.length }}</span> 项
</div>
<el-button
class="btn-main"
type="primary"
:disabled="!canBatchApprove"
@click="openBatchApprove('ytg')"
>
<el-icon><CircleCheck /></el-icon>
审批
</el-button>
<el-button
class="btn-ghost"
type="danger"
:disabled="!canBatchApprove"
@click="openBatchApprove('yth')"
>
<el-icon><CircleClose /></el-icon>
驳回
</el-button>
</div>
</div>
<div class="list-body list-wrap">
<el-table
ref="tableRef"
@@ -114,9 +146,15 @@
stripe
row-key="id"
@selection-change="handleSelectionChange"
@row-dblclick="handleView"
@row-dblclick="(row) => !productionOutbound && !approvalOnly && handleView(row)"
>
<el-table-column type="selection" min-width="55" align="center" header-align="center" />
<el-table-column
v-if="!productionOutbound"
type="selection"
min-width="55"
align="center"
header-align="center"
/>
<el-table-column
type="index"
label="序号"
@@ -125,8 +163,18 @@
header-align="center"
:index="(index) => (pagination.page - 1) * pagination.pageSize + index + 1"
/>
<el-table-column v-if="!isClinical" prop="projectName" label="所属项目" min-width="160" />
<el-table-column v-if="!isClinical" prop="teamName" label="项目组" min-width="150" />
<el-table-column
v-if="!isClinical && !isBasicExperiment"
prop="projectName"
label="所属项目"
min-width="160"
/>
<el-table-column
v-if="!isClinical && !isBasicExperiment"
prop="teamName"
label="项目组"
min-width="150"
/>
<el-table-column
prop="applicationNo"
label="申请单号"
@@ -165,7 +213,19 @@
show-overflow-tooltip
/>
<el-table-column
v-if="bizConfig.showChannel"
v-if="isBasicExperiment"
prop="projectName"
label="所属项目"
min-width="160"
/>
<el-table-column
v-if="isBasicExperiment"
prop="teamName"
label="项目组"
min-width="150"
/>
<el-table-column
v-if="bizConfig.showChannel && !isBasicExperiment"
prop="channelName"
label="渠道名称"
min-width="150"
@@ -206,6 +266,19 @@
</el-tag>
</template>
</el-table-column>
<el-table-column
v-if="isBasicExperiment"
prop="approvalStatus"
label="审批"
min-width="100"
align="center"
>
<template #default="{ row }">
<el-tag :type="applicationApprovalStatusTagType(row.approvalStatus)" size="small">
{{ applicationApprovalStatusLabel(row.approvalStatus) }}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="createTime" label="创建时间" min-width="160" align="center" >
<template #default="{ row }">{{ formatDisplayOrDash(row.createTime) }}</template>
</el-table-column>
@@ -218,64 +291,89 @@
>
<template #default="{ row }">
<div style="display: flex; justify-content: center; gap: 8px">
<template v-if="hasPrimaryStatusActions(row)">
<template v-if="productionOutbound">
<el-button
v-if="row.applicationStatus === 'dks'"
class="btn-op-item primary"
type="primary"
@click="handleStart(row)"
:loading="handoverLoadingId === row.id"
@click="handleOutboundHandover(row)"
>
<el-icon><VideoPlay /></el-icon>开始
</el-button>
<el-button
v-if="row.applicationStatus === 'jxz'"
class="btn-op-item primary"
type="primary"
@click="handleComplete(row)"
>
<el-icon><CircleCheck /></el-icon>完成
</el-button>
<el-button
v-if="canVoidApplication(row.applicationStatus)"
class="btn-op-item op-warn"
type="danger"
@click="handleVoid(row)"
>
<el-icon><CircleClose /></el-icon>作废
<el-icon><Switch /></el-icon>出库交接
</el-button>
</template>
<el-button v-else class="btn-op-item primary" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-dropdown
v-if="hasMoreActions(row)"
trigger="hover"
@command="(cmd) => handleDropdownCommand(cmd, row)"
>
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
<template v-else-if="approvalOnly">
<el-button
v-if="canApproveRow(row)"
class="btn-op-item primary"
type="primary"
@click="openApprove(row)"
>
<el-icon><CircleCheck /></el-icon>审批
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-if="hasPrimaryStatusActions(row)" command="view">
<el-icon><View /></el-icon>查看
</el-dropdown-item>
<el-dropdown-item
v-if="canEditApplication(row.applicationStatus)"
command="edit"
>
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item
v-if="row.applicationStatus === 'dks'"
command="delete"
divided
>
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
<el-button v-else class="btn-op-item" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
</template>
<template v-else>
<template v-if="hasPrimaryStatusActions(row)">
<el-button
v-if="canStartApplication(row)"
class="btn-op-item primary"
type="primary"
@click="handleStart(row)"
>
<el-icon><VideoPlay /></el-icon>开始
</el-button>
<el-button
v-if="row.applicationStatus === 'jxz'"
class="btn-op-item primary"
type="primary"
@click="handleComplete(row)"
>
<el-icon><CircleCheck /></el-icon>完成
</el-button>
<el-button
v-if="canVoidApplication(row.applicationStatus)"
class="btn-op-item op-warn"
type="danger"
@click="handleVoid(row)"
>
<el-icon><CircleClose /></el-icon>作废
</el-button>
</template>
</el-dropdown>
<el-button v-else class="btn-op-item primary" @click="handleView(row)">
<el-icon><View /></el-icon>查看
</el-button>
<el-dropdown
v-if="hasMoreActions(row)"
trigger="hover"
@command="(cmd) => handleDropdownCommand(cmd, row)"
>
<el-button class="btn-op-item">
<el-icon><More /></el-icon>
</el-button>
<template #dropdown>
<el-dropdown-menu>
<el-dropdown-item v-if="hasPrimaryStatusActions(row)" command="view">
<el-icon><View /></el-icon>查看
</el-dropdown-item>
<el-dropdown-item
v-if="canEditApplication(row.applicationStatus)"
command="edit"
>
<el-icon><Edit /></el-icon>编辑
</el-dropdown-item>
<el-dropdown-item
v-if="row.applicationStatus === 'dks'"
command="delete"
divided
>
<el-icon><Delete /></el-icon>删除
</el-dropdown-item>
</el-dropdown-menu>
</template>
</el-dropdown>
</template>
</div>
</template>
</el-table-column>
@@ -298,14 +396,65 @@
<!-- 新增/编辑弹窗 -->
<ApplicationFormDialog
:key="`form-${bizType || 'default'}`"
v-model="formDialogVisible"
:edit-id="formDialogEditId"
:biz-type="bizType"
:production-outbound="productionOutbound"
@saved="onFormSaved"
/>
<!-- 查看详情弹窗 -->
<ApplicationViewDialog v-model="viewDialogVisible" :application-id="viewApplicationId" />
<!-- 生产出库:多交付计划时选择 -->
<el-dialog
v-model="schedulePickVisible"
title="选择交付计划"
width="560px"
class="dialog-form-layout"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
>
<el-radio-group v-model="pickedScheduleId" class="schedule-pick-group">
<el-radio
v-for="s in schedulePickOptions"
:key="s.id"
:value="s.id"
class="schedule-pick-item"
>
{{ formatSchedulePickLabel(s) }}
</el-radio>
</el-radio-group>
<template #footer>
<el-button @click="schedulePickVisible = false">
<el-icon><Close /></el-icon>取消
</el-button>
<el-button type="primary" :disabled="!pickedScheduleId" @click="confirmSchedulePick">
<el-icon><Check /></el-icon>确定
</el-button>
</template>
</el-dialog>
<InfusionScheduleHandoverDialog
v-model="handoverDialogVisible"
:schedule-id="handoverScheduleId"
:schedule-row="handoverRow"
:application-id="handoverApplicationId"
:biz-type="bizType"
cells-only
@saved="loadData"
/>
<ApplicationApproveDialog
v-model="approveDialogVisible"
:targets="approveTargets"
:initial-conclusion="approveInitialConclusion"
@submitted="onApproveSubmitted"
/>
</div>
</template>
@@ -326,30 +475,50 @@
More,
VideoPlay,
CircleCheck,
CircleClose
CircleClose,
Switch,
Close,
Check
} from '@element-plus/icons-vue'
import ApplicationFormDialog from './ApplicationFormDialog.vue'
import ApplicationViewDialog from './ApplicationViewDialog.vue'
import ApplicationApproveDialog from './ApplicationApproveDialog.vue'
import InfusionScheduleHandoverDialog from '../infusion-schedule-management/InfusionScheduleHandoverDialog.vue'
import {
fetchPilotApplicationList,
fetchPilotApplicationDetail,
deletePilotApplication,
startPilotApplication,
completePilotApplication,
voidPilotApplication,
fetchChannelList
} from '@/api/admin'
import { applicationStatusLabel, applicationStatusTagType } from '@/utils/status-tag-registry'
import {
applicationStatusLabel,
applicationStatusTagType,
applicationApprovalStatusLabel,
applicationApprovalStatusTagType
} from '@/utils/status-tag-registry'
import { fetchAllPagedRecords } from '@/utils/fetch-paged-list'
import { getPilotBizConfig, resolvePilotBizType } from '@/config/pilot-biz-type'
import { clinicalResearchCategoryLabel } from '@/constants/clinical-research-category'
import { isResearchLikeBiz } from '@/utils/research-like-biz'
import { useUserStore } from '@/store/modules/user'
defineOptions({ name: 'PilotApplicationTab' })
const props = defineProps<{ bizType?: string }>()
const props = defineProps<{
bizType?: string
productionOutbound?: boolean
approvalOnly?: boolean
}>()
const userStore = useUserStore()
const currentUserId = computed(() => String(userStore.getUserInfo?.userId || ''))
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
const isClinical = computed(() => props.bizType === 'clinical_application')
const isBasicExperiment = computed(() => isResearchLikeBiz(props.bizType))
const productionOutbound = computed(() => !!props.productionOutbound)
const approvalOnly = computed(() => !!props.approvalOnly)
const keywordPlaceholder = computed(() =>
isBasicExperiment.value ? '申请单号/课题名称/客户名称' : '申请单号/订单名称/患者姓名'
)
@@ -357,8 +526,13 @@
const searchForm = reactive({
keyword: '',
channelId: '',
applicationStatus: ''
applicationStatus: '',
approvalStatus: '',
pendingMine: false
})
const approveDialogVisible = ref(false)
const approveTargets = ref<Record<string, any>[]>([])
const approveInitialConclusion = ref<'' | 'ytg' | 'yth'>('')
// ── 搜索区域渠道下拉 ──────────────────────────────────────────────────
const channelOptions = ref<any[]>([])
@@ -402,8 +576,14 @@
selectedRows.value = []
}
const canStartApplication = (row: any) => {
if (row.applicationStatus !== 'dks') return false
if (!isBasicExperiment.value) return true
return row.approvalStatus === 'ytg'
}
const batchStartTargets = computed(() =>
selectedRows.value.filter((row) => row.applicationStatus === 'dks')
selectedRows.value.filter((row) => canStartApplication(row))
)
const batchCompleteTargets = computed(() =>
selectedRows.value.filter((row) => row.applicationStatus === 'jxz')
@@ -416,6 +596,24 @@
const canBatchComplete = computed(() => batchCompleteTargets.value.length > 0)
const canBatchVoid = computed(() => batchVoidTargets.value.length > 0)
/** 本项目组负责人或管理员可审批(优先后端 canApprove) */
const canApproveRow = (row: any) => {
if (!row) return false
if (typeof row.canApprove === 'boolean') return row.canApprove
if (row.applicationStatus === 'yzf') return false
const st = String(row.approvalStatus || '')
if (st !== 'dsp' && st !== 'ytg' && st !== 'yth') return false
if (userStore.isSuperAdmin) return true
const leaderId = String(row.teamLeaderUserId || row.projectLeaderUserId || '')
const uid = currentUserId.value
return !!(leaderId && uid && leaderId === uid)
}
const batchApproveTargets = computed(() =>
selectedRows.value.filter((row) => canApproveRow(row))
)
const canBatchApprove = computed(() => batchApproveTargets.value.length > 0)
const loadData = async () => {
loading.value = true
try {
@@ -425,10 +623,24 @@
}
if (searchForm.keyword) params.keyword = searchForm.keyword
if (searchForm.channelId) params.channelId = searchForm.channelId
if (searchForm.applicationStatus) params.applicationStatus = searchForm.applicationStatus
if (searchForm.applicationStatus) {
params.applicationStatus = searchForm.applicationStatus
} else if (approvalOnly.value) {
// 审批页不展示已作废申请单
params.applicationStatus = 'dks,jxz,ywc'
}
if (isBasicExperiment.value && searchForm.approvalStatus) {
params.approvalStatus = searchForm.approvalStatus
}
if (isBasicExperiment.value && searchForm.pendingMine) {
params.pendingMine = true
}
params.projectId = projectFilter.value || undefined
params.teamId = teamFilter.value || undefined
params.bizType = resolvePilotBizType(props.bizType)
if (approvalOnly.value) {
params.forApproval = true
}
const res: any = await fetchPilotApplicationList(params)
tableData.value = res?.list ?? res?.records ?? []
@@ -451,10 +663,42 @@
searchForm.keyword = ''
searchForm.channelId = ''
searchForm.applicationStatus = ''
searchForm.approvalStatus = ''
searchForm.pendingMine = false
pagination.page = 1
loadData()
}
const openApprove = (row: any) => {
approveInitialConclusion.value = ''
approveTargets.value = [row]
approveDialogVisible.value = true
}
const openBatchApprove = (conclusion: 'ytg' | 'yth') => {
const targets = batchApproveTargets.value
if (!targets.length) {
ElMessage.warning(
selectedRows.value.length
? '所选申请单均非您负责的项目,无法审批'
: '请先勾选需要审批的申请单'
)
return
}
const skipped = selectedRows.value.length - targets.length
if (skipped > 0) {
ElMessage.info(`已跳过 ${skipped} 条非您负责的项目`)
}
approveInitialConclusion.value = conclusion
approveTargets.value = [...targets]
approveDialogVisible.value = true
}
const onApproveSubmitted = () => {
clearTableSelection()
loadData()
}
// ── 查看详情弹窗 ──────────────────────────────────────────────────────
const viewDialogVisible = ref(false)
const viewApplicationId = ref('')
@@ -479,7 +723,7 @@
/** 待开始、进行中可作废 */
const canVoidApplication = (status: string) => ['dks', 'jxz'].includes(status)
/** 是否存在开始/完成/作废等主操作 */
/** 是否存在开始/完成/作废等主操作(审批仅在审批子菜单) */
const hasPrimaryStatusActions = (row: any) =>
row.applicationStatus === 'dks' || row.applicationStatus === 'jxz'
@@ -509,6 +753,77 @@
loadData()
}
// ── 生产出库交接 ───────────────────────────────────────────────────────
const handoverLoadingId = ref('')
const handoverDialogVisible = ref(false)
const handoverScheduleId = ref('')
const handoverApplicationId = ref('')
const handoverRow = ref<Record<string, any> | null>(null)
const schedulePickVisible = ref(false)
const schedulePickOptions = ref<any[]>([])
const pickedScheduleId = ref('')
const schedulePickAppRow = ref<Record<string, any> | null>(null)
function formatSchedulePickLabel(s: any) {
const time = s.infusionTime || s.pickupTime || '—'
const product = s.cellType || s.projectName || s.cellTypeName || ''
const status = s.infusionStatus || ''
const parts = [time]
if (product) parts.push(String(product))
if (status) parts.push(String(status))
return parts.join(' · ')
}
function openHandoverForSchedule(schedule: any, appRow?: Record<string, any> | null) {
handoverScheduleId.value = schedule.id
handoverApplicationId.value = String(appRow?.id || schedule.pilotApplicationId || '')
handoverRow.value = {
...schedule,
applicationNo: schedule.applicationNo || appRow?.applicationNo,
patientName: schedule.patientName || appRow?.patientName,
projectTitle: schedule.projectTitle || appRow?.projectTitle,
customerName: schedule.customerName || appRow?.customerName
}
handoverDialogVisible.value = true
}
async function handleOutboundHandover(row: any) {
handoverLoadingId.value = row.id
try {
const res: any = await fetchPilotApplicationDetail({ id: row.id })
const detail = res?.data ?? res
const schedules = (detail?.infusionSchedules || []).filter(
(s: any) => String(s.infusionStatus || '') !== 'yqx' && s.id
)
if (!schedules.length) {
ElMessage.warning(`暂无${bizConfig.value.scheduleLabel},无法出库交接`)
return
}
if (schedules.length === 1) {
openHandoverForSchedule(schedules[0], row)
return
}
schedulePickAppRow.value = row
schedulePickOptions.value = schedules
pickedScheduleId.value = schedules[0].id
schedulePickVisible.value = true
} catch (e: any) {
ElMessage.error(e?.message || '加载交付计划失败')
} finally {
handoverLoadingId.value = ''
}
}
function confirmSchedulePick() {
const hit = schedulePickOptions.value.find((s) => s.id === pickedScheduleId.value)
if (!hit) {
ElMessage.warning('请选择交付计划')
return
}
schedulePickVisible.value = false
openHandoverForSchedule(hit, schedulePickAppRow.value)
}
// ── 删除 ──────────────────────────────────────────────────────────────
const handleDelete = async (row: any) => {
try {
@@ -704,4 +1019,19 @@
flex-wrap: wrap;
align-items: center;
}
.schedule-pick-group {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 10px;
width: 100%;
}
.schedule-pick-item {
margin-right: 0;
height: auto;
white-space: normal;
line-height: 1.4;
}
</style>
@@ -19,10 +19,28 @@
</div>
</div>
<PilotApplicationTab v-if="activeTab === 'application'" :biz-type="effectiveBizType" />
<CheckupManagementTab v-else-if="activeTab === 'checkup'" :biz-type="effectiveBizType" />
<InfusionScheduleTab v-else-if="activeTab === 'infusion'" :biz-type="effectiveBizType" />
<ClinicalPaymentTab v-else-if="activeTab === 'payment'" :biz-type="effectiveBizType" />
<PilotApplicationTab
v-if="activeTab === 'application'"
:key="`application-${effectiveBizType}`"
:biz-type="effectiveBizType"
:production-outbound="productionOutbound"
:approval-only="approvalOnly"
/>
<CheckupManagementTab
v-else-if="activeTab === 'checkup'"
:key="`checkup-${effectiveBizType}`"
:biz-type="effectiveBizType"
/>
<InfusionScheduleTab
v-else-if="activeTab === 'infusion'"
:key="`infusion-${effectiveBizType}`"
:biz-type="effectiveBizType"
/>
<ClinicalPaymentTab
v-else-if="activeTab === 'payment'"
:key="`payment-${effectiveBizType}`"
:biz-type="effectiveBizType"
/>
</section>
</div>
</template>
@@ -40,13 +58,44 @@
defineOptions({ name: 'PilotApplicationManagement' })
const props = defineProps<{ bizType?: string }>()
const bizConfig = computed(() => getPilotBizConfig(props.bizType))
const effectiveBizType = computed<PilotBizType>(() => resolvePilotBizType(props.bizType))
const props = defineProps<{
bizType?: string
productionOutbound?: boolean
approvalOnly?: boolean
}>()
const route = useRoute()
const bizConfig = computed(() => getPilotBizConfig(props.bizType || (route.meta.bizType as string)))
const effectiveBizType = computed<PilotBizType>(() =>
resolvePilotBizType(props.bizType || (route.meta.bizType as string))
)
const productionOutbound = computed(
() =>
!!props.productionOutbound ||
!!route.meta.productionOutbound ||
/basic-experiment-outbound|contract-processing-outbound/.test(route.path)
)
const approvalOnly = computed(
() =>
!!props.approvalOnly ||
!!route.meta.approvalOnly ||
/basic-experiment-approval|contract-processing-approval/.test(route.path)
)
type TabKey = 'application' | 'checkup' | 'infusion' | 'payment'
const tabCards = computed(() => {
// 生产出库 / 审批入口仅展示申请单列表
if (productionOutbound.value || approvalOnly.value) {
return [
{
key: 'application' as TabKey,
title:
effectiveBizType.value === 'basic_experiment'
? '申请单'
: `${bizConfig.value.label}申请单`
}
]
}
const cfg = bizConfig.value
const cards: Array<{ key: TabKey; title: string }> = [
{
@@ -75,7 +124,6 @@
const validTabKeys = computed(() => tabCards.value.map((c) => c.key))
const route = useRoute()
const activeTab = ref<TabKey>('application')
onMounted(() => {
@@ -1,185 +0,0 @@
<!-- 临床科研出库工单 — 确认出库细胞 -->
<!-- eslint-disable vue/no-v-model-argument vue/no-multiple-template-root -->
<template>
<el-dialog
:model-value="modelValue"
title="确认出库细胞"
width="1100px"
class="dialog-form-layout production-delivery-cell-outbound-dialog"
align-center
append-to-body
modal-class="protocol-dialog-mask"
destroy-on-close
:close-on-click-modal="false"
style="backdrop-filter: none"
@update:model-value="emit('update:modelValue', $event)"
@closed="handleClosed"
>
<div v-if="scheduleSummary" class="material-summary">
<div class="material-summary-row">
<span class="material-summary-label">工单号</span>
<span class="material-summary-value">{{ workOrderNo || '—' }}</span>
</div>
<div class="material-summary-row">
<span class="material-summary-label">申请单号</span>
<span class="material-summary-value">{{ scheduleSummary.applicationNo || '—' }}</span>
</div>
<div class="material-summary-row">
<span class="material-summary-label">课题名称</span>
<span class="material-summary-value">{{ scheduleSummary.projectTitle || '—' }}</span>
</div>
<div class="material-summary-row">
<span class="material-summary-label">客户名称</span>
<span class="material-summary-value">{{ scheduleSummary.customerName || '—' }}</span>
</div>
<div class="material-summary-row">
<span class="material-summary-label">交付时间</span>
<span class="material-summary-value">{{ scheduleSummary.infusionTime || '—' }}</span>
</div>
</div>
<div v-loading="loading" class="outbound-body">
<OutboundMaterialFormSections
ref="materialSectionsRef"
require-frozen-cell-product
:show-materials="false"
:show-papers="false"
:show-remark="false"
/>
</div>
<template #footer>
<el-button class="btn-ghost" @click="emit('update:modelValue', false)">
<el-icon><Close /></el-icon>
取消
</el-button>
<el-button class="btn-main" type="primary" :loading="submitting" @click="handleSubmit">
<el-icon><Check /></el-icon>
确认出库
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { nextTick, ref, watch } from 'vue'
import { ElMessage } from 'element-plus'
import { Check, Close } from '@element-plus/icons-vue'
import {
fetchProductionDeliveryCellOutbound,
saveProductionDeliveryCellOutbound
} from '@/api/production-work-order'
import OutboundMaterialFormSections from '@/components/business/outbound-material-form-sections/index.vue'
defineOptions({ name: 'ProductionDeliveryCellOutboundDialog' })
const props = defineProps<{
modelValue: boolean
workOrderId: string
}>()
const emit = defineEmits<{
(e: 'update:modelValue', val: boolean): void
(e: 'saved'): void
}>()
const materialSectionsRef = ref<InstanceType<typeof OutboundMaterialFormSections> | null>(null)
const loading = ref(false)
const submitting = ref(false)
const workOrderNo = ref('')
const scheduleSummary = ref<{
applicationNo?: string
patientName?: string
infusionTime?: string
projectTitle?: string
customerName?: string
} | null>(null)
async function loadData() {
if (!props.workOrderId) return
loading.value = true
try {
const data = await fetchProductionDeliveryCellOutbound(props.workOrderId)
workOrderNo.value = data.workOrderNo || ''
scheduleSummary.value = data.scheduleSummary || null
await nextTick()
materialSectionsRef.value?.loadFromApiData({
cells: data.cells as any
})
} catch (e: any) {
ElMessage.error(e?.message || '加载出库细胞失败')
emit('update:modelValue', false)
} finally {
loading.value = false
}
}
async function handleSubmit() {
if (!props.workOrderId) return
if (!materialSectionsRef.value?.validateMaterial()) return
const payload = materialSectionsRef.value.buildSavePayload()
submitting.value = true
try {
await saveProductionDeliveryCellOutbound(props.workOrderId, {
cells: (payload.cells || []).map((c: { cellProductId: string; remark?: string }) => ({
cellProductId: c.cellProductId,
remark: c.remark
}))
})
ElMessage.success('出库细胞已确认')
emit('saved')
emit('update:modelValue', false)
} catch (e: any) {
ElMessage.error(e?.message || '确认出库失败')
} finally {
submitting.value = false
}
}
function handleClosed() {
workOrderNo.value = ''
scheduleSummary.value = null
materialSectionsRef.value?.resetState()
}
watch(
() => props.modelValue,
(visible) => {
if (visible) void loadData()
}
)
</script>
<style scoped lang="scss">
.material-summary {
margin-bottom: 16px;
padding: 12px 16px;
background: var(--el-fill-color-lighter);
border-radius: 8px;
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 8px 24px;
}
.material-summary-row {
display: flex;
gap: 8px;
min-width: 0;
}
.material-summary-label {
flex: 0 0 auto;
color: var(--el-text-color-secondary);
}
.material-summary-value {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.outbound-body {
min-height: 160px;
}
</style>
@@ -75,13 +75,6 @@
<el-button class="btn-op-item" @click="emit('view-qc', row)">
<el-icon><DataLine /></el-icon>查看质检数据
</el-button>
<el-button
v-if="showDeliveryCellOutbound(row)"
class="btn-op-item"
@click="emit('delivery-cell-outbound', row)"
>
<el-icon><Box /></el-icon>确认出库细胞
</el-button>
<el-button
v-if="showStorageCertQcButton(row)"
class="btn-op-item"
@@ -360,8 +353,7 @@
ArrowDown,
ArrowUp,
DataLine,
FolderAdd,
Box
FolderAdd
} from '@element-plus/icons-vue'
import type { ProductionWorkOrderItem } from '@/api/production-work-order'
import type { OutboundQcDetailProduct } from '@/api/qc-work-order'
@@ -390,8 +382,6 @@
import ProductionStepBadge from './ProductionStepBadge.vue'
import QcWorkOrderFeeSummaryBar from '@/views/quality-inspection/qc-work-order/QcWorkOrderFeeSummaryBar.vue'
import QcWorkOrderProtocolPaymentPanel from '@/views/quality-inspection/qc-work-order/QcWorkOrderProtocolPaymentPanel.vue'
import { isResearchLikeBiz } from '@/utils/research-like-biz'
defineOptions({ name: 'ProductionWorkOrderCardList' })
type WorkOrderTypeTab = 'inbound' | 'temporary' | 'outbound'
@@ -554,7 +544,6 @@
const emit = defineEmits<{
view: [row: ProductionWorkOrderItem]
'view-qc': [row: ProductionWorkOrderItem]
'delivery-cell-outbound': [row: ProductionWorkOrderItem]
dispatch: [row: ProductionWorkOrderItem]
'dispatch-qc': [row: ProductionWorkOrderItem]
complete: [row: ProductionWorkOrderItem]
@@ -659,14 +648,6 @@
return row.workOrderStatus === 'dpz' || row.workOrderStatus === 'jxz'
}
function showDeliveryCellOutbound(row: ProductionWorkOrderItem) {
if (isMineMode.value) return false
if (row.workOrderStatus === 'yzf') return false
const tabKey = resolveEffectiveRowTabKey(listTabKey.value, row)
if (tabKey === 'outbound_basic_experiment') return true
return isResearchLikeBiz(row.bizType) && (row.workOrderType || '') === 'outbound'
}
function canVoidWorkOrder(row: ProductionWorkOrderItem) {
return row.workOrderStatus === 'dpz' || row.workOrderStatus === 'jxz'
}
@@ -23,8 +23,11 @@
<span class="task-output-card__code" :title="displayText(row.productCode)">
{{ displayText(row.productCode) }}
</span>
<el-tag :type="statusTagType(row.productStatus)" size="small">
{{ statusLabel(row.productStatus) }}
<el-tag
:type="cellProductStatusTagType(row.productStatus || '') as any"
size="small"
>
{{ cellProductStatusLabel(row.productStatus || '') }}
</el-tag>
<el-tag
v-if="isOutputMissingStorageSlot(row)"
@@ -144,6 +147,10 @@
import { formatDateOnly } from '@/utils/datetime-display'
import { resolveCellProductSpecDisplay } from '@/utils/cell-product-spec'
import { cellProductTypeNeedsPassage } from '@/utils/cell-product-type'
import {
cellProductStatusLabel,
cellProductStatusTagType
} from '@/utils/status-tag-registry'
defineOptions({ name: 'TaskOutputList' })
@@ -210,26 +217,6 @@
return resolveCellProductSpecDisplay(row)
}
function statusTagType(status: string) {
const map: Record<string, string> = {
frozen: 'success',
in_production: 'warning',
voided: 'danger',
thawed: 'info'
}
return map[status] || 'info'
}
function statusLabel(status: string) {
const map: Record<string, string> = {
frozen: '已冻存',
in_production: '生产中',
voided: '已作废',
thawed: '已复苏'
}
return map[status] || status || '—'
}
function handleAdd() {
editingItem.value = null
editingIndex.value = -1
@@ -189,7 +189,6 @@
:tasks-batch-loading="tasksBatchLoading"
@view="handleView"
@view-qc="handleViewQc"
@delivery-cell-outbound="handleDeliveryCellOutbound"
@dispatch="(row) => emit('dispatch', row)"
@dispatch-qc="(row) => emit('dispatch-qc', row)"
@complete="(row) => emit('complete', row)"
@@ -231,11 +230,6 @@
:lab-storage-code="saveSetLabStorageCode"
/>
<ProductionDeliveryCellOutboundDialog
v-model="deliveryCellOutboundVisible"
:work-order-id="deliveryCellOutboundWorkOrderId"
@saved="handleDeliveryCellOutboundSaved"
/>
</div>
</template>
@@ -249,7 +243,6 @@
import { PRODUCTION_WORK_ORDER_STATUS_FILTER_OPTIONS } from '@/utils/status-tag-registry'
import ProductionWorkOrderCardList from '../ProductionWorkOrderCardList.vue'
import ProductionWorkOrderQcViewDialog from '../ProductionWorkOrderQcViewDialog.vue'
import ProductionDeliveryCellOutboundDialog from '../ProductionDeliveryCellOutboundDialog.vue'
import SampleReceptionDialog from '../SampleReceptionDialog.vue'
import SaveProductionTaskSetDialog from '../SaveProductionTaskSetDialog.vue'
import { PRODUCTION_WORK_ORDER_VIEW_DIALOG_COMPONENTS } from '../view-dialogs/view-dialog-registry'
@@ -291,9 +284,6 @@
const saveSetLabStorageCode = computed(() =>
resolveWorkOrderLabStorageCode(saveSetRow.value)
)
const deliveryCellOutboundVisible = ref(false)
const deliveryCellOutboundWorkOrderId = ref('')
const {
cardMetaConfig,
keywordPlaceholder,
@@ -376,16 +366,6 @@
qcViewVisible.value = true
}
function handleDeliveryCellOutbound(row: ProductionWorkOrderItem) {
deliveryCellOutboundWorkOrderId.value = row.id || ''
deliveryCellOutboundVisible.value = true
}
function handleDeliveryCellOutboundSaved() {
loadData()
emit('data-changed')
}
function handleSampleReceptionSuccess() {
bumpTaskRefresh()
loadData()
@@ -66,13 +66,16 @@
header-align="center"
:index="(index) => (query.page - 1) * query.pageSize + index + 1"
/>
<el-table-column v-if="!isTeam" prop="projectNo" label="项目编号" min-width="160" />
<el-table-column
:prop="isTeam ? 'teamName' : 'projectName'"
:label="isTeam ? '项目组' : '项目名称'"
min-width="180"
/>
<el-table-column v-if="!isTeam" prop="projectNo" label="项目编号" min-width="160" />
<el-table-column v-if="!isTeam" prop="teamName" label="所属项目组" min-width="160" />
<el-table-column v-if="!isTeam" label="业务类型" min-width="200" show-overflow-tooltip>
<template #default="{ row }">{{ formatBizTypes(row.bizTypes) }}</template>
</el-table-column>
<el-table-column prop="leaderName" label="负责人" min-width="120" />
<el-table-column v-if="isTeam" label="成员" min-width="180" show-overflow-tooltip
><template #default="{ row }">{{
@@ -328,6 +331,16 @@
const projectBizLabels = computed(() =>
projectBizTypeSelectLabels(bizLabels, form.value.bizTypes as string[] | undefined)
)
function formatBizTypes(types: unknown) {
const list = Array.isArray(types)
? types
: typeof types === 'string'
? types.split(',').map((s) => s.trim()).filter(Boolean)
: []
if (!list.length) return '—'
return list.map((key) => bizLabels[key as keyof typeof bizLabels] || key).join('、')
}
async function load() {
loading.value = true
try {
@@ -25,7 +25,7 @@
<el-form-item v-if="!assignment" label="业务类型"
><el-select v-model="query.bizType" @change="resetBusinessFilters"
><el-option
v-for="(label, key) in bizLabels"
v-for="(label, key) in visibleBizLabels"
:key="key"
:value="key"
:label="label" /></el-select
@@ -202,7 +202,7 @@
:disabled="!targetTeamId"
/>
</el-form-item>
<el-form-item label="调整原因" required class="form-col-span-2">
<el-form-item label="调整原因" class="form-col-span-2">
<el-input v-model="reason" type="textarea" :maxlength="500" show-word-limit />
</el-form-item>
</el-form>
@@ -212,7 +212,7 @@
>
<el-button
type="primary"
:disabled="!target || !reason.trim()"
:disabled="!target"
:loading="busy"
@click="commit"
><el-icon><Check /></el-icon>确认调整</el-button
@@ -268,7 +268,7 @@
import { assignmentSnapshot } from '@/utils/project-management'
import { nextFilterOptionsEpoch } from '@/utils/filter-options-epoch'
import {
bizLabels,
visibleBizLabels,
fetchProjectRecords,
fetchAssignmentRecords,
fetchStatisticsRecords,
@@ -472,10 +472,6 @@
ElMessage.warning('请选择新项目')
return
}
if (!reason.value.trim()) {
ElMessage.warning('请填写调整原因')
return
}
const targets = editTargets.value.length ? [...editTargets.value] : [selected.value]
if (!targets.length || !targets[0]?.id) {
ElMessage.warning('请选择要调整的记录')
@@ -1,4 +1,8 @@
import type { AssignmentBizType, AssignmentRecord } from '@/api/project-management'
import {
isProjectBizTypeVisible,
type AssignmentBizType,
type AssignmentRecord
} from '@/api/project-management'
interface AssignmentColumn {
prop: keyof AssignmentRecord
@@ -6,13 +10,15 @@ interface AssignmentColumn {
minWidth: number
}
export const assignmentTabs: { key: AssignmentBizType; title: string }[] = [
{ key: 'cell_storage', title: '细胞存储' },
{ key: 'research_donation', title: '科研捐赠' },
{ key: 'pilot_service', title: '中试服务' },
{ key: 'basic_experiment', title: '临床科研' },
{ key: 'contract_processing', title: '委托加工' }
]
export const assignmentTabs: { key: AssignmentBizType; title: string }[] = (
[
{ key: 'cell_storage', title: '细胞存储' },
{ key: 'research_donation', title: '科研捐赠' },
{ key: 'pilot_service', title: '中试服务' },
{ key: 'basic_experiment', title: '临床科研' },
{ key: 'contract_processing', title: '委托加工' }
] as { key: AssignmentBizType; title: string }[]
).filter((item) => isProjectBizTypeVisible(item.key))
const collectionColumns: AssignmentColumn[] = [
{ prop: 'motherName', label: '母亲姓名', minWidth: 120 },
@@ -77,6 +77,7 @@
import {
fetchProjectStatistics,
bizLabels,
isProjectBizTypeVisible,
type BizType,
type ProjectRecord
} from '@/api/project-management'
@@ -91,14 +92,16 @@
unassignedTotals: ProjectRecord
presignTotal: number
}>({ items: [], totals: {}, unassignedTotals: {}, presignTotal: 0 })
const statisticsTypes: BizType[] = [
'presign',
'cell_storage',
'research_donation',
'pilot_service',
'basic_experiment',
'contract_processing'
]
const statisticsTypes: BizType[] = (
[
'presign',
'cell_storage',
'research_donation',
'pilot_service',
'basic_experiment',
'contract_processing'
] as BizType[]
).filter((key) => isProjectBizTypeVisible(key))
const applied = ref<ProjectRecord>({ groupBy: 'team' })
const displayRows = computed(() => [
...data.value.items,