Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a69dcc5bca | ||
|
|
0929164bf5 | ||
|
|
5ecde0c80d | ||
|
|
4024aad174 | ||
|
|
02811197c6 | ||
|
|
7b6a0523dd | ||
|
|
99562ee584 | ||
|
|
96773ae7a3 | ||
|
|
ef4d687d03 | ||
|
|
f5ab0c3167 | ||
|
|
e4b62d6406 | ||
|
|
808f7dcf03 |
No files matched your search
@@ -49,6 +49,7 @@ from app.models.models import (
|
||||
BizPilotInfusionSchedule,
|
||||
BizPilotInfusionScheduleProduct,
|
||||
BizPilotPatient,
|
||||
BizProtocolCollectionInfo,
|
||||
BizProtocolPartyCustomer,
|
||||
BizProtocolSample,
|
||||
BizProductionTask,
|
||||
@@ -69,6 +70,7 @@ from app.models.models import (
|
||||
from app.models.qc_param import BizQcTaskResult
|
||||
from app.models.research_donation import (
|
||||
BizResearchDonation,
|
||||
BizResearchDonationCollection,
|
||||
BizResearchDonationParty,
|
||||
BizResearchDonationSample,
|
||||
)
|
||||
@@ -808,12 +810,39 @@ def _enrich_work_order_list_items(
|
||||
party.mother_name or "",
|
||||
party.newborn_name or "",
|
||||
)
|
||||
cell_maternal_map: Dict[str, str] = {}
|
||||
if cell_proto_ids:
|
||||
for coll in (
|
||||
db.query(BizProtocolCollectionInfo)
|
||||
.filter(
|
||||
BizProtocolCollectionInfo.collection_protocol_id.in_(cell_proto_ids),
|
||||
BizProtocolCollectionInfo.del_flag == 0,
|
||||
)
|
||||
.all()
|
||||
):
|
||||
cell_maternal_map[coll.collection_protocol_id] = _fmt_dt(
|
||||
coll.maternal_blood_collect_time
|
||||
)
|
||||
donation_maternal_map: Dict[str, str] = {}
|
||||
if donation_ids:
|
||||
for coll in (
|
||||
db.query(BizResearchDonationCollection)
|
||||
.filter(
|
||||
BizResearchDonationCollection.research_donation_id.in_(donation_ids),
|
||||
BizResearchDonationCollection.del_flag == 0,
|
||||
)
|
||||
.all()
|
||||
):
|
||||
donation_maternal_map[coll.research_donation_id] = _fmt_dt(
|
||||
coll.maternal_blood_collect_time
|
||||
)
|
||||
for item in items:
|
||||
if item.get("workOrderType") == "temporary":
|
||||
item["receptionSource"] = ""
|
||||
item["receptionSourceLabel"] = ""
|
||||
item["motherName"] = ""
|
||||
item["newbornName"] = ""
|
||||
item["maternalBloodCollectTime"] = ""
|
||||
continue
|
||||
rec = _resolve_reception(item)
|
||||
source = _effective_reception_source(item, rec)
|
||||
@@ -826,6 +855,7 @@ def _enrich_work_order_list_items(
|
||||
_mother, _newborn = donation_party_map.get(_did or "", ("", ""))
|
||||
item["motherName"] = _mother
|
||||
item["newbornName"] = _newborn
|
||||
item["maternalBloodCollectTime"] = donation_maternal_map.get(_did or "", "") or ""
|
||||
else:
|
||||
_pid = (
|
||||
(getattr(rec, "collection_protocol_id", None) if rec else None) or ""
|
||||
@@ -833,6 +863,7 @@ def _enrich_work_order_list_items(
|
||||
_mother, _newborn = cell_party_map.get(_pid or "", ("", ""))
|
||||
item["motherName"] = _mother
|
||||
item["newbornName"] = _newborn
|
||||
item["maternalBloodCollectTime"] = cell_maternal_map.get(_pid or "", "") or ""
|
||||
if not rec:
|
||||
item.setdefault("receptionTime", "")
|
||||
item.setdefault("handlerName", "")
|
||||
@@ -1140,6 +1171,7 @@ def _wo_to_dict(
|
||||
"receptionTime": "",
|
||||
"handlerName": "",
|
||||
"sampleTypeName": "",
|
||||
"maternalBloodCollectTime": "",
|
||||
"workOrderStatus": wo.work_order_status,
|
||||
"workOrderStatusLabel": _WORK_ORDER_STATUS_LABELS.get(
|
||||
wo.work_order_status or "", wo.work_order_status or ""
|
||||
@@ -2601,6 +2633,7 @@ def get_work_order_detail(
|
||||
"receptionSourceLabel": enriched.get("receptionSourceLabel", ""),
|
||||
"motherName": enriched.get("motherName", ""),
|
||||
"newbornName": enriched.get("newbornName", ""),
|
||||
"maternalBloodCollectTime": enriched.get("maternalBloodCollectTime", ""),
|
||||
"protocolStatus": enriched.get("protocolStatus", ""),
|
||||
"protocolStatusLabel": enriched.get("protocolStatusLabel", ""),
|
||||
"cellProductCode": enriched.get("cellProductCode", ""),
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
python -m scripts.backfill_uc_msc_production_tasks
|
||||
python -m scripts.backfill_uc_msc_production_tasks --apply
|
||||
python -m scripts.backfill_uc_msc_production_tasks --tenant zkxw --apply
|
||||
|
||||
等价一次性 SQL(与种子脚本分开):
|
||||
docs/sql/migrations/2026-11-13-uc-msc-production-task-backfill.sql
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
"""入库质检工单列表:从协议/捐赠采集信息补齐母血采集时间。"""
|
||||
|
||||
import unittest
|
||||
from datetime import datetime
|
||||
from unittest import mock
|
||||
|
||||
import app.crud.qc_task # noqa: F401 先加载任务模块,避免与工单模块循环导入
|
||||
from app.crud import qc_work_order as qc_wo
|
||||
from app.crud.qc_work_order import _enrich_work_order_list_items
|
||||
from app.models.models import (
|
||||
BizCollectionProtocol,
|
||||
BizProtocolCollectionInfo,
|
||||
BizProtocolPartyCustomer,
|
||||
BizSampleReception,
|
||||
)
|
||||
from app.models.research_donation import (
|
||||
BizResearchDonation,
|
||||
BizResearchDonationCollection,
|
||||
BizResearchDonationParty,
|
||||
)
|
||||
|
||||
|
||||
def _item(**kwargs):
|
||||
data = {
|
||||
"id": "wo-1",
|
||||
"workOrderType": "inbound",
|
||||
"receptionId": "rec-1",
|
||||
"sampleCode": "S001",
|
||||
"collectionProtocolId": "proto-1",
|
||||
"receptionSource": "cell_storage",
|
||||
"protocolSampleId": "",
|
||||
"maternalBloodCollectTime": "",
|
||||
}
|
||||
data.update(kwargs)
|
||||
return data
|
||||
|
||||
|
||||
def _query_router(mapping):
|
||||
def _query(*entities):
|
||||
q = mock.Mock()
|
||||
q.filter.return_value = q
|
||||
q.order_by.return_value = q
|
||||
model = entities[0]
|
||||
# db.query(Model.col, ...) → first entity is InstrumentedAttribute
|
||||
cls = getattr(model, "class_", model)
|
||||
key = getattr(cls, "__name__", str(cls))
|
||||
rows = mapping.get(key, [])
|
||||
q.all.return_value = rows
|
||||
return q
|
||||
|
||||
return _query
|
||||
|
||||
|
||||
class TestEnrichWorkOrderMaternalBlood(unittest.TestCase):
|
||||
def test_cell_storage_fills_maternal_blood_collect_time(self):
|
||||
rec = mock.Mock(
|
||||
id="rec-1",
|
||||
sample_code="S001",
|
||||
reception_source="cell_storage",
|
||||
collection_protocol_id="proto-1",
|
||||
research_donation_id="",
|
||||
protocol_sample_id="",
|
||||
donation_sample_id="",
|
||||
reception_time=datetime(2026, 11, 8, 13, 30, 41),
|
||||
handler_name="质检员",
|
||||
lab_storage_code="",
|
||||
)
|
||||
coll = mock.Mock(
|
||||
collection_protocol_id="proto-1",
|
||||
maternal_blood_collect_time=datetime(2026, 11, 7, 9, 15, 0),
|
||||
del_flag=0,
|
||||
)
|
||||
db = mock.Mock()
|
||||
db.query.side_effect = _query_router(
|
||||
{
|
||||
BizSampleReception.__name__: [rec],
|
||||
BizProtocolCollectionInfo.__name__: [coll],
|
||||
BizProtocolPartyCustomer.__name__: [],
|
||||
BizCollectionProtocol.__name__: [],
|
||||
}
|
||||
)
|
||||
|
||||
with mock.patch.object(
|
||||
qc_wo, "_enrich_protocol_sibling_samples", side_effect=lambda _db, items: items
|
||||
), mock.patch.object(
|
||||
qc_wo, "apply_special_to_item_from_samples", side_effect=lambda item, **_k: item
|
||||
):
|
||||
items = _enrich_work_order_list_items(db, [_item()])
|
||||
|
||||
self.assertEqual(items[0]["maternalBloodCollectTime"], "2026-11-07 09:15:00")
|
||||
|
||||
def test_missing_maternal_blood_stays_empty(self):
|
||||
rec = mock.Mock(
|
||||
id="rec-1",
|
||||
sample_code="S001",
|
||||
reception_source="cell_storage",
|
||||
collection_protocol_id="proto-1",
|
||||
research_donation_id="",
|
||||
protocol_sample_id="",
|
||||
donation_sample_id="",
|
||||
reception_time=datetime(2026, 11, 8, 13, 30, 41),
|
||||
handler_name="质检员",
|
||||
lab_storage_code="",
|
||||
)
|
||||
db = mock.Mock()
|
||||
db.query.side_effect = _query_router(
|
||||
{
|
||||
BizSampleReception.__name__: [rec],
|
||||
BizProtocolCollectionInfo.__name__: [],
|
||||
BizProtocolPartyCustomer.__name__: [],
|
||||
BizCollectionProtocol.__name__: [],
|
||||
}
|
||||
)
|
||||
|
||||
with mock.patch.object(
|
||||
qc_wo, "_enrich_protocol_sibling_samples", side_effect=lambda _db, items: items
|
||||
), mock.patch.object(
|
||||
qc_wo, "apply_special_to_item_from_samples", side_effect=lambda item, **_k: item
|
||||
):
|
||||
items = _enrich_work_order_list_items(db, [_item()])
|
||||
|
||||
self.assertEqual(items[0]["maternalBloodCollectTime"], "")
|
||||
|
||||
def test_research_donation_fills_maternal_blood_collect_time(self):
|
||||
rec = mock.Mock(
|
||||
id="rec-2",
|
||||
sample_code="D001",
|
||||
reception_source="research_donation",
|
||||
collection_protocol_id="",
|
||||
research_donation_id="don-1",
|
||||
protocol_sample_id="",
|
||||
donation_sample_id="",
|
||||
reception_time=datetime(2026, 11, 8, 10, 0, 0),
|
||||
handler_name="质检员",
|
||||
lab_storage_code="",
|
||||
)
|
||||
coll = mock.Mock(
|
||||
research_donation_id="don-1",
|
||||
maternal_blood_collect_time=datetime(2026, 11, 6, 8, 0, 0),
|
||||
del_flag=0,
|
||||
)
|
||||
db = mock.Mock()
|
||||
db.query.side_effect = _query_router(
|
||||
{
|
||||
BizSampleReception.__name__: [rec],
|
||||
BizResearchDonationCollection.__name__: [coll],
|
||||
BizResearchDonationParty.__name__: [],
|
||||
BizResearchDonation.__name__: [],
|
||||
}
|
||||
)
|
||||
|
||||
with mock.patch.object(
|
||||
qc_wo, "_enrich_protocol_sibling_samples", side_effect=lambda _db, items: items
|
||||
), mock.patch.object(
|
||||
qc_wo, "apply_special_to_item_from_samples", side_effect=lambda item, **_k: item
|
||||
):
|
||||
items = _enrich_work_order_list_items(
|
||||
db,
|
||||
[
|
||||
_item(
|
||||
id="wo-2",
|
||||
receptionId="rec-2",
|
||||
sampleCode="D001",
|
||||
collectionProtocolId="don-1",
|
||||
receptionSource="research_donation",
|
||||
)
|
||||
],
|
||||
)
|
||||
|
||||
self.assertEqual(items[0]["maternalBloodCollectTime"], "2026-11-06 08:00:00")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -1,46 +0,0 @@
|
||||
-- =============================================================================
|
||||
-- 弱密码刷新说明:111111 → Zkxw@123
|
||||
-- 日期:2026-10-16
|
||||
-- =============================================================================
|
||||
--
|
||||
-- 重要:sys_user.password 存储 bcrypt 哈希(每次盐随机),
|
||||
-- 不能用下列语句命中弱密码用户:
|
||||
-- WHERE password = '111111' -- 无效
|
||||
-- WHERE password LIKE '%111111%' -- 无效
|
||||
--
|
||||
-- 推荐:用 Python 脚本,并通过变量指定目标库(勿依赖本机默认 .env 误连生产)。
|
||||
--
|
||||
-- cd backend && source venv/bin/activate
|
||||
--
|
||||
-- # 方式 A:完整 URL
|
||||
-- python scripts/reset_weak_password_111111.py \
|
||||
-- --database-url 'mysql+pymysql://USER:PASS@HOST:3306/DBNAME' --dry-run
|
||||
--
|
||||
-- # 方式 B:分项变量
|
||||
-- python scripts/reset_weak_password_111111.py \
|
||||
-- --db-host HOST --db-port 3306 --db-user USER --db-password 'PASS' --db-name DBNAME --dry-run
|
||||
--
|
||||
-- # 方式 C:指定环境文件
|
||||
-- python scripts/reset_weak_password_111111.py --env-file ./.env.test --dry-run
|
||||
--
|
||||
-- # 正式写入:去掉 --dry-run
|
||||
--
|
||||
-- 脚本行为:校验 del_flag=0 的用户口令是否为明文 111111(含停用账号),
|
||||
-- 命中则更新为 Zkxw@123 的新 bcrypt 哈希。
|
||||
--
|
||||
-- =============================================================================
|
||||
-- 以下仅为「已知单个用户 id」时的手工 UPDATE 模板。
|
||||
-- 哈希由本机生成示例(明文 Zkxw@123,bcrypt cost 12),部署前请用 Python 重新生成:
|
||||
-- python -c "from app.core.security import get_password_hash; print(get_password_hash('Zkxw@123'))"
|
||||
-- =============================================================================
|
||||
|
||||
-- 示例哈希(仅供手工单用户更新参考;批量请用脚本):
|
||||
-- $2b$12$ULvPCr6g9IUmI8K7nlGU5emk7hupaAz4WgFdEoQBe935Wh1pVYKCK
|
||||
|
||||
-- UPDATE sys_user
|
||||
-- SET password = '$2b$12$ULvPCr6g9IUmI8K7nlGU5emk7hupaAz4WgFdEoQBe935Wh1pVYKCK',
|
||||
-- update_time = NOW()
|
||||
-- WHERE id = '<user_id>'
|
||||
-- AND del_flag = 0;
|
||||
|
||||
-- 执行前请备份 sys_user;执行后通知用户使用新密码并建议登录后自行修改。
|
||||
@@ -1,21 +0,0 @@
|
||||
-- 实验室样本处理 ACL 归一化(可重复执行)
|
||||
-- 1) 撤销所有 lab:sample-processing* / menu:lab-sample-processing 角色菜单
|
||||
-- 2) 仅按下列角色重授:
|
||||
-- 市场编辑:市场专员/临床销售/销售助理/客服/采集专员
|
||||
-- 生产编辑:生产专员/实验专员/细胞实验员/研发专员
|
||||
-- 质检编辑:质检专员/质量安全员
|
||||
-- 主管:生产主管/质量主管/采集主管/采集经理/研发主管/研发总监/总经理/副总经理/董事长/超级管理员
|
||||
-- 只读:采集接受人
|
||||
-- 说明:正式执行请用 Agent 脚本 tmp_normalize_lab_acl.py(含幂等 undelete/insert)。
|
||||
-- 本文件作为规则记录;勿在未核对角色名时直接全量套用到其他环境。
|
||||
|
||||
UPDATE sys_role_menu rm
|
||||
JOIN sys_menu m ON m.id = rm.menu_id
|
||||
SET rm.del_flag = 1,
|
||||
rm.update_by = 'normalize-acl',
|
||||
rm.update_time = NOW()
|
||||
WHERE rm.del_flag = 0
|
||||
AND (
|
||||
m.perms LIKE 'lab:sample-processing%'
|
||||
OR m.perms = 'menu:lab-sample-processing'
|
||||
);
|
||||
@@ -1,23 +0,0 @@
|
||||
# 恢复 Excel 补充字段(真菌等)
|
||||
|
||||
## 原因
|
||||
|
||||
`20261112_lab_sample_processing_retire_excel_demo.sql` 按「补充表 sample_code = 协议样本号」软删演示行。
|
||||
会议 Excel 实际多用实验室入库编码(`B000*` / `BC*` / `UBMC*`),与协议号不一致,导致真实样本的真菌/内毒素/CD34 等补充字段被误删。
|
||||
|
||||
## 处理
|
||||
|
||||
运行:
|
||||
|
||||
```bash
|
||||
ENV_FILE=backend/.env python backend/scripts/restore_lab_sample_processing_excel_extras.py
|
||||
```
|
||||
|
||||
脚本会:
|
||||
|
||||
1. 找出 `update_by=retire-excel-demo` 且 `del_flag=1` 的补充行
|
||||
2. 仅恢复仍能关联到当前有效协议/接收编码的行
|
||||
3. 只写回 `SOURCE_EXTRA` 字段到有效补充表
|
||||
4. 同步旧台账 `biz_lab_sample_process_supplement`
|
||||
|
||||
列表侧同时会从质检完成任务填空(内毒素/真菌/支原体/细菌及母血相关)。
|
||||
@@ -1,14 +0,0 @@
|
||||
-- 软删除实验室样本处理 Excel 演示补充行:
|
||||
-- 仅删除在协议样本表中不存在对应 sample_code 的补充记录。
|
||||
-- Excel 列结构仍由代码字段目录维护;真实列表只聚合协议/接收/生产源数据。
|
||||
|
||||
UPDATE biz_lab_sample_processing_extra e
|
||||
LEFT JOIN biz_protocol_sample s
|
||||
ON s.sample_code = e.sample_code
|
||||
AND s.tenant_no = e.tenant_no
|
||||
AND s.del_flag = 0
|
||||
SET e.del_flag = 1,
|
||||
e.update_by = 'retire-excel-demo',
|
||||
e.update_time = NOW()
|
||||
WHERE e.del_flag = 0
|
||||
AND s.id IS NULL;
|
||||
@@ -1,12 +0,0 @@
|
||||
-- 纠正实验室样本处理部门 ACL:
|
||||
-- 「采集接受人」仅挂在「质检专员」职位上,不应再授予市场字段编辑权,
|
||||
-- 否则质检人员经职位角色并集会同时可改市场+质检字段。
|
||||
|
||||
UPDATE sys_role_menu rm
|
||||
JOIN sys_role r ON r.id = rm.role_id AND r.del_flag = 0 AND r.role_name = '采集接受人'
|
||||
JOIN sys_menu m ON m.id = rm.menu_id AND m.del_flag = 0
|
||||
AND m.perms = 'lab:sample-processing:market:edit'
|
||||
SET rm.del_flag = 1,
|
||||
rm.update_by = 'migration',
|
||||
rm.update_time = NOW()
|
||||
WHERE rm.del_flag = 0;
|
||||
@@ -1,120 +0,0 @@
|
||||
-- 实验室样本处理数据:补充表 + 一级模块菜单/按钮权限(不自动授权角色)
|
||||
-- MySQL 5.7,可重复执行
|
||||
|
||||
CREATE TABLE IF NOT EXISTS biz_lab_sample_processing_extra (
|
||||
id VARCHAR(64) NOT NULL,
|
||||
dataset VARCHAR(16) NOT NULL COMMENT 'hsc|ubmc|msc',
|
||||
sample_code VARCHAR(32) NOT NULL COMMENT '样本编码',
|
||||
payload_json TEXT NULL COMMENT '补充字段 JSON',
|
||||
tenant_no VARCHAR(64) NOT NULL,
|
||||
order_num INT NULL,
|
||||
remark VARCHAR(512) NULL,
|
||||
create_by VARCHAR(64) NULL,
|
||||
create_dept_id VARCHAR(64) NOT NULL DEFAULT '',
|
||||
create_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
update_by VARCHAR(64) NULL,
|
||||
update_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
del_flag SMALLINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (id),
|
||||
KEY ix_lab_sample_extra_tenant_ds_code (tenant_no, dataset, sample_code, del_flag)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
||||
-- 挂到与「质检」同一 Web 虚拟根下(复用 menu:quality 的 parent_id)
|
||||
INSERT INTO sys_menu (
|
||||
id, menu_name, parent_id, menu_type, path, component, perms,
|
||||
is_frame, visible, status, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
MD5(CONCAT(quality.tenant_no, ':menu:lab-sample-processing')),
|
||||
'实验室样本处理数据', quality.parent_id, 'M', '/lab-sample-processing', '/index/index',
|
||||
'menu:lab-sample-processing', 1, '1', '1', quality.tenant_no,
|
||||
COALESCE(quality.order_num, 50) + 1,
|
||||
'20261104 会议:造血/单个核/间充质台账',
|
||||
'migration', '', NOW(), 'migration', NOW(), 0
|
||||
FROM sys_menu quality
|
||||
WHERE quality.perms = 'menu:quality' AND quality.del_flag = 0 AND quality.status = '1'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_menu e
|
||||
WHERE e.tenant_no = quality.tenant_no AND e.perms = 'menu:lab-sample-processing' AND e.del_flag = 0
|
||||
);
|
||||
|
||||
INSERT INTO sys_menu (
|
||||
id, menu_name, parent_id, menu_type, path, component, perms,
|
||||
is_frame, visible, status, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
MD5(CONCAT(p.tenant_no, ':lab:sample-processing:list')),
|
||||
'造血干细胞数据', p.id, 'C', 'lab-sample-processing/hsc',
|
||||
'/lab-sample-processing/hsc/index', 'lab:sample-processing:list',
|
||||
1, '1', '1', p.tenant_no, 10, '造血干细胞数据列表',
|
||||
'migration', '', NOW(), 'migration', NOW(), 0
|
||||
FROM sys_menu p
|
||||
WHERE p.perms = 'menu:lab-sample-processing' AND p.del_flag = 0 AND p.status = '1'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_menu e
|
||||
WHERE e.tenant_no = p.tenant_no AND e.path = 'lab-sample-processing/hsc' AND e.del_flag = 0
|
||||
);
|
||||
|
||||
INSERT INTO sys_menu (
|
||||
id, menu_name, parent_id, menu_type, path, component, perms,
|
||||
is_frame, visible, status, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
MD5(CONCAT(p.tenant_no, ':lab:sample-processing:ubmc')),
|
||||
'单个核数据', p.id, 'C', 'lab-sample-processing/ubmc',
|
||||
'/lab-sample-processing/ubmc/index', 'lab:sample-processing:list',
|
||||
1, '1', '1', p.tenant_no, 20, '单个核数据列表',
|
||||
'migration', '', NOW(), 'migration', NOW(), 0
|
||||
FROM sys_menu p
|
||||
WHERE p.perms = 'menu:lab-sample-processing' AND p.del_flag = 0 AND p.status = '1'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_menu e
|
||||
WHERE e.tenant_no = p.tenant_no AND e.path = 'lab-sample-processing/ubmc' AND e.del_flag = 0
|
||||
);
|
||||
|
||||
INSERT INTO sys_menu (
|
||||
id, menu_name, parent_id, menu_type, path, component, perms,
|
||||
is_frame, visible, status, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
MD5(CONCAT(p.tenant_no, ':lab:sample-processing:msc')),
|
||||
'脐带间充质干细胞数据', p.id, 'C', 'lab-sample-processing/msc',
|
||||
'/lab-sample-processing/msc/index', 'lab:sample-processing:list',
|
||||
1, '1', '1', p.tenant_no, 30, '脐带间充质干细胞数据列表',
|
||||
'migration', '', NOW(), 'migration', NOW(), 0
|
||||
FROM sys_menu p
|
||||
WHERE p.perms = 'menu:lab-sample-processing' AND p.del_flag = 0 AND p.status = '1'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_menu e
|
||||
WHERE e.tenant_no = p.tenant_no AND e.path = 'lab-sample-processing/msc' AND e.del_flag = 0
|
||||
);
|
||||
|
||||
-- 编辑按钮挂在列表菜单下(三页共用同一 list 权限父节点:造血页)
|
||||
INSERT INTO sys_menu (
|
||||
id, menu_name, parent_id, menu_type, path, component, perms,
|
||||
is_frame, visible, status, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
MD5(CONCAT(p.tenant_no, ':', btn.perms)),
|
||||
btn.menu_name, p.id, 'F', '', NULL, btn.perms,
|
||||
1, '0', '1', p.tenant_no, btn.order_num, btn.remark,
|
||||
'migration', '', NOW(), 'migration', NOW(), 0
|
||||
FROM sys_menu p
|
||||
JOIN (
|
||||
SELECT '市场字段编辑' AS menu_name, 'lab:sample-processing:market:edit' AS perms, 1 AS order_num, '仅可编辑市场部门字段' AS remark
|
||||
UNION ALL SELECT '生产字段编辑', 'lab:sample-processing:production:edit', 2, '仅可编辑生产部门字段'
|
||||
UNION ALL SELECT '质检字段编辑', 'lab:sample-processing:qc:edit', 3, '仅可编辑质检部门字段'
|
||||
UNION ALL SELECT '部门主管', 'lab:sample-processing:manager', 4, '可编辑全部部门字段'
|
||||
) btn
|
||||
WHERE p.perms = 'lab:sample-processing:list'
|
||||
AND p.path = 'lab-sample-processing/hsc'
|
||||
AND p.del_flag = 0 AND p.status = '1'
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM sys_menu e
|
||||
WHERE e.tenant_no = p.tenant_no AND e.perms = btn.perms AND e.del_flag = 0
|
||||
);
|
||||
@@ -1,50 +0,0 @@
|
||||
-- Issue #100:移除多余一级菜单「实验室样本处理数据」及其子菜单/按钮
|
||||
-- 软删除 sys_menu 与对应 sys_role_menu;不影响质检管理下 lab-sample-process 台账
|
||||
-- MySQL 5.7,可重复执行
|
||||
|
||||
-- 1) 角色菜单授权
|
||||
UPDATE sys_role_menu rm
|
||||
JOIN sys_menu m ON m.id = rm.menu_id
|
||||
SET rm.del_flag = 1,
|
||||
rm.update_by = 'migration',
|
||||
rm.update_time = NOW()
|
||||
WHERE rm.del_flag = 0
|
||||
AND (
|
||||
m.perms IN (
|
||||
'menu:lab-sample-processing',
|
||||
'lab:sample-processing:list',
|
||||
'lab:sample-processing:market:edit',
|
||||
'lab:sample-processing:production:edit',
|
||||
'lab:sample-processing:qc:edit',
|
||||
'lab:sample-processing:manager'
|
||||
)
|
||||
OR m.path IN (
|
||||
'/lab-sample-processing',
|
||||
'lab-sample-processing/hsc',
|
||||
'lab-sample-processing/ubmc',
|
||||
'lab-sample-processing/msc'
|
||||
)
|
||||
);
|
||||
|
||||
-- 2) 按钮 / 子菜单 / 一级菜单(先叶子后父级,同批软删即可)
|
||||
UPDATE sys_menu
|
||||
SET del_flag = 1,
|
||||
update_by = 'migration',
|
||||
update_time = NOW()
|
||||
WHERE del_flag = 0
|
||||
AND (
|
||||
perms IN (
|
||||
'menu:lab-sample-processing',
|
||||
'lab:sample-processing:list',
|
||||
'lab:sample-processing:market:edit',
|
||||
'lab:sample-processing:production:edit',
|
||||
'lab:sample-processing:qc:edit',
|
||||
'lab:sample-processing:manager'
|
||||
)
|
||||
OR path IN (
|
||||
'/lab-sample-processing',
|
||||
'lab-sample-processing/hsc',
|
||||
'lab-sample-processing/ubmc',
|
||||
'lab-sample-processing/msc'
|
||||
)
|
||||
);
|
||||
@@ -1,9 +1,12 @@
|
||||
-- UC 入库编码自动派发:脐带MSC原代培养(内置模版)5 步
|
||||
-- 步骤:原代培养 → 半换液 → 二次贴壁 → 重铺 → 冻存(不含传代)
|
||||
-- 内容从既有「干细胞培养(内置模版)」/ MSC培养-BUILTIN 按 process_code 拷贝
|
||||
-- 幂等:已存在同名内置集合则跳过主数据创建-- 生产历史空任务工单请用:
|
||||
-- cd backend && python -m scripts.backfill_uc_msc_production_tasks --dry-run
|
||||
-- cd backend && python -m scripts.backfill_uc_msc_production_tasks --apply
|
||||
-- 幂等:已存在同名内置集合则跳过主数据创建-- 兼容:跨表比较统一 COLLATE utf8mb4_unicode_ci,避免 unicode_ci/general_ci 混用失败
|
||||
-- 生产历史空任务工单回补(二选一,勿重复对同一工单各跑一遍):
|
||||
-- SQL:docs/sql/migrations/2026-11-13-uc-msc-production-task-backfill.sql
|
||||
-- 或 Python:
|
||||
-- cd backend && python -m scripts.backfill_uc_msc_production_tasks
|
||||
-- cd backend && python -m scripts.backfill_uc_msc_production_tasks --apply
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
@@ -44,7 +47,7 @@ WHERE src.del_flag = 0
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM biz_process_route x
|
||||
WHERE x.tenant_no = src.tenant_no
|
||||
WHERE x.tenant_no COLLATE utf8mb4_unicode_ci = src.tenant_no COLLATE utf8mb4_unicode_ci
|
||||
AND x.route_code = 'MSC原代-UC-BUILTIN'
|
||||
AND x.del_flag = 0
|
||||
)
|
||||
@@ -65,7 +68,9 @@ SELECT
|
||||
s.description, s.equipment_ids, s.equipment_name, s.estimated_duration, s.sop_ids, s.sop_content,
|
||||
s.tenant_no, 1, s.remark, s.create_by, IFNULL(s.create_dept_id, ''), NOW(), s.update_by, NOW(), 0
|
||||
FROM biz_process_route_step s
|
||||
JOIN biz_process_route r ON r.id = s.route_id AND r.del_flag = 0
|
||||
JOIN biz_process_route r
|
||||
ON r.id COLLATE utf8mb4_unicode_ci = s.route_id COLLATE utf8mb4_unicode_ci
|
||||
AND r.del_flag = 0
|
||||
WHERE s.del_flag = 0
|
||||
AND s.process_code = 'SOP-SC-003-E01-01'
|
||||
AND (
|
||||
@@ -95,7 +100,9 @@ SELECT
|
||||
s.description, s.equipment_ids, s.equipment_name, s.estimated_duration, s.sop_ids, s.sop_content,
|
||||
s.tenant_no, 2, s.remark, s.create_by, IFNULL(s.create_dept_id, ''), NOW(), s.update_by, NOW(), 0
|
||||
FROM biz_process_route_step s
|
||||
JOIN biz_process_route r ON r.id = s.route_id AND r.del_flag = 0
|
||||
JOIN biz_process_route r
|
||||
ON r.id COLLATE utf8mb4_unicode_ci = s.route_id COLLATE utf8mb4_unicode_ci
|
||||
AND r.del_flag = 0
|
||||
WHERE s.del_flag = 0
|
||||
AND s.process_code = 'SOP-SC-004-E01-01'
|
||||
AND (
|
||||
@@ -125,7 +132,9 @@ SELECT
|
||||
s.description, s.equipment_ids, s.equipment_name, s.estimated_duration, s.sop_ids, s.sop_content,
|
||||
s.tenant_no, 3, s.remark, s.create_by, IFNULL(s.create_dept_id, ''), NOW(), s.update_by, NOW(), 0
|
||||
FROM biz_process_route_step s
|
||||
JOIN biz_process_route r ON r.id = s.route_id AND r.del_flag = 0
|
||||
JOIN biz_process_route r
|
||||
ON r.id COLLATE utf8mb4_unicode_ci = s.route_id COLLATE utf8mb4_unicode_ci
|
||||
AND r.del_flag = 0
|
||||
WHERE s.del_flag = 0
|
||||
AND s.process_code = 'SOP-SC-006-E01-01'
|
||||
AND (
|
||||
@@ -155,7 +164,9 @@ SELECT
|
||||
s.description, s.equipment_ids, s.equipment_name, s.estimated_duration, s.sop_ids, s.sop_content,
|
||||
s.tenant_no, 4, s.remark, s.create_by, IFNULL(s.create_dept_id, ''), NOW(), s.update_by, NOW(), 0
|
||||
FROM biz_process_route_step s
|
||||
JOIN biz_process_route r ON r.id = s.route_id AND r.del_flag = 0
|
||||
JOIN biz_process_route r
|
||||
ON r.id COLLATE utf8mb4_unicode_ci = s.route_id COLLATE utf8mb4_unicode_ci
|
||||
AND r.del_flag = 0
|
||||
WHERE s.del_flag = 0
|
||||
AND s.process_code = 'SOP-SC-005-E01-01'
|
||||
AND (
|
||||
@@ -185,7 +196,9 @@ SELECT
|
||||
s.description, s.equipment_ids, s.equipment_name, s.estimated_duration, s.sop_ids, s.sop_content,
|
||||
s.tenant_no, 5, s.remark, s.create_by, IFNULL(s.create_dept_id, ''), NOW(), s.update_by, NOW(), 0
|
||||
FROM biz_process_route_step s
|
||||
JOIN biz_process_route r ON r.id = s.route_id AND r.del_flag = 0
|
||||
JOIN biz_process_route r
|
||||
ON r.id COLLATE utf8mb4_unicode_ci = s.route_id COLLATE utf8mb4_unicode_ci
|
||||
AND r.del_flag = 0
|
||||
WHERE s.del_flag = 0
|
||||
AND s.process_code = 'SOP-SC-008-E01-01'
|
||||
AND (
|
||||
@@ -226,7 +239,7 @@ WHERE r.id = 'UCMSCROUTEA5CC11F194118AC54085447A'
|
||||
AND r.del_flag = 0
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM biz_production_task_set x
|
||||
WHERE x.tenant_no = r.tenant_no
|
||||
WHERE x.tenant_no COLLATE utf8mb4_unicode_ci = r.tenant_no COLLATE utf8mb4_unicode_ci
|
||||
AND x.set_name = '脐带MSC原代培养(内置模版)'
|
||||
AND x.is_builtin = '1'
|
||||
AND x.del_flag = 0
|
||||
@@ -259,5 +272,6 @@ WHERE s.set_name = '脐带MSC原代培养(内置模版)'
|
||||
AND s.del_flag = 0
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM biz_production_task_set_item x
|
||||
WHERE x.set_id = s.id AND x.del_flag = 0
|
||||
WHERE x.set_id COLLATE utf8mb4_unicode_ci = s.id COLLATE utf8mb4_unicode_ci
|
||||
AND x.del_flag = 0
|
||||
);
|
||||
@@ -0,0 +1,424 @@
|
||||
-- 【一次性回补】UC 开头实验室入库编码 → 补派「脐带MSC原代培养」5 步生产任务
|
||||
-- 与种子脚本分开:先执行 2026-11-13-uc-msc-builtin-task-set.sql(或确保模版已存在),再执行本文件。
|
||||
-- 等价于 backend/scripts/backfill_uc_msc_production_tasks.py --apply 的候选范围。
|
||||
--
|
||||
-- 候选条件(须全部满足):
|
||||
-- 1) 样本接收 accept_conclusion=js、del_flag=0
|
||||
-- 2) lab_storage_code 以 UC/uc 开头(非空)
|
||||
-- 3) 关联入库生产工单 work_order_type=inbound、状态 dpz/jxz、del_flag=0
|
||||
-- 4) 该工单当前无任何有效生产任务(已有任务如 UC2026010 跳过)
|
||||
--
|
||||
-- 动作:
|
||||
-- - 每工单插入 1 条 biz_production_task(状态 dpz,任务名 {入库编码}样本处理)
|
||||
-- - 从 UC 内置路线复制 5 个步骤到 biz_production_task_step(及试剂/耗材/产出/采集子表)
|
||||
-- - 工单状态 dpz → jxz(已是 jxz/ywc 的不改 ywc;本脚本候选不含 ywc)
|
||||
--
|
||||
-- 幂等:已有有效任务的工单不会进入候选;重复执行影响行数应为 0。
|
||||
-- 前置:biz_process_route.route_code='MSC原代-UC-BUILTIN'(或固定 id UCMSCROUTE…)及 5 步须已存在。
|
||||
-- MySQL 5.7 / utf8mb4。未在生产库执行;执行前请先跑下方「预览」SELECT。
|
||||
-- 兼容:
|
||||
-- 1) 跨表等值统一 COLLATE utf8mb4_general_ci,避免 unicode_ci/general_ci 混用失败
|
||||
-- 2) 多行 ID 用 MD5(业务键) 生成,避免同语句多行 UUID() 撞主键
|
||||
-- 3) task_no 序号用 UNSIGNED 整数拼接,避免用户变量浮点变成 RW…2.00
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 0. 解析 UC 内置工艺路线
|
||||
-- ---------------------------------------------------------------------------
|
||||
SET @uc_route_id := (
|
||||
SELECT r.id
|
||||
FROM biz_process_route r
|
||||
WHERE r.del_flag = 0
|
||||
AND (
|
||||
r.id = 'UCMSCROUTEA5CC11F194118AC54085447A'
|
||||
OR r.route_code = 'MSC原代-UC-BUILTIN'
|
||||
OR (r.route_name = '脐带MSC原代培养(内置模版)' AND r.is_builtin = '1')
|
||||
)
|
||||
ORDER BY
|
||||
CASE
|
||||
WHEN r.id = 'UCMSCROUTEA5CC11F194118AC54085447A' THEN 0
|
||||
WHEN r.route_code = 'MSC原代-UC-BUILTIN' THEN 1
|
||||
ELSE 2
|
||||
END
|
||||
LIMIT 1
|
||||
);
|
||||
|
||||
SET @uc_step_count := (
|
||||
SELECT COUNT(*)
|
||||
FROM biz_process_route_step s
|
||||
WHERE s.route_id COLLATE utf8mb4_unicode_ci = @uc_route_id COLLATE utf8mb4_unicode_ci
|
||||
AND s.del_flag = 0
|
||||
);
|
||||
|
||||
-- 预览:模版是否就绪(应 route 非空且 step_count=5)
|
||||
SELECT @uc_route_id AS uc_route_id, @uc_step_count AS uc_step_count;
|
||||
|
||||
-- 若模版未就绪则主动失败(避免插入无步骤任务)
|
||||
SET @uc_ready := IF(@uc_route_id IS NOT NULL AND @uc_step_count = 5, 1, 0);
|
||||
-- 下面用 @uc_ready 约束所有写操作;为 0 时 INSERT 选不出行
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 1. 候选工单临时表
|
||||
-- ---------------------------------------------------------------------------
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_uc_wo_backfill;
|
||||
CREATE TEMPORARY TABLE tmp_uc_wo_backfill (
|
||||
seq INT NOT NULL AUTO_INCREMENT,
|
||||
work_order_id VARCHAR(64) NOT NULL,
|
||||
reception_id VARCHAR(64) NOT NULL,
|
||||
lab_storage_code VARCHAR(32) NOT NULL,
|
||||
tenant_no VARCHAR(64) NOT NULL,
|
||||
sample_code VARCHAR(32) NULL,
|
||||
task_id VARCHAR(64) NULL,
|
||||
task_no VARCHAR(32) NULL,
|
||||
route_id VARCHAR(64) NULL,
|
||||
PRIMARY KEY (seq),
|
||||
UNIQUE KEY uk_wo (work_order_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
INSERT INTO tmp_uc_wo_backfill (
|
||||
work_order_id, reception_id, lab_storage_code, tenant_no, sample_code, route_id
|
||||
)
|
||||
SELECT
|
||||
wo.id,
|
||||
rec.id,
|
||||
TRIM(rec.lab_storage_code),
|
||||
wo.tenant_no,
|
||||
wo.sample_code,
|
||||
@uc_route_id
|
||||
FROM biz_production_work_order wo
|
||||
INNER JOIN biz_sample_reception rec
|
||||
ON rec.id COLLATE utf8mb4_general_ci = wo.reception_id COLLATE utf8mb4_general_ci
|
||||
AND rec.tenant_no COLLATE utf8mb4_general_ci = wo.tenant_no COLLATE utf8mb4_general_ci
|
||||
AND rec.del_flag = 0
|
||||
WHERE @uc_ready = 1
|
||||
AND wo.del_flag = 0
|
||||
AND wo.work_order_type = 'inbound'
|
||||
AND wo.work_order_status IN ('dpz', 'jxz')
|
||||
AND rec.accept_conclusion = 'js'
|
||||
AND rec.lab_storage_code IS NOT NULL
|
||||
AND TRIM(rec.lab_storage_code) <> ''
|
||||
AND (
|
||||
rec.lab_storage_code LIKE 'UC%'
|
||||
OR rec.lab_storage_code LIKE 'uc%'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM biz_production_task t
|
||||
WHERE t.work_order_id COLLATE utf8mb4_general_ci = wo.id COLLATE utf8mb4_general_ci
|
||||
AND t.tenant_no COLLATE utf8mb4_general_ci = wo.tenant_no COLLATE utf8mb4_general_ci
|
||||
AND t.del_flag = 0
|
||||
)
|
||||
ORDER BY rec.reception_time ASC, wo.create_time ASC;
|
||||
|
||||
-- 预览候选(执行写库前请核对)
|
||||
SELECT
|
||||
seq,
|
||||
work_order_id,
|
||||
lab_storage_code,
|
||||
sample_code,
|
||||
tenant_no,
|
||||
reception_id
|
||||
FROM tmp_uc_wo_backfill
|
||||
ORDER BY seq;
|
||||
|
||||
SELECT COUNT(*) AS candidate_count FROM tmp_uc_wo_backfill;
|
||||
|
||||
-- 分配 task_id / task_no(RW + yyyymmdd + 4 位序号,接当日已有最大序号)
|
||||
SET @task_day := DATE_FORMAT(NOW(), '%Y%m%d');
|
||||
SET @task_no_base := (
|
||||
SELECT IFNULL(MAX(CAST(SUBSTRING(t.task_no, 11) AS UNSIGNED)), 0)
|
||||
FROM biz_production_task t
|
||||
WHERE t.task_no REGEXP CONCAT('^RW', @task_day, '[0-9]{4}$')
|
||||
);
|
||||
SET @task_no_base := CAST(IFNULL(@task_no_base, 0) AS UNSIGNED);
|
||||
|
||||
UPDATE tmp_uc_wo_backfill
|
||||
SET
|
||||
task_id = UPPER(MD5(CONCAT('uc-msc-backfill-task:', work_order_id))),
|
||||
task_no = CONCAT('RW', @task_day, LPAD(@task_no_base + seq, 4, '0'));
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 2. 插入生产任务
|
||||
-- ---------------------------------------------------------------------------
|
||||
INSERT INTO biz_production_task (
|
||||
id, task_no, work_order_id, order_source, task_type, task_name, description,
|
||||
route_id, task_status, current_assignee_user_id, started_time, completed_time,
|
||||
conclusion, remark, attachments, equipment_ids, equipment_name,
|
||||
tenant_no, order_num, create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
c.task_id,
|
||||
c.task_no,
|
||||
c.work_order_id,
|
||||
'inbound',
|
||||
'cell_storage',
|
||||
CONCAT(c.lab_storage_code, '样本处理'),
|
||||
'脐带MSC原代培养(内置模版)',
|
||||
c.route_id,
|
||||
'dpz',
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
'一次性SQL回补:UC入库编码自动派发',
|
||||
NULL,
|
||||
r.equipment_ids,
|
||||
r.equipment_name,
|
||||
c.tenant_no,
|
||||
0,
|
||||
NULL,
|
||||
'',
|
||||
NOW(),
|
||||
NULL,
|
||||
NOW(),
|
||||
0
|
||||
FROM tmp_uc_wo_backfill c
|
||||
INNER JOIN biz_process_route r
|
||||
ON r.id COLLATE utf8mb4_unicode_ci = c.route_id COLLATE utf8mb4_unicode_ci
|
||||
AND r.del_flag = 0
|
||||
WHERE @uc_ready = 1
|
||||
AND c.task_id IS NOT NULL
|
||||
AND NOT EXISTS (
|
||||
SELECT 1 FROM biz_production_task t
|
||||
WHERE t.work_order_id COLLATE utf8mb4_general_ci = c.work_order_id COLLATE utf8mb4_general_ci
|
||||
AND t.tenant_no COLLATE utf8mb4_general_ci = c.tenant_no COLLATE utf8mb4_general_ci
|
||||
AND t.del_flag = 0
|
||||
);
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 3. 步骤映射:路线步骤 → 新任务步骤 ID
|
||||
-- ---------------------------------------------------------------------------
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_uc_step_map;
|
||||
CREATE TEMPORARY TABLE tmp_uc_step_map (
|
||||
task_id VARCHAR(64) NOT NULL,
|
||||
work_order_id VARCHAR(64) NOT NULL,
|
||||
tenant_no VARCHAR(64) NOT NULL,
|
||||
route_step_id VARCHAR(64) NOT NULL,
|
||||
task_step_id VARCHAR(64) NOT NULL,
|
||||
step_order INT NOT NULL,
|
||||
PRIMARY KEY (task_id, route_step_id),
|
||||
KEY ix_route_step (route_step_id),
|
||||
KEY ix_task_step (task_step_id)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
|
||||
|
||||
INSERT INTO tmp_uc_step_map (
|
||||
task_id, work_order_id, tenant_no, route_step_id, task_step_id, step_order
|
||||
)
|
||||
SELECT
|
||||
c.task_id,
|
||||
c.work_order_id,
|
||||
c.tenant_no,
|
||||
rs.id,
|
||||
UPPER(MD5(CONCAT('uc-msc-backfill-step:', c.work_order_id, ':', rs.id))),
|
||||
rs.step_order
|
||||
FROM tmp_uc_wo_backfill c
|
||||
INNER JOIN biz_process_route_step rs
|
||||
ON rs.route_id COLLATE utf8mb4_unicode_ci = c.route_id COLLATE utf8mb4_unicode_ci
|
||||
AND rs.del_flag = 0
|
||||
WHERE @uc_ready = 1
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM biz_production_task t
|
||||
WHERE t.id COLLATE utf8mb4_general_ci = c.task_id COLLATE utf8mb4_general_ci
|
||||
AND t.del_flag = 0
|
||||
);
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 4. 插入任务步骤
|
||||
-- ---------------------------------------------------------------------------
|
||||
INSERT INTO biz_production_task_step (
|
||||
id, task_id, step_order, process_code, category_id, process_name, description,
|
||||
equipment_ids, equipment_name, estimated_duration, actual_duration,
|
||||
sop_ids, sop_content, step_status, planned_start_time, started_time,
|
||||
completed_time, completed_by, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
m.task_step_id,
|
||||
m.task_id,
|
||||
rs.step_order,
|
||||
rs.process_code,
|
||||
rs.category_id,
|
||||
rs.process_name,
|
||||
rs.description,
|
||||
rs.equipment_ids,
|
||||
rs.equipment_name,
|
||||
rs.estimated_duration,
|
||||
NULL,
|
||||
rs.sop_ids,
|
||||
rs.sop_content,
|
||||
'dzx',
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
m.tenant_no,
|
||||
IFNULL(rs.order_num, rs.step_order),
|
||||
NULL,
|
||||
NULL,
|
||||
'',
|
||||
NOW(),
|
||||
NULL,
|
||||
NOW(),
|
||||
0
|
||||
FROM tmp_uc_step_map m
|
||||
INNER JOIN biz_process_route_step rs
|
||||
ON rs.id COLLATE utf8mb4_unicode_ci = m.route_step_id COLLATE utf8mb4_unicode_ci
|
||||
AND rs.del_flag = 0
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM biz_production_task_step x
|
||||
WHERE x.id COLLATE utf8mb4_general_ci = m.task_step_id COLLATE utf8mb4_general_ci
|
||||
);
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 5. 复制路线步骤子表 → 任务步骤子表
|
||||
-- ---------------------------------------------------------------------------
|
||||
INSERT INTO biz_production_task_step_reagent (
|
||||
id, step_id, reagent_code, reagent_name, spec, standard_usage, unit,
|
||||
is_key_material, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
UPPER(MD5(CONCAT('uc-msc-backfill-reag:', m.task_step_id, ':', src.id))),
|
||||
m.task_step_id,
|
||||
src.reagent_code,
|
||||
src.reagent_name,
|
||||
src.spec,
|
||||
src.standard_usage,
|
||||
src.unit,
|
||||
src.is_key_material,
|
||||
m.tenant_no,
|
||||
src.order_num,
|
||||
src.remark,
|
||||
NULL,
|
||||
'',
|
||||
NOW(),
|
||||
NULL,
|
||||
NOW(),
|
||||
0
|
||||
FROM tmp_uc_step_map m
|
||||
INNER JOIN biz_process_route_step_reagent src
|
||||
ON src.step_id COLLATE utf8mb4_unicode_ci = m.route_step_id COLLATE utf8mb4_unicode_ci
|
||||
AND src.del_flag = 0;
|
||||
|
||||
INSERT INTO biz_production_task_step_consumable (
|
||||
id, step_id, consumable_code, consumable_name, spec_model, standard_usage,
|
||||
unit, is_required, remark, tenant_no, order_num,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
UPPER(MD5(CONCAT('uc-msc-backfill-cons:', m.task_step_id, ':', src.id))),
|
||||
m.task_step_id,
|
||||
src.consumable_code,
|
||||
src.consumable_name,
|
||||
src.spec_model,
|
||||
src.standard_usage,
|
||||
src.unit,
|
||||
src.is_required,
|
||||
src.remark,
|
||||
m.tenant_no,
|
||||
src.order_num,
|
||||
NULL,
|
||||
'',
|
||||
NOW(),
|
||||
NULL,
|
||||
NOW(),
|
||||
0
|
||||
FROM tmp_uc_step_map m
|
||||
INNER JOIN biz_process_route_step_consumable src
|
||||
ON src.step_id COLLATE utf8mb4_unicode_ci = m.route_step_id COLLATE utf8mb4_unicode_ci
|
||||
AND src.del_flag = 0;
|
||||
|
||||
INSERT INTO biz_production_task_step_output (
|
||||
id, step_id, output_type_id, output_name, output_barcode,
|
||||
tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
UPPER(MD5(CONCAT('uc-msc-backfill-out:', m.task_step_id, ':', src.id))),
|
||||
m.task_step_id,
|
||||
src.output_type_id,
|
||||
src.output_name,
|
||||
src.output_barcode,
|
||||
m.tenant_no,
|
||||
src.order_num,
|
||||
src.remark,
|
||||
NULL,
|
||||
'',
|
||||
NOW(),
|
||||
NULL,
|
||||
NOW(),
|
||||
0
|
||||
FROM tmp_uc_step_map m
|
||||
INNER JOIN biz_process_route_step_output src
|
||||
ON src.step_id COLLATE utf8mb4_unicode_ci = m.route_step_id COLLATE utf8mb4_unicode_ci
|
||||
AND src.del_flag = 0;
|
||||
|
||||
INSERT INTO biz_production_task_step_data_collection (
|
||||
id, step_id, collection_name, unit, tenant_no, order_num, remark,
|
||||
create_by, create_dept_id, create_time, update_by, update_time, del_flag
|
||||
)
|
||||
SELECT
|
||||
UPPER(MD5(CONCAT('uc-msc-backfill-dc:', m.task_step_id, ':', src.id))),
|
||||
m.task_step_id,
|
||||
src.collection_name,
|
||||
src.unit,
|
||||
m.tenant_no,
|
||||
src.order_num,
|
||||
src.remark,
|
||||
NULL,
|
||||
'',
|
||||
NOW(),
|
||||
NULL,
|
||||
NOW(),
|
||||
0
|
||||
FROM tmp_uc_step_map m
|
||||
INNER JOIN biz_process_route_step_data_collection src
|
||||
ON src.step_id COLLATE utf8mb4_unicode_ci = m.route_step_id COLLATE utf8mb4_unicode_ci
|
||||
AND src.del_flag = 0;
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 6. 回写工单状态:有任务则 jxz(不改 ywc)
|
||||
-- ---------------------------------------------------------------------------
|
||||
UPDATE biz_production_work_order wo
|
||||
INNER JOIN tmp_uc_wo_backfill c
|
||||
ON c.work_order_id COLLATE utf8mb4_general_ci = wo.id COLLATE utf8mb4_general_ci
|
||||
SET
|
||||
wo.work_order_status = 'jxz',
|
||||
wo.update_time = NOW()
|
||||
WHERE wo.del_flag = 0
|
||||
AND wo.work_order_status = 'dpz'
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM biz_production_task t
|
||||
WHERE t.work_order_id COLLATE utf8mb4_general_ci = wo.id COLLATE utf8mb4_general_ci
|
||||
AND t.tenant_no COLLATE utf8mb4_general_ci = wo.tenant_no COLLATE utf8mb4_general_ci
|
||||
AND t.del_flag = 0
|
||||
);
|
||||
|
||||
-- ---------------------------------------------------------------------------
|
||||
-- 7. 结果核对
|
||||
-- ---------------------------------------------------------------------------
|
||||
SELECT
|
||||
c.lab_storage_code,
|
||||
c.work_order_id,
|
||||
wo.work_order_no,
|
||||
wo.work_order_status,
|
||||
t.id AS task_id,
|
||||
t.task_no,
|
||||
t.task_name,
|
||||
(
|
||||
SELECT COUNT(*)
|
||||
FROM biz_production_task_step s
|
||||
WHERE s.task_id COLLATE utf8mb4_general_ci = t.id COLLATE utf8mb4_general_ci
|
||||
AND s.del_flag = 0
|
||||
) AS step_count
|
||||
FROM tmp_uc_wo_backfill c
|
||||
LEFT JOIN biz_production_work_order wo
|
||||
ON wo.id COLLATE utf8mb4_general_ci = c.work_order_id COLLATE utf8mb4_general_ci
|
||||
LEFT JOIN biz_production_task t
|
||||
ON t.id COLLATE utf8mb4_general_ci = c.task_id COLLATE utf8mb4_general_ci
|
||||
AND t.del_flag = 0
|
||||
ORDER BY c.seq;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_uc_step_map;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp_uc_wo_backfill;
|
||||
@@ -150,6 +150,7 @@ import {
|
||||
uploadAttachment
|
||||
} from '../../api/oa.js'
|
||||
import OaCommentFileCards from './OaCommentFileCards.vue'
|
||||
import { hasOaCommentDraft } from '../oa-comment-draft.js'
|
||||
import { attachmentFullUrl } from '../../utils/attachment.js'
|
||||
import { isHarmonyWechat } from '../../utils/harmony-file-picker.js'
|
||||
import HarmonyFileSource from '../../components/HarmonyFileSource.vue'
|
||||
@@ -516,12 +517,25 @@ function confirmMention() {
|
||||
mentionVisible.value = false
|
||||
}
|
||||
|
||||
async function onSend() {
|
||||
const content = draft.value.trim()
|
||||
if (!content && !mentionUsers.value.length && !picked.value.length) {
|
||||
showToast('请填写评论、@人员或添加附件')
|
||||
return
|
||||
function draftPending() {
|
||||
return hasOaCommentDraft({
|
||||
content: draft.value,
|
||||
mentionCount: mentionUsers.value.length,
|
||||
attachmentCount: picked.value.length
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批动作前冲刷未发送草稿:无草稿直接成功;有草稿则等同点击「发送」。
|
||||
* @returns {Promise<boolean>} false 表示发送失败或忙碌,调用方应中止审批动作
|
||||
*/
|
||||
async function flushDraft(opts = {}) {
|
||||
if (!draftPending()) return true
|
||||
if (sending.value || uploading.value) {
|
||||
showToast(uploading.value ? '附件上传中,请稍后再试' : '评论发送中,请稍后再试')
|
||||
return false
|
||||
}
|
||||
const content = draft.value.trim()
|
||||
sending.value = true
|
||||
try {
|
||||
await fetchCreateOaComment(props.instanceId, {
|
||||
@@ -533,15 +547,27 @@ async function onSend() {
|
||||
picked.value = []
|
||||
mentionUsers.value = []
|
||||
closeAtSuggest()
|
||||
showToast('已发送')
|
||||
if (!opts.quiet) showToast('已发送')
|
||||
emit('refresh')
|
||||
return true
|
||||
} catch (e) {
|
||||
showToast(e?.message || '发送失败')
|
||||
return false
|
||||
} finally {
|
||||
sending.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function onSend() {
|
||||
if (!draftPending()) {
|
||||
showToast('请填写评论、@人员或添加附件')
|
||||
return
|
||||
}
|
||||
await flushDraft()
|
||||
}
|
||||
|
||||
defineExpose({ flushDraft, draftPending })
|
||||
|
||||
onMounted(() => {
|
||||
void ensureUserCache()
|
||||
})
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/** 评论区是否有未发送草稿(文字 / @ / 附件) */
|
||||
export function hasOaCommentDraft(input = {}) {
|
||||
const content = String(input.content || '').trim()
|
||||
const mentionCount = Number(input.mentionCount || 0)
|
||||
const attachmentCount = Number(input.attachmentCount || 0)
|
||||
return !!(content || mentionCount > 0 || attachmentCount > 0)
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import test from 'node:test'
|
||||
import { hasOaCommentDraft } from './oa-comment-draft.js'
|
||||
|
||||
test('empty draft is false', () => {
|
||||
assert.equal(hasOaCommentDraft({}), false)
|
||||
assert.equal(hasOaCommentDraft({ content: ' ', mentionCount: 0, attachmentCount: 0 }), false)
|
||||
})
|
||||
|
||||
test('text / mention / attachment counts as draft', () => {
|
||||
assert.equal(hasOaCommentDraft({ content: '@test' }), true)
|
||||
assert.equal(hasOaCommentDraft({ mentionCount: 1 }), true)
|
||||
assert.equal(hasOaCommentDraft({ attachmentCount: 2 }), true)
|
||||
})
|
||||
@@ -29,6 +29,7 @@
|
||||
@refresh="reloadDetail"
|
||||
/>
|
||||
<OaCommentComposer
|
||||
ref="commentComposerRef"
|
||||
:instance-id="instanceId"
|
||||
:instance-status="detail?.status || ''"
|
||||
@refresh="reloadDetail"
|
||||
@@ -238,6 +239,7 @@ const currentUserId = ref('')
|
||||
const currentUserName = ref('')
|
||||
const autoPrinted = ref(false)
|
||||
|
||||
const commentComposerRef = ref(null)
|
||||
const commentVisible = ref(false)
|
||||
const commentKind = ref('approve') // approve | reject | return
|
||||
const commentText = ref('')
|
||||
@@ -492,8 +494,16 @@ function goCopyRestart() {
|
||||
})
|
||||
}
|
||||
|
||||
function openComment(kind) {
|
||||
/** 同意/拒绝/打回前先发送评论区未提交草稿 */
|
||||
async function flushPendingComment() {
|
||||
const flush = commentComposerRef.value?.flushDraft
|
||||
if (!flush) return true
|
||||
return await flush()
|
||||
}
|
||||
|
||||
async function openComment(kind) {
|
||||
if (!myPendingTask.value) return
|
||||
if (!(await flushPendingComment())) return
|
||||
commentKind.value = kind
|
||||
commentText.value = defaultComment(kind)
|
||||
commentVisible.value = true
|
||||
|
||||
@@ -141,6 +141,8 @@ export type QcWorkOrder = {
|
||||
patientName?: string
|
||||
/** 入库工单(细胞存储/科研捐赠):母亲姓名 */
|
||||
motherName?: string
|
||||
/** 协议单母血采集时间;未录入时为空,前端展示为 — */
|
||||
maternalBloodCollectTime?: string
|
||||
/** 入库工单(细胞存储/科研捐赠):新生儿姓名 */
|
||||
newbornName?: string
|
||||
/** 出库工单:当前为第几次输注计划 */
|
||||
|
||||
@@ -192,6 +192,7 @@
|
||||
} from '@/api/oaApproval'
|
||||
import OaCommentFileCards from '@/components/oa-approval/OaCommentFileCards.vue'
|
||||
import { attachmentFullUrl } from '@/composables/useAttachmentActions'
|
||||
import { hasOaCommentDraft } from '@/utils/oa-comment-draft'
|
||||
import { isOaUploadImageFile, isOaUploadVideoFile } from '@/utils/oa-upload-file-type'
|
||||
|
||||
defineOptions({ name: 'OaCommentPanel' })
|
||||
@@ -546,12 +547,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
async function onSend() {
|
||||
const content = draft.value.trim()
|
||||
if (!content && !mentionUsers.value.length && !picked.value.length) {
|
||||
ElMessage.warning('请填写评论、@人员或添加附件')
|
||||
return
|
||||
function draftPending() {
|
||||
return hasOaCommentDraft({
|
||||
content: draft.value,
|
||||
mentionCount: mentionUsers.value.length,
|
||||
attachmentCount: picked.value.length
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批动作前冲刷未发送草稿:无草稿直接成功;有草稿则等同点击「发送」。
|
||||
* @returns false 表示发送失败或忙碌,调用方应中止审批动作
|
||||
*/
|
||||
async function flushDraft(opts?: { quiet?: boolean }): Promise<boolean> {
|
||||
if (!draftPending()) return true
|
||||
if (sending.value || uploading.value) {
|
||||
ElMessage.warning(uploading.value ? '附件上传中,请稍后再试' : '评论发送中,请稍后再试')
|
||||
return false
|
||||
}
|
||||
const content = draft.value.trim()
|
||||
sending.value = true
|
||||
try {
|
||||
await fetchCreateOaComment(props.instanceId, {
|
||||
@@ -565,15 +579,27 @@
|
||||
picked.value = []
|
||||
mentionUsers.value = []
|
||||
closeAtSuggest()
|
||||
ElMessage.success('已发送')
|
||||
if (!opts?.quiet) ElMessage.success('已发送')
|
||||
emit('refresh')
|
||||
return true
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e?.message || '发送失败')
|
||||
return false
|
||||
} finally {
|
||||
sending.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function onSend() {
|
||||
if (!draftPending()) {
|
||||
ElMessage.warning('请填写评论、@人员或添加附件')
|
||||
return
|
||||
}
|
||||
await flushDraft()
|
||||
}
|
||||
|
||||
defineExpose({ flushDraft, draftPending })
|
||||
|
||||
onMounted(() => {
|
||||
void ensureUserCache()
|
||||
})
|
||||
|
||||
@@ -1335,59 +1335,6 @@ export const sqxpAdminRoutes: AppRouteRecord[] = [
|
||||
]
|
||||
},
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// 3b. 实验室样本处理数据 (menu:lab-sample-processing)
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
{
|
||||
id: 'TOP0000000000000000000000000000L1',
|
||||
name: 'LabSampleProcessing',
|
||||
path: '/lab-sample-processing',
|
||||
component: '/index/index',
|
||||
meta: {
|
||||
title: '实验室样本处理数据',
|
||||
icon: 'ri:test-tube-line',
|
||||
keepAlive: false,
|
||||
isTopMenu: true,
|
||||
menuCode: 'menu:lab-sample-processing',
|
||||
roles: ['admin']
|
||||
},
|
||||
children: [
|
||||
{
|
||||
id: 'LAB00000000000000000000000000001',
|
||||
name: 'LabSampleProcessingHsc',
|
||||
path: 'hsc',
|
||||
component: '/lab-sample-processing/hsc/index',
|
||||
meta: {
|
||||
title: '造血干细胞数据',
|
||||
keepAlive: true,
|
||||
menuCode: 'lab:sample-processing:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'LAB00000000000000000000000000002',
|
||||
name: 'LabSampleProcessingUbmc',
|
||||
path: 'ubmc',
|
||||
component: '/lab-sample-processing/ubmc/index',
|
||||
meta: {
|
||||
title: '单个核数据',
|
||||
keepAlive: true,
|
||||
menuCode: 'lab:sample-processing:list'
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'LAB00000000000000000000000000003',
|
||||
name: 'LabSampleProcessingMsc',
|
||||
path: 'msc',
|
||||
component: '/lab-sample-processing/msc/index',
|
||||
meta: {
|
||||
title: '脐带间充质干细胞数据',
|
||||
keepAlive: true,
|
||||
menuCode: 'lab:sample-processing:list'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════════
|
||||
// 4. 运营支撑 (menu:operations)
|
||||
// 二级菜单:系统基础信息、运营支撑
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { describe, it } from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { hasOaCommentDraft } from './oa-comment-draft.ts'
|
||||
|
||||
describe('hasOaCommentDraft', () => {
|
||||
it('treats blank content without mentions/files as empty', () => {
|
||||
assert.equal(hasOaCommentDraft({}), false)
|
||||
assert.equal(hasOaCommentDraft({ content: ' ', mentionCount: 0, attachmentCount: 0 }), false)
|
||||
})
|
||||
|
||||
it('detects text, mentions and attachments', () => {
|
||||
assert.equal(hasOaCommentDraft({ content: '@test' }), true)
|
||||
assert.equal(hasOaCommentDraft({ mentionCount: 1 }), true)
|
||||
assert.equal(hasOaCommentDraft({ attachmentCount: 2 }), true)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,12 @@
|
||||
/** 评论区是否有未发送草稿(文字 / @ / 附件) */
|
||||
export function hasOaCommentDraft(input: {
|
||||
content?: string | null
|
||||
mentionCount?: number
|
||||
attachmentCount?: number
|
||||
}): boolean {
|
||||
return !!(
|
||||
String(input.content || '').trim() ||
|
||||
(input.mentionCount || 0) > 0 ||
|
||||
(input.attachmentCount || 0) > 0
|
||||
)
|
||||
}
|
||||
@@ -127,7 +127,7 @@ const inboundGroupedFields: CardMetaField[] = [
|
||||
{ label: '母亲姓名', getValue: (row) => row.motherName || '—', visible: isInboundUserInfoRow },
|
||||
{ label: '新生儿姓名', getValue: (row) => row.newbornName || '—', visible: isInboundUserInfoRow },
|
||||
inboundProtocolStatusField,
|
||||
{ label: '质检对象', getValue: formatQcTarget, colSpan: 2 },
|
||||
{ label: '质检对象', getValue: formatQcTarget },
|
||||
{
|
||||
label: '关联生产工单',
|
||||
getValue: (row) => row.productionWorkOrderNo || '—',
|
||||
@@ -139,6 +139,11 @@ const inboundGroupedFields: CardMetaField[] = [
|
||||
getValue: (row) => row.sampleTypeName || '—',
|
||||
visible: isInboundUserInfoRow
|
||||
},
|
||||
{
|
||||
label: '母血采集时间',
|
||||
getValue: (row) => formatDisplayOrDash(row.maternalBloodCollectTime),
|
||||
visible: isInboundUserInfoRow
|
||||
},
|
||||
...commonTailFields
|
||||
]
|
||||
|
||||
@@ -197,6 +202,7 @@ function buildCellStorageGroupContext(row: QcWorkOrder): string[] {
|
||||
if (row.newbornName) parts.push(`新生儿 ${row.newbornName}`)
|
||||
if (row.sampleTypeName) parts.push(row.sampleTypeName)
|
||||
if (row.receptionTime) parts.push(`接收 ${row.receptionTime}`)
|
||||
parts.push(`母血采集 ${formatDisplayOrDash(row.maternalBloodCollectTime)}`)
|
||||
if (row.handlerName) parts.push(row.handlerName)
|
||||
return parts
|
||||
}
|
||||
@@ -207,6 +213,7 @@ function buildDonationGroupContext(row: QcWorkOrder): string[] {
|
||||
if (row.newbornName) parts.push(`新生儿 ${row.newbornName}`)
|
||||
if (row.sampleTypeName) parts.push(row.sampleTypeName)
|
||||
if (row.receptionTime) parts.push(`接收 ${row.receptionTime}`)
|
||||
parts.push(`母血采集 ${formatDisplayOrDash(row.maternalBloodCollectTime)}`)
|
||||
if (row.handlerName) parts.push(row.handlerName)
|
||||
return parts
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
/>
|
||||
<OaCommentPanel
|
||||
v-if="detail?.id"
|
||||
ref="commentPanelRef"
|
||||
:instance-id="detail.id"
|
||||
:instance-status="detail.status || ''"
|
||||
@refresh="load"
|
||||
@@ -236,6 +237,9 @@
|
||||
const userStore = useUserStore()
|
||||
const loading = ref(false)
|
||||
const acting = ref(false)
|
||||
const commentPanelRef = ref<{ flushDraft?: (opts?: { quiet?: boolean }) => Promise<boolean> } | null>(
|
||||
null
|
||||
)
|
||||
const detail = ref<any>(null)
|
||||
const viewFormData = ref<Record<string, any>>({})
|
||||
const viewRule = ref<any[]>([])
|
||||
@@ -392,9 +396,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
/** 同意/拒绝/打回前先发送评论区未提交草稿 */
|
||||
async function flushPendingComment(): Promise<boolean> {
|
||||
const flush = commentPanelRef.value?.flushDraft
|
||||
if (!flush) return true
|
||||
return await flush()
|
||||
}
|
||||
|
||||
async function act(kind: 'approve' | 'reject') {
|
||||
const task = myPendingTask.value
|
||||
if (!task) return
|
||||
if (!(await flushPendingComment())) return
|
||||
let comment = ''
|
||||
try {
|
||||
const res = await ElMessageBox.prompt(
|
||||
@@ -436,6 +448,7 @@
|
||||
async function doReturn() {
|
||||
const task = myPendingTask.value
|
||||
if (!task) return
|
||||
if (!(await flushPendingComment())) return
|
||||
let comment = ''
|
||||
try {
|
||||
const res = await ElMessageBox.prompt('请填写打回意见(必填)', '打回', {
|
||||
|
||||
Reference in new issue
Block a user