|
|
@ -74,7 +74,7 @@ function AreaManage() { |
|
|
|
}) |
|
|
|
} |
|
|
|
const handleAreaAdd = ({ level, id, isCity }) => { |
|
|
|
let pid =id |
|
|
|
let pid = id |
|
|
|
setIsCity(isCity) |
|
|
|
setPid(pid) |
|
|
|
setLevel(Number(level) + 1) |
|
|
@ -89,7 +89,15 @@ function AreaManage() { |
|
|
|
} |
|
|
|
|
|
|
|
// 区域删除 |
|
|
|
const handleAreaDel = ({ name, id }) => { |
|
|
|
const handleAreaDel = ({ name, id, children }) => { |
|
|
|
let arr = [] |
|
|
|
arr.push(id) |
|
|
|
console.log(children, id); |
|
|
|
if (children != undefined) { |
|
|
|
children.map(res => { |
|
|
|
arr.push(res.id) |
|
|
|
}) |
|
|
|
} |
|
|
|
Modal.confirm({ |
|
|
|
title: '确认删除?', |
|
|
|
content: `是否确认删除区域: ${name}`, |
|
|
@ -97,7 +105,7 @@ function AreaManage() { |
|
|
|
okText: '删除', |
|
|
|
cancelText: '取消', |
|
|
|
onOk: () => { |
|
|
|
ajaxAreaDel({ name, id }).then((msg) => { |
|
|
|
ajaxAreaDel({ name, arr }).then((msg) => { |
|
|
|
message.success(msg) |
|
|
|
getAreaTree() |
|
|
|
}).catch((err) => { |
|
|
@ -158,14 +166,14 @@ function AreaManage() { |
|
|
|
{ |
|
|
|
level === 2 ? <> |
|
|
|
<PlusCircleOutlined className='label-icon' onClick={() => handleAreaAdd({ level, id, isCity: false })} /> |
|
|
|
<DeleteOutlined className="label-icon" onClick={() => handleAreaDel({ name, id })} /> |
|
|
|
<DeleteOutlined className="label-icon" onClick={() => handleAreaDel({ name, id, children })} /> |
|
|
|
<EditOutlined className="label-icon" onClick={() => handleAreaEdit({ name, id, virtually_code, code, lng_lat })} /> |
|
|
|
</> : null |
|
|
|
} |
|
|
|
{ |
|
|
|
level > 2 ? <> |
|
|
|
{/* <PlusCircleOutlined className='label-icon' onClick={() => handleAreaAdd({level, pid, isCity: false})} /> */} |
|
|
|
<DeleteOutlined className="label-icon" onClick={() => handleAreaDel({ name, id })} /> |
|
|
|
<DeleteOutlined className="label-icon" onClick={() => handleAreaDel({ name, id, children })} /> |
|
|
|
<EditOutlined className="label-icon" onClick={() => handleAreaEdit({ name, id, virtually_code, code, lng_lat })} /> |
|
|
|
</> : null |
|
|
|
} |
|
|
|