king
2023-06-20 b25bda3d390f7db85584ae97315f2aeb7aae32ce
2023-06-20
9个文件已修改
225 ■■■■ 已修改文件
src/assets/css/main.scss 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/topSearch/index.jsx 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/topSearch/mkCheckCard/index.jsx 78 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/topSearch/mkCheckCard/index.scss 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/sharecomponent/searchcomponent/searchform/index.jsx 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/formconfig.jsx 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/modalform/datatable/index.jsx 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/modalform/fieldtable/index.jsx 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/main.scss
@@ -513,4 +513,10 @@
.ant-col.ant-col-0 {
  display: inline-block;
}
.ant-dropdown {
  .ant-dropdown-menu-item:hover, .ant-dropdown-menu-submenu-title:hover {
    background-color: var(--mk-sys-color1);
  }
}
src/tabviews/zshare/topSearch/index.jsx
@@ -156,6 +156,9 @@
        // 数据源查询语句
        if (item.resourceType === '1' && item.dataSource) {
          if (item.multiple === 'dropdown') {
            item.parentField = 'pid'
          }
          let _option = Utils.getSelectQueryOptions(item)
          if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) {
@@ -178,6 +181,10 @@
          }
        }
        item.oriOptions = fromJS(item.options).toJS()
        if (item.type === 'checkcard' && item.multiple === 'dropdown' && item.resourceType === '0') {
          this.resetCheckcard(item)
        }
      }
      fieldMap.set(item.field, item)
@@ -223,6 +230,37 @@
        this.improveSearch(mainItems, localItems)
      }
    })
  }
  resetCheckcard = (item) => {
    let _options = []
    let _others = []
    item.oriOptions.forEach(op => {
      if (op.pid === item.mark) {
        _options.push(op)
      } else {
        _others.push(op)
      }
    })
    _options = _options.map(op => {
      op.children = []
      _others = _others.filter(cell => {
        if (cell.pid === op.$value) {
          op.children.push(cell)
          return false
        }
        return true
      })
      op.subIds = op.children.map(cell => cell.$value)
      return op
    })
    item.oriOptions = _options
    item.options = _options
  }
  // 查询下拉菜单
@@ -432,6 +470,10 @@
        })
        item.oriOptions = [...item.oriOptions, ...options]
        if (item.type === 'checkcard' && item.multiple === 'dropdown') {
          this.resetCheckcard(item)
        }
      }
      if (item.linkField) {
src/tabviews/zshare/topSearch/mkCheckCard/index.jsx
@@ -1,7 +1,7 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Col, Row } from 'antd'
import { Col, Row, Dropdown, Menu } from 'antd'
import { CheckOutlined } from '@ant-design/icons'
import MKEmitter from '@/utils/events.js'
@@ -225,27 +225,7 @@
          </div>
        </Col>
      })
    } else if (display !== 'picture') {
      let _style = selectStyle === 'custom' ? {backgroundColor} : null
      return options.map(item => {
        let _active = false
        if (multiple === 'true') {
          _active = selectKeys.includes(item.$value)
        } else {
          _active = selectKeys === item.$value
        }
        return <Col span={width} key={item.key}>
          <div className={'card-cell' + (_active ? ' active' : '') + selectClass} onClick={() => this.changeCard(item)}>
            <div className="bg-mask" style={_style}></div>
            {fields.map(col => {
              return <span className="content-line" key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span>
            })}
          </div>
        </Col>
      })
    } else {
    } else if (display === 'picture') {
      let paddingTop = '100%'
      if (picratio === '4:3') {
        paddingTop = '75%'
@@ -276,6 +256,60 @@
          </div>
        </Col>
      })
    } else {
      let _style = selectStyle === 'custom' ? {backgroundColor} : null
      if (multiple === 'dropdown') {
        return options.map(item => {
          if (item.children.length) {
            return <Col span={width} key={item.key}>
              <Dropdown
                overlayClassName="mk-search-card"
                overlay={
                <Menu>
                  {item.children.map((cell, index) => (<Menu.Item className={selectKeys === cell.$value ? ' active' : ''} key={index} onClick={() => this.changeCard(cell)}>{cell[fields[0].field]}</Menu.Item>))}
                </Menu>}
                placement="bottomCenter"
              >
                <div className={'card-cell' + (selectKeys && (selectKeys === item.$value || item.subIds.includes(selectKeys)) ? ' active' : '') + selectClass} onClick={() => this.changeCard(item)}>
                  <div className="bg-mask" style={_style}></div>
                  {fields.map(col => {
                    return <span className="content-line" key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span>
                  })}
                </div>
              </Dropdown>
            </Col>
          } else {
            return <Col span={width} key={item.key}>
              <div className={'card-cell' + (selectKeys === item.$value ? ' active' : '') + selectClass} onClick={() => this.changeCard(item)}>
                <div className="bg-mask" style={_style}></div>
                {fields.map(col => {
                  return <span className="content-line" key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span>
                })}
              </div>
            </Col>
          }
        })
      } else {
        return options.map(item => {
          let _active = false
          if (multiple === 'true') {
            _active = selectKeys.includes(item.$value)
          } else {
            _active = selectKeys === item.$value
          }
          return <Col span={width} key={item.key}>
            <div className={'card-cell' + (_active ? ' active' : '') + selectClass} onClick={() => this.changeCard(item)}>
              <div className="bg-mask" style={_style}></div>
              {fields.map(col => {
                return <span className="content-line" key={col.key} style={{color: col.color, fontSize: col.fontSize + 'px', height: col.fontSize * 1.5 + 'px', textAlign: col.align}}>{item[col.field]}</span>
              })}
            </div>
          </Col>
        })
      }
    }
  }
