| | |
| | | } |
| | | _style = resetStyle(_style) |
| | | |
| | | let checkAll = '' |
| | | if ((cards.subtype === 'datacard' || cards.subtype === 'dualdatacard') && card.$cardType === 'extendCard') { |
| | | checkAll = card.setting.checkAll === 'show' ? ' mk-checkable' : '' |
| | | if (checkAll && cards.wrap.selStyle === 'check square') { |
| | | checkAll = ' mk-checkable square' |
| | | } |
| | | } else if (cards.subtype === 'datacard') { |
| | | if (cards.wrap.selStyle === 'check') { |
| | | checkAll = ' mk-checkable' |
| | | } else if (cards.wrap.selStyle === 'check square') { |
| | | checkAll = ' mk-checkable square' |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Col span={card.setting.width || 6}> |
| | | <div className={'card-item ' + (card.setting.btnControl || '')} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> |
| | | <div className={'card-item ' + (card.setting.btnControl || '') + checkAll} 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={ |
| | |
| | | background: rgba(255, 255, 255, 0.55); |
| | | } |
| | | } |
| | | .card-item { |
| | | .circle-select { |
| | | position: relative; |
| | | display: none; |
| | | width: 16px; |
| | | height: 16px; |
| | | border: 1px solid #cccccc; |
| | | border-radius: 50%; |
| | | box-sizing: content-box; |
| | | margin: auto; |
| | | margin-right: 5px; |
| | | background-color: #ffffff; |
| | | transition: border-color 0.2s; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | // square |
| | | .card-item.mk-checkable { |
| | | display: flex; |
| | | .circle-select { |
| | | display: inline-block; |
| | | } |
| | | .model-menu-card-cell-list { |
| | | flex: 1; |
| | | } |
| | | } |
| | | .card-item.mk-checkable.square { |
| | | .circle-select { |
| | | border-radius: 0; |
| | | } |
| | | } |
| | |
| | | search: [], |
| | | subcards: [{ |
| | | uuid: Utils.getuuid(), |
| | | setting: { width: 24 }, |
| | | setting: { width: 24, display: 'default', position: 'bottom' }, |
| | | style: { |
| | | borderWidth: '1px', borderColor: '#e8e8e8', |
| | | paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px', |
| | | marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' |
| | | marginLeft: '8px', marginRight: '8px', marginTop: '8px' |
| | | }, |
| | | elements: [{ |
| | | uuid: Utils.getuuid(), |
| | |
| | | width: 12, |
| | | value: '循环区域' |
| | | }], |
| | | backSetting: {}, |
| | | backSetting: {width: 24}, |
| | | backStyle: { |
| | | borderLeftWidth: '1px', borderLeftColor: '#e8e8e8', |
| | | borderRightWidth: '1px', borderRightColor: '#e8e8e8', |
| | | borderBottomWidth: '1px', borderBottomColor: '#e8e8e8', |
| | | paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px' |
| | | paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px', |
| | | marginLeft: '8px', marginRight: '8px', marginBottom: '8px' |
| | | }, |
| | | backElements: [{ |
| | | uuid: Utils.getuuid(), |
| | |
| | | card.errors.push({ level: 0, detail: '数据源中无可用脚本!'}) |
| | | } else if (!card.setting.primaryKey) { |
| | | card.errors.push({ level: 0, detail: '未设置主键!'}) |
| | | } else if (!card.setting.subKey) { |
| | | card.errors.push({ level: 0, detail: '未设置子表主键!'}) |
| | | } else if (!card.setting.subBID) { |
| | | card.errors.push({ level: 0, detail: '未设置子表BID!'}) |
| | | } else if (!columns.includes(card.setting.primaryKey)) { |
| | | card.errors.push({ level: 0, detail: '主键已失效!'}) |
| | | } else if (!card.setting.supModule) { |
| | |
| | | */ |
| | | export default function (wrap, columns = [], setting) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let MenuType = '' |
| | | let menu = window.GLOB.customMenu |
| | | // let MenuType = '' |
| | | // let menu = window.GLOB.customMenu |
| | | let laypage = setting && setting.laypage !== 'false' |
| | | |
| | | if (menu.parentId === 'BillPrintTemp') { |
| | | MenuType = 'billPrint' |
| | | } |
| | | // if (menu.parentId === 'BillPrintTemp') { |
| | | // MenuType = 'billPrint' |
| | | // } |
| | | |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | |
| | |
| | | precision: 0, |
| | | required: true |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'layout', |
| | | label: '卡片布局', |
| | | initval: wrap.layout || 'grid', |
| | | tooltip: appType === 'mob' ? '弹性布局时,滑动加载无效' : '', |
| | | required: false, |
| | | options: [ |
| | | {value: 'grid', label: '栅格布局'}, |
| | | {value: 'flex', label: '弹性布局'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'printHeight', values: ['flex']}, |
| | | {field: 'cardFloat', values: ['grid']}, |
| | | ] |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // field: 'layout', |
| | | // label: '卡片布局', |
| | | // initval: wrap.layout || 'grid', |
| | | // tooltip: appType === 'mob' ? '弹性布局时,滑动加载无效' : '', |
| | | // required: false, |
| | | // options: [ |
| | | // {value: 'grid', label: '栅格布局'}, |
| | | // {value: 'flex', label: '弹性布局'}, |
| | | // ], |
| | | // controlFields: [ |
| | | // {field: 'printHeight', values: ['flex']}, |
| | | // {field: 'cardFloat', values: ['grid']}, |
| | | // ] |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | field: 'pagestyle', |
| | |
| | | {value: 'check square', label: '勾选(方框)'} |
| | | ] |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'cardFloat', |
| | | label: '对齐方式', |
| | | initval: wrap.cardFloat || 'left', |
| | | tooltip: '设置卡片的对齐方式。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'left', label: '左对齐'}, |
| | | {value: 'center', label: '居中'}, |
| | | {value: 'right', label: '右对齐'}, |
| | | ], |
| | | }, |
| | | // { |
| | | // type: 'radio', |
| | | // field: 'cardFloat', |
| | | // label: '对齐方式', |
| | | // initval: wrap.cardFloat || 'left', |
| | | // tooltip: '设置卡片的对齐方式。', |
| | | // required: false, |
| | | // options: [ |
| | | // {value: 'left', label: '左对齐'}, |
| | | // {value: 'center', label: '居中'}, |
| | | // {value: 'right', label: '右对齐'}, |
| | | // ], |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | field: 'parity', |
| | |
| | | {value: 'true', label: '有'}, |
| | | ], |
| | | }, |
| | | { |
| | | type: 'number', |
| | | field: 'printHeight', |
| | | label: '换算高度', |
| | | initval: wrap.printHeight || '', |
| | | tooltip: '当前数据卡高度相当于几条数据。', |
| | | required: false, |
| | | forbid: MenuType !== 'billPrint' |
| | | }, |
| | | // { |
| | | // type: 'number', |
| | | // field: 'printHeight', |
| | | // label: '换算高度', |
| | | // initval: wrap.printHeight || '', |
| | | // tooltip: '当前数据卡高度相当于几条数据。', |
| | | // required: false, |
| | | // forbid: MenuType !== 'billPrint' |
| | | // }, |
| | | { |
| | | type: 'radio', |
| | | field: 'empty', |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Popover, Col } from 'antd' |
| | | import { PlusOutlined, PlusSquareOutlined, EditOutlined, ToolOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | import { UpOutlined, PlusOutlined, PlusSquareOutlined, EditOutlined, ToolOutlined, FontColorsOutlined } from '@ant-design/icons' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | |
| | | } |
| | | |
| | | getSettingForms = () => { |
| | | const { cards } = this.props |
| | | const { card } = this.state |
| | | |
| | | let buttons = [] |
| | |
| | | } |
| | | }) |
| | | |
| | | return getSettingForm(card.setting, buttons) |
| | | return getSettingForm(card.setting, buttons, cards.columns, 'main') |
| | | } |
| | | |
| | | getBackSettingForms = () => { |
| | | const { cards } = this.props |
| | | const { card } = this.state |
| | | |
| | | let buttons = [] |
| | |
| | | } |
| | | }) |
| | | |
| | | return getSettingForm(card.backSetting, buttons) |
| | | return getSettingForm(card.backSetting, buttons, cards.subColumns) |
| | | } |
| | | |
| | | updateSetting = (res, type) => { |
| | |
| | | |
| | | let _style = {...card.style} |
| | | let _backStyle = {...card.backStyle} |
| | | |
| | | _backStyle.marginLeft = _style.marginLeft |
| | | _backStyle.marginRight = _style.marginRight |
| | | _backStyle.marginBottom = _style.marginBottom |
| | | |
| | | delete _style.marginBottom |
| | | let _wrapStyle = {} |
| | | |
| | | _style = resetStyle(_style) |
| | | _backStyle = resetStyle(_backStyle) |
| | | |
| | | if (card.setting.position === 'inner') { |
| | | Object.keys(_style).forEach(key => { |
| | | if (!/^(margin|border|box)/.test(key)) return |
| | | _wrapStyle[key] = _style[key] |
| | | delete _style[key] |
| | | }) |
| | | } |
| | | |
| | | let checkAll = '' |
| | | if (cards.wrap.selStyle === 'check') { |
| | | checkAll = 'mk-checkable' |
| | | } else if (cards.wrap.selStyle === 'check square') { |
| | | checkAll = 'mk-checkable square' |
| | | } |
| | | |
| | | return ( |
| | | <Col span={card.setting.width || 24}> |
| | | <div className="card-item-wrap"> |
| | | <div className={'card-item ' + (card.setting.btnControl || '')} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> |
| | | <div className="card-item-wrap" style={_wrapStyle}> |
| | | <div className={`card-item ${card.setting.btnControl || ''} ${checkAll} mk-${card.setting.display}`} style={_style} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard()}} id={card.uuid}> |
| | | <span className="circle-select"></span> |
| | | {card.setting.controlIcon === 'left' ? <PlusSquareOutlined /> : <UpOutlined />} |
| | | <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"> |
| | |
| | | </div> |
| | | <CardCellComponent cards={cards} cardCell={card} side="main" elements={card.elements} updateElement={(elements, btn) => this.updateCard(elements, btn)}/> |
| | | </div> |
| | | <div className={'card-item ' + (card.backSetting.btnControl || '')} style={_backStyle} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard('sub')}} id={card.uuid}> |
| | | <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('sub')} /> |
| | | <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.addButton('sub')} /> |
| | | <NormalForm title={'循环子卡片设置'} width={950} update={(res) => this.updateSetting(res, 'sub')} getForms={this.getBackSettingForms}> |
| | | <EditOutlined className="edit" title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="cardcell" card={card}/> |
| | | <PasteController options={['action', 'customCardElement']} updateConfig={(element, resolve) => this.paste(element, resolve, 'sub')} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={() => this.changeStyle('sub')} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | <Col span={card.backSetting.width || 24}> |
| | | <div className={'card-item ' + (card.backSetting.btnControl || '')} style={_backStyle} onDoubleClick={(e) => {e.stopPropagation(); this.doubleClickCard('sub')}} id={card.uuid}> |
| | | <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('sub')} /> |
| | | <PlusSquareOutlined className="plus" title="添加按钮" onClick={() => this.addButton('sub')} /> |
| | | <NormalForm title={'循环子卡片设置'} width={950} update={(res) => this.updateSetting(res, 'sub')} getForms={this.getBackSettingForms}> |
| | | <EditOutlined className="edit" title="编辑"/> |
| | | </NormalForm> |
| | | <CopyComponent type="cardcell" card={card}/> |
| | | <PasteController options={['action', 'customCardElement']} updateConfig={(element, resolve) => this.paste(element, resolve, 'sub')} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={() => this.changeStyle('sub')} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | </div> |
| | | <CardCellComponent cards={cards} cardCell={card} side="sub" elements={card.backElements} updateElement={(elements, btn) => this.updateCard(elements, btn, 'sub')}/> |
| | | </div> |
| | | <CardCellComponent cards={cards} cardCell={card} side="sub" elements={card.backElements} updateElement={(elements, btn) => this.updateCard(elements, btn, 'sub')}/> |
| | | </div> |
| | | </Col> |
| | | </div> |
| | | </Col> |
| | | ) |
| | |
| | | background: rgba(255, 255, 255, 0.55); |
| | | } |
| | | } |
| | | |
| | | .card-item { |
| | | >.circle-select { |
| | | position: relative; |
| | | display: none; |
| | | width: 16px; |
| | | height: 16px; |
| | | border: 1px solid #cccccc; |
| | | border-radius: 50%; |
| | | box-sizing: content-box; |
| | | margin: auto; |
| | | margin-right: 5px; |
| | | background-color: #ffffff; |
| | | transition: border-color 0.2s; |
| | | cursor: pointer; |
| | | } |
| | | >.anticon-up { |
| | | position: absolute; |
| | | bottom: 10px; |
| | | right: 10px; |
| | | display: none; |
| | | } |
| | | >.anticon-plus-square { |
| | | margin: auto 5px; |
| | | font-size: 18px; |
| | | } |
| | | } |
| | | // square |
| | | .card-item.mk-checkable { |
| | | display: flex; |
| | | .circle-select { |
| | | display: inline-block; |
| | | } |
| | | .model-menu-card-cell-list { |
| | | flex: 1; |
| | | } |
| | | } |
| | | .card-item.mk-checkable.square { |
| | | .circle-select { |
| | | border-radius: 0; |
| | | } |
| | | } |
| | | .card-item.mk-unfold, .card-item.mk-collapse { |
| | | >.anticon-up { |
| | | display: inline-block; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * @description Setting表单配置信息 |
| | | */ |
| | | export default function (setting, buttons = []) { |
| | | export default function (setting, buttons = [], columns, type) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let menulist = [] |
| | | |
| | |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'display', |
| | | label: '子表显示', |
| | | initval: setting.display || 'default', |
| | | tooltip: '展开与合并为用户可自行切换。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'default', label: '默认'}, |
| | | {value: 'unfold', label: '展开'}, |
| | | {value: 'collapse', label: '合并'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'position', values: ['default']}, |
| | | {field: 'controlIcon', values: ['unfold', 'collapse']}, |
| | | ], |
| | | forbid: type !== 'main' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'controlIcon', |
| | | label: '控制图标', |
| | | initval: setting.controlIcon || 'left', |
| | | required: false, |
| | | options: [ |
| | | {value: 'left', label: '左侧'}, |
| | | {value: 'right', label: '右侧'}, |
| | | ], |
| | | forbid: type !== 'main' |
| | | }, |
| | | { |
| | | type: 'radio', |
| | | field: 'position', |
| | | label: '子表位置', |
| | | initval: setting.position || 'bottom', |
| | | required: false, |
| | | options: [ |
| | | {value: 'bottom', label: '主表下方'}, |
| | | {value: 'inner', label: '主表内'}, |
| | | ], |
| | | forbid: type !== 'main' |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'bgField', |
| | | label: '背景图', |
| | | initval: setting.bgField || '', |
| | | tooltip: '动态背景,背景图片由字段值控制。请注意调整背景样式。', |
| | | required: false, |
| | | options: columns |
| | | }, |
| | | { |
| | | type: 'select', |
| | | field: 'click', |
| | | label: '点击事件', |
| | | initval: setting.click || '', |
| | |
| | | {value: '', label: '无'}, |
| | | {value: 'menu', label: '菜单'}, |
| | | {value: 'link', label: '链接'}, |
| | | {value: 'button', label: '按钮'} |
| | | {value: 'button', label: '按钮'}, |
| | | {value: 'unfold', label: '子表缩放', disabled: type !== 'main'}, |
| | | ], |
| | | controlFields: [ |
| | | {field: 'menu', values: ['menu']}, |
| | |
| | | {field: 'open', values: ['menu', 'link']}, |
| | | {field: 'joint', values: ['menu', 'link']}, |
| | | {field: 'linkbtn', values: ['button']}, |
| | | {field: 'clickType', values: ['button']}, |
| | | {field: 'clickType', values: ['button', 'unfold']}, |
| | | ] |
| | | }, |
| | | { |
| | |
| | | const CustomChart = asyncComponent(() => import('@/menu/components/chart/chart-custom')) |
| | | const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline')) |
| | | const AntvG6 = asyncComponent(() => import('@/menu/components/chart/antv-G6')) |
| | | const DoubleDataCard = asyncComponent(() => import('@/menu/components/card/double-data-card')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, delCard, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | return (<TableCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'table' && card.subtype === 'normaltable') { |
| | | return (<NormalTable card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'card' && card.subtype === 'dualdatacard') { |
| | | return (<DoubleDataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'table' && card.subtype === 'editable') { |
| | | return (<EditTable card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'carousel' && card.subtype === 'datacard') { |
| | |
| | | const CustomChart = asyncComponent(() => import('@/menu/components/chart/chart-custom')) |
| | | const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline')) |
| | | const AntvG6 = asyncComponent(() => import('@/menu/components/chart/antv-G6')) |
| | | const DoubleDataCard = asyncComponent(() => import('@/menu/components/card/double-data-card')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | return (<DataCard card={card} updateConfig={updateConfig} deletecomponent={delCard} />) |
| | | } else if (card.type === 'card' && card.subtype === 'propcard') { |
| | | return (<PropCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'card' && card.subtype === 'dualdatacard') { |
| | | return (<DoubleDataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'carousel' && card.subtype === 'datacard') { |
| | | return (<CarouselDataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'carousel' && card.subtype === 'propcard') { |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {config.subtype === 'dualdatacard' ? <Col span={8}> |
| | | <Form.Item label="子表BID"> |
| | | {getFieldDecorator('subBID', { |
| | | initialValue: setting.subBID || '' |
| | | })( |
| | | <Select> |
| | | {columns.map((option, i) => |
| | | <Select.Option key={i} value={option.field}> |
| | | {option.label} |
| | | </Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | </Row> |
| | | </Form> |
| | | </div> |
| | |
| | | { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '数据卡', width: 24 }, |
| | | { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '属性卡', width: 24 }, |
| | | { type: 'menu', url: card2, component: 'balcony', subtype: 'balcony', title: '浮动卡', width: 24}, |
| | | // { type: 'menu', url: card1, component: 'card', subtype: 'dualdatacard', title: '双重数据卡', width: 24 }, |
| | | { type: 'menu', url: card1, component: 'card', subtype: 'dualdatacard', title: '双重数据卡', width: 24 }, |
| | | { type: 'menu', url: simpleform, component: 'form', subtype: 'simpleform', title: '表单', width: 24, forbid: ['billPrint'] }, |
| | | { type: 'menu', url: form, component: 'form', subtype: 'stepform', title: '表单(分步)', width: 24, forbid: ['billPrint'] }, |
| | | { type: 'menu', url: tabForm, component: 'form', subtype: 'tabform', title: '表单(tab页)', width: 24, forbid: ['billPrint'] }, |
| | |
| | | const Balcony = asyncComponent(() => import('@/menu/components/card/balcony')) |
| | | const CodeSandbox = asyncComponent(() => import('@/menu/components/code/sandbox')) |
| | | const Timeline = asyncComponent(() => import('@/menu/components/timeline/normal-timeline')) |
| | | const DoubleDataCard = asyncComponent(() => import('@/menu/components/card/double-data-card')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | return (<DataCard card={card} updateConfig={updateConfig} deletecomponent={delCard} />) |
| | | } else if (card.type === 'card' && card.subtype === 'propcard') { |
| | | return (<PropCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'card' && card.subtype === 'dualdatacard') { |
| | | return (<DoubleDataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'carousel' && card.subtype === 'datacard') { |
| | | return (<CarouselDataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'carousel' && card.subtype === 'propcard') { |
| | |
| | | const OfficialAccount = asyncComponent(() => import('@/mob/components/official')) |
| | | const ShareCode = asyncComponent(() => import('@/mob/components/sharecode')) |
| | | const Iframe = asyncComponent(() => import('@/menu/components/iframe')) |
| | | const DoubleDataCard = asyncComponent(() => import('@/menu/components/card/double-data-card')) |
| | | |
| | | const Card = ({ id, card, moveCard, findCard, delCard, unGroup, updateConfig }) => { |
| | | const originalIndex = findCard(id).index |
| | |
| | | return (<DataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'card' && card.subtype === 'propcard') { |
| | | return (<PropCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'card' && card.subtype === 'dualdatacard') { |
| | | return (<DoubleDataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'carousel' && card.subtype === 'datacard') { |
| | | return (<CarouselDataCard card={card} updateConfig={updateConfig} deletecomponent={delCard}/>) |
| | | } else if (card.type === 'carousel' && card.subtype === 'propcard') { |
| | |
| | | { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '数据卡', width: 24 }, |
| | | { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '属性卡', width: 24 }, |
| | | { type: 'menu', url: card2, component: 'balcony', subtype: 'balcony', title: '浮动卡', width: 24 }, |
| | | { type: 'menu', url: card1, component: 'card', subtype: 'dualdatacard', title: '双重数据卡', width: 24 }, |
| | | { type: 'menu', url: form, component: 'form', subtype: 'simpleform', title: '表单', width: 24 }, |
| | | { type: 'menu', url: form, component: 'form', subtype: 'stepform', title: '表单(分步)', width: 24 }, |
| | | { type: 'menu', url: tabForm, component: 'form', subtype: 'tabform', title: '表单(tab页)', width: 24 }, |
| | |
| | | { type: 'menu', url: card1, component: 'card', subtype: 'datacard', title: '数据卡', width: 24 }, |
| | | { type: 'menu', url: card2, component: 'card', subtype: 'propcard', title: '属性卡', width: 24 }, |
| | | { type: 'menu', url: card2, component: 'balcony', subtype: 'balcony', title: '浮动卡', width: 24 }, |
| | | { type: 'menu', url: card1, component: 'card', subtype: 'dualdatacard', title: '双重数据卡', width: 24 }, |
| | | { type: 'menu', url: form, component: 'form', subtype: 'stepform', title: '表单(分步)', width: 24 }, |
| | | { type: 'menu', url: tabForm, component: 'form', subtype: 'tabform', title: '表单(tab页)', width: 24 }, |
| | | { type: 'menu', url: Carousel, component: 'carousel', subtype: 'datacard', title: '轮播-动态数据', width: 24 }, |
| | |
| | | } |
| | | |
| | | doubleClick = () => { |
| | | const { card, data, cards } = this.props |
| | | const { card, data, cards, onDoubleClick } = this.props |
| | | |
| | | onDoubleClick && onDoubleClick() |
| | | |
| | | if (card.setting.click !== 'button' || card.setting.clickType !== 'multi' || data.$disabled) return |
| | | |
| | | if (card.setting.linkbtn) { |
| | |
| | | |
| | | _config.subcards = null |
| | | |
| | | let _cols = new Map() |
| | | |
| | | let _data = null |
| | | let _sync = _config.setting.sync === 'true' |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | _card.elements = _card.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | _card.backElements = _card.backElements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | let supComs = null |
| | | if (_config.wrap.supType === 'multi') { |
| | |
| | | ) |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | export default DataCard |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Spin, Empty, notification, Row, Col, Pagination, Modal } from 'antd' |
| | | import { DownOutlined, UpOutlined, PlusSquareOutlined, MinusSquareOutlined } from '@ant-design/icons' |
| | | |
| | | import Api from '@/api' |
| | | import Utils from '@/utils/utils.js' |
| | | import UtilsDM from '@/utils/utils-datamanage.js' |
| | | import preImg from '@/assets/img/prev.png' |
| | | import nextImg from '@/assets/img/next.png' |
| | | import MKEmitter from '@/utils/events.js' |
| | | import TimerTask from '@/utils/timer-task.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | | const CardItem = asyncComponent(() => import('../cardItem')) |
| | | const MainAction = asyncComponent(() => import('@/tabviews/zshare/actionList')) |
| | | const NormalHeader = asyncComponent(() => import('@/tabviews/custom/components/share/normalheader')) |
| | | |
| | | class DoubleDataCard extends Component { |
| | | static propTpyes = { |
| | | data: PropTypes.array, // 统一查询数据 |
| | | config: PropTypes.object, // 组件配置信息 |
| | | mainSearch: PropTypes.any, // 外层搜索条件 |
| | | } |
| | | |
| | | state = { |
| | | BID: '', // 上级ID |
| | | BData: '', // 上级行数据 |
| | | config: null, // 图表配置信息 |
| | | search: null, // 搜索条件 |
| | | pageIndex: 1, // 页码 |
| | | activeKey: '', // 选中卡 |
| | | selectKeys: [], // 多选时选中卡片 |
| | | selectedData: [], // 选中数据,用于工具栏按钮 |
| | | loading: false, // 数据加载状态 |
| | | card: null, // 卡片设置 |
| | | data: null, // 数据 |
| | | total: null, |
| | | precards: [], |
| | | nextcards: [], |
| | | selected: 'false', |
| | | opens: [], |
| | | wrapStyle: null, |
| | | subcard: null, |
| | | subconfig: null |
| | | } |
| | | |
| | | loaded = false |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let _config = fromJS(this.props.config).toJS() |
| | | |
| | | let BID = '' |
| | | let BData = '' |
| | | |
| | | if (_config.setting.supModule) { |
| | | BData = window.GLOB.CacheData.get(_config.setting.supModule) |
| | | } else { |
| | | BData = window.GLOB.CacheData.get(_config.$pageId) |
| | | } |
| | | if (BData) { |
| | | BID = BData.$BID || '' |
| | | } |
| | | |
| | | let _card = null |
| | | let precards = [] |
| | | let nextcards = [] |
| | | |
| | | if (_config.wrap.controlField) { |
| | | if (_config.wrap.controlVal) { |
| | | _config.wrap.controlVal = _config.wrap.controlVal.split(',') |
| | | } else { |
| | | _config.wrap.controlVal = [''] |
| | | } |
| | | } |
| | | |
| | | _config.subcards.forEach(item => { |
| | | if (item.setting.click === 'button' && !item.setting.linkbtn) { |
| | | item.elements.forEach(ele => { |
| | | if (ele.eleType === 'button') { |
| | | item.setting.linkbtn = ele.uuid |
| | | } |
| | | }) |
| | | if (!item.setting.linkbtn) { |
| | | item.setting.click = '' |
| | | } |
| | | } |
| | | |
| | | if (item.$cardType !== 'extendCard') { |
| | | _card = item |
| | | } else if (!_card) { |
| | | precards.push(item) |
| | | } else { |
| | | nextcards.push(item) |
| | | } |
| | | }) |
| | | |
| | | _config.subcards = null |
| | | |
| | | let _data = null |
| | | |
| | | let selected = 'false' |
| | | if (_config.wrap.selected === 'always' || _config.wrap.selected === 'init' || _config.wrap.selected === 'sign') { |
| | | selected = _config.wrap.selected |
| | | } else { |
| | | _config.wrap.selected = 'false' |
| | | } |
| | | |
| | | _config.wrap.selStyle = _config.wrap.selStyle || 'active' |
| | | _config.wrap.pagestyle = _config.wrap.pagestyle || 'page' |
| | | |
| | | _config.wrap.wrapClass = `${_config.wrap.selStyle} ${_config.wrap.cardType || ''}` |
| | | |
| | | this.loaded = _data !== null |
| | | |
| | | let wrapStyle = null |
| | | let subcard = fromJS(_card).toJS() |
| | | let subconfig = fromJS(_config).toJS() |
| | | |
| | | subconfig.columns = subconfig.subColumns || [] |
| | | |
| | | subcard.style = subcard.backStyle |
| | | subcard.elements = subcard.backElements |
| | | subcard.setting = subcard.backSetting |
| | | |
| | | if (_card.setting.position === 'inner') { |
| | | wrapStyle = {} |
| | | Object.keys(_card.style).forEach(key => { |
| | | if (!/^(margin|border|box)/.test(key)) return |
| | | wrapStyle[key] = _card.style[key] |
| | | delete _card.style[key] |
| | | }) |
| | | } |
| | | |
| | | _config.setting.sub_field = subconfig.columns.map(col => col.field).join(',') |
| | | |
| | | this.setState({ |
| | | selected, |
| | | precards, |
| | | nextcards, |
| | | data: _data, |
| | | BID: BID || '', |
| | | BData: BData || '', |
| | | config: _config, |
| | | subcard: subcard, |
| | | subconfig: subconfig, |
| | | wrapStyle: wrapStyle, |
| | | card: _card, |
| | | search: Utils.initMainSearch(_config.search), |
| | | arr_field: _config.columns.map(col => col.field).join(','), |
| | | }, () => { |
| | | if (_config.setting.onload === 'true') { |
| | | setTimeout(() => { |
| | | this.loadData() |
| | | }, _config.setting.delay || 0) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | componentDidMount () { |
| | | const { config } = this.state |
| | | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.addListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | if (config.timer) { |
| | | this.timer = new TimerTask() |
| | | this.timer.init(config.uuid, config.timer, config.timerRepeats, () => { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData('', 'timer') |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (config.$cache && !this.loaded) { |
| | | Api.getLCacheConfig(config.uuid).then(res => { |
| | | if (!res || this.loaded) return |
| | | let _data = res.map((item, index) => { |
| | | if (item[config.setting.subdata]) { |
| | | let _children = item[config.setting.subdata] |
| | | |
| | | delete item[config.setting.subdata] |
| | | |
| | | item.children = _children.map((cell, i) => { |
| | | cell.key = i |
| | | cell.$$uuid = cell[config.setting.subKey] || '' |
| | | cell.$$BID = item[config.setting.primaryKey] || '' |
| | | cell.$$BData = {...item} |
| | | cell.$Index = i + 1 + '' |
| | | |
| | | return cell |
| | | }) |
| | | } else { |
| | | item.children = [] |
| | | } |
| | | |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | |
| | | this.setState({data: _data}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.state), fromJS(nextState)) |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | const { config } = this.state |
| | | |
| | | if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) { |
| | | this.setState({pageIndex: 1}, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | componentWillUnmount () { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('resetSelectLine', this.resetParentParam) |
| | | MKEmitter.removeListener('queryModuleParam', this.queryModuleParam) |
| | | MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult) |
| | | |
| | | this.timer && this.timer.stop() |
| | | } |
| | | |
| | | /** |
| | | * @description 按钮执行完成后页面刷新 |
| | | * @param {*} menuId // 菜单Id |
| | | * @param {*} position // 刷新位置 |
| | | * @param {*} btn // 执行的按钮 |
| | | */ |
| | | refreshByButtonResult = (menuId, position, btn, id = '', lines) => { |
| | | const { config, BID } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let supModule = config.setting.supModule |
| | | |
| | | if (position === 'line') { |
| | | if (lines && lines.length === 1) { |
| | | this.loadLinedata(lines[0].$$uuid) |
| | | } else { |
| | | this.loadData(id) |
| | | } |
| | | } else if ((position === 'mainline' || position === 'popclose') && supModule && BID) { // 刷新源组件时,附带刷新上级行与当前组件 |
| | | MKEmitter.emit('reloadData', supModule, BID) |
| | | } else if (!btn || btn.resetPageIndex !== 'false') { |
| | | this.setState({ |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData(id) |
| | | }) |
| | | } else { |
| | | this.loadData(id) |
| | | } |
| | | |
| | | if (position === 'popclose') { // 执行启动弹窗的按钮所选择的刷新项 |
| | | btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId) |
| | | } |
| | | } |
| | | |
| | | checkTopLine = (id) => { |
| | | const { config, data, selected } = this.state |
| | | |
| | | if (!data || data.length === 0) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | selectedData: [] |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | return |
| | | } |
| | | |
| | | if (selected === 'sign') { |
| | | let index = '' |
| | | let keys = [] |
| | | let items = [] |
| | | let last = '' |
| | | data.forEach((item, i) => { |
| | | if (!item.$disabled && item.selected === 'true') { |
| | | items.push(item) |
| | | keys.push(i) |
| | | index = i |
| | | last = item |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | activeKey: index, |
| | | selectKeys: keys, |
| | | selectedData: items |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, last ? last.$$uuid : '', last) |
| | | return |
| | | } |
| | | |
| | | let index = 0 |
| | | if (id) { |
| | | index = data.findIndex(item => item.$$uuid === id) |
| | | if (index === -1) { |
| | | index = 0 |
| | | } |
| | | } |
| | | |
| | | if (data[index].$disabled) { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | selectedData: [] |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | activeKey: index, |
| | | selectKeys: [index], |
| | | selectedData: [data[index]] |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, data[index].$$uuid, data[index]) |
| | | } |
| | | |
| | | checkAll = () => { |
| | | const { config, data, selectedData } = this.state |
| | | |
| | | if (!data || data.length === 0) return |
| | | |
| | | if (selectedData.length === 0 || selectedData.length < data.length) { |
| | | let index = '' |
| | | let keys = [] |
| | | let items = [] |
| | | let last = '' |
| | | |
| | | data.forEach((item, i) => { |
| | | if (item.$disabled) return |
| | | |
| | | items.push(item) |
| | | keys.push(i) |
| | | index = i |
| | | last = item |
| | | }) |
| | | |
| | | this.setState({ |
| | | activeKey: index, |
| | | selectKeys: keys, |
| | | selectedData: items |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, last ? last.$$uuid : '', last) |
| | | } else { |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | selectedData: [] |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | } |
| | | } |
| | | |
| | | reloadData = (menuId, id) => { |
| | | const { config } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | if (!id) { |
| | | this.loadData() |
| | | } else { |
| | | this.loadLinedata(id) |
| | | } |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { config } = this.state |
| | | |
| | | if (!config.setting.supModule || config.setting.supModule !== MenuID) return |
| | | if (id !== this.state.BID || id !== '') { |
| | | this.setState({ BID: id, BData: data, pageIndex: 1 }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 导出Excel时,获取页面搜索排序等参数 |
| | | */ |
| | | queryModuleParam = (menuId, callback) => { |
| | | const { mainSearch } = this.props |
| | | const { arr_field, config, search } = this.state |
| | | |
| | | if (config.uuid !== menuId) return |
| | | |
| | | let searches = search ? fromJS(search).toJS() : [] |
| | | if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | | let keys = searches.map(item => item.key.toLowerCase()) |
| | | mainSearch.forEach(item => { |
| | | if (!keys.includes(item.key.toLowerCase())) { |
| | | searches.push(item) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | callback({ |
| | | arr_field: arr_field, |
| | | orderBy: config.setting.order || '', |
| | | search: searches, |
| | | menuName: config.name |
| | | }) |
| | | } |
| | | |
| | | async loadData (id, type) { |
| | | const { mainSearch } = this.props |
| | | const { config, arr_field, pageIndex, search, BID, BData, selected, card } = this.state |
| | | |
| | | if (config.setting.supModule && !BID && config.wrap.supKey !== 'false') { // BID 不存在时,不做查询 |
| | | this.loaded = true |
| | | |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | selectedData: [], |
| | | pageIndex: 1, |
| | | data: [], |
| | | opens: [], |
| | | total: 0, |
| | | loading: false |
| | | }) |
| | | |
| | | if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { |
| | | setTimeout(() => { |
| | | this.checkTopLine(id) |
| | | }, 200) |
| | | if (selected === 'init') { |
| | | this.setState({selected: 'false'}) |
| | | } |
| | | } else { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | } |
| | | return |
| | | } |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | | let keys = searches.map(item => item.key.toLowerCase()) |
| | | mainSearch.forEach(item => { |
| | | if (!keys.includes(item.key.toLowerCase())) { |
| | | searches.push(item) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | let requireFields = searches.filter(item => item.required && item.value === '') |
| | | if (requireFields.length > 0) { |
| | | return |
| | | } |
| | | |
| | | if (type !== 'timer') { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | } |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, config.setting.pageSize, BID) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let start = 1 |
| | | if (config.setting.laypage) { |
| | | start = config.setting.pageSize * (pageIndex - 1) + 1 |
| | | } |
| | | |
| | | this.loaded = true |
| | | if (config.$cache && pageIndex === 1) { |
| | | Api.writeCacheConfig(config.uuid, result.data || '') |
| | | } |
| | | |
| | | if (selected !== 'false' || (id && config.wrap.selected !== 'false')) { |
| | | setTimeout(() => { |
| | | this.checkTopLine(id) |
| | | }, 200) |
| | | if (selected === 'init') { |
| | | this.setState({selected: 'false'}) |
| | | } |
| | | } else { |
| | | MKEmitter.emit('resetSelectLine', config.uuid, '', '') |
| | | } |
| | | |
| | | let data = [] |
| | | let opens = [] |
| | | |
| | | if (type === 'plus') { |
| | | let _data = (this.state.data || []).concat(result.data || []) |
| | | data = _data.map((item, index) => { |
| | | if (item[config.setting.subdata]) { |
| | | let _children = item[config.setting.subdata] |
| | | |
| | | delete item[config.setting.subdata] |
| | | |
| | | item.children = _children.map((cell, i) => { |
| | | cell.key = i |
| | | cell.$$uuid = cell[config.setting.subKey] || '' |
| | | cell.$$BID = item[config.setting.primaryKey] || '' |
| | | cell.$$BData = {...item} |
| | | cell.$Index = i + 1 + '' |
| | | |
| | | return cell |
| | | }) |
| | | } else { |
| | | item.children = [] |
| | | } |
| | | |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + 1 + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | |
| | | return item |
| | | }) |
| | | } else { |
| | | data = result.data.map((item, index) => { |
| | | if (item[config.setting.subdata]) { |
| | | let _children = item[config.setting.subdata] |
| | | |
| | | delete item[config.setting.subdata] |
| | | |
| | | item.children = _children.map((cell, i) => { |
| | | cell.key = i |
| | | cell.$$uuid = cell[config.setting.subKey] || '' |
| | | cell.$$BID = item[config.setting.primaryKey] || '' |
| | | cell.$$BData = {...item} |
| | | cell.$Index = i + 1 + '' |
| | | |
| | | return cell |
| | | }) |
| | | } else { |
| | | item.children = [] |
| | | } |
| | | |
| | | item.key = index |
| | | item.$$uuid = item[config.setting.primaryKey] || '' |
| | | item.$$BID = BID || '' |
| | | item.$$BData = BData || '' |
| | | item.$Index = index + start + '' |
| | | |
| | | if (config.wrap.controlField) { |
| | | if (config.wrap.controlVal.includes(item[config.wrap.controlField])) { |
| | | item.$disabled = true |
| | | } |
| | | } |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | if (card.setting.display === 'unfold') { |
| | | opens = data.map(item => item.key) |
| | | } else { |
| | | opens = [] |
| | | } |
| | | |
| | | this.setState({ |
| | | activeKey: '', |
| | | selectKeys: [], |
| | | opens: opens, |
| | | selectedData: [], |
| | | data: data, |
| | | total: result.total, |
| | | loading: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | this.timer && this.timer.stop() |
| | | if (result.ErrCode === 'N') { |
| | | Modal.error({ |
| | | title: result.message, |
| | | }) |
| | | } else { |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取单行数据 |
| | | */ |
| | | async loadLinedata (id) { |
| | | const { mainSearch } = this.props |
| | | const { config, arr_field, pageIndex, search, BID, BData } = this.state |
| | | |
| | | let searches = fromJS(search).toJS() |
| | | if (config.setting.useMSearch && mainSearch && mainSearch.length > 0) { // 主表搜索条件 |
| | | let keys = searches.map(item => item.key.toLowerCase()) |
| | | mainSearch.forEach(item => { |
| | | if (!keys.includes(item.key.toLowerCase())) { |
| | | searches.push(item) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | | |
| | | let _orderBy = config.setting.order || '' |
| | | let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, pageIndex, config.setting.pageSize, BID, id) |
| | | |
| | | let result = await Api.genericInterface(param) |
| | | if (result.status) { |
| | | let data = fromJS(this.state.data).toJS() |
| | | if (result.data && result.data[0]) { |
| | | let _data = result.data[0] |
| | | |
| | | try { |
| | | data = data.map(item => { |
| | | if (item[config.setting.primaryKey] === _data[config.setting.primaryKey]) { |
| | | if (_data[config.setting.subdata]) { |
| | | let _children = _data[config.setting.subdata] |
| | | |
| | | delete _data[config.setting.subdata] |
| | | |
| | | _data.children = _children.map((cell, i) => { |
| | | cell.key = i |
| | | cell.$$uuid = cell[config.setting.subKey] || '' |
| | | cell.$$BID = _data[config.setting.primaryKey] || '' |
| | | cell.$$BData = {..._data} |
| | | cell.$Index = i + 1 + '' |
| | | |
| | | return cell |
| | | }) |
| | | } else { |
| | | _data.children = [] |
| | | } |
| | | |
| | | _data.key = item.key |
| | | _data.$$uuid = _data[config.setting.primaryKey] || '' |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | _data.$Index = item.$Index |
| | | return _data |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | } catch (e) { |
| | | console.warn('数据查询错误') |
| | | } |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid || '', _data) |
| | | } |
| | | |
| | | this.setState({ |
| | | data: data, |
| | | loading: false |
| | | }) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | | }) |
| | | notification.error({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | loadMore = () => { |
| | | const { total, pageIndex, loading, config } = this.state |
| | | |
| | | if (loading || config.setting.pageSize * pageIndex >= total) { |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | pageIndex: pageIndex + 1 |
| | | }, () => { |
| | | this.loadData('', 'plus') |
| | | }) |
| | | } |
| | | |
| | | prevPage = () => { |
| | | const { pageIndex } = this.state |
| | | |
| | | if (pageIndex === 1) return |
| | | |
| | | this.setState({ |
| | | pageIndex: pageIndex - 1 |
| | | }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | nextPage = () => { |
| | | const { config, pageIndex, total } = this.state |
| | | let _total = config.setting.pageSize * pageIndex |
| | | |
| | | if (_total >= total) return |
| | | |
| | | this.setState({ |
| | | pageIndex: pageIndex + 1 |
| | | }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | changePageIndex = (page) => { |
| | | this.setState({ |
| | | pageIndex: page |
| | | }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | refreshSearch = (list) => { |
| | | this.setState({ |
| | | search: list, |
| | | pageIndex: 1 |
| | | }, () => { |
| | | this.loadData() |
| | | }) |
| | | } |
| | | |
| | | changeCard = (index, item, subClass) => { |
| | | const { config, selectKeys, selectedData, activeKey, opens, card } = this.state |
| | | |
| | | if (card.setting.click === 'unfold' && card.setting.clickType !== 'multi') { |
| | | if (subClass === 'mk-unfold') { |
| | | this.setState({opens: opens.filter(item => item !== index)}) |
| | | } else { |
| | | this.setState({opens: [...opens, index]}) |
| | | } |
| | | } |
| | | |
| | | if (!config.wrap.cardType) return |
| | | if (item.$disabled) 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: _activeKey, |
| | | selectKeys: _selectKeys, |
| | | selectedData: _selectedData |
| | | }) |
| | | |
| | | MKEmitter.emit('resetSelectLine', config.uuid, (_item ? _item.$$uuid : ''), _item) |
| | | } |
| | | |
| | | changeUnfold = (e, i, subClass) => { |
| | | const { opens } = this.state |
| | | |
| | | e.stopPropagation() |
| | | |
| | | if (subClass === 'mk-disabled') return |
| | | |
| | | if (subClass === 'mk-unfold') { |
| | | this.setState({opens: opens.filter(item => item !== i)}) |
| | | } else { |
| | | this.setState({opens: [...opens, i]}) |
| | | } |
| | | } |
| | | |
| | | onDoubleClick = (i, subClass) => { |
| | | const { opens, card } = this.state |
| | | |
| | | if (card.setting.click !== 'unfold' || card.setting.clickType !== 'multi') return |
| | | |
| | | if (subClass === 'mk-unfold') { |
| | | this.setState({opens: opens.filter(item => item !== i)}) |
| | | } else { |
| | | this.setState({opens: [...opens, i]}) |
| | | } |
| | | } |
| | | |
| | | render() { |
| | | const { config, precards, nextcards, loading, data, pageIndex, 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 _total = 0 |
| | | let switchable = false |
| | | if (config.wrap.pagestyle === 'switch' && config.pageable && config.setting.laypage && total > config.setting.pageSize && data) { |
| | | _total = config.setting.pageSize * pageIndex |
| | | switchable = true |
| | | } |
| | | |
| | | let extendData = {$$BID: BID, $$BData: BData, $$selectedData: selectedData, $$type: 'extendCard'} |
| | | |
| | | if (data && data[0]) { |
| | | extendData = {...extendData, ...data[0]} |
| | | } |
| | | |
| | | let checkAll = '' |
| | | if (config.wrap.selStyle && config.wrap.selStyle.indexOf('check') > -1) { |
| | | if (selectedData.length > 0) { |
| | | checkAll = selectedData.length < data.length ? ' half' : ' whole' |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <div className="custom-data-card-box" id={'anchor' + config.uuid} style={config.style}> |
| | | {loading ? |
| | | <div className="loading-mask"> |
| | | {data ? <div className="ant-spin-blur"></div> : null} |
| | | <Spin /> |
| | | </div> : null |
| | | } |
| | | <NormalHeader config={config} BID={BID} refresh={this.refreshSearch} /> |
| | | {config.action && config.action.length > 0 ? |
| | | <MainAction |
| | | BID={BID} |
| | | BData={BData} |
| | | setting={config.setting} |
| | | actions={config.action} |
| | | columns={config.columns} |
| | | selectedData={selectedData} |
| | | /> : null |
| | | } |
| | | <div className={`data-zoom ${config.wrap.wrapClass}`}> |
| | | {switchable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null} |
| | | <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.checkAll === 'show' ? <span onClick={this.checkAll} className={'circle-select' + checkAll}></span> : null} |
| | | </CardItem> |
| | | </Col> |
| | | ))} |
| | | {data && data.map((item, index) => { |
| | | let className = `card-item-wrap mk-card ` |
| | | let subClass = 'mk-unfold' |
| | | let unfold = true |
| | | if (config.wrap.parity === 'true') { |
| | | if (index % 2 === 1) { |
| | | className += 'mk-parity-bg ' |
| | | } |
| | | } |
| | | if (item.$disabled) { |
| | | className = 'mk-disabled' |
| | | } else if (activeKey === index) { |
| | | className += 'active' |
| | | } else if (selectKeys.indexOf(index) > -1) { |
| | | className += 'selected' |
| | | } |
| | | |
| | | if (card.setting.display !== 'default') { |
| | | if (item.children.length === 0) { |
| | | subClass = 'mk-disabled' |
| | | unfold = false |
| | | } else { |
| | | subClass = opens.indexOf(index) > -1 ? 'mk-unfold' : 'mk-collapse' |
| | | unfold = opens.indexOf(index) > -1 |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Col key={index} span={card.setting.width}> |
| | | <div className={className} style={wrapStyle}> |
| | | <CardItem card={card} cards={config} data={item} onDoubleClick={() => this.onDoubleClick(index, subClass)} onClick={() => {this.changeCard(index, item, subClass)}}> |
| | | <span className="circle-select"></span> |
| | | {card.setting.display !== 'default' && card.setting.controlIcon === 'left' ? (!unfold ? <PlusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/> : <MinusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/>) : null} |
| | | {card.setting.display !== 'default' && card.setting.controlIcon !== 'left' ? <UpOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/> : null} |
| | | </CardItem> |
| | | <div className={'sub-card-wrap ' + subClass}> |
| | | {item.children.map((cell, index) => <Col key={'d' + index} span={subcard.setting.width || 24}> |
| | | <CardItem card={subcard} cards={subconfig} data={cell} /> |
| | | </Col>)} |
| | | </div> |
| | | </div> |
| | | </Col> |
| | | ) |
| | | })} |
| | | {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.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} |
| | | </div> |
| | | {config.wrap.pagestyle === 'page' && config.setting.laypage && data ? <Pagination size="small" total={total} showTotal={t => `共 ${t} 条`} pageSize={config.setting.pageSize} onChange={this.changePageIndex} current={pageIndex}/> : null} |
| | | {config.wrap.pagestyle === 'more' && config.setting.laypage && data && data.length > 0 ? <div className={'mk-more' + (config.setting.pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null} |
| | | </div> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default DoubleDataCard |
New file |
| | |
| | | .custom-data-card-box { |
| | | background: #ffffff; |
| | | background-position: center center; |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | min-height: 20px; |
| | | overflow-y: auto; |
| | | |
| | | >.button-list.toolbar-button { |
| | | padding: 0; |
| | | line-height: 45px; |
| | | button { |
| | | margin-right: 0px; |
| | | margin-bottom: 0px; |
| | | min-height: 28px; |
| | | height: auto; |
| | | } |
| | | } |
| | | |
| | | .data-zoom { |
| | | display: flex; |
| | | position: relative; |
| | | .mk-disabled { |
| | | >.card-item-box { |
| | | cursor: not-allowed; |
| | | color: #bcbcbc; |
| | | .ant-mk-text, .anticon { |
| | | color: #bcbcbc!important; |
| | | span { |
| | | color: #bcbcbc!important; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .mk-parity-bg { |
| | | .card-item-box { |
| | | background-color: var(--mk-sys-color1); |
| | | } |
| | | } |
| | | } |
| | | .data-zoom.scale { |
| | | .card-row-list { |
| | | .mk-card:hover { |
| | | >.card-item-box { |
| | | z-index: 1; |
| | | transform: scale(1.05); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | .card-row-list { |
| | | flex: 10; |
| | | } |
| | | .card-row-list.flex-layout { |
| | | display: flex; |
| | | width: 100%; |
| | | >.ant-col { |
| | | width: 5%; |
| | | flex: 1; |
| | | } |
| | | } |
| | | .card-row-list.float-center { |
| | | text-align: center; |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | text-align: left; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | .card-row-list.float-right { |
| | | text-align: right; |
| | | >.ant-col { |
| | | display: inline-block; |
| | | float: none; |
| | | text-align: left; |
| | | vertical-align: top; |
| | | } |
| | | } |
| | | .card-item-box { |
| | | position: relative; |
| | | background-color: #ffffff; |
| | | transition: all 0.3s; |
| | | background-position: center center; |
| | | background-repeat: no-repeat; |
| | | background-size: cover; |
| | | } |
| | | .prev-page { |
| | | width: 20px; |
| | | div { |
| | | height: 100%; |
| | | display: table; |
| | | div { |
| | | display: table-cell; |
| | | vertical-align: middle; |
| | | } |
| | | } |
| | | img { |
| | | width: 15px; |
| | | padding: 0 2px; |
| | | height: 70px; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | .prev-page.disabled { |
| | | img { |
| | | cursor: not-allowed; |
| | | opacity: 0.4; |
| | | } |
| | | } |
| | | .card-row-list::after { |
| | | content: ' '; |
| | | display: block; |
| | | clear: both; |
| | | } |
| | | |
| | | .ant-empty { |
| | | width: 100%; |
| | | min-height: 100px; |
| | | padding-top: 15px; |
| | | |
| | | .ant-empty-image { |
| | | height: 60px; |
| | | } |
| | | } |
| | | .loading-mask { |
| | | position: absolute; |
| | | left: 0px; |
| | | top: 0; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | display: flex; |
| | | align-items: center; |
| | | justify-content: center; |
| | | text-align: justify; |
| | | z-index: 1; |
| | | |
| | | .ant-spin-blur { |
| | | position: absolute; |
| | | width: 100%; |
| | | height: 100%; |
| | | opacity: 0.5; |
| | | background: #ffffff; |
| | | } |
| | | } |
| | | .ant-pagination { |
| | | padding: 10px; |
| | | text-align: right; |
| | | } |
| | | .mk-more { |
| | | text-align: center; |
| | | line-height: 40px; |
| | | cursor: pointer; |
| | | .anticon-down { |
| | | margin-left: 2px; |
| | | } |
| | | } |
| | | .mk-more.disabled { |
| | | cursor: not-allowed; |
| | | color: #bcbcbc; |
| | | } |
| | | .mk-disabled { |
| | | .circle-select { |
| | | border-color: #e8e8e8!important; |
| | | cursor: not-allowed; |
| | | } |
| | | } |
| | | .circle-select { |
| | | position: relative; |
| | | display: none; |
| | | width: 16px; |
| | | height: 16px; |
| | | border: 1px solid #cccccc; |
| | | border-radius: 50%; |
| | | box-sizing: content-box; |
| | | margin: auto; |
| | | margin-right: 5px; |
| | | background-color: #ffffff; |
| | | transition: border-color 0.2s; |
| | | cursor: pointer; |
| | | } |
| | | .circle-select::before { |
| | | position: relative; |
| | | top: 1px; |
| | | left: 6px; |
| | | content: ' '; |
| | | display: block; |
| | | width: 5px; |
| | | height: 11px; |
| | | border-style: solid; |
| | | border-width: 0 2px 2px 0; |
| | | border-color: #ffffff; |
| | | transform: rotate(45deg); |
| | | } |
| | | |
| | | .data-zoom.check.square { |
| | | .circle-select { |
| | | border-radius: 0!important; |
| | | } |
| | | } |
| | | .data-zoom.check { |
| | | .mk-card.active, .mk-card.selected { |
| | | .circle-select { |
| | | border-color: var(--mk-sys-color); |
| | | background: var(--mk-sys-color); |
| | | } |
| | | } |
| | | .circle-select.whole { |
| | | border-color: var(--mk-sys-color); |
| | | background: var(--mk-sys-color); |
| | | } |
| | | .circle-select.half { |
| | | border-color: var(--mk-sys-color); |
| | | } |
| | | .circle-select.half::before { |
| | | display: none; |
| | | } |
| | | .circle-select.half::after { |
| | | position: absolute; |
| | | top: 4px; |
| | | left: 4px; |
| | | content: ' '; |
| | | display: block; |
| | | width: 8px; |
| | | height: 8px; |
| | | background: var(--mk-sys-color); |
| | | } |
| | | .card-item-box { |
| | | // width: 100%; |
| | | display: flex; |
| | | } |
| | | .card-cell-list { |
| | | flex: 1; |
| | | } |
| | | .circle-select { |
| | | display: block; |
| | | } |
| | | .circle-select:hover { |
| | | border-color: var(--mk-sys-color); |
| | | } |
| | | } |
| | | .card-item-wrap { |
| | | .card-item-box { |
| | | >.anticon-up { |
| | | position: absolute; |
| | | right: 0px; |
| | | bottom: 0px; |
| | | padding: 10px; |
| | | transition: all 0.3s; |
| | | cursor: pointer; |
| | | z-index: 1; |
| | | } |
| | | >.anticon-up:not(.mk-disabled):hover, >.anticon-plus-square:not(.mk-disabled):hover, >.anticon-minus-square:not(.mk-disabled):hover { |
| | | color: var(--mk-sys-color); |
| | | } |
| | | >.anticon-up.mk-disabled { |
| | | color: #e8e8e8; |
| | | cursor: not-allowed; |
| | | transform: rotate(180deg); |
| | | } |
| | | >.anticon-up.mk-collapse { |
| | | transform: rotate(180deg); |
| | | } |
| | | >.anticon-plus-square { |
| | | margin: auto 5px; |
| | | font-size: 18px; |
| | | } |
| | | >.anticon-plus-square.mk-disabled { |
| | | color: #e8e8e8; |
| | | cursor: not-allowed; |
| | | } |
| | | >.anticon-minus-square { |
| | | margin: auto 5px; |
| | | font-size: 18px; |
| | | } |
| | | } |
| | | .sub-card-wrap::after { |
| | | content: ' '; |
| | | display: block; |
| | | clear: both; |
| | | } |
| | | .sub-card-wrap.mk-collapse { |
| | | height: 0; |
| | | overflow: hidden; |
| | | transition: height 0.3s; |
| | | } |
| | | } |
| | | } |
| | | .custom-data-card-box::-webkit-scrollbar { |
| | | width: 7px; |
| | | height: 7px; |
| | | } |
| | | .custom-data-card-box::-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); |
| | | } |
| | | .custom-data-card-box::-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); |
| | | } |
| | | .custom-card-box::after { |
| | | content: ' '; |
| | | display: block; |
| | | clear: both; |
| | | } |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | | let _data = { $$empty: true } |
| | | let _sync = false |
| | |
| | | _data.$$uuid = _data[_config.setting.primaryKey] || '' |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | _config.subcards.forEach(card => { |
| | | if (card.setting.click === 'button' && !card.setting.linkbtn) { |
| | | card.elements.forEach(ele => { |
| | |
| | | card.setting.click = '' |
| | | } |
| | | } |
| | | card.elements = card.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | card.backElements = card.backElements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | |
| | | let selected = _config.wrap.selected || 'false' |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | | let _data = null |
| | | let _sync = _config.setting.sync === 'true' |
| | |
| | | } else { |
| | | _config.wrap.contentHeight = showHeader ? 'calc(100% - 45px)' : '100%' |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | _config.subcards.forEach(card => { |
| | | card.elements = card.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | |
| | | _config.wrap.pagestyle = _config.wrap.pagestyle || 'page' |
| | | |
| | |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _card = _config.subcards[0] |
| | | let _cols = new Map() |
| | | |
| | | let _data = null |
| | | let _sync = _config.setting.sync === 'true' |
| | |
| | | }) |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | if (_card.setting.click) { |
| | | _card.style.cursor = 'pointer' |
| | | } |
| | | |
| | | _card.elements = _card.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | if (!_config.wrap.height) { // 兼容 |
| | | _config.wrap.height = _config.style.height || '300px' |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | | let _data = {$$empty: true} |
| | | let _sync = false |
| | |
| | | _data.$$BID = BID || '' |
| | | _data.$$BData = BData || '' |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | if (!_config.wrap.height) { // 兼容 |
| | | _config.wrap.height = _config.style.height || '300px' |
| | | delete _config.style.height |
| | |
| | | if (card.setting.click) { |
| | | card.style.cursor = 'pointer' |
| | | } |
| | | card.elements = card.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | |
| | | _config.wrap.speed = (_config.wrap.speed || 3) * 1000 |
| | |
| | | const DataCard = asyncComponent(() => import('@/tabviews/custom/components/card/data-card')) |
| | | const TableCard = asyncComponent(() => import('@/tabviews/custom/components/card/table-card')) |
| | | const NormalTable = asyncComponent(() => import('@/tabviews/custom/components/table/normal-table')) |
| | | const DoubleDataCard = asyncComponent(() => import('@/tabviews/custom/components/card/double-data-card')) |
| | | const EditTable = asyncComponent(() => import('@/tabviews/custom/components/table/edit-table')) |
| | | const PropCard = asyncComponent(() => import('@/tabviews/custom/components/card/prop-card')) |
| | | const BraftEditor = asyncComponent(() => import('@/tabviews/custom/components/editor/braft-editor')) |
| | |
| | | <NormalTable config={item} data={data} mainSearch={mainSearch}/> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'card' && item.subtype === 'dualdatacard') { |
| | | return ( |
| | | <Col span={item.width} style={style} key={item.uuid}> |
| | | <DoubleDataCard config={item} mainSearch={mainSearch}/> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'bar' || item.type === 'line') { |
| | | return ( |
| | | <Col span={item.width} style={style} key={item.uuid}> |
| | |
| | | const AntvScatter = asyncComponent(() => import('@/tabviews/custom/components/chart/antv-scatter')) |
| | | const TableCard = asyncComponent(() => import('@/tabviews/custom/components/card/table-card')) |
| | | const NormalTable = asyncComponent(() => import('@/tabviews/custom/components/table/normal-table')) |
| | | const DoubleDataCard = asyncComponent(() => import('@/tabviews/custom/components/card/double-data-card')) |
| | | const EditTable = asyncComponent(() => import('@/tabviews/custom/components/table/edit-table')) |
| | | const PropCard = asyncComponent(() => import('@/tabviews/custom/components/card/prop-card')) |
| | | const NormalGroup = asyncComponent(() => import('@/tabviews/custom/components/group/normal-group')) |
| | |
| | | <NormalTable config={item} data={data} mainSearch={mainSearch}/> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'card' && item.subtype === 'dualdatacard') { |
| | | return ( |
| | | <Col span={item.width} style={style} key={item.uuid}> |
| | | <DoubleDataCard config={item} mainSearch={mainSearch}/> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'bar' || item.type === 'line') { |
| | | return ( |
| | | <Col span={item.width} style={style} key={item.uuid}> |
| | |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | | let BID = '' |
| | | let BData = '' |
| | |
| | | } else { |
| | | setting.orisel = true |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | _config.cols.forEach(column => { |
| | | if (column.type === 'action') { |
| | |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | let setting = {..._config.setting, ..._config.wrap} |
| | | setting.tableId = Utils.getuuid() |
| | | |
| | |
| | | setting.operType = 'btnMode' |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | let _columns = [] |
| | | let signAdd = false |
| | | _config.cols.forEach(column => { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (column.type === 'custom') { |
| | | column.elements = column.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | } else if (column.type === 'action') { |
| | | if (column.type === 'action') { |
| | | column.operations = column.elements |
| | | } |
| | | |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | let _data = null |
| | | let _sync = _config.setting.sync === 'true' |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | _config.cols.forEach(column => { |
| | | if (column.type === 'custom') { |
| | | column.elements = column.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | } else if (column.type === 'action') { |
| | | if (column.type === 'action') { |
| | | column.operations = column.elements |
| | | } |
| | | }) |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _cols = new Map() |
| | | |
| | | let _data = null |
| | | let card = null |
| | |
| | | _config.search = [] |
| | | _config.wrap.contentHeight = _config.wrap.title ? 'calc(100% - 45px)' : '100%' |
| | | |
| | | _config.columns.forEach(item => { |
| | | if (item.type !== 'number') return |
| | | _cols.set(item.field, item) |
| | | }) |
| | | |
| | | card = _config.subcards[0] |
| | | card.elements = card.elements.map(item => { |
| | | if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') { |
| | | item.decimal = _cols.get(item.field).decimal || 0 |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | card, |
| | |
| | | const AntvScatter = asyncComponent(() => import('./components/chart/antv-scatter')) |
| | | const DataCard = asyncComponent(() => import('./components/card/data-card')) |
| | | const PropCard = asyncComponent(() => import('./components/card/prop-card')) |
| | | const DoubleDataCard = asyncComponent(() => import('./components/card/double-data-card')) |
| | | const SimpleForm = asyncComponent(() => import('./components/form/simple-form')) |
| | | const StepForm = asyncComponent(() => import('./components/form/step-form')) |
| | | const TabForm = asyncComponent(() => import('./components/form/tab-form')) |
| | |
| | | <PropCard config={item} data={data} mainSearch={mainSearch}/> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'card' && item.subtype === 'dualdatacard') { |
| | | return ( |
| | | <Col span={item.width} style={style} key={item.uuid}> |
| | | <DoubleDataCard config={item} mainSearch={mainSearch}/> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'table' && item.subtype === 'normaltable') { |
| | | return ( |
| | | <Col span={item.width} style={style} key={item.uuid}> |
| | |
| | | const AntvScatter = asyncComponent(() => import('../components/chart/antv-scatter')) |
| | | const DataCard = asyncComponent(() => import('../components/card/data-card')) |
| | | const PropCard = asyncComponent(() => import('../components/card/prop-card')) |
| | | const DoubleDataCard = asyncComponent(() => import('../components/card/double-data-card')) |
| | | const SimpleForm = asyncComponent(() => import('../components/form/simple-form')) |
| | | const StepForm = asyncComponent(() => import('../components/form/step-form')) |
| | | const TabForm = asyncComponent(() => import('../components/form/tab-form')) |
| | |
| | | <PropCard config={item} data={data} mainSearch={mainSearch}/> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'card' && item.subtype === 'dualdatacard') { |
| | | return ( |
| | | <Col span={item.width} style={style} key={item.uuid}> |
| | | <DoubleDataCard config={item} mainSearch={mainSearch}/> |
| | | </Col> |
| | | ) |
| | | } else if (item.type === 'table' && item.subtype === 'basetable') { |
| | | return ( |
| | | <Col span={item.width} style={style} key={item.uuid}> |
| | |
| | | // param.sub_name = 'sub_data' |
| | | // param.sub_field = 'BID,friend_text,icon,Initials' |
| | | |
| | | if (setting.sub_field) { |
| | | param.sub_name = setting.subdata |
| | | param.tabid = setting.primaryKey || '' |
| | | param.parid = setting.subBID || '' |
| | | param.sub_field = setting.sub_field |
| | | } |
| | | |
| | | // exec_type: 'y' 解码字段:LText、LText1、LText2、custom_script、DateCount |
| | | |
| | | param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') |
| | |
| | | title: cell.label, |
| | | }) |
| | | }) |
| | | |
| | | if (item.subtype !== 'dualdatacard') return |
| | | |
| | | card.backElements && card.backElements.forEach(cell => { |
| | | if (cell.eleType !== 'button' || cell.hidden === 'true') return |
| | | |
| | | m.children.push({ |
| | | key: cell.uuid, |
| | | title: cell.label, |
| | | }) |
| | | }) |
| | | }) |
| | | } else if (item.type === 'balcony') { |
| | | item.elements && item.elements.forEach(cell => { |