货品供应商对接(货品名称)
This commit is contained in:
parent
ab6898af75
commit
574236d09f
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,15 +3,14 @@
|
|||
<el-tabs v-model="activeName" @tab-click="handleTabClick">
|
||||
<el-tab-pane label="货品名称" name="material">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="90px">
|
||||
<el-form-item label="食堂" prop="canteenId">
|
||||
<el-select v-model="queryParams.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="supplierName">
|
||||
<el-input
|
||||
v-model="queryParams.supplierName"
|
||||
placeholder="请输入供应商名称"
|
||||
clearable maxlength="30"
|
||||
style="width: 240px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="货品类别" prop="categoryIdList">
|
||||
<el-cascader
|
||||
v-model="queryParams.categoryIdList"
|
||||
|
|
@ -25,15 +24,7 @@
|
|||
placeholder="请选择货品类别" collapse-tags
|
||||
clearable style="width: 240px;"
|
||||
/>
|
||||
</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 icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
|
|
@ -50,53 +41,58 @@
|
|||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</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">
|
||||
<template slot-scope="scope">
|
||||
<span>{{(queryParams.pageNum - 1) * queryParams.pageSize + scope.$index + 1}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<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="categoryName" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="货品规格" align="center" prop="" :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">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.ifSupply" placeholder="是否供应" style="width: 100%;">
|
||||
<el-option label="是" :value="1"></el-option>
|
||||
<el-option label="否" :value="2"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="首选供应商" align="center" prop="supplierName" :show-overflow-tooltip="true">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.supplierId" placeholder="首选供应商" style="width: 100%;">
|
||||
<el-option label="是" :value="1"></el-option>
|
||||
<el-option label="否" :value="2"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备选供应商" align="center" prop="" :show-overflow-tooltip="true">
|
||||
<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>
|
||||
<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="materialTypeName" :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="ifSupply" :show-overflow-tooltip="true" width="120">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.ifSupply" placeholder="是否供应" style="width: 100%;">
|
||||
<el-option label="是" :value="1"></el-option>
|
||||
<el-option label="否" :value="2"></el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column> -->
|
||||
<el-table-column label="首选供应商" align="center" prop="supplierId" :show-overflow-tooltip="true" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-select v-model="scope.row.supplierId" placeholder="请选择供应商" style="width: 100%;" @change="changSupplier(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>
|
||||
<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>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
|
|
@ -107,16 +103,7 @@
|
|||
/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="货品类别" name="category">
|
||||
<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 :model="queryParams2" ref="queryForm2" size="small" :inline="true" v-show="showSearch" label-width="90px">
|
||||
<el-form-item label="货品类别" prop="categoryIdList">
|
||||
<el-cascader
|
||||
v-model="queryParams2.categoryIdList"
|
||||
|
|
@ -218,31 +205,29 @@
|
|||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="首选供应商" prop="supplierId">
|
||||
<el-select v-model="batchForm.supplierId" placeholder="请选择供应商" style="width: 100%;">
|
||||
<el-option label="供应商1" :value="1"></el-option>
|
||||
<el-option label="供应商2" :value="2"></el-option>
|
||||
<el-option label="供应商3" :value="3"></el-option>
|
||||
<el-option label="供应商4" :value="4"></el-option>
|
||||
<el-option label="供应商5" :value="5"></el-option>
|
||||
<el-option label="供应商6" :value="6"></el-option>
|
||||
<el-select v-model="batchForm.supplierId" placeholder="请选择首选供应商" style="width: 100%;">
|
||||
<el-option v-for="item in supplierOptions"
|
||||
:key="item.supplierId"
|
||||
:label="item.supplierName"
|
||||
:value="item.supplierId"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备选供应商" prop="">
|
||||
<el-select v-model="form.paymentDays" multiple collapse-tags placeholder="请选择备选供应商" style="width: 100%;">
|
||||
<el-option label="供应商1" :value="1"></el-option>
|
||||
<el-option label="供应商2" :value="2"></el-option>
|
||||
<el-option label="供应商3" :value="3"></el-option>
|
||||
<el-option label="供应商4" :value="4"></el-option>
|
||||
<el-option label="供应商5" :value="5"></el-option>
|
||||
<el-option label="供应商6" :value="6"></el-option>
|
||||
</el-select>
|
||||
<el-form-item label="备选供应商" prop="supplierIdList">
|
||||
<el-select v-model="batchForm.supplierIdList" multiple :multiple-limit="3" collapse-tags placeholder="请选择备选供应商" style="width: 100%;">
|
||||
<el-option v-for="item in supplierOptions"
|
||||
:key="item.supplierId"
|
||||
:label="item.supplierName"
|
||||
:value="item.supplierId"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<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="2"></el-option>
|
||||
</el-select>
|
||||
|
|
@ -251,7 +236,7 @@
|
|||
</el-row>
|
||||
</el-form>
|
||||
<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>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
|
@ -261,10 +246,9 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { systemAreaTreeApi,getCanteenByAreaApi } from "@/api/base/stall";
|
||||
<script>
|
||||
import { systemMaterialTreeApi } from "@/api/dish/material";
|
||||
import { getPageCanteenApi } from "@/api/base/canteen";
|
||||
import { supplierBindMaterialListApi,supplierPageApi,addSupplierBindMaterialApi, editSupplierBindMaterialApi } from "@/api/foodManage/supplierManage";
|
||||
|
||||
export default {
|
||||
name: "",
|
||||
|
|
@ -281,8 +265,8 @@ export default {
|
|||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
treeTypeOptions:[],//类别树
|
||||
canteenOptions:[],//食堂下拉
|
||||
treeTypeOptions:[],//类别树
|
||||
supplierOptions:[],//供应商下拉
|
||||
activeName:'material',
|
||||
//-----货品名称------
|
||||
// 总条数
|
||||
|
|
@ -293,8 +277,7 @@ export default {
|
|||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
key: undefined,
|
||||
canteenId: undefined,
|
||||
supplierName: undefined,
|
||||
categoryIdList:[]
|
||||
},
|
||||
//-----货品类别------
|
||||
|
|
@ -319,18 +302,25 @@ export default {
|
|||
{ required: true, message: "供应商名称不能为空", trigger: "blur" }
|
||||
]
|
||||
},
|
||||
batchRows:[],
|
||||
openBatch: false,
|
||||
batchForm: {},
|
||||
batchRules: {
|
||||
supplierId: [
|
||||
{ required: true, message: "供应商名称不能为空", trigger: "blur" }
|
||||
]
|
||||
{ required: true, message: "首选供应商不能为空", trigger: "change" }
|
||||
],
|
||||
supplierIdList: [
|
||||
{ required: true, message: "备选供应商不能为空", trigger: "change" }
|
||||
],
|
||||
ifSupply: [
|
||||
{ required: true, message: "是否供应不能为空", trigger: "change" }
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getTypeTreeData();
|
||||
this.getCanteenData();
|
||||
this.getTypeTreeData();
|
||||
this.getSupplierData();
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -342,23 +332,19 @@ export default {
|
|||
systemMaterialTreeApi(param).then((response) => {
|
||||
this.treeTypeOptions = response.data;
|
||||
});
|
||||
},
|
||||
//食堂下拉
|
||||
getCanteenData() {
|
||||
let param= {
|
||||
"canteenType": 1
|
||||
}
|
||||
getCanteenByAreaApi(param).then((response) => {
|
||||
this.canteenOptions=response.rows||[];
|
||||
},
|
||||
/** 查询供应商下拉结构 */
|
||||
getSupplierData() {
|
||||
supplierPageApi({ isPaging:1,areaIdList:[] }).then((response) => {
|
||||
this.supplierOptions = response.rows||[];
|
||||
});
|
||||
},
|
||||
},
|
||||
handleTabClick(){
|
||||
if(this.activeName=='material'){
|
||||
this.queryParams={
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
key: undefined,
|
||||
canteenId: undefined,
|
||||
pageSize: 10,
|
||||
supplierName: undefined,
|
||||
categoryIdList:[]
|
||||
}
|
||||
this.resetForm("queryForm");
|
||||
|
|
@ -367,8 +353,7 @@ export default {
|
|||
if(this.activeName=='category'){
|
||||
this.queryParams2={
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
canteenId: undefined,
|
||||
pageSize: 10,
|
||||
categoryIdList:[]
|
||||
}
|
||||
this.resetForm("queryForm2");
|
||||
|
|
@ -393,28 +378,104 @@ export default {
|
|||
let param = {
|
||||
"pageNum": this.queryParams.pageNum,
|
||||
"pageSize": this.queryParams.pageSize,
|
||||
"key": this.queryParams.key,
|
||||
"canteenId": this.queryParams.canteenId,
|
||||
"categoryIdList": this.queryParams.categoryIdList,
|
||||
"configType": 1,
|
||||
"supplierName": this.queryParams.supplierName,
|
||||
"categoryIdList": this.queryParams.categoryIdList,
|
||||
}
|
||||
// getPageCanteenApi(param).then(response => {
|
||||
// this.tableListData = response.rows;
|
||||
// this.total = Number(response.total);
|
||||
supplierBindMaterialListApi(param).then(response => {
|
||||
this.tableListData = response.rows;
|
||||
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;
|
||||
// });
|
||||
});
|
||||
},
|
||||
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(){
|
||||
this.batchForm={}
|
||||
this.resetForm("batchForm");
|
||||
this.openBatch=true
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(this.batchRows.length==0){
|
||||
this.$modal.msgError("请先选择货品!");
|
||||
}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;
|
||||
let param = {
|
||||
"pageNum": this.queryParams2.pageNum,
|
||||
"pageSize": this.queryParams2.pageSize,
|
||||
"key": this.queryParams2.key,
|
||||
"canteenId": this.queryParams2.canteenId,
|
||||
"categoryIdList": this.queryParams2.categoryIdList,
|
||||
"configType": 1,
|
||||
"pageSize": this.queryParams2.pageSize,
|
||||
"categoryIdList": this.queryParams2.categoryIdList,
|
||||
}
|
||||
// getPageCanteenApi(param).then(response => {
|
||||
// supplierBindMaterialListApi(param).then(response => {
|
||||
// this.tableListData2 = response.rows;
|
||||
// this.total2 = Number(response.total);
|
||||
this.loading = false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue