提交
This commit is contained in:
1 parent
2e66e03792
commit
09afdb1d65
93 files changed
+22307
-15075
No files matched your search
@@ -285,7 +285,17 @@
|
||||
<el-radio label="0">女</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="新生儿分娩时间" class="form-col-span-2">
|
||||
<el-form-item label="预产期">
|
||||
<el-date-picker
|
||||
v-model="formData.expectedDeliveryDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="选择预产期"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="新生儿分娩时间">
|
||||
<el-date-picker
|
||||
v-model="formData.newbornDeliveryTime"
|
||||
type="datetime"
|
||||
@@ -469,11 +479,11 @@
|
||||
:disabled="!selectedSamples.length"
|
||||
@click="openBatchTransportDialog"
|
||||
>
|
||||
应用到选中样本
|
||||
批量配置运输信息
|
||||
</el-button>
|
||||
</div>
|
||||
<p v-if="formData.samples.length" class="sample-transport-hint"
|
||||
>勾选样本后,点击「应用到选中样本」可批量填写运输信息。点击展开可编辑单个运输信息。</p
|
||||
>勾选样本后,点击「批量配置运输信息」可统一填写运输信息。点击展开可编辑单个运输信息。</p
|
||||
>
|
||||
|
||||
<!-- Sample Cards -->
|
||||
@@ -1162,7 +1172,10 @@
|
||||
} from '@/api/admin'
|
||||
import { fetchEthnicList, type EthnicOption } from '@/api/ethnic'
|
||||
import { useUserStore } from '@/store/modules/user'
|
||||
import { syncFqPaymentDetailRowCount } from '@/utils/protocol-payment-installment'
|
||||
import {
|
||||
calcFqInstallmentDueDate,
|
||||
syncFqPaymentDetailRowCount
|
||||
} from '@/utils/protocol-payment-installment'
|
||||
import AmountInput from '@/components/common/amount-input/index.vue'
|
||||
import { formatMoneyDisplay } from '@/utils/money-format'
|
||||
import {
|
||||
@@ -1434,6 +1447,7 @@
|
||||
fatherIdCard: '',
|
||||
newbornName: '',
|
||||
newbornIdCard: '',
|
||||
expectedDeliveryDate: '',
|
||||
newbornDeliveryTime: '',
|
||||
newbornSex: '',
|
||||
deliveryMode: '',
|
||||
@@ -1487,6 +1501,7 @@
|
||||
fatherIdCard: '',
|
||||
newbornName: '',
|
||||
newbornIdCard: '',
|
||||
expectedDeliveryDate: '',
|
||||
newbornDeliveryTime: '',
|
||||
newbornSex: '',
|
||||
deliveryMode: '',
|
||||
@@ -1634,17 +1649,46 @@
|
||||
syncPaymentDueAmounts()
|
||||
}
|
||||
|
||||
/** 日期加 N 个月,返回 YYYYMMDD 格式(入参支持 YYYYMMDD 或 YYYY-MM-DD) */
|
||||
function addMonths(dateStr: string, months: number): string {
|
||||
const compact = dateStr.replace(/-/g, '')
|
||||
const y = parseInt(compact.slice(0, 4), 10)
|
||||
const m = parseInt(compact.slice(4, 6), 10) - 1
|
||||
const d = parseInt(compact.slice(6, 8), 10)
|
||||
const date = new Date(y, m + months, d)
|
||||
const yy = date.getFullYear()
|
||||
const mm = String(date.getMonth() + 1).padStart(2, '0')
|
||||
const dd = String(date.getDate()).padStart(2, '0')
|
||||
return `${yy}${mm}${dd}`
|
||||
/** 分期开始时间默认值:新生儿分娩时间 > 预产期 > 当前日期(YYYYMMDD) */
|
||||
function defaultInstallmentStartDateYmd(): string {
|
||||
const deliveryYmd = datetimeToYmd(formData.newbornDeliveryTime)
|
||||
if (deliveryYmd) return deliveryYmd
|
||||
const expectedYmd = datetimeToYmd(formData.expectedDeliveryDate)
|
||||
if (expectedYmd) return expectedYmd
|
||||
const now = new Date()
|
||||
const pad = (n: number) => String(n).padStart(2, '0')
|
||||
return `${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}`
|
||||
}
|
||||
|
||||
function datetimeToYmd(val: string): string {
|
||||
const compact = String(val || '')
|
||||
.trim()
|
||||
.replace(/[-:\sT]/g, '')
|
||||
.slice(0, 8)
|
||||
return /^\d{8}$/.test(compact) ? compact : ''
|
||||
}
|
||||
|
||||
function isFqNumericFieldEmpty(val: unknown): boolean {
|
||||
if (val == null || val === '') return true
|
||||
const n = Number(val)
|
||||
return !Number.isFinite(n) || n < 1
|
||||
}
|
||||
|
||||
/**
|
||||
* 分期默认:期数、每期间隔均为 6;开始时间为空时按分娩/预产期/今日填充。
|
||||
* resetCountInterval:切换到分期时强制重置期数与间隔(与新增一致)。
|
||||
*/
|
||||
function applyFqPaymentDefaults(options?: { resetCountInterval?: boolean }) {
|
||||
const reset = options?.resetCountInterval ?? false
|
||||
if (reset || isFqNumericFieldEmpty(formData.installmentCount)) {
|
||||
formData.installmentCount = 6
|
||||
}
|
||||
if (reset || isFqNumericFieldEmpty(formData.installmentIntervalMonths)) {
|
||||
formData.installmentIntervalMonths = 6
|
||||
}
|
||||
if (!formData.installmentStartDate) {
|
||||
formData.installmentStartDate = defaultInstallmentStartDateYmd()
|
||||
}
|
||||
}
|
||||
|
||||
function toIntOrUndefined(val: unknown): number | undefined {
|
||||
@@ -1676,7 +1720,7 @@
|
||||
syncPaymentDueAmounts()
|
||||
formData.paymentDetails.forEach((d, i) => {
|
||||
d.installmentNo = i + 1
|
||||
d.installmentDueDate = addMonths(startDate, i * interval)
|
||||
d.installmentDueDate = calcFqInstallmentDueDate(startDate, i, interval)
|
||||
})
|
||||
return
|
||||
}
|
||||
@@ -1691,7 +1735,7 @@
|
||||
transferTime: '',
|
||||
payStatus: 'dfj',
|
||||
installmentNo: i + 1,
|
||||
installmentDueDate: addMonths(startDate, i * interval),
|
||||
installmentDueDate: calcFqInstallmentDueDate(startDate, i, interval),
|
||||
attachments: [] as Array<{
|
||||
id?: string
|
||||
fileName: string
|
||||
@@ -1710,6 +1754,7 @@
|
||||
/** 缴费模式切换回调 */
|
||||
function onPayModeChange(val: string) {
|
||||
if (val === 'fq') {
|
||||
applyFqPaymentDefaults({ resetCountInterval: true })
|
||||
tryGenerateInstallmentDetails()
|
||||
} else {
|
||||
// 趸交模式:将趸交截止时间同步到所有明细的应缴费时间
|
||||
@@ -1798,6 +1843,7 @@
|
||||
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 || '')
|
||||
@@ -1831,6 +1877,9 @@
|
||||
formData.installmentCount = pay.installmentCount ?? null
|
||||
formData.installmentIntervalMonths = pay.installmentIntervalMonths ?? null
|
||||
formData.installmentStartDate = String(pay.installmentStartDate || '')
|
||||
if (formData.payMode === 'fq') {
|
||||
applyFqPaymentDefaults()
|
||||
}
|
||||
}
|
||||
|
||||
const pd = bundle.paymentDetails as Array<Record<string, any>> | null
|
||||
@@ -1971,6 +2020,7 @@
|
||||
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,
|
||||
@@ -2531,8 +2581,8 @@
|
||||
sc: Api.BizSampleCode.SampleCodeItem,
|
||||
row: Record<string, any>
|
||||
) {
|
||||
if (!sc.usedInProtocol) return false
|
||||
return String(row.sampleCodeId || '') !== sc.id
|
||||
if (sc.usedInProtocol && String(row.sampleCodeId || '') !== sc.id) return true
|
||||
return formData.samples.some((s) => s !== row && String(s.sampleCodeId || '') === sc.id)
|
||||
}
|
||||
|
||||
function onSampleCodeChange(row: Record<string, any>) {
|
||||
|
||||
Reference in new issue
Block a user