| | |
| | | <Menu className="header-dropdown"> |
| | | {debug && <Menu.Item key="switch"> |
| | | {this.state.dict['main.edit']} |
| | | <Switch size="small" className="edit-switch" disabled={!!this.props.editLevel} checked={this.props.editState} onChange={this.changeEditState} /> |
| | | <Switch size="small" style={{marginLeft: '7px'}} disabled={!!this.props.editLevel} checked={this.props.editState} onChange={this.changeEditState} /> |
| | | </Menu.Item>} |
| | | {!this.props.editState ? <Menu.Item key="password" onClick={this.changePassword}>{this.state.dict['main.password']}</Menu.Item> : null} |
| | | {this.state.systems.length > 0 ? <Menu.SubMenu className="header-subSystem-box" title="切换系统"> |
| | | {this.state.systems.length > 0 ? <Menu.SubMenu title="切换系统"> |
| | | {this.state.systems.map((system, index) => ( |
| | | <Menu.Item className="header-subSystem" key={'sub' + index} onClick={() => {this.changeSystem(system)}}> {system.AppName} </Menu.Item> |
| | | <Menu.Item style={{minWidth: '100px'}} key={'sub' + index} onClick={() => {this.changeSystem(system)}}> {system.AppName} </Menu.Item> |
| | | ))} |
| | | </Menu.SubMenu> : null} |
| | | <Menu.Item key="doc" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item> |
| | |
| | | } |
| | | } |
| | | } |
| | | .header-subSystem { |
| | | min-width: 100px; |
| | | } |
| | | .edit-switch { |
| | | margin-left: 10px; |
| | | } |
| | |
| | | import demo4 from '@/assets/img/demo4.jpg' |
| | | import demo5 from '@/assets/img/demo5.jpg' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | |
| | | import './index.scss' |
| | | |
| | | const BarCode = asyncComponent(() => import('@/components/barcode')) |
| | | const QrCode = asyncComponent(() => import('@/components/qrcode')) |
| | | const MarkColumn = asyncIconComponent(() => import('@/menu/components/table/normal-table/columns/markcolumn')) |
| | | |
| | | const Card = ({ id, cardIds, card, moveCard, findCard, editCard, delCard, copyCard, changeStyle }) => { |
| | | const Card = ({ id, cardIds, fields, card, moveCard, findCard, editCard, delCard, copyCard, changeStyle, updateMarks }) => { |
| | | const originalIndex = findCard(id).index |
| | | const [{ isDragging }, drag] = useDrag({ |
| | | item: { type: 'action', id, originalIndex }, |
| | |
| | | ) |
| | | } else if (card.eleType === 'text' || card.eleType === 'number') { |
| | | let val = `${card.prefix || ''}${card.datatype === 'static' ? (card.value || '') : (card.field || '')}${card.postfix || ''}` |
| | | return ( |
| | | <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div> |
| | | ) |
| | | } else if (card.eleType === 'link') { |
| | | let val = card.label || card.value || card.field |
| | | return ( |
| | | <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div> |
| | | ) |
| | |
| | | <Icon className="copy" title="复制" type="copy" onClick={() => copyCard(id)} /> |
| | | <Icon className="close" title="删除" type="close" onClick={() => delCard(id)} /> |
| | | <Icon className="style" title="调整样式" onClick={() => changeStyle(id)} type="font-colors" /> |
| | | {['text', 'number'].includes(card.eleType) ? <MarkColumn columns={fields} marks={card.marks} onSubmit={(vals) => updateMarks({...card, marks: vals})} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | <div ref={node => drag(drop(node))} className={'ant-col card-cell ant-col-' + card.width}> |
| | |
| | | import Action from './action' |
| | | import './index.scss' |
| | | |
| | | const Container = ({list, handleList, handleMenu, deleteMenu, profileAction, handleStyle, dropButton, handleSubConfig }) => { |
| | | const Container = ({list, fields, handleList, handleMenu, deleteMenu, profileAction, handleStyle, updateMarks, dropButton, handleSubConfig }) => { |
| | | const [cards, setCards] = useState(list) |
| | | const moveCard = (id, atIndex) => { |
| | | const { card, index } = findCard(id) |
| | |
| | | key={card.uuid} |
| | | cardIds={cardIds} |
| | | card={card} |
| | | fields={fields} |
| | | moveCard={moveCard} |
| | | copyCard={copyCard} |
| | | editCard={editCard} |
| | | updateMarks={updateMarks} |
| | | changeStyle={changeStyle} |
| | | delCard={delCard} |
| | | findCard={findCard} |
| | |
| | | |
| | | const cardTypeOptions = { |
| | | sequence: ['eleType', 'width'], |
| | | text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix'], |
| | | text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link'], |
| | | number: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix'], |
| | | picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'url'], |
| | | picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'url', 'link'], |
| | | icon: ['eleType', 'icon', 'datatype', 'width'], |
| | | link: ['eleType', 'datatype', 'label', 'width', 'height', 'joint'], |
| | | slider: ['eleType', 'datatype', 'width', 'color', 'maxValue'], |
| | | splitline: ['eleType', 'color', 'width', 'borderWidth'], |
| | | barcode: ['eleType', 'datatype', 'width', 'barHeight', 'displayValue', 'interval'], |
| | |
| | | state = { |
| | | formlist: null, // 表单信息 |
| | | eleType: '', |
| | | datatype: '' |
| | | datatype: '', |
| | | link: '' |
| | | } |
| | | |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { card, config } = this.props |
| | | let _options = this.getOptions(card.eleType, card.datatype) |
| | | let _options = this.getOptions(card.eleType, card.datatype, card.link) |
| | | |
| | | this.setState({ |
| | | link: card.link, |
| | | eleType: card.eleType, |
| | | datatype: card.datatype, |
| | | formlist: this.props.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | |
| | | if (item.key === 'field') { |
| | | if (item.key === 'field' || item.key === 'linkurl') { |
| | | item.options = [] |
| | | config.columns.forEach(col => { |
| | | if (!/^Nvarchar/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) { |
| | |
| | | } else if (item.key === 'value' && card.eleType === 'slider') { |
| | | item.type = 'number' |
| | | item.label = '值' |
| | | } else if (item.key === 'format') { |
| | | if (card.eleType === 'text') { |
| | | item.options = item.oriOptions.filter(op => op.value !== 'percent' && op.value !== 'thdSeparator') |
| | | } else if (card.eleType === 'number') { |
| | | item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD') |
| | | } |
| | | } |
| | | if (item.key === 'linkurl') { |
| | | item.type = card.link === 'dynamic' ? 'select' : 'text' |
| | | } |
| | | |
| | | return item |
| | |
| | | }) |
| | | } |
| | | |
| | | getOptions = (eleType, datatype) => { |
| | | getOptions = (eleType, datatype, link) => { |
| | | let _options = fromJS(cardTypeOptions[eleType]).toJS() // 选项列表 |
| | | |
| | | if (['text', 'number', 'picture', 'link', 'slider', 'barcode', 'qrcode'].includes(eleType)) { |
| | |
| | | _options.push('field') |
| | | } else if (eleType !== 'picture') { |
| | | _options.push('value') |
| | | } |
| | | |
| | | if (['text', 'picture'].includes(eleType) && link) { |
| | | _options.push('linkurl', 'joint') |
| | | } |
| | | } else if (eleType === 'icon') { |
| | | if (datatype === 'dynamic') { |
| | |
| | | const { datatype } = this.state |
| | | |
| | | if (key === 'eleType') { |
| | | let _options = this.getOptions(value, datatype) |
| | | let _options = this.getOptions(value, datatype, '') |
| | | |
| | | let _formlist = this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | |
| | | item.type = 'text' |
| | | item.label = '内容' |
| | | } |
| | | } else if (item.key === 'format') { |
| | | if (value === 'text') { |
| | | item.options = item.oriOptions.filter(op => op.value !== 'percent' && op.value !== 'thdSeparator') |
| | | } else if (value === 'number') { |
| | | item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD') |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | link: '', |
| | | eleType: value, |
| | | formlist: _formlist |
| | | }, () => { |
| | |
| | | this.props.form.setFieldsValue({width: 24, color: '#1890ff'}) |
| | | } else if (value === 'splitline') { |
| | | this.props.form.setFieldsValue({width: 24, color: '#e8e8e8'}) |
| | | } else if (value === 'text' || value === 'number') { |
| | | this.props.form.setFieldsValue({format: ''}) |
| | | } |
| | | if (value === 'text' || value === 'picture') { |
| | | this.props.form.setFieldsValue({link: ''}) |
| | | } |
| | | }) |
| | | } else if (key === 'field') { |
| | |
| | | let value = e.target.value |
| | | |
| | | if (key === 'datatype') { |
| | | let _options = this.getOptions(eleType, value) |
| | | let _options = this.getOptions(eleType, value, this.state.link) |
| | | |
| | | this.setState({ |
| | | datatype: value, |
| | |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (key === 'link') { |
| | | let _options = this.getOptions(eleType, this.state.datatype, value) |
| | | this.setState({ |
| | | link: value, |
| | | formlist: this.state.formlist.map(item => { |
| | | item.hidden = !_options.includes(item.key) |
| | | if (item.key === 'linkurl') { |
| | | item.type = value === 'dynamic' ? 'select' : 'text' |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | |
| | | { value: 'number', text: '数值'}, |
| | | { value: 'picture', text: '图片'}, |
| | | { value: 'icon', text: '图标'}, |
| | | { value: 'link', text: '链接'}, |
| | | { value: 'slider', text: '进度条'}, |
| | | { value: 'splitline', text: '分割线'}, |
| | | { value: 'barcode', text: '条形码'}, |
| | |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'label', |
| | | label: '显示信息', |
| | | initVal: card.label || '', |
| | | required: false |
| | | type: 'radio', |
| | | key: 'link', |
| | | label: '链接', |
| | | initVal: card.link || '', |
| | | required: false, |
| | | options: [ |
| | | { value: '', text: '无' }, |
| | | { value: 'dynamic', text: '动态' }, |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'linkurl', |
| | | label: '链接地址', |
| | | initVal: card.linkurl || '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'select', |
| | | key: 'format', |
| | | label: '格式化', |
| | | initVal: card.format || '', |
| | | tooltip: '注:百分数、千分位对于数值类型有效,YYYY-MM-DD对于时间类型的文本有效。', |
| | | required: false, |
| | | options: [ |
| | | options: [], |
| | | oriOptions: [ |
| | | { value: '', text: '无' }, |
| | | { value: 'percent', text: '百分数' }, |
| | | { value: 'thdSeparator', text: '千分位' }, |
| | |
| | | min: 1, |
| | | max: 10, |
| | | label: '高度(行)', |
| | | initVal: card.height || 1, |
| | | required: true, |
| | | initVal: card.height, |
| | | tooltip: '内容显示行数,值为空时高度自适应,注:自适应高度仅在设置卡片高度后有效。', |
| | | required: false |
| | | }, |
| | | { |
| | | type: 'number', |
| | |
| | | |
| | | let _card = fromJS(card).toJS() |
| | | |
| | | if (_card.eleType === 'text' || _card.eleType === 'number' || _card.eleType === 'link') { |
| | | if (_card.eleType === 'text' || _card.eleType === 'number') { |
| | | _card.style = style |
| | | |
| | | let fontSize = 14 |
| | |
| | | if (res.eleType === 'splitline' && cell.eleType !== 'splitline') { |
| | | res.style.paddingTop = '5px' |
| | | res.style.paddingBottom = '5px' |
| | | } else if (res.eleType === 'text' || res.eleType === 'number' || res.eleType === 'link') { |
| | | } else if (res.eleType === 'text' || res.eleType === 'number') { |
| | | let fontSize = 14 |
| | | let lineHeight = 1.5 |
| | | let line = res.height || 1 |
| | |
| | | } |
| | | res.innerHeight = fontSize * lineHeight * line |
| | | |
| | | if (res.eleType === 'link' && !res.style.color) { |
| | | if (res.eleType === 'text' && res.link && !res.style.color) { |
| | | res.style.color = 'rgba(24, 144, 255, 1)' |
| | | } |
| | | } else if (res.eleType === 'barcode') { |
| | |
| | | }) |
| | | } |
| | | |
| | | updateMarks = (card) => { |
| | | const { elements } = this.state |
| | | |
| | | let _elements = elements.map(cell => { |
| | | if (cell.uuid === card.uuid) return card |
| | | return cell |
| | | }) |
| | | |
| | | this.setState({ |
| | | elements: _elements |
| | | }, () => { |
| | | this.props.updateElement(_elements) |
| | | }) |
| | | } |
| | | |
| | | dropButton = (id) => { |
| | | const { cards } = this.props |
| | | let index = cards.action.findIndex(item => item.uuid === id) |
| | |
| | | <div className="model-menu-card-cell-list"> |
| | | <DragElement |
| | | list={elements} |
| | | fields={cards.columns} |
| | | updateMarks={this.updateMarks} |
| | | handleList={this.handleList} |
| | | handleMenu={this.handleElement} |
| | | handleStyle={this.handleStyle} |
| | |
| | | |
| | | newcard.eleType = 'text' |
| | | newcard.datatype = 'dynamic' |
| | | newcard.height = 1 |
| | | |
| | | // 注册事件-添加元素 |
| | | MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) |
| | |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}}> |
| | | <Radio key="" value=""> 不可选 </Radio> |
| | | <Radio key="radio" value={'radio'}> 单选 </Radio> |
| | | <Radio key="checkbox" value={'checkbox'}> 多选 </Radio> |
| | | {config.subtype !== 'propcard' ? <Radio key="checkbox" value={'checkbox'}> 多选 </Radio> : null} |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | const { config } = this.props |
| | | const { card, actionlist } = this.state |
| | | |
| | | if (comIds.length !== 2 || comIds[0] !== config.uuid || comIds[1] === 'header') return |
| | | if (comIds[0] !== config.uuid || comIds[1] !== 'actionlist') return |
| | | |
| | | let _card = fromJS(card).toJS() |
| | | _card.btnstyle = style |
| | |
| | | card: element |
| | | }) |
| | | |
| | | MKEmitter.emit('changeStyle', [config.uuid, element.uuid], options, _style) |
| | | MKEmitter.emit('changeStyle', [config.uuid, 'actionlist', element.uuid], options, _style) |
| | | } |
| | | |
| | | addButton = (cardId, element) => { |
| | |
| | | import './index.scss' |
| | | |
| | | const { confirm } = Modal |
| | | const coldict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const EditColumn = asyncIconComponent(() => import('./editColumn')) |
| | | const MarkColumn = asyncIconComponent(() => import('./markcolumn')) |
| | | const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent')) |
| | |
| | | } |
| | | <Icon className="edit" title="编辑" type="edit" onClick={() => this.props.editColumn(column)} /> |
| | | <Icon className="close" title="删除" type="delete" onClick={this.deleteCol} /> |
| | | {column && ['text', 'number'].includes(column.type) ? <MarkColumn dict={coldict} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | {column && ['text', 'number'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | |
| | | } |
| | | <Icon className="edit" title="编辑" type="edit" onClick={() => this.props.editColumn(column)} /> |
| | | <Icon className="close" title="删除" type="delete" onClick={this.deleteCol} /> |
| | | {column && ['text', 'number'].includes(column.type) ? <MarkColumn dict={coldict} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | {column && ['text', 'number'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } |
| | | </div> |
| | | } trigger="hover"> |
| | | {children} |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | data: [{uuid: Utils.getuuid()}], |
| | | columns: [], |
| | | fields: [], |
| | |
| | | |
| | | render() { |
| | | const { config } = this.props |
| | | const { fields, card, lineMarks } = this.state |
| | | const { fields, card, lineMarks, dict } = this.state |
| | | const components = { |
| | | header: { |
| | | cell: DragableHeaderCol |
| | |
| | | <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType}`}> |
| | | <div className="col-control"> |
| | | <Icon title="复制" type="copy" onClick={this.copycolumn} /> |
| | | <MarkColumn dict={coldict} columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> |
| | | <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> |
| | | </div> |
| | | <DndProvider> |
| | | <Table |
| | |
| | | }} |
| | | /> |
| | | </DndProvider> |
| | | <EditColumn column={card} dict={coldict} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> |
| | | <EditColumn column={card} dict={dict} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | import MarkForm from './markform' |
| | | import './index.scss' |
| | | import { minkeIconSystem } from '@/utils/option.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import '@/assets/css/table.scss' |
| | | |
| | | const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) |
| | |
| | | class MarkColumn extends Component { |
| | | static propTpyes = { |
| | | columns: PropTypes.array, // 显示列 |
| | | dict: PropTypes.object, // 字典项 |
| | | marks: PropTypes.object, |
| | | onSubmit: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | marks: null, |
| | | columns: null, |
| | | visible: false, |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { dict } = this.props |
| | | const { marks, markColumns, visible, options, signs } = this.state |
| | | const { marks, markColumns, visible, options, signs, dict } = this.state |
| | | |
| | | return ( |
| | | <div style={{display: 'inline-block'}}> |
| | |
| | | } |
| | | |
| | | _inputfields = _formfields.filter(item => item.type === 'text' || item.type === 'number') |
| | | _tabfields = _formfields.filter(item => card.field !== item.field && ['text', 'number', 'select', 'link'].includes(item.type)) |
| | | _tabfields = _formfields.filter(item => card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) |
| | | _tabfields.unshift({field: '', text: '原表单'}) |
| | | |
| | | let uniq = new Map() |
| | |
| | | .card-item-box { |
| | | overflow: hidden; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | openNewView = (card, url) => { |
| | | openNewView = (e, card) => { |
| | | const { cardCell, data, cards } = this.props |
| | | |
| | | if (!card.link) return |
| | | e.stopPropagation() |
| | | |
| | | let url = '' |
| | | |
| | | if (card.link === 'static') { |
| | | url = card.linkurl |
| | | } else { |
| | | url = data[card.linkurl] |
| | | } |
| | | |
| | | if (url === 'sso') { |
| | | if (!data.LinkUrl1) { |
| | | url = '' |
| | | } else { |
| | | url = data.LinkUrl1 + 'index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({ |
| | | UserID: sessionStorage.getItem('UserID'), |
| | | LoginUID: sessionStorage.getItem('LoginUID'), |
| | | User_Name: sessionStorage.getItem('User_Name'), |
| | | Full_Name: sessionStorage.getItem('Full_Name'), |
| | | avatar: sessionStorage.getItem('avatar'), |
| | | dataM: data.dataM ? 'true' : '', |
| | | debug: data.debug || '', |
| | | role_id: data.role_id || '' |
| | | }))) |
| | | } |
| | | } else { |
| | | let Id = '' |
| | | let con = '?' |
| | | |
| | | if (/\?/ig.test(url)) { |
| | | con = '&' |
| | | } |
| | | |
| | | if (cards.subtype === 'propcard' && cardCell) { |
| | | Id = cardCell.setting.primaryId || '' |
| | | } else { |
| | | Id = data[cards.setting.primaryKey] || '' |
| | | } |
| | | |
| | | if (card.joint === 'true') { |
| | | url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` |
| | | } |
| | | } |
| | | |
| | | if (!url) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '地址链接不可为空!', |
| | | message: '链接地址不存在!', |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | let Id = '' |
| | | let con = '?' |
| | | |
| | | if (/\?/ig.test(url)) { |
| | | con = '&' |
| | | } |
| | | |
| | | if (cards.subtype === 'propcard' && cardCell) { |
| | | Id = cardCell.setting.primaryId || '' |
| | | } else { |
| | | Id = data[cards.setting.primaryKey] || '' |
| | | } |
| | | |
| | | if (card.joint === 'true') { |
| | | url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` |
| | | } |
| | | |
| | | window.open(url) |
| | | } |
| | | |
| | | getMark = (marks, style, content) => { |
| | | const { data } = this.props |
| | | |
| | | marks.some(mark => { |
| | | let originVal = data[mark.field[0]] + '' |
| | | let contrastVal = '' |
| | | let result = false |
| | | |
| | | if (mark.field[1] === 'static') { |
| | | contrastVal = mark.contrastValue + '' |
| | | } else { |
| | | contrastVal = data[mark.field[2]] + '' |
| | | } |
| | | |
| | | if (mark.match === '=') { |
| | | result = originVal === contrastVal |
| | | } else if (mark.match === '!=') { |
| | | result = originVal !== contrastVal |
| | | } else if (mark.match === 'like') { |
| | | result = originVal.indexOf(contrastVal) > -1 |
| | | } else if (mark.match === '>') { |
| | | try { |
| | | originVal = parseFloat(originVal) |
| | | contrastVal = parseFloat(contrastVal) |
| | | } catch { |
| | | originVal = NaN |
| | | } |
| | | |
| | | if (!isNaN(originVal) && !isNaN(contrastVal) && originVal > contrastVal) { |
| | | result = true |
| | | } |
| | | } else if (mark.match === '<') { |
| | | try { |
| | | originVal = parseFloat(originVal) |
| | | contrastVal = parseFloat(contrastVal) |
| | | } catch { |
| | | originVal = NaN |
| | | } |
| | | |
| | | if (!isNaN(originVal) && !isNaN(contrastVal) && originVal < contrastVal) { |
| | | result = true |
| | | } |
| | | } |
| | | |
| | | if (result) { |
| | | if (mark.signType[0] === 'font') { |
| | | style.color = mark.color |
| | | } else if (mark.signType[0] === 'background') { |
| | | style.background = mark.color |
| | | if (mark.fontColor) { |
| | | style.color = mark.fontColor |
| | | } |
| | | } else if (mark.signType[0] === 'underline') { |
| | | style.textDecoration = 'underline' |
| | | style.color = mark.color |
| | | } else if (mark.signType[0] === 'line-through') { |
| | | style.textDecoration = 'line-through' |
| | | style.color = mark.color |
| | | } else if (mark.signType[0] === 'icon') { |
| | | let icon = (<Icon style={{color: mark.color}} type={mark.signType[3]} />) |
| | | if (mark.signType[1] === 'front') { |
| | | content = <span>{icon} {content}</span> |
| | | } else { |
| | | content = <span>{content} {icon}</span> |
| | | } |
| | | } |
| | | } |
| | | return result |
| | | }) |
| | | |
| | | return content |
| | | } |
| | | |
| | | getContent = (card) => { |
| | |
| | | ) |
| | | } else if (card.eleType === 'text') { |
| | | let val = '' |
| | | let _style = card.style ? {...card.style} : {} |
| | | |
| | | if (card.datatype === 'static') { |
| | | val = card.value |
| | |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | } |
| | | |
| | | if (card.marks) { |
| | | val = this.getMark(card.marks, _style, val) |
| | | } |
| | | |
| | | if (card.link) { |
| | | _style.cursor = 'pointer' |
| | | } |
| | | |
| | | return ( |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> |
| | | <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div> |
| | | </div> |
| | | </Col> |
| | | ) |
| | | } else if (card.eleType === 'number') { |
| | | let val = '' |
| | | let _style = card.style ? {...card.style} : {} |
| | | |
| | | if (card.datatype === 'static') { |
| | | val = card.value |
| | |
| | | if (val !== '') { |
| | | val = `${card.prefix || ''}${val}${card.postfix || ''}` |
| | | } |
| | | |
| | | return ( |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div> |
| | | </div> |
| | | </Col> |
| | | ) |
| | | } else if (card.eleType === 'link') { |
| | | let url = '' |
| | | |
| | | if (card.datatype === 'static') { |
| | | url = card.value |
| | | } else if (data.hasOwnProperty(card.field)) { |
| | | url = data[card.field] |
| | | |
| | | if (card.marks) { |
| | | val = this.getMark(card.marks, _style, val) |
| | | } |
| | | |
| | | let val = card.label || url |
| | | |
| | | return ( |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}> |
| | | <span style={{cursor: 'pointer'}} onClick={(e) => {e.stopPropagation(); this.openNewView(card, url)}}>{val}</span> |
| | | </div> |
| | | <div style={_style}> |
| | | <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div> |
| | | </div> |
| | | </Col> |
| | | ) |
| | |
| | | ) |
| | | } else if (card.eleType === 'picture') { |
| | | let _imagestyle = {} |
| | | let _style = card.style ? {...card.style} : {} |
| | | |
| | | if (card.url) { |
| | | _imagestyle = {backgroundImage: `url('${card.url}')`} |
| | |
| | | _imagestyle.paddingTop = '100%' |
| | | } |
| | | |
| | | if (card.link) { |
| | | _style.cursor = 'pointer' |
| | | } |
| | | |
| | | return ( |
| | | <Col key={card.uuid} span={card.width}> |
| | | <div style={card.style}> |
| | | <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> |
| | | <div className="ant-mk-picture" style={_imagestyle}></div> |
| | | </div> |
| | | </Col> |
| | |
| | | font-weight: inherit; |
| | | text-decoration: inherit; |
| | | } |
| | | .ant-mk-text:not(.line1) { |
| | | .ant-mk-text:not(.line1):not(.line) { |
| | | word-break: break-word; |
| | | display: -webkit-box; |
| | | -webkit-box-orient: vertical; |
| | |
| | | config: null, // 图表配置信息 |
| | | pageIndex: 1, // 页码 |
| | | activeKey: '', // 选中卡 |
| | | selectKeys: [], // 多选时选中卡片 |
| | | selectedData: [], // 选中数据,用于工具栏按钮 |
| | | loading: false, // 数据加载状态 |
| | | sync: false, // 是否统一请求数据 |
| | | card: null, // 卡片设置 |
| | |
| | | if (config.setting.supModule && !BID) { // BID 不存在时,不做查询 |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | selectedData: [], |
| | | pageIndex: 1, |
| | | data: [], |
| | | total: 0, |
| | |
| | | if (result.status) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | selectedData: [], |
| | | data: result.data.map((item, index) => { |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | |
| | | } |
| | | |
| | | changeCard = (index, item) => { |
| | | const { config } = this.state |
| | | const { config, selectKeys, selectedData, activeKey } = this.state |
| | | |
| | | if (config.wrap.switch !== 'true') return |
| | | if (!config.wrap.cardType) return |
| | | |
| | | let _selectKeys = [] |
| | | let _selectedData = [] |
| | | let _activeKey = '' |
| | | let _item = item |
| | | if (config.wrap.cardType === 'checkbox') { |
| | | if (activeKey === index) { |
| | | _selectKeys = selectKeys.filter(key => key !== index) |
| | | _selectedData = selectedData.filter(cell => cell.key !== index) |
| | | _activeKey = _selectKeys.slice(-1)[0] |
| | | _item = selectedData.slice(-1)[0] || '' |
| | | } else if (selectKeys.indexOf(index) > -1) { |
| | | _selectKeys = selectKeys.filter(key => key !== index) |
| | | _selectedData = selectedData.filter(cell => cell.key !== index) |
| | | _activeKey = activeKey |
| | | _item = selectedData.filter(cell => cell.key === activeKey)[0] || '' |
| | | } else { |
| | | _selectKeys = [...selectKeys, index] |
| | | _selectedData = [...selectedData, item] |
| | | _activeKey = index |
| | | } |
| | | } else { |
| | | if (activeKey === index) return |
| | | |
| | | _selectedData = [item] |
| | | _activeKey = index |
| | | } |
| | | |
| | | this.setState({ |
| | | activeKey: index |
| | | activeKey: _activeKey, |
| | | selectKeys: _selectKeys, |
| | | selectedData: _selectedData |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (_item ? _item.$$uuid : ''), _item) |
| | | } |
| | | |
| | | render() { |
| | | const { config, loading, data, pageIndex, total, card, activeKey, BID, BData, selectedData } = this.state |
| | | const { config, loading, data, pageIndex, total, card, activeKey, BID, BData, selectedData, selectKeys } = this.state |
| | | |
| | | let _total = config.setting.pageSize * pageIndex |
| | | let switchable = false |
| | |
| | | {switchable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null} |
| | | {data && data.length > 0 ? <div className="card-row-list"> |
| | | {data.map((item, index) => ( |
| | | <Col className={activeKey === index ? 'active' : ''} key={index} span={card.setting.width || 6} onClick={() => {this.changeCard(index, item)}}> |
| | | <Col className={activeKey === index ? 'active' : (selectKeys.indexOf(index) > -1 ? 'selected' : '')} key={index} span={card.setting.width} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem card={card} cards={config} data={item} updateStatus={this.updateStatus}/> |
| | | </Col> |
| | | ))} |
| | |
| | | border-color: #1890ff!important; |
| | | box-shadow: 0 0 3px #1890ff; |
| | | } |
| | | >.selected >.card-item-box { |
| | | border-color: #69c0ff!important; |
| | | box-shadow: 0 0 1px #69c0ff; |
| | | } |
| | | } |
| | | .card-item-box { |
| | | background-position: center center; |
| | |
| | | } |
| | | |
| | | changeCard = (index, item) => { |
| | | const { config } = this.state |
| | | const { config, data, activeKey } = this.state |
| | | |
| | | if (config.wrap.switch !== 'true') return |
| | | if (!config.wrap.cardType || activeKey === index) return |
| | | |
| | | this.setState({ |
| | | activeKey: index |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (item.setting.primaryId || ''), data) |
| | | } |
| | | |
| | | render() { |
| | |
| | | .card-row-list { |
| | | overflow-y: auto; |
| | | .card-item-box { |
| | | overflow: hidden; |
| | | background-color: #ffffff; |
| | | transition: all 0.3s; |
| | | } |
| | |
| | | } |
| | | if (item.type === 'card') { |
| | | item.subcards.forEach(card => { |
| | | let _hasheight = card.style.height && card.style.height !== 'auto' |
| | | |
| | | card.elements = card.elements.filter(cell => { |
| | | if (cell.eleType === 'button') { |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | cell.Ot = 'requiredSgl' |
| | | } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | return cell.eleType !== 'button' || permAction[cell.uuid] |
| | | }) |
| | |
| | | if (cell.eleType === 'button') { |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | cell.Ot = 'requiredSgl' |
| | | } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | return cell.eleType !== 'button' || permAction[cell.uuid] |
| | | }) |
| | | }) |
| | | } else if (item.type === 'table' && item.subtype === 'tablecard') { |
| | | item.subcards.forEach(card => { |
| | | let _hasheight = card.style.height && card.style.height !== 'auto' |
| | | card.elements = card.elements.filter(cell => { |
| | | if (cell.eleType === 'button') { |
| | | cell.logLabel = item.name + '-' + cell.label |
| | | cell.Ot = 'requiredSgl' |
| | | } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { |
| | | cell.innerHeight = 'auto' |
| | | } |
| | | return cell.eleType !== 'button' || permAction[cell.uuid] |
| | | }) |
| | |
| | | if (!input || input.id !== selectId) return |
| | | |
| | | if (input.className === 'ant-select-search__field' && type !== 'init') { |
| | | let div = document.getElementById(input.id) |
| | | div && div.click && div.click() |
| | | let div = input.parentNode |
| | | while (div && div.parentNode) { |
| | | div = div.parentNode |
| | | if (div.id === selectId) { |
| | | div && div.click && div.click() |
| | | div = null |
| | | } |
| | | } |
| | | } else if (input.select) { |
| | | input.select() |
| | | } else if (input.focus) { |
| | |
| | | }) |
| | | |
| | | _inputfields = _formfields.filter(item => item.type === 'text' || item.type === 'number') |
| | | _tabfields = _formfields.filter(item => card.field !== item.field && ['text', 'number', 'select', 'link'].includes(item.type)) |
| | | _tabfields = _formfields.filter(item => card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) |
| | | _tabfields.unshift({field: '', text: '原表单'}) |
| | | |
| | | if (card.linkSubField && card.linkSubField.length > 0) { |
| | |
| | | } |
| | | |
| | | _inputfields = _formfields.filter(item => item.type === 'text' || item.type === 'number') |
| | | _tabfields = _formfields.filter(item => card.field !== item.field && ['text', 'number', 'select', 'link'].includes(item.type)) |
| | | _tabfields = _formfields.filter(item => card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) |
| | | _tabfields.unshift({field: '', text: '原表单'}) |
| | | |
| | | let uniq = new Map() |
| | |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkSubField', |
| | | label: Formdict['model.form.linkform'], |
| | | tooltip: '在切换选项时会把信息自动填入关联的表单(文本或数字表单)中。', |
| | | initVal: card.linkSubField || [], |
| | | options: inputfields |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'tooltip', |
| | | label: '悬浮提示', |
| | |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'linkSubField', |
| | | label: Formdict['model.form.linkform'], |
| | | tooltip: '在切换选项时会把信息自动填入关联的表单(文本或数字表单)中。', |
| | | initVal: card.linkSubField || [], |
| | | options: inputfields |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | key: 'blacklist', |
| | | label: Formdict['header.form.blacklist'], |
| | | initVal: card.blacklist || [], |
| | |
| | | |
| | | openTypeChange = (key, value) => { |
| | | if (key === 'type') { |
| | | let _options = this.getOptions(value, this.state.resourceType, this.state.supField, this.state.display, this.state.enter) |
| | | let enter = 'false' |
| | | let fieldValue = {} |
| | | |
| | | if (value === 'text' || value === 'number') { |
| | | enter = 'sub' |
| | | fieldValue.enter = 'sub' |
| | | } else if (value === 'select' || value === 'link') { |
| | | fieldValue.enter = 'false' |
| | | } |
| | | |
| | | let _options = this.getOptions(value, this.state.resourceType, this.state.supField, this.state.display, enter) |
| | | |
| | | |
| | | this.setState({ |
| | | openType: value, |
| | | enter: enter, |
| | | formlist: this.state.formlist.map(form => { |
| | | form.show = _options.includes(form.key) |
| | | if (form.key === 'initval') { |
| | |
| | | if (form.show) { |
| | | fieldValue.resourceType = form.initVal |
| | | } |
| | | } else if (form.key === 'enter') { |
| | | form.initVal = this.state.enter |
| | | } else if (form.key === 'linkSubField') { |
| | | form.initVal = this.state.linkSubFields.map(_field => _field.field) |
| | | |
| | |
| | | |
| | | export const minkeIconSystem = { |
| | | direction: [ |
| | | 'step-backward', |
| | | 'step-forward', |
| | | 'fast-backward', |
| | | 'fast-forward', |
| | | 'shrink', |
| | | 'arrows-alt', |
| | | 'arrow-up', |
| | | 'arrow-down', |
| | | 'arrow-left', |
| | | 'arrow-right', |
| | | 'down', |
| | | 'up', |
| | | 'left', |
| | |
| | | 'caret-down', |
| | | 'caret-left', |
| | | 'caret-right', |
| | | 'step-backward', |
| | | 'step-forward', |
| | | 'fast-backward', |
| | | 'fast-forward', |
| | | 'shrink', |
| | | 'arrows-alt', |
| | | 'up-circle', |
| | | 'down-circle', |
| | | 'left-circle', |
| | |
| | | 'swap', |
| | | 'swap-left', |
| | | 'swap-right', |
| | | 'arrow-up', |
| | | 'arrow-down', |
| | | 'arrow-left', |
| | | 'arrow-right', |
| | | 'play-circle', |
| | | 'up-square', |
| | | 'down-square', |