From bc5ec1017fd8a140ec5c30ea9e8ea839d5bf1bda Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 15 十二月 2020 16:22:20 +0800 Subject: [PATCH] 2020-12-15 --- src/templates/zshare/modalform/index.jsx | 15 + src/tabviews/custom/components/card/cardItem/index.scss | 3 src/components/header/index.jsx | 6 src/templates/formtabconfig/index.jsx | 2 src/menu/components/card/cardcellcomponent/dragaction/index.jsx | 4 src/menu/components/card/cardcellcomponent/elementform/index.jsx | 56 +++++- src/menu/components/card/cardcellcomponent/dragaction/card.jsx | 10 src/templates/modalconfig/index.jsx | 2 src/tabviews/custom/components/card/data-card/index.scss | 4 src/tabviews/custom/components/card/data-card/index.jsx | 47 ++++ src/tabviews/custom/components/card/table-card/index.scss | 1 src/components/header/index.scss | 6 src/tabviews/custom/components/card/cardcellList/index.jsx | 184 +++++++++++++++---- src/tabviews/custom/components/card/prop-card/index.jsx | 6 src/menu/components/table/normal-table/columns/markcolumn/index.jsx | 7 src/menu/components/card/cardcellcomponent/index.jsx | 23 ++ src/templates/zshare/formconfig.jsx | 16 src/menu/components/card/cardcomponent/index.jsx | 1 src/menu/components/share/actioncomponent/index.jsx | 4 src/tabviews/zshare/mutilform/index.jsx | 10 src/menu/components/card/cardcellcomponent/formconfig.jsx | 33 ++- src/tabviews/custom/index.jsx | 9 + src/menu/modalconfig/index.jsx | 2 src/menu/components/card/data-card/wrapsetting/settingform/index.jsx | 2 src/tabviews/custom/components/card/cardcellList/index.scss | 2 src/menu/components/table/normal-table/columns/index.jsx | 12 src/utils/option.js | 20 +- 27 files changed, 362 insertions(+), 125 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 1d6a2b3..5bfd07a 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -704,12 +704,12 @@ <Menu className="header-dropdown"> {debug && <Menu.Item key="switch"> {this.state.dict['main.edit']} - <Switch size="small" className="edit-switch" disabled={!!this.props.editLevel} checked={this.props.editState} onChange={this.changeEditState} /> + <Switch size="small" style={{marginLeft: '7px'}} disabled={!!this.props.editLevel} checked={this.props.editState} onChange={this.changeEditState} /> </Menu.Item>} {!this.props.editState ? <Menu.Item key="password" onClick={this.changePassword}>{this.state.dict['main.password']}</Menu.Item> : null} - {this.state.systems.length > 0 ? <Menu.SubMenu className="header-subSystem-box" title="鍒囨崲绯荤粺"> + {this.state.systems.length > 0 ? <Menu.SubMenu title="鍒囨崲绯荤粺"> {this.state.systems.map((system, index) => ( - <Menu.Item className="header-subSystem" key={'sub' + index} onClick={() => {this.changeSystem(system)}}> {system.AppName} </Menu.Item> + <Menu.Item style={{minWidth: '100px'}} key={'sub' + index} onClick={() => {this.changeSystem(system)}}> {system.AppName} </Menu.Item> ))} </Menu.SubMenu> : null} <Menu.Item key="doc" onClick={this.gotoDoc}>{this.state.dict['main.doc']}</Menu.Item> diff --git a/src/components/header/index.scss b/src/components/header/index.scss index cfb1926..cae47b3 100644 --- a/src/components/header/index.scss +++ b/src/components/header/index.scss @@ -206,9 +206,3 @@ } } } -.header-subSystem { - min-width: 100px; -} -.edit-switch { - margin-left: 10px; -} diff --git a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx index 60fbd7a..1950e40 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/card.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/card.jsx @@ -9,13 +9,15 @@ import demo4 from '@/assets/img/demo4.jpg' import demo5 from '@/assets/img/demo5.jpg' import asyncComponent from '@/utils/asyncComponent' +import asyncIconComponent from '@/utils/asyncIconComponent' import './index.scss' const BarCode = asyncComponent(() => import('@/components/barcode')) const QrCode = asyncComponent(() => import('@/components/qrcode')) +const MarkColumn = asyncIconComponent(() => import('@/menu/components/table/normal-table/columns/markcolumn')) -const Card = ({ id, cardIds, card, moveCard, findCard, editCard, delCard, copyCard, changeStyle }) => { +const Card = ({ id, cardIds, fields, card, moveCard, findCard, editCard, delCard, copyCard, changeStyle, updateMarks }) => { const originalIndex = findCard(id).index const [{ isDragging }, drag] = useDrag({ item: { type: 'action', id, originalIndex }, @@ -50,11 +52,6 @@ ) } else if (card.eleType === 'text' || card.eleType === 'number') { let val = `${card.prefix || ''}${card.datatype === 'static' ? (card.value || '') : (card.field || '')}${card.postfix || ''}` - return ( - <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div> - ) - } else if (card.eleType === 'link') { - let val = card.label || card.value || card.field return ( <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div> ) @@ -134,6 +131,7 @@ <Icon className="copy" title="澶嶅埗" type="copy" onClick={() => copyCard(id)} /> <Icon className="close" title="鍒犻櫎" type="close" onClick={() => delCard(id)} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={() => changeStyle(id)} type="font-colors" /> + {['text', 'number'].includes(card.eleType) ? <MarkColumn columns={fields} marks={card.marks} onSubmit={(vals) => updateMarks({...card, marks: vals})} /> : null } </div> } trigger="hover"> <div ref={node => drag(drop(node))} className={'ant-col card-cell ant-col-' + card.width}> diff --git a/src/menu/components/card/cardcellcomponent/dragaction/index.jsx b/src/menu/components/card/cardcellcomponent/dragaction/index.jsx index 119bcd2..f6b4da6 100644 --- a/src/menu/components/card/cardcellcomponent/dragaction/index.jsx +++ b/src/menu/components/card/cardcellcomponent/dragaction/index.jsx @@ -8,7 +8,7 @@ import Action from './action' import './index.scss' -const Container = ({list, handleList, handleMenu, deleteMenu, profileAction, handleStyle, dropButton, handleSubConfig }) => { +const Container = ({list, fields, handleList, handleMenu, deleteMenu, profileAction, handleStyle, updateMarks, dropButton, handleSubConfig }) => { const [cards, setCards] = useState(list) const moveCard = (id, atIndex) => { const { card, index } = findCard(id) @@ -124,9 +124,11 @@ key={card.uuid} cardIds={cardIds} card={card} + fields={fields} moveCard={moveCard} copyCard={copyCard} editCard={editCard} + updateMarks={updateMarks} changeStyle={changeStyle} delCard={delCard} findCard={findCard} diff --git a/src/menu/components/card/cardcellcomponent/elementform/index.jsx b/src/menu/components/card/cardcellcomponent/elementform/index.jsx index 25490a1..1ae5fd3 100644 --- a/src/menu/components/card/cardcellcomponent/elementform/index.jsx +++ b/src/menu/components/card/cardcellcomponent/elementform/index.jsx @@ -10,11 +10,10 @@ const cardTypeOptions = { sequence: ['eleType', 'width'], - text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix'], + text: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix', 'link'], number: ['eleType', 'datatype', 'format', 'width', 'height', 'prefix', 'postfix'], - picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'url'], + picture: ['eleType', 'datatype', 'width', 'lenWidRadio', 'url', 'link'], icon: ['eleType', 'icon', 'datatype', 'width'], - link: ['eleType', 'datatype', 'label', 'width', 'height', 'joint'], slider: ['eleType', 'datatype', 'width', 'color', 'maxValue'], splitline: ['eleType', 'color', 'width', 'borderWidth'], barcode: ['eleType', 'datatype', 'width', 'barHeight', 'displayValue', 'interval'], @@ -34,21 +33,23 @@ state = { formlist: null, // 琛ㄥ崟淇℃伅 eleType: '', - datatype: '' + datatype: '', + link: '' } UNSAFE_componentWillMount () { const { card, config } = this.props - let _options = this.getOptions(card.eleType, card.datatype) + let _options = this.getOptions(card.eleType, card.datatype, card.link) this.setState({ + link: card.link, eleType: card.eleType, datatype: card.datatype, formlist: this.props.formlist.map(item => { item.hidden = !_options.includes(item.key) - if (item.key === 'field') { + if (item.key === 'field' || item.key === 'linkurl') { item.options = [] config.columns.forEach(col => { if (!/^Nvarchar/ig.test(col.datatype) && (card.eleType === 'number' || card.eleType === 'slider')) { @@ -66,6 +67,15 @@ } else if (item.key === 'value' && card.eleType === 'slider') { item.type = 'number' item.label = '鍊�' + } else if (item.key === 'format') { + if (card.eleType === 'text') { + item.options = item.oriOptions.filter(op => op.value !== 'percent' && op.value !== 'thdSeparator') + } else if (card.eleType === 'number') { + item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD') + } + } + if (item.key === 'linkurl') { + item.type = card.link === 'dynamic' ? 'select' : 'text' } return item @@ -73,7 +83,7 @@ }) } - getOptions = (eleType, datatype) => { + getOptions = (eleType, datatype, link) => { let _options = fromJS(cardTypeOptions[eleType]).toJS() // 閫夐」鍒楄〃 if (['text', 'number', 'picture', 'link', 'slider', 'barcode', 'qrcode'].includes(eleType)) { @@ -81,6 +91,10 @@ _options.push('field') } else if (eleType !== 'picture') { _options.push('value') + } + + if (['text', 'picture'].includes(eleType) && link) { + _options.push('linkurl', 'joint') } } else if (eleType === 'icon') { if (datatype === 'dynamic') { @@ -104,7 +118,7 @@ const { datatype } = this.state if (key === 'eleType') { - let _options = this.getOptions(value, datatype) + let _options = this.getOptions(value, datatype, '') let _formlist = this.state.formlist.map(item => { item.hidden = !_options.includes(item.key) @@ -132,12 +146,19 @@ item.type = 'text' item.label = '鍐呭' } + } else if (item.key === 'format') { + if (value === 'text') { + item.options = item.oriOptions.filter(op => op.value !== 'percent' && op.value !== 'thdSeparator') + } else if (value === 'number') { + item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD') + } } return item }) this.setState({ + link: '', eleType: value, formlist: _formlist }, () => { @@ -145,6 +166,11 @@ this.props.form.setFieldsValue({width: 24, color: '#1890ff'}) } else if (value === 'splitline') { this.props.form.setFieldsValue({width: 24, color: '#e8e8e8'}) + } else if (value === 'text' || value === 'number') { + this.props.form.setFieldsValue({format: ''}) + } + if (value === 'text' || value === 'picture') { + this.props.form.setFieldsValue({link: ''}) } }) } else if (key === 'field') { @@ -159,7 +185,7 @@ let value = e.target.value if (key === 'datatype') { - let _options = this.getOptions(eleType, value) + let _options = this.getOptions(eleType, value, this.state.link) this.setState({ datatype: value, @@ -169,6 +195,18 @@ return item }) }) + } else if (key === 'link') { + let _options = this.getOptions(eleType, this.state.datatype, value) + this.setState({ + link: value, + formlist: this.state.formlist.map(item => { + item.hidden = !_options.includes(item.key) + if (item.key === 'linkurl') { + item.type = value === 'dynamic' ? 'select' : 'text' + } + return item + }) + }) } } diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index b0fc153..4c00d73 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -14,7 +14,6 @@ { value: 'number', text: '鏁板��'}, { value: 'picture', text: '鍥剧墖'}, { value: 'icon', text: '鍥炬爣'}, - { value: 'link', text: '閾炬帴'}, { value: 'slider', text: '杩涘害鏉�'}, { value: 'splitline', text: '鍒嗗壊绾�'}, { value: 'barcode', text: '鏉″舰鐮�'}, @@ -112,20 +111,33 @@ required: false }, { - type: 'text', - key: 'label', - label: '鏄剧ず淇℃伅', - initVal: card.label || '', - required: false + type: 'radio', + key: 'link', + label: '閾炬帴', + initVal: card.link || '', + required: false, + options: [ + { value: '', text: '鏃�' }, + { value: 'dynamic', text: '鍔ㄦ��' }, + { value: 'static', text: '闈欐��' } + ] + }, + { + type: 'select', + key: 'linkurl', + label: '閾炬帴鍦板潃', + initVal: card.linkurl || '', + required: true, + options: [] }, { type: 'select', key: 'format', label: '鏍煎紡鍖�', initVal: card.format || '', - tooltip: '娉細鐧惧垎鏁般�佸崈鍒嗕綅瀵逛簬鏁板�肩被鍨嬫湁鏁堬紝YYYY-MM-DD瀵逛簬鏃堕棿绫诲瀷鐨勬枃鏈湁鏁堛��', required: false, - options: [ + options: [], + oriOptions: [ { value: '', text: '鏃�' }, { value: 'percent', text: '鐧惧垎鏁�' }, { value: 'thdSeparator', text: '鍗冨垎浣�' }, @@ -201,8 +213,9 @@ min: 1, max: 10, label: '楂樺害(琛�)', - initVal: card.height || 1, - required: true, + initVal: card.height, + tooltip: '鍐呭鏄剧ず琛屾暟锛屽�间负绌烘椂楂樺害鑷�傚簲锛屾敞锛氳嚜閫傚簲楂樺害浠呭湪璁剧疆鍗$墖楂樺害鍚庢湁鏁堛��', + required: false }, { type: 'number', diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx index d96bf0d..a26c5e4 100644 --- a/src/menu/components/card/cardcellcomponent/index.jsx +++ b/src/menu/components/card/cardcellcomponent/index.jsx @@ -138,7 +138,7 @@ let _card = fromJS(card).toJS() - if (_card.eleType === 'text' || _card.eleType === 'number' || _card.eleType === 'link') { + if (_card.eleType === 'text' || _card.eleType === 'number') { _card.style = style let fontSize = 14 @@ -376,7 +376,7 @@ if (res.eleType === 'splitline' && cell.eleType !== 'splitline') { res.style.paddingTop = '5px' res.style.paddingBottom = '5px' - } else if (res.eleType === 'text' || res.eleType === 'number' || res.eleType === 'link') { + } else if (res.eleType === 'text' || res.eleType === 'number') { let fontSize = 14 let lineHeight = 1.5 let line = res.height || 1 @@ -389,7 +389,7 @@ } res.innerHeight = fontSize * lineHeight * line - if (res.eleType === 'link' && !res.style.color) { + if (res.eleType === 'text' && res.link && !res.style.color) { res.style.color = 'rgba(24, 144, 255, 1)' } } else if (res.eleType === 'barcode') { @@ -560,6 +560,21 @@ }) } + updateMarks = (card) => { + const { elements } = this.state + + let _elements = elements.map(cell => { + if (cell.uuid === card.uuid) return card + return cell + }) + + this.setState({ + elements: _elements + }, () => { + this.props.updateElement(_elements) + }) + } + dropButton = (id) => { const { cards } = this.props let index = cards.action.findIndex(item => item.uuid === id) @@ -587,6 +602,8 @@ <div className="model-menu-card-cell-list"> <DragElement list={elements} + fields={cards.columns} + updateMarks={this.updateMarks} handleList={this.handleList} handleMenu={this.handleElement} handleStyle={this.handleStyle} diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx index 73d84ce..8d6d660 100644 --- a/src/menu/components/card/cardcomponent/index.jsx +++ b/src/menu/components/card/cardcomponent/index.jsx @@ -134,6 +134,7 @@ newcard.eleType = 'text' newcard.datatype = 'dynamic' + newcard.height = 1 // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌 MKEmitter.emit('cardAddElement', [cards.uuid, card.uuid], newcard) diff --git a/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx b/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx index a20bfd9..fe1be9d 100644 --- a/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx +++ b/src/menu/components/card/data-card/wrapsetting/settingform/index.jsx @@ -158,7 +158,7 @@ <Radio.Group style={{whiteSpace: 'nowrap'}}> <Radio key="" value=""> 涓嶅彲閫� </Radio> <Radio key="radio" value={'radio'}> 鍗曢�� </Radio> - <Radio key="checkbox" value={'checkbox'}> 澶氶�� </Radio> + {config.subtype !== 'propcard' ? <Radio key="checkbox" value={'checkbox'}> 澶氶�� </Radio> : null} </Radio.Group> )} </Form.Item> diff --git a/src/menu/components/share/actioncomponent/index.jsx b/src/menu/components/share/actioncomponent/index.jsx index a56e70d..4d8860e 100644 --- a/src/menu/components/share/actioncomponent/index.jsx +++ b/src/menu/components/share/actioncomponent/index.jsx @@ -83,7 +83,7 @@ const { config } = this.props const { card, actionlist } = this.state - if (comIds.length !== 2 || comIds[0] !== config.uuid || comIds[1] === 'header') return + if (comIds[0] !== config.uuid || comIds[1] !== 'actionlist') return let _card = fromJS(card).toJS() _card.btnstyle = style @@ -110,7 +110,7 @@ card: element }) - MKEmitter.emit('changeStyle', [config.uuid, element.uuid], options, _style) + MKEmitter.emit('changeStyle', [config.uuid, 'actionlist', element.uuid], options, _style) } addButton = (cardId, element) => { diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index b2c1597..944cf5b 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -13,7 +13,6 @@ import './index.scss' const { confirm } = Modal -const coldict = localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS const EditColumn = asyncIconComponent(() => import('./editColumn')) const MarkColumn = asyncIconComponent(() => import('./markcolumn')) const CardCellComponent = asyncComponent(() => import('@/menu/components/card/cardcellcomponent')) @@ -58,7 +57,7 @@ } <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.props.editColumn(column)} /> <Icon className="close" title="鍒犻櫎" type="delete" onClick={this.deleteCol} /> - {column && ['text', 'number'].includes(column.type) ? <MarkColumn dict={coldict} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } + {column && ['text', 'number'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } </div> } trigger="hover"> {children} @@ -75,7 +74,7 @@ } <Icon className="edit" title="缂栬緫" type="edit" onClick={() => this.props.editColumn(column)} /> <Icon className="close" title="鍒犻櫎" type="delete" onClick={this.deleteCol} /> - {column && ['text', 'number'].includes(column.type) ? <MarkColumn dict={coldict} columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } + {column && ['text', 'number'].includes(column.type) ? <MarkColumn columns={fields} marks={column.marks} onSubmit={this.updateMarks} /> : null } </div> } trigger="hover"> {children} @@ -174,6 +173,7 @@ } state = { + dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, data: [{uuid: Utils.getuuid()}], columns: [], fields: [], @@ -389,7 +389,7 @@ render() { const { config } = this.props - const { fields, card, lineMarks } = this.state + const { fields, card, lineMarks, dict } = this.state const components = { header: { cell: DragableHeaderCol @@ -449,7 +449,7 @@ <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType}`}> <div className="col-control"> <Icon title="澶嶅埗" type="copy" onClick={this.copycolumn} /> - <MarkColumn dict={coldict} columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> + <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> </div> <DndProvider> <Table @@ -470,7 +470,7 @@ }} /> </DndProvider> - <EditColumn column={card} dict={coldict} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> + <EditColumn column={card} dict={dict} fields={fields} submitCol={this.submitCol} cancelCol={this.cancelCol}/> </div> ) } diff --git a/src/menu/components/table/normal-table/columns/markcolumn/index.jsx b/src/menu/components/table/normal-table/columns/markcolumn/index.jsx index bdc49d7..23ba1c8 100644 --- a/src/menu/components/table/normal-table/columns/markcolumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/markcolumn/index.jsx @@ -8,6 +8,8 @@ import MarkForm from './markform' import './index.scss' import { minkeIconSystem } from '@/utils/option.js' +import zhCN from '@/locales/zh-CN/model.js' +import enUS from '@/locales/en-US/model.js' import '@/assets/css/table.scss' const EditTable = asyncComponent(() => import('@/templates/zshare/editTable')) @@ -15,12 +17,12 @@ class MarkColumn extends Component { static propTpyes = { columns: PropTypes.array, // 鏄剧ず鍒� - dict: PropTypes.object, // 瀛楀吀椤� marks: PropTypes.object, onSubmit: PropTypes.func } state = { + dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, marks: null, columns: null, visible: false, @@ -293,8 +295,7 @@ } render() { - const { dict } = this.props - const { marks, markColumns, visible, options, signs } = this.state + const { marks, markColumns, visible, options, signs, dict } = this.state return ( <div style={{display: 'inline-block'}}> diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx index 32e9b5f..5f4be1f 100644 --- a/src/menu/modalconfig/index.jsx +++ b/src/menu/modalconfig/index.jsx @@ -200,7 +200,7 @@ } _inputfields = _formfields.filter(item => item.type === 'text' || item.type === 'number') - _tabfields = _formfields.filter(item => card.field !== item.field && ['text', 'number', 'select', 'link'].includes(item.type)) + _tabfields = _formfields.filter(item => card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) _tabfields.unshift({field: '', text: '鍘熻〃鍗�'}) let uniq = new Map() diff --git a/src/tabviews/custom/components/card/cardItem/index.scss b/src/tabviews/custom/components/card/cardItem/index.scss index e69de29..1748fdd 100644 --- a/src/tabviews/custom/components/card/cardItem/index.scss +++ b/src/tabviews/custom/components/card/cardItem/index.scss @@ -0,0 +1,3 @@ +.card-item-box { + overflow: hidden; +} \ No newline at end of file diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index db519ce..9e34be0 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -62,34 +62,137 @@ } } - openNewView = (card, url) => { + openNewView = (e, card) => { const { cardCell, data, cards } = this.props + + if (!card.link) return + e.stopPropagation() + + let url = '' + + if (card.link === 'static') { + url = card.linkurl + } else { + url = data[card.linkurl] + } + + if (url === 'sso') { + if (!data.LinkUrl1) { + url = '' + } else { + url = data.LinkUrl1 + 'index.html#/ssologin/' + window.btoa(window.encodeURIComponent(JSON.stringify({ + UserID: sessionStorage.getItem('UserID'), + LoginUID: sessionStorage.getItem('LoginUID'), + User_Name: sessionStorage.getItem('User_Name'), + Full_Name: sessionStorage.getItem('Full_Name'), + avatar: sessionStorage.getItem('avatar'), + dataM: data.dataM ? 'true' : '', + debug: data.debug || '', + role_id: data.role_id || '' + }))) + } + } else { + let Id = '' + let con = '?' + + if (/\?/ig.test(url)) { + con = '&' + } + + if (cards.subtype === 'propcard' && cardCell) { + Id = cardCell.setting.primaryId || '' + } else { + Id = data[cards.setting.primaryKey] || '' + } + + if (card.joint === 'true') { + url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` + } + } + if (!url) { notification.warning({ top: 92, - message: '鍦板潃閾炬帴涓嶅彲涓虹┖锛�', + message: '閾炬帴鍦板潃涓嶅瓨鍦紒', duration: 5 }) return } - let Id = '' - let con = '?' - - if (/\?/ig.test(url)) { - con = '&' - } - - if (cards.subtype === 'propcard' && cardCell) { - Id = cardCell.setting.primaryId || '' - } else { - Id = data[cards.setting.primaryKey] || '' - } - - if (card.joint === 'true') { - url = url + `${con}id=${Id}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` - } window.open(url) + } + + getMark = (marks, style, content) => { + const { data } = this.props + + marks.some(mark => { + let originVal = data[mark.field[0]] + '' + let contrastVal = '' + let result = false + + if (mark.field[1] === 'static') { + contrastVal = mark.contrastValue + '' + } else { + contrastVal = data[mark.field[2]] + '' + } + + if (mark.match === '=') { + result = originVal === contrastVal + } else if (mark.match === '!=') { + result = originVal !== contrastVal + } else if (mark.match === 'like') { + result = originVal.indexOf(contrastVal) > -1 + } else if (mark.match === '>') { + try { + originVal = parseFloat(originVal) + contrastVal = parseFloat(contrastVal) + } catch { + originVal = NaN + } + + if (!isNaN(originVal) && !isNaN(contrastVal) && originVal > contrastVal) { + result = true + } + } else if (mark.match === '<') { + try { + originVal = parseFloat(originVal) + contrastVal = parseFloat(contrastVal) + } catch { + originVal = NaN + } + + if (!isNaN(originVal) && !isNaN(contrastVal) && originVal < contrastVal) { + result = true + } + } + + if (result) { + if (mark.signType[0] === 'font') { + style.color = mark.color + } else if (mark.signType[0] === 'background') { + style.background = mark.color + if (mark.fontColor) { + style.color = mark.fontColor + } + } else if (mark.signType[0] === 'underline') { + style.textDecoration = 'underline' + style.color = mark.color + } else if (mark.signType[0] === 'line-through') { + style.textDecoration = 'line-through' + style.color = mark.color + } else if (mark.signType[0] === 'icon') { + let icon = (<Icon style={{color: mark.color}} type={mark.signType[3]} />) + if (mark.signType[1] === 'front') { + content = <span>{icon} {content}</span> + } else { + content = <span>{content} {icon}</span> + } + } + } + return result + }) + + return content } getContent = (card) => { @@ -105,6 +208,7 @@ ) } else if (card.eleType === 'text') { let val = '' + let _style = card.style ? {...card.style} : {} if (card.datatype === 'static') { val = card.value @@ -122,15 +226,24 @@ val = `${card.prefix || ''}${val}${card.postfix || ''}` } + if (card.marks) { + val = this.getMark(card.marks, _style, val) + } + + if (card.link) { + _style.cursor = 'pointer' + } + return ( <Col key={card.uuid} span={card.width}> - <div style={card.style}> + <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div> </div> </Col> ) } else if (card.eleType === 'number') { let val = '' + let _style = card.style ? {...card.style} : {} if (card.datatype === 'static') { val = card.value @@ -168,31 +281,15 @@ if (val !== '') { val = `${card.prefix || ''}${val}${card.postfix || ''}` } - - return ( - <Col key={card.uuid} span={card.width}> - <div style={card.style}> - <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div> - </div> - </Col> - ) - } else if (card.eleType === 'link') { - let url = '' - - if (card.datatype === 'static') { - url = card.value - } else if (data.hasOwnProperty(card.field)) { - url = data[card.field] + + if (card.marks) { + val = this.getMark(card.marks, _style, val) } - let val = card.label || url - return ( <Col key={card.uuid} span={card.width}> - <div style={card.style}> - <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}> - <span style={{cursor: 'pointer'}} onClick={(e) => {e.stopPropagation(); this.openNewView(card, url)}}>{val}</span> - </div> + <div style={_style}> + <div className={'ant-mk-text line' + card.height} style={{height: card.innerHeight || 21}}>{val}</div> </div> </Col> ) @@ -251,6 +348,7 @@ ) } else if (card.eleType === 'picture') { let _imagestyle = {} + let _style = card.style ? {...card.style} : {} if (card.url) { _imagestyle = {backgroundImage: `url('${card.url}')`} @@ -272,9 +370,13 @@ _imagestyle.paddingTop = '100%' } + if (card.link) { + _style.cursor = 'pointer' + } + return ( <Col key={card.uuid} span={card.width}> - <div style={card.style}> + <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> <div className="ant-mk-picture" style={_imagestyle}></div> </div> </Col> diff --git a/src/tabviews/custom/components/card/cardcellList/index.scss b/src/tabviews/custom/components/card/cardcellList/index.scss index 79a952f..1028cc3 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.scss +++ b/src/tabviews/custom/components/card/cardcellList/index.scss @@ -7,7 +7,7 @@ font-weight: inherit; text-decoration: inherit; } - .ant-mk-text:not(.line1) { + .ant-mk-text:not(.line1):not(.line) { word-break: break-word; display: -webkit-box; -webkit-box-orient: vertical; diff --git a/src/tabviews/custom/components/card/data-card/index.jsx b/src/tabviews/custom/components/card/data-card/index.jsx index fe0c8a2..b46423b 100644 --- a/src/tabviews/custom/components/card/data-card/index.jsx +++ b/src/tabviews/custom/components/card/data-card/index.jsx @@ -29,6 +29,8 @@ config: null, // 鍥捐〃閰嶇疆淇℃伅 pageIndex: 1, // 椤电爜 activeKey: '', // 閫変腑鍗� + selectKeys: [], // 澶氶�夋椂閫変腑鍗$墖 + selectedData: [], // 閫変腑鏁版嵁锛岀敤浜庡伐鍏锋爮鎸夐挳 loading: false, // 鏁版嵁鍔犺浇鐘舵�� sync: false, // 鏄惁缁熶竴璇锋眰鏁版嵁 card: null, // 鍗$墖璁剧疆 @@ -166,6 +168,8 @@ if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇� this.setState({ activeKey: '', + selectKeys: [], + selectedData: [], pageIndex: 1, data: [], total: 0, @@ -195,6 +199,8 @@ if (result.status) { this.setState({ activeKey: '', + selectKeys: [], + selectedData: [], data: result.data.map((item, index) => { item.key = index item.$$uuid = item[config.setting.primaryKey] || '' @@ -264,17 +270,48 @@ } changeCard = (index, item) => { - const { config } = this.state + const { config, selectKeys, selectedData, activeKey } = this.state - if (config.wrap.switch !== 'true') return + if (!config.wrap.cardType) return + + let _selectKeys = [] + let _selectedData = [] + let _activeKey = '' + let _item = item + if (config.wrap.cardType === 'checkbox') { + if (activeKey === index) { + _selectKeys = selectKeys.filter(key => key !== index) + _selectedData = selectedData.filter(cell => cell.key !== index) + _activeKey = _selectKeys.slice(-1)[0] + _item = selectedData.slice(-1)[0] || '' + } else if (selectKeys.indexOf(index) > -1) { + _selectKeys = selectKeys.filter(key => key !== index) + _selectedData = selectedData.filter(cell => cell.key !== index) + _activeKey = activeKey + _item = selectedData.filter(cell => cell.key === activeKey)[0] || '' + } else { + _selectKeys = [...selectKeys, index] + _selectedData = [...selectedData, item] + _activeKey = index + } + } else { + if (activeKey === index) return + + _selectedData = [item] + _activeKey = index + } this.setState({ - activeKey: index + activeKey: _activeKey, + selectKeys: _selectKeys, + selectedData: _selectedData }) + + MKEmitter.emit('resetSelectLine', config.uuid, (_item ? _item.$$uuid : ''), _item) } render() { - const { config, loading, data, pageIndex, total, card, activeKey, BID, BData, selectedData } = this.state + const { config, loading, data, pageIndex, total, card, activeKey, BID, BData, selectedData, selectKeys } = this.state let _total = config.setting.pageSize * pageIndex let switchable = false @@ -306,7 +343,7 @@ {switchable ? <div className={'prev-page ' + (pageIndex === 1 ? 'disabled' : '')} onClick={this.prevPage}><div><div><img src={preImg} alt=""/></div></div></div> : null} {data && data.length > 0 ? <div className="card-row-list"> {data.map((item, index) => ( - <Col className={activeKey === index ? 'active' : ''} key={index} span={card.setting.width || 6} onClick={() => {this.changeCard(index, item)}}> + <Col className={activeKey === index ? 'active' : (selectKeys.indexOf(index) > -1 ? 'selected' : '')} key={index} span={card.setting.width} onClick={() => {this.changeCard(index, item)}}> <CardItem card={card} cards={config} data={item} updateStatus={this.updateStatus}/> </Col> ))} diff --git a/src/tabviews/custom/components/card/data-card/index.scss b/src/tabviews/custom/components/card/data-card/index.scss index aefee6c..5d1f123 100644 --- a/src/tabviews/custom/components/card/data-card/index.scss +++ b/src/tabviews/custom/components/card/data-card/index.scss @@ -57,6 +57,10 @@ border-color: #1890ff!important; box-shadow: 0 0 3px #1890ff; } + >.selected >.card-item-box { + border-color: #69c0ff!important; + box-shadow: 0 0 1px #69c0ff; + } } .card-item-box { background-position: center center; diff --git a/src/tabviews/custom/components/card/prop-card/index.jsx b/src/tabviews/custom/components/card/prop-card/index.jsx index 9f47cca..1e01bd4 100644 --- a/src/tabviews/custom/components/card/prop-card/index.jsx +++ b/src/tabviews/custom/components/card/prop-card/index.jsx @@ -230,13 +230,15 @@ } changeCard = (index, item) => { - const { config } = this.state + const { config, data, activeKey } = this.state - if (config.wrap.switch !== 'true') return + if (!config.wrap.cardType || activeKey === index) return this.setState({ activeKey: index }) + + MKEmitter.emit('resetSelectLine', config.uuid, (item.setting.primaryId || ''), data) } render() { diff --git a/src/tabviews/custom/components/card/table-card/index.scss b/src/tabviews/custom/components/card/table-card/index.scss index 04dbf0f..84afeee 100644 --- a/src/tabviews/custom/components/card/table-card/index.scss +++ b/src/tabviews/custom/components/card/table-card/index.scss @@ -36,6 +36,7 @@ .card-row-list { overflow-y: auto; .card-item-box { + overflow: hidden; background-color: #ffffff; transition: all 0.3s; } diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 56c60aa..6ca66b6 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -261,10 +261,14 @@ } if (item.type === 'card') { item.subcards.forEach(card => { + let _hasheight = card.style.height && card.style.height !== 'auto' + card.elements = card.elements.filter(cell => { if (cell.eleType === 'button') { cell.logLabel = item.name + '-' + cell.label cell.Ot = 'requiredSgl' + } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { + cell.innerHeight = 'auto' } return cell.eleType !== 'button' || permAction[cell.uuid] }) @@ -272,16 +276,21 @@ if (cell.eleType === 'button') { cell.logLabel = item.name + '-' + cell.label cell.Ot = 'requiredSgl' + } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { + cell.innerHeight = 'auto' } return cell.eleType !== 'button' || permAction[cell.uuid] }) }) } else if (item.type === 'table' && item.subtype === 'tablecard') { item.subcards.forEach(card => { + let _hasheight = card.style.height && card.style.height !== 'auto' card.elements = card.elements.filter(cell => { if (cell.eleType === 'button') { cell.logLabel = item.name + '-' + cell.label cell.Ot = 'requiredSgl' + } else if (['text', 'number', 'link'].includes(cell.eleType) && !cell.height && _hasheight) { + cell.innerHeight = 'auto' } return cell.eleType !== 'button' || permAction[cell.uuid] }) diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx index 6bbb2cc..c0c29d5 100644 --- a/src/tabviews/zshare/mutilform/index.jsx +++ b/src/tabviews/zshare/mutilform/index.jsx @@ -281,8 +281,14 @@ if (!input || input.id !== selectId) return if (input.className === 'ant-select-search__field' && type !== 'init') { - let div = document.getElementById(input.id) - div && div.click && div.click() + let div = input.parentNode + while (div && div.parentNode) { + div = div.parentNode + if (div.id === selectId) { + div && div.click && div.click() + div = null + } + } } else if (input.select) { input.select() } else if (input.focus) { diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx index ef2cbd8..1098f5c 100644 --- a/src/templates/formtabconfig/index.jsx +++ b/src/templates/formtabconfig/index.jsx @@ -440,7 +440,7 @@ }) _inputfields = _formfields.filter(item => item.type === 'text' || item.type === 'number') - _tabfields = _formfields.filter(item => card.field !== item.field && ['text', 'number', 'select', 'link'].includes(item.type)) + _tabfields = _formfields.filter(item => card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) _tabfields.unshift({field: '', text: '鍘熻〃鍗�'}) if (card.linkSubField && card.linkSubField.length > 0) { diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 5bb6f03..7ada148 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -277,7 +277,7 @@ } _inputfields = _formfields.filter(item => item.type === 'text' || item.type === 'number') - _tabfields = _formfields.filter(item => card.field !== item.field && ['text', 'number', 'select', 'link'].includes(item.type)) + _tabfields = _formfields.filter(item => card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) _tabfields.unshift({field: '', text: '鍘熻〃鍗�'}) let uniq = new Map() diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index cc26757..cdeae62 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -2347,14 +2347,6 @@ readonly: false }, { - type: 'multiselect', - key: 'linkSubField', - label: Formdict['model.form.linkform'], - tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑琛ㄥ崟锛堟枃鏈垨鏁板瓧琛ㄥ崟锛変腑銆�', - initVal: card.linkSubField || [], - options: inputfields - }, - { type: 'text', key: 'tooltip', label: '鎮诞鎻愮ず', @@ -2397,6 +2389,14 @@ }, { type: 'multiselect', + key: 'linkSubField', + label: Formdict['model.form.linkform'], + tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婁俊鎭嚜鍔ㄥ~鍏ュ叧鑱旂殑琛ㄥ崟锛堟枃鏈垨鏁板瓧琛ㄥ崟锛変腑銆�', + initVal: card.linkSubField || [], + options: inputfields + }, + { + type: 'multiselect', key: 'blacklist', label: Formdict['header.form.blacklist'], initVal: card.blacklist || [], diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx index eb7b333..b0080fa 100644 --- a/src/templates/zshare/modalform/index.jsx +++ b/src/templates/zshare/modalform/index.jsx @@ -187,11 +187,22 @@ openTypeChange = (key, value) => { if (key === 'type') { - let _options = this.getOptions(value, this.state.resourceType, this.state.supField, this.state.display, this.state.enter) + let enter = 'false' let fieldValue = {} + + if (value === 'text' || value === 'number') { + enter = 'sub' + fieldValue.enter = 'sub' + } else if (value === 'select' || value === 'link') { + fieldValue.enter = 'false' + } + + let _options = this.getOptions(value, this.state.resourceType, this.state.supField, this.state.display, enter) + this.setState({ openType: value, + enter: enter, formlist: this.state.formlist.map(form => { form.show = _options.includes(form.key) if (form.key === 'initval') { @@ -233,8 +244,6 @@ if (form.show) { fieldValue.resourceType = form.initVal } - } else if (form.key === 'enter') { - form.initVal = this.state.enter } else if (form.key === 'linkSubField') { form.initVal = this.state.linkSubFields.map(_field => _field.field) diff --git a/src/utils/option.js b/src/utils/option.js index 81b642d..75fca24 100644 --- a/src/utils/option.js +++ b/src/utils/option.js @@ -665,12 +665,10 @@ export const minkeIconSystem = { direction: [ - 'step-backward', - 'step-forward', - 'fast-backward', - 'fast-forward', - 'shrink', - 'arrows-alt', + 'arrow-up', + 'arrow-down', + 'arrow-left', + 'arrow-right', 'down', 'up', 'left', @@ -679,6 +677,12 @@ 'caret-down', 'caret-left', 'caret-right', + 'step-backward', + 'step-forward', + 'fast-backward', + 'fast-forward', + 'shrink', + 'arrows-alt', 'up-circle', 'down-circle', 'left-circle', @@ -698,10 +702,6 @@ 'swap', 'swap-left', 'swap-right', - 'arrow-up', - 'arrow-down', - 'arrow-left', - 'arrow-right', 'play-circle', 'up-square', 'down-square', -- Gitblit v1.8.0