Commit 2de65965 authored by 皮倩雯's avatar 皮倩雯

fix: '巡检反馈GIS图层修改为下拉选择树'

parent 17c15cc0
Pipeline #65013 failed with stages
......@@ -28,6 +28,7 @@ import {
CM_Feedback_LoadFields,
CM_Feedback_QueryPatrolFeedback,
GetTaskSyncField,
GetGisPatrolObject,
} from '@/services/PatrolFeedback/api';
import {
GetCM_Event_LoadEventTable,
......@@ -66,6 +67,8 @@ const AddModal = props => {
const [keepAllData, setKeepAllData] = useState([]); // 保存所有关联事件类型数据
const [keepTree, setKeepTree] = useState([]);
const [keepAll, setKeepAll] = useState([]); // 保存所选关联事件下完整的字段值
const [treeSelectValue, setTreeSelectValue] = useState([]);
const [menuWebList, setMenuWebList] = useState([]);
const [form] = Form.useForm();
const [formAdd] = Form.useForm();
......@@ -74,6 +77,7 @@ const AddModal = props => {
useEffect(() => {
getEventData(); // 获取所有关联事件数据
getGisPatrolObject();
if (visible) {
if (type === 'edit') {
CM_Feedback_QueryPatrolFeedback({ id: formObj.id }).then(res => {
......@@ -142,6 +146,21 @@ const AddModal = props => {
});
};
const getGisPatrolObject = () => {
GetGisPatrolObject().then(res => {
if (res.code === '0') {
setMenuWebList(res.data);
} else {
notification.error({
message: '提示',
duration: 3,
description: res.msg,
});
}
console.log(res);
});
};
const getReloadTableField = (e, i) => {
reloadTableFields({
tableName: e,
......@@ -579,10 +598,10 @@ const AddModal = props => {
};
const mapTree = org => {
const haveChildren = Array.isArray(org.children) && org.children.length > 0;
const haveChildren = Array.isArray(org.items) && org.items.length > 0;
return haveChildren ? (
<TreeNode value={`123${org.name}`} title={org.name} disabled>
{org.children.map(item => mapTree(item))}
<TreeNode value={org.serverName} title={org.serverName} disabled>
{org.items.map(item => mapTree(item))}
</TreeNode>
) : (
<TreeNode value={org.name} title={org.name} />
......@@ -641,6 +660,10 @@ const AddModal = props => {
// setKeepTree(data);
};
const treeSelectOnchange = e => {
setTreeSelectValue(e);
};
return (
<Drawer
title="反馈配置"
......@@ -703,7 +726,22 @@ const AddModal = props => {
</Col>
<Col span={23}>
<Item label="GIS图层" name="gisLayer" labelCol={{ span: 4 }}>
<Input placeholder="请输入GIS图层" />
<TreeSelect
showSearch
value={treeSelectValue}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择映射字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
onChange={treeSelectOnchange}
>
{menuWebList ? (
menuWebList.map(i => mapTree(i))
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
</TreeSelect>
</Item>
</Col>
<Col span={23}>
......@@ -858,23 +896,6 @@ const AddModal = props => {
))
: ''}
</Select>
{/* <TreeSelect
showSearch
style={{ width: '159px', marginLeft: '4px' }}
// value={treeSelectValue}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
placeholder="请选择映射字段名 "
allowClear
treeDefaultExpandAll
showCheckedStrategy
// onChange={treeSelectOnchange}
>
{keepTree ? (
keepTree.map(i => mapTree(i))
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
)}
</TreeSelect> */}
</Form.Item>
<MinusCircleOutlined
onClick={() => remove(name)}
......
......@@ -47,3 +47,5 @@ export const CM_Feedback_ChangPatrolOrder = patrolOrder =>
// 任务同步事件字段
export const GetTaskSyncField = query =>
get(`${PANDA_GIS}/PatrolInspection/GetTaskSyncField`, query);
export const GetGisPatrolObject = query => get(`${PANDA_GIS}/MapLayer/GetGisPatrolObject`, query);
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