fix:辅料库物料清单添加筛选项

This commit is contained in:
shijing 2025-08-25 14:00:27 +08:00
parent 90f717c625
commit ee37dee001
2 changed files with 70 additions and 34 deletions

View File

@ -1,22 +1,8 @@
<template> <template>
<el-container> <el-container>
<el-header> <el-header>
<!-- <div class="left-panel"> <div class="left-panel">
<el-select </div>
v-model="query.warehouse"
clearable
placeholder="所在仓库"
@change="handleQuery"
style="width: 150px"
>
<el-option
v-for="item in warehouseOptions"
:key="item.id"
:label="item.name"
:value="item.id"
></el-option>
</el-select>
</div> -->
<div class="right-panel"> <div class="right-panel">
<el-input <el-input
v-model="query.search" v-model="query.search"
@ -41,7 +27,7 @@
v-if="project_code=='gx'" v-if="project_code=='gx'"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="日期" prop="update_time"> <el-table-column label="日期" prop="update_time" sortable>
</el-table-column> </el-table-column>
<el-table-column label="物料编号"> <el-table-column label="物料编号">
<template #default="scope"> <template #default="scope">
@ -65,24 +51,29 @@
<span v-if="scope.row.material_&&scope.row.material_.model">{{ scope.row.material_.model }}</span> <span v-if="scope.row.material_&&scope.row.material_.model">{{ scope.row.material_.model }}</span>
</template> </template>
</el-table-column> </el-table-column>
<!--
:filters="unitFilters"
:filter-method="filterUnitDate"
filter-placement="bottom-end"
-->
<el-table-column label="单位"> <el-table-column label="单位">
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.material_&&scope.row.material_.unit">{{ scope.row.material_.unit }}</span> <span v-if="scope.row.material_&&scope.row.material_.unit">{{ scope.row.material_.unit }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="安全库存"> <el-table-column label="安全库存" sortable>
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.material_&&scope.row.material_.count_safe">{{ scope.row.material_.count_safe }}</span> <span v-if="scope.row.material_&&scope.row.material_.count_safe">{{ scope.row.material_.count_safe }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量" prop="count"> <el-table-column label="数量" prop="count" sortable>
</el-table-column> </el-table-column>
<el-table-column label="单价"> <el-table-column label="单价" sortable>
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.material_&&scope.row.material_.unit_price">{{ scope.row.material_.unit_price }}</span> <span v-if="scope.row.material_&&scope.row.material_.unit_price">{{ scope.row.material_.unit_price }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="总金额" prop="expiration_date"> <el-table-column label="总金额" prop="expiration_date" sortable>
<template #default="scope"> <template #default="scope">
<span v-if="scope.row.material_&&scope.row.material_.unit_price">{{ Number(scope.row.material_.unit_price)*Number(scope.row.count) }}</span> <span v-if="scope.row.material_&&scope.row.material_.unit_price">{{ Number(scope.row.material_.unit_price)*Number(scope.row.count) }}</span>
</template> </template>
@ -137,6 +128,7 @@ export default {
apiObj: this.$API.inm.warehouse.batch, apiObj: this.$API.inm.warehouse.batch,
params: { count__gte: 1, material__type__in: "40" }, params: { count__gte: 1, material__type__in: "40" },
selection: [], selection: [],
unitFilters:[],
query: {}, query: {},
warehouseOptions: [], warehouseOptions: [],
wmtype:0, wmtype:0,
@ -148,7 +140,20 @@ export default {
}; };
}, },
mounted() { mounted() {
let that = this;
this.getWarehouse(); this.getWarehouse();
this.$nextTick(() => {
let datas = this.$refs.table.tableData;
that.unitFilters = [];
datas.forEach(item => {
let unit = item.material_.unit;
console.log(unit);
if(that.unitFilters.indexOf(unit) >-1){}else{
that.unitFilters.push(unit)
}
});
console.log(that.unitFilters);
})
}, },
methods: { methods: {
getWarehouse() { getWarehouse() {
@ -156,6 +161,9 @@ export default {
this.warehouseOptions = res; this.warehouseOptions = res;
}); });
}, },
filterUnitDate(value, row) {
return row.单位 === value;
},
handleQuery() { handleQuery() {
this.$refs.table.queryData(this.query); this.$refs.table.queryData(this.query);
}, },

View File

@ -7,20 +7,33 @@
icon="el-icon-plus" icon="el-icon-plus"
@click="add" @click="add"
v-auth="'material.create'" v-auth="'material.create'"
>新增</el-button >新增</el-button>
>
<scFileImport <scFileImport
:templateUrl="materialTemplate" :templateUrl="materialTemplate"
accept=".xlsx" accept=".xlsx"
:apiObj="$API.common.upload" :apiObj="$API.common.upload"
@success="upSuccess" @success="upSuccess"
> ></scFileImport>
</scFileImport> <!-- <el-button
type="primary"
icon="el-icon-download"
@click="exportM"
:loading="exportLoading"
>导出</el-button> -->
</div> </div>
<div class="right-panel"> <div class="right-panel">
<el-select v-model="query.cate" placeholder="辅料类型" style="width: 150px;">
<el-option
v-for="item in mCateEnum.list"
:key="item"
:label="item"
:value="item"
></el-option>
</el-select>
<el-input <el-input
v-model="query.search" v-model="query.search"
placeholder="名称" placeholder="名称/编号/规格/型号"
style="width: 250px;"
clearable clearable
></el-input> ></el-input>
<el-button <el-button
@ -40,9 +53,9 @@
@row-click="rowClick" @row-click="rowClick"
> >
<el-table-column type="index" width="50" /> <el-table-column type="index" width="50" />
<el-table-column label="物料编号" prop="number"> <el-table-column label="物料编号" prop="number" sortable>
</el-table-column> </el-table-column>
<el-table-column label="物料名称" prop="name"> <el-table-column label="物料名称" prop="name" sortable>
</el-table-column> </el-table-column>
<el-table-column label="规格" prop="specification"> <el-table-column label="规格" prop="specification">
</el-table-column> </el-table-column>
@ -57,21 +70,21 @@
></el-tag> ></el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="计量单位" prop="unit"> <el-table-column label="计量单位" prop="unit" sortable>
</el-table-column> </el-table-column>
<el-table-column label="仓库位号" prop="bin_number_main"> <el-table-column label="仓库位号" prop="bin_number_main" sortable>
</el-table-column> </el-table-column>
<el-table-column label="类型" prop="cate"> <el-table-column label="类型" prop="cate">
</el-table-column> </el-table-column>
<el-table-column label="安全库存" prop="count_safe"> <el-table-column label="安全库存" prop="count_safe" sortable>
</el-table-column> </el-table-column>
<el-table-column label="单价" prop="unit_price"> <el-table-column label="单价" prop="unit_price" sortable>
</el-table-column> </el-table-column>
<el-table-column label="总价" prop="count_safe"> <!-- <el-table-column label="总价" prop="count_safe">
<template #default="scope"> <template #default="scope">
{{ scope.row.unit_price * scope.row.count }} {{ scope.row.unit_price * scope.row.count }}
</template> </template>
</el-table-column> </el-table-column> -->
<el-table-column <el-table-column
v-if="materialType == ''" v-if="materialType == ''"
label="操作" label="操作"
@ -121,6 +134,7 @@
import scFileImport from "@/components/scFileImport"; import scFileImport from "@/components/scFileImport";
import saveDialog from "./../mtm/materials_form_gx.vue"; import saveDialog from "./../mtm/materials_form_gx.vue";
import { ElLoading } from "element-plus"; import { ElLoading } from "element-plus";
import { mCateEnum } from "@/utils/enum.js";
export default { export default {
name: "rparty", name: "rparty",
@ -140,6 +154,7 @@ export default {
}, },
data() { data() {
return { return {
mCateEnum,
project_code : this.$TOOL.data.get("BASE_INFO").base.base_code, project_code : this.$TOOL.data.get("BASE_INFO").base.base_code,
materialTemplate: " /media/default/template/material.xlsx", materialTemplate: " /media/default/template/material.xlsx",
dialog: { dialog: {
@ -156,6 +171,7 @@ export default {
}, },
materialId: "", materialId: "",
materialName: "", materialName: "",
exportLoading:false,
}; };
}, },
mounted() { mounted() {
@ -228,6 +244,18 @@ export default {
resetQuery() { resetQuery() {
this.query = {}; this.query = {};
}, },
exportM(){
let that = this;
// that.$API.mtm.material.list.req({ page:0}).then((res) => {
// that.tableData = res;
// console.log(that.tableData);
// that.exportLoading = true;
// setTimeout(() => {
// that.$XLSX("#myTable", '');
// that.exportLoading = false;
// }, 1000);
// })
},
upSuccess(res, close) { upSuccess(res, close) {
close(); close();
const loading = ElLoading.service({ const loading = ElLoading.service({