Browse Source

feat(inspection): 更新运输方式下拉选项为动态数据源

- 将检验请求列表中的运输方式选项改为动态绑定shipMethodOptions
- 添加listActiveShipMethods API调用来获取启用的运输方式
- 在页面初始化时加载运输方式选项数据
- 优化运输方式选择的数据结构和显示逻辑
master
qiankanghui 4 weeks ago
parent
commit
12bcbe75bc
  1. 49
      src/views/modules/inspection/inspectionRequestList.vue
  2. 10
      src/views/modules/order/poOrder.vue
  3. 55
      src/views/modules/port/portTransit.vue

49
src/views/modules/inspection/inspectionRequestList.vue

@ -407,9 +407,12 @@
<el-table-column prop="shipMethod" label="运输方式" header-align="center" align="center" width="100">
<template slot-scope="scope">
<el-select v-model="scope.row.shipMethod" placeholder="请选择" size="mini" style="width: 100%; box-sizing: border-box;">
<el-option label="空运" value="空运"></el-option>
<el-option label="海运" value="海运"></el-option>
<el-option label="陆运" value="陆运"></el-option>
<el-option
v-for="opt in shipMethodOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</template>
</el-table-column>
@ -473,9 +476,12 @@
<el-table-column label="运输方式" header-align="center" align="center" width="120">
<template slot-scope="scope">
<el-select v-if="editPoEditMode" v-model="scope.row.shipMothod" placeholder="请选择" size="mini" style="width: 100%;">
<el-option label="空运" value="空运"></el-option>
<el-option label="海运" value="海运"></el-option>
<el-option label="陆运" value="陆运"></el-option>
<el-option
v-for="opt in shipMethodOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
<span v-else>{{ scope.row.shipMothod }}</span>
</template>
@ -919,9 +925,12 @@
<el-table-column label="运输方式" header-align="center" align="center" width="120">
<template slot-scope="scope">
<el-select v-model="scope.row.shipMethod" placeholder="请选择" size="mini" style="width: 100%;">
<el-option label="空运" value="空运"></el-option>
<el-option label="海运" value="海运"></el-option>
<el-option label="陆运" value="陆运"></el-option>
<el-option
v-for="opt in shipMethodOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</template>
</el-table-column>
@ -1124,6 +1133,7 @@ import ComInspectionRequestAttachmentTab from './com_inspectionRequestAttachment
import ComInspectionRequestFeeTab from './com_inspectionRequestFeeTab.vue'
import { fetchSupplierDetail } from '@/utils/supplierChooselistHelper'
import excel from '@/utils/excel-util.js'
import { listActiveShipMethods } from '@/api/port/portTransit.js'
export default {
props: {
@ -1161,6 +1171,7 @@ export default {
currentRow: {},
tagNo: '',
searchType: '',
shipMethodOptions: [],
// 供应商模式上下文:来自 /sys/user/info(user.supplierNo / user.supplierName)
currentSupplierNo: '',
currentSupplierName: '',
@ -1701,12 +1712,32 @@ export default {
removeMainTableResizeListener () {
window.removeEventListener('resize', this.handleMainTableResize)
},
/**
* 加载启用的运输方式下拉选项。
* 数据来源:POST /portTransitCycle/shipMethodList(仅 active=Y)
* 以 methodDesc 作为选项 label 与 value,与订单/港口周期表存储的运输方式描述保持一致。
*/
loadShipMethodOptions () {
return listActiveShipMethods().then(({ data }) => {
if (data && data.code === 0) {
this.shipMethodOptions = (data.rows || []).map(item => ({
label: item.methodDesc,
value: item.methodDesc
}))
} else {
this.shipMethodOptions = []
}
}).catch(() => {
this.shipMethodOptions = []
})
},
/**
* 页面初始化入口:
* - 通用模式:直接查询;
* - 供应商模式:先加载当前用户供应商信息,再按供应商过滤查询。
*/
async initPageData () {
this.loadShipMethodOptions()
if (!this.isSupplierPageMode) {
this.getMainData()
return

10
src/views/modules/order/poOrder.vue

@ -3965,7 +3965,7 @@ export default {
return
}
if (tag === 2019) {
if (tag === 532) {
const via = data.method_desc || data.methodDesc || data.shipVia || ''
if (ctx === 'add') {
this.addForm.shipVia = via
@ -4927,7 +4927,7 @@ export default {
})
},
// 新增 schema 中若展示运输方式(ship_via / S_Method),则默认填充为海运
// 新增 schema 中若展示运输方式(ship_via / S_Method),则默认填充为 Ocean
applyAddDefaultShipViaBySchema (targetForm) {
if (!targetForm || !Array.isArray(this.addFormSchemaFields) || !this.addFormSchemaFields.length) {
return
@ -4942,7 +4942,7 @@ export default {
}
const current = targetForm[prop]
if (current === undefined || current === null || String(current).trim() === '') {
this.$set(targetForm, prop, '海运')
this.$set(targetForm, prop, 'Ocean')
}
},
@ -5298,7 +5298,7 @@ export default {
},
openAddShipViaSelect (target = 'master') {
const context = target === 'detail' ? 'addDetail' : 'add'
this.openEamList(2019, '', '', context, 'shipVia')
this.openEamList(532, '', '', context, 'shipVia')
},
buildMergedAddDetailForm (detailRow) {
@ -5438,7 +5438,7 @@ export default {
openShipViaSelect (row) {
this.currentShipViaRow = row
this.openEamList(2019, '', '', 'row', 'shipVia')
this.openEamList(532, '', '', 'row', 'shipVia')
},
/**

55
src/views/modules/port/portTransit.vue

@ -95,7 +95,7 @@
</el-form>
<!-- 表格区域 -->
<div class="table-area">
<div class="table-area" >
<div class="table-title" style="font-size: 13px; font-weight: 450; color: #606266;">运输周期</div>
<el-table
@ -122,7 +122,7 @@
align="center"
width="239"
>
<template slot-scope="scope">
<template slot-scope="scope" class="rq">
<input
v-model.number="scope.row.transitDays"
type="number"
@ -180,23 +180,30 @@
</el-table-column>
<el-table-column
prop="luyun"
label="陆运周期"
label="Land Transit"
align="center"
width="150">
width="140">
</el-table-column>
<el-table-column
prop="haiyun"
label="海运周期"
label="Ocean Transit"
align="center"
width="150">
width="140">
</el-table-column>
<el-table-column
prop="kongyun"
label="空运周期"
label="Air Transit"
align="center"
width="160">
width="140">
</el-table-column>
<el-table-column
prop="express"
label="Express Transit"
align="center"
width="150">
</el-table-column>
</el-table>
@ -249,9 +256,10 @@ export default {
},
// 运输周期列表
transportList: [
{ shipMethod: '陆运', transitDays: 0 },
{ shipMethod: '海运', transitDays: 0 },
{ shipMethod: '空运', transitDays: 0 }
{ shipMethod: 'Land', transitDays: 0 },
{ shipMethod: 'Ocean', transitDays: 0 },
{ shipMethod: 'Air', transitDays: 0 },
{ shipMethod: 'Express', transitDays: 0 }
],
formRules: {
departureName: [{ required: true, message: '请输入始发港名称', trigger: 'blur' }],
@ -267,9 +275,10 @@ export default {
{ columnProp: 'departureName', headerAlign: 'center', align: 'left', columnLabel: '始发港', columnWidth: 150, fixed: '', columnHidden: false, columnSortable: false, showOverflowTooltip: true },
{ columnProp: 'destination', headerAlign: 'center', align: 'left', columnLabel: '目的港口ID', columnWidth: 120, fixed: '', columnHidden: false, columnSortable: false, showOverflowTooltip: true },
{ columnProp: 'destinationName', headerAlign: 'center', align: 'left', columnLabel: '目的港口名称', columnWidth: 150, fixed: '', columnHidden: false, columnSortable: false, showOverflowTooltip: true },
{ columnProp: 'luyun', headerAlign: 'center', align: 'center', columnLabel: '陆运周期', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: true, showOverflowTooltip: true },
{ columnProp: 'haiyun', headerAlign: 'center', align: 'center', columnLabel: '海运周期', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: true, showOverflowTooltip: true },
{ columnProp: 'kongyun', headerAlign: 'center', align: 'center', columnLabel: '空运周期', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: true, showOverflowTooltip: true }
{ columnProp: 'luyun', headerAlign: 'center', align: 'center', columnLabel: 'Land Transit', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: true, showOverflowTooltip: true },
{ columnProp: 'haiyun', headerAlign: 'center', align: 'center', columnLabel: 'Ocean Transit', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: true, showOverflowTooltip: true },
{ columnProp: 'kongyun', headerAlign: 'center', align: 'center', columnLabel: 'Air Transit', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: true, showOverflowTooltip: true },
{ columnProp: 'express', headerAlign: 'center', align: 'center', columnLabel: 'Express Transit', columnWidth: 120, fixed: '', columnHidden: false, columnSortable: true, showOverflowTooltip: true }
]
}
},
@ -373,9 +382,10 @@ export default {
}
// 重置运输周期列表
this.transportList = [
{ shipMethod: '陆运', transitDays: 0 },
{ shipMethod: '海运', transitDays: 0 },
{ shipMethod: '空运', transitDays: 0 }
{ shipMethod: 'Land', transitDays: 0 },
{ shipMethod: 'Ocean', transitDays: 0 },
{ shipMethod: 'Air', transitDays: 0 },
{ shipMethod: 'Express', transitDays: 0 }
]
this.dialogVisible = true
this.$nextTick(() => {
@ -422,18 +432,21 @@ export default {
destination: this.formData.destination,
luyun: null,
haiyun: null,
kongyun: null
kongyun: null,
express: null
}
this.transportList.forEach(item => {
if (item.transitDays === null || item.transitDays === '') return
if (item.shipMethod === '陆运') {
if (item.shipMethod === 'Land') {
result.luyun = Number(item.transitDays)
} else if (item.shipMethod === '海运') {
} else if (item.shipMethod === 'Ocean') {
result.haiyun = Number(item.transitDays)
} else if (item.shipMethod === '空运') {
} else if (item.shipMethod === 'Air') {
result.kongyun = Number(item.transitDays)
} else if (item.shipMethod === 'Express') {
result.express = Number(item.transitDays)
}
})

Loading…
Cancel
Save