5 changed files with 478 additions and 2 deletions
-
6src/api/srm/srmSupplier.js
-
2src/api/supplier/supplierPartMoqPrice.js
-
37src/views/modules/order/poOrder.vue
-
288src/views/modules/srmSupplier/supplierAvlList.vue
-
147src/views/modules/supplier/supplierPartMoqPrice.vue
@ -0,0 +1,288 @@ |
|||||
|
<template> |
||||
|
<div ref="pageRoot" class="customer-css"> |
||||
|
<el-form :inline="true" label-position="top" style="margin-top: 0;"> |
||||
|
<el-form-item label="物料分类名称:"> |
||||
|
<el-input v-model="searchData.familyName" clearable style="width: 160px" /> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="分类级别:"> |
||||
|
<el-select v-model="searchData.familyType" style="width: 120px"> |
||||
|
<el-option v-for="item in familyLevelOptions" :key="item.value" :label="item.label" :value="item.value" /> |
||||
|
</el-select> |
||||
|
</el-form-item> |
||||
|
<el-form-item label=" "> |
||||
|
<el-button type="primary" @click="getFamilyList">查询</el-button> |
||||
|
</el-form-item> |
||||
|
</el-form> |
||||
|
|
||||
|
<el-table |
||||
|
ref="familyTable" |
||||
|
:height="topHeight" |
||||
|
:data="familyRows" |
||||
|
border |
||||
|
highlight-current-row |
||||
|
v-loading="familyLoading" |
||||
|
style="width: 100%" |
||||
|
@row-click="onFamilyRowClick"> |
||||
|
<el-table-column prop="familyId" label="物料分类编码" header-align="center" align="left" min-width="160" /> |
||||
|
<el-table-column prop="familyName" label="物料分类名称" header-align="center" align="left" min-width="220" /> |
||||
|
<el-table-column label="分类级别" header-align="center" align="center" min-width="110"> |
||||
|
<template slot-scope="scope"> |
||||
|
<span>{{ formatFamilyType(scope.row.familyType) }}</span> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<el-table |
||||
|
:height="bottomHeight" |
||||
|
:data="supplierRows" |
||||
|
border |
||||
|
v-loading="supplierLoading" |
||||
|
style="margin-top: 8px; width: 100%"> |
||||
|
<el-table-column prop="supplierNo" label="供应商编码" header-align="center" align="left" min-width="160" /> |
||||
|
<el-table-column prop="supplierName" label="供应商名称" header-align="center" align="left" min-width="260" /> |
||||
|
<el-table-column label="操作" fixed="right" header-align="center" align="center" width="140"> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-link type="primary" @click="openPartDialog(scope.row)">查看可供物料</el-link> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
|
||||
|
<el-dialog |
||||
|
title="可供物料" |
||||
|
:visible.sync="partDialogVisible" |
||||
|
width="960px" |
||||
|
top="4vh" |
||||
|
append-to-body |
||||
|
:close-on-click-modal="false" |
||||
|
v-drag> |
||||
|
<el-table |
||||
|
:data="partRows" |
||||
|
:height="430" |
||||
|
border |
||||
|
v-loading="partDialogLoading" |
||||
|
style="width: 100%"> |
||||
|
<el-table-column prop="partNo" label="产品编码" header-align="center" align="left" min-width="170" /> |
||||
|
<el-table-column prop="partDesc" label="产品名称" header-align="center" align="left" min-width="260" /> |
||||
|
<el-table-column prop="basePartNo" label="基准料号" header-align="center" align="left" min-width="150" /> |
||||
|
<el-table-column prop="sku" label="SKU" header-align="center" align="left" min-width="120" /> |
||||
|
<el-table-column prop="item" label="Item" header-align="center" align="left" min-width="120" /> |
||||
|
</el-table> |
||||
|
<el-pagination |
||||
|
style="margin-top: 8px; text-align: right" |
||||
|
@size-change="onPartPageSizeChange" |
||||
|
@current-change="onPartPageCurrentChange" |
||||
|
:current-page="partPageIndex" |
||||
|
:page-sizes="[20, 50, 100, 200]" |
||||
|
:page-size="partPageSize" |
||||
|
:total="partTotal" |
||||
|
layout="total, sizes, prev, pager, next, jumper" |
||||
|
/> |
||||
|
<div slot="footer" class="dialog-footer"> |
||||
|
<el-button @click="partDialogVisible = false">关闭</el-button> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { |
||||
|
searchAvlFamilyList, |
||||
|
searchAvlSupplierList, |
||||
|
searchAvlSupplierPartListPage |
||||
|
} from '@/api/srm/srmSupplier' |
||||
|
|
||||
|
export default { |
||||
|
data () { |
||||
|
return { |
||||
|
topHeight: 280, |
||||
|
bottomHeight: 280, |
||||
|
familyLoading: false, |
||||
|
supplierLoading: false, |
||||
|
partDialogLoading: false, |
||||
|
searchData: { |
||||
|
site: this.$store.state.user.site, |
||||
|
familyName: '', |
||||
|
familyType: 'level1' |
||||
|
}, |
||||
|
familyLevelOptions: [ |
||||
|
{ label: '一级', value: 'level1' }, |
||||
|
{ label: '二级', value: 'level2' }, |
||||
|
{ label: '三级', value: 'level3' } |
||||
|
], |
||||
|
familyRows: [], |
||||
|
currentFamilyRow: null, |
||||
|
supplierRows: [], |
||||
|
partDialogVisible: false, |
||||
|
partRows: [], |
||||
|
partPageIndex: 1, |
||||
|
partPageSize: 20, |
||||
|
partTotal: 0, |
||||
|
partDialogSupplierNo: '' |
||||
|
} |
||||
|
}, |
||||
|
created () { |
||||
|
this.getFamilyList() |
||||
|
}, |
||||
|
mounted () { |
||||
|
this.handleResize() |
||||
|
window.addEventListener('resize', this.handleResize) |
||||
|
}, |
||||
|
beforeDestroy () { |
||||
|
window.removeEventListener('resize', this.handleResize) |
||||
|
}, |
||||
|
methods: { |
||||
|
handleResize () { |
||||
|
this.$nextTick(() => { |
||||
|
const rootEl = this.$refs.pageRoot || this.$el |
||||
|
if (!rootEl) { |
||||
|
return |
||||
|
} |
||||
|
const rootTop = rootEl.getBoundingClientRect().top |
||||
|
const viewportBottomGap = 24 |
||||
|
const available = window.innerHeight - rootTop - viewportBottomGap |
||||
|
const nextTop = Math.max(220, Math.floor(available * 0.43)) |
||||
|
const nextBottom = Math.max(220, available - nextTop - 74) |
||||
|
this.topHeight = nextTop |
||||
|
this.bottomHeight = nextBottom |
||||
|
}) |
||||
|
}, |
||||
|
formatFamilyType (familyType) { |
||||
|
if (familyType === 'level2') return '二级' |
||||
|
if (familyType === 'level3') return '三级' |
||||
|
return '一级' |
||||
|
}, |
||||
|
getFamilyList () { |
||||
|
const site = (this.searchData.site || this.$store.state.user.site || '').trim() |
||||
|
if (!site) { |
||||
|
this.$message.warning('请先选择site') |
||||
|
return |
||||
|
} |
||||
|
this.familyLoading = true |
||||
|
searchAvlFamilyList({ |
||||
|
site, |
||||
|
familyName: this.searchData.familyName, |
||||
|
familyType: this.searchData.familyType |
||||
|
}).then(({ data }) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.familyRows = data.rows || [] |
||||
|
if (this.familyRows.length > 0) { |
||||
|
this.currentFamilyRow = this.familyRows[0] |
||||
|
this.$nextTick(() => { |
||||
|
if (this.$refs.familyTable && this.$refs.familyTable.setCurrentRow) { |
||||
|
this.$refs.familyTable.setCurrentRow(this.familyRows[0]) |
||||
|
} |
||||
|
}) |
||||
|
this.loadSupplierList() |
||||
|
} else { |
||||
|
this.currentFamilyRow = null |
||||
|
this.supplierRows = [] |
||||
|
} |
||||
|
return |
||||
|
} |
||||
|
this.familyRows = [] |
||||
|
this.currentFamilyRow = null |
||||
|
this.supplierRows = [] |
||||
|
this.$message.error((data && data.msg) || '查询物料分类失败') |
||||
|
}).catch(() => { |
||||
|
this.familyRows = [] |
||||
|
this.currentFamilyRow = null |
||||
|
this.supplierRows = [] |
||||
|
this.$message.error('查询物料分类失败') |
||||
|
}).finally(() => { |
||||
|
this.familyLoading = false |
||||
|
}) |
||||
|
}, |
||||
|
onFamilyRowClick (row) { |
||||
|
this.currentFamilyRow = row || null |
||||
|
this.loadSupplierList() |
||||
|
}, |
||||
|
loadSupplierList () { |
||||
|
if (!this.currentFamilyRow || !this.currentFamilyRow.familyId) { |
||||
|
this.supplierRows = [] |
||||
|
return |
||||
|
} |
||||
|
this.supplierLoading = true |
||||
|
searchAvlSupplierList({ |
||||
|
site: this.searchData.site, |
||||
|
familyType: this.currentFamilyRow.familyType || this.searchData.familyType, |
||||
|
familyId: this.currentFamilyRow.familyId |
||||
|
}).then(({ data }) => { |
||||
|
if (data && data.code === 0) { |
||||
|
this.supplierRows = data.rows || [] |
||||
|
return |
||||
|
} |
||||
|
this.supplierRows = [] |
||||
|
this.$message.error((data && data.msg) || '查询供应商清单失败') |
||||
|
}).catch(() => { |
||||
|
this.supplierRows = [] |
||||
|
this.$message.error('查询供应商清单失败') |
||||
|
}).finally(() => { |
||||
|
this.supplierLoading = false |
||||
|
}) |
||||
|
}, |
||||
|
openPartDialog (row) { |
||||
|
if (!row || !row.supplierNo) { |
||||
|
this.$message.warning('请选择供应商') |
||||
|
return |
||||
|
} |
||||
|
if (!this.currentFamilyRow || !this.currentFamilyRow.familyId) { |
||||
|
this.$message.warning('请先选择物料分类') |
||||
|
return |
||||
|
} |
||||
|
this.partDialogSupplierNo = row.supplierNo |
||||
|
this.partPageIndex = 1 |
||||
|
this.partDialogVisible = true |
||||
|
this.loadPartPage() |
||||
|
}, |
||||
|
loadPartPage () { |
||||
|
if (!this.partDialogSupplierNo || !this.currentFamilyRow || !this.currentFamilyRow.familyId) { |
||||
|
this.partRows = [] |
||||
|
this.partTotal = 0 |
||||
|
return |
||||
|
} |
||||
|
this.partDialogLoading = true |
||||
|
searchAvlSupplierPartListPage({ |
||||
|
site: this.searchData.site, |
||||
|
familyType: this.currentFamilyRow.familyType || this.searchData.familyType, |
||||
|
familyId: this.currentFamilyRow.familyId, |
||||
|
supplierNo: this.partDialogSupplierNo, |
||||
|
page: this.partPageIndex, |
||||
|
limit: this.partPageSize |
||||
|
}).then(({ data }) => { |
||||
|
if (data && data.code === 0) { |
||||
|
const pageData = data.page || {} |
||||
|
this.partRows = Array.isArray(pageData.list) ? pageData.list : [] |
||||
|
this.partPageIndex = Number(pageData.currPage || this.partPageIndex || 1) |
||||
|
this.partPageSize = Number(pageData.pageSize || this.partPageSize || 20) |
||||
|
this.partTotal = Number(pageData.totalCount || 0) |
||||
|
return |
||||
|
} |
||||
|
this.partRows = [] |
||||
|
this.partTotal = 0 |
||||
|
this.$message.error((data && data.msg) || '查询可供物料失败') |
||||
|
}).catch(() => { |
||||
|
this.partRows = [] |
||||
|
this.partTotal = 0 |
||||
|
this.$message.error('查询可供物料失败') |
||||
|
}).finally(() => { |
||||
|
this.partDialogLoading = false |
||||
|
}) |
||||
|
}, |
||||
|
onPartPageSizeChange (val) { |
||||
|
this.partPageSize = Number(val) || 20 |
||||
|
this.partPageIndex = 1 |
||||
|
this.loadPartPage() |
||||
|
}, |
||||
|
onPartPageCurrentChange (val) { |
||||
|
this.partPageIndex = Number(val) || 1 |
||||
|
this.loadPartPage() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped lang="scss"> |
||||
|
/deep/ .el-table__fixed-right-patch { |
||||
|
display: none !important; |
||||
|
} |
||||
|
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue