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