<template>
|
<!-- 面包屑导航区 -->
|
<div class="indexs">
|
<el-card>
|
<el-row>
|
<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.materialName" placeholder="物料名称" class="search"></el-input>
|
<el-input v-model="searchParam.materialCode" placeholder="物料编号" class="search"></el-input>
|
<el-input v-model="searchParam.tranckNnmber" placeholder="跟踪号" class="search"></el-input>
|
<!-- <el-date-picker
|
v-model="datatime"
|
size="large"
|
type="datetimerange"
|
value-format="yyyy-MM-dd HH:mm:ss"
|
range-separator="至"
|
start-placeholder="开始日期"
|
end-placeholder="结束日期"
|
>
|
</el-date-picker> -->
|
<el-button type="success" plain @click="find(1)" >查询</el-button>
|
<el-button type="info" plain @click="reset" >重置</el-button>
|
</el-row>
|
<!-- 显示人员列表 -->
|
<el-table ref= "table" :max-height="tableHeight" :data="TakeStocklist" bottom= "10%" border stripe show-summary :summary-method="getSummaries" >
|
<el-table-column
|
type="selection"
|
width="55">
|
</el-table-column>
|
<el-table-column
|
label="序号"
|
type="index"
|
width="50">
|
</el-table-column>
|
<el-table-column label="数据ID" prop="ProductPosition_Id" width="80 " v-if="false"></el-table-column>
|
<el-table-column label="跟踪号" prop="ExtendField04" width="100"></el-table-column>
|
<el-table-column label="物料编号" prop="ProductCode" width="200"></el-table-column>
|
<el-table-column label="物料名称" prop="ProductName" width="300" ></el-table-column>
|
<el-table-column label="汇总数量" prop="ProductStorage" width="200"></el-table-column>
|
<el-table-column label="库存单位" prop="SmallUnit" width="110"></el-table-column>
|
<el-table-column label="安全预警值" prop="Brand_Id" width="110"></el-table-column>
|
</el-table>
|
<el-pagination
|
:current-page="queryInfo.pagenum"
|
:page-sizes="[5,10, 15, 20,50,100,1000,10000]"
|
: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'
|
export default {
|
data() {
|
return {
|
tableHeight:window.innerHeight-214,
|
searchParam: {
|
materialName: null,
|
materialCode: null,
|
tranckNnmber: null
|
},
|
queryInfo: {
|
// 当前页
|
pagenum: 1,
|
// 每页显示多少条信息s
|
pagesize: 10
|
},
|
|
TakeStocklist: [],
|
TakeStocklistAll: [],
|
total: 0,
|
datatime: '',
|
//selectType: [{ value: "1", label: "立体库" }, { value: "2", label: "虚拟库" }],
|
selectType: [{ value: '1', label: '常规货位' }, { value: '4', label: '暂存区' }],
|
selectTypeValue: '1',
|
dialogFormVisible: false,
|
productList: [],
|
updateDate: null
|
}
|
},
|
created() {},
|
mounted() {
|
this.find(1)
|
},
|
methods: {
|
// 监听 pagesize 改变
|
handleSizeChange(newSizd) {
|
this.queryInfo.pagesize = newSizd
|
this.queryInfo.pagenum = 1
|
this.find(1)
|
},
|
// 监听 页码值改变
|
handleCurrentChange(newpage) {
|
this.queryInfo.pagenum = newpage
|
|
this.find(2)
|
},
|
userStatusChange(userinfo) {
|
console.log(userinfo)
|
},
|
getSummaries(param) {
|
const { columns, data } = param
|
const sums = []
|
columns.forEach((column, index) => {
|
if (index === 0) {
|
sums[index] = '合计'
|
return
|
}
|
if (index != 5) {
|
sums[index] = ''
|
return
|
}
|
const values = data.map(item => Number(item[column.property]))
|
if (!values.every(value => isNaN(value))) {
|
sums[index] = values.reduce((prev, curr) => {
|
const value = Number(curr)
|
if (!isNaN(value)) {
|
return prev + curr
|
} else {
|
return prev
|
}
|
}, 0)
|
sums[index] += ' '
|
} else {
|
sums[index] = 'N/A'
|
}
|
sums[index] = Number(sums[index]).toFixed(2)
|
})
|
|
return sums
|
},
|
|
formatJson(filterVal, jsonData) {
|
return jsonData.map(v =>
|
filterVal.map(j => {
|
if (j === 'timestamp') {
|
return parseTime(v[j])
|
} else {
|
return v[j]
|
}
|
})
|
)
|
},
|
find(ischang = 1) {
|
if (ischang == 1) {
|
this.queryInfo.pagenum = 1
|
}
|
const url = '/api/task/findProductStock'
|
const params = {
|
search: this.searchParam,
|
queryInfo: this.queryInfo, //分页
|
positionTypeValue: this.selectTypeValue, //下拉框的值
|
datatime: this.datatime, //日期
|
alarmValue: 1
|
}
|
var callback = res => {
|
debugger
|
if (res.result === true) {
|
res.data.forEach(item => {
|
if (item.IsBoosterArm === 0) item.IsBoosterArm = '否'
|
if (item.IsBoosterArm === 1) item.IsBoosterArm = '是'
|
})
|
|
this.TakeStocklist = res.data
|
this.TakeStocklistAll = res.data2
|
this.total = res.countPrint
|
} else {
|
this.TakeStocklist = []
|
this.TakeStocklistAll = []
|
this.total = 0
|
return this.$message.success('当前条件 查不到数据!')
|
}
|
}
|
this.common.ajax(url, params, callback, true)
|
},
|
find_export(ischang = 1) {
|
if (ischang == 1) {
|
this.queryInfo.pagenum = 1
|
}
|
const url = '/api/task/findProductStock'
|
const params = {
|
IsLoadAllData:true,//加载全部
|
search: this.searchParam,
|
queryInfo: this.queryInfo, //分页
|
positionTypeValue: this.selectTypeValue, //下拉框的值
|
datatime: this.datatime, //日期
|
alarmValue: 1
|
}
|
var callback = res => {
|
//debugger
|
if (res.result === true) {
|
res.data2.forEach(item => {
|
if (item.IsBoosterArm === 0) item.IsBoosterArm = '否'
|
if (item.IsBoosterArm === 1) item.IsBoosterArm = '是'
|
})
|
|
this.TakeStocklistAll = res.data2
|
this.do_exportExcel()
|
} else {
|
this.TakeStocklistAll = []
|
return this.$message.success('当前条件 查不到数据!')
|
}
|
}
|
this.common.ajax(url, params, callback, true)
|
},
|
do_exportExcel() {
|
// import("@/vendor/Export2Excel")
|
this.downloadLoading = true
|
import('@/vendor/Export2Excel').then(excel => {
|
const tHeader = ['跟踪号', '物料编号', '物料名称', '汇总数量', '库存单位', '安全预警值']
|
const filterVal = ['ExtendField04', 'ProductCode', 'ProductName', 'ProductStorage', 'SmallUnit', 'Brand_Id']
|
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.tranckNnmber = null
|
this.selectTypeValue = '1'
|
this.datatime = ''
|
this.find()
|
}
|
}
|
}
|
</script>
|
<style lang="postcss" scoped>
|
.el-table .el-pagination {
|
margin-top: 10px;
|
line-height: 30px;
|
margin-bottom: 0%;
|
}
|
.el-row {
|
text-align: left;
|
}
|
.selectValues {
|
width: 420px;
|
}
|
.search {
|
width: 200px;
|
}
|
.selectTypeValue {
|
width: 150px;
|
}
|
.el-card {
|
padding: 0%;
|
margin-bottom: 0%;
|
/* 84 = navbar + tags-view = 50 +34 */
|
max-height: calc(100vh - 104px);
|
}
|
thead .el-table-column--selection .cell {
|
display: none;
|
}
|
.el-scrollbar{
|
.el-scrollbar__bar.is-vertical {
|
opacity: 1;/* 改为0不显示滚动条*/
|
width:5;
|
}
|
}
|
|
</style>
|