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

fix: '修复巡检初始值获取失败bug'

parent 637ef695
Pipeline #63418 passed with stages
......@@ -56,6 +56,7 @@ import VerifyModal from './VerifyModal';
import Tree from '@/components/ExpendableTree';
import RuleConfig from '@/components/RuleConfig';
import Things from '../../../../../assets/images/icons/时间.svg';
import logo from '@/assets/images/icons/值映射.png';
const AddModal = props => {
const {
callBackSubmit = () => {},
......@@ -3348,17 +3349,17 @@ const AddModal = props => {
rules={[{ required: true, message: '请输入字段名' }]}
style={{ marginBottom:0}}
>
<Input placeholder="请输入字段名" style={{width:'210px'}}/>
<Input placeholder="请输入字段名" style={{width:'208px'}}/>
</Item>
</Col>
<Col span={1} style={{paddingTop:'3px'}}><SwapOutlined style={{marginLeft:'-4px'}}/></Col>
<Col span={1} style={{paddingTop:'3px'}}> <img src={logo} style={{ height: '24px', marginLeft:'-10px' }} alt="" /></Col>
<Col span={11}>
<Item
name="eventOrder"
rules={[{ required: true, message: '请输入映射字段名' }]}
style={{ marginBottom:0}}
>
<Input placeholder="请输入映射字段名" style={{ width:'210px'}}/>
<Input placeholder="请输入映射字段名" style={{ width:'208px'}}/>
</Item>
</Col>
</Row>
......@@ -3404,9 +3405,10 @@ const AddModal = props => {
},
]}
>
<Input placeholder="请填写字段名" style={{ width:'210px', marginLeft:'98px'}}/>
<Input placeholder="请填写字段名" style={{ width:'208px', marginLeft:'98px'}}/>
</Form.Item>
<SwapOutlined style={{marginLeft:'4px'}}/>
{/* <SwapOutlined style={{marginLeft:'4px'}}/> */}
<img src={logo} style={{ height: '24px' }} alt="" />
<Form.Item
{...restField}
style={{ marginBottom: '5px' }}
......@@ -3414,7 +3416,7 @@ const AddModal = props => {
fieldKey={[fieldKey, 'key']}
rules={[{ required: true, message: '请填写映射字段名'}]}
>
<Input placeholder="请填写映射字段名" style={{ width:'210px', marginLeft:'4px'}}/>
<Input placeholder="请填写映射字段名" style={{ width:'208px'}}/>
</Form.Item>
<MinusCircleOutlined
onClick={() => remove(name)}
......
......@@ -61,12 +61,11 @@ const AddModal = props => {
const [chooseGroupName, setChooseGroupName] = useState(['角色', '部门', '站点']);
const [keepFiled, setKeepFiled] = useState([]);
const [eventData, setEventData] = useState([]);
const [keepData, setKeepData] = useState([]);
const [keep, setkeep] = useState([]);
const [keepAllData, setKeepAllData] = useState([]);
const [keepData, setKeepData] = useState('');
const [keep, setkeep] = useState([]); // 保存初始完整任务同步事件字段
const [keepAllData, setKeepAllData] = useState([]); // 保存所有关联事件类型数据
const [keepTree, setKeepTree] = useState([]);
const [keepAll, setKeepAll] = useState([]);
const all = useRef();
const [keepAll, setKeepAll] = useState([]); // 保存所选关联事件下完整的字段值
const [form] = Form.useForm();
const [formAdd] = Form.useForm();
......@@ -95,16 +94,16 @@ const AddModal = props => {
formAdd.resetFields();
form.resetFields();
setKeepTree([]);
setKeepData([]);
setKeepData('');
}
}, [visible]);
// 获取字段名数据
const getGetTaskSyncField = e => {
GetTaskSyncField().then(res => {
if (res.code === '0') {
// 编辑时处理数据为下拉框过滤调已选数据
if (e) {
console.log(res.data);
console.log(e);
let datalist = [...e];
datalist.map(i => {
res.data.map(j => {
......@@ -113,9 +112,7 @@ const AddModal = props => {
}
});
});
console.log(e);
console.log(datalist);
formAdd.setFieldsValue({ parmars: datalist });
formAdd.setFieldsValue({ parmars: datalist }); // 处理数据让下拉框回显title值
let aa = e;
let from = [];
aa.map(i => {
......@@ -124,18 +121,15 @@ const AddModal = props => {
}
});
let lastFrom = [];
keep.map(j => {
res.data.map(j => {
if (from.indexOf(j.key) == -1) {
lastFrom.push(j);
}
});
setKeepData(lastFrom);
console.log(lastFrom);
} else {
setKeepData(res.data);
console.log(res.data);
}
setkeep(res.data);
}
});
......@@ -149,7 +143,7 @@ const AddModal = props => {
console.log(res.data.root);
console.log(i);
setKeepAll(res.data.root);
// 编辑时过滤数据
// 编辑时过滤下l拉框初始数据
if (i) {
let aa = i;
let to = [];
......@@ -307,14 +301,11 @@ const AddModal = props => {
const onSubmit = () => {
formAdd.validateFields().then(validate1 => {
console.log(validate1);
if (validate1) {
form.validateFields().then(validate => {
if (validate) {
let obj = form.getFieldsValue();
let objaa = formAdd.getFieldValue('parmars');
console.log(objaa);
console.log(keep);
objaa &&
objaa.map(i => {
keep.map(j => {
......@@ -323,7 +314,6 @@ const AddModal = props => {
}
});
});
console.log(objaa);
if (type == 'add') {
CM_Feedback_OperatePatrolFeedback({
...obj,
......@@ -880,7 +870,7 @@ const AddModal = props => {
block
icon={<PlusOutlined />}
style={{ marginLeft: '-2px' }}
disabled={!(keepData.length > 0)}
disabled={keepData && !(keepData.length > 0)}
>
添加映射
</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