<template>
|
<section>
|
<!--工具条-->
|
<SearchBar
|
:buttonList="buttonList"
|
@callFunction="callFunction"
|
></SearchBar>
|
|
<!--列表-->
|
<el-table
|
:data="WMStockLog"
|
highlight-current-row
|
@current-change="selectCurrentRow"
|
v-loading="listLoading"
|
@selection-change="selsChange"
|
@select="selsChangeOne"
|
style="width: 100%"
|
ref="multipleTable"
|
>
|
<el-table-column type="selection" width="50"></el-table-column>
|
<el-table-column type="index" width="40"></el-table-column>
|
<el-table-column
|
prop="CodeNo"
|
label="订单编号"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="Code"
|
label="商品编号"
|
width="150"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="ProductName"
|
label="商品名称"
|
width="160"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="ProductSpec"
|
label="商品规格"
|
width="140"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="WareHouseName"
|
label="所属仓库"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="TypeName"
|
label="台账类型"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="QuantitySign"
|
label="台账数量"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="Price"
|
label="台账单价"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="TotalPrice"
|
label="台账总价"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="RemainQuantity"
|
label="库存数量"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="RemainPrice"
|
label="库存均价"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="TotalRemainPrice"
|
label="库存总价"
|
width="100"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="AdminName"
|
label="创建人"
|
width="90"
|
sortable
|
></el-table-column>
|
<el-table-column
|
prop="CreateTime"
|
label="创建时间"
|
:formatter="formatDateTime"
|
width="140"
|
sortable
|
></el-table-column>
|
</el-table>
|
|
<!--工具条-->
|
<el-col :span="24" class="toolbar">
|
<el-pagination
|
layout="prev, pager, next"
|
@current-change="handleCurrentChange"
|
:page-size="20"
|
:total="total"
|
style="float: right"
|
></el-pagination>
|
</el-col>
|
</section>
|
</template>
|
|
<script>
|
import util from "../../../../util/date";
|
import {
|
//获取后台数据接口
|
getWMStockLogListPage, //库存流水日志列表API
|
ExportWMStockLog, //库存流水日志导出API
|
} from "../../../api/api";
|
import { getButtonList } from "../../../promissionRouter";
|
import Toolbar from "../../../components/Toolbar";
|
import SearchBar from "./SearchBar";
|
export default {
|
components: { SearchBar },
|
data() {
|
return {
|
filters: {
|
name: "",
|
typeoptions: "", //类型下拉
|
warehouseoptions: "", //仓库下拉
|
startdate: "", //开始时间
|
enddate: "", //结束时间
|
},
|
WMStockLog: [],
|
total: 0,
|
buttonList: [],
|
currentRow: null,
|
page: 1,
|
listLoading: false,
|
sels: [], //列表选中列
|
//导入
|
importFormVisible: false, //导入界面是否显示
|
fileList: [],
|
};
|
},
|
methods: {
|
//选中行时勾选框
|
selsChangeOne(selection, row) {
|
this.currentRow = row;
|
this.$refs.multipleTable.toggleRowSelection(row); //选中当前选择
|
this.selectCurrentRow(row);
|
},
|
selectCurrentRow(val) {
|
this.currentRow = val;
|
this.$refs.multipleTable.toggleRowSelection(val); //选中当前选择
|
},
|
callFunction(item) {
|
this.filters = {
|
name: item.nameSearch,
|
typeoptions: item.stocktypeoptionsSearch, //类型下拉
|
warehouseoptions: item.warehouseoptionsSearch, //仓库下拉
|
startdate: item.startdateSearch, //开始时间
|
enddate: item.enddateSearch, //结束时间
|
};
|
this[item.Func].apply(this, item);
|
},
|
formatDateTime: function (row, column) {
|
return !row.CreateTime || row.CreateTime == ""
|
? ""
|
: util.formatDate.format(new Date(row.CreateTime), "yyyy-MM-dd hh:mm");
|
},
|
handleCurrentChange(val) {
|
this.page = val;
|
this.getWMStockLog();
|
},
|
//获取库存流水日志列表
|
getWMStockLog() {
|
let para = {
|
page: this.page,
|
key: this.filters.name,
|
typeoptions: this.filters.typeoptions,
|
warehouseoptions: this.filters.warehouseoptions,
|
startdate: this.filters.startdate,
|
enddate: this.filters.enddate,
|
};
|
this.listLoading = true;
|
|
//NProgress.start();
|
getWMStockLogListPage(para).then((res) => {
|
this.total = res.data.response.dataCount;
|
this.WMStockLog = res.data.response.data;
|
this.listLoading = false;
|
//NProgress.done();
|
});
|
},
|
selsChange: function (sels) {
|
this.sels = sels;
|
},
|
//导出物料初期实况
|
handleExportFirst() {
|
let para = { type: 1 };
|
ExportWMStockLog(para)
|
.then((res) => {
|
const blob = new Blob([res.data], {
|
type: "application/x-xls",
|
});
|
const url = window.URL.createObjectURL(blob);
|
const aLink = document.createElement("a");
|
aLink.style.display = "none";
|
aLink.href = url;
|
aLink.setAttribute(
|
"download",
|
"物料初期实况" + new Date().getTime() + ".xlsx"
|
);
|
document.body.appendChild(aLink);
|
aLink.click();
|
document.body.removeChild(aLink); // 下载完成移除元素
|
window.URL.revokeObjectURL(url); // 释放掉blob对象
|
})
|
.catch((err) => {
|
console.log(err);
|
});
|
},
|
//导出物料初末实况
|
handleExportEnd() {
|
let para = { type: 2 };
|
ExportWMStockLog(para)
|
.then((res) => {
|
const blob = new Blob([res.data], {
|
type: "application/x-xls",
|
});
|
const url = window.URL.createObjectURL(blob);
|
const aLink = document.createElement("a");
|
aLink.style.display = "none";
|
aLink.href = url;
|
aLink.setAttribute(
|
"download",
|
"物料初末实况" + new Date().getTime() + ".xlsx"
|
);
|
document.body.appendChild(aLink);
|
aLink.click();
|
document.body.removeChild(aLink); // 下载完成移除元素
|
window.URL.revokeObjectURL(url); // 释放掉blob对象
|
})
|
.catch((err) => {
|
console.log(err);
|
});
|
},
|
},
|
mounted() {
|
this.getWMStockLog();
|
|
let routers = window.localStorage.router
|
? JSON.parse(window.localStorage.router)
|
: [];
|
this.buttonList = getButtonList(this.$route.path, routers);
|
},
|
};
|
</script>
|