|
|
<template> <div class="mod-config"> <el-form :inline="true" label-position="top" :model="searchData" @keyup.enter.native="getDataList()"> <el-form-item :label="'库位编码'"> <el-input v-model="searchData.locationId" clearable style="width: 120px"></el-input> </el-form-item> <el-form-item :label="'库位名称'"> <el-input v-model="searchData.locationName" clearable style="width: 210px"></el-input> </el-form-item> <el-form-item :label="'仓库'"> <el-input v-model="searchData.warehouseId" clearable style="width: 210px"></el-input> </el-form-item> <el-form-item :label="'库位类型'"> <el-select clearable v-model="searchData.locationType" style="width: 120px"> <el-option label="Picking" value="Picking"></el-option> <el-option label="Arrival" value="Arrival"></el-option> <el-option label="Floor stock" value="Floor stock"></el-option> <el-option label="Shipment" value="Shipment"></el-option> </el-select> </el-form-item> <el-form-item :label="' '"> <el-button type="primary" @click="getDataList()">查询</el-button> <download-excel :fields="fields()" :data="exportData" type="xls" :name="exportName" :header="exportHeader" :footer="exportFooter" :fetch="createExportData" :before-generate="startDownload" :before-finish="finishDownload" worksheet="导出信息" class="el-button el-button--primary el-button--medium"> {{ "导出" }} </download-excel> </el-form-item> </el-form>
<el-table :height="height" :data="dataList" border style="width: 100%;"> <el-table-column v-for="(item,index) in columnList" :key="index" :sortable="item.columnSortable" :prop="item.columnProp" :header-align="item.headerAlign" :show-overflow-tooltip="item.showOverflowTooltip" :align="item.align" :fixed="item.fixed==''?false:item.fixed" :min-width="item.columnWidth" :label="item.columnLabel"> <template slot-scope="scope"> <span v-if="!item.columnHidden">{{ scope.row[item.columnProp] }}</span> <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span> </template> </el-table-column> </el-table>
<!-- 分页栏 --> <el-pagination style="margin-top: 0px" @size-change="sizeChangeHandle" @current-change="currentChangeHandle" :current-page="pageIndex" :page-sizes="[20, 50, 100, 200, 500]" :page-size="pageSize" :total="totalPage" layout="total, sizes, prev, pager, next, jumper"> </el-pagination> </div></template>
<script>import { locationInformationSearch, // 库位信息列表查询
} from '@/api/part/partInformation.js'import Chooselist from '@/views/modules/common/Chooselist'export default { components: { Chooselist }, watch: { searchData: { deep: true, handler: function (newV, oldV) { this.searchData.locationId = this.searchData.locationId.toUpperCase() } }, }, data () { return { // 导出
exportData: [], exportName: '库位' + this.dayjs().format('YYYYMMDDHHmmss'), exportHeader: ['库位'], exportFooter: [], resultList: [], // ======== 行高 ========
height: 200, // ======== 分页 ========
pageIndex: 1, pageSize: 50, totalPage: 0, // 条件查询
searchData: { site: this.$store.state.user.site, locationId: '', locationName: '', warehouseId: '', locationType: '', active: '', page: 1, limit: 10 }, // ======== 数据列表 ========
dataList: [], // 展示列集
columnList: [ { userId: this.$store.state.user.name, functionId: 104009, serialNumber: '104009Table1LocationId', tableId: "104009Table1", tableName: "库位信息表", columnProp: 'locationId', headerAlign: "center", align: "left", columnLabel: '库位编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 }, { userId: this.$store.state.user.name, functionId: 104009, serialNumber: '104009Table1LocationName', tableId: "104009Table1", tableName: "库位信息表", columnProp: 'locationName', headerAlign: "center", align: "left", columnLabel: '库位名称', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 200 }, { userId: this.$store.state.user.name, functionId: 104009, serialNumber: '104009Table1WarehouseId', tableId: "104009Table1", tableName: "库位信息表", columnProp: 'warehouseId', headerAlign: "center", align: "left", columnLabel: '仓库编码', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 120 }, { userId: this.$store.state.user.name, functionId: 104009, serialNumber: '104009Table1LocationType', tableId: "104009Table1", tableName: "库位信息表", columnProp: 'locationType', headerAlign: "center", align: "left", columnLabel: '库位类型', columnHidden: false, columnImage: false, columnSortable: false, sortLv: 0, status: true, fixed: '', columnWidth: 100 }, ], } },
mounted () { this.$nextTick(() => { this.height = window.innerHeight - 170 }) },
created () { this.getDataList() },
methods: { // 每页数
sizeChangeHandle (val) { this.pageSize = val this.pageIndex = 1 this.getDataList() },
// 当前页
currentChangeHandle (val) { this.pageIndex = val this.getDataList() },
// 获取数据列表
getDataList () { this.searchData.limit = this.pageSize this.searchData.page = this.pageIndex locationInformationSearch(this.searchData).then(({data}) => { if (data.code === 0) { this.dataList = data.page.list this.pageIndex = data.page.currPage this.pageSize = data.page.pageSize this.totalPage = data.page.totalCount } }) },
//导出excel
async createExportData() { this.searchData.limit = -1 this.searchData.page = 1 await locationInformationSearch(this.searchData).then(({data}) => { this.exportList= data.page.list }) return this.exportList }, startDownload() {}, finishDownload() {}, fields() { let json = "{" this.columnList.forEach((item, index) => { if (index == this.columnList.length - 1) { json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" } else { json += "\"" + item.columnLabel + "\"" + ":" + "\"" + item.columnProp + "\"" + "," } }) json += "}" let s = eval("(" + json + ")") return s }, // 导出 end
}}</script>
<style scoped lang="scss">/deep/ .customer-tab .el-tabs__content { padding: 0px !important; height: 459px;}</style>
|