index.jsx 104.0 KB
Newer Older
徐立's avatar
徐立 committed
1 2 3 4 5 6 7
/**
 * 徐立
 * 2019年9月22日
 * 动态表格组件返回对应的组件
 */
import React, { Component } from 'react';
import md5 from 'js-md5';
8
import FormModal from './FormModal';
徐立's avatar
徐立 committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
import {
  message,
  Icon,
  Input,
  InputNumber,
  Button,
  Checkbox,
  DatePicker,
  Radio,
  Switch,
  Modal,
  TimePicker,
  Row,
  Col,
  Select,
  Upload,
  Form,
  Table,
徐立's avatar
徐立 committed
27
  notification,
徐立's avatar
徐立 committed
28
} from 'antd';
chscls@163.com's avatar
chscls@163.com committed
29
import UUID from 'react-native-uuid';
徐立's avatar
徐立 committed
30
import QRCode from 'qrcode.react';
徐立's avatar
徐立 committed
31 32
import { EditorState, Editor } from 'draft-js';
import MyBlockRenderer from '../App/MyBlockRender';
徐立's avatar
徐立 committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
import {
  InputItem as MobileInputItem,
  ImagePicker as MobileImagePicker,
  Modal as MobileModal,
  DatePicker as MobileDatePicker,
  List as MobileList,
  Picker as MobilePicker,
  Flex,
  Card,
  Toast,
  Checkbox as MobileCheckbox,
  TextareaItem as MobileTextareaItem,
  Switch as MobileSwitch,
} from 'antd-mobile';
import ReactEcharts from 'echarts-for-react';
48
import ZdyTable from '../Table/index';
徐立's avatar
徐立 committed
49 50 51
import { connect } from 'dva';
import UploadCom from '../libs/UploadCom';
import TableSelect from '../libs/TableSelect';
52
import LocationCom from '../libs/LocationCom';
徐立's avatar
徐立 committed
53 54
import MobileDate from '../libs/MobileDate';
import ChildForm from '../libs/ChildForm';
chscls@163.com's avatar
chscls@163.com committed
55
import ImgUploadCom from '../libs/ImgUploadCom';
徐立's avatar
徐立 committed
56 57 58 59
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
60
import config from '@/webPublic/one_stop_public/config';
61 62
import { isEmpty, isNaN, cloneDeep } from 'lodash';
import { queryApiActionPath } from '../utils/queryConfig';
徐立's avatar
徐立 committed
63 64 65
import { extend } from 'umi-request';
import { date } from '../libs/formList/config';
import Highlighter from 'react-highlight-words';
徐立's avatar
徐立 committed
66
import Signature from '../Signature';
67
import baseX from 'base-x';
徐立's avatar
徐立 committed
68
import { changeToDraftState } from '../utils/myutils';
69 70 71
const Bs64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
const base64 = baseX(Bs64);
import { Base16Encode } from '../Base16/index';
徐立's avatar
徐立 committed
72
import { getToken } from '../utils/token';
73
import { formulaList } from '../excelInitFuc/functionList';
徐立's avatar
徐立 committed
74
import FilePreview from '../filePreview';
chscls@163.com's avatar
chscls@163.com committed
75
import DraftEditorCom from '../App/DraftEditorCom';
徐立's avatar
徐立 committed
76 77
const Item = MobileList.Item;
const Brief = Item.Brief;
wanyielin's avatar
wanyielin committed
78 79
function getBase64(value) {
  return value ? base64.encode(new Buffer(value)) : null;
徐立's avatar
徐立 committed
80 81 82 83 84 85 86
}
const codeMessage = {
  200: '服务器成功返回请求的数据。',
  201: '新建或修改数据成功。',
  202: '一个请求已经进入后台排队(异步任务)。',
  204: '删除数据成功。',
  400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
chscls@163.com's avatar
chscls@163.com committed
87
  401: '登录已过期,请重新登录',
徐立's avatar
徐立 committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
  403: '用户得到授权,但是访问是被禁止的。',
  404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
  406: '请求的格式不可得。',
  410: '请求的资源被永久删除,且不会再得到的。',
  422: '当创建一个对象时,发生一个验证错误。',
  500: '服务器发生错误,请检查服务器。',
  502: '网关错误。',
  503: '服务不可用,服务器暂时过载或维护。',
  504: '网关超时。',
};
const { TextArea } = Input;
const { Option } = Select;
const must = <span style={{ color: '#FF5350', marginLeft: 5, marginRight: 5 }}>*</span>;
const { MonthPicker, RangePicker } = DatePicker;
const AgreeItem = MobileCheckbox.AgreeItem;
const errorHandler = error => {
  const { response } = error;
徐立's avatar
徐立 committed
105

徐立's avatar
徐立 committed
106 107
  if (response && response.status) {
    const errorText = codeMessage[response.status] || response.statusText;
徐立's avatar
徐立 committed
108

109
    message.error(`请求错误${errorText}`);
chscls@163.com's avatar
chscls@163.com committed
110 111 112 113 114
    if (response.status === 401) {
      return window.g_app._store.dispatch({
        type: 'login/loginout',
      });
    }
徐立's avatar
徐立 committed
115
  } else {
116
    message.error(`网络故障,请检查网络链接或联系管理员`);
徐立's avatar
徐立 committed
117 118 119
  }
};

wanyielin's avatar
wanyielin committed
120
@connect(({ DataColumn, SqlManageEntity, formList, loading }) => ({
121 122 123 124
  DataColumn,
  SqlManageEntity,
  formList,
  loading: loading.models.DataColumn || loading.models.SqlManageEntity || loading.models.formList,
徐立's avatar
徐立 committed
125 126 127 128 129 130
}))
export default class tableCom extends Component {
  state = {
    options: this.props.options || [],
    labels: [],
    url: null,
131 132
    selectDis: true, // 让下拉框在获取到数据前失效,防止网络卡顿用户点击时造成页面白屏
    isDate: true, // 避免重复调用
徐立's avatar
徐立 committed
133 134 135 136 137 138 139 140
    sqlKeys: {},
    searchText: '',
    reqUrls: {},
    res: null,
    option: {},
    sqlModel: {},
    columns: [],
    sqlContent: null,
徐立's avatar
徐立 committed
141
    modalProps: {},
142 143 144
    modalTitle: '',
    modalInit: {},
    modalCode: null,
徐立's avatar
徐立 committed
145 146
    dataSource: {
      list: [],
147
      pagination: false,
徐立's avatar
徐立 committed
148 149
    },
  };
150 151 152
  excludeKeys = ['defaultValues', ''];
  closeModal = callback => {
    const { dispatch } = this.props;
chscls@163.com's avatar
chscls@163.com committed
153

154 155 156 157 158 159
    dispatch({
      type: 'DataColumn/showModal',
      payload: { isShowModal: false },
      callback: callback,
    });
  };
徐立's avatar
徐立 committed
160
  showModal = (fk, title, data, modalProps) => {
161
    const { dispatch } = this.props;
徐立's avatar
徐立 committed
162

163 164 165 166
    dispatch({
      type: 'DataColumn/showModal',
      payload: { isShowModal: true },
      callback: () => {
徐立's avatar
徐立 committed
167 168 169 170 171 172
        this.setState({
          modalInit: data,
          modalTitle: title,
          modalCode: fk,
          modalProps: modalProps,
        });
173 174 175
      },
    });
  };
徐立's avatar
徐立 committed
176

177
  equal = (obj1, obj2, json, sqlContent, depth) => {
徐立's avatar
徐立 committed
178
    if (obj1 == null && obj2 != null) {
179
      return false;
徐立's avatar
徐立 committed
180 181
    }
    if (obj1 != null && obj2 == null) {
182
      return false;
徐立's avatar
徐立 committed
183 184
    }
    if (obj1 == null && obj2 == null) {
185
      return true;
徐立's avatar
徐立 committed
186 187 188 189
    }

    if (obj1 instanceof Date) {
      if (obj1.valueOf() != obj2.valueOf()) {
190
        return false;
徐立's avatar
徐立 committed
191 192 193
      }
    } else if (obj1 instanceof moment) {
      if (obj1.valueOf() != obj2.valueOf()) {
194
        return false;
徐立's avatar
徐立 committed
195 196 197
      }
    } else if (typeof obj1 == 'function') {
      if (obj1.toString() != obj2.toString()) {
198
        return false;
徐立's avatar
徐立 committed
199 200 201
      }
    }

202
    const keys = new Set();
徐立's avatar
徐立 committed
203
    if (obj2 != null) {
204 205 206
      Object.keys(obj2).forEach(k => {
        if (k != '') keys.add(k);
      });
徐立's avatar
徐立 committed
207 208
    }
    if (obj1 != null) {
209 210 211
      Object.keys(obj1).forEach(k => {
        if (k != '') keys.add(k);
      });
徐立's avatar
徐立 committed
212 213
    }

214
    let res = true;
徐立's avatar
徐立 committed
215 216

    for (let key of keys) {
217 218
      if (key == '') {
        continue;
徐立's avatar
徐立 committed
219
      }
徐立's avatar
徐立 committed
220

徐立's avatar
徐立 committed
221
      if (this.excludeKeys.includes(key)) {
222
        continue;
徐立's avatar
徐立 committed
223 224 225
      }

      if (obj1[key] == null && obj2[key] != null) {
226
        res = false;
徐立's avatar
徐立 committed
227 228 229
        break;
      }
      if (obj1[key] != null && obj2[key] == null) {
230
        res = false;
徐立's avatar
徐立 committed
231 232
        break;
      }
徐立's avatar
徐立 committed
233

234 235 236 237 238 239 240 241 242
      if (
        depth == 1 &&
        ((this.props.json.sqlKey == null &&
          sqlContent == null &&
          json.formula == null &&
          json.funcs == null) ||
          (sqlContent != null && sqlContent.indexOf(key) == -1) ||
          (json.formula != null &&
            json.formula.indexOf(key) == -1 &&
徐立's avatar
徐立 committed
243 244
            json.funcs != null &&
            json.funcs.indexOf(key) == -1))
245 246 247 248
      ) {
        this.excludeKeys.push(key);

        continue;
徐立's avatar
徐立 committed
249 250 251
      }

      if (obj1[key] == null && obj2[key] == null) {
252
        continue;
徐立's avatar
徐立 committed
253 254
      }
      if (isNaN(obj1[key]) && isNaN(obj2[key])) {
255
        continue;
徐立's avatar
徐立 committed
256 257 258 259 260 261 262 263 264
      }
      /*  if (this.typeOf(obj1[key]) != this.typeOf(obj1[key])) {

         res = false
         break;
       } */

      if (obj1[key] instanceof Array) {
        if (obj1[key].length != obj2[key].length) {
265
          res = false;
徐立's avatar
徐立 committed
266 267
          break;
        } else {
268
          var xx = true;
徐立's avatar
徐立 committed
269 270

          for (var i = 0; i < obj1[key].length; i++) {
chscls@163.com's avatar
chscls@163.com committed
271
            if (!this.equal(obj1[key][i], obj2[key][i], json, sqlContent, depth + 1)) {
272
              xx = false;
徐立's avatar
徐立 committed
273 274 275 276 277
              break;
            }
          }

          if (!xx) {
278
            res = false;
徐立's avatar
徐立 committed
279 280 281 282
            break;
          }
        }
      } else if (obj1[key] instanceof Object) {
283
        const x = this.equal(obj1[key], obj2[key], json, sqlContent, depth + 1);
徐立's avatar
徐立 committed
284 285

        if (!x) {
286
          res = false;
徐立's avatar
徐立 committed
287 288
          break;
        }
289
      } else if (typeof obj1[key] == 'function') {
徐立's avatar
徐立 committed
290
        if (obj1[key].toString() != obj2[key].toString()) {
291
          res = false;
徐立's avatar
徐立 committed
292 293 294 295
          break;
        }
      } else {
        if (obj1[key] != obj2[key]) {
296
          res = false;
徐立's avatar
徐立 committed
297 298 299 300 301 302 303 304
          break;
        }
      }
    }

    return res;
  };

wanyielin's avatar
wanyielin committed
305
  getRender = (com, props) => {
306 307 308 309 310 311 312 313 314 315 316 317 318 319
    if (com == 'span') return <span {...props} />;
    if (com == 'a') return <a {...props} />;
    if (com == 'div') return <div {...props} />;
    if (com == 'canvas') return <canvas {...props} />;
    if (com == 'iframe') return <iframe {...props} />;
    if (com == 'img') {
      const src =
        props.src != null
          ? props.src.indexOf('http') > -1
            ? props.src
            : config.httpServer + props.src
          : null;
      const pp = { ...props, src: src };
      return <img {...pp} />;
徐立's avatar
徐立 committed
320
    }
321
  };
徐立's avatar
徐立 committed
322

徐立's avatar
徐立 committed
323 324 325
  /**
   * 判断传入值是否为JSON文本
   */
326
  isJSON = str => {
徐立's avatar
徐立 committed
327 328 329 330 331 332 333 334 335 336 337 338 339
    if (typeof str == 'string') {
      try {
        var obj = JSON.parse(str);
        if (typeof obj == 'object' && obj) {
          return true;
        } else {
          return false;
        }
      } catch (e) {
        console.log('error:' + str + '!!!' + e);
        return false;
      }
    }
340 341
    console.log('这不是个字符串');
  };
徐立's avatar
徐立 committed
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
  /**
   * 上传文件输入
   * 使用antd上传组件
   */
  file = {
    name: 'file',
    action: queryApiActionPath() + '/upload',
    onChange: info => {
      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();
徐立's avatar
徐立 committed
367

徐立's avatar
徐立 committed
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398
    this.setState({ searchText: selectedKeys[0] });
  };

  handleReset = clearFilters => {
    clearFilters();
    this.setState({ searchText: '' });
  };

  getColumnSearchProps = (dataIndex, title) => ({
    filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters }) => (
      <div style={{ padding: 8 }}>
        <Input
          ref={node => {
            this.searchInput = node;
          }}
          placeholder={`请输入${title}`}
          value={selectedKeys[0]}
          onChange={e => setSelectedKeys(e.target.value ? [e.target.value] : [])}
          onPressEnter={() => this.handleSearch(selectedKeys, confirm)}
          style={{ width: 188, marginBottom: 8, display: 'block' }}
        />
        <Button
          type="primary"
          onClick={() => this.handleSearch(selectedKeys, confirm)}
          icon="search"
          loading={this.props.loading}
          size="small"
          style={{ width: 90, marginRight: 8 }}
        >
          搜索
        </Button>
399 400 401 402 403 404
        <Button
          loading={this.props.loading}
          onClick={() => this.handleReset(clearFilters)}
          size="small"
          style={{ width: 90 }}
        >
徐立's avatar
徐立 committed
405 406 407 408
          重置
        </Button>
      </div>
    ),
409 410
    filterIcon: filtered => <Icon type="search" style={{ color: filtered ? '#1890ff' : 'red' }} />,
    onFilter: (value, record) =>
徐立's avatar
徐立 committed
411
      record[dataIndex]
412 413 414 415 416
        ? record[dataIndex]
            .toString()
            .toLowerCase()
            .includes(value.toLowerCase())
        : '',
徐立's avatar
徐立 committed
417 418 419 420 421 422 423
    onFilterDropdownVisibleChange: visible => {
      if (visible) {
        setTimeout(() => this.searchInput.select());
      }
    },
    render: text => {
      if (text != null) {
424 425 426 427 428 429 430 431
        return (
          <Highlighter
            highlightStyle={{ backgroundColor: '#ffc069', padding: 0 }}
            searchWords={[this.state.searchText]}
            autoEscape
            textToHighlight={text.toString()}
          />
        );
徐立's avatar
徐立 committed
432
      } else {
433
        return '';
徐立's avatar
徐立 committed
434 435 436 437 438 439
      }
    },
  });

  componentWillReceiveProps(props) {
    const { json, mapData, obj } = props;
440
    if (json == null || this.props.safe) {
徐立's avatar
徐立 committed
441 442
      return;
    }
443 444 445 446
    if (
      !(this.dataFilter.includes(json.comName) || json.comName == 'TableSelect') &&
      json.isFormulaOnce
    ) {
徐立's avatar
徐立 committed
447 448
      return;
    }
449 450 451 452 453 454 455
    if (
      !(
        this.dataFilter.includes(json.comName) ||
        json.comName == 'TableSelect' ||
        (json.formula != null && json.formula != '')
      )
    ) {
徐立's avatar
徐立 committed
456 457
      return;
    }
458 459 460 461
    const obj2 = props.form.getFieldsValue();
    const bb = this.equal(this.obj, obj2, json, this.state.sqlContent, 1);
    let bb2 = true;
    let childObj2 = {};
徐立's avatar
徐立 committed
462 463 464
    if (props.fatherCode) {
      if (obj2 != null && obj2[props.fatherCode]) {
        childObj2 = obj2[props.fatherCode][props.index];
徐立's avatar
徐立 committed
465

466
        bb2 = this.equal(this.childObj, childObj2, json, this.state.sqlContent, 1);
徐立's avatar
徐立 committed
467 468 469 470
      }
    }

    if (!(bb && bb2)) {
471
      const now = new Date().valueOf();
徐立's avatar
徐立 committed
472 473 474 475 476 477 478 479 480 481 482

      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) {
483
        this.count.splice(0, j);
徐立's avatar
徐立 committed
484 485
      }
      if (this.count.length > 10) {
486 487 488 489
        console.log(
          `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
            1}列:存在循环风险,1秒内执行超过10次,现已停止执行,请检查,`,
        );
徐立's avatar
徐立 committed
490 491 492 493

        return;
      }
      if (!bb) {
494
        this.obj = cloneDeep(obj2);
徐立's avatar
徐立 committed
495 496
      }
      if (!bb2) {
497
        this.childObj = cloneDeep(childObj2);
徐立's avatar
徐立 committed
498
      }
499
      this.count.push(now);
徐立's avatar
徐立 committed
500
    } else {
501
      return;
徐立's avatar
徐立 committed
502 503
    }

wanyielin's avatar
wanyielin committed
504
    const bindObj = this.getColumn('c1');
chscls@163.com's avatar
chscls@163.com committed
505

506 507 508 509 510 511 512 513 514 515 516
    let dataColumn =
      this.props.fatherCode != null
        ? bindObj
          ? {
              ...bindObj,
              base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
            }
          : { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
        : bindObj;
    if (this.props.fatherCode == null && dataColumn == null)
      dataColumn = { base52: this.props.uuid };
wanyielin's avatar
wanyielin committed
517 518 519 520 521 522
    /*     if (this.props.fatherCode != null) {
          dataColumn = { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
        } else {
          dataColumn = { base52: this.props.uuid }
          if (Object.keys(mapData).length > 0) {
            const columnIds = json.columnIds;
523

wanyielin's avatar
wanyielin committed
524 525 526 527 528 529
            if (columnIds && columnIds['c1']) {
              const columnId = columnIds['c1'][columnIds['c1'].length - 1];
              if (mapData[columnId] != null) {
                dataColumn = mapData[columnId]
              }
            }
徐立's avatar
徐立 committed
530 531 532
          }
        }
      }
chscls@163.com's avatar
chscls@163.com committed
533
    } */
wanyielin's avatar
wanyielin committed
534 535
    if (!this.props.isEdit && this.props.fatherCode) {
      if (bindObj != null) {
536
        dataColumn.base52 = bindObj.base52;
wanyielin's avatar
wanyielin committed
537
      } else {
538
        dataColumn.base52 = this.props.uuid;
chscls@163.com's avatar
chscls@163.com committed
539
      }
wanyielin's avatar
wanyielin committed
540 541
    }

542 543 544 545 546 547 548
    if (this.dataFilter.includes(json.comName) || json.comName == 'TableSelect') {
      const obj2 = {
        ...obj,
        ...props.form.getFieldsValue(),
        ...props.defaultValues[this.props.formKey],
      };
      this.getData(json, dataColumn, obj2);
徐立's avatar
徐立 committed
549
    }
550 551
    if (json.formula != null && json.formula != '' && !json.isFormulaOnce) {
      this.getFunctionValue(json.formula, dataColumn, json);
徐立's avatar
徐立 committed
552 553
    }
  }
554
  dataFilter = ['Select', 'Radio', 'Checkbox'];
徐立's avatar
徐立 committed
555 556

  getData = (json, dataColumn, obj, init) => {
557 558 559 560 561
    const allValues = JSON.stringify(obj);
    if (json.comName == 'TableSelect') {
      const { dispatch } = this.props;
      const { sqlKey, optionType } = json;
      if (optionType == 'sql') {
徐立's avatar
徐立 committed
562 563 564 565
        dispatch({
          type: 'SqlManageEntity/find',
          payload: { sqlKey: sqlKey },
          callback: sqlModel => {
566
            this.setState({ sqlModel });
徐立's avatar
徐立 committed
567 568 569 570 571 572
            if (sqlModel.dataObjId) {
              dispatch({
                type: 'formList/getHead',
                payload: { dataObjId: sqlModel.dataObjId },
                callback: datas => {
                  if (datas) {
573
                    const columns = [];
徐立's avatar
徐立 committed
574 575 576 577 578
                    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;
579 580 581 582
                        if (
                          ['DATE', 'DATETIME', 'TIME', 'TIMESTAMP', 'YEAR'].includes(datas[i].type)
                        ) {
                          column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
徐立's avatar
徐立 committed
583 584 585
                        }
                        columns.push(column);
                      } else {
586
                        break;
徐立's avatar
徐立 committed
587 588
                      }
                    }
589
                    this.setState({ columns });
徐立's avatar
徐立 committed
590
                  }
591 592
                },
              });
徐立's avatar
徐立 committed
593
            } else {
594
              const cols = sqlModel.cols;
徐立's avatar
徐立 committed
595
              if (cols != null || cols.length > 0) {
596 597
                const columns = [];
                const cll = JSON.parse(cols);
徐立's avatar
徐立 committed
598 599 600 601 602
                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)) {
603
                    var ff = 'YYYY-MM-DD HH:mm:ss';
徐立's avatar
徐立 committed
604
                    switch (cll[k].type) {
605 606 607 608 609 610 611 612 613
                      case 'DATE':
                        ff = 'YYYY-MM-DD';
                        break;
                      case 'YEAR':
                        ff = 'YYYY';
                        break;
                      case 'TIME':
                        ff = 'HH:mm:ss';
                        break;
徐立's avatar
徐立 committed
614 615
                    }

616
                    column.render = val => moment(parseInt(val)).format(ff);
徐立's avatar
徐立 committed
617 618 619 620 621
                  }
                  if (cll[k].isQuery) {
                    column = {
                      ...this.getColumnSearchProps(cll[k].name, cll[k].title),
                      ...column,
622
                    };
徐立's avatar
徐立 committed
623 624 625 626
                  }

                  columns.push(column);
                }
627
                this.setState({ columns });
徐立's avatar
徐立 committed
628 629 630 631 632 633 634 635
              }

              dispatch({
                type: 'DataColumn/getSqlData',
                payload: { sqlKey, allValues },
                callback: list => {
                  const x = {
                    list: list,
636 637 638 639 640
                    pagination: false,
                  };
                  this.setState({ dataSource: x });
                },
              });
徐立's avatar
徐立 committed
641
            }
642 643 644
          },
        });
      } else if (optionType == 'reference' && dataColumn.referenceObjId) {
徐立's avatar
徐立 committed
645 646
        dispatch({
          type: 'formList/getHead',
wanyielin's avatar
wanyielin committed
647
          payload: { dataObjId: dataColumn.referenceObjId },
徐立's avatar
徐立 committed
648 649
          callback: datas => {
            if (datas) {
650
              const columns = [];
徐立's avatar
徐立 committed
651 652 653 654 655 656
              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)) {
657
                    column.render = val => moment(val).format('YYYY-MM-DD HH:mm:ss');
徐立's avatar
徐立 committed
658 659 660
                  }
                  columns.push(column);
                } else {
661
                  break;
徐立's avatar
徐立 committed
662 663
                }
              }
664
              this.setState({ columns });
徐立's avatar
徐立 committed
665
            }
666 667
          },
        });
徐立's avatar
徐立 committed
668 669 670 671 672
      }
    }

    if (json.optionType != null && this.dataFilter.includes(json.comName)) {
      switch (json.optionType) {
673
        case 'reference':
徐立's avatar
徐立 committed
674
          if (dataColumn.referenceObjId != null) {
675
            this.fetchData(obj, dataColumn, init, json.filterSql, allValues);
徐立's avatar
徐立 committed
676 677
          }
          break;
678 679
        case 'enum':
          if (json.enums != null && json.enums != '') {
徐立's avatar
徐立 committed
680 681
            var enu;
            try {
682
              enu = JSON.parse(json.enums);
徐立's avatar
徐立 committed
683
            } catch (e) {
684 685
              message.error('枚举json格式存在问题');
              enu = [];
徐立's avatar
徐立 committed
686 687
            }

688
            this.changeEnum(obj, dataColumn, enu);
徐立's avatar
徐立 committed
689 690
          }
          break;
691 692 693 694 695 696 697 698 699 700 701
        case 'sql':
          if (json.sqlKey != null && json.sqlKey != '') {
            this.fetchData3(
              obj,
              dataColumn,
              init,
              json.sqlKey,
              json.labelName,
              json.valueName,
              allValues,
            );
徐立's avatar
徐立 committed
702 703
          }
          break;
704 705
        case 'func':
          if (json.funcs != null && json.funcs != '') {
徐立's avatar
徐立 committed
706
            let enu;
wanyielin's avatar
wanyielin committed
707

徐立's avatar
徐立 committed
708
            try {
wanyielin's avatar
wanyielin committed
709
              this.getFunctionValue(json.funcs, { base52: this.props.uuid }, json, () => {
chscls@163.com's avatar
chscls@163.com committed
710
                if (init != null && Object.keys(init).length > 0) {
711 712
                  let base52 = dataColumn.base52;
                  let vlu = this.props.form.getFieldValue(base52);
wanyielin's avatar
wanyielin committed
713 714 715
                  if (vlu instanceof Array) {
                    for (var i = 0; i < this.state.options.length; i++) {
                      if (vlu.includes(this.state.options[i].value)) {
716
                        labs.push(this.state.options[i].label);
chscls@163.com's avatar
chscls@163.com committed
717 718
                      }
                    }
wanyielin's avatar
wanyielin committed
719 720 721
                  } else {
                    for (var i = 0; i < this.state.options.length; i++) {
                      if (vlu == this.state.options[i].value) {
722
                        labs.push(this.state.options[i].label);
chscls@163.com's avatar
chscls@163.com committed
723 724 725 726
                        break;
                      }
                    }
                  }
wanyielin's avatar
wanyielin committed
727

728
                  this.setState({ labels: labs });
wanyielin's avatar
wanyielin committed
729
                } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
730
                  let base52 = dataColumn.base52;
wanyielin's avatar
wanyielin committed
731

732
                  const vlu = obj[base52];
wanyielin's avatar
wanyielin committed
733

734
                  const labs = [];
wanyielin's avatar
wanyielin committed
735 736 737
                  if (vlu instanceof Array) {
                    for (var i = 0; i < this.state.options.length; i++) {
                      if (vlu.includes(this.state.options[i].value)) {
738
                        labs.push(this.state.options[i].label);
chscls@163.com's avatar
chscls@163.com committed
739 740
                      }
                    }
wanyielin's avatar
wanyielin committed
741 742 743
                  } else {
                    for (var i = 0; i < this.state.options.length; i++) {
                      if (vlu == this.state.options[i].value) {
744
                        labs.push(this.state.options[i].label);
chscls@163.com's avatar
chscls@163.com committed
745 746 747 748
                        break;
                      }
                    }
                  }
wanyielin's avatar
wanyielin committed
749

750
                  this.setState({ labels: labs });
wanyielin's avatar
wanyielin committed
751 752 753
                }
              });
            } catch (e) {
754
              message.error('公式选项配置存在问题');
wanyielin's avatar
wanyielin committed
755
            }
徐立's avatar
徐立 committed
756 757 758 759
          }
          break;
      }
    }
760
  };
徐立's avatar
徐立 committed
761 762 763

  setValues = (base52, json, values) => {
    try {
764
      this.props.form.setFieldsValue(values);
徐立's avatar
徐立 committed
765
    } catch (e) {
766 767 768 769 770
      console.log(
        `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
          1}列:公式配置有误,回调函数内部错误,`,
        e,
      );
771
      //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
772
    }
773
  };
wanyielin's avatar
wanyielin committed
774
  reqUtil = (base52, json, orgCallback, url, method, params, callback, options = {}) => {
徐立's avatar
徐立 committed
775
    //查缓存
chscls@163.com's avatar
chscls@163.com committed
776
    var isChange = true;
777 778
    if (url.indexOf('http') === -1) {
      url = config.httpServer + url;
徐立's avatar
徐立 committed
779
    }
780
    const { reqUrls } = this.state;
徐立's avatar
徐立 committed
781
    if (reqUrls[url] != null) {
782
      const ps = reqUrls[url].params;
徐立's avatar
徐立 committed
783 784

      if (Object.keys(params).length != Object.keys(ps).length) {
785
        isChange = true;
徐立's avatar
徐立 committed
786 787 788
      } else {
        for (var key in params) {
          if (params[key] == null && ps[key] != null) {
789
            isChange = true;
徐立's avatar
徐立 committed
790 791
            break;
          } else if (params[key] != null && ps[key] == null) {
792
            isChange = true;
徐立's avatar
徐立 committed
793 794 795
            break;
          } else {
            if (params[key] != ps[key]) {
796 797
              isChange = true;
              break;
徐立's avatar
徐立 committed
798 799 800 801 802
            }
          }
        }
      }
    } else {
803 804
      reqUrls[url] = { params: params };
      isChange = true;
徐立's avatar
徐立 committed
805
    }
徐立's avatar
徐立 committed
806
    console.log(isChange);
徐立's avatar
徐立 committed
807 808
    if (!isChange) {
      if (callback) {
809
        const data = reqUrls[url].data;
徐立's avatar
徐立 committed
810

811 812
        if (json.optionType && json.optionType == 'func') {
          const res = callback(data);
徐立's avatar
徐立 committed
813

814
          if (res != null && !(typeof res === 'function')) {
wanyielin's avatar
wanyielin committed
815
            this.setState({ options: res, selectDis: false }, () => {
816
              if (orgCallback) orgCallback();
chscls@163.com's avatar
chscls@163.com committed
817
            });
徐立's avatar
徐立 committed
818
          }
819
        } else if (json.comName == 'Button') {
徐立's avatar
徐立 committed
820
          try {
821
            callback(data);
徐立's avatar
徐立 committed
822
          } catch (e) {
823 824 825 826 827
            console.log(
              `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                1}列:公式配置有误,回调函数内部错误,`,
              e,
            );
828
            //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
829
          }
830
        } else if (json.comName == 'Echart' || json.comName == 'QRCode') {
徐立's avatar
徐立 committed
831
          try {
832
            const x = callback(data);
徐立's avatar
徐立 committed
833
            if (x != null) {
834
              this.setState({ option: x });
徐立's avatar
徐立 committed
835 836
            }
          } catch (e) {
837 838 839 840 841
            console.log(
              `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                1}列:公式配置有误,回调函数内部错误,`,
              e,
            );
842
            //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
843 844 845 846
          }
        } else {
          if (base52) {
            try {
847 848
              const x = callback(data);
              if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
徐立's avatar
徐立 committed
849
            } catch (e) {
850 851 852 853 854
              console.log(
                `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                  1}列:公式配置有误,回调函数内部错误,`,
                e,
              );
855
              //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
856 857 858 859
            }
          }
        }
      }
860
      return 'norefeshxxxxxxxxxxxxxxxxxxxx';
徐立's avatar
徐立 committed
861
    }
862
    this.setState({}, () => {
wanyielin's avatar
wanyielin committed
863 864
      for (let i in params) {
        if (params[i] == null) {
865
          delete params[i];
徐立's avatar
徐立 committed
866 867
        }
      }
wanyielin's avatar
wanyielin committed
868
      if (getToken() != null) {
869
        params.token = getToken();
徐立's avatar
徐立 committed
870
      }
徐立's avatar
徐立 committed
871

872
      const requestParams = params;
徐立's avatar
徐立 committed
873 874 875 876 877 878 879 880 881
      const umiRequest = extend({
        errorHandler, // 默认错误处理
        credentials: 'omit', // 默认请求是否带上cookie
        mode: 'cors',
        ...options,
      });
      umiRequest(url, {
        data: requestParams,
        method: method,
882
        requestType: 'form',
徐立's avatar
徐立 committed
883
      }).then(data => {
884 885 886
        const { reqUrls } = this.state;
        reqUrls[url].data = data;
        this.setState({ res: data, reqUrls }, () => {
徐立's avatar
徐立 committed
887
          if (callback) {
888 889
            if (json.optionType && json.optionType == 'func') {
              const res = callback(data);
徐立's avatar
徐立 committed
890

891
              if (res != null && !(typeof res === 'function')) {
wanyielin's avatar
wanyielin committed
892
                this.setState({ options: res, selectDis: false }, () => {
893
                  if (orgCallback) orgCallback();
chscls@163.com's avatar
chscls@163.com committed
894
                });
徐立's avatar
徐立 committed
895
              }
896
            } else if (json.comName == 'Button') {
徐立's avatar
徐立 committed
897
              try {
898
                callback(data);
徐立's avatar
徐立 committed
899
              } catch (e) {
900 901 902 903 904
                console.log(
                  `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                    1}列:公式配置有误,回调函数内部错误,`,
                  e,
                );
905
                //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
906
              }
907
            } else if (json.comName == 'Echart' || json.comName == 'QRCode') {
徐立's avatar
徐立 committed
908
              try {
909
                const x = callback(data);
徐立's avatar
徐立 committed
910
                if (x != null) {
911
                  this.setState({ option: x });
徐立's avatar
徐立 committed
912 913
                }
              } catch (e) {
914 915 916 917 918
                console.log(
                  `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                    1}列:公式配置有误,回调函数内部错误,`,
                  e,
                );
919
                //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
920 921 922 923
              }
            } else {
              if (base52) {
                try {
924 925
                  const x = callback(data);
                  if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
徐立's avatar
徐立 committed
926
                } catch (e) {
927 928 929 930 931
                  console.log(
                    `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                      1}列:公式配置有误,回调函数内部错误,`,
                    e,
                  );
932
                  //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
933 934 935 936
                }
              }
            }
          }
937 938 939
        });
      });
    });
徐立's avatar
徐立 committed
940

941 942
    return 'norefeshxxxxxxxxxxxxxxxxxxxx';
  };
wanyielin's avatar
wanyielin committed
943
  sqlUtil = (base52, json, orgCallback, sqlKey, params, callback, options = {}) => {
徐立's avatar
徐立 committed
944 945
    //查缓存
    var isChange = false;
946
    const { sqlKeys } = this.state;
徐立's avatar
徐立 committed
947 948

    if (sqlKeys[sqlKey] != null) {
949
      const ps = sqlKeys[sqlKey].params;
徐立's avatar
徐立 committed
950 951

      if (params.length != ps.length) {
952
        isChange = true;
徐立's avatar
徐立 committed
953 954 955
      } else {
        for (var i = 0; i < params.length; i++) {
          if (params[i] != ps[i]) {
956
            isChange = true;
徐立's avatar
徐立 committed
957 958 959 960 961
            break;
          }
        }
      }
    } else {
962 963
      sqlKeys[sqlKey] = { params: params };
      isChange = true;
徐立's avatar
徐立 committed
964 965 966
    }
    if (!isChange) {
      if (callback) {
967 968 969 970
        const data = sqlKeys[sqlKey].data;
        if (json.optionType && json.optionType == 'func') {
          const res = callback(data);
          if (res != null && !(typeof res === 'function')) {
wanyielin's avatar
wanyielin committed
971
            this.setState({ options: res, selectDis: false }, () => {
972
              if (orgCallback) orgCallback();
chscls@163.com's avatar
chscls@163.com committed
973
            });
徐立's avatar
徐立 committed
974
          }
975
        } else if (json.comName == 'Button') {
徐立's avatar
徐立 committed
976
          try {
977
            callback(data);
徐立's avatar
徐立 committed
978
          } catch (e) {
979 980 981 982 983
            console.log(
              `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                1}列:公式配置有误,回调函数内部错误,`,
              e,
            );
984
            //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
985
          }
986
        } else if (json.comName == 'Echart' || json.comName == 'QRCode') {
徐立's avatar
徐立 committed
987
          try {
988
            const x = callback(data);
徐立's avatar
徐立 committed
989
            if (x != null) {
990
              this.setState({ option: x });
徐立's avatar
徐立 committed
991 992
            }
          } catch (e) {
993 994 995 996 997
            console.log(
              `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                1}列:公式配置有误,回调函数内部错误,`,
              e,
            );
998
            //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
999 1000 1001 1002
          }
        } else {
          if (base52) {
            try {
1003 1004
              const x = callback(data);
              if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
徐立's avatar
徐立 committed
1005
            } catch (e) {
1006 1007 1008 1009 1010
              console.log(
                `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                  1}列:公式配置有误,回调函数内部错误,`,
                e,
              );
1011
              //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
1012 1013 1014 1015
            }
          }
        }
      }
1016
      return 'norefeshxxxxxxxxxxxxxxxxxxxx';
徐立's avatar
徐立 committed
1017 1018
    }

1019 1020 1021 1022 1023
    const allValues = JSON.stringify({
      ...this.props.obj,
      ...this.props.form.getFieldsValue(),
      ...this.props.defaultValues[this.props.formKey],
    });
徐立's avatar
徐立 committed
1024

1025
    const url = queryApiActionPath() + '/DataColumnApi/getSqlData';
徐立's avatar
徐立 committed
1026
    this.setState({ sqlKeys }, () => {
1027
      const pp = { sqlKey: Base16Encode(sqlKey), params, allValues: Base16Encode(allValues) };
wanyielin's avatar
wanyielin committed
1028
      if (getToken() != null) {
1029
        pp.token = getToken();
徐立's avatar
徐立 committed
1030 1031 1032 1033 1034 1035 1036 1037
      }
      const umiRequest = extend({
        errorHandler, // 默认错误处理
        credentials: 'omit', // 默认请求是否带上cookie
        mode: 'cors',
        ...options,
      });
      umiRequest(url, {
wanyielin's avatar
wanyielin committed
1038
        data: pp,
徐立's avatar
徐立 committed
1039
        method: 'POST',
1040
        requestType: 'form',
徐立's avatar
徐立 committed
1041
      }).then(data => {
1042 1043 1044
        const { sqlKeys } = this.state;
        sqlKeys[sqlKey].data = data;
        this.setState({ sqlKeys });
徐立's avatar
徐立 committed
1045
        if (data == null) {
1046
          return;
徐立's avatar
徐立 committed
1047 1048 1049
        }

        if (callback) {
1050 1051
          if (json.optionType && json.optionType == 'func') {
            const res = callback(data);
徐立's avatar
徐立 committed
1052

1053
            if (res != null && !(typeof res === 'function')) {
wanyielin's avatar
wanyielin committed
1054
              this.setState({ options: res, selectDis: false }, () => {
1055
                if (orgCallback) orgCallback();
chscls@163.com's avatar
chscls@163.com committed
1056
              });
徐立's avatar
徐立 committed
1057
            }
1058
          } else if (json.comName == 'Button') {
徐立's avatar
徐立 committed
1059
            try {
1060
              callback(data);
徐立's avatar
徐立 committed
1061
            } catch (e) {
1062 1063 1064 1065 1066
              console.log(
                `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                  1}列:公式配置有误,回调函数内部错误,`,
                e,
              );
1067
              //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
1068
            }
1069
          } else if (json.comName == 'Echart' || json.comName == 'QRCode') {
徐立's avatar
徐立 committed
1070
            try {
1071
              const x = callback(data);
徐立's avatar
徐立 committed
1072
              if (x != null) {
1073
                this.setState({ option: x });
徐立's avatar
徐立 committed
1074 1075
              }
            } catch (e) {
1076 1077 1078 1079 1080
              console.log(
                `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                  1}列:公式配置有误,回调函数内部错误,`,
                e,
              );
1081
              //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
1082 1083 1084 1085
            }
          } else {
            if (base52) {
              try {
1086 1087
                const x = callback(data);
                if (x == null || x != 'NaN') this.props.form.setFieldsValue({ [base52]: x });
徐立's avatar
徐立 committed
1088
              } catch (e) {
1089 1090 1091 1092 1093
                console.log(
                  `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                    1}列:公式配置有误,回调函数内部错误,`,
                  e,
                );
1094
                //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,回调函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
1095 1096 1097 1098
              }
            }
          }
        }
1099 1100
      });
    });
徐立's avatar
徐立 committed
1101

1102 1103
    return 'norefeshxxxxxxxxxxxxxxxxxxxx';
  };
徐立's avatar
徐立 committed
1104

