This commit is contained in:
2026-08-14 19:59:32 +08:00
parent f7594ebd39
commit 1540b80c89
29 changed files with 780 additions and 587 deletions
@@ -6,7 +6,15 @@ const source = readFileSync(resolve(process.cwd(), 'src/modules/ocean-bookings/p
describe('OceanBookingDetailView interaction contract', () => {
it('selects business objects and automatically keeps their ids and names together', () => {
expect(source).toContain('placeholder="请选择客户"')
expect(source).toContain('placeholder="请选择客户(可选)"')
expect(source).toContain('filterable clearable')
expect(source).toContain('@update:model-value="selectCustomer"')
expect(source).toContain('no-data-text="暂无可选客户"')
expect(source).toContain('customerId: null, customerName: null')
expect(source).toContain("value == null || value === '' ? null : String(value)")
expect(source).toContain('form.data.customerName = form.data.customerId ? form.data.customerName : null')
expect(source).toContain('normalizeDraftData()')
expect(source).not.toContain("customerId: [{ required: true")
expect(source).toContain('placeholder="请选择船公司"')
expect(source).toContain('placeholder="请选择订舱代理"')
expect(source).toContain("selectPartner('shippingCompany'")
@@ -38,22 +46,37 @@ describe('OceanBookingDetailView interaction contract', () => {
it('provides guidance for every free-text booking field', () => {
for (const placeholder of [
'请输入提单号(可选)', '请输入船名', '请输入航次', '例如:CNNGB', '例如:宁波港',
'例如:USLAX', '例如:洛杉矶港', '请输入最终交货地点', '请输入订舱备注(可选)',
'例如:CNNGB', '例如:宁波港', '例如:USLAX', '例如:洛杉矶港',
'请输入最终交货地点', '请输入订舱备注(可选)',
]) expect(source).toContain(`placeholder="${placeholder}"`)
})
it('uses compact choices and keeps capacity snapshots behind one specification control', () => {
expect(source).toContain("const serviceTermOptions = ['CY-CY', 'CY-DOOR', 'DOOR-CY', 'DOOR-DOOR']")
expect(source).toContain("const freightTermOptions = ['PREPAID', 'COLLECT']")
it('keeps release-only transport facts out of draft editing and saving', () => {
for (const field of ['billOfLadingNo', 'vesselName', 'voyageNo', 'estimatedSailingAt', 'estimatedArrivalAt']) {
expect(source).not.toContain(`v-model="form.data.${field}"`)
}
expect(source).toContain(':model-value="detail?.billOfLadingNo || \'\'" disabled placeholder="确认放舱时录入"')
expect(source).toContain(':model-value="detail?.vesselName || \'\'" disabled placeholder="确认放舱时录入"')
expect(source).toContain('v-model="releaseForm.billOfLadingNo"')
expect(source).toContain('v-model="releaseForm.vesselName"')
expect(source).toContain('v-model="releaseForm.voyageNo"')
expect(source).toContain('v-model="releaseForm.estimatedSailingAt"')
expect(source).toContain('v-model="releaseForm.estimatedArrivalAt"')
})
it('uses source-backed free text terms and keeps capacity snapshots behind one specification control', () => {
expect(source).not.toContain('serviceTermOptions')
expect(source).not.toContain('freightTermOptions')
expect(source).toContain("const containerTypeOptions = ['20GP', '40GP', '40HC', '40NR', '45HC']")
expect(source).toContain('<el-select v-model="form.data.serviceTerm"')
expect(source).toContain('<el-select v-model="form.data.freightTerm"')
expect(source).toContain('label="主要运输条款 Service Term" prop="serviceTerm"')
expect(source).toContain('<el-input v-model="form.data.serviceTerm" clearable maxlength="32" placeholder="请输入 Service Term"')
expect(source).toContain('label="运费条款 Freight Term" prop="freightTerm"')
expect(source).toContain('<el-input v-model="form.data.freightTerm" clearable maxlength="32" placeholder="请输入 Freight Term"')
expect(source).toContain('<el-select v-model="container.containerType"')
expect(source).toContain('<el-select v-model="container.containerKind"')
expect(source).toContain(':aria-label="`设置箱型 ${index + 1} 的容量与限重`"')
expect(source).toContain('function containerSpecificationLabel(')
expect(source).not.toContain('<el-input v-model="form.data.serviceTerm"')
expect(source).not.toContain("['PREPAID', 'COLLECT']")
expect(source).not.toContain('<el-input v-model="container.containerType"')
})
@@ -124,7 +147,7 @@ describe('OceanBookingDetailView interaction contract', () => {
it('shows client-side validation failures instead of rendering an empty error alert', () => {
expect(source).toContain(':title="actionError.message"')
expect(source).toContain("actionError.value = { message: '请完善客户、装柜仓库和物流渠道等必填信息' }")
expect(source).toContain("actionError.value = { message: '请完善装柜仓库、物流渠道和运输条款等必填信息' }")
expect(source).toContain("actionError.value = { message: '发货人、收货人和通知人名称均为必填项' }")
expect(source).toContain('规格(必填)')
expect(source).toContain('placeholder="单位名称(必填)"')