From 3723f5e83b1733882a152018450bb5ab18e683b0 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 30 三月 2022 22:22:27 +0800 Subject: [PATCH] 2022-03-30 --- src/menu/components/share/searchcomponent/index.scss | 8 + src/mob/components/menubar/normal-menubar/menucomponent/index.jsx | 5 src/tabviews/zshare/mutilform/mkCheckCard/index.jsx | 13 +++ src/tabviews/zshare/topSearch/index.jsx | 14 +++ src/templates/zshare/formconfig.jsx | 12 +++ src/templates/zshare/modalform/datatable/index.jsx | 39 ++++++++- src/mob/components/menubar/normal-menubar/index.jsx | 4 src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx | 11 ++ src/menu/components/share/searchcomponent/dragsearch/card.jsx | 11 ++ src/mob/components/topbar/normal-navbar/options.jsx | 12 ++ src/mob/components/menubar/normal-menubar/options.jsx | 11 ++ src/mob/components/menubar/normal-menubar/index.scss | 23 +++++ src/mob/components/topbar/normal-navbar/index.jsx | 2 src/tabviews/zshare/topSearch/advanceform/index.jsx | 6 + src/templates/sharecomponent/searchcomponent/index.scss | 11 ++ src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 28 ++++--- 16 files changed, 175 insertions(+), 35 deletions(-) diff --git a/src/menu/components/share/searchcomponent/dragsearch/card.jsx b/src/menu/components/share/searchcomponent/dragsearch/card.jsx index 650c5b6..f6f78e3 100644 --- a/src/menu/components/share/searchcomponent/dragsearch/card.jsx +++ b/src/menu/components/share/searchcomponent/dragsearch/card.jsx @@ -103,6 +103,11 @@ formItem = <DateGroup card={card} /> } + let labelwidth = card.labelwidth || 33.3 + if (card.labelShow === 'false') { + labelwidth = 0 + } + return ( <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> @@ -114,8 +119,10 @@ <div className={'page-card ' + (card.labelShow || '')} style={{ opacity: opacity}}> <div ref={node => drag(drop(node))}> <Form.Item - labelCol={{xs: { span: 24 }, sm: { span: 8 }}} - wrapperCol = {{xs: { span: 24 }, sm: { span: 16 }}} + labelCol={{style: {width: labelwidth + '%'}}} + wrapperCol={{style: {width: (100 - labelwidth) + '%'}}} + // labelCol={{xs: { span: 24 }, sm: { span: 8 }}} + // wrapperCol = {{xs: { span: 24 }, sm: { span: 16 }}} label={card.labelShow !== 'false' ? card.label : ''} required={card.required === 'true'} > diff --git a/src/menu/components/share/searchcomponent/index.scss b/src/menu/components/share/searchcomponent/index.scss index 8effaa7..fccf1bf 100644 --- a/src/menu/components/share/searchcomponent/index.scss +++ b/src/menu/components/share/searchcomponent/index.scss @@ -1,7 +1,7 @@ .model-custom-header-search-list { padding: 0px; - .ant-row .ant-col { + .ant-row >.ant-col { float: right; padding: 0 6px; } @@ -49,6 +49,12 @@ opacity: 0; z-index: 2; } + .ant-form-item-label { + float: left; + } + .ant-form-item-control-wrapper { + float: left; + } } .page-card.false { .ant-form-item-label { diff --git a/src/mob/components/menubar/normal-menubar/index.jsx b/src/mob/components/menubar/normal-menubar/index.jsx index 85e728f..2e02fab 100644 --- a/src/mob/components/menubar/normal-menubar/index.jsx +++ b/src/mob/components/menubar/normal-menubar/index.jsx @@ -285,7 +285,9 @@ } trigger="hover"> <ToolOutlined /> </Popover> - {card.subMenus.map((menu, index) => (<MenuComponent key={menu.uuid} offset={!index ? offset : 0} cards={card} card={menu} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} + <div className={(card.wrap.layout || 'grid') + '-layout'}> + {card.subMenus.map((menu, index) => (<MenuComponent key={menu.uuid} offset={!index ? offset : 0} cards={card} card={menu} move={this.move} updateElement={this.updateCard} deleteElement={this.deleteCard}/>))} + </div> </div> ) } diff --git a/src/mob/components/menubar/normal-menubar/index.scss b/src/mob/components/menubar/normal-menubar/index.scss index 17f053d..f5e0186 100644 --- a/src/mob/components/menubar/normal-menubar/index.scss +++ b/src/mob/components/menubar/normal-menubar/index.scss @@ -27,6 +27,29 @@ padding: 5px; background: rgba(255, 255, 255, 0.55); } + .menu-right { + display: none; + } + .vertical-layout { + >.ant-col { + width: 100%; + .menu-item { + display: flex; + align-items: center; + .menu-sign { + margin-right: 10px; + } + .menu-name { + text-align: inherit; + flex: 10; + } + .menu-right { + margin-left: 5px; + display: inline-block; + } + } + } + } .menu-item { overflow: hidden; diff --git a/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx b/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx index 45740d0..4cefea2 100644 --- a/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx +++ b/src/mob/components/menubar/normal-menubar/menucomponent/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { Popover, Col } from 'antd' -import { SwapOutlined, ArrowLeftOutlined, ArrowRightOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined } from '@ant-design/icons' +import { SwapOutlined, ArrowLeftOutlined, ArrowRightOutlined, EditOutlined, FontColorsOutlined, DeleteOutlined, RightOutlined } from '@ant-design/icons' import asyncIconComponent from '@/utils/asyncIconComponent' import Utils from '@/utils/utils.js' @@ -76,7 +76,7 @@ const { card } = this.state let _style = card.style ? fromJS(card.style).toJS() : {} - let options = ['font', 'border', 'padding'] + let options = ['font', 'border', 'padding', 'margin', 'background'] MKEmitter.emit('changeStyle', [cards.uuid, card.uuid], options, _style) } @@ -160,6 +160,7 @@ {card.setting.tip ? <sup className="am-badge-text"></sup> : null} </div>} <div className="menu-name">{card.setting.name}</div> + <RightOutlined className="menu-right" /> </div> </Popover> </Col> diff --git a/src/mob/components/menubar/normal-menubar/options.jsx b/src/mob/components/menubar/normal-menubar/options.jsx index 45e6b8a..5aeb689 100644 --- a/src/mob/components/menubar/normal-menubar/options.jsx +++ b/src/mob/components/menubar/normal-menubar/options.jsx @@ -40,6 +40,17 @@ {value: 'dynamic', label: '鍔ㄦ��'}, {value: 'static', label: '闈欐��'}, ] + }, + { + type: 'radio', + field: 'layout', + label: '鑿滃崟甯冨眬', + initval: wrap.layout || 'grid', + required: false, + options: [ + {value: 'grid', label: '鏍呮牸甯冨眬'}, + {value: 'vertical', label: '涓婁笅甯冨眬'}, + ] } ] diff --git a/src/mob/components/topbar/normal-navbar/index.jsx b/src/mob/components/topbar/normal-navbar/index.jsx index e14304d..5ee7895 100644 --- a/src/mob/components/topbar/normal-navbar/index.jsx +++ b/src/mob/components/topbar/normal-navbar/index.jsx @@ -209,7 +209,7 @@ <div className="normal-topbar-edit-box" style={card.style} onClick={this.clickComponent} id={card.uuid}> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - <NormalForm title="瀵艰埅鏍忚缃�" width={750} update={this.updateWrap} getForms={this.getWrapForms}> + <NormalForm title="瀵艰埅鏍忚缃�" width={850} update={this.updateWrap} getForms={this.getWrapForms}> <EditOutlined style={{color: '#1890ff'}} title="缂栬緫"/> </NormalForm> <CopyComponent type="topbar" card={card}/> diff --git a/src/mob/components/topbar/normal-navbar/options.jsx b/src/mob/components/topbar/normal-navbar/options.jsx index 260e5b2..fbc9746 100644 --- a/src/mob/components/topbar/normal-navbar/options.jsx +++ b/src/mob/components/topbar/normal-navbar/options.jsx @@ -172,7 +172,15 @@ editable: true, required: true, render: (text, record) => <MkIcon type={text}/>, - width: '35%' + width: '23%' + }, + { + title: '鑷畾涔夊悕绉�', + dataIndex: 'name', + inputType: 'text', + editable: true, + required: false, + width: '23%' }, { title: '鑿滃崟', @@ -181,7 +189,7 @@ editable: true, required: true, extends: [{key: 'label', value: 'label'}], - width: '35%', + width: '23%', render: (text, record) => record.label, options: menulist } diff --git a/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx b/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx index 9014cbb..d0b2c65 100644 --- a/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx +++ b/src/tabviews/zshare/mutilform/mkCheckCard/index.jsx @@ -145,6 +145,19 @@ }, () => { this.props.onChange(item.$value, other) }) + } else { + let other = {} + config.linkFields && config.linkFields.forEach((m, i) => { + setTimeout(() => { + MKEmitter.emit('mkFP', m.uuid, '', 0) + }, (i + 1) * 100) + }) + + this.setState({ + selectKeys: '' + }, () => { + this.props.onChange('', other) + }) } } diff --git a/src/tabviews/zshare/topSearch/advanceform/index.jsx b/src/tabviews/zshare/topSearch/advanceform/index.jsx index 8680e75..ae479bd 100644 --- a/src/tabviews/zshare/topSearch/advanceform/index.jsx +++ b/src/tabviews/zshare/topSearch/advanceform/index.jsx @@ -53,7 +53,11 @@ if (content) { fields.push( <Col span={item.ratio || 6} key={index}> - <Form.Item label={item.labelShow !== 'false' ? item.label : ''}> + <Form.Item + labelCol={item.labelCol} + wrapperCol={item.wrapperCol} + label={item.labelShow !== 'false' ? item.label : ''} + > {getFieldDecorator(item.field, { initialValue: item.initval, rules: _rules diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index 316dca4..39e88fc 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -101,6 +101,13 @@ linkFields[item.linkField].push({field: item.field, uuid: item.uuid}) } + let labelwidth = item.labelwidth || 33.3 + if (item.labelShow === 'false') { + labelwidth = 0 + } + item.labelCol = {style: {width: labelwidth + '%'}} + item.wrapperCol = {style: {width: (100 - labelwidth) + '%'}} + if (fieldMap.has(item.field)) { item.field = item.field + '@tail@' } @@ -497,7 +504,12 @@ if (content) { fields.push( <Col span={item.ratio || 6} key={index}> - <Form.Item className={className} label={item.labelShow !== 'false' ? item.label : ''}> + <Form.Item + className={className} + label={item.labelShow !== 'false' ? item.label : ''} + labelCol={item.labelCol} + wrapperCol={item.wrapperCol} + > {getFieldDecorator(field, { initialValue: item.initval, rules: _rules diff --git a/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx b/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx index 75bf193..6183e23 100644 --- a/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx +++ b/src/templates/sharecomponent/searchcomponent/dragsearch/card.jsx @@ -113,6 +113,11 @@ formItem = <CheckCard config={card} /> } + let labelwidth = card.labelwidth || 33.3 + if (card.labelShow === 'false') { + labelwidth = 0 + } + return ( <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> @@ -124,8 +129,10 @@ <div className={'page-card ' + (card.labelShow || '') + ' ' + type} style={{ opacity: opacity}}> <div ref={node => drag(drop(node))} onDoubleClick={() => editCard(id)}> <Form.Item - labelCol={{xs: { span: 24 }, sm: { span: 8 }}} - wrapperCol = {{xs: { span: 24 }, sm: { span: 16 }}} + labelCol={{style: {width: labelwidth + '%'}}} + wrapperCol={{style: {width: (100 - labelwidth) + '%'}}} + // labelCol={{xs: { span: 24 }, sm: { span: 8 }}} + // wrapperCol = {{xs: { span: 24 }, sm: { span: 16 }}} label={card.labelShow !== 'false' ? card.label : ''} required={card.required === 'true'} help={showField ? card.field + (card.datefield ? ', ' + card.datefield : '') : ''} diff --git a/src/templates/sharecomponent/searchcomponent/index.scss b/src/templates/sharecomponent/searchcomponent/index.scss index e8da957..74c00ca 100644 --- a/src/templates/sharecomponent/searchcomponent/index.scss +++ b/src/templates/sharecomponent/searchcomponent/index.scss @@ -15,10 +15,11 @@ } > .ant-row { min-height: 65px; + >.ant-col { + padding: 0 12px!important; + } } - .ant-row .ant-col-6 { - padding: 0 12px!important; - } + .ant-row.ant-form-item .ant-col { padding: 0; } @@ -30,7 +31,11 @@ height: 55px; .ant-form-item { margin-bottom: 0px; + .ant-form-item-label { + float: left; + } .ant-form-item-control-wrapper { + float: left; .ant-select { width: 100%; margin-top: 4px; diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index c1496f5..f1004e0 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -94,17 +94,17 @@ ] const searchTypeOptions = { - text: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'inputType', 'advanced', 'query'], - select: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query'], - multiselect: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query'], - link: ['label', 'field', 'resourceType', 'initval', 'type', 'linkField', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query'], - date: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision'], - checkcard: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'resourceType', 'display', 'width', 'multiple', 'borderColor', 'required', 'Hide', 'labelShow', 'advanced', 'query'], - dateweek: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query'], - datemonth: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query'], - daterange: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision'], - group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'labelShow', 'query'], - range: ['label', 'type', 'field', 'initval', 'match', 'blacklist', 'Hide', 'required', 'maxValue', 'minValue', 'step', 'labelShow', 'query'] + text: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'inputType', 'advanced', 'query', 'labelwidth'], + select: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query', 'labelwidth'], + multiselect: ['label', 'field', 'resourceType', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], + link: ['label', 'field', 'resourceType', 'initval', 'type', 'linkField', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'setAll', 'dropdown', 'query', 'labelwidth'], + date: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision', 'labelwidth'], + checkcard: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'resourceType', 'display', 'width', 'multiple', 'borderColor', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], + dateweek: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], + datemonth: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'labelwidth'], + daterange: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced', 'query', 'precision', 'labelwidth'], + group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'labelShow', 'query', 'labelwidth'], + range: ['label', 'type', 'field', 'initval', 'match', 'blacklist', 'Hide', 'required', 'maxValue', 'minValue', 'step', 'labelShow', 'query', 'labelwidth'] } class MainSearch extends Component { @@ -257,6 +257,7 @@ } optionChange = (key, value) => { + let oriType = this.record.type this.record[key] = value let _fieldval = {} @@ -281,6 +282,9 @@ if (value === 'checkcard') { this.record.multiple = 'false' _fieldval.multiple = 'false' + _fieldval.ratio = 24 + } else if (oriType === 'checkcard') { + _fieldval.ratio = 6 } if (this.record.options.length > 0) { @@ -459,7 +463,7 @@ initVal = item.initVal if (item.max) { - content = <InputNumber min={item.min} max={item.max} precision={0} onPressEnter={this.handleSubmit}/> + content = <InputNumber min={item.min} max={item.max} precision={item.precision || 0} onPressEnter={this.handleSubmit}/> } else { content = <InputNumber onPressEnter={this.handleSubmit}/> } diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 007fdca..a9468fe 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -650,6 +650,18 @@ required: false }, { + type: 'number', + key: 'labelwidth', + min: 1, + max: 100, + precision: 1, + label: '鍚嶇О瀹藉害', + initVal: card.labelwidth || 33.3, + tooltip: '鍚嶇О鍗犳嵁鎼滅储鏉′欢瀹藉害鐨勭櫨鍒嗘瘮銆傛敞锛氬瓨鍦ㄥ鍒楁悳绱㈡椂锛屽綋鍓嶆悳绱㈠鏋滄兂瑕佸崰鎹暣琛屽彲鍙傜収浠ヤ笅姣斾緥锛屼袱鍒楋紙16.5锛夈�佷笁鍒楋紙10.8锛夈�佸洓鍒楋紙8锛�', + required: true, + forbid: appType === 'mob' + }, + { type: 'radio', key: 'precision', label: '绮剧‘搴�', diff --git a/src/templates/zshare/modalform/datatable/index.jsx b/src/templates/zshare/modalform/datatable/index.jsx index 99e2320..ec8b5a1 100644 --- a/src/templates/zshare/modalform/datatable/index.jsx +++ b/src/templates/zshare/modalform/datatable/index.jsx @@ -2,7 +2,7 @@ import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' import { DndProvider, DragSource, DropTarget } from 'react-dnd' -import { Table, Input, Popconfirm, Form, notification } from 'antd' +import { Table, Input, Popconfirm, Form, notification, message } from 'antd' import { PlusOutlined, EditOutlined, DeleteOutlined, SwapOutlined } from '@ant-design/icons' import Utils from '@/utils/utils.js' @@ -120,12 +120,12 @@ {editing ? ( <Form.Item style={{ margin: '0 -5px 0 -5px' }}> {getFieldDecorator(dataIndex, { - rules: [ - { - required: dataIndex === '$value', - message: `Please Input ${title}!`, - }, - ], + // rules: [ + // { + // required: dataIndex === '$value', + // message: `Please Input ${title}!`, + // }, + // ], initialValue: _val, })(this.getInput(form))} </Form.Item> @@ -282,8 +282,20 @@ } onSave = (record) => { + const { type } = this.props const newData = [...this.state.data] const index = newData.findIndex(item => record.key === item.key) + + if (type === 'link') { + if (newData.filter(m => record.key !== m.key && record.$value === m.$value && record.ParentID === m.ParentID).length > 0) { + message.warning('鐩稿悓ParentID涓嬶紝姝alue鍊煎凡瀛樺湪锛�') + } + } else { + if (newData.filter(m => record.key !== m.key && record.$value === m.$value).length > 0) { + message.warning('姝alue鍊煎凡瀛樺湪锛�') + } + } + if (index > -1) { newData.splice(index, 1, record) this.setState({ data: newData, editingKey: '' }, () => { @@ -304,6 +316,8 @@ } save(form, key) { + const { type } = this.props + form.validateFields((error, row) => { if (error) { return; @@ -311,6 +325,17 @@ const newData = [...this.state.data] const index = newData.findIndex(item => key === item.key) + + if (type === 'link') { + if (newData.filter(m => key !== m.key && row.$value === m.$value && row.ParentID === m.ParentID).length > 0) { + message.warning('鐩稿悓ParentID涓嬶紝姝alue鍊煎凡瀛樺湪锛�') + } + } else { + if (newData.filter(m => key !== m.key && row.$value === m.$value).length > 0) { + message.warning('姝alue鍊煎凡瀛樺湪锛�') + } + } + if (index > -1) { const item = newData[index] newData.splice(index, 1, { -- Gitblit v1.8.0