src/tabviews/zshare/topSearch/mkCheckCard/index.scss
@@ -177,4 +177,9 @@
  .card-cell {
    border: 0px;
  }
}
.mk-search-card {
  .ant-dropdown-menu-item.active {
    color: var(--mk-sys-color);
  }
}
src/templates/sharecomponent/searchcomponent/searchform/index.jsx
@@ -119,11 +119,7 @@
  }
  state = {
    openType: null,          // 搜索条件显示类型
    resourceType: null,      // 下拉搜索时,选项来源类型
    formlist: null,          // 表单
    cFields: [],
    textTooltip: '字段名可以使用逗号分隔,进行综合搜索',
    formlist: null
  }
  record = {}
@@ -213,6 +209,9 @@
        }
        if (this.record.selectStyle === 'custom') {
          shows.push('backgroundColor')
        }
        if (this.record.multiple === 'dropdown') {
          shows.push('mark')
        }
      }
      shows.push('linkField')
@@ -487,7 +486,7 @@
            <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />
          </AutoComplete>
        } else {
          content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />
          content = <Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} onChange={(e) => {this.optionChange(item.key, e.target.value)}}/>
        }
      } else if (item.type === 'number') {
        rules = [
@@ -554,7 +553,7 @@
          if (this.record.linkField) {
            type = 'link'
          }
          content = <DataTable type={type} display={this.record.display} linkSubFields={[]} transfield={{}} fields={this.record.fields || []} onChange={this.changeOptions}/>
          content = <DataTable type={type} multiple={this.record.multiple} display={this.record.display} linkSubFields={[]} transfield={{}} fields={this.record.fields || []} onChange={this.changeOptions}/>
        }
      } else if (item.type === 'fields') {
        span = 24
@@ -665,10 +664,15 @@
              values.options = []
            }
          } else if (values.type === 'checkcard') {
            if (values.multiple === 'dropdown' && values.display !== 'text') {
              values.multiple = 'false'
            }
            if (values.resourceType === '0') {
              values.options = values.options || []
              values.options = values.options.map(m => {
                m.ParentID = m.ParentID || ''
                m.pid = m.pid || ''
                return m
              })
src/templates/zshare/formconfig.jsx
@@ -386,6 +386,30 @@
    })
  }
  let muloptions = [{
    value: 'false',
    text: '单选'
  }, {
    value: 'true',
    text: '多选'
  }, {
    value: 'dropdown',
    text: '下拉菜单'
  }]
  if (appType !== '') {
    muloptions = [{
      value: 'false',
      text: '单选'
    }, {
      value: 'true',
      text: '多选'
    }]
    if (card.multiple === 'dropdown') {
      card.multiple = 'false'
    }
  }
  return [
    {
      type: 'text',
@@ -573,14 +597,9 @@
      key: 'multiple',
      label: '选择形式',
      initVal: card.multiple || 'false',
      tooltip: appType === '' ? '使用下拉菜单时,选项会依据 pid 组织数据的上下级关系,二级选项会下拉展示。注:1、显示为文本时有效;2、使用数据源请返回 pid 字段。' : '',
      required: true,
      options: [{
        value: 'false',
        text: '单选'
      }, {
        value: 'true',
        text: '多选'
      }]
      options: muloptions
    },
    {
      type: 'select',
@@ -900,6 +919,14 @@
      required: true
    },
    {
      type: 'text',
      key: 'mark',
      label: '顶级标识',
      initVal: card.mark || '',
      tooltip: 'pid与顶级标识相同时,视为顶级节点。',
      required: false
    },
    {
      type: 'multiselect',
      key: 'blacklist',
      label: '黑名单',
src/templates/zshare/modalform/datatable/index.jsx
@@ -174,6 +174,7 @@
      !is(fromJS(this.props.fields), fromJS(nextProps.fields)) ||
      !is(fromJS(this.props.linkSubFields), fromJS(nextProps.linkSubFields)) ||
      this.props.display !== nextProps.display ||
      (nextProps.multiple && this.props.multiple !== nextProps.multiple) ||
      this.props.type !== nextProps.type
    ) {
      this.setState({editingKey: ''}, () => {
@@ -185,9 +186,9 @@
  }
  getCloumns = () => {
    const { display, fields, linkSubFields, transfield, type } = this.props
    const { display, fields, linkSubFields, transfield, type, multiple } = this.props
    let columns = []
    let keys = ['ParentID']
    let keys = ['ParentID', 'pid']
    if (display === 'picture') {
      columns.push({
@@ -241,6 +242,14 @@
      editable: true,
    })
    if (multiple === 'dropdown' && display === 'text') {
      columns.unshift({
        title: 'pid',
        dataIndex: 'pid',
        editable: true,
      })
    }
    if (type === 'link') {
      columns.unshift({
        title: 'ParentID',
src/templates/zshare/modalform/fieldtable/index.jsx
@@ -127,6 +127,26 @@
        this.setState({loading: false})
      })
      return
    } else if (fields.filter(f => f.toLowerCase() === 'parentid').length > 0) {
      notification.warning({
        top: 92,
        message: '字段名不可使用parentid!',
        duration: 5
      })
      this.setState({loading: true}, () => {
        this.setState({loading: false})
      })
      return
    } else if (fields.filter(f => f.toLowerCase() === 'pid').length > 0) {
      notification.warning({
        top: 92,
        message: '字段名不可使用pid!',
        duration: 5
      })
      this.setState({loading: true}, () => {
        this.setState({loading: false})
      })
      return
    }
    this.setState({ data }, () => {
src/utils/utils.js
@@ -800,6 +800,8 @@
        arrfield.push(item.urlField)
      } else if (item.colorField) {
        arrfield.push(item.colorField)
      } else if (item.parentField) {
        arrfield.push(item.parentField)
      }
    }