king
2020-07-06 3193df5faaacb0fe903ce993b16319276528524f
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
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Icon, Tooltip, Modal, notification, Button } from 'antd'
import moment from 'moment'
 
import Api from '@/api'
import options from '@/store/options.js'
import Utils from '@/utils/utils.js'
import DevUtils from '@/utils/devutils.js'
import zhCN from '@/locales/zh-CN/model.js'
import enUS from '@/locales/en-US/model.js'
import { getActionForm } from '@/templates/zshare/formconfig'
 
import ActionForm from './actionform'
import VerifyCard from '@/templates/zshare/verifycard'
import CreateFunc from '@/templates/zshare/createfunc'
import CreateInterface from '@/templates/zshare/createinterface'
import VerifyPrint from './verifyprint'
import VerifyExcelIn from './verifyexcelin'
import VerifyExcelOut from './verifyexcelout'
import DragElement from './dragaction'
import './index.scss'
 
const { confirm } = Modal
 
class ActionComponent extends Component {
  static propTpyes = {
    type: PropTypes.string,          // 菜单类型,主表或子表
    menu: PropTypes.object,          // 菜单信息(菜单id,菜单参数,菜单名称)
    config: PropTypes.object,        // 菜单配置信息
    menuformRef: PropTypes.any,      // 菜单基本信息表单对象
    pasteContent: PropTypes.object,  // 粘贴配置信息
    usefulFields: PropTypes.array,   // 自定义函数可用字段
    tabs: PropTypes.array,           // 所有标签
    setSubConfig: PropTypes.func,    // 设置子配置信息
    updateaction: PropTypes.func     // 菜单配置更新
  }
 
  state = {
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    card: null,          // 编辑中元素
    formlist: null,      // 表单信息
    actionlist: null,    // 按钮组
    copying: false,      // 按钮复制中
    visible: false,      // 模态框控制
    profVisible: false   // 验证信息模态框
  }
 
  /**
   * @description 搜索条件初始化
   */
  UNSAFE_componentWillMount () {
    this.setState({
      actionlist: fromJS(this.props.config.action).toJS()
    })
  }
 
  /**
   * @description 监听到按钮复制时,触发按钮编辑
   */
  UNSAFE_componentWillReceiveProps (nextProps) {
    const { actionlist } = this.state
 
    if (nextProps.pasteContent && nextProps.pasteContent.copyType === 'action') {
      this.setState({actionlist: [...actionlist, nextProps.pasteContent]})
      this.handleAction(nextProps.pasteContent)
    } else if (!is(fromJS(nextProps.config.action), fromJS(this.props.config.action)) && !is(fromJS(nextProps.config.action), fromJS(actionlist))) {
      this.setState({actionlist: fromJS(nextProps.config.action).toJS()})
    }
  }
 
  /**
   * @description 按钮顺序调整,或拖拽添加
   */
  handleList = (list, card) => {
    const { config } = this.props
 
    if (card) {
      this.setState({actionlist: list})
      this.handleAction(card)
    } else {
      this.setState({actionlist: list}, () => {
        this.props.updateaction({...config, action: list})
      })
    }
  }
 
