454 lines
13 KiB
Vue
454 lines
13 KiB
Vue
|
||
<template>
|
||
<div class="div1">
|
||
|
||
<div class="div2" style="padding-bottom: 10px">
|
||
<el-form ref="form" :model="param" label-width="80px">
|
||
<el-row :gutter="24">
|
||
<el-col :span="4">
|
||
<el-form-item label="出库类型">
|
||
<el-select v-model="param.出库类型" multiple filterable placeholder="请选择库区" style="width: 155px;">
|
||
<el-option
|
||
v-for="item in Pt"
|
||
:key="item"
|
||
:label="item"
|
||
:value="item"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="任务号:">
|
||
<el-input type="textarea" v-model="param.任务号" :rows="1"></el-input>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="子任务号:">
|
||
<el-input type="textarea" v-model="param.子任务号" :rows="1"></el-input>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="库区">
|
||
<el-select v-model="param.库区" multiple filterable placeholder="请选择库区" style="width: 100%;">
|
||
<el-option
|
||
v-for="item in Ku"
|
||
:key="item.index"
|
||
:label="item.name"
|
||
:value="item.name"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
</el-col>
|
||
<el-col :span="4">
|
||
<el-form-item label="创建日期:">
|
||
<el-date-picker style="width: 300px"
|
||
v-model="param.创建日期"
|
||
type="daterange"
|
||
align="right"
|
||
unlink-panels
|
||
range-separator="至"
|
||
start-placeholder="开始日期"
|
||
end-placeholder="结束日期"
|
||
:picker-options="pickerOptions">
|
||
</el-date-picker>
|
||
</el-form-item>
|
||
</el-col>
|
||
</el-row>
|
||
<el-button type="success" @click="find">查找</el-button>
|
||
<el-button type="success" @click="down">导出</el-button>
|
||
<el-button type="success" @click="rest">重置</el-button>
|
||
<!-- <el-checkbox v-model="checked" @change="Allquesr">是否显示全部查询条件</el-checkbox>-->
|
||
</el-form>
|
||
</div>
|
||
|
||
<el-table
|
||
v-loading="this.tableloding"
|
||
:height="MaxHeight"
|
||
:header-cell-style="{background:'#000',color:'#fff'}"
|
||
:span-method="objectSpanMethod"
|
||
:data="tableData"
|
||
id="educe-table"
|
||
ref="tableData"
|
||
style="width: 100%;">
|
||
<el-table-column v-for="item in columns" :key="item.prop" :prop="item.prop" :label="item.label" :min-width="item.minWidth" />
|
||
</el-table>
|
||
<el-pagination
|
||
@size-change="handleSizeChange"
|
||
@current-change="handleCurrentChange"
|
||
:current-page="pageNum"
|
||
:page-sizes="[ 50, 100, 200,500]"
|
||
:page-size="pageSize"
|
||
layout="total, sizes, prev, pager, next, jumper"
|
||
:total="total">
|
||
</el-pagination>
|
||
</div>
|
||
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
pickerOptions: {
|
||
shortcuts: [{
|
||
text: '最近一周',
|
||
onClick(picker) {
|
||
const end = new Date();
|
||
const start = new Date();
|
||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
||
picker.$emit('pick', [start, end]);
|
||
}
|
||
}, {
|
||
text: '最近一个月',
|
||
onClick(picker) {
|
||
const end = new Date();
|
||
const start = new Date();
|
||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
||
picker.$emit('pick', [start, end]);
|
||
}
|
||
}, {
|
||
text: '最近三个月',
|
||
onClick(picker) {
|
||
const end = new Date();
|
||
const start = new Date();
|
||
start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
|
||
picker.$emit('pick', [start, end]);
|
||
}
|
||
}]
|
||
},
|
||
/*多选下拉框-库区*/
|
||
Ku: [],
|
||
/*多选下拉框-出库类型*/
|
||
Pt: [],
|
||
// 表头配置
|
||
columns: [
|
||
{
|
||
prop: '单据类型',
|
||
minWidth: '150px',
|
||
label: '单据类型'
|
||
},
|
||
{
|
||
prop: '出库类型',
|
||
minWidth: '150px',
|
||
label: '出库类型'
|
||
},
|
||
{
|
||
prop: '任务号',
|
||
minWidth: '150px',
|
||
label: '任务号'
|
||
},
|
||
{
|
||
prop: '子任务号',
|
||
minWidth: '150px',
|
||
label: '子任务号'
|
||
},
|
||
{
|
||
prop: '库区',
|
||
minWidth: '150px',
|
||
label: '库区'
|
||
},
|
||
{
|
||
prop: '拣货行',
|
||
minWidth: '150px',
|
||
label: '拣货行'
|
||
},
|
||
{
|
||
prop: '创建时间',
|
||
minWidth: '150px',
|
||
label: '创建时间'
|
||
},
|
||
{
|
||
prop: '生成合单任务时间',
|
||
minWidth: '150px',
|
||
label: '生成合单任务时间'
|
||
},
|
||
{
|
||
prop: '下发时间',
|
||
minWidth: '150px',
|
||
label: '下发时间'
|
||
},
|
||
{
|
||
prop: '全部拣货完成时间',
|
||
minWidth: '150px',
|
||
label: '全部拣货完成时间'
|
||
},
|
||
{
|
||
prop: '清点时间',
|
||
minWidth: '150px',
|
||
label: '清点时间'
|
||
},
|
||
{
|
||
prop: '合单时间',
|
||
minWidth: '150px',
|
||
label: '合单时间'
|
||
},
|
||
{
|
||
prop: '交单时间',
|
||
minWidth: '150px',
|
||
label: '交单时间'
|
||
},
|
||
{
|
||
prop: '创建-下发时间',
|
||
minWidth: '150px',
|
||
label: '创建-下发时间'
|
||
},
|
||
{
|
||
prop: '下发-拣货时间',
|
||
minWidth: '150px',
|
||
label: '下发-拣货时间'
|
||
},
|
||
{
|
||
prop: '拣货-合单时间',
|
||
minWidth: '150px',
|
||
label: '拣货-合单时间'
|
||
},
|
||
{
|
||
prop: '拣货-合单时间',
|
||
minWidth: '150px',
|
||
label: '拣货-合单时间'
|
||
},
|
||
{
|
||
prop: '合单-交单时间',
|
||
minWidth: '150px',
|
||
label: '合单-交单时间'
|
||
},
|
||
{
|
||
prop: '拣货-清点时间',
|
||
minWidth: '150px',
|
||
label: '拣货-清点时间'
|
||
},
|
||
{
|
||
prop: '清点-合单时间',
|
||
minWidth: '150px',
|
||
label: '清点-合单时间'
|
||
},
|
||
{
|
||
prop: '拣货-交单时间',
|
||
minWidth: '150px',
|
||
label: '拣货-交单时间'
|
||
}
|
||
],
|
||
tableloding: false,
|
||
isShow:false,//是否展示全部搜索条件
|
||
tableData: [],
|
||
pageSize: 50
|
||
,spanArr: [], //每行合并数
|
||
pos: 0, //角标索引
|
||
pageNum: 1,
|
||
total: 3,
|
||
param: {
|
||
出库类型:'',
|
||
任务号:'',
|
||
子任务号:'',
|
||
库区:'',
|
||
创建日期:''
|
||
},
|
||
loading: false,
|
||
checked: false,
|
||
}
|
||
},
|
||
|
||
computed:{
|
||
MaxHeight(){
|
||
return window.innerHeight - 240 +"px";
|
||
}
|
||
},
|
||
mounted: function () {
|
||
this.queryUser();
|
||
this.KuS();
|
||
this.PtS();
|
||
},
|
||
updated() {
|
||
// 每次更新会重新对 Table 进行重新布局
|
||
this.$nextTick(() => {
|
||
if (this.$refs.mutipleTable !== undefined) {
|
||
this.$refs.mutipleTable.doLayout()
|
||
}
|
||
})
|
||
},
|
||
methods: {
|
||
// 合并单元格样式,主要是针对要合并列的第一个单元格(有其他需要的可自行更改)
|
||
cellStyle({ row, column }) {
|
||
// 找到数组中列>1那一个单元格,就是需要改变的样式
|
||
if (row['mergeData'][column.property] && row['mergeData'][column.property][1] && row['mergeData'][column.property][1] > 1) {
|
||
return { 'text-align': 'left' }
|
||
} else {
|
||
return {}
|
||
}
|
||
|
||
},
|
||
objectSpanMethod({ row, column }) {
|
||
// 直接返回后端给的对应字段的单元格数据
|
||
return row['mergeData'][column.property]
|
||
},
|
||
handleEdit(index, row) {
|
||
console.log(index, row);
|
||
},
|
||
handleDelete(index, row) {
|
||
console.log(index, row);
|
||
},
|
||
handleSizeChange(val) {
|
||
console.log(`每页 ${val} 条`);
|
||
this.pageNum = 1;
|
||
this.pageSize = val;
|
||
this.queryUser();
|
||
},
|
||
handleCurrentChange(val) {
|
||
console.log(`当前页: ${val}`);
|
||
this.pageNum = val;
|
||
this.queryUser();
|
||
},
|
||
queryUser() {
|
||
//列表数据加载
|
||
this.$axios.post(this.$httpUrl + '/JianHuoXiaoLv/queryList', {
|
||
pageSize: this.pageSize,
|
||
pageNum: this.pageNum,
|
||
param: this.param,
|
||
}).then(res => res.data)
|
||
.then(res => {
|
||
if (res.code == 200) {
|
||
this.tableData = res.data
|
||
this.total = res.total
|
||
} else {
|
||
this.$message.error('获取数据失败');
|
||
}
|
||
|
||
// eslint-disable-next-line no-unused-vars
|
||
},err=>{
|
||
this.tableloding=false;
|
||
})
|
||
|
||
},
|
||
find(){
|
||
this.pageNum=1;
|
||
this.queryUser();
|
||
},
|
||
down(){
|
||
this.downExcel();
|
||
},
|
||
downExcel() {
|
||
//显示加载图
|
||
this.tableloding=true;
|
||
//发起请求:/Jianhuojiemian/download,请求方式为post,类型为 {responseType:'blob'}
|
||
//参数和搜索参数一样
|
||
this.$axios.post(this.$httpUrl + '/Xuliehaoqingdan/download', {
|
||
pageSize: this.pageSize,
|
||
pageNum: this.pageNum,
|
||
param: this.param,
|
||
},{responseType:'blob'}).then(res => {
|
||
this.tableloding=false;
|
||
//重命名文件
|
||
this.downloadFile(res.data,'序列号库存清点'+ '数据', 'xlsx')
|
||
});
|
||
//列表数据加载
|
||
|
||
},
|
||
downloadFile(obj, name, suffix) {
|
||
//解析流文件,进行下载保存
|
||
const url = window.URL.createObjectURL(new Blob([obj]))
|
||
const link = document.createElement('a')
|
||
link.style.display = 'none'
|
||
link.href = url
|
||
const fileName = this.parseTime(new Date()) + '-' + name + '.' + suffix
|
||
link.setAttribute('download', fileName)
|
||
document.body.appendChild(link)
|
||
link.click()
|
||
document.body.removeChild(link)
|
||
},
|
||
KuS(){
|
||
//库区下拉列表数据加载
|
||
this.$axios.post(this.$httpUrl + '/Kucunhuizong/ku', {
|
||
|
||
}).then(res => res.data)
|
||
.then(res => {
|
||
if (res.code == 200) {
|
||
this.Ku = res.data;
|
||
} else {
|
||
this.$message.error('获取数据失败');
|
||
}
|
||
|
||
// eslint-disable-next-line no-unused-vars
|
||
},err=>{
|
||
this.tableloding=false;
|
||
})
|
||
},
|
||
PtS(){
|
||
//库区下拉列表数据加载
|
||
this.$axios.post(this.$httpUrl + '/JianHuoXiaoLv/inputPt', {
|
||
|
||
}).then(res => res.data)
|
||
.then(res => {
|
||
if (res.code == 200) {
|
||
this.Pt = res.data;
|
||
} else {
|
||
this.$message.error('获取数据失败');
|
||
}
|
||
|
||
// eslint-disable-next-line no-unused-vars
|
||
},err=>{
|
||
this.tableloding=false;
|
||
})
|
||
},
|
||
parseTime(time, cFormat) {
|
||
//获取当前时间
|
||
if (arguments.length === 0) {
|
||
return null
|
||
}
|
||
const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
|
||
let date
|
||
if (typeof time === 'undefined' || time === null || time === 'null') {
|
||
return ''
|
||
} else if (typeof time === 'object') {
|
||
date = time
|
||
} else {
|
||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||
time = parseInt(time)
|
||
}
|
||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||
time = time * 1000
|
||
}
|
||
date = new Date(time)
|
||
}
|
||
const formatObj = {
|
||
y: date.getFullYear(),
|
||
m: date.getMonth() + 1,
|
||
d: date.getDate(),
|
||
h: date.getHours(),
|
||
i: date.getMinutes(),
|
||
s: date.getSeconds(),
|
||
a: date.getDay()
|
||
}
|
||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||
let value = formatObj[key]
|
||
// Note: getDay() returns 0 on Sunday
|
||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
|
||
if (result.length > 0 && value < 10) {
|
||
value = '0' + value
|
||
}
|
||
return value || 0
|
||
})
|
||
return time_str
|
||
},
|
||
Allquesr(){
|
||
//查询按钮
|
||
if(this.checked){
|
||
this.isShow=true;
|
||
}else {
|
||
this.isShow=false;
|
||
}
|
||
},
|
||
rest() {
|
||
//条件查询重置
|
||
this.checked=false;
|
||
this.isShow=false;
|
||
this.param={};
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
<style scoped>
|
||
|
||
</style>
|