fix:库存统计变更接口materialCount2

This commit is contained in:
shijing 2025-12-05 15:09:56 +08:00
parent 086c7a2a6b
commit ee65f15665
1 changed files with 58 additions and 48 deletions

View File

@ -42,13 +42,13 @@
<scTable v-else ref="tables11" :data="tableData11" id="exportDiv1" stripe hideDo hidePagination <scTable v-else ref="tables11" :data="tableData11" id="exportDiv1" stripe hideDo hidePagination
:summary-method="getSummaries2" show-summary row-key="id"> :summary-method="getSummaries2" show-summary row-key="id">
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="物料名" prop="name" :filters="nameFilters11" <el-table-column label="物料名" prop="material_name" :filters="nameFilters11"
:filter-method="filterName11" filter-placement="bottom-end" /> :filter-method="filterName11" filter-placement="bottom-end" />
<el-table-column label="型号" prop="model" :filters="modelFilters11" <el-table-column label="型号" prop="material_model" :filters="modelFilters11"
:filter-method="filterModel11" filter-placement="bottom-end" /> :filter-method="filterModel11" filter-placement="bottom-end" />
<el-table-column label="规格" prop="specification" :filters="specsFilters11" <el-table-column label="规格" prop="material_specification" :filters="specsFilters11"
:filter-method="filterSpecs11" filter-placement="bottom-end" /> :filter-method="filterSpecs11" filter-placement="bottom-end" />
<el-table-column label="仓库合格品数" prop="count_mb" /> <el-table-column label="仓库合格品数" prop="count" />
<el-table-column label="周预估值" v-if="params.type == 30"> <el-table-column label="周预估值" v-if="params.type == 30">
<template #default="scope"> <template #default="scope">
<el-input v-model="scope.row.week_esitimate_consume" <el-input v-model="scope.row.week_esitimate_consume"
@ -274,39 +274,35 @@ export default {
that.nameFilters11 = []; that.nameFilters11 = [];
that.modelFilters11 = []; that.modelFilters11 = [];
that.specsFilters11 = []; that.specsFilters11 = [];
let nameList = [], specsList = [], modelList = []; let obj = {query: {"material_types": this.params.type,}};
if (that.material_name !== '' && that.material_name !== null) { that.$API.bi.dataset.exec.req("materialCount2", obj).then((res) => {
that.params.name = that.material_name; if (res.data2.ds0) {
} let data = res.data2.ds0;
that.params.query = '{id,name,model,specification,count_mb,week_esitimate_consume}'; that.tableData11 = data;
this.$API.mtm.material.list.req(that.params).then((res) => { if(data.length>0){
that.tableData11 = res; data.forEach((ite)=>{
if (res.length > 0) { if (that.nameFilters11.findIndex(i=>i.value==ite.material_name)<0) {
res.forEach((ite) => { let obj={};
if (nameList.indexOf(ite.name) > -1) { } else { obj.text=ite.material_name;
nameList.push(ite.name); obj.value=ite.material_name;
let obj = {};
obj.text = ite.name;
obj.value = ite.name;
that.nameFilters11.push(obj); that.nameFilters11.push(obj);
} }
if (modelList.indexOf(ite.model) > -1) { } else { if (that.modelFilters11.findIndex(i=>i.value==ite.material_model)<0) {
modelList.push(ite.model); let obj2={};
let obj2 = {}; obj2.text=ite.material_model;
obj2.text = ite.model; obj2.value=ite.material_model;
obj2.value = ite.model;
that.modelFilters11.push(obj2); that.modelFilters11.push(obj2);
} }
if (specsList.indexOf(ite.specification) > -1) { } else { if (that.specsFilters11.findIndex(i=>i.value==ite.material_specification)<0) {
specsList.push(ite.specification); let obj3={};
let obj3 = {}; obj3.text=ite.material_specification;
obj3.text = ite.specification; obj3.value=ite.material_specification;
obj3.value = ite.specification;
that.specsFilters11.push(obj3); that.specsFilters11.push(obj3);
} }
}); })
} }
}); }
})
}, },
materialTypeChange() { materialTypeChange() {
let that = this; let that = this;
@ -329,17 +325,31 @@ export default {
"select_material": "", "select_material": "",
"groupby_material": "" "groupby_material": ""
}; };
if(that.params.type==40){ let query2 = {
query.select_material="material.cate as cate"; "material_types": this.params.type,
query.groupby_material="material.cate"; "select_material": "material.name as material_name",
query.select_material_name = ""; "groupby_material": "material.name"
query.groupby_material_name = "";
} }
if(that.params.type==10||that.params.type==20){
this.$API.bi.dataset.exec.req("materialCount", {query:query }).then((res) => { this.$API.bi.dataset.exec.req("materialCount", {query:query }).then((res) => {
if (res.echart_options) { if (res.echart_options) {
this.echartsOptions = JSON.parse(res.echart_options); this.echartsOptions = JSON.parse(res.echart_options);
} }
}) })
}else{
if(that.params.type==40){
query2.select_material="material.cate as cate";
query2.groupby_material="material.cate";
query2.select_material_name = "";
query2.groupby_material_name = "";
}
this.$API.bi.dataset.exec.req("materialCount2", {query:query2 }).then((res) => {
if (res.echart_options) {
this.echartsOptions = JSON.parse(res.echart_options);
}
})
}
}, },
// //
weekcountChange(row) { weekcountChange(row) {
@ -521,13 +531,13 @@ export default {
return row.dept_name == value; return row.dept_name == value;
}, },
filterName11(value, row) { filterName11(value, row) {
return row.name == value; return row.material_name == value;
}, },
filterSpecs11(value, row) { filterSpecs11(value, row) {
return row.specification == value; return row.material_specification == value;
}, },
filterModel11(value, row) { filterModel11(value, row) {
return row.model == value; return row.material_model == value;
}, },
filterName2(value, row) { filterName2(value, row) {
return row.物料名 == value; return row.物料名 == value;