king
2020-04-09 b9a0e8541f0959db5d848f7b893c8838851ce411
src/tabviews/commontable/index.jsx
@@ -68,6 +68,7 @@
    tabParam: null,       // 表单标签参数
    refreshtabs: null,    // 需要刷新的标签集
    confirmLoading: false,// 自定义设置模态框加载中
    revertLoading: false, // 恢复默认设置
    settingVisible: false,// 自定义设置模态框
    triggerBtn: null,     // 点击表格中或快捷键触发的按钮
    tabActive: null       // 标签页展开控制
@@ -77,7 +78,7 @@
   * @description 获取页面配置信息
   */
  async loadconfig () {
    const { permAction, param } = this.props
    const { permAction, permMenus, param } = this.props
    let _param = {
      func: 'sPC_Get_LongParam',
@@ -234,12 +235,14 @@
      })
      // 生成显示列,处理合并列中的字段
      config.columns.forEach(col => {
      config.columns.forEach((col, index) => {
        if (_hideCol.includes(col.uuid)) return
        // if (col.linkThdMenu && !permAction[col.linkThdMenu.MenuID]) {
        //   col.linkThdMenu = ''
        // }
        if (col.linkThdMenu && !permMenus[col.linkThdMenu.MenuID]) {
          col.linkThdMenu = ''
        }
        col.sort = index
        if (col.type === 'colspan' && col.sublist) {
          let _col = JSON.parse(JSON.stringify(col))
@@ -263,15 +266,17 @@
        })
      }
      let valid = true // 搜索条件必填验证
      config.search.forEach(item => {
        if (item.type === 'text' && param && param.searchkey === item.field) {
          item.initval = param.searchval
      let valid = true // 搜索条件必填验证, 初始搜索条件
      let initSearch = config.search.map(item => {
        let _item = JSON.parse(JSON.stringify(item))
        if (_item.type === 'text' && param && param.searchkey === _item.field) {
          _item.initval = param.searchval
        }
        if (item.required === 'true' && !item.initval) {
        if (_item.required === 'true' && !_item.initval) {
          valid = false
        }
        return _item
      })
      if (_curUserConfig) {
@@ -299,7 +304,7 @@
        columns: _columns,
        logcolumns: _logcolumns,
        arr_field: _arrField.join(','),
        search: Utils.initMainSearch(config.search) // 搜索条件初始化(含有时间格式,需要转化)
        search: Utils.initMainSearch(initSearch) // 搜索条件初始化(含有时间格式,需要转化)
      }, () => {
        this.improveSearch()
        if (config.setting.onload !== 'false' && valid) { // 初始化可加载
@@ -1024,7 +1029,8 @@
  controlCustomSetting = () => {
    this.setState({
      settingVisible: true,
      confirmLoading: false
      confirmLoading: false,
      revertLoading: false
    })
  }
@@ -1058,6 +1064,37 @@
    }
    this.props.modifyTabview(tabs)
  }
  settingRevert = () => {
    let param = {
      func: 's_TrdMenu_UserParam_del',
      MenuID: this.props.MenuID
    }
    this.setState({
      revertLoading: true
    })
    Api.getSystemConfig(param).then(result => {
      if (!result.status) {
        this.setState({
          revertLoading: false
        })
        notification.warning({
          top: 92,
          message: result.message,
          duration: 10
        })
        return
      }
      this.setState({
        settingVisible: false,
        revertLoading: false
      }, () => {
        window.GLOB.CacheMap = new Map()
        this.reloadview()
      })
    })
  }
  settingSubmit = () => {
@@ -1303,9 +1340,12 @@
            maskClosable={false}
            width={950}
            visible={this.state.settingVisible}
            onOk={this.settingSubmit}
            onCancel={() => { this.setState({ settingVisible: false }) }}
            confirmLoading={this.state.confirmLoading}
            footer={[
              <Button key="revert" type="danger" loading={this.state.revertLoading} onClick={this.settingRevert}>{this.state.dict['main.revert.default']}</Button>,
              <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['main.cancel']}</Button>,
              <Button key="confirm" type="primary" loading={this.state.confirmLoading} onClick={this.settingSubmit}>{this.state.dict['main.confirm']}</Button>
            ]}
            destroyOnClose
          >
            {this.state.settingVisible ?
@@ -1334,6 +1374,7 @@
    tabviews: state.tabviews,
    refreshTab: state.refreshTab,
    permAction: state.permAction,
    permMenus: state.permMenus,
    permRoles: state.permRoles
  }
}