king
2022-11-08 d0e8c7cb64d7d219f7cfec8bc87cf699b9cfe7b2
2022-11-08
7个文件已修改
142 ■■■■ 已修改文件
src/menu/components/table/base-table/columns/index.jsx 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/base-table/columns/index.scss 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/edit-table/columns/index.jsx 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/normal-table/columns/index.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/replaceField/index.jsx 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/replaceField/settingform/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/updatetable/index.jsx 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/table/base-table/columns/index.jsx
@@ -12,7 +12,7 @@
import './index.scss'
const { confirm } = Modal
const EditColumn = asyncIconComponent(() => import('./editColumn'))
const EditColumn = asyncComponent(() => import('./editColumn'))
const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent'))
const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent'))
const PasteComponent = asyncIconComponent(() => import('@/components/paste'))
@@ -576,6 +576,16 @@
    }
    const columns = this.handlecolumns(this.state.columns, fields, config)
    let groups = null
    if (columns.length > 12) {
      let g = Math.ceil(columns.length / 8)
      let n = Math.ceil(columns.length / g)
      groups = []
      for (let i = 0, len = columns.length; i < len; i += n) {
        groups.push(columns.slice(i, i + n))
      }
    }
    return (
      <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType} ${config.wrap.mode || ''}`} id={tableId}>
@@ -585,10 +595,29 @@
          <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} />
        </div>
        <DndProvider>
          {groups ? groups.map((group, i) => {
            return <Table
              key={i}
              rowKey="uuid"
              size={config.wrap.size || 'middle'}
              bordered={config.wrap.bordered !== 'false'}
              components={components}
              dataSource={this.state.data}
              rowSelection={config.wrap.tableType && i === 0 ? { type: 'radio' } : null}
              columns={group}
              pagination={i === groups.length - 1 ? {
                current: 1,
                pageSize: 10,
                pageSizeOptions: ['10', '25', '50', '100', '500', '1000'],
                showSizeChanger: true,
                total: 58,
                showTotal: (total, range) => `${range[0]}-${range[1]} 共 ${total} 条`
              } : false}
            />
          }) :
          <Table
            rowKey="uuid"
            size={config.wrap.size || 'middle'}
            rowClassName="editable-row"
            bordered={config.wrap.bordered !== 'false'}
            components={components}
            dataSource={this.state.data}
@@ -602,7 +631,7 @@
              total: 58,
              showTotal: (total, range) => `${range[0]}-${range[1]} 共 ${total} 条`
            }}
          />
          />}
        </DndProvider>
        <EditColumn column={card} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/>
      </div>
src/menu/components/table/base-table/columns/index.scss
@@ -5,6 +5,9 @@
  --mk-table-font-size: 14px;
  --mk-table-font-weight: normal;
  .ant-table-wrapper + .ant-table-wrapper {
    margin-top: 10px;
  }
  .ant-table {
    color: inherit;
    font-size: inherit;
src/menu/components/table/edit-table/columns/index.jsx
@@ -605,7 +605,6 @@
          <Table
            rowKey="uuid"
            size={config.wrap.size || 'middle'}
            rowClassName="editable-row"
            bordered={config.wrap.bordered !== 'false'}
            rowSelection={rowSelection}
            components={components}
src/menu/components/table/normal-table/columns/index.jsx
@@ -13,7 +13,7 @@
const { confirm } = Modal
const { Paragraph } = Typography 
const EditColumn = asyncIconComponent(() => import('./editColumn'))
const EditColumn = asyncComponent(() => import('./editColumn'))
const MarkColumn = asyncIconComponent(() => import('@/menu/components/share/markcomponent'))
const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent'))
const MobPagination = asyncIconComponent(() => import('@/menu/components/share/mobPagination'))
@@ -604,7 +604,6 @@
          <Table
            rowKey="uuid"
            size={config.wrap.size || 'middle'}
            rowClassName="editable-row"
            bordered={config.wrap.bordered !== 'false'}
            components={components}
            dataSource={this.state.data}
src/menu/replaceField/index.jsx
@@ -154,10 +154,12 @@
    })
  }
  // 依据原字段替换为新字段
  exec = (map) => {
    const { type } = this.props
    let config = fromJS(this.props.config).toJS()
    if (this.props.type === 'custom') {
    if (type === 'custom') {
      let _replace = (components) => {
        return components.map(item => {
          if (item.type === 'tabs') {
@@ -209,6 +211,9 @@
                  return col
                })
              }
              if (m.config && m.config.components) {
                m.config.components = _replace(m.config.components)
              }
            })
          }
@@ -235,6 +240,9 @@
                      return col
                    })
                  }
                  if (m.config && m.config.components) {
                    m.config.components = _replace(m.config.components)
                  }
                  return m
                })
              }
@@ -259,6 +267,9 @@
                      }
                      return col
                    })
                  }
                  if (m.config && m.config.components) {
                    m.config.components = _replace(m.config.components)
                  }
                  return m
                })
@@ -295,6 +306,9 @@
                  }
                  return col
                })
              }
              if (m.config && m.config.components) {
                m.config.components = _replace(m.config.components)
              }
              return m
            })
@@ -363,6 +377,9 @@
                        return col
                      })
                    }
                    if (m.config && m.config.components) {
                      m.config.components = _replace(m.config.components)
                    }
                    return m
                  })
@@ -389,12 +406,21 @@
            item.cols = _update(item.cols)
          }
          if (item.subtype === 'basetable') {
            item.cols = item.cols.map(col => {
              if (col.field && map[col.field.toLowerCase()]) {
                col.field = map[col.field.toLowerCase()].FieldName
              }
              return col
            })
          }
          return item
        })
      }
      config.components = _replace(config.components)
    } else if (this.props.type === 'table') {
    } else if (type === 'table') {
      config.columns = config.columns.map(col => {
        if (col.field && map[col.field.toLowerCase()]) {
          col.field = map[col.field.toLowerCase()].FieldName
@@ -423,7 +449,7 @@
        }
        return m
      })
    } else if (this.props.type === 'form') {
    } else if (type === 'form') {
      config.fields = config.fields.map(col => {
        if (col.field && map[col.field.toLowerCase()]) {
          col.field = map[col.field.toLowerCase()].FieldName
@@ -449,10 +475,12 @@
    }, 300)
  }
  // 依据字段替换名称
  execLabel = (map) => {
    const { type } = this.props
    let config = fromJS(this.props.config).toJS()
    if (this.props.type === 'custom') {
    if (type === 'custom') {
      let _replace = (components) => {
        return components.map(item => {
          if (item.type === 'tabs') {
@@ -500,6 +528,9 @@
                  return col
                })
              }
              if (m.config && m.config.components) {
                m.config.components = _replace(m.config.components)
              }
            })
          }
@@ -524,6 +555,9 @@
                        return col
                      })
                    }
                    if (m.config && m.config.components) {
                      m.config.components = _replace(m.config.components)
                    }
                    return m
                  })
@@ -542,12 +576,21 @@
            item.cols = _update(item.cols)
          }
          if (item.subtype === 'basetable') {
            item.cols = item.cols.map(col => {
              if (col.field && map[col.field.toLowerCase()]) {
                col.label = map[col.field.toLowerCase()].FieldDec
              }
              return col
            })
          }
          return item
        })
      }
      config.components = _replace(config.components)
    } else if (this.props.type === 'table') {
    } else if (type === 'table') {
      config.columns = config.columns.map(col => {
        if (col.field && map[col.field.toLowerCase()]) {
          col.label = map[col.field.toLowerCase()].FieldDec
@@ -573,7 +616,7 @@
        }
        return m
      })
    } else if (this.props.type === 'form') {
    } else if (type === 'form') {
      config.fields = config.fields.map(col => {
        if (col.field && map[col.field.toLowerCase()]) {
          col.label = map[col.field.toLowerCase()].FieldDec
src/menu/replaceField/settingform/index.jsx
@@ -121,7 +121,7 @@
              {getFieldDecorator('resource', {
                initialValue: 'custom'
              })(
                <Radio.Group onChange={(e) => this.setState({resource: e.target.value})}>
                <Radio.Group onChange={(e) => {this.setState({resource: e.target.value});this.props.form.setFieldsValue({reType: 'field'})}}>
                  <Radio value="dict">数据字典</Radio>
                  <Radio value="custom">自定义</Radio>
                </Radio.Group>
@@ -135,7 +135,7 @@
              })(
                <Radio.Group onChange={(e) => this.setState({reType: e.target.value})}>
                  <Radio value="field">字段 <SwapRightOutlined /> 名称</Radio>
                  <Radio value="name">原字段 <SwapRightOutlined /> 新字段</Radio>
                  <Radio disabled={resource === 'dict'} value="name">原字段 <SwapRightOutlined /> 新字段</Radio>
                </Radio.Group>
              )}
            </Form.Item>
src/templates/comtableconfig/updatetable/index.jsx
@@ -20,6 +20,7 @@
  }
  state = {}
  delButtons = []
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.state), fromJS(nextState))
@@ -52,22 +53,19 @@
  execUpdate = (_resolve) => {
    const { config } = this.props
    let uuid = config.uuid
    let trail = md5(uuid).slice(-10) + 'mk'
    uuid = uuid.replace(/.{12}$/, trail)
    this.delButtons = []
    let _config = {
      version: 1.0,
      uuid: uuid,
      MenuID: uuid,
      uuid: config.uuid,
      MenuID: config.uuid,
      fstMenuId: config.fstMenuId,
      parentId: config.ParentId,
      Template: 'BaseTable',
      easyCode: config.easyCode,
      enabled: false,
      MenuName: config.MenuName + '_new',
      MenuNo: config.MenuNo + '_new',
      MenuName: config.MenuName,
      MenuNo: config.MenuNo,
      OpenType: 'newtab',
      tables: config.tables || [],
      urlFields: config.urlFields || [],
@@ -126,7 +124,7 @@
                equalTab: n.equalTab && n.equalTab.length > 0 ? n.equalTab[0] : ''
              }
            ]}
            this.delButtons.push(n.linkTab)
            oldtabs[n.uuid] = tab.components[0].uuid
            _tbs.push(tab.components[0])
@@ -688,13 +686,15 @@
      Api.getSystemConfig(param).then(res => {
        resolve(res)
      })
    // }).then(res => { // 删除原菜单
    //   if (!res || !res.status) return res
    }).then(res => { // 删除原菜单
      if (!res || !res.status) return res
    //   return Api.getSystemConfig({
    //     func: 'sPC_MainMenu_Del',
    //     MenuID: this.props.config.uuid
    //   })
      if (this.delButtons.length === 0) return res
      return Api.getSystemConfig({
        func: 'sPC_MainMenu_Del',
        MenuID: this.delButtons.join(',')
      })
    }).then(res => {
      if (!res) return
@@ -714,9 +714,10 @@
        let _param = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam)))
        // window.history.replaceState(null, null, window.location.href.split('#')[0] + `#/tabledesign/${_param}`)
        // window.location.reload()
        window.open(`#/tabledesign/${_param}`)
        setTimeout(() => {
          window.history.replaceState(null, null, window.location.href.split('#')[0] + `#/tabledesign/${_param}`)
          window.location.reload()
        }, 2000)
      } else {
        notification.warning({
          top: 92,
@@ -968,6 +969,8 @@
      delete _btn.position
      delete _btn.linkTab
      this.delButtons.push(btn.uuid)
      _btn.show = 'button'
      if (_btn.execSuccess === 'equaltab') {