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

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

View File

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

File diff suppressed because it is too large Load Diff