<template>
|
<div class="chart-wrapper">
|
<el-form :inline="true" :model="formData" class="demo-form-inline">
|
<div class="haocai-title">物料出库排名</div>
|
<span class="demonstration">出库时间</span>
|
<el-date-picker v-model="outdate" class="w-400" type="daterange" placeholder="选择日期" value-format="yyyy-MM-dd" format="yyyy-MM-dd" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期">
|
</el-date-picker>
|
<el-form-item label="货主名称">
|
<el-select v-model="formData.consignor_Id" placeholder="请选择" class="w-200">
|
<el-option v-for="item in consignorNames" :key="item.consignor_Id" :label="item.consignorName" :value="item.consignor_Id" @click.native="()=>{
|
formData.consignorCode=item.consignorCode;
|
formData.consignorName=item.consignorName;
|
}">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item label="所属仓库">
|
<el-select v-model="formData.storage_Id" placeholder="请选择" class="w-200">
|
<el-option v-for="item in storageNames" :key="item.storage_Id" :label="item.storageName" :value="item.storage_Id">
|
</el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" @click="getColumnData(formData)">查询</el-button>
|
</el-form-item>
|
<bar-chart ref="barchartInfo" :gutter="10" :xaxis-array="barXaxisArray" :series="barSeries" />
|
</el-form>
|
</div>
|
</template>
|
|
<script>
|
import BarChart from "../components/BarChart";
|
|
export default {
|
components: {
|
BarChart
|
},
|
data() {
|
return {
|
barXaxisArray: [],
|
barSeries: [{ name: "", data: [] }],
|
formData: {
|
consignor_Id: null,
|
storage_Id: null, // 仓库id
|
storageName: null
|
},
|
// 货主 列表
|
consignorNames: null,
|
// 仓库 列表
|
storageNames: null,
|
outdate: ""
|
};
|
},
|
mounted() {
|
this.getColumnData();
|
this.getConsignorList();
|
this.getStorageList();
|
},
|
methods: {
|
getColumnData() {
|
var the = this;
|
const consignor_Id = this.formData.consignor_Id;
|
const storage_Id = this.formData.storage_Id;
|
const startdate = this.outdate[0];
|
const endtime = this.outdate[1];
|
const url = "/api/dashboard/wms/getColumnData";
|
const params = {
|
consignor_Id: consignor_Id,
|
storage_Id: storage_Id,
|
startdate: startdate,
|
endtime: endtime
|
};
|
var callback = res => {
|
if (res.result) {
|
this.barXaxisArray = [];
|
this.barSeries = [{ name: "", data: [] }];
|
this.dataInfo = res.data;
|
this.barSeries[0].name = "订单数";
|
this.dataInfo.forEach(row => {
|
// this.barXaxisArray.push(row.year + "-" + row.month);
|
this.barXaxisArray.push(row.name);
|
this.barSeries[0].data.push(row.count);
|
});
|
window.setTimeout(function() {
|
the.$refs.barchartInfo.initChart();
|
}, 10);
|
}
|
};
|
this.common.ajax(url, params, callback, true);
|
},
|
// 获取货主名称下拉框
|
getConsignorList() {
|
const url = "/api/basicInfo/base/consignor/getList";
|
const params = {
|
openNodeApi: true
|
};
|
var callback = res => {
|
if (res.result) {
|
this.consignorNames = res.data;
|
}
|
};
|
this.common.ajax(url, params, callback);
|
},
|
// 获取仓库
|
getStorageList() {
|
const url = "/api/basicInfo/base/storage/getList";
|
const params = {};
|
var callback = res => {
|
if (res.result) {
|
this.storageNames = res.data;
|
}
|
};
|
this.common.ajax(url, params, callback);
|
}
|
}
|
};
|
</script>
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
.chart-wrapper {
|
background: #fff;
|
padding: 16px 16px;
|
margin-bottom: 10px;
|
.haocai-title {
|
text-align: center;
|
color: #888;
|
font-size: 18px;
|
margin-bottom: 20px;
|
}
|
}
|
</style>
|