| | |
| | | 'use strict'; |
| | | // 'use strict'; |
| | | |
| | | const fs = require('fs'); |
| | | const path = require('path'); |
| | |
| | | 'use strict'; |
| | | // 'use strict'; |
| | | |
| | | const fs = require('fs'); |
| | | const path = require('path'); |
| | |
| | | 'use strict'; |
| | | // 'use strict'; |
| | | |
| | | const path = require('path'); |
| | | const fs = require('fs'); |
| | |
| | | 'use strict'; |
| | | // 'use strict'; |
| | | |
| | | const { resolveModuleName } = require('ts-pnp'); |
| | | |
| | |
| | | 'use strict'; |
| | | // 'use strict'; |
| | | |
| | | const errorOverlayMiddleware = require('react-dev-utils/errorOverlayMiddleware'); |
| | | const evalSourceMapMiddleware = require('react-dev-utils/evalSourceMapMiddleware'); |
| | |
| | | const Formdict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS |
| | | |
| | | /** |
| | | * @description 获取按钮表单配置信息 |
| | | * @param {*} card 编辑按钮 |
| | | * @param {*} type 按钮类型,用于区分可选的打开方式 |
| | | * @description 获取元素配置信息 |
| | | * @param {*} card |
| | | * @param {*} type |
| | | */ |
| | | export function getCardCellForm (card, type, subtype) { |
| | | export function getCardCellForm (card, type, subtype, cardCell) { |
| | | let _options = [ |
| | | { value: 'text', text: '文本'}, |
| | | { value: 'number', text: '数值'}, |
| | |
| | | } else { |
| | | appMenus = [] |
| | | } |
| | | } |
| | | |
| | | let dataTypes = [ |
| | | { value: 'dynamic', text: '动态' }, |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | if (cardCell.$cardType === 'extendCard') { |
| | | card.datatype = 'static' |
| | | dataTypes = [ |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | } |
| | | |
| | | let forms = [ |
| | |
| | | label: '数据类型', |
| | | initVal: card.datatype || 'static', |
| | | required: true, |
| | | options: [ |
| | | { value: 'dynamic', text: '动态' }, |
| | | { value: 'static', text: '静态' } |
| | | ] |
| | | options: dataTypes |
| | | }, |
| | | { |
| | | type: 'select', |
| | |
| | | * @description 元素编辑,获取元素表单信息 |
| | | */ |
| | | handleElement = (card) => { |
| | | const { cards } = this.props |
| | | const { cards, cardCell } = this.props |
| | | |
| | | if (card.eleType === 'button') { |
| | | this.handleAction(card) |
| | |
| | | this.setState({ |
| | | visible: true, |
| | | card: card, |
| | | formlist: getCardCellForm(card, cards.type, cards.subtype) |
| | | formlist: getCardCellForm(card, cards.type, cards.subtype, cardCell) |
| | | }) |
| | | } |
| | | } |
| | |
| | | const { cards } = this.props |
| | | let btn = fromJS(item).toJS() |
| | | |
| | | if ((sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') !== 'false')) return |
| | | if ((sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') === 'true')) return |
| | | |
| | | if (btn.eleType === 'button') { |
| | | if (btn.OpenType === 'pop') { |
| | |
| | | } trigger="hover" getPopupContainer={() => document.getElementById(card.uuid + 'swap')}> |
| | | <Icon type="swap" id={card.uuid + 'swap'}/> |
| | | </Popover> : null} |
| | | {cards.subtype === 'propcard' ? <Icon className="close" title="删除卡片" type="delete" onClick={() => this.props.deleteElement(card)} /> : null} |
| | | {cards.subtype === 'propcard' || card.$cardType === 'extendCard' ? <Icon className="close" title="删除卡片" type="delete" onClick={() => this.props.deleteElement(card)} /> : null} |
| | | {card.setting.type === 'multi' ? <Switch size="small" onClick={this.changeSide} defaultChecked /> : null} |
| | | </div> |
| | | } trigger="hover"> |
| | |
| | | wrapClassName="popview-modal" |
| | | title={'卡片设置'} |
| | | visible={settingVisible} |
| | | width={700} |
| | | width={800} |
| | | maskClosable={false} |
| | | okText={dict['model.submit']} |
| | | onOk={this.settingSubmit} |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div className="model-menu-setting-form"> |
| | | <div className="model-menu-card-setting-form"> |
| | | <Form {...formItemLayout}> |
| | | <Row gutter={24}> |
| | | <Col span={12}> |
| | |
| | | </Form.Item> |
| | | </Col> : null} |
| | | <Col span={12}> |
| | | <Form.Item label="点击事件"> |
| | | <Form.Item label={ |
| | | <Tooltip placement="topLeft" title="当选择触发按钮时,只有当卡片中只存在一个按钮时有效。"> |
| | | <Icon type="question-circle" /> |
| | | 点击事件 |
| | | </Tooltip> |
| | | }> |
| | | {getFieldDecorator('click', { |
| | | initialValue: click |
| | | })( |
| | | <Radio.Group onChange={(e) => this.setState({click: e.target.value})}> |
| | | <Radio.Group style={{whiteSpace: 'nowrap'}} onChange={(e) => this.setState({click: e.target.value})}> |
| | | <Radio value="">无</Radio> |
| | | <Radio value="menu">菜单</Radio> |
| | | <Radio value="link">链接</Radio> |
| | | <Radio value="button">按钮</Radio> |
| | | </Radio.Group> |
| | | )} |
| | | </Form.Item> |
| | |
| | | })( <TextArea rows={2}/> )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {appType === 'pc' ? <Col span={12}> |
| | | {appType === 'pc' && click !== '' && click !== 'button' ? <Col span={12}> |
| | | <Form.Item label="打开方式"> |
| | | {getFieldDecorator('open', { |
| | | initialValue: setting.open || 'blank' |
| | |
| | | )} |
| | | </Form.Item> |
| | | </Col> : null} |
| | | {click !== '' ? <Col span={12}> |
| | | {click !== '' && click !== 'button' ? <Col span={12}> |
| | | <Form.Item label="参数拼接"> |
| | | {getFieldDecorator('joint', { |
| | | initialValue: setting.joint || 'true' |
| | |
| | | .model-menu-setting-form { |
| | | .model-menu-card-setting-form { |
| | | position: relative; |
| | | |
| | | .anticon-question-circle { |
| | |
| | | width: 84%; |
| | | } |
| | | } |
| | | .ant-radio-wrapper { |
| | | margin-right: 3px; |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | addCard = () => { |
| | | let card = fromJS(this.state.card).toJS() |
| | | |
| | | let newcard = { |
| | | uuid: Utils.getuuid(), |
| | | $cardType: 'extendCard', |
| | | setting: { width: 6, type: 'simple', click: 'button'}, |
| | | style: { |
| | | borderWidth: '1px', borderColor: '#e8e8e8', |
| | | paddingTop: '15px', paddingBottom: '15px', paddingLeft: '15px', paddingRight: '15px', |
| | | marginLeft: '8px', marginRight: '8px', marginTop: '8px', marginBottom: '8px' |
| | | }, |
| | | backStyle: {}, |
| | | elements: [], |
| | | backElements: [] |
| | | } |
| | | |
| | | card.subcards.push(newcard) |
| | | |
| | | this.setState({card}) |
| | | this.props.updateConfig(card) |
| | | } |
| | | |
| | | clickComponent = (e) => { |
| | | if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { |
| | | e.stopPropagation() |
| | |
| | | <NormalHeader defaultshow="hidden" config={card} updateComponent={this.updateComponent}/> |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | {appType !== 'mob' ? <Icon className="plus" title="添加卡片" onClick={this.addCard} type="plus" /> : null} |
| | | {appType !== 'mob' ? <Icon className="plus" title="添加搜索" onClick={this.addSearch} type="plus-circle" /> : null} |
| | | <Icon className="plus" title="添加按钮" onClick={this.addButton} type="plus-square" /> |
| | | <WrapComponent config={card} updateConfig={this.updateComponent} /> |
| | | <CopyComponent type="datacard" card={card}/> |
| | | <PasteComponent config={card} options={['action', 'search', 'form']} updateConfig={this.updateComponent} /> |
| | | <PasteComponent config={card} options={['action', 'search', 'form', 'cardcell']} updateConfig={this.updateComponent} /> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | | <LogComponent btnlog={card.btnlog || []} handlelog={this.handleLog} /> |
| | | <UserComponent config={card}/> |
| | |
| | | } |
| | | |
| | | getOptions = (_opentype, _intertype, _funcType, _pageTemplate, _procMode) => { |
| | | let _options = fromJS(actionTypeOptions[_opentype]).toJS() // 选项列表 |
| | | let _options = actionTypeOptions[_opentype] ? fromJS(actionTypeOptions[_opentype]).toJS() : [] // 选项列表 |
| | | |
| | | if (_opentype === 'innerpage') { // 新页面,可选模板(自定义时,可填入外部链接) |
| | | if (_pageTemplate === 'custom') { |
| | |
| | | })( |
| | | <Select |
| | | showSearch |
| | | allowClear |
| | | filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.optionChange(item.key, value)}} |
| | | getPopupContainer={() => document.getElementById('winter')} |
| | |
| | | { value: 'pay', text: Formdict['model.pay'] }, |
| | | { value: 'custom', text: Formdict['header.form.custom'] } |
| | | ] |
| | | const isApp = sessionStorage.getItem('appType') === 'pc' |
| | | const isApp = ['pc', 'mob'].includes(sessionStorage.getItem('appType')) |
| | | |
| | | let funTypes = [ |
| | | { value: 'changeuser', text: Formdict['header.form.func.changeuser'] }, |
| | |
| | | * @description 按钮双击触发子配置 |
| | | */ |
| | | btnDoubleClick = (element) => { |
| | | if (sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') !== 'false') return |
| | | if (sessionStorage.getItem('style-control') && sessionStorage.getItem('style-control') === 'true') return |
| | | |
| | | if (element.OpenType === 'pop' || element.OpenType === 'popview' || element.execMode === 'pop') { |
| | | this.props.setSubConfig(element) |
| | |
| | | this.setState({visible: true}) |
| | | } |
| | | |
| | | resetconfig = (item, copyBtns) => { |
| | | resetconfig = (item, copyBtns, config) => { |
| | | let _uuid = Utils.getuuid() |
| | | |
| | | if (item.OpenType === 'popview') { |
| | |
| | | item.uuid = _uuid |
| | | } |
| | | |
| | | if (item.copyType === 'cardcell') { |
| | | if (item.copyType === 'cardcell' && config.subtype === 'datacard') { |
| | | item.setting = item.setting || {} |
| | | item.$cardType = 'extendCard' |
| | | item.setting.width = item.setting.width || 6 |
| | | |
| | | if (item.elements) { |
| | | item.elements = item.elements.map(cell => { |
| | | if (cell.datatype === 'dynamic') { |
| | | cell.datatype = 'static' |
| | | } |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | | if (item.backElements) { |
| | | item.backElements = item.backElements.map(cell => { |
| | | if (cell.datatype === 'dynamic') { |
| | | cell.datatype = 'static' |
| | | } |
| | | cell.uuid = Utils.getuuid() |
| | | return cell |
| | | }) |
| | | } |
| | | } else if (item.copyType === 'cardcell') { |
| | | item.setting = item.setting || {} |
| | | item.setting.width = item.setting.width || 6 |
| | | delete item.$cardType |
| | | |
| | | if (item.elements) { |
| | | item.elements = item.elements.map(cell => { |
| | |
| | | let config = fromJS(this.props.config).toJS() |
| | | let copyBtns = new Map() |
| | | |
| | | res = this.resetconfig(res, copyBtns) |
| | | res = this.resetconfig(res, copyBtns, config) |
| | | delete res.copyType |
| | | |
| | | copyBtns = [...copyBtns.values()] |
| | |
| | | _card.style = config.style |
| | | _card.headerStyle = config.headerStyle |
| | | |
| | | let oriUids = {} |
| | | _card.action = config.action.map(item => { |
| | | item.uuid = Utils.getuuid() |
| | | let _uuid = Utils.getuuid() |
| | | oriUids[item.uuid] = _uuid |
| | | item.uuid = _uuid |
| | | return item |
| | | }) |
| | | _card.search = config.search.map(item => { |
| | |
| | | } |
| | | return col |
| | | }) |
| | | |
| | | if (_card.wrap.doubleClick) { |
| | | _card.wrap.doubleClick = oriUids[_card.wrap.doubleClick] || '' |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | item.btnlog = [] |
| | | } |
| | | |
| | | let oriUids = {} |
| | | if (item.action) { |
| | | if (sessionStorage.getItem('editMenuType') === 'popview') { |
| | | item.action = item.action.filter(c => c.OpenType !== 'popview' && c.OpenType !== 'funcbutton') |
| | | } |
| | | item.action = item.action.map(cell => { |
| | | let _uuid = Utils.getuuid() |
| | | |
| | | oriUids[cell.uuid] = _uuid |
| | | |
| | | if (cell.OpenType === 'popview') { |
| | | let _cell = fromJS(cell).toJS() |
| | | _cell.$originUuid = _cell.uuid |
| | |
| | | if (item.setting && item.setting.supModule) { |
| | | item.setting.supModule = '' |
| | | } |
| | | |
| | | if (item.wrap && item.wrap.doubleClick) { |
| | | item.wrap.doubleClick = oriUids[item.wrap.doubleClick] || '' |
| | | } |
| | | |
| | | return item |
| | | } |
| | |
| | | UNSAFE_componentWillMount () { |
| | | const { data, initdata, BID } = this.props |
| | | let _config = fromJS(this.props.config).toJS() |
| | | let _card = _config.subcards[0] |
| | | |
| | | _config.subcards = _config.subcards.map(item => { |
| | | item.setting.$click = '' |
| | | if (item.setting.click === 'button') { |
| | | if (item.elements.filter(ele => ele.eleType === 'button').length < 2) { |
| | | item.setting.$click = ' trigger-button' |
| | | } |
| | | item.setting.click = '' |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | let _card = _config.subcards.shift() |
| | | let _cols = new Map() |
| | | |
| | | let _data = null |
| | |
| | | } else if (_config.setting.sync === 'true' && initdata) { |
| | | _data = initdata || [] |
| | | _sync = false |
| | | } |
| | | |
| | | if (_config.wrap.cardFloat && _config.wrap.cardFloat !== 'left') { |
| | | let _width = 0 |
| | | _config.subcards.forEach(card => { |
| | | _width += card.setting.width |
| | | }) |
| | | |
| | | _config.$offset = _width |
| | | } |
| | | |
| | | if (_data) { |
| | |
| | | switchable = true |
| | | } |
| | | let offset = 0 |
| | | |
| | | if (config.wrap.cardFloat && config.wrap.cardFloat !== 'left') { |
| | | if (data && card.setting.width * data.length < 24) { |
| | | offset = 24 - card.setting.width * data.length |
| | | let length = data ? data.length : 0 |
| | | if (card.setting.width * length + config.$offset < 24) { |
| | | offset = 24 - card.setting.width * length - config.$offset |
| | | if (config.wrap.cardFloat === 'center') { |
| | | offset = Math.floor(offset / 2) |
| | | } |
| | |
| | | } |
| | | <div className={`data-zoom ${config.wrap.cardType || ''} ${config.wrap.scale || ''}`}> |
| | | {switchable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null} |
| | | {data && data.length > 0 ? <Row className="card-row-list"> |
| | | {data.map((item, index) => ( |
| | | <Col className={(activeKey === index ? ' active' : (selectKeys.indexOf(index) > -1 ? ' selected' : '')) + (card.setting.click ? ' pointer' : '')} key={index} span={card.setting.width} offset={!index ? offset : 0} onClick={() => {this.changeCard(index, item)}}> |
| | | <Row className="card-row-list"> |
| | | {data && data.map((item, index) => ( |
| | | <Col className={(activeKey === index ? ' active' : (selectKeys.indexOf(index) > -1 ? ' selected' : '')) + (card.setting.$click ? ' pointer' : '') + card.setting.$click} key={index} span={card.setting.width} offset={!index ? offset : 0} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem card={card} cards={config} data={item}/> |
| | | </Col> |
| | | ))} |
| | | </Row> : null} |
| | | {config.subcards.map((item, index) => ( |
| | | <Col key={'mk' + index} className={item.setting.$click} span={item.setting.width || 6} offset={(!data || data.length === 0) ? offset : 0}> |
| | | <CardItem card={item} cards={config} data={{$$BID: BID}}/> |
| | | </Col> |
| | | ))} |
| | | </Row> |
| | | {switchable ? <div className={'prev-page ' + (total <= _total ? 'disabled' : '')} onClick={this.nextPage}><div><div><img src={nextImg} alt=""/></div></div></div> : null} |
| | | {!data || data.length === 0 ? <Empty description={false}/> : null} |
| | | {config.subcards.length === 0 && (!data || data.length === 0) ? <Empty description={false}/> : null} |
| | | </div> |
| | | {config.wrap.pagestyle !== 'switch' && config.setting.laypage && data ? <Pagination size="small" total={total} showTotal={t => `共 ${t} 条`} pageSize={config.setting.pageSize} onChange={this.changePageIndex} current={pageIndex}/> : null} |
| | | </div> |
| | |
| | | margin: 10px; |
| | | text-align: right; |
| | | } |
| | | .trigger-button { |
| | | .card-item-box { |
| | | .card-cell-list { |
| | | position: unset; |
| | | .mk-cell-btn { |
| | | position: unset; |
| | | .ant-btn { |
| | | position: unset; |
| | | } |
| | | .ant-btn::after { |
| | | content: ' '; |
| | | position: absolute; |
| | | top: 0; |
| | | bottom: 0; |
| | | left: 0; |
| | | right: 0; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .custom-card-box::after { |
| | |
| | | |
| | | let _width = 0 |
| | | _config.subcards.forEach(card => { |
| | | card.setting.$click = '' |
| | | if (card.setting.click === 'button') { |
| | | if (card.elements.filter(ele => ele.eleType === 'button').length < 2) { |
| | | card.setting.$click = ' trigger-button' |
| | | } |
| | | card.setting.click = '' |
| | | } |
| | | _width += card.setting.width |
| | | card.elements = card.elements.map(item => { |
| | | if (item.field && _cols.has(item.field)) { |
| | |
| | | <NormalHeader config={config}/> |
| | | <Row className={`card-row-list ${config.wrap.cardType || ''} ${config.wrap.scale || ''}`}> |
| | | {config.subcards.map((item, index) => ( |
| | | <Col className={(activeKey === index ? 'active' : '') + (item.setting.click ? ' pointer' : '')} key={index} span={item.setting.width || 6} offset={item.offset || 0} onClick={() => {this.changeCard(index, item)}}> |
| | | <Col className={(activeKey === index ? 'active' : '') + (item.setting.click ? ' pointer' : '') + item.setting.$click} key={index} span={item.setting.width || 6} offset={item.offset || 0} onClick={() => {this.changeCard(index, item)}}> |
| | | <CardItem card={item} cards={config} data={data}/> |
| | | </Col> |
| | | ))} |
| | |
| | | background: #ffffff; |
| | | } |
| | | } |
| | | .trigger-button { |
| | | .card-item-box { |
| | | .card-cell-list { |
| | | position: unset; |
| | | .mk-cell-btn { |
| | | position: unset; |
| | | .ant-btn { |
| | | position: unset; |
| | | } |
| | | .ant-btn::after { |
| | | content: ' '; |
| | | position: absolute; |
| | | top: 0; |
| | | bottom: 0; |
| | | left: 0; |
| | | right: 0; |
| | | cursor: pointer; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | .custom-card-box::after { |