diff --git a/src/api/dish/material.js b/src/api/dish/material.js index f561447d..031f72fd 100644 --- a/src/api/dish/material.js +++ b/src/api/dish/material.js @@ -5,9 +5,6 @@ export function systemMaterialTreeApi(data) { return request({ url: '/smart-canteen/cook_material_type/getTree', method: 'post', - headers: { - "merchant-id":"378915229716713472", - }, data: data }) } diff --git a/src/api/superStore/shopMaterial.js b/src/api/superStore/shopMaterial.js index 00bdee01..aee1eb2b 100644 --- a/src/api/superStore/shopMaterial.js +++ b/src/api/superStore/shopMaterial.js @@ -3,18 +3,18 @@ import request from '@/utils/request' // 商品类别 export function shopMaterialTreeApi(data) { return request({ - url: '/smart-canteen/supermarket_material_type/list', - method: 'get', + url: '/smart-canteen/cook_material_type/getTree', + method: 'post', headers: { "merchant-id":"378915229716713472", }, - params: data + data: data }) } // 新增商品类别 export function addMaterialTypeApi(data) { return request({ - url: '/smart-canteen/supermarket_material_type', + url: '/smart-canteen/cook_material_type/add', method: 'post', headers: { "merchant-id":"378915229716713472", @@ -25,7 +25,7 @@ export function addMaterialTypeApi(data) { //修改商品类别 export function updateMaterialTypeApi(data) { return request({ - url: '/smart-canteen/supermarket_material_type/edit', + url: '/smart-canteen/cook_material_type/edit', method: 'post', headers: { "merchant-id":"378915229716713472", @@ -36,7 +36,7 @@ export function updateMaterialTypeApi(data) { //删除商品类别 export function removeMaterialTypeApi(data) { return request({ - url: '/smart-canteen/supermarket_material_type/del/'+data.materialTypeId, + url: '/smart-canteen/cook_material_type/del/'+data.id, method: 'post', headers: { "merchant-id":"378915229716713472", @@ -48,7 +48,7 @@ export function removeMaterialTypeApi(data) { // 查询商品列表 export function getMaterialListApi(data) { return request({ - url: '/smart-canteen/supermarket_material/list', + url: '/smart-canteen/cook_material/list', method: 'get', headers: { "merchant-id":"378915229716713472", @@ -60,7 +60,7 @@ export function getMaterialListApi(data) { // 新增商品 export function addMaterialApi(data) { return request({ - url: '/smart-canteen/supermarket_material', + url: '/smart-canteen/cook_material/add', method: 'post', headers: { "merchant-id":"378915229716713472", @@ -72,7 +72,7 @@ export function addMaterialApi(data) { // 编辑商品 export function updateMaterialApi(data) { return request({ - url: '/smart-canteen/supermarket_material/edit', + url: '/smart-canteen/cook_material/edit', method: 'post', headers: { "merchant-id":"378915229716713472", @@ -84,7 +84,7 @@ export function updateMaterialApi(data) { // 删除商品 export function removeMaterialApi(data) { return request({ - url: '/smart-canteen/supermarket_material/del/'+data.materialId, + url: '/smart-canteen/cook_material/del/'+data.materialId, method: 'post', headers: { "merchant-id":"378915229716713472", diff --git a/src/views/canteen/dish/material/components/MaterialDialog.vue b/src/views/canteen/dish/material/components/MaterialDialog.vue index c6046dad..e4e5d9e2 100644 --- a/src/views/canteen/dish/material/components/MaterialDialog.vue +++ b/src/views/canteen/dish/material/components/MaterialDialog.vue @@ -352,7 +352,8 @@ export default { //类型树 getTypeTreeData() { let param = { - // areaId:this.form.areaId + areaId:this.form.areaId, + goodsType:1 } systemMaterialTreeApi(param).then((response) => { this.treeTypeOptions = response.data; diff --git a/src/views/canteen/dish/material/index.vue b/src/views/canteen/dish/material/index.vue index 30973956..1dda0270 100644 --- a/src/views/canteen/dish/material/index.vue +++ b/src/views/canteen/dish/material/index.vue @@ -430,7 +430,10 @@ export default { }, /** 查询新增页面-上级类型下拉树结构 */ getTreeData() { - systemMaterialTreeApi({categoryType:1}).then((response) => { + let param = { + goodsType:1 + } + systemMaterialTreeApi(param).then((response) => { this.treeOptions = response.data; this.addLevel(this.treeOptions) console.log("this.treeOptions",this.treeOptions) @@ -549,6 +552,7 @@ export default { "areaId": this.queryParams.areaId, "materialName": this.queryParams.materialName, "materialCode": this.queryParams.materialCode, + "goodsType": 1, "materialTypeIds": this.$refs.typeTree.getCheckedKeys(), } getMaterialListApi(params).then((response) => { diff --git a/src/views/canteen/superstore/shopMaterial/components/MaterialDialog.vue b/src/views/canteen/superstore/shopMaterial/components/MaterialDialog.vue index f6f1df5a..ad060686 100644 --- a/src/views/canteen/superstore/shopMaterial/components/MaterialDialog.vue +++ b/src/views/canteen/superstore/shopMaterial/components/MaterialDialog.vue @@ -39,7 +39,7 @@ :props="{ emitPath: false,// 若设置 false,则只返回该节点的值,只返回最后选择的id checkStrictly: false,//来设置父子节点取消选中关联,从而达到选择任意一级选项的目的 - value:'materialTypeId',label:'materialTypeName' + value:'id',label:'categoryName' }" clearable > @@ -264,40 +264,10 @@ export default { }, //类型树 getTypeTreeData() { - shopMaterialTreeApi().then((response) => { - this.treeTypeOptions = this.handleTree(response.rows,'materialTypeId'); + shopMaterialTreeApi({areaId:this.form.areaId,goodsType:2}).then((response) => { + this.treeTypeOptions = response.data; }); }, - handleTree(data, idKey, parentIdKey = 'parentId', childrenKey = 'children') { - // 用于存储节点数据的Map,以idKey为键 - const nodeMap = new Map(); - // 用于存储根节点的数组 - const rootNodes = []; - - // 遍历数据,构建nodeMap并找到根节点 - data.forEach(node => { - // 将节点添加到nodeMap中,并初始化children为空数组 - if(node.parentId==0){ - nodeMap.set(node[idKey], { ...node, [childrenKey]: [] }); - }else{ - nodeMap.set(node[idKey], { ...node }); - } - // 如果parentId为null或父节点不存在于nodeMap中,则该节点为根节点 - if (node[parentIdKey] === null || !nodeMap.has(node[parentIdKey])) { - // 将根节点添加到rootNodes数组中 - rootNodes.push(nodeMap.get(node[idKey])); - } else { - // 否则,将当前节点添加到其父节点的children列表中 - // 获取父节点 - const parentNode = nodeMap.get(node[parentIdKey]); - // 将当前节点添加到父节点的children列表中 - parentNode[childrenKey].push(nodeMap.get(node[idKey])); - } - }); - - // 返回根节点数组,它现在包含了完整的树形结构 - return rootNodes; - }, //单位类型拉下选 getDrpUnitList() { let param = { diff --git a/src/views/canteen/superstore/shopMaterial/index.vue b/src/views/canteen/superstore/shopMaterial/index.vue index 6ae9ae48..1d16b781 100644 --- a/src/views/canteen/superstore/shopMaterial/index.vue +++ b/src/views/canteen/superstore/shopMaterial/index.vue @@ -27,7 +27,7 @@ :expand-on-click-node="false" :filter-node-method="filterNode" ref="typeTree" - node-key="materialTypeId" + node-key="id" highlight-current @node-click="handleNodeClick" @check-change="handleCheckChange" @@ -312,7 +312,7 @@ export default { isMousemoveId: null, defaultProps: { children: "children", - label: "materialTypeName", + label: "categoryName", }, keyWord:"",//左侧树-关键字查询 isEditType:false,//是否编辑 @@ -383,8 +383,11 @@ export default { }, /** 查询新增页面-上级类型下拉树结构 */ getTreeData() { - shopMaterialTreeApi().then((response) => { - this.treeOptions = this.handleTree(response.rows,'materialTypeId'); + let param = { + goodsType:2 + } + shopMaterialTreeApi(param).then((response) => { + this.treeOptions = response.data; this.addLevel(this.treeOptions) console.log("this.treeOptions",this.treeOptions) if(this.treeOptions && this.treeOptions.length > 0){ @@ -442,7 +445,8 @@ export default { this.isEditType=false; this.form={} this.resetForm("form"); - this.$set(this.form,"parentId",data.materialTypeId) + this.$set(this.form,"parentId",data.id) + this.$set(this.form,"goodsType",data.categoryType) this.open = true; this.title = "新增"; }, @@ -454,33 +458,19 @@ export default { this.form = { ...data }; - console.log(this.form) + this.$set(this.form,"materialTypeId",data.id) + this.$set(this.form,"materialTypeName",data.categoryName) + this.$set(this.form,"goodsType",data.categoryType) this.open = true; this.title = "修改"; - }, - // 获取父节点的类别名称 - getParentCategoryName(parentId) { - const findNode = (nodes) => { - for (let node of nodes) { - if (node.materialTypeId === parentId) { - return node.materialTypeName; - } - if (node.children) { - const result = findNode(node.children); - if (result) return result; - } - } - return ""; - }; - return findNode(this.treeOptions); - }, + }, /* 树节点删除 */ removeTreeNode(data) { console.log(data, "删除时的数据源--"); this.$modal .confirm("是否确认删除数据项?") .then(function () { - return removeMaterialTypeApi({"materialTypeId":data.materialTypeId}); + return removeMaterialTypeApi({"id":data.id}); }) .then(() => { this.$modal.msgSuccess("删除成功"); @@ -540,6 +530,7 @@ export default { "materialName": this.queryParams.materialName, "barCode": this.queryParams.barCode, "materialCode": this.queryParams.materialCode, + "goodsType": 2, "materialTypeIds": this.$refs.typeTree.getCheckedKeys(), } getMaterialListApi(params).then((response) => { diff --git a/src/views/foodManage/purchaseManage/contractList/edit.vue b/src/views/foodManage/purchaseManage/contractList/edit.vue index 5d86c0f0..c7303e86 100644 --- a/src/views/foodManage/purchaseManage/contractList/edit.vue +++ b/src/views/foodManage/purchaseManage/contractList/edit.vue @@ -92,22 +92,79 @@ -
- +
+
+
+ 货品信息 +
+
+ 添加货品 + 删除 +
+
+
+ + + + + + + + + + + + + + +
- 提 交 + 提 交 返 回
- -
- + +
+ + + + + + + + + 搜索 + 重置 + + + + + + + + + + + + + + + +
@@ -122,6 +179,7 @@ export default { data() { return { loading:false, + loadingBtn:false, baseInfo: { contractName:undefined, contractType:undefined, @@ -152,25 +210,23 @@ export default { canteenOptions:[], supplierOptions:[], stallOptions:[], - dateRange:[], - // dateRangeRadio:"", - // dateRangeList:[], - // dateRangeIndex:0, + dateRange:[], pickerOptions: { disabledDate(v) { return v.getTime() < (new Date().getTime() - 86400000);// - 86400000是否包括当天 } }, - contractDateList:[], - weekDateList:[], - detailList:[], - openDishes:false, - // 查询菜品 - queryDish:{ - salesMode:null, - typeId:null, - dishesName:'' - }, + contractMaterialList:[], + openDialog:false, + // 查询参数 + queryParams: { + pageNum: 1, + pageSize: 10, + }, + // 总条数 + total: 0, + //表格数据 + tableListData: [], }; }, @@ -212,12 +268,39 @@ export default { // getSupplierByAreaApi(param).then((response) => { // this.supplierOptions=response.rows||[] // }); - }, - - + }, //选择日期范围 changeDateRange(e){ //this.formatDate(e[0]) + }, + addMaterial(){ + this.openDialog=true + setTimeout(()=>{ + this.$refs.multipleTable1.clearSelection() + },300) + }, + /** 搜索按钮操作 */ + handleQuery() { + this.queryParams.pageNum = 1; + this.getList(); + }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm("queryForm"); + this.handleQuery(); + }, + /** 查询列表 */ + getList() { + this.loading = true; + let param = { + "pageNum": this.queryParams.pageNum, + "pageSize": this.queryParams.pageSize, + } + getPageCanteenApi(param).then(response => { + this.tableListData = response.records; + this.total = Number(response.total); + this.loading = false; + }); }, // 提交按钮 confirmSubmit(){ @@ -251,18 +334,28 @@ export default { // if(this.noDishes){ // this.$modal.msgError("请选中菜品!"); // }else{ - // this.loading=true + // this.loadingBtn=true // addMenucontractApi(param).then((response) => { - // this.loading=false + // this.loadingBtn=false // this.jumpList() // }).catch(() => { - // this.loading=false + // this.loadingBtn=false // }); // } } }); }, - + // 多选框选中数据 + handleSelectionChange(selection) { + // this.batchIds1 = selection.map(item => item.tradeId) + // this.single = selection.length !== 1 + // this.multiple = !selection.length + }, + handleSelectionChange2(selection) { + // this.batchIds1 = selection.map(item => item.tradeId) + // this.single = selection.length !== 1 + // this.multiple = !selection.length + }, //日期 formatDate(date) { // 格式化为 YYYY-MM-DD diff --git a/src/views/foodManage/purchaseManage/contractList/index.vue b/src/views/foodManage/purchaseManage/contractList/index.vue index 9aa59dd8..674890b4 100644 --- a/src/views/foodManage/purchaseManage/contractList/index.vue +++ b/src/views/foodManage/purchaseManage/contractList/index.vue @@ -218,8 +218,8 @@ export default { getList() { this.loading = true; let param = { - "current": this.queryParams.pageNum, - "size": this.queryParams.pageSize, + "pageNum": this.queryParams.pageNum, + "pageSize": this.queryParams.pageSize, } getPageCanteenApi(param).then(response => { this.tableListData = response.records;