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

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

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