物料统计

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"> <el-table-column label="操作" fixed="right" align="center" width="100px">
<template #default="scope"> <template #default="scope">
<!-- <el-link type="primary" @click="table_check(scope.row)" v-if="mioObj.state==20&&mioObj.type=='do_in'"> --> <!-- <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>
<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>
<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> </el-button>
</template> </template>

View File

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