king
2020-03-03 e603c97dbe7a4f1dbd6445e00383ed651182e0fe
src/templates/comtableconfig/index.jsx
@@ -19,6 +19,7 @@
import TabForm from '@/templates/tableshare/tabform'
import SearchForm from '@/templates/tableshare/searchform'
import ColumnForm from '@/templates/tableshare/columnform'
import PasteForm from '@/templates/tableshare/pasteform'
import DragElement from '@/templates/tableshare/dragelement'
import ColspanForm from '@/templates/tableshare/colspanform'
import GridBtnForm from '@/templates/tableshare/gridbtnform'
@@ -612,9 +613,9 @@
              // 解析配置,修改模态框标题名称
              if (result.LongParam) {
                try {
                  _LongParam = window.decodeURIComponent(window.atob(result.LongParam))
                  _LongParam = JSON.parse(_LongParam)
                  _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
                } catch (e) {
                  console.warn('Parse Failure')
                  _LongParam = ''
                }
              }
@@ -623,6 +624,7 @@
                  _LongParam.setting.title = res.label
                  _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam)))
                } catch {
                  console.warn('Stringify Failure')
                  _LongParam = ''
                }
              } else {
@@ -669,9 +671,9 @@
              // 解析配置,修改模态框标题名称
              if (result.LongParam) {
                try {
                  _LongParam = window.decodeURIComponent(window.atob(result.LongParam))
                  _LongParam = JSON.parse(_LongParam)
                  _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
                } catch (e) {
                  console.warn('Parse Failure')
                  _LongParam = ''
                }
              }
@@ -694,6 +696,7 @@
                  _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_LongParam)))
                  _temp = 'FormTab'
                } catch {
                  console.warn('Stringify Failure')
                  _LongParam = ''
                }
              } else {
@@ -874,10 +877,10 @@
          }).then(res => {
            let _LongParam = ''
            if (res.status && res.LongParam) {
              _LongParam = window.decodeURIComponent(window.atob(res.LongParam))
              try {
                _LongParam = JSON.parse(_LongParam)
                _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
              } catch (e) {
                console.warn('Parse Failure')
                _LongParam = ''
              }
            }
@@ -1685,9 +1688,9 @@
        
                  if (result.LongParam) {
                    try {
                      _LongParam = window.decodeURIComponent(window.atob(result.LongParam))
                      _LongParam = JSON.parse(_LongParam)
                      _LongParam = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
                    } catch (e) {
                      console.warn('Parse Failure')
                      _LongParam = ''
                    }
                  }
@@ -1752,14 +1755,22 @@
        
        let tabParam = { // 添加菜单tab页
          func: 'sPC_sMenusTab_AddUpt',
          MenuID: menu.MenuID,
          LText: _config.tabs.map((item, index) => {
            return `select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort`
          })
          MenuID: menu.MenuID
        }
        tabParam.LText = tabParam.LText.join(' union all ')
        tabParam.LText = Utils.formatOptions(tabParam.LText)
        let _LText = []
        let _index = 1
        _config.tabgroups.forEach(groupId => {
          _config[groupId].forEach(item => {
            _LText.push(`select '${menu.MenuID}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${_index * 10}' as Sort`)
            _index++
          })
        })
        _LText = _LText.join(' union all ')
        tabParam.LText = Utils.formatOptions(_LText)
        tabParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
        tabParam.secretkey = Utils.encrypt(tabParam.LText, tabParam.timestamp)
  
@@ -1804,6 +1815,7 @@
                try {
                  _ParentParam = window.btoa(window.encodeURIComponent(JSON.stringify(item.card)))
                } catch (e) {
                  console.warn('Stringify Failure')
                  _ParentParam = null
                }
@@ -2027,10 +2039,10 @@
            if (result.LongParam) {
              let _subconfig = ''
              try {
                _subconfig = window.decodeURIComponent(window.atob(result.LongParam))
                _subconfig = JSON.parse(_subconfig)
                _subconfig = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
                _temp = _subconfig.type
              } catch (e) {
                console.warn('Parse Failure')
                _subconfig = ''
              }
@@ -2054,6 +2066,7 @@
                  })
                  _subconfig = window.btoa(window.encodeURIComponent(JSON.stringify(_subconfig)))
                } catch {
                  console.warn('Stringify Failure')
                  _subconfig = ''
                }
@@ -2554,10 +2567,10 @@
            })
            let _LongParam = ''
            if (res.LongParam) {
              _LongParam = window.decodeURIComponent(window.atob(res.LongParam))
              try {
                _LongParam = JSON.parse(_LongParam)
                _LongParam = JSON.parse(window.decodeURIComponent(window.atob(res.LongParam)))
              } catch (e) {
                console.warn('Parse Failure')
                _LongParam = ''
              }
            }