wanyielin's avatar
wanyielin committed
1105
  getFunctionValue = (fun, column, json, callback) => {
徐立's avatar
徐立 committed
1106 1107 1108
    /*  if (!this.props.isEdit) {
       return
     } */
1109 1110
    const base52 = column.base52;

徐立's avatar
徐立 committed
1111 1112 1113 1114
    /**
     * 中台函数库注入
     * 动态生成表单配置函数所使用
     */
1115
    let functionObj = {};
徐立's avatar
徐立 committed
1116
    formulaList.map(item => {
1117 1118 1119 1120
      item.children.map(arr => {
        functionObj[arr.callKey] = arr.function;
      });
    });
徐立's avatar
徐立 committed
1121
    try {
1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143
      var fun1 = new Function(
        'obj',
        'init',
        'modalInit',
        'defaultValues',
        'env',
        'index',
        'fatherCode',
        'utils',
        '$',
        'routerState',
        'shareData',
        'sceneRouter',
        fun,
      );
      let obj;
      if (!this.props.isEdit && this.props.fatherCode) {
        obj = {
          ...this.props.fatherObj,
          ...this.props.form.getFieldsValue(),
          ...this.props.defaultValues[this.props.formKey],
        };
wanyielin's avatar
wanyielin committed
1144
      } else {
1145 1146 1147 1148 1149
        obj = {
          ...this.props.obj,
          ...this.props.form.getFieldsValue(),
          ...this.props.defaultValues[this.props.formKey],
        };
chscls@163.com's avatar
chscls@163.com committed
1150
      }
徐立's avatar
徐立 committed
1151

1152 1153 1154 1155 1156
      const value = fun1(
        obj,
        this.props.init,
        this.props.modalInit,
        this.props.defaultValues,
徐立's avatar
徐立 committed
1157 1158 1159 1160 1161 1162
        {
          clientType: this.props.get,
          formCode: this.props.formCode,
          formId: this.props.formId,
          isEdit: this.props.isEdit,
        },
1163 1164
        this.props.index,
        this.props.fatherCode,
wanyielin's avatar
wanyielin committed
1165
        {
徐立's avatar
徐立 committed
1166
          moment: moment,
wanyielin's avatar
wanyielin committed
1167
          sql: this.sqlUtil.bind(this, base52, json, callback),
1168 1169
          message: message,
          router: router,
徐立's avatar
徐立 committed
1170
          uuid: UUID,
徐立's avatar
徐立 committed
1171
          setValues: this.setValues.bind(this, base52, json),
wanyielin's avatar
wanyielin committed
1172
          req: this.reqUtil.bind(this, base52, json, callback),
1173 1174 1175 1176 1177
          md5: md5,
          showModal: this.showModal,
          closeModal: this.closeModal,
          render: this.getRender,
          base64: getBase64,
chscls@163.com's avatar
chscls@163.com committed
1178
          form:this.props.form
徐立's avatar
徐立 committed
1179
        },
徐立's avatar
徐立 committed
1180
        functionObj,
1181 1182
        this.props.routerState,
        this.props.messageData,
1183 1184
        this.props.concealModel,
      );
徐立's avatar
徐立 committed
1185

1186 1187
      if (base52) {
        if (value != null && value == 'norefeshxxxxxxxxxxxxxxxxxxxx') {
徐立's avatar
徐立 committed
1188 1189 1190 1191 1192
        } else {
          /**
           * 会出现重复调用2次,然后NAN造成无限循环
           */
          if (isNaN(value)) {
1193
            return;
徐立's avatar
徐立 committed
1194
          }
1195 1196 1197 1198
          if (json.comName == 'Button') {
            return value;
          } else if (json.optionType && json.optionType == 'func') {
            if (value != null && !(typeof value === 'function')) {
wanyielin's avatar
wanyielin committed
1199
              this.setState({ options: value, selectDis: false }, () => {
1200
                if (callback) callback();
chscls@163.com's avatar
chscls@163.com committed
1201
              });
chscls@163.com's avatar
chscls@163.com committed
1202
            }
1203 1204
          } else if (json.comName == 'Echart' || json.comName == 'QRCode') {
            this.setState({ option: value });
徐立's avatar
徐立 committed
1205 1206
          } else {
            try {
1207 1208 1209 1210 1211 1212 1213
              this.props.form.setFieldsValue({ [base52]: value });
            } catch {
              console.log(
                `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
                  1}列:公式配置有误,函数内部错误,`,
                e,
              );
1214
              //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,函数内部错误${e}`, 10)
徐立's avatar
徐立 committed
1215 1216 1217 1218 1219
            }
          }
        }
      }
    } catch (e) {
1220 1221 1222 1223 1224
      console.log(
        `页面${this.props.formKey}${this.props.i + 1}行,第${this.props.j +
          1}列:公式配置有误,暂存失败,`,
        e,
      );
1225
      //message.error(`页面${this.props.formKey}第${this.props.i + 1}行,第${this.props.j + 1}列:公式配置有误,暂存失败${e}`, 10)
徐立's avatar
徐立 committed
1226
    }
1227
  };
徐立's avatar
徐立 committed
1228 1229 1230
  componentDidMount() {
    const { json, mapData, obj, init } = this.props;
    if (json == null) {
1231
      return;
徐立's avatar
徐立 committed
1232
    }
1233 1234
    if (json.sqlKey != null && json.sqlKey != '') {
      const { dispatch } = this.props;
徐立's avatar
徐立 committed
1235 1236 1237 1238
      dispatch({
        type: 'SqlManageEntity/find',
        payload: { sqlKey: json.sqlKey },
        callback: res => {
1239 1240 1241 1242
          this.setState({ sqlContent: res.sql });
        },
      });
    }
徐立's avatar
徐立 committed
1243

wanyielin's avatar
wanyielin committed
1244 1245
    const bindObj = this.getColumn('c1');

1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256
    let dataColumn =
      this.props.fatherCode != null
        ? bindObj
          ? {
              ...bindObj,
              base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
            }
          : { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
        : bindObj;
    if (this.props.fatherCode == null && dataColumn == null)
      dataColumn = { base52: this.props.uuid };
徐立's avatar
徐立 committed
1257

wanyielin's avatar
wanyielin committed
1258 1259
    if (!this.props.isEdit && this.props.fatherCode) {
      if (bindObj != null) {
1260
        dataColumn.base52 = bindObj.base52;
wanyielin's avatar
wanyielin committed
1261
      } else {
1262
        dataColumn.base52 = this.props.uuid;
徐立's avatar
徐立 committed
1263 1264 1265
      }
    }

1266 1267 1268 1269
    this.getData(json, dataColumn, obj);
    if (json.formula != null && json.formula != '' && !this.props.safe) {
      this.getFunctionValue(json.formula, dataColumn, json);
    }
徐立's avatar
徐立 committed
1270 1271 1272 1273 1274 1275 1276 1277 1278 1279
  }
  fetchData3 = (obj, dataColumn, init, sqlKey, labelName, valueName, allValues) => {
    const { dispatch } = this.props;

    if (init != null && Object.keys(init).length > 0) {
      dispatch({
        type: 'DataColumn/getSqlOptions',
        payload: { sqlKey, allValues },
        callback: options => {
          const optionsx = [];
1280 1281
          let base52 = dataColumn.base52;
          let vl = this.props.form.getFieldValue(base52);
wanyielin's avatar
wanyielin committed
1282
          let isExist = false;
徐立's avatar
徐立 committed
1283
          for (var i = 0; i < options.length; i++) {
wanyielin's avatar
wanyielin committed
1284 1285
            if (vl == options[i][valueName] && !isExist) {
              isExist = true;
徐立's avatar
徐立 committed
1286 1287 1288 1289 1290 1291
            }
            optionsx.push({
              label: options[i][labelName],
              value: options[i][valueName],
            });
          }
徐立's avatar
徐立 committed
1292

wanyielin's avatar
wanyielin committed
1293
          if (!isExist && vl != null && options.length > 0) {
1294
            this.props.form.setFieldsValue({ [base52]: null });
徐立's avatar
徐立 committed
1295 1296 1297 1298 1299
          }
          this.setState({ options: optionsx, selectDis: false });
        },
      });
    } else if (!this.props.isEdit && Object.keys(obj).length > 0) {
1300
      let base52 = dataColumn.base52;
徐立's avatar
徐立 committed
1301
      if (this.props.fatherCode) {
1302 1303
        const x = base52.split('.');
        base52 = x[x.length - 1];
徐立's avatar
徐立 committed
1304
      }
徐立's avatar
徐立 committed
1305 1306 1307 1308 1309 1310 1311 1312
      if (obj[base52]) {
        dispatch({
          type: 'DataColumn/getSqlLabels',
          payload: { sqlKey, values: obj[base52], labelName, valueName, allValues },
          callback: labels => {
            this.setState({ labels, selectDis: false });
          },
        });
chscls@163.com's avatar
chscls@163.com committed
1313
      }
徐立's avatar
徐立 committed
1314 1315 1316 1317 1318
    } else {
      dispatch({
        type: 'DataColumn/getSqlOptions',
        payload: { sqlKey, allValues },
        callback: options => {
1319 1320
          let base52 = dataColumn.base52;
          let vl = this.props.form.getFieldValue(base52);
徐立's avatar
徐立 committed
1321
          const optionsx = [];
wanyielin's avatar
wanyielin committed
1322
          let isExist = false;
徐立's avatar
徐立 committed
1323
          for (var i = 0; i < options.length; i++) {
wanyielin's avatar
wanyielin committed
1324 1325
            if (vl == options[i][valueName] && !isExist) {
              isExist = true;
徐立's avatar
徐立 committed
1326 1327 1328 1329 1330 1331
            }
            optionsx.push({
              label: options[i][labelName],
              value: options[i][valueName],
            });
          }
徐立's avatar
徐立 committed
1332

wanyielin's avatar
wanyielin committed
1333
          if (!isExist && vl != null && options.length > 0) {
徐立's avatar
徐立 committed
1334
            //console.log("isExist",optionsx,vl,isExist)
1335
            this.props.form.setFieldsValue({ [base52]: null });
wanyielin's avatar
wanyielin committed
1336
          }
徐立's avatar
徐立 committed
1337

徐立's avatar
徐立 committed
1338 1339 1340 1341
          this.setState({ options: optionsx, selectDis: false });
        },
      });
    }
1342
  };
徐立's avatar
徐立 committed
1343 1344 1345
  changeEnum = (obj, dataColumn, options) => {
    if (!this.props.isEdit && Object.keys(obj).length > 0) {
      const values = obj[dataColumn.base52];
1346
      const labels = [];
徐立's avatar
徐立 committed
1347 1348 1349 1350
      if (values != null) {
        if (values instanceof Array) {
          for (var i = 0; i < options.length; i++) {
            if (values.includes(options[i].value)) {
1351
              labels.push(options[i].label);
徐立's avatar
徐立 committed
1352 1353 1354 1355 1356 1357
              // break;
            }
          }
        } else {
          for (var i = 0; i < options.length; i++) {
            if (values == options[i].value) {
1358
              labels.push(options[i].label);
徐立's avatar
徐立 committed
1359 1360 1361 1362 1363 1364 1365 1366 1367 1368
              // break;
            }
          }
        }
      }

      this.setState({ labels: labels, selectDis: false });
    } else {
      this.setState({ options: options, selectDis: false });
    }
1369
  };
徐立's avatar
徐立 committed
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413
  fetchData = (obj, dataColumn, init, filterSql, allValues) => {
    const { dispatch } = this.props;

    if (init != null && Object.keys(init).length > 0) {
      dispatch({
        type: 'DataColumn/getOptions',
        payload: { id: dataColumn.id, filterSql, allValues },
        callback: options => {
          const optionsx = [];
          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]) {
        dispatch({
          type: 'DataColumn/getLabels',
          payload: { id: dataColumn.id, values: obj[dataColumn.base52], filterSql, allValues },
          callback: labels => {
            this.setState({ labels, selectDis: false });
          },
        });
      }
    } else {
      dispatch({
        type: 'DataColumn/getOptions',
        payload: { id: dataColumn.id, filterSql, allValues },
        callback: options => {
          const optionsx = [];
          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 });
        },
      });
    }
1414
  };
