Commit e0e84e02 authored by 皮倩雯's avatar 皮倩雯

fix: '流程中心gis配置增加验证'

parent 60a8e1ca
Pipeline #74418 passed with stages
/* eslint-disable no-unused-expressions */
/* eslint-disable no-else-return */
/* eslint-disable prefer-destructuring */ /* eslint-disable prefer-destructuring */
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { GetMaplayerByTerminalType, GetLayerList, GetLayerFields } from '@/services/flow/flow'; import { GetMaplayerByTerminalType, GetLayerList, GetLayerFields } from '@/services/flow/flow';
...@@ -103,7 +105,7 @@ const AddModal = props => { ...@@ -103,7 +105,7 @@ const AddModal = props => {
let obj = form.getFieldsValue(); let obj = form.getFieldsValue();
let newValue = value ? value : schemeValue; let newValue = value ? value : schemeValue;
console.log(schemeValue); console.log(schemeValue);
debugger debugger;
let data = newValue.find(i => i.servicename === obj.schemeName); let data = newValue.find(i => i.servicename === obj.schemeName);
GetLayerFields({ GetLayerFields({
mapServer: data.servicename, mapServer: data.servicename,
...@@ -125,8 +127,13 @@ const AddModal = props => { ...@@ -125,8 +127,13 @@ const AddModal = props => {
// 表单监听 // 表单监听
const onValuesChange = val => { const onValuesChange = val => {
if (Object.keys(val)[0] === 'schemeName') { if (Object.keys(val)[0] === 'schemeName') {
form.setFieldsValue({ nodeName1: '', nodeValue1: '', users: [] });
setLayerValue([]);
setLayerFields([]);
layerData.current = {};
getLayerList(val[Object.keys(val)[0]]); getLayerList(val[Object.keys(val)[0]]);
} else if (Object.keys(val)[0] === 'nodeName1') { } else if (Object.keys(val)[0] === 'nodeName1') {
form.setFieldsValue({ nodeValue1: '' });
getLayerFields(val[Object.keys(val)[0]]); getLayerFields(val[Object.keys(val)[0]]);
} else if (Object.keys(val)[0] === 'Fields') { } else if (Object.keys(val)[0] === 'Fields') {
let arr = []; let arr = [];
...@@ -134,13 +141,13 @@ const AddModal = props => { ...@@ -134,13 +141,13 @@ const AddModal = props => {
arr.push(...item.TableFields); arr.push(...item.TableFields);
}); });
let data = arr.find(i => i.FieldName === val[Object.keys(val)[0]]); let data = arr.find(i => i.FieldName === val[Object.keys(val)[0]]);
console.log(data);
setTableType(data.type); setTableType(data.type);
setType(data.FiledType); setType(data.FiledType);
setTableName(data.table); setTableName(data.table);
// 修改源字段字段类型改变要重新获取type更新所有目标字段下拉框数据 form.setFieldsValue({ schemeName: '', nodeName1: '', nodeValue1: '', users: [] });
// getLayerFields(val[Object.keys(val)[0]]); setLayerValue([]);
setLayerFields([]);
layerData.current = {};
} }
}; };
...@@ -296,7 +303,7 @@ const AddModal = props => { ...@@ -296,7 +303,7 @@ const AddModal = props => {
{layerFields && {layerFields &&
layerFields.map(item => ( layerFields.map(item => (
<Option value={item.field} key={item.field}> <Option value={item.field} key={item.field}>
<span>{item.field}</span> <span>{item.fieldAlias}</span>
</Option> </Option>
))} ))}
</Select> </Select>
...@@ -328,6 +335,9 @@ const AddModal = props => { ...@@ -328,6 +335,9 @@ const AddModal = props => {
style={{ width: '100%' }} style={{ width: '100%' }}
onChange={e => { onChange={e => {
getLayerFields(e, key); getLayerFields(e, key);
let obj = form.getFieldsValue().users;
obj[key].nodeValue = '';
form.setFieldsValue({ users: obj });
}} }}
> >
{layerValue && {layerValue &&
...@@ -347,7 +357,7 @@ const AddModal = props => { ...@@ -347,7 +357,7 @@ const AddModal = props => {
fieldKey={[fieldKey, 'last']} fieldKey={[fieldKey, 'last']}
labelCol={{ span: 8 }} labelCol={{ span: 8 }}
rules={[{ required: true, message: '不能为空' }]} rules={[{ required: true, message: '不能为空' }]}
style={{ width: '230px', marginLeft: '3px' }} style={{ width: '230px', marginLeft: '5px' }}
> >
<Select <Select
placeholder="请选择设备字段" placeholder="请选择设备字段"
...@@ -358,7 +368,7 @@ const AddModal = props => { ...@@ -358,7 +368,7 @@ const AddModal = props => {
layerData.current[key].map(item => { layerData.current[key].map(item => {
return ( return (
<Option value={item.field} key={item.field}> <Option value={item.field} key={item.field}>
<span>{item.field}</span> <span>{item.fieldAlias}</span>
</Option> </Option>
); );
})} })}
...@@ -387,7 +397,7 @@ const AddModal = props => { ...@@ -387,7 +397,7 @@ const AddModal = props => {
onClick={() => add()} onClick={() => add()}
block block
icon={<PlusOutlined />} icon={<PlusOutlined />}
style={{ width: '411px', marginLeft: '87px' }} style={{ width: '394px', marginLeft: '99px' }}
> >
新增项 新增项
</Button> </Button>
......
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