|
|
<template> <div class="mod-config supplier-new-product-history"> <el-form :inline="true" label-position="top" class="history-search-form" :model="searchData"> <el-form-item label="ShortOffice"> <el-input v-model.trim="searchData.shortOffice" clearable placeholder="ShortOffice" @keyup.enter.native="handleSearch" /> </el-form-item> <el-form-item label="ShortNpc"> <el-input v-model.trim="searchData.shortNpc" clearable placeholder="ShortNpc" @keyup.enter.native="handleSearch" /> </el-form-item> <el-form-item label="基准料号"> <el-input v-model.trim="searchData.basePartNo" clearable placeholder="基准料号" @keyup.enter.native="handleSearch" /> </el-form-item> <el-form-item label="SKU"> <el-input v-model.trim="searchData.sku" clearable placeholder="SKU" @keyup.enter.native="handleSearch" /> </el-form-item> <el-form-item label="订单日期"> <span class="history-date-pair"> <el-date-picker v-model="searchData.orderDateStart" type="date" placeholder="Start Date" value-format="yyyy-MM-dd" style="width:130px" /> <span class="history-date-sep">-</span> <el-date-picker v-model="searchData.orderDateEnd" type="date" placeholder="End Date" value-format="yyyy-MM-dd" style="width:130px" /> </span> </el-form-item> <el-form-item label=" "> <el-button type="primary" :loading="loading" @click="handleSearch">查询</el-button> <el-button @click="resetSearch">重置</el-button> </el-form-item> </el-form>
<el-table :data="rows" :height="tableHeight" border stripe v-loading="loading" style="width:100%"> <el-table-column prop="shortOffice" label="ShortOffice" min-width="135" show-overflow-tooltip /> <el-table-column prop="shortNpc" label="ShortNpc" min-width="135" show-overflow-tooltip /> <el-table-column prop="basePartNo" label="基准料号" min-width="155" show-overflow-tooltip /> <el-table-column prop="sku" label="SKU" min-width="155" show-overflow-tooltip /> <el-table-column prop="partNo" label="物料号" min-width="175" show-overflow-tooltip /> <el-table-column prop="firstOrderNo" label="首次订单号" min-width="145" show-overflow-tooltip /> <el-table-column prop="itemNo" label="行号" min-width="70" align="center" /> <el-table-column prop="oriOrderDate" label="订单日期" min-width="115" align="center" /> <el-table-column prop="createTime" label="系统计算日期" min-width="175" align="center" /> </el-table>
<el-pagination :current-page="pageIndex" :page-size="pageSize" :page-sizes="[20, 50, 100, 200, 500]" :total="totalCount" layout="total, sizes, prev, pager, next, jumper" @size-change="sizeChangeHandle" @current-change="currentChangeHandle" /> </div></template>
<script>import { searchSupplierNewProductHistoryPage } from '@/api/order/supplierNewProductHistory.js'
const emptySearch = () => ({ shortOffice: '', shortNpc: '', basePartNo: '', sku: '', orderDateStart: '', orderDateEnd: ''})
export default { name: 'supplierNewProductHistory', data () { return { searchData: emptySearch(), rows: [], loading: false, pageIndex: 1, pageSize: 20, totalCount: 0, tableHeight: 400 } }, mounted () { this.updateTableHeight() window.addEventListener('resize', this.updateTableHeight) this.getDataList() }, beforeDestroy () { window.removeEventListener('resize', this.updateTableHeight) }, methods: { updateTableHeight () { this.tableHeight = Math.max(300, window.innerHeight - 250) }, handleSearch () { const { orderDateStart, orderDateEnd } = this.searchData if (orderDateStart && orderDateEnd && orderDateStart > orderDateEnd) { this.$message.warning('订单日期开始不能晚于结束') return } this.pageIndex = 1 this.getDataList() }, resetSearch () { this.searchData = emptySearch() this.pageIndex = 1 this.getDataList() }, getDataList () { this.loading = true searchSupplierNewProductHistoryPage({ ...this.searchData, page: this.pageIndex, limit: this.pageSize }).then(({ data }) => { if (!data || data.code !== 0) { this.$message.error((data && data.msg) || '查询失败') this.rows = [] this.totalCount = 0 return } const page = data.page || {} this.rows = page.list || [] this.totalCount = page.totalCount || 0 }).catch(err => { this.rows = [] this.totalCount = 0 this.$message.error((err && err.message) || '查询失败') }).finally(() => { this.loading = false }) }, sizeChangeHandle (size) { this.pageSize = size this.pageIndex = 1 this.getDataList() }, currentChangeHandle (page) { this.pageIndex = page this.getDataList() } }}</script>
<style scoped>.history-search-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 2px 12px; margin-bottom: 12px;}.history-search-form /deep/ .el-form-item { margin: 0;}.history-search-form /deep/ .el-input { width: 130px;}.history-date-pair { display: inline-flex; align-items: center;}.history-date-sep { width: 12px; text-align: center;}</style>
|