Browse Source

feat(order): 优化订单模块字段权限控制和买家选择功能

- 在字段权限组件中实现强制必填字段逻辑,系统级必录字段默认必填且不允许取消
- 修复字段可见性与必填状态的联动逻辑,隐藏字段时自动取消必填勾选
- 为订单搜索栏的Buyer字段添加插槽支持,允许页面自定义买家选择功能
- 实现订单页面买家选择弹窗功能,支持从当前客户下选择可用买家
- 调整买家选择弹窗的UI布局,优化列宽和对话框尺寸
- 为enquiry字段添加默认日期设置功能,新增时自动带出当天日期
- 为advance_payment字段添加下拉选项配置,统一Yes/No选项显示格式
- 修改文档发送和电放等字段的初始默认值设置逻辑
master
qiankanghui 3 weeks ago
parent
commit
c88ad85354
  1. 9
      src/api/npcIqc/npcIqc.js
  2. 333
      src/views/modules/npcIqc/logisticsManagement.vue
  3. 148
      src/views/modules/order/poOrder.vue
  4. 1
      src/views/modules/order/poOrderAdvancedQueryConfig.js

9
src/api/npcIqc/npcIqc.js

@ -14,6 +14,15 @@ export const getAvailablePoList = (data) => createAPI(`/srm/logistics/getAvailab
// 新增物流:将选中的PO订单绑定到指定物流单号(更新 c_flexid)
export const updateLogisticsPo = (data) => createAPI(`/srm/logistics/updateLogisticsPo`, 'post', data)
// 移除:将选中订单的 c_flexid 置空、Telex 重置为 No
export const removeLogisticsPo = (data) => createAPI(`/srm/logistics/removeLogisticsPo`, 'post', data)
// 编辑:将物流单号下所有PO的 Telex_Release 批量更新
export const updateTelexRelease = (data) => createAPI(`/srm/logistics/updateTelexRelease`, 'post', data)
// 编辑:修改物流单号(旧单号整组迁移到新单号)
export const changeLogisticsFlexId = (data) => createAPI(`/srm/logistics/changeLogisticsFlexId`, 'post', data)
// 下载导入模板
export const downloadTemplate = () => {
return createAPI('/npcIqc/downloadTemplate', 'post', {}, { responseType: 'blob' })

333
src/views/modules/npcIqc/logisticsManagement.vue

@ -3,7 +3,7 @@
<!-- 查询条件 -->
<el-form :inline="true" label-position="top" class="search-form-inline">
<div class="search-row">
<el-form-item label="进仓编号" class="search-item">
<el-form-item label="LOGISTICS ID" class="search-item">
<el-input v-model="searchData.flexId" style="width: 150px" @keyup.enter.native="getMainData"/>
</el-form-item>
<el-form-item class="search-item">
@ -32,7 +32,7 @@
style="margin-top: 0px; width: 100%;">
<el-table-column
prop="flexId"
label="物流单号"
label="LOGISTICS ID"
min-width="160"
show-overflow-tooltip />
<el-table-column
@ -55,6 +55,16 @@
label="已出货数量"
width="120"
align="center" />
<el-table-column
label="操作"
width="90"
header-align="center"
align="center"
fixed="right">
<template slot-scope="scope">
<a class="customer-a" @click="openEditDialog(scope.row)">编辑 </a>
</template>
</el-table-column>
</el-table>
<!-- 分页插件 -->
@ -129,22 +139,35 @@
@getBaseData="getBaseData">
</Chooselist>
<!-- 新增物流弹窗 -->
<el-dialog title="新增物流" :visible.sync="addDialogVisible" width="1200px" append-to-body :close-on-click-modal="false" v-drag class="add-logistics-dialog">
<!-- 新增/编辑物流弹窗 -->
<el-dialog :title="dialogMode === 'edit' ? '编辑物流' : '新增物流'" :visible.sync="addDialogVisible" width="1200px" append-to-body :close-on-click-modal="false" v-drag class="add-logistics-dialog">
<el-form :inline="true" label-position="top" size="small" class="add-form">
<el-form-item label="物流单号">
<el-input v-model="addForm.flexId" style="width: 180px" @blur="handleAddFormBlur"/>
<com-po-order-customer-picker :site="$store.state.user.site" v-model="addForm.customer" :disabled="dialogMode === 'edit'" embedded />
<el-form-item>
<template slot="label">
<a v-if="dialogMode === 'edit'" href="#" @click.prevent="openChangeFlexIdDialog">LOGISTICS ID</a>
<span v-else>LOGISTICS ID</span>
</template>
<el-input v-model="addForm.flexId" style="width: 180px" :disabled="dialogMode === 'edit'" @blur="handleAddFormBlur"/>
</el-form-item>
<el-form-item>
<span slot="label"><a href="#" @click="openAddSupplierChoose">供应商编码</a></span>
<el-input v-model="addForm.supplierNo" style="width: 150px" @blur="handleAddFormBlur"/>
<template slot="label">
<a v-if="dialogMode === 'add'" href="#" @click="openAddSupplierChoose">供应商编码</a>
<span v-else>供应商编码</span>
</template>
<el-input v-model="addForm.supplierNo" style="width: 150px" :disabled="dialogMode === 'edit'" @blur="handleAddFormBlur"/>
</el-form-item>
<el-form-item label="供应商名称">
<el-input v-model="addForm.supplierName" style="width: 360px" readonly/>
<el-input v-model="addForm.supplierName" style="width: 360px" disabled/>
</el-form-item>
<el-form-item v-if="dialogMode === 'edit'" label="Telex_Release">
<el-select v-model="telexRelease" size="small" style="width: 120px" @change="telexDirty = true">
<el-option v-for="item in yesNoTextOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-form>
<div style="margin-bottom: 8px; text-align: left">
<el-button type="primary" size="small" @click="openAvailableDialog">新增</el-button>
<el-button type="primary" size="small" @click="openAvailableDialog">增加</el-button>
</div>
<el-table
:data="addPoList"
@ -168,14 +191,52 @@
</el-table-column>
<el-table-column prop="shipVia" label="Method" min-width="110" show-overflow-tooltip />
<el-table-column prop="shippedQty" label="Qty Shipped" width="110" align="center" />
<el-table-column v-if="dialogMode === 'edit'" label="操作" width="80" header-align="center" align="center" fixed="right">
<template slot-scope="scope">
<a class="customer-a" @click="handleRemovePo(scope.row)">移除 </a>
</template>
</el-table-column>
</el-table>
<span slot="footer" class="dialog-footer">
<el-button @click="addDialogVisible = false" type="primary">关闭</el-button>
<el-button v-if="dialogMode === 'edit'" type="primary" :loading="editSaving" @click="saveEditAll">保存</el-button>
<el-button @click="addDialogVisible = false">关闭</el-button>
</span>
</el-dialog>
<!-- 修改物流单号弹窗 -->
<el-dialog title="修改物流单号" :visible.sync="changeFlexIdDialogVisible" width="420px" append-to-body :close-on-click-modal="false">
<el-form label-position="top" size="small">
<el-form-item label="当前物流单号">
<el-input :value="addForm.flexId" readonly/>
</el-form-item>
<el-form-item label="新物流单号">
<el-input v-model="newFlexIdInput" placeholder="请输入新的物流单号"/>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmChangeFlexId">确认</el-button>
<el-button @click="changeFlexIdDialogVisible = false">取消</el-button>
</span>
</el-dialog>
<!-- 选择PO弹窗 -->
<el-dialog title="选择PO" :visible.sync="availableDialogVisible" width="70%" append-to-body :close-on-click-modal="false" v-drag>
<el-form :inline="true" size="small" style="margin-bottom: 4px">
<el-form-item label="PO">
<el-input v-model="availableSearch.po" clearable style="width: 160px" @keyup.enter.native="searchAvailablePo"/>
</el-form-item>
<el-form-item label="Item">
<el-input v-model="availableSearch.item" clearable style="width: 160px" @keyup.enter.native="searchAvailablePo"/>
</el-form-item>
<el-form-item label="Method">
<el-select v-model="availableSearch.method" clearable placeholder="请选择" style="width: 140px">
<el-option v-for="item in methodOptions" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchAvailablePo">查询</el-button>
</el-form-item>
</el-form>
<el-table
ref="availableTable"
:data="availablePoList"
@ -212,13 +273,15 @@
<script>
import LogisticsAttachmentTab from './com_logisticsAttachmentTab.vue'
import { searchLogistics, getPoList, getAvailablePoList, updateLogisticsPo } from '@/api/npcIqc/npcIqc.js'
import ComPoOrderCustomerPicker from '@/views/modules/order/com_poOrder_CustomerPicker.vue'
import { searchLogistics, getPoList, getAvailablePoList, updateLogisticsPo, removeLogisticsPo, updateTelexRelease, changeLogisticsFlexId } from '@/api/npcIqc/npcIqc.js'
import Chooselist from '@/views/modules/common/Chooselist_eam'
import excel from '@/utils/excel-util.js'
export default {
components: {
LogisticsAttachmentTab,
ComPoOrderCustomerPicker,
Chooselist
},
data () {
@ -246,22 +309,55 @@ export default {
targetField: '',
// 供应商选择回调目标:'search' 主查询 | 'add' 新增弹窗
supplierChooseTarget: 'search',
// 新增/编辑物流弹窗模式:'add' 新增 | 'edit' 编辑
dialogMode: 'add',
// 新增物流相关
addDialogVisible: false,
addForm: {
flexId: '',
supplierNo: '',
supplierName: ''
supplierName: '',
customer: ''
},
addPoList: [],
addPoLoading: false,
// 新增物流弹窗内表格高度(填满弹窗固定高度的剩余空间)
addPoTableHeight: 430,
// 编辑界面 Telex_Release 下拉(库内存 Yes/No 全拼)
telexRelease: 'No',
yesNoTextOptions: [
{ label: 'Yes', value: 'Yes' },
{ label: 'No', value: 'No' }
],
// 编辑界面本次暂存(未保存)的新增/移除订单号,点"保存"才写库
pendingAddOrderNos: [],
pendingRemoveOrderNos: [],
// 编辑界面 Telex 是否被用户改动(未改动则保存时不写库,避免默认值误重置)
telexDirty: false,
// 编辑界面物流单号暂存:originalFlexId=进入时数据库值,flexIdDirty=是否已改动(点保存才写库)
originalFlexId: '',
flexIdDirty: false,
editSaving: false,
// 修改物流单号弹窗
changeFlexIdDialogVisible: false,
newFlexIdInput: '',
// 选择PO弹窗相关
availableDialogVisible: false,
availablePoList: [],
availableLoading: false,
availableSelection: []
availableSelection: [],
// 选择PO弹窗筛选条件(PO/Item/Method)
availableSearch: {
po: '',
item: '',
method: ''
},
// Method 下拉选项(与 poOrder 运输方式口径一致)
methodOptions: [
{ label: '海运 SEA', value: 'SEA' },
{ label: '空运 AIR', value: 'AIR' },
{ label: '陆运 ROAD', value: 'ROAD' }
]
}
},
mounted () {
@ -385,9 +481,39 @@ export default {
// 打开新增物流弹窗
openAddDialog () {
this.addForm = { flexId: '', supplierNo: '', supplierName: '' }
this.dialogMode = 'add'
this.addForm = { flexId: '', supplierNo: '', supplierName: '', customer: '' }
this.addPoList = []
this.telexRelease = 'No'
this.availableSearch = { po: '', item: '', method: '' }
this.addDialogVisible = true
},
// 打开编辑物流弹窗(从主表行进入,字段锁定)
openEditDialog (row) {
if (!row || !row.flexId) {
this.$message.warning('该行无物流单号,无法编辑')
return
}
this.dialogMode = 'edit'
this.addForm = {
flexId: row.flexId,
supplierNo: row.supplierNo || '',
supplierName: row.supplierName || '',
customer: ''
}
this.addPoList = []
this.telexRelease = 'No'
this.telexDirty = false
this.pendingAddOrderNos = []
this.pendingRemoveOrderNos = []
this.originalFlexId = row.flexId
this.flexIdDirty = false
this.editSaving = false
this.availableSearch = { po: '', item: '', method: '' }
this.addDialogVisible = true
// 打开即加载该物流单号+供应商下已关联的PO
this.loadAddPoList()
},
// 供应商编码选择(新增弹窗专用,复用 Chooselist)
@ -424,6 +550,10 @@ export default {
} else {
this.addPoList = []
}
// 编辑界面:Customer 从已关联的PO锁定带出(不可编辑)
if (this.dialogMode === 'edit') {
this.addForm.customer = (this.addPoList[0] && this.addPoList[0].ccustomer) || ''
}
this.addPoLoading = false
}).catch(() => {
this.addPoList = []
@ -433,8 +563,12 @@ export default {
// 打开选择PO弹窗
openAvailableDialog () {
if (!this.addForm.customer) {
this.$message.warning('请先选择Customer')
return
}
if (!this.addForm.flexId || !this.addForm.supplierNo) {
this.$message.warning('请先填写物流单号和供应商编码')
this.$message.warning('请先填写LOGISTICS ID和供应商编码')
return
}
this.availableSelection = []
@ -448,7 +582,11 @@ export default {
const params = {
flexId: this.addForm.flexId,
supplierNo: this.addForm.supplierNo,
customer: this.addForm.customer || '',
site: this.$store.state.user.site,
po: this.availableSearch.po || '',
item: this.availableSearch.item || '',
method: this.availableSearch.method || '',
page: 1,
limit: 1000
}
@ -465,17 +603,40 @@ export default {
})
},
// 选择PO弹窗查询(PO/Item/Method)
searchAvailablePo () {
this.loadAvailablePoList()
},
// 选择PO多选变化
handleAvailableSelectionChange (val) {
this.availableSelection = val
},
// 保存选中的PO:更新其 c_flexid 并刷新第一个弹窗
// 保存选中的PO:新增模式立即写库;编辑模式仅前端暂存(点底部"保存"才写库)
saveAvailablePo () {
if (!this.availableSelection.length) {
this.$message.warning('请至少选择一条PO')
return
}
if (this.dialogMode === 'edit') {
// 编辑模式:只改前端 addPoList,不碰数据库
this.availableSelection.forEach(row => {
if (!this.addPoList.some(exist => exist.orderNo === row.orderNo)) {
this.addPoList.push(row)
}
// 若之前暂存过移除,则抵消
const rmIdx = this.pendingRemoveOrderNos.indexOf(row.orderNo)
if (rmIdx !== -1) this.pendingRemoveOrderNos.splice(rmIdx, 1)
// 记录待新增
if (this.pendingAddOrderNos.indexOf(row.orderNo) === -1) {
this.pendingAddOrderNos.push(row.orderNo)
}
})
this.availableDialogVisible = false
this.$message.success('已添加,点击底部"保存"后生效')
return
}
const params = {
flexId: this.addForm.flexId,
supplierNo: this.addForm.supplierNo,
@ -497,6 +658,142 @@ export default {
})
},
// 移除:将该PO订单的 c_flexid 置空、Telex 重置为 No(按 order_no 整单)
handleRemovePo (row) {
if (!this.addForm.flexId) {
this.$message.warning('请先填写LOGISTICS ID')
return
}
this.$confirm(`确认将订单 ${row.orderRef1 || row.orderNo} 从该物流单号移除?移除后其 Telex_Release 将重置为 No。`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
if (this.dialogMode === 'edit') {
// 编辑模式:只改前端,不碰数据库
const idx = this.addPoList.findIndex(r => r.orderNo === row.orderNo)
if (idx !== -1) this.addPoList.splice(idx, 1)
const addIdx = this.pendingAddOrderNos.indexOf(row.orderNo)
if (addIdx !== -1) {
// 本次暂存新增又移除 → 直接抵消,不需写库
this.pendingAddOrderNos.splice(addIdx, 1)
} else if (this.pendingRemoveOrderNos.indexOf(row.orderNo) === -1) {
// 数据库已有的 → 记录为待移除
this.pendingRemoveOrderNos.push(row.orderNo)
}
this.$message.success('已移除,点击底部"保存"后生效')
return
}
const params = {
site: this.$store.state.user.site,
flexId: this.addForm.flexId,
supplierNo: this.addForm.supplierNo,
orderNoList: [row.orderNo]
}
removeLogisticsPo(params).then(({ data }) => {
if (data.code === 0) {
this.$message.success('移除成功')
this.loadAddPoList()
this.getMainData()
} else {
this.$message.error(data.msg || '移除失败')
}
}).catch(() => {
this.$message.error('移除失败')
})
}).catch(() => {})
},
// 编辑界面:点击底部"保存"才一次性提交本次所有暂存改动(移除→改单号→新增→Telex)
saveEditAll () {
if (!this.addForm.flexId) {
this.$message.warning('缺少物流单号')
return
}
const site = this.$store.state.user.site
const supplierNo = this.addForm.supplierNo
const oldFlexId = this.originalFlexId // 数据库当前值
const newFlexId = this.addForm.flexId // 可能已暂存修改
const flexIdChanged = this.flexIdDirty && newFlexId !== oldFlexId
const removeList = this.pendingRemoveOrderNos.slice()
const addList = this.pendingAddOrderNos.slice()
const commitTelex = this.telexDirty
if (!removeList.length && !addList.length && !commitTelex && !flexIdChanged) {
// 无任何改动:直接关闭弹窗(不写库),避免点了“没反应”
this.addDialogVisible = false
return
}
this.editSaving = true
let chain = Promise.resolve()
// 1. 移除:仍按数据库原物流单号(oldFlexId)解除(此时尚未迁移)
if (removeList.length) {
chain = chain.then(() => removeLogisticsPo({ site, flexId: oldFlexId, supplierNo, orderNoList: removeList }).then(({ data }) => {
if (data.code !== 0) throw new Error(data.msg || '移除失败')
}))
}
// 2. 物流单号变更:整组 old→new
if (flexIdChanged) {
chain = chain.then(() => changeLogisticsFlexId({ site, flexId: oldFlexId, supplierNo, newFlexId }).then(({ data }) => {
if (data.code !== 0) throw new Error(data.msg || '物流单号修改失败')
}))
}
// 3. 新增:绑定到最终物流单号(newFlexId)
if (addList.length) {
chain = chain.then(() => updateLogisticsPo({ site, flexId: newFlexId, supplierNo, orderNoList: addList }).then(({ data }) => {
if (data.code !== 0) throw new Error(data.msg || '绑定失败')
}))
}
// 4. Telex:按最终物流单号批量刷新
if (commitTelex) {
chain = chain.then(() => updateTelexRelease({ site, flexId: newFlexId, supplierNo, telexRelease: this.telexRelease }).then(({ data }) => {
if (data.code !== 0) throw new Error(data.msg || 'Telex_Release 保存失败')
}))
}
chain.then(() => {
this.$message.success('保存成功')
this.pendingAddOrderNos = []
this.pendingRemoveOrderNos = []
this.telexDirty = false
this.flexIdDirty = false
this.originalFlexId = newFlexId
this.addDialogVisible = false
this.getMainData()
}).catch(err => {
this.$message.error((err && err.message) || '保存失败')
// 部分提交可能已生效,回退前端显示为库中实际值,避免新旧单号不一致
this.addForm.flexId = this.originalFlexId
this.flexIdDirty = false
this.loadAddPoList()
this.getMainData()
}).finally(() => {
this.editSaving = false
})
},
// 打开修改物流单号弹窗
openChangeFlexIdDialog () {
this.newFlexIdInput = this.addForm.flexId
this.changeFlexIdDialogVisible = true
},
// 确认修改物流单号:编辑界面仅前端暂存,点底部"保存"才写库
confirmChangeFlexId () {
const newVal = (this.newFlexIdInput || '').trim()
if (!newVal) {
this.$message.warning('新物流单号不能为空')
return
}
if (newVal === this.addForm.flexId) {
this.changeFlexIdDialogVisible = false
return
}
// 只改前端显示值(锁定输入框会跟着变),标记待改,不动数据库
this.addForm.flexId = newVal
this.flexIdDirty = true
this.changeFlexIdDialogVisible = false
this.$message.success('已修改,点击底部"保存"后生效')
},
// 加载PO清单
loadPoList () {
if (!this.currentRow.flexId) {
@ -653,7 +950,7 @@ export default {
// 定义导出列配置
const columnMapping = [
{ columnProp: 'flexId', columnLabel: '进仓编号' },
{ columnProp: 'flexId', columnLabel: 'LOGISTICS ID' },
{ columnProp: 'supplierNo', columnLabel: '供应商编码' },
{ columnProp: 'supplierName', columnLabel: '供应商名称' },
{ columnProp: 'poCount', columnLabel: 'PO数量' },

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

@ -33,7 +33,7 @@
{{ editMode ? '确定' : '编辑' }}
</el-button>
<el-button v-if="editMode" style="margin-left: 2px" @click="cancelEditMode">取消</el-button>
<el-button type="success" plain style="margin-left: 2px" @click="syncOriTransitCycle" v-if="editMode" :disabled="!syncSelection || !syncSelection.length">同步运输周期</el-button>
<el-button type="success" plain style="margin-left: 2px" @click="openSyncTransitCycleDialog" v-if="!editMode" :disabled="!syncSelection || !syncSelection.length">同步运输周期</el-button>
<el-button type="primary" style="margin-left: 2px" @click="openAddDialog" v-if="!editMode">新增</el-button>
<el-button type="primary" plain style="margin-left: 2px" @click="openCurrentRowPriceDialog" v-if="!editMode" :disabled="!currentRow">查看价格表</el-button>
<el-button type="warning" plain style="margin-left: 2px" @click="handleSplitToNewPo" v-if="!editMode" :disabled="!currentRow || !canSplitToNewPo(currentRow.status)">拆单到新PO</el-button>
@ -50,7 +50,7 @@
@current-change="onTableCurrentChange"
@selection-change="onSyncSelectionChange">
<el-table-column
v-if="editMode"
v-if="!editMode"
type="selection"
fixed="left"
width="45">
@ -581,6 +581,80 @@
</div>
</el-dialog>
<!--
模态框:同步运输周期(主页面勾选行后打开)
用途:行内可修改始发港/目的港/运输方式,确认后按行传后端重取 ori_transit_cycle 并连带重算相关日期
-->
<el-dialog
title="同步运输周期"
v-drag
:visible.sync="syncTransitCycleDialogVisible"
width="960px"
top="8vh"
append-to-body
:close-on-click-modal="false">
<div style="margin-bottom: 8px; color: #909399; font-size: 12px;">
可修改勾选行的始发港、目的港和运输方式,确认后按新值同步运输周期并连带重算相关日期
</div>
<el-table :data="syncDialogRows" border size="small" max-height="420" style="width: 100%;">
<el-table-column type="index" label="#" header-align="center" align="center" width="50"/>
<el-table-column prop="orderNo" label="PO号" header-align="center" align="center" width="130"/>
<el-table-column prop="itemNo" label="PO行号" header-align="center" align="center" width="80"/>
<el-table-column prop="item" label="Item" header-align="center" align="center" min-width="100" show-overflow-tooltip/>
<el-table-column label="始发港" header-align="center" align="center" min-width="190">
<template slot-scope="scope">
<el-select
v-model="scope.row.departure"
size="mini"
style="width: 100%"
filterable
clearable
placeholder="请选择始发港">
<el-option
v-for="option in poDepartureOptions"
:key="option.value"
:label="option.label"
:value="option.value" />
</el-select>
</template>
</el-table-column>
<el-table-column label="目的港" header-align="center" align="center" min-width="190">
<template slot-scope="scope">
<el-select
v-model="scope.row.destination"
size="mini"
style="width: 100%"
filterable
clearable
placeholder="请选择目的港">
<el-option
v-for="option in poDestinationOptions"
:key="option.value"
:label="option.label"
:value="option.value" />
</el-select>
</template>
</el-table-column>
<el-table-column label="运输方式" header-align="center" align="center" min-width="190">
<template slot-scope="scope">
<el-input
v-model="scope.row.shipVia"
size="mini"
style="width: 100%; cursor: pointer"
readonly
placeholder="请选择运输方式"
@click.native="openShipViaSelect(scope.row)">
<i slot="suffix" class="el-icon-search" style="cursor: pointer" @click.stop="openShipViaSelect(scope.row)"></i>
</el-input>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" :loading="syncTransitCycleSaving" @click="confirmSyncTransitCycle">同步</el-button>
<el-button @click="syncTransitCycleDialogVisible = false">取消</el-button>
</div>
</el-dialog>
<ChooselistEam ref="eamList" @getBaseData="getEamData" />
<po-order-advanced-query
@ -1135,8 +1209,12 @@ export default {
// ===== 页面基础状态 =====
loading: false,
masterRows: [],
// 编辑模式「同步运输周期」勾选行
// 主页面「同步运输周期」勾选行
syncSelection: [],
// 同步运输周期弹窗
syncTransitCycleDialogVisible: false,
syncTransitCycleSaving: false,
syncDialogRows: [],
/**
* 需要单独写编辑 UI 的 columnProp 填在这里,才会走模板里「自定义」分支;不在此数组的仍用默认 select/num/text - rqrq
* 示例:['mPlanner', 'comments']
@ -2013,6 +2091,29 @@ export default {
selectOptionsKey: '',
selectOptions: null
},
{
userId: this.$store.state.user.name,
functionId: 812003,
serialNumber: '812003Table1DOriginalTt',
tableId: '812003Table1',
tableName: 'PO Order',
columnProp: 'originalTt',
headerAlign: 'center',
align: 'center',
columnLabel: 'Original TT',
columnHidden: false,
columnImage: false,
columnSortable: false,
sortLv: 0,
status: true,
fixed: '',
columnWidth: 110,
showOverflowTooltip: true,
editAble: false,
editType: 'number',
selectOptionsKey: '',
selectOptions: null
},
{
userId: this.$store.state.user.name,
functionId: 812003,
@ -4181,12 +4282,44 @@ export default {
this.syncSelection = rows || []
},
syncOriTransitCycle () {
/** 主页面点击「同步运输周期」:把勾选行复制成弹窗可编辑副本(不直接改表格行,取消时不污染页面数据) */
openSyncTransitCycleDialog () {
const rows = this.syncSelection || []
if (!rows.length) {
this.$message.warning('请先勾选需要同步的行')
return
}
this.syncDialogRows = rows.map((r, idx) => ({
rowKey: `${r.orderNo || ''}_${r.itemNo || ''}_${idx}`,
site: r.site,
orderNo: r.orderNo,
itemNo: r.itemNo,
item: r.item,
customer: r.customer,
departure: r.departure,
destination: r.destination,
shipVia: r.shipVia,
wantReceiveDate: r.wantReceiveDate,
narrival: r.narrival
}))
this.syncTransitCycleDialogVisible = true
},
/** 弹窗内确认同步:逐项校验后按行传当前值,后端逐行取 ori_transit_cycle 并连带重算日期 */
confirmSyncTransitCycle () {
if (this.syncTransitCycleSaving) {
return
}
const rows = this.syncDialogRows || []
if (!rows.length) {
this.$message.warning('没有可同步的行')
return
}
const invalid = rows.find(r => !r.departure || !r.destination || !r.shipVia)
if (invalid) {
this.$message.warning(`行 ${invalid.orderNo || ''}-${invalid.itemNo || ''} 的始发港、目的港和运输方式不能为空`)
return
}
const payload = rows.map(r => ({
site: r.site,
orderNo: r.orderNo,
@ -4203,6 +4336,7 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.syncTransitCycleSaving = true
syncOriTransitCycle(payload).then(({ data }) => {
if (data && data.code === 0) {
const d = data.data || {}
@ -4211,13 +4345,19 @@ export default {
if (s.unmatchedCount) msg += `,其中 ${s.unmatchedCount} 条未匹配到周期`
if (s.skipCount) msg += `,跳过 ${s.skipCount} 条`
this.$message.success(msg)
this.syncTransitCycleDialogVisible = false
this.syncSelection = []
if (this.$refs.poTable && this.$refs.poTable.clearSelection) {
this.$refs.poTable.clearSelection()
}
this.getDataList()
} else {
this.$message.error((data && data.msg) || '同步失败')
}
}).catch(error => {
this.$message.error('同步失败: ' + error.message)
}).finally(() => {
this.syncTransitCycleSaving = false
})
}).catch(() => {})
},

1
src/views/modules/order/poOrderAdvancedQueryConfig.js

@ -76,6 +76,7 @@ export const PO_ADVANCED_QUERY_FIELD_CONFIG = [
{ sortOrder: 25, field: 'narrival', label: 'Final Confirmed Arrival Date', sqlColumn: 'pod.c_narrival', dataType: 'date' },
{ sortOrder: 26, field: 'crd', label: 'PI Confirmed CRD', sqlColumn: 'pod.c_crd', dataType: 'date' },
{ sortOrder: 27, field: 'crdOri', label: 'Original CRD', sqlColumn: 'pod.c_crd_ori', dataType: 'date' },
{ sortOrder: 27, field: 'originalTt', label: 'Original TT', sqlColumn: 'pod.original_tt', dataType: 'number' },
{ sortOrder: 27, field: 'inspection', label: 'Inspection Date', sqlColumn: 'pod.c_inspection', dataType: 'date' },
{ sortOrder: 28, field: 'realCrd', label: 'Actual Completion Date', sqlColumn: 'pod.c_real_crd', dataType: 'date' },
{ sortOrder: 29, field: 'eta', label: 'ETA', sqlColumn: 'pod.c_eta', dataType: 'date' },

Loading…
Cancel
Save