库存统计、采购统计、库存检验统计
This commit is contained in:
parent
69ed9b9d83
commit
1bce64dbbd
|
@ -96,6 +96,14 @@ export default {
|
||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setWeekConsume: {
|
||||||
|
name: "更新周预估值",
|
||||||
|
req: async function(id, data){
|
||||||
|
return await http.put(
|
||||||
|
`${config.API_URL}/mtm/material/${id}/set_week_esitimate_consume/`,
|
||||||
|
data);
|
||||||
|
}
|
||||||
|
},
|
||||||
update: {
|
update: {
|
||||||
name: "更新",
|
name: "更新",
|
||||||
req: async function(id, data){
|
req: async function(id, data){
|
||||||
|
|
|
@ -2416,7 +2416,7 @@ const routes = [
|
||||||
"path": "/material_statistics",
|
"path": "/material_statistics",
|
||||||
"name": "material_statistics",
|
"name": "material_statistics",
|
||||||
"meta": {
|
"meta": {
|
||||||
"title": "物料统计",
|
"title": "采购统计",
|
||||||
"icon": "el-icon-trend-charts",
|
"icon": "el-icon-trend-charts",
|
||||||
"perms": ["statistic_material"],
|
"perms": ["statistic_material"],
|
||||||
},
|
},
|
||||||
|
@ -2444,6 +2444,17 @@ const routes = [
|
||||||
},
|
},
|
||||||
"component": "statistics/inm_statistics.vue"
|
"component": "statistics/inm_statistics.vue"
|
||||||
},
|
},
|
||||||
|
//库存统计
|
||||||
|
{
|
||||||
|
"path": "/stock_statistics",
|
||||||
|
"name": "stock_statistics",
|
||||||
|
"meta": {
|
||||||
|
"title": "库存统计",
|
||||||
|
"icon": "el-icon-trend-charts",
|
||||||
|
"perms": ["statistic_stock"],
|
||||||
|
},
|
||||||
|
"component": "statistics/stock_statistics.vue"
|
||||||
|
},
|
||||||
],
|
],
|
||||||
// children:[
|
// children:[
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -62,7 +62,23 @@ export const drainTypeEnum = new EnumFactory({
|
||||||
'mtrans': '物料输送',
|
'mtrans': '物料输送',
|
||||||
'mstore':'物料储存'
|
'mstore':'物料储存'
|
||||||
})
|
})
|
||||||
|
export const mioTypeEnum = new EnumFactory({
|
||||||
|
'do_out': '生产领料',
|
||||||
|
'sale_out': '销售发货',
|
||||||
|
'pur_in': '采购入库',
|
||||||
|
'do_in': '生产入库',
|
||||||
|
'other_in': '其他入库',
|
||||||
|
'other_out': '其他出库'
|
||||||
|
})
|
||||||
|
export const productTypeEnum = new EnumFactory({
|
||||||
|
10: '成品',
|
||||||
|
20: '半成品',
|
||||||
|
30: '主要原料',
|
||||||
|
40: '辅助材料',
|
||||||
|
50: '加工工具',
|
||||||
|
60: '辅助工装',
|
||||||
|
70: '办公用品',
|
||||||
|
})
|
||||||
export const eqTypeEnum = new EnumFactory({
|
export const eqTypeEnum = new EnumFactory({
|
||||||
10: { text: '生产设备', type: 'success' },
|
10: { text: '生产设备', type: 'success' },
|
||||||
20: { text: '计量设备', type: 'primary' },
|
20: { text: '计量设备', type: 'primary' },
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
<el-col :lg="16">
|
<el-col :lg="16">
|
||||||
<el-card shadow="never" style="position: relative;">
|
<el-card shadow="never" style="position: relative;">
|
||||||
<el-button @click="handleExport('ZJ')" class="tables" type="primary">导出</el-button>
|
<el-button @click="handleExport('ZJ')" class="tables" type="primary">导出</el-button>
|
||||||
<el-table :data="tableData" id="exportDivZJ">
|
<el-table :data="tableData" id="exportDivZJ" :height="300">
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="批次号" prop="date">
|
<el-table-column label="批次号" prop="date">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<el-col :lg="16">
|
<el-col :lg="16">
|
||||||
<el-card shadow="never" style="position: relative;">
|
<el-card shadow="never" style="position: relative;">
|
||||||
<el-button @click="handleExport('ZB')" class="tables" type="primary">导出</el-button>
|
<el-button @click="handleExport('ZB')" class="tables" type="primary">导出</el-button>
|
||||||
<el-table :data="tableData" id="exportDivZB">
|
<el-table :data="tableData" id="exportDivZB" :height="300">
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="日期" prop="date">
|
<el-table-column label="日期" prop="date">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
@ -142,22 +142,21 @@
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'item'
|
trigger: 'item'
|
||||||
},
|
},
|
||||||
series: [
|
series: {
|
||||||
{
|
name: '预制棒',
|
||||||
name: '访问来源',
|
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
radius: ['40%', '70%'],
|
radius: ['40%', '70%'],
|
||||||
center: ['50%', '60%'],
|
center: ['50%', '60%'],
|
||||||
label: false,
|
label: false,
|
||||||
data: [
|
data: [
|
||||||
{value: 1048, name: '搜索引擎'},
|
{ value: 0, name: '炸纹' },
|
||||||
{value: 735, name: '直接访问'},
|
{ value: 0, name: '条纹' },
|
||||||
{value: 580, name: '邮件营销'},
|
{ value: 0, name: '气泡' },
|
||||||
{value: 484, name: '联盟广告'},
|
{ value: 0, name: '弯曲' },
|
||||||
{value: 300, name: '视频广告'}
|
{ value: 0, name: '其他' },
|
||||||
|
{ value: 0, name: '合格' },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
|
||||||
},
|
},
|
||||||
option2: {
|
option2: {
|
||||||
title: {
|
title: {
|
||||||
|
@ -167,22 +166,21 @@
|
||||||
tooltip: {
|
tooltip: {
|
||||||
trigger: 'item'
|
trigger: 'item'
|
||||||
},
|
},
|
||||||
series: [
|
series: {
|
||||||
{
|
name: '预制管',
|
||||||
name: '访问来源',
|
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
radius: ['40%', '70%'],
|
radius: ['40%', '70%'],
|
||||||
center: ['50%', '60%'],
|
center: ['50%', '60%'],
|
||||||
label: false,
|
label: false,
|
||||||
data: [
|
data: [
|
||||||
{value: 1048, name: '搜索引擎'},
|
{ value: 0, name: '椭圆弯曲' },
|
||||||
{value: 735, name: '直接访问'},
|
{ value: 0, name: '大小头' },
|
||||||
{value: 580, name: '邮件营销'},
|
{ value: 0, name: '偏壁' },
|
||||||
{value: 484, name: '联盟广告'},
|
{ value: 0, name: '结石' },
|
||||||
{value: 300, name: '视频广告'}
|
{ value: 0, name: '气线' },
|
||||||
|
{ value: 0, name: '合格' },
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -208,7 +206,7 @@
|
||||||
}else{
|
}else{
|
||||||
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
|
this.xAxisData = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']
|
||||||
}
|
}
|
||||||
this.option.xAxis.data = this.xAxisData;
|
this.option1.xAxis.data = this.xAxisData;
|
||||||
this.option2.xAxis.data = this.xAxisData;
|
this.option2.xAxis.data = this.xAxisData;
|
||||||
},
|
},
|
||||||
//预制棒检验统计
|
//预制棒检验统计
|
||||||
|
@ -218,9 +216,25 @@
|
||||||
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
|
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "7车间" },
|
||||||
};
|
};
|
||||||
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log('7生产车间统计:',doInRes);
|
console.log('7生产车间统计:', res);
|
||||||
debugger;
|
if (res.data2.ds0 && res.data2.ds0.length > 0) {
|
||||||
|
let item = res.data2.ds0[0];
|
||||||
|
that.yesterdayObjet = item;
|
||||||
|
that.option1.series.data[0].value = item.炸纹;
|
||||||
|
that.option1.series.data[1].value = item.条纹;
|
||||||
|
that.option1.series.data[2].value = item.气泡;
|
||||||
|
that.option1.series.data[3].value = item.弯曲;
|
||||||
|
that.option1.series.data[4].value = item.其他;
|
||||||
|
that.option1.series.data[5].value = item.合格数;
|
||||||
|
} else {
|
||||||
|
that.option1.series.data[0].value = 0;
|
||||||
|
that.option1.series.data[1].value = 0;
|
||||||
|
that.option1.series.data[2].value = 0;
|
||||||
|
that.option1.series.data[3].value = 0;
|
||||||
|
that.option1.series.data[4].value = 0;
|
||||||
|
that.option1.series.data[5].value = 0;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
//预制管检验统计
|
//预制管检验统计
|
||||||
|
@ -230,15 +244,30 @@
|
||||||
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
|
query: { start_date: this.start_date, end_date: this.end_date, dept_name: "10·车间" },
|
||||||
};
|
};
|
||||||
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
let exec = that.queryType=='月'?'lineWeek':'lineMonth';
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((doInRes) => {
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
console.log('10生产车间统计:',doInRes);
|
console.log('10生产车间统计:',res);
|
||||||
debugger;
|
if (res.data2.ds0 && res.data2.ds0.length > 0) {
|
||||||
|
let item = res.data2.ds0[0];
|
||||||
|
that.yesterdayObjet = item;
|
||||||
|
that.option2.series.data[0].value = item.弯曲;
|
||||||
|
that.option2.series.data[1].value = item.大小头;
|
||||||
|
that.option2.series.data[2].value = item.偏壁;
|
||||||
|
that.option2.series.data[3].value = item.结石;
|
||||||
|
that.option2.series.data[4].value = item.气线;
|
||||||
|
that.option2.series.data[5].value = item.合格数;
|
||||||
|
} else {
|
||||||
|
that.option2.series.data[0].value = 0;
|
||||||
|
that.option2.series.data[1].value = 0;
|
||||||
|
that.option2.series.data[2].value = 0;
|
||||||
|
that.option2.series.data[3].value = 0;
|
||||||
|
that.option2.series.data[4].value = 0;
|
||||||
|
that.option2.series.data[5].value = 0;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleQuery(){
|
handleQuery(){
|
||||||
if(this.queryDate!==''){
|
if(this.queryDate!==''){
|
||||||
if(this.queryType=='月'){
|
if(this.queryType=='月'){
|
||||||
|
|
||||||
this.start_date =this.queryDate+'-01';
|
this.start_date =this.queryDate+'-01';
|
||||||
let arr = this.queryDate.split('-');
|
let arr = this.queryDate.split('-');
|
||||||
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
this.end_date = this.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
||||||
|
|
|
@ -51,7 +51,6 @@
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col>
|
<el-col>
|
||||||
<div id="bachart1" style="width:100%;height:300px;"></div>
|
<div id="bachart1" style="width:100%;height:300px;"></div>
|
||||||
<!-- <scEcharts height="300px" :option="option2"></scEcharts> -->
|
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-card shadow="never" style="width: 100%;position: relative;margin-top: 20px;">
|
<el-card shadow="never" style="width: 100%;position: relative;margin-top: 20px;">
|
||||||
<el-button @click="handleExport('1')" class="tables" type="primary">导出</el-button>
|
<el-button @click="handleExport('1')" class="tables" type="primary">导出</el-button>
|
||||||
|
@ -75,27 +74,16 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :lg="12">
|
<el-col :lg="12">
|
||||||
<el-card shadow="never" style="margin-bottom: 8px;">
|
<el-card shadow="never" style="margin-bottom: 8px;">
|
||||||
|
<el-container>
|
||||||
<el-header>
|
<el-header>
|
||||||
<div class="right-panel">
|
<div class="right-panel">
|
||||||
<h2>消耗统计</h2>
|
<h2>采购统计总表</h2>
|
||||||
<el-select v-model="materialOut" clearable @change="materialOutChange">
|
|
||||||
<el-option v-for="item in outOption"
|
|
||||||
:key="item.id"
|
|
||||||
:label="item.full_name"
|
|
||||||
:value="item.id"
|
|
||||||
>
|
|
||||||
</el-option>
|
|
||||||
</el-select>
|
|
||||||
</div>
|
</div>
|
||||||
</el-header>
|
</el-header>
|
||||||
<el-row>
|
<el-main style="width: 100%;position: relative;">
|
||||||
<el-col>
|
|
||||||
<div id="bachart2" style="width:100%;height:300px;"></div>
|
|
||||||
<!-- <scEcharts height="300px" :option="option2"></scEcharts> -->
|
|
||||||
</el-col>
|
|
||||||
<el-card shadow="never" style="width: 100%;position: relative;margin-top: 20px;">
|
|
||||||
<el-button @click="handleExport('2')" class="tables" type="primary">导出</el-button>
|
<el-button @click="handleExport('2')" class="tables" type="primary">导出</el-button>
|
||||||
<el-table :data="tableData2" id="exportDiv2" :height="tableHeight">
|
|
||||||
|
<scTable :data="tableData2" id="exportDiv2" :height="rightHeight" hideDo>
|
||||||
<el-table-column type="index" width="50" />
|
<el-table-column type="index" width="50" />
|
||||||
<el-table-column label="日期" prop="date">
|
<el-table-column label="日期" prop="date">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
|
@ -108,9 +96,9 @@
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="数量" prop="数量">
|
<el-table-column label="数量" prop="数量">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</scTable>
|
||||||
</el-card>
|
</el-main>
|
||||||
</el-row>
|
</el-container>
|
||||||
</el-card>
|
</el-card>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
@ -169,6 +157,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tableHeight: 0,
|
tableHeight: 0,
|
||||||
|
rightHeight:0,
|
||||||
tableData1:[],
|
tableData1:[],
|
||||||
tableData2:[],
|
tableData2:[],
|
||||||
materialIn:'',
|
materialIn:'',
|
||||||
|
@ -192,23 +181,22 @@
|
||||||
that.currentMonth = month;
|
that.currentMonth = month;
|
||||||
that.start_date =year+'-'+month+'-01';
|
that.start_date =year+'-'+month+'-01';
|
||||||
that.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
that.end_date = year+'-'+month+'-'+new Date(year, month, 0).getDate();
|
||||||
console.log('that.start_date',that.start_date)
|
|
||||||
console.log('that.end_date',that.end_date)
|
|
||||||
let month1 = month;
|
let month1 = month;
|
||||||
if(month1<10){month1='0'+month1}
|
if(month1<10){month1='0'+month1}
|
||||||
that.queryDate = year+'-'+month1;
|
that.queryDate = year+'-'+month1;
|
||||||
that.firstWeekNum = that.getWeekOfYear(new Date(that.start_date));
|
that.firstWeekNum = that.getWeekOfYear(new Date(that.start_date));
|
||||||
that.endWeekNum = that.getWeekOfYear(new Date(that.end_date));
|
that.endWeekNum = that.getWeekOfYear(new Date(that.end_date));
|
||||||
console.log('that.firstWeekNum',that.firstWeekNum)
|
// console.log('that.firstWeekNum',that.firstWeekNum)
|
||||||
console.log('that.endWeekNum',that.endWeekNum)
|
// console.log('that.endWeekNum',that.endWeekNum)
|
||||||
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
let duration = that.endWeekNum - that.firstWeekNum + 1;
|
||||||
for(let i =1;i<=duration;i++ ){
|
for(let i =1;i<=duration;i++ ){
|
||||||
that.xAxisOrigin.push('第'+i+'周');
|
that.xAxisOrigin.push('第'+i+'周');
|
||||||
}
|
}
|
||||||
that.xAxisData = that.xAxisOrigin;
|
that.xAxisData = that.xAxisOrigin;
|
||||||
let height= document.getElementById('elMain').clientHeight-140;
|
let height= document.getElementById('elMain').clientHeight;
|
||||||
let chartheight = document.getElementById('bachart1').clientHeight;
|
let chartheight = document.getElementById('bachart1').clientHeight;
|
||||||
that.tableHeight = height-chartheight;
|
that.rightHeight = height - 115;
|
||||||
|
that.tableHeight = height-140-chartheight;
|
||||||
this.getInmOption();
|
this.getInmOption();
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
|
@ -242,15 +230,11 @@
|
||||||
materialInChange(){
|
materialInChange(){
|
||||||
this.getInmData();
|
this.getInmData();
|
||||||
},
|
},
|
||||||
materialOutChange(){
|
|
||||||
this.getOutData();
|
|
||||||
},
|
|
||||||
//采购物料选项
|
//采购物料选项
|
||||||
getInmOption(){
|
getInmOption(){
|
||||||
let that = this;
|
let that = this;
|
||||||
let obj = {};
|
let obj = {};
|
||||||
obj.page=0;
|
obj.page=0;
|
||||||
console.log('000000')
|
|
||||||
obj.type__in = '30,40,50,60,70';
|
obj.type__in = '30,40,50,60,70';
|
||||||
that.$API.mtm.material.list.req( obj).then((res) => {
|
that.$API.mtm.material.list.req( obj).then((res) => {
|
||||||
that.inmOption = res;
|
that.inmOption = res;
|
||||||
|
@ -264,7 +248,6 @@
|
||||||
that.outOption = arr;
|
that.outOption = arr;
|
||||||
that.materialOut = arr[1].id;
|
that.materialOut = arr[1].id;
|
||||||
that.getInmData();
|
that.getInmData();
|
||||||
that.getOutData();
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//采购物料
|
//采购物料
|
||||||
|
@ -292,46 +275,23 @@
|
||||||
seriesData[index]=item.数量;
|
seriesData[index]=item.数量;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
debugger;
|
|
||||||
console.log('seriesData',seriesData)
|
|
||||||
option.series.data = seriesData;
|
option.series.data = seriesData;
|
||||||
that.setChart("bachart1", option);
|
that.setChart("bachart1", option);
|
||||||
}else{
|
}else{
|
||||||
that.setChart("bachart1", option);
|
that.setChart("bachart1", option);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
let obj2 = {
|
||||||
//消耗暂定
|
query: { start_date: that.start_date, end_date: that.end_date, mio_type: "pur_in"}
|
||||||
getOutData(){
|
}
|
||||||
let that = this;
|
that.$API.bi.dataset.exec.req(exec, obj2).then((res) => {
|
||||||
let option = deepCopy(that.basicOption);
|
if (res.data2.ds0) {
|
||||||
option.xAxis.data = that.xAxisData;
|
|
||||||
let exec = that.queryType=='月'?'saleOutWeek':'saleOutMonth';
|
|
||||||
let obj = {
|
|
||||||
query: { start_date: that.start_date, end_date: that.end_date, mio_type: "do_out",material_id:that.materialOut },
|
|
||||||
};
|
|
||||||
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
|
||||||
debugger;
|
|
||||||
console.log('getOutData',res);
|
|
||||||
let data = res.data2.ds0;
|
let data = res.data2.ds0;
|
||||||
that.tableData2 = data;
|
that.tableData2 = data;
|
||||||
if(data.length>0){
|
|
||||||
option.series.data = [];
|
|
||||||
let seriesData = [];
|
|
||||||
data.forEach(item=>{
|
|
||||||
if(that.queryType=='月'){
|
|
||||||
let index = item.周-that.firstWeekNum;
|
|
||||||
seriesData[index]=item.数量;
|
|
||||||
} else {
|
} else {
|
||||||
let index = item.月-1;
|
that.tableData2 = [];
|
||||||
seriesData[index]=item.数量;
|
|
||||||
}
|
|
||||||
})
|
|
||||||
option.series.data = seriesData;
|
|
||||||
that.setChart("bachart2", option);
|
|
||||||
}else{
|
|
||||||
that.setChart("bachart2", option);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleQuery(){
|
handleQuery(){
|
||||||
|
@ -367,12 +327,11 @@
|
||||||
that.xAxisData = that.monthList;
|
that.xAxisData = that.monthList;
|
||||||
}
|
}
|
||||||
this.getInmData();
|
this.getInmData();
|
||||||
this.getOutData();
|
|
||||||
},
|
},
|
||||||
handleExport(val) {
|
handleExport(val) {
|
||||||
this.exportLoading = true;
|
this.exportLoading = true;
|
||||||
let id = '#exportDiv' + val;
|
let id = '#exportDiv' + val;
|
||||||
let name = val == '1' ? '采购统计' : '消耗统计';
|
let name = val == '1' ? '采购统计' : '采购统计总表';
|
||||||
this.$XLSX(id, name);
|
this.$XLSX(id, name);
|
||||||
this.exportLoading = false;
|
this.exportLoading = false;
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,224 @@
|
||||||
|
<template>
|
||||||
|
<el-container>
|
||||||
|
<el-aside style="width: 50%;background: #ffffff;">
|
||||||
|
<el-container>
|
||||||
|
<el-header>
|
||||||
|
<div class="left-panel">
|
||||||
|
<span style="font-size: 14px">库存统计</span>
|
||||||
|
</div>
|
||||||
|
<div class="right-panel">
|
||||||
|
<el-select v-model="params.type" clearable @change="materialTypeChange">
|
||||||
|
<el-option v-for="item in materialTypeOptions"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="materialTypeChange"></el-button>
|
||||||
|
<el-button @click="handleExport('1')" type="primary">导出</el-button>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
<el-main>
|
||||||
|
<scTable ref="tables1" :apiObj="apiObj" :params="params" id="exportDiv1" stripe hideDo>
|
||||||
|
<el-table-column type="index" width="50" />
|
||||||
|
<el-table-column label="物料名" prop="name"></el-table-column>
|
||||||
|
<el-table-column label="型号" prop="model"></el-table-column>
|
||||||
|
<el-table-column label="规格" prop="specification"></el-table-column>
|
||||||
|
<el-table-column label="库存总数" prop="count"></el-table-column>
|
||||||
|
<el-table-column label="周预估值" v-if="params.type==30">
|
||||||
|
<template #default="scope">
|
||||||
|
<el-input v-model="scope.row.week_esitimate_consume" @blur="weekcountChange(scope.row)"></el-input>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="可用天数" v-if="params.type==30">
|
||||||
|
<template #default="scope">
|
||||||
|
<span v-if="scope.row.week_esitimate_consume&&scope.row.week_esitimate_consume!==null">
|
||||||
|
{{ Math.floor(scope.row.count/scope.row.week_esitimate_consume)}}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</el-aside>
|
||||||
|
<el-main class="nopadding">
|
||||||
|
<el-container>
|
||||||
|
<el-header>
|
||||||
|
<div class="left-panel">
|
||||||
|
<span style="font-size: 14px">库存出入库统计</span>
|
||||||
|
</div>
|
||||||
|
<div class="right-panel">
|
||||||
|
<el-select v-model="query.mio_type" clearable @change="mioTypeChange" style="width: 100px;">
|
||||||
|
<el-option v-for="e in mioTypeEnum.values" :key="e.key" :value="e.key"
|
||||||
|
:label="e.text"></el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-select v-model="queryType" @change="queryTypeChange" style="width: 100px;">
|
||||||
|
<el-option v-for="item in typeOptions"
|
||||||
|
:key="item" :label="item" :value="item"></el-option>
|
||||||
|
</el-select>
|
||||||
|
<el-date-picker
|
||||||
|
v-if="queryType=='月'"
|
||||||
|
v-model="queryDate"
|
||||||
|
type="month"
|
||||||
|
placeholder="查询月"
|
||||||
|
value-format="YYYY-MM"
|
||||||
|
style="width: 100px;"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
|
<el-date-picker
|
||||||
|
v-if="queryType=='年'"
|
||||||
|
v-model="queryDate"
|
||||||
|
type="year"
|
||||||
|
placeholder="查询年"
|
||||||
|
value-format="YYYY"
|
||||||
|
style="width: 100px;"
|
||||||
|
>
|
||||||
|
</el-date-picker>
|
||||||
|
<el-button type="primary" icon="el-icon-search" @click="handleQuery"></el-button>
|
||||||
|
<el-button @click="handleExport('2')" type="primary">导出</el-button>
|
||||||
|
</div>
|
||||||
|
</el-header>
|
||||||
|
<el-main>
|
||||||
|
<scTable ref="tables2" :data="tableData" id="exportDiv2" stripe hideDo hidePagination>
|
||||||
|
<el-table-column label="物料名" prop="material"></el-table-column>
|
||||||
|
<el-table-column label="型号" prop="model"></el-table-column>
|
||||||
|
<el-table-column label="规格" prop="specification"></el-table-column>
|
||||||
|
<el-table-column label="出入库类型" prop="model">
|
||||||
|
<template>
|
||||||
|
<span></span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<template v-if="queryType=='月'&&(query.mio_type=='pur_in'||query.mio_type=='do_in'||query.mio_type=='other_in')">
|
||||||
|
<el-table-column label="月入库总数" prop="count"></el-table-column>
|
||||||
|
</template>
|
||||||
|
<template v-if="queryType=='月'&&(query.mio_type=='do_out'||query.mio_type=='sale_out'||query.mio_type=='other_out')">
|
||||||
|
<el-table-column label="月出库数量" prop="batch"> </el-table-column>
|
||||||
|
</template>
|
||||||
|
<template v-if="queryType=='年'&&(query.mio_type=='pur_in'||query.mio_type=='do_in'||query.mio_type=='other_in')">
|
||||||
|
<el-table-column label="年入库总数" prop="count"></el-table-column>
|
||||||
|
</template>
|
||||||
|
<template v-if="queryType=='年'&&(query.mio_type=='do_out'||query.mio_type=='sale_out'||query.mio_type=='other_out')">
|
||||||
|
<el-table-column label="年出库总数" prop="count"></el-table-column>
|
||||||
|
</template>
|
||||||
|
</scTable>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</el-main>
|
||||||
|
</el-container>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { mioTypeEnum } from "@/utils/enum.js";
|
||||||
|
function deepCopy(obj) {
|
||||||
|
return JSON.parse(JSON.stringify(obj));
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
name: 'chart',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
mioTypeEnum,
|
||||||
|
apiObj: this.$API.mtm.material.list,
|
||||||
|
materialType: '',
|
||||||
|
params: { is_hidden: false, type: 10 ,count__gte:1},
|
||||||
|
query: {
|
||||||
|
mio_type:mioTypeEnum.values[0].key
|
||||||
|
},
|
||||||
|
queryType:'月',
|
||||||
|
queryDate: '',
|
||||||
|
start_date:'',
|
||||||
|
end_date: '',
|
||||||
|
currentYear:'',
|
||||||
|
currentMonth: '',
|
||||||
|
currentLastDay:'',
|
||||||
|
tableData: [],
|
||||||
|
typeOptions: ['月', '年'],
|
||||||
|
materialTypeOptions: [
|
||||||
|
{id:10,name:'成品'},
|
||||||
|
{id:20,name:'半成品'},
|
||||||
|
{id:30,name:'主要原料'},
|
||||||
|
{id:40,name:'辅助材料'},
|
||||||
|
{id:70,name:'办公用品'},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mounted(){
|
||||||
|
let that = this;
|
||||||
|
let date = new Date();
|
||||||
|
let year = date.getFullYear();
|
||||||
|
let month = date.getMonth() + 1;
|
||||||
|
let lastDay = new Date(year, month, 0).getDate();
|
||||||
|
that.currentYear = year;
|
||||||
|
that.currentMonth = month > 9 ? month : '0' + month;
|
||||||
|
that.currentLastDay = lastDay;
|
||||||
|
that.queryDate = that.currentYear + '-' + that.currentMonth;
|
||||||
|
that.start_date = that.currentYear + '-'+ that.currentMonth + '-01';
|
||||||
|
that.end_date = that.currentYear + '-'+ that.currentMonth + '-'+lastDay;
|
||||||
|
that.getInmData();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
materialTypeChange() {
|
||||||
|
this.$refs.tables1.refresh();
|
||||||
|
},
|
||||||
|
//更改周预估用量
|
||||||
|
weekcountChange(row) {
|
||||||
|
let obj = { week_esitimate_consume: row.week_esitimate_consume };
|
||||||
|
this.$API.mtm.material.setWeekConsume.req(row.id, obj).then(res => {
|
||||||
|
console.log(res);
|
||||||
|
this.$refs.tables1.refresh();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
//获取表格数据
|
||||||
|
getInmData(){
|
||||||
|
let that = this;
|
||||||
|
let exec = that.queryType=='月'?'saleOutMonth':'saleOutYear';
|
||||||
|
let obj = {
|
||||||
|
query: { start_date: that.start_date, end_date: that.end_date, mio_type: that.query.mio_type},
|
||||||
|
};
|
||||||
|
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
|
||||||
|
if (res.data2.ds0) {
|
||||||
|
let data = res.data2.ds0;
|
||||||
|
that.tableData = data;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleQuery(){
|
||||||
|
let that = this;
|
||||||
|
if(that.queryType=='月'){
|
||||||
|
if(that.queryDate!==''&&that.queryDate!==null){
|
||||||
|
that.start_date =that.queryDate+'-01';
|
||||||
|
let arr = that.queryDate.split('-');
|
||||||
|
that.end_date = that.queryDate+'-'+new Date(arr[0], arr[1], 0).getDate();
|
||||||
|
}else{
|
||||||
|
that.start_date =that.currentYear+'-'+this.currentMonth+'-01';
|
||||||
|
that.end_date = that.currentYear+'-'+this.currentMonth+'-'+that.currentLastDay;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(this.queryDate!==''&&this.queryDate!==null){
|
||||||
|
this.start_date = this.queryDate+'-01-01';
|
||||||
|
this.end_date = this.queryDate+'-12-31';
|
||||||
|
}else{
|
||||||
|
this.start_date = this.currentYear+'-01-01';
|
||||||
|
this.end_date = this.currentYear+'-12-31';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.getInmData();
|
||||||
|
},
|
||||||
|
handleExport(val) {
|
||||||
|
this.exportLoading = true;
|
||||||
|
let id = '#exportDiv' + val;
|
||||||
|
let name = val == '1' ? '库存统计' : '库存出入库统计';
|
||||||
|
this.$XLSX(id, name);
|
||||||
|
this.exportLoading = false;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.tables {
|
||||||
|
position: absolute;
|
||||||
|
top: 4px;
|
||||||
|
right: 6px;
|
||||||
|
z-index: 10;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue