king
2019-12-10 88f02c2c018fb1e5c171bd4975dac534c584c3ba
2019-12-10
20个文件已修改
1040 ■■■■■ 已修改文件
src/api/index.js 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/sidemenu/editthdmenu/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/locales/en-US/comtable.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/locales/zh-CN/comtable.js 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/commontable/index.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/actionform/index.jsx 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/columnform/index.jsx 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/dragelement/index.jsx 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/gridbtnform/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/index.jsx 299 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/index.scss 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/source.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/dragelement/card.jsx 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/dragelement/index.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/groupform/index.jsx 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/index.jsx 310 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/index.scss 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/modalform/index.jsx 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/modalform/index.scss 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/source.jsx 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/index.js
@@ -22,17 +22,19 @@
  return Promise.reject(error)
})
// const setCurrentUrl = () => {
//   if (!!(window.history && window.history.pushState)) {
//     window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login')
//     window.location.reload()
//   }
// }
const setCurrentUrl = () => {
  if (!!(window.history && window.history.pushState)) {
    window.history.replaceState(null, null, window.location.href.split('#')[0] + '#/login')
    window.location.reload()
  }
}
let GlobMap = new Map()
axios.interceptors.response.use((response) => {
  if (response.data.ErrCode === 'LoginError') {
    // setCurrentUrl()
    return Promise.resolve(response.data)
    setCurrentUrl()
    // return Promise.resolve(response.data)
  } else {
    return Promise.resolve(response.data)
  }
@@ -127,10 +129,29 @@
    if (window.GLOB.mainSystemApi) {
      param.rduri = window.GLOB.mainSystemApi
    }
    return axios({
      url: '/webapi/dostar',
      data: param
    })
    if (param.isCache) { // 数据需要缓存时
      delete param.isCache
      if (GlobMap.has(param)) {
        return Promise.resolve(GlobMap.get(param))
      } else {
        return new Promise(resolve => {
          axios({
            url: '/webapi/dostar',
            data: param
          }).then(res => {
            console.log(res)
            GlobMap.set(param, res)
            resolve(res)
          })
        })
      }
    } else {
      return axios({
        url: '/webapi/dostar',
        data: param
      })
    }
  }
  /**
src/components/sidemenu/editthdmenu/index.jsx
@@ -383,7 +383,7 @@
  handleSubConfig = (item, originMenu, config) => {
    if (item.OpenType === 'pop') {
      item.pageParam = ''
      if (config && config.type === 'modal') {
      if (config && config.type === 'Modal') {
        item.pageParam = config
      }
src/locales/en-US/comtable.js
@@ -66,6 +66,7 @@
  'header.form.pageTemplate': '页面模板',
  'header.form.type': 'Type',
  'header.form.text': 'Text',
  'header.form.textarea': '多行文本',
  'header.form.picture': '图片',
  'header.form.number': '数字',
  'header.form.colspan': '合并列',
@@ -78,6 +79,11 @@
  'header.form.dateyear': '日期(年)',
  'header.form.daterange': '日期(区间)',
  'header.form.initval': 'Initial Value',
  'header.form.decimal': '小数位',
  'header.form.format': '格式化',
  'header.form.empty': '空',
  'header.form.thdSeparator': '千分位',
  'header.form.prefix': '前置符',
  'header.form.isRequired': '行设置',
  'header.form.notRequired': '不选择行',
  'header.form.requiredSgl': '选择单行',
@@ -112,12 +118,19 @@
  'header.form.resourceType': '选项来源',
  'header.form.custom': '自定义',
  'header.form.datasource': '数据源',
  'header.form.datasource.actionhelp': '使用系统函数时,请填写数据源。',
  'header.form.actionhelp.datasource': '使用系统函数时,请填写数据源。',
  'header.form.actionhelp.sqlType': '使用系统函数时,请选择类型。',
  'header.form.action.type': '操作类型',
  'header.form.action.insert': '添加',
  'header.form.action.update': '修改',
  'header.form.action.LogicDelete': '逻辑删除',
  'header.form.action.delete': '物理删除',
  'header.form.valueField': '值·字段',
  'header.form.valueText': '文本·字段',
  'header.form.orderBy': '排序·字段',
  'header.form.orderType': '排序方式',
  'header.form.match': '匹配模式',
  'header.form.matchVal': '匹配值',
  'header.form.asc': '正序',
  'header.form.desc': '倒序',
  'header.form.linkField': '关联字段',
@@ -125,11 +138,13 @@
  'header.form.dropdown': '下拉菜单',
  'header.form.button': '按钮',
  'header.form.style': '风格',
  'header.form.color': '颜色',
  'header.form.order': '排列',
  'header.form.horizontal': '水平',
  'header.form.vertical': '垂直',
  'header.form.selectItem.error': '下拉选项设置错误!',
  'header.form.request.method': '请求方式',
  'header.form.readonly': '是否只读',
  'form.required.input': 'Please enter the ',
  'form.required.select': '请选择'
}
src/locales/zh-CN/comtable.js
@@ -66,6 +66,7 @@
  'header.form.pageTemplate': '页面模板',
  'header.form.type': '类型',
  'header.form.text': '文本',
  'header.form.textarea': '多行文本',
  'header.form.picture': '图片',
  'header.form.number': '数字',
  'header.form.colspan': '合并列',
@@ -78,6 +79,11 @@
  'header.form.dateyear': '日期(年)',
  'header.form.daterange': '日期(区间)',
  'header.form.initval': '初始值',
  'header.form.decimal': '小数位',
  'header.form.format': '格式化',
  'header.form.empty': '空',
  'header.form.thdSeparator': '千分位',
  'header.form.prefix': '前置符',
  'header.form.isRequired': '行设置',
  'header.form.notRequired': '不选择行',
  'header.form.requiredSgl': '选择单行',
@@ -112,12 +118,19 @@
  'header.form.resourceType': '选项来源',
  'header.form.custom': '自定义',
  'header.form.datasource': '数据源',
  'header.form.datasource.actionhelp': '使用系统函数时,请填写数据源。',
  'header.form.actionhelp.datasource': '使用系统函数时,请填写数据源。',
  'header.form.actionhelp.sqlType': '使用系统函数时,请选择类型。',
  'header.form.action.type': '操作类型',
  'header.form.action.insert': '添加',
  'header.form.action.update': '修改',
  'header.form.action.LogicDelete': '逻辑删除',
  'header.form.action.delete': '物理删除',
  'header.form.valueField': '值·字段',
  'header.form.valueText': '文本·字段',
  'header.form.orderBy': '排序·字段',
  'header.form.orderType': '排序方式',
  'header.form.match': '匹配模式',
  'header.form.matchVal': '匹配值',
  'header.form.asc': '正序',
  'header.form.desc': '倒序',
  'header.form.linkField': '关联字段',
@@ -125,11 +138,13 @@
  'header.form.dropdown': '下拉菜单',
  'header.form.button': '按钮',
  'header.form.style': '风格',
  'header.form.color': '颜色',
  'header.form.order': '排列',
  'header.form.horizontal': '水平',
  'header.form.vertical': '垂直',
  'header.form.selectItem.error': '下拉选项设置错误!',
  'header.form.request.method': '请求方式',
  'header.form.readonly': '是否只读',
  'form.required.input': '请输入',
  'form.required.select': '请选择'
}
src/tabviews/commontable/index.jsx
@@ -45,7 +45,8 @@
    // 获取主菜单
    let param = {
      func: 'sPC_Get_LongParam',
      MenuID: this.props.MenuID
      MenuID: this.props.MenuID,
      isCache: true
    }
    let result = await Api.getSystemConfig(param)
    if (result.status && result.LongParam) {
src/templates/comtableconfig/actionform/index.jsx
@@ -111,13 +111,13 @@
      if (_intertype === 'outer') {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method']
      } else {
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql']
        _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType']
      }
    } else {
      if (_intertype === 'outer') {
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'method']
      } else {
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql']
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType']
      }
    }
    this.setState({
@@ -158,11 +158,11 @@
        if (this.state.interType === 'outer') {
          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'execSuccess', 'execError', 'method']
        } else {
          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql']
          _options = ['label', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType']
        }
      } else {
        if (this.state.interType === 'inner') {
          _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql']
          _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType']
        } else {
          _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method']
        }
@@ -240,7 +240,7 @@
    if (key === 'intertype') {
      let _options = null
      if (value === 'inner') {
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql']
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType']
      } else {
        _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'interface', 'outerFunc', 'callbackFunc', 'method']
      }
@@ -261,9 +261,13 @@
      if (item.hidden) return
      if (item.type === 'text') { // 文本搜索
        let help = ''
        if (item.key === 'sql') {
          help = this.props.dict['header.form.actionhelp.datasource']
        }
        fields.push(
          <Col span={12} key={index}>
            <Form.Item label={item.label}>
            <Form.Item label={item.label} help={help}>
              {getFieldDecorator(item.key, {
                initialValue: item.initVal || '',
                rules: [
@@ -277,9 +281,13 @@
          </Col>
        )
      } else if (item.type === 'select') { // 下拉搜索
        let help = ''
        if (item.key === 'sqlType') {
          help = this.props.dict['header.form.actionhelp.sqlType']
        }
        fields.push(
          <Col span={12} key={index}>
            <Form.Item label={item.label}>
            <Form.Item label={item.label} help={help}>
              {getFieldDecorator(item.key, {
                initialValue: item.initVal || '',
                rules: [
@@ -334,7 +342,7 @@
      } else if (item.type === 'textarea') {
        fields.push(
          <Col span={24} key={index}>
            <Form.Item label={item.label} help={this.props.dict['header.form.datasource.actionhelp']} className="textarea">
            <Form.Item label={item.label} className="textarea">
              {getFieldDecorator(item.key, {
                initialValue: item.initVal
              })(<TextArea rows={4} />)}
@@ -362,7 +370,7 @@
          if (values.innerFunc === '' && values.sql === '') {
            notification.warning({
              top: 92,
              message: this.props.dict['header.form.datasource.actionhelp'],
              message: this.props.dict['header.form.actionhelp.datasource'],
              duration: 10
            })
          } else {
src/templates/comtableconfig/columnform/index.jsx
@@ -11,13 +11,77 @@
  }
  state = {
    formlist: null
  }
  UNSAFE_componentWillMount () {
    let _type = this.props.formlist.filter(form => form.key === 'type')[0].initVal
    let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width']
    if (_type === 'text') {
      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color']
    } else if (_type === 'number') {
      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'match', 'matchVal', 'color']
    } else if (_type === 'textarea') {
      _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color']
    }
    this.setState({
      formlist: this.props.formlist.map(item => {
        item.hidden = !_options.includes(item.key)
        if (item.key === 'matchVal' && (_type === 'text' || _type === 'textarea')) {
          item.type = 'text'
        } else if (item.key === 'matchVal' && _type === 'number') {
          item.type = 'number'
        }
        return item
      })
    })
  }
  typeChange = (key, value) => {
    if (key === 'type') {
      let _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width']
      if (value === 'text') {
        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color']
      } else if (value === 'number') {
        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'match', 'matchVal', 'color']
      } else if (value === 'textarea') {
        _options = ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'matchVal', 'color']
      }
      this.setState({
        formlist: this.props.formlist.map(item => {
          item.hidden = !_options.includes(item.key)
          if (item.key === 'matchVal' && (value === 'text' || value === 'textarea')) {
            item.type = 'text'
          } else if (item.key === 'matchVal' && value === 'number') {
            item.type = 'number'
            item.initVal = ''
            item.hidden = true
          }
          return item
        })
      }, () => {
        this.setState({
          formlist: this.props.formlist.map(item => {
            if (item.key === 'matchVal' && value === 'number') {
              item.hidden = false
            }
            return item
          })
        })
      })
    }
  }
  getFields() {
    const { getFieldDecorator } = this.props.form
    const fields = []
    this.props.formlist.forEach((item, index) => {
    this.state.formlist.forEach((item, index) => {
      if (item.hidden) return
      if (item.type === 'text') { // 文本搜索
        fields.push(
          <Col span={12} key={index}>
@@ -39,14 +103,14 @@
          <Col span={12} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.key, {
                initialValue: item.initVal || '',
                initialValue: item.initVal,
                rules: [
                  {
                    required: !!item.required,
                    message: this.props.dict['form.required.input'] + item.label + '!'
                  }
                ]
              })(<InputNumber min={1} max={1000} precision={item.decimal} />)}
              })(<InputNumber min={item.min} max={item.max} precision={item.decimal} />)}
            </Form.Item>
          </Col>
        )
@@ -66,6 +130,7 @@
                <Select
                  showSearch
                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  onChange={(value) => {this.typeChange(item.key, value)}}
                  getPopupContainer={() => document.getElementById('columnwinter')}
                >
                  {item.options.map(option =>
src/templates/comtableconfig/dragelement/index.jsx
@@ -14,7 +14,8 @@
    const { card, index } = findCard(id)
    const _cards = update(cards, { $splice: [[index, 1], [atIndex, 0, card]] })
    setCards(_cards)
    handleList({[type]: _cards})
    handleList(type, _cards)
    // handleList({[type]: _cards})
  }
  const findCard = id => {
@@ -40,15 +41,6 @@
    let copycard = JSON.parse(JSON.stringify(card))
    copycard.uuid = Utils.getuuid()
    copycard.origin = false
    // let names = cards.map(car => { return car.label })
    // let index = 1
    // let origin = copycard.label.split('(copy')[0] || 'button'
    // let label = origin + '(copy)'
    // while (names.includes(label)) {
    //   label = origin + `(copy${index})`
    //   index++
    // }
    copycard.label = copycard.label + '(copy)'
    
    let indexes = cards.map(car => { return car.id })
@@ -57,12 +49,6 @@
      newid++
    }
    copycard.id = newid
    // const { index: overIndex } = findCard(`${card.id}`)
    // const _cards = update(cards, { $splice: [[overIndex + 1, 0, copycard]] })
    // setCards(_cards)
    // handleList({action: _cards})
    copyElement(copycard)
  }
@@ -110,6 +96,7 @@
        newcard.innerFunc = ''
        newcard.outerFunc = ''
        newcard.sql = ''
        newcard.sqlType = ''
        newcard.Ot = 'requiredSgl'
        newcard.OpenType = item.subType
        newcard.icon = ''
@@ -161,7 +148,7 @@
      const _cards = update(cards, { $splice: [[targetIndex, 0, newcard]] })
      setCards(_cards)
      handleList({[type]: _cards})
      handleList(type, _cards, newcard)
      target = null
    }
  })
src/templates/comtableconfig/gridbtnform/index.jsx
@@ -46,7 +46,7 @@
      {
        type: 'select',
        key: 'style',
        label: this.props.dict['header.form.align'],
        label: this.props.dict['header.form.style'],
        initVal: this.props.card.style,
        required: true,
        options: [{
src/templates/comtableconfig/index.jsx
@@ -3,7 +3,7 @@
import { is, fromJS } from 'immutable'
import { DndProvider } from 'react-dnd'
import HTML5Backend from 'react-dnd-html5-backend'
import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty } from 'antd'
import { Button, Card, Modal, Collapse, notification, Spin, Select, List, Icon, Empty, Switch } from 'antd'
import moment from 'moment'
import DragElement from './dragelement'
import SourceElement from './dragelement/source'
@@ -37,28 +37,29 @@
  }
  state = {
    operaType: '', // 操作类型,新建或编辑
    dict: CommonDict, // 字典
    config: null, // 页面配置
    visible: false, // 搜索条件、按钮、显示列,模态框显示控制
    tableVisible: false, // 数据表字段模态框
    addType: '', // 添加类型-搜索条件或显示列
    tableColumns: [], // 表格显示列
    fields: null, // 搜索条件及显示列,可选字段
    menuformlist: null, // 基本信息表单字段
    formlist: null, // 搜索条件、按钮、显示列表单字段
    formtemp: '', // 表单类型,显示列、按钮、搜索条件
    card: null, // 编辑元素
    searchloading: false, // 搜索条件加载中
    actionloading: false, // 按钮加载中
    columnsloading: false, // 显示列加载中
    menuloading: false, // 菜单保存中
    loading: false, // 加载中,页面spin
    settingVisible: false, // 全局配置模态框
    closeVisible: false, // 关闭模态框
    tables: [], // 可用表名
    selectedTables: [], // 已选表名
    originMenu: null, // 原始菜单
    operaType: '',           // 操作类型,新建或编辑
    dict: CommonDict,        // 字典
    config: null,            // 页面配置
    visible: false,          // 搜索条件、按钮、显示列,模态框显示控制
    tableVisible: false,     // 数据表字段模态框
    addType: '',             // 添加类型-搜索条件或显示列
    tableColumns: [],        // 表格显示列
    fields: null,            // 搜索条件及显示列,可选字段
    menuformlist: null,      // 基本信息表单字段
    formlist: null,          // 搜索条件、按钮、显示列表单字段
    formtemp: '',            // 表单类型,显示列、按钮、搜索条件
    card: null,              // 编辑元素
    searchloading: false,    // 搜索条件加载中
    actionloading: false,    // 按钮加载中
    columnsloading: false,   // 显示列加载中
    menuloading: false,      // 菜单保存中
    menucloseloading: false, // 菜单关闭时,选择保存
    loading: false,          // 加载中,页面spin
    settingVisible: false,   // 全局配置模态框
    closeVisible: false,     // 关闭模态框
    tables: [],              // 可用表名
    selectedTables: [],      // 已选表名
    originMenu: null,        // 原始菜单
    originActions: null
  }
@@ -95,7 +96,7 @@
      originActions: _oriActions,
      config: _config,
      operaType: _type,
      originMenu: JSON.parse(JSON.stringify({...menu})),
      originMenu: JSON.parse(JSON.stringify(menu)),
      selectedTables: _config.tables || [],
      menuformlist: [
        {
@@ -240,29 +241,31 @@
    })
  }
  handleList = (listObj) => {
    let config = this.state.config
    if (this.state.operaType === 'add') {
      let key = Object.keys(listObj)[0]
      let newlength = listObj[key].length
      if (newlength > config[key].length) {
        listObj[key] = listObj[key].filter(item => !item.origin)
      }
      if (newlength > listObj[key].length) {
  handleList = (type, list, card) => {
    const { config } = this.state
    if (list.length > config[type].length) {
      list = list.filter(item => !item.origin)
      this.setState({
        [type + 'loading']: true,
        config: {...config, [type]: list }
      }, () => {
        // 刷新对应的配置信息
        this.setState({
          [key + 'loading']: true,
          config: {...config, ...listObj}
        }, () => {
          // 刷新对应的配置信息
          this.setState({
            [key + 'loading']: false
          })
          [type + 'loading']: false
        })
      } else {
        this.setState({config: {...config, ...listObj}})
      }
        if (type === 'search') {
          this.handleSearch(card)
        } else if (type === 'action') {
          this.handleAction(card)
        } else if (type === 'columns') {
          this.handleColumn(card)
        }
      })
    } else {
      this.setState({config: {...config, ...listObj}})
      this.setState({config: {...config, [type]: list}})
    }
  }
@@ -622,20 +625,20 @@
            text: this.state.dict['header.form.refresh.view']
          }]
        },
        {
          type: 'select',
          key: 'method',
          label: this.state.dict['header.form.request.method'],
          initVal: card.method || 'POST',
          required: true,
          options: [{
            MenuID: 'POST',
            text: 'POST'
          }, {
            MenuID: 'GET',
            text: 'GET'
          }]
        },
        // {
        //   type: 'select',
        //   key: 'method',
        //   label: this.state.dict['header.form.request.method'],
        //   initVal: card.method || 'POST',
        //   required: true,
        //   options: [{
        //     MenuID: 'POST',
        //     text: 'POST'
        //   }, {
        //     MenuID: 'GET',
        //     text: 'GET'
        //   }]
        // },
        {
          type: 'select',
          key: 'icon',
@@ -653,11 +656,31 @@
          options: []
        },
        {
          type: 'textarea',
          type: 'text',
          key: 'sql',
          label: this.state.dict['header.form.datasource'],
          initVal: card.sql || '',
          initVal: card.sql || this.state.config.setting.tableName || '',
          required: false
        },
        {
          type: 'select',
          key: 'sqlType',
          label: this.state.dict['header.form.action.type'],
          initVal: card.sqlType || 'insert',
          required: false,
          options: [{
            MenuID: 'insert',
            text: this.state.dict['header.form.action.insert']
          }, {
            MenuID: 'update',
            text: this.state.dict['header.form.action.update']
          }, {
            MenuID: 'LogicDelete',
            text: this.state.dict['header.form.action.LogicDelete']
          }, {
            MenuID: 'delete',
            text: this.state.dict['header.form.action.delete']
          }]
        }
      ]
    })
@@ -697,6 +720,12 @@
            }, {
              MenuID: 'picture',
              text: this.state.dict['header.form.picture']
            }, {
              MenuID: 'number',
              text: this.state.dict['header.form.number']
            }, {
              MenuID: 'textarea',
              text: this.state.dict['header.form.textarea']
            }]
          },
          {
@@ -731,7 +760,7 @@
            }]
          },
          {
            type: 'select',
            type: 'radio',
            key: 'IsSort',
            label: this.state.dict['header.form.IsSort'],
            initVal: card.IsSort,
@@ -747,10 +776,110 @@
          {
            type: 'number',
            key: 'Width',
            min: 1,
            max: 1000,
            decimal: 0,
            label: this.state.dict['header.form.columnWidth'],
            initVal: card.Width,
            required: true
          },
          {
            type: 'number',
            key: 'decimal',
            min: 0,
            max: 18,
            decimal: 0,
            label: this.state.dict['header.form.decimal'],
            initVal: card.decimal,
            required: false
          },
          {
            type: 'select',
            key: 'format',
            label: this.state.dict['header.form.format'],
            initVal: card.format || '',
            options: [{
              MenuID: '',
              text: this.state.dict['header.form.empty']
            }, {
              MenuID: 'thdSeparator',
              text: this.state.dict['header.form.thdSeparator']
            }],
            required: false
          },
          {
            type: 'text',
            key: 'prefix',
            label: this.state.dict['header.form.prefix'],
            initVal: card.prefix || '',
            required: false,
            readonly: false
          },
          {
            type: 'select',
            key: 'match',
            label: this.state.dict['header.form.match'],
            initVal: card.match || '',
            options: [{
              MenuID: '',
              text: this.state.dict['header.form.empty']
            }, {
              MenuID: '>',
              text: '>'
            }, {
              MenuID: '<',
              text: '<'
            }, {
              MenuID: '>=',
              text: '>='
            }, {
              MenuID: '<=',
              text: '<='
            }, {
              MenuID: 'between',
              text: 'between'
            }],
            required: false
          },
          {
            type: 'text',
            key: 'matchVal',
            min: -Infinity,
            max: Infinity,
            decimal: 0,
            label: this.state.dict['header.form.matchVal'],
            initVal: card.matchVal || '',
            required: false,
            readonly: false
          },
          {
            type: 'select',
            key: 'color',
            label: this.state.dict['header.form.color'],
            initVal: card.color || '',
            options: [{
              MenuID: '',
              text: this.state.dict['header.form.empty']
            }, {
              MenuID: 'red',
              text: '红色(内容)'
            }, {
              MenuID: 'redbg',
              text: '红色(背景)'
            }, {
              MenuID: 'orange',
              text: '橙色(内容)'
            }, {
              MenuID: 'orangebg',
              text: '橙色(背景)'
            }, {
              MenuID: 'green',
              text: '绿色(内容)'
            }, {
              MenuID: 'greenbg',
              text: '绿色(背景)'
            }],
            required: false
          }
        ]
      })
@@ -981,9 +1110,15 @@
          LongParam: _LongParam
        }
        
        this.setState({
          menuloading: true
        })
        if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态
          this.setState({
            menucloseloading: true
          })
        } else {
          this.setState({
            menuloading: true
          })
        }
        Api.getSystemConfig(param).then(response => {
          if (response.status) {
@@ -1001,7 +1136,8 @@
            this.submitAction(btnParam)
          } else {
            this.setState({
              menuloading: false
              menuloading: false,
              menucloseloading: false
            })
            notification.warning({
              top: 92,
@@ -1021,9 +1157,16 @@
          PageParam: JSON.stringify(_pageParam),
          LongParam: _LongParam
        }
        this.setState({
          menuloading: true
        })
        if (this.state.closeVisible) { // 显示关闭对话框时,模态框中保存按钮,显示保存中状态
          this.setState({
            menucloseloading: true
          })
        } else {
          this.setState({
            menuloading: true
          })
        }
        Api.getSystemConfig(param).then(response => {
          if (response.status) {
@@ -1040,7 +1183,8 @@
            this.submitAction(btnParam)
          } else {
            this.setState({
              menuloading: false
              menuloading: false,
              menucloseloading: false
            })
            notification.warning({
              top: 92,
@@ -1074,12 +1218,14 @@
          this.props.handleConfig('')
        } else {
          this.setState({
            menuloading: false
            menuloading: false,
            menucloseloading: false
          })
        }
      } else {
        this.setState({
          menuloading: false
          menuloading: false,
          menucloseloading: false
        })
        notification.warning({
          top: 92,
@@ -1499,6 +1645,14 @@
    }
  }
  onEnabledChange = () => {
    const { config } = this.state
    this.setState({
      config: {...config, enabled: !config.enabled}
    })
  }
  render () {
    const configAction = this.state.config.action.filter(_action =>
      !_action.origin && (_action.OpenType === 'pop' || _action.OpenType === 'popview' || _action.OpenType === 'blank' || _action.OpenType === 'tab')
@@ -1598,6 +1752,7 @@
          <div className="setting">
            <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={
              <div>
                <Switch className="big" checkedChildren="启" unCheckedChildren="关" defaultChecked={this.state.config.enabled} onChange={this.onEnabledChange} />
                <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button>
                <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button>
                <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button>
@@ -1745,7 +1900,7 @@
          visible={this.state.closeVisible}
          onCancel={() => { this.setState({closeVisible: false}) }}
          footer={[
            <Button key="save" className="mk-btn mk-green" onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>,
            <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>,
            <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig('')}}>{this.state.dict['header.notsave']}</Button>,
            <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button>
          ]}
src/templates/comtableconfig/index.scss
@@ -124,6 +124,19 @@
    height: 100%;
    overflow-y: hidden;
    background: #ffffff;
    .ant-switch.big {
      min-width: 60px;
      height: 28px;
      line-height: 28px;
      margin-top: -2px;
      .ant-switch-inner {
        font-size: 14px;
      }
    }
    .ant-switch.big::after {
      width: 24px;
      height: 24px;
    }
    .ant-card-head {
      min-height: 44px;
    }
src/templates/comtableconfig/source.jsx
@@ -7,6 +7,7 @@
class CommonTableBaseData {
  baseConfig = {
    type: 'system',
    enabled: false,
    setting: {
      actionfixed: false,
      columnfixed: false,
@@ -89,6 +90,7 @@
        method: 'POST',
        outerFunc: '',
        sql: '',
        sqlType: '',
        callbackFunc: '',
        Ot: 'notRequired',
        position: 'toolbar',
@@ -110,6 +112,7 @@
        method: 'POST',
        outerFunc: '',
        sql: '',
        sqlType: '',
        callbackFunc: '',
        Ot: 'requiredSgl',
        position: 'grid',
@@ -131,6 +134,7 @@
        method: 'POST',
        outerFunc: '',
        sql: '',
        sqlType: '',
        callbackFunc: '',
        Ot: 'required',
        position: 'toolbar',
@@ -152,6 +156,7 @@
        method: 'POST',
        outerFunc: '',
        sql: '',
        sqlType: '',
        callbackFunc: '',
        Ot: 'requiredOnce',
        position: 'toolbar',
src/templates/modalconfig/dragelement/card.jsx
@@ -1,6 +1,6 @@
import React from 'react'
import { useDrag, useDrop } from 'react-dnd'
import { Icon, Select, DatePicker, Input } from 'antd'
import { Icon, Select, DatePicker, Input, InputNumber } from 'antd'
import moment from 'moment'
import ItemTypes from './itemtypes'
import './index.scss'
@@ -26,10 +26,7 @@
    hover({ id: draggedId }) {
      if (!draggedId) return
      if (draggedId !== id) {
        console.log(id)
        const { index: overIndex } = findCard(id)
        console.log(overIndex)
        console.log(draggedId)
        moveCard(draggedId, overIndex)
      }
    },
@@ -44,6 +41,20 @@
    closeCard(id)
  }
  let selectval = ''
  if (card.type === 'select' || card.type === 'link') {
    if (card.initval) {
      let _option = card.options.filter(option => option.Value === card.initval)[0]
      if (_option) {
        selectval = _option.Text || ''
      } else {
        selectval = ''
      }
    } else if (card.setAll === 'true') {
      selectval = '全部'
    }
  }
  return (
    <div className="page-card" style={{ opacity: opacity}}>
      <div ref={node => drag(drop(node))}>
@@ -56,19 +67,20 @@
              <Input style={{marginTop: '4px'}} defaultValue={card.initval} />
            }
            {card.type === 'number' &&
              <Input style={{marginTop: '4px'}} defaultValue={card.initval} />
              <InputNumber defaultValue={card.initval} precision={card.decimal} />
            }
            {(card.type === 'select' || card.type === 'link') &&
              <Select defaultValue={card.initval}></Select>
              <Select defaultValue={selectval}></Select>
            }
            {card.type === 'date' &&
              <DatePicker defaultValue={card.initval ? moment(card.initval, 'YYYY-MM-DD') : null} />
              <DatePicker defaultValue={card.initval ? moment().subtract(card.initval, 'days') : null} />
            }
            {card.type === 'datemonth' ?
              <MonthPicker defaultValue={card.initval ? moment().subtract(card.initval, 'month') : null} /> : null
            }
            {card.type === 'datetime' &&
              <DatePicker showTime defaultValue={card.initval ? moment(card.initval, 'YYYY-MM-DD HH:mm:ss') : null} />
              <DatePicker showTime defaultValue={card.initval ? moment().subtract(card.initval, 'days') : null} />
              // <DatePicker showTime defaultValue={card.initval ? moment(card.initval, 'YYYY-MM-DD HH:mm:ss') : null} />
            }
            <div className="input-mask"></div>
          </div>
src/templates/modalconfig/dragelement/index.jsx
@@ -76,6 +76,7 @@
      newcard.valueText = ''
      newcard.orderBy = ''
      newcard.orderType = 'asc'
      newcard.readonly = 'false'
      
      // let indexes = cards.map(car => {return car.id})
      // let newid = 0
@@ -102,9 +103,9 @@
      setCards(_cards)
      if (!group) {
        handleList(_cards)
        handleList(_cards, null, null, newcard)
      } else {
        handleList(_cards, group)
        handleList(_cards, group, null, newcard)
      }
      target = null
src/templates/modalconfig/groupform/index.jsx
@@ -2,6 +2,7 @@
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, InputNumber } from 'antd'
import TransferForm from '../transferform'
import Utils from '@/utils/utils.js'
import './index.scss'
class SettingForm extends Component {
@@ -24,7 +25,17 @@
    let _default = config.groups[config.groups.length - 1]
    let _selectds = []
    if (config.groups.length === 1) {
    if (!_default) {
      _default = {
        label: '未分组',
        default: true,
        sort: 101,
        uuid: Utils.getuuid(),
        sublist: []
      }
    }
    if (config.groups.length === 0) {
      _source = config.fields.filter(item => !item.origin)
    } else {
      _source = [..._default.sublist, ...group.sublist]
src/templates/modalconfig/index.jsx
@@ -43,11 +43,12 @@
    card: null,            // 编辑元素
    loading: false,        // 表单刷新时使用
    menuloading: false,    // 菜单保存中
    closeloading: false,   // 菜单保存中
    settingVisible: false, // 全局配置模态框
    closeVisible: false,   // 关闭模态框
    tables: [],            // 可用表名
    selectedTables: [],    // 已选表名
    originMenu: null,      // 原始菜单
    originConfig: null,      // 原始菜单
    groupVisible: false,   // 全局配置模态框
    curgroup: null         // 当前组,新建或编辑
  }
@@ -63,6 +64,7 @@
    const {menu, editAction} = this.props
    let _config = ''
    if (editAction.pageParam) {
      _config = editAction.pageParam
    } else {
@@ -76,6 +78,7 @@
    this.setState({
      config: _config,
      selectedTables: _config.tables || [],
      originConfig: JSON.parse(JSON.stringify(_config)),
      modalformlist: [
        {
          type: 'text',
@@ -191,11 +194,13 @@
   * @description 表单变化
   * 1、表单拖拽添加时,检查是否存在示例表单,如存在则去除示例
   * 2、表单移动后,保存移动后的顺序
   * 3、新增表单时,直接打开编辑框
   */
  handleList = (list, group, elementId) => {
  handleList = (list, group, elementId, newcard) => {
    let _config = JSON.parse(JSON.stringify(this.state.config))
    if (!group && !elementId) {
      // 没有分组时(拖拽添加)
      if (list.length > _config.fields.length) {
        _config.fields = list.filter(item => !item.origin)
  
@@ -206,12 +211,14 @@
          this.setState({
            loading: false
          })
          this.handleForm(newcard)
        })
      } else {
        _config.fields = list
        this.setState({config: _config})
      }
    } else if (group && !elementId) {
      // 存在分组时,拖拽添加
      if (list.length > group.sublist.length) {
        group.sublist = list
        _config.groups = _config.groups.map(item => {
@@ -229,6 +236,7 @@
          this.setState({
            loading: false
          })
          this.handleForm(newcard)
        })
      } else {
        group.sublist = list
@@ -242,6 +250,7 @@
        this.setState({config: _config})
      }
    } else if (group && elementId) {
      // 修改已有元素的分组
      let element = null
      _config.groups.forEach(item => {
        item.sublist = item.sublist.filter(cell => {
@@ -277,9 +286,9 @@
  /**
   * @description 表单编辑
   * 1、显示编辑弹窗
   * 2、保存编辑项
   * 3、设置编辑参数项
   * 1、显示编辑弹窗-visible
   * 2、保存编辑项-card
   * 3、设置编辑参数项-formlist
   */
  handleForm = (card) => {
    this.setState({
@@ -312,6 +321,9 @@
            value: 'text',
            text: this.state.dict['header.form.text']
          }, {
            value: 'number',
            text: this.state.dict['header.form.number']
          }, {
            value: 'select',
            text: this.state.dict['header.form.select']
          }, {
@@ -321,14 +333,11 @@
            value: 'date',
            text: this.state.dict['header.form.dateday']
          }, {
            value: 'dateweek',
            text: this.state.dict['header.form.dateweek']
          }, {
            value: 'datemonth',
            text: this.state.dict['header.form.datemonth']
          }, {
            value: 'daterange',
            text: this.state.dict['header.form.daterange']
            value: 'datetime',
            text: this.state.dict['header.form.datetime']
          }]
        },
        {
@@ -425,6 +434,26 @@
            value: 'desc',
            text: this.state.dict['header.form.desc']
          }]
        },
        {
          type: 'number',
          key: 'decimal',
          label: this.state.dict['header.form.decimal'],
          initVal: card.decimal || 0,
          required: false
        },
        {
          type: 'radio',
          key: 'readonly',
          label: this.state.dict['header.form.readonly'],
          initVal: card.readonly || 'false',
          options: [{
            value: 'true',
            text: this.state.dict['header.form.true']
          }, {
            value: 'false',
            text: this.state.dict['header.form.false']
          }]
        }
      ]
    })
@@ -439,6 +468,14 @@
  handleSubmit = () => {
    this.formRef.handleConfirm().then(res => {
      let _config = JSON.parse(JSON.stringify(this.state.config))
      if ((res.type === 'select' || res.type === 'link') && res.resourceType === '1') {
        let sql = 'select ' + res.valueField + ',' + res.valueText + ' from (' + res.dataSource + ')'
        if (res.orderBy) {
          sql = sql + ' ld order by ' + res.orderBy + ' ' + res.orderType
        }
        res.dataSourceSql = Utils.formatOptions(sql)
      }
      _config.fields = _config.fields.map(item => {
        if (item.uuid === res.uuid) {
@@ -494,175 +531,105 @@
  }
  submitConfig = () => {
    const { menu } = this.props
    const { config, originMenu } = this.state
    this.menuformRef.handleConfirm().then(res => {
    const { menu, editAction } = this.props
    const { config } = this.state
      
      if (!config.fields[0] && config.fields[0].origin) {
        notification.warning({
          top: 92,
          message: '请添加表单',
          duration: 10
        })
        return
      }
      let _LongParam = ''
      let _config = {...config, tables: this.state.selectedTables}
      let _pageParam = {...menu.PageParam, OpenType: res.opentype}
      try {
        _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
      } catch (e) {
        notification.warning({
          top: 92,
          message: '编译错误',
          duration: 10
        })
        return
      }
      let param = {
        func: 'sPC_ButtonParam_AddUpt',
        ParentID: res.parentId,
        MenuID: menu.MenuID,
        MenuNo: res.menuNo,
        Template: menu.PageParam.Template || '',
        MenuName: res.menuName,
        PageParam: JSON.stringify(_pageParam),
        LongParam: _LongParam
      }
      this.setState({
        menuloading: true
      })
      Api.getSystemConfig(param).then(response => {
        if (response.status) {
          this.setState({
            menuloading: false,
            originMenu: {
              ...originMenu,
              LongParam: _config,
              PageParam: _pageParam,
              MenuName: res.menuName,
              MenuNo: res.menuNo,
              ParentID: res.parentId
            }
          })
          notification.success({
            top: 92,
            message: '保存成功',
            duration: 10
          })
        } else {
          this.setState({
            menuloading: false
          })
          notification.warning({
            top: 92,
            message: response.message,
            duration: 10
          })
        }
      })
      // let param = {
      //   func: 'sPC_TrdMenu_Upt',
      //   ParentID: res.parentId,
      //   MenuID: menu.MenuID,
      //   MenuNo: res.menuNo,
      //   Template: menu.PageParam.Template || '',
      //   MenuName: res.menuName,
      //   PageParam: JSON.stringify(_pageParam),
      //   LongParam: _LongParam
      // }
      this.setState({
        menuloading: true
      })
      Api.getSystemConfig(param).then(response => {
        if (response.status) {
          notification.success({
            top: 92,
            message: '保存成功',
            duration: 10
          })
          if (this.state.closeVisible) {
            this.props.handleConfig('')
          } else {
            this.setState({
              menuloading: false,
              originMenu: {
                ...originMenu,
                LongParam: _config,
                PageParam: _pageParam,
                MenuName: res.menuName,
                MenuNo: res.menuNo,
                ParentID: res.parentId
              }
            })
          }
        } else {
          this.setState({
            menuloading: false
          })
          notification.warning({
            top: 92,
            message: response.message,
            duration: 10
          })
        }
      })
    }, () => {
    if ((!config.groups[0] && !config.fields[0]) || (config.fields[0] && config.fields[0].origin)) {
      notification.warning({
        top: 92,
        message: this.state.dict['header.menu.basemsg'],
        message: '请添加表单',
        duration: 10
      })
      return
    }
    let _LongParam = ''
    let _config = {...config, tables: this.state.selectedTables}
    try {
      _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config)))
    } catch (e) {
      notification.warning({
        top: 92,
        message: '编译错误',
        duration: 10
      })
      return
    }
    let param = {
      func: 'sPC_ButtonParam_AddUpt',
      ParentID: menu.MenuID,
      MenuID: editAction.uuid,
      MenuNo: menu.MenuNo,
      Template: 'Modal',
      MenuName: editAction.label,
      PageParam: JSON.stringify({Template: 'Modal'}),
      LongParam: _LongParam
    }
    if (this.state.closeVisible) {
      this.setState({
        closeloading: true
      })
    } else {
      this.setState({
        menuloading: true
      })
    }
    Api.getSystemConfig(param).then(response => {
      if (response.status) {
        this.setState({
          menuloading: false,
          closeloading: false,
          originConfig: _config,
          config: _config
        })
        notification.success({
          top: 92,
          message: '保存成功',
          duration: 10
        })
      } else {
        this.setState({
          closeloading: false,
          menuloading: false
        })
        notification.warning({
          top: 92,
          message: response.message,
          duration: 10
        })
      }
    })
  }
  cancelConfig = () => {
    const { menu } = this.props
    const { config, originMenu } = this.state
    const { config, originConfig } = this.state
    let _this = this
    let isOrigin = config.fields.filter(item => item.origin).length > 0
    if (isOrigin) {
      confirm({
        content: '菜单尚未提交,确定放弃保存吗?',
        content: '尚未提交,确定放弃保存吗?',
        okText: this.state.dict['header.confirm'],
        cancelText: this.state.dict['header.cancel'],
        onOk() {
          _this.props.handleConfig('')
          _this.props.handleConfig(menu.type)
        },
        onCancel() {}
      })
    } else {
      this.menuformRef.handleConfirm().then(res => {
        let _config = {...config, tables: this.state.selectedTables}
        let _pageParam = {...menu.PageParam, OpenType: res.opentype}
        let _originMenu = {
          ...originMenu,
          LongParam: _config,
          PageParam: _pageParam,
          MenuName: res.menuName,
          MenuNo: res.menuNo,
          ParentID: res.parentId
        }
        if (!is(fromJS(originMenu), fromJS(_originMenu))) {
          this.setState({
            closeVisible: true
          })
        } else {
          this.props.handleConfig('')
        }
      }, () => {
      if (!is(fromJS(config), fromJS(originConfig))) {
        this.setState({
          closeVisible: true
        })
      })
      } else {
        this.props.handleConfig(menu.type)
      }
    }
  }
@@ -775,6 +742,7 @@
          valueText: '',
          orderBy: '',
          orderType: 'asc',
          readonly: 'false'
        }
      })
      _config.groups[_config.groups.length - 1].sublist = [..._config.groups[_config.groups.length - 1].sublist, ..._additems]
@@ -818,6 +786,7 @@
            valueText: '',
            orderBy: '',
            orderType: 'asc',
            readonly: 'false'
          }
  
          items.push(newcard)
@@ -906,8 +875,8 @@
    const {selectedTables, tableColumns} = this.state
    this.setState({
      selectedTables: selectedTables.filter(item => item.name !== table.name),
      tableColumns: tableColumns.filter(item => item.tableName !== table.name)
      selectedTables: selectedTables.filter(item => item.TbName !== table.TbName),
      tableColumns: tableColumns.filter(item => item.tableName !== table.TbName)
    })
  }
@@ -968,7 +937,7 @@
        
        if (_length === 1) {
          _config.fields = [...group.sublist, ..._config.groups[0].sublist]
          _config.groups[0].sublist = []
          _config.groups = []
        } else {
          _config.groups[_length - 1].sublist = [...group.sublist, ..._config.groups[_length - 1].sublist]
        }
@@ -996,13 +965,18 @@
      if (_group.isnew) {
        delete _group.isnew
        config.groups.unshift(_group)
        config.groups = config.groups.map(item => {
          if (item.default) {
            return res.default
          } else {
            return item
          }
        })
        if (config.groups.length > 1) {
          config.groups = config.groups.map(item => {
            if (item.default) {
              return res.default
            } else {
              return item
            }
          })
        } else {
          config.groups.push(res.default)
        }
      } else {
        config.groups = config.groups.map(item => {
          if (item.uuid === _group.uuid) {
@@ -1035,6 +1009,7 @@
  }
  render () {
    const { menu } = this.props
    const { config } = this.state
    return (
@@ -1046,7 +1021,6 @@
                <MenuForm
                  dict={this.state.dict}
                  formlist={this.state.modalformlist}
                  wrappedComponentRef={(inst) => this.menuformRef = inst}
                />
                <div className="ant-col ant-form-item-label">
                  <label title={this.state.dict['header.menu.table.add']}>
@@ -1109,7 +1083,7 @@
                </div>
                <div className="ant-modal-body">
                  <div className="modal-form">
                    {!this.state.loading && config.groups.length > 1 &&
                    {!this.state.loading && config.groups.length > 0 &&
                      config.groups.map(group => {
                        return (
                          <div key={group.uuid}>
@@ -1131,7 +1105,7 @@
                        )
                      })
                    }
                    {!this.state.loading && config.groups.length === 1?
                    {!this.state.loading && config.groups.length === 0 ?
                      <DragElement
                        list={config.fields}
                        setting={config.setting}
@@ -1210,8 +1184,8 @@
          visible={this.state.closeVisible}
          onCancel={() => { this.setState({closeVisible: false}) }}
          footer={[
            <Button key="save" className="mk-btn mk-green" onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>,
            <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig('')}}>{this.state.dict['header.notsave']}</Button>,
            <Button key="save" className="mk-btn mk-green" loading={this.state.closeloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>,
            <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig(menu.type)}}>{this.state.dict['header.notsave']}</Button>,
            <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button>
          ]}
          destroyOnClose
src/templates/modalconfig/index.scss
@@ -231,6 +231,10 @@
                width: 100%;
                margin-top: 4px;
              }
              .ant-input-number {
                width: 100%;
                margin-top: 4px;
              }
              .input-mask {
                position: absolute;
                top: 0;
src/templates/modalconfig/modalform/index.jsx
@@ -1,6 +1,6 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Select, Icon, Radio, notification } from 'antd'
import { Form, Row, Col, Input, Select, Icon, Radio, notification, InputNumber } from 'antd'
import EditTable from '../editable'
import './index.scss'
@@ -19,17 +19,57 @@
    formlist: null,
    dateoptions: {
      date: [{value: '', text: '空'}, {value: '0', text: '当天'}, {value: 1, text: '前一天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}],
      dateweek: [{value: '', text: '空'}, {value: '0', text: '本周'}, {value: 1, text: '上周'}, {value: 3, text: '前三周'}, {value: 7, text: '前七周'}],
      datemonth: [{value: '', text: '空'}, {value: '0', text: '本月'}, {value: 1, text: '上月'}, {value: 3, text: '前三月'}, {value: 7, text: '前七月'}],
      daterange: [{value: '', text: '空'}, {value: '0', text: '今天'}, {value: 1, text: '昨天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}],
      datemonth: [{value: '', text: '空'}, {value: '0', text: '本月'}, {value: 1, text: '上月'}, {value: 3, text: '前三月'}, {value: 6, text: '前六月'}],
      datetime: [{value: '', text: '空'}, {value: '0', text: '现在'}, {value: 1, text: '昨天'}, {value: 3, text: '前三天'}, {value: 7, text: '前七天'}, {value: 30, text: '前30天'}],
    }
  }
  UNSAFE_componentWillMount () {
    let formlist = JSON.parse(JSON.stringify(this.props.formlist))
    let type = formlist.filter(cell => cell.key === 'type')[0].initVal
    let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal
    let _options = ['label', 'field', 'initval', 'type', 'readonly'] // 默认显示项
    if ((type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源
      _options = [..._options, 'resourceType', 'setAll', 'options']
    } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源
      _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
    } else if (type === 'number') {
      _options = [..._options, 'decimal']
    }
    if (type === 'link') { // 关联类型、增加关联字段
      _options = [..._options, 'linkField']
    }
    this.setState({
      openType: type,
      resourceType: resourceType,
      formlist: formlist.map(form => {
        if (this.state.dateoptions.hasOwnProperty(type) && form.key === 'initval') {
          form.options = this.state.dateoptions[type]
          form.type = 'select'
        } else if (type === 'number' && form.key === 'initval') {
          form.type = 'number'
          form.initVal = 0
        }
        form.hidden = !_options.includes(form.key)
        return form
      })
    })
  }
  openTypeChange = (key, value) => {
    if (key === 'type') {
      let _options = ['label', 'field', 'initval', 'type']
      if (value === 'select' || value === 'link') { // 切换类型为选择或关联时,来源默认为自定义
      let _options = ['label', 'field', 'initval', 'type', 'readonly']
      if ((value === 'select' || value === 'link') && this.state.resourceType === '0') { // 选择类型、自定义资源
        _options = [..._options, 'resourceType', 'setAll', 'options']
      } else if ((value === 'select' || value === 'link') && this.state.resourceType === '1') { // 选择类型、数据源
        _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
      } else if (value === 'number') {
        _options = [..._options, 'decimal']
      }
      
      if (value === 'link') {
@@ -38,17 +78,20 @@
      
      this.setState({
        openType: value,
        resourceType: '0',
        formlist: this.state.formlist.map(form => {
          form.hidden = !_options.includes(form.key)
          if (form.key === 'initval') {
            if (this.state.dateoptions.hasOwnProperty(value)) {
              form.options = this.state.dateoptions[value]
              form.type = 'select'
              form.initVal = ''
            } else if (value === 'number') {
              form.type = 'number'
              form.initVal = 0
            } else {
              form.type = 'text'
              form.initVal = ''
            }
            form.initVal = ''
            form.hidden = true
          }
          return form
@@ -70,7 +113,7 @@
    const { openType } = this.state
    let value = e.target.value
    if (key === 'resourceType') {
      let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'setAll']
      let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'setAll', 'readonly']
      if (value === '0') {
        _options = [..._options, 'options']
      } else if (value === '1') {
@@ -113,6 +156,40 @@
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'number') {
        if (item.key === 'decimal') {
          fields.push(
            <Col span={12} key={index}>
              <Form.Item label={item.label}>
                {getFieldDecorator(item.key, {
                  initialValue: item.initVal || 0,
                  rules: [
                    {
                      required: !!item.required,
                      message: this.props.dict['form.required.input'] + item.label + '!'
                    }
                  ]
                })(<InputNumber min={0} max={18} precision={0} />)}
              </Form.Item>
            </Col>
          )
        } else {
          fields.push(
            <Col span={12} key={index}>
              <Form.Item label={item.label}>
                {getFieldDecorator(item.key, {
                  initialValue: item.initVal || 0,
                  rules: [
                    {
                      required: !!item.required,
                      message: this.props.dict['form.required.input'] + item.label + '!'
                    }
                  ]
                })(<InputNumber />)}
              </Form.Item>
            </Col>
          )
        }
      } else if (item.type === 'select') { // 下拉搜索
        fields.push(
          <Col span={12} key={index}>
@@ -130,7 +207,7 @@
                  showSearch
                  filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  onChange={(value) => {this.openTypeChange(item.key, value)}}
                  getPopupContainer={() => document.getElementById('commontable-search-form-box')}
                  getPopupContainer={() => document.getElementById('modal-fields-form-box')}
                >
                  {item.options.map(option =>
                    <Select.Option id={option.value} title={option.text} key={option.value} value={option.value}>
@@ -237,39 +314,6 @@
    })
  }
  resetForm = (formlist) => {
    if (!formlist) return
    let type = formlist.filter(cell => cell.key === 'type')[0].initVal
    let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal
    let _options = ['label', 'field', 'initval', 'type'] // 默认显示项
    if ((type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源
      _options = [..._options, 'resourceType', 'setAll', 'options']
    } else if ((type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源
      _options = [..._options, 'resourceType', 'setAll', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
    }
    if (type === 'link') { // 关联类型、增加关联字段
      _options = [..._options, 'linkField']
    }
    this.setState({
      openType: type,
      resourceType: resourceType,
      formlist: formlist.map(form => {
        if (this.state.dateoptions.hasOwnProperty(type) && form.key === 'initval') {
          form.options = this.state.dateoptions[type]
          form.type = 'select'
        }
        form.hidden = !_options.includes(form.key)
        return form
      })
    })
  }
  UNSAFE_componentWillMount () {
    this.resetForm(this.props.formlist)
  }
  render() {
    const formItemLayout = {
      labelCol: {
@@ -282,7 +326,7 @@
      }
    }
    return (
      <Form {...formItemLayout} className="ant-advanced-search-form commontable-search-form" id="commontable-search-form-box">
      <Form {...formItemLayout} className="ant-advanced-search-form modal-fields-form" id="modal-fields-form-box">
        <Row gutter={24}>{this.getFields()}</Row>
      </Form>
    )
src/templates/modalconfig/modalform/index.scss
@@ -1,4 +1,4 @@
.ant-advanced-search-form.commontable-search-form {
.ant-advanced-search-form.modal-fields-form {
  min-height: 180px;
  .ant-col-offset-4 {
    padding-left: 6px!important;
@@ -10,4 +10,7 @@
      width: 100%;
    }
  }
  .ant-input-number {
    width: 100%;
  }
}
src/templates/modalconfig/source.jsx
@@ -6,26 +6,20 @@
class CommonTableBaseData {
  baseConfig = {
    type: 'modal',
    type: 'Modal',
    setting: {
      title: '',
      width: 60,
      cols: '2'
    },
    tables: [],
    groups: [{
      label: '未分组',
      default: true,
      sort: 101,
      uuid: Utils.getuuid(),
      sublist: []
    }],
    groups: [],
    fields: [
      {
        origin: true,
        id: Utils.getuuid(),
        uuid: Utils.getuuid(),
        label: 'text',
        label: 'label',
        field: '',
        initval: '',
        type: 'text',
@@ -38,12 +32,12 @@
        valueText: '',
        orderBy: '',
        orderType: 'asc',
        display: 'dropdown'
        readonly: 'false'
      }, {
        origin: true,
        id: Utils.getuuid(),
        uuid: Utils.getuuid(),
        label: 'select',
        label: 'label',
        field: '',
        initval: '',
        type: 'select',
@@ -56,12 +50,12 @@
        valueText: '',
        orderBy: '',
        orderType: 'asc',
        display: 'dropdown'
        readonly: 'false'
      }, {
        origin: true,
        id: Utils.getuuid(),
        uuid: Utils.getuuid(),
        label: 'date',
        label: 'label',
        field: '',
        initval: '',
        type: 'date',
@@ -74,7 +68,7 @@
        valueText: '',
        orderBy: '',
        orderType: 'asc',
        display: 'dropdown'
        readonly: 'false'
      }
    ]
  }