index.jsx 130.7 KB
Newer Older
徐立's avatar
徐立 committed
1 2
/**
 * 2019年9月22日
3
 * TODO 钟是志 2021年10月20日
徐立's avatar
徐立 committed
4 5
 * 动态表格组件返回对应的组件
 */
钟是志's avatar
钟是志 committed
6 7
import React, { Component, lazy, Suspense } from 'react';

徐立's avatar
徐立 committed
8
import md5 from 'js-md5';
9
import FormModal from './FormModal';
徐立's avatar
徐立 committed
10
import {
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
  Button,
  Cascader,
  Checkbox,
  Col,
  DatePicker,
  Form,
  Icon,
  Input,
  InputNumber,
  message,
  Radio,
  Row,
  Select,
  Switch,
  Table,
26
  Tabs,
徐立's avatar
徐立 committed
27
} from 'antd';
chscls@163.com's avatar
chscls@163.com committed
28
import UUID from 'react-native-uuid';
徐立's avatar
徐立 committed
29
import QRCode from 'qrcode.react';
30
import { Editor } from 'draft-js';
徐立's avatar
徐立 committed
31
import MyBlockRenderer from '../App/MyBlockRender';
钟是志's avatar
钟是志 committed
32 33
// import CronEditor from 'antd-cron-editor'; // 2022年3月17日 按需加载这个组件 钟是志
import { Flex, List as MobileList, Switch as MobileSwitch, List } from 'antd-mobile';
徐立's avatar
徐立 committed
34
import ReactEcharts from 'echarts-for-react';
35
import ZdyTable from '../Table/index';
36
import { connect } from 'dva';
徐立's avatar
徐立 committed
37 38
import UploadCom from '../libs/UploadCom';
import TableSelect from '../libs/TableSelect';
39
import LocationCom from '../libs/LocationCom';
徐立's avatar
徐立 committed
40 41
import MobileDate from '../libs/MobileDate';
import ChildForm from '../libs/ChildForm';
tb53863844's avatar
tb53863844 committed
42
import Neo4jD3Com from '../libs/Neo4jD3Com';
chscls@163.com's avatar
chscls@163.com committed
43
import ImgUploadCom from '../libs/ImgUploadCom';
44
import VideoUploadCom from '../libs/VideoUploadCom';
徐立's avatar
徐立 committed
45 46 47 48
import moment from 'moment';
import router from 'umi/router';
import TableList from '../libs/TableList';
import styles from './style.less';
chscls@163.com's avatar
chscls@163.com committed
49
import config from '@/webPublic/one_stop_public/config';
50
import { cloneDeep, isEmpty, isNaN } from 'lodash';
51
import { queryApiActionPath, queryFileUrl } from '../utils/queryConfig';
徐立's avatar
徐立 committed
52
import Highlighter from 'react-highlight-words';
徐立's avatar
徐立 committed
53
import Signature from '../Signature';
钟是志's avatar
钟是志 committed
54
import { changeToDraftState, deepCopy, preHandle } from '../utils/myutils';
55 56
import { getToken } from '../utils/token';
import { formulaList } from '../excelInitFuc/functionList';
徐立's avatar
徐立 committed
57
import FilePreview from '../filePreview';
chscls@163.com's avatar
chscls@163.com committed
58
import DraftEditorCom from '../App/DraftEditorCom';
徐立's avatar
徐立 committed
59
import MobileItem from './MobileItem';
60
import MobileCascader from './CascaderDiy/MobileCascader';
61 62 63 64 65 66
import {
  equal,
  errorHandler,
  getBase64,
  getRender,
  isJSON,
钟是志's avatar
钟是志 committed
67
  ShowComName,
68
} from './Split_Index/staticInfo';
钟是志's avatar
钟是志 committed
69
import PictureSignature, {
70
  SignArray,
钟是志's avatar
钟是志 committed
71
} from '@/webPublic/one_stop_public/libs/PictureSignature/PictureSignature';
72
import WangEditor from '@/webPublic/zyd_public/WangEditor/OnstopWang';
73
import MobileCard from './Split_Index/MobileCard/index';
74
import { noPrefixRequest, uaaRequest } from '@/webPublic/one_stop_public/utils/request';
75 76 77
import RangePickerDiy, {
  getMomentArr,
} from '@/webPublic/one_stop_public/tableCompon/Split_Index/RangePickerDiy';
钟是志's avatar
钟是志 committed
78
import getActiveJson from '@/webPublic/one_stop_public/Table/getActiveJson';
79
import getOneStopUploadUrl from '@/webPublic/one_stop_public/Base16/getOneStopUploadUrl';
80
import SwitchWeb from '@/webPublic/one_stop_public/tableCompon/Split_Index/SwitchWeb';
钟是志's avatar
钟是志 committed
81
import CronEditorDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/CronEditorDiy/index';
82
import ButtonDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/ButtonDiy';
83 84
import giveVarcharRules from '@/webPublic/one_stop_public/tableCompon/Split_Index/giveVarcharLength';
import getPopupContainer from '@/webPublic/one_stop_public/tableCompon/Split_Index/getPopupContainer';
85
import StepDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/StepDiy';
86
import EchartsDiy from '@/webPublic/one_stop_public/tableCompon/Split_Index/EchartsDiy';
87 88 89 90 91 92 93 94 95 96
import { getServicesNomal } from '../Services/services';
import {
	getHeaderListApi,
  getSqlDataApi,
  findApi,
  getSqlOptionsApi,
  getSqlLabelsApi,
  getLabelsApi,
  getOptionsApi,
} from '../Services/apiConfig';
97 98 99
/**
 * 日期组件antd3.x有bug 详情见禅道 27152 毕业跟踪调查管理 毕业时间改为年级筛选
 */
100 101
const { TextArea } = Input;
const { Option } = Select;
徐立's avatar
徐立 committed
102

103
const giveRender = (column = {}) => {
104 105 106 107 108 109 110 111 112 113
  if (!column?.render) {
    // 超过30个字的字段 自动隐藏
    column.render = (text, record) => {
      if (text && typeof text === 'string' && text.length > 30) {
        return <span title={text}>{text.slice(0, 30)}</span>;
      }
      return text;
    };
  }
  return column;
钟是志's avatar
钟是志 committed
114
};
115

116
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
117 118 119 120
  DataColumn,
  SqlManageEntity,
  formList,
  loading: loading.models.DataColumn || loading.models.SqlManageEntity || loading.models.formList,
徐立's avatar
徐立 committed
121
}))
122
export default class TableCom extends Component {
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
  constructor(props) {
    super(props);
    this.state = {
      options: this.props.options || [],
      labels: [],
      url: null,
      selectDis: true, // 让下拉框在获取到数据前失效,防止网络卡顿用户点击时造成页面白屏
      isDate: true, // 避免重复调用
      sqlKeys: {},
      searchText: '',
      reqUrls: {},
      res: null,
      option: {},
      sqlModel: {},
      columns: [],
      sqlContent: null,
      modalProps: {},
      modalTitle: '',
      modalInit: {},
      modalCode: null,
143
      getSqlOptionsCache: '', // fetchData3 函数参数做缓存 防止重复请求接口 禅道28017
144 145 146 147 148 149
      dataSource: {
        list: [],
        pagination: false,
      },
    };
    this.excludeKeys = ['defaultValues', ''];
150 151 152 153 154 155 156 157
    this.otherProps = {};
    if(props.json?.otherProps){
      try {
        this.otherProps = new Function(props.json?.otherProps)();
      }catch (e) {

      }
    }
158 159 160 161 162 163 164 165 166 167 168 169
  }

  closeModal = (fk, callback) => {
    const { dispatch } = this.props;
    const x = this.props.DataColumn.isShowModal;
    x[fk] = false;
    dispatch({
      type: 'DataColumn/showModal',
      payload: { isShowModal: x },
      callback: callback,
    });
  };
170

171
  changeTabsActiveKey = activeKey => {
172 173 174 175 176
    this.setState({
      activeKey,
    });
  };

177 178 179 180 181
  showModal = (fk, title, data, modalProps) => {

    const { dispatch } = this.props;
    const x = this.props.DataColumn.isShowModal;
    x[fk] = true;
182 183 184 185 186
    this.setState(
      {
        modalInit: data,
      },
      () => {
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201
        setTimeout(() => {
          // 解决禅道 31435 勤工助学(新)/工作情况考核,20219001028 批次设置的时间没有受控制 看下
          dispatch({
            type: 'DataColumn/showModal',
            payload: { isShowModal: x },
            callback: () => {
              this.setState({
                modalTitle: title,
                modalCode: fk,
                modalProps: modalProps,
              });
            },
          });
        }, 300);

202 203
      },
    );
204 205 206 207 208 209 210 211
  };

  /**
   * 上传文件输入
   * 使用antd上传组件
   */
  file = {
    name: 'file',
212
    action: getOneStopUploadUrl(),
213
    onChange: info => {
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
      if (info.file.status !== 'uploading') {
        this.setState({
          img: info.file.response,
        });
      }
      if (info.file.status === 'done') {
        message.success(`图像添加成功,如需保存请点击保存`);
      } else if (info.file.status === 'error') {
        message.error(`图像添加失败.`);
      }
    },
  };
  obj = {};
  childObj = {};
  count = [];
  handleSearch = (selectedKeys, confirm) => {
    confirm();
    this.setState({ searchText: selectedKeys[0] });
  };

234
  handleReset = clearFilters => {
235 236 237 238 239 240 241 242 243 244 245
    clearFilters();
    this.resetSearchText();
  };

  resetSearchText = () => {
    this.setState({
      searchText: '',
    });
  };

  getColumnSearchProps = (dataIndex, title) => ({
246
    filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
247 248
      <div style={{ padding: 8 }}>
        <Input
249
          ref={node => {
250 251 252 253
            this.searchInput = node;
          }}
          placeholder={`请输入${title}`}
          value={selectedKeys[0]}
254
          onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
255 256 257 258 259 260 261 262
          onPressEnter={() => this.handleSearch(selectedKeys, confirm)}
          style={{
            width: 188,
            marginBottom: 8,
            display: 'block',
          }}
        />
        <Button
263
          type="primary"
264
          onClick={() => this.handleSearch(selectedKeys, confirm)}
265
          icon="search"
266
          loading={this.props.loading}
267
          size="small"
268 269 270
          style={{
            width: 90,
            marginRight: 8,
271 272
          }}
        >
273 274 275 276 277
          搜索
        </Button>
        <Button
          loading={this.props.loading}
          onClick={() => this.handleReset(clearFilters)}
278
          size="small"
279 280
          style={{ width: 90 }}
        >
281 282 283 284
          重置
        </Button>
      </div>
    ),
285
    filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }} />,
286 287 288
    onFilter: (value, record) =>
      record[dataIndex]
        ? record[dataIndex]
289 290 291
            .toString()
            .toLowerCase()
            .includes(value.toLowerCase())
292
        : '',
293
    onFilterDropdownVisibleChange: visible => {
294 295 296 297
      if (visible) {
        setTimeout(() => this.searchInput.select());
      }
    },
