<template>
|
<!-- 面包屑导航区 let userInfo = await ctx.helper.userInfo(); -->
|
<div>
|
<el-card>
|
<!-- 搜索与添加 -->
|
|
<el-row>
|
<el-col :span="8">
|
</el-col><el-button type="success" plain @click="exportExcel" >导出全部Excel</el-button>
|
<el-select v-model="selectTypeValue" placeholder="选择货位类型" class="selectTypeValue">
|
<el-option
|
v-for="item in selectType"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
<el-input v-model="searchParam.saleCode" placeholder="销售单号" class="selectValues"></el-input>
|
<el-input v-model="searchParam.materialCode" placeholder="物料编号" class="selectValues"></el-input>
|
<el-input v-model="searchParam.materialName" placeholder="物料名称" class="selectValues"></el-input>
|
<el-button type="success" plain @click="getUserList(1)" >查询</el-button>
|
<el-button type="info" plain @click="reset" >重置</el-button>
|
<el-tag type="warning" class="infoSize" >{{infoTotal}}</el-tag>
|
</el-row>
|
<!-- 显示人员列表 -->
|
<el-table :data="TakeStocklist" :max-height="tableHeight" border stripe>
|
<el-table-column label="ID" prop="ID" width="60"></el-table-column>
|
<el-table-column label="销售单号" prop="ProcureCode" width="110"></el-table-column>
|
<el-table-column label="销售项号" prop="ProcureItem" width="100"></el-table-column>
|
<el-table-column label="物料编号" prop="MateralCode" width="300"></el-table-column>
|
<el-table-column label="物料名称" prop="MateralName" width="500"></el-table-column>
|
<el-table-column label="单位" prop="Unit" width="100"></el-table-column>
|
<el-table-column label="库存数量" prop="StockQuantity" width="110"></el-table-column>
|
<el-table-column label="SAP数量" prop="SapQuantity" width="110"></el-table-column>
|
<el-table-column label="盘点时间" prop="CreateDate" width="160"></el-table-column>
|
</el-table>
|
<el-pagination
|
:current-page="queryInfo.pagenum"
|
:page-sizes="[10, 15, 20,50,100,500,1000,2000,5000]"
|
:page-size="queryInfo.pagesize"
|
:total="total"
|
layout="total, sizes, prev, pager, next, jumper"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
>
|
</el-pagination>
|
</el-card>
|
</div>
|
</template>
|
<script>
|
import { parseTime } from '@/utils'
|
import { getDate } from '@/utils/dateTime'
|
export default {
|
data() {
|
return {
|
tableHeight:window.innerHeight-244,
|
input: '',
|
queryInfo: {
|
query: '',
|
// 当前页
|
pagenum: 1,
|
// 每页显示多少条信息
|
pagesize: 10
|
},
|
selectType: [
|
{ value: '1', label: '不筛选' },
|
{ value: '2', label: '差异数据' },
|
{ value: '3', label: '仅立库数据' },
|
{ value: '4', label: '仅SAP数据' }
|
],
|
infoTotal: '合计:暂无数据',
|
selectTypeValue: '1',
|
searchParam: {
|
materialName: null,
|
materialCode: null,
|
saleCode: null
|
},
|
TakeStocklist: [],
|
TakeStocklistAll: [],
|
total: 0
|
}
|
},
|
created() {},
|
mounted() {
|
this.getUserList(1)
|
},
|
methods: {
|
// if (res.mssg.status != 200) return this.$message.error("人员为空");
|
// this.userlist = res.data;
|
// this.total = res.mssg.total;
|
// },
|
getUserList(ischang = 1) {
|
//debugger
|
if (ischang == 1) {
|
this.queryInfo.pagenum = 1
|
}
|
const url = '/api/task/GetTakeStock'
|
const params = {
|
search: this.searchParam, //输入框的值
|
queryInfo: this.queryInfo, //分页
|
positionTypeValue: this.selectTypeValue //下拉框的值
|
}
|
|
var callback = res => {
|
if (res.statusCode !== 200) return this.$message.error('盘点数据为空')
|
|
this.total = res.countPrint
|
this.infoTotal = '盘点数据统计:' + res.data2[0].MateralName
|
res.data.forEach(item => {
|
item.CreateDate = getDate(item.CreateDate)
|
})
|
|
this.TakeStocklist = res.data
|
this.TakeStocklistAll = res.data2
|
}
|
this.common.ajax(url, params, callback, true)
|
},
|
find_export(ischang = 1) {
|
//debugger
|
if (ischang == 1) {
|
this.queryInfo.pagenum = 1
|
}
|
const url = '/api/task/GetTakeStock'
|
const params = {
|
IsLoadAllData:true,//加载全部
|
search: this.searchParam, //输入框的值
|
queryInfo: this.queryInfo, //分页
|
positionTypeValue: this.selectTypeValue //下拉框的值
|
}
|
|
var callback = res => {
|
if (res.statusCode !== 200) return this.$message.error('盘点数据为空')
|
this.TakeStocklistAll = res.data2
|
this.do_exportExcel()
|
}
|
this.common.ajax(url, params, callback, true)
|
},
|
do_exportExcel() {
|
// import("@/vendor/Export2Excel")
|
this.downloadLoading = true
|
import('@/vendor/Export2Excel').then(excel => {
|
const tHeader = ['ID', '销售单号', '销售项号', '物料编号', '物料名称', '单位', '库存数量', 'SAP数量','盘点时间']
|
const filterVal = ['ID', 'ProcureCode', 'ProcureItem', 'MateralCode', 'MateralName', 'Unit', 'StockQuantity', 'SapQuantity','CreateDate']
|
const data = this.formatJson(filterVal, this.TakeStocklistAll)
|
excel.export_json_to_excel({
|
header: tHeader,
|
data,
|
filename: '库存盘点表'
|
})
|
this.downloadLoading = false
|
})
|
},
|
exportExcel() {
|
this.find_export(1)
|
},
|
reset() {
|
this.searchParam.materialName = null
|
this.searchParam.materialCode = null
|
this.searchParam.saleCode = null
|
this.selectTypeValue = '1'
|
this.getUserList(1)
|
},
|
// 监听 pagesize 改变
|
handleSizeChange(newSizd) {
|
this.queryInfo.pagesize = newSizd
|
this.queryInfo.pagenum = 1
|
this.getUserList(1)
|
},
|
// 监听 页码值改变
|
handleCurrentChange(newpage) {
|
this.queryInfo.pagenum = newpage
|
|
this.getUserList(2)
|
},
|
userStatusChange(userinfo) {
|
console.log(userinfo)
|
},
|
|
|
formatJson(filterVal, jsonData) {
|
return jsonData.map(v =>
|
filterVal.map(j => {
|
if (j === 'timestamp') {
|
return parseTime(v[j])
|
} else {
|
return v[j]
|
}
|
})
|
)
|
}
|
}
|
}
|
</script>
|
<style lang="postcss" scoped>
|
.el-table {
|
margin-top: 10px;
|
line-height: 30px;
|
}
|
.el-col {
|
line-height: 30px;
|
}
|
.selectValues {
|
width: 220px;
|
}
|
.selectTypeValue {
|
width: 150px;
|
}
|
.infoSize {
|
font-size: 20px;
|
line-height: 30px;
|
}
|
.el-card {
|
padding: 0%;
|
margin-bottom: 0%;
|
/* 84 = navbar + tags-view = 50 +34 */
|
max-height: calc(100vh - 104px);
|
}
|
.el-scrollbar{
|
.el-scrollbar__bar.is-vertical {
|
opacity: 1;/* 改为0不显示滚动条*/
|
width:5;
|
}
|
}
|
|
</style>
|