king
2020-12-17 a4ef35bb323b5f8300f15a4eb604d61ff39a194a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
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
367
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
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { connect } from 'react-redux'
import { is, fromJS } from 'immutable'
import { notification, Spin, Row, Col, Button, message } from 'antd'
import moment from 'moment'
import md5 from 'md5'
 
import Api from '@/api'
import options from '@/store/options.js'
import zhCN from '@/locales/zh-CN/main.js'
import enUS from '@/locales/en-US/main.js'
import Utils from '@/utils/utils.js'
import asyncComponent from '@/utils/asyncComponent'
import MKEmitter from '@/utils/events.js'
import NotFount from '@/components/404'
import './index.scss'
 
// 通用组件
const AntvBarAndLine = asyncComponent(() => import('./components/chart/antv-bar-line'))
const AntvPie = asyncComponent(() => import('./components/chart/antv-pie'))
const AntvTabs = asyncComponent(() => import('./components/tabs/antv-tabs'))
const DataCard = asyncComponent(() => import('./components/card/data-card'))
const PropCard = asyncComponent(() => import('./components/card/prop-card'))
const TableCard = asyncComponent(() => import('./components/card/table-card'))
const MainSearch = asyncComponent(() => import('./components/search/main-search'))
const NormalTable = asyncComponent(() => import('./components/table/normal-table'))
 