徐立's avatar
徐立 committed
1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425
  getColumn = key => {
    let { mapData, json } = this.props;

    const columnIds = json.columnIds;

    if (
      columnIds == null ||
      Object.keys(columnIds).length == 0 ||
      columnIds[key] == null ||
      mapData == null
    ) {
chscls@163.com's avatar
chscls@163.com committed
1426
      return null;
徐立's avatar
徐立 committed
1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438
    }

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

    return dataColumn;
  };

  render() {
    /**
     * json为申请表单
     * obj为查看详情用户输入值
     */
1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450
    let {
      json,
      obj,
      mapData,
      init,
      sqlData,
      defaultValues,
      get,
      formKey,
      isEdit,
      datas,
    } = this.props;
徐立's avatar
徐立 committed
1451
    const { options, labels, selectDis, modalCode, modalTitle, modalInit, modalProps } = this.state;
徐立's avatar
徐立 committed
1452
    const { getFieldDecorator, getFieldError, getFieldProps } = this.props.form;
1453
    const disabled = json != null ? json.disabled : false;
徐立's avatar
徐立 committed
1454 1455 1456 1457
    if (json == null) {
      return <></>;
    }
    if (json.comName == 'QRCode') {
1458 1459 1460 1461 1462 1463 1464
      if (
        this.state.option == null ||
        this.state.option.value == null ||
        this.state.option.value == null
      )
        return <></>;
      return <QRCode {...this.state.option} key={this.props.uuid} />;
徐立's avatar
徐立 committed
1465 1466 1467
    }

    if (json.comName == 'Echart') {
1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478
      return (
        <ReactEcharts
          style={{ height: json.height || 500 }}
          key={this.props.uuid}
          option={this.state.option || {}}
          notMerge={true}
          lazyUpdate={true}
          theme={'theme_name'}
          onEvents={{}}
        />
      );
徐立's avatar
徐立 committed
1479 1480
    }
    if (json.comName == 'PartForm') {
1481
      const fk = this.props.form.getFieldValue(this.props.uuid) || json.childFormKey;
徐立's avatar
徐立 committed
1482
      if (fk == null) {
1483
        return <></>;
徐立's avatar
徐立 committed
1484 1485 1486 1487
      }
      if (formKey == fk) {
        return <>片段表单key不能和自身相同</>;
      }
1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501
      return (
        <>
          {this.props.form.getFieldDecorator(this.props.uuid, {
            initialValue: fk,
          })(<Input type="hidden" />)}{' '}
          <ZdyTable
            key={fk}
            datas={datas}
            get={get}
            isChild={true}
            currentFormKey={fk}
            isEdit={isEdit}
            obj={obj}
            init={init}
chscls@163.com's avatar
chscls@163.com committed
1502 1503
            formCode={this.props.formCode}
            formId={this.props.formId}
1504 1505 1506 1507 1508 1509 1510 1511
            form={this.props.form}
            mapData={mapData}
            sqlData={sqlData}
            {...datas[fk]}
            defaultValues={defaultValues}
          />
        </>
      );
徐立's avatar
徐立 committed
1512 1513
    }
    if (json.comName == 'Label') {
1514
      let uid;
徐立's avatar
徐立 committed
1515
      if (this.props.fatherCode != null) {
1516
        uid = `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}`;
徐立's avatar
徐立 committed
1517
      } else {
1518
        uid = this.props.uuid;
徐立's avatar
徐立 committed
1519 1520
      }
      if (!isEdit) {
1521
        return obj[this.props.uuid] || json.initialValue || '';
徐立's avatar
徐立 committed
1522 1523
      } else {
        if (this.props.fatherCode != null) {
1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539
          return (
            <>
              {this.props.form.getFieldDecorator(uid, {
                initialValue: obj[this.props.uuid] || json.initialValue,
              })(<Input type="hidden" />)}
              <span
                style={{
                  fontWeight: get == 'mobile' ? 'bold' : '',
                  marginRight: get == 'mobile' ? 12 : '',
                }}
                {...json.props}
              >
                {obj[this.props.uuid] || json.initialValue}
              </span>
            </>
          );
wanyielin's avatar
wanyielin committed
1540
        } else {
1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556
          return (
            <>
              {this.props.form.getFieldDecorator(uid, {
                initialValue: this.props.form.getFieldValue(uid) || json.initialValue,
              })(<Input type="hidden" />)}
              <span
                style={{
                  fontWeight: get == 'mobile' ? 'bold' : '',
                  marginRight: get == 'mobile' ? 12 : '',
                }}
                {...json.props}
              >
                {this.props.form.getFieldValue(uid)}
              </span>
            </>
          );
wanyielin's avatar
wanyielin committed
1557
        }
徐立's avatar
徐立 committed
1558 1559 1560 1561
      }
    }

    if (json.comName == 'Description') {
1562 1563
      const key = json.sqls[json.sqls.length - 1];
      var cm = '';
徐立's avatar
徐立 committed
1564 1565 1566 1567
      var value;

      if (obj != null && obj.defaultValues) {
        if (obj.defaultValues[formKey]) {
1568
          value = obj.defaultValues[formKey][key];
徐立's avatar
徐立 committed
1569
        } else if (defaultValues) {
1570
          value = defaultValues[key];
徐立's avatar
徐立 committed
1571 1572
        }
      } else if (defaultValues) {
1573
        value = defaultValues[key];
徐立's avatar
徐立 committed
1574 1575 1576
      }
      switch (json.viewName) {
        case 'TextArea':
1577 1578 1579 1580 1581 1582
          cm = (
            <span>
              {value}
              {get === 'mobile' ? <br /> : ''}
            </span>
          );
徐立's avatar
徐立 committed
1583 1584
          break;
        case 'Switch':
1585 1586 1587 1588 1589 1590
          cm = (
            <span>
              {value}
              {get === 'mobile' ? <br /> : ''}
            </span>
          );
徐立's avatar
徐立 committed
1591 1592 1593

          break;
        case 'Input':
1594 1595 1596 1597 1598 1599
          cm = (
            <span style={{ paddingRight: get == 'mobile' ? 8 : '' }}>
              {value}
              {get === 'mobile' ? <br /> : ''}
            </span>
          );
徐立's avatar
徐立 committed
1600 1601 1602

          break;
        case 'InputNumber':
1603 1604 1605 1606 1607 1608
          cm = (
            <span>
              {value}
              {get === 'mobile' ? <br /> : ''}
            </span>
          );
徐立's avatar
徐立 committed
1609 1610 1611

          break;
        case 'DatePicker':
1612 1613
          cm = value ? (
            <span>
徐立's avatar
徐立 committed
1614
              {moment(parseInt(value)).format('YYYY-MM-DD HH:mm:ss')}
1615 1616 1617 1618
              {get === 'mobile' ? <br /> : ''}
            </span>
          ) : (
            ''
徐立's avatar
徐立 committed
1619 1620 1621 1622
          );

          break;
        case 'UploadCom':
1623
          const files = value.files || [];
徐立's avatar
徐立 committed
1624 1625 1626 1627 1628
          cm = (
            <>
              <ul>
                {files.map((f, index2) => {
                  if (f.path.indexOf('.png') != -1 || f.path.indexOf('.jpg') != -1) {
1629 1630 1631 1632 1633 1634 1635
                    return (
                      <img
                        key={index2}
                        style={{ width: 100, height: 100 }}
                        src={queryApiActionPath() + f.path}
                      />
                    );
徐立's avatar
徐立 committed
1636
                  }
1637 1638 1639 1640 1641 1642 1643
                  return (
                    <li key={index2}>
                      <a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
                        {f.name}
                      </a>
                    </li>
                  );
徐立's avatar
徐立 committed
1644 1645
                })}
              </ul>
1646
              {get === 'mobile' ? <br /> : ''}
徐立's avatar
徐立 committed
1647 1648 1649 1650 1651
            </>
          );

          break;
        case 'ImgUploadCom':
1652 1653
          if (value == null || value == '') {
            cm = <div style={{ width: json.width, height: json.height }}></div>;
wanyielin's avatar
wanyielin committed
1654
          } else {
1655 1656 1657 1658 1659 1660 1661 1662 1663
            cm = (
              <>
                <img
                  src={config.httpServer + value}
                  style={{ width: json.width, height: json.height }}
                />
                {get === 'mobile' ? <br /> : ''}
              </>
            );
wanyielin's avatar
wanyielin committed
1664
          }
徐立's avatar
徐立 committed
1665 1666 1667 1668 1669

          break;
      }

      if (json.isLabel) {
1670 1671
        if (obj && obj.defaultValues && obj.defaultValues[formKey]) {
          if (!isEdit) {
徐立's avatar
徐立 committed
1672
            return (
1673
              <Row
徐立's avatar
徐立 committed
1674
                style={{
1675 1676
                  minHeight: 40,
                  lineHeight: '40px',
徐立's avatar
徐立 committed
1677
                }}
1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689
              >
                <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)',
                  }}
徐立's avatar
徐立 committed
1690
                >
1691 1692
                  {json.label ? (
                    <>
徐立's avatar
徐立 committed
1693 1694
                      {json.label}
                      <span
1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705
                        style={{
                          position: 'relative',
                          top: '-0.5px',
                          margin: '0 8px 0 2px',
                        }}
                      >
                        :
                      </span>
                    </>
                  ) : sqlData[key] ? (
                    <>
徐立's avatar
徐立 committed
1706 1707
                      {sqlData[key].title}
                      <span
1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728
                        style={{
                          position: 'relative',
                          top: '-0.5px',
                          margin: '0 8px 0 2px',
                        }}
                      >
                        :
                      </span>
                    </>
                  ) : (
                    ''
                  )}
                </Col>
                <Col
                  span={json.wrapperSpan}
                  style={{
                    position: 'relative',
                    lineHeight: '40px',
                    zoom: 1,
                    fontSize: 14,
                  }}
徐立's avatar
徐立 committed
1729 1730
                >
                  {cm}
1731 1732 1733
                </Col>
              </Row>
            );
徐立's avatar
徐立 committed
1734 1735
          } else {
            return (
1736 1737 1738 1739 1740 1741 1742 1743
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
              >
                {cm}
              </Form.Item>
            );
徐立's avatar
徐立 committed
1744
          }
徐立's avatar
徐立 committed
1745 1746 1747 1748 1749
        } else {
          if (get === 'mobile') {
            /**
             * 列表类型
             */
1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764
            return (
              <>
                {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
                  initialValue: value,
                })(
                  <MobileList id="MobileList">
                    <MobileList.Item extra={cm}>
                      <span style={{ fontSize: 14 }}>
                        {json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
                      </span>
                    </MobileList.Item>
                  </MobileList>,
                )}
              </>
            );
徐立's avatar
徐立 committed
1765 1766
            // return <div><span style={{marginRight:12}}>{json.label?json.label:sqlData[key] ? sqlData[key].title : ""}:</span><span>{cm}</span></div>
          }
1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780
          return (
            <>
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={json.label ? json.label : sqlData[key] ? sqlData[key].title : ''}
              >
                {cm}
              </Form.Item>
              {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
                initialValue: value,
              })(<Input type="hidden" />)}
            </>
          );
徐立's avatar
徐立 committed
1781 1782 1783
        }
      } else {
        if (!isEdit && obj.defaultValues && obj.defaultValues[formKey]) {
1784
          return cm;
徐立's avatar
徐立 committed
1785
        } else {
1786 1787 1788 1789 1790 1791 1792 1793
          return (
            <>
              {cm}
              {this.props.form.getFieldDecorator(`defaultValues.${formKey}.${key}`, {
                initialValue: value,
              })(<Input type="hidden" />)}
            </>
          );
徐立's avatar
徐立 committed
1794 1795 1796 1797 1798 1799
        }
      }
    }

    var cm;
    var required = false;
wanyielin's avatar
wanyielin committed
1800
    const bindObj = this.getColumn('c1');
徐立's avatar
徐立 committed
1801

1802 1803 1804 1805 1806 1807 1808 1809 1810
    let dataColumn =
      this.props.fatherCode != null
        ? bindObj
          ? {
              ...bindObj,
              base52: `${this.props.fatherCode}.[${this.props.index}].${bindObj.base52}`,
            }
          : { base52: `${this.props.fatherCode}.[${this.props.index}].${this.props.uuid}` }
        : bindObj;
徐立's avatar
徐立 committed
1811

wanyielin's avatar
wanyielin committed
1812
    if (this.props.fatherCode == null && dataColumn == null) {
1813
      dataColumn = { base52: this.props.uuid };
chscls@163.com's avatar
chscls@163.com committed
1814
    }
wanyielin's avatar
wanyielin committed
1815
    if (dataColumn.isNull != null && !dataColumn.isNull) {
chscls@163.com's avatar
chscls@163.com committed
1816
      required = true;
徐立's avatar
徐立 committed
1817 1818
    }

1819
    var title = json.label || (dataColumn && dataColumn.title);
