diff --git a/src/views/canteen/accountCenter/cardManage/cardList/index.vue b/src/views/canteen/accountCenter/cardManage/cardList/index.vue index 44114641..237faa67 100644 --- a/src/views/canteen/accountCenter/cardManage/cardList/index.vue +++ b/src/views/canteen/accountCenter/cardManage/cardList/index.vue @@ -51,19 +51,19 @@ 换卡 退卡 挂失 无 - + @@ -623,8 +577,7 @@ @@ -724,7 +677,7 @@ isMousemoveId: null, defaultProps: { children: "children", - label: "materialTypeName", + label: "categoryName", }, keyShopWord:"",//左侧树-关键字查询 putawayStates:[{"putawayState":"1","putawayStateName":"上架"},{"putawayState":"2","putawayStateName":"下架"}], @@ -895,6 +848,12 @@ return this.checkUrlList.length > 0 }, }, + watch: { + // 根据名称筛选部门树 + keyShopWord(val) { + this.$refs.typeTree.filter(val); + }, + }, methods: { handleNumberInput(value){ this.inputValue = value.replace(/[^\d.]/g, ''); @@ -1110,13 +1069,14 @@ console.log(file) this.dialogImageUrl = file.url this.dialogVisible = true - }, - - - + }, + //商品类别树 getShopTreeData() { - shopMaterialTreeApi().then((response) => { - this.treeShopOptions = this.handleTree(response.rows,'materialTypeId'); + let param = { + goodsType:2 + } + shopMaterialTreeApi(param).then((response) => { + this.treeShopOptions = response.data this.addLevel(this.treeShopOptions) console.log("this.treeOptions",this.treeShopOptions) if(this.treeShopOptions && this.treeShopOptions.length > 0){ @@ -1129,34 +1089,8 @@ // 筛选节点 - 左侧树 filterNode(value, data) { if (!value) return true; - return data.materialTypeName.indexOf(value) !== -1; - }, - handleTree(data, idKey, parentIdKey = 'parentId', childrenKey = 'children') { - // 用于存储节点数据的Map,以idKey为键 - const nodeMap = new Map(); - // 用于存储根节点的数组 - const rootNodes = []; - - // 遍历数据,构建nodeMap并找到根节点 - data.forEach(node => { - // 将节点添加到nodeMap中,并初始化children为空数组 - nodeMap.set(node[idKey], { ...node, [childrenKey]: [] }); - // 如果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; - }, + return data.categoryName.indexOf(value) !== -1; + }, addLevel(nodes, level = 0) { nodes.forEach(node => { node.level = level; // 设置当前节点的层级 @@ -1214,9 +1148,6 @@ this.resetForm("queryShopForm"); this.handleShopQuery(); }, - - - /** 商品列表 */ getShopList() { this.loading = true; @@ -1226,7 +1157,8 @@ "putawayState": this.queryShopParams.putawayState, "materialName":this.queryShopParams.materialName, "barCode":this.queryShopParams.barCode, - "supermarketId":this.selectSupermarketId + "supermarketId":this.selectSupermarketId, + "materialTypeIds": this.$refs.typeTree.getCheckedKeys(), } console.log("this.queryShopParams",param) shopPageListApi(param).then(response => { @@ -1245,30 +1177,12 @@ } getShopProductApi(param).then(response => { console.log("response.data",response.data) - this.productFrom=response.data; - this.productFrom.putawayStatef=this.productFrom.putawayState=="1"?true:false; - this.productFrom.ifOnlinef=this.productFrom.ifOnline=="2"?true:false; + this.productFrom=response.data; }); }, cancelShopEitd(){ this.openProductEitd=false; - }, - handlePutawayStateEitdChange(from){ - let pws=from.putawayState; - if(pws=="1"){ - this.productFrom.putawayState="2"; - }else if(pws=="2"){ - this.productFrom.putawayState="1"; - } - }, - handleIfOnlineEitdChange(from){ - let pws=from.ifOnline; - if(pws=="1"){ - this.productFrom.ifOnline="2"; - }else if(pws=="2"){ - this.productFrom.ifOnline="1"; - } - }, + }, handlePutawayStateChange(row){ let pws=row.putawayState; let param={} @@ -1304,12 +1218,6 @@ eitdShopProductApi(param).then(response => { this.getShopList(); }); - }, - handlePutawayStateChanges(row){ - - }, - handleIfOnlineChanges(row){ - }, submitShopEitd(){ console.log("this.productFrom",this.productFrom) diff --git a/src/views/foodManage/supplierManage/goodsSupplier/index.vue b/src/views/foodManage/supplierManage/goodsSupplier/index.vue index e142c308..5e3994cc 100644 --- a/src/views/foodManage/supplierManage/goodsSupplier/index.vue +++ b/src/views/foodManage/supplierManage/goodsSupplier/index.vue @@ -85,7 +85,6 @@ -