3 changed files with 1435 additions and 0 deletions
-
15src/api/supplier/supplierPartMoqPrice.js
-
1068src/views/modules/supplier/supplierPartMoqPrice.vue
-
352src/views/modules/supplier/supplierPartTierPriceHistory.vue
@ -0,0 +1,15 @@ |
|||
import { createAPI } from '@/utils/httpRequest.js' |
|||
|
|||
// 供应商可供物料与MOQ接口 - rqrq
|
|||
export const listSupplierPartMoq = data => createAPI('/supplier/supplierPartMoqPrice/listSupplierPart', 'post', data) |
|||
export const saveSupplierPartMoq = data => createAPI('/supplier/supplierPartMoqPrice/saveSupplierPart', 'post', data) |
|||
export const addSupplierPartMoq = data => createAPI('/supplier/supplierPartMoqPrice/addSupplierPart', 'post', data) |
|||
|
|||
// 阶梯价接口 - rqrq
|
|||
export const listCurrentTierPrice = data => createAPI('/supplier/supplierPartMoqPrice/listCurrentTierPrice', 'post', data) |
|||
export const saveTierPrice = data => createAPI('/supplier/supplierPartMoqPrice/saveTierPrice', 'post', data) |
|||
export const uploadTierPricePreview = data => createAPI('/supplier/supplierPartMoqPrice/uploadPreview', 'post', data) |
|||
export const uploadTierPriceConfirm = data => createAPI('/supplier/supplierPartMoqPrice/uploadConfirm', 'post', data) |
|||
export const listTierPriceHistory = data => createAPI('/supplier/supplierPartMoqPrice/listTierPriceHistory', 'post', data) |
|||
export const listTierPriceHistoryMain = data => createAPI('/supplier/supplierPartMoqPrice/listTierPriceHistoryMain', 'post', data) |
|||
export const listTierPriceHistoryDetail = data => createAPI('/supplier/supplierPartMoqPrice/listTierPriceHistoryDetail', 'post', data) |
|||
1068
src/views/modules/supplier/supplierPartMoqPrice.vue
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,352 @@ |
|||
<template> |
|||
<div class="customer-css supplier-part-tier-price-history"> |
|||
<el-form :inline="true" label-position="top" class="pi-search-form"> |
|||
<el-form-item> |
|||
<span slot="label" style="" @click="getBaseList(520, 'search')"><a href="javascript:void(0)">供应商编号</a></span> |
|||
<el-input |
|||
v-model="searchData.supplierNo" |
|||
placeholder="选择或输入编号" |
|||
style="width: 180px" |
|||
clearable |
|||
@keyup.enter.native="searchMainList" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item> |
|||
<span slot="label" style="" @click="getBaseList(507, 'search')"><a href="javascript:void(0)">物料编码</a></span> |
|||
<el-input |
|||
v-model="searchData.partNo" |
|||
placeholder="选择或输入物料编码" |
|||
style="width: 180px" |
|||
clearable |
|||
@keyup.enter.native="searchMainList" |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label="价格日期"> |
|||
<el-date-picker |
|||
v-model="searchData.priceDate" |
|||
type="date" |
|||
value-format="yyyy-MM-dd" |
|||
format="yyyy-MM-dd" |
|||
placeholder="价格日期" |
|||
style="width: 150px" |
|||
clearable |
|||
/> |
|||
</el-form-item> |
|||
<el-form-item label=" "> |
|||
<el-button type="primary" class="customer-bun-min" :loading="mainLoading" @click="searchMainList">查询</el-button> |
|||
<el-button class="customer-bun-min" @click="resetSearch">重置</el-button> |
|||
</el-form-item> |
|||
</el-form> |
|||
|
|||
<el-table |
|||
ref="mainTable" |
|||
:data="historyMainList" |
|||
:height="mainTableHeight" |
|||
border |
|||
stripe |
|||
highlight-current-row |
|||
v-loading="mainLoading" |
|||
style="width: 100%" |
|||
@row-click="handleMainRowClick" |
|||
> |
|||
<el-table-column fixed="right" label="操作" width="90" header-align="center" align="center"> |
|||
<template slot-scope="scope"> |
|||
<el-link style="cursor: pointer" @click.stop="openAttachmentDialog(scope.row)">查看附件</el-link> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="supplierCode" label="供应商编号" min-width="120" header-align="center" align="center" /> |
|||
<el-table-column prop="supplierName" label="供应商名称" min-width="180" header-align="center" align="left" show-overflow-tooltip /> |
|||
<el-table-column prop="currencyDesc" label="币种描述" min-width="120" header-align="center" align="center" :formatter="formatCurrencyDesc" /> |
|||
<el-table-column prop="partNo" label="物料编码" min-width="140" header-align="center" align="center" /> |
|||
<el-table-column prop="partDesc" label="物料名称" min-width="180" header-align="center" align="left" show-overflow-tooltip /> |
|||
<el-table-column prop="versionNo" label="价格版本号" min-width="180" header-align="center" align="center" /> |
|||
<el-table-column prop="submitDateOnly" label="上传日期" min-width="120" header-align="center" align="center" /> |
|||
<el-table-column prop="priceDate" label="价格日期" min-width="120" header-align="center" align="center" /> |
|||
<el-table-column prop="submitBy" label="提交人" min-width="100" header-align="center" align="center" /> |
|||
</el-table> |
|||
|
|||
<div class="table-toolbar"> |
|||
<span class="selected-text"> |
|||
当前选择: |
|||
{{ selectedMain ? `${selectedMain.supplierCode} / ${selectedMain.partNo} ` : '未选择历史主记录' }} |
|||
</span> |
|||
</div> |
|||
|
|||
<el-table |
|||
:data="historyDetailList" |
|||
:height="detailTableHeight" |
|||
border |
|||
stripe |
|||
v-loading="detailLoading" |
|||
style="width: 100%" |
|||
|
|||
> |
|||
<el-table-column prop="qtyStart" label="开始数量" min-width="110" header-align="center" align="right" :formatter="formatNumberCell" /> |
|||
<el-table-column prop="qtyEnd" label="结束数量" min-width="110" header-align="center" align="right" :formatter="formatNumberCell" /> |
|||
<el-table-column prop="unitPrice" label="单价" min-width="120" header-align="center" align="right" :formatter="formatNumberCell" /> |
|||
<el-table-column prop="remark" label="备注" min-width="200" header-align="center" align="left" show-overflow-tooltip /> |
|||
</el-table> |
|||
|
|||
<el-dialog |
|||
title="历史附件" |
|||
:visible.sync="attachmentDialogVisible" |
|||
width="900px" |
|||
:close-on-click-modal="false" |
|||
v-drag |
|||
> |
|||
<el-table :data="attachmentList" :height="360" border stripe v-loading="attachmentLoading" style="width: 100%"> |
|||
<el-table-column prop="fileName" label="文件名" min-width="260" header-align="center" align="left" show-overflow-tooltip /> |
|||
<el-table-column prop="createdBy" label="上传人" min-width="120" header-align="center" align="center" /> |
|||
<el-table-column prop="createDate" label="上传时间" min-width="160" header-align="center" align="center" /> |
|||
<el-table-column label="操作" width="90" header-align="center" align="center" fixed="right"> |
|||
<template slot-scope="scope"> |
|||
<el-link style="cursor: pointer" @click="downloadAttachment(scope.row)">下载</el-link> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
<div slot="footer" class="dialog-footer"> |
|||
<el-button type="primary" @click="attachmentDialogVisible = false">关闭</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
<Chooselist ref="baseList" @getBaseData="getBaseData" /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Chooselist from '@/views/modules/common/Chooselist_eam' |
|||
import { |
|||
listTierPriceHistoryMain, |
|||
listTierPriceHistoryDetail |
|||
} from '@/api/supplier/supplierPartMoqPrice' |
|||
import { queryOssFilePlus, downLoadObjectFile } from '@/api/oss/oss' |
|||
|
|||
export default { |
|||
name: 'SupplierPartTierPriceHistory', |
|||
components: { Chooselist }, |
|||
data () { |
|||
return { |
|||
mainTableHeight: 260, |
|||
detailTableHeight: 260, |
|||
tagNo: '', |
|||
tagType: 'search', |
|||
searchData: { |
|||
site: this.$store.state.user.site, |
|||
supplierNo: '', |
|||
partNo: '', |
|||
priceDate: '' |
|||
}, |
|||
mainLoading: false, |
|||
detailLoading: false, |
|||
historyMainList: [], |
|||
selectedMain: null, |
|||
historyDetailList: [], |
|||
attachmentDialogVisible: false, |
|||
attachmentLoading: false, |
|||
attachmentList: [], |
|||
attachmentRefIds: [] |
|||
} |
|||
}, |
|||
mounted () { |
|||
this.handleResize() |
|||
window.addEventListener('resize', this.handleResize) |
|||
}, |
|||
beforeDestroy () { |
|||
window.removeEventListener('resize', this.handleResize) |
|||
}, |
|||
methods: { |
|||
handleResize () { |
|||
const availableHeight = window.innerHeight - 260 |
|||
this.mainTableHeight = Math.max(220, Math.floor(availableHeight * 0.45)) |
|||
this.detailTableHeight = Math.max(220, Math.floor(availableHeight * 0.45)) |
|||
}, |
|||
getBaseList (val, type) { |
|||
this.tagNo = val |
|||
this.tagType = type || 'search' |
|||
this.$nextTick(() => { |
|||
let strVal = '' |
|||
let conSql = '' |
|||
if (val === 520) { |
|||
strVal = this.searchData.supplierNo || '' |
|||
conSql = " and site = '" + this.$store.state.user.site + "'" |
|||
} |
|||
if (val === 507) { |
|||
strVal = this.searchData.partNo || '' |
|||
conSql = " and site = '" + this.$store.state.user.site + "'" |
|||
} |
|||
this.$refs.baseList.init(val, strVal, conSql) |
|||
}) |
|||
}, |
|||
getBaseData (val) { |
|||
if (this.tagNo === 520) { |
|||
this.searchData.supplierNo = val.supplier_no || '' |
|||
} |
|||
if (this.tagNo === 507) { |
|||
this.searchData.partNo = val.part_no || '' |
|||
} |
|||
}, |
|||
resetSearch () { |
|||
this.searchData = { |
|||
site: this.$store.state.user.site, |
|||
supplierNo: '', |
|||
partNo: '', |
|||
priceDate: '' |
|||
} |
|||
this.historyMainList = [] |
|||
this.selectedMain = null |
|||
this.historyDetailList = [] |
|||
}, |
|||
searchMainList () { |
|||
this.mainLoading = true |
|||
const inData = { |
|||
site: this.$store.state.user.site, |
|||
supplierCode: (this.searchData.supplierNo || '').trim(), |
|||
partNo: (this.searchData.partNo || '').trim(), |
|||
priceDate: this.searchData.priceDate || '' |
|||
} |
|||
listTierPriceHistoryMain(inData).then(({ data }) => { |
|||
if (data && data.code === 0) { |
|||
this.historyMainList = data.rows || [] |
|||
this.selectedMain = null |
|||
this.historyDetailList = [] |
|||
if (this.historyMainList.length > 0) { |
|||
this.$refs.mainTable.setCurrentRow(this.historyMainList[0]) |
|||
this.handleMainRowClick(this.historyMainList[0]) |
|||
} |
|||
} else { |
|||
this.historyMainList = [] |
|||
this.$alert((data && data.msg) || '查询失败', '错误', { confirmButtonText: '确定' }) |
|||
} |
|||
}).catch(() => { |
|||
this.historyMainList = [] |
|||
this.$message.error('查询失败') |
|||
}).finally(() => { |
|||
this.mainLoading = false |
|||
}) |
|||
}, |
|||
handleMainRowClick (row) { |
|||
this.selectedMain = row ? JSON.parse(JSON.stringify(row)) : null |
|||
this.loadDetailList() |
|||
}, |
|||
loadDetailList () { |
|||
if (!this.selectedMain || !this.selectedMain.id) { |
|||
this.historyDetailList = [] |
|||
return |
|||
} |
|||
this.detailLoading = true |
|||
const inData = { |
|||
site: this.$store.state.user.site, |
|||
historyMainId: this.selectedMain.id |
|||
} |
|||
listTierPriceHistoryDetail(inData).then(({ data }) => { |
|||
if (data && data.code === 0) { |
|||
this.historyDetailList = data.rows || [] |
|||
} else { |
|||
this.historyDetailList = [] |
|||
this.$alert((data && data.msg) || '明细查询失败', '错误', { confirmButtonText: '确定' }) |
|||
} |
|||
}).catch(() => { |
|||
this.historyDetailList = [] |
|||
this.$message.error('明细查询失败') |
|||
}).finally(() => { |
|||
this.detailLoading = false |
|||
}) |
|||
}, |
|||
openAttachmentDialog (row) { |
|||
this.attachmentDialogVisible = true |
|||
this.attachmentRefIds = this.parseAttachmentRefs((row && row.attachmentRefs) || '') |
|||
this.fetchAttachmentList(row) |
|||
}, |
|||
buildAttachmentQueryParams (row) { |
|||
return { |
|||
orderRef1: row.site || this.$store.state.user.site, |
|||
orderRef2: row.supplierCode || '', |
|||
orderRef3: row.partNo || '', |
|||
orderRef4: this.toDateStr(row.priceDate), |
|||
orderReftype: 'SUPPLIER_PART_PRICE' |
|||
} |
|||
}, |
|||
toDateStr (val) { |
|||
if (!val) return '' |
|||
if (typeof val === 'string') { |
|||
return val.length >= 10 ? val.slice(0, 10) : val |
|||
} |
|||
if (this.dayjs) { |
|||
return this.dayjs(val).format('YYYY-MM-DD') |
|||
} |
|||
const date = new Date(val) |
|||
if (Number.isNaN(date.getTime())) return '' |
|||
const pad = num => String(num).padStart(2, '0') |
|||
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}` |
|||
}, |
|||
normalizeNumberValue (value, defaultValue = 0) { |
|||
if (value === null || value === undefined || value === '') return defaultValue |
|||
const num = Number(value) |
|||
if (Number.isNaN(num)) return defaultValue |
|||
return Object.is(num, -0) ? 0 : num |
|||
}, |
|||
formatNumberCell (row, column, cellValue) { |
|||
return String(this.normalizeNumberValue(cellValue, 0)) |
|||
}, |
|||
formatCurrencyDesc (row) { |
|||
if (!row) return '' |
|||
return row.currencyDesc || row.currency || '' |
|||
}, |
|||
fetchAttachmentList (row) { |
|||
const params = this.buildAttachmentQueryParams(row || {}) |
|||
const refIdSet = new Set((this.attachmentRefIds || []).map(item => String(item))) |
|||
this.attachmentLoading = true |
|||
queryOssFilePlus(params).then(({ data }) => { |
|||
if (data && data.code === 0) { |
|||
const allRows = data.rows || [] |
|||
this.attachmentList = refIdSet.size > 0 |
|||
? allRows.filter(item => refIdSet.has(String(item.id))) |
|||
: [] |
|||
} else { |
|||
this.attachmentList = [] |
|||
} |
|||
}).catch(() => { |
|||
this.attachmentList = [] |
|||
}).finally(() => { |
|||
this.attachmentLoading = false |
|||
}) |
|||
}, |
|||
downloadAttachment (row) { |
|||
downLoadObjectFile(row).then(({ data }) => { |
|||
const blob = new Blob([data], { type: 'application/octet-stream;charset=utf-8' }) |
|||
const linkNode = document.createElement('a') |
|||
linkNode.download = row.fileName || 'download' |
|||
linkNode.style.display = 'none' |
|||
linkNode.href = URL.createObjectURL(blob) |
|||
document.body.appendChild(linkNode) |
|||
linkNode.click() |
|||
URL.revokeObjectURL(linkNode.href) |
|||
document.body.removeChild(linkNode) |
|||
}).catch(() => { |
|||
this.$message.error('下载失败') |
|||
}) |
|||
}, |
|||
parseAttachmentRefs (refs) { |
|||
if (!refs) return [] |
|||
return String(refs) |
|||
.split(',') |
|||
.map(item => item.trim()) |
|||
.filter(item => item !== '') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.supplier-part-tier-price-history .table-toolbar { |
|||
margin: 8px 0; |
|||
display: flex; |
|||
justify-content: space-between; |
|||
align-items: center; |
|||
} |
|||
|
|||
.supplier-part-tier-price-history .selected-text { |
|||
font-size: 13px; |
|||
color: #606266; |
|||
} |
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue