货品供应商对接(货品名称)

This commit is contained in:
zzyuan 2025-07-17 10:03:11 +08:00
parent ab6898af75
commit 574236d09f
2 changed files with 228 additions and 136 deletions

View File

@ -87,7 +87,41 @@ export function supplyStatisticsPageApi(data) {
// 货品供应商关联list
export function supplierBindMaterialListApi(data) {
return request({
url: '/smart-canteen/ims_supplier_bind_material/list',
method: 'get',
headers: {
//"merchant-id":"378915229716713472",
},
params:data
})
}
// 货品供应商-新增
export function addSupplierBindMaterialApi(data) {
return request({
url: '/smart-canteen/ims_supplier_bind_material',
method: 'post',
headers: {
//"merchant-id":"378915229716713472",
},
data: data
})
}
// 货品供应商-修改
export function editSupplierBindMaterialApi(data) {
return request({
url: '/smart-canteen/ims_supplier_bind_material/edit',
method: 'post',
headers: {
//"merchant-id":"378915229716713472",
},
data: data
})
}

View File

@ -3,15 +3,14 @@
<el-tabs v-model="activeName" @tab-click="handleTabClick"> <el-tabs v-model="activeName" @tab-click="handleTabClick">
<el-tab-pane label="货品名称" name="material"> <el-tab-pane label="货品名称" name="material">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="食堂" prop="canteenId"> <el-form-item label="供应商名称" prop="supplierName">
<el-select v-model="queryParams.canteenId" placeholder="请选择食堂" clearable style="width: 240px;"> <el-input
<el-option v-for="item in canteenOptions" v-model="queryParams.supplierName"
:key="item.canteenId" placeholder="请输入供应商名称"
:label="item.canteenName" clearable maxlength="30"
:value="item.canteenId" style="width: 240px"
></el-option> />
</el-select> </el-form-item>
</el-form-item>
<el-form-item label="货品类别" prop="categoryIdList"> <el-form-item label="货品类别" prop="categoryIdList">
<el-cascader <el-cascader
v-model="queryParams.categoryIdList" v-model="queryParams.categoryIdList"
@ -25,15 +24,7 @@
placeholder="请选择货品类别" collapse-tags placeholder="请选择货品类别" collapse-tags
clearable style="width: 240px;" clearable style="width: 240px;"
/> />
</el-form-item> </el-form-item>
<el-form-item label="货品名称" prop="key">
<el-input
v-model="queryParams.key"
placeholder="请输入货品名称"
clearable maxlength="30"
style="width: 240px"
/>
</el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@ -50,53 +41,58 @@
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="tableListData" height="800"> <el-table v-loading="loading" :data="tableListData" height="800" :row-key="(row)=>{return row.id}" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="50" align="center" :reserve-selection="true" />
<el-table-column label="序号" align="center" width="80" type="index" fixed="left"> <el-table-column label="序号" align="center" width="80" type="index" fixed="left">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span> <span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" /> <el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" />
<el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" /> <el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="货品类别" align="center" prop="categoryName" :show-overflow-tooltip="true" /> <el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="货品规格" align="center" prop="" :show-overflow-tooltip="true" /> <el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true" />
<el-table-column label="所属区域" align="center" prop="areaName" :show-overflow-tooltip="true" /> <el-table-column label="所属区域" align="center" prop="areaName" :show-overflow-tooltip="true" />
<!-- <el-table-column label="是否供应" align="center" prop="ifSupply" :show-overflow-tooltip="true" width="120"> <!-- <el-table-column label="是否供应" align="center" prop="ifSupply" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.ifSupply" placeholder="是否供应" style="width: 100%;"> <el-select v-model="scope.row.ifSupply" placeholder="是否供应" style="width: 100%;">
<el-option label="是" :value="1"></el-option> <el-option label="是" :value="1"></el-option>
<el-option label="否" :value="2"></el-option> <el-option label="否" :value="2"></el-option>
</el-select> </el-select>
</template> </template>
</el-table-column> --> </el-table-column> -->
<el-table-column label="首选供应商" align="center" prop="supplierName" :show-overflow-tooltip="true"> <el-table-column label="首选供应商" align="center" prop="supplierId" :show-overflow-tooltip="true" width="150">
<template slot-scope="scope"> <template slot-scope="scope">
<el-select v-model="scope.row.supplierId" placeholder="首选供应商" style="width: 100%;"> <el-select v-model="scope.row.supplierId" placeholder="请选择供应商" style="width: 100%;" @change="changSupplier(scope.row)">
<el-option label="是" :value="1"></el-option> <el-option v-for="item in supplierOptions"
<el-option label="否" :value="2"></el-option> :key="item.supplierId"
</el-select> :label="item.supplierName"
</template> :value="item.supplierId"
</el-table-column> ></el-option>
<el-table-column label="备选供应商" align="center" prop="" :show-overflow-tooltip="true"> </el-select>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>选择</el-button>
</template>
</el-table-column>
<el-table-column label="中标供应商" align="center" prop="" :show-overflow-tooltip="true"/>
<el-table-column label="最近一次供货" align="center">
<!-- <el-table-column label="供应商名称" align="center" prop="lastOrderGoodsSupplierName" width="120" :show-overflow-tooltip="true" /> -->
<el-table-column label="时间" align="center" prop="lastOrderGoodsDate" width="160" :show-overflow-tooltip="true" />
<el-table-column label="价格" align="center" prop="lastOrderGoodsPrice" width="120" :show-overflow-tooltip="true" >
<template slot-scope="scope">
<span>{{ (scope.row.lastOrderGoodsPrice/100).toFixed(2) }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table-column> <el-table-column label="备选供应商" align="center" prop="supplierIdList" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-select v-model="scope.row.supplierIdList" multiple :multiple-limit="3" placeholder="请选择供应商" style="width: 100%;" @change="changSupplierList(scope.row)">
<el-option v-for="item in supplierOptions"
:key="item.supplierId"
:label="item.supplierName"
:value="item.supplierId"
></el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="中标供应商" align="center" prop="supplierName" :show-overflow-tooltip="true"/>
<el-table-column label="最近一次供货" align="center">
<!-- <el-table-column label="供应商名称" align="center" prop="lastOrderGoodsSupplierName" width="120" :show-overflow-tooltip="true" /> -->
<el-table-column label="时间" align="center" prop="lastOrderGoodsDate" width="160" :show-overflow-tooltip="true" />
<el-table-column label="价格" align="center" prop="lastOrderGoodsPrice" width="120" :show-overflow-tooltip="true" >
<template slot-scope="scope">
<span>{{ (scope.row.lastOrderGoodsPrice/100).toFixed(2) }}</span>
</template>
</el-table-column>
</el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
@ -107,16 +103,7 @@
/> />
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="货品类别" name="category"> <el-tab-pane label="货品类别" name="category">
<el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" v-show="showSearch" label-width="90px"> <el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="食堂" prop="canteenId">
<el-select v-model="queryParams2.canteenId" placeholder="请选择食堂" clearable style="width: 240px;">
<el-option v-for="item in canteenOptions"
:key="item.canteenId"
:label="item.canteenName"
:value="item.canteenId"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="货品类别" prop="categoryIdList"> <el-form-item label="货品类别" prop="categoryIdList">
<el-cascader <el-cascader
v-model="queryParams2.categoryIdList" v-model="queryParams2.categoryIdList"
@ -218,31 +205,29 @@
<el-row> <el-row>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="首选供应商" prop="supplierId"> <el-form-item label="首选供应商" prop="supplierId">
<el-select v-model="batchForm.supplierId" placeholder="请选择供应商" style="width: 100%;"> <el-select v-model="batchForm.supplierId" placeholder="请选择首选供应商" style="width: 100%;">
<el-option label="供应商1" :value="1"></el-option> <el-option v-for="item in supplierOptions"
<el-option label="供应商2" :value="2"></el-option> :key="item.supplierId"
<el-option label="供应商3" :value="3"></el-option> :label="item.supplierName"
<el-option label="供应商4" :value="4"></el-option> :value="item.supplierId"
<el-option label="供应商5" :value="5"></el-option> ></el-option>
<el-option label="供应商6" :value="6"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备选供应商" prop=""> <el-form-item label="备选供应商" prop="supplierIdList">
<el-select v-model="form.paymentDays" multiple collapse-tags placeholder="请选择备选供应商" style="width: 100%;"> <el-select v-model="batchForm.supplierIdList" multiple :multiple-limit="3" collapse-tags placeholder="请选择备选供应商" style="width: 100%;">
<el-option label="供应商1" :value="1"></el-option> <el-option v-for="item in supplierOptions"
<el-option label="供应商2" :value="2"></el-option> :key="item.supplierId"
<el-option label="供应商3" :value="3"></el-option> :label="item.supplierName"
<el-option label="供应商4" :value="4"></el-option> :value="item.supplierId"
<el-option label="供应商5" :value="5"></el-option> ></el-option>
<el-option label="供应商6" :value="6"></el-option> </el-select>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="是否供应" prop="ifSupply"> <el-form-item label="是否供应" prop="ifSupply">
<el-select v-model="form.ifSupply" placeholder="是否供应" style="width: 100%;"> <el-select v-model="batchForm.ifSupply" placeholder="是否供应" style="width: 100%;">
<el-option label="是" :value="1"></el-option> <el-option label="是" :value="1"></el-option>
<el-option label="否" :value="2"></el-option> <el-option label="否" :value="2"></el-option>
</el-select> </el-select>
@ -251,7 +236,7 @@
</el-row> </el-row>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="openBatch=false"> </el-button> <el-button type="primary" @click="confirmBatchEdit"> </el-button>
<el-button @click="openBatch=false"> </el-button> <el-button @click="openBatch=false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -261,10 +246,9 @@
</div> </div>
</template> </template>
<script> <script>
import { systemAreaTreeApi,getCanteenByAreaApi } from "@/api/base/stall";
import { systemMaterialTreeApi } from "@/api/dish/material"; import { systemMaterialTreeApi } from "@/api/dish/material";
import { getPageCanteenApi } from "@/api/base/canteen"; import { supplierBindMaterialListApi,supplierPageApi,addSupplierBindMaterialApi, editSupplierBindMaterialApi } from "@/api/foodManage/supplierManage";
export default { export default {
name: "", name: "",
@ -281,8 +265,8 @@ export default {
multiple: true, multiple: true,
// //
showSearch: true, showSearch: true,
treeTypeOptions:[],// treeTypeOptions:[],//
canteenOptions:[],// supplierOptions:[],//
activeName:'material', activeName:'material',
//----------- //-----------
// //
@ -293,8 +277,7 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
key: undefined, supplierName: undefined,
canteenId: undefined,
categoryIdList:[] categoryIdList:[]
}, },
//----------- //-----------
@ -319,18 +302,25 @@ export default {
{ required: true, message: "供应商名称不能为空", trigger: "blur" } { required: true, message: "供应商名称不能为空", trigger: "blur" }
] ]
}, },
batchRows:[],
openBatch: false, openBatch: false,
batchForm: {}, batchForm: {},
batchRules: { batchRules: {
supplierId: [ supplierId: [
{ required: true, message: "供应商名称不能为空", trigger: "blur" } { required: true, message: "首选供应商不能为空", trigger: "change" }
] ],
supplierIdList: [
{ required: true, message: "备选供应商不能为空", trigger: "change" }
],
ifSupply: [
{ required: true, message: "是否供应不能为空", trigger: "change" }
],
}, },
}; };
}, },
created() { created() {
this.getTypeTreeData(); this.getTypeTreeData();
this.getCanteenData(); this.getSupplierData();
this.getList(); this.getList();
}, },
methods: { methods: {
@ -342,23 +332,19 @@ export default {
systemMaterialTreeApi(param).then((response) => { systemMaterialTreeApi(param).then((response) => {
this.treeTypeOptions = response.data; this.treeTypeOptions = response.data;
}); });
}, },
// /** 查询供应商下拉结构 */
getCanteenData() { getSupplierData() {
let param= { supplierPageApi({ isPaging:1,areaIdList:[] }).then((response) => {
"canteenType": 1 this.supplierOptions = response.rows||[];
}
getCanteenByAreaApi(param).then((response) => {
this.canteenOptions=response.rows||[];
}); });
}, },
handleTabClick(){ handleTabClick(){
if(this.activeName=='material'){ if(this.activeName=='material'){
this.queryParams={ this.queryParams={
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
key: undefined, supplierName: undefined,
canteenId: undefined,
categoryIdList:[] categoryIdList:[]
} }
this.resetForm("queryForm"); this.resetForm("queryForm");
@ -367,8 +353,7 @@ export default {
if(this.activeName=='category'){ if(this.activeName=='category'){
this.queryParams2={ this.queryParams2={
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
canteenId: undefined,
categoryIdList:[] categoryIdList:[]
} }
this.resetForm("queryForm2"); this.resetForm("queryForm2");
@ -393,28 +378,104 @@ export default {
let param = { let param = {
"pageNum": this.queryParams.pageNum, "pageNum": this.queryParams.pageNum,
"pageSize": this.queryParams.pageSize, "pageSize": this.queryParams.pageSize,
"key": this.queryParams.key, "supplierName": this.queryParams.supplierName,
"canteenId": this.queryParams.canteenId, "categoryIdList": this.queryParams.categoryIdList,
"categoryIdList": this.queryParams.categoryIdList,
"configType": 1,
} }
// getPageCanteenApi(param).then(response => { supplierBindMaterialListApi(param).then(response => {
// this.tableListData = response.rows; this.tableListData = response.rows;
// this.total = Number(response.total); this.tableListData.forEach(item=>{
let arr=[]
if(item.alternativeSuppliers&&item.alternativeSuppliers.length>0){
item.alternativeSuppliers.forEach(sub=>{
arr.push(sub.supplierId)
})
}
this.$set(item,"supplierIdList",arr)
})
this.total = Number(response.total);
this.loading = false; this.loading = false;
// }); });
},
changSupplier(row){
console.log(row)
let param = [
{
"id":row.id,
"canteenId": row.canteenId,
"supplierId": row.supplierId,
"materialId": row.materialId,
"alternativeSuppliers": row.alternativeSuppliers,
"ifSupply": row.ifSupply
}
]
editSupplierBindMaterialApi(param).then(response => {
this.$modal.msgSuccess("修改成功");
this.getList();
});
},
changSupplierList(row){
let param = [
{
"id":row.id,
"canteenId": row.canteenId,
"supplierId": row.supplierId,
"materialId": row.materialId,
"alternativeSuppliers": [],
"ifSupply": row.ifSupply
}
]
if(row.supplierIdList&&row.supplierIdList.length>0){
row.supplierIdList.forEach(item => {
param[0].alternativeSuppliers.push({"supplierId":item})
})
}else{
param[0].alternativeSuppliers=[]
}
editSupplierBindMaterialApi(param).then(response => {
// this.$modal.msgSuccess("");
// this.getList();
});
},
//
handleSelectionChange(selection) {
this.batchRows = selection
}, },
handleBatch(){ handleBatch(){
this.batchForm={} if(this.batchRows.length==0){
this.resetForm("batchForm"); this.$modal.msgError("请先选择货品!");
this.openBatch=true }else{
this.batchForm={}
this.resetForm("batchForm");
this.openBatch=true
}
},
confirmBatchEdit(){
this.$refs["batchForm"].validate(valid => {
if (valid) {
let arr = [];
this.batchForm.supplierIdList.forEach(item => {
arr.push({"supplierId":item})
})
let param =[]
this.batchRows.forEach(item=>{
let obj = {
"id":item.id,
"canteenId": item.canteenId,
"supplierId": this.batchForm.supplierId,
"materialId": item.materialId,
"alternativeSuppliers": arr,
"ifSupply": this.batchForm.ifSupply
}
param.push(obj)
})
console.log(param)
editSupplierBindMaterialApi(param).then(response => {
this.$modal.msgSuccess("修改成功");
this.openBatch=false
this.getList();
});
}
})
}, },
@ -437,13 +498,10 @@ export default {
this.loading = true; this.loading = true;
let param = { let param = {
"pageNum": this.queryParams2.pageNum, "pageNum": this.queryParams2.pageNum,
"pageSize": this.queryParams2.pageSize, "pageSize": this.queryParams2.pageSize,
"key": this.queryParams2.key, "categoryIdList": this.queryParams2.categoryIdList,
"canteenId": this.queryParams2.canteenId,
"categoryIdList": this.queryParams2.categoryIdList,
"configType": 1,
} }
// getPageCanteenApi(param).then(response => { // supplierBindMaterialListApi(param).then(response => {
// this.tableListData2 = response.rows; // this.tableListData2 = response.rows;
// this.total2 = Number(response.total); // this.total2 = Number(response.total);
this.loading = false; this.loading = false;