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