298
    render: text => {
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
      if (text != null) {
        return (
          <Highlighter
            highlightStyle={{
              backgroundColor: '#ffc069',
              padding: 0,
            }}
            searchWords={[this.state.searchText]}
            autoEscape
            textToHighlight={text.toString()}
          />
        );
      } else {
        return '';
      }
    },
  });
  searchJson = (value, json, level, labs) => {
    if (!json || !Array.isArray(json) || !json.length || !value) {
      // console.log('下拉级联组件数据错误 没得值', value);
      return;
    }
    for (var i = 0; i < json.length; i++) {
      if (!!value && json[i].value == value[level]) {
        labs.push(json[i].label);
        if (json[i].children) {
          this.searchJson(value, json[i].children, level + 1, labs);
        }
        break;
      }
    }
  };

  componentWillReceiveProps(props) {
333
    const { json, mapData, obj } = props;
334 335 336 337
    if (json == null || this.props.safe) {
      return;
    }
    if (
338
      !(this.dataFilter.includes(json.comName) || json.comName === 'TableSelect') &&
339 340 341 342 343 344 345
      json.isFormulaOnce
    ) {
      return;
    }
    if (
      !(
        this.dataFilter.includes(json.comName) ||
346
        json.comName === 'TableSelect' ||
347
        !!json.formula
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
      )
    ) {
      return;
    }
    const obj2 = props.form.getFieldsValue();
    const bb = equal(this.obj, obj2, json, this.state.sqlContent, 1, this.props, this.excludeKeys);
    let bb2 = true;
    let childObj2 = {};
    if (props.fatherCode) {
      if (obj2 != null && obj2[props.fatherCode]) {
        childObj2 = obj2[props.fatherCode][props.index];

        bb2 = equal(
          this.childObj,
          childObj2,
          json,
          this.state.sqlContent,
          1,
          this.props,
          this.excludeKeys,
        );
      }
    }

    if (!(bb && bb2)) {
      const now = new Date().valueOf();

      let j = 0;
      for (var i = 0; i < this.count.length; i++) {
        if (now - this.count[i] < 1000) {
          break;
        } else {
          j = i;
        }
      }

      if (j > 0) {
        this.count.splice(0, j);
      }
      if (this.count.length > 10) {
        console.log(
          `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props
            .i + 1}行,第${this.props.j +
391
            1}列:存在循环风险,1秒内执行超过10次,现已停止执行,请检查,`,
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412
        );

        return;
      }
      if (!bb) {
        this.obj = cloneDeep(obj2);
      }
      if (!bb2) {
        this.childObj = cloneDeep(childObj2);
      }
      this.count.push(now);
    } else {
      return;
    }

    const bindObj = this.getColumn('c1');

    let dataColumn =
      this.props.fatherCode != null
        ? bindObj
          ? {
413 414 415
              ...bindObj,
              base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
            }
416 417 418 419 420 421 422 423 424 425 426 427 428
          : { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
        : bindObj;
    if (this.props.fatherCode == null && dataColumn == null) {
      dataColumn = { base52: this.props.uuid };
    }

    if (!this.props.isEdit && this.props.fatherCode) {
      if (bindObj != null) {
        dataColumn.base52 = bindObj.base52;
      } else {
        dataColumn.base52 = this.props.uuid;
      }
    }
429 430 431 432
    // if(this.props.uuid === 'id_44cd90f124abc2427428ee2285222628953f'){
    //   console.log('我去调接口查枚举了');
    //
    // }
433
    if (this.dataFilter.includes(json.comName) || json.comName === 'TableSelect') {
434 435 436
      const obj2 = {
        ...obj,
        ...props.defaultValues[this.props.formKey],
437
        ...props.form.getFieldsValue(),
438 439 440
      };
      this.getData(json, dataColumn, obj2);
    }
441
    if (!!json.formula && !json.isFormulaOnce) {
442 443 444 445 446 447 448
      this.getFunctionValue(json.formula, dataColumn, json);
    }
  }

  dataFilter = ['Select', 'Radio', 'Checkbox', 'Cascader'];

  getData = (json, dataColumn, obj, init) => {
449
    const { formKey, uuid } = this.props;
450 451 452 453 454
    let jsonStatic = json;
    json = {
      ...jsonStatic,
      ...getActiveJson(formKey, uuid),
    };
455 456 457 458
    let allValues = deepCopy(obj);
    preHandle(allValues);
    allValues = JSON.stringify(allValues);
    if (json.comName === 'TableSelect') {
459
      const { sqlKey, optionType } = json;
460
      if (optionType === 'sql') {
461 462 463 464 465
        getServicesNomal(findApi, { sqlKey }).then(sqlModel => {
          this.setState({ sqlModel });
          if (sqlModel.dataObjId) {
            getServicesNomal(getHeaderListApi, { dataObjId: sqlModel.dataObjId }).then(datas => {
              if (datas) {
466
                const columns = [];
467 468 469 470 471 472 473 474 475
                for (var i = 0; i < datas.length; i++) {
                  if (i <= json.colNum ? json.colNum : 10) {
                    let column = {};
                    column.title = datas[i].title;
                    column.dataIndex = datas[i].name;
                    if (
                      ['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)
                    ) {
                      column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
476 477
                    }

478
                    column = giveRender(column);
479

480 481 482 483
                    columns.push(column);
                  } else {
                    break;
                  }
484 485 486
                }
                this.setState({ columns });
              }
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
            });
          } else {
            const cols = sqlModel.cols;
            if (cols != null || cols.length > 0) {
              const columns = [];
              const cll = JSON.parse(cols);
              for (var k in cll) {
                let column = {};
                column.title = cll[k].title;
                column.dataIndex = cll[k].name;
                if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(cll[k].type)) {
                  var ff = 'YYYY-MM-DD HH:mm:ss';
                  switch (cll[k].type) {
                    case 'DATE':
                      ff = 'YYYY-MM-DD';
                      break;
                    case 'YEAR':
                      ff = 'YYYY';
                      break;
                    case 'TIME':
                      ff = 'HH:mm:ss';
                      break;
                  }

                  column.render = val => moment(parseInt(val)).format(ff);
                }
                if (cll[k].isQuery) {
                  column = {
                    ...this.getColumnSearchProps(cll[k].name, cll[k].title),
                    ...column,
517
                  };
518 519 520 521 522 523 524
                }

                column = giveRender(column);

                columns.push(column);
              }
              this.setState({ columns });
525
            }
526 527 528 529 530 531 532 533 534 535 536 537
            getServicesNomal(getSqlDataApi, {
              sqlKey,
              allValues,
              isCache: this.otherProps?.isCache || false,
            }).then(list => {
              const x = {
                list: list,
                pagination: false,
              };
              this.setState({ dataSource: x });
            });
          }
538 539
        });
      } else if (optionType == 'reference' && dataColumn.referenceObjId) {
540 541 542 543 544 545 546 547 548 549
        getServicesNomal(getHeaderListApi, { dataObjId: dataColumn.referenceObjId }).then(datas => {
          if (datas) {
            const columns = [];
            for (var i = 0; i < datas.length; i++) {
              if (i <= json.colNum ? json.colNum : 10) {
                let column = {};
                column.title = datas[i].title;
                column.dataIndex = datas[i].name;
                if (['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)) {
                  column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
550
                }
551 552 553 554
                column = giveRender(column);
                columns.push(column);
              } else {
                break;
555 556
              }
            }
557 558
            this.setState({ columns });
          }
559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
        });
      }
    }

    if (json.optionType != null && this.dataFilter.includes(json.comName)) {
      // 获取 下拉枚举值
      switch (json.optionType) {
        case 'reference':
          if (dataColumn.referenceObjId != null) {
            this.fetchData(obj, dataColumn, init, json.filterSql, allValues);
          }
          break;
        case 'enum':
          if (json.enums != null && json.enums != '') {
            var enu;
            try {
              enu = JSON.parse(json.enums);
            } catch (e) {
              message.error('枚举json格式存在问题');
              enu = [];
            }

            this.changeEnum(obj, dataColumn, enu);
          }
          break;
        case 'sql':
钟是志's avatar
钟是志 committed
585
          if (json.sqlKey != null && !!json.sqlKey) {
586
            this.fetchData3(obj, dataColumn, init, json, allValues);
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 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
          }
          break;
        case 'func':
          if (json.funcs != null && json.funcs != '') {
            if (json.comName == 'Cascader') {
              try {
                this.getFunctionValue(json.funcs, { base52: this.props.uuid }, json, () => {
                  if (init != null && Object.keys(init).length > 0) {
                    let base52 = dataColumn.base52;
                    let vlu = this.props.form.getFieldsValue()[base52];
                    const labs = [];
                    this.searchJson(vlu, this.state.options, 0, labs);

                    this.setState({ labels: labs });
                  } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
                    let base52 = dataColumn.base52;

                    const vlu = obj[base52];

                    const labs = [];
                    this.searchJson(vlu, this.state.options, 0, labs);
                    this.setState({ labels: labs });
                  }
                });
              } catch (e) {
                message.error('公式选项配置存在问题');
              }
            } else {
              try {
                this.getFunctionValue(json.funcs, { base52: this.props.uuid }, json, () => {
                  if (init != null && Object.keys(init).length > 0) {
                    let base52 = dataColumn.base52;
                    let vlu = this.props.form.getFieldsValue()[base52];
                    const labs = [];
                    if (vlu instanceof Array) {
                      for (var i = 0; i < this.state.options.length; i++) {
                        if (vlu.includes(this.state.options[i].value)) {
                          labs.push(this.state.options[i].label);
                        }
                      }
                    } else {
                      for (var i = 0; i < this.state.options.length; i++) {
                        if (vlu == this.state.options[i].value) {
                          labs.push(this.state.options[i].label);
                          break;
                        }
                      }
                    }

                    this.setState({ labels: labs });
                  } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
                    let base52 = dataColumn.base52;

                    const vlu = obj[base52];

                    const labs = [];
                    if (vlu instanceof Array) {
                      for (var i = 0; i < this.state.options.length; i++) {
                        if (vlu.includes(this.state.options[i].value)) {
                          labs.push(this.state.options[i].label);
                        }
                      }
                    } else {
                      for (var i = 0; i < this.state.options.length; i++) {
                        if (vlu == this.state.options[i].value) {
                          labs.push(this.state.options[i].label);
                          break;
                        }
                      }
                    }

                    this.setState({ labels: labs });
                  }
                });
              } catch (e) {
                message.error('公式选项配置存在问题');
              }
            }
          }
          break;
      }
    }
  };

  setValues = (base52, json, values) => {
    try {
      this.props.form.setFieldsValue(values);
    } catch (e) {
      console.log(
        `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i +
677
          1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723
        e,
      );
    }
    if (!this.props.isEdit) {
      if (this.props.setRealTimeValues) {
        this.props.setRealTimeValues(values);
      }
    }
  };
  reqUtil = (base52, json, orgCallback, url, method, params, callback, options = {}) => {
    //查缓存
    var isChange = true;
    if (url.indexOf('http') === -1) {
      url = config.httpServer + url;
    }
    const { reqUrls } = this.state;
    if (reqUrls[url] != null) {
      const ps = reqUrls[url].params;

      if (Object.keys(params).length != Object.keys(ps).length) {
        isChange = true;
      } else {
        for (var key in params) {
          if (params[key] == null && ps[key] != null) {
            isChange = true;
            break;
          } else if (params[key] != null && ps[key] == null) {
            isChange = true;
            break;
          } else {
            if (params[key] != ps[key]) {
              isChange = true;
              break;
            }
          }
        }
      }
    } else {
      reqUrls[url] = { params: params };
      isChange = true;
    }

    if (!isChange) {
      if (callback) {
        const data = reqUrls[url].data;

724
        if (json.optionType && json.optionType === 'func') {
725 726 727 728 729 730 731 732 733 734 735 736 737
          const res = callback(data);

          if (res != null && !(typeof res === 'function')) {
            this.setState(
              {
                options: res,
                selectDis: false,
              },
              () => {
                if (orgCallback) orgCallback();
              },
            );
          }
738
        } else if (json.comName === 'Button') {
739 740 741 742 743 744 745 746 747 748
          try {
            callback(data);
          } catch (e) {
            console.log(
              `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
              e,
            );
            //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
          }
749
        } else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765
          try {
            const x = callback(data);
            if (x != null) {
              this.setState({ option: x });
            }
          } catch (e) {
            console.log(
              `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
              e,
            );
          }
        } else {
          if (base52) {
            try {
              const x = callback(data);
766

767 768 769 770
              if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
            } catch (e) {
              console.log(
                `页面${this.props.formKey} ${json.comName}${this.props.i + 1}行,第${this.props.j +
771
                  1}列:公式配置有误,回调函数内部错误,`,
772 773 774 775 776 777 778 779 780 781 782 783 784 785
                e,
              );
            }
          }
        }
      }
      return 'norefeshxxxxxxxxxxxxxxxxxxxx';
    }

    for (let i in params) {
      if (params[i] == null) {
        delete params[i];
      }
    }
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828
    noPrefixRequest(url, params).then(data => {
      // if (!data || !Array.isArray(data)) {
      // 	data = [];
      // }
      const { reqUrls } = this.state;
      if (reqUrls && reqUrls[url]) {
        reqUrls[url].data = data;
      }
      this.setState(
        {
          res: data,
          reqUrls,
        },
        () => {
          if (callback) {
            if (json.optionType && json.optionType == 'func') {
              const res = callback(data);
              if (res != null && !(typeof res === 'function')) {
                this.setState(
                  {
                    options: res,
                    selectDis: false,
                  },
                  () => {
                    if (orgCallback) orgCallback();
                  },
                );
              }
            } else if (json.comName == 'Button') {
              try {
                callback(data);
              } catch (e) {
                console.log(
                  `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                    .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
                  e,
                );
              }
            } else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
              try {
                const x = callback(data);
                if (x != null) {
                  this.setState({ option: x });
829
                }
830 831 832 833 834 835 836 837 838
              } catch (e) {
                console.log(
                  `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                    .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
                  e,
                );
              }
            } else {
              if (base52) {
839 840
                try {
                  const x = callback(data);
841

842
                  if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
843 844
                } catch (e) {
                  console.log(
845 846 847 848
                    `页面${this.props.currentFormTitle} ${this.props.formKey} ${
                      json.comName
                    }${this.props.i + 1}行,第${this.props.j +
                      1}列:公式配置有误,回调函数内部错误,`,
849 850 851 852 853
                    e,
                  );
                }
              }
            }
854 855 856 857
          }
        },
      );
    });
858 859 860

    return 'norefeshxxxxxxxxxxxxxxxxxxxx';
  };
钟是志's avatar
钟是志 committed
861 862
  sqlUtil = (base52, json, orgCallback, sqlKey, params, p1, p2, p3) => {
    let callback = p1;
钟是志's avatar
钟是志 committed
863
    let options = typeof p2 === 'undefined' ? {} : p2;
钟是志's avatar
钟是志 committed
864
    let otherParams = {};
钟是志's avatar
钟是志 committed
865 866 867 868 869
    if (p1 && typeof p1 === 'object') {
      callback = p2;
      otherParams = p1;
      options = p3 || {};
    }
870
    //查缓存
871

872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889
    var isChange = false;
    const { sqlKeys } = this.state;

    if (sqlKeys[sqlKey] != null) {
      const ps = sqlKeys[sqlKey].params;

      if (params.length != ps.length) {
        isChange = true;
      } else {
        for (var i = 0; i < params.length; i++) {
          if (params[i] != ps[i]) {
            isChange = true;
            break;
          }
        }
      }
      if (!isChange) {
        const os = sqlKeys[sqlKey].options;
钟是志's avatar
钟是志 committed
890 891
        if (JSON.stringify(options) !== JSON.stringify(os)) {
          sqlKeys[sqlKey].options = options;
892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911
          isChange = true;
        } else {
          for (var k in options) {
            if (os[k] == null || options[k] != os[k]) {
              isChange = true;
              break;
            }
          }
        }
      }
    } else {
      sqlKeys[sqlKey] = {
        params: params,
        options: options,
      };
      isChange = true;
    }
    if (!isChange) {
      if (callback) {
        const data = sqlKeys[sqlKey].data;
912
        if (json.optionType && json.optionType === 'func') {
913 914 915 916 917 918 919 920 921 922 923 924
          const res = callback(data);
          if (res != null && !(typeof res === 'function')) {
            this.setState(
              {
                options: res,
                selectDis: false,
              },
              () => {
                if (orgCallback) orgCallback();
              },
            );
          }
925
        } else if (json.comName === 'Button') {
926 927 928 929 930 931 932 933 934
          try {
            callback(data);
          } catch (e) {
            console.log(
              `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
              e,
            );
          }
