fieldEditor.jsx 188 KB
Newer Older
1
/* eslint-disable no-cond-assign */
2 3 4 5
/* eslint-disable prefer-promise-reject-errors */
/* eslint-disable prettier/prettier */
/* eslint-disable guard-for-in */
/* eslint-disable eqeqeq */
6
/* eslint-disable no-lonely-if */
7
/* eslint-disable no-restricted-syntax */
8
/* eslint-disable indent */
9 10 11 12 13 14
/* eslint-disable prefer-destructuring */
/* eslint-disable import/order */
/* eslint-disable default-case */
/* eslint-disable one-var */
/* eslint-disable no-unused-expressions */
/* eslint-disable no-case-declarations */
15
import React, { useState, useEffect } from 'react';
皮倩雯's avatar
皮倩雯 committed
16 17 18 19 20 21 22 23 24 25 26 27
import {
  Form,
  Modal,
  Input,
  Select,
  Radio,
  Checkbox,
  notification,
  Tooltip,
  Drawer,
  Space,
  Button,
28
  Empty,
29 30
  Col,
  Row,
31
  TreeSelect,
32
  Image,
33
  Switch,
皮倩雯's avatar
皮倩雯 committed
34
} from 'antd';
35
import AllImage from '@/assets/images/title/All.png';
36
import TreeImage from '@/assets/images/title/Tree.png';
37
import partImage from '@/assets/images/title/part.png';
38
import {
皮倩雯's avatar
皮倩雯 committed
39 40 41 42 43
  getField,
  loadTableFields,
  LoadEventFields,
  LoadEventType,
  UpdateFields,
44
  reloadTableFields,
邓超's avatar
邓超 committed
45
} from '@/services/tablemanager/tablemanager';
46 47 48 49 50
import {
  PlusSquareOutlined,
  UnorderedListOutlined,
  FontColorsOutlined,
  InfoCircleOutlined,
51 52
  MinusCircleOutlined,
  PlusOutlined,
53
  SwapOutlined,
54
  CodeSandboxCircleFilled,
55
} from '@ant-design/icons';
56

