|
|
|
@ -16,6 +16,7 @@ |
|
|
|
<el-form-item label=" " class="search-item search-btn-item"> |
|
|
|
<el-button type="primary" @click="getMainData">查询</el-button> |
|
|
|
<el-button type="primary" @click="exportExcel" style="margin-left: 2px">导出</el-button> |
|
|
|
<el-button type="primary" @click="openAddDialog" style="margin-left: 2px">新增</el-button> |
|
|
|
</el-form-item> |
|
|
|
</div> |
|
|
|
</el-form> |
|
|
|
@ -54,11 +55,6 @@ |
|
|
|
label="已出货数量" |
|
|
|
width="120" |
|
|
|
align="center" /> |
|
|
|
<el-table-column |
|
|
|
prop=" " |
|
|
|
label=" " |
|
|
|
width="200" |
|
|
|
align="center" /> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<!-- 分页插件 --> |
|
|
|
@ -132,12 +128,76 @@ |
|
|
|
ref="baseList" |
|
|
|
@getBaseData="getBaseData"> |
|
|
|
</Chooselist> |
|
|
|
|
|
|
|
<!-- 新增物流弹窗 --> |
|
|
|
<el-dialog title="新增物流" :visible.sync="addDialogVisible" width="960px" 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"/> |
|
|
|
</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"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="供应商名称"> |
|
|
|
<el-input v-model="addForm.supplierName" style="width: 360px" readonly/> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
<div style="margin-bottom: 8px; text-align: left"> |
|
|
|
<el-button type="primary" size="small" @click="openAvailableDialog">新增</el-button> |
|
|
|
</div> |
|
|
|
<el-table |
|
|
|
:data="addPoList" |
|
|
|
border |
|
|
|
v-loading="addPoLoading" |
|
|
|
:height="addPoTableHeight" |
|
|
|
style="width: 100%;"> |
|
|
|
<el-table-column prop="ccustomer" label="Customer" min-width="130" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="orderRef1" label="PO" min-width="130" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="orderDate" label="PO日期" width="130" align="center"> |
|
|
|
<template slot-scope="scope">{{ formatDate(scope.row.orderDate) }}</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="partNo" label="Item" min-width="140" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="sku" label="SKU" min-width="140" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="qty" label="Qty" width="90" align="center" /> |
|
|
|
<el-table-column prop="shippedQty" label="Qty Shipped" width="110" align="center" /> |
|
|
|
</el-table> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-button @click="addDialogVisible = false" type="primary">关闭</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-table |
|
|
|
ref="availableTable" |
|
|
|
:data="availablePoList" |
|
|
|
border |
|
|
|
v-loading="availableLoading" |
|
|
|
height="420px" |
|
|
|
@selection-change="handleAvailableSelectionChange" |
|
|
|
style="width: 100%;"> |
|
|
|
<el-table-column type="selection" width="50" align="center" /> |
|
|
|
<el-table-column prop="orderRef1" label="PO" min-width="160" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="orderDate" label="PO日期" width="150" align="center"> |
|
|
|
<template slot-scope="scope">{{ formatDate(scope.row.orderDate) }}</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="ccustomer" label="Customer" min-width="160" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="supplierNo" label="供应商编码" width="140" align="center" /> |
|
|
|
<el-table-column prop="partNo" label="Item" min-width="140" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="sku" label="SKU" min-width="140" show-overflow-tooltip /> |
|
|
|
</el-table> |
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" :disabled="!availableSelection.length" @click="saveAvailablePo">保存</el-button> |
|
|
|
<el-button @click="availableDialogVisible = false">取消</el-button> |
|
|
|
</span> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import LogisticsAttachmentTab from './com_logisticsAttachmentTab.vue' |
|
|
|
import { searchLogistics, getPoList } from '@/api/npcIqc/npcIqc.js' |
|
|
|
import { searchLogistics, getPoList, getAvailablePoList, updateLogisticsPo } from '@/api/npcIqc/npcIqc.js' |
|
|
|
import Chooselist from '@/views/modules/common/Chooselist_eam' |
|
|
|
import excel from '@/utils/excel-util.js' |
|
|
|
|
|
|
|
@ -168,7 +228,25 @@ export default { |
|
|
|
dataListLoading: false, |
|
|
|
poListLoading: false, |
|
|
|
tagNo: '', |
|
|
|
targetField: '' |
|
|
|
targetField: '', |
|
|
|
// 供应商选择回调目标:'search' 主查询 | 'add' 新增弹窗 |
|
|
|
supplierChooseTarget: 'search', |
|
|
|
// 新增物流相关 |
|
|
|
addDialogVisible: false, |
|
|
|
addForm: { |
|
|
|
flexId: '', |
|
|
|
supplierNo: '', |
|
|
|
supplierName: '' |
|
|
|
}, |
|
|
|
addPoList: [], |
|
|
|
addPoLoading: false, |
|
|
|
// 新增物流弹窗内表格高度(填满弹窗固定高度的剩余空间) |
|
|
|
addPoTableHeight: 430, |
|
|
|
// 选择PO弹窗相关 |
|
|
|
availableDialogVisible: false, |
|
|
|
availablePoList: [], |
|
|
|
availableLoading: false, |
|
|
|
availableSelection: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted () { |
|
|
|
@ -256,6 +334,7 @@ export default { |
|
|
|
getBaseList(val, targetField) { |
|
|
|
this.tagNo = val |
|
|
|
this.targetField = targetField |
|
|
|
this.supplierChooseTarget = 'search' |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
let strVal = '' |
|
|
|
@ -277,9 +356,130 @@ export default { |
|
|
|
// 供应商编码选择 |
|
|
|
const supplierNo = val.supplier_no || val.code || '' |
|
|
|
const supplierName = val.supplier_name || val.name || '' |
|
|
|
this.searchData.supplierNo = supplierNo |
|
|
|
this.searchData.supplierName = supplierName |
|
|
|
if (this.supplierChooseTarget === 'add') { |
|
|
|
this.addForm.supplierNo = supplierNo |
|
|
|
this.addForm.supplierName = supplierName |
|
|
|
// 供应商选定后,若物流单号已填则自动查询 |
|
|
|
this.handleAddFormBlur() |
|
|
|
} else { |
|
|
|
this.searchData.supplierNo = supplierNo |
|
|
|
this.searchData.supplierName = supplierName |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 打开新增物流弹窗 |
|
|
|
openAddDialog () { |
|
|
|
this.addForm = { flexId: '', supplierNo: '', supplierName: '' } |
|
|
|
this.addPoList = [] |
|
|
|
this.addDialogVisible = true |
|
|
|
}, |
|
|
|
|
|
|
|
// 供应商编码选择(新增弹窗专用,复用 Chooselist) |
|
|
|
openAddSupplierChoose () { |
|
|
|
this.tagNo = 520 |
|
|
|
this.supplierChooseTarget = 'add' |
|
|
|
this.$nextTick(() => { |
|
|
|
const strVal = this.addForm.supplierNo || '' |
|
|
|
const conSql = " and supplier_no <> '' " |
|
|
|
this.$refs.baseList.init(520, strVal, conSql) |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 物流单号+供应商都填写后,失焦触发查询已关联的订单 |
|
|
|
handleAddFormBlur () { |
|
|
|
if (this.addForm.flexId && this.addForm.supplierNo) { |
|
|
|
this.loadAddPoList() |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 加载新增弹窗内的PO清单(当前物流单号+供应商) |
|
|
|
loadAddPoList () { |
|
|
|
this.addPoLoading = true |
|
|
|
const params = { |
|
|
|
flexId: this.addForm.flexId, |
|
|
|
supplierNo: this.addForm.supplierNo, |
|
|
|
site: this.$store.state.user.site, |
|
|
|
page: 1, |
|
|
|
limit: 1000 |
|
|
|
} |
|
|
|
getPoList(params).then(({ data }) => { |
|
|
|
if (data.code === 0 && data.page) { |
|
|
|
this.addPoList = data.page.list || [] |
|
|
|
} else { |
|
|
|
this.addPoList = [] |
|
|
|
} |
|
|
|
this.addPoLoading = false |
|
|
|
}).catch(() => { |
|
|
|
this.addPoList = [] |
|
|
|
this.addPoLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 打开选择PO弹窗 |
|
|
|
openAvailableDialog () { |
|
|
|
if (!this.addForm.flexId || !this.addForm.supplierNo) { |
|
|
|
this.$message.warning('请先填写物流单号和供应商编码') |
|
|
|
return |
|
|
|
} |
|
|
|
this.availableSelection = [] |
|
|
|
this.availableDialogVisible = true |
|
|
|
this.loadAvailablePoList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 加载该供应商下可选的PO(排除当前表格中已有数据) |
|
|
|
loadAvailablePoList () { |
|
|
|
this.availableLoading = true |
|
|
|
const params = { |
|
|
|
flexId: this.addForm.flexId, |
|
|
|
supplierNo: this.addForm.supplierNo, |
|
|
|
site: this.$store.state.user.site, |
|
|
|
page: 1, |
|
|
|
limit: 1000 |
|
|
|
} |
|
|
|
getAvailablePoList(params).then(({ data }) => { |
|
|
|
if (data.code === 0 && data.page) { |
|
|
|
this.availablePoList = data.page.list || [] |
|
|
|
} else { |
|
|
|
this.availablePoList = [] |
|
|
|
} |
|
|
|
this.availableLoading = false |
|
|
|
}).catch(() => { |
|
|
|
this.availablePoList = [] |
|
|
|
this.availableLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 选择PO多选变化 |
|
|
|
handleAvailableSelectionChange (val) { |
|
|
|
this.availableSelection = val |
|
|
|
}, |
|
|
|
|
|
|
|
// 保存选中的PO:更新其 c_flexid 并刷新第一个弹窗 |
|
|
|
saveAvailablePo () { |
|
|
|
if (!this.availableSelection.length) { |
|
|
|
this.$message.warning('请至少选择一条PO') |
|
|
|
return |
|
|
|
} |
|
|
|
const params = { |
|
|
|
flexId: this.addForm.flexId, |
|
|
|
supplierNo: this.addForm.supplierNo, |
|
|
|
site: this.$store.state.user.site, |
|
|
|
orderNoList: this.availableSelection.map(row => row.orderNo) |
|
|
|
} |
|
|
|
updateLogisticsPo(params).then(({ data }) => { |
|
|
|
if (data.code === 0) { |
|
|
|
this.$message.success('保存成功') |
|
|
|
this.availableDialogVisible = false |
|
|
|
// 刷新第一个弹窗表格及主列表 |
|
|
|
this.loadAddPoList() |
|
|
|
this.getMainData() |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '保存失败') |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.$message.error('保存失败') |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 加载PO清单 |
|
|
|
@ -541,4 +741,23 @@ export default { |
|
|
|
/deep/ .customer-tab .el-tabs__content { |
|
|
|
padding: 5px !important; |
|
|
|
} |
|
|
|
|
|
|
|
/* 新增物流弹窗:压缩顶部标签行高,避免标签与输入框之间留白过大 */ |
|
|
|
.add-form /deep/ .el-form-item__label { |
|
|
|
padding-bottom: 0; |
|
|
|
line-height: 1; |
|
|
|
height: auto; |
|
|
|
} |
|
|
|
|
|
|
|
.add-form /deep/ .el-form-item { |
|
|
|
margin-bottom: 8px; |
|
|
|
} |
|
|
|
|
|
|
|
/* 新增物流弹窗:固定高度,内容超出时滚动 */ |
|
|
|
.add-logistics-dialog /deep/ .el-dialog__body { |
|
|
|
height: 560px; |
|
|
|
overflow-y: auto; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</style> |