徐立's avatar
徐立 committed
1820 1821 1822
    var initValue;
    if (init != null) {
      if (this.props.fatherCode != null) {
1823 1824 1825 1826
        initValue =
          init[this.props.index] != null
            ? init[this.props.index][bindObj ? bindObj.base52 : this.props.uuid]
            : null;
徐立's avatar
徐立 committed
1827 1828 1829 1830 1831 1832
      } else {
        initValue = init[dataColumn.base52];
      }
    } else {
      if (json.initialValue != null) {
        try {
1833
          initValue = JSON.parse(json.initialValue);
徐立's avatar
徐立 committed
1834
        } catch (e) {
1835
          initValue = null;
徐立's avatar
徐立 committed
1836 1837 1838 1839 1840
        }
      }
    }
    if (!isEdit) {
      if (this.props.fatherCode) {
wanyielin's avatar
wanyielin committed
1841
        if (bindObj != null) {
1842
          dataColumn.base52 = bindObj.base52;
wanyielin's avatar
wanyielin committed
1843
        } else {
1844
          dataColumn.base52 = this.props.uuid;
chscls@163.com's avatar
chscls@163.com committed
1845
        }
徐立's avatar
徐立 committed
1846 1847 1848 1849 1850 1851 1852
      }

      switch (json.comName) {
        // 电子签章展示
        // case 'Signature':
        //   cm = <img  src={queryApiActionPath()+obj[dataColumn.base52]} />
        //   break;
chscls@163.com's avatar
chscls@163.com committed
1853
        case 'RichText':
徐立's avatar
徐立 committed
1854 1855 1856 1857 1858 1859 1860 1861
          cm = (
            <Editor
              key={dataColumn.base52}
              readOnly={true}
              blockRendererFn={MyBlockRenderer.bind(this, true, null, null, null)}
              editorState={changeToDraftState(obj[dataColumn.base52])}
            />
          );
chscls@163.com's avatar
chscls@163.com committed
1862
          break;
徐立's avatar
徐立 committed
1863
        case 'TextArea':
1864 1865 1866 1867 1868 1869 1870 1871 1872
          cm = (
            <span
              style={{
                wordBreak: 'break-all',
              }}
            >
              {obj[dataColumn.base52]}
            </span>
          );
徐立's avatar
徐立 committed
1873 1874 1875 1876 1877 1878
          break;
        case 'Switch':
          cm = <span>{obj[dataColumn.base52]}</span>;

          break;
        case 'Input':
徐立's avatar
徐立 committed
1879 1880 1881 1882 1883 1884 1885 1886 1887
          cm = (
            <span
              style={{
                wordBreak: 'break-all',
              }}
            >
              {obj[dataColumn.base52]}
            </span>
          );
徐立's avatar
徐立 committed
1888 1889

          break;
wanyielin's avatar
wanyielin committed
1890 1891
        case 'InputHidden':
          cm = <></>;
徐立's avatar
徐立 committed
1892

wanyielin's avatar
wanyielin committed
1893
          break;
徐立's avatar
徐立 committed
1894 1895 1896 1897 1898 1899 1900 1901
        case 'InputNumber':
          cm = <span>{obj[dataColumn.base52]}</span>;

          break;
        /**
         * 为Radio为单选
         */
        case 'Radio':
1902
          cm = <span>{labels != null && labels.length > 0 ? Object.values(labels[0]) : ''}</span>;
徐立's avatar
徐立 committed
1903 1904 1905 1906 1907 1908 1909

          break;
        /**
         * 为Checked为多选
         * 该组件需要调用请求
         */
        case 'Checkbox':
1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928
          cm = (
            <span>
              {labels != null
                ? labels.map((r, i) =>
                    i == 0 ? (
                      typeof r == 'string' ? (
                        <span>{r}</span>
                      ) : (
                        Object.values(r)
                      )
                    ) : typeof r == 'string' ? (
                      <span style={{ marginLeft: 12 }}>{r}</span>
                    ) : (
                      ',' + Object.values(r)
                    ),
                  )
                : ''}
            </span>
          );
徐立's avatar
徐立 committed
1929 1930 1931

          break;
        case 'Select':
1932
          cm = <span>{labels != null && labels.length > 0 ? Object.values(labels[0]) : ''}</span>;
徐立's avatar
徐立 committed
1933 1934 1935

          break;
        case 'TableSelect':
1936 1937 1938 1939
          const ds =
            obj[dataColumn.base52] && obj[dataColumn.base52].selects
              ? Object.values(obj[dataColumn.base52].selects)
              : [];
徐立's avatar
徐立 committed
1940
          if (json.showTable) {
1941 1942 1943 1944 1945 1946 1947 1948 1949
            cm = (
              <Table
                get={get}
                columns={this.state.columns}
                size="small"
                dataSource={ds}
                pagination={false}
              />
            );
徐立's avatar
徐立 committed
1950
          } else {
1951 1952 1953 1954 1955
            cm = (
              <span>
                {ds.map((r, i) => (i == 0 ? r[json.labelName] : ',' + r[json.labelName]))}
              </span>
            );
徐立's avatar
徐立 committed
1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968
          }

          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) ivs.push(moment(parseInt(init[end.base52])));
          }
          if (begin != null && end != null) {
徐立's avatar
徐立 committed
1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983
            if (!obj[begin.base52]) {
              cm = <span>暂无</span>;
            } else {
              cm = (
                <span>
                  {moment(parseInt(obj[begin.base52])).format(
                    json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                  )}{' '}
{' '}
                  {moment(parseInt(obj[end.base52])).format(
                    json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                  )}
                </span>
              );
            }
徐立's avatar
徐立 committed
1984
          } else {
1985
            cm = '';
徐立's avatar
徐立 committed
1986 1987 1988 1989 1990 1991
          }
          title = '起止时间';
          break;
        case 'DatePicker':
          if (obj[dataColumn.base52] && obj[dataColumn.base52].indexOf('-') === -1) {
            cm = (
1992 1993 1994 1995 1996
              <span>
                {moment(parseInt(obj[dataColumn.base52])).format(
                  json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                )}
              </span>
徐立's avatar
徐立 committed
1997 1998 1999
            );
          } else {
            cm = (
2000 2001 2002 2003 2004 2005 2006
              <span>
                {obj[dataColumn.base52]
                  ? moment(+new Date(obj[dataColumn.base52])).format(
                      json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                    )
                  : ''}
              </span>
徐立's avatar
徐立 committed
2007 2008 2009 2010 2011 2012 2013 2014 2015 2016
            );
          }

          break;

        case 'UploadCom':
          /**
           * 查找不到数据 添加判断
           * 只有一个附件返回的是一个对象不是数组,暂时使用2个判断
           */
2017 2018 2019
          if (!isEmpty(obj[dataColumn.base52])) {
            // 首先判断是否为空对象
            let ary;
徐立's avatar
徐立 committed
2020 2021 2022 2023
            /**
             * 判断返回值是否为JSON字符串,不是则直接使用
             */
            if (this.isJSON(obj[dataColumn.base52])) {
2024
              ary = JSON.parse(obj[dataColumn.base52]);
徐立's avatar
徐立 committed
2025
            } else {
2026
              ary = obj[dataColumn.base52];
徐立's avatar
徐立 committed
2027
            }
2028 2029
            if (!!ary.files) {
              // 然后判断存在多个附件的数组是否存在
徐立's avatar
徐立 committed
2030 2031 2032 2033
              const files = !isEmpty(ary) ? ary.files : [];
              cm = (
                <ul>
                  {files.map((f, index2) => {
2034 2035 2036 2037 2038 2039 2040 2041 2042
                    // if (f.path.indexOf('.png') != -1 || f.path.indexOf('.jpg') != -1) {
                    //   return (
                    //     <img
                    //       key={index2}
                    //       style={{ width: 100, height: 100 }}
                    //       src={queryApiActionPath() + f.path}
                    //     />
                    //   );
                    // }
2043 2044 2045 2046 2047 2048
                    if (get === 'web') {
                      return (
                        <li key={index2}>
                          <FilePreview path={queryApiActionPath() + f.path} pathName={f.name} />
                        </li>
                      );
徐立's avatar
徐立 committed
2049
                    }
2050 2051 2052 2053 2054 2055 2056
                    return (
                      <li key={index2}>
                        <a target="_blank" key={f.path} href={queryApiActionPath() + f.path}>
                          {f.name}
                        </a>
                      </li>
                    );
徐立's avatar
徐立 committed
2057 2058 2059 2060 2061 2062 2063
                  })}
                </ul>
              );
            } else {
              const files = !isEmpty(ary) ? ary : [];
              cm = (
                <ul>
徐立's avatar
徐立 committed
2064 2065
                  {Array.isArray(files) &&
                    files.map((f, index2) => {
2066 2067 2068 2069 2070 2071 2072 2073 2074 2075
                      // if (f.filePath.indexOf('.png') != -1 || f.filePath.indexOf('.jpg') != -1) {
                      //   return (
                      //     <img
                      //       key={index2}
                      //       style={{ width: 100, height: 100 }}
                      //       src={queryApiActionPath() + f.filePath}
                      //     />
                      //   );
                      // }
                      if (get === 'web') {
徐立's avatar
徐立 committed
2076
                        return (
2077 2078 2079
                          <li key={index2}>
                            <FilePreview path={queryApiActionPath() + f.path} pathName={f.name} />
                          </li>
徐立's avatar
徐立 committed
2080 2081
                        );
                      }
2082
                      return (
徐立's avatar
徐立 committed
2083 2084 2085 2086 2087 2088 2089 2090 2091
                        <li key={index2}>
                          <a
                            target="_blank"
                            key={f.filePath}
                            href={queryApiActionPath() + f.filePath}
                          >
                            {f.fileName}
                          </a>
                        </li>
2092
                      );
徐立's avatar
徐立 committed
2093
                    })}
徐立's avatar
徐立 committed
2094 2095 2096 2097
                </ul>
              );
            }
          } else {
2098 2099 2100 2101 2102
            cm = (
              <span style={{ display: 'inline-block', width: '100%', textAlign: 'center' }}>
                暂无附件
              </span>
            );
徐立's avatar
徐立 committed
2103 2104 2105 2106
          }

          break;
        case 'ImgUploadCom':
2107 2108
          if (obj[dataColumn.base52] == null || obj[dataColumn.base52] == '') {
            cm = <div style={{ width: json.width, height: json.height }}></div>;
wanyielin's avatar
wanyielin committed
2109
          } else {
2110 2111 2112 2113
            cm = FilePreview ? (
              <FilePreview
                path={config.httpServer + obj[dataColumn.base52]}
                pathName={obj[dataColumn.base52]}
徐立's avatar
徐立 committed
2114 2115
                width={json.width}
                height={json.height}
2116 2117
              />
            ) : (
2118 2119 2120 2121 2122
              <img
                src={config.httpServer + obj[dataColumn.base52]}
                style={{ width: json.width, height: json.height }}
              />
            );
chscls@163.com's avatar
1  
chscls@163.com committed
2123
          }
徐立's avatar
徐立 committed
2124

徐立's avatar
徐立 committed
2125 2126
          break;
        case 'Signature':
2127 2128 2129 2130 2131 2132
          cm = (
            <img
              src={config.httpServer + obj[dataColumn.base52]}
              style={{
                width:
                  get === 'mobile'
chscls@163.com's avatar
chscls@163.com committed
2133
                    ? document.documentElement.clientWidth - 100 || document.body.clientWidth - 100
2134 2135 2136 2137 2138
                    : json.width,
                height: get === 'mobile' ? '' : json.height,
              }}
            />
          );
徐立's avatar
徐立 committed
2139 2140 2141

          break;
        case 'ChildForm':
2142
          const xxxxx = obj[dataColumn.base52];
徐立's avatar
徐立 committed
2143
          if (xxxxx == null) {
2144
            cm = <></>;
徐立's avatar
徐立 committed
2145 2146 2147
            break;
          }
          if (Object.keys(xxxxx).length > 0) {
2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160
            delete xxxxx[''];
          }

          cm = (
            <ChildForm
              fatherObj={obj}
              json={json}
              rights={json.rights || ['add', 'delete']}
              isMobile={get === 'mobile'}
              value={xxxxx}
              deleteName={json.deleteName}
              addName={json.addName}
              isEdit={isEdit}
chscls@163.com's avatar
chscls@163.com committed
2161 2162
              formCode={this.props.formCode}
              formId={this.props.formId}
2163 2164 2165 2166 2167 2168 2169 2170
              base52={dataColumn.base52}
              mapData={mapData}
              datas={datas ? datas[json.childFormKey] : null}
              defaultValues={defaultValues}
              sqlData={sqlData}
              form={this.props.form}
            />
          );
徐立's avatar
徐立 committed
2171 2172
          break;
        case 'Button':
2173
          let events = {};
徐立's avatar
徐立 committed
2174 2175

          if (json.events != null) {
2176
            events = this.getFunctionValue(json.events, { base52: this.props.uuid }, json);
徐立's avatar
徐立 committed
2177
          }
wanyielin's avatar
wanyielin committed
2178
          if (events && events.dom) {
2179
            cm = events.dom;
wanyielin's avatar
wanyielin committed
2180
          } else {
徐立's avatar
徐立 committed
2181
            const ev = {
wanyielin's avatar
wanyielin committed
2182
              children: json.initialValue,
2183 2184
              ...events,
            };
wanyielin's avatar
wanyielin committed
2185
            if (json.isLink) {
2186
              cm = <a {...ev} />;
wanyielin's avatar
wanyielin committed
2187
            } else {
2188
              cm = <Button loading={this.props.loading} type="primary" {...ev} />;
徐立's avatar
徐立 committed
2189 2190
            }
          }
徐立's avatar
徐立 committed
2191

徐立's avatar
徐立 committed
2192 2193
          break;
        case 'LocationCom':
2194
          cm = <span></span>;
徐立's avatar
徐立 committed
2195 2196 2197
          break;

        case 'Table':
2198 2199
          if (json.objCode == null || json.objCode == '') {
            cm = <></>;
徐立's avatar
徐立 committed
2200
          }
2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215
          cm = (
            <TableList
              get={get}
              isTree={json.isTree}
              json={json}
              loading={this.props.loading}
              showHeader={json.showHeader}
              isHiddenPage={json.isHiddenPage}
              pageSize={json.pageSize}
              value={obj[dataColumn.base52 || this.props.uuid] || {}}
              objCode={json.objCode}
              sql={json.filterSql}
              rights={json.rights}
            />
          );
徐立's avatar
徐立 committed
2216 2217
          break;
        default:
2218
          cm = <span>缺乏字段{json.comName}的匹配项</span>;