935
        } else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951
          try {
            const x = callback(data);
            if (x != null) {
              this.setState({ option: x });
            }
          } catch (e) {
            console.log(
              `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
              e,
            );
          }
        } else {
          if (base52) {
            try {
              const x = callback(data);
952

953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974
              if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
            } catch (e) {
              console.log(
                `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                  .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
                e,
              );
            }
          }
        }
      }
      return 'norefeshxxxxxxxxxxxxxxxxxxxx';
    }

    const url = '/DataColumnApi/getSqlData';
    this.setState({ sqlKeys }, () => {
      const allValues = JSON.stringify({
        ...this.props.obj,
        ...this.props.form.getFieldsValue(),
        ...this.props.defaultValues[this.props.formKey],
        ...options,
      });
975

976 977 978 979
      let pp = {
        sqlKey,
        params,
        allValues,
980
        ...otherParams,
981 982 983 984
      };
      if (getToken() != null) {
        pp.token = getToken();
      }
985 986 987 988 989 990 991
      uaaRequest(url, pp).then(data => {
        const { sqlKeys } = this.state;
        sqlKeys[sqlKey].data = data;
        this.setState({ sqlKeys });
        if (data == null) {
          return;
        }
992

993 994 995
        if (callback) {
          if (json.optionType && json.optionType === 'func') {
            const res = callback(data);
996

997 998 999 1000 1001 1002 1003 1004 1005 1006 1007
            if (res != null && !(typeof res === 'function')) {
              this.setState(
                {
                  options: res,
                  selectDis: false,
                },
                () => {
                  if (orgCallback) orgCallback();
                },
              );
            }
钟是志's avatar
钟是志 committed
1008
          } else if (['Button', 'MobileCard'].includes(json.comName)) {
1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022
            try {
              callback(data);
            } catch (e) {
              console.log(
                `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                  .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
                e,
              );
            }
          } else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
            try {
              const x = callback(data);
              if (x != null) {
                this.setState({ option: x });
1023
              }
1024 1025 1026 1027 1028 1029 1030 1031 1032
            } catch (e) {
              console.log(
                `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                  .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
                e,
              );
            }
          } else {
            if (base52) {
1033 1034
              try {
                const x = callback(data);
1035 1036
                // console.log(x, 938);
                if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
1037 1038 1039 1040 1041 1042 1043 1044 1045
              } catch (e) {
                console.log(
                  `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                    .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误,`,
                  e,
                );
              }
            }
          }
1046 1047
        }
      });
1048 1049 1050 1051 1052
    });

    return 'norefeshxxxxxxxxxxxxxxxxxxxx';
  };

钟是志's avatar
钟是志 committed
1053 1054 1055 1056 1057 1058 1059
  getObjValues = () => {
    const { isEdit, fatherObj, defaultValues, formKey, form, fatherCode } = this.props;
    let obj = {};
    if (!isEdit && fatherCode) {
      obj = {
        ...fatherObj,
        ...defaultValues[formKey],
1060
        ...form.getFieldsValue(),
钟是志's avatar
钟是志 committed
1061 1062 1063 1064 1065 1066
      };
    } else {
      obj = {
        ...(fatherObj ? fatherObj : {}),
        ...this.props.obj,
        ...defaultValues[formKey],
1067
        ...form.getFieldsValue(),
钟是志's avatar
钟是志 committed
1068 1069 1070
      };
    }
    return obj;
1071
  };
钟是志's avatar
钟是志 committed
1072

1073
  functionArguments = (column, callback) => {
1074
    const base52 = column.base52;
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105
    const {
      json: jsonStatic,
      isEdit,
      fatherCode,
      form,
      defaultValues,
      formKey,
      fatherObj,
      init,
      modalInit,
      get,
      formCode,
      taskAssignee,
      formId,
      userId,
      taskId,
      index,
      uuid,
      importExcel,
      routerState,
      messageData,
      concealModel,
    } = this.props;
    let json = jsonStatic;
    if (json) {
      json = {
        ...jsonStatic,
        ...getActiveJson(formKey, uuid),
      };
    }

钟是志's avatar
钟是志 committed
1106
    let obj = this.getObjValues();
1107 1108 1109 1110 1111 1112

    /**
     * 中台函数库注入
     * 动态生成表单配置函数所使用
     */
    let functionObj = {};
1113 1114
    formulaList.map(item => {
      item.children.map(arr => {
1115 1116 1117
        functionObj[arr.callKey] = arr.function;
      });
    });
1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160
    /**
     * 中台函数库注入
     * 动态生成表单配置函数所使用
     */

    return {
      obj: obj,
      init: init,
      modalInit: modalInit,
      defaultValues: defaultValues,
      env: {
        clientType: get,
        formCode: formCode,
        formId: formId,
        isEdit: isEdit,
        taskAssignee: taskAssignee,
        userId: userId,
        taskId: taskId,
      },
      index,
      fatherCode: fatherCode,
      utils: {
        moment,
        sql: this.sqlUtil.bind(this, base52, json, callback), // utils.sql xxx
        message,
        importExcel: importExcel,
        router: router,
        uuid: UUID,
        setValues: this.setValues.bind(this, base52, json),
        req: this.reqUtil.bind(this, base52, json, callback),
        md5,
        showModal: this.showModal,
        closeModal: this.closeModal,
        render: getRender,
        base64: getBase64,
        form: form,
        preHandle,
      },
      functionObj,
      routerState,
      messageData,
      concealModel,
    };
1161
  };
1162 1163 1164 1165 1166

  getFunctionValue = (fun, column, json, callback) => {
    if (this.props.safe) return;
    const base52 = column.base52;

1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182
    try {
      var fun1 = new Function(
        'obj',
        'init',
        'modalInit',
        'defaultValues',
        'env',
        'index',
        'fatherCode',
        'utils',
        '$',
        'routerState',
        'shareData',
        'sceneRouter',
        fun,
      );
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196
      const {
        obj,
        init,
        modalInit,
        defaultValues,
        env,
        index,
        fatherCode,
        utils,
        routerState,
        concealModel,
        messageData,
        functionObj,
      } = this.functionArguments(column, callback);
1197
      // console.log(obj.id_4f1c72d949e7, 'getFunctionValue');
1198 1199
      const value = fun1(
        obj,
1200 1201 1202 1203 1204 1205 1206
        init,
        modalInit,
        defaultValues,
        env,
        index,
        fatherCode,
        utils,
1207
        functionObj,
1208 1209 1210
        routerState,
        messageData,
        concealModel,
1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234
      );
      if (base52) {
        if (value != null && value == 'norefeshxxxxxxxxxxxxxxxxxxxx') {
        } else {
          /**
           * 会出现重复调用2次,然后NAN造成无限循环
           */
          if (isNaN(value)) {
            return;
          }
          if (json.comName == 'Button') {
            return value;
          } else if (json.optionType && json.optionType == 'func') {
            if (value != null && !(typeof value === 'function')) {
              this.setState(
                {
                  options: value,
                  selectDis: false,
                },
                () => {
                  if (callback) callback();
                },
              );
            }
1235
          } else if (['Echart', 'QRCode', 'Graph', 'Tabs'].includes(json.comName)) {
1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252
            this.setState({ option: value });
          } else {
            try {
              this.props.form.setFieldsValue({ [base52]: value });
            } catch {
              console.log(
                `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this
                  .props.i + 1}行,第${this.props.j + 1}列:公式配置有误,函数内部错误,`,
                e,
              );
            }
          }
        }
      }
    } catch (e) {
      console.log(
        `页面${this.props.currentFormTitle} ${this.props.formKey} ${json.comName}${this.props.i +
1253
          1}行,第${this.props.j + 1}列:公式配置有误,暂存失败,`,
1254 1255 1256 1257 1258 1259
        e,
      );
    }
  };

  componentDidMount() {
1260
    const { json, mapData, obj, init } = this.props;
1261 1262 1263
    if (json == null) {
      return;
    }
1264
    if (json.sqlKey != null && json.sqlKey !== '') {
1265 1266 1267
      getServicesNomal(findApi, { sqlKey: json.sqlKey }).then(res => {
        this.setState({ sqlContent: res.sql });
      })
1268 1269 1270 1271 1272 1273 1274 1275
    }

    const bindObj = this.getColumn('c1');

    let dataColumn =
      this.props.fatherCode != null
        ? bindObj
          ? {
1276 1277 1278
              ...bindObj,
              base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
            }
1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292
          : { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
        : bindObj;
    if (this.props.fatherCode == null && dataColumn == null) {
      dataColumn = { base52: this.props.uuid };
    }

    if (!this.props.isEdit && this.props.fatherCode) {
      if (bindObj != null) {
        dataColumn.base52 = bindObj.base52;
      } else {
        dataColumn.base52 = this.props.uuid;
      }
    }

1293 1294 1295 1296 1297
    const obj2 = {
      ...obj,
      ...this.props.form.getFieldsValue(),
      ...this.props.defaultValues[this.props.formKey],
    };
1298
    // console.log(obj.id_4f1c72d949e7, 'tableCom-1295',);
1299 1300

    this.getData(json, dataColumn, obj2);
1301 1302 1303 1304 1305
    if (json.formula != null && json.formula != '' && !this.props.safe) {
      this.getFunctionValue(json.formula, dataColumn, json);
    }
  }

钟是志's avatar
钟是志 committed
1306
  fetchData3 = (obj, dataColumn, init, json, allValues) => {
1307
    const { sqlKey, labelName, valueName, isMeta, filterSql } = json;
1308

1309
    // debugger;
1310 1311
    if (isMeta) {
      // 2022年7月5日 2022 姚鑫国说的 如果是元数据 不需要传这个allValues
1312 1313 1314
      // 解决禅道bug 28017
      allValues = {};
    }
1315
    if (init != null && Object.keys(init).length > 0) {
1316 1317 1318 1319 1320
      const params = {
        sqlKey,
        allValues,
        isMeta,
        filterSql: isMeta ? filterSql || '' : undefined,
钟是志's avatar
钟是志 committed
1321
      };
1322
      let getSqlOptionsCache = JSON.stringify(params);
1323 1324
      if (isMeta && getSqlOptionsCache === this.state.getSqlOptionsCache) {
        // 当上次的请求参数和这次的相同时 不再发起请求
1325 1326 1327
        return false;
      }

1328

1329

1330 1331 1332 1333 1334 1335 1336 1337
      getServicesNomal(getSqlOptionsApi, params).then(options => {
        const optionsx = [];
        let base52 = dataColumn.base52;
        let vl = this.props.form.getFieldsValue()[base52];
        let isExist = false;
        for (var i = 0; i < options.length; i++) {
          if (vl == options[i][valueName] && !isExist) {
            isExist = true;
1338
          }
1339 1340 1341
          optionsx.push({
            label: options[i][labelName],
            value: options[i][valueName],
1342
          });
1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353
        }

        if (!isExist && vl != null && options.length > 0) {
          // console.log(base52, 1144);
          this.props.form.setFieldsValue({ [base52]: null });
        }
        this.setState({
          getSqlOptionsCache,
          options: optionsx,
          selectDis: false,
        });
1354 1355 1356 1357 1358 1359 1360
      });
    } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
      let base52 = dataColumn.base52;
      if (this.props.fatherCode) {
        const x = base52.split('.');
        base52 = x[x.length - 1];
      }
1361 1362 1363 1364 1365 1366 1367 1368

      const params = {
        sqlKey,
        values: obj[base52],
        labelName,
        valueName,
        allValues,
        isMeta,
钟是志's avatar
钟是志 committed
1369
      };
1370 1371

      let getSqlOptionsCache = JSON.stringify(params);
1372 1373
      if (isMeta && getSqlOptionsCache === this.state.getSqlOptionsCache) {
        // 当上次的请求参数和这次的相同时 不再发起请求
1374 1375 1376
        return false;
      }

1377
      if (obj[base52]) {
1378 1379 1380 1381 1382 1383 1384
        getServicesNomal(getSqlLabelsApi, params).then(labels => {
          this.setState({
            getSqlOptionsCache,
            labels,
            selectDis: false,
          });
        })
1385 1386
      }
    } else {
1387 1388 1389 1390 1391 1392 1393 1394
      const params = {
        sqlKey,
        allValues,
        isMeta,
        filterSql: isMeta ? filterSql || '' : undefined,
      };
      // console.log('1332', this.state.getSqlOptionsCache, JSON.stringify(params));
      let getSqlOptionsCache = JSON.stringify(params);
1395 1396
      if (isMeta && getSqlOptionsCache === this.state.getSqlOptionsCache) {
        // 当上次的请求参数和这次的相同时 不再发起请求
1397 1398
        return false;
      }
1399 1400 1401 1402

      // if(params.sqlKey === 'KFRvOyGdyvU'){
      //   console.log(params);
      // }
1403 1404 1405 1406 1407 1408 1409 1410
      getServicesNomal(getSqlOptionsApi, params).then(options => {
        let base52 = dataColumn.base52;
        let vl = this.props.form.getFieldsValue()[base52];
        const optionsx = [];
        let isExist = false;
        for (var i = 0; i < options.length; i++) {
          if (vl == options[i][valueName] && !isExist) {
            isExist = true;
1411
          }
1412 1413 1414
          if (Array.isArray(vl) && vl.length && vl.includes(options[i][valueName]) && !isExist) {
            // 钟是志 2021年9月28日 16:19:46 解决 checkbox 多选负值不上的bug
            isExist = true;
1415
          }
1416 1417 1418
          optionsx.push({
            label: options[i][labelName],
            value: options[i][valueName],
1419
          });
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431
        }

        if (!isExist && vl != null && options.length > 0) {
          this.props.form.setFieldsValue({ [base52]: null });
        }

        this.setState({
          getSqlOptionsCache,
          options: optionsx,
          selectDis: false,
        });
      })
1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473
    }
  };
  changeEnum = (obj, dataColumn, options) => {
    if (!this.props.isEdit && Object.keys(obj).length > 0) {
      let values = obj[dataColumn.base52];
      if (typeof values === 'string' && isJSON(values)) {
        values = JSON.parse(values);
      }
      // console.log('select组件的labels对应的', values);
      const labels = [];
      if (values != null) {
        if (values instanceof Array) {
          for (var i = 0; i < options.length; i++) {
            if (values.includes(options[i].value)) {
              labels.push(options[i].label);
              // break;
            }
          }
        } else {
          for (var i = 0; i < options.length; i++) {
            if (values == options[i].value) {
              labels.push(options[i].label);
              // break;
            }
          }
        }
      }

      this.setState({
        labels: labels,
        selectDis: false,
      });
    } else {
      this.setState({
        options: options,
        selectDis: false,
      });
    }
  };
  fetchData = (obj, dataColumn, init, filterSql, allValues) => {

    if (init != null && Object.keys(init).length > 0) {
1474 1475 1476 1477 1478 1479
      getServicesNomal(getSqlOptionsApi, {
        id: dataColumn.id,
        filterSql,
        allValues,
      }).then(options => {
        const optionsx = [];
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492
          for (var i = 0; i < options.length; i++) {
            optionsx.push({
              label: options[i][dataColumn.referenceNameName],
              value: options[i][dataColumn.referenceCodeName],
            });
          }
          this.setState({
            options: optionsx,
            selectDis: false,
          });
      });
    } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
      if (obj[dataColumn.base52]) {
1493
        getServicesNomal(getLabelsApi, {
1494
          id: dataColumn.id,
1495
          values: obj[dataColumn.base52],
1496 1497
          filterSql,
          allValues,
1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511
        }).then(labels => {
          this.setState({
            labels,
            selectDis: false,
          });
        });
      }
    } else {
      getServicesNomal(getOptionsApi, {
        id: dataColumn.id,
        filterSql,
        allValues,
      }).then(options => {
        const optionsx = [];
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524
          for (var i = 0; i < options.length; i++) {
            optionsx.push({
              label: options[i][dataColumn.referenceNameName],
              value: options[i][dataColumn.referenceCodeName],
            });
          }
          this.setState({
            options: optionsx,
            selectDis: false,
          });
      });
    }
  };