class CustomPage extends Component {
  static propTpyes = {
    param: PropTypes.any,        // 其他页面传递的参数
    MenuID: PropTypes.string,    // 菜单Id
    MenuNo: PropTypes.string,    // 菜单参数
    MenuName: PropTypes.string   // 菜单名称
  }
 
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    ContainerId: Utils.getuuid(), // 菜单外层html Id
    BID: '',              // 页面跳转时携带ID
    loadingview: true,    // 页面加载中
    viewlost: false,      // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用
    lostmsg: '',          // 页面丢失时的提示信息
    config: null,         // 页面配置信息,包括组件等
    mainSearch: null,     // 主搜索
    userConfig: null,     // 用户自定义设置
    data: null,           // 列表数据集
    loading: false,       // 列表数据加载中
    visible: false,       // 标签页控制
    treevisible: false,   // 菜单结构树弹框显示隐藏控制
    debug: sessionStorage.getItem('debug') === 'true'
  }
 
  /**
   * @description 获取页面配置信息
   */
  async loadconfig () {
    const { permAction, permMenus, param } = this.props
 
    let _param = {
      func: 'sPC_Get_LongParam',
      MenuID: this.props.MenuID
    }
    let result = await Api.getCacheConfig(_param)
 
    if (result.status) {
      let config = ''
      let userConfig = null
 
      try { // 配置信息解析
        config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
      } catch (e) {
        console.warn('Parse Failure')
        config = ''
      }
 
      // HS不使用自定义设置
      if (result.LongParamUser && this.props.menuType !== 'HS') {
        try { // 配置信息解析
          userConfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParamUser)))
        } catch (e) {
          console.warn('Parse Failure')
          userConfig = null
        }
      }
 
      // 页面配置解析错误时提示
      if (!config) {
        this.setState({
          viewlost: true,
          loadingview: false
        })
        return
      }
 
      // 页面未启用时,显示未启用页面
      if (!config.enabled) {
        this.setState({
          viewlost: true,
          loadingview: false,
          lostmsg: this.state.dict['main.view.unenabled']
        })
        return
      }
 
      // 数据缓存设置
      if (config.cacheUseful === 'true') {
        if (!['day', 'hour'].includes(config.timeUnit)) {
          config.timeUnit = 'day'
        }
        config.cacheTime = config.cacheTime || 1
      }
 
      // 权限过滤
      let roleId = sessionStorage.getItem('role_id') || '' // 角色ID
      config.components = this.filterComponent(config.components, roleId, permAction, permMenus)
      
      // 获取主搜索条件
      let mainSearch = []
      config.components.forEach(component => {
        if (component.type !== 'search') return
 
        component.search = component.search.map(item => {
          item.oriInitval = item.initval
          if (['text', 'select', 'link'].includes(item.type) && param) {
            if (param.searchkey === item.field) {
              item.initval = param.searchval
            } else if (param.BID && item.field.toLowerCase() === 'bid') {
              item.initval = param.BID
            } else if (param.data && param.data[item.field]) {
              item.initval = param.data[item.field]
            }
          }
 
          return item
        })
 
        mainSearch = Utils.initMainSearch(component.search)
      })
 
      let params = []
      let BID = param && param.BID ? param.BID : ''
      let inherit = {}
 
      if (config.cacheUseful === 'true') { // 缓存继承
        inherit.cacheUseful = config.cacheUseful
        inherit.timeUnit = config.timeUnit
        inherit.cacheTime = config.cacheTime
      }
 
      config.components = this.formatSetting(config.components, params, mainSearch, inherit)
 
      this.setState({
        BID: BID,
        userConfig: userConfig,
        config,
        mainSearch
      }, () => {
        if (!params || params.length === 0) {
          setTimeout(() => { // 延时加载状态
            this.setState({
              loadingview: false
            })
          }, 1000)
        } else {
          this.loadmaindata(params)
        }
      })
    } else {
      this.setState({
        loadingview: false,
        viewlost: true
      })
      notification.warning({
        top: 92,
        message: result.message,
        duration: 5
      })
    }
  }
 
  filterComponent = (components, roleId, permAction, permMenus) => {
    return components.filter(item => {
      if (item.type === 'tabs') {
        if (
          item.setting.blacklist && item.setting.blacklist.length > 0 &&
          item.setting.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0
        ) {
          return false
        }
 
        item.subtabs = item.subtabs.map(tab => {
          tab.components = this.filterComponent(tab.components, roleId, permAction, permMenus)
          return tab
        })
 
        let supIds = []
        item.subtabs.forEach(tab => {
          tab.components.forEach(comp => {
            if (comp.type === 'tabs' && comp.parentIds) {
              supIds.push(...comp.parentIds)
            } else if (comp.setting.supModule) {
              supIds.push(comp.setting.supModule)
            }
          })
        })
        item.parentIds = supIds
      } else if (item.type === 'pie' || item.type === 'bar' || item.type === 'line') {
        if (
          item.plot.blacklist && item.plot.blacklist.length > 0 &&
          item.plot.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0
        ) {
          return false
        }
      } else {
        if (
          item.wrap.blacklist && item.wrap.blacklist.length > 0 &&
          item.wrap.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0
        ) {
          return false
        }
      }
      // 搜索黑名单过滤
      if (item.search && item.search.length > 0) {
        item.search = item.search.map(cell => {
          cell.oriInitval = cell.initval
 
          if (!cell.blacklist || cell.blacklist.length === 0) return cell
          if (cell.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
            cell.Hide = 'true'
          }
 
          return item
        })
      }
      if (item.type === 'table' && item.subtype === 'normaltable') {
        item.cols = item.cols.map(col => {
          if (!col.blacklist || col.blacklist.length === 0) return col
          if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
            col.Hide = 'true'
          }
 
          if (col.Hide !== 'true' && col.linkmenu && col.linkmenu.length > 0) {
            let menu_id = col.linkmenu.slice(-1)[0]
            col.linkThdMenu = permMenus.filter(m => m.MenuID === menu_id)[0] || ''
          } else {
            col.linkThdMenu = ''
          }
 
          return col
        })
      }
 
      // 权限过滤
      if (this.props.menuType !== 'HS') {
        if (item.action && item.action.length > 0) {
          item.action = item.action.filter(cell => {
            cell.logLabel = item.name + '-' + cell.label
            return permAction[cell.uuid]
          })
        }
        if (item.type === 'card') {
          item.subcards.forEach(card => {
            let _hasheight = card.style.height && card.style.height !== 'auto'
 
            if (card.style.shadow) { // 卡片阴影
              card.style.boxShadow = '0 0 4px ' + card.style.shadow
              delete card.style.shadow
            }
 
            card.elements = card.elements.filter(cell => {
              if (cell.eleType === 'button') {
                cell.logLabel = item.name + '-' + cell.label
                cell.Ot = 'requiredSgl'
              } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) {
                cell.innerHeight = 'auto'
              }
              return cell.eleType !== 'button' || permAction[cell.uuid]
            })
            card.backElements = card.backElements.filter(cell => {
              if (cell.eleType === 'button') {
                cell.logLabel = item.name + '-' + cell.label
                cell.Ot = 'requiredSgl'
              } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) {
                cell.innerHeight = 'auto'
              }
              return cell.eleType !== 'button' || permAction[cell.uuid]
            })
          })
        } else if (item.type === 'table' && item.subtype === 'tablecard') {
          item.subcards.forEach(card => {
            let _hasheight = card.style.height && card.style.height !== 'auto'
            card.elements = card.elements.filter(cell => {
              if (cell.eleType === 'button') {
                cell.logLabel = item.name + '-' + cell.label
                cell.Ot = 'requiredSgl'
              } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) {
                cell.innerHeight = 'auto'
              }
              return cell.eleType !== 'button' || permAction[cell.uuid]
            })
          })
        } else if (item.type === 'table' && item.subtype === 'normaltable') {
          item.cols.forEach(col => {
            if (col.type !== 'action') return
            col.elements = col.elements.filter(cell => {
              cell.logLabel = item.name + '-' + cell.label
              cell.Ot = 'requiredSgl'
              return permAction[cell.uuid]
            })
          })
        } 
      } else {
        if (item.action && item.action.length > 0) {
          item.action = item.action.map(cell => {
            cell.logLabel = item.name + '-' + cell.label
            return cell
          })
        }
      }
 
      if (item.setting && item.setting.supModule) {
        let pid = item.setting.supModule.slice(-1)[0]
        if (pid && pid !== 'empty') {
          item.setting.supModule = pid
        } else {
          item.setting.supModule = ''
        }
      }
      if (item.wrap && item.wrap.doubleClick) {
        let index = item.action.findIndex((btn) => btn.uuid === item.wrap.doubleClick)
        if (index === -1) {
          item.wrap.doubleClick = ''
        }
      }
      
      return true
    })
  }
 
  // 格式化默认设置
  formatSetting = (components, params, mainSearch, inherit) => {
    return components.map(component => {
      if (component.type === 'tabs') {
        component.subtabs = component.subtabs.map(tab => {
          tab.components = this.formatSetting(tab.components, [], [], inherit)
          tab = {...tab, ...inherit}
          return tab
        })
      }
 
      if (!component.setting) return component // 不使用系统函数时
      if (!component.format || (component.subtype === 'propcard' && component.wrap.datatype === 'static')) return component // 没有动态数据  数据格式 array 或 object
      if (component.setting.interType !== 'system') { // 不使用系统函数时
        component.setting.sync = 'false'
        component.setting.laypage = component.setting.laypage === 'true'
        return component
      }
 
      let _customScript = ''
      component.scripts && component.scripts.forEach(script => {
        if (script.status !== 'false') {
          _customScript += `
          ${script.sql}
          `
        }
      })
      delete component.scripts
 
      component.setting.execute = component.setting.execute !== 'false'  // 默认sql是否执行,转为boolean 统一格式
      component.setting.laypage = component.setting.laypage === 'true'   // 是否分页,转为boolean 统一格式
 
      if (!component.setting.execute) {
        component.setting.dataresource = ''
      }
      if (/\s/.test(component.setting.dataresource)) {
        component.setting.dataresource = '(' + component.setting.dataresource + ') tb'
      }
  
      if (sessionStorage.getItem('dataM') === 'true') { // 数据权限
        component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*')
        component.setting.dataresource = component.setting.dataresource.replace(/@\$/ig, '*/')
        _customScript = _customScript.replace(/\$@/ig, '/*')
        _customScript = _customScript.replace(/@\$/ig, '*/')
      } else {
        component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '')
        _customScript = _customScript.replace(/@\$|\$@/ig, '')
      }
 
      component.setting.customScript = _customScript // 整理后自定义脚本
 
      // floor    组件的层级
      // dataName 系统生成的数据源名称
      // pageable 是否分页,组件属性,不分页的组件才可以统一查询
      if (component.floor === 1 && component.dataName && (!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true' && component.setting.sync === 'true') {
        let param = this.getDefaultParam(component, mainSearch)
        params.push(param)
      } else if (component.floor === 1) {
        component.setting.sync = 'false'
      }
 
      return component
    })
  }
 
  /**
   * @description 获取系统存储过程 sPC_Get_TableData 的参数
   */
  getDefaultParam = (component, mainSearch) => {
    const { columns, search, setting, dataName, format } = component
    
    let searchlist = []
    if (search && search.length > 0) {
      searchlist = Utils.initMainSearch(search)
    }
 
    if (setting.useMSearch === 'true') {
      let keys = searchlist.map(item => item.key)
      mainSearch.forEach(item => {
        if (!keys.includes(item.key)) {
          searchlist.push(item)
        }
      })
    }
 
    let arr_field = columns.map(col => col.field)
    let _dataresource = setting.dataresource
    let _customScript = setting.customScript
 
    
    if (setting.queryType === 'statistics' || _customScript) {
      let allSearch = Utils.getAllSearchOptions(searchlist)
      let regoptions = allSearch.map(item => {
        return {
          reg: new RegExp('@' + item.key + '@', 'ig'),
          value: `'${item.value}'`
        }
      })
 
      regoptions.forEach(item => {
        if (_dataresource && setting.queryType === 'statistics') {
          _dataresource = _dataresource.replace(item.reg, item.value)
        }
        _customScript = _customScript.replace(item.reg, item.value)
      })
    }
 
    let _search = ''
    if (setting.queryType !== 'statistics' && _dataresource) {
      _search = Utils.joinMainSearchkey(searchlist)
      _search = _search ? 'where ' + _search : ''
    }
 
    if (setting.order && _dataresource) {
      _dataresource = `select top 1000 ${arr_field.join(',')} from (select ${arr_field.join(',')} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable order by tmptable.rows `
    } else if (_dataresource) {
      _dataresource = `select top 1000 ${arr_field.join(',')} from ${_dataresource} ${_search} `
    }
 
    // 测试系统打印查询语句
    if ((options.sysType === 'local' && !window.GLOB.systemType) || window.debugger === true) {
      _customScript &&  console.info(`${_dataresource ? '' : '/*不执行默认sql*/\n'}${_customScript}`)
      _dataresource &&  console.info(_dataresource)
    }
 
    return {
      name: dataName,
      columns: columns,
      par_tablename: '',
      type: format === 'array' ? format : '',
      primaryKey: setting.primaryKey || '',
      foreign_key: '',
      sql: _dataresource,
      script: _customScript
    }
  }
 
  /**
   * @description 主表数据加载
   */ 
  loadmaindata = (params) => {
    const { config } = this.state
    let LText_field = []
    let diffUser = false
    let _LText = params.map((item, index) => {
      let _script = item.script
 
      if (index === 0) {
        _script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000) select @ErrorCode='',@retmsg =''
          ${_script}
        `
      }
      if (!diffUser && (/@userid@/ig.test(item.sql) || /@userid@/ig.test(_script))) {
        diffUser = true
      }
 
      item.columns.forEach(cell => {
        LText_field.push(`Select '${item.name}' as tablename,'${cell.field}' as fieldname,'${cell.datatype}' as field_type`)
      })
      return `Select '${item.name}' as tablename,'${window.btoa(window.encodeURIComponent(item.sql))}' as LText,'${window.btoa(window.encodeURIComponent(_script))}' as Lcustomize,'${item.type}' as table_type,'${item.primaryKey}' as primary_key,'${item.par_tablename}' as par_tablename,'${item.foreign_key}' as foreign_key,'${index}' as Sort`
    })
 
    // 把大接口sPC_Get_structured_data的ltext拆成三份,第一段:@LText1,第二段@LText,第三段@LText2
    let param = {
      func: 'sPC_Get_structured_data',
      LText: _LText.join(' union all '),
      LText_field: LText_field.join(' union all '),
      BID: this.state.BID || ''
    }
 
    let { LText, LText1, LText2 } = Utils.sPCInUpDeFormatOptions(param.LText)
 
    param.LText1 = LText1
    param.LText = LText
    param.LText2 = LText2
    param.LText_field = Utils.formatOptions(param.LText_field)
 
    if (config.cacheUseful === 'true') {
      param.time_type = config.timeUnit
      param.time_limit = config.cacheTime
      if (diffUser) {
        param.userid = sessionStorage.getItem('UserID')
      }
      param.data_md5 = md5(JSON.stringify(param))
    }
 
    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
 
    this.setState({loading: true, loadingview: false})
 
    Api.getLocalConfig(param).then(result => {
      if (result.status) {
        delete result.status
        delete result.message
        delete result.ErrMesg
        delete result.ErrCode
 
        this.setState({
          data: result,
          loading: false
        })
      } else {
        this.setState({
          data: '',
          loading: false
        })
        notification.error({
          top: 92,
          message: result.message,
          duration: 10
        })
      }
    })
  }
 
  handleviewconfig = (e) => {
    e.stopPropagation()
 
    const { MenuNo } = this.props
    const { config } = this.state
 
    if (config && config.funcs && config.funcs.length > 0) {
      this.setState({
        treevisible: true
      })
    } else {
      let oInput = document.createElement('input')
      oInput.value = MenuNo || ''
      document.body.appendChild(oInput)
      oInput.select()
      document.execCommand('Copy')
      document.body.removeChild(oInput)
      message.success(this.state.dict['main.copy.success'])
    }
  }
 
  reloadMenuView = (menuId) => {
    const { MenuID } = this.props
 
    if (MenuID !== menuId) return
 
    this.reloadview()
  }
 
  UNSAFE_componentWillMount () {
    // 组件加载时,获取菜单数据
    this.loadconfig()
  }
 
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
  }
 
  componentDidMount () {
    MKEmitter.addListener('reloadMenuView', this.reloadMenuView)
  }
 
  /**
   * @description 组件销毁,清除state更新,清除快捷键设置
   */
  componentWillUnmount () {
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('reloadMenuView', this.reloadMenuView)
  }
 
  reloadview = () => {
    this.setState({
      BID: '',              // 页面跳转时携带ID
      loadingview: true,    // 页面加载中
      viewlost: false,      // 页面丢失:1、未获取到配置-页面丢失;2、页面未启用
      config: null,         // 页面配置信息,包括组件等
      loading: false        // 列表数据加载中
    }, () => {
      this.loadconfig()
    })
  }
 
  resetSearch = (search) => {
    this.setState({mainSearch: search})
  }
 
  getComponents = () => {
    const { menuType } = this.props
    const { config, BID, data, mainSearch } = this.state
 
    if (!config || !config.components) return
 
    return config.components.map(item => {
      let _bid = BID
      if (item.setting && item.setting.supModule) {
        _bid = ''
      }
 
      if (item.type === 'bar' || item.type === 'line') {
        return (
          <Col span={item.width} key={item.uuid}>
            <AntvBarAndLine config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
          </Col>
        )
      } else if (item.type === 'pie') {
        return (
          <Col span={item.width} key={item.uuid}>
            <AntvPie config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
          </Col>
        )
      } else if (item.type === 'search') {
        return (
          <Col span={item.width} key={item.uuid}>
            <MainSearch config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} refreshdata={this.resetSearch} />
          </Col>
        )
      } else if (item.type === 'tabs') {
        return (
          <Col span={item.width} key={item.uuid}>
            <AntvTabs config={item} mainSearch={mainSearch} />
          </Col>
        )
      } else if (item.type === 'card' && item.subtype === 'datacard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <DataCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
          </Col>
        )
      } else if (item.type === 'card' && item.subtype === 'propcard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <PropCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
          </Col>
        )
      } else if (item.type === 'table' && item.subtype === 'tablecard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <TableCard config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
          </Col>
        )
      } else if (item.type === 'table' && item.subtype === 'normaltable') {
        return (
          <Col span={item.width} key={item.uuid}>
            <NormalTable config={item} data={data} BID={_bid} mainSearch={mainSearch} menuType={menuType} />
          </Col>
        )
      } else {
        return null
      }
    })
  }
 
  render() {
    const { menuType, MenuNo } = this.props
    const { debug, loadingview, viewlost, config, loading } = this.state
 
    return (
      <div className={'custom-page-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}>
        {(loadingview || loading) ? <Spin className="view-spin" size="large" /> : null}
        <Row>{this.getComponents()}</Row>
        {debug && MenuNo && options.sysType !== 'cloud' && menuType !== 'HS' ? <Button
          icon="copy"
          shape="circle"
          className="common-table-copy"
          onClick={this.handleviewconfig}
        /> : null}
        {viewlost ? <NotFount msg={this.state.lostmsg} /> : null}
      </div>
    )
  }
}
 
const mapStateToProps = (state) => {
  return {
    menuType: state.editLevel,
    refreshTab: state.refreshTab,
    permAction: state.permAction,
    permMenus: state.permMenus
  }
}
 
const mapDispatchToProps = () => {
  return {}
}
 
export default connect(mapStateToProps, mapDispatchToProps)(CustomPage)