供应商、订单采购加入供应商筛选等

This commit is contained in:
jjLv 2025-10-14 18:08:20 +08:00
parent 9c71f3fe98
commit 171c87d447
5 changed files with 686 additions and 620 deletions

View File

@ -42,6 +42,7 @@
"clipboard": "2.0.8",
"core-js": "3.25.3",
"crypto-js": "^4.2.0",
"decimal.js": "^10.6.0",
"echarts": "5.4.0",
"element-ui": "2.15.8",
"file-saver": "2.0.5",

View File

@ -0,0 +1,50 @@
// 优化后的工具文件 utils/PrecisionHandler.js
import Decimal from 'decimal.js';
// 关键:设置足够高的精度并禁止自动转换为数字
Decimal.set({
precision: 30,
toExpNeg: -999, // 避免小数字自动转为科学计数法
toExpPos: 999 // 避免大数字自动转为科学计数法
});
export default {
// 确保输入是字符串类型以保留完整精度
toDecimal(num) {
// 如果是数字先转为字符串,避免精度丢失
if (typeof num === 'number') {
num = num.toString();
}
return new Decimal(num);
},
// 加法
add(num1, num2) {
return this.toDecimal(num1).plus(this.toDecimal(num2));
},
// 减法
subtract(num1, num2) {
return this.toDecimal(num1).minus(this.toDecimal(num2));
},
// 乘法
multiply(num1, num2) {
return this.toDecimal(num1).times(this.toDecimal(num2));
},
// 除法
divide(num1, num2) {
return this.toDecimal(num1).dividedBy(this.toDecimal(num2));
},
// 四舍五入保留指定小数位(返回字符串,避免转换丢失)
round(num, decimalPlaces = 2) {
return this.toDecimal(num).toFixed(decimalPlaces);
},
// 转换为数字(仅在确定不会丢失精度时使用)
toNumber(decimal) {
return decimal.toNumber();
}
};

View File