1525
  getColumn = key => {
1526
    let { mapData, json } = this.props;
1527

钟是志's avatar
钟是志 committed
1528
    const columnIds = json?.columnIds;
1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549

    if (
      columnIds == null ||
      Object.keys(columnIds).length == 0 ||
      columnIds[key] == null ||
      mapData == null
    ) {
      return null;
    }

    const dataColumn = mapData[columnIds[key][columnIds[key].length - 1]];

    return dataColumn;
  };

  render() {
    /**
     * json为申请表单
     * obj为查看详情用户输入值
     */
    let {
1550
      json: jsonStatic,
1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566
      obj,
      mapData,
      init,
      sqlData,
      defaultValues,
      get,
      formKey,
      isEdit,
      datas,
      taskAssignee,
      userId,
      i,
      j,
      isPreview,
      currentFormTitle,
      getCellValue,
1567
      uuid,
1568
    } = this.props;
1569 1570

    // 27282 双选会报名后管理员修改举办时间 但是单位申请信息么有随着更新
钟是志's avatar
钟是志 committed
1571
    let json = jsonStatic;
钟是志's avatar
钟是志 committed
1572

钟是志's avatar
钟是志 committed
1573 1574 1575 1576 1577
    if (json) {
      json = {
        ...jsonStatic,
        ...getActiveJson(formKey, uuid),
      };
钟是志's avatar
钟是志 committed
1578
    }
1579 1580 1581
    // if(uuid === 'violation_type_id'){
    //   console.log(formKey, json);
    // }
1582

1583 1584
    const { options, labels, selectDis, modalCode, modalTitle, modalInit, modalProps } = this.state;
    const { getFieldDecorator, getFieldError, getFieldProps } = this.props.form;
1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606
    const disabled = json != null ? json.disabled : false;
    const permRank = json != null ? (json.permRank != null ? json.permRank : 0) : 0;
    if (json?.label === '账号') {
      // console.log(json);
    }
    if (json == null) {
      return <></>;
    }
    let otherProps = {};

    //私有
    if (!isEdit && permRank == 1 && taskAssignee != userId) {
      return <></>;
    }
    if (json.comName == 'QRCode') {
      if (
        this.state.option == null ||
        this.state.option.value == null ||
        this.state.option.value == null
      ) {
        return <></>;
      }
1607
      return <QRCode {...this.state.option} key={uuid} />;
1608
    }
1609 1610 1611 1612 1613 1614
    if (json.comName === 'Echart') {
      return this.props.form.getFieldDecorator(uuid, {
        initialValue: '',
      })(
       <EchartsDiy json={json} uuid={uuid} option={this.state.option}/>
      )
1615
    }
1616
    if (json.comName === 'Graph') {
1617
      return <Neo4jD3Com key={uuid} json={json} option={this.state.option || []} />;
1618
    }
1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644
    if (['PartForm', 'Steps'].includes(json.comName)) {
      this.partFormProps = {
        taskId: this.props.taskId,
        importExcel: this.props.importExcel,
        setRealTimeValues: this.props.setRealTimeValues,
        hfInstance: this.props.hfInstance,
        getCellValue: getCellValue,
        taskAssignee: taskAssignee,
        isWebPrint: this.props.isWebPrint || false,
        userId: userId,
        isPreview: isPreview,
        modalInit: modalInit,
        datas: datas,
        trees: this.props.trees,
        get: get,
        isChild: true,
        isEdit: isEdit,
        obj: obj,
        init: init,
        formCode: this.props.formCode,
        formId: this.props.formId,
        mapData: mapData,
        sqlData: sqlData,
        defaultValues: defaultValues,
      };
    }
1645

1646
    if (json.comName === 'PartForm') {
1647
      const fk = this.props.form.getFieldsValue()[uuid] || json.childFormKey;
1648 1649 1650
      if (fk == null) {
        return <></>;
      }
1651
      if (formKey === fk) {
1652 1653 1654 1655
        return <>片段表单key不能和自身相同</>;
      }
      return (
        <>
1656
          {this.props.form.getFieldDecorator(uuid, {
1657
            initialValue: fk,
1658
          })(<Input type="hidden" />)}{' '}
1659
          <ZdyTable
1660
            {...this.partFormProps}
1661 1662 1663 1664 1665 1666
            currentFormTitle={
              this.props.getCurrentFormTitle ? this.props.getCurrentFormTitle(fk) : null
            }
            key={fk}
            currentFormKey={fk}
            {...datas[fk]}
钟是志's avatar
钟是志 committed
1667
            form={this.props.form}
1668 1669 1670 1671
          />
        </>
      );
    }
1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682
    // if([
    // //  'Select',
    // //  'Input',
    //   'InputHidden',
    // //  'DatePicker',
    // //  'TextArea',
    // //  'Radio',
    // ].includes(json.comName)){
    //   return null;
    //   // Select Input InputHidden DatePicker DatePicker TextArea Radio
    // }
1683 1684 1685 1686 1687 1688 1689 1690

    if (json.comName === 'Excel') {
      const value = getCellValue(i, j, currentFormTitle);
      const xx = (
        <div
          style={{
            textAlign: 'center',
            height: value == null ? 20 : null,
1691 1692
          }}
        >
1693 1694 1695 1696 1697 1698 1699 1700
          {value}
        </div>
      );
      return xx;
    }
    if (json.comName === 'Label') {
      let uid;
      if (this.props.fatherCode != null) {
1701
        uid = `${this.props.fatherCode}.[${this.props.index}].${uuid}`;
1702
      } else {
1703
        uid = uuid;
1704 1705
      }
      if (!isEdit) {
1706
        return obj[uuid] || json.initialValue || '';
1707 1708 1709 1710 1711
      } else {
        if (this.props.fatherCode != null) {
          return (
            <>
              {this.props.form.getFieldDecorator(uid, {
1712
                initialValue: obj[uuid] || json.initialValue,
1713
              })(<Input type="hidden" />)}
1714 1715 1716 1717 1718
              <span
                style={{
                  fontWeight: get === 'mobile' ? 'bold' : '',
                  marginRight: get === 'mobile' ? 12 : '',
                }}
1719 1720 1721 1722
                {...json.props}
              >
                {obj[uuid] || json.initialValue}
              </span>
1723 1724 1725 1726 1727 1728 1729
            </>
          );
        } else {
          return (
            <>
              {this.props.form.getFieldDecorator(uid, {
                initialValue: this.props.form.getFieldsValue()[uid] || json.initialValue,
1730
              })(<Input type="hidden" />)}
1731 1732 1733 1734 1735
              <span
                style={{
                  fontWeight: get === 'mobile' ? 'bold' : '',
                  marginRight: get === 'mobile' ? 12 : '',
                }}
1736 1737 1738 1739
                {...json.props}
              >
                {this.props.form.getFieldsValue()[uid]}
              </span>
1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777
            </>
          );
        }
      }
    }

    if (json.comName === 'Description') {
      const key = json.sqls[json.sqls.length - 1];
      var cm = '';
      var value;
      if (obj != null && obj.defaultValues) {
        let defaultValuesNew = {};
        for (let i in obj.defaultValues) {
          let oneFormKey = obj.defaultValues[i];
          if (oneFormKey && typeof oneFormKey === 'object') {
            for (let g in oneFormKey) {
              defaultValuesNew[g] = oneFormKey[g];
            }
          }
        }
        value = defaultValuesNew[key] || defaultValues[key];
        /** 2022年3月4日 15点15分 姚鑫国说的 这里面的key 不会有重复的 所以直接遍历后赋值到 value 上
         *  解决 移动端渲染的表单和web端渲染的不同 导致获取不到默认值的bug
         *  禅道bug 24669 学生事务/请假管理/请假审核,2018010347 辅导员审核时 在表中 学生的个人信息没出来
         *  **/
        // if (obj.defaultValues[formKey]) {
        //   value = obj.defaultValues[formKey][key];
        // } else if (defaultValues) {
        //   value = defaultValues[key];
        // }
      } else if (defaultValues) {
        value = defaultValues[key];
      }

      switch (json.viewName) {
        case 'TextArea':
          cm = (
            <span style={{ paddingRight: get === 'mobile' ? 8 : '' }}>
1778
              {value}
1779
              {get === 'mobile' ? <br /> : ''}
1780
            </span>
1781 1782 1783 1784 1785
          );
          break;
        case 'Switch':
          cm = (
            <span>
1786
              {value}
1787
              {get === 'mobile' ? <br /> : ''}
1788
            </span>
1789
          );
钟是志's avatar
钟是志 committed
1790

1791 1792 1793 1794
          break;
        case 'Input':
          cm = (
            <span style={{ paddingRight: get === 'mobile' ? 8 : '' }} data-com-name={'input'}>
1795
              {value}
1796
              {get === 'mobile' ? '' : ''}
1797
            </span>
1798
          );
钟是志's avatar
钟是志 committed
1799

1800 1801 1802 1803
          break;
        case 'Cron':
          cm = (
            <span style={{ paddingRight: get == 'mobile' ? 8 : '' }}>
1804
              {value}
1805
              {get === 'mobile' ? <br /> : ''}
1806
            </span>
1807
          );
钟是志's avatar
钟是志 committed
1808

1809 1810 1811 1812
          break;
        case 'InputNumber':
          cm = (
            <span>
1813
              {value}
1814
              {get === 'mobile' ? <br /> : ''}
1815
            </span>
1816 1817 1818 1819 1820 1821
          );

          break;
        case 'DatePicker':
          cm = value ? (
            <span>
1822
              {moment(parseInt(value)).format('YYYY-MM-DD HH:mm:ss')}
1823
              {get === 'mobile' ? <br /> : ''}
1824
            </span>
1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837
          ) : (
            ''
          );

          break;
        case 'PictureSignature': //只读模式
          const filesX = value.files || [];
          cm = (
            <>
              <ul>
                {filesX.map((f, index2) => {
                  return (
                    <li key={index2}>
1838
                      <a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
1839 1840 1841 1842 1843 1844
                        {f.name}
                      </a>
                    </li>
                  );
                })}
              </ul>
1845
              {get === 'mobile' ? <br /> : ''}
1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857
            </>
          );

          break;
        case 'UploadCom':
          const files = value.files || [];
          cm = (
            <>
              <ul>
                {files.map((f, index2) => {
                  return (
                    <li key={index2}>
1858
                      <a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
1859 1860 1861 1862 1863 1864
                        {f.name}
                      </a>
                    </li>
                  );
                })}
              </ul>
1865
              {get === 'mobile' ? <br /> : ''}
1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883
            </>
          );

          break;
        case 'ImgUploadCom': // 图片上传组件
          if (value == null || value == '') {
            cm = (
              <div
                style={{
                  width: json.width,
                  height: json.height,
                }}
              />
            );
          } else {
            cm = (
              <>
                <img
1884
                  src={queryFileUrl(value)}
1885 1886 1887 1888 1889
                  style={{
                    width: json.width,
                    height: json.height,
                  }}
                />
1890
                {get === 'mobile' ? <br /> : ''}
1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909
              </>
            );
          }

          break;
        case 'VideoUploadCom':
          if (value == null || value == '') {
            cm = (
              <div
                style={{
                  width: json.width,
                  height: json.height,
                }}
              />
            );
          } else {
            cm = (
              <>
                <img
1910
                  src={queryFileUrl(value)}
1911 1912 1913 1914 1915
                  style={{
                    width: json.width,
                    height: json.height,
                  }}
                />
1916
                {get === 'mobile' ? <br /> : ''}
1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932
              </>
            );
          }
          break;
      }
      if (get === 'mobile') {
        if (
          (json.isMobileLabel != null && json.isMobileLabel) ||
          (json.isMobileLabel == null && json.isLabel)
        ) {
          if (obj && obj.defaultValues && obj.defaultValues[formKey]) {
            return (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
1933 1934
                label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
              >
1935 1936 1937 1938 1939 1940 1941 1942 1943 1944
                {cm}
              </MobileItem>
            );
          } else {
            return (
              <>
                <MobileItem
                  isPreview={isPreview}
                  labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                  wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
1945 1946
                  label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
                >
1947 1948 1949 1950
                  {cm}
                </MobileItem>
                {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
                  initialValue: value,
1951
                })(<Input type="hidden" />)}
1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963
              </>
            );
          }
        } else {
          if (!isEdit && obj.defaultValues && obj.defaultValues[formKey]) {
            return cm;
          } else {
            return (
              <>
                {cm}
                {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
                  initialValue: value,
1964
                })(<Input type="hidden" />)}
1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977
              </>
            );
          }
        }
      } else {
        if (json.isLabel) {
          if (obj && obj.defaultValues && obj.defaultValues[formKey]) {
            if (!isEdit) {
              return (
                <Row
                  style={{
                    minHeight: 40,
                    lineHeight: '40px',
1978 1979
                  }}
                >
1980 1981 1982 1983 1984 1985 1986 1987 1988 1989
                  <Col
                    className={json.label ? json.label : sqlData[key] ? styles.row_col_div : ''}
                    span={json.labelSpan}
                    style={{
                      textAlign: json.labelSpan === 24 ? 'left' : 'right',
                      lineHeight: '40px',
                      whiteSpace: 'nowrap',
                      overflow: 'hidden',
                      fontSize: 14,
                      color: 'rgba(0,0,0,0.85)',
1990 1991
                    }}
                  >
1992 1993 1994 1995 1996 1997 1998 1999
                    {json.label ? (
                      <>
                        {json.label}
                        <span
                          style={{
                            position: 'relative',
                            top: '-0.5px',
                            margin: '0 8px 0 2px',
2000 2001 2002 2003
                          }}
                        >
                          :
                        </span>
2004 2005 2006 2007 2008 2009 2010 2011 2012
                      </>
                    ) : sqlData[key] ? (
                      <>
                        {sqlData[key].title}
                        <span
                          style={{
                            position: 'relative',
                            top: '-0.5px',
                            margin: '0 8px 0 2px',
2013 2014 2015 2016
                          }}
                        >
                          :
                        </span>
2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028
                      </>
                    ) : (
                      ''
                    )}
                  </Col>
                  <Col
                    span={json.wrapperSpan}
                    style={{
                      position: 'relative',
                      lineHeight: '40px',
                      zoom: 1,
                      fontSize: 14,
2029 2030
                    }}
                  >
2031 2032 2033 2034 2035 2036 2037 2038 2039
                    {cm}
                  </Col>
                </Row>
              );
            } else {
              return (
                <Form.Item
                  labelCol={{ span: json.labelSpan }}
                  wrapperCol={{ span: json.wrapperSpan }}
2040 2041
                  label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
                >
2042 2043 2044 2045 2046 2047 2048 2049 2050 2051
                  {cm}
                </Form.Item>
              );
            }
          } else {
            return (
              <>
                <Form.Item
                  labelCol={{ span: json.labelSpan }}
                  wrapperCol={{ span: json.wrapperSpan }}
2052 2053
                  label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
                >
2054 2055 2056 2057
                  {cm}
                </Form.Item>
                {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
                  initialValue: value,
2058
                })(<Input type="hidden" />)}
2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070
              </>
            );
          }
        } else {
          if (!isEdit && obj.defaultValues && obj.defaultValues[formKey]) {
            return cm;
          } else {
            return (
              <>
                {cm}
                {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
                  initialValue: value,
2071
                })(<Input type="hidden" />)}
2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086
              </>
            );
          }
        }
      }
    }

    var cm;
    var required = false;
    const bindObj = this.getColumn('c1');

    let dataColumn =
      this.props.fatherCode != null
        ? bindObj
          ? {
2087 2088 2089
              ...bindObj,
              base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
            }