@@ -2740,6 +2753,7 @@
            try {
              _conf = JSON.parse(window.decodeURIComponent(window.atob(menu.ParentParam)))
            } catch (e) {
              console.warn('Parse Failure')
              _conf = ''
            }
          }
@@ -2826,6 +2840,25 @@
      Api.getSystemConfig(_param)
    })
    this.props.handleView()
  }
  pasteSubmit = () => {
    this.pasteFormRef.handleConfirm().then(res => {
      if (res.copyType !== 'action') {
        notification.warning({
          top: 92,
          message: '配置信息格式错误!',
          duration: 10
        })
        return
      }
      this.setState({
        modaltype: ''
      }, () => {
        this.handleAction(res, 'copy')
      })
    })
  }
  render () {
@@ -2995,13 +3028,13 @@
                  placeholder={this.state.dict['header.form.search.placeholder']}
                />
              </div>
              <div className="action-list">
              <div className="action-list" id="action-list">
                <Tooltip placement="bottomLeft" overlayClassName="middle" title="在左侧工具栏《按钮》中,选择对应类型的按钮拖至此处添加,如选择按钮类型为表单、新标签页等含有配置页面的按钮,可在左侧工具栏-按钮-可配置按钮处,点击按钮完成相关配置。注:当设置按钮显示位置为表格时,显示列会增加操作列。">
                  <Icon type="question-circle" />
                </Tooltip>
                {/* <div className="thawbutton" title={this.state.dict['header.form.thawbutton']} onClick={this.handleThaw}>
                  <Icon type="unlock" />
                </div> */}
                <div className="copybutton" title={this.state.dict['header.form.paste']} onClick={() => {this.setState({modaltype: 'paste'})}}>
                  <Icon type="snippets" />
                </div>
                <DragElement
                  type="action"
                  list={this.state.config.action}
@@ -3073,6 +3106,7 @@
          <SearchForm
            dict={this.state.dict}
            card={this.state.card}
            inputSubmit={this.handleSubmit}
            optionLibs={this.state.optionLibs}
            formlist={this.state.formlist}
            wrappedComponentRef={(inst) => this.searchFormRef = inst}
@@ -3097,6 +3131,7 @@
            card={this.state.card}
            tabs={this.state.tabviews}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            setting={this.state.config.setting}
            wrappedComponentRef={(inst) => this.actionFormRef = inst}
          />
@@ -3114,6 +3149,7 @@
          <ColumnForm
            dict={this.state.dict}
            card={this.state.card}
            inputSubmit={this.handleSubmit}
            formlist={this.state.formlist}
            wrappedComponentRef={(inst) => this.columnFormRef = inst}
          />
@@ -3131,6 +3167,7 @@
          <ColspanForm
            dict={this.state.dict}
            card={this.state.card}
            inputSubmit={this.handleSubmit}
            columns={this.state.config.columns}
            wrappedComponentRef={(inst) => this.columnFormRef = inst}
          />
@@ -3147,6 +3184,7 @@
        >
          <GridBtnForm
            dict={this.state.dict}
            inputSubmit={this.handleSubmit}
            card={this.state.config.gridBtn}
            wrappedComponentRef={(inst) => this.gridBtnFormRef = inst}
          />
@@ -3163,10 +3201,11 @@
        >
          <TabForm
            type="tabs"
            tabs={this.state.tabviews}
            dict={this.state.dict}
            card={this.state.card}
            tabs={this.state.tabviews}
            formlist={this.state.formlist}
            inputSubmit={this.handleSubmit}
            wrappedComponentRef={(inst) => this.tabsFormRef = inst}
          />
        </Modal>
@@ -3261,6 +3300,7 @@
          <SettingForm
            dict={this.state.dict}
            menu={this.props.menu}
            inputSubmit={this.settingSave}
            data={this.state.config.setting}
            columns={this.state.config.columns}
            usefulFields={this.props.permFuncField}
@@ -3295,6 +3335,21 @@
          {!this.state.thawbtnlist && <Spin style={{marginLeft: 'calc(50% - 22px)', marginTop: '70px', marginBottom: '70px'}} size="large" />}
          {this.state.thawbtnlist && <TransferForm ref="trawmenu" dict={this.state.dict} menulist={this.state.thawbtnlist}/>}
        </Modal>
        {/* 按钮配置信息粘贴复制 */}
        <Modal
          title={this.state.dict['header.form.paste']}
          visible={modaltype === 'paste'}
          width={600}
          maskClosable={false}
          onOk={this.pasteSubmit}
          onCancel={() => {this.setState({modaltype: ''})}}
          destroyOnClose
        >
          <PasteForm
            dict={this.state.dict}
            wrappedComponentRef={(inst) => this.pasteFormRef = inst}
          />
        </Modal>
        {this.state.loading && <Spin size="large" />}
      </div>
    )