@ -11,7 +11,7 @@
<el-form-item label="交货时间" prop="requestArrivalTime">
<el-date-picker
v-model="baseInfo.requestArrivalTime"
type="date" align="right"
type="date" align="right"
format="yyyy-MM-dd" style="width: 240px;"
:picker-options="pickerOptions" @change="baseInfo.requestArrivalTime=formatDate(baseInfo.requestArrivalTime)">
</el-date-picker>
@ -20,13 +20,13 @@
<el-cascader v-model="baseInfo.areaId"
:options="treeAreaOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
:disabled="materialList.length>0"
:props="{
:props="{
emitPath: false,// falseid
checkStrictly: false,//
value:'id',label:'label'
}" @change="handleAreaChange">
</el-cascader>
</el-form-item>
</el-form-item>
<el-form-item label="所属食堂" prop="canteenId">
<el-select v-model="baseInfo.canteenId" placeholder="请选择所属食堂" style="width: 240px;" @change="handleCanteenChange">
<el-option v-for="item in canteenOptions"
@ -34,8 +34,8 @@
:label="item.canteenName"
:value="item.canteenId"
></el-option>
</el-select>
</el-form-item>
</el-select>
</el-form-item>
<el-form-item label="所属档口" prop="stallId">
<el-select v-model="baseInfo.stallId" placeholder="请选择所属档口" style="width: 240px;">
<el-option v-for="item in stallOptions"
@ -43,8 +43,8 @@
:label="item.stallName"
:value="item.stallId"
></el-option>
</el-select>
</el-form-item>
</el-select>
</el-form-item>
<el-form-item label="供应商" prop="supplierId">
<el-select v-model="baseInfo.supplierId" placeholder="请选择供应商" style="width: 240px;">
<el-option v-for="item in supplierOptions"
@ -52,7 +52,7 @@
:label="item.supplierName"
:value="item.supplierId"
></el-option>
</el-select>
</el-select>
</el-form-item>
<el-form-item label="送货仓库" prop="warehouseId">
<el-select v-model="baseInfo.warehouseId" clearable placeholder="请选择送货仓库" style="width: 100%;">
@ -65,19 +65,19 @@
</el-form-item>
<el-form-item label="详细地址" prop="supplyAddress">
<el-input v-model="baseInfo.supplyAddress" placeholder="请输入详细地址" maxlength="20" clearable style="width: 240px"/>
</el-form-item>
</el-form-item>
<el-form-item label="采购合同" prop="contractCode">
<el-select v-model="baseInfo.contractCode" filterable remote
reserve-keyword placeholder="请查询并选择采购合同" style="width: 240px;margin-right: 10px;"
:remote-method="remoteMethod" :loading="loading2" >
<el-option v-for="lab in contractOptions"
<el-option v-for="lab in contractOptions"
:key="lab.contractCode"
:label="lab.contractTitle"
:value="lab.contractCode">
</el-option>
</el-select>
</el-form-item>
</el-form-item>
<el-form-item label="付款方式" prop="payMoneyStyle">
<el-radio-group v-model="baseInfo.payMoneyStyle" >
<el-radio label="1" style="font-size: 14px;">一次性付款</el-radio>
@ -87,7 +87,7 @@
<el-form-item label="付款日期" prop="payMoneyDate">
<el-date-picker
v-model="baseInfo.payMoneyDate"
type="date" align="right"
type="date" align="right"
format="yyyy-MM-dd" style="width: 240px;"
:picker-options="pickerOptions" @change="baseInfo.payMoneyDate=formatDate(baseInfo.payMoneyDate)">
</el-date-picker>
@ -105,7 +105,7 @@
<el-input v-model="baseInfo.remark" placeholder="请输入备注" maxlength="30" clearable style="width: 240px"/>
</el-form-item>
</el-form>
</div>
</div>
<div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;">
<div style="width: 100%;display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;">
<div>
@ -122,36 +122,36 @@
<el-table-column type="selection" width="50" align="center" :reserve-selection="true" />
<el-table-column label="序号" align="center" width="80" type="index" />
<!-- <el-table-column label="图片" align="center" prop="" :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="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :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="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
<!-- <template slot-scope="scope">
<span v-if="scope.row.salesMode==1">按份</span>
<span v-if="scope.row.salesMode==2">称重</span>
</template> -->
</el-table-column>
</el-table-column>
<el-table-column label="单价(元)" align="center" prop="singlePrice" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="scope.row.singlePrice" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.singlePrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="数量" align="center" prop="orderNum" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model.number="scope.row.orderNum" placeholder="请输入" maxlength="10" clearable @input="(v)=>(scope.row.orderNum=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span v-if="scope.row.singlePrice>=0">{{ scope.row.orderNum*scope.row.singlePrice }}</span>
<span v-if="scope.row.singlePrice>=0">{{ PrecisionHandler.multiply(scope.row.orderNum,scope.row.singlePrice) }}</span>
</template>
</el-table-column>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true">
<template slot-scope="scope">
<el-input v-model="scope.row.remark" placeholder="请输入" maxlength="20" clearable/>
</template>
</el-table-column>
</el-table-column>
</el-table>
</div>
</div>
@ -160,7 +160,7 @@
<el-button type="success" plain @click="confirmSubmit" :loading="loadingBtn">提交</el-button>
<el-button @click="jumpList">返回</el-button>
</div>
<!-- 选择菜品 -->
<el-dialog title="选择货品" :visible.sync="openDialog" width="65%" append-to-body >
<div style="width: 100%;height:620px;">
@ -168,11 +168,11 @@
<el-form-item label="货品类别" prop="materialTypeIds">
<el-cascader v-model="queryParams.materialTypeIds"
:options="materialTreeOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
:props="{
:props="{
multiple: true,
emitPath: false,// falseid
checkStrictly: false,//
value:'id',label:'categoryName'
value:'id',label:'categoryName'
}" collapse-tags>
</el-cascader>
</el-form-item>
@ -195,21 +195,21 @@
</template>
</el-table-column>
<!-- <el-table-column label="图片" align="center" prop="" :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="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :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="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
<!-- <template slot-scope="scope">
<span v-if="scope.row.salesMode==1">按份</span>
<span v-if="scope.row.salesMode==2">称重</span>
</template> -->
</el-table-column>
</el-table-column>
<el-table-column label="单价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true">
<template slot-scope="scope">
<span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span>
</template>
</el-table-column>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
@ -217,18 +217,18 @@
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
/>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmChosen"> </el-button>
<el-button @click="openDialog=false"> </el-button>
</div>
</el-dialog>
</el-dialog>
<!-- 导入 -->
<el-dialog title="导入采购计划" :visible.sync="openImportDialog" width="60%" append-to-body >
<div style="width: 100%;height:650px;">
<el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" label-width="100px">
<el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" label-width="100px">
<el-form-item label="计划日期">
<el-date-picker
v-model="dateRange"
@ -259,12 +259,12 @@
<template slot-scope="scope">
<span>{{(queryParams2.pageNum - 1) * queryParams2.pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="采购计划单号" align="center" prop="planCode" :show-overflow-tooltip="true" />
<el-table-column label="采购计划时间" align="center" prop="purchaseDate" :show-overflow-tooltip="true" />
<el-table-column label="所属食堂" align="center" prop="canteenName" :show-overflow-tooltip="true" />
<el-table-column label="所属档口" align="center" prop="stallName" :show-overflow-tooltip="true" />
<el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true" />
</el-table-column>
<el-table-column label="采购计划单号" align="center" prop="planCode" :show-overflow-tooltip="true" />
<el-table-column label="采购计划时间" align="center" prop="purchaseDate" :show-overflow-tooltip="true" />
<el-table-column label="所属食堂" align="center" prop="canteenName" :show-overflow-tooltip="true" />
<el-table-column label="所属档口" align="center" prop="stallName" :show-overflow-tooltip="true" />
<el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true" />
</el-table>
<pagination
v-show="total2>0"
@ -272,36 +272,42 @@
:page.sync="queryParams2.pageNum"
:limit.sync="queryParams2.pageSize"
@pagination="getList2"
/>
/>
<div>
<div>采购计划明细</div>
<el-table :data="materialDetailsData" height="250">
<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="unitName" :show-overflow-tooltip="true" />
<el-table-column label="计划采购数量" align="center" prop="purchaseNum" :show-overflow-tooltip="true" />
</el-table>
<el-table :data="materialDetailsData" height="250">
<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="unitName" :show-overflow-tooltip="true" />
<el-table-column label="计划采购数量" align="center" prop="purchaseNum" :show-overflow-tooltip="true" />
</el-table>
</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmImport"> </el-button>
<el-button @click="openImportDialog=false"> </el-button>
</div>
</el-dialog>
</el-dialog>
</div>
</template>
<script>
import { imgUpLoadTwo } from '@/api/system/upload'
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi,drpWareHousePageApi,purchaseContractPageApi } from "@/api/foodManage/purchaseManage";
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi,drpWareHousePageApi,purchaseContractPageApi } from "@/api/foodManage/purchaseManage";
import { getPurchaseOrderInfoApi,addPurchaseOrderApi,editPurchaseOrderApi } from "@/api/foodManage/purchaseManage";
import { purchasePlanPageApi,getPurchasePlanInfoApi } from "@/api/foodManage/purchaseManage";
import PrecisionHandler from '../../../../utils/PrecisionHandler'
export default {
name: "orderEdit",
computed: {
PrecisionHandler() {
return PrecisionHandler
}
},
dicts: [],
data() {
return {
@ -310,11 +316,14 @@ export default {
loading2:false,
contractOptions:[],
loadingBtn:false,
baseInfo: {
baseInfo: {
orderTitle:undefined,
contractType:undefined,
areaId:undefined,
canteenId:undefined,
canteenId:undefined,
supplierId: undefined,
warehouseId:undefined,
},
//
baseRules: {
@ -347,31 +356,31 @@ export default {
canteenOptions:[],
stallOptions:[],
supplierOptions:[],
wareHouseOptions:[],
pickerOptions: {
wareHouseOptions:[],
pickerOptions: {
disabledDate(v) {
return v.getTime() < (new Date().getTime() - 86400000);// - 86400000
}
},
},
materialList:[],//-
batchIds:[],//--
openDialog:false,
materialTreeOptions:[],
materialTreeOptions:[],
queryParams: { // --
pageNum: 1,
pageSize: 10,
},
pageSize: 10,
},
total: 0, //
tableListData: [],//-
batchChosenMaterial:[],//--
noMaterial:false,
noMaterial:false,
//
openImportDialog:false,
queryParams2: { // --
pageNum: 1,
pageSize: 10,
pageSize: 10,
planCode:null
},
},
loading2:false,
total2: 0, //
tableListData2: [],//-
@ -407,15 +416,15 @@ export default {
},
};
},
created() {
if(this.$route.query.purchaseOrderRowData){
created() {
if(this.$route.query.purchaseOrderRowData){
this.purchaseOrderRowData = JSON.parse(this.$route.query.purchaseOrderRowData)
setTimeout(()=>{
this.getContractInfo()
this.getContractInfo()
},800)
}
this.getAreaTreeData()
this.getMaterialTree()
this.getAreaTreeData()
this.getMaterialTree()
},
watch:{
'$route.query.purchaseOrderRowData':function(newId, oldId) {
@ -428,24 +437,24 @@ export default {
}
},
},
methods: {
methods: {
//
jumpList() {
const obj = { path: "foodManage/purchaseManage/orderEdit" };
this.$tab.closeOpenPage(obj);
this.$router.replace({ path: "/foodManage/purchaseManage/purchaseOrder" }); //
this.$router.replace({ path: "/foodManage/purchaseManage/purchaseOrder" }); //
},
getContractInfo(){
console.log(this.purchaseOrderRowData)
console.log(this.purchaseOrderRowData)
let param = {
orderGoodsId:this.purchaseOrderRowData.orderGoodsId
}
//
getPurchaseOrderInfoApi(param).then((response) => {
this.baseInfo = response.data;
this.materialList = this.baseInfo.orderGoodsDetailList;
this.baseInfo = response.data;
this.materialList = this.baseInfo.orderGoodsDetailList;
this.materialList.forEach(item=>{
this.$set(item,"singlePrice",Number(item.singlePrice)/100)
this.$set(item,"singlePrice",Number(item.singlePrice)/100)
})
getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => {
this.canteenOptions=response.rows||[];
@ -453,24 +462,24 @@ export default {
});
getStallByCanteenApi({ canteenId:this.baseInfo.canteenId }).then((response) => {
this.stallOptions=response.rows||[]
this.$set(this.baseInfo,"stallId",this.baseInfo.stallId)
});
this.$set(this.baseInfo,"stallId",this.baseInfo.stallId)
});
supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => {
this.supplierOptions = response.rows||[];
this.$set(this.baseInfo,"supplierId",response.data.supplierId)
});
this.supplierOptions = response.rows||[];
this.$set(this.baseInfo,"supplierId",response.data.supplierId)
});
drpWareHousePageApi({ areaId:this.baseInfo.areaId }).then((response) => {
this.wareHouseOptions = response.rows||[];
this.$set(this.baseInfo,"warehouseId",response.data.warehouseId)
});
});
this.wareHouseOptions = response.rows||[];
this.$set(this.baseInfo,"warehouseId",response.data.warehouseId)
});
});
},
//
getAreaTreeData() {
systemAreaTreeApi({}).then((response) => {
this.treeAreaOptions = response.data;
if(this.treeAreaOptions.length>0){
this.$set(this.baseInfo,"areaId",this.getFirstChild(this.treeAreaOptions[0]).id)
this.$set(this.baseInfo,"areaId",this.getFirstChild(this.treeAreaOptions[0]).id)
this.handleAreaChange()
}
});
@ -483,51 +492,51 @@ export default {
}
},
//-
handleAreaChange(e){
handleAreaChange(e){
this.getCanteenData()
this.getSupplierData()
this.getWareHouseData()
},
},
/** 查询查询食堂下拉结构 */
getCanteenData() {
getCanteenData() {
let param= {
areaId:this.baseInfo.areaId
}
}
getCanteenByAreaApi(param).then((response) => {
this.canteenOptions=response.rows||[];
if(this.canteenOptions.length>0){
this.$set(this.baseInfo,"canteenId",this.canteenOptions[0].canteenId)
if(this.canteenOptions.length>0){
this.$set(this.baseInfo,"canteenId",this.canteenOptions[0].canteenId)
this.handleCanteenChange()
}
});
},
/** 查询供应商下拉结构 */
getSupplierData() {
getSupplierData() {
supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => {
this.supplierOptions = response.rows||[];
this.$set(this.baseInfo,"supplierId",null)
});
});
},
/** 查询供应商下拉结构 */
getWareHouseData() {
getWareHouseData() {
drpWareHousePageApi({ areaId:this.baseInfo.areaId }).then((response) => {
this.wareHouseOptions = response.rows||[];
this.$set(this.baseInfo,'warehouseId',null)
});
this.$set(this.baseInfo,'warehouseId',null)
});
},
//-
handleCanteenChange(e){
handleCanteenChange(e){
this.getStallData()
},
/** 查询档口下拉结构 */
getStallData() {
getStallData() {
let param= {
canteenId:this.baseInfo.canteenId
}
}
getStallByCanteenApi(param).then((response) => {
this.stallOptions=response.rows||[]
if(this.stallOptions.length>0){
this.$set(this.baseInfo,"stallId",this.stallOptions[0].stallId)
this.$set(this.baseInfo,"stallId",this.stallOptions[0].stallId)
}
});
},
@ -537,9 +546,9 @@ export default {
// goodsType:1
}
systemMaterialTreeApi(param).then((response) => {
this.materialTreeOptions = response.data;
this.materialTreeOptions = response.data;
});
},
},
//-
remoteMethod(query) {
if (query !== '') {
@ -548,60 +557,63 @@ export default {
this.loading2 = false;
let param = {
pageNum: 1,
searchValue: query,
searchValue: query,
pageSize: 20
}
purchaseContractPageApi(param).then(response => {
this.contractOptions = response.rows;
this.contractOptions = response.rows;
});
}, 200);
} else {
this.contractOptions = [];
}
},
},
//
changeDateRange(e){
//this.formatDate(e[0])
changeDateRange(e){
//this.formatDate(e[0])
},
//
handleSelectionChange(selection) {
this.batchIds = selection.map(item => item.materialId)
},
//
delMaterial(){
delMaterial(){
this.batchIds.forEach(ID=>{
let index = this.materialList.findIndex(v=>v.materialId==ID)
if(index>-1){
this.materialList.splice(index,1)
}
})
setTimeout(()=>{
this.$refs.multipleTable.clearSelection()
},300)
setTimeout(()=>{
this.$refs.multipleTable.clearSelection()
},300)
},
//
addMaterial(){
if(this.baseInfo.areaId!=undefined){
this.openDialog=true
this.resetQuery()
setTimeout(()=>{
this.$refs.multipleTable1.clearSelection()
},300)
}else{
this.$modal.msgError("请先选择区域");
if(this.baseInfo.areaId==undefined || this.baseInfo.areaId =="" ) {
this.$modal.msgError("请先选择区域");
return
}
},
if(this.baseInfo.supplierId==undefined || this.baseInfo.supplierId =="" ) {
this.$modal.msgError("请先选择供应商");
return
}
this.openDialog=true
this.resetQuery()
setTimeout(()=>{
this.$refs.multipleTable1.clearSelection()
},300)
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
resetQuery() {
this.queryParams = {
pageNum: 1,
pageSize: 10,
pageSize: 10,
}
this.resetForm("queryForm");
this.handleQuery();
@ -614,8 +626,9 @@ export default {
"pageNum": this.queryParams.pageNum,
"areaId": this.baseInfo.areaId,
"materialName": this.queryParams.materialName,
"materialCode": this.queryParams.materialCode,
"materialCode": this.queryParams.materialCode,
"materialTypeIds": this.queryParams.materialTypeIds,
"supplierId": this.baseInfo.supplierId,
}
getMaterialListApi(param).then(response => {
this.tableListData = response.rows;
@ -626,22 +639,22 @@ export default {
handleSelectionChange2(selection) {
this.batchChosenMaterial = selection;
this.batchChosenMaterial.forEach(item=>{
this.$set(item,"orderNum",0)
this.$set(item,"singlePrice",item.unitPrice/100)
this.$set(item,"orderNum",0)
this.$set(item,"singlePrice",item.unitPrice/100)
})
},
confirmChosen(){
if(this.batchChosenMaterial.length>0){
this.loading = true
this.loading = true
if(this.baseInfo.purchasePlanCode&&this.baseInfo.purchasePlanCode!=""){
this.$modal.confirm('是否确认覆盖货品明细?').then(() => {
this.baseInfo.purchasePlanCode = null
this.materialList = this.batchChosenMaterial
this.loading = false
this.openDialog=false
}).catch(() => {});
}).catch(() => {});
}else{
let items = [...this.materialList,...this.batchChosenMaterial]
let items = [...this.materialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index;
});
@ -649,46 +662,46 @@ export default {
setTimeout(()=>{
this.loading = false
this.openDialog=false
},500)
},500)
}
}
}
},
//稿
confirmSave(){
this.$refs["baseInfo"].validate(valid => {
if (valid) {
let param = Object.assign({},this.baseInfo);
if (valid) {
let param = Object.assign({},this.baseInfo);
param.requestArrivalTime = this.formatDate(this.baseInfo.requestArrivalTime)
if(this.baseInfo.payMoneyDate){
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
}
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
}
param.orderAmount=0
param.totalNum=0
param.orderStatus=1
param.orderGoodsDetailList = []
param.orderGoodsDetailList = []
this.noMaterial = false;
if(this.materialList.length>0){
if(this.materialList.length>0){
this.materialList.forEach(item=>{
if(item.singlePrice==0 || item.orderNum==0){
this.noMaterial = true
}else{
let obj = Object.assign({}, item)
obj.singlePrice = Number(obj.singlePrice)*100
obj.totalPrice = (Number(obj.singlePrice)*Number(obj.orderNum))
param.orderAmount = param.orderAmount+obj.totalPrice;
obj.singlePrice = Number(obj.singlePrice)*100
obj.totalPrice = (Number(obj.singlePrice)*Number(obj.orderNum))
param.orderAmount = param.orderAmount+obj.totalPrice;
param.totalNum = param.totalNum+Number(obj.orderNum)
param.orderGoodsDetailList.push(obj)
}
})
}
}
})
}
if(this.noMaterial){
this.$modal.msgError("请输入单价和数量!");
}else{
this.noMaterial = true;
if(this.materialList.length>0){
this.noMaterial = false;
}
this.noMaterial = false;
}
console.log(param)
if(this.noMaterial){
this.$modal.msgError("请添加货品!");
@ -698,60 +711,59 @@ export default {
editPurchaseOrderApi(param).then((response) => {
this.$modal.msgSuccess("修改成功");
this.loadingBtn=false
this.jumpList()
this.jumpList()
}).catch(() => {
this.loadingBtn=false
});
});
} else {
addPurchaseOrderApi(param).then((response) => {
this.$modal.msgSuccess("保存成功");
this.loadingBtn=false
this.jumpList()
this.jumpList()
}).catch(() => {
this.loadingBtn=false
});
});
}
}
}
}
}
}
});
},
//
confirmSubmit(){
this.$refs["baseInfo"].validate(valid => {
if (valid) {
let param = Object.assign({},this.baseInfo);
if (valid) {
let param = Object.assign({},this.baseInfo);
param.requestArrivalTime = this.formatDate(this.baseInfo.requestArrivalTime)
if(this.baseInfo.payMoneyDate){
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
}
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
}
param.orderAmount=0
param.totalNum=0
param.orderStatus=2
param.orderGoodsDetailList = []
param.orderGoodsDetailList = []
this.noMaterial = false;
if(this.materialList.length>0){
if(this.materialList.length>0){
this.materialList.forEach(item=>{
if(item.singlePrice==0 || item.orderNum==0){
this.noMaterial = true
}else{
let obj = Object.assign({}, item)
obj.singlePrice = Number(obj.singlePrice)*100
obj.totalPrice = (Number(obj.singlePrice)*Number(obj.orderNum))
param.orderAmount = param.orderAmount+obj.totalPrice;
obj.singlePrice = Number(obj.singlePrice)*100
obj.totalPrice = (Number(obj.singlePrice)*Number(obj.orderNum))
param.orderAmount = param.orderAmount+obj.totalPrice;
param.totalNum = param.totalNum+Number(obj.orderNum)
param.orderGoodsDetailList.push(obj)
}
})
}
}
})
}
if(this.noMaterial){
this.$modal.msgError("请输入单价和数量!");
}else{
this.noMaterial = true;
if(this.materialList.length>0){
this.noMaterial = false;
}
this.noMaterial = false;
}
console.log(param)
if(this.noMaterial){
this.$modal.msgError("请添加货品!");
@ -761,22 +773,22 @@ export default {
editPurchaseOrderApi(param).then((response) => {
this.$modal.msgSuccess("修改成功");
this.loadingBtn=false
this.jumpList()
this.jumpList()
}).catch(() => {
this.loadingBtn=false
});
});
} else {
addPurchaseOrderApi(param).then((response) => {
this.$modal.msgSuccess("保存成功");
this.loadingBtn=false
this.jumpList()
this.jumpList()
}).catch(() => {
this.loadingBtn=false
});
});
}
}
}
}
}
}
});
},
@ -784,14 +796,14 @@ export default {
//
importPurchasePlan(){
if(this.baseInfo.areaId!=undefined||this.baseInfo.canteenId!=undefined||this.baseInfo.stallId!=undefined){
this.openImportDialog=true
this.openImportDialog=true
this.resetQuery2()
// setTimeout(()=>{
// this.$refs.multipleTable2.clearSelection()
// },300)
// this.$refs.multipleTable2.clearSelection()
// },300)
}else{
this.$modal.msgError("请先选择区域,食堂,档口");
}
}
},
/** 搜索按钮操作 */
handleQuery2() {
@ -799,11 +811,11 @@ export default {
this.getList2();
},
/** 重置按钮操作 */
resetQuery2() {
resetQuery2() {
this.dateRange = this.defaultDateRange()
this.queryParams2 = {
pageNum: 1,
pageSize: 10,
pageSize: 10,
}
this.resetForm("queryForm2");
this.handleQuery2();
@ -826,7 +838,7 @@ export default {
}else{
param.startTime=undefined;
param.endTime=undefined;
}
}
purchasePlanPageApi(param).then(response => {
this.tableListData2 = response.rows;
this.total2 = Number(response.total);
@ -840,36 +852,36 @@ export default {
let param = {
planId:this.importRow.planId
}
getPurchasePlanInfoApi(param).then((response) => {
this.materialDetailsData = response.data.purchasePlanDetailList||[];
getPurchasePlanInfoApi(param).then((response) => {
this.materialDetailsData = response.data.purchasePlanDetailList||[];
});
},
confirmImport(){
confirmImport(){
if(this.materialDetailsData.length>0){
this.$modal.confirm('是否确认覆盖货品明细?').then(() => {
this.materialList = this.materialDetailsData;
this.materialList = this.materialDetailsData;
this.materialList.forEach(item=>{
this.$set(item,"orderNum",item.purchaseNum)
})
this.baseInfo.purchasePlanCode = this.importRow.planCode;
this.baseInfo.purchasePlanCode = this.importRow.planCode;
this.$set(this.baseInfo,"remark","导入采购计划")
setTimeout(()=>{
setTimeout(()=>{
this.openImportDialog=false
},500)
}).catch(() => {});
},500)
}).catch(() => {});
}else{
this.$modal.msgError("采购计划明细无货品");
}
},
},
defaultDateRange() {
const end = new Date(new Date().toLocaleDateString());
end.setTime(end.getTime() + 24 * 60 * 60 * 1000 -1);
const start = new Date((new Date().toLocaleDateString()));
start.setTime(start.getTime() - 30 * 24 * 60 * 60 * 1000);
start.setTime(start.getTime() - 30 * 24 * 60 * 60 * 1000);
this.start = parseInt(start.getTime() / 1000)
this.end = parseInt(end.getTime() / 1000)
return [start, end]
},
},
//
formatDate(date) {
// YYYY-MM-DD
@ -890,7 +902,7 @@ export default {
const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
const seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
}
}
};
</script>
@ -932,10 +944,10 @@ export default {
align-items: center;
cursor: pointer;
}
.dish-name:hover{
.dish-name:hover{
background-color:rgba(0, 0, 0, 0.1);
color: #4b80fd;
}
}
.dialog-center{
width: 10%;
@ -987,4 +999,4 @@ export default {
border: 1px solid #fff;
cursor: pointer;
}
</style>
</style>

View File

@ -4,14 +4,14 @@
<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="supplierName">
<el-input
<el-input
v-model="queryParams.supplierName"
placeholder="请输入供应商名称"
clearable maxlength="30"
style="width: 240px"
style="width: 240px"
/>
</el-form-item>
<el-form-item label="货品类别" prop="materialTypeIds">
<el-form-item label="货品类别" prop="materialTypeIds">
<el-cascader
v-model="queryParams.materialTypeIds"
:options="treeTypeOptions"
@ -22,14 +22,14 @@
value:'id',label:'categoryName'
}"
placeholder="请选择货品类别" collapse-tags
clearable style="width: 240px;"
clearable 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>
</el-form-item>
</el-form>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
@ -38,9 +38,9 @@
size="mini"
@click="handleBatch"
>批量关联供应商</el-button>
</el-col>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-row>
<el-table v-loading="loading" :data="tableListData" height="550" :row-key="(row)=>{return row.materialId}" @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">
@ -51,18 +51,18 @@
<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="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">
<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>
<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="180">
<template slot-scope="scope">
<template slot-scope="scope">
<el-select v-model="scope.row.supplierId" placeholder="请选择供应商" style="width: 100%;" @change="changSupplier(scope.row)" @clear="clearSupplier(scope.row)" clearable>
<el-option v-for="item in supplierOptions"
:disabled="checkDisabled(item,scope.row)"
@ -70,11 +70,11 @@
:label="item.supplierName"
:value="item.supplierId"
></el-option>
</el-select>
</el-select>
</template>
</el-table-column>
<el-table-column label="备选供应商" align="center" prop="supplierIdList" :show-overflow-tooltip="true" width="240">
<template slot-scope="scope">
<template slot-scope="scope">
<el-select v-model="scope.row.supplierIdList" multiple collapse-tags :multiple-limit="3" placeholder="请选择供应商" style="width: 100%;" @change="changSupplierList(scope.row)" @clear="changSupplierList(scope.row)" clearable>
<el-option v-for="item in supplierOptions"
:disabled="checkDisabled2(item,scope.row)"
@ -82,18 +82,18 @@
:label="item.supplierName"
:value="item.supplierId"
></el-option>
</el-select>
</el-select>
</template>
</el-table-column>
<el-table-column label="供应商名称" align="center" prop="supplierName" :show-overflow-tooltip="true"/>
<el-table-column label="最近一次供货时间" align="center" prop="purchaseGoodsTime" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column label="最近一次供货时间" align="center" prop="purchaseGoodsTime" :show-overflow-tooltip="true">
</el-table-column>
<el-table-column label="价格" align="center" prop="singlePrice" width="120" :show-overflow-tooltip="true" >
<template slot-scope="scope">
<span>{{ (scope.row.singlePrice/100).toFixed(2)||0 }}</span>
</template>
</el-table-column>
</el-table>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -103,8 +103,8 @@
/>
</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="materialTypeIds">
<el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" v-show="showSearch" label-width="90px">
<el-form-item label="货品类别" prop="materialTypeIds">
<el-cascader
v-model="queryParams2.materialTypeIds"
:options="treeTypeOptions"
@ -115,14 +115,14 @@
value:'id',label:'categoryName'
}"
placeholder="请选择货品类别" collapse-tags
clearable style="width: 240px;"
clearable style="width: 240px;"
/>
</el-form-item>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery2">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery2">重置</el-button>
</el-form-item>
</el-form>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
@ -131,19 +131,19 @@
size="mini"
@click="handleBatch"
>批量关联供应商</el-button>
</el-col>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-row>
<el-table v-loading="loading" :data="tableListData2" height="800" :row-key="(row)=>{return row.materialTypeId}" @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">
<template slot-scope="scope">
<span>{{(queryParams2.pageNum - 1) * queryParams2.pageSize + scope.$index + 1}}</span>
</template>
</el-table-column>
<el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true"/>
</el-table-column>
<el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true"/>
<el-table-column label="首选供应商" align="center" prop="supplierId" :show-overflow-tooltip="true">
<template slot-scope="scope">
<template slot-scope="scope">
<el-select v-model="scope.row.supplierId" placeholder="请选择供应商" style="width: 100%;" @change="changSupplier(scope.row)" @clear="clearSupplier(scope.row)" clearable>
<el-option v-for="item in supplierOptions"
:disabled="checkDisabled(item,scope.row)"
@ -151,11 +151,11 @@
:label="item.supplierName"
:value="item.supplierId"
></el-option>
</el-select>
</el-select>
</template>
</el-table-column>
<el-table-column label="备选供应商" align="center" prop="supplierIdList" :show-overflow-tooltip="true">
<template slot-scope="scope">
<template slot-scope="scope">
<el-select v-model="scope.row.supplierIdList" multiple collapse-tags :multiple-limit="3" placeholder="请选择供应商" style="width: 100%;" @change="changSupplierList(scope.row)" @clear="changSupplierList(scope.row)" clearable>
<el-option v-for="item in supplierOptions"
:disabled="checkDisabled2(item,scope.row)"
@ -163,11 +163,11 @@
:label="item.supplierName"
:value="item.supplierId"
></el-option>
</el-select>
</el-select>
</template>
</el-table-column>
</el-table>
</el-table-column>
</el-table>
<pagination
v-show="total2>0"
:total="total2"
@ -175,28 +175,28 @@
:limit.sync="queryParams2.pageSize"
@pagination="getList2"
/>
</el-tab-pane>
</el-tab-pane>
</el-tabs>
<!-- 对话框 -->
<el-dialog title="备选供应商" :visible.sync="open" width="600px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row>
<el-row>
<el-col :span="24">
<el-form-item label="供应商" prop="paymentDays">
<el-select v-model="form.paymentDays" multiple collapse-tags placeholder="请选择供应商" style="width: 100%;">
<el-option label="日" :value="1"></el-option>
<el-option label="周" :value="2"></el-option>
<el-option label="月" :value="3"></el-option>
<el-option label="两个月" :value="4"></el-option>
<el-option label="季度" :value="5"></el-option>
<el-option label="半年" :value="6"></el-option>
<el-option label="年" :value="7"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-option label="周" :value="2"></el-option>
<el-option label="月" :value="3"></el-option>
<el-option label="两个月" :value="4"></el-option>
<el-option label="季度" :value="5"></el-option>
<el-option label="半年" :value="6"></el-option>
<el-option label="年" :value="7"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
@ -208,7 +208,7 @@
<!-- 对话框 -->
<el-dialog title="批量关联供应商" :visible.sync="openBatch" width="600px" append-to-body>
<el-form ref="batchForm" :model="batchForm" :rules="batchRules" label-width="100px">
<el-row>
<el-row>
<el-col :span="24">
<el-form-item label="首选供应商" prop="supplierId">
<el-select v-model="batchForm.supplierId" placeholder="请选择首选供应商" style="width: 100%;" @change="dialogChangeSupplier">
@ -218,8 +218,8 @@
:label="item.supplierName"
:value="item.supplierId"
></el-option>
</el-select>
</el-form-item>
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备选供应商" prop="supplierIdList">
@ -230,16 +230,16 @@
:label="item.supplierName"
:value="item.supplierId"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-select>
</el-form-item>
</el-col>
<!-- <el-col :span="24">
<el-form-item label="是否供应" prop="ifSupply">
<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>
</el-form-item>
</el-select>
</el-form-item>
</el-col> -->
</el-row>
</el-form>
@ -254,8 +254,8 @@
</div>
</template>
<script>
import { systemMaterialTreeApi } from "@/api/dish/material";
<script>
import { systemMaterialTreeApi } from "@/api/dish/material";
import { materialBindSupplierPageApi,materialTypeBindSupplierPageApi,supplierPageApi,supplierBindMaterialApi,addSupplierBindMaterialApi, editSupplierBindMaterialApi } from "@/api/foodManage/supplierManage";
export default {
@ -273,35 +273,35 @@ export default {
multiple: true,
//
showSearch: true,
treeTypeOptions:[],//
supplierOptions:[],//
treeTypeOptions:[],//
supplierOptions:[],//
activeName:'material',
//-----------
//
total: 0,
//
tableListData: [],
tableListData: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
supplierName: undefined,
pageSize: 10,
supplierName: undefined,
materialTypeIds:[]
},
//-----------
//
total2: 0,
//
tableListData2: [],
tableListData2: [],
//
queryParams2: {
pageNum: 1,
pageSize: 10,
canteenId: undefined,
pageSize: 10,
canteenId: undefined,
materialTypeIds:[]
},
},
//
open: false,
open: false,
//
form: {},
//
@ -311,8 +311,8 @@ export default {
]
},
batchRows:[],
openBatch: false,
batchForm: {},
openBatch: false,
batchForm: {},
batchRules: {
supplierId: [
{ required: true, message: "首选供应商不能为空", trigger: "change" }
@ -326,10 +326,10 @@ export default {
},
};
},
created() {
this.getTypeTreeData();
this.getSupplierData();
this.getList();
created() {
this.getTypeTreeData();
this.getSupplierData();
this.getList();
},
methods: {
//
@ -342,17 +342,17 @@ export default {
});
},
/** 查询供应商下拉结构 */
getSupplierData() {
getSupplierData() {
supplierPageApi({ isPaging:1,areaIdList:[] }).then((response) => {
this.supplierOptions = response.rows||[];
});
this.supplierOptions = response.rows||[];
});
},
handleTabClick(){
if(this.activeName=='material'){
this.queryParams={
pageNum: 1,
pageSize: 10,
supplierName: undefined,
supplierName: undefined,
materialTypeIds:[]
}
this.resetForm("queryForm");
@ -361,13 +361,13 @@ export default {
if(this.activeName=='category'){
this.queryParams2={
pageNum: 1,
pageSize: 10,
pageSize: 10,
materialTypeIds:[]
}
this.resetForm("queryForm2");
this.handleQuery2()
}
},
//-----------
/** 搜索按钮操作 */
@ -376,11 +376,11 @@ export default {
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
resetQuery() {
this.queryParams={
pageNum: 1,
pageSize: 10,
supplierName: undefined,
supplierName: undefined,
materialTypeIds:[]
}
this.resetForm("queryForm");
@ -390,10 +390,10 @@ export default {
getList() {
this.loading = true;
let param = {
"pageNum": this.queryParams.pageNum,
"pageNum": this.queryParams.pageNum,
"pageSize": this.queryParams.pageSize,
"supplierName": this.queryParams.supplierName,
"materialTypeIds": this.queryParams.materialTypeIds,
"supplierName": this.queryParams.supplierName,
"materialTypeIds": this.queryParams.materialTypeIds,
}
materialBindSupplierPageApi(param).then(response => {
this.tableListData = response.rows;
@ -405,7 +405,7 @@ export default {
})
}
this.$set(item,"supplierIdList",arr)
})
})
this.total = Number(response.total);
this.loading = false;
});
@ -414,56 +414,56 @@ export default {
//-
changSupplier(row){
console.log(row)
let param = {
"materialId":null,
let param = {
"materialId":null,
"materialIds":null,
"categoryId":null,
"categoryId":null,
"categoryIds":null,
"canteenId": row.canteenId,
"supplierId": row.supplierId,
"supplierId": row.supplierId,
"alternativeSuppliers": row.alternativeSuppliers,
"ifSupply": row.ifSupply
}
}
if(!row.materialId){//
param.categoryId = row.materialTypeId
}else{//
param.materialId = row.materialId
param.materialId = row.materialId
}
supplierBindMaterialApi(param).then(response => {
this.$modal.msgSuccess("修改成功");
this.getList()
});
});
},
//-
clearSupplier(row){
let param = {
"materialId":null,
let param = {
"materialId":null,
"materialIds":null,
"categoryId":null,
"categoryId":null,
"categoryIds":null,
"supplierId": null,
"supplierId": null,
"canteenId": row.canteenId,
"alternativeSuppliers": row.alternativeSuppliers,
"ifSupply": row.ifSupply
}
}
if(!row.materialId){//
param.categoryId = row.materialTypeId
}else{//
param.materialId = row.materialId
param.materialId = row.materialId
}
supplierBindMaterialApi(param).then(response => {
this.$modal.msgSuccess("修改成功");
this.getList()
});
});
},
//-
changSupplierList(row){
console.log(row)
let param = {
"materialId":null,
let param = {
"materialId":null,
"materialIds":null,
"categoryId":null,
"categoryIds":null,
"categoryId":null,
"categoryIds":null,
"canteenId": row.canteenId,
"supplierId": row.supplierId,
"materialId": row.materialId,
@ -473,108 +473,109 @@ export default {
if(!row.materialId){//
param.categoryId = row.materialTypeId
}else{//
param.materialId = row.materialId
param.materialId = row.materialId
}
if(row.supplierIdList&&row.supplierIdList.length>0){
row.supplierIdList.forEach(item => {
param.alternativeSuppliers.push({"supplierId":item})
})
})
}else{
param.alternativeSuppliers=null
}
supplierBindMaterialApi(param).then(response => {
}
supplierBindMaterialApi(param).then(response => {
this.$modal.msgSuccess("修改成功");
this.getList();
});
});
},
//
checkDisabled(item,row){
//
let flag = false;
if(row.alternativeSuppliers&&row.alternativeSuppliers.length>0){
let index = row.alternativeSuppliers.findIndex(v=>v.supplierId==item.supplierId)
if(index==-1){
if(item.status==1){
flag=false
}else{
flag=true
}
}else{
flag=true
}
//
checkDisabled(item,row){
//
let flag = false;
if(row.alternativeSuppliers&&row.alternativeSuppliers.length>0){
let index = row.alternativeSuppliers.findIndex(v=>v.supplierId==item.supplierId)
if(index==-1){
if(item.status==1){
flag=false
}else{
if(item.status==1){
flag=false
}else{
flag=true
}
flag=true
}
return flag;
},
//
checkDisabled2(item,row){
//
let flag = false;
if(row.supplierId&&row.supplierId!=""){
if(item.supplierId==row.supplierId){
if(item.status==1){
flag=false
}else{
flag=true
}
}else{
flag=true
}
}else{
flag=true
}
}else{
if(item.status==1){
flag=false
}else{
flag=true
}
}
return flag;
},
//
checkDisabled2(item,row){
//
let flag = false;
if(row.supplierId&&row.supplierId!=""){
if(item.supplierId==row.supplierId){
if(item.status==1){
flag=false
}else{
if(item.status==1){
flag=false
}else{
flag=true
}
flag=true
}
return flag;
},
//
}else{
flag=true
}
}else{
if(item.status==1){
flag=false
}else{
flag=true
}
}
return flag;
},
//
handleSelectionChange(selection) {
this.batchRows = selection
},
//
handleBatch(){
if(this.batchRows.length==0){
this.$modal.msgError("请先选择货品!");
this.$modal.msgError("请先选择货品!");
}else{
this.batchForm={}
this.resetForm("batchForm");
this.openBatch=true
this.openBatch=true
}
},
//
confirmBatchEdit(){
this.$refs["batchForm"].validate(valid => {
if (valid) {
let arr = [];
let arr = [];
this.batchForm.supplierIdList.forEach(item => {
arr.push({"supplierId":item})
})
let param = {
"materialId":null,
"materialId":null,
"materialIds":[],
"categoryId":null,
"categoryIds":[],
"categoryId":null,
"categoryIds":[],
"canteenId": null,
"supplierId": this.batchForm.supplierId,
"supplierId": this.batchForm.supplierId,
"alternativeSuppliers": arr,
"ifSupply": "1"
}
this.batchRows.forEach(item=>{
if(!item.materialId){
param.categoryIds.push(item.materialTypeId)
param.materialIds=null
param.materialIds=null
}else{
param.materialIds.push(item.materialId)
param.categoryIds=null
}
}
})
console.log(param)
supplierBindMaterialApi(param).then(response => {
@ -582,7 +583,7 @@ export default {
this.openBatch=false;
this.getList();
this.getList2();
});
});
}
})
},
@ -598,7 +599,7 @@ export default {
console.log(e)
this.$set(this.batchForm,"supplierIdList",e)
},
//-----------
/** 搜索按钮操作 */
handleQuery2() {
@ -606,10 +607,10 @@ export default {
this.getList2();
},
/** 重置按钮操作 */
resetQuery2() {
resetQuery2() {
this.queryParams2={
pageNum: 1,
pageSize: 10,
pageSize: 10,
materialTypeIds:[]
}
this.resetForm("queryForm2");
@ -619,9 +620,9 @@ export default {
getList2() {
this.loading = true;
let param = {
"pageNum": this.queryParams2.pageNum,
"pageSize": this.queryParams2.pageSize,
"materialTypeIds": this.queryParams2.materialTypeIds,
"pageNum": this.queryParams2.pageNum,
"pageSize": this.queryParams2.pageSize,
"materialTypeIds": this.queryParams2.materialTypeIds,
}
materialTypeBindSupplierPageApi(param).then(response => {
this.tableListData2 = response.rows;
@ -633,23 +634,23 @@ export default {
})
}
this.$set(item,"supplierIdList",arr)
})
})
this.total2 = Number(response.total);
this.loading = false;
});
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.open = true;
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
this.open = true;
this.reset();
this.open = true;
},
//
cancel() {
@ -660,7 +661,7 @@ export default {
reset() {
this.form = {};
this.resetForm("form");
},
},
/** 提交按钮 */
submitForm: function() {
this.$refs["form"].validate(valid => {

File diff suppressed because it is too large Load Diff