2090
          : { base52: `${this.props.fatherCode}.[${this.props.index}].${uuid}` }
2091 2092 2093
        : bindObj;

    if (this.props.fatherCode == null && dataColumn == null) {
2094
      dataColumn = { base52: uuid };
2095 2096 2097 2098
    }
    if (dataColumn.isNull != null && !dataColumn.isNull) {
      required = true;
    }
2099 2100 2101
    if (Array.isArray(json.vlds)) {
      for (let item of json.vlds) {
        if (item.required) {
钟是志's avatar
钟是志 committed
2102 2103 2104 2105 2106
          required = true; // 验证里面填了必填 则必填
        }
      }
    }

2107 2108 2109 2110 2111 2112 2113 2114 2115

    var title = json.label || (dataColumn && dataColumn.title);
    var initValue;
    const objinit = { ...init, ...obj };

    if (objinit !== null && Object.keys(objinit).length > 0) {
      if (this.props.fatherCode != null) {
        initValue =
          objinit[this.props.index] != null
2116
            ? objinit[this.props.index][bindObj ? bindObj.base52 : uuid]
2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129
            : null;
      } else {
        initValue = objinit[dataColumn.base52];
      }
    } else {
      if (json.initialValue != null) {
        try {
          initValue = JSON.parse(json.initialValue);
        } catch (e) {
          initValue = null;
        }
      }
    }
钟是志's avatar
钟是志 committed
2130

2131 2132 2133 2134 2135
    if (!isEdit) {
      if (this.props.fatherCode) {
        if (bindObj != null) {
          dataColumn.base52 = bindObj.base52;
        } else {
2136
          dataColumn.base52 = uuid;
2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150
        }
      }

      switch (json.comName) {
        case 'RichText':
          cm = (
            <Editor
              key={dataColumn.base52}
              readOnly={true}
              blockRendererFn={MyBlockRenderer.bind(this, true, null, null, null)}
              editorState={changeToDraftState(obj[dataColumn.base52])}
            />
          );
          break;
2151 2152 2153
        case 'MobileCard':
          let value = obj[dataColumn.base52];
          if (!value || value === 'null') {
2154
            return <div />;
2155
          }
2156 2157 2158 2159 2160 2161 2162 2163 2164
          cm = (
            <MobileCard
              value={value}
              json={json}
              getArguments={this.functionArguments}
              tableComProps={this.props}
              dataColumn={dataColumn}
            />
          );
2165
          break;
2166 2167 2168
        case 'WangEditor':
          let textV = obj[dataColumn.base52];
          if (!textV || textV === 'null') {
2169
            return <div />;
2170 2171 2172 2173 2174
          }
          cm = (
            <div
              dangerouslySetInnerHTML={{
                __html: `<div class='wangEditorHtml'>
钟是志's avatar
钟是志 committed
2175
${obj[dataColumn.base52]}
钟是志's avatar
钟是志 committed
2176
</div>`,
2177 2178 2179 2180 2181 2182 2183 2184 2185
              }}
            />
          );
          break;
        case 'TextArea':
          cm = (
            <span
              style={{
                wordBreak: 'break-all',
2186 2187 2188 2189
              }}
            >
              {obj[dataColumn.base52]}
            </span>
2190 2191 2192 2193 2194 2195 2196 2197 2198
          );
          break;
        case 'Switch':
          cm = <span>{obj[dataColumn.base52]}</span>;

          break;
        case 'Input':
          cm = (
            <span
2199 2200
              data-obj-base52={dataColumn.base52}
              data-obj-comname={'Input'}
2201 2202
              style={{
                wordBreak: 'break-all',
2203 2204 2205 2206
              }}
            >
              {obj[dataColumn.base52]}
            </span>
2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231
          );

          break;
        case 'InputHidden':
          cm = <></>;

          break;
        case 'InputNumber':
          cm = <span>{obj[dataColumn.base52]}</span>;

          break;
        /**
         * 为Radio为单选
         */
        case 'Radio':
          cm = <span>{labels != null && labels.length > 0 ? Object.values(labels[0]) : ''}</span>;

          break;
        /**
         * 为Checked为多选
         * 该组件需要调用请求
         */
        case 'Checkbox':
          cm = (
            <span>
2232 2233
              {labels != null
                ? labels.map((r, i) =>
2234 2235 2236 2237 2238 2239 2240 2241
                    i == 0 ? (
                      typeof r == 'string' ? (
                        <span>{r}</span>
                      ) : (
                        Object.values(r)
                      )
                    ) : typeof r == 'string' ? (
                      <span style={{ marginLeft: 12 }}>{r}</span>
2242
                    ) : (
2243 2244 2245
                      ',' + Object.values(r)
                    ),
                  )
2246
                : ''}
2247
            </span>
2248 2249 2250 2251 2252 2253
          );

          break;
        case 'Select':
          let stringLabels = labels != null && labels.length > 0 ? labels.join(' ') : '';
          if (Array.isArray(labels) && labels.length && typeof labels[0] === 'object') {
2254 2255 2256 2257 2258 2259 2260
            stringLabels = '';
            let vLabels = [];
            for(let item of labels){ // 解决禅道 32141 如果存在其他问题 估计要从otherProps中获取是否是多选 如果不是多选只取一个值
              if(Object.values(item)){
                vLabels.push(Object.values(item));
              }
            }
2261
            stringLabels = [...new Set(vLabels)].join(', '); //
2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278
          }
          cm = <span>{stringLabels}</span>;

          break;
        case 'Cascader':
          cm = <span>{labels != null ? labels.join(json.spliter ? json.spliter : '') : ''}</span>;
          break;
        case 'TableSelect':
          const ds =
            obj[dataColumn.base52] && obj[dataColumn.base52].selects
              ? Object.values(obj[dataColumn.base52].selects)
              : [];
          if (json.showTable) {
            cm = (
              <Table
                get={get}
                columns={this.state.columns}
2279
                size="small"
2280 2281 2282 2283 2284 2285 2286
                dataSource={ds}
                pagination={false}
              />
            );
          } else {
            cm = (
              <span>
2287 2288
                {ds.map((r, i) => (i == 0 ? r[json.labelName] : ',' + r[json.labelName]))}
              </span>
2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310
            );
          }

          break;
        case 'RangePicker':
          const begin = dataColumn;
          const end = this.getColumn('c2');
          const ivs = [];
          if (initValue != null && init != null) {
            ivs.push(moment(parseInt(initValue)));
            if (end != null && init[end.base52]) {
              ivs.push(moment(parseInt(init[end.base52])));
            } else {
              ivs.push(moment());
            }
          }
          if (begin != null && end != null) {
            if (!obj[begin.base52]) {
              cm = <span>暂无</span>;
            } else {
              cm = (
                <span>
2311 2312 2313
                  {moment(parseInt(obj[begin.base52])).format(
                    json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                  )}{' '}
2314
{' '}
2315 2316 2317
                  {moment(parseInt(obj[end.base52])).format(
                    json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                  )}
2318
                </span>
2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330
              );
            }
          } else {
            cm = '';
          }
          title = title ? title : '起止时间';
          break;
        case 'DatePicker':
          const vTime = obj[dataColumn.base52];
          if (vTime && typeof vTime === 'string' && vTime.indexOf('-') <= -1) {
            cm = (
              <span>
2331
                {moment(parseInt(vTime)).format(json.format ? json.format : 'YYYY-MM-DD HH:mm:ss')}
2332
              </span>
2333 2334 2335 2336
            );
          } else {
            cm = (
              <span>
2337
                {vTime
2338
                  ? moment(+new Date(vTime)).format(
2339 2340 2341
                      json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                    )
                  : ''}
2342
              </span>
2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382
            );
          }

          break;
        case 'PictureSignature': // 非编辑模式 直接渲染成图片
          if (!isEmpty(obj[dataColumn.base52])) {
            // 首先判断是否为空对象
            let ary;
            /**
             * 判断返回值是否为JSON字符串,不是则直接使用
             */
            if (isJSON(obj[dataColumn.base52])) {
              ary = JSON.parse(obj[dataColumn.base52]);
            } else {
              ary = obj[dataColumn.base52];
            }
            if (!!ary.files) {
              // 然后判断存在多个附件的数组是否存在
              const files = !isEmpty(ary) ? ary.files : [];
              cm = (
                <ul className={styles.imageUl}>
                  {files.map((f, index2) => {
                    return (
                      <li key={f.path}>
                        <PictureSignature
                          json={json}
                          disabled={true} // 只读模式
                          basicUrl={queryApiActionPath()}
                          fileInfo={f}
                        />
                      </li>
                    );
                  })}
                </ul>
              );
            } else {
              const files = !isEmpty(ary) ? ary : [];
              cm = (
                <ul className={styles.imageUl}>
                  {Array.isArray(files) &&
2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394
                    files.map((f, index2) => {
                      return (
                        <li key={f.path}>
                          <PictureSignature
                            json={json}
                            disabled={true} // 只读模式
                            basicUrl={queryApiActionPath()}
                            fileInfo={f}
                          />
                        </li>
                      );
                    })}
2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436
                </ul>
              );
            }
          } else {
            cm = (
              <span
                style={{
                  display: 'inline-block',
                  width: '100%',
                  textAlign: 'center',
                }}
              />
            );
          }

          break;
        case 'UploadCom':
          /**
           * 查找不到数据 添加判断
           * 只有一个附件返回的是一个对象不是数组,暂时使用2个判断
           */
          if (!isEmpty(obj[dataColumn.base52])) {
            // 首先判断是否为空对象
            let ary;
            /**
             * 判断返回值是否为JSON字符串,不是则直接使用
             */
            if (isJSON(obj[dataColumn.base52])) {
              ary = JSON.parse(obj[dataColumn.base52]);
            } else {
              ary = obj[dataColumn.base52];
            }
            if (!!ary.files) {
              // 然后判断存在多个附件的数组是否存在
              const files = !isEmpty(ary) ? ary.files : [];
              cm = (
                <ul className={styles.imageUl}>
                  {files.map((f, index2) => {
                    if (get === 'web' && !this.props.isPrint) {
                      return (
                        <li key={index2}>
                          <FilePreview
2437
                            path={queryFileUrl(f.path)}
2438 2439 2440 2441 2442 2443 2444 2445
                            pathName={f.name}
                            type={'UploadCom'}
                          />
                        </li>
                      );
                    }
                    return (
                      <li key={index2}>
2446
                        <a target="_blank" key={f.path} href={queryFileUrl(f.path)}>
2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458
                          {f.name}
                        </a>
                      </li>
                    );
                  })}
                </ul>
              );
            } else {
              const files = !isEmpty(ary) ? ary : [];
              cm = (
                <ul className={styles.imageUl}>
                  {Array.isArray(files) &&
2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470
                    files.map((f, index2) => {
                      if (get === 'web' || !this.props.isPrint) {
                        return (
                          <li key={index2}>
                            <FilePreview
                              path={queryFileUrl(f.path)}
                              pathName={f.name}
                              type={'UploadCom'}
                            />
                          </li>
                        );
                      }
2471 2472
                      return (
                        <li key={index2}>
2473 2474 2475
                          <a target="_blank" key={f.filePath} href={queryFileUrl(f.filePath)}>
                            {f.fileName}
                          </a>
2476 2477
                        </li>
                      );
2478
                    })}
2479 2480 2481 2482 2483 2484 2485 2486 2487 2488
                </ul>
              );
            }
          } else {
            cm = (
              <span
                style={{
                  display: 'inline-block',
                  width: '100%',
                  textAlign: 'center',
2489 2490 2491 2492
                }}
              >
                暂无附件
              </span>
2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509
            );
          }

          break;
        case 'ImgUploadCom':
          if (obj[dataColumn.base52] == null || obj[dataColumn.base52] == '') {
            cm = (
              <div
                style={{
                  width: json.width,
                  height: json.height,
                }}
              />
            );
          } else {
            cm = FilePreview ? (
              <FilePreview
2510
                path={queryFileUrl(obj[dataColumn.base52])}
2511 2512 2513 2514 2515 2516
                pathName={obj[dataColumn.base52]}
                width={json.width}
                height={json.height}
              />
            ) : (
              <img
2517
                src={queryFileUrl(obj[dataColumn.base52])}
2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539
                style={{
                  width: json.width,
                  height: json.height,
                }}
              />
            );
          }

          break;
        case 'VideoUploadCom':
          if (obj[dataColumn.base52] == null || obj[dataColumn.base52] == '') {
            cm = (
              <div
                style={{
                  width: json.width,
                  height: json.height,
                }}
              />
            );
          } else {
            cm = FilePreview ? (
              <FilePreview
2540
                path={queryFileUrl(obj[dataColumn.base52])}
2541 2542 2543 2544 2545 2546
                pathName={obj[dataColumn.base52]}
                width={json.width}
                height={json.height}
              />
            ) : (
              <img
2547
                src={queryFileUrl(obj[dataColumn.base52])}
2548 2549 2550 2551 2552 2553 2554 2555 2556 2557
                style={{
                  width: json.width,
                  height: json.height,
                }}
              />
            );
          }

          break;
        case 'Signature':
钟是志's avatar
钟是志 committed
2558 2559 2560 2561
          if (!obj[dataColumn.base52]) {
            console.log('签名组件没有获取到图片地址', dataColumn.base52);
            cm = '';
          } else {
钟是志's avatar
钟是志 committed
2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572
            const filePath = queryFileUrl(obj[dataColumn.base52]);
            if (!filePath) {
              cm = '';
            } else {
              cm = (
                <img
                  data-cell-component={'Signature'}
                  data-cell-base52={dataColumn.base52}
                  src={filePath}
                  style={{
                    marginLeft: 5,
2573
                    minHeight: get === 'mobile' ? '200px' : 'auto',
2574
                    width: get === 'mobile' ? 'auto' : json.width,
钟是志's avatar
钟是志 committed
2575 2576 2577 2578 2579
                    height: get === 'mobile' ? '' : json.height,
                  }}
                />
              );
            }
钟是志's avatar
钟是志 committed
2580 2581
          }

2582 2583 2584 2585 2586
          break;
        case 'ChildForm':
          const xxxxx = obj[dataColumn.base52];
          if (xxxxx == null) {
            cm = <></>;
2587
            // Chil;
2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604
            break;
          }
          if (Object.keys(xxxxx).length > 0) {
            delete xxxxx[''];
          }
          cm = (
            <ChildForm
              taskId={this.props.taskId}
              setRealTimeValues={this.props.setRealTimeValues}
              modalInit={modalInit}
              trees={this.props.trees}
              isPreview={isPreview}
              hfInstance={this.props.hfInstance}
              getCurrentFormTitle={this.props.getCurrentFormTitle}
              getCellValue={getCellValue}
              fatherObj={obj}
              json={json}
2605
              rights={json.rights || []}
2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626
              isMobile={get === 'mobile'}
              value={xxxxx}
              deleteName={json.deleteName}
              addName={json.addName}
              isEdit={isEdit}
              formCode={this.props.formCode}
              formId={this.props.formId}
              base52={dataColumn.base52}
              mapData={mapData}
              datas={datas ? datas[json.childFormKey] : null}
              datasAll={datas}
              defaultValues={defaultValues}
              sqlData={sqlData}
              form={this.props.form}
            />
          );
          break;
        case 'Button':
          let events = {};

          if (json.events != null) {
2627
            events = this.getFunctionValue(json.events, { base52: uuid }, json);
2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638
          }
          if (events && events.dom) {
            cm = events.dom;
          } else {
            const ev = {
              children: json.initialValue,
              ...events,
            };
            if (json.isLink) {
              cm = <a {...ev} />;
            } else {
2639
              cm = <ButtonDiy loading={this.props.loading} type="primary" {...ev} />;
2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663
            }
          }

          break;
        case 'LocationCom':
          let v = obj[dataColumn.base52];
          if (typeof v !== 'object') {
            console.log('定位组件未获取到对象', '进行了数据转换', v, typeof v, isJSON(v));
            if (isJSON(v)) {
              v = JSON.parse(v);
            } else {
              v = {};
            }
          }
          cm = <span>{v.address || ''}</span>;
          break;

        case 'Table':
          if (json.objCode == null || json.objCode == '') {
            cm = <></>;
          }
          cm = (
            <TableList
              get={get}
2664
              uuid={uuid}
2665 2666 2667 2668 2669 2670
              isTree={json.isTree}
              json={json}
              loading={this.props.loading}
              showHeader={json.showHeader}
              isHiddenPage={json.isHiddenPage}
              pageSize={json.pageSize}
2671
              value={obj[dataColumn.base52 || uuid] || {}}
2672 2673 2674
              objCode={json.objCode}
              sql={json.filterSql}
              rights={json.rights}
钟是志's avatar
钟是志 committed
2675
              obj={this.getObjValues()}
2676 2677 2678 2679 2680 2681
            />
          );
          break;
        default:
          cm = (
            <span>
2682
              缺乏字段
2683 2684
              {json.comName}
              的匹配项
2685
            </span>
2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707
          );
          break;
      }
    } else {
      //编辑模式
      if (json.vlds && json.vlds.length > 0) {
        for (let i in json.vlds) {
          if (json.vlds[i].validatorFunc && json.vlds[i].validatorFunc != '') {
            try {
              let fn = new Function('rule', 'value', 'callback', json.vlds[i].validatorFunc);
              json.vlds[i].validator = fn;
            } catch (e) {
              console.log(e);
            }
          }
        }
      }
      switch (json.comName) {
        case 'Button':
          let events = {};

          if (json.events != null) {
2708
            events = this.getFunctionValue(json.events, { base52: uuid }, json);
2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719
          }
          if (events && events.dom) {
            cm = events.dom;
          } else {
            const ev = {
              children: json.initialValue,
              ...events,
            };
            if (json.isLink) {
              cm = <a {...ev} />;
            } else {
2720
              cm = <ButtonDiy loading={this.props.loading} type="primary" {...ev} />;
2721 2722 2723 2724 2725
            }
          }

          break;
        case 'Switch':
2726 2727
          if (initValue === 'true' || initValue === true) {
            initValue = true;
钟是志's avatar
钟是志 committed
2728
          } else {
2729 2730
            initValue = false;
          }
2731 2732
          if (get === 'mobile') {
            if (dataColumn == null || json.formula != null) {
2733
              cm = this.props.form.getFieldsValue()[uuid];
2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745
              break;
            }
            cm = (
              <MobileList.Item
                extra={
                  <MobileSwitch
                    {...getFieldProps(dataColumn.base52, {
                      initialValue: initValue,
                      rules:
                        json.vlds && json.vlds.length > 0
                          ? json.vlds
                          : [
2746 2747 2748 2749 2750
                              {
                                required: required,
                                message: '请选择' + title,
                              },
                            ],
2751 2752
                    })}
                    disabled={disabled}
2753
                    onClick={checked => {
2754 2755 2756 2757 2758 2759
                      // set new value
                      this.props.form.setFieldsValue({
                        [dataColumn.base52]: checked,
                      });
                    }}
                  />
2760 2761
                }
              >
2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776
                {(json.isMobileLabel != null && json.isMobileLabel) ||
                (json.isMobileLabel == null && json.isLabel)
                  ? title
                  : ''}
              </MobileList.Item>
            );
            break;
          }
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            valuePropName: 'checked',
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
2777 2778 2779 2780 2781
                    {
                      required: required,
                      message: '请选择' + title,
                    },
                  ],
2782
          })(<SwitchWeb json={json} disabled={disabled} />);
