Commit 966df176 authored by 皮倩雯's avatar 皮倩雯

fix: '巡检反馈图层选择优化'

parent c386d214
Pipeline #78191 passed with stages
...@@ -49,7 +49,15 @@ import RuleConfig from '@/components/RuleConfig'; ...@@ -49,7 +49,15 @@ import RuleConfig from '@/components/RuleConfig';
const { Option } = Select; const { Option } = Select;
const AddModal = props => { const AddModal = props => {
const { callBackSubmit = () => {}, visible, type, formObj, keepTableData, onClose } = props; const {
callBackSubmit = () => {},
visible,
type,
formObj,
keepTableData,
onClose,
pipeArr,
} = props;
const [filed, setFiled] = useState({}); // 传给子组件列表数据 const [filed, setFiled] = useState({}); // 传给子组件列表数据
const [filed1, setFiled1] = useState({}); // 传给子组件列表数据 const [filed1, setFiled1] = useState({}); // 传给子组件列表数据
...@@ -75,6 +83,8 @@ const AddModal = props => { ...@@ -75,6 +83,8 @@ const AddModal = props => {
const [menuWebList, setMenuWebList] = useState([]); const [menuWebList, setMenuWebList] = useState([]);
const [showRule, setShowRule] = useState(false); const [showRule, setShowRule] = useState(false);
const [fieldList, setFieldList] = useState([]); const [fieldList, setFieldList] = useState([]);
const [layerList, setLayerList] = useState([]);
const [newPipeArr, setNewPipeArr] = useState([]);
const [form] = Form.useForm(); const [form] = Form.useForm();
const [formAdd] = Form.useForm(); const [formAdd] = Form.useForm();
...@@ -83,8 +93,8 @@ const AddModal = props => { ...@@ -83,8 +93,8 @@ const AddModal = props => {
useEffect(() => { useEffect(() => {
getEventData(); // 获取所有关联事件数据 getEventData(); // 获取所有关联事件数据
getGisPatrolObject();
if (visible) { if (visible) {
setNewPipeArr(pipeArr);
if (type === 'edit') { if (type === 'edit') {
CM_Feedback_QueryPatrolFeedback({ id: formObj.id }).then(res => { CM_Feedback_QueryPatrolFeedback({ id: formObj.id }).then(res => {
form.setFieldsValue({ ...res.data }); form.setFieldsValue({ ...res.data });
...@@ -92,18 +102,19 @@ const AddModal = props => { ...@@ -92,18 +102,19 @@ const AddModal = props => {
if (!res.data.businessGroup) { if (!res.data.businessGroup) {
form.setFieldsValue({ form.setFieldsValue({
businessGroup: '区域巡检', businessGroup: '区域巡检',
gisLayer: res.data.gisServerName // gisLayer: res.data.gisServerName
? `${res.data.gisServerName}&${res.data.gisLayer}` // ? `${res.data.gisServerName}&${res.data.gisLayer}`
: res.data.gisLayer, // : res.data.gisLayer,
}); });
} else { } else {
form.setFieldsValue({ form.setFieldsValue({
businessGroup: res.data.businessGroup.split(','), businessGroup: res.data.businessGroup.split(','),
gisLayer: res.data.gisServerName // gisLayer: res.data.gisServerName
? `${res.data.gisServerName}&${res.data.gisLayer}` // ? `${res.data.gisServerName}&${res.data.gisLayer}`
: res.data.gisLayer, // : res.data.gisLayer,
}); });
} }
getGisPatrolObject(res.data.gisServerName);
onChangeEvent(res.data.relationEvent, aa); // 改变关联事件类型 onChangeEvent(res.data.relationEvent, aa); // 改变关联事件类型
getFeedbackTable(); getFeedbackTable();
...@@ -119,6 +130,8 @@ const AddModal = props => { ...@@ -119,6 +130,8 @@ const AddModal = props => {
getRoles(); getRoles();
} }
} else { } else {
setLayerList([]);
setNewPipeArr([]);
formAdd.resetFields(); formAdd.resetFields();
form.resetFields(); form.resetFields();
setKeepTree([]); setKeepTree([]);
...@@ -153,10 +166,10 @@ const AddModal = props => { ...@@ -153,10 +166,10 @@ const AddModal = props => {
} }
}; };
const getGisPatrolObject = () => { const getGisPatrolObject = val => {
GetGisPatrolObject().then(res => { GetGisPatrolObject({ serverName: val }).then(res => {
if (res.code === '0') { if (res.code === '0') {
setMenuWebList(res.data); setLayerList(res.data[0]?.items);
} else { } else {
notification.error({ notification.error({
message: '提示', message: '提示',
...@@ -353,15 +366,15 @@ const AddModal = props => { ...@@ -353,15 +366,15 @@ const AddModal = props => {
obj.businessGroup = obj.businessGroup.toString(); obj.businessGroup = obj.businessGroup.toString();
let list = []; let list = [];
let groupNameSever = ''; let groupNameSever = '';
if (obj.gisLayer && obj.gisLayer.indexOf('&') !== -1) { // if (obj.gisLayer && obj.gisLayer.indexOf('&') !== -1) {
list = obj.gisLayer.split('&'); // list = obj.gisLayer.split('&');
obj.gisLayer = list[1]; // obj.gisLayer = list[1];
groupNameSever = list[0]; // groupNameSever = list[0];
} // }
if (type == 'add') { if (type == 'add') {
CM_Feedback_OperatePatrolFeedback({ CM_Feedback_OperatePatrolFeedback({
...obj, ...obj,
gisServerName: groupNameSever, // gisServerName: groupNameSever,
mappingFields: mappingFields && JSON.stringify(mappingFields), mappingFields: mappingFields && JSON.stringify(mappingFields),
}).then(res => { }).then(res => {
if (res.code === 0) { if (res.code === 0) {
...@@ -383,7 +396,7 @@ const AddModal = props => { ...@@ -383,7 +396,7 @@ const AddModal = props => {
} else { } else {
CM_Feedback_OperatePatrolFeedback({ CM_Feedback_OperatePatrolFeedback({
...obj, ...obj,
gisServerName: groupNameSever, // gisServerName: groupNameSever,
id: formObj.id, id: formObj.id,
mappingFields: mappingFields && JSON.stringify(mappingFields), mappingFields: mappingFields && JSON.stringify(mappingFields),
}).then(res => { }).then(res => {
...@@ -613,7 +626,9 @@ const AddModal = props => { ...@@ -613,7 +626,9 @@ const AddModal = props => {
}; };
const treeSelectOnchange = e => { const treeSelectOnchange = e => {
setTreeSelectValue(e); form.setFieldsValue({ gisLayer: '' });
getGisPatrolObject(e);
// setTreeSelectValue(e);
}; };
const saveRule = e => { const saveRule = e => {
...@@ -712,7 +727,53 @@ const AddModal = props => { ...@@ -712,7 +727,53 @@ const AddModal = props => {
<Input placeholder="请输入分组名称" /> <Input placeholder="请输入分组名称" />
</Item> </Item>
</Col> </Col>
<Col span={23}> <Col span={11}>
<Item
label="GIS服务"
name="gisServerName"
labelCol={{ span: 8 }}
rules={[
{
required: true,
message: '请选择GIS服务',
},
]}
>
<Select placeholder="选择GIS服务" onChange={treeSelectOnchange} showSearch>
{newPipeArr
? newPipeArr.map((item, index) => (
<Option key={index} value={item}>
{item}
</Option>
))
: ''}
</Select>
</Item>
</Col>
<Col span={12}>
<Item
label="GIS图层"
name="gisLayer"
labelCol={{ span: 8 }}
rules={[
{
required: true,
message: '请选择GIS图层',
},
]}
>
<Select placeholder="选择GIS图层" showSearch>
{layerList
? layerList.map((item, index) => (
<Option key={item.id} value={item.name}>
{item.name}
</Option>
))
: ''}
</Select>
</Item>
</Col>
{/* <Col span={23}>
<Item <Item
label="GIS图层" label="GIS图层"
name="gisLayer" name="gisLayer"
...@@ -741,7 +802,7 @@ const AddModal = props => { ...@@ -741,7 +802,7 @@ const AddModal = props => {
)} )}
</TreeSelect> </TreeSelect>
</Item> </Item>
</Col> </Col> */}
<Col span={23}> <Col span={23}>
<Item label="GIS条件" name="gisFilterValue" labelCol={{ span: 4 }}> <Item label="GIS条件" name="gisFilterValue" labelCol={{ span: 4 }}>
<Input placeholder="示例:设备级别 = '小区阀门' (设备级别来自图层表字段)" /> <Input placeholder="示例:设备级别 = '小区阀门' (设备级别来自图层表字段)" />
......
...@@ -17,6 +17,7 @@ import { ...@@ -17,6 +17,7 @@ import {
CM_Feedback_LoadPatrolFeedbacks, CM_Feedback_LoadPatrolFeedbacks,
CM_Feedback_RemovePatrolFeedback, CM_Feedback_RemovePatrolFeedback,
} from '@/services/PatrolFeedback/api'; } from '@/services/PatrolFeedback/api';
import { GetVectorService } from '@/services/webConfig/api';
import { import {
EditTwoTone, EditTwoTone,
DeleteOutlined, DeleteOutlined,
...@@ -51,6 +52,8 @@ const patrolFeedback = () => { ...@@ -51,6 +52,8 @@ const patrolFeedback = () => {
const searchValue = useRef(null); const searchValue = useRef(null);
const [keepSearch, setKeepSearch] = useState([]); const [keepSearch, setKeepSearch] = useState([]);
const [newTableData, setNewTableData] = useState([]); const [newTableData, setNewTableData] = useState([]);
const [pipeArr, setPipeArr] = useState([]);
const groupNum = useRef({ 区域巡检: 0, DMA巡检: 0, 未分组: 0 });
const tableList = useRef({ const tableList = useRef({
pageIndex: 1, pageIndex: 1,
pageSize: 20, pageSize: 20,
...@@ -223,8 +226,27 @@ const patrolFeedback = () => { ...@@ -223,8 +226,27 @@ const patrolFeedback = () => {
useEffect(() => { useEffect(() => {
getTableList(); getTableList();
pipeNetwork();
}, []); }, []);
// 获取管网及默认底图
const pipeNetwork = () => {
let pipeArr1 = [];
GetVectorService().then(res => {
if (res.code === 0) {
if (res.data.VectorList.length > 0) {
res.data.VectorList.map(item => {
pipeArr1.push(item.ServiceName.split('.')[0]);
});
}
if (pipeArr1.indexOf('虚拟图层') === -1) {
pipeArr1.push('虚拟图层');
}
setPipeArr(pipeArr1);
}
});
};
const getTableList = val => { const getTableList = val => {
setTreeLoading(true); setTreeLoading(true);
CM_Feedback_LoadPatrolFeedbacks({ CM_Feedback_LoadPatrolFeedbacks({
...@@ -232,8 +254,18 @@ const patrolFeedback = () => { ...@@ -232,8 +254,18 @@ const patrolFeedback = () => {
pageSize: tableList.current.pageSize, pageSize: tableList.current.pageSize,
keyword: val ? val : searchValue.current, keyword: val ? val : searchValue.current,
}).then(res => { }).then(res => {
let list = val ? val : searchValue.current;
if (list) {
setPickItem('');
}
setTreeLoading(false); setTreeLoading(false);
if (res.code === 0) { if (res.code === 0) {
let newGroupNum = {
区域巡检: res.data.AreaInspectionCount,
DMA巡检: res.data.DMAInspectionCont,
未分组: res.data.ElseInspectionCont,
};
groupNum.current = newGroupNum;
tableList.current.total = res.data.TotalCount; tableList.current.total = res.data.TotalCount;
let data = {}; let data = {};
if (res.data.list.length > 0) { if (res.data.list.length > 0) {
...@@ -421,7 +453,7 @@ const patrolFeedback = () => { ...@@ -421,7 +453,7 @@ const patrolFeedback = () => {
{item} {item}
</Tooltip> </Tooltip>
</div> </div>
{tableData[item] ? tableData[item].length : ''} {tableData[item] ? groupNum.current[item] : ''}
</div> </div>
))} ))}
</div> </div>
...@@ -550,6 +582,7 @@ const patrolFeedback = () => { ...@@ -550,6 +582,7 @@ const patrolFeedback = () => {
callBackSubmit={onOK} callBackSubmit={onOK}
formObj={formObj} formObj={formObj}
keepTableData={keepTableData} keepTableData={keepTableData}
pipeArr={pipeArr}
placement="right" placement="right"
/> />
<SortModal <SortModal
......
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