徐立's avatar
徐立 committed
2219 2220 2221 2222 2223
          break;
      }
    } else {
      if (json.vlds && json.vlds.length > 0) {
        for (let i in json.vlds) {
2224
          if (json.vlds[i].validatorFunc && json.vlds[i].validatorFunc != '') {
徐立's avatar
徐立 committed
2225
            try {
2226 2227
              let fn = new Function('rule', 'value', 'callback', json.vlds[i].validatorFunc);
              json.vlds[i].validator = fn;
徐立's avatar
徐立 committed
2228
            } catch (e) {
2229
              console.log(e);
徐立's avatar
徐立 committed
2230 2231 2232 2233 2234 2235
            }
          }
        }
      }
      switch (json.comName) {
        case 'Button':
2236
          let events = {};
徐立's avatar
徐立 committed
2237 2238

          if (json.events != null) {
2239
            events = this.getFunctionValue(json.events, { base52: this.props.uuid }, json);
徐立's avatar
徐立 committed
2240
          }
wanyielin's avatar
wanyielin committed
2241
          if (events && events.dom) {
2242
            cm = events.dom;
wanyielin's avatar
wanyielin committed
2243
          } else {
徐立's avatar
徐立 committed
2244
            const ev = {
wanyielin's avatar
wanyielin committed
2245
              children: json.initialValue,
2246 2247
              ...events,
            };
wanyielin's avatar
wanyielin committed
2248
            if (json.isLink) {
2249
              cm = <a {...ev} />;
wanyielin's avatar
wanyielin committed
2250
            } else {
2251
              cm = <Button loading={this.props.loading} type="primary" {...ev} />;
徐立's avatar
徐立 committed
2252 2253
            }
          }
徐立's avatar
徐立 committed
2254

徐立's avatar
徐立 committed
2255 2256 2257 2258 2259 2260 2261
          break;
        case 'TextArea':
          if (get === 'mobile') {
            cm = (
              <MobileTextareaItem
                {...getFieldProps(dataColumn.base52, {
                  initialValue: initValue,
2262 2263 2264 2265
                  rules:
                    json.vlds && json.vlds.length > 0
                      ? json.vlds
                      : [{ required: required, message: '请输入' + title }],
徐立's avatar
徐立 committed
2266 2267 2268 2269 2270 2271 2272 2273
                })}
                //disabled={disabled}
                style={{ fontSize: 14 }}
                clear
                autoHeight
                // title={<span className={styles.text}>{dataColumn.title}</span>}
                placeholder={json.placeholder}
              />
2274
            );
徐立's avatar
徐立 committed
2275
            if (json.isLabel && title) {
2276 2277 2278 2279 2280 2281 2282 2283 2284
              cm = (
                <Form.Item
                  labelCol={{ span: json.labelSpan }}
                  wrapperCol={{ span: json.wrapperSpan }}
                  label={title}
                >
                  {cm}
                </Form.Item>
              );
徐立's avatar
徐立 committed
2285 2286 2287 2288
            }
          } else {
            cm = getFieldDecorator(dataColumn.base52, {
              initialValue: initValue,
2289 2290 2291 2292
              rules:
                json.vlds && json.vlds.length > 0
                  ? json.vlds
                  : [{ required: required, message: '请输入' + title }],
徐立's avatar
徐立 committed
2293 2294 2295 2296 2297
            })(<TextArea disabled={disabled} rows={4} placeholder={json.placeholder} />);
          }
          break;
        case 'Switch':
          if (get === 'mobile') {
2298 2299 2300 2301
            if (dataColumn == null || json.formula != null) {
              cm = this.props.form.getFieldValue(this.props.uuid);
              break;
            }
徐立's avatar
徐立 committed
2302 2303
            cm = (
              <MobileList.Item
2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326
                extra={
                  <MobileSwitch
                    {...getFieldProps(dataColumn.base52, {
                      initialValue: initValue,
                      rules:
                        json.vlds && json.vlds.length > 0
                          ? json.vlds
                          : [{ required: required, message: '请选择' + title }],
                    })}
                    disabled={disabled}
                    onClick={checked => {
                      // set new value
                      this.props.form.setFieldsValue({
                        [dataColumn.base52]: checked,
                      });
                    }}
                  />
                }
              >
                {json.isLabel ? title : ''}
              </MobileList.Item>
            );
            break;
徐立's avatar
徐立 committed
2327 2328 2329 2330 2331
          }

          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
            valuePropName: 'checked',
2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请选择' + title }],
          })(
            <Switch
              disabled={disabled}
              checkedChildren={json.checkedChildren}
              unCheckedChildren={json.unCheckedChildren}
            />,
          );
徐立's avatar
徐立 committed
2343 2344 2345

          break;
        case 'Input':
徐立's avatar
徐立 committed
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 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 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
          // if (get === 'mobile') {
          //   // cm = (<div className={styles.form}><MobileInputItem
          //   //   type={'text'}
          //   //   className="mobile-form-input-left"
          //   //   {...getFieldProps(dataColumn.base52, {
          //   //     initialValue: initValue, // 默认值
          //   //     rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{
          //   //       required: required,
          //   //       message: '请输入' + title,
          //   //     }],
          //   //   })}
          //   //   clear
          //   //   disabled={disabled}
          //   //   placeholder={json.placeholder ? json.placeholder : '请输入' + (title ? title : '')}
          //   // >
          //   // {json.isLabel ?
          //   //   title ?
          //   //     <span className={styles.text}>
          //   //       {required ? must : ''}
          //   //       {title}</span>
          //   //     : ''
          //   //   : get === 'mobile' ?
          //   //     <span className={styles.text}>{required ? must : ''}请输入:
          //   //             {/* {title} */}
          //   //     </span>
          //   //     : ''}
          //   // </MobileInputItem></div>)
          //   cm = (
          //     <MobileList>
          //       <Item arrow="empty" multipleLine onClick={() => {}}>
          //         {json.isLabel ? (
          //           title ? (
          //             <span className={styles.text}>
          //               {required ? must : ''}
          //               {title}
          //             </span>
          //           ) : (
          //             ''
          //           )
          //         ) : get === 'mobile' ? (
          //           <span className={styles.text}>
          //             {required ? must : ''}请输入:
          //             {/* {title} */}
          //           </span>
          //         ) : (
          //           ''
          //         )}
          //         <Brief>
          //           <div className={styles.form}>
          //             <MobileInputItem
          //               type={'text'}
          //               className="mobile-form-input-left"
          //               {...getFieldProps(dataColumn.base52, {
          //                 initialValue: initValue, // 默认值
          //                 rules:
          //                   json.vlds && json.vlds.length > 0
          //                     ? json.vlds
          //                     : [
          //                         {
          //                           required: required,
          //                           message: '请输入' + title,
          //                         },
          //                       ],
          //               })}
          //               clear
          //               disabled={disabled}
          //               placeholder={
          //                 json.placeholder ? json.placeholder : '请输入' + (title ? title : '')
          //               }
          //             ></MobileInputItem>
          //           </div>
          //         </Brief>
          //       </Item>
          //     </MobileList>
          //   );
          //   break;
          // }
徐立's avatar
徐立 committed
2423 2424
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请输入' + title }],
          })(
            <Input
              disabled={disabled}
              style={{ width: json.width }}
              placeholder={json.placeholder}
            />,
          );
徐立's avatar
徐立 committed
2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449
          if (get == 'mobile') {
            cm = <div>{cm}</div>;
            if (json.isLabel && title) {
              cm = (
                <Form.Item
                  labelCol={{ span: json.labelSpan }}
                  wrapperCol={{ span: json.wrapperSpan }}
                  label={title}
                >
                  {cm}
                </Form.Item>
              );
            }
          }
徐立's avatar
徐立 committed
2450
          break;
wanyielin's avatar
wanyielin committed
2451 2452
        case 'InputHidden':
          cm = getFieldDecorator(dataColumn.base52, {
2453
            initialValue: initValue,
wanyielin's avatar
wanyielin committed
2454
          })(<Input type="hidden" />);
徐立's avatar
徐立 committed
2455 2456
          break;
        case 'InputNumber':
wanyielin's avatar
wanyielin committed
2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474
          /* if (get === 'mobile') {

        cm = (<div className={styles.form}><MobileInputItem
            type={'digit'}
            className="mobile-form-input-left"
            {...getFieldProps(dataColumn.base52, {
              initialValue: initValue, // 默认值
              rules: json.vlds && json.vlds.length > 0 ? json.vlds : [{
                required: required,
                message: '请输入',
              }],
            })}
            clear
            disabled={disabled}
            placeholder={json.placeholder ? json.placeholder : '请输入' + (title ? title : '')}
          >{json.isLabel ? title ? <span className={styles.text}>{title}</span> : '' : ''}</MobileInputItem></div>)
          break
        } */
徐立's avatar
徐立 committed
2475 2476 2477

          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请输入' + title }],
          })(
            <InputNumber
              disabled={disabled}
              placeholder={json.placeholder}
              max={json.max}
              min={json.min}
              precision={json.precision}
              step={json.step}
            />,
          );
徐立's avatar
徐立 committed
2492
          if (get == 'mobile') {
2493
            cm = <div>{cm}</div>;
徐立's avatar
徐立 committed
2494
            if (json.isLabel && title) {
2495 2496 2497 2498 2499 2500 2501 2502 2503
              cm = (
                <Form.Item
                  labelCol={{ span: json.labelSpan }}
                  wrapperCol={{ span: json.wrapperSpan }}
                  label={title}
                >
                  {cm}
                </Form.Item>
              );
徐立's avatar
徐立 committed
2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537
            }
          }
          break;

        /**
         * 为Radio为单选
         */
        case 'Radio':
          // if (get === 'mobile') {
          //   cm = (
          //     <MobilePicker
          //       cascade
          //       extra={<span className={styles.placeholder}>{required ? must : ''}{'请选择' + dataColumn.title}</span>}
          //       title={dataColumn.title}
          //       {...getFieldProps(dataColumn.base52, {
          //         initialValue: initValue, // 默认值
          //         rules: [{ required: required, message: '请选择' + dataColumn.title }],
          //       })}
          //       cols={1}
          //       disabled={disabled}
          //       data={options}
          //     >
          //       <MobileList.Item arrow="horizontal">
          //         <span className={styles.text}>
          //             {/* {dataColumn.title} */}
          //             请选择
          //         </span>
          //       </MobileList.Item>
          //     </MobilePicker>
          //   )
          //   break;
          // }
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
2538 2539 2540 2541
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请选择' + dataColumn.title }],
徐立's avatar
徐立 committed
2542 2543
          })(<Radio.Group options={options} disabled={disabled} />);
          if (get == 'mobile') {
2544
            cm = <div>{cm}</div>;
徐立's avatar
徐立 committed
2545
            if (json.isLabel && title) {
2546 2547 2548 2549 2550 2551 2552 2553 2554
              cm = (
                <Form.Item
                  labelCol={{ span: json.labelSpan }}
                  wrapperCol={{ span: json.wrapperSpan }}
                  label={title}
                >
                  {cm}
                </Form.Item>
              );
徐立's avatar
徐立 committed
2555 2556 2557 2558 2559 2560 2561 2562 2563 2564
            }
          }
          break;
        /**
         * 为Checked为多选
         * 该组件需要调用请求
         */
        case 'Checkbox':
          if (get === 'mobile') {
            cm = (
2565 2566 2567 2568 2569 2570 2571 2572
              <Flex direction="column" align="start">
                {getFieldDecorator(dataColumn.base52, {
                  initialValue: initValue, // 默认值
                  rules:
                    json.vlds && json.vlds.length > 0
                      ? json.vlds
                      : [{ required: required, message: '请选择' + dataColumn.title }],
                })(<Checkbox.Group options={options} disabled={disabled} />)}
徐立's avatar
徐立 committed
2573
              </Flex>
2574
            );
徐立's avatar
徐立 committed
2575 2576

            if (json.isLabel && title) {
2577 2578 2579 2580 2581 2582 2583 2584 2585
              cm = (
                <Form.Item
                  labelCol={{ span: json.labelSpan }}
                  wrapperCol={{ span: json.wrapperSpan }}
                  label={title}
                >
                  {cm}
                </Form.Item>
              );
徐立's avatar
徐立 committed
2586 2587
            }

2588
            break;
徐立's avatar
徐立 committed
2589 2590 2591 2592
          }

          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
2593 2594 2595 2596
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请选择' + dataColumn.title }],
徐立's avatar
徐立 committed
2597 2598 2599 2600 2601 2602
          })(<Checkbox.Group options={options} disabled={disabled} />);

          break;
        case 'Select':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
2603 2604 2605 2606
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请选择' + dataColumn.title }],
徐立's avatar
徐立 committed
2607 2608 2609 2610 2611 2612 2613 2614
          })(
            <Select
              allowClear
              showSearch
              disabled={selectDis || disabled}
              placeholder={json.placeholder}
              style={{ width: json.width }}
              optionFilterProp="children"
徐立's avatar
徐立 committed
2615 2616 2617 2618 2619 2620 2621
              getPopupContainer={
                this.props.isDynamic
                  ? () => {
                      return document.querySelector('#dynamic_div');
                    }
                  : ''
              }
wanyielin's avatar
wanyielin committed
2622
              onFocus={() => {
2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637
                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;
徐立's avatar
徐立 committed
2638 2639
              }}
              filterOption={(input, option) =>
2640 2641 2642
                option
                  ? option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
                  : false
徐立's avatar
徐立 committed
2643 2644
              }
            >
2645 2646 2647 2648 2649 2650 2651 2652
              {options
                ? options.map(r => (
                    <Option key={r.value} value={r.value}>
                      {r.label}
                    </Option>
                  ))
                : ''}
            </Select>,
徐立's avatar
徐立 committed
2653 2654
          );
          if (get === 'mobile' && json.isLabel && title) {
2655 2656 2657 2658 2659 2660 2661 2662 2663
            cm = (
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
              >
                {cm}
              </Form.Item>
            );
徐立's avatar
徐立 committed
2664
          } else if (get === 'mobile') {
2665
            cm = <div>{cm}</div>;
徐立's avatar
徐立 committed
2666 2667 2668 2669 2670 2671 2672
          }

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

2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [
                    {
                      validator: (rule, value, callback) => {
                        if (
                          (Object.keys(value).length == 0 ||
                            Object.keys(value.selects).length == 0) &&
                          required != null &&
                          required
                        ) {
                          var errors = [];
                          errors.push(new Error('请选择至少一个', rule.field));
                        }
                        callback(errors);
                      },
                      required: required,
                    },
                  ],
          })(
            <TableSelect
              get={get}
              json={json}
              dataColumn={dataColumn}
              columns={this.state.columns}
              dataSource={this.state.dataSource}
              sqlModel={this.state.sqlModel}
            />,
徐立's avatar
徐立 committed
2702 2703
          );
          if (get === 'mobile' && json.isLabel && title) {
2704 2705 2706 2707 2708 2709 2710 2711 2712
            cm = (
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
              >
                {cm}
              </Form.Item>
            );
徐立's avatar
徐立 committed
2713 2714 2715 2716 2717 2718 2719
          }
          break;

        case 'RangePicker':
          const begin = dataColumn;
          var end = this.getColumn('c2');
          if (end == null) {
2720
            end = { base52: this.props.uuid + '_2' };
徐立's avatar
徐立 committed
2721 2722 2723 2724 2725 2726 2727 2728 2729
          }
          const ivs = [];
          if (initValue != null && init != null) {
            ivs.push(moment(parseInt(initValue)));
            ivs.push(moment(parseInt(init[end.base52])));
          }
          if (!isEdit) {
            cm = (
              <span>
2730 2731 2732 2733 2734 2735 2736
                {moment(parseInt(obj[begin.base52])).format(
                  json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                )}{' '}
{' '}
                {moment(parseInt(obj[end.base52])).format(
                  json.format ? json.format : 'YYYY-MM-DD HH:mm:ss',
                )}
徐立's avatar
徐立 committed
2737 2738 2739 2740 2741 2742
              </span>
            );
          } else {
            if (get === 'mobile') {
              cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
                initialValue: ivs,
2743 2744 2745 2746 2747
                rules:
                  json.vlds && json.vlds.length > 0
                    ? json.vlds
                    : [{ required: required, message: '请选择起止时间' }],
              })(<MobileDate disabled={disabled} formate={json.format} />);
