king
2023-03-20 5b75a82df7876f7c2c3e1f9da48752e2b2008ff8
src/views/menudesign/index.jsx
@@ -37,6 +37,7 @@
const PasteController = asyncComponent(() => import('@/menu/pastecontroller'))
const StyleController = asyncComponent(() => import('@/menu/stylecontroller'))
const ReplaceField = asyncComponent(() => import('@/menu/replaceField'))
const NormalCss = asyncComponent(() => import('@/menu/normalCss'))
const Versions = asyncComponent(() => import('@/menu/versions'))
const TableNodes = asyncComponent(() => import('@/menu/tablenodes'))
const SysInterface = asyncComponent(() => import('@/menu/sysinterface'))
@@ -64,7 +65,7 @@
    config: null,
    customComponents: [],
    comloading: false,
    settingshow: true,
    settingshow: sessionStorage.getItem('settingshow') !== 'false',
    eyeopen: false,
    view: '',
    popConfig: null,
@@ -84,7 +85,7 @@
      this.setState({
        MenuType: param.MenuType,
        MenuId: param.MenuId,
        MenuId: param.MenuId || param.MenuID,
        ParentId: param.ParentId || '',
        MenuName: param.MenuName || '',
        MenuNo: param.MenuNo || '',
@@ -165,6 +166,9 @@
        }
        let node = document.getElementById('save-modal-config')
        if (!node) {
          node = document.getElementById('save-pop-config')
        }
        if (!node) {
          node = document.getElementById('save-config')
        }
@@ -509,7 +513,7 @@
        })
      } else if (item.type === 'group') {
        item.components = this.collectTB(item.components, popBtns)
      } else if (item.type !== 'search') {
      } else {
        item.$tables = getTables(item, popBtns)
      }
@@ -582,6 +586,7 @@
    let popBtns = []
    config.components = this.collectTB(config.components, popBtns)
    config.version = 2.0
    if (popBtns.length === 0) {
      this.setState({
@@ -753,6 +758,35 @@
    return true
  }
  resetSyncQuery = (components) => {
    return components.map(item => {
      if (item.type === 'tabs') {
        item.subtabs.forEach(tab => {
          tab.components = this.resetSyncQuery(tab.components)
        })
      } else if (item.type === 'group') {
        item.components = this.resetSyncQuery(item.components)
      } else if (item.setting && item.setting.interType === 'system' && item.setting.sync === 'true') {
        let sql = ''
        if (item.setting.execute !== 'false' && item.setting.dataresource) {
          sql = item.setting.dataresource
        }
        item.scripts && item.scripts.forEach(script => {
          if (script.status === 'false') return
          sql += script.sql
        })
        if (sql.length > 8000) {
          item.setting.sync = 'false'
        }
      }
      return item
    })
  }
  submitConfig = () => {
    const { MenuType } = this.state
    let config = fromJS(this.state.config).toJS()
@@ -773,6 +807,10 @@
    setTimeout(() => {
      if (config.enabled && this.verifyConfig()) {
        config.enabled = false
      }
      if (config.cacheUseful !== 'true') {
        config.components = this.resetSyncQuery(config.components)
      }
      let tbs = []
@@ -843,7 +881,6 @@
      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 (MenuType === 'billPrint') { // 打印生成页面效果图
@@ -872,7 +909,7 @@
              } else {
                resolve(result)
              }
            })
            }, this.netError)
          })
        } else {
          resolve({status: true})
@@ -885,10 +922,7 @@
        if (!res || !res.status) return res
        if (MenuType !== 'billPrint') { // 基本信息改变时,通知菜单列表更新
          let ori = this.state.oriConfig
          if (config.MenuName !== ori.MenuName || config.MenuNo !== ori.MenuNo || config.parentId !== ori.parentId) {
            localStorage.setItem('menuUpdate', new Date().getTime())
          }
          localStorage.setItem('menuUpdate', new Date().getTime() + ',' + config.uuid)
        }
        config.open_edition = res.open_edition || ''
        this.setState({
@@ -908,7 +942,7 @@
          }
          return Api.getSystemConfig(_param)
        }
      }).then(res => { // 页面按钮关系保存
      }, this.netError).then(res => { // 页面按钮关系保存
        if (!res || !res.status) return res
        this.setState({
@@ -922,7 +956,7 @@
            status: true
          }
        }
      }).then(res => {
      }, this.netError).then(res => {
        this.setState({
          menuloading: false
        })
@@ -943,8 +977,21 @@
            duration: 5
          })
        }
      })
      }, this.netError)
    }, 300 + (+sessionStorage.getItem('mkDelay')))
  }
  netError = (error) => {
    this.setState({
      menuloading: false
    })
    if (!error) {
      notification.warning({
        top: 92,
        message: '保存失败,请检查网络是否正常。',
        duration: 5
      })
    }
  }
  getRoleFields = () => {
@@ -1037,12 +1084,14 @@
        carousel: '轮播',
        tree: '树形列表',
        chart: '自定义图表',
        editor: '富文本',
        group: '分组'
        // editor: '富文本',
        group: '分组',
        iframe: 'iframe'
      }
      let subforbid = {
        editable: '可编辑表格',
        voucher: '凭证'
        voucher: '凭证',
        account: '账套'
      }
      config.components.forEach(item => {
@@ -1102,6 +1151,7 @@
  changeSetting = () => {
    this.setState({settingshow: !this.state.settingshow})
    sessionStorage.setItem('settingshow', '' + !this.state.settingshow)
    setTimeout(() => {
      MKEmitter.emit('tabsChange', 'all')
@@ -1148,6 +1198,7 @@
                    {/* 表名添加 */}
                    {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null}
                    {config ? <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>菜单ID</Paragraph> : null}
                    {config ? <NormalCss config={config} updateConfig={this.updateConfig}/> : null}
                  </Panel>
                  {/* 组件添加 */}
                  <Panel header="组件" key="component">