Commit 7d9070cb authored by 武广's avatar 武广

feat: 添加初始化tree

parent 0d105a36
......@@ -8,7 +8,7 @@ const CustomTree = forwardRef(props => {
const { treeData } = props;
const onChange = () => {
props.onChange(treeData.key, !treeData.checked);
props.onChange(treeData.key, !treeData.checked, treeData.level);
};
const onVisible = debounce(e => {
......
This diff is collapsed.
......@@ -48,15 +48,22 @@ const AddAreaModal = props => {
const handleOk = () => {
validateFields(async (error, fieldsValue) => {
const newData = [];
console.log('fieldsValue :>> ', fieldsValue);
fieldsValue.list.map(itemData =>
newData.push({
addressId: itemData.key,
addressLevel: itemData.level,
addressName: itemData.label,
}),
);
const getValues = list => {
list.forEach(itemData => {
if (itemData.checked) {
newData.push({
addressId: itemData.key,
addressLevel: itemData.level,
addressName: itemData.label,
});
} else if (itemData.children && itemData.children.length) {
getValues(itemData.children);
}
});
};
if (!error) {
console.log('fieldsValue :>> ', fieldsValue);
getValues(fieldsValue.list);
if (props.templateData.status) {
const data = await forbiddenAddress({
templateId: props.templateData.id,
......@@ -91,6 +98,9 @@ const AddAreaModal = props => {
let arr = [];
const dealData = list =>
list.map(item => {
item.key = +item.addressId;
item.label = item.addressName;
item.indeterminate = !item.isForbidden;
item.checked = item.isForbidden;
item.children && item.children.length && dealData(item.children);
return item;
......
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