king
2021-10-21 1da6506bf58270bacc2a4345002c6b082835580e
src/menu/popview/index.jsx
@@ -19,6 +19,7 @@
const { confirm } = Modal
const MenuForm = asyncComponent(() => import('./menuform'))
const Versions = asyncComponent(() => import('@/menu/versions'))
const Header = asyncComponent(() => import('@/menu/header'))
const SourceWrap = asyncComponent(() => import('@/menu/modulesource'))
const MenuShell = asyncComponent(() => import('@/menu/menushell'))
@@ -39,9 +40,7 @@
  state = {
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    MenuType: '',
    MenuId: '',
    MenuNo: '',
    delButtons: [],
    activeKey: 'basedata',
    menuloading: false,
@@ -177,6 +176,11 @@
    let param = {
      func: 'sPC_Get_LongParam',
      MenuID: MenuId
    }
    if (sessionStorage.getItem('appType') === 'pc') {
      param.TypeCharOne = sessionStorage.getItem('kei_no')
      param.Typename = 'pc'
    }
    Api.getSystemConfig(param).then(result => {
@@ -380,11 +384,18 @@
        LText: []
      }
      btnParam.LText = this.getMenuMessage()
      btnParam.LText = btnParam.LText.join(' union all ')
      btnParam.LText = Utils.formatOptions(btnParam.LText)
      btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp)
      if (sessionStorage.getItem('appType') === 'pc') {
        param.TypeCharOne = sessionStorage.getItem('kei_no')
        param.Typename = 'pc'
        btnParam.LText = ''
      } else {
        btnParam.LText = this.getMenuMessage()
        btnParam.LText = btnParam.LText.join(' union all ')
        btnParam.LText = Utils.formatOptions(btnParam.LText)
        btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
        btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp)
      }
      new Promise(resolve => {
        if (delButtons.length === 0) {
@@ -497,6 +508,8 @@
          error = `组件《${item.name}》未设置数据源!`
        } else if (item.setting.interType && !item.setting.primaryKey) {
          error = `组件《${item.name}》未设置主键!`
        } else if (!item.setting.supModule) {
          error = `组件《${item.name}》未设置上级组件!`
        }
      }
      if (item.type === 'bar' || item.type === 'line' || item.type === 'pie') {
@@ -554,11 +567,29 @@
    this.setState({config})
    window.GLOB.customMenu = config
    notification.success({
      top: 92,
      message: '粘贴成功!',
      duration: 2
    })
  }
  refreshConfig = () => {
    this.setState({
      delButtons: [],
      activeKey: 'basedata',
      menuloading: false,
      oriConfig: null,
      config: null,
    }, () => {
      this.getMenuParam()
    })
  }
  render () {
    const { btn } = this.props
    const { activeKey, MenuType, dict, config, menuloading, customComponents } = this.state
    const { activeKey, dict, config, menuloading, customComponents, MenuId } = this.state
    return (
      <div className="pc-poper-view">
@@ -576,10 +607,10 @@
                </Panel>
                {/* 组件添加 */}
                <Panel header={dict['mob.component']} key="component">
                  <SourceWrap MenuType={MenuType} />
                  <SourceWrap MenuType="" />
                </Panel>
                {customComponents && customComponents.length ? <Panel header="自定义组件" key="cuscomponent">
                  <SourceWrap components={customComponents} MenuType={MenuType} />
                  <SourceWrap components={customComponents} MenuType="" />
                </Panel> : null}
                <Panel header={'页面背景'} key="background">
                  {config ? <BgController config={config} updateConfig={this.updateConfig} /> : null}
@@ -594,9 +625,10 @@
                <div> {config && config.MenuName} </div>
              } bordered={false} extra={
                <div>
                  <Versions MenuId={MenuId} open_edition={config ? config.open_edition : ''} updateConfig={this.refreshConfig}/>
                  <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/>
                  <StyleCombControlButton menu={config} />
                  <PasteController type="menu" Tab={null} insert={this.insert} />
                  <PasteController insert={this.insert} />
                  {config ? <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config.enabled} onChange={this.onEnabledChange} /> : null}
                  <Button type="primary" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button>
                  <Button type="default" onClick={this.closeView}>{dict['mob.return']}</Button>