2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796

          break;
        case 'TextArea':
          if (json?.otherProps) {
            otherProps = json?.otherProps;
            try {
              // mode = multiple 就支持下拉多选了
              otherProps = new Function(otherProps)();
            } catch (e) {
              otherProps = {};
            }
          }
          if (get === 'mobile') {
            cm = getFieldDecorator(dataColumn.base52, {
2797
              initialValue: initValue,
2798
              rules: giveVarcharRules({
2799 2800 2801
                dataColumn,
                json,
                required,
2802
                title,
2803
              }),
2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822
            })(
              <TextArea
                autoSize={{ minRows: 4 }}
                disabled={disabled}
                placeholder={json.placeholder}
                {...otherProps}
              />,
            );
            cm = <div>{cm}</div>;
            if (
              ((json.isMobileLabel != null && json.isMobileLabel) ||
                (json.isMobileLabel == null && json.isLabel)) &&
              title
            ) {
              cm = (
                <MobileItem
                  isPreview={isPreview}
                  labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                  wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
2823 2824
                  label={title}
                >
2825 2826 2827 2828 2829 2830 2831
                  {cm}
                </MobileItem>
              );
            }
          } else {

            cm = getFieldDecorator(dataColumn.base52, {
2832
              initialValue: initValue,
2833
              rules: giveVarcharRules({
2834 2835 2836
                dataColumn,
                json,
                required,
2837
                title,
2838
              }),
2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859
            })(
              <TextArea
                autoSize={{ minRows: 4 }}
                disabled={disabled}
                rows={4}
                placeholder={json.placeholder}
                {...otherProps}
              />,
            );
          }
          break;
        case 'Input':
          if (json?.otherProps) {
            otherProps = json?.otherProps;
            try {
              // mode = multiple 就支持下拉多选了
              otherProps = new Function(otherProps)();
            } catch (e) {
              otherProps = {};
            }
          }
2860
          const { disabledInputStyle = {}, addonAfter } = otherProps;
2861 2862 2863
          let inputStyle = {
            width: json.width,
          };
钟是志's avatar
钟是志 committed
2864
          if (disabled) {
2865 2866 2867
            inputStyle = {
              ...inputStyle,
              ...disabledInputStyle,
钟是志's avatar
钟是志 committed
2868
            };
2869 2870
          }
          cm = getFieldDecorator(dataColumn.base52, {
2871
            initialValue: initValue,
2872 2873 2874 2875
            rules: giveVarcharRules({
              dataColumn,
              json,
              required,
2876
              title,
2877
            }),
2878 2879 2880 2881 2882
          })(
            <Input
              disabled={disabled}
              style={inputStyle}
              placeholder={json.placeholder}
2883
              addonAfter={addonAfter}
钟是志's avatar
钟是志 committed
2884 2885
            />,
          );
2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898

          if (get === 'mobile') {
            cm = <div>{cm}</div>;
            if (
              ((json.isMobileLabel != null && json.isMobileLabel) ||
                (json.isMobileLabel == null && json.isLabel)) &&
              title
            ) {
              cm = (
                <MobileItem
                  isPreview={isPreview}
                  labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                  wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
2899 2900
                  label={title}
                >
2901 2902 2903 2904 2905 2906 2907 2908 2909
                  {cm}
                </MobileItem>
              );
            }
          }
          break;
        case 'InputHidden':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
2910
          })(<Input type="hidden" />);
2911 2912
          break;
        case 'InputNumber':
2913 2914 2915 2916 2917 2918 2919 2920
          if (json?.otherProps) {
            otherProps = json?.otherProps;
            try {
              otherProps = new Function(otherProps)();
            } catch (e) {
              otherProps = {};
            }
          }
2921 2922 2923 2924 2925 2926
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
2927 2928 2929 2930 2931
                    {
                      required: required,
                      message: '请输入' + title,
                    },
                  ],
2932 2933 2934 2935 2936 2937
          })(
            <InputNumber
              disabled={disabled}
              placeholder={json.placeholder}
              max={json.max}
              min={json.min}
2938
              addonAfter={otherProps?.addonAfter} //3.0ant 不支持
2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954
              precision={json.precision}
              step={json.step}
            />,
          );
          if (get == 'mobile') {
            cm = <div>{cm}</div>;
            if (
              ((json.isMobileLabel != null && json.isMobileLabel) ||
                (json.isMobileLabel == null && json.isLabel)) &&
              title
            ) {
              cm = (
                <MobileItem
                  isPreview={isPreview}
                  labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                  wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
2955 2956
                  label={title}
                >
2957 2958 2959 2960 2961 2962
                  {cm}
                </MobileItem>
              );
            }
          }
          break;
2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975
        case 'Tabs':
          let configOption = this.state.option;
          if (
            !configOption ||
            !configOption.data ||
            !Array.isArray(configOption.data) ||
            !configOption.data.length
          ) {
            return null;
          }
          const tabsProps = configOption.tabsProps || {};
          const tabPaneProps = configOption.tabPaneProps || {};
          let activeKey = this.state.activeKey || configOption.data[0].key;
2976 2977 2978 2979 2980 2981
          cm = (
            <Tabs onChange={this.changeTabsActiveKey} activeKey={activeKey} {...tabsProps}>
              {configOption.data.map(r => {
                return (
                  <Tabs.TabPane tab={r.title} key={r.key} {...tabPaneProps}>
                    {activeKey === r.key ? (
2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003
                      <ZdyTable
                        changedValues={this.props.changedValues}
                        setRealTimeValues={this.props.setRealTimeValues}
                        trees={this.props.trees}
                        taskId={this.props.taskId}
                        taskAssignee={taskAssignee}
                        userId={userId}
                        modalInit={modalInit}
                        key={r.key}
                        datas={datas}
                        get={get}
                        isChild={true}
                        currentFormKey={r.key}
                        isEdit={isEdit}
                        obj={obj}
                        init={init}
                        form={this.props.form}
                        mapData={mapData}
                        sqlData={sqlData}
                        {...datas[r.key]}
                        defaultValues={defaultValues}
                      />
3004
                    ) : /**
3005 3006 3007 3008 3009
                       <ZdyTable
                       key={r}
                       modalInit={modalInit}
                       hfInstance={hfInstance}
                       currentFormTitle={
3010 3011
                            getCurrentFormTitle ? getCurrentFormTitle(json.childFormKey) : null
                          }
3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033
                       getCellValue={getCellValue}
                       formCode={this.props.formCode}
                       formId={this.props.formId}
                       isPreview={isPreview}
                       currentFormKey={json.childFormKey}
                       formConfig={datas}
                       get="mobile"
                       fatherCode={base52}
                       isEdit={isEdit}
                       index={r}
                       obj={objs[r]}
                       fatherObj={this.props.fatherObj}
                       init={objs}
                       isChild={true}
                       form={form}
                       mapData={mapData}
                       sqlData={sqlData}
                       datas={datasAll}
                       {...datas}
                       defaultValues={defaultValues}
                       />
                       * */
3034 3035 3036 3037 3038 3039
                    null}
                  </Tabs.TabPane>
                );
              })}
            </Tabs>
          );
