Commit 859d17be authored by 前端-李俊鑫's avatar 前端-李俊鑫

feat: 调整规则配置品类接口

parent 32535c1b
import React, { useRef, useState, useCallback, forwardRef, memo, useEffect, useImperativeHandle } from 'react'
import { Modal, Tree } from 'antd'
import CommonDrawer from '../CommonDrawer'
import { getProductPlatformGetCategoryTree } from '@/services/ProductV2Api'
import { getProductCustomerGetCustomerCategoryTree } from '@/services/ProductV2Api'
interface PropsType {
onOk?: (values: any) => void
......@@ -24,7 +24,7 @@ const CategoryDrawer = (props: PropsType, ref) => {
}, [checkedKeys])
const getCategoryTree = async () => {
const { code, data } = await getProductPlatformGetCategoryTree()
const { code, data } = await getProductCustomerGetCustomerCategoryTree()
if (code === 1000) {
setCategoryTree(data)
}
......@@ -38,11 +38,11 @@ const CategoryDrawer = (props: PropsType, ref) => {
const checkAbleCategoryTree = () => {
const newTree = JSON.parse(JSON.stringify(categoryTree))
function delTree(tree, delItem) {
function delTree(delItem) {
if (delItem) {
if (delItem.children.length) {
delItem.children.forEach(item => {
delTree(tree, item)
delTree(item)
})
} else {
if(selectCache.includes(delItem.id)) {
......@@ -52,7 +52,7 @@ const CategoryDrawer = (props: PropsType, ref) => {
}
}
newTree.forEach(item => {
delTree(newTree, item)
delTree(item)
})
return newTree
}
......
......@@ -69,9 +69,10 @@ const ConfigDrawer = (props: PropsType, ref) => {
fnClose()
}
})
return
} else {
onChange?.()
fnClose()
}
fnClose()
}, [])
const handleShow = useCallback(async ({ process, formData }: any, flag: boolean) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment