Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2bc20e695f | ||
|
|
95b07639e8 | ||
|
|
f3672d3cc2 | ||
|
|
4de69c37ff | ||
|
|
9242ed0538 | ||
|
|
2e741b1284 | ||
|
|
6b1bf8a1d2 | ||
|
|
ef3e015ff9 |
No files matched your search
@@ -53,6 +53,7 @@ class ApplicationCreateBody(BaseModel):
|
||||
customer_name: Optional[str] = Field(None, alias="customerName")
|
||||
customer_contact: Optional[str] = Field(None, alias="customerContact")
|
||||
customer_phone: Optional[str] = Field(None, alias="customerPhone")
|
||||
research_category: Optional[str] = Field(None, alias="researchCategory")
|
||||
|
||||
|
||||
class ApplicationUpdateBody(BaseModel):
|
||||
@@ -65,6 +66,7 @@ class ApplicationUpdateBody(BaseModel):
|
||||
customer_name: Optional[str] = Field(None, alias="customerName")
|
||||
customer_contact: Optional[str] = Field(None, alias="customerContact")
|
||||
customer_phone: Optional[str] = Field(None, alias="customerPhone")
|
||||
research_category: Optional[str] = Field(None, alias="researchCategory")
|
||||
|
||||
|
||||
class PatientSaveBody(BaseModel):
|
||||
@@ -206,6 +208,7 @@ class ApplicationSaveBody(BaseModel):
|
||||
customer_name: Optional[str] = Field(None, alias="customerName")
|
||||
customer_contact: Optional[str] = Field(None, alias="customerContact")
|
||||
customer_phone: Optional[str] = Field(None, alias="customerPhone")
|
||||
research_category: Optional[str] = Field(None, alias="researchCategory")
|
||||
remark: Optional[str] = None
|
||||
consent_form_urls: Optional[str] = Field(None, alias="consentFormUrls")
|
||||
consent_attachments: Optional[list] = Field(None, alias="consentAttachments")
|
||||
@@ -287,6 +290,7 @@ async def api_create_application(
|
||||
"customerName": body.customer_name,
|
||||
"customerContact": body.customer_contact,
|
||||
"customerPhone": body.customer_phone,
|
||||
"researchCategory": body.research_category,
|
||||
}
|
||||
result = pilot_application.create_application(
|
||||
db,
|
||||
@@ -322,6 +326,8 @@ async def api_update_application(
|
||||
data["customerContact"] = body.customer_contact
|
||||
if body.customer_phone is not None:
|
||||
data["customerPhone"] = body.customer_phone
|
||||
if body.research_category is not None:
|
||||
data["researchCategory"] = body.research_category
|
||||
result = pilot_application.update_application(
|
||||
db, app_id=body.id, data=data, tenant_no=tenant_no
|
||||
)
|
||||
@@ -364,6 +370,8 @@ async def api_save_application(
|
||||
app_data["customerContact"] = body.customer_contact
|
||||
if body.customer_phone is not None:
|
||||
app_data["customerPhone"] = body.customer_phone
|
||||
if body.research_category is not None:
|
||||
app_data["researchCategory"] = body.research_category
|
||||
if body.consent_attachments is not None:
|
||||
app_data["consentAttachments"] = body.consent_attachments
|
||||
elif body.consent_form_urls is not None:
|
||||
@@ -380,7 +388,11 @@ async def api_save_application(
|
||||
):
|
||||
return error_response(400, "请选择渠道服务订单")
|
||||
|
||||
if not is_edit and biz_type == "clinical_application" and not app_data["channelId"]:
|
||||
if (
|
||||
not is_edit
|
||||
and biz_type in ("clinical_application", "basic_experiment")
|
||||
and not app_data["channelId"]
|
||||
):
|
||||
return error_response(400, "请选择渠道")
|
||||
|
||||
if is_edit:
|
||||
|
||||
@@ -49,7 +49,9 @@ from app.schemas.production_work_order import (
|
||||
ProductionWorkOrderCreate,
|
||||
ProductionWorkOrderConfigureBody,
|
||||
ProductionWorkOrderUpdate,
|
||||
ProductionDeliveryCellOutboundBody,
|
||||
)
|
||||
from app.crud import outbound_handover as outbound_handover_svc
|
||||
from app.schemas.production_task_set import (
|
||||
ProductionTaskSetCreateBody,
|
||||
ProductionTaskSetFromWorkOrderBody,
|
||||
@@ -2025,6 +2027,56 @@ async def list_production_work_order_cell_product_options(
|
||||
return error_response(400, str(e))
|
||||
|
||||
|
||||
@router.get("/production-work-orders/{wo_id}/delivery-cell-outbound")
|
||||
async def get_production_delivery_cell_outbound_api(
|
||||
wo_id: str,
|
||||
user: dict = Depends(require_admin_or_super_admin),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""临床科研出库工单 — 获取已确认的交付出库细胞。"""
|
||||
try:
|
||||
tenant_no = _get_tenant_no(db, user)
|
||||
data = outbound_handover_svc.get_production_delivery_cell_outbound(
|
||||
db, wo_id, tenant_no
|
||||
)
|
||||
return success_response(data)
|
||||
except HTTPException as e:
|
||||
return error_response(e.status_code, e.detail)
|
||||
except ValueError as e:
|
||||
return error_response(400, str(e))
|
||||
|
||||
|
||||
@router.put("/production-work-orders/{wo_id}/delivery-cell-outbound")
|
||||
async def save_production_delivery_cell_outbound_api(
|
||||
wo_id: str,
|
||||
body: ProductionDeliveryCellOutboundBody,
|
||||
user: dict = Depends(require_admin_or_super_admin),
|
||||
db: Session = Depends(get_db),
|
||||
):
|
||||
"""临床科研出库工单 — 确认出库细胞(写台账并联动库存)。"""
|
||||
try:
|
||||
tenant_no = _get_tenant_no(db, user)
|
||||
data = outbound_handover_svc.save_production_delivery_cell_outbound(
|
||||
db,
|
||||
wo_id,
|
||||
cells=body.cells or [],
|
||||
tenant_no=tenant_no,
|
||||
user_id=user.get("user_id") or "",
|
||||
create_dept_id=user.get("dept_id") or "",
|
||||
)
|
||||
db.commit()
|
||||
return success_response(data, message="出库细胞已确认")
|
||||
except HTTPException as e:
|
||||
db.rollback()
|
||||
return error_response(e.status_code, e.detail)
|
||||
except ValueError as e:
|
||||
db.rollback()
|
||||
return error_response(400, str(e))
|
||||
except Exception as e:
|
||||
db.rollback()
|
||||
return error_response(400, str(e))
|
||||
|
||||
|
||||
@router.get("/production-work-orders/{wo_id}/qc-info")
|
||||
async def get_production_work_order_qc_info_api(
|
||||
wo_id: str,
|
||||
|
||||
@@ -1178,6 +1178,9 @@ async def list_my_qc_tasks(
|
||||
qcBizType: Optional[str] = None,
|
||||
receptionSource: Optional[str] = Query(None, alias="receptionSource"),
|
||||
bizType: Optional[str] = Query(None, alias="bizType"),
|
||||
protocolStatus: Optional[str] = Query(
|
||||
None, alias="protocolStatus", description="协议/捐赠状态,多个用英文逗号分隔"
|
||||
),
|
||||
db: Session = Depends(get_db),
|
||||
user: dict = Depends(require_menu_code("biz:myQcTask:list")),
|
||||
):
|
||||
@@ -1194,6 +1197,7 @@ async def list_my_qc_tasks(
|
||||
qc_biz_type=qcBizType,
|
||||
reception_source=receptionSource,
|
||||
biz_type=bizType,
|
||||
protocol_status=protocolStatus,
|
||||
tenant_no=tenant_no,
|
||||
)
|
||||
return success_response(_page_payload(items, total, page, pageSize))
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,27 @@
|
||||
"""临床科研申请单 · 业务子类型(research_category)"""
|
||||
from typing import Optional
|
||||
|
||||
RESEARCH_CATEGORY_LABELS = {
|
||||
"bio_tech_clinical": "生物新技术临床科研",
|
||||
"joint_topic_declare": "临床课题联合申报",
|
||||
"bio_pharma_rd": "生物制药研发",
|
||||
}
|
||||
|
||||
RESEARCH_CATEGORY_CODES = tuple(RESEARCH_CATEGORY_LABELS.keys())
|
||||
|
||||
|
||||
def research_category_label(code: Optional[str]) -> str:
|
||||
if not code:
|
||||
return ""
|
||||
return RESEARCH_CATEGORY_LABELS.get(code, code)
|
||||
|
||||
|
||||
def validate_research_category(code: Optional[str], required: bool = False) -> str:
|
||||
value = (code or "").strip()
|
||||
if not value:
|
||||
if required:
|
||||
raise ValueError("请选择业务类型")
|
||||
return ""
|
||||
if value not in RESEARCH_CATEGORY_LABELS:
|
||||
raise ValueError("业务类型无效")
|
||||
return value
|
||||
@@ -23,14 +23,14 @@ def resolve_research_donation_protocol_status_filter(
|
||||
|
||||
Returns:
|
||||
("in", statuses) — 按所选状态 IN 过滤
|
||||
("none", []) — 显式空选择,无匹配结果
|
||||
("all", []) — 显式空选择,不限制协议状态
|
||||
("default", DEFAULT_QC_DONATION_PROTOCOL_STATUSES) — 未传参,与列表默认一致
|
||||
"""
|
||||
if protocol_status is None:
|
||||
return ("default", list(DEFAULT_QC_DONATION_PROTOCOL_STATUSES))
|
||||
statuses = [s.strip() for s in str(protocol_status).split(",") if s.strip()]
|
||||
if not statuses:
|
||||
return ("none", [])
|
||||
return ("all", [])
|
||||
return ("in", statuses)
|
||||
|
||||
_PROTOCOL_STATUS_LABELS = {
|
||||
|
||||
@@ -179,23 +179,38 @@ def save_outbound_handover(
|
||||
handover_person = handover_user_id
|
||||
|
||||
om = outbound_material or {}
|
||||
cells = om.get("cells") or []
|
||||
qc_materials = om.get("qcMaterials") or om.get("qc_materials") or []
|
||||
paper_materials = om.get("paperMaterials") or om.get("paper_materials") or []
|
||||
material_remark = om.get("remark")
|
||||
|
||||
biz_type = (detail.get("bizType") or "").strip()
|
||||
if not biz_type:
|
||||
biz_type = ((detail.get("application") or {}).get("bizType") or "").strip()
|
||||
# 临床科研:细胞出库由生产工单确认,市场交接只维护物料/交接信息
|
||||
cells_owned_by_production = biz_type == "basic_experiment"
|
||||
|
||||
# 读取保存前台账,用于回滚上次出库交接的库存/状态变更
|
||||
previous_material = orm_material_svc.get_outbound_material(db, schedule_id, tenant_no)
|
||||
previous_cells = previous_material.get("cells") or []
|
||||
previous_cell_ids = [
|
||||
(c.get("cellProductId") or c.get("cell_product_id") or "").strip()
|
||||
for c in (previous_material.get("cells") or [])
|
||||
for c in previous_cells
|
||||
]
|
||||
had_previous_handover = get_handover_by_schedule(db, schedule_id, tenant_no) is not None
|
||||
|
||||
if cells_owned_by_production:
|
||||
cells = previous_cells
|
||||
revert_cell_ids: List[str] = []
|
||||
apply_cells: List[Any] = []
|
||||
else:
|
||||
cells = om.get("cells") or []
|
||||
revert_cell_ids = previous_cell_ids if had_previous_handover else []
|
||||
apply_cells = cells
|
||||
|
||||
handover_inv_svc.revert_handover_inventory(
|
||||
db,
|
||||
schedule_id,
|
||||
cell_product_ids=previous_cell_ids if had_previous_handover else [],
|
||||
cell_product_ids=revert_cell_ids,
|
||||
tenant_no=tenant_no,
|
||||
user_id=user_id,
|
||||
)
|
||||
@@ -216,7 +231,7 @@ def save_outbound_handover(
|
||||
handover_inv_svc.apply_handover_inventory(
|
||||
db,
|
||||
schedule_id,
|
||||
cells=cells,
|
||||
cells=apply_cells,
|
||||
qc_materials=qc_materials,
|
||||
tenant_no=tenant_no,
|
||||
user_id=user_id,
|
||||
@@ -255,3 +270,111 @@ def save_outbound_handover(
|
||||
db.flush()
|
||||
|
||||
return get_outbound_handover(db, schedule_id, tenant_no)
|
||||
|
||||
|
||||
def _assert_basic_experiment_outbound_wo(wo: Any) -> str:
|
||||
"""校验临床科研出库工单,返回关联交付计划 ID。"""
|
||||
if not wo:
|
||||
raise HTTPException(status_code=404, detail="工单不存在")
|
||||
if (getattr(wo, "work_order_type", None) or "") != "outbound":
|
||||
raise HTTPException(status_code=400, detail="仅出库工单可确认出库细胞")
|
||||
if (getattr(wo, "biz_type", None) or "") != "basic_experiment":
|
||||
raise HTTPException(status_code=400, detail="仅临床科研出库工单可确认出库细胞")
|
||||
if (getattr(wo, "work_order_status", None) or "") == "yzf":
|
||||
raise HTTPException(status_code=400, detail="已作废工单不可确认出库细胞")
|
||||
schedule_id = (getattr(wo, "infusion_schedule_id", None) or "").strip()
|
||||
if not schedule_id:
|
||||
raise HTTPException(status_code=400, detail="工单未关联交付计划,无法确认出库细胞")
|
||||
return schedule_id
|
||||
|
||||
|
||||
def get_production_delivery_cell_outbound(
|
||||
db: Session,
|
||||
work_order_id: str,
|
||||
tenant_no: str,
|
||||
) -> Dict[str, Any]:
|
||||
"""生产工单 — 临床科研交付出库细胞编辑数据。"""
|
||||
from app.crud import production_work_order as production_work_order_svc
|
||||
|
||||
wo = production_work_order_svc.get_production_work_order(db, work_order_id, tenant_no)
|
||||
schedule_id = _assert_basic_experiment_outbound_wo(wo)
|
||||
detail = schedule_mgmt_svc.get_infusion_schedule_detail(db, schedule_id, tenant_no)
|
||||
if not detail:
|
||||
raise HTTPException(status_code=404, detail="交付计划不存在")
|
||||
outbound_material = orm_material_svc.get_outbound_material(db, schedule_id, tenant_no)
|
||||
return {
|
||||
"workOrderId": wo.id,
|
||||
"workOrderNo": wo.work_order_no or "",
|
||||
"infusionScheduleId": schedule_id,
|
||||
"scheduleSummary": {
|
||||
"applicationNo": detail.get("applicationNo") or "",
|
||||
"patientName": detail.get("patientName") or "",
|
||||
"infusionTime": detail.get("infusionTime") or "",
|
||||
"projectTitle": detail.get("projectTitle")
|
||||
or ((detail.get("application") or {}).get("projectTitle") or ""),
|
||||
"customerName": detail.get("customerName")
|
||||
or ((detail.get("application") or {}).get("customerName") or ""),
|
||||
},
|
||||
"cells": outbound_material.get("cells") or [],
|
||||
}
|
||||
|
||||
|
||||
def save_production_delivery_cell_outbound(
|
||||
db: Session,
|
||||
work_order_id: str,
|
||||
*,
|
||||
cells: List[Dict[str, Any]],
|
||||
tenant_no: str,
|
||||
user_id: str,
|
||||
create_dept_id: str = "",
|
||||
) -> Dict[str, Any]:
|
||||
"""生产确认临床科研交付出库细胞:写台账并联动细胞产品库存(不 commit)。"""
|
||||
from app.crud import production_work_order as production_work_order_svc
|
||||
|
||||
wo = production_work_order_svc.get_production_work_order(db, work_order_id, tenant_no)
|
||||
schedule_id = _assert_basic_experiment_outbound_wo(wo)
|
||||
detail = schedule_mgmt_svc.get_infusion_schedule_detail(db, schedule_id, tenant_no)
|
||||
if not detail:
|
||||
raise HTTPException(status_code=404, detail="交付计划不存在")
|
||||
|
||||
previous_material = orm_material_svc.get_outbound_material(db, schedule_id, tenant_no)
|
||||
previous_cell_ids = [
|
||||
(c.get("cellProductId") or c.get("cell_product_id") or "").strip()
|
||||
for c in (previous_material.get("cells") or [])
|
||||
]
|
||||
|
||||
# 仅回滚细胞;市场物料扣减由出库交接维护,不可一并撤销
|
||||
handover_inv_svc.revert_handover_inventory(
|
||||
db,
|
||||
schedule_id,
|
||||
cell_product_ids=previous_cell_ids,
|
||||
tenant_no=tenant_no,
|
||||
user_id=user_id,
|
||||
skip_materials=True,
|
||||
)
|
||||
|
||||
orm_material_svc.save_outbound_material(
|
||||
db,
|
||||
schedule_id,
|
||||
paper_attachments=None,
|
||||
paper_materials=previous_material.get("paperMaterials") or [],
|
||||
remark=previous_material.get("remark"),
|
||||
cells=cells or [],
|
||||
qc_materials=previous_material.get("qcMaterials") or [],
|
||||
tenant_no=tenant_no,
|
||||
user_id=user_id,
|
||||
create_dept_id=create_dept_id,
|
||||
)
|
||||
|
||||
handover_inv_svc.apply_handover_inventory(
|
||||
db,
|
||||
schedule_id,
|
||||
cells=cells or [],
|
||||
qc_materials=[],
|
||||
tenant_no=tenant_no,
|
||||
user_id=user_id,
|
||||
create_dept_id=create_dept_id,
|
||||
receiver_person="",
|
||||
)
|
||||
|
||||
return get_production_delivery_cell_outbound(db, work_order_id, tenant_no)
|
||||
@@ -264,30 +264,35 @@ def revert_handover_inventory(
|
||||
cell_product_ids: Iterable[str],
|
||||
tenant_no: str,
|
||||
user_id: Optional[str] = None,
|
||||
skip_materials: bool = False,
|
||||
) -> None:
|
||||
"""回滚本输注计划上次出库交接产生的库存/状态变更(不 commit)。"""
|
||||
"""回滚本输注计划上次出库交接产生的库存/状态变更(不 commit)。
|
||||
|
||||
skip_materials=True 时仅回滚细胞产品状态(临床科研由生产单独出库细胞时使用)。
|
||||
"""
|
||||
sid = (schedule_id or "").strip()
|
||||
if not sid:
|
||||
return
|
||||
|
||||
remark_prefix = _handover_usage_remark_prefix(sid)
|
||||
now = datetime.now()
|
||||
_revert_legacy_qc_handover_usages(
|
||||
db,
|
||||
schedule_id=sid,
|
||||
tenant_no=tenant_no,
|
||||
user_id=user_id,
|
||||
remark_prefix=remark_prefix,
|
||||
now=now,
|
||||
)
|
||||
_revert_market_handover_usages(
|
||||
db,
|
||||
schedule_id=sid,
|
||||
tenant_no=tenant_no,
|
||||
user_id=user_id,
|
||||
remark_prefix=remark_prefix,
|
||||
now=now,
|
||||
)
|
||||
if not skip_materials:
|
||||
_revert_legacy_qc_handover_usages(
|
||||
db,
|
||||
schedule_id=sid,
|
||||
tenant_no=tenant_no,
|
||||
user_id=user_id,
|
||||
remark_prefix=remark_prefix,
|
||||
now=now,
|
||||
)
|
||||
_revert_market_handover_usages(
|
||||
db,
|
||||
schedule_id=sid,
|
||||
tenant_no=tenant_no,
|
||||
user_id=user_id,
|
||||
remark_prefix=remark_prefix,
|
||||
now=now,
|
||||
)
|
||||
|
||||
seen: Set[str] = set()
|
||||
for raw_id in cell_product_ids:
|
||||
|
||||
@@ -25,6 +25,7 @@ from app.models.models import (
|
||||
)
|
||||
from app.crud import pilot_checkup
|
||||
from app.crud.collection_protocol import attachments_to_urls, urls_to_attachment_list
|
||||
from app.constants.research_category import validate_research_category
|
||||
|
||||
|
||||
# ────────────────────────────────────────────
|
||||
@@ -125,6 +126,7 @@ def _row_to_dict_application(row, db=None, tenant_no=None) -> Dict[str, Any]:
|
||||
"customerName": row.customer_name or "",
|
||||
"customerContact": row.customer_contact or "",
|
||||
"customerPhone": row.customer_phone or "",
|
||||
"researchCategory": getattr(row, "research_category", None) or "",
|
||||
"applicationStatus": row.application_status or "",
|
||||
"bizType": row.biz_type or "pilot_service",
|
||||
"channelServiceOrderId": row.channel_service_order_id or "",
|
||||
@@ -455,6 +457,7 @@ def create_application(
|
||||
customer_name = ""
|
||||
customer_contact = ""
|
||||
customer_phone = ""
|
||||
research_category = ""
|
||||
consent_form_urls = data.get("consentFormUrls") or None
|
||||
|
||||
if biz_type == "basic_experiment":
|
||||
@@ -466,13 +469,29 @@ def create_application(
|
||||
raise ValueError("请填写客户联系人")
|
||||
if not (data.get("customerPhone") or "").strip():
|
||||
raise ValueError("请填写客户联系方式")
|
||||
research_category = validate_research_category(
|
||||
data.get("researchCategory"), required=True
|
||||
)
|
||||
project_title = (data.get("projectTitle") or "").strip()
|
||||
customer_name = (data.get("customerName") or "").strip()
|
||||
customer_contact = (data.get("customerContact") or "").strip()
|
||||
customer_phone = (data.get("customerPhone") or "").strip()
|
||||
channel_service_order_id = ""
|
||||
channel_id = ""
|
||||
channel_name = ""
|
||||
channel_id = (data.get("channelId") or "").strip()
|
||||
if not channel_id:
|
||||
raise ValueError("请选择渠道")
|
||||
ch = (
|
||||
db.query(BizChannel)
|
||||
.filter(
|
||||
BizChannel.id == channel_id,
|
||||
BizChannel.tenant_no == tenant_no,
|
||||
BizChannel.del_flag == 0,
|
||||
)
|
||||
.first()
|
||||
)
|
||||
if not ch:
|
||||
raise ValueError("渠道不存在")
|
||||
channel_name = ch.channel_name or ""
|
||||
consent_form_urls = None
|
||||
elif not channel_service_order_id and biz_type != "clinical_application":
|
||||
raise ValueError("请选择渠道服务订单")
|
||||
@@ -527,6 +546,7 @@ def create_application(
|
||||
customer_name=customer_name or None,
|
||||
customer_contact=customer_contact or None,
|
||||
customer_phone=customer_phone or None,
|
||||
research_category=research_category or None,
|
||||
application_status="dks",
|
||||
channel_service_order_id=channel_service_order_id or "",
|
||||
channel_id=(
|
||||
@@ -586,6 +606,35 @@ def update_application(db: Session, app_id: str, data: dict, tenant_no: str) ->
|
||||
row.customer_contact = (data["customerContact"] or "").strip() or None
|
||||
if "customerPhone" in data and data["customerPhone"] is not None:
|
||||
row.customer_phone = (data["customerPhone"] or "").strip() or None
|
||||
if "researchCategory" in data and data["researchCategory"] is not None:
|
||||
if (row.biz_type or "") == "basic_experiment":
|
||||
row.research_category = validate_research_category(
|
||||
data.get("researchCategory"), required=True
|
||||
) or None
|
||||
else:
|
||||
row.research_category = validate_research_category(
|
||||
data.get("researchCategory"), required=False
|
||||
) or None
|
||||
if "channelId" in data and data["channelId"] is not None:
|
||||
if (row.biz_type or "") in ("basic_experiment", "clinical_application"):
|
||||
new_channel_id = (data.get("channelId") or "").strip()
|
||||
if not new_channel_id:
|
||||
raise ValueError("请选择渠道")
|
||||
ch = (
|
||||
db.query(BizChannel)
|
||||
.filter(
|
||||
BizChannel.id == new_channel_id,
|
||||
BizChannel.tenant_no == tenant_no,
|
||||
BizChannel.del_flag == 0,
|
||||
)
|
||||
.first()
|
||||
)
|
||||
if not ch:
|
||||
raise ValueError("渠道不存在")
|
||||
row.channel_id = new_channel_id
|
||||
row.channel_name = ch.channel_name or ""
|
||||
if (row.biz_type or "") == "basic_experiment":
|
||||
row.channel_service_order_id = ""
|
||||
if "consentFormUrls" in data:
|
||||
row.consent_form_urls = data.get("consentFormUrls") or None
|
||||
if "attachmentUrls" in data:
|
||||
|
||||
@@ -19,6 +19,7 @@ from app.crud.qc_work_order import (
|
||||
_sample_type_name_for_reception,
|
||||
_work_order_qc_biz_type,
|
||||
_OUTBOUND_BIZ_TYPE_LABELS,
|
||||
apply_research_donation_protocol_status_filter,
|
||||
build_work_order_list_summaries,
|
||||
)
|
||||
from app.core.db_collation import eq_unicode, unicode_ci
|
||||
@@ -574,6 +575,7 @@ def list_mine_tasks(
|
||||
qc_biz_type: Optional[str] = None,
|
||||
reception_source: Optional[str] = None,
|
||||
biz_type: Optional[str] = None,
|
||||
protocol_status: Optional[str] = None,
|
||||
tenant_no: Optional[str] = None,
|
||||
) -> Tuple[List[Dict[str, Any]], int]:
|
||||
def _filtered():
|
||||
@@ -632,6 +634,11 @@ def list_mine_tasks(
|
||||
bt_out = (biz_type or "").strip()
|
||||
if bt_out:
|
||||
q0 = q0.filter(BizQcWorkOrder.biz_type == bt_out)
|
||||
q0 = apply_research_donation_protocol_status_filter(
|
||||
q0,
|
||||
protocol_status,
|
||||
reception_source=reception_source,
|
||||
)
|
||||
return q0
|
||||
|
||||
total = _filtered().order_by(None).with_entities(func.count(BizQcTask.id)).scalar() or 0
|
||||
|
||||
@@ -1718,8 +1718,8 @@ def apply_research_donation_protocol_status_filter(
|
||||
return query
|
||||
|
||||
mode, statuses = resolve_research_donation_protocol_status_filter(protocol_status)
|
||||
if mode == "none":
|
||||
return query.filter(BizQcWorkOrder.id.in_([]))
|
||||
if mode == "all":
|
||||
return query
|
||||
if mode == "in":
|
||||
return query.filter(_research_donation_status_exists(statuses))
|
||||
# default:与前端默认勾选一致
|
||||
|
||||
@@ -4182,6 +4182,11 @@ class BizPilotApplication(Base):
|
||||
customer_name = Column(String(200), nullable=True, comment="客户名称(临床科研)")
|
||||
customer_contact = Column(String(100), nullable=True, comment="客户联系人(临床科研)")
|
||||
customer_phone = Column(String(32), nullable=True, comment="客户联系方式(临床科研)")
|
||||
research_category = Column(
|
||||
String(32),
|
||||
nullable=True,
|
||||
comment="临床科研业务子类型: bio_tech_clinical/joint_topic_declare/bio_pharma_rd",
|
||||
)
|
||||
application_status = Column(String(16), nullable=False, default="dks", comment="dks待开始 jxz进行中 ywc已完成 yzf已作废")
|
||||
channel_service_order_id = Column(String(64), nullable=False, comment="渠道服务购买订单ID")
|
||||
channel_id = Column(String(64), nullable=True, comment="渠道ID(缓存自服务订单)")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from typing import Optional
|
||||
from typing import Any, Dict, List, Optional
|
||||
from datetime import datetime
|
||||
|
||||
|
||||
@@ -57,3 +57,11 @@ class ProductionWorkOrderConfigureBody(BaseModel):
|
||||
route_id: Optional[str] = Field(None, alias="routeId")
|
||||
description: Optional[str] = Field("", alias="description")
|
||||
remark: Optional[str] = Field("", alias="remark")
|
||||
|
||||
|
||||
class ProductionDeliveryCellOutboundBody(BaseModel):
|
||||
"""临床科研出库工单 — 确认出库细胞。"""
|
||||
|
||||
model_config = ConfigDict(populate_by_name=True)
|
||||
|
||||
cells: List[Dict[str, Any]] = Field(default_factory=list, description="出库细胞产品列表")
|
||||
@@ -28,6 +28,8 @@ class TestBasicExperimentCreateValidation(unittest.TestCase):
|
||||
db = MagicMock()
|
||||
data = {
|
||||
"bizType": "basic_experiment",
|
||||
"researchCategory": "bio_tech_clinical",
|
||||
"channelId": "ch-1",
|
||||
"projectTitle": "课题A",
|
||||
"customerName": "",
|
||||
"customerContact": "张三",
|
||||
@@ -43,6 +45,46 @@ class TestBasicExperimentCreateValidation(unittest.TestCase):
|
||||
)
|
||||
self.assertIn("客户名称", str(ctx.exception))
|
||||
|
||||
def test_create_basic_experiment_requires_research_category(self):
|
||||
db = MagicMock()
|
||||
data = {
|
||||
"bizType": "basic_experiment",
|
||||
"channelId": "ch-1",
|
||||
"projectTitle": "课题A",
|
||||
"customerName": "客户A",
|
||||
"customerContact": "张三",
|
||||
"customerPhone": "13800000000",
|
||||
}
|
||||
with self.assertRaises(ValueError) as ctx:
|
||||
crud.create_application(
|
||||
db,
|
||||
data=data,
|
||||
tenant_no="zkxw",
|
||||
user_id="user-1",
|
||||
dept_id="dept-1",
|
||||
)
|
||||
self.assertIn("业务类型", str(ctx.exception))
|
||||
|
||||
def test_create_basic_experiment_requires_channel(self):
|
||||
db = MagicMock()
|
||||
data = {
|
||||
"bizType": "basic_experiment",
|
||||
"researchCategory": "bio_tech_clinical",
|
||||
"projectTitle": "课题A",
|
||||
"customerName": "客户A",
|
||||
"customerContact": "张三",
|
||||
"customerPhone": "13800000000",
|
||||
}
|
||||
with self.assertRaises(ValueError) as ctx:
|
||||
crud.create_application(
|
||||
db,
|
||||
data=data,
|
||||
tenant_no="zkxw",
|
||||
user_id="user-1",
|
||||
dept_id="dept-1",
|
||||
)
|
||||
self.assertIn("渠道", str(ctx.exception))
|
||||
|
||||
|
||||
class TestBasicExperimentSaleSchedules(unittest.TestCase):
|
||||
@patch("app.crud.pilot_application.create_schedule")
|
||||
|
||||
@@ -0,0 +1,172 @@
|
||||
"""临床科研:生产确认出库细胞 / 市场交接不改细胞库存。"""
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from fastapi import HTTPException
|
||||
|
||||
|
||||
class TestAssertBasicExperimentOutboundWo(unittest.TestCase):
|
||||
def test_rejects_non_outbound(self):
|
||||
from app.crud.outbound_handover import _assert_basic_experiment_outbound_wo
|
||||
|
||||
wo = MagicMock(
|
||||
work_order_type="inbound",
|
||||
biz_type="basic_experiment",
|
||||
work_order_status="jxz",
|
||||
infusion_schedule_id="s1",
|
||||
)
|
||||
with self.assertRaises(HTTPException) as ctx:
|
||||
_assert_basic_experiment_outbound_wo(wo)
|
||||
self.assertEqual(ctx.exception.status_code, 400)
|
||||
|
||||
def test_rejects_other_biz_type(self):
|
||||
from app.crud.outbound_handover import _assert_basic_experiment_outbound_wo
|
||||
|
||||
wo = MagicMock(
|
||||
work_order_type="outbound",
|
||||
biz_type="pilot_service",
|
||||
work_order_status="jxz",
|
||||
infusion_schedule_id="s1",
|
||||
)
|
||||
with self.assertRaises(HTTPException) as ctx:
|
||||
_assert_basic_experiment_outbound_wo(wo)
|
||||
self.assertEqual(ctx.exception.status_code, 400)
|
||||
|
||||
def test_ok_returns_schedule_id(self):
|
||||
from app.crud.outbound_handover import _assert_basic_experiment_outbound_wo
|
||||
|
||||
wo = MagicMock(
|
||||
work_order_type="outbound",
|
||||
biz_type="basic_experiment",
|
||||
work_order_status="jxz",
|
||||
infusion_schedule_id="sched-1",
|
||||
)
|
||||
self.assertEqual(_assert_basic_experiment_outbound_wo(wo), "sched-1")
|
||||
|
||||
|
||||
class TestSaveOutboundHandoverBasicExperiment(unittest.TestCase):
|
||||
@patch("app.crud.outbound_handover.handover_inv_svc")
|
||||
@patch("app.crud.outbound_handover.orm_material_svc")
|
||||
@patch("app.crud.outbound_handover.get_outbound_handover")
|
||||
@patch("app.crud.outbound_handover.get_handover_by_schedule")
|
||||
@patch("app.crud.outbound_handover.schedule_mgmt_svc")
|
||||
def test_market_keeps_previous_cells_and_skips_cell_inventory(
|
||||
self,
|
||||
schedule_mgmt_svc,
|
||||
get_handover_by_schedule,
|
||||
get_outbound_handover,
|
||||
orm_material_svc,
|
||||
handover_inv_svc,
|
||||
):
|
||||
from app.crud.outbound_handover import save_outbound_handover
|
||||
|
||||
schedule_mgmt_svc.get_infusion_schedule_detail.return_value = {
|
||||
"bizType": "basic_experiment",
|
||||
"applicationNo": "A1",
|
||||
}
|
||||
previous_cells = [{"cellProductId": "cp-prod", "productCode": "P1"}]
|
||||
orm_material_svc.get_outbound_material.return_value = {
|
||||
"cells": previous_cells,
|
||||
"qcMaterials": [],
|
||||
"paperMaterials": [],
|
||||
"remark": "",
|
||||
}
|
||||
get_handover_by_schedule.return_value = None
|
||||
get_outbound_handover.return_value = {"ok": True}
|
||||
|
||||
db = MagicMock()
|
||||
sys_user = MagicMock(nick_name="张三", user_no="u1", del_flag=0)
|
||||
db.query.return_value.filter.return_value.first.return_value = sys_user
|
||||
|
||||
save_outbound_handover(
|
||||
db,
|
||||
"sched-1",
|
||||
outbound_material={
|
||||
"cells": [{"cellProductId": "cp-market-tamper"}],
|
||||
"qcMaterials": [{"materialId": "m1", "qty": 1}],
|
||||
"paperMaterials": [],
|
||||
},
|
||||
handover={
|
||||
"handoverUserId": "u1",
|
||||
"receiverPerson": "李四",
|
||||
"handoverTime": "2026-11-20 10:00:00",
|
||||
},
|
||||
tenant_no="t1",
|
||||
user_id="u1",
|
||||
)
|
||||
|
||||
handover_inv_svc.revert_handover_inventory.assert_called_once()
|
||||
revert_kwargs = handover_inv_svc.revert_handover_inventory.call_args.kwargs
|
||||
self.assertEqual(revert_kwargs["cell_product_ids"], [])
|
||||
|
||||
save_kwargs = orm_material_svc.save_outbound_material.call_args.kwargs
|
||||
self.assertEqual(save_kwargs["cells"], previous_cells)
|
||||
|
||||
apply_kwargs = handover_inv_svc.apply_handover_inventory.call_args.kwargs
|
||||
self.assertEqual(apply_kwargs["cells"], [])
|
||||
self.assertEqual(apply_kwargs["qc_materials"], [{"materialId": "m1", "qty": 1}])
|
||||
|
||||
|
||||
class TestSaveProductionDeliveryCellOutbound(unittest.TestCase):
|
||||
@patch("app.crud.outbound_handover.get_production_delivery_cell_outbound")
|
||||
@patch("app.crud.outbound_handover.handover_inv_svc")
|
||||
@patch("app.crud.outbound_handover.orm_material_svc")
|
||||
@patch("app.crud.outbound_handover.schedule_mgmt_svc")
|
||||
@patch("app.crud.production_work_order.get_production_work_order")
|
||||
def test_reverts_cells_only_then_applies(
|
||||
self,
|
||||
get_wo,
|
||||
schedule_mgmt_svc,
|
||||
orm_material_svc,
|
||||
handover_inv_svc,
|
||||
get_delivery,
|
||||
):
|
||||
from app.crud.outbound_handover import save_production_delivery_cell_outbound
|
||||
|
||||
get_wo.return_value = MagicMock(
|
||||
id="wo1",
|
||||
work_order_no="WO1",
|
||||
work_order_type="outbound",
|
||||
biz_type="basic_experiment",
|
||||
work_order_status="jxz",
|
||||
infusion_schedule_id="sched-1",
|
||||
)
|
||||
schedule_mgmt_svc.get_infusion_schedule_detail.return_value = {
|
||||
"bizType": "basic_experiment"
|
||||
}
|
||||
orm_material_svc.get_outbound_material.return_value = {
|
||||
"cells": [{"cellProductId": "old-cp"}],
|
||||
"qcMaterials": [{"materialId": "m1", "qty": 2}],
|
||||
"paperMaterials": [{"paperName": "出库单", "copies": 1}],
|
||||
"remark": "keep",
|
||||
}
|
||||
get_delivery.return_value = {"cells": []}
|
||||
|
||||
cells = [{"cellProductId": "new-cp"}]
|
||||
save_production_delivery_cell_outbound(
|
||||
MagicMock(),
|
||||
"wo1",
|
||||
cells=cells,
|
||||
tenant_no="t1",
|
||||
user_id="u1",
|
||||
create_dept_id="d1",
|
||||
)
|
||||
|
||||
revert_kwargs = handover_inv_svc.revert_handover_inventory.call_args.kwargs
|
||||
self.assertEqual(revert_kwargs["cell_product_ids"], ["old-cp"])
|
||||
self.assertTrue(revert_kwargs["skip_materials"])
|
||||
|
||||
save_kwargs = orm_material_svc.save_outbound_material.call_args.kwargs
|
||||
self.assertEqual(save_kwargs["cells"], cells)
|
||||
self.assertEqual(save_kwargs["qc_materials"], [{"materialId": "m1", "qty": 2}])
|
||||
self.assertEqual(
|
||||
save_kwargs["paper_materials"], [{"paperName": "出库单", "copies": 1}]
|
||||
)
|
||||
|
||||
apply_kwargs = handover_inv_svc.apply_handover_inventory.call_args.kwargs
|
||||
self.assertEqual(apply_kwargs["cells"], cells)
|
||||
self.assertEqual(apply_kwargs["qc_materials"], [])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -17,8 +17,8 @@ def test_explicit_statuses_returned():
|
||||
assert resolve_research_donation_protocol_status_filter("dsx,sxz") == ("in", ["dsx", "sxz"])
|
||||
|
||||
|
||||
def test_explicit_empty_means_none():
|
||||
assert resolve_research_donation_protocol_status_filter("") == ("none", [])
|
||||
def test_explicit_empty_means_all():
|
||||
assert resolve_research_donation_protocol_status_filter("") == ("all", [])
|
||||
|
||||
|
||||
def test_missing_means_default_dsx_sxz():
|
||||
@@ -27,5 +27,5 @@ def test_missing_means_default_dsx_sxz():
|
||||
assert statuses == ["dsx", "sxz"]
|
||||
|
||||
|
||||
def test_whitespace_only_means_none():
|
||||
assert resolve_research_donation_protocol_status_filter(" , ") == ("none", [])
|
||||
def test_whitespace_only_means_all():
|
||||
assert resolve_research_donation_protocol_status_filter(" , ") == ("all", [])
|
||||
@@ -0,0 +1,20 @@
|
||||
-- 临床科研申请单:业务子类型 research_category
|
||||
-- MySQL 5.7,可重复执行。
|
||||
|
||||
SET @col_exists := (
|
||||
SELECT COUNT(*)
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = DATABASE()
|
||||
AND TABLE_NAME = 'biz_pilot_application'
|
||||
AND COLUMN_NAME = 'research_category'
|
||||
);
|
||||
|
||||
SET @sql := IF(
|
||||
@col_exists = 0,
|
||||
"ALTER TABLE biz_pilot_application ADD COLUMN research_category VARCHAR(32) NULL COMMENT '临床科研业务子类型: bio_tech_clinical/joint_topic_declare/bio_pharma_rd' AFTER customer_phone",
|
||||
'SELECT 1'
|
||||
);
|
||||
|
||||
PREPARE stmt FROM @sql;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
@@ -316,3 +316,45 @@ 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
|
||||
})
|
||||
}
|
||||
@@ -170,6 +170,8 @@ export function fetchMyQcTaskList(params?: {
|
||||
qcBizType?: string
|
||||
receptionSource?: string
|
||||
bizType?: string
|
||||
/** 科研捐赠:协议/捐赠状态,多个逗号分隔;空串=不限制 */
|
||||
protocolStatus?: string
|
||||
}) {
|
||||
return request.get<PageList<QcTask>>({
|
||||
url: '/web/admin/qc-tasks/mine',
|
||||
|
||||
@@ -4,10 +4,16 @@
|
||||
<div class="outbound-material-form-sections">
|
||||
<div class="material-sections">
|
||||
<!-- 出库细胞 -->
|
||||
<section class="section-card">
|
||||
<section v-if="showCells" 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="!cellsReadonly"
|
||||
type="primary"
|
||||
size="small"
|
||||
class="btn-main"
|
||||
@click="openCellSelect"
|
||||
>
|
||||
<el-icon><Plus /></el-icon>
|
||||
添加细胞产品
|
||||
</el-button>
|
||||
@@ -18,7 +24,7 @@
|
||||
class="list-table inner-table"
|
||||
stripe
|
||||
max-height="280"
|
||||
empty-text="请从细胞产品库勾选"
|
||||
:empty-text="cellsReadonly ? '暂无生产确认的出库细胞' : '请从细胞产品库勾选'"
|
||||
>
|
||||
<el-table-column type="index" label="序号" min-width="56" align="center" />
|
||||
<el-table-column
|
||||
@@ -56,7 +62,13 @@
|
||||
<span v-else>—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="80" align="center" fixed="right">
|
||||
<el-table-column
|
||||
v-if="!cellsReadonly"
|
||||
label="操作"
|
||||
min-width="80"
|
||||
align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template #default="{ $index }">
|
||||
<el-button type="danger" link size="small" @click="removeCellRow($index)">
|
||||
<el-icon><Delete /></el-icon>
|
||||
@@ -69,7 +81,7 @@
|
||||
</section>
|
||||
|
||||
<!-- 使用的物料 -->
|
||||
<section class="section-card">
|
||||
<section v-if="showMaterials" 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="addMaterialRow">
|
||||
@@ -145,7 +157,7 @@
|
||||
</section>
|
||||
|
||||
<!-- 纸质材料 -->
|
||||
<section class="section-card">
|
||||
<section v-if="showPapers" 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="addPaperRow">
|
||||
@@ -289,7 +301,7 @@
|
||||
<p v-else class="section-empty-hint">点击「添加纸质材料」逐条填写名称、份数并上传附件;仅作台账留存,不扣库存</p>
|
||||
</section>
|
||||
|
||||
<el-form label-position="top" class="biz-dialog-form">
|
||||
<el-form v-if="showRemark" label-position="top" class="biz-dialog-form">
|
||||
<el-form-item label="备注">
|
||||
<el-input
|
||||
v-model="formRemark"
|
||||
@@ -424,9 +436,20 @@
|
||||
defineProps<{
|
||||
/** 出库交接等需扣库存场景:仅允许选择已冻存细胞,且已选行保留可选 */
|
||||
requireFrozenCellProduct?: boolean
|
||||
/** 临床科研市场交接:细胞由生产确认,仅只读展示 */
|
||||
cellsReadonly?: boolean
|
||||
showCells?: boolean
|
||||
showMaterials?: boolean
|
||||
showPapers?: boolean
|
||||
showRemark?: boolean
|
||||
}>(),
|
||||
{
|
||||
requireFrozenCellProduct: false
|
||||
requireFrozenCellProduct: false,
|
||||
cellsReadonly: false,
|
||||
showCells: true,
|
||||
showMaterials: true,
|
||||
showPapers: true,
|
||||
showRemark: true
|
||||
}
|
||||
)
|
||||
|
||||
@@ -785,34 +808,38 @@
|
||||
}
|
||||
|
||||
function validateMaterial() {
|
||||
if (paperRows.value.some((r) => r._uploading)) {
|
||||
if (props.showPapers && paperRows.value.some((r) => r._uploading)) {
|
||||
ElMessage.warning('纸质材料附件上传中,请稍候')
|
||||
return false
|
||||
}
|
||||
for (const row of materialRows.value) {
|
||||
if (!row.materialId) {
|
||||
ElMessage.warning('请为每条物料选择名称')
|
||||
return false
|
||||
}
|
||||
const qty = row.qty
|
||||
if (qty == null || !Number.isFinite(Number(qty)) || Number(qty) <= 0) {
|
||||
ElMessage.warning('物料计划用量须大于 0')
|
||||
return false
|
||||
if (props.showMaterials) {
|
||||
for (const row of materialRows.value) {
|
||||
if (!row.materialId) {
|
||||
ElMessage.warning('请为每条物料选择名称')
|
||||
return false
|
||||
}
|
||||
const qty = row.qty
|
||||
if (qty == null || !Number.isFinite(Number(qty)) || Number(qty) <= 0) {
|
||||
ElMessage.warning('物料计划用量须大于 0')
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const row of paperRows.value) {
|
||||
if (!row.paperName?.trim()) {
|
||||
ElMessage.warning('请填写每条纸质材料的名称')
|
||||
return false
|
||||
}
|
||||
const copies = row.copies
|
||||
if (copies == null || !Number.isFinite(Number(copies)) || Number(copies) <= 0) {
|
||||
ElMessage.warning('纸质材料份数须大于 0')
|
||||
return false
|
||||
}
|
||||
if (!row.attachments.length) {
|
||||
ElMessage.warning('请为每条纸质材料上传附件')
|
||||
return false
|
||||
if (props.showPapers) {
|
||||
for (const row of paperRows.value) {
|
||||
if (!row.paperName?.trim()) {
|
||||
ElMessage.warning('请填写每条纸质材料的名称')
|
||||
return false
|
||||
}
|
||||
const copies = row.copies
|
||||
if (copies == null || !Number.isFinite(Number(copies)) || Number(copies) <= 0) {
|
||||
ElMessage.warning('纸质材料份数须大于 0')
|
||||
return false
|
||||
}
|
||||
if (!row.attachments.length) {
|
||||
ElMessage.warning('请为每条纸质材料上传附件')
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
|
||||
@@ -62,7 +62,7 @@ export const PILOT_BIZ_TYPE_CONFIG: Record<PilotBizType, PilotBizTypeConfig> = {
|
||||
basic_experiment: {
|
||||
label: '临床科研',
|
||||
applicationNoPrefix: 'JCSY',
|
||||
showChannel: false,
|
||||
showChannel: true,
|
||||
showPatient: false,
|
||||
showConsent: false,
|
||||
showOtherAttachments: false,
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/** 临床科研申请单 · 业务子类型(researchCategory) */
|
||||
export const CLINICAL_RESEARCH_CATEGORY_OPTIONS = [
|
||||
{ value: 'bio_tech_clinical', label: '生物新技术临床科研' },
|
||||
{ value: 'joint_topic_declare', label: '临床课题联合申报' },
|
||||
{ value: 'bio_pharma_rd', label: '生物制药研发' }
|
||||
] as const
|
||||
|
||||
export type ClinicalResearchCategory =
|
||||
(typeof CLINICAL_RESEARCH_CATEGORY_OPTIONS)[number]['value']
|
||||
|
||||
const LABEL_MAP = Object.fromEntries(
|
||||
CLINICAL_RESEARCH_CATEGORY_OPTIONS.map((o) => [o.value, o.label])
|
||||
) as Record<string, string>
|
||||
|
||||
export function clinicalResearchCategoryLabel(code?: string | null): string {
|
||||
if (!code) return ''
|
||||
return LABEL_MAP[code] || code
|
||||
}
|
||||
@@ -25,7 +25,7 @@ describe('donation protocol status filter helpers', () => {
|
||||
|
||||
it('matchesProtocolStatusFilter semantics', () => {
|
||||
assert.equal(matchesProtocolStatusFilter('yzf', undefined), true)
|
||||
assert.equal(matchesProtocolStatusFilter('yzf', []), false)
|
||||
assert.equal(matchesProtocolStatusFilter('yzf', []), true)
|
||||
assert.equal(matchesProtocolStatusFilter('sxz', ['dsx', 'sxz']), true)
|
||||
assert.equal(matchesProtocolStatusFilter('yzf', ['dsx', 'sxz']), false)
|
||||
assert.equal(matchesProtocolStatusFilter('', ['dsx']), false)
|
||||
|
||||
@@ -18,7 +18,7 @@ export const DEFAULT_DONATION_PROTOCOL_STATUS_FILTER = ['dsx', 'sxz']
|
||||
/**
|
||||
* 拼协议状态查询参数。
|
||||
* - 有选中:逗号串
|
||||
* - 空数组:返回 ''(显式空;勿当 undefined)
|
||||
* - 空数组:返回 ''(显式空=不限制;勿当 undefined,undefined 会走后端默认勾选)
|
||||
*/
|
||||
export function joinProtocolStatusFilter(statuses: string[]): string {
|
||||
return statuses.map((s) => s.trim()).filter(Boolean).join(',')
|
||||
@@ -27,13 +27,12 @@ export function joinProtocolStatusFilter(statuses: string[]): string {
|
||||
/**
|
||||
* 协议状态是否命中筛选。
|
||||
* - filter === undefined:不限制
|
||||
* - filter 为空数组:无匹配
|
||||
* - filter 为空数组:不限制(显式清空)
|
||||
*/
|
||||
export function matchesProtocolStatusFilter(
|
||||
status: string,
|
||||
filter: string[] | undefined
|
||||
): boolean {
|
||||
if (filter === undefined) return true
|
||||
if (!filter.length) return false
|
||||
if (filter === undefined || !filter.length) return true
|
||||
return filter.includes((status || '').trim())
|
||||
}
|
||||
@@ -27,13 +27,15 @@ export type QcTaskMineFilters = {
|
||||
keyword?: string
|
||||
taskType?: string
|
||||
taskStatus?: string
|
||||
/** 科研捐赠:协议状态逗号串;''=不限制;缺省不传 */
|
||||
protocolStatus?: string
|
||||
tabKey: QcWorkOrderTabKey
|
||||
}
|
||||
|
||||
export type MineWorkOrderSearchFilters = {
|
||||
keyword?: string
|
||||
workOrderStatus?: string | string[]
|
||||
/** 科研捐赠 Tab:协议/捐赠状态多选;undefined=不限制;[]=无匹配 */
|
||||
/** 科研捐赠 Tab:协议/捐赠状态多选;undefined/[]=不限制 */
|
||||
protocolStatus?: string[]
|
||||
triggerSource?: string
|
||||
qcCategory?: string
|
||||
@@ -145,6 +147,8 @@ export async function fetchAllMineTasks(filters: QcTaskMineFilters): Promise<QcT
|
||||
let page = 1
|
||||
const all: QcTask[] = []
|
||||
let total = 0
|
||||
const protocolStatusParam =
|
||||
filters.tabKey === 'inbound_research_donation' ? (filters.protocolStatus ?? '') : undefined
|
||||
while (true) {
|
||||
const res = await fetchMyQcTaskList({
|
||||
page,
|
||||
@@ -154,7 +158,8 @@ export async function fetchAllMineTasks(filters: QcTaskMineFilters): Promise<QcT
|
||||
taskStatus: filters.taskStatus || undefined,
|
||||
qcBizType: listQuery.workOrderType,
|
||||
receptionSource: listQuery.receptionSource,
|
||||
bizType: listQuery.bizType
|
||||
bizType: listQuery.bizType,
|
||||
...(protocolStatusParam !== undefined ? { protocolStatus: protocolStatusParam } : {})
|
||||
})
|
||||
const list = res.list || []
|
||||
all.push(...list)
|
||||
|
||||
+8
-1
@@ -31,7 +31,11 @@
|
||||
</div>
|
||||
|
||||
<div v-loading="loading" class="handover-body">
|
||||
<OutboundMaterialFormSections ref="materialSectionsRef" require-frozen-cell-product />
|
||||
<OutboundMaterialFormSections
|
||||
ref="materialSectionsRef"
|
||||
require-frozen-cell-product
|
||||
:cells-readonly="isBasicExperiment"
|
||||
/>
|
||||
|
||||
<section class="section-card handover-form-section">
|
||||
<h3 class="section-title section-title--mint-bar">交接信息</h3>
|
||||
@@ -264,6 +268,9 @@
|
||||
const pickupTimeLabel = computed(
|
||||
() => getPilotBizConfig(resolvePilotBizType(props.bizType)).pickupTimeLabel
|
||||
)
|
||||
const isBasicExperiment = computed(
|
||||
() => resolvePilotBizType(props.bizType) === 'basic_experiment'
|
||||
)
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:modelValue', val: boolean): void
|
||||
|
||||
@@ -71,6 +71,39 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
<template v-if="isBasicExperiment">
|
||||
<el-form-item label="业务类型" prop="researchCategory">
|
||||
<el-select
|
||||
v-model="formData.researchCategory"
|
||||
class="w-full"
|
||||
clearable
|
||||
placeholder="请选择业务类型"
|
||||
>
|
||||
<el-option
|
||||
v-for="opt in clinicalResearchCategoryOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value"
|
||||
/>
|
||||
</el-select>
|
||||
</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>
|
||||
</el-form-item>
|
||||
<el-form-item label="课题名称" prop="projectTitle">
|
||||
<el-input v-model="formData.projectTitle" placeholder="请输入课题名称" />
|
||||
</el-form-item>
|
||||
@@ -92,7 +125,11 @@
|
||||
/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
<el-form-item v-if="bizConfig.showChannel" label="渠道" prop="channelId">
|
||||
<el-form-item
|
||||
v-if="bizConfig.showChannel && !isBasicExperiment"
|
||||
label="渠道"
|
||||
prop="channelId"
|
||||
>
|
||||
<el-select
|
||||
v-model="formData.channelId"
|
||||
class="w-full"
|
||||
@@ -1284,9 +1321,12 @@
|
||||
} from '@/utils/status-tag-registry'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { getPilotBizConfig } from '@/config/pilot-biz-type'
|
||||
import { CLINICAL_RESEARCH_CATEGORY_OPTIONS } from '@/constants/clinical-research-category'
|
||||
|
||||
defineOptions({ name: 'ApplicationFormDialog' })
|
||||
|
||||
const clinicalResearchCategoryOptions = CLINICAL_RESEARCH_CATEGORY_OPTIONS
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue: boolean
|
||||
editId: string | null
|
||||
@@ -1342,7 +1382,8 @@
|
||||
projectTitle: '',
|
||||
customerName: '',
|
||||
customerContact: '',
|
||||
customerPhone: ''
|
||||
customerPhone: '',
|
||||
researchCategory: ''
|
||||
})
|
||||
|
||||
type SaleProductLine = {
|
||||
@@ -1371,6 +1412,7 @@
|
||||
channelServiceOrderId: [
|
||||
{ required: true, message: '请选择服务订单', trigger: 'change' }
|
||||
],
|
||||
researchCategory: [{ required: true, message: '请选择业务类型', trigger: 'change' }],
|
||||
projectTitle: [{ required: true, message: '请填写课题名称', trigger: 'blur' }],
|
||||
customerName: [{ required: true, message: '请填写客户名称', trigger: 'blur' }],
|
||||
customerContact: [{ required: true, message: '请填写客户联系人', trigger: 'blur' }],
|
||||
@@ -1437,12 +1479,14 @@
|
||||
formData.channelServiceOrderId = ''
|
||||
serviceOrderOptions.value = []
|
||||
|
||||
if (isClinical.value) {
|
||||
// 临床:价格池与渠道无关;切换渠道时勿清空 agreementPriceOptions(否则「添加细胞产品」会失效)
|
||||
clearScheduleCellProducts()
|
||||
if (!channelId) return
|
||||
if (!agreementPriceOptions.value.length) {
|
||||
await loadClinicalCellProductPrices()
|
||||
if (isClinical.value || isBasicExperiment.value) {
|
||||
// 临床/临床科研:不依赖服务订单;临床还需价格池
|
||||
if (isClinical.value) {
|
||||
clearScheduleCellProducts()
|
||||
if (!channelId) return
|
||||
if (!agreementPriceOptions.value.length) {
|
||||
await loadClinicalCellProductPrices()
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -2798,6 +2842,7 @@
|
||||
formData.customerName = ''
|
||||
formData.customerContact = ''
|
||||
formData.customerPhone = ''
|
||||
formData.researchCategory = ''
|
||||
saleProductLines.value = []
|
||||
saleLineSeq = 0
|
||||
patientForm.customerId = ''
|
||||
@@ -2850,6 +2895,7 @@
|
||||
formData.customerName = detail.customerName || ''
|
||||
formData.customerContact = detail.customerContact || ''
|
||||
formData.customerPhone = detail.customerPhone || ''
|
||||
formData.researchCategory = detail.researchCategory || ''
|
||||
|
||||
if (detail.consentAttachmentFiles?.length) {
|
||||
consentFileList.value = mapAttachmentFilesFromDetail(detail.consentAttachmentFiles)
|
||||
@@ -2866,8 +2912,8 @@
|
||||
otherFileList.value = []
|
||||
}
|
||||
|
||||
// 加载渠道后加载服务订单
|
||||
if (formData.channelId && !isClinical.value) {
|
||||
// 中试:加载渠道后加载服务订单(临床/临床科研不需要)
|
||||
if (formData.channelId && !isClinical.value && !isBasicExperiment.value) {
|
||||
try {
|
||||
serviceOrderOptions.value = await fetchAllPagedRecords((page, pageSize) =>
|
||||
fetchChannelServiceOrderList({
|
||||
@@ -2963,7 +3009,7 @@
|
||||
}))
|
||||
}))
|
||||
}
|
||||
if (formData.channelId && !isClinical.value) {
|
||||
if (formData.channelId && !isClinical.value && !isBasicExperiment.value) {
|
||||
await loadAgreements(formData.channelId)
|
||||
}
|
||||
if (isBasicExperiment.value && detail.infusionSchedules?.length) {
|
||||
@@ -3062,6 +3108,8 @@
|
||||
}
|
||||
|
||||
if (isBasicExperiment.value) {
|
||||
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
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
<div class="kpi-value">{{ dash(applicationDetail.customerName) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!isBasicExperiment" class="kpi-card">
|
||||
<div class="kpi-card">
|
||||
<div class="kpi-card__icon" aria-hidden="true">
|
||||
<el-icon><User /></el-icon>
|
||||
</div>
|
||||
@@ -121,6 +121,16 @@
|
||||
<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.channelName) }}</div>
|
||||
</div>
|
||||
<div class="data-item">
|
||||
<div class="data-label">课题名称</div>
|
||||
<div class="data-value">{{ dash(applicationDetail.projectTitle) }}</div>
|
||||
@@ -888,6 +898,7 @@
|
||||
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import { getPilotBizConfig } from '@/config/pilot-biz-type'
|
||||
import { clinicalResearchCategoryLabel } from '@/constants/clinical-research-category'
|
||||
import {
|
||||
applicationStatusLabel,
|
||||
applicationStatusTagType,
|
||||
|
||||
@@ -139,6 +139,17 @@
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isBasicExperiment"
|
||||
prop="researchCategory"
|
||||
label="业务类型"
|
||||
min-width="160"
|
||||
show-overflow-tooltip
|
||||
>
|
||||
<template #default="{ row }">
|
||||
{{ clinicalResearchCategoryLabel(row.researchCategory) || '—' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="isBasicExperiment"
|
||||
prop="projectTitle"
|
||||
@@ -330,6 +341,7 @@
|
||||
import { applicationStatusLabel, applicationStatusTagType } 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'
|
||||
|
||||
defineOptions({ name: 'PilotApplicationTab' })
|
||||
|
||||
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
<!-- 临床科研出库工单 — 确认出库细胞 -->
|
||||
<!-- 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>
|
||||
+18
-1
@@ -75,6 +75,13 @@
|
||||
<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"
|
||||
@@ -353,7 +360,8 @@
|
||||
ArrowDown,
|
||||
ArrowUp,
|
||||
DataLine,
|
||||
FolderAdd
|
||||
FolderAdd,
|
||||
Box
|
||||
} from '@element-plus/icons-vue'
|
||||
import type { ProductionWorkOrderItem } from '@/api/production-work-order'
|
||||
import type { OutboundQcDetailProduct } from '@/api/qc-work-order'
|
||||
@@ -545,6 +553,7 @@
|
||||
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]
|
||||
@@ -649,6 +658,14 @@
|
||||
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 row.bizType === 'basic_experiment' && (row.workOrderType || '') === 'outbound'
|
||||
}
|
||||
|
||||
function canVoidWorkOrder(row: ProductionWorkOrderItem) {
|
||||
return row.workOrderStatus === 'dpz' || row.workOrderStatus === 'jxz'
|
||||
}
|
||||
|
||||
+20
@@ -189,6 +189,7 @@
|
||||
: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)"
|
||||
@@ -229,6 +230,12 @@
|
||||
:tasks="saveSetTasks"
|
||||
:lab-storage-code="saveSetLabStorageCode"
|
||||
/>
|
||||
|
||||
<ProductionDeliveryCellOutboundDialog
|
||||
v-model="deliveryCellOutboundVisible"
|
||||
:work-order-id="deliveryCellOutboundWorkOrderId"
|
||||
@saved="handleDeliveryCellOutboundSaved"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -242,6 +249,7 @@
|
||||
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'
|
||||
@@ -283,6 +291,8 @@
|
||||
const saveSetLabStorageCode = computed(() =>
|
||||
resolveWorkOrderLabStorageCode(saveSetRow.value)
|
||||
)
|
||||
const deliveryCellOutboundVisible = ref(false)
|
||||
const deliveryCellOutboundWorkOrderId = ref('')
|
||||
|
||||
const {
|
||||
cardMetaConfig,
|
||||
@@ -366,6 +376,16 @@
|
||||
qcViewVisible.value = true
|
||||
}
|
||||
|
||||
function handleDeliveryCellOutbound(row: ProductionWorkOrderItem) {
|
||||
deliveryCellOutboundWorkOrderId.value = row.id || ''
|
||||
deliveryCellOutboundVisible.value = true
|
||||
}
|
||||
|
||||
function handleDeliveryCellOutboundSaved() {
|
||||
loadData()
|
||||
emit('data-changed')
|
||||
}
|
||||
|
||||
function handleSampleReceptionSuccess() {
|
||||
bumpTaskRefresh()
|
||||
loadData()
|
||||
|
||||
+4
-6
@@ -153,6 +153,10 @@ export function useQcWorkOrderTabPage(
|
||||
keyword: searchForm.keyword || undefined,
|
||||
taskStatus: searchForm.taskStatus || undefined,
|
||||
taskType: searchForm.taskType || undefined,
|
||||
protocolStatus:
|
||||
tabKey.value === 'inbound_research_donation'
|
||||
? joinProtocolStatusFilter(searchForm.protocolStatus)
|
||||
: undefined,
|
||||
tabKey: tabKey.value
|
||||
})
|
||||
let entries = groupMineTasksByWorkOrder(tasks)
|
||||
@@ -172,12 +176,6 @@ export function useQcWorkOrderTabPage(
|
||||
}
|
||||
|
||||
const tab = tabConfig.value
|
||||
if (tabKey.value === 'inbound_research_donation' && !searchForm.protocolStatus.length) {
|
||||
tableData.value = []
|
||||
presetBatchesByWorkOrderId.value = undefined
|
||||
pagination.total = 0
|
||||
return
|
||||
}
|
||||
const timeParams =
|
||||
isAllQcWorkOrderTab(tabKey.value) || !tabUsesInfusionTimeFilter(tab)
|
||||
? {
|
||||
|
||||
Reference in new issue
Block a user