3040
          break;
3041 3042 3043 3044 3045 3046 3047 3048 3049 3050
        /**
         * 为Radio为单选
         */
        case 'Radio':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3051 3052 3053 3054 3055
                    {
                      required: required,
                      message: '请选择' + dataColumn.title,
                    },
                  ],
3056
          })(<Radio.Group options={options} disabled={disabled} />);
3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068
          if (get == 'mobile') {
            cm = <div>{cm}</div>;
            if (
              ((json.isMobileLabel != null && json.isMobileLabel) ||
                (json.isMobileLabel == null && json.isLabel)) &&
              title
            ) {
              cm = (
                <MobileItem
                  isPreview={isPreview}
                  labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                  wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3069 3070
                  label={title}
                >
3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083
                  {cm}
                </MobileItem>
              );
            }
          }
          break;
        /**
         * 为Checked为多选
         * 该组件需要调用请求
         */
        case 'Checkbox':
          if (get === 'mobile') {
            cm = (
3084
              <Flex direction="column" align="start">
3085 3086 3087 3088 3089 3090
                {getFieldDecorator(dataColumn.base52, {
                  initialValue: initValue, // 默认值
                  rules:
                    json.vlds && json.vlds.length > 0
                      ? json.vlds
                      : [
3091 3092 3093 3094 3095
                          {
                            required: required,
                            message: '请选择' + dataColumn.title,
                          },
                        ],
3096
                })(<Checkbox.Group options={options} disabled={disabled} />)}
3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109
              </Flex>
            );

            if (
              ((json.isMobileLabel != null && json.isMobileLabel) ||
                (json.isMobileLabel == null && json.isLabel)) &&
              title
            ) {
              cm = (
                <MobileItem
                  isPreview={isPreview}
                  labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                  wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3110 3111
                  label={title}
                >
3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125
                  {cm}
                </MobileItem>
              );
            }

            break;
          }
          // console.log(dataColumn.base52);
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3126 3127 3128 3129 3130
                    {
                      required: required,
                      message: '请选择' + dataColumn.title,
                    },
                  ],
3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148
          })(
            <Checkbox.Group
              options={options}
              disabled={disabled}
              data-base52={dataColumn.base52}
            />,
          );
          break;
        case 'Select':
          if (json?.otherProps) {
            otherProps = json?.otherProps;
            try {
              // mode = multiple 就支持下拉多选了
              otherProps = new Function(otherProps)();
            } catch (e) {
              otherProps = {};
            }
          }
钟是志's avatar
钟是志 committed
3149

3150 3151 3152 3153 3154
          const optDiy = Array.isArray(json?.options)
            ? json.options
            : Array.isArray(options)
            ? options
            : [];
钟是志's avatar
钟是志 committed
3155 3156 3157
          // if(uuid  === 'violation_type_id'){
          //   console.log(json);
          // }
3158
          if (dataColumn.base52 === 'KjWXQFIprRc') {
钟是志's avatar
钟是志 committed
3159
            // console.log(json, required, dataColumn, optDiy);
钟是志's avatar
钟是志 committed
3160
          }
钟是志's avatar
钟是志 committed
3161

3162
          cm = getFieldDecorator(dataColumn.base52, {
3163
            initialValue: !initValue && otherProps?.mode === 'multiple' ? undefined : initValue,
3164
            rules:
3165
              Array.isArray(json.vlds) && json.vlds.length > 0
3166 3167
                ? json.vlds
                : [
3168 3169 3170 3171 3172
                    {
                      required: required,
                      message: '请选择' + dataColumn.title,
                    },
                  ],
3173
          })(
3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209
            !optDiy.length ? (
              <Input disabled={true} style={{ width: json.width }} />
            ) : (
              <Select
                allowClear
                showSearch
                disabled={selectDis || disabled}
                placeholder={json.placeholder}
                style={{ width: json.width }}
                optionFilterProp="children"
                getPopupContainer={getPopupContainer(this.props.isDynamic, uuid)}
                onFocus={() => {
                  get === 'mobile' // 移动端取消输入键盘弹出
                    ? setTimeout(() => {
                        if (document.querySelectorAll(`.ant-select-search__field`).length > 0) {
                          let ary = [...document.querySelectorAll(`.ant-select-search__field`)];
                          ary.map(item => {
                            item.setAttribute('readonly', 'readonly');
                            // setTimeout(() => {
                            //   ary.map(arr => {
                            //     arr.removeAttribute('readonly');
                            //   })
                            // });
                          });
                        }
                      })
                    : null;
                }}
                filterOption={(input, option) =>
                  option
                    ? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                    : false
                }
                {...otherProps}
              >
                {optDiy.map(r => {
3210
                  return (
3211 3212 3213
                    <Option key={r.value} value={r.value}>
                      {r.label}
                    </Option>
3214
                  );
3215 3216 3217
                })}
              </Select>
            ),
3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229
          );
          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3230 3231
                label={title}
              >
3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253
                {cm}
              </MobileItem>
            );
          } else if (get === 'mobile') {
            cm = <div>{cm}</div>;
          }

          break;

        case 'Cascader':
          //zsz
          if (json?.otherProps) {
            otherProps = json?.otherProps;
            try {
              // mode = multiple 就支持下拉多选了
              otherProps = new Function(otherProps)();
            } catch (e) {
              otherProps = {};
            }
          }
          const filterF = function filter(inputValue, path) {
            return path.some(
3254
              option => option?.label?.toLowerCase()?.indexOf(inputValue.toLowerCase()) > -1,
3255 3256 3257 3258
            );
          };
          // if(this.props.uuid === 'id_32691685234912400529714267d34dc585a2'){
          //   console.log(initValue,
钟是志's avatar
钟是志 committed
3259 3260 3261 3262
          //     dataColumn.base52,
          //     // options,
          //     // otherProps,
          //   );
3263
          //   console.log(this.props.form.getFieldsValue())
钟是志's avatar
钟是志 committed
3264
          // }
3265 3266 3267 3268 3269 3270
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3271 3272 3273 3274 3275
                    {
                      required: required,
                      message: '请选择' + dataColumn.title,
                    },
                  ],
3276 3277 3278 3279
          })(
            <Cascader // 这里的options 获取方式存在bug 公式会重复调用
              options={options}
              allowClear
3280
              data-cell-uuid-cascader={uuid}
3281 3282
              showSearch={{ filter: filterF }}
              disabled={disabled}
3283
              getPopupContainer={getPopupContainer(this.props.isDynamic, uuid)}
3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296
              placeholder={json.placeholder}
              style={{ width: json.width }}
              {...otherProps}
            />,
          );
          if (get === 'mobile') {
            // console.log(json.vlds);
            cm = getFieldDecorator(dataColumn.base52, {
              initialValue: initValue,
              rules:
                json.vlds && json.vlds.length > 0
                  ? json.vlds
                  : [
3297 3298 3299 3300 3301
                      {
                        required: required,
                        message: '请选择' + dataColumn.title,
                      },
                    ],
3302
            })(<MobileCascader options={options} label={title} disabled={disabled} json={json} />);
3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315
          }

          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3316 3317
                label={title}
              >
3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333
                {cm}
              </MobileItem>
            );
          } else if (get === 'mobile') {
            cm = <div>{cm}</div>;
          }

          break;
        case 'TableSelect':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue || {},

            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347
                    {
                      validator: (rule, value, callback) => {
                        let errors = [];
                        if (
                          (Object.keys(value).length == 0 ||
                            Object.keys(value.selects).length == 0) &&
                          required != null &&
                          required
                        ) {
                          errors.push(new Error('请选择至少一个', rule.field));
                        }
                        callback(errors);
                      },
                      required: required,
3348
                    },
3349
                  ],
3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372
          })(
            <TableSelect
              get={get}
              json={json}
              disabled={!isEdit}
              dataColumn={dataColumn}
              columns={this.state.columns}
              dataSource={this.state.dataSource}
              sqlModel={this.state.sqlModel}
              resetSearchText={this.resetSearchText}
            />,
          );
          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3373 3374
                label={title}
              >
3375 3376 3377 3378 3379 3380 3381
                {cm}
              </MobileItem>
            );
          }
          break;

        case 'RangePicker':
3382 3383 3384 3385 3386 3387 3388 3389 3390
          if (json?.otherProps) {
            otherProps = json?.otherProps;
            try {
              // mode = multiple 就支持下拉多选了
              otherProps = new Function(otherProps)();
            } catch (e) {
              otherProps = {};
            }
          }
3391 3392 3393
          const begin = dataColumn;
          var end = this.getColumn('c2');
          if (end == null) {
3394
            end = { base52: uuid + '_2' };
3395 3396
          }
          const ivs = getMomentArr({
钟是志's avatar
钟是志 committed
3397 3398 3399 3400
            begin,
            end,
            initValue,
            init,
3401
            obj,
3402 3403 3404 3405 3406
          });

          if (!isEdit) {
            cm = (
              <span>
3407 3408 3409
                {moment(parseInt(obj[begin.base52])).format(
                  json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                )}{' '}
3410
{' '}
3411 3412 3413
                {moment(parseInt(obj[end.base52])).format(
                  json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                )}
3414
              </span>
3415 3416 3417 3418 3419 3420 3421 3422 3423
            );
          } else {
            if (get === 'mobile') {
              cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
                initialValue: ivs,
                rules:
                  json.vlds && json.vlds.length > 0
                    ? json.vlds
                    : [
3424 3425 3426
                        {
                          required: required,
                          message: '请选择起止时间',
3427 3428
                          validator: (rule, value, callback) => {
                            let errors = [];
3429
                            if (!value || !Array.isArray(value) || value.length !== 2) {
3430 3431 3432 3433 3434 3435
                              // 移动端起止时间必须是个数组 且 length = 2
                              errors.push(new Error('请选择', rule.field));
                            }

                            callback(errors);
                          },
3436 3437
                        },
                      ],
3438 3439 3440 3441 3442 3443
              })(
                <MobileDate
                  disabled={disabled}
                  required={required}
                  format={json.format}
                  showTime={json.showTime}
3444
                  otherProps={otherProps}
3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457
                />,
              );
              if (
                ((json.isMobileLabel != null && json.isMobileLabel) ||
                  (json.isMobileLabel == null && json.isLabel)) &&
                title
              ) {
                cm = (
                  <MobileItem
                    isPreview={isPreview}
                    labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                    wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
                    label={title}
3458 3459
                    required={required}
                  >
3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473
                    {cm}
                  </MobileItem>
                );
              }
              break;
            }
            // console.table('rangePicker', this.props?.form?.getFieldsValue()[begin.base52 + '$' + end.base52]);

            cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
              initialValue: ivs,
              rules:
                json.vlds && json.vlds.length > 0
                  ? json.vlds
                  : [
3474 3475 3476 3477 3478
                      {
                        required: required,
                        message: '请选择起止时间',
                      },
                    ],
3479
            })(<RangePickerDiy json={json} disabled={disabled} uuid={uuid} />);
3480 3481 3482
          }
          if (json.label == null) title = '起止时间';
          break;
3483 3484 3485 3486 3487 3488 3489 3490 3491 3492
        case 'DatePicker':
          if (json?.otherProps) {
            otherProps = json?.otherProps;
            try {
              // mode = multiple 就支持下拉多选了
              otherProps = new Function(otherProps)();
            } catch (e) {
              otherProps = {};
            }
          }
3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505
          // cm = null;
          // break;
          var iv = null;
          if (initValue != null) {
            iv = moment(typeof initValue === 'string' ? +initValue : initValue);
          }
          // console.log(iv,json.format)
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: iv,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3506 3507 3508 3509 3510
                    {
                      required: required,
                      message: '请选择起止时间',
                    },
                  ],
3511 3512 3513 3514
          })(
            <DatePicker
              disabled={disabled}
              showTime={json.showTime != null ? json.showTime : true}
3515
              getCalendarContainer={getPopupContainer(false, uuid)}
3516 3517 3518
              onOpenChange={
                get === 'mobile'
                  ? () => {
3519 3520 3521
                      // 取消唤起移动端小键盘
                      setTimeout(() => {
                        if (document.querySelector('.ant-calendar-input ')) {
3522 3523
                          document
                            .querySelector('.ant-calendar-input ')
3524 3525 3526 3527 3528 3529 3530 3531 3532 3533
                            .setAttribute('readonly', 'readonly');
                          setTimeout(() => {
                            document
                              .querySelector('.ant-calendar-input ')
                              .removeAttribute('readonly');
                          });
                        }
                      });
                    }
                  : () => {}
3534 3535
              }
              format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'}
3536
              {...otherProps}
3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549
            />,
          );
          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3550 3551
                label={title}
              >
3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569
                {cm}
              </MobileItem>
            );
          }
          break;
        case 'PictureSignature': // 签章组件
          let filesPictureSignature = [];
          if (initValue != null && !isEmpty(initValue.files)) {
            filesPictureSignature = initValue.files;
          }
          console.log('签章组件', json, filesPictureSignature);

          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: { files: filesPictureSignature },
            rules:
              json?.vlds && json?.vlds.length > 0
                ? json.vlds
                : [
3570 3571 3572 3573 3574
                    {
                      required,
                      message: '请进行签章',
                    },
                  ],
3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593
          })(
            <SignArray // 签章组件 编辑模式
              json={json}
              disabled={disabled || isPreview}
              basicUrl={queryApiActionPath()}
              form={this.props.form}
            />,
          );
          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3594 3595
                label={title}
              >
3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643
                {cm}
              </MobileItem>
            );
          }
          break;
        case 'UploadCom':
          let files = [];
          // if (initValue != null) {
          if (initValue != null && !isEmpty(initValue.files)) {
            files = initValue.files;
          }
          // console.log(dataColumn.base52);
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: { files },
            rules: [
              {
                required,
                message: '请选择附件',
                validator: (rule, valueUploadCom, callback) => {
                  let errors = [];
                  if ((!valueUploadCom || valueUploadCom?.files?.length === 0) && required) {
                    errors.push(new Error('至少上传一个', rule.field));
                  }
                  callback(errors);
                },
              },
            ],
          })(
            <UploadCom
              isMultiple={json.isMultiple}
              accept={json.accept}
              btnName={json.btnName}
              json={json}
              dataKey={dataColumn.base52}
              disabled={disabled || isPreview}
            />,
          );
          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3644 3645
                label={title}
              >