徐立's avatar
徐立 committed
2748
              if (json.isLabel && title) {
2749 2750 2751 2752 2753 2754 2755 2756 2757
                cm = (
                  <Form.Item
                    labelCol={{ span: json.labelSpan }}
                    wrapperCol={{ span: json.wrapperSpan }}
                    label={title}
                  >
                    {cm}
                  </Form.Item>
                );
徐立's avatar
徐立 committed
2758
              }
2759
              break;
徐立's avatar
徐立 committed
2760 2761 2762
            }
            cm = getFieldDecorator(begin.base52 + '$' + end.base52, {
              initialValue: ivs,
2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773
              rules:
                json.vlds && json.vlds.length > 0
                  ? json.vlds
                  : [{ required: required, message: '请选择起止时间' }],
            })(
              <RangePicker
                showTime={json.showTime != null ? json.showTime : true}
                format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'}
                disabled={disabled}
              />,
            );
徐立's avatar
徐立 committed
2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795
          }
          if (json.label == null) title = '起止时间';
          break;
        case 'DatePicker':
          // if (get === 'mobile') {
          //   var iv = null;
          //   if (initValue != null) {
          //     iv = moment(initValue);
          //   }
          //   cm = getFieldDecorator(dataColumn.base52, {
          //     initialValue: iv,
          //     rules: json.vlds && json.vlds.length > 0 ?json.vlds: [{ required: required, message: '请选择起止时间' }],
          //   })(<div><DatePicker disabled={disabled} showTime format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'} /></div>);
          //   if (get === 'mobile' && json.isLabel && title) {
          //     cm = <Form.Item
          //       labelCol={{ span: json.labelSpan }}
          //       wrapperCol={{ span: json.wrapperSpan }}
          //       label={title}
          //     >
          //       {cm}
          //     </Form.Item>
          //   }
wanyielin's avatar
wanyielin committed
2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812
          // cm = (
          //   <MobileDatePicker
          //     mode={'date'}
          //     disabled={disabled}
          //     locale={{ okText: "确定", dismissText: '取消' }}
          //     extra={<span className={styles.placeholder}>{!!initValue ? moment(initValue).format('YYYY-MM-DD') : '请选择日期'}</span>}
          //     {...getFieldProps(dataColumn.base52, {
          //       initialValue: +moment(initValue).format('YYYY-MM-DD'), // 默认值
          //       rules: [
          //         { required: required, message: '请选择日期' },
          //         // { validator: this.validateDatePicker },
          //       ]
          //     })}
          //   >
          //     <MobileList.Item arrow="horizontal"><span className={styles.text}>{required ? must : ''}{dataColumn.title}</span></MobileList.Item>
          //   </MobileDatePicker>
          // )
徐立's avatar
徐立 committed
2813 2814 2815 2816
          //   break
          // }
          var iv = null;
          if (initValue != null) {
wanyielin's avatar
wanyielin committed
2817
            iv = moment(typeof initValue === 'string' ? +initValue : initValue);
徐立's avatar
徐立 committed
2818 2819 2820 2821
          }
          // console.log(iv,json.format)
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: iv,
2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请选择起止时间' }],
          })(
            <DatePicker
              disabled={disabled}
              showTime={json.showTime != null ? json.showTime : true}
              onOpenChange={
                get === 'mobile'
                  ? () => {
                      // 取消唤起移动端小键盘
                      setTimeout(() => {
                        if (document.querySelector('.ant-calendar-input ')) {
                          document
                            .querySelector('.ant-calendar-input ')
                            .setAttribute('readonly', 'readonly');
                          setTimeout(() => {
                            document
                              .querySelector('.ant-calendar-input ')
                              .removeAttribute('readonly');
                          });
                        }
                      });
                    }
                  : () => {}
              }
              format={json.format ? json.format : 'YYYY-MM-DD HH:mm:ss'}
            />,
          );
徐立's avatar
徐立 committed
2852
          if (get === 'mobile' && json.isLabel && title) {
2853 2854 2855 2856 2857 2858 2859 2860 2861
            cm = (
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
              >
                {cm}
              </Form.Item>
            );
徐立's avatar
徐立 committed
2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872
          }
          break;

        case 'UploadCom':
          let files = [];
          // if (initValue != null) {
          if (initValue != null && !isEmpty(initValue.files)) {
            files = initValue.files;
          }
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: { files: files },
2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885
            rules: [
              {
                validator: (rule, value, callback) => {
                  if (value.files.length == 0 && required != null && required) {
                    var errors = [];
                    errors.push(new Error('至少上传一个', rule.field));
                  }
                  callback(errors);
                },
                required: required,
                message: '请选择附件',
              },
            ],
徐立's avatar
徐立 committed
2886 2887
          })(<UploadCom />);
          if (get === 'mobile' && json.isLabel && title) {
2888 2889 2890
            cm = (
              <Form.Item
                labelCol={{ span: json.labelSpan }}
chscls@163.com's avatar
chscls@163.com committed
2891 2892 2893 2894 2895 2896 2897 2898
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
              >
                {cm}
              </Form.Item>
            );
          }
          break;
徐立's avatar
徐立 committed
2899
        case 'RichText':
chscls@163.com's avatar
chscls@163.com committed
2900
          cm = getFieldDecorator(dataColumn.base52, {
chscls@163.com's avatar
chscls@163.com committed
2901
            initialValue: initValue,
徐立's avatar
徐立 committed
2902 2903 2904 2905
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请输入' }],
chscls@163.com's avatar
chscls@163.com committed
2906
          })(<DraftEditorCom placeholder={json.placeholder} />);
chscls@163.com's avatar
chscls@163.com committed
2907 2908 2909 2910
          if (get === 'mobile' && json.isLabel && title) {
            cm = (
              <Form.Item
                labelCol={{ span: json.labelSpan }}
2911 2912 2913 2914 2915 2916
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
              >
                {cm}
              </Form.Item>
            );
徐立's avatar
徐立 committed
2917 2918 2919 2920 2921
          }
          break;
        case 'LocationCom':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: {},
徐立's avatar
徐立 committed
2922 2923 2924 2925
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请进行定位' }],
2926 2927 2928 2929 2930 2931 2932 2933 2934
          })(
            <LocationCom
              get={get}
              btnName={json.btnName}
              btnSucName={json.btnSucName}
              width={json.width}
              showMap={json.showMap}
            />,
          );
徐立's avatar
徐立 committed
2935
          if (get === 'mobile' && json.isLabel && title) {
2936 2937 2938 2939 2940 2941 2942 2943 2944
            cm = (
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
              >
                {cm}
              </Form.Item>
            );
徐立's avatar
徐立 committed
2945 2946 2947 2948 2949
          }
          break;
        case 'ChildForm':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue || {},
2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968
          })(
            <ChildForm
              rights={json.rights || []}
              isMobile={get === 'mobile'}
              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}
              defaultValues={defaultValues}
              sqlData={sqlData}
              form={this.props.form}
            />,
          );
徐立's avatar
徐立 committed
2969 2970

          if (get === 'mobile' && json.isLabel && title) {
2971 2972 2973 2974 2975 2976 2977 2978 2979
            cm = (
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
              >
                {cm}
              </Form.Item>
            );
徐立's avatar
徐立 committed
2980 2981 2982
          }
          break;
        case 'ImgUploadCom':
chscls@163.com's avatar
chscls@163.com committed
2983 2984
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
徐立's avatar
徐立 committed
2985 2986 2987 2988
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请上传图片' }],
2989
          })(<ImgUploadCom json={json} disabled={disabled} />);
徐立's avatar
徐立 committed
2990
          if (get === 'mobile' && json.isLabel && title) {
2991 2992 2993 2994 2995 2996 2997 2998 2999
            cm = (
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
              >
                {cm}
              </Form.Item>
            );
徐立's avatar
徐立 committed
3000 3001 3002 3003 3004
          }
          break;
        case 'Signature':
          cm = getFieldDecorator(dataColumn.base52, {
            initialValue: initValue,
徐立's avatar
徐立 committed
3005 3006 3007 3008
            rules:
              json.vlds && json.vlds.length > 0
                ? json.vlds
                : [{ required: required, message: '请进行签名' }],
3009 3010 3011 3012
          })(
            <Signature
              width={
                get === 'mobile'
chenhuan's avatar
chenhuan committed
3013
                  ? document.documentElement.clientWidth - 100 || document.body.clientWidth - 100
3014 3015 3016 3017 3018
                  : json.width
              }
              height={json.height}
            />,
          );
徐立's avatar
徐立 committed
3019
          if (get === 'mobile' && json.isLabel && title) {
3020 3021 3022 3023 3024 3025 3026 3027 3028
            cm = (
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
              >
                {cm}
              </Form.Item>
            );
徐立's avatar
徐立 committed
3029 3030 3031
          }
          break;
        case 'Table':
3032 3033
          if (json.objCode == null || json.objCode == '') {
            cm = <></>;
徐立's avatar
徐立 committed
3034
          } else {
3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054
            cm = (
              <>
                {getFieldDecorator(dataColumn.base52 || this.props.uuid, {
                  initialValue: initValue || {},
                })(
                  <TableList
                    json={json}
                    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
3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072
          }
          break;
      }
    }

    if (json.isLabel) {
      if (get === 'mobile' && !this.props.isEdit) {
        /**
         * 列表类型
         */
        // return (<MobileList>
        //   <MobileList.Item extra={cm}>
        //   <span style={{fontSize:14}}>{title}:</span>
        //   </MobileList.Item>
        // </MobileList>)
        /**
         * 卡片类型
         */
3073 3074 3075 3076
        return (
          <Card style={{ margin: 5, border: '1px solid #ccc' }}>
            {modalCode ? (
              <FormModal
徐立's avatar
徐立 committed
3077
                {...modalProps}
3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105
                visible={this.props.DataColumn.isShowModal}
                handleCancel={this.closeModal}
                title={modalTitle}
              >
                <ZdyTable
                  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>
            ) : (
              ''
            )}
            <Card.Header title={<span style={{ fontSize: 14 }}>{title}:</span>} />
            <Card.Body>{cm}</Card.Body>
          </Card>
        );
徐立's avatar
徐立 committed
3106 3107 3108 3109 3110 3111 3112
        // return <Flex direction='column'>
        //   <Flex.Item style={{width:'100%'}}>{title}:</Flex.Item>
        //   <Flex.Item style={{width:'100%',padding:'10px'}}>{cm}</Flex.Item>
        //   </Flex>
        // return <Row><Col span={6}>{title}:</Col><Col span={18}>{cm}</Col></Row>
      }
      if (get === 'web') {
3113
        if (!isEdit) {
徐立's avatar
徐立 committed
3114 3115
          return (
            <Row
徐立's avatar
徐立 committed
3116
              style={{
3117 3118
                minHeight: 40,
                lineHeight: '40px',
徐立's avatar
徐立 committed
3119
              }}
3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131
            >
              <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)',
                }}
徐立's avatar
徐立 committed
3132 3133
              >
                {title}
3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153
                {title && (
                  <span
                    style={{
                      position: 'relative',
                      top: '-0.5px',
                      margin: '0 8px 0 2px',
                    }}
                  >
                    :
                  </span>
                )}
              </Col>
              <Col
                span={json.wrapperSpan}
                style={{
                  position: 'relative',
                  lineHeight: '40px',
                  zoom: 1,
                  fontSize: 14,
                }}
徐立's avatar
徐立 committed
3154 3155
              >
                {cm}
3156 3157 3158
              </Col>
              {modalCode ? (
                <FormModal
徐立's avatar
徐立 committed
3159
                  {...modalProps}
3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185
                  visible={this.props.DataColumn.isShowModal}
                  handleCancel={this.closeModal}
                  title={modalTitle}
                >
                  <ZdyTable
                    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>
          );
徐立's avatar
徐立 committed
3186 3187
        } else {
          return (
3188 3189 3190
            <>
              {modalCode ? (
                <FormModal
徐立's avatar
徐立 committed
3191
                  {...modalProps}
3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224
                  visible={this.props.DataColumn.isShowModal}
                  handleCancel={this.closeModal}
                  title={modalTitle}
                >
                  <ZdyTable
                    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>
              ) : (
                ''
              )}
              <Form.Item
                labelCol={{ span: json.labelSpan }}
                wrapperCol={{ span: json.wrapperSpan }}
                label={title}
              >
                {cm}
              </Form.Item>
            </>
          );
徐立's avatar
徐立 committed
3225
        }
徐立's avatar
徐立 committed
3226
      } else {
3227 3228 3229 3230
        return (
          <>
            {modalCode ? (
              <FormModal
3231
                {...modalProps}
3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258
                visible={this.props.DataColumn.isShowModal}
                handleCancel={this.closeModal}
                title={modalTitle}
              >
                <ZdyTable
                  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>
            ) : (
              ''
            )}
            {cm}
          </>
        );
徐立's avatar
徐立 committed
3259 3260
      }
    } else {
chscls@163.com's avatar
chscls@163.com committed
3261
      return (
3262 3263 3264
        <>
          {modalCode ? (
            <FormModal
徐立's avatar
徐立 committed
3265
              {...modalProps}
3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291
              visible={this.props.DataColumn.isShowModal}
              handleCancel={this.closeModal}
              title={modalTitle}
            >
              <ZdyTable
                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>
          ) : (
            ''
          )}
          <Form.Item>{cm}</Form.Item>
        </>
chscls@163.com's avatar
chscls@163.com committed
3292
      );
徐立's avatar
徐立 committed
3293 3294 3295
    }
  }
}