物料统计

This commit is contained in:
shijing 2024-01-09 17:02:38 +08:00
parent ef2612f2b7
commit 5109a85764
2 changed files with 93 additions and 53 deletions

View File

@ -44,13 +44,14 @@
<el-table-column label="操作" fixed="right" align="center" width="100px">
<template #default="scope">
<!-- <el-link type="primary" @click="table_check(scope.row)" v-if="mioObj.state==20&&mioObj.type=='do_in'"> -->
<el-button link type="primary" @click="table_check(scope.row)" v-if="scope.row.test_date==null" v-auth="'mioitem.test'">
<el-button link type="primary" @click="table_check(scope.row)"
v-if="scope.row.test_date==null&&mioObj.state==20&&(type=='pur_in'||type=='do_in')" v-auth="'mioitem.test'">
检验
</el-button>
<el-button link type="primary" @click="check_Show(scope.row)" v-else>
<el-button link type="primary" @click="check_Show(scope.row)" v-if="scope.row.test_date!==null">
查看
</el-button>
<el-button link type="danger" @click="table_del(scope.row)" v-if="scope.row.test_date==null">
<el-button link type="danger" @click="table_del(scope.row)" v-if="mioObj.state==10">
删除
</el-button>
</template>

View File

@ -38,10 +38,10 @@
<el-header>
<div class="right-panel">
<h2>采购统计</h2>
<el-select v-model="material_id" clearable @change="materialChange">
<el-select v-model="materialIn" clearable @change="materialInChange">
<el-option v-for="item in inmOption"
:key="item.id"
:label="item.name"
:label="item.full_name"
:value="item.id"
>
</el-option>
@ -54,13 +54,18 @@
<!-- <scEcharts height="300px" :option="option2"></scEcharts> -->
</el-col>
<el-col>
<el-table :data="tableData">
<el-table :data="tableData1">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
<template #default="scope">
<span>{{ scope.row. }}-</span>
<span v-if="scope.row.周">{{ scope.row.周 }}</span>
<span v-if="scope.row.月">{{ scope.row.月 }}</span>
</template>
</el-table-column>
<el-table-column label="名称" prop="name">
<el-table-column label="名称" prop="物料">
</el-table-column>
<el-table-column label="数量" prop="count">
<el-table-column label="数量" prop="数量">
</el-table-column>
</el-table>
</el-col>
@ -72,10 +77,10 @@
<el-header>
<div class="right-panel">
<h2>消耗统计</h2>
<el-select v-model="product" clearable @change="productChange">
<el-option v-for="item in inmOption"
<el-select v-model="materialOut" clearable @change="materialOutChange">
<el-option v-for="item in outOption"
:key="item.id"
:label="item.name"
:label="item.full_name"
:value="item.id"
>
</el-option>
@ -88,13 +93,18 @@
<!-- <scEcharts height="300px" :option="option2"></scEcharts> -->
</el-col>
<el-col>
<el-table :data="tableData">
<el-table :data="tableData2">
<el-table-column type="index" width="50" />
<el-table-column label="日期" prop="date">
<template #default="scope">
<span>{{ scope.row. }}-</span>
<span v-if="scope.row.周">{{ scope.row.周 }}</span>
<span v-if="scope.row.月">{{ scope.row.月 }}</span>
</template>
</el-table-column>
<el-table-column label="名称" prop="name">
<el-table-column label="名称" prop="物料">
</el-table-column>
<el-table-column label="数量" prop="count">
<el-table-column label="数量" prop="数量">
</el-table-column>
</el-table>
</el-col>
@ -149,19 +159,16 @@
type: 'value'
},
lenged:[],
series: [{
series: {
data: [0, 0, 0, 0, 0, 0, 0],
stack: 'Ad',
type: 'bar',
barWidth: '15px',
}]
}
},
tableData:[
{id:1,date:'2023-12-11',name:'ZJ2-1',count:200},
{id:1,date:'2023-12-11',name:'ZJ2-2',count:200},
{id:1,date:'2023-12-11',name:'ZJ2-3',count:200},
{id:1,date:'2023-12-11',name:'ZJ2-4',count:200},
],
tableData1:[],
tableData2:[],
materialIn:'',
firstWeekNum:1,
endWeekNum:1,
product:'',
@ -193,13 +200,6 @@
}
that.xAxisData = that.xAxisOrigin;
this.getInmOption();
// this.getOutOption();
let option = deepCopy(that.basicOption);
option.xAxis.data = that.xAxisData;
that.setChart("bachart1", option);
let option2 = deepCopy(that.basicOption);
option2.xAxis.data = that.xAxisData;
that.setChart("bachart2", option2);
},
methods:{
setChart(name, option = null) {
@ -229,60 +229,99 @@
console.log(value)
this.queryDate = '';
},
materialChange(){},
materialInChange(){
this.getInmData();
},
materialOutChange(){
this.getOutData();
},
//
getInmOption(){
let that = this;
let obj = {};
obj.page=0;
console.log('000000')
obj.type__in = '30,40,50,60,70';
that.$API.mtm.material.list.req( obj).then((res) => {
that.inmOption = res;
console.log('inmOption',res)
that.materialIn = res[0].id;
that.materialIn = res[1].id;
let arr = [];
res.forEach(item=>{
if(item.type==30){
arr.push(item)
}
});
that.outOption = arr;
that.materialOut = arr[1].id;
that.getInmData();
that.getOutData();
})
},
//
getInmData(){
let that = this;
let option = deepCopy(that.basicOption);
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: "pur_in",material_id:that.materialIn },
};
that.$API.bi.dataset.exec.req(exec, obj).then((res) => {
debugger;
console.log('getInmData',res);
res.forEach(item => {
});
let data = res.data2.ds0;
that.tableData1 = 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{
let index = item.-1;
seriesData[index]=item.数量;
}
})
},
//
getOutOption(){
let that = this;
let obj = {};
obj.page=0;
that.$API.inm.mioitem.list.req( obj).then((res) => {
that.inmOption = res;
console.log('inmOption',res)
that.materialOut = res[0].id;
that.getOutData();
debugger;
console.log('seriesData',seriesData)
option.series.data = seriesData;
that.setChart("bachart1", option);
}else{
that.setChart("bachart1", option);
}
})
},
//
getOutData(){
let that = this;
let option = deepCopy(that.basicOption);
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: "sale_out",material_id:that.materialOut },
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('getInmData',res);
res.forEach(item => {
});
console.log('getOutData',res);
let data = res.data2.ds0;
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{
let index = item.-1;
seriesData[index]=item.数量;
}
})
option.series.data = seriesData;
that.setChart("bachart2", option);
}else{
that.setChart("bachart2", option);
}
})
},
handleQuery(){