57 58
import styles from './index.less';
import VerifyModal from './VerifyModal';
59
import Tree from '@/components/ExpendableTree';
60
import RuleConfig from '@/components/RuleConfig';
61
import Things from '../../../../../assets/images/icons/时间.svg';
62
import logo from '@/assets/images/icons/值映射.png';
63
import AddForm from '../../../../productCenter/webConfig/menuconfig/AddForm';
64
const AddModal = props => {
65 66 67 68 69 70 71 72 73
  const {
    callBackSubmit = () => {},
    isType,
    itemData,
    isVisible,
    formObj1,
    onCancel,
    treeData,
    keepTreeFirst,
皮倩雯's avatar
皮倩雯 committed
74
    keepStandingBook,
75
    keepTreeData,
76
    keepTree,
77
  } = props;
皮倩雯's avatar
皮倩雯 committed
78 79 80 81
  const [loading, setLoading] = useState(false);
  const [fieldName, setFieldName] = useState([]); // 弹窗
  const [eventList, setEventList] = useState([]); // 事件
  const [filed, setFiled] = useState({}); // 事件
82
  const [treeValue, setTreeValue] = useState([]);
皮倩雯's avatar
皮倩雯 committed
83
  const [verification, setVerification] = useState([]);
84
  const [Shape, setShape] = useState('');
85
  const [treeSelectValue, setTreeSelectValue] = useState(undefined);
86 87
  const [pep, setPep] = useState(false);
  const [cho, setCho] = useState(false);
88
  const [site, setSite] = useState(false);
89
  const [flag, setFlag] = useState(false);
90
  const [saveBtnLoading, setSaveBtnLoading] = useState(false);
91 92 93 94 95 96 97 98 99 100 101 102 103 104

  const [characteristics1, setCharacteristics1] = useState([
    {
      name: '文本类',
      ID: 0,
      children: [
        '文本',
        '唯一值文本',
        '多行文本',
        '本人部门',
        '本人姓名',
        '数值',
        '地址',
        '设备二维码',
105
        // '本人ID',
106
        '富文本',
皮倩雯's avatar
皮倩雯 committed
107
        '编码',
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
      ],
    },
    {
      name: '选择器类',
      ID: 1,
      children: [
        '选择器',
        '搜索选择器',
        '值选择器',
        '可编辑值选择器',
        '站点选择器',
        '人员选择器',
        '城市选择器',
        '台账选择器',
        '业务选择器',
        '部门选择器',
      ],
    },
    {
      name: '附件类',
      ID: 2,
129
      children: ['附件', '图片', '录音', '视频'],
130 131 132 133 134 135 136 137 138 139 140
    },
    {
      name: '时间类',
      ID: 3,
      children: ['日期时间', '日期', '日期月份', '日期年份', '日期周', '时分秒'],
    },
    {
      name: '地图类',
      ID: 4,
      children: ['坐标控件', '设备选择', '区域控件', '路径控件', '位置坐标'],
    },
皮倩雯's avatar
皮倩雯 committed
141 142 143 144 145
    // {
    //   name: '台账专有类',
    //   ID: 5,
    //   children: ['智能抄表'],
    // },
146 147 148 149 150
    {
      name: '高级控件',
      ID: 5,
      children: ['关联表单'],
    },
151
  ]);
皮倩雯's avatar
皮倩雯 committed
152 153 154 155 156
  const [visible, setVisible] = useState(false); // 弹窗
  const [isShow, setIsShow] = useState(false); // 弹窗
  const [type, setType] = useState(''); // 弹窗类型
  const [formObj, setFormObj] = useState({ rule: [], numerical: '' });
  const [characterValue, setCharacterValue] = useState('');
157
  const [show, setShow] = useState('block');
158
  const [hide, setHide] = useState(false);
皮倩雯's avatar
皮倩雯 committed
159 160 161 162
  const [pramData, setPramData] = useState({
    Unit: '',
    ExceptionEvent: '',
    Group: '',
163 164 165 166
    RowSpan: '',
    ColSpan: '',
    ReadOnly: '',
    EditableLater: '',
皮倩雯's avatar
皮倩雯 committed
167 168
    ExceptionValue: '',
    Preset: '',
169 170 171
    picture: '',
    must: '',
    coordinates: '',
皮倩雯's avatar
皮倩雯 committed
172
  });
173 174 175 176 177
  const [currentSelectOrg, setCurrentSelectOrg] = useState([]);
  const [checkedList, setCheckedList] = useState([]); // 选中的复选框内容
  const [expendKey, setExpendKey] = useState(''); // 保存默认展开项
  const [valueData, setValueData] = useState([]); // 保存所有修改数据
  const [keep, setKeep] = useState();
178
  const [chee, setChee] = useState('');
179
  const [cheestyle, setCheestyle] = useState('');
180
  const [radio, setRadio] = useState('');
181
  const [radiostyle, setRadiostyle] = useState('');
182 183 184
  const [radio1, setRadio1] = useState('');
  const [radio3, setRadio3] = useState('');
  const [detail, setDetail] = useState('');
185 186
  const [checkboxAll1, setCheckboxAll1] = useState('');
  const [checkboxAllID1, setCheckboxAllID1] = useState('');
皮倩雯's avatar
皮倩雯 committed
187 188 189
  const { TextArea } = Input;
  const [form] = Form.useForm();
  const { Item } = Form;
190
  const { TreeNode } = TreeSelect;
191
  const [timeData, setTimeData] = useState('');
皮倩雯's avatar
皮倩雯 committed
192
  const { Option } = Select;
193
  const [synchronization, setSynchronization] = useState('');
194 195 196
  const [popeleShape, setPopeleShape] = useState('');
  const [gl, setGl] = useState('');
  const [cse, setCse] = useState('');
197 198 199 200
  const [view, setView] = useState(true);
  const [preView, setPreView] = useState(true);
  const [viewMuise, setViewMuise] = useState(true);
  const [preViewVideo, setPreViewVideo] = useState(true);
201 202
  const [visibleChecked, setVisibleChecked] = useState(true);
  const [formAdd] = Form.useForm();
203 204
  const [showRule, setShowRule] = useState(false);
  const [fieldList, setFieldList] = useState([]);
205 206
  const [fieldValue, setFeildValue] = useState([]); // 保存关联表单形态,字段名下拉框数据
  const [mapFieldValue, setMapFeildValue] = useState([]); // 保存关联表单形态,映射字段名下拉框数据
207 208 209
  const [standbookData, setStandbookData] = useState([]);
  const [fieldshineChecked, setFieldshineChecked] = useState(false);
  const [standFiledData, setStandFiledData] = useState([]);
210

211 212 213 214
  const change = e => {
    console.log(e);
    setVisibleChecked(e);
  };
215 216 217
  const fieldshineChange = e => {
    console.log(e);
    setFieldshineChecked(e);
218
    setCho(false);
219
    form.setFieldsValue({ fieldName: '' });
220
  };
221 222 223
  const onChangeView = e => {
    setView(e.target.checked);
  };
224

225 226 227
  const onChangePreView = e => {
    setPreView(e.target.checked);
  };
228

229 230 231
  const onChangePreViewMuise = e => {
    setViewMuise(e.target.checked);
  };
232

233 234 235
  const onChangePreViewVideo = e => {
    setPreViewVideo(e.target.checked);
  };
236

皮倩雯's avatar
皮倩雯 committed
237 238
  // 提交
  const onSubmit = () => {
239
    setSaveBtnLoading(true);
240 241
    // 不切换树
    if (valueData.length == 0) {
242 243 244 245 246 247 248 249 250
      formAdd.validateFields().then(validate1 => {
        if (validate1) {
          form.validateFields().then(validate => {
            if (validate) {
              setLoading(true);
              let obj = form.getFieldsValue();
              let aa = '';
              if (synchronization == true) {
                aa = 1;
251
              } else {
252
                aa = 0;
253
              }
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
              console.log(Shape);
              let data = [
                {
                  Unit: obj.Unit || '',
                  StoreType: pramData.StoreType,
                  Group: pramData.Group || '',
                  Shape,
                  ExceptionEvent: pramData.ExceptionEvent || '',
                  RowSpan: Number(obj.RowSpan) || 0,
                  ColSpan: pramData.ColSpan || 0,
                  ReadOnly: pramData.ReadOnly || false,
                  EditableLater: pramData.EditableLater || false,
                  ExceptionValue: pramData.ExceptionValue || '',
                  Preset: pramData.Preset || '',
                  ID: pramData.ID,
                  Order: pramData.Order,
                  Name: obj.Name,
                  Alias: obj.Alias,
                  SyncEvent: aa,
                  ValidationRule: obj.ValidationRule,
                  ExceptionEventFields: characterValue,
                },
              ];
              console.log(data);
              switch (Shape) {
279 280 281 282 283 284 285 286 287 288 289 290 291 292
                case '本人部门':
                  if (checkboxAllID1 == true) {
                    data[0].Config = `ID存储`;
                  } else {
                    data[0].Config = '';
                  }
                  break;
                case '本人姓名':
                  if (checkboxAllID1 == true) {
                    data[0].Config = `ID存储`;
                  } else {
                    data[0].Config = '';
                  }
                  break;
293 294 295 296 297 298 299 300 301
                case '编码':
                  data[0].Config = `${obj.code}.${obj.prefix ? obj.prefix : ''}`;
                  break;
                case '坐标控件':
                  pramData.coordinates ? (data[0].Config = '当前坐标') : (data[0].Config = '');
                  break;
                case '图片':
                case '可预览图片':
                  // data[0].Config = pramData.picture ? '拍照相册' : '';
302
                  data[0].Config = pramData.picture ? '拍照相册' : '';
303 304 305 306 307 308 309 310 311 312 313 314
                  data[0].ValidationRule = pramData.must ? 'required' : '';
                  break;
                case '值选择器':
                  if (obj.Config.endsWith('.n')) {
                    data[0].Config = obj.Config;
                  } else if (radiostyle == 1) {
                    // 平铺值选择器
                    data[0].Config = cho ? `${obj.Config}.n` : `${obj.Config}`;
                  } else {
                    data[0].Config = obj.Config;
                  }
                  break;
315

316 317 318 319 320 321 322 323 324
                case '搜索选择器':
                  if (obj.Config.endsWith('.n')) {
                    data[0].Config = obj.Config;
                  } else {
                    // 平铺值选择器
                    data[0].Config = radio == 0 ? `${obj.Config}` : `${obj.Config}.n`;
                  }
                  break;
                case '部门选择器':
325 326
                  if (checkboxAllID1 == true) {
                    data[0].Config = cho ? `.n+ID存储` : `+ID存储`;
327
                  } else {
328
                    data[0].Config = cho ? `.n` : '';
329 330 331 332
                  }
                  break;
                case '唯一值文本':
                  data[0].Config = obj.fieldName
333
                    ? `${obj.tableName}.${obj.fieldName}`
334 335 336
                    : `${obj.tableName}`;
                  break;
                case '站点选择器':
337 338 339 340 341 342 343
                  if (checkboxAllID1 == true) {
                    data[0].Config = pep
                      ? `本人${cho ? '.n' : ''}+ID存储`
                      : `全部${cho ? '.n' : ''}+ID存储`;
                  } else {
                    data[0].Config = pep ? `本人${cho ? '.n' : ''}` : `全部${cho ? '.n' : ''}`;
                  }
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359
                  break;
                case '业务选择器':
                  if (obj.fieldName.endsWith('.n')) {
                    data[0].Config = obj.fieldName
                      ? `${obj.tableName}.${obj.fieldName}`
                      : `${obj.tableName}`;
                  } else if (obj.fieldName) {
                    data[0].Config =
                      radio == 0
                        ? `${obj.tableName}.${obj.fieldName}`
                        : `${obj.tableName}.${obj.fieldName}.n`;
                  } else {
                    data[0].Config = radio == 0 ? `${obj.tableName}` : `${obj.tableName}.n`;
                  }
                  break;
                case '台账选择器':
360 361 362 363 364 365 366 367
                  let arr = {};
                  arr.fromField = obj.workOrder;
                  arr.toField = obj.eventOrder;
                  let li = [];
                  if (formAdd.getFieldValue('parmars')) {
                    li = [...formAdd.getFieldValue('parmars')];
                  }
                  li.push(arr);
368
                  let result = {};
369
                  result.siteJurisdiction = !!site;
370 371 372 373 374
                  result.fieldshine = li;
                  console.log(result);
                  let standData = fieldshineChecked ? JSON.stringify(result) : obj.fieldName;
                  console.log(JSON.stringify(result));
                  console.log(standData);
375
                  if (obj.fieldName && obj.fieldName.endsWith('.n')) {
376
                    data[0].Config = `${obj.standingBook}.${obj.fieldName}`;
377
                  } else if (standData) {
378 379 380
                    data[0].Config = cho
                      ? `${obj.standingBook}.${standData}.n`
                      : `${obj.standingBook}.${standData}`;
381 382 383
                  }
                  if (obj.filterName) {
                    data[0].Config = `${data[0].Config}?${obj.filterName}`;
384 385
                  } else {
                    data[0].Config = `${data[0].Config}`;
386
                  }
387
                  console.log(data[0].Config);
388 389 390 391 392 393
                  break;
                case '关联表单':
                  let aalist = {};
                  aalist.台账名称 = obj.standingBook;
                  aalist.默认显示 = visibleChecked || false;
                  aalist.控制规则 = obj.configName;
394

395 396 397
                  let arrlist = {};
                  arrlist.fromField = obj.workOrder;
                  arrlist.toField = obj.eventOrder;
398
                  let lii = [];
399 400
                  if (formAdd.getFieldValue('parmars')) {
                    lii = [...formAdd.getFieldValue('parmars')];
401 402 403 404 405 406 407 408 409 410 411
                  }
                  console.log(lii);
                  lii.push(arrlist);
                  aalist.映射字段 = lii;
                  data[0].Config = JSON.stringify(aalist);
                  break;
                case '选择器':
                  if (cse) {
                    let str = cho
                      ? `${obj.farter}.${obj.farterData}.n`
                      : `${obj.farter}.${obj.farterData}`;
412 413
                    data[0].Config = str;
                  } else {
414 415
                    console.log(obj.Config);
                    let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
416 417
                    data[0].Config = str;
                  }
418 419 420 421 422
                  break;
                case '人员选择器':
                  if (popeleShape == '分组模态') {
                    if (checkboxAllID1 == true) {
                      if (obj.ConfigName) {
423 424 425
                        let str = cho
                          ? `全部.${obj.ConfigName}.n+ID存储`
                          : `全部.${obj.ConfigName}+ID存储`;
426 427
                        data[0].Config = str;
                      } else {
428
                        let str = cho ? `全部.n+ID存储` : `全部+ID存储`;
429 430 431 432 433 434 435 436 437 438
                        data[0].Config = str;
                      }
                    } else if (obj.ConfigName) {
                      let str = cho ? `全部.${obj.ConfigName}.n` : `全部.${obj.ConfigName}`;
                      data[0].Config = str;
                    } else {
                      let str = cho ? `全部.n` : `全部`;
                      data[0].Config = str;
                    }
                  } else if (popeleShape == '下拉框') {
439 440
                    if (checkboxAllID1 == true) {
                      let str = cho ? `${obj.Config}.n+ID存储` : `${obj.Config}+ID存储`;
441 442
                      data[0].Config = str;
                    } else {
443
                      let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
444 445
                      data[0].Config = str;
                    }
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463
                  } else if (popeleShape == '树形模态') {
                    if (gl) {
                      if (checkboxAllID1 == true) {
                        let str = cho ? `tree.多选|站点+ID存储` : `tree.单选|站点+ID存储`;
                        data[0].Config = str;
                      } else {
                        let str = cho ? `tree.多选|站点` : `tree.单选|站点`;
                        data[0].Config = str;
                      }
                    } else {
                      if (checkboxAllID1 == true) {
                        let str = cho ? `tree.多选|非站点+ID存储` : `tree.单选|非站点+ID存储`;
                        data[0].Config = str;
                      } else {
                        let str = cho ? `tree.多选|非站点` : `tree.单选|非站点`;
                        data[0].Config = str;
                      }
                    }
464 465 466 467 468 469 470 471 472
                  }
                  break;
                default:
                  data[0].Config = obj.Config;
              }
              console.log(data);
              if (Shape == '图片') {
                if (view) {
                  data[0].Shape = '可预览图片';
473
                } else {
474
                  data[0].Shape = '图片';
475
                }
476 477 478 479
              }
              if (Shape == '附件') {
                if (preView) {
                  data[0].Shape = '可预览附件';
480
                } else {
481
                  data[0].Shape = '附件';
482
                }
483
              }
484 485 486 487 488 489 490 491 492 493
              if (Shape == '值选择器') {
                if (radiostyle == 0) {
                  if (!cho) {
                    data[0].Shape = '值选择器';
                  } else {
                    data[0].Shape = '值复选器';
                  }
                } else {
                  data[0].Shape = '平铺值选择器';
                }
494
              }
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
              console.log(data);
              UpdateFields(data).then(res => {
                setLoading(false);
                if (res.msg === 'Ok' || res.msg === '') {
                  form.resetFields();
                  callBackSubmit();
                  notification.success({
                    message: '提示',
                    duration: 3,
                    description: '修改成功',
                  });
                } else {
                  notification.error({
                    message: '提示',
                    duration: 3,
                    description: res.msg,
                  });
                }
513
                setSaveBtnLoading(false);
514 515 516 517 518 519
              });
            }
          });
        }
      });
    } else {
520 521 522 523 524 525 526
      formAdd.validateFields().then(validate1 => {
        if (validate1) {
          form.validateFields().then(validate => {
            if (validate) {
              onSelect(1.14, keep);
            }
          });
527 528
        }
      });
529
    }
皮倩雯's avatar
皮倩雯 committed
530
  };
531

532
  const getData = () => {
533
    console.log(keepTree);
534
    let last = [];
535 536
    let aa = ['工单编号', '事件编号']; // 固定分组数据
    let kk = [];
537 538 539 540 541 542 543 544 545 546 547 548 549
    keepTree.map((i, j) => {
      if (i != '工单编号' && i != '事件编号') {
        // let kk = {};
        // kk.name = i;
        // kk.ID = j + 1;
        // last.push(kk);
        kk.push(i);
      }
    });
    let bb = {}; // 内置字段对象
    bb.name = '内置字段';
    bb.ID = 0;
    bb.children = aa;
550 551
    last.push(bb);
    let dd = {}; // 附加字段对象
552 553 554
    dd.name = '附加字段';
    dd.ID = 1;
    dd.children = kk;
555 556
    last.push(dd);
    console.log(last);
557 558 559 560 561 562 563 564 565 566
    setFeildValue(last);

    // let cc = [];
    // cc.push(bb);
    // console.log(cc.concat(last));
    // if (aa.length > 0) {
    //   setFeildValue(cc.concat(last));
    // } else {
    //   setFeildValue(last);
    // }
567
    // 编辑时过滤下拉框初始数据
568
  };
569

皮倩雯's avatar
皮倩雯 committed
570
  useEffect(() => {
571
    if (isVisible) {
572 573
      console.log(keepTree);
      getStandData();
574
      getData();
575
      setFieldList(keepTreeData);
576 577 578 579 580 581
      // 用于判断分组名与字段名重复时提示当前未选中字段
      if (keepTreeFirst.indexOf(itemData.name) != -1 && itemData.children) {
        setShow('none');
      } else {
        setShow('block');
      }
582
      console.log(treeData);
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604
      setTreeValue(treeData);
      setValueData([]);
      setExpendKey(itemData.ID);
      setCurrentSelectOrg(itemData.ID);
      console.log(treeData);
      if (isType != '') {
        let req1 = getField({ fieldID: itemData.ID });
        let req2 = loadTableFields({ tableName: formObj1 });
        let req3 = LoadEventType({});
        Promise.all([req1, req2, req3]).then(res => {
          res[1].msg === 'Ok' && setFieldName(res[1].data.root);
          res[2].msg === 'Ok' && setEventList(res[2].data.root);
          if (res[0].msg === 'Ok') {
            form.setFieldsValue({ ...res[0].data.root });
            if (res[0].data.root.ExceptionEventFields === '') {
              setCharacterValue('');
              setCheckedList([]);
              setIsShow(false);
            } else {
              setIsShow(true);
              setCharacterValue(res[0].data.root.ExceptionEventFields);
              setCheckedList(res[0].data.root.ExceptionEventFields.split(','));
605
            }
606 607 608 609 610 611 612
            if (res[0].data.root.SyncEvent === 1) {
              form.setFieldsValue({ SyncEvent: true });
              setSynchronization(true);
            } else {
              form.setFieldsValue({ SyncEvent: false });
              setSynchronization(false);
            }
613
            console.log(res[0].data.root.Shape);
614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635
            if (res[0].data.root.StoreType == 'datetime') {
              setCharacteristics1([
                {
                  name: '时间类',
                  ID: 3,
                  children: ['日期时间', '日期', '日期月份', '日期年份', '日期周', '时分秒'],
                },
              ]);
            } else {
              setCharacteristics1([
                {
                  name: '文本类',
                  ID: 0,
                  children: [
                    '文本',
                    '唯一值文本',
                    '多行文本',
                    '本人部门',
                    '本人姓名',
                    '数值',
                    '地址',
                    '设备二维码',
636
                    // '本人ID',
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677
                    '富文本',
                    '编码',
                  ],
                },
                {
                  name: '选择器类',
                  ID: 1,
                  children: [
                    '选择器',
                    '搜索选择器',
                    '值选择器',
                    '可编辑值选择器',
                    '站点选择器',
                    '人员选择器',
                    '城市选择器',
                    '台账选择器',
                    '业务选择器',
                    '部门选择器',
                  ],
                },
                {
                  name: '附件类',
                  ID: 2,
                  children: ['附件', '图片', '录音', '视频'],
                },
                {
                  name: '时间类',
                  ID: 3,
                  children: ['日期时间', '日期', '日期月份', '日期年份', '日期周', '时分秒'],
                },
                {
                  name: '地图类',
                  ID: 4,
                  children: ['坐标控件', '设备选择', '区域控件', '路径控件', '位置坐标'],
                },
                {
                  name: '高级控件',
                  ID: 5,
                  children: ['关联表单'],
                },
              ]);
678
            }
679

680 681 682 683 684 685 686 687 688 689 690 691
            if (res[0].data.root.Shape == '文本') {
              setDetail('输入内容将显示在前端输入框提示信息中');
            } else if (res[0].data.root.Shape == '多行文本') {
              setDetail('输入内容将显示在前端输入框提示信息中');
            } else if (res[0].data.root.Shape == '数值') {
              setDetail('输入内容将显示在前端输入框提示信息中');
            } else if (res[0].data.root.Shape == '设备二维码') {
              setDetail('输入内容将显示在前端输入框提示信息中');
            } else if (res[0].data.root.Shape == '选择器') {
              setDetail('数据字典名称');
            } else if (
              res[0].data.root.Shape == '值选择器' ||
692
              res[0].data.root.Shape == '值复选器'
693 694 695 696 697 698 699 700 701 702
            ) {
              setDetail('用英文逗号分隔自定义的值,可设置初始值');
            } else if (res[0].data.root.Shape == '可编辑值选择器') {
              setDetail('用英文逗号分隔自定义的值,可编辑,可设置初始值');
            } else if (res[0].data.root.Shape == '平铺值选择器') {
              setDetail('用英文逗号分隔自定义的值,勾选,可设置初始值值后加.n可调整为复选');
            } else {
              setDetail('');
            }

703 704 705 706
            let coordinates = false;
            let picture = false;
            let must = false;

707 708 709 710 711 712
            switch (res[0].data.root.Shape) {
              case '坐标控件':
                res[0].data.root.Config === '当前坐标'
                  ? (coordinates = true)
                  : (coordinates = false);
                break;
713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736
              case '日期时间':
              case '日期':
              case '日期月份':
              case '日期年份':
              case '日期周':
              case '时分秒':
                if (res[0].data.root.Config === '默认为空') {
                  form.setFieldsValue({
                    Config: '默认为空',
                  });
                } else if (res[0].data.root.Config === '锁定为当前时间') {
                  form.setFieldsValue({
                    Config: '不可选择',
                  });
                } else if (res[0].data.root.Config === '默认为当前时间') {
                  form.setFieldsValue({
                    Config: '默认为当前时间',
                  });
                } else if (res[0].data.root.Config === '不超过当前时间') {
                  form.setFieldsValue({
                    Config: '不超过当前时间',
                  });
                }
                break;
737
              case '图片':
738
                // res[0].data.root.Config === '拍照相册' ? (picture = true) : (picture = false);
739
                res[0].data.root.Config === '拍照相册' ? (picture = true) : (picture = false);
740
                res[0].data.root.ValidationRule === 'required' ? (must = true) : (must = false);
741
                break;
742
              case '可预览图片':
743
                // res[0].data.root.Config === '拍照相册' ? (picture = true) : (picture = false);
744
                res[0].data.root.Config === '拍照相册' ? (picture = true) : (picture = false);
745 746
                res[0].data.root.ValidationRule === 'required' ? (must = true) : (must = false);
                break;
747 748 749 750 751 752 753
              case '编码':
                let code = res[0].data.root.Config.split('.');
                form.setFieldsValue({
                  code: code[0] || '',
                  prefix: code[1] === 'undefined' ? '' : code[1],
                });
                break;
754 755
              case '本人部门':
                let depart = res[0].data.root.Config;
756 757
                form.setFieldsValue({ AllID1: !!depart });
                setCheckboxAllID1(!!depart);
758 759 760
                break;
              case '本人姓名':
                let name = res[0].data.root.Config;
761 762
                form.setFieldsValue({ AllID1: !!name });
                setCheckboxAllID1(!!name);
763
                break;
764
              case '站点选择器':
765 766
                let siteId = res[0].data.root.Config.split('+');
                let site = siteId[0].split('.');
767
                if (site[0] == '本人') {
768 769 770 771
                  if (res[0].data.root.Config.indexOf('.n') !== -1) {
                    form.setFieldsValue({
                      pepole: true,
                      choose: true,
772
                      AllID1: !!siteId[1],
773
                    });
774 775
                    setPep(true);
                    setCho(true);
776
                  } else {
777 778 779
                    form.setFieldsValue({
                      pepole: true,
                      choose: false,
780
                      AllID1: !!siteId[1],
781
                    });
782 783
                    setPep(true);
                    setCho(false);
784
                  }
785 786 787 788 789
                } else if (site[0] == '全部') {
                  if (res[0].data.root.Config.indexOf('.n') !== -1) {
                    form.setFieldsValue({
                      pepole: false,
                      choose: true,
790
                      AllID1: !!siteId[1],
791 792 793 794 795 796 797
                    });
                    setPep(false);
                    setCho(true);
                  } else {
                    form.setFieldsValue({
                      pepole: false,
                      choose: false,
798
                      AllID1: !!siteId[1],
799 800 801 802
                    });
                    setPep(false);
                    setCho(false);
                  }
803
                }
804
                setCheckboxAllID1(!!siteId[1]);
805
                break;
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822
              case '搜索选择器':
                let data = res[0].data.root.Config.split('.');
                form.setFieldsValue({
                  Config: data[0] || '',
                });
                if (res[0].data.root.Config.endsWith('.n')) {
                  form.setFieldsValue({
                    check: 1,
                  });
                  setRadio(1);
                } else {
                  form.setFieldsValue({
                    check: 0,
                  });
                  setRadio(0);
                }
                break;
823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847
              case '平铺值选择器':
                let dataa = res[0].data.root.Config.split('.');
                form.setFieldsValue({
                  Config: dataa[0] || '',
                });
                if (res[0].data.root.Config.endsWith('.n')) {
                  form.setFieldsValue({
                    check: 1,
                    choose: true,
                  });
                  setCho(true);
                  setRadio(1);
                } else {
                  form.setFieldsValue({
                    check: 0,
                    choose: false,
                  });
                  setCho(false);
                  setRadio(0);
                }
                form.setFieldsValue({
                  style: 1,
                });
                setRadiostyle(1);
                break;
848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874
              case '唯一值文本':
                let arr = res[0].data.root.Config.split('.');
                form.setFieldsValue({
                  tableName: arr[0] || '',
                  fieldName: arr[1] || '',
                });
                break;
              case '业务选择器':
                let list = res[0].data.root.Config.split('.');
                console.log(list);
                form.setFieldsValue({
                  tableName: list[0] || '',
                  fieldName: list[1] || '',
                });
                if (res[0].data.root.Config.endsWith('.n')) {
                  form.setFieldsValue({
                    check: 1,
                  });
                  setRadio(1);
                } else {
                  form.setFieldsValue({
                    check: 0,
                  });
                  setRadio(0);
                }
                break;
              case '部门选择器':
875 876
                let department = res[0].data.root.Config.split('+');
                if (department[0] == '.n') {
877
                  form.setFieldsValue({ choose: true, AllID1: !!department[1] });
878
                  setCho(true);
879
                } else {
880
                  form.setFieldsValue({ choose: false, AllID1: !!department[1] });
881
                  setCho(false);
882
                }
883
                setCheckboxAllID1(!!department[1]);
884 885 886
                break;
              case '台账选择器':
                let book = res[0].data.root.Config.split('.');
887
                let rueslt1 = keepStandingBook.find(i => i.name == book[0]);
888 889 890 891
                if(!rueslt1) {
                  notification.error({
                    message: '提示',
                    duration: 3,
892
                    description: `没有匹配到台账名【${book[0]}】,请检查配置!`,
893 894 895 896
                  });
                } else {
                  getMapFelidValue(rueslt1?.tableName);
                }
897
                let bb = book[1].split('?');
898 899 900 901 902
                if (bb[0].indexOf('[') !== -1) {
                  let filedname = JSON.parse(bb[0]);
                  form.setFieldsValue({
                    standingBook: book[0] || '',
                    fieldName: bb[0] || '',
903 904 905 906 907 908 909 910 911 912
                    workOrder:
                      filedname.fieldshine != undefined
                        ? filedname.fieldshine[filedname.fieldshine.length - 1].fromField
                        : filedname[filedname.length - 1].fromField,
                    eventOrder:
                      filedname.fieldshine != undefined
                        ? filedname.fieldshine[filedname.fieldshine.length - 1].toField
                        : filedname[filedname.length - 1].toField,
                    siteJurisdiction:
                      filedname.siteJurisdiction != undefined ? filedname.siteJurisdiction : false,
913 914
                    fieldshine: true,
                  });
915 916 917
                  setSite(
                    filedname.siteJurisdiction != undefined ? filedname.siteJurisdiction : false,
                  );
918
                  // 映射字段
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944
                  if (filedname.fieldshine != undefined) {
                    if (Array.isArray(filedname.fieldshine)) {
                      let gg = [...filedname.fieldshine];
                      let a11 = [];
                      gg.length > 0 &&
                        gg.map((i, j) => {
                          if (j !== gg.length - 1) {
                            a11.push(i);
                          }
                        });
                      formAdd.setFieldsValue({ parmars: a11 });
                      setFieldshineChecked(true);
                    }
                  } else {
                    if (Array.isArray(filedname)) {
                      let gg = [...filedname];
                      let a11 = [];
                      gg.length > 0 &&
                        gg.map((i, j) => {
                          if (j !== gg.length - 1) {
                            a11.push(i);
                          }
                        });
                      formAdd.setFieldsValue({ parmars: a11 });
                      setFieldshineChecked(true);
                    }
945 946 947 948 949 950 951 952 953 954
                  }
                } else {
                  form.setFieldsValue({
                    standingBook: book[0] || '',
                    fieldName: bb[0] || '',
                    fieldshine: false,
                  });
                  setFieldshineChecked(false);
                }

955 956 957
                let book1 = res[0].data.root.Config.split('?');
                if (book1[1]) {
                  form.setFieldsValue({
皮倩雯's avatar
皮倩雯 committed
958
                    filterName: book1[1],
959 960 961 962
                  });
                }
                if (book1[0].endsWith('.n')) {
                  form.setFieldsValue({
963
                    check: true,
964
                  });
965
                  setCho(true);
966 967
                } else {
                  form.setFieldsValue({
968
                    check: false,
969
                  });
970
                  setCho(false);
971 972
                }
                break;
973
              case '关联表单':
974
                console.log(keepStandingBook);
975
                let data11 = JSON.parse(res[0].data.root.Config);
976 977
                let rueslt = keepStandingBook.find(i => i.name == data11.台账名称);
                console.log(rueslt.tableName);
978 979 980 981
                if(!rueslt1) {
                  notification.error({
                    message: '提示',
                    duration: 3,
982
                    description: `没有匹配到台账名【${book[0]}】,请检查配置!`,
983 984 985 986
                  });
                } else {
                  getMapFelidValue(rueslt1?.tableName);
                }
987 988
                form.setFieldsValue({
                  standingBook: data11.台账名称,
989 990
                  workOrder: data11.映射字段[data11.映射字段.length - 1].fromField,
                  eventOrder: data11.映射字段[data11.映射字段.length - 1].toField,
991 992 993
                  configName: data11.控制规则,
                });
                let gg = [...data11.映射字段];
994 995 996 997 998 999 1000
                let a11 = [];
                gg.length > 0 &&
                  gg.map((i, j) => {
                    if (j !== gg.length - 1) {
                      a11.push(i);
                    }
                  });
1001 1002 1003
                formAdd.setFieldsValue({ parmars: a11 });
                setVisibleChecked(data11.默认显示);
                break;
1004 1005 1006 1007
              case '选择器':
                let sele = res[0].data.root.Config.split('.');
                console.log(sele[0]);
                console.log(sele[1]);
1008
                if (sele[1] && sele[1] != 'n') {
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022
                  form.setFieldsValue({
                    Association: true,
                    farter: sele[0],
                    farterData: sele[1],
                  });
                  setCse(true);
                } else {
                  console.log(sele[0]);
                  form.setFieldsValue({
                    Association: false,
                    Config: sele[0],
                  });
                  setCse(false);
                }
1023 1024 1025 1026 1027 1028 1029
                if (res[0].data.root.Config.endsWith('.n')) {
                  form.setFieldsValue({ choose: true });
                  setCho(true);
                } else {
                  form.setFieldsValue({ choose: false });
                  setCho(false);
                }
1030
                break;
1031 1032
              case '人员选择器':
                let pepole = res[0].data.root.Config.split('.');
1033
                let id = res[0].data.root.Config.split('+');
1034 1035
                form.setFieldsValue({ ShowConfig: res[0].data.root.Config });
                if (pepole[0] == '全部') {
1036 1037 1038
                  setHide(false);
                  setFlag(true);
                  setCheckboxAll1(true);
1039 1040 1041
                  if (pepole[1] && pepole[1] != 'n') {
                    let aa = pepole[1].split('+');
                    console.log(aa);
1042
                    form.setFieldsValue({
1043
                      PeShape: '分组模态',
1044
                      All1: true,
1045
                      AllID1: !!id[1],
1046
                      ConfigName: aa[0] !== 'n' ? aa[0] : '',
1047 1048 1049
                    });
                  } else {
                    form.setFieldsValue({
1050
                      PeShape: '分组模态',
1051
                      All1: true,
1052
                      AllID1: !!id[1],
1053 1054 1055
                      ConfigName: '',
                    });
                  }
1056
                  setCheckboxAllID1(!!id[1]);
1057
                  if (res[0].data.root.Config.indexOf('.n') !== -1) {
1058 1059
                    form.setFieldsValue({ choose: true });
                    setCho(true);
1060 1061 1062
                  } else {
                    form.setFieldsValue({ choose: false });
                    setCho(false);
1063 1064 1065 1066 1067 1068 1069
                  }
                  setPopeleShape('分组模态');
                } else if (pepole[0] == 'tree') {
                  setCheckboxAll1(false);
                  setHide(true);
                  setFlag(1);
                  let tree = pepole[1].split('|');
1070
                  let treeId = tree[1].split('+');
1071
                  if (tree[0] == '多选') {
1072
                    if (treeId[0] == '站点') {
1073 1074 1075
                      form.setFieldsValue({
                        PeShape: '树形模态',
                        All1: true,
1076
                        AllID1: !!id[1],
1077 1078
                        guolv: true,
                        choose: true,
1079
                      });
1080 1081
                      setGl(true);
                      setCho(true);
1082 1083 1084 1085
                    } else {
                      form.setFieldsValue({
                        PeShape: '树形模态',
                        All1: true,
1086
                        AllID1: !!id[1],
1087 1088
                        guolv: false,
                        choose: true,
1089
                      });
1090 1091
                      setGl(false);
                      setCho(true);
1092
                    }
1093
                  } else if (treeId[0] == '站点') {
1094 1095 1096
                    form.setFieldsValue({
                      PeShape: '树形模态',
                      All1: true,
1097
                      AllID1: !!id[1],
1098 1099 1100 1101 1102
                      guolv: true,
                      choose: false,
                    });
                    setGl(true);
                    setCho(false);
1103
                  } else {
1104 1105 1106
                    form.setFieldsValue({
                      PeShape: '树形模态',
                      All1: true,
1107
                      AllID1: !!id[1],
1108 1109 1110 1111 1112
                      guolv: false,
                      choose: false,
                    });
                    setGl(false);
                    setCho(false);
1113
                  }
1114
                  setCheckboxAllID1(!!id[1]);
1115
                  setPopeleShape('树形模态');
1116
                } else {
1117
                  setCheckboxAll1(false);
1118
                  setCheckboxAllID1(!!id[1]);
1119 1120
                  setHide(true);
                  setFlag(false);
1121
                  let aa = pepole[0].split('+');
1122
                  form.setFieldsValue({
1123
                    All1: false,
1124
                    PeShape: '下拉框',
1125
                    AllID1: !!id[1],
1126
                    Config: aa[0],
1127
                  });
1128
                  if (res[0].data.root.Config.indexOf('.n') !== -1) {
1129 1130
                    form.setFieldsValue({ choose: true });
                    setCho(true);
1131 1132 1133
                  } else {
                    form.setFieldsValue({ choose: false });
                    setCho(false);
1134 1135
                  }
                  setPopeleShape('下拉框');
1136
                }
1137

1138
                break;
1139
            }
1140
            if (res[0].data.root.Shape == '可预览图片') {
1141
              setView(true);
1142
            } else if (res[0].data.root.Shape == '图片') {
1143
              setView(false);
1144
            } else if (res[0].data.root.Shape == '可预览附件') {
1145
              setPreView(true);
1146
            } else if (res[0].data.root.Shape == '附件') {
1147
              setPreView(false);
1148
            } else if (res[0].data.root.Shape == '值选择器') {
1149
              setRadiostyle(0);
1150 1151 1152 1153

              setCho(false);
              form.setFieldsValue({ style: 0, choose: false });
            } else if (res[0].data.root.Shape == '值复选器') {
1154
              setRadiostyle(0);
1155 1156 1157

              setCho(true);
              form.setFieldsValue({ style: 0, choose: true });
1158 1159
            }

1160 1161 1162 1163 1164 1165 1166 1167 1168 1169
            if (res[0].data.root.Shape == '可预览图片') {
              setShape('图片');
            } else if (res[0].data.root.Shape == '可预览附件') {
              setShape('附件');
            } else if (res[0].data.root.Shape == '平铺值选择器') {
              setShape('值选择器');
            } else if (res[0].data.root.Shape == '值复选器') {
              setShape('值选择器');
            } else {
              setShape(res[0].data.root.Shape);
1170
            }
1171 1172 1173
            if (!res[0].data.root.Shape) {
              console.log(1111);
              if (res[0].data.root.StoreType == 'datetime') {
1174
                setShape('日期时间');
1175 1176 1177 1178 1179 1180
              } else if (
                res[0].data.root.StoreType == 'int' ||
                res[0].data.root.StoreType == 'float' ||
                res[0].data.root.StoreType == 'bigint' ||
                (res[0].data.root.StoreType == 'int') == 'decimal'
              ) {
1181
                setShape('数值');
1182 1183
              } else {
                console.log(1111122222);
1184 1185 1186
                setShape('文本');
              }
            }
1187
            setPramData({ ...res[0].data.root, coordinates, must, picture });
1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204
            // if (
            //   res[0].data.root.Shape == '多行文本' ||
            //   res[0].data.root.Shape == '附件' ||
            //   res[0].data.root.Shape == '可预览附件' ||
            //   res[0].data.root.Shape == '图片' ||
            //   res[0].data.root.Shape == '可预览图片' ||
            //   res[0].data.root.Shape == '录音' ||
            //   res[0].data.root.Shape == '视频'
            // ) {
            //   form.setFieldsValue({ RowSpan: 6 });
            // } else {
            //   if (res[0].data.root.RowSpan !== 0) {
            //     form.setFieldsValue({ RowSpan: res[0].data.root.RowSpan });
            //   } else {
            //     form.setFieldsValue({ RowSpan: 1 });
            //   }
            // }
1205
            // 清空表单数据
1206
            let index = res[2].data.root.find(item => item.Name == res[0].data.root.ExceptionEvent);
1207
            console.log(index);
1208
            // getFieldData(index.TableName);
1209
          }
1210 1211 1212
        });
      }
    } else {
1213 1214 1215
      setPopeleShape('');
      setGl('');
      setCse('');
1216 1217
      setPramData([]);
      form.resetFields();
1218
      formAdd.resetFields();
1219
      setChee('');
1220
      setCheestyle('');
1221
      setRadio('');
1222
      setRadiostyle('');
1223 1224
      setRadio1('');
      setRadio3('');
1225 1226
      setPep('');
      setCho('');
1227
      setSite('');
1228 1229 1230
      setCheckboxAll1('');
      setCheckboxAllID1('');
      setFlag(false);
1231
      setPopeleShape('下拉框');
1232 1233
      setHide(true);
      setSynchronization(false);
1234
    }
皮倩雯's avatar
皮倩雯 committed
1235
  }, [isVisible]);
1236

1237 1238 1239 1240 1241 1242 1243 1244 1245
  // 获取关联表单形态字段映射下拉框数据
  const getMapFelidValue = e => {
    console.log(e);
    reloadTableFields({
      tableName: e,
    }).then(res => {
      if (res.msg === 'Ok') {
        // 编辑时过滤下l拉框初始数据
        setMapFeildValue(res.data.root);
1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256
        let data = [];
        let list = {};
        let datalist = [];
        list.ID = 0;
        list.name = e;
        res.data.root.map(i => {
          datalist.push(i.name);
        });
        list.children = datalist;
        data.push(list);
        setStandbookData(data);
1257 1258 1259 1260
      }
    });
  };

1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272
  const getStandData = () => {
    let data = [];
    let list = {};
    let datalist = [];
    datalist = [...keepTree];
    list.ID = 0;
    list.name = formObj1;
    list.children = datalist;
    data.push(list);
    setStandFiledData(data);
  };

1273
  const seach = e => {
1274 1275 1276
    let rueslt = keepStandingBook.find(i => i.name == e);
    getMapFelidValue(rueslt.tableName);
    formAdd.resetFields();
1277
    form.setFieldsValue({ workOrder: undefined, eventOrder: undefined });
1278
  };
1279

皮倩雯's avatar
皮倩雯 committed
1280 1281 1282
  const handleChange = value => {
    form.setFieldsValue({ schemename: value });
  };
1283

皮倩雯's avatar
皮倩雯 committed
1284
  const onOK = prop => {
1285
    console.log(prop, 'prop');
皮倩雯's avatar
皮倩雯 committed
1286 1287 1288 1289 1290 1291
    setVisible(false);
    if (type === 'rule') {
      form.setFieldsValue({ ValidationRule: prop });
    } else {
      setCheckedList(prop.checkedList);
      setCharacterValue(prop.str);
1292
    }
皮倩雯's avatar
皮倩雯 committed
1293
  };
1294
  const add1 = aa => {
皮倩雯's avatar
皮倩雯 committed
1295
    let obj = form.getFieldsValue();
1296 1297
    let data = { numerical: '', rule: [] };
    console.log(obj.ValidationRule, 'ValidationRule');
皮倩雯's avatar
皮倩雯 committed
1298 1299
    if (obj.ValidationRule) {
      let arr = obj.ValidationRule.split(',');
1300 1301 1302 1303 1304 1305 1306 1307
      arr.forEach(item => {
        let value;
        if (item.indexOf('maxLength') !== -1) {
          value = 'maxLength';
        } else {
          value = item;
        }
        switch (value) {
皮倩雯's avatar
皮倩雯 committed
1308 1309 1310 1311 1312 1313 1314 1315 1316
          case 'required':
            data.rule.push(item);
            break;
          case 'emphasis':
            data.rule.push(item);
            break;
          case 'sensitive':
            data.rule.push(item);
            break;
1317 1318 1319
          case 'maxLength':
            data.rule.push(item);
            break;
皮倩雯's avatar
皮倩雯 committed
1320 1321
          default:
            data.numerical = item;
1322
        }
皮倩雯's avatar
皮倩雯 committed
1323 1324 1325
      });
    } else {
      data = { rule: [], numerical: '' };
1326
    }
1327
    setType(aa);
皮倩雯's avatar
皮倩雯 committed
1328 1329 1330
    setFormObj(data);
    setVisible(true);
  };
1331

皮倩雯's avatar
皮倩雯 committed
1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342
  const handleEvent = (value, e) => {
    let data = { ...pramData };
    data.ExceptionEvent = e.name;
    if (e.tablename) {
      getFieldData(e.tablename);
      setPramData(data);
    } else {
      setIsShow(false);
      setFiled({});
      setCharacterValue('');
      setCheckedList([]);
1343
    }
皮倩雯's avatar
皮倩雯 committed
1344 1345 1346 1347
  };
  const getFieldData = value => {
    LoadEventFields({ eventTableName: value, distinctFields: '' }).then(res => {
      if (res.msg === 'Ok') {
1348
        console.log(res.data.root);
皮倩雯's avatar
皮倩雯 committed
1349 1350 1351 1352 1353
        setFiled(formateArrDataA(res.data.root, 'group'));
        setIsShow(true);
      }
    });
  };
1354

皮倩雯's avatar
皮倩雯 committed
1355 1356 1357 1358
  const formateArrDataA = (initialArr, name) => {
    // 判定传参是否符合规则
    if (!(initialArr instanceof Array)) {
      return '请传入正确格式的数组';
1359
    }
皮倩雯's avatar
皮倩雯 committed
1360 1361
    if (!name) {
      return '请传入对象属性';
1362
    }
1363
    // 先获取一下这个数组中有多少个"name"
皮倩雯's avatar
皮倩雯 committed
1364 1365 1366 1367 1368
    let nameArr = [];
    for (let i in initialArr) {
      if (nameArr.indexOf(initialArr[i][`${name}`]) === -1) {
        nameArr.push(initialArr[i][`${name}`]);
      }
1369
    }
1370
    // 新建一个包含多个list的结果对象
皮倩雯's avatar
皮倩雯 committed
1371 1372 1373 1374 1375 1376 1377 1378
    let tempObj = {};
    // 根据不同的"name"生成多个数组
    for (let k in nameArr) {
      for (let j in initialArr) {
        if (initialArr[j][`${name}`] == nameArr[k]) {
          // 每次外循环时新建一个对应"name"的数组, 内循环时当前数组不变
          tempObj[nameArr[k]] = tempObj[nameArr[k]] || [];
          tempObj[nameArr[k]].push(initialArr[j]);
1379
        }
皮倩雯's avatar
皮倩雯 committed
1380
      }
1381
    }
皮倩雯's avatar
皮倩雯 committed
1382 1383 1384 1385 1386 1387
    for (let key in tempObj) {
      let arr = [];
      tempObj[key].map(item => {
        tempObj[key] = arr;
        arr.push(item.fieldName);
      });
1388
    }
皮倩雯's avatar
皮倩雯 committed
1389 1390 1391
    return tempObj;
  };
  const handleCharacteristics = value => {
1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405
    if (
      value == '日期' ||
      value == '日期时间' ||
      value == '日期月份' ||
      value == '日期年份' ||
      value == '日期周' ||
      value == '时分秒'
    ) {
      console.log(123);
      form.setFieldsValue({ Config: '默认为当前时间' });
      setTimeData('默认为当前时间');
    } else {
      form.setFieldsValue({
        Config: '',
1406
        guolv: '',
1407 1408 1409 1410 1411
        ConfigName: '',
        tableName: '',
        fieldName: '',
        filterName: '',
        filterValue: '',
1412
        standingBook: undefined,
1413
        check: 0,
1414
        style: 0,
1415 1416 1417 1418 1419 1420 1421
        AllID: '0',
        All: '0',
        AllID1: '',
        All1: '',
        ShowConfig: '',
        pepole: '',
        choose: '',
1422 1423 1424 1425
        PeShape: '',
        Association: '',
        farter: '',
        farterData: '',
1426 1427
        workOrder: undefined,
        eventOrder: undefined,
1428
        configName: '',
1429 1430
      });
    }
1431
    formAdd.resetFields();
1432
    setVisibleChecked(true);
1433 1434 1435 1436
    setView(true);
    setPreView(true);
    setViewMuise(true);
    setPreViewVideo(true);
1437 1438
    setCse('');
    setPopeleShape('');
1439
    setRadio(0);
1440
    setRadiostyle(0);
1441 1442
    setRadio3('0');
    setRadio1('0');
1443
    setGl('');
1444 1445
    setPep('');
    setCho('');
1446
    setSite('');
1447 1448 1449
    setCheckboxAll1('');
    setCheckboxAllID1('');
    setFlag(false);
1450
    setPopeleShape('下拉框');
1451
    setHide(true);
1452 1453
    setFieldshineChecked(false);
    formAdd.resetFields();
1454
    console.log(value);
1455 1456 1457 1458 1459 1460 1461 1462 1463 1464
    if (value == '文本') {
      setDetail('输入内容将显示在前端输入框提示信息中');
    } else if (value == '多行文本') {
      setDetail('输入内容将显示在前端输入框提示信息中');
    } else if (value == '数值') {
      setDetail('输入内容将显示在前端输入框提示信息中');
    } else if (value == '设备二维码') {
      setDetail('输入内容将显示在前端输入框提示信息中');
    } else if (value == '选择器') {
      setDetail('数据字典名称');
1465
    } else if (value == '值选择器' || value == '值复选器') {
1466 1467 1468 1469 1470 1471 1472 1473 1474
      setDetail('用英文逗号分隔自定义的值,可设置初始值');
    } else if (value == '可编辑值选择器') {
      setDetail('用英文逗号分隔自定义的值,可编辑,可设置初始值');
    } else if (value == '平铺值选择器') {
      setDetail('用英文逗号分隔自定义的值,勾选,可设置初始值值后加.n可调整为复选');
    } else {
      setDetail('');
    }

1475 1476
    if (
      value == '多行文本' ||
1477
      value == '富文本' ||
1478 1479 1480 1481 1482
      value == '附件' ||
      value == '可预览附件' ||
      value == '图片' ||
      value == '可预览图片' ||
      value == '录音' ||
1483
      value == '视频' ||
1484
      value == '关联表单'
1485 1486 1487 1488 1489 1490 1491 1492
    ) {
      form.setFieldsValue({ RowSpan: 6 });
    } else {
      if (pramData.RowSpan) {
        form.setFieldsValue({ RowSpan: pramData.RowSpan });
      }
      form.setFieldsValue({ RowSpan: 1 });
    }
皮倩雯's avatar
皮倩雯 committed
1493 1494 1495 1496 1497 1498 1499 1500
    let data = { ...pramData };
    setShape(value);
    data.must = false;
    data.coordinates = false;
    data.picture = false;
    data.Preset = '';
    setPramData(data);
    form.setFieldsValue({ ValidationRule: '' });
1501 1502 1503
    // if (value.indexOf('日期') != -1 || value === '时分秒') {
    //   form.setFieldsValue({ Config: undefined });
    // }
皮倩雯's avatar
皮倩雯 committed
1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545
  };
  const onCharacterValue = e => {
    setCharacterValue(e.target.value);
  };
  const onChangeReady = (e, str) => {
    let data = { ...pramData };
    switch (str) {
      case 'ReadOnly':
        data.ReadOnly = e.target.checked;
        break;
      case 'EditableLater':
        data.EditableLater = e.target.checked;
        break;
      case 'must':
        data.must = e.target.checked;
        break;
      case 'picture':
        data.picture = e.target.checked;
        break;
      case 'coordinates':
        data.coordinates = e.target.checked;
        break;
    }
    setPramData(data);
  };
  const handleInput = (e, str) => {
    let data = { ...pramData };
    switch (str) {
      case 'Unit':
        data.Unit = e.target.value;
        break;
      case 'RowSpan':
        data.RowSpan = e.target.value;
        break;
      case 'Preset':
        data.Preset = e.target.value;
        break;
      case 'ExceptionValue':
        data.ExceptionValue = e.target.value;
        break;
      default:
        break;
1546
    }
皮倩雯's avatar
皮倩雯 committed
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566
    setPramData(data);
  };
  const handleSeparator = value => {
    let data = { ...pramData };
    switch (value) {
      case '6':
        data.Preset = '是';
        form.setFieldsValue({ Config: '是,否' });
        break;
      case '7':
        data.Preset = '否';
        form.setFieldsValue({ Config: '是,否' });
        break;
      case '8':
        data.Preset = '否';
        form.setFieldsValue({ Config: '否,是' });
        break;
    }
    setPramData(data);
  };
1567 1568 1569

  const mapTree = org => {
    const haveChildren = Array.isArray(org.children) && org.children.length > 0;
1570
    if (org.storeType == 'datetime') {
1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587
      return {
        title: (
          <span className={styles.titleText}>
            {org.children ? (
              <UnorderedListOutlined style={{ color: '#1890FF' }} />
            ) : (
              <img src={Things} style={{ height: '14px' }} alt="" />
            )}
            <span style={{ marginLeft: '5px' }}>{org.name}</span>
          </span>
        ),
        key: org.ID,
        // 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
        children: haveChildren ? org.children.map(i => mapTree(i)) : [],
        org,
      };
    }
1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603
    return {
      title: (
        <span className={styles.titleText}>
          {org.children ? (
            <UnorderedListOutlined style={{ color: '#1890FF' }} />
          ) : (
            <FontColorsOutlined style={{ color: '#1890FF' }} />
          )}
          <span style={{ marginLeft: '5px' }}>{org.name}</span>
        </span>
      ),
      key: org.ID,
      // 判断它是否存在子集,若果存在就进行再次进行遍历操作,知道不存在子集便对其他的元素进行操作
      children: haveChildren ? org.children.map(i => mapTree(i)) : [],
      org,
    };
1604 1605
  };
  const onSelect = (i, e) => {
1606 1607
    console.log(i);
    console.log(e);
1608
    setMapFeildValue([]);
1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630
    if (e.node.org.storeType && e.node.org.storeType == 'datetime') {
      setCharacteristics1([
        {
          name: '时间类',
          ID: 3,
          children: ['日期时间', '日期', '日期月份', '日期年份', '日期周', '时分秒'],
        },
      ]);
    } else if (e.node.org.storeType && e.node.org.storeType != 'datetime') {
      setCharacteristics1([
        {
          name: '文本类',
          ID: 0,
          children: [
            '文本',
            '唯一值文本',
            '多行文本',
            '本人部门',
            '本人姓名',
            '数值',
            '地址',
            '设备二维码',
1631
            // '本人ID',
1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672
            '富文本',
            '编码',
          ],
        },
        {
          name: '选择器类',
          ID: 1,
          children: [
            '选择器',
            '搜索选择器',
            '值选择器',
            '可编辑值选择器',
            '站点选择器',
            '人员选择器',
            '城市选择器',
            '台账选择器',
            '业务选择器',
            '部门选择器',
          ],
        },
        {
          name: '附件类',
          ID: 2,
          children: ['附件', '图片', '录音', '视频'],
        },
        {
          name: '时间类',
          ID: 3,
          children: ['日期时间', '日期', '日期月份', '日期年份', '日期周', '时分秒'],
        },
        {
          name: '地图类',
          ID: 4,
          children: ['坐标控件', '设备选择', '区域控件', '路径控件', '位置坐标'],
        },
        {
          name: '高级控件',
          ID: 5,
          children: ['关联表单'],
        },
      ]);
1673
    }
1674
    if (e && !e.node.org.children) {
1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693
      setKeep(e);
      if (e.node) {
        setCurrentSelectOrg(e.node.org.ID);
      } else {
        setCurrentSelectOrg(e.ID);
      }
      if (e.node && keepTreeFirst.indexOf(e.node.org.name) != -1 && e.node.children.length > 0) {
        setShow('none');
      } else {
        setShow('block');
      }
      if (isType != '') {
        let req1 = getField({ fieldID: e.node.org.ID });
        let req2 = loadTableFields({ tableName: formObj1 });
        let req3 = LoadEventType({});
        let bb = [];
        valueData.map(i => {
          bb.push(i.ID.toString());
        });
1694 1695 1696
        console.log(valueData);
        console.log(bb);
        console.log(e.node.org.ID);
1697 1698 1699 1700 1701 1702
        if (bb.indexOf(e.node.org.ID) != -1) {
          let aa = valueData.find(i => i.ID == e.node.org.ID);
          Promise.all([req1, req2, req3]).then(res => {
            res[1].msg === 'Ok' && setFieldName(res[1].data.root);
            res[2].msg === 'Ok' && setEventList(res[2].data.root);
            if (res[0].msg === 'Ok') {
1703 1704 1705 1706 1707 1708 1709 1710 1711 1712
              console.log(aa);
              if (aa.Shape == '可预览图片') {
                setView(true);
              } else if (aa.Shape == '图片') {
                setView(false);
              } else if (aa.Shape == '可预览附件') {
                setPreView(true);
              } else if (aa.Shape == '附件') {
                setPreView(false);
              } else if (aa.Shape == '值选择器') {
1713 1714
                setRadiostyle(0);
                setCho(false);
1715 1716
                form.setFieldsValue({ style: 0, choose: false });
              } else if (aa.Shape == '值复选器') {
1717 1718
                setRadiostyle(0);
                setCho(true);
1719
                form.setFieldsValue({ style: 0, choose: true });
1720
              }
1721 1722

              if (aa.Shape == '可预览图片') {
1723
                setShape('图片');
1724 1725 1726 1727 1728 1729 1730
              } else if (aa.Shape == '可预览附件') {
                setShape('附件');
              } else if (aa.Shape == '平铺值选择器') {
                setShape('值选择器');
              } else if (aa.Shape == '值复选器') {
                setShape('值选择器');
              } else {
1731 1732
                setShape(aa.Shape);
              }
1733 1734 1735 1736
              console.log(aa);
              if (!aa.Shape) {
                console.log(1111);
                if (aa.StoreType == 'datetime') {
1737
                  setShape('日期时间');
1738 1739 1740 1741 1742 1743
                } else if (
                  aa.StoreType == 'int' ||
                  aa.StoreType == 'float' ||
                  aa.StoreType == 'bigint' ||
                  (aa.StoreType == 'int') == 'decimal'
                ) {
1744
                  setShape('数值');
1745 1746
                } else {
                  console.log(1111122222);
1747 1748 1749
                  setShape('文本');
                }
              }
1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766
              form.setFieldsValue({ ...aa });
              if (aa.ExceptionEventFields === '') {
                setCharacterValue('');
                setCheckedList([]);
                setIsShow(false);
              } else {
                setIsShow(true);
                setCharacterValue(aa.ExceptionEventFields);
                setCheckedList(aa.ExceptionEventFields.split(','));
              }
              if (aa.SyncEvent === 1) {
                form.setFieldsValue({ SyncEvent: true });
                setSynchronization(true);
              } else {
                form.setFieldsValue({ SyncEvent: false });
                setSynchronization(false);
              }
1767

1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786
              if (aa.Shape == '文本') {
                setDetail('输入内容将显示在前端输入框提示信息中');
              } else if (aa.Shape == '多行文本') {
                setDetail('输入内容将显示在前端输入框提示信息中');
              } else if (aa.Shape == '数值') {
                setDetail('输入内容将显示在前端输入框提示信息中');
              } else if (aa.Shape == '设备二维码') {
                setDetail('输入内容将显示在前端输入框提示信息中');
              } else if (aa.Shape == '选择器') {
                setDetail('数据字典名称');
              } else if (aa.Shape == '值选择器' || aa.Shape == '值复选器') {
                setDetail('用英文逗号分隔自定义的值,可设置初始值');
              } else if (aa.Shape == '可编辑值选择器') {
                setDetail('用英文逗号分隔自定义的值,可编辑,可设置初始值');
              } else if (aa.Shape == '平铺值选择器') {
                setDetail('用英文逗号分隔自定义的值,勾选,可设置初始值值后加.n可调整为复选');
              } else {
                setDetail('');
              }
1787 1788 1789 1790
              let coordinates = false;
              let picture = false;
              let must = false;

1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821
              switch (aa.Shape) {
                case '坐标控件':
                  aa.Config === '当前坐标' ? (coordinates = true) : (coordinates = false);
                  break;
                case '日期时间':
                case '日期':
                case '日期月份':
                case '日期年份':
                case '日期周':
                case '时分秒':
                  if (aa.Config === '默认为空') {
                    form.setFieldsValue({
                      Config: '默认为空',
                    });
                  } else if (aa.Config === '锁定为当前时间') {
                    form.setFieldsValue({
                      Config: '不可选择',
                    });
                  } else if (aa.Config === '默认为当前时间') {
                    form.setFieldsValue({
                      Config: '默认为当前时间',
                    });
                  } else if (aa.Config === '不超过当前时间') {
                    form.setFieldsValue({
                      Config: '不超过当前时间',
                    });
                  }
                  break;
                case '图片':
                case '可预览图片':
                  // aa.Config === '拍照相册' ? (picture = true) : (picture = false);
1822
                  aa.Config === '拍照相册' ? (picture = true) : (picture = false);
1823 1824 1825 1826
                  aa.ValidationRule === 'required' ? (must = true) : (must = false);
                  break;
                case '编码':
                  let code = aa.Config.split('.');
1827
                  form.setFieldsValue({
1828 1829
                    code: code[0] || '',
                    prefix: code[1] === 'undefined' ? '' : code[1],
1830
                  });
1831
                  break;
1832 1833
                case '本人部门':
                  let depart = aa.Config;
1834 1835
                  form.setFieldsValue({ AllID1: !!depart });
                  setCheckboxAllID1(!!depart);
1836 1837 1838
                  break;
                case '本人姓名':
                  let name = aa.Config;
1839 1840
                  form.setFieldsValue({ AllID1: !!name });
                  setCheckboxAllID1(!!name);
1841
                  break;
1842 1843
                case '搜索选择器':
                  let data = aa.Config.split('.');
1844
                  form.setFieldsValue({
1845
                    Config: data[0] || '',
1846
                  });
1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859
                  if (aa.Config.endsWith('.n')) {
                    form.setFieldsValue({
                      check: 1,
                    });
                    setRadio(1);
                  } else {
                    form.setFieldsValue({
                      check: 0,
                    });
                    setRadio(0);
                  }
                  break;
                case '平铺值选择器':
1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879
                  let dataa = aa.Config.split('.');
                  form.setFieldsValue({
                    Config: dataa[0] || '',
                  });
                  if (aa.Config.endsWith('.n')) {
                    form.setFieldsValue({
                      choose: true,
                    });
                    setCho(true);
                  } else {
                    form.setFieldsValue({
                      choose: false,
                    });
                    setCho(false);
                  }
                  form.setFieldsValue({
                    style: 1,
                  });
                  setRadiostyle(1);
                  break;
1880 1881
                case '唯一值文本':
                  let arr = aa.Config.split('.');
1882
                  form.setFieldsValue({
1883 1884
                    tableName: arr[0] || '',
                    fieldName: arr[1] || '',
1885
                  });
1886 1887 1888
                  break;
                case '业务选择器':
                  let list = aa.Config.split('.');
1889
                  form.setFieldsValue({
1890 1891
                    tableName: list[0] || '',
                    fieldName: list[1] || '',
1892
                  });
1893
                  if (aa.Config.endsWith('.n')) {
1894
                    form.setFieldsValue({
1895 1896 1897 1898 1899 1900
                      check: 1,
                    });
                    setRadio(1);
                  } else {
                    form.setFieldsValue({
                      check: 0,
1901
                    });
1902 1903 1904 1905
                    setRadio(0);
                  }
                  break;
                case '站点选择器':
1906 1907
                  let siteId = aa.Config.split('+');
                  let site = siteId[0].split('.');
1908
                  if (site[0] == '本人') {
1909 1910 1911 1912
                    if (aa.Config.indexOf('.n') !== -1) {
                      form.setFieldsValue({
                        pepole: true,
                        choose: true,
1913
                        AllID1: !!siteId[1],
1914
                      });
1915 1916
                      setPep(true);
                      setCho(true);
1917
                    } else {
1918 1919 1920
                      form.setFieldsValue({
                        pepole: true,
                        choose: false,
1921
                        AllID1: !!siteId[1],
1922
                      });
1923 1924 1925
                      setPep(true);
                      setCho(false);
                    }
1926 1927 1928 1929 1930
                  } else if (site[0] == '全部') {
                    if (aa.Config.indexOf('.n') !== -1) {
                      form.setFieldsValue({
                        pepole: false,
                        choose: true,
1931
                        AllID1: !!siteId[1],
1932 1933 1934 1935 1936 1937 1938
                      });
                      setPep(false);
                      setCho(true);
                    } else {
                      form.setFieldsValue({
                        pepole: false,
                        choose: false,
1939
                        AllID1: !!siteId[1],
1940 1941 1942 1943
                      });
                      setPep(false);
                      setCho(false);
                    }
1944
                  }
1945
                  setCheckboxAllID1(!!siteId[1]);
1946 1947
                  break;
                case '部门选择器':
1948 1949
                  let department = aa.Config.split('+');
                  if (department[0] == '.n') {
1950
                    form.setFieldsValue({ choose: true, AllID1: !!department[1] });
1951
                    setCho(true);
1952
                  } else {
1953
                    form.setFieldsValue({ choose: false, AllID1: !!department[1] });
1954
                    setCho(false);
1955
                  }
1956
                  setCheckboxAllID1(!!department[1]);
1957
                  break;
1958 1959
                case '关联表单':
                  let data11 = JSON.parse(aa.Config);
1960 1961
                  let rueslt = keepStandingBook.find(i => i.name == data11.台账名称);
                  console.log(rueslt.tableName);
1962 1963 1964 1965
                  if(!rueslt1) {
                    notification.error({
                      message: '提示',
                      duration: 3,
1966
                      description: `没有匹配到台账名【${book[0]}】,请检查配置!`,
1967 1968 1969 1970
                    });
                  } else {
                    getMapFelidValue(rueslt1?.tableName);
                  }
1971 1972
                  form.setFieldsValue({
                    standingBook: data11.台账名称,
1973 1974
                    workOrder: data11.映射字段[data11.映射字段.length - 1].fromField,
                    eventOrder: data11.映射字段[data11.映射字段.length - 1].toField,
1975 1976 1977
                    configName: data11.控制规则,
                  });
                  let gg = [...data11.映射字段];
1978 1979 1980 1981 1982 1983 1984
                  let a11 = [];
                  gg.length > 0 &&
                    gg.map((i, j) => {
                      if (j !== gg.length - 1) {
                        a11.push(i);
                      }
                    });
1985 1986 1987
                  formAdd.setFieldsValue({ parmars: a11 });
                  setVisibleChecked(data11.默认显示);
                  break;
1988
                case '台账选择器':
1989
                  console.log(aa.Config);
1990
                  let book = aa.Config.split('.');
1991
                  let rueslt1 = keepStandingBook.find(j => j.name == book[0]);
1992 1993 1994 1995
                  if(!rueslt1) {
                    notification.error({
                      message: '提示',
                      duration: 3,
1996
                      description: `没有匹配到台账名【${book[0]}】,请检查配置!`,
1997 1998 1999 2000
                    });
                  } else {
                    getMapFelidValue(rueslt1?.tableName);
                  }
2001

2002
                  let ad = book[1].split('?');
2003 2004 2005 2006 2007
                  if (ad[0].indexOf('[') !== -1) {
                    let filedname = JSON.parse(ad[0]);
                    form.setFieldsValue({
                      standingBook: book[0] || '',
                      fieldName: ad[0] || '',
2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
                      workOrder:
                        filedname.fieldshine != undefined
                          ? filedname.fieldshine[filedname.fieldshine.length - 1].fromField
                          : filedname[filedname.length - 1].fromField,
                      eventOrder:
                        filedname.fieldshine != undefined
                          ? filedname.fieldshine[filedname.fieldshine.length - 1].toField
                          : filedname[filedname.length - 1].toField,
                      siteJurisdiction:
                        filedname.siteJurisdiction != undefined
                          ? filedname.siteJurisdiction
                          : false,
2020 2021
                      fieldshine: true,
                    });
2022 2023 2024
                    setSite(
                      filedname.siteJurisdiction != undefined ? filedname.siteJurisdiction : false,
                    );
2025
                    // 映射字段
2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051
                    if (filedname.fieldshine != undefined) {
                      if (Array.isArray(filedname.fieldshine)) {
                        let g = [...filedname.fieldshine];
                        let a1 = [];
                        g.length > 0 &&
                          g.map((i, j) => {
                            if (j !== g.length - 1) {
                              a1.push(i);
                            }
                          });
                        formAdd.setFieldsValue({ parmars: a1 });
                        setFieldshineChecked(true);
                      }
                    } else {
                      if (Array.isArray(filedname)) {
                        let g = [...filedname];
                        let a1 = [];
                        g.length > 0 &&
                          g.map((i, j) => {
                            if (j !== g.length - 1) {
                              a1.push(i);
                            }
                          });
                        formAdd.setFieldsValue({ parmars: a1 });
                        setFieldshineChecked(true);
                      }
2052 2053 2054 2055 2056 2057 2058
                    }
                  } else {
                    form.setFieldsValue({
                      standingBook: book[0] || '',
                      fieldName: ad[0] || '',
                      fieldshine: false,
                    });
2059

2060 2061
                    setFieldshineChecked(false);
                  }
2062 2063 2064 2065 2066 2067 2068 2069
                  let book1 = aa.Config.split('?');
                  if (book1[1]) {
                    form.setFieldsValue({
                      filterName: book1[1],
                    });
                  }
                  if (book1[0].endsWith('.n')) {
                    form.setFieldsValue({
2070
                      check: true,
2071
                    });
2072
                    setCho(true);
2073
                  } else {
2074
                    form.setFieldsValue({
2075
                      check: false,
2076
                    });
2077
                    setCho(false);
2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094
                  }
                  break;
                case '选择器':
                  let sele = aa.Config.split('.');
                  if (sele[1] && sele[1] != 'n') {
                    form.setFieldsValue({
                      Association: true,
                      farter: sele[0],
                      farterData: sele[1],
                    });
                    setCse(true);
                  } else {
                    form.setFieldsValue({
                      Association: false,
                      Config: sele[0],
                    });
                    setCse(false);
2095 2096
                  }
                  if (aa.Config.endsWith('.n')) {
2097
                    form.setFieldsValue({ check: true });
2098
                    setCho(true);
2099
                  } else {
2100
                    form.setFieldsValue({ check: false });
2101
                    setCho(false);
2102
                  }
2103 2104 2105
                  break;
                case '人员选择器':
                  let pepole = aa.Config.split('.');
2106 2107
                  console.log(pepole);
                  let id = aa.Config.split('+');
2108 2109 2110 2111 2112
                  form.setFieldsValue({ ShowConfig: aa.Config });
                  if (pepole[0] == '全部') {
                    setHide(false);
                    setFlag(true);
                    setCheckboxAll1(true);
2113 2114
                    if (pepole[1] && pepole[1] != 'n') {
                      let config = pepole[1].split('+');
2115
                      form.setFieldsValue({
2116
                        PeShape: '分组模态',
2117
                        All1: true,
2118
                        AllID1: !!id[1],
2119
                        ConfigName: config[0] !== 'n' ? config[0] : '',
2120 2121 2122
                      });
                    } else {
                      form.setFieldsValue({
2123
                        PeShape: '分组模态',
2124
                        All1: true,
2125
                        AllID1: !!id[1],
2126
                        ConfigName: '',
2127
                      });
2128
                    }
2129
                    setCheckboxAllID1(!!id[1]);
2130
                    if (aa.Config.indexOf('.n') !== -1) {
2131 2132 2133 2134
                      form.setFieldsValue({ choose: true });
                      setCho(true);
                    } else {
                      form.setFieldsValue({ choose: false });
2135
                      setCho(false);
2136
                    }
2137 2138 2139 2140 2141 2142
                    setPopeleShape('分组模态');
                  } else if (pepole[0] == 'tree') {
                    setCheckboxAll1(false);
                    setHide(true);
                    setFlag(1);
                    let tree = pepole[1].split('|');
2143
                    let treeId = tree[1].split('+');
2144
                    if (tree[0] == '多选') {
2145
                      if (treeId[0] == '站点') {
2146 2147 2148
                        form.setFieldsValue({
                          PeShape: '树形模态',
                          All1: true,
2149
                          AllID1: !!id[1],
2150 2151 2152 2153 2154 2155 2156 2157 2158
                          guolv: true,
                          choose: true,
                        });
                        setGl(true);
                        setCho(true);
                      } else {
                        form.setFieldsValue({
                          PeShape: '树形模态',
                          All1: true,
2159
                          AllID1: !!id[1],
2160 2161 2162 2163 2164 2165
                          guolv: false,
                          choose: true,
                        });
                        setGl(false);
                        setCho(true);
                      }
2166
                    } else if (treeId[0] == '站点') {
2167 2168 2169
                      form.setFieldsValue({
                        PeShape: '树形模态',
                        All1: true,
2170
                        AllID1: !!id[1],
2171 2172 2173 2174 2175
                        guolv: true,
                        choose: false,
                      });
                      setGl(true);
                      setCho(false);
2176
                    } else {
2177 2178 2179
                      form.setFieldsValue({
                        PeShape: '树形模态',
                        All1: true,
2180
                        AllID1: !!id[1],
2181 2182 2183 2184 2185
                        guolv: false,
                        choose: false,
                      });
                      setGl(false);
                      setCho(false);
2186
                    }
2187
                    setCheckboxAllID1(!!id[1]);
2188
                    setPopeleShape('树形模态');
2189
                  } else {
2190
                    setCheckboxAll1(false);
2191
                    setCheckboxAllID1(!!id[1]);
2192 2193
                    setHide(true);
                    setFlag(false);
2194
                    let aaa = pepole[0].split('+');
2195
                    form.setFieldsValue({
2196 2197
                      All1: false,
                      PeShape: '下拉框',
2198
                      AllID1: !!id[1],
2199
                      Config: aaa[0],
2200
                    });
2201
                    if (aa.Config.indexOf('.n') !== -1) {
2202 2203
                      form.setFieldsValue({ choose: true });
                      setCho(true);
2204
                    } else {
2205 2206
                      form.setFieldsValue({ choose: false });
                      setCho(false);
2207
                    }
2208
                    setPopeleShape('下拉框');
2209
                  }
2210

2211 2212 2213 2214 2215
                  break;
              }
              setValue1();
              setPramData({ ...aa, coordinates, must, picture });
              let index = res[2].data.root.find(item => item.Name == aa.ExceptionEvent);
2216

2217 2218 2219 2220 2221 2222 2223 2224 2225
              getFieldData(index.TableName);
            }
          });
        } else {
          Promise.all([req1, req2, req3]).then(res => {
            res[1].msg === 'Ok' && setFieldName(res[1].data.root);
            res[2].msg === 'Ok' && setEventList(res[2].data.root);
            if (res[0].msg === 'Ok') {
              console.log(res[0].data.root.Shape);
2226 2227 2228 2229 2230 2231 2232 2233 2234
              if (res[0].data.root.Shape == '可预览图片') {
                setView(true);
              } else if (res[0].data.root.Shape == '图片') {
                setView(false);
              } else if (res[0].data.root.Shape == '可预览附件') {
                setPreView(true);
              } else if (res[0].data.root.Shape == '附件') {
                setPreView(false);
              } else if (res[0].data.root.Shape == '值选择器') {
2235
                setRadiostyle(0);
2236 2237 2238 2239

                setCho(false);
                form.setFieldsValue({ check: 0, style: 0, choose: false });
              } else if (res[0].data.root.Shape == '值复选器') {
2240
                setRadiostyle(0);
2241 2242 2243

                setCho(true);
                form.setFieldsValue({ check: 1, style: 0, choose: true });
2244
              }
2245
              if (res[0].data.root.Shape == '可预览图片') {
2246
                setShape('图片');
2247
              } else if (res[0].data.root.Shape == '可预览附件') {
2248
                setShape('附件');
2249
              } else if (res[0].data.root.Shape == '平铺值选择器') {
2250
                setShape('值选择器');
2251
              } else if (res[0].data.root.Shape == '值复选器') {
2252
                setShape('值选择器');
2253 2254
              } else {
                setShape(res[0].data.root.Shape);
2255
              }
2256 2257 2258 2259
              console.log(res[0].data.root);
              if (!res[0].data.root.Shape) {
                console.log(1111);
                if (res[0].data.root.StoreType == 'datetime') {
2260
                  setShape('日期时间');
2261 2262 2263 2264 2265 2266
                } else if (
                  res[0].data.root.StoreType == 'int' ||
                  res[0].data.root.StoreType == 'float' ||
                  res[0].data.root.StoreType == 'bigint' ||
                  (res[0].data.root.StoreType == 'int') == 'decimal'
                ) {
2267
                  setShape('数值');
2268
                } else {
2269 2270 2271
                  setShape('文本');
                }
              }
2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288
              form.setFieldsValue({ ...res[0].data.root });
              if (res[0].data.root.ExceptionEventFields === '') {
                setCharacterValue('');
                setCheckedList([]);
                setIsShow(false);
              } else {
                setIsShow(true);
                setCharacterValue(res[0].data.root.ExceptionEventFields);
                setCheckedList(res[0].data.root.ExceptionEventFields.split(','));
              }
              if (res[0].data.root.SyncEvent === 1) {
                form.setFieldsValue({ SyncEvent: true });
                setSynchronization(true);
              } else {
                form.setFieldsValue({ SyncEvent: false });
                setSynchronization(false);
              }
2289 2290 2291 2292

              let coordinates = false;
              let picture = false;
              let must = false;
2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325
              switch (res[0].data.root.Shape) {
                case '坐标控件':
                  res[0].data.root.Config === '当前坐标'
                    ? (coordinates = true)
                    : (coordinates = false);
                  break;
                case '日期时间':
                case '日期':
                case '日期月份':
                case '日期年份':
                case '日期周':
                case '时分秒':
                  if (res[0].data.root.Config === '默认为空') {
                    form.setFieldsValue({
                      Config: '默认为空',
                    });
                  } else if (res[0].data.root.Config === '锁定为当前时间') {
                    form.setFieldsValue({
                      Config: '不可选择',
                    });
                  } else if (res[0].data.root.Config === '默认为当前时间') {
                    form.setFieldsValue({
                      Config: '默认为当前时间',
                    });
                  } else if (res[0].data.root.Config === '不超过当前时间') {
                    form.setFieldsValue({
                      Config: '不超过当前时间',
                    });
                  }
                  break;
                case '图片':
                case '可预览图片':
                  // res[0].data.root.Config === '拍照相册' ? (picture = true) : (picture = false);
2326
                  res[0].data.root.Config === '拍照相册' ? (picture = true) : (picture = false);
2327 2328 2329 2330
                  res[0].data.root.ValidationRule === 'required' ? (must = true) : (must = false);
                  break;
                case '编码':
                  let code = res[0].data.root.Config.split('.');
2331
                  form.setFieldsValue({
2332 2333
                    code: code[0] || '',
                    prefix: code[1] === 'undefined' ? '' : code[1],
2334
                  });
2335
                  break;
2336 2337
                case '本人部门':
                  let depart = res[0].data.root.Config;
2338 2339
                  form.setFieldsValue({ AllID1: !!depart });
                  setCheckboxAllID1(!!depart);
2340 2341 2342
                  break;
                case '本人姓名':
                  let name = res[0].data.root.Config;
2343 2344
                  form.setFieldsValue({ AllID1: !!name });
                  setCheckboxAllID1(!!name);
2345
                  break;
2346 2347
                case '搜索选择器':
                  let data = res[0].data.root.Config.split('.');
2348
                  form.setFieldsValue({
2349
                    Config: data[0] || '',
2350
                  });
2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362
                  if (res[0].data.root.Config.endsWith('.n')) {
                    form.setFieldsValue({
                      check: 1,
                    });
                    setRadio(1);
                  } else {
                    form.setFieldsValue({
                      check: 0,
                    });
                    setRadio(0);
                  }
                  break;
2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383
                case '平铺值选择器':
                  let dataa = res[0].data.root.Config.split('.');
                  form.setFieldsValue({
                    Config: dataa[0] || '',
                  });
                  if (res[0].data.root.Config.endsWith('.n')) {
                    form.setFieldsValue({
                      choose: true,
                    });
                    setCho(true);
                  } else {
                    form.setFieldsValue({
                      choose: false,
                    });
                    setCho(false);
                  }
                  form.setFieldsValue({
                    style: 1,
                  });
                  setRadiostyle(1);
                  break;
2384 2385
                case '唯一值文本':
                  let arr = res[0].data.root.Config.split('.');
2386
                  form.setFieldsValue({
2387 2388
                    tableName: arr[0] || '',
                    fieldName: arr[1] || '',
2389
                  });
2390 2391
                  break;
                case '站点选择器':
2392 2393
                  let siteId = res[0].data.root.Config.split('+');
                  let site = siteId[0].split('.');
2394
                  if (site[0] == '本人') {
2395 2396 2397 2398
                    if (res[0].data.root.Config.indexOf('.n') !== -1) {
                      form.setFieldsValue({
                        pepole: true,
                        choose: true,
2399
                        AllID1: !!siteId[1],
2400
                      });
2401 2402 2403
                      setPep(true);
                      setCho(true);
                    } else {
2404 2405 2406
                      form.setFieldsValue({
                        pepole: true,
                        choose: false,
2407
                        AllID1: !!siteId[1],
2408
                      });
2409 2410 2411
                      setPep(true);
                      setCho(false);
                    }
2412 2413 2414 2415 2416
                  } else if (site[0] == '全部') {
                    if (res[0].data.root.Config.indexOf('.n') !== -1) {
                      form.setFieldsValue({
                        pepole: false,
                        choose: true,
2417
                        AllID1: !!siteId[1],
2418 2419 2420 2421 2422 2423 2424
                      });
                      setPep(false);
                      setCho(true);
                    } else {
                      form.setFieldsValue({
                        pepole: false,
                        choose: false,
2425
                        AllID1: !!siteId[1],
2426 2427 2428 2429
                      });
                      setPep(false);
                      setCho(false);
                    }
2430
                  }
2431
                  setCheckboxAllID1(!!siteId[1]);
2432 2433 2434
                  break;
                case '业务选择器':
                  let list = res[0].data.root.Config.split('.');
2435

2436
                  form.setFieldsValue({
2437 2438
                    tableName: list[0] || '',
                    fieldName: list[1] || '',
2439
                  });
2440
                  if (res[0].data.root.Config.endsWith('.n')) {
2441
                    form.setFieldsValue({
2442
                      check: 1,
2443
                    });
2444
                    setRadio(1);
2445 2446
                  } else {
                    form.setFieldsValue({
2447
                      check: 0,
2448
                    });
2449
                    setRadio(0);
2450
                  }
2451 2452
                  break;
                case '部门选择器':
2453 2454
                  let department = res[0].data.root.Config.split('+');
                  if (department[0] == '.n') {
2455
                    form.setFieldsValue({ choose: true, AllID1: !!department[1] });
2456
                    setCho(true);
2457
                  } else {
2458
                    form.setFieldsValue({ choose: false, AllID1: !!department[1] });
2459
                    setCho(false);
2460
                  }
2461
                  setCheckboxAllID1(!!department[1]);
2462
                  break;
2463 2464 2465

                case '关联表单':
                  let data11 = JSON.parse(res[0].data.root.Config);
2466 2467
                  let rueslt = keepStandingBook.find(i => i.name == data11.台账名称);
                  console.log(rueslt.tableName);
2468 2469 2470 2471
                  if(!rueslt1) {
                    notification.error({
                      message: '提示',
                      duration: 3,
2472
                      description: `没有匹配到台账名【${book[0]}】,请检查配置!`,
2473 2474 2475 2476
                    });
                  } else {
                    getMapFelidValue(rueslt1?.tableName);
                  }
2477 2478
                  form.setFieldsValue({
                    standingBook: data11.台账名称,
2479 2480
                    workOrder: data11.映射字段[data11.映射字段.length - 1].fromField,
                    eventOrder: data11.映射字段[data11.映射字段.length - 1].toField,
2481 2482 2483
                    configName: data11.控制规则,
                  });
                  let gg = [...data11.映射字段];
2484 2485 2486 2487 2488 2489 2490
                  let a11 = [];
                  gg.length > 0 &&
                    gg.map((i, j) => {
                      if (j !== gg.length - 1) {
                        a11.push(i);
                      }
                    });
2491 2492 2493
                  formAdd.setFieldsValue({ parmars: a11 });
                  setVisibleChecked(data11.默认显示);
                  break;
2494
                case '台账选择器':
2495
                  console.log(res[0].data.root.Config);
2496
                  let book = res[0].data.root.Config.split('.');
2497 2498
                  let rueslt1 = keepStandingBook.find(i => i.name == book[0]);
                  console.log(rueslt1.tableName);
2499 2500 2501 2502
                  if(!rueslt1) {
                    notification.error({
                      message: '提示',
                      duration: 3,
2503
                      description: `没有匹配到台账名【${book[0]}】,请检查配置!`,
2504 2505 2506 2507
                    });
                  } else {
                    getMapFelidValue(rueslt1?.tableName);
                  }
2508

2509
                  let ab = book[1].split('?');
2510
                  console.log(ab);
2511 2512 2513 2514 2515 2516
                  if (ab[0].indexOf('[') !== -1) {
                    let filedname = JSON.parse(ab[0]);
                    console.log(filedname);
                    form.setFieldsValue({
                      standingBook: book[0] || '',
                      fieldName: ab[0] || '',
2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528
                      workOrder:
                        filedname.fieldshine != undefined
                          ? filedname.fieldshine[filedname.fieldshine.length - 1].fromField
                          : filedname[filedname.length - 1].fromField,
                      eventOrder:
                        filedname.fieldshine != undefined
                          ? filedname.fieldshine[filedname.fieldshine.length - 1].toField
                          : filedname[filedname.length - 1].toField,
                      siteJurisdiction:
                        filedname.siteJurisdiction != undefined
                          ? filedname.siteJurisdiction
                          : false,
2529 2530
                      fieldshine: true,
                    });
2531 2532 2533
                    setSite(
                      filedname.siteJurisdiction != undefined ? filedname.siteJurisdiction : false,
                    );
2534
                    // 映射字段
2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560
                    if (filedname.fieldshine != undefined) {
                      if (Array.isArray(filedname.fieldshine)) {
                        let g = [...filedname.fieldshine];
                        let a1 = [];
                        g.length > 0 &&
                          g.map((i, j) => {
                            if (j !== g.length - 1) {
                              a1.push(i);
                            }
                          });
                        formAdd.setFieldsValue({ parmars: a1 });
                        setFieldshineChecked(true);
                      }
                    } else {
                      if (Array.isArray(filedname)) {
                        let g = [...filedname];
                        let a1 = [];
                        g.length > 0 &&
                          g.map((i, j) => {
                            if (j !== g.length - 1) {
                              a1.push(i);
                            }
                          });
                        formAdd.setFieldsValue({ parmars: a1 });
                        setFieldshineChecked(true);
                      }
2561 2562 2563 2564 2565 2566 2567
                    }
                  } else {
                    form.setFieldsValue({
                      standingBook: book[0] || '',
                      fieldName: ab[0] || '',
                      fieldshine: false,
                    });
2568

2569 2570 2571
                    setFieldshineChecked(false);
                  }

2572
                  let book1 = res[0].data.root.Config.split('?');
2573

2574
                  if (book1[1]) {
2575
                    form.setFieldsValue({
2576 2577 2578 2579 2580
                      filterName: book1[1],
                    });
                  }
                  if (book1[0].endsWith('.n')) {
                    form.setFieldsValue({
2581
                      check: true,
2582
                    });
2583
                    setCho(true);
2584 2585
                  } else {
                    form.setFieldsValue({
2586
                      check: false,
2587
                    });
2588
                    setCho(false);
2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603
                  }
                  break;
                case '选择器':
                  let sele = res[0].data.root.Config.split('.');
                  if (sele[1] && sele[1] != 'n') {
                    form.setFieldsValue({
                      Association: true,
                      farter: sele[0],
                      farterData: sele[1],
                    });
                    setCse(true);
                  } else {
                    form.setFieldsValue({
                      Association: false,
                      Config: sele[0],
2604
                    });
2605
                    setCse(false);
2606
                  }
2607 2608 2609
                  if (res[0].data.root.Config.endsWith('.n')) {
                    form.setFieldsValue({ choose: true });
                    setCho(true);
2610 2611 2612
                  } else {
                    form.setFieldsValue({ choose: false });
                    setCho(false);
2613
                  }
2614 2615 2616
                  break;
                case '人员选择器':
                  let pepole = res[0].data.root.Config.split('.');
2617
                  let id = res[0].data.root.Config.split('+');
2618 2619 2620 2621 2622
                  form.setFieldsValue({ ShowConfig: res[0].data.root.Config });
                  if (pepole[0] == '全部') {
                    setHide(false);
                    setFlag(true);
                    setCheckboxAll1(true);
2623 2624
                    if (pepole[1] && pepole[1] != 'n') {
                      let aa = pepole[1].split('+');
2625
                      form.setFieldsValue({
2626
                        PeShape: '分组模态',
2627
                        All1: true,
2628
                        AllID1: !!id[1],
2629
                        ConfigName: aa[0] !== 'n' ? aa[0] : '',
2630 2631 2632
                      });
                    } else {
                      form.setFieldsValue({
2633
                        PeShape: '分组模态',
2634
                        All1: true,
2635
                        AllID1: !!id[1],
2636
                        ConfigName: '',
2637
                      });
2638
                    }
2639
                    setCheckboxAllID1(!!id[1]);
2640
                    if (res[0].data.root.Config.indexOf('.n') !== -1) {
2641 2642 2643 2644
                      form.setFieldsValue({ choose: true });
                      setCho(true);
                    } else {
                      form.setFieldsValue({ choose: false });
2645
                      setCho(false);
2646
                    }
2647 2648 2649 2650 2651 2652
                    setPopeleShape('分组模态');
                  } else if (pepole[0] == 'tree') {
                    setCheckboxAll1(false);
                    setHide(true);
                    setFlag(1);
                    let tree = pepole[1].split('|');
2653
                    let treeId = tree[1].split('+');
2654
                    if (tree[0] == '多选') {
2655
                      if (treeId[0] == '站点') {
2656 2657 2658
                        form.setFieldsValue({
                          PeShape: '树形模态',
                          All1: true,
2659
                          AllID1: !!id[1],
2660 2661 2662 2663 2664 2665 2666 2667 2668
                          guolv: true,
                          choose: true,
                        });
                        setGl(true);
                        setCho(true);
                      } else {
                        form.setFieldsValue({
                          PeShape: '树形模态',
                          All1: true,
2669
                          AllID1: !!id[1],
2670 2671 2672 2673 2674 2675
                          guolv: false,
                          choose: true,
                        });
                        setGl(false);
                        setCho(true);
                      }
2676
                    } else if (treeId[0] == '站点') {
2677 2678 2679
                      form.setFieldsValue({
                        PeShape: '树形模态',
                        All1: true,
2680
                        AllID1: !!id[1],
2681 2682 2683 2684 2685
                        guolv: true,
                        choose: false,
                      });
                      setGl(true);
                      setCho(false);
2686
                    } else {
2687 2688 2689
                      form.setFieldsValue({
                        PeShape: '树形模态',
                        All1: true,
2690
                        AllID1: !!id[1],
2691 2692 2693 2694 2695
                        guolv: false,
                        choose: false,
                      });
                      setGl(false);
                      setCho(false);
2696
                    }
2697
                    setCheckboxAllID1(!!id[1]);
2698
                    setPopeleShape('树形模态');
2699
                  } else {
2700
                    setCheckboxAll1(false);
2701
                    setCheckboxAllID1(!!id[1]);
2702 2703
                    setHide(true);
                    setFlag(false);
2704
                    let aa = pepole[0].split('+');
2705 2706 2707
                    form.setFieldsValue({
                      All1: false,
                      PeShape: '下拉框',
2708
                      AllID1: !!id[1],
2709
                      Config: aa[0],
2710
                    });
2711
                    if (res[0].data.root.Config.indexOf('.n') !== -1) {
2712 2713 2714 2715 2716 2717 2718
                      form.setFieldsValue({ choose: true });
                      setCho(true);
                    } else {
                      form.setFieldsValue({ choose: false });
                      setCho(false);
                    }
                    setPopeleShape('下拉框');
2719
                  }
2720 2721 2722 2723
                  break;
              }
              setValue1();
              setPramData({ ...res[0].data.root, coordinates, must, picture });
2724 2725 2726 2727
              let index = res[2].data.root.find(
                item => item.Name == res[0].data.root.ExceptionEvent,
              );

2728
              getFieldData(index.TableName);
2729
            }
2730 2731
          });
        }
2732 2733
      }
    }
2734

2735
    // formAdd.validateFields().then(validate1 => {
2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784
    // if(validate1){
    form.validateFields().then(validate => {
      if (validate) {
        setLoading(true);
        let obj = form.getFieldsValue();
        let aa = '';
        if (synchronization == true) {
          aa = 1;
        } else {
          aa = 0;
        }
        console.log(obj);
        let data = [
          {
            Unit: obj.Unit || '',
            StoreType: pramData.StoreType,
            Group: pramData.Group || '',
            Shape,
            ExceptionEvent: pramData.ExceptionEvent || '',
            RowSpan: Number(obj.RowSpan) || 0,
            ColSpan: pramData.ColSpan || 0,
            ReadOnly: pramData.ReadOnly || false,
            EditableLater: pramData.EditableLater || false,
            ExceptionValue: pramData.ExceptionValue || '',
            Preset: pramData.Preset || '',
            ID: pramData.ID,
            Order: pramData.Order,
            Name: obj.Name,
            Alias: obj.Alias,
            SyncEvent: aa,
            ValidationRule: obj.ValidationRule,
            ExceptionEventFields: characterValue,
          },
        ];
        console.log(Shape);
        if (Shape == '图片') {
          if (view) {
            data[0].Shape = '可预览图片';
          } else {
            data[0].Shape = '图片';
          }
        }
        if (Shape == '附件') {
          if (preView) {
            data[0].Shape = '可预览附件';
          } else {
            data[0].Shape = '附件';
          }
        }
2785

2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798
        if (Shape == '值选择器') {
          if (radiostyle == 0) {
            if (!cho) {
              data[0].Shape = '值选择器';
            } else {
              data[0].Shape = '值复选器';
            }
          } else {
            data[0].Shape = '平铺值选择器';
          }
        }

        switch (Shape) {
2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812
          case '本人部门':
            if (checkboxAllID1 == true) {
              data[0].Config = `ID存储`;
            } else {
              data[0].Config = '';
            }
            break;
          case '本人姓名':
            if (checkboxAllID1 == true) {
              data[0].Config = `ID存储`;
            } else {
              data[0].Config = '';
            }
            break;
2813 2814 2815 2816 2817 2818 2819 2820 2821
          case '编码':
            data[0].Config = `${obj.code}.${obj.prefix ? obj.prefix : ''}`;
            break;
          case '坐标控件':
            pramData.coordinates ? (data[0].Config = '当前坐标') : (data[0].Config = '');
            break;
          case '图片':
          case '可预览图片':
            // data[0].Config = pramData.picture ? '拍照相册' : '';
2822
            data[0].Config = pramData.picture ? '拍照相册' : '';
2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837
            data[0].ValidationRule = pramData.must ? 'required' : '';
            break;
          case '搜索选择器':
            if (obj.Config.endsWith('.n')) {
              data[0].Config = obj.Config;
            } else {
              data[0].Config = radio == 0 ? `${obj.Config}` : `${obj.Config}.n`;
            }
            break;
          case '唯一值文本':
            data[0].Config = obj.fieldName
              ? `${obj.tableName}.${obj.fieldName}`
              : `${obj.tableName}`;
            break;
          case '站点选择器':
2838 2839 2840 2841 2842 2843 2844
            if (checkboxAllID1 == true) {
              data[0].Config = pep
                ? `本人${cho ? '.n' : ''}+ID存储`
                : `全部${cho ? '.n' : ''}+ID存储`;
            } else {
              data[0].Config = pep ? `本人${cho ? '.n' : ''}` : `全部${cho ? '.n' : ''}`;
            }
2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860
            break;
          case '业务选择器':
            if (obj.fieldName.endsWith('.n')) {
              data[0].Config = obj.fieldName
                ? `${obj.tableName}.${obj.fieldName}`
                : `${obj.tableName}`;
            } else if (obj.fieldName) {
              data[0].Config =
                radio == 0
                  ? `${obj.tableName}.${obj.fieldName}`
                  : `${obj.tableName}.${obj.fieldName}.n`;
            } else {
              data[0].Config = radio == 0 ? `${obj.tableName}` : `${obj.tableName}.n`;
            }
            break;
          case '部门选择器':
2861 2862
            if (checkboxAllID1 == true) {
              data[0].Config = cho ? `.n+ID存储` : `+ID存储`;
2863
            } else {
2864
              data[0].Config = cho ? `.n` : '';
2865 2866 2867
            }
            break;
          case '台账选择器':
2868 2869 2870 2871 2872 2873 2874 2875
            let arr = {};
            arr.fromField = obj.workOrder;
            arr.toField = obj.eventOrder;
            let li = [];
            if (formAdd.getFieldValue('parmars')) {
              li = [...formAdd.getFieldValue('parmars')];
            }
            li.push(arr);
2876
            let result = {};
2877
            result.siteJurisdiction = !!site;
2878 2879
            result.fieldshine = li;
            let standData = fieldshineChecked ? JSON.stringify(result) : obj.fieldName;
2880
            if (obj.fieldName && obj.fieldName.endsWith('.n')) {
2881
              data[0].Config = `${obj.standingBook}.${obj.fieldName}`;
2882
            } else if (standData) {
2883 2884 2885
              data[0].Config = cho
                ? `${obj.standingBook}.${standData}.n`
                : `${obj.standingBook}.${standData}`;
2886 2887 2888
            }
            if (obj.filterName) {
              data[0].Config = `${data[0].Config}?${obj.filterName}`;
2889 2890
            } else {
              data[0].Config = `${data[0].Config}`;
2891
            }
2892
            console.log(data[0].Config);
2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914
            break;
          case '关联表单':
            let aalist = {};
            let arrlist = {};
            aalist.台账名称 = obj.standingBook;
            arrlist.fromField = obj.workOrder;
            arrlist.toField = obj.eventOrder;
            aalist.默认显示 = visibleChecked || false;
            aalist.控制规则 = obj.configName;
            let lii = [];
            if (formAdd.getFieldValue('parmars')) {
              lii = [...formAdd.getFieldValue('parmars')];
            }
            console.log(lii);
            lii.push(arrlist);
            let lia = [];

            lii.length > 0 &&
              lii.map(i => {
                if (i) {
                  if (i.fromField && i.toField) {
                    lia.push(i);
2915
                  }
2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947
                }
              });
            console.log(lia);
            aalist.映射字段 = lia;
            console.log(aalist);
            data[0].Config = JSON.stringify(aalist);
            break;
          case '选择器':
            if (cse) {
              let str = cho
                ? `${obj.farter}.${obj.farterData}.n`
                : `${obj.farter}.${obj.farterData}`;
              data[0].Config = str;
            } else {
              let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
              data[0].Config = str;
            }
            break;
          case '值选择器':
            if (obj.Config.endsWith('.n')) {
              data[0].Config = obj.Config;
            } else if (radiostyle == 1) {
              // 平铺值选择器
              data[0].Config = cho ? `${obj.Config}.n` : `${obj.Config}`;
            } else {
              data[0].Config = obj.Config;
            }
            break;
          case '人员选择器':
            if (popeleShape == '分组模态') {
              if (checkboxAllID1 == true) {
                if (obj.ConfigName) {
2948 2949 2950
                  let str = cho
                    ? `全部.${obj.ConfigName}.n+ID存储`
                    : `全部.${obj.ConfigName}+ID存储`;
2951
                  data[0].Config = str;
2952
                } else {
2953
                  let str = cho ? `全部.n+ID存储` : `全部+ID存储`;
2954
                  data[0].Config = str;
2955
                }
2956 2957 2958
              } else if (obj.ConfigName) {
                let str = cho ? `全部.${obj.ConfigName}.n` : `全部.${obj.ConfigName}`;
                data[0].Config = str;
2959
              } else {
2960 2961
                let str = cho ? `全部.n` : `全部`;
                data[0].Config = str;
2962
              }
2963
            } else if (popeleShape == '下拉框') {
2964 2965
              if (checkboxAllID1 == true) {
                let str = cho ? `${obj.Config}.n+ID存储` : `${obj.Config}+ID存储`;
2966 2967
                data[0].Config = str;
              } else {
2968
                let str = cho ? `${obj.Config}.n` : `${obj.Config}`;
2969
                data[0].Config = str;
2970
              }
2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988
            } else if (popeleShape == '树形模态') {
              if (gl) {
                if (checkboxAllID1 == true) {
                  let str = cho ? `tree.多选|站点+ID存储` : `tree.单选|站点+ID存储`;
                  data[0].Config = str;
                } else {
                  let str = cho ? `tree.多选|站点` : `tree.单选|站点`;
                  data[0].Config = str;
                }
              } else {
                if (checkboxAllID1 == true) {
                  let str = cho ? `tree.多选|非站点+ID存储` : `tree.单选|非站点+ID存储`;
                  data[0].Config = str;
                } else {
                  let str = cho ? `tree.多选|非站点` : `tree.单选|非站点`;
                  data[0].Config = str;
                }
              }
2989
            }
2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001
            break;
          default:
            data[0].Config = obj.Config;
        }
        console.log(data[0]);
        let aadata = valueData;
        console.log(keepTreeFirst);
        // if (keepTreeFirst.indexOf(e.node.org.name) == -1) {
        if (aadata.length > 0) {
          let aa = [];
          aadata.map(i => {
            aa.push(i.ID);
3002
          });
3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014
          if (aa.indexOf(data[0].ID) != -1) {
            aadata.map((i, j) => {
              if (i.ID == data[0].ID) {
                aadata[j] = data[0];
              }
            });
          } else {
            aadata.push(data[0]);
          }
        } else {
          aadata.push(data[0]);
        }
3015
        // }
3016
        console.log(valueData);
3017

3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045
        console.log(aadata);
        setValueData(aadata);
        form.setFieldsValue({
          Association: '',
          Config: '',
          guolv: '',
          ConfigName: '',
          tableName: '',
          fieldName: '',
          filterName: '',
          filterValue: '',
          standingBook: '',
          check: 0,
          AllID: '0',
          All: '0',
          AllID1: '',
          All1: '',
          ShowConfig: '',
          pepole: '',
          choose: '',
          SyncEvent: '',
          PeShape: '',
          farter: '',
          farterData: '',
          workOrder: '',
          eventOrder: '',
          configName: '',
        });
3046
        // setVisibleChecked(true);
3047 3048 3049 3050 3051 3052 3053 3054 3055
        setCse('');
        setPopeleShape('');
        setRadio(0);
        setRadiostyle(0);
        setRadio3('0');
        setRadio1('0');
        setGl('');
        setPep('');
        setCho('');
3056
        setSite('');
3057 3058 3059
        setCheckboxAll1('');
        setCheckboxAllID1('');
        setSynchronization(false);
3060
        setFieldshineChecked(false);
3061 3062 3063
        setFlag(false);
        setPopeleShape('');
        setHide(true);
3064
        formAdd.resetFields();
3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083
        if (i == 1.14) {
          console.log(valueData);
          UpdateFields(valueData).then(res => {
            setLoading(false);
            if (res.msg === 'Ok' || res.msg === '') {
              form.resetFields();
              callBackSubmit();
              notification.success({
                message: '提示',
                duration: 3,
                description: '修改成功',
              });
            } else {
              notification.error({
                message: '提示',
                duration: 3,
                description: res.msg,
              });
            }
3084
            setSaveBtnLoading(false);
3085 3086 3087 3088 3089 3090 3091
          });
        }
      }
    });
    // }
    // });
  };
3092

3093 3094
  const mapTree1 = org => {
    if (org.children) {
3095 3096 3097 3098
      // 如果当前形态是关联表单 字段名过滤掉本形态字段名
      if(Shape === '关联表单') {
        org.children = org.children.filter(item => item !== pramData.Name)
      }
3099 3100 3101 3102 3103 3104 3105 3106 3107 3108
      return (
        <TreeNode value={org.name} title={org.name} disabled>
          {org.children.map(item => mapTreeSelect(item))}
        </TreeNode>
      );
    }
    if (org.name) {
      return <TreeNode value={org.name} title={org.name} />;
    }
    return <TreeNode value={org} title={org} key={org} />;
3109
  };
3110

3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123
  const mapTree2 = org => {
    console.log(123);
    console.log(org);
    if (org.children) {
      return (
        <TreeNode value={org.name} title={org.name} key={org.ID} disabled>
          {org.children.map(item => mapTreeSelect(item))}
        </TreeNode>
      );
    }
    return <TreeNode value={org} title={org} key={org} />;
  };

3124 3125 3126 3127 3128
  const onChange2 = e => {
    setRadio(e.target.value);
    setValue1();
  };

3129
  const onChangestyle = e => {
3130
    setRadiostyle(e.target.value);
3131
  };
3132

3133 3134 3135 3136 3137
  const timeDataOnVChange = e => {
    console.log(e.target.value);
    setTimeData(e.target.value);
  };

3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171
  const inputOnChange = e => {
    setValue1();
  };

  const inputOnchange = e => {
    setValue1();
  };

  const onChange3 = e => {
    setRadio3(e.target.value);
    setValue1();
  };

  const onChange1 = e => {
    let aa = form.getFieldsValue().ConfigName;
    let bb = form.getFieldsValue().Config;
    console.log(aa);
    console.log(bb);
    if (e.target.value == '全部') {
      form.setFieldsValue({ ConfigName: bb });
    } else {
      form.setFieldsValue({ Config: aa, AllID: '0' });
      setRadio3('0');
    }
    setRadio1(e.target.value);
    setValue();
  };

  const setValue = () => {
    let aa = form.getFieldsValue().ConfigName;
    let bb = form.getFieldsValue().Config;
    let cc = form.getFieldsValue().All;
    let dd = form.getFieldsValue().AllID;
    let ff = form.getFieldsValue().check;
3172

3173 3174 3175 3176 3177 3178 3179 3180
    if (cc == '全部') {
      if (dd == '全部ID') {
        if (bb) {
          if (ff == 1) {
            form.setFieldsValue({ ShowConfig: `全部ID.${bb}.n` });
          } else {
            form.setFieldsValue({ ShowConfig: `全部ID.${bb}` });
          }
3181 3182
        } else if (ff == 1) {
          form.setFieldsValue({ ShowConfig: `全部ID.n` });
3183
        } else {
3184
          form.setFieldsValue({ ShowConfig: `全部ID` });
3185
        }
3186
      } else if (bb) {
3187
        if (ff == 1) {
3188
          form.setFieldsValue({ ShowConfig: `全部.${bb}.n` });
3189
        } else {
3190
          form.setFieldsValue({ ShowConfig: `全部.${bb}` });
3191
        }
3192 3193
      } else if (ff == 1) {
        form.setFieldsValue({ ShowConfig: `全部.n` });
3194
      } else {
3195 3196 3197 3198 3199 3200 3201
        form.setFieldsValue({ ShowConfig: `全部` });
      }
    } else if (aa) {
      if (ff == 1) {
        form.setFieldsValue({ ShowConfig: `${aa}.n` });
      } else {
        form.setFieldsValue({ ShowConfig: `${aa}` });
3202
      }
3203 3204 3205 3206
    } else if (ff == 1) {
      form.setFieldsValue({ ShowConfig: `.n` });
    } else {
      form.setFieldsValue({ ShowConfig: '' });
3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223
    }
  };

  const setValue1 = () => {
    let aa = form.getFieldsValue().ConfigName;
    let bb = form.getFieldsValue().Config;
    let cc = form.getFieldsValue().All;
    let dd = form.getFieldsValue().AllID;
    let ff = form.getFieldsValue().check;
    if (cc == '全部') {
      if (dd == '全部ID') {
        if (aa) {
          if (ff == 1) {
            form.setFieldsValue({ ShowConfig: `全部ID.${aa}.n` });
          } else {
            form.setFieldsValue({ ShowConfig: `全部ID.${aa}` });
          }
3224 3225
        } else if (ff == 1) {
          form.setFieldsValue({ ShowConfig: `全部ID.n` });
3226
        } else {
3227
          form.setFieldsValue({ ShowConfig: `全部ID` });
3228
        }
3229
      } else if (aa) {
3230
        if (ff == 1) {
3231
          form.setFieldsValue({ ShowConfig: `全部.${aa}.n` });
3232
        } else {
3233
          form.setFieldsValue({ ShowConfig: `全部.${aa}` });
3234
        }
3235 3236
      } else if (ff == 1) {
        form.setFieldsValue({ ShowConfig: `全部.n` });
3237
      } else {
3238
        form.setFieldsValue({ ShowConfig: `全部` });
3239
      }
3240 3241 3242 3243 3244 3245 3246 3247 3248 3249
    } else if (bb) {
      if (ff == 1) {
        form.setFieldsValue({ ShowConfig: `${bb}.n` });
      } else {
        form.setFieldsValue({ ShowConfig: `${bb}` });
      }
    } else if (ff == 1) {
      form.setFieldsValue({ ShowConfig: `.n` });
    } else {
      form.setFieldsValue({ ShowConfig: '' });
3250 3251 3252
    }
  };

3253 3254
  const mapTreeSelect = org =>
    org.children ? (
3255 3256 3257 3258 3259 3260 3261
      <TreeNode value={org.name} title={org.name} disabled>
        {org.children.map(item => mapTreeSelect(item))}
      </TreeNode>
    ) : (
      <TreeNode value={org} title={org} key={org} />
    );

3262 3263 3264 3265 3266 3267 3268 3269
  const changePepole = e => {
    setPep(e.target.checked);
  };

  const changeChoose = e => {
    setCho(e.target.checked);
  };

3270 3271 3272 3273
  const changeSite = e => {
    setSite(e.target.checked);
  };

3274 3275 3276 3277 3278
  const changeGl = e => {
    console.log(e);
    setGl(e.target.checked);
  };

3279 3280 3281 3282 3283
  const changeAll1 = e => {
    let aa = form.getFieldsValue().ConfigName;
    let bb = form.getFieldsValue().Config;
    setCheckboxAll1(e.target.checked);
    if (e.target.checked == true) {
3284
      if (bb || bb == '' || bb == undefined) {
3285 3286 3287 3288 3289
        form.setFieldsValue({ ConfigName: bb });
      }
      setHide(false);
      setFlag(true);
    } else {
3290
      if (aa || aa == '' || bb == undefined) {
3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302
        form.setFieldsValue({ Config: aa });
      }
      setHide(true);
      setFlag(false);
      setCheckboxAllID1(false);
    }
  };

  const changeAllID1 = e => {
    setCheckboxAllID1(e.target.checked);
  };

3303 3304 3305 3306
  const changeSy = e => {
    setSynchronization(e.target.checked);
  };

3307
  const popeleShapeOnChange = e => {
3308
    form.setFieldsValue({ ConfigName: '', Config: '' });
3309 3310
    console.log(e);
    setPopeleShape(e.target.value);
3311 3312
    // let aa = form.getFieldsValue().ConfigName;
    // let bb = form.getFieldsValue().Config;
3313
    if (e.target.value == '分组模态') {
3314 3315 3316
      // if (bb || bb == '' || bb == undefined) {
      //   form.setFieldsValue({ ConfigName: bb });
      // }
3317 3318 3319
      setHide(false);
      setFlag(true);
    } else if (e.target.value == '下拉框') {
3320 3321 3322
      // if (aa || aa == '' || bb == undefined) {
      //   form.setFieldsValue({ Config: aa });
      // }
3323 3324
      setHide(true);
      setFlag(false);
3325
      // setCheckboxAllID1(false);
3326 3327 3328
    } else if (e.target.value == '树形模态') {
      setHide(true);
      setFlag(1);
3329
      // setCheckboxAllID1(false);
3330 3331 3332 3333
    }
  };

  const changeCse = e => {
3334
    form.setFieldsValue({ farter: '', farterData: '', Config: '' });
3335 3336 3337
    setCse(e.target.checked);
  };

3338
  const editRule = () => {
3339
    setShowRule(true);
3340
  };
3341

3342 3343
  const saveRule = e => {
    form.setFieldsValue({ configName: e });
3344
    setShowRule(false);
3345 3346
    console.log(e);
  };
3347

皮倩雯's avatar
皮倩雯 committed
3348 3349 3350 3351
  return (
    <>
      <Drawer
        title="修改"
3352
        width="1000px"
皮倩雯's avatar
皮倩雯 committed
3353 3354 3355
        // {...props}
        visible={isVisible}
        onClose={onCancel}
3356
        zIndex={99}
3357
        destroyOnClose
3358 3359 3360
        afterClose={() => {
          form.resetFields();
        }}
皮倩雯's avatar
皮倩雯 committed
3361 3362
        footer={
          <Space>
3363
            <Button onClick={onSubmit} loading={saveBtnLoading} type="primary">
3364
              保存
皮倩雯's avatar
皮倩雯 committed
3365 3366 3367 3368
            </Button>
          </Space>
        }
      >
3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390
        <div style={{ width: '100%', display: 'flex', justifyContent: 'flex-start' }}>
          <div
            style={{
              width: '300px',
              overflowY: 'scroll',
              height: 'calc(100vh - 160px)',
              borderRight: '1px solid #f0eded',
            }}
          >
            <Tree
              showIcon="true"
              blockNode
              autoExpandParent
              selectedKeys={[currentSelectOrg]}
              onSelect={onSelect}
              treeData={treeValue.map(t => mapTree(t))}
              expandedKeys={expendKey}
            />
          </div>
          {show == 'block' ? (
            <div style={{ width: '600px', overflowY: 'scroll', height: 'calc(100vh - 160px)' }}>
              {isVisible && (
3391
                <Form form={form}>
3392 3393 3394
                  <Item
                    label="字段名"
                    name="Name"
3395
                    labelCol={{ span: 4 }}
3396 3397
                    rules={[{ required: true, message: '请输入表名' }]}
                  >
3398
                    <Input placeholder="请输入别名" disabled />
3399
                  </Item>
3400 3401
                  <Item label="别名" name="Alias" labelCol={{ span: 4 }}>
                    <Input placeholder="请输入别名" allowClear />
3402
                  </Item>
3403
                  <Item name="ReadOnly" label="属性" labelCol={{ span: 4 }}>
3404 3405 3406 3407 3408 3409 3410
                    <div>
                      <Checkbox
                        checked={pramData.ReadOnly}
                        onChange={e => onChangeReady(e, 'ReadOnly')}
                      >
                        只读
                      </Checkbox>
3411
                      <Checkbox
3412 3413 3414 3415
                        checked={pramData.EditableLater}
                        onChange={e => onChangeReady(e, 'EditableLater')}
                      >
                        允许补正(事后修改)
3416
                      </Checkbox>
3417 3418
                    </div>
                  </Item>
3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439
                  <Item
                    label={
                      <Tooltip
                        title={
                          <>
                            <span>适合于分表办理,将信息由工单同步到事件</span>
                          </>
                        }
                      >
                        <InfoCircleOutlined
                          style={{
                            color: 'rgb(24 144 255)',
                            marginRight: '5px',
                          }}
                        />
                        <span>同步</span>
                      </Tooltip>
                    }
                    name="SyncEvent"
                    labelCol={{ span: 4 }}
                  >
3440 3441 3442 3443
                    <Checkbox checked={synchronization} onChange={changeSy}>
                      工单 → 事件
                    </Checkbox>
                    {/* <Radio.Group>
3444 3445 3446 3447 3448 3449
                      <Radio value={0} style={{ marginRight: '0.5rem' }}>
                        不同步
                      </Radio>
                      <Radio value={1} style={{ marginRight: '0.5rem' }}>
                        工单 → 事件
                      </Radio>
3450 3451 3452
                     
                    </Radio.Group> */}
                    {/* <Radio value={2}>事件(上报时) → 工单</Radio> */}
3453
                  </Item>
3454 3455
                  <Row>
                    {/* <Col span={1} /> */}
3456
                    <Col span={16}>
3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474
                      <Item label="形态" labelCol={{ span: 6 }}>
                        <TreeSelect
                          style={{ width: '95%' }}
                          value={Shape}
                          onChange={handleCharacteristics}
                          showSearch
                          dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                          placeholder="请选择表名 "
                          allowClear
                          treeDefaultExpandAll
                          showCheckedStrategy
                        >
                          {characteristics1 ? (
                            characteristics1.map(i => mapTreeSelect(i))
                          ) : (
                            <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
                          )}
                        </TreeSelect>
3475 3476
                      </Item>
                    </Col>
皮倩雯's avatar
皮倩雯 committed
3477

3478
                    <Col span={5}>
3479
                      <Item label="单位" name="Unit" labelCol={{ span: 10 }}>
3480 3481 3482
                        <Input style={{ width: '95%' }} placeholder="" />
                      </Item>
                    </Col>
皮倩雯's avatar
皮倩雯 committed
3483
                    <Col span={3}>
3484 3485
                      <Item label="宽" name="RowSpan" labelCol={{ span: 8 }}>
                        <Input placeholder="" />
3486 3487 3488
                      </Item>
                    </Col>
                  </Row>
3489 3490

                  {/* <div style={{ border: '1px dashed red' }}> */}
3491 3492 3493
                  {(() => {
                    switch (Shape) {
                      case '编码':
皮倩雯's avatar
皮倩雯 committed
3494
                        return (
3495
                          <>
3496 3497
                            <Item label="前缀" name="prefix" labelCol={{ span: 4 }}>
                              <Input placeholder="" allowClear />
3498
                            </Item>
3499
                            <Item label="编码方式" name="code" labelCol={{ span: 4 }}>
3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512
                              <Radio.Group>
                                <Radio value="年份编码" style={{ marginRight: '0.5rem' }}>
                                  XJ-2019-000001(前缀-年份-六位编码)
                                </Radio>
                                <Radio value="年月编码" style={{ marginRight: '0.5rem' }}>
                                  XJ-201909-000001(前缀-年份月份-六位编码)
                                </Radio>
                                <Radio value="一般编码" defaultChecked>
                                  XJ00000001(前缀 八位编码)
                                </Radio>
                              </Radio.Group>
                            </Item>
                          </>
皮倩雯's avatar
皮倩雯 committed
3513
                        );
3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545
                      // case '值选择器':
                      // case '值复选器':
                      //   return (
                      //     <>
                      //       {' '}
                      //       <Item label="可选值" name="Config" labelCol={{ span: 4 }}>
                      //         <TextArea
                      //           allowClear
                      //           placeholder="用英文逗号分隔自定义的值,可设置初始值"
                      //         />
                      //       </Item>
                      //       {/* <Item colon={false} label=" " labelCol={{ span: 3 }}>
                      //         {' '}
                      //         <div style={{ display: 'flex', alignItems: 'center' }}>
                      //           <span style={{ marginRight: '0.4rem' }}>
                      //             以英文逗号为分隔符填写,或其他分隔符粘贴:
                      //           </span>
                      //           <Select onChange={handleSeparator} style={{ width: '30.8%' }}>
                      //             <Select.Option value="0">以,分隔(英文逗号)</Select.Option>
                      //             <Select.Option value="1">以/分隔(正斜杠)</Select.Option>
                      //             <Select.Option value="2">以\\分隔(反斜杠)</Select.Option>
                      //             <Select.Option value="3">以、分隔(中文顿号)</Select.Option>
                      //             <Select.Option value="4">以;分隔(英文分号)</Select.Option>
                      //             <Select.Option value="5">以;分隔(中文分号)</Select.Option>
                      //             <Select.Option value="6">(是)/否</Select.Option>
                      //             <Select.Option value="7">是/(否)</Select.Option>
                      //             <Select.Option value="8">(否)/是</Select.Option>
                      //           </Select>
                      //         </div>
                      //       </Item> */}
                      //     </>
                      //   );
3546 3547 3548 3549
                      case '可编辑值选择器':
                        return (
                          <>
                            {' '}
3550
                            <Item label="可选值" name="Config" labelCol={{ span: 4 }}>
3551 3552 3553 3554 3555 3556 3557
                              <TextArea
                                allowClear
                                placeholder="用英文逗号分隔自定义的值,可编辑,可设置初始值"
                              />
                            </Item>
                          </>
                        );
3558
                      case '值选择器':
3559 3560 3561
                        return (
                          <>
                            {' '}
3562
                            <Item label="可选值" name="Config" labelCol={{ span: 4 }}>
3563 3564 3565 3566 3567
                              <TextArea
                                allowClear
                                placeholder="用英文逗号分隔自定义的值,勾选,可设置初始值"
                              />
                            </Item>
3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578
                            <Item
                              colon={false}
                              name="style"
                              label="交互方式:"
                              labelCol={{ span: 4 }}
                            >
                              <Radio.Group
                                onChange={onChangestyle}
                                value={radiostyle}
                                defaultValue={cheestyle}
                              >
3579
                                <Radio value={0}>下拉框</Radio>
3580 3581 3582
                                <Radio value={1}>平铺</Radio>
                              </Radio.Group>
                            </Item>
3583
                            {/* <Item colon={false} name="check" label="配置:" labelCol={{ span: 4 }}>
3584 3585 3586 3587
                              <Radio.Group onChange={onChange2} value={radio} defaultValue={chee}>
                                <Radio value={0}>单选</Radio>
                                <Radio value={1}>多选</Radio>
                              </Radio.Group>
3588
                            </Item> */}
3589 3590 3591 3592 3593 3594 3595 3596 3597
                            <Item name="choose" label="配置:" labelCol={{ span: 4 }}>
                              <Checkbox
                                checked={cho}
                                onChange={changeChoose}
                                style={{ marginBottom: '0' }}
                              >
                                多选
                              </Checkbox>
                            </Item>
3598 3599 3600
                          </>
                        );
                      case '图片':
3601
                      case '可预览图片':
3602
                        return (
3603
                          <Item name="ReadOnly" label="配置" labelCol={{ span: 4 }}>
3604
                            <div>
3605
                              <Checkbox checked={view} onChange={onChangeView}>
3606
                                可预览
3607
                              </Checkbox>
3608
                              <Checkbox
3609 3610 3611 3612
                                checked={pramData.must}
                                onChange={e => onChangeReady(e, 'must')}
                              >
                                必填字段
3613
                              </Checkbox>
3614 3615 3616 3617 3618 3619
                              <Checkbox
                                checked={pramData.picture}
                                onChange={e => onChangeReady(e, 'picture')}
                              >
                                允许从相册选取
                              </Checkbox>
3620 3621 3622
                            </div>
                          </Item>
                        );
3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633
                      case '附件':
                      case '可预览附件':
                        return (
                          <Item label="配置" labelCol={{ span: 4 }}>
                            <div>
                              <Checkbox checked={preView} onChange={onChangePreView}>
                                可预览
                              </Checkbox>
                            </div>
                          </Item>
                        );
3634
                      case '唯一值文本':
3635
                        return (
3636 3637 3638 3639 3640
                          <Row>
                            <Col span={12}>
                              <Item
                                label="表名"
                                name="tableName"
3641
                                labelCol={{ span: 8 }}
3642
                                rules={[{ required: true, message: '请输入表名' }]}
3643
                              >
3644
                                <Input placeholder="请输入表名" />
3645 3646 3647 3648 3649 3650
                              </Item>
                            </Col>
                            <Col span={12}>
                              <Item
                                label="字段名"
                                name="fieldName"
3651
                                labelCol={{ span: 9 }}
3652 3653
                                rules={[{ required: true, message: '请输入表名' }]}
                              >
3654
                                <Input placeholder="请输入字段名" />
3655 3656 3657
                              </Item>
                            </Col>
                          </Row>
3658
                        );
3659
                      case '业务选择器':
3660
                        return (
3661 3662 3663 3664 3665 3666
                          <>
                            <Row>
                              <Col span={12}>
                                <Item
                                  label="表名"
                                  name="tableName"
3667
                                  labelCol={{ span: 8 }}
3668 3669
                                  rules={[{ required: true, message: '请输入表名' }]}
                                >
3670
                                  <Input placeholder="请输入表名" />
3671 3672 3673 3674 3675 3676
                                </Item>
                              </Col>
                              <Col span={12}>
                                <Item
                                  label="字段名"
                                  name="fieldName"
3677
                                  labelCol={{ span: 7 }}
3678 3679
                                  rules={[{ required: true, message: '请输入表名' }]}
                                >
3680
                                  <Input placeholder="请输入字段名" />
3681 3682 3683
                                </Item>
                              </Col>
                            </Row>
3684
                            <Item colon={false} name="check" label="配置:" labelCol={{ span: 4 }}>
3685 3686 3687 3688 3689 3690 3691 3692 3693 3694
                              <Radio.Group onChange={onChange2} value={radio} defaultValue={chee}>
                                <Radio value={0}>单选</Radio>
                                <Radio value={1}>多选</Radio>
                              </Radio.Group>
                            </Item>
                          </>
                        );
                      case '选择器':
                        return (
                          <>
3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710
                            <Item labelCol={{ span: 4 }} label="配置">
                              <div style={{ display: 'inline-block', marginRight: '10px' }}>
                                <Item
                                  name="Association"
                                  labelCol={{ span: 4 }}
                                  style={{ marginBottom: '0' }}
                                >
                                  <Checkbox
                                    checked={cse}
                                    onChange={changeCse}
                                    style={{ marginBottom: '0' }}
                                  >
                                    关联选择器
                                  </Checkbox>
                                </Item>
                              </div>
3711
                              {/* <div style={{ display: 'inline-block', marginRight: '10px' }}>
3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724
                                <Item
                                  name="choose"
                                  labelCol={{ span: 4 }}
                                  style={{ marginBottom: '0' }}
                                >
                                  <Checkbox
                                    checked={cho}
                                    onChange={changeChoose}
                                    style={{ marginBottom: '0' }}
                                  >
                                    多选
                                  </Checkbox>
                                </Item>
3725
                              </div> */}
3726
                            </Item>
3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751
                            {cse ? (
                              <Row>
                                <Col span={12}>
                                  <Item
                                    label="父字段名"
                                    name="farter"
                                    labelCol={{ span: 8 }}
                                    rules={[{ required: true, message: '请输入父字段名' }]}
                                  >
                                    <Input placeholder="请输入父字段名称" />
                                  </Item>
                                </Col>
                                <Col span={12}>
                                  <Item
                                    label="数据字典"
                                    name="farterData"
                                    labelCol={{ span: 7 }}
                                    rules={[{ required: true, message: '请输入数据字典名称' }]}
                                  >
                                    <Input placeholder="请输入数据字典名称" />
                                  </Item>
                                </Col>
                              </Row>
                            ) : (
                              <Item label="数据字典" name="Config" labelCol={{ span: 4 }}>
3752
                                <Input allowClear placeholder="请输入数据字典名称" />
3753 3754
                              </Item>
                            )}
3755 3756 3757 3758 3759 3760
                          </>
                        );
                      case '搜索选择器':
                        return (
                          <>
                            <Item
3761
                              label="数据字典"
3762
                              name="Config"
3763
                              labelCol={{ span: 4 }}
皮倩雯's avatar
皮倩雯 committed
3764
                              // rules={[{ required: true, message: '请输入数据字典名称' }]}
3765
                            >
3766
                              <Input allowClear placeholder="请输入数据字典名称" />
3767
                            </Item>
3768
                            <Item colon={false} name="check" label="配置:" labelCol={{ span: 4 }}>
3769 3770 3771 3772 3773 3774 3775 3776 3777
                              <Radio.Group onChange={onChange2} value={radio} defaultValue={chee}>
                                <Radio value={0}>单选</Radio>
                                <Radio value={1}>多选</Radio>
                              </Radio.Group>
                            </Item>
                          </>
                        );
                      case '部门选择器':
                        return (
3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801
                          <Item name="Config" labelCol={{ span: 4 }} label="配置">
                            <div style={{ display: 'inline-block' }}>
                              <Item name="choose" style={{ marginBottom: '0' }}>
                                <Checkbox
                                  checked={cho}
                                  onChange={changeChoose}
                                  style={{ marginBottom: '0' }}
                                >
                                  多选
                                </Checkbox>
                              </Item>
                            </div>
                            <div style={{ display: 'inline-block', marginRight: '10px' }}>
                              <Item name="AllID1" style={{ marginBottom: '0' }}>
                                <Checkbox
                                  checked={checkboxAllID1}
                                  onChange={changeAllID1}
                                  style={{ marginBottom: '0' }}
                                >
                                  ID存储
                                </Checkbox>
                              </Item>
                            </div>
                          </Item>
3802 3803 3804
                        );
                      case '站点选择器':
                        return (
3805
                          <Item name="Config" labelCol={{ span: 4 }} label="配置">
3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816
                            <div style={{ display: 'inline-block' }}>
                              <Item name="pepole" style={{ marginBottom: '0' }}>
                                <Checkbox
                                  checked={pep}
                                  onChange={changePepole}
                                  style={{ marginBottom: '0' }}
                                >
                                  本人
                                </Checkbox>
                              </Item>
                            </div>
3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828
                            <div style={{ display: 'inline-block', marginRight: '10px' }}>
                              <Item name="AllID1" style={{ marginBottom: '0' }}>
                                <Checkbox
                                  checked={checkboxAllID1}
                                  onChange={changeAllID1}
                                  style={{ marginBottom: '0' }}
                                >
                                  ID存储
                                </Checkbox>
                              </Item>
                            </div>
                            <div style={{ display: 'inline-block' }}>
3829 3830 3831 3832 3833 3834
                              <Item name="choose" style={{ marginBottom: '0' }}>
                                <Checkbox
                                  checked={cho}
                                  onChange={changeChoose}
                                  style={{ marginBottom: '0' }}
                                >
3835
                                  多选
3836 3837
                                </Checkbox>
                              </Item>
3838
                            </div>
3839 3840
                          </Item>
                        );
3841 3842 3843 3844 3845 3846 3847 3848 3849
                      case '关联表单':
                        return (
                          <>
                            <Item
                              label="台账名"
                              name="standingBook"
                              labelCol={{ span: 4 }}
                              rules={[{ required: true, message: '请选择台账名' }]}
                            >
3850 3851 3852 3853 3854
                              <Select
                                placeholder="请选择台账名"
                                showSearch
                                onChange={e => seach(e)}
                              >
3855 3856
                                {keepStandingBook
                                  ? keepStandingBook.map((item, index) => (
3857 3858 3859
                                      <Option key={index} value={item.name}>
                                        {item.name}
                                      </Option>
3860
                                    ))
3861 3862 3863
                                  : ''}
                              </Select>
                            </Item>
3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880
                            <Item
                              style={{ marginBottom: '10px' }}
                              label={
                                <>
                                  <span
                                    style={{
                                      color: 'red',
                                      fontSize: '17px',
                                      marginRight: '5px',
                                      marginTop: '3px',
                                    }}
                                  >
                                    *
                                  </span>
                                  <span>映射字段</span>
                                </>
                              }
3881 3882 3883 3884 3885 3886
                              labelCol={{ span: 4 }}
                            >
                              <Row>
                                <Col span={11}>
                                  <Item
                                    name="workOrder"
3887
                                    rules={[{ required: true, message: '请输入字段名' }]}
3888
                                    style={{ marginBottom: 0 }}
3889
                                  >
3890
                                    <TreeSelect
3891 3892
                                      showSearch
                                      style={{ width: '208px' }}
3893 3894 3895 3896 3897 3898 3899
                                      // value={treeSelectValue}
                                      dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                                      placeholder="请选择字段名 "
                                      allowClear
                                      treeDefaultExpandAll
                                      showCheckedStrategy
                                      // onChange={treeSelectOnchange}
3900
                                    >
3901 3902 3903 3904 3905 3906
                                      {fieldValue ? (
                                        fieldValue.map(i => mapTree1(i))
                                      ) : (
                                        <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
                                      )}
                                    </TreeSelect>
3907 3908
                                  </Item>
                                </Col>
3909 3910 3911 3912 3913 3914 3915 3916
                                <Col span={1} style={{ paddingTop: '3px' }}>
                                  {' '}
                                  <img
                                    src={logo}
                                    style={{ height: '24px', marginLeft: '-10px' }}
                                    alt=""
                                  />
                                </Col>
3917
                                <Col span={11}>
3918
                                  <Item
3919
                                    name="eventOrder"
3920
                                    rules={[{ required: true, message: '请输入映射字段名' }]}
3921
                                    style={{ marginBottom: 0 }}
3922
                                  >
3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934
                                    <Select
                                      placeholder="选择映射字段名"
                                      showSearch
                                      style={{ width: '208px' }}
                                    >
                                      {mapFieldValue.length > 0
                                        ? mapFieldValue.map((item, index) => (
                                            <>
                                              <Option key={item.name} value={item.name}>
                                                {item.name}
                                              </Option>
                                            </>
3935
                                          ))
3936 3937
                                        : ''}
                                    </Select>
3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958
                                  </Item>
                                </Col>
                              </Row>
                            </Item>
                            <Form name="form" form={formAdd} labelCol={{ span: 7 }}>
                              <Form.List name="parmars">
                                {(fields, { add, remove }) => (
                                  <>
                                    {fields.map(({ key, name, fieldKey, ...restField }) => (
                                      <Space
                                        key={key}
                                        style={{
                                          display: 'flex',
                                          marginBottom: '5px',
                                          justifyContent: 'center',
                                        }}
                                        align="baseline"
                                      >
                                        <Form.Item
                                          {...restField}
                                          style={{ marginBottom: '5px' }}
3959
                                          name={[name, 'fromField']}
3960 3961 3962
                                          fieldKey={[fieldKey, 'key']}
                                          validateTrigger={['onChange', 'onBlur']}
                                          rules={[
3963 3964 3965
                                            { required: true, message: '请填写字段名' },
                                            {
                                              validator: () => {
3966 3967 3968 3969 3970 3971 3972 3973
                                                let aa = formAdd.getFieldsValue().parmars;
                                                let data = [];
                                                aa.length > 0 &&
                                                  aa.map(i => {
                                                    if (i) {
                                                      data.push(i.fromField);
                                                    }
                                                  });
3974 3975
                                                let list = new Set(data);
                                                let ee = form.getFieldsValue().workOrder;
3976 3977 3978 3979
                                                if (
                                                  list.size !== data.length ||
                                                  data.indexOf(ee) != -1
                                                ) {
3980 3981 3982 3983 3984
                                                  return Promise.reject(new Error('字段名重复'));
                                                }
                                                return Promise.resolve();
                                              },
                                            },
3985 3986
                                          ]}
                                        >
3987
                                          <TreeSelect
3988 3989
                                            showSearch
                                            style={{ width: '208px', marginLeft: '98px' }}
3990 3991 3992 3993 3994 3995 3996
                                            // value={treeSelectValue}
                                            dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                                            placeholder="请选择字段名 "
                                            allowClear
                                            treeDefaultExpandAll
                                            showCheckedStrategy
                                            // onChange={treeSelectOnchange}
3997
                                          >
3998 3999 4000 4001 4002 4003
                                            {fieldValue ? (
                                              fieldValue.map(i => mapTree1(i))
                                            ) : (
                                              <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
                                            )}
                                          </TreeSelect>
4004
                                        </Form.Item>
4005 4006
                                        {/* <SwapOutlined style={{marginLeft:'4px'}}/> */}
                                        <img src={logo} style={{ height: '24px' }} alt="" />
4007 4008 4009
                                        <Form.Item
                                          {...restField}
                                          style={{ marginBottom: '5px' }}
4010 4011
                                          name={[name, 'toField']}
                                          fieldKey={[fieldKey, 'key']}
4012
                                          rules={[{ required: true, message: '请填写映射字段名' }]}
4013
                                        >
4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025
                                          <Select
                                            placeholder="选择映射字段名"
                                            showSearch
                                            style={{ width: '208px' }}
                                          >
                                            {mapFieldValue.length > 0
                                              ? mapFieldValue.map((item, index) => (
                                                  <>
                                                    <Option key={item.name} value={item.name}>
                                                      {item.name}
                                                    </Option>
                                                  </>
4026
                                                ))
4027 4028
                                              : ''}
                                          </Select>
4029 4030 4031 4032 4033 4034 4035 4036 4037
                                        </Form.Item>
                                        <MinusCircleOutlined
                                          onClick={() => remove(name)}
                                          style={{ marginLeft: '10px', fontSize: '20px' }}
                                        />
                                      </Space>
                                    ))}
                                    <Form.Item>
                                      <Button
4038
                                        style={{ width: '456px', marginLeft: '100px' }}
4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063
                                        type="dashed"
                                        onClick={() => add()}
                                        block
                                        icon={<PlusOutlined />}
                                      >
                                        添加映射
                                      </Button>
                                    </Form.Item>
                                  </>
                                )}
                              </Form.List>
                            </Form>
                            <Item label="默认显示" labelCol={{ span: 4 }}>
                              <Switch
                                checkedChildren="是"
                                unCheckedChildren="否"
                                checked={visibleChecked}
                                onChange={change}
                                //  style={{ marginLeft: '35px' }}
                              />
                            </Item>
                            <Item
                              label="控制规则"
                              name="configName"
                              labelCol={{ span: 4 }}
4064
                              // rules={[{ required: true, message: '请输入控制规则' }]}
4065
                            >
4066
                              {/* <TextArea placeholder="示例:{表名.是否缴费} = ‘是’ and {表名.缴费金额} > 1000" /> */}
4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077
                              <div
                                style={{
                                  border: '2px solid #6A98FA',
                                  minHeight: '34px',
                                  lineHeight: '34px',
                                  textAlign: 'center',
                                }}
                                onClick={editRule}
                              >
                                <span>{form.getFieldsValue().configName}</span>
                              </div>
4078 4079 4080 4081
                            </Item>
                          </>
                        );

4082 4083 4084
                      case '台账选择器':
                        return (
                          <>
4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096
                            <Item
                              label="台账名"
                              name="standingBook"
                              labelCol={{ span: 4 }}
                              rules={[{ required: true, message: '请选择台账名' }]}
                            >
                              <Select onChange={e => seach(e)} showSearch>
                                {keepStandingBook
                                  ? keepStandingBook.map((item, index) => (
                                      <Option key={index} value={item.name}>
                                        {item.name}
                                      </Option>
4097
                                    ))
4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108
                                  : ''}
                              </Select>
                            </Item>
                            <Item label="字段映射" name="fieldshine" labelCol={{ span: 4 }}>
                              <Switch
                                checkedChildren="是"
                                unCheckedChildren="否"
                                checked={fieldshineChecked}
                                onChange={fieldshineChange}
                              />
                            </Item>
4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132
                            <Item label="配置" labelCol={{ span: 4 }}>
                              {fieldshineChecked && (
                                <div style={{ display: 'inline-block', marginRight: '20px' }}>
                                  <Item name="siteJurisdiction" style={{ marginBottom: '0px' }}>
                                    <Checkbox checked={site} onChange={changeSite}>
                                      站点过滤
                                    </Checkbox>
                                  </Item>
                                </div>
                              )}
                              {!fieldshineChecked && (
                                <div style={{ display: 'inline-block', marginRight: '20px' }}>
                                  <Item name="check" style={{ marginBottom: '0px' }}>
                                    <Checkbox
                                      checked={cho}
                                      onChange={changeChoose}
                                      style={{ marginBottom: '0' }}
                                    >
                                      多选
                                    </Checkbox>
                                  </Item>
                                </div>
                              )}
                            </Item>
4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143
                            {fieldshineChecked === false ? (
                              <Item
                                label="字段名"
                                name="fieldName"
                                labelCol={{ span: 4 }}
                                rules={[{ required: true, message: '请输入字段名' }]}
                              >
                                <Input placeholder="台账表中字段用于数据回显" />
                              </Item>
                            ) : (
                              <>
4144
                                <Item
4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161
                                  style={{ marginBottom: '10px' }}
                                  label={
                                    <>
                                      <span
                                        style={{
                                          color: 'red',
                                          fontSize: '17px',
                                          marginRight: '5px',
                                          marginTop: '3px',
                                        }}
                                      >
                                        *
                                      </span>
                                      <span>映射字段</span>
                                    </>
                                  }
                                  labelCol={{ span: 4 }}
4162
                                >
4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203
                                  <Row>
                                    <Col span={11}>
                                      <Item
                                        name="workOrder"
                                        rules={[{ required: true, message: '请输入字段名' }]}
                                        style={{ marginBottom: 0 }}
                                      >
                                        <TreeSelect
                                          showSearch
                                          style={{ width: '208px' }}
                                          dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                                          placeholder="请选择字段名 "
                                          allowClear
                                          treeDefaultExpandAll
                                        >
                                          {standbookData ? (
                                            standbookData.map(i => mapTree2(i))
                                          ) : (
                                            <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
                                          )}
                                        </TreeSelect>
                                      </Item>
                                    </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 }}
                                      >
                                        <TreeSelect
                                          showSearch
                                          style={{ width: '208px' }}
                                          dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
4204
                                          placeholder="请选择映射字段名"
4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216
                                          allowClear
                                          treeDefaultExpandAll
                                        >
                                          {standFiledData ? (
                                            standFiledData.map(i => mapTree2(i))
                                          ) : (
                                            <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
                                          )}
                                        </TreeSelect>
                                      </Item>
                                    </Col>
                                  </Row>
4217
                                </Item>
4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327
                                <Form name="form" form={formAdd} labelCol={{ span: 7 }}>
                                  <Form.List name="parmars">
                                    {(fields, { add, remove }) => (
                                      <>
                                        {fields.map(({ key, name, fieldKey, ...restField }) => (
                                          <Space
                                            key={key}
                                            style={{
                                              display: 'flex',
                                              marginBottom: '5px',
                                              justifyContent: 'center',
                                            }}
                                            align="baseline"
                                          >
                                            <Form.Item
                                              {...restField}
                                              style={{ marginBottom: '5px' }}
                                              name={[name, 'fromField']}
                                              fieldKey={[fieldKey, 'key']}
                                              validateTrigger={['onChange', 'onBlur']}
                                              rules={[{ required: true, message: '请填写字段名' }]}
                                            >
                                              <TreeSelect
                                                showSearch
                                                style={{ width: '208px', marginLeft: '98px' }}
                                                dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                                                placeholder="请选择字段名 "
                                                allowClear
                                                treeDefaultExpandAll
                                              >
                                                {standbookData ? (
                                                  standbookData.map(i => mapTree2(i))
                                                ) : (
                                                  <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
                                                )}
                                              </TreeSelect>
                                            </Form.Item>
                                            <img src={logo} style={{ height: '24px' }} alt="" />
                                            <Form.Item
                                              {...restField}
                                              style={{ marginBottom: '5px' }}
                                              name={[name, 'toField']}
                                              fieldKey={[fieldKey, 'key']}
                                              rules={[
                                                { required: true, message: '请填写映射字段名' },
                                                {
                                                  validator: () => {
                                                    let aa = formAdd.getFieldsValue().parmars;
                                                    console.log(aa);
                                                    let data = [];
                                                    aa.length > 0 &&
                                                      aa.map(i => {
                                                        if (i) {
                                                          data.push(i.toField);
                                                        }
                                                      });
                                                    let list = new Set(data);
                                                    let ee = form.getFieldsValue().eventOrder;
                                                    if (
                                                      list.size !== data.length ||
                                                      data.indexOf(ee) != -1
                                                    ) {
                                                      return Promise.reject(
                                                        new Error('映射字段名重复'),
                                                      );
                                                    }
                                                    return Promise.resolve();
                                                  },
                                                },
                                              ]}
                                            >
                                              <TreeSelect
                                                showSearch
                                                style={{ width: '208px' }}
                                                dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                                                placeholder="请选择字段名 "
                                                allowClear
                                                treeDefaultExpandAll
                                              >
                                                {standFiledData ? (
                                                  standFiledData.map(i => mapTree2(i))
                                                ) : (
                                                  <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
                                                )}
                                              </TreeSelect>
                                            </Form.Item>
                                            <MinusCircleOutlined
                                              onClick={() => remove(name)}
                                              style={{ marginLeft: '10px', fontSize: '20px' }}
                                            />
                                          </Space>
                                        ))}
                                        <Form.Item>
                                          <Button
                                            style={{ width: '456px', marginLeft: '100px' }}
                                            type="dashed"
                                            onClick={() => add()}
                                            block
                                            icon={<PlusOutlined />}
                                          >
                                            添加映射
                                          </Button>
                                        </Form.Item>
                                      </>
                                    )}
                                  </Form.List>
                                </Form>
                              </>
                            )}

皮倩雯's avatar
皮倩雯 committed
4328
                            {/* <Col span={12}> */}
4329
                            <Item label="SQL过滤" name="filterName" labelCol={{ span: 4 }}>
4330
                              <TextArea placeholder="示例:部门='XX部门'" />
皮倩雯's avatar
皮倩雯 committed
4331 4332 4333 4334
                            </Item>

                            {/* </Col> */}
                            {/* <Col span={2}>
4335
                                <span style={{ marginLeft: '20px' }}>=</span>
4336 4337
                              </Col>
                              <Col span={9}>
4338 4339 4340 4341 4342
                                <Item name="filterValue">
                                  <Input
                                    style={{ width: '89%', marginLeft: '12px' }}
                                    placeholder="请输入过滤条件"
                                  />
4343
                                </Item>
皮倩雯's avatar
皮倩雯 committed
4344
                              </Col> */}
4345 4346 4347 4348 4349
                          </>
                        );
                      case '人员选择器':
                        return (
                          <>
4350
                            <Item labelCol={{ span: 4 }} label="交互方式" name="PeShape">
4351
                              <div style={{ display: 'inline-block', marginRight: '10px' }}>
4352 4353 4354 4355 4356 4357
                                <Radio.Group
                                  style={{ marginTop: '0.3rem' }}
                                  value={popeleShape}
                                  onChange={popeleShapeOnChange}
                                >
                                  <Radio value="下拉框">下拉框</Radio>
4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378
                                  <Radio value="分组模态">
                                    {' '}
                                    <Tooltip
                                      title={
                                        <>
                                          <span>分组模态显示人员所属机构</span>
                                          <Image width={200} src={AllImage} />
                                        </>
                                      }
                                    >
                                      <InfoCircleOutlined
                                        style={{
                                          color: 'rgb(24 144 255)',
                                          marginRight: '5px',
                                          marginTop: '-8px',
                                        }}
                                      />
                                    </Tooltip>
                                    分组模态
                                  </Radio>

4379
                                  {/* <Radio value="树形模态">
4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396
                                    <Tooltip
                                      title={
                                        <>
                                          <span>树形模态显示部门树</span>
                                          <Image width={200} src={TreeImage} />
                                        </>
                                      }
                                    >
                                      <InfoCircleOutlined
                                        style={{
                                          color: 'rgb(24 144 255)',
                                          marginRight: '5px',
                                          marginTop: '-8px',
                                        }}
                                      />
                                    </Tooltip>
                                    树形模态
4397
                                  </Radio> */}
4398 4399 4400
                                </Radio.Group>
                              </div>
                            </Item>
4401
                            <Item labelCol={{ span: 4 }} label="配置">
4402
                              {/* <div style={{ display: 'inline-block', marginRight: '10px' }}>
4403 4404 4405 4406 4407 4408 4409 4410 4411
                                <Item name="All1" style={{ marginBottom: '0' }}>
                                  <Checkbox
                                    checked={checkboxAll1}
                                    onChange={changeAll1}
                                    style={{ marginBottom: '0' }}
                                  >
                                    弹窗
                                  </Checkbox>
                                </Item>
4412
                              </div> */}
4413
                              <div style={{ display: 'inline-block', marginRight: '10px' }}>
皮倩雯's avatar
皮倩雯 committed
4414
                                <Item name="choose" style={{ marginBottom: '0' }}>
4415
                                  <Checkbox
皮倩雯's avatar
皮倩雯 committed
4416 4417
                                    checked={cho}
                                    onChange={changeChoose}
4418 4419
                                    style={{ marginBottom: '0' }}
                                  >
4420
                                    多选
4421 4422 4423
                                  </Checkbox>
                                </Item>
                              </div>
4424
                              <div style={{ display: 'inline-block', marginRight: '10px' }}>
皮倩雯's avatar
皮倩雯 committed
4425
                                <Item name="AllID1" style={{ marginBottom: '0' }}>
4426
                                  <Checkbox
皮倩雯's avatar
皮倩雯 committed
4427 4428
                                    checked={checkboxAllID1}
                                    onChange={changeAllID1}
4429
                                    style={{ marginBottom: '0' }}
4430
                                    // disabled={hide}
4431
                                  >
皮倩雯's avatar
皮倩雯 committed
4432
                                    ID存储
4433 4434
                                  </Checkbox>
                                </Item>
4435
                              </div>
4436 4437 4438 4439 4440 4441 4442
                            </Item>
                            {(() => {
                              switch (flag) {
                                case true:
                                  return (
                                    <>
                                      <Item
4443
                                        label="机构角色"
4444
                                        name="ConfigName"
4445
                                        labelCol={{ span: 4 }}
4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465
                                        rules={[
                                          {
                                            validator: (rule, value) => {
                                              let str = /[.]/g;
                                              if (str.test(form.getFieldValue().ConfigName)) {
                                                return Promise.reject('.作为分隔符,请勿输入');
                                              }
                                              return Promise.resolve();
                                            },
                                          },
                                        ]}
                                      >
                                        <Input
                                          allowClear
                                          placeholder="请输入角色或机构名称"
                                          onChange={inputOnChange}
                                        />
                                      </Item>
                                    </>
                                  );
4466 4467 4468
                                case 1:
                                  return (
                                    <>
4469
                                      <Item label="机构角色" name="guolv" labelCol={{ span: 4 }}>
4470 4471 4472 4473 4474 4475 4476
                                        <Checkbox
                                          checked={gl}
                                          onChange={changeGl}
                                          style={{ marginBottom: '0' }}
                                        >
                                          本人站点
                                        </Checkbox>
4477 4478 4479
                                      </Item>
                                    </>
                                  );
4480 4481 4482 4483
                                case false:
                                  return (
                                    <>
                                      <Item
4484
                                        label="机构角色:"
4485
                                        name="Config"
4486
                                        labelCol={{ span: 4 }}
4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511
                                        rules={[
                                          {
                                            required: true,
                                            message: '请输入角色或机构名称',
                                          },
                                          {
                                            validator: (rule, value) => {
                                              let str = /[.]/g;
                                              if (str.test(form.getFieldValue().Config)) {
                                                return Promise.reject('.作为分隔符,请勿输入');
                                              }
                                              return Promise.resolve();
                                            },
                                          },
                                        ]}
                                      >
                                        <Input
                                          allowClear
                                          placeholder="请输入角色或机构名称"
                                          onChange={inputOnchange}
                                        />
                                      </Item>
                                    </>
                                  );
                              }
4512 4513 4514
                            })()}
                          </>
                        );
4515 4516 4517 4518 4519 4520 4521 4522

                      case '日期时间':
                      case '日期':
                      case '日期月份':
                      case '日期年份':
                      case '日期周':
                      case '时分秒':
                        return (
4523
                          <Item label="选项" name="Config" labelCol={{ span: 4 }}>
4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544
                            <Radio.Group
                              style={{ marginTop: '0.3rem' }}
                              value={timeData}
                              onChange={timeDataOnVChange}
                            >
                              <Radio
                                value="默认为空"
                                style={{ width: '18rem', marginBottom: '0.5rem' }}
                              >
                                默认为空
                              </Radio>
                              <Radio value="默认为当前时间">默认为当前时间</Radio>
                              <Radio value="不可选择" style={{ width: '18rem' }}>
                                锁定为当前时间
                              </Radio>
                              <Radio value="不超过当前时间">不超过当前时间</Radio>
                            </Radio.Group>
                          </Item>
                        );
                      case '坐标控件':
                        return (
4545
                          <Item label="选项" name="Config" labelCol={{ span: 4 }}>
4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556
                            <div>
                              <Checkbox
                                value="当前坐标"
                                style={{ marginRight: '0.2rem' }}
                                checked={pramData.coordinates}
                                onChange={e => onChangeReady(e, 'coordinates')}
                              />
                              锁定为当前位置坐标
                            </div>
                          </Item>
                        );
4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588
                      case '本人姓名':
                        return (
                          <Item name="Config" labelCol={{ span: 4 }} label="配置">
                            <div style={{ display: 'inline-block', marginRight: '10px' }}>
                              <Item name="AllID1" style={{ marginBottom: '0' }}>
                                <Checkbox
                                  checked={checkboxAllID1}
                                  onChange={changeAllID1}
                                  style={{ marginBottom: '0' }}
                                >
                                  ID存储
                                </Checkbox>
                              </Item>
                            </div>
                          </Item>
                        );
                      case '本人部门':
                        return (
                          <Item name="Config" labelCol={{ span: 4 }} label="配置">
                            <div style={{ display: 'inline-block', marginRight: '10px' }}>
                              <Item name="AllID1" style={{ marginBottom: '0' }}>
                                <Checkbox
                                  checked={checkboxAllID1}
                                  onChange={changeAllID1}
                                  style={{ marginBottom: '0' }}
                                >
                                  ID存储
                                </Checkbox>
                              </Item>
                            </div>
                          </Item>
                        );
4589 4590 4591 4592 4593 4594
                      // case '位置坐标':
                      //   return (
                      //     <Item label="字段名称" name="Config" labelCol={{ span: 4 }}>
                      //       <Input allowClear placeholder="请输入坐标位置" />
                      //     </Item>
                      //   );
4595 4596
                      case '视频':
                      case '录音':
4597 4598 4599 4600 4601 4602 4603 4604
                      case '地址':
                      case '城市选择器':
                      case '设备选择':
                      case '区域控件':
                      case '路径控件':
                      case '智能抄表':
                        // case '位置坐标':
                        return <></>;
4605 4606
                      default:
                        return (
4607 4608
                          <Item label="配置" name="Config" labelCol={{ span: 4 }}>
                            <TextArea allowClear placeholder={detail} />
4609 4610 4611 4612
                          </Item>
                        );
                    }
                  })()}
4613
                  {/* </div> */}
4614
                  {Shape === '图片' || Shape === '可预览图片' ? (
4615
                    ''
4616
                  ) : (
4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658
                    <Item labelCol={{ span: 4 }}>
                      {/* <div className={styles.listEvent}> */}
                      <Row>
                        <Col span={12}>
                          <Item label="预设值" labelCol={{ span: 8 }}>
                            <Input
                              // style={{ width: '41%', height: '1.8rem' }}
                              value={pramData.Preset}
                              onChange={e => handleInput(e, 'Preset')}
                              placeholder=""
                              allowClear
                            />
                          </Item>
                        </Col>
                        <Col span={11}>
                          <Item
                            style={{ marginLeft: '1rem' }}
                            label="验证"
                            labelCol={{ span: 7 }}
                            name="ValidationRule"
                          >
                            <Input style={{ width: '92%' }} placeholder="" allowClear />
                          </Item>
                        </Col>
                        <Col span={1}>
                          <Tooltip title="选择验证规则">
                            <PlusSquareOutlined
                              onClick={() => {
                                add1('rule');
                              }}
                              style={{
                                fontSize: '24px',
                                color: '#1890FF',
                                marginTop: '8px',
                                marginLeft: '-3px',
                              }}
                            />
                          </Tooltip>
                        </Col>
                      </Row>
                    </Item>
                  )}
4659

4660
                  {/* <Item label="异常值">
皮倩雯's avatar
皮倩雯 committed
4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717
              <div className={styles.listEvent}>
                <Input
                  style={{ width: '40%', height: '1.8rem' }}
                  value={pramData.ExceptionValue}
                  onChange={e => handleInput(e, 'ExceptionValue')}
                  placeholder=""
                  allowClear
                />
                <Item
                  style={{ marginLeft: '1rem' }}
                  label="触发事件"
                  name="ExceptionEvent"
                  style={{ margin: '0 0 0 1rem' }}
                >
                  <Select style={{ width: '12rem' }} onChange={handleEvent}>
                    {eventList.length
                      ? eventList.map((item, index) => {
                          return (
                            <Select.Option
                              key={index}
                              tablename={item.TableName}
                              name={item.Name}
                              value={item.ID}
                            >
                              {item.Name}
                            </Select.Option>
                          );
                        })
                      : ''}
                  </Select>
                </Item>
              </div>
            </Item>
            <Item label="字段集">
              <div className={styles.listEvent}>
                <Input
                  style={{ width: '93%' }}
                  placeholder=""
                  disabled={!isShow}
                  onChange={onCharacterValue}
                  allowClear
                  value={characterValue}
                />
                <Tooltip title={!isShow ? '' : '字符集选择'}>
                  <PlusSquareOutlined
                    onClick={() => (!isShow ? '' : add('characteristics'))}
                    style={{
                      fontSize: '24px',
                      color: !isShow ? 'gray' : '#1890FF',
                      cursor: !isShow ? 'no-drop' : 'pointer',
                      display: 'flex',
                      alignItems: 'center',
                      marginLeft: '0.5rem',
                    }}
                  />
                </Tooltip>
              </div>
4718
            </Item> */}
4719 4720 4721
                </Form>
              )}
              {/* <ChangeAdd
4722 4723 4724 4725 4726 4727 4728 4729 4730
          visible={visible}
          onCancel={() => setVisible(false)}
          callBackSubmit={onOK}
          newCheckedList={checkedList}
          isType={type}
          filed={filed}
          characterValue={characterValue}
          formObj={formObj}
        /> */}
4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747
              <VerifyModal
                visible={visible}
                onCancel={() => setVisible(false)}
                callBackSubmit={onOK}
                newCheckedList={checkedList}
                isType={type}
                filed={filed}
                characterValue={characterValue}
                formObj={formObj}
              />
            </div>
          ) : (
            <div style={{ margin: '0 auto' }}>
              <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="当前未选中字段" />
            </div>
          )}
        </div>
皮倩雯's avatar
皮倩雯 committed
4748
      </Drawer>
4749 4750 4751 4752 4753 4754 4755 4756
      <RuleConfig
        RuleContent={form.getFieldsValue().configName}
        fieldList={fieldList}
        visible={showRule}
        handleCancel={() => setShowRule(false)}
        onSubumit={e => saveRule(e)}
        flag={2}
      />
皮倩雯's avatar
皮倩雯 committed
4757 4758
    </>
  );
4759 4760
};
export default AddModal;