This commit is contained in:
zlwu committed 2026-06-26 21:44:33 +08:00
1 parent e4c4cbeedc
commit 0c7034e932
83 files changed
+13802 -12094

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import { fetchCellProductSpecList } from '@/api/admin'
/** 按规格名称精确匹配主数据,返回 specId(可选关联) */
export async function resolveCellProductSpecIdByName(
specName: string
): Promise<string | undefined> {
const name = specName.trim()
if (!name) return undefined
try {
const res = await fetchCellProductSpecList({
page: 1,
pageSize: 100,
keyword: name
})
const list = res?.list || res || []
const exact = list.find((item: { specName?: string }) => item.specName === name)
return exact?.id
} catch {
return undefined
}
}
+9
View File
@@ -0,0 +1,9 @@
/** 细胞产品类型是否需要代次(仅 MSC) */
export function cellProductTypeNeedsPassage(
productTypeName?: string | null,
productTypeCode?: string | null
): boolean {
const name = (productTypeName || '').trim().toUpperCase()
const code = (productTypeCode || '').trim().toUpperCase()
return name === 'MSC' || code === 'MSC'
}
@@ -154,7 +154,8 @@ async function fetchMineTasksByScope(
taskStatus: filters.taskStatus || undefined,
workOrderType: listQuery.workOrderType,
receptionSource: listQuery.receptionSource,
bizType: listQuery.bizType
bizType: listQuery.bizType,
includeStepSummary: true
})
const list = res.list || []
all.push(...list)
@@ -0,0 +1,68 @@
import { fetchUserList } from '@/api/admin'
/** 生产任务步骤负责人须具备的角色(与 sys_role.role_name 精确匹配) */
export const PRODUCTION_STEP_ASSIGNEE_ROLE = '实验专员'
export function productionStepAssigneeUserListParams(query?: string) {
return {
page: 1,
pageSize: 50,
keyword: query?.trim() || undefined,
status: '1',
roleName: PRODUCTION_STEP_ASSIGNEE_ROLE
}
}
let cachedDefaultUsers: Api.User.UserItem[] | null = null
const cacheByKeyword = new Map<string, Api.User.UserItem[]>()
let inflightDefault: Promise<Api.User.UserItem[]> | null = null
const inflightByKeyword = new Map<string, Promise<Api.User.UserItem[]>>()
/** 带会话内缓存的实验专员用户列表(派发/编辑步骤负责人下拉共用) */
export async function fetchProductionStepAssigneeUsers(query?: string) {
const kw = (query || '').trim()
if (!kw) {
if (cachedDefaultUsers) {
return { list: cachedDefaultUsers, total: cachedDefaultUsers.length }
}
if (!inflightDefault) {
inflightDefault = fetchUserList(productionStepAssigneeUserListParams(''))
.then((res) => {
cachedDefaultUsers = res.list || []
return cachedDefaultUsers
})
.finally(() => {
inflightDefault = null
})
}
const list = await inflightDefault
return { list, total: list.length }
}
if (cacheByKeyword.has(kw)) {
const list = cacheByKeyword.get(kw)!
return { list, total: list.length }
}
let inflight = inflightByKeyword.get(kw)
if (!inflight) {
inflight = fetchUserList(productionStepAssigneeUserListParams(kw))
.then((res) => {
const list = res.list || []
cacheByKeyword.set(kw, list)
return list
})
.finally(() => {
inflightByKeyword.delete(kw)
})
inflightByKeyword.set(kw, inflight)
}
const list = await inflight
return { list, total: list.length }
}
export function invalidateProductionStepAssigneeUserCache() {
cachedDefaultUsers = null
cacheByKeyword.clear()
}