king
2021-04-07 f3167f8371d19d0ea8fe7d0e7af5517ff0b08cd2
src/templates/comtableconfig/index.jsx
@@ -25,6 +25,7 @@
const { Panel } = Collapse
const { confirm } = Modal
const UrlFieldComponent = asyncComponent(() => import('@/menu/urlfieldcomponent'))
const EditComponent = asyncComponent(() => import('@/templates/zshare/editcomponent'))
const SettingComponent = asyncComponent(() => import('@/templates/sharecomponent/settingcomponent'))
const TableComponent = asyncComponent(() => import('@/templates/sharecomponent/tablecomponent'))
@@ -42,9 +43,8 @@
  }
  state = {
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    config: null,            // 页面配置
    tableFields: [],         // 已选的常用表
    formlist: null,          // 搜索条件、按钮、显示列表单字段
    menuloading: false,      // 菜单保存中
    menucloseloading: false, // 菜单关闭时,选择保存
@@ -101,17 +101,17 @@
          item.linkTab = ''
        }
        if (item.OpenType === 'pop') { // 含有子配置项的按钮(表单)
        if (item.OpenType === 'pop' || item.execMode === 'pop') { // 含有子配置项的按钮(表单)
          _oriActions.push({
            prebtn: fromJS(item).toJS(),
            curuuid: uuid,
            Template: 'Modal'
          })
        } else if (item.OpenType === 'tab' || item.OpenType === 'blank') { // 含有子配置项的按钮(标签后当前页打开)
        } else if (item.OpenType === 'tab' && item.tabTemplate === 'FormTab') { // 含有子配置项的按钮(标签页打开)
          _oriActions.push({
            prebtn: fromJS(item).toJS(),
            curuuid: uuid,
            Template: item.tabTemplate
            Template: 'FormTab'
          })
        }
@@ -616,6 +616,8 @@
        let curBtn = config.action.filter(cell => item.curuuid === cell.uuid)[0] // 查看初始化按钮是否存在
        if (!curBtn) return
        if (curBtn.OpenType !== item.prebtn.OpenType) return
        if (curBtn.OpenType === 'tab' && curBtn.tabTemplate !== 'FormTab') return
        if (curBtn.OpenType === 'funcbutton' && curBtn.execMode !== 'pop') return
        oriActions.push({
          prebtn: item.prebtn,
@@ -775,16 +777,6 @@
        duration: 5
      })
    } else {
      // 基本信息验证
      if (!config.fstMenuId || !config.ParentId || !config.MenuName || !config.MenuNo) {
        notification.warning({
          top: 92,
          message: this.state.dict['model.menu.basemsg'],
          duration: 5
        })
        this.setState({activeKey: '0'})
        return
      }
      if (!is(fromJS(originMenu), fromJS(config))) { // 菜单信息变化时,提示保存
        notification.warning({
          top: 92,
@@ -794,7 +786,7 @@
        return
      }
      let submenu = menu.fstMenuList.filter(item => item.MenuID === config.fstMenuId)[0]
      let submenu = menu.fstMenuList.filter(_menu => _menu.MenuID === config.fstMenuId)[0]
      let _Menu = {
        ...menu,
@@ -813,17 +805,17 @@
      let isbutton = true
      let _btnTab = null
      
      if (type === 'button' && item.OpenType === 'pop') {
        _view = 'Modal'             // 表单页面
      } else if (type === 'button' && (item.OpenType === 'tab' || item.OpenType === 'blank')) {
        _view = item.tabTemplate    // 新标签页模板
      if (type === 'button' && (item.OpenType === 'pop' || item.execMode === 'pop')) {
        _view = 'Modal'      // 表单页面
      } else if (type === 'button' && item.OpenType === 'tab') {
        _view = 'FormTab'    // 表单标签页模板
        _btnTab = item
      } else if (type === 'button' && item.OpenType === 'popview') {
        _view = item.tabType || 'SubTable' // 新弹窗标签模板 tabType 属性已去除
        _view = 'SubTable'   // 新弹窗标签模板 tabType 属性已去除
        uuid = item.linkTab
        isbutton = false
      } else if (type === 'tab') {
        _view = item.type           // 标签模板
        _view = 'SubTable'   // 标签模板
        uuid = item.linkTab
        isbutton = false
      }
@@ -1082,28 +1074,6 @@
  }
  
  /**
   * @description 更新常用表信息,快捷添加后更新配置信息
   */
  updatetable = (config, fields) => {
    const { tableFields } = this.state
    this.setState({
      config: config,
      tableFields: fields ? fields : tableFields
    })
  }
  /**
   * @description 更新标签配置信息
   */
  updatetabs = (config) => {
    this.setState({
      config: config
    })
  }
  /**
   * @description 更新配置信息
   */
  updateconfig = (config) => {
@@ -1116,7 +1086,7 @@
    const { menu } = this.props
    const { activeKey, config, chartview } = this.state
    const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview', 'blank'].includes(_action.OpenType) || (_action.OpenType === 'tab' && _action.tabTemplate === 'FormTab')))
    const confActions = config.action.filter(_action => !_action.origin && (['pop', 'popview'].includes(_action.OpenType) || (_action.OpenType === 'tab' && _action.tabTemplate === 'FormTab') || (_action.OpenType === 'funcbutton' && _action.execMode === 'pop')))
    let configTabs = []
    config.tabgroups.forEach(group => {
@@ -1138,11 +1108,15 @@
                  dict={this.state.dict}
                  updatemenu={this.updateconfig}
                />
                {config ? <UrlFieldComponent
                  config={config}
                  updateConfig={this.updateconfig}
                /> : null}
                {/* 表名添加 */}
                <TableComponent
                  config={config}
                  containerId="main-basedata"
                  updatetable={this.updatetable}
                  updatetable={this.updateconfig}
                />
              </Panel>
              {/* 搜索条件添加 */}
@@ -1153,7 +1127,6 @@
                <FieldsComponent
                  config={config}
                  type="search"
                  tableFields={this.state.tableFields}
                  updatefield={this.updateconfig}
                />
              </Panel>
@@ -1193,7 +1166,6 @@
                <FieldsComponent
                  config={config}
                  type="columns"
                  tableFields={this.state.tableFields}
                  updatefield={this.updateconfig}
                />
              </Panel>
@@ -1304,7 +1276,7 @@
                config={config}
                tabs={this.state.tabviews}
                setSubConfig={(item) => this.setSubConfig(item, 'tab')}
                updatetabs={this.updatetabs}
                updatetabs={this.updateconfig}
              />
            </Card>
          </div>