3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657
                {cm}
              </MobileItem>
            );
          }
          break;
        case 'WangEditor':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3658 3659 3660 3661 3662
                    {
                      required: required,
                      message: '请输入',
                    },
                  ],
3663
          })(<WangEditor json={json} dataColumn={dataColumn} disabled={disabled} uuid={uuid} />);
3664
          break;
3665 3666 3667
        case 'Steps':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
3668 3669 3670 3671 3672 3673 3674
          })(
            <StepDiy
              json={json}
              dataColumn={dataColumn}
              disabled={disabled}
              uuid={uuid}
              partFormProps={this.partFormProps}
钟是志's avatar
钟是志 committed
3675
              form={this.props.form}
3676 3677
            />,
          );
3678
          break;
3679 3680 3681 3682 3683 3684 3685
        case 'MobileCard':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
          })(
            <MobileCard
              json={json}
              uuid={uuid}
3686 3687 3688
              getArguments={this.functionArguments}
              tableComProps={this.props}
              dataColumn={dataColumn}
3689 3690
            />,
          );
3691
          break;
3692 3693 3694 3695 3696 3697 3698
        case 'RichText':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3699 3700 3701 3702 3703
                    {
                      required: required,
                      message: '请输入',
                    },
                  ],
3704
          })(<DraftEditorCom placeholder={json.placeholder} disabled={json.disabled} />);
3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715
          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3716 3717
                label={title}
              >
3718 3719 3720 3721 3722 3723
                {cm}
              </MobileItem>
            );
          }
          break;
        case 'Cron':
钟是志's avatar
钟是志 committed
3724 3725 3726 3727 3728 3729
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3730 3731 3732 3733 3734
                    {
                      required: required,
                      message: '请输入' + title,
                    },
                  ],
3735
          })(<CronEditorDiy />);
3736 3737 3738 3739 3740 3741 3742 3743
          break;
        case 'LocationCom':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: {},
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757
                    {
                      required,
                      message: '请获取定位信息',
                      validator: (rule, valueThis, callback) => {
                        let errors = [];
                        console.log(valueThis);
                        if (
                          (!valueThis || !JSON.stringify(valueThis).includes('address')) &&
                          required
                        ) {
                          errors.push(new Error('请获取定位信息', rule.field));
                        }
                        callback(errors);
                      },
3758
                    },
3759
                  ],
3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780
          })(
            <LocationCom
              get={get}
              json={json}
              btnName={json.btnName}
              btnSucName={json.btnSucName}
              width={json.width}
              showMap={json.showMap}
            />,
          );
          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3781 3782
                label={title}
              >
3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830
                {cm}
              </MobileItem>
            );
          }
          break;
        case 'ChildForm':
          // console.log(datas, json);
          cm = getFieldDecorator(dataColumn.base52, { initialValue: initValue || {} })(
            <ChildForm
              taskId={this.props.taskId}
              setRealTimeValues={this.props.setRealTimeValues}
              rights={json.rights || []}
              hfInstance={this.props.hfInstance}
              getCurrentFormTitle={this.props.getCurrentFormTitle}
              getCellValue={getCellValue}
              isMobile={get === 'mobile'}
              trees={this.props.trees}
              fatherObj={obj}
              isPreview={isPreview}
              num={json.num}
              min={json.min}
              max={json.max}
              json={json}
              deleteName={json.deleteName}
              addName={json.addName}
              isEdit={isEdit}
              base52={dataColumn.base52}
              mapData={mapData}
              datas={datas ? datas[json.childFormKey] : null}
              datasAll={datas}
              // datas={datas}
              defaultValues={defaultValues}
              sqlData={sqlData}
              form={this.props.form}
            />,
          );

          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3831 3832
                label={title}
              >
3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844
                {cm}
              </MobileItem>
            );
          }
          break;
        case 'ImgUploadCom':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3845 3846 3847 3848 3849
                    {
                      required: required,
                      message: '请上传图片',
                    },
                  ],
3850
          })(<ImgUploadCom json={json} disabled={disabled} otherProps={this.otherProps}/>);
3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861
          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3862 3863
                label={title}
              >
3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875
                {cm}
              </MobileItem>
            );
          }
          break;
        case 'VideoUploadCom':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3876 3877 3878 3879 3880
                    {
                      required: required,
                      message: '请上传视频',
                    },
                  ],
3881
          })(<VideoUploadCom json={json} disabled={disabled} />);
3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892
          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3893 3894
                label={title}
              >
3895 3896 3897 3898 3899
                {cm}
              </MobileItem>
            );
          }
          break;
钟是志's avatar
钟是志 committed
3900
        case 'Signature': // 签名组件
3901 3902 3903 3904 3905 3906
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
3907 3908 3909 3910 3911
                    {
                      required: required,
                      message: '请进行签名',
                    },
                  ],
3912
          })(<Signature width={json.width} height={json.height} get={get} />);
3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923
          if (
            get === 'mobile' &&
            ((json.isMobileLabel != null && json.isMobileLabel) ||
              (json.isMobileLabel == null && json.isLabel)) &&
            title
          ) {
            cm = (
              <MobileItem
                isPreview={isPreview}
                labelCol={{ span: json.mLabelSpan || json.labelSpan }}
                wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
3924 3925
                label={title}
              >
3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936
                {cm}
              </MobileItem>
            );
          }
          break;
        case 'Table':
          if (json.objCode == null || json.objCode == '') {
            cm = <></>;
          } else {
            cm = (
              <>
3937
                {getFieldDecorator(dataColumn.base52 || uuid, {
3938 3939 3940 3941
                  initialValue: initValue || {},
                })(
                  <TableList
                    json={json}
3942
                    uuid={uuid}
3943 3944 3945 3946 3947 3948 3949 3950 3951
                    isTree={json.isTree}
                    isHiddenPage={json.isHiddenPage}
                    showHeader={json.showHeader}
                    loading={this.props.loading}
                    pageSize={json.pageSize}
                    objCode={json.objCode}
                    sql={json.filterSql}
                    rights={json.rights}
                    get={get}
钟是志's avatar
钟是志 committed
3952
                    obj={this.getObjValues()}
3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969
                  />,
                )}
              </>
            );
          }
          break;
      }
    }

    if (json.isLabel) {
      if (get === 'mobile' && !this.props.isEdit) {
        return (
          <List
            style={{
              margin: 5,
              border: '1px solid #ccc',
            }}
3970 3971
            className={styles.mobileList}
          >
3972 3973 3974 3975 3976
            {modalCode ? (
              <FormModal
                {...modalProps}
                visible={this.props.DataColumn.isShowModal[modalCode]}
                handleCancel={this.closeModal.bind(this, modalCode)}
3977 3978
                title={modalTitle}
              >
3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002
                <ZdyTable
                  taskId={this.props.taskId}
                  taskAssignee={taskAssignee}
                  userId={userId}
                  trees={this.props.trees}
                  modalInit={modalInit}
                  key={modalCode}
                  datas={datas}
                  get={get}
                  isChild={true}
                  currentFormKey={modalCode}
                  isEdit={isEdit}
                  obj={obj}
                  init={init}
                  form={this.props.form}
                  mapData={mapData}
                  sqlData={sqlData}
                  {...datas[modalCode]}
                  defaultValues={defaultValues}
                />
              </FormModal>
            ) : (
              ''
            )}
4003 4004 4005 4006 4007 4008
            <List.Item extra={cm} multipleLine={true}>
              {title}
            </List.Item>
            {/*<Card.Header title={<span style={{ fontSize: 14 }}>{title}: {cm}</span>} />*/}
            {/*移动端只读模式 组件修改*/}
            {/*<Card.Body>{cm}</Card.Body>*/}
4009 4010 4011 4012 4013 4014 4015 4016 4017 4018
          </List>
        );
      }
      if (get === 'web') {
        if (!isEdit) {
          return (
            <Row
              style={{
                minHeight: 40,
                lineHeight: '40px',
4019 4020
              }}
            >
4021 4022 4023 4024 4025 4026 4027 4028 4029 4030
              <Col
                className={title ? styles.row_col_div : ''}
                span={json.labelSpan}
                style={{
                  textAlign: json.labelSpan === 24 ? 'left' : 'right',
                  lineHeight: '40px',
                  whiteSpace: 'nowrap',
                  overflow: 'hidden',
                  fontSize: 14,
                  color: 'rgba(0,0,0,0.85)',
4031 4032
                }}
              >
4033 4034 4035 4036 4037 4038 4039 4040
                {title}
                {title && (
                  <span
                    data-cell-component-name={json.comName || 'no_com'}
                    style={{
                      position: 'relative',
                      top: '-0.5px',
                      margin: '0 8px 0 2px',
4041 4042 4043 4044
                    }}
                  >
                    :
                  </span>
4045 4046 4047 4048 4049 4050 4051 4052 4053
                )}
              </Col>
              <Col
                span={json.wrapperSpan}
                style={{
                  position: 'relative',
                  lineHeight: '40px',
                  zoom: 1,
                  fontSize: 14,
4054 4055
                }}
              >
4056 4057 4058 4059 4060 4061 4062
                {cm}
              </Col>
              {modalCode ? (
                <FormModal
                  {...modalProps}
                  visible={this.props.DataColumn.isShowModal[modalCode]}
                  handleCancel={this.closeModal.bind(this, modalCode)}
4063 4064
                  title={modalTitle}
                >
4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092
                  <ZdyTable
                    taskId={this.props.taskId}
                    taskAssignee={taskAssignee}
                    userId={userId}
                    trees={this.props.trees}
                    modalInit={modalInit}
                    key={modalCode}
                    datas={datas}
                    get={get}
                    isChild={true}
                    currentFormKey={modalCode}
                    isEdit={isEdit}
                    obj={obj}
                    init={init}
                    form={this.props.form}
                    mapData={mapData}
                    sqlData={sqlData}
                    {...datas[modalCode]}
                    defaultValues={defaultValues}
                  />
                </FormModal>
              ) : (
                ''
              )}
            </Row>
          );
        } else {
          // console.log(datas);
4093

4094 4095 4096 4097 4098 4099 4100
          return (
            <>
              {modalCode ? (
                <FormModal
                  {...modalProps}
                  visible={this.props.DataColumn.isShowModal[modalCode]}
                  handleCancel={this.closeModal.bind(this, modalCode)}
4101 4102
                  title={modalTitle}
                >
4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131
                  <ZdyTable
                    taskId={this.props.taskId}
                    taskAssignee={taskAssignee}
                    userId={userId}
                    trees={this.props.trees}
                    modalInit={modalInit}
                    key={modalCode}
                    datas={datas}
                    get={get}
                    isChild={true}
                    currentFormKey={modalCode}
                    isEdit={isEdit}
                    obj={obj}
                    init={init}
                    form={this.props.form}
                    mapData={mapData}
                    sqlData={sqlData}
                    {...datas[modalCode]}
                    // items={}
                    defaultValues={defaultValues}
                  />
                </FormModal>
              ) : (
                ''
              )}
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
4132 4133
                data-cell-component-name={json.comName || 'no_com'}
              >
4134
                <ShowComName json={json} />
4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147
                {cm}
              </Form.Item>
            </>
          );
        }
      } else {
        return (
          <>
            {modalCode ? (
              <FormModal
                {...modalProps}
                visible={this.props.DataColumn.isShowModal[modalCode]}
                handleCancel={this.closeModal.bind(this, modalCode)}
4148 4149
                title={modalTitle}
              >
4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179
                <ZdyTable
                  taskId={this.props.taskId}
                  taskAssignee={taskAssignee}
                  userId={userId}
                  modalInit={modalInit}
                  trees={this.props.trees}
                  key={modalCode}
                  datas={datas}
                  get={get}
                  isChild={true}
                  currentFormKey={modalCode}
                  isEdit={isEdit}
                  obj={obj}
                  init={init}
                  form={this.props.form}
                  mapData={mapData}
                  sqlData={sqlData}
                  {...datas[modalCode]}
                  defaultValues={defaultValues}
                />
              </FormModal>
            ) : (
              ''
            )}
            {cm}
          </>
        );
      }
    } else {
      // console.log(datas[modalCode]);
4180

4181 4182 4183 4184 4185 4186 4187
      return (
        <>
          {modalCode ? (
            <FormModal
              {...modalProps}
              visible={this.props.DataColumn.isShowModal[modalCode]}
              handleCancel={this.closeModal.bind(this, modalCode)}
4188 4189
              title={modalTitle}
            >
4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218
              <ZdyTable
                taskId={this.props.taskId}
                taskAssignee={taskAssignee}
                userId={userId}
                trees={this.props.trees}
                modalInit={modalInit}
                key={modalCode}
                datas={datas}
                get={get}
                isChild={true}
                currentFormKey={modalCode}
                isEdit={isEdit}
                obj={obj}
                init={init}
                form={this.props.form}
                mapData={mapData}
                sqlData={sqlData}
                {...datas[modalCode]}
                defaultValues={defaultValues}
              />
            </FormModal>
          ) : (
            ''
          )}
          {json.isMobileLabel && !isEdit && get == 'mobile' ? (
            <MobileItem
              isPreview={isPreview}
              labelCol={{ span: json.mLabelSpan || json.labelSpan }}
              wrapperCol={{ span: json.mWrapperSpan || json.wrapperSpan }}
4219 4220
              label={title}
            >
4221 4222 4223 4224 4225 4226 4227 4228
              {cm}
            </MobileItem>
          ) : isEdit && get == 'web' ? (
            json.isLabel ? (
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
4229
              >
4230
                <ShowComName json={json} />
4231
                {cm}
4232 4233 4234
              </Form.Item>
            ) : (
              <Form.Item>
4235
                <ShowComName json={json} />
4236 4237 4238 4239 4240 4241 4242 4243 4244 4245
                {cm}
              </Form.Item>
            )
          ) : (
            cm
          )}
        </>
      );
    }
  }
徐立's avatar
徐立 committed
4246
}