提交
This commit is contained in:
1 parent
427bcb1551
commit
31b04575e2
247 files changed
+39284
-20367
No files matched your search
@@ -198,11 +198,21 @@
|
||||
<SampleTransportFormSection
|
||||
v-model:samples="formData.samples"
|
||||
:sample-type-options="sampleTypeOptions"
|
||||
:sample-type-options-loading="sampleTypeLoading"
|
||||
:sample-code-options="sampleCodeOptions"
|
||||
:sample-code-options-loading="sampleCodeLoading"
|
||||
:unit-options="unitOptions"
|
||||
:unit-options-loading="unitLoading"
|
||||
:site-options="siteOptions"
|
||||
:site-options-loading="siteLoading"
|
||||
:express-company-options="expressCompanyOptions"
|
||||
:express-company-options-loading="expressCompanyLoading"
|
||||
:show-price="false"
|
||||
@search-sample-code="remoteSearchSampleCodes"
|
||||
@search-sample-type="remoteSearchSampleTypes"
|
||||
@search-unit="remoteSearchUnits"
|
||||
@search-site="remoteSearchSites"
|
||||
@search-express-company="remoteSearchExpressCompanies"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -657,6 +667,11 @@
|
||||
>([])
|
||||
const unitOptions = ref<Array<{ id: string; unitName: string; unitCode: string }>>([])
|
||||
const sampleCodeOptions = ref<Api.BizSampleCode.SampleCodeItem[]>([])
|
||||
const sampleCodeLoading = ref(false)
|
||||
const sampleTypeLoading = ref(false)
|
||||
const unitLoading = ref(false)
|
||||
const siteLoading = ref(false)
|
||||
const expressCompanyLoading = ref(false)
|
||||
const expressCompanyOptions = ref<Api.ExpressCompany.ExpressCompanyItem[]>([])
|
||||
const siteOptions = ref<Api.Site.SiteItem[]>([])
|
||||
let sampleRowSeq = 0
|
||||
@@ -857,6 +872,11 @@
|
||||
salesSnapshot.value = null
|
||||
regionOptions.value = []
|
||||
hospitalOptions.value = []
|
||||
sampleTypeOptions.value = []
|
||||
unitOptions.value = []
|
||||
sampleCodeOptions.value = []
|
||||
siteOptions.value = []
|
||||
expressCompanyOptions.value = []
|
||||
activeFormTab.value = 'basic'
|
||||
}
|
||||
|
||||
@@ -898,7 +918,6 @@
|
||||
resetForm()
|
||||
formData.motherEthnic = DEFAULT_MOTHER_ETHNIC
|
||||
formData.donationDate = new Date().toISOString().slice(0, 10).replace(/-/g, '')
|
||||
loadSampleOptions()
|
||||
void loadEthnicOptions()
|
||||
void remoteSearchCustomers('')
|
||||
|
||||
@@ -1022,8 +1041,7 @@
|
||||
dialogFormLoading.value = true
|
||||
|
||||
try {
|
||||
const [, , bundle] = await Promise.all([
|
||||
loadSampleOptions(),
|
||||
const [, bundle] = await Promise.all([
|
||||
loadEthnicOptions(),
|
||||
fetchResearchDonationDetail(String(row.id)).catch(() => null)
|
||||
])
|
||||
@@ -1060,7 +1078,7 @@
|
||||
}
|
||||
await Promise.all(hydrateTasks)
|
||||
if (formData.samples.length) {
|
||||
ensureSampleCodesInOptions(formData.samples)
|
||||
hydrateSampleLookupOptions()
|
||||
}
|
||||
} catch {
|
||||
/* 保留列表行已填基础字段 */
|
||||
@@ -1344,6 +1362,65 @@
|
||||
sampleCodeOptions.value = merged
|
||||
}
|
||||
|
||||
function ensureSampleTypesInOptions(samples: Array<Record<string, any>>) {
|
||||
const merged = [...sampleTypeOptions.value]
|
||||
for (const s of samples) {
|
||||
const id = String(s.sampleTypeId || '')
|
||||
if (!id || merged.some((x) => x.id === id)) continue
|
||||
merged.push({
|
||||
id,
|
||||
typeCode: '',
|
||||
typeName: id,
|
||||
storageYears: s.storageYears ?? null,
|
||||
storagePrice: null
|
||||
})
|
||||
}
|
||||
sampleTypeOptions.value = merged
|
||||
}
|
||||
|
||||
function ensureUnitsInOptions(samples: Array<Record<string, any>>) {
|
||||
const merged = [...unitOptions.value]
|
||||
for (const s of samples) {
|
||||
const id = String(s.unitId || '')
|
||||
if (!id || merged.some((x) => x.id === id)) continue
|
||||
merged.push({ id, unitName: id, unitCode: '' })
|
||||
}
|
||||
unitOptions.value = merged
|
||||
}
|
||||
|
||||
function ensureSitesInOptions(samples: Array<Record<string, any>>) {
|
||||
const merged = [...siteOptions.value]
|
||||
for (const s of samples) {
|
||||
const id = String(s.transport?.destSiteId || '')
|
||||
if (!id || merged.some((x) => x.id === id)) continue
|
||||
merged.push({
|
||||
id,
|
||||
siteCode: '',
|
||||
siteName: id,
|
||||
siteType: '',
|
||||
status: '',
|
||||
address: '',
|
||||
contactName: '',
|
||||
contactPhone: '',
|
||||
businessScope: '',
|
||||
siteImage: '',
|
||||
tenantNo: '',
|
||||
orderNum: 0,
|
||||
remark: '',
|
||||
createTime: '',
|
||||
updateTime: ''
|
||||
})
|
||||
}
|
||||
siteOptions.value = merged
|
||||
}
|
||||
|
||||
function hydrateSampleLookupOptions() {
|
||||
ensureSampleTypesInOptions(formData.samples)
|
||||
ensureSampleCodesInOptions(formData.samples)
|
||||
ensureUnitsInOptions(formData.samples)
|
||||
ensureSitesInOptions(formData.samples)
|
||||
}
|
||||
|
||||
/* ====== 客户检索(母亲信息) ====== */
|
||||
function formatCustomerLabel(c: { customerName: string; phoneNo: string; idCardNo: string }) {
|
||||
const parts = [c.customerName || '']
|
||||
@@ -1476,23 +1553,91 @@
|
||||
formData.salesUserId = u.id
|
||||
}
|
||||
|
||||
/* ====== 样本类型/单位选项 ====== */
|
||||
async function loadSampleOptions() {
|
||||
async function remoteSearchSampleCodes(query: string) {
|
||||
sampleCodeLoading.value = true
|
||||
try {
|
||||
const [stRes, uRes, scRes, ecRes, siteRes] = await Promise.all([
|
||||
fetchCellSampleTypeList({ page: 1, pageSize: 100 }),
|
||||
fetchItemUnitList({ page: 1, pageSize: 100 }),
|
||||
fetchSampleCodeList({ page: 1, pageSize: 100 }),
|
||||
fetchExpressCompanyList({ page: 1, pageSize: 100 }),
|
||||
fetchSiteList({ page: 1, pageSize: 100 })
|
||||
])
|
||||
sampleTypeOptions.value = (stRes.list || []) as any
|
||||
unitOptions.value = (uRes.list || []) as any
|
||||
sampleCodeOptions.value = (scRes.list || []) as any
|
||||
expressCompanyOptions.value = ecRes.list || []
|
||||
siteOptions.value = siteRes.list || []
|
||||
const res = await fetchSampleCodeList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
sampleCodeOptions.value = (res.list || []) as Api.BizSampleCode.SampleCodeItem[]
|
||||
ensureSampleCodesInOptions(formData.samples)
|
||||
} catch {
|
||||
/* ignore */
|
||||
sampleCodeOptions.value = []
|
||||
ensureSampleCodesInOptions(formData.samples)
|
||||
} finally {
|
||||
sampleCodeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function remoteSearchSampleTypes(query: string) {
|
||||
sampleTypeLoading.value = true
|
||||
try {
|
||||
const res = await fetchCellSampleTypeList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
sampleTypeOptions.value = (res.list || []) as any
|
||||
ensureSampleTypesInOptions(formData.samples)
|
||||
} catch {
|
||||
sampleTypeOptions.value = []
|
||||
ensureSampleTypesInOptions(formData.samples)
|
||||
} finally {
|
||||
sampleTypeLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function remoteSearchUnits(query: string) {
|
||||
unitLoading.value = true
|
||||
try {
|
||||
const res = await fetchItemUnitList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
unitOptions.value = (res.list || []) as any
|
||||
ensureUnitsInOptions(formData.samples)
|
||||
} catch {
|
||||
unitOptions.value = []
|
||||
ensureUnitsInOptions(formData.samples)
|
||||
} finally {
|
||||
unitLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function remoteSearchSites(query: string) {
|
||||
siteLoading.value = true
|
||||
try {
|
||||
const res = await fetchSiteList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
siteOptions.value = res.list || []
|
||||
ensureSitesInOptions(formData.samples)
|
||||
} catch {
|
||||
siteOptions.value = []
|
||||
ensureSitesInOptions(formData.samples)
|
||||
} finally {
|
||||
siteLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function remoteSearchExpressCompanies(query: string) {
|
||||
expressCompanyLoading.value = true
|
||||
try {
|
||||
const res = await fetchExpressCompanyList({
|
||||
page: 1,
|
||||
pageSize: 100,
|
||||
keyword: query?.trim() || undefined
|
||||
})
|
||||
expressCompanyOptions.value = res.list || []
|
||||
} catch {
|
||||
expressCompanyOptions.value = []
|
||||
} finally {
|
||||
expressCompanyLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user