king
2019-12-31 c41b93d4c5e2146a1d1568887fb8ce1e3144d7fb
2019-12-31
13个文件已修改
177 ■■■■ 已修改文件
src/tabviews/commontable/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/subtable/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/subtabtable/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/tableshare/mutilform/index.jsx 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/tableshare/topSearch/index.jsx 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/tableshare/topSearch/index.scss 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/comtableconfig/index.jsx 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/dragelement/card.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/index.jsx 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/modalform/index.jsx 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/subtableconfig/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/tableshare/searchform/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils.js 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/commontable/index.jsx
@@ -139,12 +139,11 @@
      let _actions = config.action.filter(item => item.position === 'toolbar') // 过滤工具栏按钮(未经过权限过滤)
      let _tab = config.tabs.filter(tab => tab.supMenu === 'mainTable')        // 检查是否有与主表关联的子表
      let supmenus = {}
      config.tabgroups.forEach(group => {
        if (config[group] && config[group].length > 0) {
          config[group] = config[group].map(tab => {
            if (tab.subtabs.length > 0) {
            if (tab.subtabs && tab.subtabs.length > 0) {
              tab.subtabs.forEach(id => {
                supmenus[id] = tab.uuid
              })
@@ -198,7 +197,7 @@
    let searchlist = JSON.parse(JSON.stringify(this.state.searchlist))
    let deffers = []
    searchlist.forEach(item => {
      if (item.type !== 'select' && item.type !== 'link') return
      if (item.type !== 'multiselect' && item.type !== 'select' && item.type !== 'link') return
      if (item.setAll === 'true') {
        item.options.unshift({
          key: Utils.getuuid(),
@@ -272,6 +271,7 @@
          })
        }
      })
      this.setState({searchlist})
    })
  }
src/tabviews/subtable/index.jsx
@@ -180,7 +180,7 @@
    let searchlist = JSON.parse(JSON.stringify(this.state.searchlist))
    let deffers = []
    searchlist.forEach(item => {
      if (item.type !== 'select' && item.type !== 'link') return
      if (item.type !== 'multiselect' && item.type !== 'select' && item.type !== 'link') return
      if (item.setAll === 'true') {
        item.options.unshift({
          key: Utils.getuuid(),
src/tabviews/subtabtable/index.jsx
@@ -162,7 +162,7 @@
    let searchlist = JSON.parse(JSON.stringify(this.state.searchlist))
    let deffers = []
    searchlist.forEach(item => {
      if (item.type !== 'select' && item.type !== 'link') return
      if (item.type !== 'multiselect' && item.type !== 'select' && item.type !== 'link') return
      if (item.setAll === 'true') {
        item.options.unshift({
          key: Utils.getuuid(),
src/tabviews/tableshare/mutilform/index.jsx
@@ -272,6 +272,33 @@
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'multiselect') { // 多选
        let _initval = item.initval ? item.initval.split(',').filter(Boolean) : []
        fields.push(
          <Col span={24 / cols} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {
                initialValue: _initval,
                rules: [
                  {
                    required: item.required === 'true',
                    message: this.props.dict['form.required.select'] + item.label + '!'
                  }
                ]
              })(
                <Select
                  showSearch
                  mode="multiple"
                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                >
                  {item.options.map(option =>
                    <Select.Option id={option.key} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option>
                  )}
                </Select>
              )}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'date') { // 时间搜索
        let _initval = this.props.data ? this.props.data[item.field] : ''
        if (_initval) {
@@ -398,6 +425,13 @@
                key: key,
                value: values[key]
              })
            } else if (this.state.datatype[key] === 'multiselect') {
              search.push({
                type: this.state.datatype[key],
                readonly: this.state.readtype[key],
                key: key,
                value: values[key] ? values[key].join(',') : ''
              })
            } else {
              search.push({
                type: this.state.datatype[key],
src/tabviews/tableshare/topSearch/index.jsx
@@ -2,6 +2,7 @@
import PropTypes from 'prop-types'
import { Form, Row, Col, Input, Button, Select, DatePicker, notification } from 'antd'
import moment from 'moment'
import Utils from '@/utils/utils.js'
import './index.scss'
const {MonthPicker, WeekPicker, RangePicker} = DatePicker
@@ -13,9 +14,10 @@
  }
  state = {
    match: null, // 搜索条件匹配规则
    match: null,            // 搜索条件匹配规则
    style: null,
    searchlist: null
    searchlist: null,
    formId: Utils.getuuid()
  }
  UNSAFE_componentWillMount () {
@@ -72,8 +74,8 @@
    })
  }
  UNSAFE_componentWillReceiveProps() {
    let searchlist = JSON.parse(JSON.stringify(this.props.searchlist))
  UNSAFE_componentWillReceiveProps(nextProps) {
    let searchlist = JSON.parse(JSON.stringify(nextProps.searchlist))
    let _list = []
    let fieldMap = new Map()
@@ -170,7 +172,10 @@
  getFields() {
    const { getFieldDecorator } = this.props.form
    const fields = []
    this.state.searchlist.forEach((item, index) => {
      if (item.hidden) return
      if (item.type === 'text') { // 文本搜索
        fields.push(
          <Col span={6} key={index}>
@@ -186,12 +191,33 @@
              {getFieldDecorator(item.field, {initialValue: item.initval })(
                <Select
                  showSearch
                  // onChange={this.searchChange}
                  onChange={(value) => {this.selectChange(item, value)}}
                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  getPopupContainer={() => document.getElementById(this.state.formId)}
                >
                  {item.options.map(option =>
                    <Select.Option id={option.key} title={option.Text} key={option.key} value={option.Value}>{option.Text}</Select.Option>
                  {item.options.map((option, i) =>
                    <Select.Option id={`${i}`} title={option.Text} key={`${i}`} value={option.Value}>{option.Text}</Select.Option>
                  )}
                </Select>
              )}
            </Form.Item>
          </Col>
        )
      } else if (item.type === 'multiselect') { // 下拉多选
        let _initval = item.initval ? item.initval.split(',').filter(Boolean) : []
        fields.push(
          <Col span={6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {initialValue: _initval })(
                <Select
                  showSearch
                  mode="multiple"
                  // onChange={(value) => {this.selectChange(item, value)}}
                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                  getPopupContainer={() => document.getElementById(this.state.formId)}
                >
                  {item.options.map((option, i) =>
                    <Select.Option id={`${i}`} title={option.Text} key={`${i}`} value={option.Value}>{option.Text}</Select.Option>
                  )}
                </Select>
              )}
@@ -203,7 +229,7 @@
          <Col span={6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval, 'days') : null })(
                <DatePicker onChange={this.searchChange} />
                <DatePicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} />
              )}
            </Form.Item>
          </Col>
@@ -213,7 +239,7 @@
          <Col span={6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval, 'month') : null })(
                <MonthPicker onChange={this.searchChange} />
                <MonthPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} />
              )}
            </Form.Item>
          </Col>
@@ -223,7 +249,7 @@
          <Col span={6} key={index}>
            <Form.Item label={item.label}>
              {getFieldDecorator(item.field, {initialValue: item.initval ? moment().subtract(item.initval * 7, 'days') : null })(
                <WeekPicker onChange={this.searchChange} />
                <WeekPicker onChange={this.searchChange} getCalendarContainer={() => document.getElementById(this.state.formId)} />
              )}
            </Form.Item>
          </Col>
@@ -251,6 +277,7 @@
                  placeholder={['开始日期', '结束日期']}
                  renderExtraFooter={() => 'extra footer'}
                  onChange={this.searchChange}
                  getCalendarContainer={() => document.getElementById(this.state.formId)}
                />
              )}
            </Form.Item>
@@ -361,6 +388,13 @@
          value: _value,
          match: this.state.match[key]
        })
      } else if (this.state.style[key] === 'multiselect') {
        search.push({
          type: this.state.style[key],
          key: key.replace(/@tail@$/, ''),
          value: values[key],
          match: this.state.match[key]
        })
      } else {
        search.push({
          type: this.state.style[key],
@@ -375,7 +409,7 @@
  render() {
    return (
      <Form className="ant-advanced-search-form top-search" onSubmit={this.handleSearch}>
      <Form className="ant-advanced-search-form top-search" id={this.state.formId} onSubmit={this.handleSearch}>
        <Row gutter={24}>{this.getFields()}</Row>
      </Form>
    )
src/tabviews/tableshare/topSearch/index.scss
@@ -7,6 +7,7 @@
  }
  .ant-form-item-control-wrapper {
    flex: 1;
    width: calc(100% - 100px);
  }
  .ant-form-item-label {
    width: 100px;
@@ -16,4 +17,10 @@
    padding: 4px 20px 4px 5px;
    font-size: 13px;
  }
  .ant-select-dropdown {
    z-index: 10 !important;
  }
  .ant-calendar-picker-container {
    z-index: 10 !important;
  }
}
src/templates/comtableconfig/index.jsx
@@ -1177,7 +1177,7 @@
        let isupdate = false
        if (res.type === 'search') {
          if ((res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') {
          if ((res.values.type === 'multiselect' || res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') {
            let _datasource = res.values.dataSource
            if (/\s/.test(_datasource)) {
@@ -2562,7 +2562,6 @@
   * @description 设置可配置按钮
   */
  setSubConfig = (btn, type) => {
    console.log(btn)
    const { menu } = this.props
    const { config, originMenu } = this.state
src/templates/modalconfig/dragelement/card.jsx
@@ -42,7 +42,7 @@
  }
  let selectval = ''
  if (card.type === 'select' || card.type === 'link') {
  if (card.type === 'multiselect' || card.type === 'select' || card.type === 'link') {
    if (card.initval) {
      let _option = card.options.filter(option => option.Value === card.initval)[0]
      if (_option) {
@@ -69,7 +69,7 @@
            {card.type === 'number' &&
              <InputNumber defaultValue={card.initval} precision={card.decimal} />
            }
            {(card.type === 'select' || card.type === 'link') &&
            {(card.type === 'multiselect' || card.type === 'select' || card.type === 'link') &&
              <Select defaultValue={selectval}></Select>
            }
            {card.type === 'date' &&
src/templates/modalconfig/index.jsx
@@ -350,6 +350,9 @@
            value: 'select',
            text: this.state.dict['header.form.select']
          }, {
            value: 'multiselect',
            text: this.state.dict['header.form.multiselect']
          }, {
            value: 'link',
            text: this.state.dict['header.form.link']
          }, {
@@ -505,7 +508,7 @@
    this.formRef.handleConfirm().then(res => {
      let _config = JSON.parse(JSON.stringify(this.state.config))
      if ((res.type === 'select' || res.type === 'link') && res.resourceType === '1') {
      if ((res.type === 'multiselect' || res.type === 'select' || res.type === 'link') && res.resourceType === '1') {
        let _datasource = res.dataSource
        if (/\s/.test(_datasource)) {
src/templates/modalconfig/modalform/index.jsx
@@ -27,12 +27,16 @@
    let resourceType = formlist.filter(cell => cell.key === 'resourceType')[0].initVal
    let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required'] // 默认显示项
    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 === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 选择类型、自定义资源
      _options = [..._options, 'resourceType', 'options']
    } else if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '1') { // 选择类型、数据源
      _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
    } else if (type === 'number') {
      _options = [..._options, 'decimal']
    }
    if (type === 'select' || type === 'link') {
      _options.push('setAll')
    }
    if (type === 'link') { // 关联类型、增加关联字段
@@ -73,12 +77,16 @@
    if (key === 'type') {
      let _options = ['label', 'field', 'initval', 'type', 'readonly', 'required']
      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']
      if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 选择类型、自定义资源
        _options = [..._options, 'resourceType', 'options']
      } else if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '1') { // 选择类型、数据源
        _options = [..._options, 'resourceType', 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
      } else if (value === 'number') {
        _options = [..._options, 'decimal']
      }
      if (value === 'select' || value === 'link') {
        _options.push('setAll')
      }
      
      if (value === 'link') {
@@ -122,11 +130,15 @@
    const { openType } = this.state
    let value = e.target.value
    if (key === 'resourceType') {
      let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'setAll', 'readonly', 'required']
      let _options = ['label', 'field', 'initval', 'type', 'resourceType', 'readonly', 'required']
      if (value === '0') {
        _options = [..._options, 'options']
      } else if (value === '1') {
        _options = [..._options, 'dataSource', 'valueField', 'valueText', 'orderBy', 'orderType']
      }
      if (openType === 'select' || openType === 'link') {
        _options.push('setAll')
      }
      
      if (openType === 'link') {
@@ -292,11 +304,11 @@
          values.id = this.props.card.id
          values.uuid = this.props.card.uuid
          // 下拉菜单或关联菜单
          if ((values.type === 'select' || values.type === 'link') && values.resourceType === '0') {
          if ((values.type === 'multiselect' || values.type === 'select' || values.type === 'link') && values.resourceType === '0') {
            values.options = this.refs.editTable.state.dataSource
            values.dataSource = ''
            let emptys = []
            if (values.type === 'select') {
            if (values.type === 'multiselect' || values.type === 'select') {
              emptys = values.options.filter(op => !(op.Value && op.Text))
            } else {
              emptys = values.options.filter(op => !(op.Value && op.Text && op.ParentID))
@@ -304,7 +316,7 @@
            if (emptys.length > 0) {
              isvalid = false
            }
          } else if ((values.type === 'select' || values.type === 'link') && values.resourceType === '1') {
          } else if ((values.type === 'multiselect' || values.type === 'select' || values.type === 'link') && values.resourceType === '1') {
            values.options = []
          }
src/templates/subtableconfig/index.jsx
@@ -995,7 +995,7 @@
        let isupdate = false
        if (res.type === 'search') {
          if ((res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') {
          if ((res.values.type === 'multiselect' || res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') {
            let _datasource = res.values.dataSource
            if (/\s/.test(_datasource)) {
src/templates/tableshare/searchform/index.jsx
@@ -316,11 +316,11 @@
          values.id = this.props.card.id
          values.uuid = this.props.card.uuid
          // 下拉菜单或关联菜单
          if ((values.type === 'select' || values.type === 'link') && values.resourceType === '0') {
          if ((values.type === 'multiselect' || values.type === 'select' || values.type === 'link') && values.resourceType === '0') {
            values.options = this.refs.editTable.state.dataSource
            values.dataSource = ''
            let emptys = []
            if (values.type === 'select') {
            if (values.type === 'multiselect' || values.type === 'select') {
              emptys = values.options.filter(op => !(op.Value && op.Text))
            } else {
              emptys = values.options.filter(op => !(op.Value && op.Text && op.ParentID))
@@ -328,7 +328,7 @@
            if (emptys.length > 0) {
              isvalid = false
            }
          } else if ((values.type === 'select' || values.type === 'link') && values.resourceType === '1') {
          } else if ((values.type === 'multiselect' || values.type === 'select' || values.type === 'link') && values.resourceType === '1') {
            values.options = []
          }
src/utils/utils.js
@@ -227,6 +227,8 @@
        }
        item.value = _val ? [moment().subtract(_val[0], 'days').format('YYYY-MM-DD'),
          moment().subtract(_val[1], 'days').format('YYYY-MM-DD')] : ''
      } else if (item.type === 'multiselect') {
        item.value = item.value ? item.value.split(',').filter(Boolean) : []
      }
      newsearches.push(item)
    })
@@ -294,6 +296,8 @@
        item.key.split(',').forEach(field => { // 综合搜索,所字段拼接
          newsearches[field] = item.value
        })
      } else if (item.type === 'multiselect') {
        newsearches[item.key] = item.value.join(',')
      } else {
        newsearches[item.key] = item.value
      }
@@ -312,7 +316,8 @@
    let searchText = ''
    searches.forEach(item => {
      if (!item.value) return
      if (!item.value || (item.type === 'multiselect' && item.value.length === 0)) return
      searchText += (searchText !== '' ? ' AND ' : '')
      if (item.type === 'text') {
        let str = item.match === '=' ? '' : '%'
@@ -325,6 +330,13 @@
        let str = item.match === '=' ? '' : '%'
        searchText += item.key + ' ' + item.match + ' \'' + str + item.value + str + '\''
      } else if (item.type === 'multiselect') {
        let str = item.match === '=' ? '' : '%'
        let options = item.value.map(val => {
          return item.key + ' ' + item.match + ' \'' + str + val + str + '\''
        })
        searchText += '(' + options.join(' OR ') + ')'
      } else if (item.type === 'date') {
        let _val = item.value
        let timetail = ' 00:00:00.000'