king
2020-02-22 592ff0aa0f2d45d143872b672a1468e268d3157f
src/templates/comtableconfig/index.jsx
@@ -40,6 +40,7 @@
class ComTableConfig extends Component {
  static propTpyes = {
    menu: PropTypes.any,
    optionLibs: PropTypes.any,
    supMenuList: PropTypes.array,
    reloadmenu: PropTypes.func,
    handleView: PropTypes.func
@@ -70,7 +71,8 @@
    funcLoading: false,      // 存储过程创建中
    showColumnName: false,   // 显示列字段名控制
    tabviews: [],            // 所有标签页
    profileVisible: false    // 验证信息模态框
    profileVisible: false,   // 验证信息模态框
    optionLibs: null         // 自定义下拉选项库
  }
  /**
@@ -79,7 +81,7 @@
   * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单
   */
  UNSAFE_componentWillMount () {
    const { menu } = this.props
    const { menu, optionLibs } = this.props
    let _LongParam = menu.LongParam
    let _config = ''
@@ -92,6 +94,21 @@
      _config.isAdd = true
    } else {
      _config = _LongParam
      _config.search.forEach(item => {
        if (
          (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') &&
          item.resourceType === '0' &&
          item.options && item.options.length > 0
        ) {
          optionLibs.set(item.uuid, {
            uuid: item.uuid,
            label: item.label,
            parname: menu.MenuName,
            type: 'search',
            options: item.options
          })
        }
      })
    }
    // 配置默认值,兼容
@@ -135,6 +152,7 @@
    this.setState({
      config: _config,
      optionLibs: optionLibs,
      originActions: _oriActions,
      originMenu: JSON.parse(JSON.stringify(menu)),
      selectedTables: _config.tables || [],
@@ -521,10 +539,24 @@
   */
  handleSubmit = () => {
    const { menu } = this.props
    const { config, card, modaltype } = this.state
    const { config, card, modaltype, optionLibs } = this.state
    if (modaltype === 'search') {
      this.searchFormRef.handleConfirm().then(res => {
        if ( // 更新下拉字典
          (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') &&
          res.resourceType === '0' &&
          res.options && res.options.length > 0
        ) {
          optionLibs.set(res.uuid, {
            uuid: res.uuid,
            label: res.label,
            parname: menu.MenuName,
            type: 'search',
            options: res.options
          })
        }
        let _search = config.search.map(item => {
          if (item.uuid === res.uuid) {
            return res
@@ -536,6 +568,7 @@
        this.setState({
          config: {...config, search: _search},
          optionLibs: optionLibs,
          modaltype: ''
        })
      })
@@ -1126,7 +1159,7 @@
        return
      }
      if (setting.dataresource.length > 50 && config.setting.dataresource !== setting.dataresource) {
      if (/[^\s]+\s+[^\s]+/ig.test(setting.dataresource) && config.setting.dataresource !== setting.dataresource) {
        let param = {
          func: 's_DataSrc_Save',
          LText: setting.dataresource,
@@ -2301,7 +2334,7 @@
      if (
        res.interType === 'inner' &&
        !res.innerFunc &&
        res.dataresource.length > 50 &&
        /[^\s]+\s+[^\s]+/ig.test(res.dataresource) &&
        config.setting.dataresource !== res.dataresource
      ) {
        let param = {
@@ -2329,7 +2362,7 @@
   */
  setSubConfig = (item, type) => {
    const { menu } = this.props
    const { config, originMenu } = this.state
    const { config, originMenu, optionLibs } = this.state
    if (!originMenu.MenuID) { // menuID不存在时,为新建菜单,提示菜单尚未保存
      notification.warning({
@@ -2381,6 +2414,7 @@
        }
        let param = {
          optionLibs: optionLibs,
          editMenu: _originMenu,
          editTab: !isbutton ? item : '',
          tabConfig: null,
@@ -2815,6 +2849,7 @@
          <SearchForm
            dict={this.state.dict}
            card={this.state.card}
            optionLibs={this.state.optionLibs}
            formlist={this.state.formlist}
            wrappedComponentRef={(inst) => this.searchFormRef = inst}
          />