| | |
| | | |
| | | .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); |
| | | } |
| | | } |
| | |
| | | |
| | | // 数据源查询语句 |
| | | 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')) { |
| | |
| | | } |
| | | } |
| | | item.oriOptions = fromJS(item.options).toJS() |
| | | |
| | | if (item.type === 'checkcard' && item.multiple === 'dropdown' && item.resourceType === '0') { |
| | | this.resetCheckcard(item) |
| | | } |
| | | } |
| | | |
| | | fieldMap.set(item.field, item) |
| | |
| | | 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 |
| | | } |
| | | |
| | | // 查询下拉菜单 |
| | |
| | | }) |
| | | |
| | | item.oriOptions = [...item.oriOptions, ...options] |
| | | |
| | | if (item.type === 'checkcard' && item.multiple === 'dropdown') { |
| | | this.resetCheckcard(item) |
| | | } |
| | | } |
| | | |
| | | if (item.linkField) { |
| | |
| | | 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' |
| | |
| | | </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%' |
| | |
| | | </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> |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | .card-cell { |
| | | border: 0px; |
| | | } |
| | | } |
| | | .mk-search-card { |
| | | .ant-dropdown-menu-item.active { |
| | | color: var(--mk-sys-color); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | state = { |
| | | openType: null, // 搜索条件显示类型 |
| | | resourceType: null, // 下拉搜索时,选项来源类型 |
| | | formlist: null, // 表单 |
| | | cFields: [], |
| | | textTooltip: '字段名可以使用逗号分隔,进行综合搜索', |
| | | formlist: null |
| | | } |
| | | |
| | | record = {} |
| | |
| | | } |
| | | if (this.record.selectStyle === 'custom') { |
| | | shows.push('backgroundColor') |
| | | } |
| | | if (this.record.multiple === 'dropdown') { |
| | | shows.push('mark') |
| | | } |
| | | } |
| | | shows.push('linkField') |
| | |
| | | <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 = [ |
| | |
| | | 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 |
| | |
| | | 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 |
| | | }) |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | 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', |
| | |
| | | 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', |
| | |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'mark', |
| | | label: '顶级标识', |
| | | initVal: card.mark || '', |
| | | tooltip: 'pid与顶级标识相同时,视为顶级节点。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: '黑名单', |
| | |
| | | !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: ''}, () => { |
| | |
| | | } |
| | | |
| | | 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({ |
| | |
| | | editable: true, |
| | | }) |
| | | |
| | | if (multiple === 'dropdown' && display === 'text') { |
| | | columns.unshift({ |
| | | title: 'pid', |
| | | dataIndex: 'pid', |
| | | editable: true, |
| | | }) |
| | | } |
| | | |
| | | if (type === 'link') { |
| | | columns.unshift({ |
| | | title: 'ParentID', |
| | |
| | | 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 }, () => { |
| | |
| | | arrfield.push(item.urlField) |
| | | } else if (item.colorField) { |
| | | arrfield.push(item.colorField) |
| | | } else if (item.parentField) { |
| | | arrfield.push(item.parentField) |
| | | } |
| | | } |
| | | |