diff --git a/src/views/canteen/dish/menu/detail.vue b/src/views/canteen/dish/menu/detail.vue index d67e117d..c7f2aa3c 100644 --- a/src/views/canteen/dish/menu/detail.vue +++ b/src/views/canteen/dish/menu/detail.vue @@ -628,7 +628,7 @@ export default { systemAreaTreeApi({}).then((response) => { this.treeAreaOptions = response.data; if(this.treeAreaOptions.length>0){ - this.baseInfo.areaId = this.getFirstChild(this.treeAreaOptions[0]).id; + this.$set(this.baseInfo,"areaId",this.getFirstChild(this.treeAreaOptions[0]).id) this.handleAreaChange() } }); @@ -648,7 +648,7 @@ export default { getCanteenByAreaApi(param).then((response) => { this.canteenOptions=response.rows||[] if(this.canteenOptions.length>0){ - this.baseInfo.canteenId = this.canteenOptions[0].canteenId; + this.$set(this.baseInfo,"canteenId",this.canteenOptions[0].canteenId) this.handleCanteenChange() } }); @@ -661,7 +661,7 @@ export default { getStallByCanteenApi(param).then((response) => { this.stallOptions=response.rows||[] if(this.stallOptions.length>0){ - this.baseInfo.stallId = this.stallOptions[0].stallId; + this.$set(this.baseInfo,"stallId",this.stallOptions[0].stallId) } }); }, diff --git a/src/views/foodManage/purchaseManage/contractList/edit.vue b/src/views/foodManage/purchaseManage/contractList/edit.vue index 8c046e34..c871886d 100644 --- a/src/views/foodManage/purchaseManage/contractList/edit.vue +++ b/src/views/foodManage/purchaseManage/contractList/edit.vue @@ -557,7 +557,14 @@ export default { } param.contractAmount = 0; param.commitStatus=2 - param.purchaseContractDetailList = [] + param.purchaseContractDetailList = [] + param.contractAttachment = "" + if(this.attachmentList.length>0){ + console.log(this.attachmentList) + let arr = this.attachmentList.map(item=>item.url) + param.contractAttachment = arr.join(',') + console.log(param) + } this.noMaterial = false; if(this.contractMaterialList.length>0){ this.contractMaterialList.forEach(item=>{ diff --git a/src/views/foodManage/purchaseManage/purchaseInspection/edit.vue b/src/views/foodManage/purchaseManage/purchaseInspection/edit.vue index 6186b8d1..09842466 100644 --- a/src/views/foodManage/purchaseManage/purchaseInspection/edit.vue +++ b/src/views/foodManage/purchaseManage/purchaseInspection/edit.vue @@ -61,6 +61,24 @@ +
@@ -70,6 +88,7 @@
添加货品 + 导入采购订单 删除
@@ -190,6 +209,57 @@ 取 消 + + + +
+ + + + + + 搜索 + 重置 + + + + + + + + + + + + + + + + + + + + +
+ +
@@ -198,6 +268,7 @@ import { imgUpLoadTwo } from '@/api/system/upload' import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall"; import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi,drpWareHousePageApi } from "@/api/foodManage/purchaseManage"; import { getPurchaseInspectInfoApi,addPurchaseInspectApi,editPurchaseInspectApi } from "@/api/foodManage/purchaseManage"; +import { purchaseOrderPageApi,getPurchaseOrderInfoApi } from "@/api/foodManage/purchaseManage"; export default { name: "InspectionEdit", @@ -211,6 +282,7 @@ export default { contractTitle:undefined, contractType:undefined, areaId:undefined, + contractAttachmentList:[], }, // 表单校验 baseRules: { @@ -246,7 +318,10 @@ export default { ], inspector: [ { required: true, message: "验货人不能为空", trigger: "blur" } - ] + ], + contractAttachmentList: [ + { required: true, message: "合同附件不能为空", trigger: "change" } + ], }, treeAreaOptions:[], canteenOptions:[], @@ -271,12 +346,25 @@ export default { tableListData: [],//货品弹窗-货品表格数据 batchChosenMaterial:[],//货品弹窗-货品表格-选中的货品数组 noMaterial:false, - + //导入功能 + openImportDialog:false, + queryParams2: { // 货品弹窗-货品表格-查询参数 + pageNum: 1, + pageSize: 10, + orderGoodsCode:null + }, + loading2:false, + total2: 0, // 总条数 + tableListData2: [],//导入弹窗-表格数据 + importRow:{},//导入弹窗-表格数据-选中数据 + materialDetailsData: [],//导入弹窗-明细数据 + }; }, created() { this.getAreaTreeData() this.getMaterialTree() + this.attachmentList=[] if(this.$route.query.purchaseInspectionRowData){ this.purchaseInspectionRowData = JSON.parse(this.$route.query.purchaseInspectionRowData) this.getContractInfo() @@ -290,6 +378,7 @@ export default { }else{ this.baseInfo={} this.materialList=[] + this.attachmentList=[] } }, }, @@ -312,6 +401,11 @@ export default { this.materialList.forEach(item=>{ this.$set(item,"unitPrice",Number(item.unitPrice)/100) }) + if(this.baseInfo.contractAttachmentList.length>0){ + this.baseInfo.contractAttachmentList.forEach(item=>{ + this.attachmentList.push({name:item,url:item}) + }) + } supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => { this.supplierOptions = response.rows||[]; this.$set(this.baseInfo,'deliverySupplierId',this.baseInfo.deliverySupplierId) @@ -326,6 +420,10 @@ export default { 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.handleAreaChange() + } }); }, getFirstChild(node) { @@ -343,15 +441,19 @@ export default { /** 查询供应商下拉结构 */ getSupplierData() { supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => { - this.supplierOptions = response.rows||[]; - this.$set(this.baseInfo,"deliverySupplierId",null) + this.supplierOptions = response.rows||[]; + if(this.supplierOptions.length>0){ + this.$set(this.baseInfo,"deliverySupplierId",this.supplierOptions[0].supplierId) + } }); }, /** 查询供应商下拉结构 */ getWareHouseData() { drpWareHousePageApi({ areaId:this.baseInfo.areaId }).then((response) => { - this.wareHouseOptions = response.rows||[]; - this.$set(this.baseInfo,'deliveryWarehouseId',null) + this.wareHouseOptions = response.rows||[]; + if(this.wareHouseOptions.length>0){ + this.$set(this.baseInfo,"deliveryWarehouseId",this.wareHouseOptions[0].warehouseId) + } }); }, /** 查询货品类别下拉树结构 */ @@ -452,11 +554,10 @@ export default { param.inspectQualifiedNum = 0;//验货合格总数量 param.status=1 param.inspectGoodsDetails = [] - param.contractAttachment = "" + param.purchaseAttachmentList = "" if(this.attachmentList.length>0){ - console.log(this.attachmentList) let arr = this.attachmentList.map(item=>item.url) - param.contractAttachment = arr.join(',') + param.purchaseAttachmentList = arr.join(',') console.log(param) } this.noMaterial = false; @@ -519,11 +620,10 @@ export default { param.inspectQualifiedNum = 0;//验货合格总数量 param.status=2 param.inspectGoodsDetails = [] - param.contractAttachment = "" + param.purchaseAttachmentList = "" if(this.attachmentList.length>0){ - console.log(this.attachmentList) let arr = this.attachmentList.map(item=>item.url) - param.contractAttachment = arr.join(',') + param.purchaseAttachmentList = arr.join(',') console.log(param) } this.noMaterial = false; @@ -575,14 +675,80 @@ export default { } } }); + }, + //导入 + importPurchaseOrder(){ + if(this.baseInfo.areaId!=undefined||this.baseInfo.deliveryWarehouseId!=undefined||this.baseInfo.deliverySupplierId!=undefined){ + this.openImportDialog=true + this.resetQuery2() + // setTimeout(()=>{ + // this.$refs.multipleTable2.clearSelection() + // },300) + }else{ + this.$modal.msgError("请先选择区域,仓库,供应商"); + } }, - + /** 搜索按钮操作 */ + handleQuery2() { + this.queryParams2.pageNum = 1; + this.getList2(); + }, + /** 重置按钮操作 */ + resetQuery2() { + this.resetForm("queryForm2"); + this.handleQuery2(); + }, + /** 查询列表 */ + getList2() { + this.loading2 = true; + let param = { + "pageSize": this.queryParams2.pageSize, + "pageNum": this.queryParams2.pageNum, + "orderGoodsCode": this.queryParams2.orderGoodsCode, + "orderStatus":2, + "areaId": this.baseInfo.areaId, + "warehouseId": this.baseInfo.deliveryWarehouseId, + "supplierId": this.baseInfo.deliverySupplierId, + } + purchaseOrderPageApi(param).then(response => { + this.tableListData2 = response.rows; + this.total2 = Number(response.total); + this.loading2 = false; + }); + }, + confirmImport(row){ + console.log(row) + this.importRow = row; + let param = { + orderGoodsId:this.importRow.orderGoodsId + } + getPurchaseOrderInfoApi(param).then((response) => { + this.materialDetailsData = response.data.orderGoodsDetailList||[]; + this.$modal.confirm('是否确认导入采购订单?').then(()=>{ + if(this.materialDetailsData.length>0){ + this.materialList = this.materialDetailsData; + this.materialList.forEach(item=>{ + this.$set(item,"unitPrice",Number(item.singlePrice)/100) + this.$set(item,"orderNum",item.orderNum) + }) + this.baseInfo.relateOrderGoodsId = this.importRow.orderGoodsCode; + this.$set(this.baseInfo,"remark","导入采购订单") + setTimeout(()=>{ + this.openImportDialog=false + },500) + }else{ + this.$modal.msgError("采购订单明细无货品!"); + } + }).catch(() => {}); + }); + }, //附件上传 fileUpLoad(param){ param.type = 'canteen' imgUpLoadTwo(param).then((res) => { if (res.code == 200) { this.attachmentList.push(res.data) + this.baseInfo.purchaseAttachmentList.push(res.data.url) } else { this.$modal.msgError(res.msg); } @@ -591,7 +757,6 @@ export default { }) }, handleRemoveFile(file, fileList){ - console.log(this.attachmentList) let sum = 0 this.attachmentList.forEach((item, index) => { if (item.url == file.url) { @@ -599,6 +764,7 @@ export default { } }) this.attachmentList.splice(sum, 1) + this.baseInfo.purchaseAttachmentList.splice(sum, 1) }, //日期 formatDate(date) { diff --git a/src/views/foodManage/purchaseManage/purchaseOrder/edit.vue b/src/views/foodManage/purchaseManage/purchaseOrder/edit.vue index b297ba80..827ae489 100644 --- a/src/views/foodManage/purchaseManage/purchaseOrder/edit.vue +++ b/src/views/foodManage/purchaseManage/purchaseOrder/edit.vue @@ -15,8 +15,7 @@ format="yyyy-MM-dd" style="width: 240px;" :picker-options="pickerOptions" @change="baseInfo.requestArrivalTime=formatDate(baseInfo.requestArrivalTime)"> - - + - - - - - - + + + + + +
添加货品 + 导入采购计划 删除
@@ -223,6 +223,73 @@ 取 消 + + + +
+ + + + + + + + + + + 搜索 + 重置 + + + + + + + + + + + + + + + +
+
采购计划明细
+ + + + + + + +
+
+ +
+ + @@ -231,6 +298,7 @@ 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 { getPurchaseOrderInfoApi,addPurchaseOrderApi,editPurchaseOrderApi } from "@/api/foodManage/purchaseManage"; +import { purchasePlanPageApi,getPurchasePlanInfoApi } from "@/api/foodManage/purchaseManage"; export default { name: "orderEdit", dicts: [], @@ -296,7 +364,46 @@ export default { tableListData: [],//货品弹窗-货品表格数据 batchChosenMaterial:[],//货品弹窗-货品表格-选中的货品数组 noMaterial:false, - + //导入功能 + openImportDialog:false, + queryParams2: { // 货品弹窗-货品表格-查询参数 + pageNum: 1, + pageSize: 10, + planCode:null + }, + loading2:false, + total2: 0, // 总条数 + tableListData2: [],//导入弹窗-表格数据 + importRow:{},//导入弹窗-表格数据-选中数据 + materialDetailsData: [],//导入弹窗-明细数据 + dateRange:this.defaultDateRange(),//区域树 + pickerOptions2: { + shortcuts: [{ + text: '最近一周', + onClick(picker) { + const start = new Date(); + const end = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 6); + picker.$emit('pick', [start, end]); + } + },{ + text: '最近一个月', + onClick(picker) { + const start = new Date(); + const end = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 30); + picker.$emit('pick', [start, end]); + } + },{ + text: '最近三个月', + onClick(picker) { + const start = new Date(); + const end = new Date(); + start.setTime(start.getTime() - 3600 * 1000 * 24 * 91); + picker.$emit('pick', [start, end]); + } + }] + }, }; }, created() { @@ -359,6 +466,10 @@ export default { 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.handleAreaChange() + } }); }, getFirstChild(node) { @@ -381,7 +492,10 @@ export default { } getCanteenByAreaApi(param).then((response) => { this.canteenOptions=response.rows||[]; - this.$set(this.baseInfo,"canteenId",null) + if(this.canteenOptions.length>0){ + this.$set(this.baseInfo,"canteenId",this.canteenOptions[0].canteenId) + this.handleCanteenChange() + } }); }, /** 查询供应商下拉结构 */ @@ -409,7 +523,9 @@ export default { } getStallByCanteenApi(param).then((response) => { this.stallOptions=response.rows||[] - this.$set(this.baseInfo,"stallId",null) + if(this.stallOptions.length>0){ + this.$set(this.baseInfo,"stallId",this.stallOptions[0].stallId) + } }); }, /** 查询货品类别下拉树结构 */ @@ -641,6 +757,91 @@ export default { }); }, + //导入 + importPurchasePlan(){ + if(this.baseInfo.areaId!=undefined||this.baseInfo.canteenId!=undefined||this.baseInfo.stallId!=undefined){ + this.openImportDialog=true + this.resetQuery2() + // setTimeout(()=>{ + // this.$refs.multipleTable2.clearSelection() + // },300) + }else{ + this.$modal.msgError("请先选择区域,食堂,档口"); + } + }, + /** 搜索按钮操作 */ + handleQuery2() { + this.queryParams2.pageNum = 1; + this.getList2(); + }, + /** 重置按钮操作 */ + resetQuery2() { + this.dateRange = this.defaultDateRange() + this.resetForm("queryForm2"); + this.handleQuery2(); + }, + /** 查询列表 */ + getList2() { + this.loading2 = true; + let param = { + "pageSize": this.queryParams2.pageSize, + "pageNum": this.queryParams2.pageNum, + "planCode": this.queryParams2.planCode, + "status":2, + "areaId": this.baseInfo.areaId, + "canteenId": this.baseInfo.canteenId, + "stallId": this.baseInfo.stallId + } + if(this.dateRange&&this.dateRange.length>0){ + param.startDateTime=this.formatDateTime(this.dateRange[0]) + param.endDateTime=this.formatDateTime(this.dateRange[1]) + }else{ + param.startDateTime=undefined; + param.endDateTime=undefined; + } + purchasePlanPageApi(param).then(response => { + this.tableListData2 = response.rows; + this.total2 = Number(response.total); + this.loading2 = false; + }); + }, + //选中 + handleCurrentChange(row){ + console.log(row) + this.importRow = row; + let param = { + planId:this.importRow.planId + } + getPurchasePlanInfoApi(param).then((response) => { + this.materialDetailsData = response.data.purchasePlanDetailList||[]; + }); + }, + confirmImport(){ + if(this.materialDetailsData.length>0){ + this.$modal.confirm('是否确认覆盖货品明细?').then(() => { + this.materialList = this.materialDetailsData; + this.materialList.forEach(item=>{ + this.$set(item,"orderNum",item.purchaseNum) + }) + this.baseInfo.purchasePlanCode = this.importRow.planCode; + this.$set(this.baseInfo,"remark","导入采购计划") + setTimeout(()=>{ + this.openImportDialog=false + },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); + this.start = parseInt(start.getTime() / 1000) + this.end = parseInt(end.getTime() / 1000) + return [start, end] + }, //日期 formatDate(date) { // 格式化为 YYYY-MM-DD diff --git a/src/views/foodManage/purchaseManage/purchaseOrder/index.vue b/src/views/foodManage/purchaseManage/purchaseOrder/index.vue index 77a29c05..1f9462bf 100644 --- a/src/views/foodManage/purchaseManage/purchaseOrder/index.vue +++ b/src/views/foodManage/purchaseManage/purchaseOrder/index.vue @@ -1,7 +1,7 @@