| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Modal, notification, Switch, message, Spin } from 'antd' |
| | | import { Icon, Modal, notification, Switch, message } from 'antd' |
| | | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | columnlist: null, // 显示列 |
| | | loading: false, // 查询显示列联动菜单 |
| | | showField: false, // 显示列字段 |
| | | modaltype: '', // 模态框控制 |
| | | card: null // 编辑中元素 |
| | |
| | | columns={columnlist} |
| | | /> |
| | | </Modal> |
| | | {this.state.loading && <Spin size="large" />} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | cols: [ |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 }, |
| | | { origin: true, uuid: Utils.getuuid(), Align: 'left', label: 'label', field: '', Hide: 'false', IsSort: 'true', type: 'text', Width: 120 } |
| | | ], |
| | | scripts: [] |
| | |
| | | .model-table-search-list { |
| | | padding: 10px 0px 0px; |
| | | min-height: 65px; |
| | | border-bottom: 1px solid #f0f0f0; |
| | | >.anticon-question-circle { |
| | | display: none; |
| | | } |
| | |
| | | } |
| | | .model-menu-action-list { |
| | | line-height: 40px; |
| | | padding: 15px 0px 10px; |
| | | padding: 10px 0px; |
| | | } |
| | | .model-menu-action-list.length0 { |
| | | display: none; |
New file |
| | |
| | | import React, { Component } from 'react' |
| | | import { Tabs } from 'antd' |
| | | import { DndProvider, DragSource, DropTarget } from 'react-dnd' |
| | | |
| | | // Drag & Drop node |
| | | class TabNode extends Component { |
| | | render() { |
| | | const { connectDragSource, connectDropTarget, children } = this.props |
| | | |
| | | return connectDragSource(connectDropTarget(children)) |
| | | } |
| | | } |
| | | |
| | | const cardTarget = { |
| | | drop(props, monitor) { |
| | | const dragKey = monitor.getItem().index |
| | | const hoverKey = props.index |
| | | |
| | | if (dragKey === hoverKey) { |
| | | return; |
| | | } |
| | | |
| | | props.moveTabNode(dragKey, hoverKey) |
| | | monitor.getItem().index = hoverKey |
| | | } |
| | | } |
| | | |
| | | const cardSource = { |
| | | beginDrag(props) { |
| | | return { |
| | | id: props.id, |
| | | index: props.index, |
| | | } |
| | | } |
| | | } |
| | | |
| | | const WrapTabNode = DropTarget('DND_NODE', cardTarget, connect => ({ |
| | | connectDropTarget: connect.dropTarget(), |
| | | }))( |
| | | DragSource('DND_NODE', cardSource, (connect, monitor) => ({ |
| | | connectDragSource: connect.dragSource(), |
| | | isDragging: monitor.isDragging(), |
| | | }))(TabNode) |
| | | ) |
| | | |
| | | class DraggableTabs extends Component { |
| | | state = { |
| | | order: [] |
| | | } |
| | | |
| | | moveTabNode = (dragKey, hoverKey) => { |
| | | const newOrder = this.state.order.slice() |
| | | const { children } = this.props |
| | | |
| | | if (dragKey === 'tool' || hoverKey === 'tool') return |
| | | |
| | | React.Children.forEach(children, c => { |
| | | if (newOrder.indexOf(c.key) === -1) { |
| | | newOrder.push(c.key) |
| | | } |
| | | }) |
| | | |
| | | const dragIndex = newOrder.indexOf(dragKey) |
| | | const hoverIndex = newOrder.indexOf(hoverKey) |
| | | |
| | | newOrder.splice(dragIndex, 1) |
| | | newOrder.splice(hoverIndex, 0, dragKey) |
| | | let _order = newOrder.filter(item => item !== 'tool') |
| | | |
| | | this.setState({ |
| | | order: [..._order, 'tool'] |
| | | }) |
| | | this.props.tabsMove(_order) |
| | | } |
| | | |
| | | renderTabBar = (props, DefaultTabBar) => ( |
| | | <DefaultTabBar {...props}> |
| | | {node => ( |
| | | <WrapTabNode key={node.key} index={node.key} moveTabNode={this.moveTabNode}> |
| | | {node} |
| | | </WrapTabNode> |
| | | )} |
| | | </DefaultTabBar> |
| | | ) |
| | | |
| | | render() { |
| | | const { order } = this.state |
| | | const { children } = this.props |
| | | |
| | | const tabs = [] |
| | | React.Children.forEach(children, c => { |
| | | tabs.push(c) |
| | | }) |
| | | |
| | | const orderTabs = tabs.slice().sort((a, b) => { |
| | | const orderA = order.indexOf(a.key) |
| | | const orderB = order.indexOf(b.key) |
| | | |
| | | if (orderA !== -1 && orderB !== -1) { |
| | | return orderA - orderB |
| | | } |
| | | if (orderA !== -1) { |
| | | return -1 |
| | | } |
| | | if (orderB !== -1) { |
| | | return 1 |
| | | } |
| | | |
| | | const ia = tabs.indexOf(a) |
| | | const ib = tabs.indexOf(b) |
| | | |
| | | return ia - ib |
| | | }) |
| | | |
| | | return ( |
| | | <DndProvider> |
| | | <Tabs renderTabBar={this.renderTabBar} {...this.props}> |
| | | {orderTabs} |
| | | </Tabs> |
| | | </DndProvider> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default DraggableTabs |
| | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | import DraggableTabs from './dragabletabs' |
| | | |
| | | import Utils from '@/utils/utils.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | |
| | | }) |
| | | } |
| | | |
| | | moveSwitch = (index, index1) => { |
| | | moveSwitch = (order) => { |
| | | let tabs = fromJS(this.state.tabs).toJS() |
| | | tabs.subtabs[index] = tabs.subtabs.splice(index1, 1, tabs.subtabs[index])[0] |
| | | let subtab = {} |
| | | tabs.subtabs.forEach(item => { |
| | | subtab[item.uuid] = item |
| | | }) |
| | | |
| | | tabs.subtabs = [] |
| | | |
| | | order.forEach(item => { |
| | | if (subtab[item]) { |
| | | tabs.subtabs.push(subtab[item]) |
| | | } |
| | | }) |
| | | |
| | | this.setState({tabs}) |
| | | this.props.updateConfig(tabs) |
| | |
| | | |
| | | return ( |
| | | <div className="menu-tabs-edit-box" style={tabs.style}> |
| | | <Tabs defaultActiveKey="1" tabPosition={tabs.setting.position} type={tabs.setting.tabStyle}> |
| | | {tabs.subtabs.map((tab, index) => ( |
| | | <DraggableTabs tabPosition={tabs.setting.position} type={tabs.setting.tabStyle} tabsMove={this.moveSwitch}> |
| | | {tabs.subtabs.map(tab => ( |
| | | <TabPane tab={ |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <Icon className="edit" title="edit" type="edit" onClick={() => this.editTab(tab)} /> |
| | | {index !== 0 ? <Icon className="edit" type="arrow-left" onClick={() => this.moveSwitch(index, index - 1)} /> : null} |
| | | {(index + 1) !== tabs.subtabs.length ? <Icon className="edit" type="arrow-right" onClick={() => this.moveSwitch(index, index + 1)} /> : null} |
| | | <Icon className="close" title="delete" type="close" onClick={() => this.delTab(tab)} /> |
| | | </div> |
| | | } trigger="hover"> |
| | |
| | | </Popover> |
| | | } key="tool"> |
| | | </TabPane> |
| | | </Tabs> |
| | | </DraggableTabs> |
| | | <Modal |
| | | wrapClassName="popview-modal" |
| | | title={'标签编辑'} |
| | |
| | | min-height: 200px; |
| | | } |
| | | |
| | | .ant-tabs .ant-tabs-top-bar > .ant-tabs-nav-container { |
| | | >.ant-tabs-tab-next:not(.ant-tabs-tab-arrow-show) + .ant-tabs-nav-wrap > .ant-tabs-nav-scroll > .ant-tabs-nav { |
| | | width: 100%; |
| | | > div > .ant-tabs-tab-disabled { |
| | | float: right; |
| | | } |
| | | } |
| | | } |
| | | |
| | | .ant-tabs .ant-tabs-left-bar .ant-tabs-tab { |
| | | padding: 0px; |
| | | text-align: right; |
| | |
| | | _dataresource = '(' + _dataresource + ') tb' |
| | | } |
| | | |
| | | _dataresource = `select ${setting.laypage !== 'false' ? 'top 10' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable ${setting.laypage !== 'false' ? 'where rows > 0' : ''} order by tmptable.rows` |
| | | _dataresource = `select${setting.laypage !== 'false' ? ' top 10' : ''} ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource} ${_search}) tmptable ${setting.laypage !== 'false' ? 'where rows > 0' : ''} order by tmptable.rows` |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `${_customScript} |
| | | sql = `/* sql 验证 */ |
| | | ${_customScript} |
| | | ${_dataresource} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } else { |
| | | sql = _dataresource |
| | | sql = `/* sql 验证 */ |
| | | ${_dataresource}` |
| | | } |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | |
| | | console.info(sql) |
| | | |
| | | return { error, sql } |
| | | } |
| | |
| | | > |
| | | <div className="menu-style-controller"> |
| | | <Form {...formItemLayout}> |
| | | {card ? <Collapse expandIconPosition="right" destroyInactivePanel={true} defaultActiveKey={options[0]} accordion={true}> |
| | | {card ? <Collapse expandIconPosition="right" destroyInactivePanel={true} defaultActiveKey={options[0]}> |
| | | {options.includes('height') ? <Panel header="高度" key="height"> |
| | | <Col span={24}> |
| | | <Form.Item |
| | |
| | | </Collapse> : null} |
| | | </Form> |
| | | <div style={{textAlign: 'right'}}> |
| | | <Button style={{margin: '30px 10px 0px 0px'}} onClick={this.onCloseDrawer}>关闭</Button> |
| | | <Button style={{margin: '30px 10px 30px 0px'}} onClick={this.onCloseDrawer}>关闭</Button> |
| | | </div> |
| | | </div> |
| | | </Drawer> |
| | |
| | | > .ant-collapse-item { |
| | | border-color: #202735; |
| | | > .ant-collapse-header { |
| | | padding: 10px 40px 10px 16px; |
| | | padding: 7px 40px 7px 16px; |
| | | background: #262E3F; |
| | | color: rgba(255, 255, 255, 0.85); |
| | | } |
| | |
| | | width: 100%; |
| | | } |
| | | .ant-form-item { |
| | | margin-bottom: 5px; |
| | | margin-bottom: 2px; |
| | | |
| | | .ant-form-item-label > label { |
| | | color: rgba(255, 255, 255, 0.85); |
| | |
| | | .ant-input-number-input { |
| | | height: 28px; |
| | | } |
| | | } |
| | | .ant-input-group-addon { |
| | | background: transparent; |
| | | } |
| | | .ant-select-selection { |
| | | background: transparent; |
| | |
| | | overflow-y: auto; |
| | | } |
| | | .ant-drawer-body::-webkit-scrollbar { |
| | | width: 7px; |
| | | } |
| | | .ant-drawer-body::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .ant-drawer-body::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | display: none; |
| | | } |
| | | .ant-drawer-wrapper-body { |
| | | background: #262E3F; |
| | |
| | | height: 48px; |
| | | width: 48px; |
| | | line-height: 48px; |
| | | color: rgba(255, 255, 255, 0.65); |
| | | color: #ffffff; |
| | | } |
| | | } |
| | | } |
| | |
| | | return ( |
| | | <div className="style-input-box"> |
| | | <Input value={value} addonAfter={ |
| | | options.length > 1 ? |
| | | <Select value={unit} onChange={this.changeUnit}> |
| | | {options.map(item => <Option key={item} value={item}>{item}</Option>)} |
| | | </Select> |
| | | </Select> : |
| | | <div className="single-unit">{unit}</div> |
| | | } onChange={this.changeValue}/> |
| | | </div> |
| | | ) |
| | |
| | | line-height: 32px; |
| | | .ant-select { |
| | | width: 60px!important; |
| | | .ant-select-selection { |
| | | color: rgba(0, 0, 0, 0.75)!important; |
| | | } |
| | | } |
| | | .single-unit { |
| | | width: 38px; |
| | | text-align: left; |
| | | color: rgba(255, 255, 255, 0.65); |
| | | } |
| | | } |
| | |
| | | imgShow: false, // 图片放大模态框 |
| | | imgSrc: '', // 图片路径 |
| | | lineMarks: null, // 行标记 |
| | | colMap: null, // 列信息(全部) |
| | | activeIndex: null, // 标记当前选中行 |
| | | rowspan: null // 行合并字段信息 |
| | | } |
| | |
| | | let columns = JSON.parse(JSON.stringify(this.props.columns)) |
| | | let lineMarks = [] |
| | | let _columns = [] |
| | | let colMap = new Map() // 用于获取字段信息 |
| | | let radio = 5 // 虚化比例 |
| | | let _format = false // 是否虚化处理 |
| | | let rowspan = null |
| | |
| | | } |
| | | } |
| | | |
| | | // 获取行标记 |
| | | config.columns.forEach(col => { |
| | | if (!col.field) return |
| | | |
| | | colMap.set(col.field, col) |
| | | col.marks && col.marks.forEach(mark => { |
| | | if (mark.signType === 'line') { |
| | | lineMarks.push(mark) |
| | | } |
| | | }) |
| | | }) |
| | | |
| | | columns.forEach((item, index) => { |
| | |
| | | item.blur = true |
| | | } |
| | | |
| | | if (item.marks) { |
| | | item.marks = item.marks.filter(mark => { |
| | | let originField = colMap.get(mark.field) |
| | | let contrastField = mark.contrastType === 'dynamic' ? colMap.get(mark.contrastField) : '' |
| | | |
| | | if (!originField || (mark.contrastType === 'dynamic' && !contrastField)) return false |
| | | if (contrastField && originField.type !== contrastField.type) return false |
| | | if (mark.contrastType === 'static') { |
| | | if (originField.type === 'text' && typeof(mark.contrastValue) === 'number') { |
| | | return false |
| | | } else if (originField.type === 'number' && typeof(mark.contrastValue) === 'string') { |
| | | return false |
| | | } else if (!['number', 'text'].includes(originField.type)) { |
| | | return false |
| | | } |
| | | } |
| | | |
| | | if (mark.signType === 'line') { |
| | | lineMarks.push(mark) |
| | | return false |
| | | } else if (mark.signType === 'card') { |
| | | return false |
| | | } |
| | | return true |
| | | }) |
| | | if (item.marks) { // 过滤行和卡片标记 |
| | | item.marks = item.marks.filter(mark => mark.signType !== 'line' && mark.signType !== 'card') |
| | | |
| | | if (item.marks.length === 0) { |
| | | item.marks = '' |
| | |
| | | |
| | | if (col.rowspan === 'true') { |
| | | rowspan = col |
| | | } |
| | | |
| | | if (col.marks) { // 过滤行和卡片标记 |
| | | col.marks = col.marks.filter(mark => mark.signType !== 'line' && mark.signType !== 'card') |
| | | |
| | | if (col.marks.length === 0) { |
| | | col.marks = '' |
| | | } |
| | | } |
| | | |
| | | cell.children.push({ |
| | |
| | | columns: _columns, |
| | | pageSize: pageSize ? pageSize : 10, |
| | | lineMarks: lineMarks, |
| | | colMap: colMap, |
| | | rowspan: rowspan |
| | | }) |
| | | } |
| | |
| | | } |
| | | |
| | | getMark = (record, marks) => { |
| | | const { colMap } = this.state |
| | | let className = '' |
| | | let isIcon = false |
| | | let position = 'back' |
| | | let icon = '' |
| | | |
| | | marks.some(mark => { |
| | | let originField = colMap.get(mark.field) |
| | | |
| | | if (!originField) return false |
| | | |
| | | let originType = originField.type || 'text' |
| | | |
| | | let originVal = record.hasOwnProperty(mark.field) ? record[mark.field] : '' |
| | | let originVal = record[mark.field] + '' |
| | | let contrastVal = '' |
| | | if (mark.contrastType === 'static') { |
| | | contrastVal = mark.contrastValue |
| | | contrastVal = mark.contrastValue + '' |
| | | } else { |
| | | contrastVal = record.hasOwnProperty(mark.contrastField) ? record[mark.contrastField] : '' |
| | | contrastVal = record[mark.contrastField] + '' |
| | | } |
| | | |
| | | if (originType === 'text') { |
| | | originVal = '' + originVal |
| | | contrastVal = '' + contrastVal |
| | | } else if (originType === 'number' && originVal !== '' && contrastVal !== '') { |
| | | if (mark.match === '=') { |
| | | className = originVal === contrastVal ? mark.color[1] : '' |
| | | } else if (mark.match === '!=') { |
| | | className = originVal !== contrastVal ? mark.color[1] : '' |
| | | } else if (mark.match === 'like') { |
| | | className = originVal.indexOf(contrastVal) > -1 ? mark.color[1] : '' |
| | | } else if (mark.match === '>') { |
| | | try { |
| | | originVal = parseFloat(originVal) |
| | | contrastVal = parseFloat(contrastVal) |
| | | if (isNaN(originVal) || isNaN(contrastVal)) { |
| | | originVal = '' |
| | | } |
| | | } catch { |
| | | originVal = '' |
| | | originVal = NaN |
| | | } |
| | | } |
| | | |
| | | if (originVal === '' || contrastVal === '') return false |
| | | if (!isNaN(originVal) && !isNaN(contrastVal) && originVal > contrastVal) { |
| | | className = mark.color[1] |
| | | } |
| | | } else if (mark.match === '<') { |
| | | try { |
| | | originVal = parseFloat(originVal) |
| | | contrastVal = parseFloat(contrastVal) |
| | | } catch { |
| | | originVal = NaN |
| | | } |
| | | |
| | | if (mark.match === '=' && originVal === contrastVal) { |
| | | className = mark.color[1] |
| | | } else if (mark.match === '!=' && originVal !== contrastVal) { |
| | | className = mark.color[1] |
| | | } else if (mark.match === 'like' && originVal.indexOf(contrastVal) > -1) { |
| | | className = mark.color[1] |
| | | } else if (mark.match === '>' && originVal > contrastVal) { |
| | | className = mark.color[1] |
| | | } else if (mark.match === '<' && originVal < contrastVal) { |
| | | className = mark.color[1] |
| | | if (!isNaN(originVal) && !isNaN(contrastVal) && originVal < contrastVal) { |
| | | className = mark.color[1] |
| | | } |
| | | } |
| | | |
| | | if (!className) return false |
| | |
| | | |
| | | render() { |
| | | const { setting, pickup, statFValue } = this.props |
| | | const { selectedRowKeys, lineMarks, colMap, activeIndex, rowspan } = this.state |
| | | const { selectedRowKeys, lineMarks, activeIndex, rowspan } = this.state |
| | | |
| | | // 设置表格选择属性:单选、多选、不可选 |
| | | let rowSelection = null |
| | |
| | | if (lineMarks.length === 0) return className |
| | | |
| | | lineMarks.some(mark => { |
| | | let originType = colMap.get(mark.field).type |
| | | |
| | | let originVal = record.hasOwnProperty(mark.field) ? record[mark.field] : '' |
| | | let originVal = record[mark.field] + '' |
| | | let contrastVal = '' |
| | | if (mark.contrastType === 'static') { |
| | | contrastVal = mark.contrastValue |
| | | contrastVal = mark.contrastValue + '' |
| | | } else { |
| | | contrastVal = record.hasOwnProperty(mark.contrastField) ? record[mark.contrastField] : '' |
| | | contrastVal = record[mark.contrastField] + '' |
| | | } |
| | | |
| | | if (originType === 'text') { |
| | | originVal = '' + originVal |
| | | contrastVal = '' + contrastVal |
| | | } else if (originType === 'number' && originVal !== '' && contrastVal !== '') { |
| | | if (mark.match === '=') { |
| | | className = originVal === contrastVal ? 'background ' + mark.color[1] : '' |
| | | } else if (mark.match === '!=') { |
| | | className = originVal !== contrastVal ? 'background ' + mark.color[1] : '' |
| | | } else if (mark.match === 'like') { |
| | | className = originVal.indexOf(contrastVal) > -1 ? 'background ' + mark.color[1] : '' |
| | | } else if (mark.match === '>') { |
| | | try { |
| | | originVal = parseFloat(originVal) |
| | | contrastVal = parseFloat(contrastVal) |
| | | if (isNaN(originVal) || isNaN(contrastVal)) { |
| | | originVal = '' |
| | | } |
| | | } catch { |
| | | originVal = '' |
| | | originVal = NaN |
| | | } |
| | | } |
| | | |
| | | if (originVal === '' || contrastVal === '') return false |
| | | |
| | | if (mark.match === '=' && originVal === contrastVal) { |
| | | className = 'background ' + mark.color[1] |
| | | } else if (mark.match === '!=' && originVal !== contrastVal) { |
| | | className = 'background ' + mark.color[1] |
| | | } else if (mark.match === 'like' && originVal.indexOf(contrastVal) > -1) { |
| | | className = 'background ' + mark.color[1] |
| | | } else if (mark.match === '>' && originVal > contrastVal) { |
| | | className = 'background ' + mark.color[1] |
| | | } else if (mark.match === '<' && originVal < contrastVal) { |
| | | className = 'background ' + mark.color[1] |
| | | |
| | | if (!isNaN(originVal) && !isNaN(contrastVal) && originVal > contrastVal) { |
| | | className = 'background ' + mark.color[1] |
| | | } |
| | | } else if (mark.match === '<') { |
| | | try { |
| | | originVal = parseFloat(originVal) |
| | | contrastVal = parseFloat(contrastVal) |
| | | } catch { |
| | | originVal = NaN |
| | | } |
| | | |
| | | if (!isNaN(originVal) && !isNaN(contrastVal) && originVal < contrastVal) { |
| | | className = 'background ' + mark.color[1] |
| | | } |
| | | } |
| | | |
| | | if (!className) return false |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Tooltip, Modal, notification, Switch, message, Spin } from 'antd' |
| | | import { Icon, Tooltip, Modal, notification, Switch, message } from 'antd' |
| | | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | columnlist: null, // 显示列 |
| | | loading: false, // 查询显示列联动菜单 |
| | | showField: false, // 显示列字段 |
| | | modaltype: '', // 模态框控制 |
| | | card: null // 编辑中元素 |
| | |
| | | columns={columnlist} |
| | | /> |
| | | </Modal> |
| | | {this.state.loading && <Spin size="large" />} |
| | | </div> |
| | | ) |
| | | } |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Form, Row, Col, Select, Button, Input, InputNumber, Radio, Icon, Cascader, Tooltip } from 'antd' |
| | | import { Form, Row, Col, Select, Button, Input, Radio, Icon, Cascader, Tooltip } from 'antd' |
| | | |
| | | import { minkeColorSystem, minkeIconSystem } from '@/utils/option.js' |
| | | import './index.scss' |
| | |
| | | } |
| | | } |
| | | |
| | | let contFields = columns.filter(col => originField.field !== col.field && originField.type === col.type) |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} id="model-mark-form-box" className="mingke-table"> |
| | | <Row gutter={24}> |
| | |
| | | <Select> |
| | | <Select.Option value="="> = </Select.Option> |
| | | <Select.Option value="!="> != </Select.Option> |
| | | {originField.type === 'number' ? <Select.Option value=">"> > </Select.Option> : null} |
| | | {originField.type === 'number' ? <Select.Option value="<"> < </Select.Option> : null} |
| | | {originField.type === 'text' ? <Select.Option value="like"> like </Select.Option> : null} |
| | | <Select.Option value=">"> > </Select.Option> |
| | | <Select.Option value="<"> < </Select.Option> |
| | | <Select.Option value="like"> like </Select.Option> |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | |
| | | {contrastType === 'static' ? <Col span={6}> |
| | | <Form.Item label={'对比值'}> |
| | | {getFieldDecorator('contrastValue', { |
| | | initialValue: '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.input'] + '对比值!' |
| | | } |
| | | ] |
| | | })(originField.type === 'number' ? <InputNumber /> : <Input placeholder="" autoComplete="off" />)} |
| | | initialValue: '' |
| | | })(<Input placeholder="" autoComplete="off" />)} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {contrastType === 'dynamic' ? <Col span={6}> |
| | |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | > |
| | | {contFields.map(item => ( |
| | | {columns.map(item => ( |
| | | <Select.Option key={item.uuid} title={item.label + '(' + item.field + ')'} value={item.field}>{item.label + '(' + item.field + ')'}</Select.Option> |
| | | ))} |
| | | </Select> |
| | |
| | | </Row> |
| | | <Row> |
| | | {dataSource.map((item, index) => { |
| | | if (item.field.toLowerCase().indexOf(this.state.searchKey.toLowerCase()) >= 0) { |
| | | if (item.field.toLowerCase().indexOf(this.state.searchKey.toLowerCase()) >= 0 || item.label.indexOf(this.state.searchKey) >= 0) { |
| | | return ( |
| | | <Col key={index} span={8}> |
| | | <EditCardCell ref={'cellCard' + index} type={type} card={item} dict={this.props.dict} changeCard={this.changeCard} /> |
| | |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `${_customScript} |
| | | sql = `/* sql 验证 */ |
| | | ${_customScript} |
| | | ${_dataresource} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } else { |
| | | sql = _dataresource |
| | | sql = `/* sql 验证 */ |
| | | ${_dataresource}` |
| | | } |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | console.info(sql) |
| | | |
| | | return sql |
| | | } |
| | |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `${_customScript} |
| | | sql = `/* sql 验证 */ |
| | | ${_customScript} |
| | | ${_dataresource} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } else { |
| | | sql = _dataresource |
| | | sql = `/* sql 验证 */ |
| | | ${_dataresource}` |
| | | } |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | console.info(sql) |
| | | |
| | | return sql |
| | | } |
| | |
| | | } |
| | | |
| | | if (_customScript) { |
| | | sql = `${_customScript} |
| | | sql = `/* sql 验证 */ |
| | | ${_customScript} |
| | | ${_dataresource} |
| | | aaa: |
| | | if @ErrorCode!='' |
| | | insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ |
| | | ` |
| | | } else { |
| | | sql = _dataresource |
| | | sql = `/* sql 验证 */ |
| | | ${_dataresource}` |
| | | } |
| | | sql = sql.replace(/\n\s{8}/ig, '\n') |
| | | console.info(sql) |
| | | |
| | | return sql |
| | | } |
| | |
| | | import React, { Component } from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { DndProvider, DragSource, DropTarget } from 'react-dnd' |
| | | import { Table, Input, InputNumber, Popconfirm, Form, Icon, Select, Radio, Cascader, notification } from 'antd' |
| | | |
| | | import ColorSketch from '@/mob/colorsketch' |
| | |
| | | |
| | | let eTDict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | const EditableContext = React.createContext() |
| | | let dragingIndex = -1 |
| | | |
| | | class BodyRow extends React.Component { |
| | | render() { |
| | | const { isOver, connectDragSource, connectDropTarget, moveRow, ...restProps } = this.props |
| | | const style = { ...restProps.style, cursor: 'move' } |
| | | |
| | | let { className } = restProps |
| | | if (isOver) { |
| | | if (restProps.index > dragingIndex) { |
| | | className += ' drop-over-downward' |
| | | } |
| | | if (restProps.index < dragingIndex) { |
| | | className += ' drop-over-upward' |
| | | } |
| | | } |
| | | |
| | | return connectDragSource( |
| | | connectDropTarget(<tr {...restProps} className={className} style={style} />), |
| | | ) |
| | | } |
| | | } |
| | | |
| | | const rowSource = { |
| | | beginDrag(props) { |
| | | dragingIndex = props.index |
| | | return { |
| | | index: props.index, |
| | | } |
| | | } |
| | | } |
| | | |
| | | const rowTarget = { |
| | | drop(props, monitor) { |
| | | const dragIndex = monitor.getItem().index |
| | | const hoverIndex = props.index |
| | | |
| | | if (dragIndex === hoverIndex) { |
| | | return |
| | | } |
| | | |
| | | props.moveRow(dragIndex, hoverIndex) |
| | | |
| | | monitor.getItem().index = hoverIndex |
| | | }, |
| | | } |
| | | |
| | | const DragableBodyRow = DropTarget('row', rowTarget, (connect, monitor) => ({ |
| | | connectDropTarget: connect.dropTarget(), |
| | | isOver: monitor.isOver(), |
| | | }))( |
| | | DragSource('row', rowSource, connect => ({ |
| | | connectDragSource: connect.dragSource(), |
| | | }))(BodyRow), |
| | | ) |
| | | |
| | | class EditableCell extends Component { |
| | | getInput = (form) => { |
| | |
| | | ) : ( |
| | | <div className={'edit-operation-btn' + (editingKey !== '' ? ' disabled' : '')}> |
| | | {!actions || actions.includes('edit') ? <span className="primary" onClick={() => {editingKey === '' && this.edit(record.uuid)}}><Icon type="edit" /></span> : null} |
| | | {!actions || actions.includes('up') ? <span className="primary" onClick={() => {editingKey === '' && this.handleUpDown(record.uuid, 'up')}}><Icon type="arrow-up" /></span> : null} |
| | | {!actions || actions.includes('down') ? <span className="danger" onClick={() => {editingKey === '' && this.handleUpDown(record.uuid, 'down')}}><Icon type="arrow-down" /></span> : null} |
| | | {(!actions || actions.includes('del')) && editingKey === '' ? <Popconfirm |
| | | overlayClassName="popover-confirm" |
| | | title={eTDict['model.query.delete']} |
| | |
| | | }) |
| | | } |
| | | |
| | | handleUpDown = (uuid, direction) => { |
| | | let _data = fromJS(this.state.data).toJS() |
| | | const index = _data.findIndex(item => uuid === item.uuid) |
| | | |
| | | if ((index === 0 && direction === 'up') || (index === _data.length - 1 && direction === 'down')) { |
| | | return |
| | | } |
| | | |
| | | if (direction === 'up') { |
| | | _data.splice(index - 1, 0, ..._data.splice(index, 1)) |
| | | } else { |
| | | _data.splice(index + 1, 0, ..._data.splice(index, 1)) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }, () => { |
| | | this.props.onChange(_data) |
| | | }) |
| | | } |
| | | |
| | | save(form, uuid) { |
| | | const { columns } = this.state |
| | | form.validateFields((error, row) => { |
| | |
| | | this.setState({ editingKey: uuid }) |
| | | } |
| | | |
| | | moveRow = (dragIndex, hoverIndex) => { |
| | | const { editingKey } = this.state |
| | | let _data = fromJS(this.state.data).toJS() |
| | | |
| | | if (editingKey) return |
| | | |
| | | _data.splice(hoverIndex, 0, ..._data.splice(dragIndex, 1)) |
| | | |
| | | this.setState({ |
| | | data: _data |
| | | }, () => { |
| | | this.props.onChange(_data) |
| | | }) |
| | | } |
| | | |
| | | render() { |
| | | const components = { |
| | | const { actions } = this.props |
| | | |
| | | let components = { |
| | | body: { |
| | | cell: EditableCell, |
| | | cell: EditableCell |
| | | } |
| | | } |
| | | if (!actions || actions.includes('down') || actions.includes('up')) { |
| | | components.body.row = DragableBodyRow |
| | | } |
| | | |
| | | const columns = this.state.columns.map(col => { |
| | |
| | | |
| | | return ( |
| | | <EditableContext.Provider value={this.props.form}> |
| | | <div className="modal-edit-table"> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | components={components} |
| | | dataSource={this.state.data} |
| | | columns={columns} |
| | | rowClassName="editable-row" |
| | | pagination={false} |
| | | /> |
| | | <div className={'modal-edit-table ' + (this.state.editingKey ? 'editing' : '')}> |
| | | <DndProvider> |
| | | <Table |
| | | bordered |
| | | rowKey="uuid" |
| | | components={components} |
| | | dataSource={this.state.data} |
| | | columns={columns} |
| | | rowClassName="editable-row" |
| | | pagination={false} |
| | | onRow={(record, index) => ({ |
| | | index, |
| | | moveRow: this.moveRow, |
| | | })} |
| | | /> |
| | | </DndProvider> |
| | | </div> |
| | | </EditableContext.Provider> |
| | | ) |
| | |
| | | width: 100%; |
| | | } |
| | | > td { |
| | | padding: 16px 10px; |
| | | padding: 14px 10px; |
| | | } |
| | | > td:last-child { |
| | | padding: 0px; |
| | | } |
| | | } |
| | | |
| | |
| | | span { |
| | | margin-right: 10px; |
| | | cursor: pointer; |
| | | font-size: 16px; |
| | | padding: 5px; |
| | | } |
| | | .primary { |
| | | color: #1890ff; |
| | |
| | | margin: 0; |
| | | } |
| | | } |
| | | .modal-edit-table.editing { |
| | | .editable-row { |
| | | cursor: default!important; |
| | | } |
| | | } |
| | | .modal-edit-table:not(.editing) { |
| | | tr.drop-over-downward td { |
| | | border-bottom: 2px dashed #1890ff; |
| | | } |
| | | tr.drop-over-upward td { |
| | | border-top: 2px dashed #1890ff; |
| | | } |
| | | } |
| | |
| | | // 数据权限 |
| | | param.LText = param.LText.replace(/@\$|\$@/ig, '') |
| | | |
| | | console.info(`/* sql 验证 */\n${param.LText.replace(/\n\s{6,20}/ig, '\n')}`) |
| | | |
| | | param.LText = Utils.formatOptions(param.LText) |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | | param.secretkey = Utils.encrypt(param.LText, param.timestamp) |
| | |
| | | { |
| | | title: '报错编码', |
| | | dataIndex: 'errorCode', |
| | | width: '12%', |
| | | width: '13%', |
| | | editable: true, |
| | | inputType: 'select', |
| | | options: [ |
| | |
| | | { |
| | | title: '验证类型', |
| | | dataIndex: 'verifyType', |
| | | width: '13%', |
| | | width: '14%', |
| | | render: (text, record) => record.verifyType === 'logic' ? '逻辑验证' : '物理验证', |
| | | inputType: 'select', |
| | | editable: true, |
| | |
| | | { |
| | | title: '是否启用', |
| | | dataIndex: 'status', |
| | | width: '13%', |
| | | width: '14%', |
| | | editable: true, |
| | | required: false, |
| | | inputType: 'switch', |