| | |
| | | |
| | | item.hidden = false |
| | | |
| | | if (item.forbid && item.del) return false |
| | | |
| | | if (item.forbid) { |
| | | item.hidden = true |
| | | } |
| | |
| | | }) |
| | | this.setState({visible: false}) |
| | | } else { |
| | | notification.success({ |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 2 |
| | | duration: 5 |
| | | }) |
| | | } |
| | | }) |
| | |
| | | state = { |
| | | subMenulist: [], // 二级菜单 |
| | | rootSubmenuKeys: null, |
| | | openKeys: null, |
| | | preview: null |
| | | openKeys: null |
| | | } |
| | | |
| | | async loadsubmenu (menu) { |
| | |
| | | import React from 'react' |
| | | import { useDrag, useDrop } from 'react-dnd' |
| | | import { Popover } from 'antd' |
| | | import { EditOutlined, CopyOutlined, CloseOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import { EditOutlined, CopyOutlined, CloseOutlined, FontColorsOutlined, CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons' |
| | | |
| | | import MkIcon from '@/components/mk-icon' |
| | | import moment from 'moment' |
| | |
| | | if (card.fixStyle === 'alone') { |
| | | let _s = {fontSize: card.fixSize, color: card.fixColor, marginLeft: card.fixLeft, marginRight: card.fixRight} |
| | | val = <><span style={_s}>{card.prefix || ''}</span>{`${card.datatype === 'static' ? (card.value || '') : (card.field || '')}`}<span style={_s}>{card.postfix || ''}</span></> |
| | | } |
| | | if (card.sortField) { |
| | | val = <><span>{val}</span><span className="sort-wrap"><CaretUpOutlined /><CaretDownOutlined /></span></> |
| | | } |
| | | return ( |
| | | <div className={'ant-mk-text line' + (card.height || '')} style={{height: card.innerHeight || 'auto'}}>{val}</div> |
| | |
| | | _style_ = {clear: 'left'} |
| | | } |
| | | |
| | | let tableHCell = false |
| | | if (parent.setting && parent.setting.cardRole === 'header') { |
| | | tableHCell = true |
| | | } |
| | | |
| | | return ( |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | |
| | | <CopyOutlined className="copy" title="复制" onClick={() => copyCard(id)} /> |
| | | <CloseOutlined className="close" title="删除" onClick={() => delCard(id)} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={() => changeStyle(id)}/> |
| | | {['text', 'number', 'slider', 'sequence', 'formula'].includes(card.eleType) ? <MarkColumn field={card.field || ''} columns={fields} type={card.eleType} marks={card.marks} onSubmit={(vals) => updateMarks({...card, marks: vals})} /> : null } |
| | | {['text', 'number', 'slider', 'sequence', 'formula'].includes(card.eleType) && !tableHCell ? <MarkColumn field={card.field || ''} columns={fields} type={card.eleType} marks={card.marks} onSubmit={(vals) => updateMarks({...card, marks: vals})} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | <div ref={node => drag(drop(node))} style={_style_} className={'ant-col card-cell ant-col-' + card.width}> |
| | |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | } |
| | | .sort-wrap { |
| | | position: relative; |
| | | margin-left: 5px; |
| | | font-size: 12px; |
| | | color: #bfbfbf; |
| | | display: none; |
| | | |
| | | .anticon-caret-up { |
| | | position: relative; |
| | | top: -4px; |
| | | } |
| | | .anticon-caret-down { |
| | | position: absolute; |
| | | top: 5px; |
| | | left: 0px; |
| | | } |
| | | } |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { fromJS } from 'immutable' |
| | | import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader } from 'antd' |
| | | import { Form, Row, Col, Input, Select, Radio, Tooltip, InputNumber, Cascader, Popover } from 'antd' |
| | | import { QuestionCircleOutlined } from '@ant-design/icons' |
| | | |
| | | import { formRule } from '@/utils/option.js' |
| | |
| | | |
| | | const cardTypeOptions = { |
| | | sequence: ['eleType', 'width'], |
| | | text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'anchors', 'noValue', 'bgImage', 'fixStyle', 'copyable', 'alignItems'], |
| | | text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link', 'anchors', 'noValue', 'bgImage', 'fixStyle', 'copyable', 'alignItems', 'sortField'], |
| | | number: ['eleType', 'datatype', 'width', 'height', 'prefix', 'postfix', 'noValue', 'fixStyle', 'alignItems'], |
| | | picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'maxWidth', 'link', 'noValue'], |
| | | video: ['eleType', 'datatype', 'width', 'aspectRatio', 'autoPlay', 'loop', 'startTime', 'noValue', 'posterType'], |
| | |
| | | } |
| | | }) |
| | | } |
| | | } else if (item.key === 'sortField' && !item.forbid) { |
| | | item.options = [] |
| | | |
| | | config.columns.forEach(col => { |
| | | let label = `${col.field}(${col.label})` |
| | | item.options.push({ |
| | | value: col.field, |
| | | text: label |
| | | }) |
| | | }) |
| | | |
| | | if (config.subColumns) { |
| | | config.subColumns.forEach(col => { |
| | | let label = `${col.field}(${col.label})` |
| | | item.options.push({ |
| | | value: col.field, |
| | | text: label |
| | | }) |
| | | }) |
| | | } |
| | | } else if (item.key === 'value' && card.eleType === 'slider') { |
| | | item.type = 'number' |
| | | item.label = '值' |
| | | } else if (item.key === 'formula') { |
| | | item.fields = [] |
| | | |
| | | config.columns.forEach(col => { |
| | | item.fields.push(col.field) |
| | | }) |
| | | |
| | | if (config.subColumns) { |
| | | config.subColumns.forEach(col => { |
| | | item.fields.push(col.field) |
| | | }) |
| | | } |
| | | |
| | | item.fields = item.fields.join(', ') |
| | | } else if (item.key === 'value' && card.eleType === 'text') { |
| | | item.type = 'textarea' |
| | | item.label = '内容' |
| | |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'textarea') { |
| | | fields.push( |
| | | <Col span={24} className="textarea" key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | | { |
| | | required: item.readonly ? false : !!item.required, |
| | | message: '请输入' + item.label + '!' |
| | | } |
| | | ] |
| | | })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | if (item.key === 'formula') { |
| | | fields.push( |
| | | <Col span={24} className="textarea" key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | | { |
| | | required: item.readonly ? false : !!item.required, |
| | | message: '请输入' + item.label + '!' |
| | | } |
| | | ] |
| | | })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)} |
| | | </Form.Item> |
| | | <Popover overlayClassName="formula-fields" placement="topLeft" title="" content={<div>{item.fields}</div>} trigger="click"> |
| | | <span className="formula-icon">字段集</span> |
| | | </Popover> |
| | | </Col> |
| | | ) |
| | | } else { |
| | | fields.push( |
| | | <Col span={24} className="textarea" key={index}> |
| | | <Form.Item label={item.tooltip ? |
| | | <Tooltip placement="topLeft" title={item.tooltip}> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | {item.label} |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.key, { |
| | | initialValue: item.initVal || '', |
| | | rules: [ |
| | | { |
| | | required: item.readonly ? false : !!item.required, |
| | | message: '请输入' + item.label + '!' |
| | | } |
| | | ] |
| | | })(<TextArea autoSize={{minRows: 2}} disabled={item.readonly} placeholder={item.placeholder || ''} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | | } |
| | | } else if (item.type === 'number') { |
| | | fields.push( |
| | | <Col span={12} key={index}> |
| | |
| | | height: 65px; |
| | | } |
| | | .ant-col.textarea { |
| | | position: relative; |
| | | min-height: 80px; |
| | | .ant-form-item-label { |
| | | width: 14.2%; |
| | | } |
| | | .ant-form-item-control-wrapper { |
| | | width: 85.8%; |
| | | } |
| | | |
| | | .formula-icon { |
| | | position: absolute; |
| | | bottom: 5px; |
| | | right: 15px; |
| | | cursor: pointer; |
| | | font-size: 12px; |
| | | color: #1890ff; |
| | | } |
| | | } |
| | | } |
| | |
| | | .ant-form-explain, .ant-form-extra { |
| | | font-size: 13px; |
| | | } |
| | | } |
| | | .formula-fields { |
| | | z-index: 1200!important; |
| | | |
| | | .ant-popover-inner-content { |
| | | div { |
| | | max-width: 750px; |
| | | word-break: break-all; |
| | | } |
| | | } |
| | | } |
| | |
| | | tooltip = '在扩展卡片中,动态数据显示值为获取到的第一行数据。' |
| | | } |
| | | |
| | | let isHeader = false |
| | | if (cardCell.$cardType === 'extendCard' && cardCell.setting.cardRole === 'header') { |
| | | isHeader = true |
| | | anchors = null |
| | | card.link = '' |
| | | _options = [{ value: 'text', text: '文本'}] |
| | | } |
| | | |
| | | let width = card.width || 12 |
| | | if (/x/.test(card.width)) { |
| | | width = +width.replace(/x/, '.5') |
| | |
| | | { value: 'MM月DD日 ahh:mm', text: '自定义2(例:12月17日 上午10:57)' }, |
| | | { value: 'calendar1', text: '自定义3(例:今天 上午10:57)' }, |
| | | { value: 'calendar2', text: '自定义4(例:刚刚、昨天、5天前)' }, |
| | | ] |
| | | ], |
| | | forbid: isHeader |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | tooltip: '绑定数据源字段,可根据返回值改变背景图。', |
| | | required: false, |
| | | allowClear: true, |
| | | options: [] |
| | | options: [], |
| | | forbid: isHeader |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | |
| | | { value: '', text: '无' }, |
| | | { value: 'dynamic', text: '动态' }, |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | ], |
| | | forbid: isHeader |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | key: 'alignItems', |
| | | label: '垂直对齐', |
| | | initVal: card.alignItems || '', |
| | | tooltip: '垂直方向的对齐方式。', |
| | | tooltip: '垂直方向的对齐方式。注:高度(行)大于1时有效。', |
| | | required: false, |
| | | options: [ |
| | | { value: '', text: '居上' }, |
| | | { value: 'center', text: '居中' }, |
| | | { value: 'end', text: '居下' } |
| | | ] |
| | | ], |
| | | forbid: isHeader |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | options: [ |
| | | { value: '', text: '统一样式' }, |
| | | { value: 'alone', text: '独立样式' } |
| | | ] |
| | | ], |
| | | forbid: isHeader |
| | | }, |
| | | { |
| | | type: 'radio', |
| | |
| | | options: [ |
| | | { value: 'true', text: '是' }, |
| | | { value: 'false', text: '否' } |
| | | ] |
| | | ], |
| | | forbid: isHeader |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | tooltip: '前缀、后缀的右边距。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'sortField', |
| | | label: '排序字段', |
| | | initVal: card.sortField || '', |
| | | required: false, |
| | | allowClear: true, |
| | | options: [], |
| | | forbid: !isHeader |
| | | }, |
| | | ] |
| | | |
| | | return forms |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps(nextProps) { |
| | | if (this.props.side !== nextProps.side) { |
| | | if (this.props.side !== nextProps.side && nextProps.side) { |
| | | this.setState({ |
| | | elements: fromJS(nextProps.elements).toJS() |
| | | }) |
| | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | |
| | | const NormalForm = asyncIconComponent(() => import('@/components/normalform')) |
| | | const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent')) |
| | | const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) |
| | |
| | | newcard.datatype = 'dynamic' |
| | | newcard.height = 1 |
| | | |
| | | if (card.$cardType === 'extendCard' && card.setting.cardRole === 'header') { |
| | | newcard.datatype = 'static' |
| | | } |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', card.uuid, newcard) |
| | | } |
| | |
| | | updateSetting = (res) => { |
| | | const { card, side, appType } = this.state |
| | | |
| | | if (card.$cardType === 'extendCard' && res.cardRole === 'header') { |
| | | let _card = {...card, setting: res} |
| | | |
| | | let originLength = _card.elements.length |
| | | _card.elements = _card.elements.filter(item => item.eleType === 'text') |
| | | _card.backElements = [] |
| | | |
| | | delete _card.menus |
| | | |
| | | if (_card.elements.length < originLength) { |
| | | const that = this |
| | | |
| | | confirm({ |
| | | title: '表格头仅支持文本,确定要切换卡片角色吗?', |
| | | content: '', |
| | | okText: '确定', |
| | | cancelText: '取消', |
| | | onOk() { |
| | | that.setState({ card: _card, side: '', elements: fromJS(_card.elements).toJS() }, () => { |
| | | that.setState({ side: 'front' }) |
| | | }) |
| | | that.props.updateElement(_card) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | | } else { |
| | | this.setState({ card: _card, side: 'front' }) |
| | | this.props.updateElement(_card) |
| | | } |
| | | |
| | | return |
| | | } |
| | | |
| | | if (appType === '' && res.menu) { |
| | | let list = null |
| | | try { |
| | |
| | | |
| | | let _uuid = Utils.getuuid() |
| | | |
| | | if (card.$cardType === 'extendCard' && card.setting.cardRole === 'header' && element.eleType !== 'text') { |
| | | resolve({status: false, message: '表格头仅支持文本元素!'}) |
| | | return |
| | | } |
| | | |
| | | if (element.copyType === 'action') { |
| | | element.eleType = 'button' |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | let tablerole = '' |
| | | if (card.$cardType === 'extendCard' && card.setting.cardRole === 'header') { |
| | | tablerole = ' mk-table-header' |
| | | } |
| | | |
| | | return ( |
| | | <Col span={card.setting.width || 6}> |
| | | <div className={'card-item ' + (card.setting.btnControl || '') + checkAll} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> |
| | | <div className={'card-item ' + (card.setting.btnControl || '') + checkAll + tablerole} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> |
| | | <span className="circle-select"></span> |
| | | <CardCellComponent cards={cards} cardCell={card} side={side} elements={elements} updateElement={this.updateCard}/> |
| | | <div className="card-control" onDoubleClick={(e) => e.stopPropagation()}> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <PlusOutlined className="plus" title="添加元素" onClick={this.addElement} /> |
| | | <PlusSquareOutlined className="plus" title="添加按钮" onClick={this.addButton} /> |
| | | {!tablerole ? <PlusSquareOutlined className="plus" title="添加按钮" onClick={this.addButton} /> : null} |
| | | <NormalForm title={cards.subtype === 'datacard' && card.$cardType !== 'extendCard' ? '循环卡片设置' : '属性卡片设置'} width={950} update={this.updateSetting} getForms={this.getSettingForms}> |
| | | <EditOutlined className="edit" title="编辑"/> |
| | | </NormalForm> |
| | |
| | | border-radius: 0; |
| | | } |
| | | } |
| | | .card-item.mk-table-header { |
| | | .sort-wrap { |
| | | display: inline; |
| | | } |
| | | } |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'cardRole', |
| | | label: '卡片角色', |
| | | initval: setting.cardRole || 'card', |
| | | required: false, |
| | | options: [ |
| | | {value: 'card', label: '属性卡'}, |
| | | {value: 'header', label: '表格头'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'type', values: ['card']}, |
| | | {field: 'click', values: ['card']}, |
| | | {field: 'btnControl', values: ['card']}, |
| | | ], |
| | | del: true, |
| | | forbid: cardType !== 'extendCard' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'type', |
| | | label: '卡片类型', |
| | | initval: setting.type || 'simple', |
| | |
| | | picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'fieldlength', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span'], |
| | | video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'fieldlength', 'blacklist', 'aspectRatio'], |
| | | colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist'], |
| | | action: ['label', 'type', 'Align', 'Width'], |
| | | formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], |
| | | index: ['label', 'type', 'Align', 'Width'] |
| | |
| | | width: 88%; |
| | | } |
| | | } |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | float: none; |
| | | } |
| | | } |
| | |
| | | text: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'prefix', 'postfix', 'textFormat', 'editable', 'initval', 'blacklist'], |
| | | number: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'decimal', 'format', 'prefix', 'postfix', 'editable', 'initval', 'sum', 'blacklist'], |
| | | textarea: ['label', 'field', 'type', 'Align', 'Hide', 'Width', 'prefix', 'initval', 'postfix', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist'], |
| | | colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], |
| | | action: ['label', 'type', 'Align', 'Width'], |
| | | formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], |
| | |
| | | cursor: pointer; |
| | | font-size: 14px; |
| | | } |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | float: none; |
| | | } |
| | | } |
| | |
| | | picture: ['label', 'field', 'type', 'Align', 'Hide', 'IsSort', 'Width', 'blacklist', 'scale', 'lenWidRadio', 'backgroundSize', 'span'], |
| | | video: ['label', 'field', 'type', 'Align', 'Hide', 'startTime', 'Width', 'blacklist', 'aspectRatio'], |
| | | colspan: ['label', 'type', 'Align', 'Hide', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Hide', 'Width', 'blacklist'], |
| | | custom: ['label', 'type', 'Align', 'Width', 'blacklist'], |
| | | action: ['label', 'type', 'Align', 'Width'], |
| | | formula: ['label', 'type', 'Align', 'Hide', 'Width', 'prefix', 'postfix', 'eval', 'formula', 'blacklist'], |
| | | index: ['label', 'type', 'Align', 'Width'] |
| | |
| | | width: 88%; |
| | | } |
| | | } |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | float: none; |
| | | } |
| | | } |
| | |
| | | import { Form, Tabs, Popconfirm, notification, Modal, Typography, Spin, message, Button, Input } from 'antd' |
| | | import { StopOutlined, CheckCircleOutlined, EditOutlined, SwapOutlined, DeleteOutlined, CopyOutlined, BorderOutlined, SnippetsOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | |
| | | state = { |
| | | columns: [], |
| | | debugId: '', |
| | | subColumns: [], |
| | | activeKey: 'setting', |
| | | loading: false, |
| | |
| | | } |
| | | |
| | | sqlverify = (resolve, reject, change = false, testScripts) => { |
| | | const { columns, setting, scripts, searches, defaultSearch } = this.state |
| | | const { columns, setting, scripts, searches, defaultSearch, debugId } = this.state |
| | | |
| | | let _scripts = scripts.filter(item => item.status !== 'false') |
| | | |
| | |
| | | if ((setting.interType === 'system' && setting.execute !== 'false') || _scripts.length > 0) { |
| | | let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | let r = SettingUtils.getDebugSql(setting, _scripts, columns, searches, defaultSearch, timestamp) |
| | | |
| | | let _debugId = md5(r.sql) |
| | | |
| | | if (debugId === _debugId) { |
| | | resolve() |
| | | return |
| | | } |
| | | |
| | | if (r.errors) { |
| | | notification.warning({ |
| | |
| | | if (sumParam) { |
| | | Api.genericInterface(sumParam).then(res => { |
| | | if (res.status) { |
| | | this.setState({debugId: _debugId}) |
| | | resolve() |
| | | } else { |
| | | reject() |
| | |
| | | } |
| | | }) |
| | | } else { |
| | | this.setState({debugId: _debugId}) |
| | | resolve() |
| | | } |
| | | } else { |
| | |
| | | '10:1': '10%', '3:4': '133.33%', '2:3': '150%', '9:16': '177.78%' |
| | | } |
| | | |
| | | class TextCell extends Component { |
| | | componentDidMount() { |
| | | if (this.node && this.node.scrollHeight > this.node.offsetHeight) { |
| | | this.node.style.display = 'block' |
| | | } |
| | | } |
| | | |
| | | componentDidUpdate() { |
| | | if (this.node) { |
| | | if (this.node.scrollHeight > this.node.offsetHeight) { |
| | | this.node.style.display = 'block' |
| | | } else { |
| | | this.node.style.display = 'flex' |
| | | } |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { card, className, value } = this.props |
| | | |
| | | let lineStyle = {height: card.innerHeight} |
| | | lineStyle.display = 'flex' |
| | | lineStyle.alignItems = card.alignItems |
| | | lineStyle.justifyContent = card.style.textAlign || 'left' |
| | | |
| | | return ( |
| | | <div ref={ref => this.node = ref} className={className} style={lineStyle}>{value}</div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | class CardCellComponent extends Component { |
| | | static propTpyes = { |
| | | cards: PropTypes.object, // 菜单配置信息 |
| | |
| | | className = mark.signType |
| | | } |
| | | contents.push( |
| | | <Col key={card.uuid} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={card.style}> |
| | | <div className={'ant-mk-text line1' + className} style={{height: card.innerHeight || 'auto'}}><span className="sequence-wrap" style={_style}>{data.$Index || ''}</span></div> |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'text') { |
| | | let val = '' |
| | | let _style = card.style ? {...card.style} : {} |
| | | let _style = {...card.style} |
| | | |
| | | if (card.datatype === 'static') { |
| | | val = card.value || '' |
| | |
| | | if (card.bgImage && data[card.bgImage]) { |
| | | _style.backgroundImage = `url('${data[card.bgImage]}')` |
| | | } |
| | | |
| | | let lineStyle = {height: card.innerHeight || 'auto'} |
| | | if (card.alignItems) { |
| | | lineStyle.display = 'flex' |
| | | lineStyle.alignItems = card.alignItems |
| | | lineStyle.justifyContent = _style.textAlign || 'left' |
| | | } |
| | | |
| | | contents.push( |
| | | <Col key={card.uuid} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={lineStyle}>{val}</div> |
| | | {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'number') { |
| | | let val = '' |
| | | let _style = card.style ? {...card.style} : {} |
| | | let _style = {...card.style} |
| | | |
| | | if (card.datatype === 'static') { |
| | | val = card.value |
| | |
| | | className = mark.signType |
| | | } |
| | | |
| | | let lineStyle = {height: card.innerHeight || 'auto'} |
| | | if (card.alignItems) { |
| | | lineStyle.display = 'flex' |
| | | lineStyle.alignItems = card.alignItems |
| | | lineStyle.justifyContent = _style.textAlign || 'left' |
| | | } |
| | | |
| | | contents.push( |
| | | <Col key={card.uuid} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={_style}> |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={lineStyle}>{val}</div> |
| | | {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'icon') { |
| | | let val = '' |
| | | let icon = '' |
| | | let height = card.innerHeight |
| | | |
| | | if (card.datatype === 'dynamic') { |
| | | icon = data[card.field] || '' |
| | |
| | | if (!icon && card.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | | if (!height) { // 兼容 |
| | | let fontSize = 14 |
| | | let lineHeight = 1.5 |
| | | |
| | | if (card.style.fontSize) { |
| | | fontSize = parseInt(card.style.fontSize) |
| | | } |
| | | if (card.style.lineHeight) { |
| | | lineHeight = parseFloat(card.style.lineHeight) |
| | | } |
| | | |
| | | height = fontSize * lineHeight |
| | | } |
| | | |
| | | if (data.hasOwnProperty(card.tooltip)) { |
| | | val = data[card.tooltip] |
| | |
| | | } |
| | | |
| | | contents.push( |
| | | <Col key={card.uuid} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={card.style}> |
| | | {val ? <Tooltip title={val}> |
| | | <MkIcon className="ant-mk-icon" style={{height: height}} type={icon}/> |
| | | </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: height}} type={icon}/>} |
| | | <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/> |
| | | </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/>} |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'slider') { |
| | | let val = 0 |
| | |
| | | } |
| | | |
| | | contents.push( |
| | | <Col key={card.uuid} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={card.style}> |
| | | <MkProgress value={val} config={card} color={color}/> |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'picture') { |
| | | let _imagestyle = {} |
| | | let _style = card.style ? {margin: '0 auto', ...card.style} : {} |
| | | let _style = {margin: '0 auto', ...card.style} |
| | | let url = '' |
| | | if (card.maxWidth) { |
| | | _style.maxWidth = card.maxWidth |
| | |
| | | let urls = url ? url.split(',').filter(Boolean) : [''] |
| | | |
| | | urls.forEach((u, i) => { |
| | | contents.push(<Col key={card.uuid + i} style={_style_} span={card.width}> |
| | | contents.push(<div className={'ant-col ant-col-' + card.width} key={card.uuid + i} style={_style_} span={card.width}> |
| | | <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> |
| | | <MkPicture style={_imagestyle} scale={scale} url={u} urls={urls}/> |
| | | </div> |
| | | </Col>) |
| | | </div>) |
| | | }) |
| | | } else if (card.eleType === 'splitline') { |
| | | let _borderWidth = card.borderWidth === undefined ? 1 : card.borderWidth |
| | | _style_ = _style_ || {} |
| | | _style_.minHeight = _borderWidth |
| | | contents.push( |
| | | <Col key={card.uuid} span={card.width} style={_style_}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} span={card.width} style={_style_}> |
| | | <div style={card.style}> |
| | | <div className="ant-mk-splitline" style={{borderColor: card.color, borderWidth: _borderWidth}}></div> |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'barcode') { |
| | | let val = '' |
| | |
| | | } |
| | | |
| | | contents.push( |
| | | <Col key={card.uuid} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={card.style}> |
| | | <div style={{height: card.innerHeight || 25}}> |
| | | {val ? <BarCode card={card} value={val}/> : null} |
| | | </div> |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'video') { |
| | | let url = '' |
| | |
| | | |
| | | urls.forEach((u, i) => { |
| | | contents.push( |
| | | <Col key={card.uuid + i} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid + i} style={_style_} span={card.width}> |
| | | <div className="video-wrap" style={card.style}> |
| | | <Video card={card} poster={poster} value={u}/> |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | }) |
| | | } else if (card.eleType === 'qrcode') { |
| | |
| | | } |
| | | |
| | | contents.push( |
| | | <Col key={card.uuid} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={card.style}> |
| | | <div style={{minHeight: card.qrWidth || 50}}> |
| | | {val ? <QrCode card={card} value={val}/> : null} |
| | | </div> |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'currentDate') { |
| | | let val = moment().format(card.dateFormat || 'YYYY-MM-DD') |
| | |
| | | } |
| | | |
| | | contents.push( |
| | | <Col key={card.uuid} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={card.style}> |
| | | <div className="ant-mk-text line1" style={{height: card.innerHeight || 'auto'}}>{val}</div> |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'formula') { |
| | | let val = 0 |
| | | let _style = card.style ? {...card.style} : {} |
| | | let _style = {...card.style} |
| | | |
| | | if (card.$sync) { |
| | | if (card.eval === 'false') { |
| | |
| | | className = mark.signType |
| | | } |
| | | |
| | | let lineStyle = {height: card.innerHeight || 'auto'} |
| | | if (card.alignItems) { |
| | | lineStyle.display = 'flex' |
| | | lineStyle.alignItems = card.alignItems |
| | | lineStyle.justifyContent = _style.textAlign || 'left' |
| | | } |
| | | |
| | | contents.push( |
| | | <Col key={card.uuid} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div style={_style}> |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={lineStyle}>{val}</div> |
| | | {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : |
| | | <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'color') { |
| | | let color = '' |
| | |
| | | } |
| | | |
| | | contents.push( |
| | | <Col key={card.uuid} style={_style_} span={card.width}> |
| | | <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <div className="ant-mk-color" style={card.style}> |
| | | <div style={_bgstyle} onClick={(e) => { |
| | | if (card.copyable === 'true') { |
| | |
| | | } |
| | | }}></div> |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.eleType === 'button') { |
| | | let _disabled = data.$disabled |
| | |
| | | |
| | | if (['exec', 'prompt', 'pop', 'form'].includes(card.OpenType)) { |
| | | contents.push( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={_style_} span={card.width}> |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <NormalButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | |
| | | columns={cards.columns} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.OpenType === 'excelIn') { |
| | | contents.push( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={_style_} span={card.width}> |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <ExcelInButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.OpenType === 'excelOut') { |
| | | contents.push( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={_style_} span={card.width}> |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <ExcelOutButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.OpenType === 'popview') { |
| | | contents.push( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={_style_} span={card.width}> |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <PopupButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.OpenType === 'tab') { |
| | | contents.push( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={_style_} span={card.width}> |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <TabButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | |
| | | disabled={_disabled} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.OpenType === 'innerpage') { |
| | | contents.push( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={_style_} span={card.width}> |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <NewPageButton |
| | | btn={card} |
| | | BData={data.$$BData || ''} |
| | | disabled={_disabled} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.OpenType === 'funcbutton') { |
| | | if (card.funcType === 'changeuser' || card.funcType === 'closetab') { |
| | | contents.push( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={_style_} span={card.width}> |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <ChangeUserButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.funcType === 'print') { |
| | | contents.push( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={_style_} span={card.width}> |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <PrintButton |
| | | btn={card} |
| | | BID={data.$$BID} |
| | |
| | | columns={cards.columns} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.funcType === 'megvii') { |
| | | contents.push( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={_style_} span={card.width}> |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <FuncMegvii |
| | | btn={card} |
| | | BID={data.$$BID} |
| | |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } else if (card.funcType === 'filezip') { |
| | | contents.push( |
| | | <Col key={card.uuid} className="mk-cell-btn" style={_style_} span={card.width}> |
| | | <div className={'ant-col mk-cell-btn ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> |
| | | <FuncZip |
| | | btn={card} |
| | | BID={data.$$BID} |
| | |
| | | setting={cards.setting} |
| | | selectedData={_data} |
| | | /> |
| | | </Col> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | |
| | | return ( |
| | | <div className={'card-cell-list ' + (cardCell && cardCell.setting && cardCell.setting.layout === 'flex' ? 'mk-flex' : '')}> |
| | | {this.getContent()} |
| | | <Col style={{display: 'none'}} span={24}></Col> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | import './index.scss' |
| | | |
| | | const CardItem = asyncComponent(() => import('../cardItem')) |
| | | const TableHeader = asyncComponent(() => import('../tableHeader')) |
| | | const MainAction = asyncComponent(() => import('@/tabviews/zshare/actionList')) |
| | | const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) |
| | | |
| | |
| | | search: null, // 搜索条件 |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, |
| | | orderBy: '', |
| | | pageOptions: [], |
| | | activeKey: '', // 选中卡 |
| | | selectKeys: [], // 多选时选中卡片 |
| | |
| | | } |
| | | } |
| | | |
| | | _config.$extend = false |
| | | |
| | | _config.subcards.forEach(item => { |
| | | if (item.setting.click === 'button' && !item.setting.linkbtn) { |
| | | item.elements.forEach(ele => { |
| | |
| | | if (item.$cardType !== 'extendCard') { |
| | | _card = item |
| | | } else if (!_card) { |
| | | _config.$extend = true |
| | | precards.push(item) |
| | | } else { |
| | | _config.$extend = true |
| | | nextcards.push(item) |
| | | } |
| | | }) |
| | |
| | | this.loaded = _data !== null |
| | | |
| | | let pageOptions = ['10', '25', '50', '100', '500', '1000'] |
| | | |
| | | if (!_config.setting.laypage) { |
| | | _config.wrap.pagestyle = 'none' |
| | | } |
| | | |
| | | if (_config.wrap.pagestyle === 'page') { |
| | | let size = (_config.setting.pageSize || 10) + '' |
| | |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { mainSearch } = this.props |
| | | const { arr_field, config, search } = this.state |
| | | const { arr_field, config, search, orderBy } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | orderBy: orderBy ||config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | }) |
| | |
| | | |
| | | async loadData (id, type) { |
| | | const { mainSearch } = this.props |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData, selected } = this.state |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData, selected, orderBy } = this.state |
| | | |
| | | if (config.setting.supModule && !BID && config.wrap.supKey !== 'false') { // BID 不存在时,不做查询 |
| | | this.loaded = true |
| | |
| | | }) |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let _orderBy = orderBy || config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | |
| | | */ |
| | | async loadLinedata (id) { |
| | | const { mainSearch } = this.props |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData } = this.state |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData, orderBy } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | loading: true |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let _orderBy = orderBy || config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | |
| | | } |
| | | } |
| | | |
| | | refreshByHeader = (sorter) => { |
| | | this.setState({ |
| | | orderBy: sorter || '' |
| | | }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { config, precards, nextcards, loading, data, pageIndex, pageSize, total, card, activeKey, BID, BData, selectedData, selectKeys } = this.state |
| | | |
| | |
| | | |
| | | let _total = 0 |
| | | let switchable = false |
| | | if (config.wrap.pagestyle === 'switch' && config.pageable && config.setting.laypage && total > pageSize && data) { |
| | | if (config.wrap.pagestyle === 'switch' && total > pageSize && data) { |
| | | _total = pageSize * pageIndex |
| | | switchable = true |
| | | } |
| | | |
| | | let extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'} |
| | | let extendData = null |
| | | |
| | | if (data && data[0]) { |
| | | extendData = {...extendData, ...data[0]} |
| | | if (config.$extend) { |
| | | extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'} |
| | | |
| | | if (data && data[0]) { |
| | | if (selectedData[0]) { |
| | | extendData = {...extendData, ...selectedData[0]} |
| | | } else { |
| | | extendData = {...extendData, ...data[0]} |
| | | } |
| | | } |
| | | } |
| | | |
| | | let checkAll = '' |
| | |
| | | <Row className={'card-row-list ' + config.wrap.layout}> |
| | | {precards.map((item, index) => ( |
| | | <Col key={'pre' + index} className="extend-card" span={item.setting.width || 6}> |
| | | <CardItem card={item} cards={config} data={extendData}> |
| | | {item.setting.cardRole === 'header' ? <TableHeader card={item} data={extendData} refresh={this.refreshByHeader}> |
| | | {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} |
| | | </CardItem> |
| | | </TableHeader> : <CardItem card={item} cards={config} data={extendData}> |
| | | {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} |
| | | </CardItem>} |
| | | </Col> |
| | | ))} |
| | | {data && data.map((item, index) => { |
| | |
| | | })} |
| | | {nextcards.map((item, index) => ( |
| | | <Col key={'next' + index} className="extend-card" span={item.setting.width || 6}> |
| | | <CardItem card={item} cards={config} data={extendData}> |
| | | {item.setting.cardRole === 'header' ? <TableHeader card={item} data={extendData} refresh={this.refreshByHeader}> |
| | | {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} |
| | | </CardItem> |
| | | </TableHeader> : <CardItem card={item} cards={config} data={extendData}> |
| | | {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} |
| | | </CardItem>} |
| | | </Col> |
| | | ))} |
| | | </Row> |
| | | {switchable ? <div className={'prev-page ' + (total <= _total ? 'disabled' : '')} onClick={this.nextPage}><div><div><img src={nextImg} alt=""/></div></div></div> : null} |
| | | {precards.length === 0 && nextcards.length === 0 && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | {!config.$extend && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | </div> |
| | | {config.wrap.pagestyle === 'page' && config.setting.laypage && data ? <Pagination size="small" total={total} showTotal={(t, range) => `${range[0]}-${range[1]} 共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && config.setting.laypage && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | import './index.scss' |
| | | |
| | | const CardItem = asyncComponent(() => import('../cardItem')) |
| | | const TableHeader = asyncComponent(() => import('../tableHeader')) |
| | | const MainAction = asyncComponent(() => import('@/tabviews/zshare/actionList')) |
| | | const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) |
| | | |
| | |
| | | search: null, // 搜索条件 |
| | | pageIndex: 1, // 页码 |
| | | pageSize: 10, |
| | | orderBy: '', |
| | | pageOptions: [], |
| | | activeKey: '', // 选中卡 |
| | | selectKeys: [], // 多选时选中卡片 |
| | |
| | | } |
| | | } |
| | | |
| | | _config.$extend = false |
| | | |
| | | _config.subcards.forEach(item => { |
| | | if (item.setting.click === 'button' && !item.setting.linkbtn) { |
| | | item.elements.forEach(ele => { |
| | |
| | | if (item.$cardType !== 'extendCard') { |
| | | _card = item |
| | | } else if (!_card) { |
| | | _config.$extend = true |
| | | precards.push(item) |
| | | } else { |
| | | _config.$extend = true |
| | | nextcards.push(item) |
| | | } |
| | | }) |
| | |
| | | |
| | | _config.setting.sub_field = subconfig.columns.map(col => col.field).join(',') |
| | | let pageOptions = ['10', '25', '50', '100', '500', '1000'] |
| | | |
| | | if (!_config.setting.laypage) { |
| | | _config.wrap.pagestyle = 'none' |
| | | } |
| | | |
| | | if (_config.wrap.pagestyle === 'page') { |
| | | let size = (_config.setting.pageSize || 10) + '' |
| | |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { mainSearch } = this.props |
| | | const { arr_field, config, search } = this.state |
| | | const { arr_field, config, search, orderBy } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | orderBy: orderBy || config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | }) |
| | |
| | | |
| | | async loadData (id, type) { |
| | | const { mainSearch } = this.props |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData, selected, card } = this.state |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData, selected, card, orderBy } = this.state |
| | | |
| | | if (config.setting.supModule && !BID && config.wrap.supKey !== 'false') { // BID 不存在时,不做查询 |
| | | this.loaded = true |
| | |
| | | }) |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let _orderBy = orderBy || config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | |
| | | */ |
| | | async loadLinedata (id) { |
| | | const { mainSearch } = this.props |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData } = this.state |
| | | const { config, arr_field, pageIndex, pageSize, search, BID, BData, orderBy } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | |
| | | loading: true |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let _orderBy = orderBy || config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | |
| | | } |
| | | } |
| | | |
| | | refreshByHeader = (sorter) => { |
| | | this.setState({ |
| | | orderBy: sorter || '' |
| | | }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const { config, precards, nextcards, loading, data, pageIndex, pageSize, total, card, activeKey, BID, BData, selectedData, selectKeys, subcard, subconfig, wrapStyle, opens } = this.state |
| | | |
| | | if (config.wrap.empty === 'hidden' && (!data || data.length === 0)) return null |
| | | |
| | | let extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'} |
| | | let extendData = null |
| | | |
| | | if (data && data[0]) { |
| | | extendData = {...extendData, ...data[0]} |
| | | if (config.$extend) { |
| | | extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'} |
| | | |
| | | if (data && data[0]) { |
| | | if (selectedData[0]) { |
| | | extendData = {...extendData, ...selectedData[0]} |
| | | } else { |
| | | extendData = {...extendData, ...data[0]} |
| | | } |
| | | } |
| | | } |
| | | |
| | | let checkAll = '' |
| | |
| | | <Row className={'card-row-list '}> |
| | | {precards.map((item, index) => ( |
| | | <Col key={'pre' + index} className="extend-card" span={item.setting.width || 6}> |
| | | <CardItem card={item} cards={config} data={extendData}> |
| | | {item.setting.cardRole === 'header' ? <TableHeader card={item} data={extendData} refresh={this.refreshByHeader}> |
| | | {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} |
| | | </CardItem> |
| | | </TableHeader> : <CardItem card={item} cards={config} data={extendData}> |
| | | {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} |
| | | </CardItem>} |
| | | </Col> |
| | | ))} |
| | | {data && data.map((item, index) => { |
| | |
| | | })} |
| | | {nextcards.map((item, index) => ( |
| | | <Col key={'next' + index} className="extend-card" span={item.setting.width || 6}> |
| | | <CardItem card={item} cards={config} data={extendData}> |
| | | {item.setting.cardRole === 'header' ? <TableHeader card={item} data={extendData} refresh={this.refreshByHeader}> |
| | | {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} |
| | | </CardItem> |
| | | </TableHeader> : <CardItem card={item} cards={config} data={extendData}> |
| | | {item.setting.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} |
| | | </CardItem>} |
| | | </Col> |
| | | ))} |
| | | </Row> |
| | | {precards.length === 0 && nextcards.length === 0 && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | {!config.$extend && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | </div> |
| | | </div> |
| | | {config.wrap.pagestyle === 'page' && config.setting.laypage && data ? <Pagination size="small" total={total} showTotal={(t, range) => `${range[0]}-${range[1]} 共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && config.setting.laypage && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | showHeader = true |
| | | } |
| | | |
| | | _config.wrap.pagestyle = _config.wrap.pagestyle || 'page' |
| | | |
| | | if (_config.setting.laypage) { |
| | | _config.wrap.contentHeight = showHeader ? 'calc(100% - 85px)' : 'calc(100% - 40px)' |
| | | } else { |
| | | _config.wrap.pagestyle = 'none' |
| | | _config.wrap.contentHeight = showHeader ? 'calc(100% - 45px)' : '100%' |
| | | } |
| | | |
| | | _config.wrap.pagestyle = _config.wrap.pagestyle || 'page' |
| | | |
| | | this.loaded = _data !== null |
| | | |
| | |
| | | {data && data.length === 0 ? <div className="card-row-list" style={{height: config.wrap.contentHeight}}> |
| | | <Empty description={false}/> |
| | | </div> : null} |
| | | {config.setting.laypage && config.wrap.pagestyle === 'page' ? <Pagination size="small" current={pageIndex} total={total} onChange={this.changePageIndex} /> : null} |
| | | {config.setting.laypage && config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (config.setting.pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | {config.wrap.pagestyle === 'page' ? <Pagination size="small" current={pageIndex} total={total} onChange={this.changePageIndex} /> : null} |
| | | {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (config.setting.pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | </div> |
| | | ) |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { CaretUpOutlined, CaretDownOutlined } from '@ant-design/icons' |
| | | |
| | | import './index.scss' |
| | | |
| | | class TableHeader extends Component { |
| | | static propTpyes = { |
| | | card: PropTypes.object, // 卡片配置信息 |
| | | data: PropTypes.object, |
| | | refresh: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | sortField: '', |
| | | order: '' |
| | | } |
| | | |
| | | /** |
| | | * @description 搜索条件初始化 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props), fromJS(nextProps)) |
| | | } |
| | | |
| | | /** |
| | | * @description 组件销毁,清除state更新,清除快捷键设置 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | triggerHeader = (item) => { |
| | | const { sortField, order } = this.state |
| | | |
| | | if (!item.sortField) return |
| | | |
| | | if (item.sortField !== sortField) { |
| | | this.setState({sortField: item.sortField, order: 'asc'}) |
| | | |
| | | this.props.refresh(item.sortField + ' asc') |
| | | } else { |
| | | if (order === 'asc') { |
| | | this.setState({order: 'desc'}) |
| | | this.props.refresh(item.sortField + ' desc') |
| | | } else if (order === 'desc') { |
| | | this.setState({sortField: '', order: ''}) |
| | | this.props.refresh('') |
| | | } |
| | | } |
| | | } |
| | | |
| | | getContent = () => { |
| | | const { data, card } = this.props |
| | | const { sortField, order } = this.state |
| | | |
| | | let contents = [] |
| | | |
| | | card.elements.forEach(item => { |
| | | if (item.eleType !== 'text') return |
| | | |
| | | let _style_ = null |
| | | |
| | | if (item.style && item.style.clear === 'left') { |
| | | _style_ = {clear: 'left'} |
| | | } |
| | | |
| | | let val = '' |
| | | let _style = item.style ? {...item.style} : {} |
| | | |
| | | if (item.datatype === 'static') { |
| | | val = item.value || '' |
| | | if (/@username@|@fullName@|@mk_city@|@bid@/ig.test(val)) { |
| | | let userName = sessionStorage.getItem('User_Name') || '' |
| | | let fullName = sessionStorage.getItem('Full_Name') || '' |
| | | let city = sessionStorage.getItem('city') || '' |
| | | let bid = data.$$BID || '' |
| | | val = val.replace(/@username@/ig, userName).replace(/@fullName@/ig, fullName).replace(/@mk_city@/ig, city).replace(/@bid@/ig, bid) |
| | | } else if (/@month@/ig.test(val)) { |
| | | val = val.replace(/@month@/ig, new Date().toLocaleString('en-US', { month: 'long' })) |
| | | } else if (/@week@/ig.test(val)) { |
| | | val = val.replace(/@week@/ig, (() => { |
| | | let day = new Date().getDay() |
| | | let weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'] |
| | | return weeks[day] |
| | | })()) |
| | | } else if (/@day@/ig.test(val)) { |
| | | val = val.replace(/@day@/ig, (() => { |
| | | let day = new Date().getDate() |
| | | return day < 10 ? '0' + day : day |
| | | })()) |
| | | } |
| | | } else if (data.hasOwnProperty(item.field)) { |
| | | val = data[item.field] |
| | | } |
| | | |
| | | if (val === '' && item.noValue === 'hide') { // 空值隐藏 |
| | | return null |
| | | } |
| | | |
| | | if (val !== '') { |
| | | if (item.sortField) { |
| | | val = <> |
| | | <span className="mk-content">{item.prefix || ''}{val}{item.postfix || ''}</span> |
| | | <span className="sort-wrap"><CaretUpOutlined /><CaretDownOutlined /></span> |
| | | </> |
| | | } else { |
| | | val = <span>{item.prefix || ''}{val}{item.postfix || ''}</span> |
| | | } |
| | | } |
| | | |
| | | let lineStyle = {height: item.innerHeight || 'auto', display: 'flex', alignItems: 'center', justifyContent: _style.textAlign || 'left'} |
| | | |
| | | let extra = '' |
| | | if (item.sortField) { |
| | | extra = ' sortable' |
| | | |
| | | if (item.sortField === sortField) { |
| | | if (order === 'asc') { |
| | | extra += ' up-sort' |
| | | } else { |
| | | extra += ' down-sort' |
| | | } |
| | | } |
| | | } |
| | | |
| | | contents.push( |
| | | <div className={'ant-col ant-col-' + item.width + extra} onClick={() => this.triggerHeader(item)} key={item.uuid} style={_style_} span={item.width}> |
| | | <div style={_style}> |
| | | <div className={'ant-mk-text mk-header-cell line' + (item.height || '')} style={lineStyle}>{val}</div> |
| | | </div> |
| | | </div> |
| | | ) |
| | | }) |
| | | |
| | | return contents |
| | | } |
| | | |
| | | render() { |
| | | const { card, children } = this.props |
| | | |
| | | return ( |
| | | <div className={'card-item-box mk-table-header'} style={card.style}> |
| | | {children} |
| | | <div className={'card-cell-list ' + (card.setting.layout === 'flex' ? 'mk-flex' : '')}> |
| | | {this.getContent()} |
| | | </div> |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default TableHeader |
New file |
| | |
| | | .card-item-box.mk-table-header { |
| | | position: relative; |
| | | overflow: hidden; |
| | | |
| | | .mk-content { |
| | | display: inline-block; |
| | | white-space: normal; |
| | | max-width: calc(100% - 20px); |
| | | } |
| | | .sort-wrap { |
| | | position: relative; |
| | | margin-left: 10px; |
| | | font-size: 12px; |
| | | color: #bfbfbf; |
| | | display: inline-block; |
| | | |
| | | .anticon-caret-up { |
| | | position: relative; |
| | | top: -3px; |
| | | } |
| | | .anticon-caret-down { |
| | | position: absolute; |
| | | top: 7px; |
| | | left: 0px; |
| | | } |
| | | } |
| | | .sortable { |
| | | cursor: pointer; |
| | | } |
| | | .sortable.up-sort { |
| | | .anticon-caret-up { |
| | | color: var(--mk-sys-color); |
| | | } |
| | | } |
| | | .sortable.down-sort { |
| | | .anticon-caret-down { |
| | | color: var(--mk-sys-color); |
| | | } |
| | | } |
| | | .sortable:hover { |
| | | .mk-content { |
| | | color: var(--mk-sys-color); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } else if (col.type === 'custom') { |
| | | col.elements = col.elements.map(cell => { |
| | | if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } |
| | | cell = this.resetElement(cell) |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | item.action = item.action.filter(cell => { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | cell.$toolbtn = true |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | if (cell.btnstyle) { // 兼容 |
| | | cell.style = cell.style || {} |
| | | cell.style = {...cell.style, ...cell.btnstyle} |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | return skip || permAction[cell.uuid] |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | } else if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return cell.eleType !== 'button' || skip || permAction[cell.uuid] |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | } else if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return cell.eleType !== 'button' || skip || permAction[cell.uuid] |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (cell.syncComponentId === item.wrap.supModule) { |
| | | cell.syncComponentId = '' |
| | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | } else if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return cell.eleType !== 'button' || skip || permAction[cell.uuid] |
| | |
| | | if (col.type !== 'action') return true |
| | | col.elements = col.elements.filter(cell => { |
| | | if (cell.hidden === 'true') return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | |
| | | cell = this.resetButton(item, cell, popview) |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | |
| | | |
| | | if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 打印机设置 |
| | | cell = this.getPrinter(cell, item.uuid) |
| | | } |
| | | |
| | | if (cell.btnstyle) { // 兼容 |
| | | cell.style = cell.style || {} |
| | | cell.style = {...cell.style, ...cell.btnstyle} |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | return skip || permAction[cell.uuid] |
| | |
| | | |
| | | return true |
| | | }) |
| | | } |
| | | |
| | | resetButton = (item, cell, popview) => { |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.ContainerId = this.state.ContainerId |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = this.props.MenuID |
| | | cell.$view = popview |
| | | |
| | | if (cell.btnstyle) { // 兼容 |
| | | cell.style = cell.style || {} |
| | | cell.style = {...cell.style, ...cell.btnstyle} |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | } |
| | | |
| | | resetElement = (cell) => { |
| | | cell.style = cell.style || {} |
| | | if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | |
| | | cell.innerHeight = cell.innerHeight || 'auto' |
| | | cell.alignItems = cell.height > 1 ? cell.alignItems : '' |
| | | |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else if (cell.eleType === 'icon') { |
| | | if (!cell.innerHeight) { // 兼容 |
| | | let fontSize = 14 |
| | | let lineHeight = 1.5 |
| | | |
| | | if (cell.style.fontSize) { |
| | | fontSize = parseInt(cell.style.fontSize) |
| | | } |
| | | if (cell.style.lineHeight) { |
| | | lineHeight = parseFloat(cell.style.lineHeight) |
| | | } |
| | | |
| | | cell.innerHeight = fontSize * lineHeight |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | } |
| | | |
| | | getPrinter = (item, parentId) => { |
| | |
| | | const { loadingview, viewlost, config, loading, shortcuts, BID } = this.state |
| | | |
| | | return ( |
| | | <div className={'custom-page-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}> |
| | | <div className={`custom-page-wrap ${config && config.minWidth ? 'mk-scroll' : ''} ${loadingview || loading ? 'loading' : ''}`} id={this.state.ContainerId} style={config ? config.style : null}> |
| | | {(loadingview || (loading && !config.$cache)) ? <Spin className="view-spin" size="large" /> : null} |
| | | <Row id={config ? 'menu' + config.uuid : ''} className="component-wrap">{this.getComponents()}</Row> |
| | | <Row id={config ? 'menu' + config.uuid : ''} style={config && config.minWidth ? {minWidth: config.minWidth} : null} className="component-wrap">{this.getComponents()}</Row> |
| | | {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null} |
| | | {config && window.GLOB.breakpoint ? <DebugTable /> : null} |
| | | {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null} |
| | |
| | | display: none; |
| | | } |
| | | } |
| | | .custom-page-wrap.mk-scroll { |
| | | height: calc(100vh - 93px); |
| | | overflow: auto; |
| | | margin: 0!important; |
| | | } |
| | |
| | | } |
| | | } else if (col.type === 'custom') { |
| | | col.elements = col.elements.map(cell => { |
| | | if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } |
| | | cell = this.resetElement(cell) |
| | | return cell |
| | | }) |
| | | } |
| | |
| | | item.action = item.action.filter(cell => { |
| | | if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | cell = this.resetButton(item, cell, Tab) |
| | | cell.$toolbtn = true |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.btnstyle) { // 兼容 |
| | | cell.style = cell.style || {} |
| | | cell.style = {...cell.style, ...cell.btnstyle} |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | cell = this.resetButton(item, cell, Tab) |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | } else if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return true |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | cell = this.resetButton(item, cell, Tab) |
| | | |
| | | if (!mutil && cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | } else if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return true |
| | |
| | | if (cell.eleType === 'button') { |
| | | if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | cell = this.resetButton(item, cell, Tab) |
| | | |
| | | if (cell.syncComponentId === item.wrap.supModule) { |
| | | cell.syncComponentId = '' |
| | |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | } else if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else { |
| | | cell = this.resetElement(cell) |
| | | } |
| | | |
| | | return true |
| | |
| | | col.elements = col.elements.filter(cell => { |
| | | if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false |
| | | |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | cell = this.resetButton(item, cell, Tab) |
| | | |
| | | if (cell.syncComponentId === item.setting.supModule) { |
| | | cell.syncComponentId = '' |
| | | if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { |
| | | cell.execSuccess = 'mainline' |
| | | } |
| | | } |
| | | |
| | | if (cell.btnstyle) { // 兼容 |
| | | cell.style = cell.style || {} |
| | | cell.style = {...cell.style, ...cell.btnstyle} |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | resetButton = (item, cell, Tab) => { |
| | | cell.logLabel = item.$menuname + '-' + cell.label |
| | | cell.Ot = cell.Ot || 'requiredSgl' |
| | | cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' |
| | | cell.$menuId = item.uuid |
| | | cell.$MenuID = Tab.$MenuID |
| | | cell.$tabId = Tab.uuid |
| | | |
| | | if (cell.btnstyle) { // 兼容 |
| | | cell.style = cell.style || {} |
| | | cell.style = {...cell.style, ...cell.btnstyle} |
| | | } |
| | | |
| | | if (cell.controlField) { |
| | | if (/,/ig.test(cell.controlVal)) { |
| | | cell.controlVals = cell.controlVal.split(',') |
| | | } else { |
| | | cell.controlVals = [(cell.controlVal || '')] |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | } |
| | | |
| | | resetElement = (cell) => { |
| | | cell.style = cell.style || {} |
| | | if (['text', 'number', 'formula'].includes(cell.eleType)) { |
| | | if (!cell.height) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | |
| | | cell.innerHeight = cell.innerHeight || 'auto' |
| | | cell.alignItems = cell.height > 1 ? cell.alignItems : '' |
| | | |
| | | if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { |
| | | cell.round = Math.pow(10, cell.decimal) |
| | | if (cell.format === 'percent') { |
| | | cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 |
| | | } |
| | | } |
| | | } else if (cell.eleType === 'icon') { |
| | | if (!cell.innerHeight) { // 兼容 |
| | | let fontSize = 14 |
| | | let lineHeight = 1.5 |
| | | |
| | | if (cell.style.fontSize) { |
| | | fontSize = parseInt(cell.style.fontSize) |
| | | } |
| | | if (cell.style.lineHeight) { |
| | | lineHeight = parseFloat(cell.style.lineHeight) |
| | | } |
| | | |
| | | cell.innerHeight = fontSize * lineHeight |
| | | } |
| | | } |
| | | |
| | | return cell |
| | | } |
| | | |
| | | getPrinter = (item, parentId) => { |
| | | let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid) |
| | | |
| | |
| | | }) |
| | | } |
| | | |
| | | if (btn.verify.wrapText === 'true' && data) { |
| | | let lines = data.length + 1 |
| | | let start = 2 |
| | | if (btn.verify.merge === 'true') { |
| | | lines = data.length + 2 |
| | | } |
| | | for (let n = 0; n < cols.length; n++) { |
| | | for (let m = start; m <= lines; m++) { |
| | | if (ws[cols[n] + m] && !ws[cols[n] + m].s) { |
| | | ws[cols[n] + m].s = {alignment: { wrapText: true }} |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // ws["A1"].s = {fill: { bgColor: { rgb: "FFFFAA" }}, font: { color: { rgb: "1890FF" } }} |
| | | |
| | | const wb = XLSX.utils.book_new() |
| | |
| | | defaultSql = btn.verify.defaultSql || 'true' |
| | | _dataresource = btn.verify.dataresource || '' |
| | | queryType = btn.verify.queryType |
| | | primaryKey = btn.verify.primaryKey || 'ID' |
| | | // primaryKey = btn.verify.primaryKey || 'ID' |
| | | |
| | | if (/\s/.test(_dataresource)) { |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | |
| | | if (btn.Ot === 'requiredOnce' && selectedData && selectedData.length > 0) { |
| | | primaryId = selectedData.map(d => d.$$uuid || '').filter(Boolean).join(',') |
| | | if (_search && primaryId) { |
| | | _search += ` and ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` |
| | | _search += ` and ${primaryKey} in (select ${primaryKey} from dbo.SplitComma('${primaryId}'))` |
| | | } else if (primaryId) { |
| | | _search = `where ${primaryKey} in (select ID from dbo.SplitComma('${primaryId}'))` |
| | | _search = `where ${primaryKey} in (select ${primaryKey} from dbo.SplitComma('${primaryId}'))` |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | }) |
| | | |
| | | let _data = {} |
| | | if (data) { |
| | | Object.keys(data).forEach(key => { |
| | | data[key.toLowerCase()] = data[key] |
| | | _data[key.toLowerCase()] = data[key] |
| | | }) |
| | | } |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (data && btn.Ot !== 'notRequired' && columns && columns.length > 0) { |
| | | datavars = {...data, ...datavars} |
| | | datavars = {..._data, ...datavars} |
| | | |
| | | const setField = (col) => { |
| | | if (!col.field) return |
| | |
| | | MKEmitter.emit('popclose') |
| | | } else if (btn.execError !== 'never') { |
| | | MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn, '', this.state.selines) |
| | | } else if (btn.OpenType === 'form' && btn.formType !== 'counter') { |
| | | } |
| | | if (btn.OpenType === 'form') { |
| | | let data = this.props.selectedData && this.props.selectedData[0] ? this.props.selectedData[0] : null |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | |
| | | if (btn.formType === 'counter') { |
| | | let count = 0 |
| | | if (data && data[btn.field]) { |
| | | count = +data[btn.field] |
| | | if (isNaN(count)) { |
| | | count = 0 |
| | | } |
| | | } |
| | | |
| | | this.setState({count: count }) |
| | | } else { |
| | | this.setState({check: data && data[btn.field] === btn.openVal}) |
| | | } |
| | | } |
| | | |
| | | if (window.GLOB.breakpoint) { |
| | |
| | | } |
| | | |
| | | updateDataType = (e) => { |
| | | this.setState({dataType: e.target.value}) |
| | | this.props.updateDataType(e.target.value) |
| | | |
| | | if (e.target.value === 'custom') { |
| | | setTimeout(() => { |
| | | this.setState({ |
| | | dataType: e.target.value, |
| | | defaultSql: this.props.setting.defaultSql || 'true' |
| | | }) |
| | | }, 10) |
| | | } else { |
| | | this.setState({dataType: e.target.value}) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {dataType === 'custom' && defaultSql === 'true' ? <Col className="short-label" span={8}> |
| | | {/* {dataType === 'custom' && defaultSql === 'true' ? <Col className="short-label" span={8}> |
| | | <Form.Item label="主键"> |
| | | {getFieldDecorator('primaryKey', { |
| | | initialValue: setting.primaryKey || 'ID', |
| | | })(<Input placeholder={''} autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Col> : null} */} |
| | | {dataType === 'custom' && defaultSql === 'true' ? <Col className="short-label" span={8}> |
| | | <Form.Item label="排序方式"> |
| | | {getFieldDecorator('order', { |
| | |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {btnType !== 'print' ? <Col span={8}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="Excel内容区是否自动换行。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 自动换行 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('wrapText', { |
| | | initialValue: setting.wrapText || 'false' |
| | | })( |
| | | <Radio.Group> |
| | | <Radio value="false">否</Radio> |
| | | <Radio value="true">是</Radio> |
| | | </Radio.Group>)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | </div> |
| | |
| | | import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Radio, Spin, Typography, Popconfirm } from 'antd' |
| | | import { EditOutlined, StopOutlined, CheckCircleOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | |
| | | state = { |
| | | verify: {}, |
| | | debugId: '', |
| | | activeKey: 'setting', |
| | | defaultscript: '', // 自定义脚本 |
| | | excelColumns: [ |
| | |
| | | } else if (activeKey === 'setting') { |
| | | this.settingForm.handleConfirm().then(res => { |
| | | let _verify = {...verify, ...res} |
| | | |
| | | if (res.dataType !== 'custom') { |
| | | delete _verify.tableName |
| | | delete _verify.dataresource |
| | | delete _verify.queryType |
| | | delete _verify.defaultSql |
| | | delete _verify.order |
| | | |
| | | _verify.scripts = [] |
| | | } |
| | | |
| | | this.setState({ |
| | | verify: _verify |
| | | }, () => { |
| | |
| | | } |
| | | |
| | | sqlverify = (_resolve, _reject, scripts) => { |
| | | const { searches, verify } = this.state |
| | | const { searches, verify, debugId } = this.state |
| | | |
| | | if (verify.dataType !== 'custom') { |
| | | _resolve() |
| | |
| | | |
| | | let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | let sql = SettingUtils.getDebugSql(verify, scripts, (verify.useSearch === 'true' ? searches : []), Utils, timestamp) |
| | | |
| | | let _debugId = md5(sql) |
| | | |
| | | if (debugId === _debugId) { |
| | | _resolve() |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({debugId: _debugId}) |
| | | _resolve() |
| | | } else { |
| | | _reject() |
| | |
| | | } |
| | | |
| | | updateDataType = (val) => { |
| | | this.setState({verify: {...this.state.verify, dataType: val}}) |
| | | const { config } = this.props |
| | | |
| | | let verify = {...this.state.verify, dataType: val} |
| | | if (val === 'custom' && config.setting) { |
| | | verify.tableName = verify.tableName || config.setting.tableName || '' |
| | | verify.dataresource = verify.dataresource || config.setting.dataresource || '' |
| | | verify.queryType = verify.queryType || config.setting.queryType || '' |
| | | verify.defaultSql = verify.defaultSql || config.setting.execute || '' |
| | | verify.order = verify.order || config.setting.order || '' |
| | | |
| | | if (verify.scripts.length === 0 && config.scripts && config.scripts.length > 0) { |
| | | verify.scripts = fromJS(config.scripts).toJS() |
| | | } |
| | | } |
| | | |
| | | this.setState({verify: verify}) |
| | | } |
| | | |
| | | render() { |
| | |
| | | import { Form, Tabs, Row, Col, Button, notification, Modal, message, InputNumber, Input, Select, Radio, Tooltip, Typography, Popconfirm, Spin } from 'antd' |
| | | import { QuestionCircleOutlined, EditOutlined, StopOutlined, CheckCircleOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons' |
| | | import moment from 'moment' |
| | | import md5 from 'md5' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | |
| | | |
| | | state = { |
| | | verify: {}, |
| | | debugId: '', |
| | | templates: [], |
| | | loading: false, |
| | | activeKey: 'base', |
| | |
| | | } |
| | | |
| | | sqlverify = (_resolve, _reject, scripts) => { |
| | | const { verify, declareSql } = this.state |
| | | const { verify, declareSql, debugId } = this.state |
| | | |
| | | let timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | let sql = SettingUtils.getDebugSql(verify.setting || {}, verify.columns, scripts, declareSql, timestamp) |
| | | |
| | | let _debugId = md5(sql) |
| | | |
| | | if (debugId === _debugId) { |
| | | _resolve() |
| | | return |
| | | } |
| | | |
| | | let param = { |
| | | func: 's_debug_sql', |
| | | exec_type: 'y', |
| | |
| | | |
| | | Api.genericInterface(param).then(result => { |
| | | if (result.status) { |
| | | this.setState({debugId: _debugId}) |
| | | _resolve() |
| | | } else { |
| | | _reject() |
| | |
| | | width: 88%; |
| | | } |
| | | } |
| | | >.ant-row >.ant-col { |
| | | display: inline-block; |
| | | vertical-align: top; |
| | | float: none; |
| | | } |
| | | } |
| | |
| | | _type = 'text' |
| | | } |
| | | } else if (props.type === 'search') { |
| | | if (_type !== 'select') { |
| | | if (_type === 'date' || _type === 'datetime') { |
| | | _type = 'date' |
| | | } else if (_type !== 'select') { |
| | | _type = 'text' |
| | | } |
| | | } else if (props.type === 'form') { |
| | |
| | | <Radio.Group onChange={this.changeType} value={card.type} disabled={!card.selected || card.origin}> |
| | | <Radio value="text">text</Radio> |
| | | <Radio value="select">select</Radio> |
| | | <Radio value="date">date</Radio> |
| | | </Radio.Group> : null |
| | | } |
| | | {type === 'columns' ? |
| | |
| | | selectCards.forEach(item => { |
| | | let _match = '' |
| | | let initval = '' |
| | | if (item.type === 'select') { |
| | | let _type = item.type |
| | | if (item.type === 'date') { |
| | | _type = 'daterange' |
| | | } else if (item.type === 'select') { |
| | | _match = '=' |
| | | } else { |
| | | item.type = 'text' |
| | | _type = 'text' |
| | | _match = 'like' |
| | | } |
| | | |
| | |
| | | label: item.label, |
| | | field: item.field, |
| | | initval: initval, |
| | | type: item.type, |
| | | type: _type, |
| | | resourceType: '0', |
| | | options: [], |
| | | orderType: 'asc', |
| | |
| | | } |
| | | }) |
| | | |
| | | let _data = {} |
| | | if (data) { |
| | | Object.keys(data).forEach(key => { |
| | | data[key.toLowerCase()] = data[key] |
| | | _data[key.toLowerCase()] = data[key] |
| | | }) |
| | | } |
| | | |
| | | // 添加数据中字段,表单值优先(按钮不选行或多行拼接时跳过) |
| | | if (data && btn.Ot !== 'notRequired' && columns && columns.length > 0) { |
| | | datavars = {...data, ...datavars} |
| | | datavars = {..._data, ...datavars} |
| | | |
| | | const setField = (col) => { |
| | | if (!col.field) return |
| | |
| | | let _val = '' |
| | | if (_linkKey === 'bid' && BID) { // 替换bid |
| | | _val = BID |
| | | } else if (data && data.hasOwnProperty(_linkKey)) { |
| | | _val = data[_linkKey] |
| | | } else if (_data.hasOwnProperty(_linkKey)) { |
| | | _val = _data[_linkKey] |
| | | } |
| | | _ModularDetailCode = `'${item.TypeCharOne + _val}'` |
| | | } else { |
| | |
| | | _sql += ` |
| | | /* 创建凭证 */ |
| | | exec s_BVoucher_Create |
| | | @Bill ='${data[_voucher.linkField.toLowerCase()]}', |
| | | @Bill ='${_data[_voucher.linkField.toLowerCase()]}', |
| | | @BVoucherType ='${_voucher.BVoucherType}', |
| | | @VoucherTypeOne ='${_voucher.VoucherTypeOne}', |
| | | @VoucherTypeTwo ='${_voucher.VoucherTypeTwo}', |
| | |
| | | } |
| | | } |
| | | |
| | | let _history = sessionStorage.getItem('history') |
| | | if (_history) { |
| | | sessionStorage.removeItem('history') |
| | | // 查看是否为其他页面跳转,路径存在时,跳回原页面 |
| | | this.props.history.replace(_history) |
| | | } else { |
| | | this.props.history.replace('/main') |
| | | } |
| | | this.props.history.replace('/main') |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && options.sysType === 'SSO') { |
| | | message.warning('应用尚未创建,请向云端同步应用!') |
| | | |
| | |
| | | sessionStorage.removeItem('visitorUserID') |
| | | sessionStorage.removeItem('visitorLoginUID') |
| | | |
| | | let _history = sessionStorage.getItem('history') |
| | | if (_history) { |
| | | sessionStorage.removeItem('history') |
| | | // 查看是否为其他页面跳转,路径存在时,跳回原页面 |
| | | this.props.history.replace(_history) |
| | | } else { |
| | | this.props.history.replace('/main') |
| | | } |
| | | this.props.history.replace('/main') |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && options.sysType === 'SSO') { |
| | | message.warning('应用尚未创建,请向云端同步应用!') |
| | | |
| | |
| | | sessionStorage.removeItem('visitorUserID') |
| | | sessionStorage.removeItem('visitorLoginUID') |
| | | |
| | | let _history = sessionStorage.getItem('history') |
| | | if (_history) { |
| | | sessionStorage.removeItem('history') |
| | | // 查看是否为其他页面跳转,路径存在时,跳回原页面 |
| | | this.props.history.replace(_history) |
| | | } else { |
| | | this.props.history.replace('/main') |
| | | } |
| | | this.props.history.replace('/main') |
| | | } else if (res.ErrCode === 'Need_Get_Appkey' && options.sysType === 'SSO') { |
| | | message.warning('应用尚未创建,请向云端同步应用!') |
| | | |
| | |
| | | this.props.form.setFieldsValue({parentId: _id}) |
| | | this.props.updateConfig({...config, fstMenuId: value, parentId: _id}) |
| | | }) |
| | | } else if (key === 'parentId') { |
| | | this.props.updateConfig({...config, parentId: value}) |
| | | } else if (key === 'cacheUseful') { |
| | | this.props.updateConfig({...config, cacheUseful: value}) |
| | | } else if (key === 'timeUnit') { |
| | | this.props.updateConfig({...config, timeUnit: value}) |
| | | } else if (key === 'OpenType') { |
| | | this.props.updateConfig({...config, OpenType: value}) |
| | | } else if (key === 'hidden') { |
| | | this.props.updateConfig({...config, hidden: value}) |
| | | } else if (key === 'permission') { |
| | | this.props.updateConfig({...config, permission: value}) |
| | | } else if (key === 'cacheLocal') { |
| | | this.props.updateConfig({...config, cacheLocal: value}) |
| | | } else { |
| | | if (key === 'cacheTime' || key === 'minWidth') { |
| | | if (typeof(value) !== 'number') { |
| | | value = '' |
| | | } |
| | | } |
| | | this.props.updateConfig({...config, [key]: value}) |
| | | } |
| | | } |
| | | |
| | | // 菜单名称 |
| | | changeName = (e) => { |
| | | this.props.updateConfig({...this.props.config, MenuName: e.target.value}) |
| | | } |
| | | |
| | | // 菜单参数 |
| | | changeNo = (e) => { |
| | | this.props.updateConfig({...this.props.config, MenuNo: e.target.value}) |
| | | } |
| | | |
| | | // 助记码 |
| | | changeEasyCode = (e) => { |
| | | this.props.updateConfig({...this.props.config, easyCode: e.target.value}) |
| | | } |
| | | |
| | | changeRemark = (e) => { |
| | | this.props.updateConfig({...this.props.config, Remark: e.target.value}) |
| | | } |
| | | |
| | | changeCacheDay = (val) => { |
| | | if (typeof(val) !== 'number') { |
| | | val = '' |
| | | } |
| | | this.props.updateConfig({...this.props.config, cacheTime: val}) |
| | | } |
| | | |
| | | render() { |
| | |
| | | message: '请输入菜单名称!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" onChange={this.changeName}/>)} |
| | | })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('MenuName', e.target.value)}}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | message: '请输入菜单参数!' |
| | | } |
| | | ] |
| | | })(<Input placeholder="" autoComplete="off" onChange={this.changeNo}/>)} |
| | | })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('MenuNo', e.target.value)}}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | <Radio.Group onChange={(e) => {this.selectChange('OpenType', e.target.value)}}> |
| | | <Radio value="newtab">标签页</Radio> |
| | | <Radio value="newpage">新页面</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="跳过权限验证时,页面中组件及按钮不在进行权限控制。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 权限验证 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('permission', { |
| | | initialValue: config.permission || 'true' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('permission', e.target.value)}}> |
| | | <Radio value="true">使用</Radio> |
| | | <Radio value="false">不使用</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="跳过权限验证时,页面中组件及按钮不在进行权限控制。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 权限验证 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('permission', { |
| | | initialValue: config.permission || 'true' |
| | | })( |
| | | <Radio.Group onChange={(e) => {this.selectChange('permission', e.target.value)}}> |
| | | <Radio value="true">使用</Radio> |
| | | <Radio value="false">不使用</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | {config.cacheUseful === 'true' ? <Col span={24}> |
| | | <Form.Item label="单位"> |
| | | {getFieldDecorator('timeUnit', { |
| | |
| | | } |
| | | ] |
| | | })( |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={this.changeCacheDay}/> |
| | | <InputNumber min={1} max={config.timeUnit !== 'hour' ? 7 : 23} precision={0} onChange={(val) => {this.selectChange('cacheTime', val)}}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={24}> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="如果页面内容在窗口中无法完全展示,可设置最小宽度,实现页面的横向滚动。"> |
| | | <QuestionCircleOutlined className="mk-form-tip" /> |
| | | 最小宽度 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('minWidth', { |
| | | initialValue: config.minWidth |
| | | })( |
| | | <InputNumber min={0} precision={0} onChange={(val) => {this.selectChange('minWidth', val)}}/> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label="助记码"> |
| | | {getFieldDecorator('easyCode', { |
| | | initialValue: config.easyCode |
| | | })(<Input placeholder="" autoComplete="off" onChange={this.changeEasyCode}/>)} |
| | | })(<Input placeholder="" autoComplete="off" onChange={(e) => {this.selectChange('easyCode', e.target.value)}}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | |
| | | message: '备注最多512个字符!' |
| | | } |
| | | ] |
| | | })(<TextArea rows={2} placeholder={''} onChange={this.changeRemark} />)} |
| | | })(<TextArea rows={2} placeholder={''} onChange={(e) => {this.selectChange('Remark', e.target.value)}}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | </Row> |