|
|
|
@ -152,7 +152,7 @@ |
|
|
|
<el-dialog |
|
|
|
title="新增验货申请" |
|
|
|
:visible.sync="addDialogVisible" |
|
|
|
width="65%" |
|
|
|
width="1050px" |
|
|
|
top="5vh" |
|
|
|
:close-on-click-modal="false" |
|
|
|
@close="handleCloseAddDialog"> |
|
|
|
@ -186,7 +186,7 @@ |
|
|
|
|
|
|
|
<el-row :gutter="10"> |
|
|
|
<el-col :span="6"> |
|
|
|
<el-form-item prop="supplierNo"><span slot="label" class="choose-label" @click="getBaseList(501)">供应商编码</span> |
|
|
|
<el-form-item prop="supplierNo"><span slot="label" class="choose-label" @click="openPoSupplierDialog">供应商编码</span> |
|
|
|
<el-input |
|
|
|
v-model="addFormData.supplierNo" |
|
|
|
readonly |
|
|
|
@ -201,7 +201,8 @@ |
|
|
|
</el-col> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label=" " > |
|
|
|
<div style="height: 28px;"></div> |
|
|
|
<el-button type="primary" size="medium" style="margin-top:13px;" @click="openOrderSupplierDialog">从订单选择供应商</el-button> |
|
|
|
|
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
|
@ -243,39 +244,63 @@ |
|
|
|
|
|
|
|
<!-- PO号筛选和排序工具栏 --> |
|
|
|
<div class="po-toolbar"> |
|
|
|
<!-- 搜索框 + 按钮组放在一起 --> |
|
|
|
<div style="display: flex; align-items: center; gap: 8px; flex: 0 0 auto;"> |
|
|
|
<!-- 搜索框 --> |
|
|
|
<div style="width: 180px;"> |
|
|
|
<el-form :inline="true" label-width="70px" size="mini" class="add-po-search-form"> |
|
|
|
<el-form-item label="PO"> |
|
|
|
<el-input |
|
|
|
v-model="poSearchKeyword" |
|
|
|
placeholder="请输入PO/产品编码/Item/SKU筛选" |
|
|
|
size="mini" |
|
|
|
v-model="addPoFilter.orderNo" |
|
|
|
clearable |
|
|
|
@input="filterPoList"> |
|
|
|
<i slot="prefix" class="el-input__icon el-icon-search"></i> |
|
|
|
</el-input> |
|
|
|
</div> |
|
|
|
|
|
|
|
<!-- CRD日期排序按钮 --> |
|
|
|
<el-button type="primary" icon="el-icon-sort" @click="toggleCrdSort"> |
|
|
|
CRD日期排序 |
|
|
|
</el-button> |
|
|
|
|
|
|
|
<!-- 重置筛选按钮 --> |
|
|
|
<el-button type="primary" @click="resetPoFilter" v-if="poSearchKeyword || crdSortOrder"> |
|
|
|
重置筛选 |
|
|
|
</el-button> |
|
|
|
</div> |
|
|
|
style="width: 80px" |
|
|
|
@keyup.enter.native="filterAddPoList"/> |
|
|
|
</el-form-item> |
|
|
|
<!-- <el-form-item label="产品编码">--> |
|
|
|
<!-- <el-input--> |
|
|
|
<!-- v-model="addPoFilter.partNo"--> |
|
|
|
<!-- clearable--> |
|
|
|
<!-- style="width: 80px"--> |
|
|
|
<!-- @keyup.enter.native="filterAddPoList"/>--> |
|
|
|
<!-- </el-form-item>--> |
|
|
|
<el-form-item label="Item"> |
|
|
|
<el-input |
|
|
|
v-model="addPoFilter.item" |
|
|
|
clearable |
|
|
|
style="width: 80px" |
|
|
|
@keyup.enter.native="filterAddPoList"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="SKU"> |
|
|
|
<el-input |
|
|
|
v-model="addPoFilter.sku" |
|
|
|
clearable |
|
|
|
style="width: 80px" |
|
|
|
@keyup.enter.native="filterAddPoList"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="物料名称"> |
|
|
|
<el-input |
|
|
|
v-model="addPoFilter.partDesc" |
|
|
|
clearable |
|
|
|
style="width: 80px" |
|
|
|
@keyup.enter.native="filterAddPoList"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="供应商名称"> |
|
|
|
<el-input |
|
|
|
v-model="addPoFilter.supplierName" |
|
|
|
clearable |
|
|
|
style="width: 100px" |
|
|
|
@keyup.enter.native="filterAddPoList"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label=" "> |
|
|
|
<el-button type="primary" size="medium" style="margin-top:13px;" @click="filterAddPoList">查询</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
</div> |
|
|
|
|
|
|
|
<el-table |
|
|
|
ref="addPoTable" |
|
|
|
:data="filteredPoList" |
|
|
|
border |
|
|
|
size="small" |
|
|
|
table-layout="fixed" |
|
|
|
height="400px" |
|
|
|
style="width: 100%; margin-top: 10px;" |
|
|
|
height="350px" |
|
|
|
style="width: 100%; margin-top: 0px;" |
|
|
|
@selection-change="handleSelectionChange"> |
|
|
|
<el-table-column type="selection" width="55" align="center" fixed="left" /> |
|
|
|
<el-table-column prop="orderRef1" label="PO号" header-align="center" align="center" width="120"/> |
|
|
|
@ -337,6 +362,165 @@ |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<el-dialog |
|
|
|
title="选择供应商" |
|
|
|
:visible.sync="poSupplierDialogVisible" |
|
|
|
width="760px" |
|
|
|
append-to-body |
|
|
|
:close-on-click-modal="false"> |
|
|
|
<el-form :inline="true" label-width="80px" size="mini" class="po-supplier-search-form"> |
|
|
|
<el-form-item label="供应商编码"> |
|
|
|
<el-input |
|
|
|
v-model="poSupplierSearch.supplierNo" |
|
|
|
clearable |
|
|
|
style="width: 120px" |
|
|
|
@keyup.enter.native="searchPoSupplierList"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="供应商名称"> |
|
|
|
<el-input |
|
|
|
v-model="poSupplierSearch.supplierName" |
|
|
|
clearable |
|
|
|
style="width: 200px" |
|
|
|
@keyup.enter.native="searchPoSupplierList"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label=" "> |
|
|
|
<el-button type="primary" size="medium" @click="searchPoSupplierList">查询</el-button> |
|
|
|
<el-button size="medium" @click="resetPoSupplierSearch">重置</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
|
|
|
|
<el-table |
|
|
|
ref="poSupplierTable" |
|
|
|
:data="poSupplierList" |
|
|
|
border |
|
|
|
height="360px" |
|
|
|
v-loading="poSupplierLoading" |
|
|
|
highlight-current-row |
|
|
|
@current-change="onPoSupplierCurrentChange" |
|
|
|
@row-dblclick="onPoSupplierRowDblClick"> |
|
|
|
<el-table-column prop="supplierNo" label="供应商编码" header-align="center" align="left" min-width="140" /> |
|
|
|
<el-table-column prop="supplierName" label="供应商名称" header-align="center" align="left" min-width="220" /> |
|
|
|
<el-table-column prop="poDetailCount" label="PO明细数" header-align="center" align="right" min-width="120" /> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<el-pagination |
|
|
|
style="margin-top: 10px; text-align: right" |
|
|
|
@size-change="onPoSupplierPageSizeChange" |
|
|
|
@current-change="onPoSupplierPageCurrentChange" |
|
|
|
:current-page="poSupplierPageIndex" |
|
|
|
:page-sizes="[20, 50, 100, 200]" |
|
|
|
:page-size="poSupplierPageSize" |
|
|
|
:total="poSupplierTotal" |
|
|
|
layout="total, sizes, prev, pager, next, jumper"> |
|
|
|
</el-pagination> |
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" @click="confirmPoSupplierSelect">确认</el-button> |
|
|
|
<el-button @click="poSupplierDialogVisible = false">取消</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<el-dialog |
|
|
|
title="从订单选择供应商" |
|
|
|
:visible.sync="orderSupplierDialogVisible" |
|
|
|
width="1260px" |
|
|
|
append-to-body |
|
|
|
:close-on-click-modal="false"> |
|
|
|
<el-form :inline="true" label-position="top" class="search-form-inline"> |
|
|
|
<el-form-item label="PO"> |
|
|
|
<el-input |
|
|
|
v-model="orderSupplierSearch.orderNo" |
|
|
|
clearable |
|
|
|
style="width: 150px" |
|
|
|
@keyup.enter.native="searchOrderSupplierByPo"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="产品编码"> |
|
|
|
<el-input |
|
|
|
v-model="orderSupplierSearch.partNo" |
|
|
|
clearable |
|
|
|
style="width: 150px" |
|
|
|
@keyup.enter.native="searchOrderSupplierByPo"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="Item"> |
|
|
|
<el-input |
|
|
|
v-model="orderSupplierSearch.item" |
|
|
|
clearable |
|
|
|
style="width: 140px" |
|
|
|
@keyup.enter.native="searchOrderSupplierByPo"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="SKU"> |
|
|
|
<el-input |
|
|
|
v-model="orderSupplierSearch.sku" |
|
|
|
clearable |
|
|
|
style="width: 140px" |
|
|
|
@keyup.enter.native="searchOrderSupplierByPo"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="物料名称"> |
|
|
|
<el-input |
|
|
|
v-model="orderSupplierSearch.partDesc" |
|
|
|
clearable |
|
|
|
style="width: 200px" |
|
|
|
@keyup.enter.native="searchOrderSupplierByPo"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="供应商名称"> |
|
|
|
<el-input |
|
|
|
v-model="orderSupplierSearch.supplierName" |
|
|
|
clearable |
|
|
|
style="width: 200px" |
|
|
|
@keyup.enter.native="searchOrderSupplierByPo"/> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label=" "> |
|
|
|
<el-button type="primary" @click="searchOrderSupplierByPo">查询</el-button> |
|
|
|
<el-button @click="resetOrderSupplierSearch">重置</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form> |
|
|
|
|
|
|
|
<el-table |
|
|
|
ref="orderSupplierTable" |
|
|
|
:data="orderSupplierList" |
|
|
|
border |
|
|
|
height="430px" |
|
|
|
v-loading="orderSupplierLoading" |
|
|
|
highlight-current-row |
|
|
|
@current-change="onOrderSupplierCurrentChange" |
|
|
|
@row-dblclick="onOrderSupplierRowDblClick" |
|
|
|
:default-sort="{ prop: 'crd', order: 'descending' }"> |
|
|
|
<el-table-column prop="supplierNo" label="供应商编码" header-align="center" align="left" min-width="120" fixed="left" /> |
|
|
|
<el-table-column prop="supplierName" label="供应商名称" header-align="center" align="left" min-width="180" fixed="left" /> |
|
|
|
<el-table-column prop="orderRef1" label="PO号" header-align="center" align="center" min-width="120" /> |
|
|
|
<el-table-column prop="orderRef2" label="PO行号" header-align="center" align="center" min-width="80" /> |
|
|
|
<el-table-column prop="partNo" label="产品编码" header-align="center" align="left" min-width="140" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="item" label="Item" header-align="center" align="left" min-width="120" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="sku" label="SKU" header-align="center" align="left" min-width="140" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="partDesc" label="物料名称" header-align="center" align="left" min-width="170" show-overflow-tooltip /> |
|
|
|
<el-table-column prop="waitInspectQty" label="未验货数量" header-align="center" align="right" min-width="100" /> |
|
|
|
<el-table-column |
|
|
|
prop="crd" |
|
|
|
label="CRD日期" |
|
|
|
header-align="center" |
|
|
|
align="center" |
|
|
|
min-width="120" |
|
|
|
sortable |
|
|
|
:sort-method="(a, b) => sortCrdDate(a, b)" /> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
<el-pagination |
|
|
|
style="margin-top: 10px; text-align: right" |
|
|
|
@size-change="onOrderSupplierPageSizeChange" |
|
|
|
@current-change="onOrderSupplierPageCurrentChange" |
|
|
|
:current-page="orderSupplierPageIndex" |
|
|
|
:page-sizes="[20, 50, 100, 200]" |
|
|
|
:page-size="orderSupplierPageSize" |
|
|
|
:total="orderSupplierTotal" |
|
|
|
layout="total, sizes, prev, pager, next, jumper"> |
|
|
|
</el-pagination> |
|
|
|
|
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" @click="confirmOrderSupplierSelect">确认</el-button> |
|
|
|
<el-button @click="orderSupplierDialogVisible = false">取消</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 导入弹窗 --> |
|
|
|
<el-dialog title="验货申请数据导入" :visible.sync="uploadDialogVisible" width="800px"> |
|
|
|
<!-- 选择文件 --> |
|
|
|
@ -380,8 +564,7 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { searchInspectionRequestHeaderList, queryPoPage, saveInspectionRequest, deleteInspectionRequest, confirmInspectionRequest, downloadTemplate, previewUpload, batchSave } from '@/api/inspection/inspectionRequestHeader.js' |
|
|
|
import { searchSrmSupplierList } from '@/api/srm/srmSupplier.js' |
|
|
|
import { searchInspectionRequestHeaderList, queryPoPage, queryPoSupplierPage, queryPoSupplierOrderPage, saveInspectionRequest, deleteInspectionRequest, confirmInspectionRequest, downloadTemplate, previewUpload, batchSave } from '@/api/inspection/inspectionRequestHeader.js' |
|
|
|
import { searchSrmSupplierAddressList } from '@/api/srm/srmSupplier.js' |
|
|
|
import Chooselist from '@/views/modules/common/Chooselist_eam' |
|
|
|
import ComInspectionRequestDetail from './com_inspectionRequestDetail.vue' |
|
|
|
@ -435,9 +618,42 @@ export default { |
|
|
|
}, |
|
|
|
poList: [], |
|
|
|
filteredPoList: [], |
|
|
|
poSearchKeyword: '', |
|
|
|
crdSortOrder: '', |
|
|
|
addPoFilter: { |
|
|
|
orderNo: '', |
|
|
|
partNo: '', |
|
|
|
item: '', |
|
|
|
sku: '', |
|
|
|
partDesc: '', |
|
|
|
supplierName: '' |
|
|
|
}, |
|
|
|
selectedPoList: [], |
|
|
|
poSupplierDialogVisible: false, |
|
|
|
poSupplierLoading: false, |
|
|
|
poSupplierList: [], |
|
|
|
poSupplierCurrentRow: null, |
|
|
|
poSupplierPageIndex: 1, |
|
|
|
poSupplierPageSize: 20, |
|
|
|
poSupplierTotal: 0, |
|
|
|
poSupplierSearch: { |
|
|
|
supplierNo: '', |
|
|
|
supplierName: '' |
|
|
|
}, |
|
|
|
orderSupplierDialogVisible: false, |
|
|
|
orderSupplierLoading: false, |
|
|
|
orderSupplierList: [], |
|
|
|
orderSupplierCurrentRow: null, |
|
|
|
orderSupplierPageIndex: 1, |
|
|
|
orderSupplierPageSize: 50, |
|
|
|
orderSupplierTotal: 0, |
|
|
|
orderSupplierSearch: { |
|
|
|
orderNo: '', |
|
|
|
partNo: '', |
|
|
|
item: '', |
|
|
|
sku: '', |
|
|
|
partDesc: '', |
|
|
|
supplierName: '' |
|
|
|
}, |
|
|
|
pendingAutoSelectPoRow: null, |
|
|
|
// 上传相关 |
|
|
|
uploadDialogVisible: false, |
|
|
|
uploadFileName: '', |
|
|
|
@ -890,8 +1106,41 @@ export default { |
|
|
|
this.poList = [] |
|
|
|
this.filteredPoList = [] |
|
|
|
this.selectedPoList = [] |
|
|
|
this.poSearchKeyword = '' |
|
|
|
this.crdSortOrder = '' |
|
|
|
this.addPoFilter = { |
|
|
|
orderNo: '', |
|
|
|
partNo: '', |
|
|
|
item: '', |
|
|
|
sku: '', |
|
|
|
partDesc: '', |
|
|
|
supplierName: '' |
|
|
|
} |
|
|
|
this.poSupplierDialogVisible = false |
|
|
|
this.poSupplierLoading = false |
|
|
|
this.poSupplierList = [] |
|
|
|
this.poSupplierCurrentRow = null |
|
|
|
this.poSupplierPageIndex = 1 |
|
|
|
this.poSupplierPageSize = 20 |
|
|
|
this.poSupplierTotal = 0 |
|
|
|
this.poSupplierSearch = { |
|
|
|
supplierNo: '', |
|
|
|
supplierName: '' |
|
|
|
} |
|
|
|
this.orderSupplierDialogVisible = false |
|
|
|
this.orderSupplierLoading = false |
|
|
|
this.orderSupplierList = [] |
|
|
|
this.orderSupplierCurrentRow = null |
|
|
|
this.orderSupplierPageIndex = 1 |
|
|
|
this.orderSupplierPageSize = 50 |
|
|
|
this.orderSupplierTotal = 0 |
|
|
|
this.orderSupplierSearch = { |
|
|
|
orderNo: '', |
|
|
|
partNo: '', |
|
|
|
item: '', |
|
|
|
sku: '', |
|
|
|
partDesc: '', |
|
|
|
supplierName: '' |
|
|
|
} |
|
|
|
this.pendingAutoSelectPoRow = null |
|
|
|
if (this.$refs.addFormData) { |
|
|
|
this.$refs.addFormData.clearValidate() |
|
|
|
} |
|
|
|
@ -933,6 +1182,313 @@ export default { |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 打开新增弹窗专用供应商查询 |
|
|
|
openPoSupplierDialog () { |
|
|
|
this.poSupplierDialogVisible = true |
|
|
|
this.poSupplierPageIndex = 1 |
|
|
|
this.poSupplierCurrentRow = null |
|
|
|
this.poSupplierSearch.supplierNo = this.addFormData.supplierNo || '' |
|
|
|
this.poSupplierSearch.supplierName = '' |
|
|
|
this.loadPoSupplierList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 查询新增弹窗专用供应商列表 |
|
|
|
loadPoSupplierList () { |
|
|
|
const params = { |
|
|
|
site: this.$store.state.user.site, |
|
|
|
supplierNo: this.poSupplierSearch.supplierNo || '', |
|
|
|
supplierName: this.poSupplierSearch.supplierName || '', |
|
|
|
page: this.poSupplierPageIndex, |
|
|
|
limit: this.poSupplierPageSize |
|
|
|
} |
|
|
|
this.poSupplierLoading = true |
|
|
|
queryPoSupplierPage(params).then(({ data }) => { |
|
|
|
if (data.code === 0 && data.page) { |
|
|
|
this.poSupplierList = data.page.list || [] |
|
|
|
this.poSupplierTotal = data.page.totalCount || 0 |
|
|
|
this.poSupplierPageIndex = data.page.currPage || this.poSupplierPageIndex |
|
|
|
this.poSupplierPageSize = data.page.pageSize || this.poSupplierPageSize |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.poSupplierList.length > 0) { |
|
|
|
this.poSupplierCurrentRow = this.poSupplierList[0] |
|
|
|
if (this.$refs.poSupplierTable) { |
|
|
|
this.$refs.poSupplierTable.setCurrentRow(this.poSupplierCurrentRow) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.poSupplierCurrentRow = null |
|
|
|
if (this.$refs.poSupplierTable) { |
|
|
|
this.$refs.poSupplierTable.setCurrentRow() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.poSupplierList = [] |
|
|
|
this.poSupplierTotal = 0 |
|
|
|
this.poSupplierCurrentRow = null |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.poSupplierList = [] |
|
|
|
this.poSupplierTotal = 0 |
|
|
|
this.poSupplierCurrentRow = null |
|
|
|
this.$message.error('加载供应商列表失败') |
|
|
|
}).finally(() => { |
|
|
|
this.poSupplierLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 供应商弹框查询 |
|
|
|
searchPoSupplierList () { |
|
|
|
this.poSupplierPageIndex = 1 |
|
|
|
this.loadPoSupplierList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 供应商弹框重置查询 |
|
|
|
resetPoSupplierSearch () { |
|
|
|
this.poSupplierSearch.supplierNo = '' |
|
|
|
this.poSupplierSearch.supplierName = '' |
|
|
|
this.poSupplierPageIndex = 1 |
|
|
|
this.loadPoSupplierList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 供应商弹框页大小变化 |
|
|
|
onPoSupplierPageSizeChange (val) { |
|
|
|
this.poSupplierPageSize = val |
|
|
|
this.poSupplierPageIndex = 1 |
|
|
|
this.loadPoSupplierList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 供应商弹框页码变化 |
|
|
|
onPoSupplierPageCurrentChange (val) { |
|
|
|
this.poSupplierPageIndex = val |
|
|
|
this.loadPoSupplierList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 供应商弹框选中行变化 |
|
|
|
onPoSupplierCurrentChange (row) { |
|
|
|
this.poSupplierCurrentRow = row || null |
|
|
|
}, |
|
|
|
|
|
|
|
// 供应商弹框双击选择 |
|
|
|
onPoSupplierRowDblClick (row) { |
|
|
|
this.selectPoSupplier(row) |
|
|
|
}, |
|
|
|
|
|
|
|
// 供应商弹框点击确认 |
|
|
|
confirmPoSupplierSelect () { |
|
|
|
this.selectPoSupplier(this.poSupplierCurrentRow) |
|
|
|
}, |
|
|
|
|
|
|
|
// 回填供应商并刷新PO明细 |
|
|
|
selectPoSupplier (row) { |
|
|
|
if (!row || !row.supplierNo) { |
|
|
|
this.$message.warning('请选择供应商') |
|
|
|
return |
|
|
|
} |
|
|
|
const supplierNoVal = row.supplierNo || '' |
|
|
|
const supplierNameVal = row.supplierName || '' |
|
|
|
this.$set(this.addFormData, 'supplierNo', supplierNoVal) |
|
|
|
this.$set(this.addFormData, 'supplierName', supplierNameVal) |
|
|
|
this.addPoFilter = { |
|
|
|
orderNo: '', |
|
|
|
partNo: '', |
|
|
|
item: '', |
|
|
|
sku: '', |
|
|
|
partDesc: '', |
|
|
|
supplierName: '' |
|
|
|
} |
|
|
|
this.poSupplierDialogVisible = false |
|
|
|
this.orderSupplierDialogVisible = false |
|
|
|
this.loadPoList() |
|
|
|
this.fetchSupplierAddress(supplierNoVal) |
|
|
|
}, |
|
|
|
|
|
|
|
// 判断两条PO明细是否为同一行(优先用内部主键,再回退到展示字段) |
|
|
|
isSamePoDetailRow (sourceRow, targetRow) { |
|
|
|
if (!sourceRow || !targetRow) { |
|
|
|
return false |
|
|
|
} |
|
|
|
const sourceOrderNo = String(sourceRow.orderNo || sourceRow.order_no || '') |
|
|
|
const sourceItemNo = String(sourceRow.itemNo || sourceRow.item_no || '') |
|
|
|
const targetOrderNo = String(targetRow.orderNo || targetRow.order_no || '') |
|
|
|
const targetItemNo = String(targetRow.itemNo || targetRow.item_no || '') |
|
|
|
if (sourceOrderNo && sourceItemNo && targetOrderNo && targetItemNo) { |
|
|
|
return sourceOrderNo === targetOrderNo && sourceItemNo === targetItemNo |
|
|
|
} |
|
|
|
return String(sourceRow.orderRef1 || '') === String(targetRow.orderRef1 || '') && |
|
|
|
String(sourceRow.orderRef2 || '') === String(targetRow.orderRef2 || '') && |
|
|
|
String(sourceRow.partNo || '') === String(targetRow.partNo || '') |
|
|
|
}, |
|
|
|
|
|
|
|
// 供应商回填后,自动勾选“从订单选择供应商”时选中的那条PO明细 |
|
|
|
applyPendingAutoSelectPoRow () { |
|
|
|
if (!this.pendingAutoSelectPoRow) { |
|
|
|
return |
|
|
|
} |
|
|
|
const targetRow = this.pendingAutoSelectPoRow |
|
|
|
this.$nextTick(() => { |
|
|
|
const tableRef = this.$refs.addPoTable |
|
|
|
if (!tableRef) { |
|
|
|
this.pendingAutoSelectPoRow = null |
|
|
|
return |
|
|
|
} |
|
|
|
let matchedRow = null |
|
|
|
for (let i = 0; i < this.filteredPoList.length; i++) { |
|
|
|
if (this.isSamePoDetailRow(this.filteredPoList[i], targetRow)) { |
|
|
|
matchedRow = this.filteredPoList[i] |
|
|
|
break |
|
|
|
} |
|
|
|
} |
|
|
|
if (matchedRow) { |
|
|
|
tableRef.toggleRowSelection(matchedRow, true) |
|
|
|
} |
|
|
|
this.pendingAutoSelectPoRow = null |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 打开“从订单选择供应商”弹框(不默认筛供应商) |
|
|
|
openOrderSupplierDialog () { |
|
|
|
this.orderSupplierDialogVisible = true |
|
|
|
this.orderSupplierCurrentRow = null |
|
|
|
this.orderSupplierPageIndex = 1 |
|
|
|
this.orderSupplierTotal = 0 |
|
|
|
this.orderSupplierSearch = { |
|
|
|
orderNo: '', |
|
|
|
partNo: '', |
|
|
|
item: '', |
|
|
|
sku: '', |
|
|
|
partDesc: '', |
|
|
|
supplierName: '' |
|
|
|
} |
|
|
|
this.loadOrderSupplierList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 订单来源供应商弹框查询 |
|
|
|
searchOrderSupplierByPo () { |
|
|
|
this.orderSupplierPageIndex = 1 |
|
|
|
this.loadOrderSupplierList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 加载订单来源供应商分页列表(专用后端方法) |
|
|
|
loadOrderSupplierList () { |
|
|
|
const params = { |
|
|
|
site: this.$store.state.user.site, |
|
|
|
page: this.orderSupplierPageIndex, |
|
|
|
limit: this.orderSupplierPageSize, |
|
|
|
orderNo: this.orderSupplierSearch.orderNo || '', |
|
|
|
partNo: this.orderSupplierSearch.partNo || '', |
|
|
|
item: this.orderSupplierSearch.item || '', |
|
|
|
sku: this.orderSupplierSearch.sku || '', |
|
|
|
partDesc: this.orderSupplierSearch.partDesc || '', |
|
|
|
supplierName: this.orderSupplierSearch.supplierName || '' |
|
|
|
} |
|
|
|
this.orderSupplierLoading = true |
|
|
|
queryPoSupplierOrderPage(params).then(({ data }) => { |
|
|
|
if (data.code === 0 && data.page) { |
|
|
|
const list = (data.page.list || []).map(item => ({ |
|
|
|
...item, |
|
|
|
supplierNo: item.supplierNo || item.supplier_no || '', |
|
|
|
supplierName: item.supplierName || item.supplier_name || '', |
|
|
|
crd: item.crd ? String(item.crd).split(' ')[0] : '' |
|
|
|
})) |
|
|
|
this.orderSupplierList = list |
|
|
|
this.orderSupplierTotal = data.page.totalCount || 0 |
|
|
|
this.orderSupplierPageIndex = data.page.currPage || this.orderSupplierPageIndex |
|
|
|
this.orderSupplierPageSize = data.page.pageSize || this.orderSupplierPageSize |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.orderSupplierList.length > 0) { |
|
|
|
this.orderSupplierCurrentRow = this.orderSupplierList[0] |
|
|
|
if (this.$refs.orderSupplierTable) { |
|
|
|
this.$refs.orderSupplierTable.setCurrentRow(this.orderSupplierCurrentRow) |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.orderSupplierCurrentRow = null |
|
|
|
if (this.$refs.orderSupplierTable) { |
|
|
|
this.$refs.orderSupplierTable.setCurrentRow() |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.orderSupplierList = [] |
|
|
|
this.orderSupplierCurrentRow = null |
|
|
|
this.orderSupplierTotal = 0 |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.orderSupplierList = [] |
|
|
|
this.orderSupplierCurrentRow = null |
|
|
|
this.orderSupplierTotal = 0 |
|
|
|
this.$message.error('加载订单来源供应商失败') |
|
|
|
}).finally(() => { |
|
|
|
this.orderSupplierLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 重置“从订单选择供应商”筛选条件 |
|
|
|
resetOrderSupplierSearch () { |
|
|
|
this.orderSupplierSearch = { |
|
|
|
orderNo: '', |
|
|
|
partNo: '', |
|
|
|
item: '', |
|
|
|
sku: '', |
|
|
|
partDesc: '', |
|
|
|
supplierName: '' |
|
|
|
} |
|
|
|
this.orderSupplierPageIndex = 1 |
|
|
|
this.loadOrderSupplierList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 订单来源供应商弹框页大小变化 |
|
|
|
onOrderSupplierPageSizeChange (val) { |
|
|
|
this.orderSupplierPageSize = val |
|
|
|
this.orderSupplierPageIndex = 1 |
|
|
|
this.loadOrderSupplierList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 订单来源供应商弹框页码变化 |
|
|
|
onOrderSupplierPageCurrentChange (val) { |
|
|
|
this.orderSupplierPageIndex = val |
|
|
|
this.loadOrderSupplierList() |
|
|
|
}, |
|
|
|
|
|
|
|
// “从订单选择供应商”选中行变化 |
|
|
|
onOrderSupplierCurrentChange (row) { |
|
|
|
this.orderSupplierCurrentRow = row || null |
|
|
|
}, |
|
|
|
|
|
|
|
// “从订单选择供应商”双击选择 |
|
|
|
onOrderSupplierRowDblClick (row) { |
|
|
|
this.selectSupplierByOrderRow(row) |
|
|
|
}, |
|
|
|
|
|
|
|
// “从订单选择供应商”点击确认 |
|
|
|
confirmOrderSupplierSelect () { |
|
|
|
this.selectSupplierByOrderRow(this.orderSupplierCurrentRow) |
|
|
|
}, |
|
|
|
|
|
|
|
// 从订单行回填供应商并触发原有后续流程 |
|
|
|
selectSupplierByOrderRow (row) { |
|
|
|
if (!row) { |
|
|
|
this.$message.warning('请选择订单行') |
|
|
|
return |
|
|
|
} |
|
|
|
const supplierNo = row.supplierNo || row.supplier_no || '' |
|
|
|
const supplierName = row.supplierName || row.supplier_name || '' |
|
|
|
if (!supplierNo) { |
|
|
|
this.$message.warning('所选订单行缺少供应商编码') |
|
|
|
return |
|
|
|
} |
|
|
|
this.pendingAutoSelectPoRow = { |
|
|
|
orderNo: row.orderNo || row.order_no || '', |
|
|
|
itemNo: row.itemNo || row.item_no || '', |
|
|
|
orderRef1: row.orderRef1 || '', |
|
|
|
orderRef2: row.orderRef2 || '', |
|
|
|
partNo: row.partNo || '' |
|
|
|
} |
|
|
|
this.selectPoSupplier({ |
|
|
|
supplierNo: supplierNo, |
|
|
|
supplierName: supplierName |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 加载PO列表(选择供应商后调用) |
|
|
|
loadPoList () { |
|
|
|
if (!this.addFormData.supplierNo) { |
|
|
|
@ -951,19 +1507,24 @@ export default { |
|
|
|
if (data.code === 0 && data.page) { |
|
|
|
this.poList = data.page.list.map(item => ({ |
|
|
|
...item, |
|
|
|
supplierNo: item.supplierNo || item.supplier_no || this.addFormData.supplierNo || '', |
|
|
|
supplierName: item.supplierName || item.supplier_name || this.addFormData.supplierName || '', |
|
|
|
inspectQty: item.waitInspectQty || 0, // 默认值为未验货数量 |
|
|
|
shipMethod: item.shipMethod || '',// 运输方式 |
|
|
|
crd: item.crd ? item.crd.split(' ')[0] : '' |
|
|
|
})) |
|
|
|
this.filteredPoList = [...this.poList] |
|
|
|
this.filterAddPoList() |
|
|
|
this.applyPendingAutoSelectPoRow() |
|
|
|
} else { |
|
|
|
this.poList = [] |
|
|
|
this.filteredPoList = [] |
|
|
|
this.pendingAutoSelectPoRow = null |
|
|
|
this.$message.info('该供应商暂无可申请验货的PO') |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.poList = [] |
|
|
|
this.filteredPoList = [] |
|
|
|
this.pendingAutoSelectPoRow = null |
|
|
|
this.$message.error('加载PO列表失败') |
|
|
|
}) |
|
|
|
}, |
|
|
|
@ -973,57 +1534,53 @@ export default { |
|
|
|
this.selectedPoList = selection |
|
|
|
}, |
|
|
|
|
|
|
|
// 筛选PO列表 |
|
|
|
filterPoList () { |
|
|
|
// 新增验货申请-PO明细筛选 |
|
|
|
filterAddPoList () { |
|
|
|
let result = [...this.poList] |
|
|
|
|
|
|
|
if (this.poSearchKeyword) { |
|
|
|
const keyword = this.poSearchKeyword.toLowerCase() |
|
|
|
result = result.filter(item => |
|
|
|
(item.orderRef1 && item.orderRef1.toLowerCase().includes(keyword)) || |
|
|
|
(item.partNo && item.partNo.toLowerCase().includes(keyword)) || |
|
|
|
(item.item && item.item.toLowerCase().includes(keyword)) || |
|
|
|
(item.sku && item.sku.toLowerCase().includes(keyword)) |
|
|
|
) |
|
|
|
const filter = this.addPoFilter || {} |
|
|
|
const orderNoKeyword = (filter.orderNo || '').toLowerCase().trim() |
|
|
|
const partNoKeyword = (filter.partNo || '').toLowerCase().trim() |
|
|
|
const itemKeyword = (filter.item || '').toLowerCase().trim() |
|
|
|
const skuKeyword = (filter.sku || '').toLowerCase().trim() |
|
|
|
const partDescKeyword = (filter.partDesc || '').toLowerCase().trim() |
|
|
|
const supplierNameKeyword = (filter.supplierName || '').toLowerCase().trim() |
|
|
|
|
|
|
|
if (orderNoKeyword) { |
|
|
|
result = result.filter(item => { |
|
|
|
const orderRef1 = String(item.orderRef1 || '').toLowerCase() |
|
|
|
const orderNo = String(item.orderNo || item.order_no || '').toLowerCase() |
|
|
|
return orderRef1.includes(orderNoKeyword) || orderNo.includes(orderNoKeyword) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if (this.crdSortOrder) { |
|
|
|
result.sort((a, b) => { |
|
|
|
const dateA = a.crd || '' |
|
|
|
const dateB = b.crd || '' |
|
|
|
|
|
|
|
if (!dateA && !dateB) return 0 |
|
|
|
if (!dateA) return this.crdSortOrder === 'asc' ? -1 : 1 |
|
|
|
if (!dateB) return this.crdSortOrder === 'asc' ? 1 : -1 |
|
|
|
|
|
|
|
if (this.crdSortOrder === 'asc') { |
|
|
|
return dateA.localeCompare(dateB) |
|
|
|
} else { |
|
|
|
return dateB.localeCompare(dateA) |
|
|
|
if (partNoKeyword) { |
|
|
|
result = result.filter(item => String(item.partNo || '').toLowerCase().includes(partNoKeyword)) |
|
|
|
} |
|
|
|
}) |
|
|
|
if (itemKeyword) { |
|
|
|
result = result.filter(item => String(item.item || '').toLowerCase().includes(itemKeyword)) |
|
|
|
} |
|
|
|
|
|
|
|
this.filteredPoList = result |
|
|
|
}, |
|
|
|
|
|
|
|
// 切换CRD日期排序 |
|
|
|
toggleCrdSort () { |
|
|
|
if (!this.crdSortOrder) { |
|
|
|
this.crdSortOrder = 'asc' |
|
|
|
} else if (this.crdSortOrder === 'asc') { |
|
|
|
this.crdSortOrder = 'desc' |
|
|
|
} else { |
|
|
|
this.crdSortOrder = '' |
|
|
|
if (skuKeyword) { |
|
|
|
result = result.filter(item => String(item.sku || '').toLowerCase().includes(skuKeyword)) |
|
|
|
} |
|
|
|
if (partDescKeyword) { |
|
|
|
result = result.filter(item => String(item.partDesc || '').toLowerCase().includes(partDescKeyword)) |
|
|
|
} |
|
|
|
this.filterPoList() |
|
|
|
if (supplierNameKeyword) { |
|
|
|
result = result.filter(item => String(item.supplierName || '').toLowerCase().includes(supplierNameKeyword)) |
|
|
|
} |
|
|
|
this.filteredPoList = result |
|
|
|
}, |
|
|
|
|
|
|
|
// 重置筛选 |
|
|
|
resetPoFilter () { |
|
|
|
this.poSearchKeyword = '' |
|
|
|
this.crdSortOrder = '' |
|
|
|
this.filteredPoList = [...this.poList] |
|
|
|
// 新增验货申请-PO筛选重置 |
|
|
|
resetAddPoFilter () { |
|
|
|
this.addPoFilter = { |
|
|
|
orderNo: '', |
|
|
|
partNo: '', |
|
|
|
item: '', |
|
|
|
sku: '', |
|
|
|
partDesc: '', |
|
|
|
supplierName: '' |
|
|
|
} |
|
|
|
this.filterAddPoList() |
|
|
|
}, |
|
|
|
|
|
|
|
// CRD日期排序方法 |
|
|
|
@ -1598,4 +2155,16 @@ export default { |
|
|
|
.choose-label:hover { |
|
|
|
text-decoration: underline; |
|
|
|
} |
|
|
|
|
|
|
|
.po-supplier-search-form { |
|
|
|
margin-bottom: 8px; |
|
|
|
} |
|
|
|
|
|
|
|
.order-supplier-search-form { |
|
|
|
margin-bottom: 8px; |
|
|
|
} |
|
|
|
|
|
|
|
.add-po-search-form { |
|
|
|
margin-bottom: 8px; |
|
|
|
} |
|
|
|
</style> |