  /**
   * @description 按钮编辑,获取按钮表单信息
   */
  handleAction = (card) => {
    const { menu } = this.props
    let ableField = this.props.usefulFields.join(', ')
    let functip = <div>
      <p style={{marginBottom: '5px'}}>{this.state.dict['model.tooltip.func.innerface'].replace('@ableField', ableField)}</p>
      <p>{this.state.dict['model.tooltip.func.outface']}</p>
    </div>
 
    let menulist = menu.fstMenuList.map(item => {
      return {
        value: item.MenuID,
        label: item.text,
        isLeaf: false
      }
    })
 
    if (card.linkmenu && card.linkmenu.length > 0) {
      let _param = {
        func: 'sPC_Get_FunMenu',
        ParentID: card.linkmenu[0],
        systemType: options.sysType,
        debug: 'Y'
      }
  
      Api.getSystemConfig(_param).then(result => {
        if (result.status) {
          menulist = menulist.map(item => {
            if (item.value === card.linkmenu[0]) {
              item.children = result.data.map(item => {
                let submenu = {
                  value: item.ParentID,
                  label: item.MenuNameP,
                  children: item.FunMenu.map(cell => {
                    return {
                      value: cell.MenuID,
                      label: cell.MenuName,
                      MenuID: cell.MenuID,
                      MenuName: cell.MenuName,
                      MenuNo: cell.MenuNo,
                      Ot: cell.Ot,
                      PageParam: cell.PageParam,
                      LinkUrl: cell.LinkUrl,
                      disabled: cell.MenuID === menu.MenuID
                    }
                  })
                }
 
                return submenu
              })
            }
            return item
          })
        } else {
          notification.warning({
            top: 92,
            message: result.message,
            duration: 5
          })
        }
 
        this.setState({
          visible: true,
          card: card,
          formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist)
        })
      })
    } else {
      this.setState({
        visible: true,
        card: card,
        formlist: getActionForm(card, functip, this.props.config, this.props.usefulFields, this.props.type, menulist)
      })
    }
  }
 
  /**
   * @description 取消保存,如果元素为新添元素,则从序列中删除
   */
  editModalCancel = () => {
    const { card } = this.state
 
    if (card.focus) {
      let actionlist = fromJS(this.state.actionlist).toJS()
 
      actionlist = actionlist.filter(item => item.uuid !== card.uuid)
 
      this.setState({
        card: null,
        actionlist: actionlist,
        visible: false
      })
    } else {
      this.setState({
        card: null,
        visible: false
      })
    }
  }
 
  /**
   * @description 搜索修改后提交保存
   * 1、去除系统默认搜索条件
   * 2、字段及提示文字重复校验
   * 3、更新下拉菜单可选集合
   * 4、下拉菜单数据源语法验证
   */
  handleSubmit = () => {
    const { config, menuformRef } = this.props
    const { card } = this.state
    let _actionlist = fromJS(this.state.actionlist).toJS()
    let menu = fromJS(this.props.menu).toJS() // 菜单信息,存在表单对象时,从菜单中更新
 
    if (menuformRef) {
      menu = {...menu, MenuName: menuformRef.props.form.getFieldValue('MenuName'), MenuNo: menuformRef.props.form.getFieldValue('MenuNo')}
    }
 
    this.actionFormRef.handleConfirm().then(btn => {
      _actionlist = _actionlist.filter(item => !item.origin || item.uuid === btn.uuid)
 
      let labelrepet = false
      _actionlist = _actionlist.map(item => {
        if (item.uuid !== btn.uuid && item.label === btn.label) {
          labelrepet = true
        }
 
        if (item.uuid === btn.uuid) {
          return btn
        } else {
          return item
        }
      })
 
      if (labelrepet) {
        notification.warning({
          top: 92,
          message: this.state.dict['model.name.exist'] + ' !',
          duration: 5
        })
        return
      }
 
      this.setState({
        copying: true
      })
 
      let copyActionId = '' // 按钮为复制时,记录当前按钮的Id,菜单取消保存时,删除复制按钮配置信息
 
      /**
       * @description 按钮保存校验
       * 1、检查按钮是否为表单或表单标签页,如前后一致,则复制其内容
       * 2、检查按钮是否为标签页,如前后一致,则复制标签页
       */
      new Promise(resolve => {
        if (
          !card.originCard ||
          (btn.OpenType === 'pop' && card.originCard.OpenType !== 'pop') ||
          (['tab', 'blank'].includes(btn.OpenType) && !['tab', 'blank'].includes(card.originCard.OpenType)) ||
          (btn.OpenType === 'popview' && (!btn.createTab || card.originCard.OpenType !== 'popview' || !card.originCard.linkTab))
        ) { // 按钮不是复制,或按钮前后类型不一致时,直接保存
          resolve('save')
        } else if (btn.OpenType === 'pop' || btn.OpenType === 'tab' || btn.OpenType === 'blank') {
          resolve('subconf')
        } else if (btn.OpenType === 'popview') {
          resolve('subtab')
        } else {
          resolve('save')
        }
      }).then(result => { // 查询原按钮配置信息
        if (result === 'save' || result === 'subtab') return result
 
        return Api.getSystemConfig({
          func: 'sPC_Get_LongParam',
          MenuID: card.originCard.uuid
        })
      }).then(result => { // 复制按钮配置信息,保存至新添加按钮
        if (result === 'save' || result === 'subtab') return result
 
        if (result.status && result.LongParam) {
          let _LongParam = ''
 
          // 解析配置
          if (result.LongParam) {
            try {
              _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
            } catch (e) {
              console.warn('Parse Failure')
              _LongParam = ''
            }
          }
 
          let _temp = '' // 配置信息类型
 
          // 修改模态框标题名称
          if (btn.OpenType === 'pop' && _LongParam && _LongParam.type === 'Modal') {
            try {
              _LongParam.setting.title = btn.label
              _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam)))
              _temp = 'Modal'
            } catch {
              console.warn('Stringify Failure')
              _LongParam = ''
              _temp = ''
            }
          } else if (['tab', 'blank'].includes(btn.OpenType) && _LongParam && _LongParam.type === 'FormTab') {
            try {
              _LongParam.action = _LongParam.action.map(_btn => {
                _btn.uuid = Utils.getuuid()
 
                return _btn
              })
              _LongParam.tabgroups.forEach(_groupId => {
                _LongParam[_groupId] = _LongParam[_groupId].map(_tab => {
                  _tab.uuid = Utils.getuuid()
 
                  return _tab
                })
              })
              _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam)))
              _temp = 'FormTab'
            } catch {
              console.warn('Stringify Failure')
              _LongParam = ''
              _temp = ''
            }
          }
 
          if (!_temp) return 'save'
 
          let param = {
            func: 'sPC_ButtonParam_AddUpt',
            ParentID: menu.MenuID,
            MenuID: btn.uuid,
            MenuNo: menu.MenuNo,
            Template: _temp,
            MenuName: btn.label,
            PageParam: JSON.stringify({Template: _temp}),
            LongParam: _LongParam
          }
 
          return Api.getSystemConfig(param)
        } else {
          if (!result.status) {
            notification.warning({
              top: 92,
              message: result.message,
              duration: 5
            })
          }
          return 'save'
        }
      }).then(result => {
        if (result === 'save' || result === 'subtab') return result
 
        if (!result.status) {
          notification.warning({
            top: 92,
            message: result.message,
            duration: 5
          })
        } else {
          copyActionId = btn.uuid
        }
 
        return 'save'
      }).then(result => { // 查询原按钮关联标签信息
        if (result === 'save') return result
 
        return Api.getSystemConfig({
          func: 'sPC_Get_LongParam',
          MenuID: card.originCard.linkTab
        })
      }).then(result => { // 标签复制
        if (result === 'save') return result
 
        let _LongParam = '' // 标签配置信息
 
        if (!result.status) {
          notification.warning({
            top: 92,
            message: result.message,
            duration: 5
          })
        } else if (result.LongParam) {
          // 解析标签配置
          try {
            _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
          } catch (e) {
            console.warn('Parse Failure')
            _LongParam = ''
          }
        }
 
        if (!_LongParam) {
          return 'save'
        } else {
          copyActionId = btn.linkTab
 
          return new Promise(resolve => {
            this.copytab(btn, _LongParam, resolve)
          })
        }
      }).then(() => {
        // 判断是否存在操作列
        let _hasGridbtn = _actionlist.filter(act => act.position === 'grid').length > 0
        let _gridBtn = config.gridBtn ? fromJS(config.gridBtn).toJS() : null
 
        if (_gridBtn) {
          _gridBtn.display = _hasGridbtn
        } else {
          _gridBtn = {
            display: _hasGridbtn,
            Align: 'center',
            IsSort: 'false',
            uuid: Utils.getuuid(),
            label: this.state.dict['model.form.column.action'],
            type: 'action',
            style: 'button',
            show: 'horizontal',
            Width: 120
          }
        }
 
        this.setState({
          actionlist: _actionlist,
          copying: false,
          visible: false
        }, () => {
          this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, copyActionId)
        })
      })
    })
  }
 
  /**
   * @description 标签复制
   * 1、保存按钮关联的新标签
   * 2、保存标签按钮信息
   * 3、保存新标签中按钮的子配置信息
   */
  copytab = (btn, _tab, _resolve) => {
    let _LongParam = ''
 
    _tab.uuid = btn.linkTab
    _tab.tabName = _tab.tabName + moment().format('YYYY-MM-DD HH:mm:ss')
    _tab.tabNo = _tab.tabNo + moment().format('YYYY-MM-DD HH:mm:ss')
 
    let param = {
      func: 'sPC_Tab_AddUpt',
      MenuID: _tab.uuid,
      MenuNo: _tab.tabNo,
      Template: _tab.Template,
      MenuName: _tab.tabName,
      Remark: _tab.Remark,
      PageParam: JSON.stringify({Template: _tab.Template}),
      Sort: 0
    }
 
    let _oriActions = []
 
    let btnParam = {
      func: 'sPC_Button_AddUpt',
      Type: 40,
      ParentID: _tab.uuid,
      MenuNo: _tab.tabNo,
      Template: _tab.Template,
      PageParam: '',
      LongParam: '',
      LText: ''
    }
 
    try {
      let _linkchange = {}
      btnParam.LText = []
 
      _tab.action = _tab.action.map((item, index) => {
        let uuid = Utils.getuuid()
 
        if (item.OpenType === 'pop') {
          _oriActions.push({
            prebtn: JSON.parse(JSON.stringify(item)),
            curuuid: uuid,
            Template: 'Modal'
          })
        } else if (item.OpenType === 'popview') {
          _linkchange[item.linkTab] = Utils.getuuid()
 
          item.linkTab = _linkchange[item.linkTab]
        }
 
        item.uuid = uuid
 
        btnParam.LText.push(`select '${item.uuid}' as menuid, '${item.label}' as menuname, '${(index + 1) * 10}' as Sort`)
 
        return item
      })
 
      if (_tab.funcs && _tab.funcs.length > 0) {
        _tab.funcs = _tab.funcs.map(item => {
          if (item.type === 'tab') {
            item.linkTab = _linkchange[item.linkTab]
            item.menuNo = ''
            item.subfuncs = []
          }
 
          return item
        })
      }
 
      btnParam.LText = btnParam.LText.join(' union all ')
      btnParam.LText = Utils.formatOptions(btnParam.LText)
      btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
      btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp)
 
      _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_tab)))
    } catch {
      console.warn('Stringify Failure')
      _LongParam = ''
      _resolve('save')
      return
    }
 
    param.LongParam = _LongParam
 
    new Promise(resolve => {
      Api.getSystemConfig(param).then(response => {
        if (response.status) {
          resolve(true)
        } else {
          notification.warning({
            top: 92,
            message: response.message,
            duration: 5
          })
          resolve(false)
        }
      })
    }).then(result => {
      if (!result) return result
      if (!btnParam.LText) return true
 
      return Api.getSystemConfig(btnParam)
    }).then(result => {
      if (result === false || result === true) return result
 
      if (result.status) {
        return true
      } else {
        notification.warning({
          top: 92,
          message: result.message,
          duration: 5
        })
        return false
      }
    }).then(result => {
      if (!result) return result
      if (_oriActions.length === 0) return true
 
      let deffers = _oriActions.map(item => {
        return new Promise(resolve => {
          Api.getSystemConfig({
            func: 'sPC_Get_LongParam',
            MenuID: item.prebtn.uuid
          }).then(response => {
            if (!response.status || !response.LongParam) {
              resolve(response)
            } else {
              let _param = {
                func: 'sPC_ButtonParam_AddUpt',
                ParentID: _tab.uuid,
                MenuID: item.curuuid,
                MenuNo: _tab.tabNo,
                Template: item.Template,
                MenuName: item.prebtn.label,
                PageParam: JSON.stringify({Template: item.Template}),
                LongParam: response.LongParam
              }
              Api.getSystemConfig(_param).then(resp => {
                resolve(resp)
              })
            }
          })
        })
      })
 
      return Promise.all(deffers)
    }).then(result => {
      let error = ''
 
      if (typeof(result) === 'object') {
        result.forEach(resul => {
          if (!resul.status && !error) {
            error = resul
          }
        })
      }
      
      if (error) {
        notification.warning({
          top: 92,
          message: error.message,
          duration: 5
        })
      }
 
      _resolve('save')
    })
  }
 
  /**
   * @description 按钮删除
   */
  deleteElement = (card) => {
    const { config } = this.props
    const { dict } = this.state
    let _this = this
 
    confirm({
      content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} ?`,
      okText: dict['model.confirm'],
      cancelText: this.state.dict['model.cancel'],
      onOk() {
        let _actionlist = fromJS(_this.state.actionlist).toJS()
 
        _actionlist = _actionlist.filter(item => item.uuid !== card.uuid)
 
        let _hasGridbtn = _actionlist.filter(act => act.position === 'grid').length > 0
        let _gridBtn = config.gridBtn ? fromJS(config.gridBtn).toJS() : null
 
        if (_gridBtn) {
          _gridBtn.display = _hasGridbtn
        } else {
          _gridBtn = {
            display: _hasGridbtn,
            Align: 'center',
            IsSort: 'false',
            uuid: Utils.getuuid(),
            label: this.state.dict['model.form.column.action'],
            type: 'action',
            style: 'button',
            show: 'horizontal',
            Width: 120
          }
        }
 
        let delcard = {
          type: 'action',
          card: card
        }
 
        _this.setState({
          actionlist: _actionlist
        }, () => {
          _this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn}, '', delcard)
        })
      },
      onCancel() {}
    })
  }
 
  /**
   * @description 验证信息配置
   */
  profileAction = (element) => {
    this.setState({
      profVisible: true,
      card: element
    })
  }
 
  /**
   * @description 验证信息保存
   */
  verifySubmit = () => {
    const { config } = this.props
    const { card } = this.state
    
    this.verifyRef.handleConfirm().then(res => {
      let _actionlist = fromJS(this.state.actionlist).toJS()
      _actionlist = _actionlist.filter(item => !item.origin || item.uuid === card.uuid)
 
      _actionlist = _actionlist.map(item => {
        if (item.uuid === card.uuid) {
          item.verify = res
        }
  
        return item
      })
 
      this.setState({
        actionlist: _actionlist,
        profVisible: false
      }, () => {
        this.props.updateaction({...config, action: _actionlist})
      })
    })
  }
 
  /**
   * @description 创建按钮存储过程
   */
  creatFunc = () => {
    const { config, menuformRef } = this.props
    let _config = fromJS(this.props.config).toJS()
    let menu = fromJS(this.props.menu).toJS() // 菜单信息,存在表单对象时,从菜单中更新
 
    if (menuformRef) {
      menu = {...menu, MenuName: menuformRef.props.form.getFieldValue('MenuName'), MenuNo: menuformRef.props.form.getFieldValue('MenuNo')}
    }
 
    this.actionFormRef.handleConfirm().then(res => {
      let btn = res         // 按钮信息
      let newLText = ''     // 创建存储过程sql
      let DelText = ''      // 删除存储过程sql
 
      let _actionlist = fromJS(this.state.actionlist).toJS()
 
      _actionlist = _actionlist.filter(item => !item.origin || item.uuid === btn.uuid)
 
      let labelrepet = false
      _actionlist = _actionlist.map(item => {
        if (item.uuid !== btn.uuid && item.label === btn.label) {
          labelrepet = true
        }
 
        if (item.uuid === btn.uuid) {
          return btn
        } else {
          return item
        }
      })
 
      if (labelrepet) {
        notification.warning({
          top: 92,
          message: this.state.dict['model.name.exist'] + ' !',
          duration: 5
        })
        return
      }
 
      // 创建存储过程,必须填写内部函数名
      if (!btn.innerFunc) {
        notification.warning({
          top: 92,
          message: '请填写内部函数!',
          duration: 5
        })
        return
      }
 
      new Promise(resolve => {
        // 弹窗(表单)类按钮,先获取按钮配置信息,如果尚未配置按钮则会报错并终止。
        // 获取信息后生成删除和创建存储过程的语句
        if (btn.OpenType === 'pop') {
          Api.getSystemConfig({
            func: 'sPC_Get_LongParam',
            MenuID: btn.uuid
          }).then(res => {
            let _LongParam = ''
            if (res.status && res.LongParam) {
              try {
                _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
              } catch (e) {
                console.warn('Parse Failure')
                _LongParam = ''
              }
            }
 
            if (_LongParam) {
              let fields = []
              if (_LongParam.groups.length > 0) {
                _LongParam.groups.forEach(group => {
                  fields = [...fields, ...group.sublist]
                })
              } else {
                fields = _LongParam.fields
              }
 
              let _param = {
                funcName: btn.innerFunc,
                name: _config.setting.tableName || '',
                fields: fields,
                menuNo: menu.MenuNo
              }
              newLText = Utils.formatOptions(DevUtils.getfunc(_param, btn, menu, _config))
              DelText = Utils.formatOptions(DevUtils.dropfunc(btn.innerFunc))
              resolve(true)
            } else {
              notification.warning({
                top: 92,
                message: '弹窗(表单)按钮,请先配置表单信息!',
                duration: 5
              })
              resolve(false)
            }
          })
        } else if (btn.OpenType === 'excelIn') {
          if (btn.verify && btn.verify.sheet && btn.verify.columns && btn.verify.columns.length > 0) {
            let _param = {
              funcName: btn.innerFunc,
              menuNo: menu.MenuNo
            }
            newLText = Utils.formatOptions(DevUtils.getexcelInfunc(_param, btn, menu))
            DelText = Utils.formatOptions(DevUtils.dropfunc(btn.innerFunc))
            resolve(true)
          } else {
            notification.warning({
              top: 92,
              message: '请完善导入Excel验证信息!',
              duration: 5
            })
            resolve(false)
          }
        } else if (btn.OpenType === 'excelOut') {
          let _param = {
            innerFunc: btn.innerFunc
          }
 
          newLText = Utils.formatOptions(DevUtils.getTableFunc(_param, menu, _config)) // 创建存储过程sql
          DelText = Utils.formatOptions(DevUtils.dropfunc(btn.innerFunc))
 
          resolve(true)
        } else {
          let _param = {
            funcName: btn.innerFunc,
            name: _config.setting.tableName || '',
            fields: '',
            menuNo: menu.MenuNo
          }
          newLText = Utils.formatOptions(DevUtils.getfunc(_param, btn, menu, _config))
          DelText = Utils.formatOptions(DevUtils.dropfunc(btn.innerFunc))
          resolve(true)
        }
      }).then(res => {
        if (!res) return
 
        this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => {
          if (result !== 'success') return
 
          // 判断是否存在操作列
          let _hasGridbtn = _actionlist.filter(act => act.position === 'grid').length > 0
          let _gridBtn = config.gridBtn ? fromJS(config.gridBtn).toJS() : null
 
          if (_gridBtn) {
            _gridBtn.display = _hasGridbtn
          } else {
            _gridBtn = {
              display: _hasGridbtn,
              Align: 'center',
              IsSort: 'false',
              uuid: Utils.getuuid(),
              label: this.state.dict['model.form.column.action'],
              type: 'action',
              style: 'button',
              show: 'horizontal',
              Width: 120
            }
          }
 
          this.setState({
            actionlist: _actionlist
          }, () => {
            this.props.updateaction({...config, action: _actionlist, gridBtn: _gridBtn})
          })
        })
      })
    })
  }
 
  /**
   * @description 创建按钮接口(写入)
   */
  btnCreatInterface = () => {
    const { config, type, menuformRef } = this.props
    let menu = fromJS(this.props.menu).toJS() // 菜单信息,存在表单对象时,从菜单中更新
 
    if (menuformRef) {
      menu = {...menu, MenuName: menuformRef.props.form.getFieldValue('MenuName'), MenuNo: menuformRef.props.form.getFieldValue('MenuNo')}
    }
 
    this.actionFormRef.handleConfirm().then(result => {
      if (result.Ot === 'requiredOnce') {
        notification.warning({
          top: 92,
          message: '多行拼接时,不可创建接口!',
          duration: 5
        })
        return
      }
      let _menu = {
        type: type,
        MenuID: menu.MenuID,
        menuName: menu.MenuName,
        menuNo: menu.MenuNo
      }
      
      this.refs.btnCreatInterface.triggerInInterface(result, config, _menu)
    })
  }
 
  /**
   * @description 按钮双击触发子配置
   */
  btnDoubleClick = (element) => {
    if (!element.origin && (element.OpenType === 'pop' || element.OpenType === 'popview' || element.OpenType === 'blank' || element.OpenType === 'tab')) {
      this.props.setSubConfig(element)
    } else {
      notification.warning({
        top: 92,
        message: '此按钮无子配置项!',
        duration: 5
      })
    }
  }
 
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
  }
 
  /**
   * @description 组件销毁,清除state更新
   */
  componentWillUnmount () {
    this.setState = () => {
      return
    }
  }
 
  render() {
    const { config } = this.props
    const { actionlist, visible, card, dict, copying, profVisible } = this.state
 
    let hasbtncrtinter = false
    if (card && !card.copyType && config.setting.interType === 'inner' && !config.setting.innerFunc && config.setting.dataresource) {
      hasbtncrtinter = true
    }
 
    return (
      <div className="model-table-action-list" style={config.charts.length > 1 ? {paddingTop: 15} : null}>
        <Tooltip placement="bottomLeft" overlayClassName="middle" title={dict['model.tooltip.action.guide']}>
          <Icon type="question-circle" />
        </Tooltip>
        <DragElement
          list={actionlist}
          setting={this.props.config.setting}
          handleList={this.handleList}
          handleMenu={this.handleAction}
          deleteMenu={this.deleteElement}
          profileMenu={this.profileAction}
          doubleClickCard={this.btnDoubleClick}
          placeholder={dict['header.form.action.placeholder']}
        />
        {/* 编辑按钮:复制、编辑 */}
        <Modal
          title={dict['model.action'] + '-' + (card && card.copyType === 'action' ? dict['model.copy'] : dict['model.edit'])}
          visible={visible}
          width={800}
          maskClosable={false}
          onCancel={this.editModalCancel}
          footer={[
            hasbtncrtinter ? <CreateInterface key="interface" dict={dict} ref="btnCreatInterface" trigger={this.btnCreatInterface}/> : null,
            card && !card.copyType ? <CreateFunc key="create" dict={dict} ref="btnCreatFunc" trigger={this.creatFunc}/> : null,
            <Button key="cancel" onClick={this.editModalCancel}>{dict['model.cancel']}</Button>,
            <Button key="confirm" type="primary" loading={copying} onClick={this.handleSubmit}>{dict['model.confirm']}</Button>
          ]}
          destroyOnClose
        >
          <ActionForm
            dict={dict}
            card={card}
            tabs={this.props.tabs}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            setting={config.setting}
            wrappedComponentRef={(inst) => this.actionFormRef = inst}
          />
        </Modal>
        {/* 按钮使用系统存储过程时,验证信息模态框 */}
        <Modal
          wrapClassName="model-table-action-verify-modal"
          title={'验证信息'}
          visible={profVisible}
          width={'75vw'}
          maskClosable={false}
          style={{minWidth: '900px', maxWidth: '1200px'}}
          okText={dict['model.submit']}
          onOk={this.verifySubmit}
          onCancel={() => { this.setState({ profVisible: false }) }}
          destroyOnClose
        >
          {card && !card.execMode && card.OpenType !== 'excelIn' && card.OpenType !== 'excelOut' ?
            <VerifyCard
              floor={this.props.type}
              card={card}
              dict={dict}
              config={config}
              columns={config.columns}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
          {card && card.execMode ?
            <VerifyPrint
              card={card}
              dict={dict}
              columns={config.columns}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
          {card && card.OpenType === 'excelIn' ?
            <VerifyExcelIn
              card={card}
              dict={dict}
              columns={config.columns}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
          {card && card.OpenType === 'excelOut' ?
            <VerifyExcelOut
              card={card}
              dict={dict}
              config={config}
              wrappedComponentRef={(inst) => this.verifyRef = inst}
            /> : null
          }
        </Modal>
      </div>
    )
  }
}
 
export default ActionComponent