2855 lines
94 KiB
Vue
2855 lines
94 KiB
Vue
<template>
|
|
<!-- ========== 捐赠协议单 - 新增/编辑弹窗 ========== -->
|
|
<el-dialog
|
|
:model-value="modelValue"
|
|
:title="dialogTitle"
|
|
width="1600px"
|
|
class="dialog-form-layout"
|
|
align-center
|
|
append-to-body
|
|
modal-class="protocol-dialog-mask"
|
|
destroy-on-close
|
|
:close-on-click-modal="false"
|
|
@update:model-value="emit('update:modelValue', $event)"
|
|
@closed="resetForm"
|
|
>
|
|
<DialogFormBody :loading="dialogFormLoading" body-class="protocol-dialog-body min-h-[200px]">
|
|
<div class="detail-tabs">
|
|
<div
|
|
v-for="tab in formTabs"
|
|
:key="tab.key"
|
|
class="detail-tab"
|
|
:class="{ active: activeFormTab === tab.key }"
|
|
@click="scrollToSection(tab.key)"
|
|
>
|
|
{{ tab.label }}
|
|
</div>
|
|
</div>
|
|
|
|
<el-form
|
|
ref="formRef"
|
|
:model="formData"
|
|
:rules="formRules"
|
|
label-position="top"
|
|
scroll-to-error
|
|
class="protocol-form"
|
|
>
|
|
<!-- Tab 1: 基本信息 -->
|
|
<div id="form-section-basic" class="form-tab-pane">
|
|
<div class="section-card">
|
|
<div class="section-title">
|
|
<div class="section-title-left"><h3>基本信息</h3></div>
|
|
</div>
|
|
<div class="form-grid form-grid--col4">
|
|
<el-form-item label="捐赠状态" prop="donationStatus">
|
|
<el-select
|
|
v-model="formData.donationStatus"
|
|
placeholder="请选择"
|
|
style="width: 100%"
|
|
>
|
|
<el-option label="待生效" value="dsx" />
|
|
<el-option label="生效中" value="sxz" />
|
|
<el-option label="已过期" value="ygq" />
|
|
<el-option label="已作废" value="yzf" />
|
|
<el-option label="属地废弃" value="sdfq" />
|
|
<el-option label="转细胞存储" value="zckc" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="捐赠日期" prop="donationDate">
|
|
<el-date-picker
|
|
v-model="formData.donationDate"
|
|
type="date"
|
|
value-format="YYYYMMDD"
|
|
format="YYYY-MM-DD"
|
|
placeholder="选择捐赠日期"
|
|
clearable
|
|
style="width: 100%"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="采集专员" prop="collectorUserId">
|
|
<el-select
|
|
v-model="collectorUserId"
|
|
class="w-full"
|
|
filterable
|
|
remote
|
|
clearable
|
|
reserve-keyword
|
|
:remote-method="remoteSearchCollectorUsers"
|
|
:loading="collectorLoading"
|
|
placeholder="输入姓名检索用户"
|
|
@change="onCollectorUserChange"
|
|
>
|
|
<el-option
|
|
v-for="u in collectorUserOptions"
|
|
:key="u.id"
|
|
:label="u.nickName + (u.phoneNo ? ' · ' + u.phoneNo : '')"
|
|
:value="u.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="备注">
|
|
<el-input v-model="formData.remark" type="textarea" :rows="2" placeholder="可选" />
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tab 2: 采集信息 -->
|
|
<div id="form-section-collection" class="form-tab-pane">
|
|
<div class="section-card">
|
|
<div class="section-title">
|
|
<div class="section-title-left"><h3>采集信息</h3></div>
|
|
</div>
|
|
<div class="form-grid form-grid--col7">
|
|
<el-form-item label="市场专员">
|
|
<el-select
|
|
v-model="salesUserId"
|
|
class="w-full"
|
|
filterable
|
|
remote
|
|
clearable
|
|
reserve-keyword
|
|
:remote-method="remoteSearchSalesUsers"
|
|
:loading="salesLoading"
|
|
placeholder="输入姓名检索用户"
|
|
@change="onSalesUserChange"
|
|
>
|
|
<el-option
|
|
v-for="u in salesUserOptions"
|
|
:key="u.id"
|
|
:label="u.nickName + (u.phoneNo ? ' · ' + u.phoneNo : '')"
|
|
:value="u.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="采集地区">
|
|
<el-select
|
|
v-model="formData.regionId"
|
|
class="w-full"
|
|
filterable
|
|
:remote="!linkedRegionMode"
|
|
clearable
|
|
reserve-keyword
|
|
:remote-method="linkedRegionMode ? undefined : remoteSearchRegions"
|
|
:loading="regionLoading"
|
|
:placeholder="linkedRegionMode ? '请选择关联地区' : '输入地区名称检索'"
|
|
@change="onRegionChange"
|
|
@clear="onRegionClear"
|
|
>
|
|
<el-option
|
|
v-for="r in regionOptions"
|
|
:key="r.id"
|
|
:label="r.regionName"
|
|
:value="r.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="采集医院">
|
|
<el-select
|
|
v-model="formData.hospitalId"
|
|
class="w-full"
|
|
filterable
|
|
remote
|
|
clearable
|
|
reserve-keyword
|
|
:remote-method="remoteSearchHospitals"
|
|
:loading="hospitalLoading"
|
|
:disabled="!formData.regionId"
|
|
placeholder="请先选择采集地区"
|
|
@change="onHospitalChange"
|
|
>
|
|
<el-option
|
|
v-for="h in hospitalOptions"
|
|
:key="h.id"
|
|
:label="h.hospitalName"
|
|
:value="h.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="地区经理">
|
|
<el-select
|
|
v-model="regionManagerUserId"
|
|
class="w-full"
|
|
filterable
|
|
remote
|
|
clearable
|
|
reserve-keyword
|
|
:remote-method="remoteSearchManagerUsers"
|
|
:loading="managerLoading"
|
|
placeholder="默认取地区负责人,可修改"
|
|
@change="onManagerUserChange"
|
|
>
|
|
<el-option
|
|
v-for="u in managerUserOptions"
|
|
:key="u.id"
|
|
:label="u.nickName + (u.phoneNo ? ' · ' + u.phoneNo : '')"
|
|
:value="u.id"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="采集医护">
|
|
<el-input v-model="formData.medicalStaff" placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item label="样本采集时间">
|
|
<div
|
|
class="date-paste-wrap"
|
|
@paste.capture="
|
|
(e) =>
|
|
handleChineseDatetimePaste(
|
|
e,
|
|
'datetime-minute',
|
|
(v) => (formData.sampleCollectTime = v)
|
|
)
|
|
"
|
|
>
|
|
<el-date-picker
|
|
v-model="formData.sampleCollectTime"
|
|
type="datetime"
|
|
format="YYYY-MM-DD HH:mm"
|
|
value-format="YYYY-MM-DD HH:mm"
|
|
placeholder="选择采集时间"
|
|
clearable
|
|
style="width: 100%"
|
|
/>
|
|
</div>
|
|
</el-form-item>
|
|
<el-form-item label="母血采集时间">
|
|
<div
|
|
class="date-paste-wrap"
|
|
@paste.capture="
|
|
(e) =>
|
|
handleChineseDatetimePaste(
|
|
e,
|
|
'datetime-minute',
|
|
(v) => (formData.maternalBloodCollectTime = v)
|
|
)
|
|
"
|
|
>
|
|
<el-date-picker
|
|
v-model="formData.maternalBloodCollectTime"
|
|
type="datetime"
|
|
format="YYYY-MM-DD HH:mm"
|
|
value-format="YYYY-MM-DD HH:mm"
|
|
placeholder="选择采集时间"
|
|
clearable
|
|
style="width: 100%"
|
|
/>
|
|
</div>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tab 3: 样本及运输信息 -->
|
|
<div id="form-section-sample" class="form-tab-pane">
|
|
<div class="section-card">
|
|
<div class="section-title">
|
|
<div class="section-title-left"><h3>样本及运输信息</h3></div>
|
|
</div>
|
|
<SampleTransportFormSection
|
|
v-model:samples="formData.samples"
|
|
sample-source="research_donation"
|
|
:protocol-id="formData.id || ''"
|
|
hide-collect-detail-fields
|
|
auto-generate-sample-code
|
|
:reserve-sample-code="reserveDonationSampleCode"
|
|
: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"
|
|
:show-price="false"
|
|
@search-sample-code="remoteSearchSampleCodes"
|
|
@search-sample-type="remoteSearchSampleTypes"
|
|
@search-unit="remoteSearchUnits"
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tab 4: 客户信息 -->
|
|
<div id="form-section-party" class="form-tab-pane">
|
|
<div class="section-card section-card--green">
|
|
<div class="section-title">
|
|
<div class="section-title-left"><h3>客户信息</h3></div>
|
|
</div>
|
|
<div class="client-sub-cards">
|
|
<!-- 母亲信息 -->
|
|
<div class="client-sub-card">
|
|
<div class="sub-card-header">
|
|
<span class="icon">🤱</span>
|
|
<h4>母亲信息</h4>
|
|
</div>
|
|
<div class="form-grid form-grid--col2">
|
|
<el-form-item>
|
|
<template #label>
|
|
母亲姓名<span class="form-label-tip">可检索客户档案</span>
|
|
</template>
|
|
<el-autocomplete
|
|
v-model="formData.motherName"
|
|
class="w-full"
|
|
:fetch-suggestions="queryPartyCustomers"
|
|
:fit-input-width="false"
|
|
clearable
|
|
value-key="customerName"
|
|
placeholder="输入姓名检索或直接填写"
|
|
popper-class="mother-customer-suggest-popper"
|
|
@select="onMotherCustomerSelect"
|
|
@clear="onMotherCustomerClear"
|
|
@input="onMotherNameInput"
|
|
>
|
|
<template #default="{ item }">
|
|
<div class="mother-customer-suggest-item">
|
|
<span class="mother-customer-suggest-item__name">{{
|
|
item.customerName || '—'
|
|
}}</span>
|
|
<span class="mother-customer-suggest-item__phone">{{
|
|
item.phoneNo || '—'
|
|
}}</span>
|
|
<span class="mother-customer-suggest-item__idcard">{{
|
|
item.idCardNo || '—'
|
|
}}</span>
|
|
</div>
|
|
</template>
|
|
</el-autocomplete>
|
|
</el-form-item>
|
|
<el-form-item label="母亲联系电话">
|
|
<el-input v-model="formData.motherPhone" placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item label="母亲身份证号">
|
|
<el-input v-model="formData.motherIdCard" placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item label="母亲邮箱">
|
|
<el-input v-model="formData.motherEmail" placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item label="母亲出生年月">
|
|
<el-date-picker
|
|
v-model="formData.motherBirthYm"
|
|
type="month"
|
|
value-format="YYYYMM"
|
|
format="YYYY-MM"
|
|
placeholder="选择月份"
|
|
clearable
|
|
style="width: 100%"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="母亲民族">
|
|
<el-select
|
|
v-model="formData.motherEthnic"
|
|
class="w-full"
|
|
filterable
|
|
clearable
|
|
:loading="ethnicLoading"
|
|
placeholder="请选择或检索民族"
|
|
>
|
|
<el-option
|
|
v-for="e in ethnicOptions"
|
|
:key="e.ethnicCode"
|
|
:label="e.ethnicName"
|
|
:value="e.ethnicName"
|
|
/>
|
|
</el-select>
|
|
</el-form-item>
|
|
</div>
|
|
<el-form-item label="母亲家庭住址">
|
|
<el-input v-model="formData.motherAddress" placeholder="请输入" />
|
|
</el-form-item>
|
|
</div>
|
|
|
|
<!-- 父亲信息 -->
|
|
<div class="client-sub-card">
|
|
<div class="sub-card-header">
|
|
<span class="icon">👨</span>
|
|
<h4>父亲信息</h4>
|
|
</div>
|
|
<div class="form-grid form-grid--col2">
|
|
<el-form-item>
|
|
<template #label>
|
|
父亲姓名<span class="form-label-tip">可检索客户档案</span>
|
|
</template>
|
|
<el-autocomplete
|
|
v-model="formData.fatherName"
|
|
class="w-full"
|
|
:fetch-suggestions="queryPartyCustomers"
|
|
:fit-input-width="false"
|
|
clearable
|
|
value-key="customerName"
|
|
placeholder="输入姓名检索或直接填写"
|
|
popper-class="mother-customer-suggest-popper"
|
|
@select="onFatherCustomerSelect"
|
|
@clear="onFatherCustomerClear"
|
|
@input="onFatherNameInput"
|
|
>
|
|
<template #default="{ item }">
|
|
<div class="mother-customer-suggest-item">
|
|
<span class="mother-customer-suggest-item__name">{{
|
|
item.customerName || '—'
|
|
}}</span>
|
|
<span class="mother-customer-suggest-item__phone">{{
|
|
item.phoneNo || '—'
|
|
}}</span>
|
|
<span class="mother-customer-suggest-item__idcard">{{
|
|
item.idCardNo || '—'
|
|
}}</span>
|
|
</div>
|
|
</template>
|
|
</el-autocomplete>
|
|
</el-form-item>
|
|
<el-form-item label="父亲电话">
|
|
<el-input v-model="formData.fatherPhone" placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item label="父亲身份证号" class="form-col-span-2">
|
|
<el-input v-model="formData.fatherIdCard" placeholder="请输入" />
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 新生儿信息 -->
|
|
<div class="client-sub-card">
|
|
<div class="sub-card-header">
|
|
<span class="icon">👶</span>
|
|
<h4>新生儿信息</h4>
|
|
</div>
|
|
<div class="form-grid form-grid--col2">
|
|
<el-form-item label="新生儿姓名">
|
|
<el-input v-model="formData.newbornName" placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item label="新生儿性别">
|
|
<el-radio-group v-model="formData.newbornSex">
|
|
<el-radio label="1">男</el-radio>
|
|
<el-radio label="0">女</el-radio>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
<el-form-item label="预产期">
|
|
<div
|
|
class="date-paste-wrap"
|
|
@paste.capture="
|
|
(e) =>
|
|
handleChineseDatetimePaste(
|
|
e,
|
|
'date',
|
|
(v) => (formData.expectedDeliveryDate = v)
|
|
)
|
|
"
|
|
>
|
|
<el-date-picker
|
|
v-model="formData.expectedDeliveryDate"
|
|
type="date"
|
|
value-format="YYYY-MM-DD"
|
|
placeholder="选择预产期"
|
|
clearable
|
|
style="width: 100%"
|
|
/>
|
|
</div>
|
|
</el-form-item>
|
|
<el-form-item label="新生儿分娩时间">
|
|
<div
|
|
class="date-paste-wrap"
|
|
@paste.capture="
|
|
(e) =>
|
|
handleChineseDatetimePaste(
|
|
e,
|
|
'datetime',
|
|
(v) => (formData.newbornDeliveryTime = v)
|
|
)
|
|
"
|
|
>
|
|
<el-date-picker
|
|
v-model="formData.newbornDeliveryTime"
|
|
type="datetime"
|
|
value-format="YYYY-MM-DD HH:mm:ss"
|
|
placeholder="选择分娩时间"
|
|
clearable
|
|
style="width: 100%"
|
|
/>
|
|
</div>
|
|
</el-form-item>
|
|
<el-form-item label="新生儿身份证" class="form-col-span-2">
|
|
<el-input v-model="formData.newbornIdCard" placeholder="请输入" />
|
|
</el-form-item>
|
|
<el-form-item label="分娩方式">
|
|
<el-select
|
|
v-model="formData.deliveryMode"
|
|
placeholder="请选择"
|
|
clearable
|
|
style="width: 100%"
|
|
>
|
|
<el-option label="顺产" value="sc" />
|
|
<el-option label="剖宫产" value="pgc" />
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="胎次">
|
|
<el-input
|
|
v-model="formData.birthOrder"
|
|
type="number"
|
|
step="any"
|
|
:min="1"
|
|
style="width: 100%"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="新生儿体重(克)">
|
|
<el-input
|
|
:model-value="formData.newbornWeightGram ?? ''"
|
|
placeholder="请输入"
|
|
style="width: 100%"
|
|
@update:model-value="
|
|
(v) => (formData.newbornWeightGram = extractNumericPart(v))
|
|
"
|
|
/>
|
|
</el-form-item>
|
|
<el-form-item label="新生儿评分">
|
|
<el-input
|
|
v-model="formData.apgar1min"
|
|
type="number"
|
|
step="any"
|
|
:min="0"
|
|
:max="10"
|
|
style="width: 100%"
|
|
/>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Tab 5: 附件信息 -->
|
|
<div id="form-section-attachment" class="form-tab-pane">
|
|
<div class="section-card">
|
|
<div class="section-title">
|
|
<div class="section-title-left"><h3>附件信息</h3></div>
|
|
</div>
|
|
|
|
<!-- 知情同意书 -->
|
|
<div class="form-grid form-grid--attachment">
|
|
<el-form-item label="知情同意书">
|
|
<div
|
|
class="attachment-upload"
|
|
:class="{ 'is-dragover': isConsentAttachDragover }"
|
|
v-bind="consentAttachDropHandlers"
|
|
>
|
|
<div class="attachment-list">
|
|
<el-upload
|
|
ref="consentUploadRef"
|
|
:auto-upload="false"
|
|
:show-file-list="false"
|
|
:multiple="true"
|
|
@change="handleConsentAttachmentChange"
|
|
>
|
|
<div class="upload-card">
|
|
<el-icon :size="28" color="#047857"><Plus /></el-icon>
|
|
<span class="upload-card-text">上传附件</span>
|
|
</div>
|
|
</el-upload>
|
|
<div
|
|
v-for="(file, fIdx) in consentAttachments"
|
|
:key="file.id || fIdx"
|
|
class="attachment-item"
|
|
:class="{ 'is-uploading': file._uploading }"
|
|
>
|
|
<div
|
|
class="attachment-preview"
|
|
@click="
|
|
isImageFile(file) && file.fileUrl ? handlePreviewAttachment(file) : undefined
|
|
"
|
|
>
|
|
<template v-if="isImageFile(file) && file.fileUrl">
|
|
<img :src="fullFileUrl(file.fileUrl)" :alt="file.fileName" />
|
|
</template>
|
|
<template v-else-if="isImageFile(file) && !file.fileUrl">
|
|
<el-icon :size="24" color="#94a3b8"><Loading /></el-icon>
|
|
</template>
|
|
<template v-else-if="isVideoFile(file)">
|
|
<div class="attachment-preview__icon attachment-preview__icon--video">
|
|
<el-icon :size="28"><VideoPlay /></el-icon>
|
|
</div>
|
|
</template>
|
|
<template v-else>
|
|
<div class="attachment-preview__icon attachment-preview__icon--doc">
|
|
<el-icon :size="28"><Document /></el-icon>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
<div class="attachment-footer">
|
|
<span class="attachment-name" :title="file.fileName">{{ file.fileName }}</span>
|
|
<div class="attachment-actions">
|
|
<el-icon
|
|
class="action-btn"
|
|
title="下载"
|
|
@click="handleDownloadAttachment(file)"
|
|
><Download
|
|
/></el-icon>
|
|
<el-icon
|
|
class="action-btn action-btn--danger"
|
|
title="删除"
|
|
@click="removeConsentAttachment(fIdx)"
|
|
><Delete
|
|
/></el-icon>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<span class="upload-hint"
|
|
>支持拖拽或点击上传图片、视频、PDF、Word、Excel
|
|
等常见文件格式,可稍后补充,单文件不超过 20MB</span
|
|
>
|
|
</div>
|
|
</el-form-item>
|
|
</div>
|
|
|
|
<!-- 传染病检测报告 -->
|
|
<div class="form-grid form-grid--attachment">
|
|
<el-form-item label="传染病检测报告">
|
|
<div
|
|
class="attachment-upload"
|
|
:class="{ 'is-dragover': isInfectiousReportAttachDragover }"
|
|
v-bind="infectiousReportAttachDropHandlers"
|
|
>
|
|
<div class="attachment-list">
|
|
<el-upload
|
|
ref="infectiousReportUploadRef"
|
|
:auto-upload="false"
|
|
:show-file-list="false"
|
|
:multiple="true"
|
|
@change="handleInfectiousReportAttachmentChange"
|
|
>
|
|
<div class="upload-card">
|
|
<el-icon :size="28" color="#047857"><Plus /></el-icon>
|
|
<span class="upload-card-text">上传附件</span>
|
|
</div>
|
|
</el-upload>
|
|
<div
|
|
v-for="(file, fIdx) in infectiousDiseaseReportAttachments"
|
|
:key="file.id || fIdx"
|
|
class="attachment-item"
|
|
:class="{ 'is-uploading': file._uploading }"
|
|
>
|
|
<div
|
|
class="attachment-preview"
|
|
@click="
|
|
isImageFile(file) && file.fileUrl ? handlePreviewAttachment(file) : undefined
|
|
"
|
|
>
|
|
<template v-if="isImageFile(file) && file.fileUrl">
|
|
<img :src="fullFileUrl(file.fileUrl)" :alt="file.fileName" />
|
|
</template>
|
|
<template v-else-if="isImageFile(file) && !file.fileUrl">
|
|
<el-icon :size="24" color="#94a3b8"><Loading /></el-icon>
|
|
</template>
|
|
<template v-else-if="isVideoFile(file)">
|
|
<div class="attachment-preview__icon attachment-preview__icon--video">
|
|
<el-icon :size="28"><VideoPlay /></el-icon>
|
|
</div>
|
|
</template>
|
|
<template v-else>
|
|
<div class="attachment-preview__icon attachment-preview__icon--doc">
|
|
<el-icon :size="28"><Document /></el-icon>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
<div class="attachment-footer">
|
|
<span class="attachment-name" :title="file.fileName">{{ file.fileName }}</span>
|
|
<div class="attachment-actions">
|
|
<el-icon
|
|
class="action-btn"
|
|
title="下载"
|
|
@click="handleDownloadAttachment(file)"
|
|
><Download
|
|
/></el-icon>
|
|
<el-icon
|
|
class="action-btn action-btn--danger"
|
|
title="删除"
|
|
@click="removeInfectiousReportAttachment(fIdx)"
|
|
><Delete
|
|
/></el-icon>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<span class="upload-hint"
|
|
>支持拖拽或点击上传图片、视频、PDF、Word、Excel
|
|
等常见文件格式,可稍后补充,单文件不超过 20MB</span
|
|
>
|
|
</div>
|
|
</el-form-item>
|
|
</div>
|
|
|
|
<!-- 其他附件 -->
|
|
<div class="form-grid form-grid--attachment">
|
|
<el-form-item label="其他附件">
|
|
<div
|
|
class="attachment-upload"
|
|
:class="{ 'is-dragover': isOtherAttachDragover }"
|
|
v-bind="otherAttachDropHandlers"
|
|
>
|
|
<div class="attachment-list">
|
|
<el-upload
|
|
ref="otherUploadRef"
|
|
:auto-upload="false"
|
|
:show-file-list="false"
|
|
:multiple="true"
|
|
@change="handleOtherAttachmentChange"
|
|
>
|
|
<div class="upload-card">
|
|
<el-icon :size="28" color="#047857"><Plus /></el-icon>
|
|
<span class="upload-card-text">上传附件</span>
|
|
</div>
|
|
</el-upload>
|
|
<div
|
|
v-for="(file, fIdx) in otherAttachments"
|
|
:key="file.id || fIdx"
|
|
class="attachment-item"
|
|
:class="{ 'is-uploading': file._uploading }"
|
|
>
|
|
<div
|
|
class="attachment-preview"
|
|
@click="
|
|
isImageFile(file) && file.fileUrl ? handlePreviewAttachment(file) : undefined
|
|
"
|
|
>
|
|
<template v-if="isImageFile(file) && file.fileUrl">
|
|
<img :src="fullFileUrl(file.fileUrl)" :alt="file.fileName" />
|
|
</template>
|
|
<template v-else-if="isImageFile(file) && !file.fileUrl">
|
|
<el-icon :size="24" color="#94a3b8"><Loading /></el-icon>
|
|
</template>
|
|
<template v-else-if="isVideoFile(file)">
|
|
<div class="attachment-preview__icon attachment-preview__icon--video">
|
|
<el-icon :size="28"><VideoPlay /></el-icon>
|
|
</div>
|
|
</template>
|
|
<template v-else>
|
|
<div class="attachment-preview__icon attachment-preview__icon--doc">
|
|
<el-icon :size="28"><Document /></el-icon>
|
|
</div>
|
|
</template>
|
|
</div>
|
|
<div class="attachment-footer">
|
|
<span class="attachment-name" :title="file.fileName">{{ file.fileName }}</span>
|
|
<div class="attachment-actions">
|
|
<el-icon
|
|
class="action-btn"
|
|
title="下载"
|
|
@click="handleDownloadAttachment(file)"
|
|
><Download
|
|
/></el-icon>
|
|
<el-icon
|
|
class="action-btn action-btn--danger"
|
|
title="删除"
|
|
@click="removeOtherAttachment(fIdx)"
|
|
><Delete
|
|
/></el-icon>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<span class="upload-hint"
|
|
>支持拖拽或点击上传图片、视频、PDF、Word、Excel
|
|
等常见文件格式,单文件不超过 20MB</span
|
|
>
|
|
</div>
|
|
</el-form-item>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</el-form>
|
|
</DialogFormBody>
|
|
|
|
<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="submitLoading" @click="handleSubmit">
|
|
<el-icon><Check /></el-icon>
|
|
确定
|
|
</el-button>
|
|
</template>
|
|
</el-dialog>
|
|
|
|
<!-- ========== 文件预览弹窗 ========== -->
|
|
<el-dialog
|
|
v-model="previewVisible"
|
|
title="文件预览"
|
|
width="800px"
|
|
align-center
|
|
append-to-body
|
|
destroy-on-close
|
|
>
|
|
<div v-if="previewType === 'image'" class="preview-container">
|
|
<img
|
|
:src="previewUrl"
|
|
alt="预览"
|
|
style="max-width: 100%; max-height: 70vh; display: block; margin: 0 auto"
|
|
/>
|
|
</div>
|
|
<div v-else class="preview-container">
|
|
<video
|
|
:src="previewUrl"
|
|
controls
|
|
style="max-width: 100%; max-height: 70vh; display: block; margin: 0 auto"
|
|
/>
|
|
</div>
|
|
</el-dialog>
|
|
</template>
|
|
<script setup lang="ts">
|
|
import DialogFormBody from '@/components/business/dialog-form-body/index.vue'
|
|
import SampleTransportFormSection from '@/components/business/sample-transport-form-section/index.vue'
|
|
import { ElMessage } from 'element-plus'
|
|
import {
|
|
Plus,
|
|
Close,
|
|
Check,
|
|
Delete,
|
|
Document,
|
|
VideoPlay,
|
|
Loading,
|
|
Download
|
|
} from '@element-plus/icons-vue'
|
|
import {
|
|
fetchResearchDonationDetail,
|
|
fetchCreateResearchDonation,
|
|
fetchUpdateResearchDonation,
|
|
fetchNextDonationSampleCode
|
|
} from '@/api/research-donation'
|
|
import { fetchUploadAttachment } from '@/api/business'
|
|
import { useAttachmentDropZone } from '@/composables/useAttachmentDropZone'
|
|
import { downloadAttachmentFile } from '@/utils/download-attachment'
|
|
import { handleChineseDatetimePaste, formatDatetimeToMinute } from '@/utils/chinese-datetime-parse'
|
|
import { extractNumericPart } from '@/utils/numeric-input-parse'
|
|
import {
|
|
fetchCustomerList,
|
|
fetchUserList,
|
|
fetchUserDetail,
|
|
fetchCellSampleTypeList,
|
|
fetchItemUnitList,
|
|
fetchCollectionRegionList,
|
|
fetchHospitalList,
|
|
fetchRegionStaffList,
|
|
fetchRegionsByStaffUser,
|
|
fetchSampleCodeList,
|
|
fetchExpressCompanyList,
|
|
fetchSiteList
|
|
} from '@/api/admin'
|
|
import { fetchEthnicList, type EthnicOption } from '@/api/ethnic'
|
|
import { useUserStore } from '@/store/modules/user'
|
|
|
|
const userStore = useUserStore()
|
|
|
|
const regionOptions = ref<Api.BizCollectionRegion.RegionItem[]>([])
|
|
const regionLoading = ref(false)
|
|
const hospitalOptions = ref<Api.BizCollectionHospital.HospitalItem[]>([])
|
|
const hospitalLoading = ref(false)
|
|
|
|
const collectorUserId = ref<string | null>(null)
|
|
const collectorUserOptions = ref<Api.User.UserItem[]>([])
|
|
const collectorLoading = ref(false)
|
|
const collectorSnapshot = ref<Api.User.UserItem | null>(null)
|
|
|
|
const salesUserId = ref<string | null>(null)
|
|
const salesUserOptions = ref<Api.User.UserItem[]>([])
|
|
const salesLoading = ref(false)
|
|
const salesSnapshot = ref<Api.User.UserItem | null>(null)
|
|
|
|
const regionManagerUserId = ref<string | null>(null)
|
|
const managerUserOptions = ref<Api.User.UserItem[]>([])
|
|
const managerLoading = ref(false)
|
|
const managerSnapshot = ref<Api.User.UserItem | null>(null)
|
|
const linkedRegionMode = ref(false)
|
|
const linkedMotherCustomerId = ref('')
|
|
const linkedMotherCustomerName = ref('')
|
|
const linkedFatherCustomerId = ref('')
|
|
const linkedFatherCustomerName = ref('')
|
|
|
|
const sampleTypeOptions = ref<
|
|
Array<{
|
|
id: string
|
|
typeCode: string
|
|
typeName: string
|
|
storageYears: number | null
|
|
storagePrice: number | null
|
|
}>
|
|
>([])
|
|
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
|
|
|
|
type SampleTransportForm = {
|
|
transportType: string
|
|
expressCompanyId: string
|
|
waybillNo: string
|
|
destSiteId: string
|
|
expressFee: number | null
|
|
etaTime: string
|
|
carrierName: string
|
|
carrierPhone: string
|
|
}
|
|
|
|
function createEmptyTransport(): SampleTransportForm {
|
|
return {
|
|
transportType: '',
|
|
expressCompanyId: '',
|
|
waybillNo: '',
|
|
destSiteId: '',
|
|
expressFee: null,
|
|
etaTime: '',
|
|
carrierName: '',
|
|
carrierPhone: ''
|
|
}
|
|
}
|
|
|
|
const ethnicOptions = ref<EthnicOption[]>([])
|
|
const ethnicLoading = ref(false)
|
|
const DEFAULT_MOTHER_ETHNIC = '汉族'
|
|
const minioBaseUrl = (import.meta.env.VITE_MINIO_BASE_URL || '').replace(/\/$/, '')
|
|
|
|
function fullFileUrl(suffix: string) {
|
|
if (!suffix) return ''
|
|
if (suffix.startsWith('http://') || suffix.startsWith('https://') || suffix.startsWith('/'))
|
|
return suffix
|
|
return `${minioBaseUrl}/${suffix}`
|
|
}
|
|
|
|
async function loadEthnicOptions() {
|
|
if (ethnicOptions.value.length) return
|
|
ethnicLoading.value = true
|
|
try {
|
|
const res = await fetchEthnicList({ limit: 200 })
|
|
ethnicOptions.value = res.list || []
|
|
} finally {
|
|
ethnicLoading.value = false
|
|
}
|
|
}
|
|
|
|
function ensureEthnicOptionInList(name: string) {
|
|
const n = (name || '').trim()
|
|
if (!n) return
|
|
if (ethnicOptions.value.some((e) => e.ethnicName === n)) return
|
|
ethnicOptions.value = [
|
|
{ id: '', ethnicName: n, ethnicCode: '', orderNum: null },
|
|
...ethnicOptions.value
|
|
]
|
|
}
|
|
|
|
defineOptions({ name: 'DonationFormDialog' })
|
|
|
|
const props = defineProps<{
|
|
modelValue: boolean
|
|
editId: string | null
|
|
listRow?: Record<string, any> | null
|
|
}>()
|
|
|
|
const emit = defineEmits<{
|
|
(e: 'update:modelValue', val: boolean): void
|
|
(e: 'saved'): void
|
|
}>()
|
|
|
|
/* ====== Tab 常量 ====== */
|
|
const formTabs = [
|
|
{ key: 'basic', label: '基本信息' },
|
|
{ key: 'collection', label: '采集信息' },
|
|
{ key: 'sample', label: '样本及运输信息' },
|
|
{ key: 'party', label: '客户信息' },
|
|
{ key: 'attachment', label: '附件信息' }
|
|
] as const
|
|
|
|
/* ====== 新增/编辑弹窗 ====== */
|
|
const dialogFormLoading = ref(false)
|
|
const dialogTitle = ref('新增捐赠协议单')
|
|
const isEdit = ref(false)
|
|
const submitLoading = ref(false)
|
|
const editingId = ref<string | null>(null)
|
|
const formRef = ref()
|
|
const activeFormTab = ref('basic')
|
|
|
|
type AttachmentFileItem = {
|
|
id?: string
|
|
fileName: string
|
|
fileUrl: string
|
|
fileSize: number
|
|
fileSizeDisplay?: string
|
|
fileType?: string
|
|
_uploading?: boolean
|
|
}
|
|
|
|
const formData = reactive({
|
|
// Basic
|
|
donationNo: '',
|
|
donationNoId: '',
|
|
donationStatus: 'sxz',
|
|
donationDate: '',
|
|
collectorUserId: '',
|
|
remark: '',
|
|
// Party Customer
|
|
customerId: '' as string,
|
|
fatherCustomerId: '' as string,
|
|
motherName: '',
|
|
motherPhone: '',
|
|
motherIdCard: '',
|
|
motherBirthYm: '',
|
|
motherEthnic: '',
|
|
motherEmail: '',
|
|
motherAddress: '',
|
|
fatherName: '',
|
|
fatherPhone: '',
|
|
fatherIdCard: '',
|
|
newbornName: '',
|
|
newbornIdCard: '',
|
|
expectedDeliveryDate: '',
|
|
newbornDeliveryTime: '',
|
|
newbornSex: '',
|
|
deliveryMode: '',
|
|
birthOrder: null as number | null,
|
|
newbornWeightGram: null as number | null,
|
|
apgar1min: null as number | null,
|
|
apgar5min: null as number | null,
|
|
// Collection Info
|
|
regionId: '',
|
|
hospitalId: '',
|
|
medicalStaff: '',
|
|
salesUserId: '',
|
|
regionManagerUserId: '',
|
|
sampleCollectTime: '',
|
|
maternalBloodCollectTime: '',
|
|
// Samples
|
|
samples: [] as Array<Record<string, any>>,
|
|
// Attachments
|
|
consentAttachments: [] as Array<AttachmentFileItem>,
|
|
infectiousDiseaseReportAttachments: [] as Array<AttachmentFileItem>,
|
|
otherAttachments: [] as Array<AttachmentFileItem>
|
|
})
|
|
|
|
const formRules = computed(() => ({
|
|
donationStatus: [{ required: true, message: '请选择捐赠状态', trigger: 'change' }]
|
|
}))
|
|
|
|
function resetForm() {
|
|
Object.assign(formData, {
|
|
donationNo: '',
|
|
donationNoId: '',
|
|
donationStatus: 'sxz',
|
|
donationDate: '',
|
|
collectorUserId: '',
|
|
remark: '',
|
|
customerId: '',
|
|
fatherCustomerId: '',
|
|
motherName: '',
|
|
motherPhone: '',
|
|
motherIdCard: '',
|
|
motherBirthYm: '',
|
|
motherEthnic: '',
|
|
motherEmail: '',
|
|
motherAddress: '',
|
|
fatherName: '',
|
|
fatherPhone: '',
|
|
fatherIdCard: '',
|
|
newbornName: '',
|
|
newbornIdCard: '',
|
|
expectedDeliveryDate: '',
|
|
newbornDeliveryTime: '',
|
|
newbornSex: '',
|
|
deliveryMode: '',
|
|
birthOrder: null,
|
|
newbornWeightGram: null,
|
|
apgar1min: null,
|
|
apgar5min: null,
|
|
regionId: '',
|
|
hospitalId: '',
|
|
medicalStaff: '',
|
|
salesUserId: '',
|
|
regionManagerUserId: '',
|
|
sampleCollectTime: '',
|
|
maternalBloodCollectTime: '',
|
|
samples: [],
|
|
consentAttachments: [],
|
|
infectiousDiseaseReportAttachments: [],
|
|
otherAttachments: []
|
|
})
|
|
collectorUserId.value = null
|
|
collectorUserOptions.value = []
|
|
collectorSnapshot.value = null
|
|
salesUserId.value = null
|
|
salesUserOptions.value = []
|
|
salesSnapshot.value = null
|
|
regionManagerUserId.value = null
|
|
managerUserOptions.value = []
|
|
managerSnapshot.value = null
|
|
linkedRegionMode.value = false
|
|
linkedMotherCustomerId.value = ''
|
|
linkedMotherCustomerName.value = ''
|
|
linkedFatherCustomerId.value = ''
|
|
linkedFatherCustomerName.value = ''
|
|
regionOptions.value = []
|
|
hospitalOptions.value = []
|
|
sampleTypeOptions.value = []
|
|
unitOptions.value = []
|
|
sampleCodeOptions.value = []
|
|
siteOptions.value = []
|
|
expressCompanyOptions.value = []
|
|
activeFormTab.value = 'basic'
|
|
}
|
|
|
|
function scrollToSection(key: string) {
|
|
activeFormTab.value = key
|
|
const el = document.getElementById(`form-section-${key}`)
|
|
if (el) {
|
|
el.scrollIntoView({ behavior: 'smooth', block: 'start' })
|
|
}
|
|
}
|
|
|
|
function normalizeSampleRow(raw: Record<string, any>) {
|
|
const transportRaw = raw.transport && typeof raw.transport === 'object' ? raw.transport : {}
|
|
const statusRaw = raw.sampleStatus
|
|
const sampleStatus =
|
|
statusRaw != null && String(statusRaw).trim() !== '' ? String(statusRaw).trim() : ''
|
|
return {
|
|
...raw,
|
|
sampleStatus,
|
|
_rowKey: raw.id || raw._rowKey || `new-${++sampleRowSeq}`,
|
|
transport: {
|
|
...createEmptyTransport(),
|
|
transportType: transportRaw.transportType || '',
|
|
expressCompanyId: transportRaw.expressCompanyId || '',
|
|
waybillNo: transportRaw.waybillNo || '',
|
|
destSiteId: transportRaw.destSiteId || '',
|
|
destSiteName: transportRaw.destSiteName || '',
|
|
expressFee: transportRaw.expressFee ?? null,
|
|
etaTime: transportRaw.etaTime || '',
|
|
carrierName: transportRaw.carrierName || '',
|
|
carrierPhone: transportRaw.carrierPhone || ''
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleOpenForAdd() {
|
|
isEdit.value = false
|
|
editingId.value = null
|
|
dialogTitle.value = '新增捐赠协议单'
|
|
resetForm()
|
|
formData.motherEthnic = DEFAULT_MOTHER_ETHNIC
|
|
formData.donationDate = new Date().toISOString().slice(0, 10).replace(/-/g, '')
|
|
void loadEthnicOptions()
|
|
|
|
// 默认采集专员、市场专员为当前登录人
|
|
const currentUser = userStore.getUserInfo
|
|
const uid = String(currentUser?.id || currentUser?.userId || '')
|
|
if (uid) {
|
|
const displayName = currentUser?.realName || currentUser?.username || ''
|
|
const phone = currentUser?.phone || ''
|
|
const userStub = {
|
|
id: uid,
|
|
nickName: displayName,
|
|
phoneNo: phone,
|
|
deptId: '',
|
|
userNo: '',
|
|
email: '',
|
|
sex: '',
|
|
avatar: '',
|
|
status: '1',
|
|
tenantNo: '',
|
|
orderNum: 0,
|
|
remark: '',
|
|
createTime: '',
|
|
updateTime: ''
|
|
} as Api.User.UserItem
|
|
|
|
// 采集专员默认当前用户
|
|
collectorUserId.value = uid
|
|
formData.collectorUserId = uid
|
|
collectorSnapshot.value = { ...userStub }
|
|
collectorUserOptions.value = [{ ...userStub }]
|
|
|
|
// 市场专员默认当前用户,并按关联地区带出采集地区 / 地区经理
|
|
salesUserId.value = uid
|
|
formData.salesUserId = uid
|
|
salesSnapshot.value = { ...userStub }
|
|
salesUserOptions.value = [{ ...userStub }]
|
|
void applyRegionsForSalesUser(uid)
|
|
}
|
|
}
|
|
|
|
function applyDonationBundleToForm(bundle: Record<string, any>) {
|
|
const donation = (bundle.donation ?? bundle.protocol) as Record<string, any> | null
|
|
if (donation) {
|
|
formData.collectorUserId = String(donation.collectorUserId || formData.collectorUserId || '')
|
|
formData.donationNo = String(donation.donationNo || formData.donationNo || '')
|
|
formData.donationStatus = String(donation.donationStatus || formData.donationStatus || 'dsx')
|
|
formData.donationDate = String(donation.donationDate || formData.donationDate || '')
|
|
formData.remark = String(donation.remark ?? formData.remark ?? '')
|
|
}
|
|
|
|
const pc = (bundle.party ?? bundle.partyCustomer) as Record<string, any> | null
|
|
if (pc) {
|
|
formData.motherName = String(pc.motherName || '')
|
|
formData.motherPhone = String(pc.motherPhone || '')
|
|
formData.motherIdCard = String(pc.motherIdCard || '')
|
|
formData.motherBirthYm = String(pc.motherBirthYm || '')
|
|
formData.motherEthnic = String(pc.motherEthnic || '')
|
|
ensureEthnicOptionInList(formData.motherEthnic)
|
|
formData.motherEmail = String(pc.motherEmail || '')
|
|
formData.motherAddress = String(pc.motherAddress || '')
|
|
formData.fatherName = String(pc.fatherName || '')
|
|
formData.fatherPhone = String(pc.fatherPhone || '')
|
|
formData.fatherIdCard = String(pc.fatherIdCard || '')
|
|
formData.newbornName = String(pc.newbornName || '')
|
|
formData.newbornIdCard = String(pc.newbornIdCard || '')
|
|
formData.expectedDeliveryDate = String(pc.expectedDeliveryDate || '')
|
|
formData.newbornDeliveryTime = String(pc.newbornDeliveryTime || '')
|
|
formData.newbornSex = String(pc.newbornSex ?? '')
|
|
formData.deliveryMode = String(pc.deliveryMode || '')
|
|
formData.birthOrder = pc.birthOrder ?? null
|
|
formData.newbornWeightGram = pc.newbornWeightGram ?? null
|
|
formData.apgar1min = pc.apgar1min ?? null
|
|
formData.apgar5min = pc.apgar5min ?? null
|
|
formData.customerId = String(pc.customerId || '')
|
|
formData.fatherCustomerId = String(pc.fatherCustomerId || '')
|
|
linkedMotherCustomerId.value = formData.customerId
|
|
linkedMotherCustomerName.value = formData.motherName
|
|
linkedFatherCustomerId.value = formData.fatherCustomerId
|
|
linkedFatherCustomerName.value = formData.fatherName
|
|
}
|
|
|
|
const ci = (bundle.collection ?? bundle.collectionInfo) as Record<string, any> | null
|
|
if (ci) {
|
|
formData.regionId = String(ci.regionId || '')
|
|
formData.hospitalId = String(ci.hospitalId || '')
|
|
formData.medicalStaff = String(ci.medicalStaff || '')
|
|
formData.salesUserId = String(ci.salesUserId || '')
|
|
formData.regionManagerUserId = String(ci.regionManagerUserId || '')
|
|
formData.sampleCollectTime = formatDatetimeToMinute(String(ci.sampleCollectTime || ''))
|
|
formData.maternalBloodCollectTime = formatDatetimeToMinute(String(ci.maternalBloodCollectTime || ''))
|
|
}
|
|
|
|
const samples = bundle.samples as Array<Record<string, any>> | null
|
|
if (samples && samples.length) {
|
|
formData.samples = samples.map((s) => normalizeSampleRow(s))
|
|
}
|
|
|
|
// Attachments(在 donation 对象上,与查看弹窗一致)
|
|
const consentAtt = (donation?.consentAttachmentFiles ??
|
|
(bundle as any).consentAttachmentFiles) as Array<Record<string, any>> | null
|
|
if (consentAtt && consentAtt.length) {
|
|
formData.consentAttachments = consentAtt.map((a) => ({ ...a })) as any
|
|
}
|
|
const infectiousReportAtt = (donation?.infectiousDiseaseReportAttachmentFiles ??
|
|
(bundle as any).infectiousDiseaseReportAttachmentFiles) as Array<Record<string, any>> | null
|
|
if (infectiousReportAtt && infectiousReportAtt.length) {
|
|
formData.infectiousDiseaseReportAttachments = infectiousReportAtt.map((a) => ({
|
|
...a
|
|
})) as any
|
|
}
|
|
const otherAtt = (donation?.attachmentFiles ?? (bundle as any).attachmentFiles) as Array<
|
|
Record<string, any>
|
|
> | null
|
|
if (otherAtt && otherAtt.length) {
|
|
formData.otherAttachments = otherAtt.map((a) => ({ ...a })) as any
|
|
}
|
|
}
|
|
|
|
async function handleOpenForEdit() {
|
|
const row = props.listRow
|
|
if (!row || !props.editId) return
|
|
|
|
isEdit.value = true
|
|
dialogTitle.value = '编辑捐赠协议单'
|
|
editingId.value = props.editId
|
|
resetForm()
|
|
|
|
formData.donationNo = String(row.donationNo || '')
|
|
formData.donationStatus = String(row.donationStatus || 'dsx')
|
|
formData.donationDate = String(row.donationDate || '')
|
|
formData.collectorUserId = String(row.collectorUserId || '')
|
|
formData.remark = String(row.remark || '')
|
|
|
|
dialogFormLoading.value = true
|
|
|
|
try {
|
|
const [, bundle] = await Promise.all([
|
|
loadEthnicOptions(),
|
|
fetchResearchDonationDetail(String(row.id)).catch(() => null)
|
|
])
|
|
if (bundle) {
|
|
applyDonationBundleToForm(bundle as Record<string, any>)
|
|
}
|
|
|
|
const ciBundle = ((bundle as any)?.collection ??
|
|
(bundle as any)?.collectionInfo) as Record<string, any> | null
|
|
const hydrateTasks: Promise<void>[] = [
|
|
hydrateCollectorUserForEdit(
|
|
formData.collectorUserId,
|
|
String((row as any).collectorUserName || '')
|
|
),
|
|
hydrateSalesUserForEdit(formData.salesUserId, String((row as any).salesUserName || '')),
|
|
hydrateManagerUserForEdit(
|
|
formData.regionManagerUserId,
|
|
String(ciBundle?.regionManagerUserName || (row as any).regionManagerUserName || '')
|
|
)
|
|
]
|
|
if (formData.regionId) {
|
|
hydrateTasks.push(
|
|
ensureRegionOptionForEdit(formData.regionId, String((row as any).regionName || ''))
|
|
)
|
|
}
|
|
if (formData.regionId && formData.hospitalId) {
|
|
hydrateTasks.push(
|
|
ensureHospitalOptionForEdit(
|
|
formData.regionId,
|
|
formData.hospitalId,
|
|
String((row as any).hospitalName || '')
|
|
)
|
|
)
|
|
}
|
|
await Promise.all(hydrateTasks)
|
|
if (formData.salesUserId) {
|
|
await applyRegionsForSalesUser(formData.salesUserId, {
|
|
preferKeepRegion: true,
|
|
skipManagerDefault: true
|
|
})
|
|
}
|
|
if (formData.samples.length) {
|
|
await Promise.all([
|
|
remoteSearchSampleTypes(''),
|
|
remoteSearchSites(''),
|
|
remoteSearchUnits(''),
|
|
remoteSearchSampleCodes('')
|
|
])
|
|
hydrateSampleLookupOptions()
|
|
}
|
|
} catch {
|
|
/* 保留列表行已填基础字段 */
|
|
} finally {
|
|
dialogFormLoading.value = false
|
|
}
|
|
}
|
|
|
|
async function reserveDonationSampleCode() {
|
|
const pending = formData.samples
|
|
.map((s) => String(s.sampleCode || '').trim())
|
|
.filter(Boolean)
|
|
const res = await fetchNextDonationSampleCode({
|
|
pendingCodes: pending.length ? pending.join(',') : undefined
|
|
})
|
|
return res.sampleCode
|
|
}
|
|
|
|
async function assignDonationSampleCodeIfMissing(sample: Record<string, any>) {
|
|
if (String(sample.sampleCode || '').trim()) return
|
|
sample.sampleCode = await reserveDonationSampleCode()
|
|
sample.sampleCodeId = ''
|
|
}
|
|
|
|
async function ensureDonationSampleCodesBeforeSave() {
|
|
for (const sample of formData.samples) {
|
|
await assignDonationSampleCodeIfMissing(sample)
|
|
}
|
|
}
|
|
|
|
async function handleSubmit() {
|
|
if (!formRef.value) return
|
|
await formRef.value.validate()
|
|
try {
|
|
await ensureDonationSampleCodesBeforeSave()
|
|
} catch {
|
|
ElMessage.error('样本编码生成失败,请稍后重试')
|
|
return
|
|
}
|
|
if (!isEdit.value) {
|
|
const seenCodes = new Set<string>()
|
|
for (const sampleRow of formData.samples) {
|
|
const code = String(sampleRow.sampleCode || '').trim()
|
|
if (!code) continue
|
|
if (seenCodes.has(code)) {
|
|
ElMessage.warning(`样本编码「${code}」重复,请检查后重试`)
|
|
return
|
|
}
|
|
seenCodes.add(code)
|
|
if (!sampleRow.sampleCodeId) continue
|
|
const sc = sampleCodeOptions.value.find((x) => x.id === sampleRow.sampleCodeId)
|
|
if (sc?.usedInProtocol) {
|
|
ElMessage.warning(`样本编码「${sampleRow.sampleCode || sc.sampleCode}」已被占用,请更换`)
|
|
return
|
|
}
|
|
}
|
|
}
|
|
submitLoading.value = true
|
|
try {
|
|
const payload: Record<string, unknown> = {
|
|
donationStatus: formData.donationStatus,
|
|
donationDate: formData.donationDate || undefined,
|
|
collectorUserId: formData.collectorUserId || undefined,
|
|
remark: formData.remark || undefined,
|
|
consentAttachments: formData.consentAttachments.map((a) => ({
|
|
id: a.id,
|
|
fileName: a.fileName,
|
|
fileUrl: a.fileUrl,
|
|
fileSize: a.fileSize,
|
|
fileSizeDisplay: a.fileSizeDisplay,
|
|
fileType: a.fileType
|
|
})),
|
|
infectiousDiseaseReportAttachments: formData.infectiousDiseaseReportAttachments.map(
|
|
(a) => ({
|
|
id: a.id,
|
|
fileName: a.fileName,
|
|
fileUrl: a.fileUrl,
|
|
fileSize: a.fileSize,
|
|
fileSizeDisplay: a.fileSizeDisplay,
|
|
fileType: a.fileType
|
|
})
|
|
),
|
|
otherAttachments: formData.otherAttachments.map((a) => ({
|
|
id: a.id,
|
|
fileName: a.fileName,
|
|
fileUrl: a.fileUrl,
|
|
fileSize: a.fileSize,
|
|
fileSizeDisplay: a.fileSizeDisplay,
|
|
fileType: a.fileType
|
|
})),
|
|
partyCustomer: {
|
|
customerId: formData.customerId || undefined,
|
|
fatherCustomerId: formData.fatherCustomerId || undefined,
|
|
motherName: formData.motherName || undefined,
|
|
motherPhone: formData.motherPhone || undefined,
|
|
motherIdCard: formData.motherIdCard || undefined,
|
|
motherBirthYm: formData.motherBirthYm || undefined,
|
|
motherEthnic: formData.motherEthnic || undefined,
|
|
motherEmail: formData.motherEmail || undefined,
|
|
motherAddress: formData.motherAddress || undefined,
|
|
fatherName: formData.fatherName || undefined,
|
|
fatherPhone: formData.fatherPhone || undefined,
|
|
fatherIdCard: formData.fatherIdCard || undefined,
|
|
newbornName: formData.newbornName || undefined,
|
|
newbornIdCard: formData.newbornIdCard || undefined,
|
|
expectedDeliveryDate: formData.expectedDeliveryDate || undefined,
|
|
newbornDeliveryTime: formData.newbornDeliveryTime || undefined,
|
|
newbornSex: formData.newbornSex || undefined,
|
|
deliveryMode: formData.deliveryMode || undefined,
|
|
birthOrder: formData.birthOrder ?? undefined,
|
|
newbornWeightGram: formData.newbornWeightGram ?? undefined,
|
|
apgar1min: formData.apgar1min ?? undefined,
|
|
apgar5min: formData.apgar5min ?? undefined
|
|
},
|
|
collectionInfo: {
|
|
regionId: formData.regionId || undefined,
|
|
hospitalId: formData.hospitalId || undefined,
|
|
medicalStaff: formData.medicalStaff || undefined,
|
|
salesUserId: formData.salesUserId || undefined,
|
|
regionManagerUserId: formData.regionManagerUserId || undefined,
|
|
sampleCollectTime: formData.sampleCollectTime || undefined,
|
|
maternalBloodCollectTime: formData.maternalBloodCollectTime || undefined
|
|
},
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
samples: formData.samples.map(({ _rowKey: _, transport, freight, freightDraft, ...s }) => ({
|
|
...s,
|
|
sampleStatus:
|
|
s.sampleStatus != null && String(s.sampleStatus).trim() !== ''
|
|
? String(s.sampleStatus).trim()
|
|
: null,
|
|
transport: {
|
|
transportType: transport?.transportType || '',
|
|
expressCompanyId: transport?.expressCompanyId || '',
|
|
waybillNo: transport?.waybillNo || '',
|
|
destSiteId: transport?.destSiteId || '',
|
|
expressFee: transport?.expressFee ?? null,
|
|
etaTime: transport?.etaTime || '',
|
|
carrierName: transport?.carrierName || '',
|
|
carrierPhone: transport?.carrierPhone || ''
|
|
},
|
|
freightId: freight?.id || s.freightId || undefined,
|
|
freightDraft: freightDraft || undefined
|
|
}))
|
|
}
|
|
|
|
if (isEdit.value && editingId.value) {
|
|
await fetchUpdateResearchDonation(editingId.value, payload)
|
|
} else {
|
|
await fetchCreateResearchDonation(payload)
|
|
}
|
|
emit('update:modelValue', false)
|
|
emit('saved')
|
|
} finally {
|
|
submitLoading.value = false
|
|
}
|
|
}
|
|
|
|
function createUserStub(id: string, nickName: string, phoneNo = ''): Api.User.UserItem {
|
|
return {
|
|
id,
|
|
nickName: nickName || id,
|
|
phoneNo,
|
|
deptId: '',
|
|
userNo: '',
|
|
email: '',
|
|
sex: '',
|
|
avatar: '',
|
|
status: '1',
|
|
tenantNo: '',
|
|
orderNum: 0,
|
|
remark: '',
|
|
createTime: '',
|
|
updateTime: ''
|
|
}
|
|
}
|
|
|
|
async function hydrateRemoteUserForEdit(
|
|
userId: string,
|
|
displayName: string | undefined,
|
|
assign: (user: Api.User.UserItem) => void,
|
|
clear: () => void
|
|
) {
|
|
const uid = (userId || '').trim()
|
|
if (!uid) {
|
|
clear()
|
|
return
|
|
}
|
|
try {
|
|
const detail = await fetchUserDetail(uid)
|
|
assign(detail)
|
|
return
|
|
} catch {
|
|
/* 回退为列表/占位展示名 */
|
|
}
|
|
assign(createUserStub(uid, (displayName || '').trim()))
|
|
}
|
|
|
|
async function hydrateCollectorUserForEdit(userId: string, displayName?: string) {
|
|
await hydrateRemoteUserForEdit(
|
|
userId,
|
|
displayName,
|
|
(user) => {
|
|
collectorSnapshot.value = { ...user }
|
|
collectorUserId.value = user.id
|
|
collectorUserOptions.value = [{ ...user }]
|
|
formData.collectorUserId = user.id
|
|
},
|
|
() => {
|
|
collectorUserId.value = null
|
|
collectorSnapshot.value = null
|
|
collectorUserOptions.value = []
|
|
formData.collectorUserId = ''
|
|
}
|
|
)
|
|
}
|
|
|
|
async function hydrateSalesUserForEdit(userId: string, displayName?: string) {
|
|
await hydrateRemoteUserForEdit(
|
|
userId,
|
|
displayName,
|
|
(user) => {
|
|
salesSnapshot.value = { ...user }
|
|
salesUserId.value = user.id
|
|
salesUserOptions.value = [{ ...user }]
|
|
formData.salesUserId = user.id
|
|
},
|
|
() => {
|
|
salesUserId.value = null
|
|
salesSnapshot.value = null
|
|
salesUserOptions.value = []
|
|
formData.salesUserId = ''
|
|
}
|
|
)
|
|
}
|
|
|
|
async function hydrateManagerUserForEdit(userId: string, displayName?: string) {
|
|
await hydrateRemoteUserForEdit(
|
|
userId,
|
|
displayName,
|
|
(user) => {
|
|
managerSnapshot.value = { ...user }
|
|
regionManagerUserId.value = user.id
|
|
managerUserOptions.value = [{ ...user }]
|
|
formData.regionManagerUserId = user.id
|
|
},
|
|
() => {
|
|
regionManagerUserId.value = null
|
|
managerSnapshot.value = null
|
|
managerUserOptions.value = []
|
|
formData.regionManagerUserId = ''
|
|
}
|
|
)
|
|
}
|
|
|
|
function makeManagerUserStub(id: string, name: string): Api.User.UserItem {
|
|
return {
|
|
id,
|
|
nickName: name || id,
|
|
phoneNo: '',
|
|
deptId: '',
|
|
userNo: '',
|
|
email: '',
|
|
sex: '',
|
|
avatar: '',
|
|
status: '1',
|
|
tenantNo: '',
|
|
orderNum: 0,
|
|
remark: '',
|
|
createTime: '',
|
|
updateTime: ''
|
|
} as Api.User.UserItem
|
|
}
|
|
|
|
async function ensureRegionOptionForEdit(regionId: string, regionName?: string) {
|
|
const rid = (regionId || '').trim()
|
|
if (!rid) return
|
|
await remoteSearchRegions('')
|
|
if (regionOptions.value.some((r) => r.id === rid)) return
|
|
const stub: Api.BizCollectionRegion.RegionItem = {
|
|
id: rid,
|
|
regionName: (regionName || '').trim() || rid,
|
|
hospitalNames: [],
|
|
tenantNo: '',
|
|
orderNum: 0,
|
|
remark: '',
|
|
createTime: '',
|
|
updateTime: ''
|
|
}
|
|
regionOptions.value = [stub, ...regionOptions.value]
|
|
}
|
|
|
|
async function ensureHospitalOptionForEdit(
|
|
regionId: string,
|
|
hospitalId: string,
|
|
hospitalName?: string
|
|
) {
|
|
const hid = (hospitalId || '').trim()
|
|
if (!hid || !(regionId || '').trim()) return
|
|
await loadHospitalsByRegion(regionId, '')
|
|
if (hospitalOptions.value.some((h) => h.id === hid)) return
|
|
const stub: Api.BizCollectionHospital.HospitalItem = {
|
|
id: hid,
|
|
regionId,
|
|
hospitalName: (hospitalName || '').trim() || hid,
|
|
tenantNo: '',
|
|
orderNum: 0,
|
|
remark: '',
|
|
createTime: '',
|
|
updateTime: ''
|
|
}
|
|
hospitalOptions.value = [stub, ...hospitalOptions.value]
|
|
}
|
|
|
|
function ensureSampleCodesInOptions(samples: Array<Record<string, any>>) {
|
|
const merged = [...sampleCodeOptions.value]
|
|
for (const s of samples) {
|
|
const id = String(s.sampleCodeId || '')
|
|
if (!id || merged.some((x) => x.id === id)) continue
|
|
merged.push({
|
|
id,
|
|
sampleCode: String(s.sampleCode || id),
|
|
sampleCodeType: '',
|
|
issued: 0,
|
|
usedInProtocol: false,
|
|
issuedUserId: '',
|
|
issuedUserName: '',
|
|
issuedTime: '',
|
|
tenantNo: '',
|
|
orderNum: 0,
|
|
remark: '',
|
|
createTime: '',
|
|
updateTime: ''
|
|
})
|
|
}
|
|
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) continue
|
|
const name = String(s.transport?.destSiteName || '').trim()
|
|
const existing = merged.find((x) => x.id === id)
|
|
if (existing) {
|
|
if (name && (!existing.siteName || existing.siteName === existing.id)) {
|
|
existing.siteName = name
|
|
}
|
|
continue
|
|
}
|
|
merged.push({
|
|
id,
|
|
siteCode: '',
|
|
siteName: name || 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)
|
|
}
|
|
|
|
/* ====== 采集专员检索 ====== */
|
|
async function remoteSearchCollectorUsers(query: string) {
|
|
collectorLoading.value = true
|
|
try {
|
|
const res = await fetchUserList({
|
|
page: 1,
|
|
pageSize: 50,
|
|
keyword: query || undefined,
|
|
status: '1'
|
|
})
|
|
let list = [...(res.list || [])]
|
|
if (
|
|
collectorUserId.value &&
|
|
collectorSnapshot.value?.id === collectorUserId.value &&
|
|
!list.some((x) => x.id === collectorUserId.value)
|
|
) {
|
|
list = [collectorSnapshot.value, ...list]
|
|
}
|
|
collectorUserOptions.value = list
|
|
} catch {
|
|
collectorUserOptions.value = []
|
|
} finally {
|
|
collectorLoading.value = false
|
|
}
|
|
}
|
|
|
|
function onCollectorUserChange(val: string | null | undefined) {
|
|
if (!val) {
|
|
collectorUserId.value = null
|
|
collectorSnapshot.value = null
|
|
formData.collectorUserId = ''
|
|
return
|
|
}
|
|
const u = collectorUserOptions.value.find((x) => x.id === val) || collectorSnapshot.value
|
|
if (!u) return
|
|
collectorSnapshot.value = { ...u }
|
|
collectorUserId.value = u.id
|
|
formData.collectorUserId = u.id
|
|
}
|
|
|
|
/* ====== 市场专员检索 ====== */
|
|
async function remoteSearchSalesUsers(query: string) {
|
|
salesLoading.value = true
|
|
try {
|
|
const res = await fetchUserList({
|
|
page: 1,
|
|
pageSize: 50,
|
|
keyword: query || undefined,
|
|
status: '1'
|
|
})
|
|
let list = [...(res.list || [])]
|
|
if (
|
|
salesUserId.value &&
|
|
salesSnapshot.value?.id === salesUserId.value &&
|
|
!list.some((x) => x.id === salesUserId.value)
|
|
) {
|
|
list = [salesSnapshot.value, ...list]
|
|
}
|
|
salesUserOptions.value = list
|
|
} catch {
|
|
salesUserOptions.value = []
|
|
} finally {
|
|
salesLoading.value = false
|
|
}
|
|
}
|
|
|
|
async function remoteSearchManagerUsers(query: string) {
|
|
managerLoading.value = true
|
|
try {
|
|
const res = await fetchUserList({
|
|
page: 1,
|
|
pageSize: 50,
|
|
keyword: (query || '').trim() || undefined,
|
|
status: '1'
|
|
})
|
|
let list = [...(res.list || [])]
|
|
const cur = regionManagerUserId.value
|
|
if (cur && !list.some((x) => x.id === cur)) {
|
|
const keep =
|
|
managerSnapshot.value?.id === cur
|
|
? managerSnapshot.value
|
|
: managerUserOptions.value.find((x) => x.id === cur)
|
|
if (keep) list = [keep, ...list]
|
|
}
|
|
managerUserOptions.value = list
|
|
} catch {
|
|
managerUserOptions.value = []
|
|
} finally {
|
|
managerLoading.value = false
|
|
}
|
|
}
|
|
|
|
async function onSalesUserChange(val: string | null | undefined) {
|
|
if (!val) {
|
|
salesUserId.value = null
|
|
salesSnapshot.value = null
|
|
formData.salesUserId = ''
|
|
await applyRegionsForSalesUser(null)
|
|
return
|
|
}
|
|
const u = salesUserOptions.value.find((x) => x.id === val) || salesSnapshot.value
|
|
if (!u) return
|
|
salesSnapshot.value = { ...u }
|
|
salesUserId.value = u.id
|
|
formData.salesUserId = u.id
|
|
await applyRegionsForSalesUser(u.id)
|
|
}
|
|
|
|
function onManagerUserChange(val: string | null | undefined) {
|
|
if (!val) {
|
|
regionManagerUserId.value = null
|
|
managerSnapshot.value = null
|
|
formData.regionManagerUserId = ''
|
|
return
|
|
}
|
|
const u = managerUserOptions.value.find((x) => x.id === val) || managerSnapshot.value
|
|
if (!u) {
|
|
regionManagerUserId.value = val
|
|
formData.regionManagerUserId = val
|
|
return
|
|
}
|
|
managerSnapshot.value = { ...u }
|
|
regionManagerUserId.value = u.id
|
|
formData.regionManagerUserId = u.id
|
|
}
|
|
|
|
async function applyDefaultRegionManager(regionId: string) {
|
|
if (!regionId) {
|
|
regionManagerUserId.value = null
|
|
formData.regionManagerUserId = ''
|
|
managerUserOptions.value = []
|
|
managerSnapshot.value = null
|
|
return
|
|
}
|
|
try {
|
|
const res: any = await fetchRegionStaffList(regionId, { page: 1, pageSize: 100 })
|
|
const list = (res?.list || []) as Array<Record<string, any>>
|
|
const leader = list.find((x) => x.isLeader) || list[0]
|
|
if (!leader?.userId) {
|
|
regionManagerUserId.value = null
|
|
formData.regionManagerUserId = ''
|
|
return
|
|
}
|
|
const stub = makeManagerUserStub(
|
|
String(leader.userId),
|
|
String(leader.nickName || leader.userName || '')
|
|
)
|
|
regionManagerUserId.value = stub.id
|
|
formData.regionManagerUserId = stub.id
|
|
managerSnapshot.value = { ...stub }
|
|
if (!managerUserOptions.value.some((x) => x.id === stub.id)) {
|
|
managerUserOptions.value = [stub, ...managerUserOptions.value]
|
|
}
|
|
} catch {
|
|
/* 地区无人员配置时留空,可手工选择 */
|
|
}
|
|
}
|
|
|
|
async function applyRegionsForSalesUser(
|
|
userId: string | null,
|
|
opts?: { preferKeepRegion?: boolean; skipManagerDefault?: boolean }
|
|
) {
|
|
const uid = (userId || '').trim()
|
|
if (!uid) {
|
|
linkedRegionMode.value = false
|
|
formData.regionId = ''
|
|
formData.hospitalId = ''
|
|
regionManagerUserId.value = null
|
|
formData.regionManagerUserId = ''
|
|
managerUserOptions.value = []
|
|
managerSnapshot.value = null
|
|
regionOptions.value = []
|
|
hospitalOptions.value = []
|
|
return
|
|
}
|
|
try {
|
|
const res: any = await fetchRegionsByStaffUser(uid)
|
|
const list = (res?.list || []) as Array<{ id: string; regionName: string }>
|
|
if (list.length > 0) {
|
|
linkedRegionMode.value = true
|
|
// 编辑回填:以库中已存 regionId 为准,即使不在专员关联列表中也保留
|
|
const keep = Boolean(opts?.preferKeepRegion && formData.regionId)
|
|
const inLinked = Boolean(formData.regionId && list.some((x) => x.id === formData.regionId))
|
|
const prevRegionName =
|
|
regionOptions.value.find((r) => r.id === formData.regionId)?.regionName || ''
|
|
regionOptions.value = list as any
|
|
if (keep && !inLinked) {
|
|
const stub = {
|
|
id: formData.regionId,
|
|
regionName: prevRegionName || formData.regionId,
|
|
hospitalNames: [] as string[],
|
|
tenantNo: '',
|
|
orderNum: 0,
|
|
remark: '',
|
|
createTime: '',
|
|
updateTime: ''
|
|
}
|
|
regionOptions.value = [stub as any, ...regionOptions.value]
|
|
}
|
|
const nextId = keep ? formData.regionId : inLinked ? formData.regionId : list[0].id
|
|
const regionChanged = nextId !== formData.regionId
|
|
formData.regionId = nextId
|
|
if (regionChanged) {
|
|
formData.hospitalId = ''
|
|
hospitalOptions.value = []
|
|
await loadHospitalsByRegion(nextId, '')
|
|
if (!opts?.skipManagerDefault) {
|
|
await applyDefaultRegionManager(nextId)
|
|
}
|
|
} else if (!opts?.skipManagerDefault && !formData.regionManagerUserId) {
|
|
await applyDefaultRegionManager(nextId)
|
|
}
|
|
} else {
|
|
linkedRegionMode.value = false
|
|
// 编辑回填:专员无关联地区时保留库中已存值,仅退出关联模式(恢复全量检索)
|
|
if (opts?.preferKeepRegion) {
|
|
return
|
|
}
|
|
formData.regionId = ''
|
|
formData.hospitalId = ''
|
|
hospitalOptions.value = []
|
|
regionOptions.value = []
|
|
regionManagerUserId.value = null
|
|
formData.regionManagerUserId = ''
|
|
managerUserOptions.value = []
|
|
managerSnapshot.value = null
|
|
}
|
|
} catch {
|
|
linkedRegionMode.value = false
|
|
}
|
|
}
|
|
|
|
async function remoteSearchSampleCodes(query: string, codeFilter?: string) {
|
|
sampleCodeLoading.value = true
|
|
try {
|
|
const res = await fetchSampleCodeList({
|
|
page: 1,
|
|
pageSize: 100,
|
|
keyword: query?.trim() || undefined,
|
|
codeFilter: codeFilter?.trim() || undefined
|
|
})
|
|
sampleCodeOptions.value = (res.list || []) as Api.BizSampleCode.SampleCodeItem[]
|
|
ensureSampleCodesInOptions(formData.samples)
|
|
} catch {
|
|
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
|
|
}
|
|
}
|
|
|
|
/* ====== 采集地区下拉检索 ====== */
|
|
async function remoteSearchRegions(query: string) {
|
|
regionLoading.value = true
|
|
try {
|
|
const res = await fetchCollectionRegionList({
|
|
page: 1,
|
|
pageSize: 100,
|
|
keyword: query || undefined
|
|
})
|
|
regionOptions.value = res.list || []
|
|
} catch {
|
|
regionOptions.value = []
|
|
} finally {
|
|
regionLoading.value = false
|
|
}
|
|
}
|
|
|
|
async function onRegionChange(val: string | null | undefined) {
|
|
if (!val) {
|
|
formData.regionId = ''
|
|
hospitalOptions.value = []
|
|
formData.hospitalId = ''
|
|
regionManagerUserId.value = null
|
|
formData.regionManagerUserId = ''
|
|
managerUserOptions.value = []
|
|
managerSnapshot.value = null
|
|
return
|
|
}
|
|
formData.regionId = val
|
|
formData.hospitalId = ''
|
|
hospitalOptions.value = []
|
|
await loadHospitalsByRegion(val)
|
|
await applyDefaultRegionManager(val)
|
|
}
|
|
|
|
function onRegionClear() {
|
|
formData.regionId = ''
|
|
formData.hospitalId = ''
|
|
hospitalOptions.value = []
|
|
regionManagerUserId.value = null
|
|
formData.regionManagerUserId = ''
|
|
managerUserOptions.value = []
|
|
managerSnapshot.value = null
|
|
}
|
|
|
|
async function loadHospitalsByRegion(regionId: string, keyword?: string) {
|
|
hospitalLoading.value = true
|
|
try {
|
|
const res = await fetchHospitalList(regionId, {
|
|
page: 1,
|
|
pageSize: 100,
|
|
keyword: keyword || undefined
|
|
})
|
|
hospitalOptions.value = res.list || []
|
|
} catch {
|
|
hospitalOptions.value = []
|
|
} finally {
|
|
hospitalLoading.value = false
|
|
}
|
|
}
|
|
|
|
/* ====== 采集医院下拉检索 ====== */
|
|
async function remoteSearchHospitals(query: string) {
|
|
if (!formData.regionId) {
|
|
hospitalOptions.value = []
|
|
return
|
|
}
|
|
await loadHospitalsByRegion(formData.regionId, query)
|
|
}
|
|
|
|
function onHospitalChange(val: string | null | undefined) {
|
|
if (!val) {
|
|
formData.hospitalId = ''
|
|
return
|
|
}
|
|
formData.hospitalId = val
|
|
}
|
|
|
|
/* ====== 母亲/父亲姓名检索客户档案 ====== */
|
|
async function queryPartyCustomers(
|
|
query: string,
|
|
cb: (list: Api.BizCustomer.CustomerItem[]) => void
|
|
) {
|
|
const q = (query || '').trim()
|
|
if (!q) {
|
|
cb([])
|
|
return
|
|
}
|
|
try {
|
|
const res = await fetchCustomerList({ page: 1, pageSize: 20, keyword: q })
|
|
cb(res.list || [])
|
|
} catch {
|
|
cb([])
|
|
}
|
|
}
|
|
|
|
function onMotherCustomerSelect(item: Api.BizCustomer.CustomerItem) {
|
|
const name = String(item.customerName || '').trim()
|
|
formData.customerId = item.id
|
|
formData.motherName = name
|
|
formData.motherPhone = String(item.phoneNo || '').trim()
|
|
formData.motherIdCard = String(item.idCardNo || '').trim()
|
|
linkedMotherCustomerId.value = item.id
|
|
linkedMotherCustomerName.value = name
|
|
calcBirthFromIdCard()
|
|
const birthYm = String(item.birthYm || '').trim()
|
|
const ethnic = String(item.ethnic || '').trim()
|
|
const email = String(item.email || '').trim()
|
|
const address = String(item.address || '').trim()
|
|
if (!(formData.motherBirthYm || '').trim() && birthYm) formData.motherBirthYm = birthYm
|
|
if (!(formData.motherEthnic || '').trim() && ethnic) {
|
|
formData.motherEthnic = ethnic
|
|
ensureEthnicOptionInList(ethnic)
|
|
}
|
|
if (!(formData.motherEmail || '').trim() && email) formData.motherEmail = email
|
|
if (!(formData.motherAddress || '').trim() && address) formData.motherAddress = address
|
|
}
|
|
|
|
function onMotherCustomerClear() {
|
|
formData.customerId = ''
|
|
linkedMotherCustomerId.value = ''
|
|
linkedMotherCustomerName.value = ''
|
|
}
|
|
|
|
function onMotherNameInput(val: string) {
|
|
if (linkedMotherCustomerId.value && val !== linkedMotherCustomerName.value) {
|
|
formData.customerId = ''
|
|
linkedMotherCustomerId.value = ''
|
|
linkedMotherCustomerName.value = ''
|
|
}
|
|
}
|
|
|
|
function onFatherCustomerSelect(item: Api.BizCustomer.CustomerItem) {
|
|
const name = String(item.customerName || '').trim()
|
|
formData.fatherCustomerId = item.id
|
|
formData.fatherName = name
|
|
formData.fatherPhone = String(item.phoneNo || '').trim()
|
|
formData.fatherIdCard = String(item.idCardNo || '').trim()
|
|
linkedFatherCustomerId.value = item.id
|
|
linkedFatherCustomerName.value = name
|
|
}
|
|
|
|
function onFatherCustomerClear() {
|
|
formData.fatherCustomerId = ''
|
|
linkedFatherCustomerId.value = ''
|
|
linkedFatherCustomerName.value = ''
|
|
}
|
|
|
|
function onFatherNameInput(val: string) {
|
|
if (linkedFatherCustomerId.value && val !== linkedFatherCustomerName.value) {
|
|
formData.fatherCustomerId = ''
|
|
linkedFatherCustomerId.value = ''
|
|
linkedFatherCustomerName.value = ''
|
|
}
|
|
}
|
|
|
|
/* ====== 母亲身份证号 ↔ 出生年月联动 ====== */
|
|
function calcBirthFromIdCard() {
|
|
const idCard = (formData.motherIdCard || '').trim()
|
|
if (/^\d{17}[\dXx]$/.test(idCard)) {
|
|
formData.motherBirthYm = idCard.substring(6, 12)
|
|
} else if (/^\d{15}$/.test(idCard)) {
|
|
const yy = idCard.substring(6, 8)
|
|
const mm = idCard.substring(8, 10)
|
|
const prefix = parseInt(yy, 10) > 30 ? '19' : '20'
|
|
formData.motherBirthYm = prefix + yy + mm
|
|
} else if (!idCard) {
|
|
formData.motherBirthYm = ''
|
|
}
|
|
}
|
|
|
|
watch(
|
|
() => formData.motherIdCard,
|
|
() => calcBirthFromIdCard()
|
|
)
|
|
|
|
/* ====== 附件上传 ====== */
|
|
function isImageFile(file: any) {
|
|
const url = (file.fileUrl || '').toLowerCase()
|
|
const name = (file.fileName || '').toLowerCase()
|
|
return (
|
|
/\.(jpg|jpeg|png|gif|bmp|webp|svg)(\?|$)/.test(url) ||
|
|
/\.(jpg|jpeg|png|gif|bmp|webp|svg)$/.test(name) ||
|
|
(file.fileType || '').startsWith('image/')
|
|
)
|
|
}
|
|
|
|
function isVideoFile(file: any) {
|
|
const url = (file.fileUrl || '').toLowerCase()
|
|
const name = (file.fileName || '').toLowerCase()
|
|
return (
|
|
/\.(mp4|webm|ogg|mov|avi)(\?|$)/.test(url) ||
|
|
/\.(mp4|webm|ogg|mov|avi)$/.test(name) ||
|
|
(file.fileType || '').startsWith('video/')
|
|
)
|
|
}
|
|
|
|
/* ====== 知情同意书附件上传 ====== */
|
|
const consentUploadRef = ref()
|
|
const consentAttachments = computed(() => formData.consentAttachments)
|
|
const infectiousDiseaseReportAttachments = computed(
|
|
() => formData.infectiousDiseaseReportAttachments
|
|
)
|
|
const otherAttachments = computed(() => formData.otherAttachments)
|
|
|
|
async function handleConsentAttachmentChange(uploadFile: any) {
|
|
const file = uploadFile.raw || uploadFile
|
|
if (!file) return
|
|
const tempId = `temp_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`
|
|
formData.consentAttachments.push({
|
|
id: tempId,
|
|
fileName: file.name,
|
|
fileUrl: '',
|
|
fileSize: file.size,
|
|
fileSizeDisplay: `${(file.size / 1024).toFixed(1)} KB`,
|
|
fileType: file.type || '',
|
|
_uploading: true
|
|
})
|
|
const idx = formData.consentAttachments.length - 1
|
|
try {
|
|
const fd = new FormData()
|
|
fd.append('folder', 'donation-consent')
|
|
fd.append('file', file)
|
|
const res = await fetchUploadAttachment(fd)
|
|
formData.consentAttachments[idx] = {
|
|
...formData.consentAttachments[idx],
|
|
id: res.id || tempId,
|
|
fileName: file.name || res.fileName,
|
|
fileUrl: res.fileUrl,
|
|
fileSize: res.fileSize || file.size,
|
|
fileSizeDisplay: res.fileSizeDisplay || `${(file.size / 1024).toFixed(1)} KB`,
|
|
fileType: res.fileType || file.type || '',
|
|
_uploading: false
|
|
}
|
|
} catch {
|
|
ElMessage.error('文件上传失败')
|
|
formData.consentAttachments.splice(idx, 1)
|
|
} finally {
|
|
nextTick(() => consentUploadRef.value?.clearFiles())
|
|
}
|
|
}
|
|
|
|
function removeConsentAttachment(index: number) {
|
|
formData.consentAttachments.splice(index, 1)
|
|
}
|
|
|
|
const { isDragover: isConsentAttachDragover, dropZoneHandlers: consentAttachDropHandlers } =
|
|
useAttachmentDropZone({
|
|
onFiles: (files) => {
|
|
for (const file of files) {
|
|
void handleConsentAttachmentChange({ raw: file })
|
|
}
|
|
}
|
|
})
|
|
|
|
/* ====== 传染病检测报告附件上传 ====== */
|
|
const infectiousReportUploadRef = ref()
|
|
|
|
async function handleInfectiousReportAttachmentChange(uploadFile: any) {
|
|
const file = uploadFile.raw || uploadFile
|
|
if (!file) return
|
|
const tempId = `temp_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`
|
|
formData.infectiousDiseaseReportAttachments.push({
|
|
id: tempId,
|
|
fileName: file.name,
|
|
fileUrl: '',
|
|
fileSize: file.size,
|
|
fileSizeDisplay: `${(file.size / 1024).toFixed(1)} KB`,
|
|
fileType: file.type || '',
|
|
_uploading: true
|
|
})
|
|
const idx = formData.infectiousDiseaseReportAttachments.length - 1
|
|
try {
|
|
const fd = new FormData()
|
|
fd.append('folder', 'donation-infectious-disease-report')
|
|
fd.append('file', file)
|
|
const res = await fetchUploadAttachment(fd)
|
|
formData.infectiousDiseaseReportAttachments[idx] = {
|
|
...formData.infectiousDiseaseReportAttachments[idx],
|
|
id: res.id || tempId,
|
|
fileName: file.name || res.fileName,
|
|
fileUrl: res.fileUrl,
|
|
fileSize: res.fileSize || file.size,
|
|
fileSizeDisplay: res.fileSizeDisplay || `${(file.size / 1024).toFixed(1)} KB`,
|
|
fileType: res.fileType || file.type || '',
|
|
_uploading: false
|
|
}
|
|
} catch {
|
|
ElMessage.error('文件上传失败')
|
|
formData.infectiousDiseaseReportAttachments.splice(idx, 1)
|
|
} finally {
|
|
nextTick(() => infectiousReportUploadRef.value?.clearFiles())
|
|
}
|
|
}
|
|
|
|
function removeInfectiousReportAttachment(index: number) {
|
|
formData.infectiousDiseaseReportAttachments.splice(index, 1)
|
|
}
|
|
|
|
const {
|
|
isDragover: isInfectiousReportAttachDragover,
|
|
dropZoneHandlers: infectiousReportAttachDropHandlers
|
|
} = useAttachmentDropZone({
|
|
onFiles: (files) => {
|
|
for (const file of files) {
|
|
void handleInfectiousReportAttachmentChange({ raw: file })
|
|
}
|
|
}
|
|
})
|
|
|
|
/* ====== 其他附件上传 ====== */
|
|
const otherUploadRef = ref()
|
|
|
|
async function handleOtherAttachmentChange(uploadFile: any) {
|
|
const file = uploadFile.raw || uploadFile
|
|
if (!file) return
|
|
const tempId = `temp_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`
|
|
formData.otherAttachments.push({
|
|
id: tempId,
|
|
fileName: file.name,
|
|
fileUrl: '',
|
|
fileSize: file.size,
|
|
fileSizeDisplay: `${(file.size / 1024).toFixed(1)} KB`,
|
|
fileType: file.type || '',
|
|
_uploading: true
|
|
})
|
|
const idx = formData.otherAttachments.length - 1
|
|
try {
|
|
const fd = new FormData()
|
|
fd.append('folder', 'donation-other')
|
|
fd.append('file', file)
|
|
const res = await fetchUploadAttachment(fd)
|
|
formData.otherAttachments[idx] = {
|
|
...formData.otherAttachments[idx],
|
|
id: res.id || tempId,
|
|
fileName: file.name || res.fileName,
|
|
fileUrl: res.fileUrl,
|
|
fileSize: res.fileSize || file.size,
|
|
fileSizeDisplay: res.fileSizeDisplay || `${(file.size / 1024).toFixed(1)} KB`,
|
|
fileType: res.fileType || file.type || '',
|
|
_uploading: false
|
|
}
|
|
} catch {
|
|
ElMessage.error('文件上传失败')
|
|
formData.otherAttachments.splice(idx, 1)
|
|
} finally {
|
|
nextTick(() => otherUploadRef.value?.clearFiles())
|
|
}
|
|
}
|
|
|
|
function removeOtherAttachment(index: number) {
|
|
formData.otherAttachments.splice(index, 1)
|
|
}
|
|
|
|
const { isDragover: isOtherAttachDragover, dropZoneHandlers: otherAttachDropHandlers } =
|
|
useAttachmentDropZone({
|
|
onFiles: (files) => {
|
|
for (const file of files) {
|
|
void handleOtherAttachmentChange({ raw: file })
|
|
}
|
|
}
|
|
})
|
|
|
|
/* ====== 文件预览 ====== */
|
|
const previewVisible = ref(false)
|
|
const previewUrl = ref('')
|
|
const previewType = ref<'image' | 'video'>('image')
|
|
|
|
function handlePreviewAttachment(file: any) {
|
|
if (file._uploading) return
|
|
previewUrl.value = fullFileUrl(file.fileUrl)
|
|
previewType.value = isVideoFile(file) ? 'video' : 'image'
|
|
previewVisible.value = true
|
|
}
|
|
|
|
function handleDownloadAttachment(file: any) {
|
|
downloadAttachmentFile(file, { fullFileUrl })
|
|
}
|
|
|
|
/* ====== 弹窗打开时自动初始化 ====== */
|
|
watch(
|
|
() => props.modelValue,
|
|
(visible) => {
|
|
if (visible) {
|
|
if (props.editId) {
|
|
handleOpenForEdit()
|
|
} else {
|
|
handleOpenForAdd()
|
|
}
|
|
}
|
|
}
|
|
)
|
|
</script>
|
|
<style scoped lang="scss">
|
|
/* ═══════════════════════════════════════════
|
|
DIALOG BODY
|
|
═══════════════════════════════════════════ */
|
|
:deep(.protocol-dialog-body) {
|
|
overflow: visible;
|
|
background: #fff;
|
|
}
|
|
|
|
.detail-tabs {
|
|
margin: 0 20px 12px;
|
|
}
|
|
|
|
.protocol-form {
|
|
padding: 0 20px 16px;
|
|
|
|
:deep(.el-form-item) {
|
|
margin-bottom: 4px;
|
|
}
|
|
}
|
|
|
|
.date-paste-wrap {
|
|
width: 100%;
|
|
}
|
|
|
|
/* ═══════════════════════════════════════════
|
|
SECTIONS(单区域连续排布,无分块圆角卡片)
|
|
═══════════════════════════════════════════ */
|
|
.form-tab-pane {
|
|
padding: 0;
|
|
|
|
& + .form-tab-pane {
|
|
margin-top: 14px;
|
|
}
|
|
}
|
|
|
|
.section-card {
|
|
border-radius: 0;
|
|
padding: 0;
|
|
margin-bottom: 0;
|
|
box-shadow: none;
|
|
position: relative;
|
|
background: transparent;
|
|
|
|
&--green {
|
|
background: transparent;
|
|
}
|
|
}
|
|
|
|
.section-title {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
margin-bottom: 10px;
|
|
padding-bottom: 0;
|
|
border-bottom: none;
|
|
}
|
|
|
|
.section-title-left {
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
&::before {
|
|
content: '';
|
|
width: 3px;
|
|
height: 14px;
|
|
background: #047857;
|
|
border-radius: 2px;
|
|
margin-right: 8px;
|
|
flex-shrink: 0;
|
|
}
|
|
}
|
|
|
|
.section-title h3 {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
}
|
|
|
|
.section-subtitle {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: #374151;
|
|
margin: 12px 0 10px;
|
|
|
|
&::before {
|
|
content: '';
|
|
width: 2px;
|
|
height: 12px;
|
|
background: #047857;
|
|
border-radius: 1px;
|
|
}
|
|
}
|
|
|
|
/* ═══════════════════════════════════════════
|
|
FORM GRID
|
|
═══════════════════════════════════════════ */
|
|
.form-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 12px 16px;
|
|
|
|
&--col2 {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
}
|
|
|
|
&--col4 {
|
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
}
|
|
|
|
&--col7 {
|
|
grid-template-columns: repeat(7, minmax(0, 1fr));
|
|
}
|
|
|
|
&--attachment {
|
|
margin-top: 10px;
|
|
grid-template-columns: 1fr;
|
|
|
|
&:first-of-type {
|
|
margin-top: 0;
|
|
}
|
|
}
|
|
}
|
|
|
|
.form-col-span-2 {
|
|
grid-column: 1 / -1;
|
|
}
|
|
|
|
/* ═══════════════════════════════════════════
|
|
CLIENT SUB CARDS
|
|
═══════════════════════════════════════════ */
|
|
.client-sub-cards {
|
|
display: grid;
|
|
grid-template-columns: repeat(3, 1fr);
|
|
gap: 16px;
|
|
}
|
|
|
|
.client-sub-card {
|
|
background: #fff;
|
|
border-radius: 10px;
|
|
padding: 18px 20px;
|
|
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
|
|
border: 1px solid rgba(0, 0, 0, 0.03);
|
|
transition:
|
|
transform 0.2s,
|
|
box-shadow 0.2s;
|
|
|
|
&:hover {
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
|
|
}
|
|
}
|
|
|
|
.sub-card-header {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
margin-bottom: 14px;
|
|
padding-bottom: 10px;
|
|
border-bottom: 1px solid #f1f5f9;
|
|
|
|
.icon {
|
|
font-size: 22px;
|
|
line-height: 1;
|
|
}
|
|
|
|
h4 {
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
}
|
|
}
|
|
|
|
/* ═══════════════════════════════════════════
|
|
ATTACHMENTS (legacy)
|
|
═══════════════════════════════════════════ */
|
|
.attachment-upload {
|
|
width: 100%;
|
|
}
|
|
|
|
.upload-card {
|
|
width: 140px;
|
|
height: 96px;
|
|
border: 1px dashed #a8d4c4;
|
|
border-radius: 8px;
|
|
background: #f0fdf4;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 6px;
|
|
cursor: pointer;
|
|
transition:
|
|
border-color 0.15s,
|
|
background 0.15s;
|
|
|
|
&:hover {
|
|
border-color: #047857;
|
|
border-style: solid;
|
|
background: #e8f4ee;
|
|
}
|
|
}
|
|
|
|
.upload-card-text {
|
|
font-size: 12px;
|
|
color: #047857;
|
|
font-weight: 500;
|
|
line-height: 1;
|
|
}
|
|
|
|
.upload-hint {
|
|
display: block;
|
|
font-size: 11px;
|
|
color: var(--mint-text-muted, #334155);
|
|
line-height: 1;
|
|
margin-top: 8px;
|
|
}
|
|
|
|
.attachment-list {
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
gap: 12px;
|
|
}
|
|
|
|
.attachment-item {
|
|
width: 140px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
border: 1px solid #e2e8f0;
|
|
border-radius: 8px;
|
|
background: #fff;
|
|
overflow: hidden;
|
|
transition:
|
|
border-color 0.15s,
|
|
box-shadow 0.15s;
|
|
|
|
&:hover {
|
|
border-color: #047857;
|
|
box-shadow: 0 2px 8px rgba(4, 120, 87, 0.1);
|
|
}
|
|
|
|
&.is-uploading {
|
|
opacity: 0.6;
|
|
pointer-events: none;
|
|
}
|
|
}
|
|
|
|
.attachment-preview {
|
|
width: 100%;
|
|
height: 96px;
|
|
flex-shrink: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
background: #f8fafc;
|
|
overflow: hidden;
|
|
cursor: pointer;
|
|
|
|
img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
display: block;
|
|
}
|
|
}
|
|
|
|
.attachment-preview__icon {
|
|
width: 48px;
|
|
height: 48px;
|
|
border-radius: 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
&--video {
|
|
background: #ede9fe;
|
|
color: #7c3aed;
|
|
}
|
|
|
|
&--doc {
|
|
background: #e0f2fe;
|
|
color: #0284c7;
|
|
}
|
|
}
|
|
|
|
.attachment-footer {
|
|
display: flex;
|
|
flex-direction: column;
|
|
flex: 1;
|
|
padding: 6px 8px;
|
|
}
|
|
|
|
.attachment-name {
|
|
display: -webkit-box;
|
|
-webkit-line-clamp: 2;
|
|
-webkit-box-orient: vertical;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
font-size: 11px;
|
|
color: #334155;
|
|
line-height: 1.4;
|
|
word-break: break-all;
|
|
min-height: calc(11px * 1.4 * 2);
|
|
}
|
|
|
|
.attachment-actions {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
gap: 8px;
|
|
margin-top: 4px;
|
|
flex-shrink: 0;
|
|
transition: opacity 0.15s;
|
|
}
|
|
|
|
.action-btn {
|
|
width: 22px;
|
|
height: 22px;
|
|
border-radius: 4px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 12px;
|
|
color: var(--mint-text-muted, #334155);
|
|
cursor: pointer;
|
|
background: #f1f5f9;
|
|
transition:
|
|
background 0.15s,
|
|
color 0.15s;
|
|
|
|
&:hover {
|
|
background: #047857;
|
|
color: #fff;
|
|
}
|
|
|
|
&--danger:hover {
|
|
background: #ef4444;
|
|
color: #fff;
|
|
}
|
|
}
|
|
|
|
.upload-card--sm {
|
|
width: 96px;
|
|
height: 76px;
|
|
|
|
.upload-card-text {
|
|
font-size: 11px;
|
|
}
|
|
}
|
|
|
|
.preview-container {
|
|
text-align: center;
|
|
}
|
|
|
|
/* ═══════════════════════════════════════════
|
|
RESPONSIVE
|
|
═══════════════════════════════════════════ */
|
|
@media (max-width: 900px) {
|
|
.form-grid {
|
|
grid-template-columns: repeat(2, 1fr);
|
|
|
|
&--col2 {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
&--col4 {
|
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
}
|
|
|
|
&--col7 {
|
|
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
}
|
|
}
|
|
|
|
.client-sub-cards {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
}
|
|
|
|
:global(.mother-customer-suggest-popper) {
|
|
min-width: 520px !important;
|
|
width: max-content !important;
|
|
}
|
|
|
|
:global(.mother-customer-suggest-popper .mother-customer-suggest-item) {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 16px;
|
|
white-space: nowrap;
|
|
line-height: 1.4;
|
|
}
|
|
|
|
:global(.mother-customer-suggest-popper .mother-customer-suggest-item__name) {
|
|
flex: 0 0 72px;
|
|
font-weight: 500;
|
|
color: var(--mint-text, #0f172a);
|
|
}
|
|
|
|
:global(.mother-customer-suggest-popper .mother-customer-suggest-item__phone) {
|
|
flex: 0 0 120px;
|
|
color: var(--mint-text-muted, #64748b);
|
|
}
|
|
|
|
:global(.mother-customer-suggest-popper .mother-customer-suggest-item__idcard) {
|
|
flex: 0 0 auto;
|
|
font-variant-numeric: tabular-nums;
|
|
letter-spacing: 0.02em;
|
|
color: var(--mint-text, #0f172a);
|
|
}
|
|
</style>
|