From b636a3f64219455ee680bd626c65282c636cfcef Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 07 七月 2021 19:06:13 +0800 Subject: [PATCH] 2021-07-07 --- src/tabviews/zshare/topSearch/index.jsx | 2 src/templates/zshare/formconfig.jsx | 2 src/mob/components/topbar/normal-navbar/wrapsetting/settingform/index.jsx | 24 +--- src/menu/components/tabs/tablabelform/index.jsx | 28 ++++- src/tabviews/zshare/mutilform/checkCard/index.jsx | 15 ++ src/menu/components/tabs/antv-tabs/index.scss | 32 ++++++ src/templates/sharecomponent/searchcomponent/index.jsx | 16 +- src/tabviews/zshare/topSearch/mkSelect/index.jsx | 14 +- src/mob/searchconfig/settingform/index.jsx | 38 ++++++ src/mob/components/topbar/normal-navbar/index.jsx | 5 src/menu/components/tabs/antv-tabs/index.jsx | 50 +++++++++ src/mob/searchconfig/searchdragelement/index.scss | 1 src/utils/utils.js | 3 src/menu/components/tabs/tabsetting/settingform/index.jsx | 17 +++ src/templates/sharecomponent/searchcomponent/searchform/index.jsx | 2 15 files changed, 190 insertions(+), 59 deletions(-) diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx index 34c546b..8f64880 100644 --- a/src/menu/components/tabs/antv-tabs/index.jsx +++ b/src/menu/components/tabs/antv-tabs/index.jsx @@ -31,6 +31,7 @@ state = { dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, + appType: sessionStorage.getItem('appType'), tabs: null, editab: null, labelvisible: false @@ -74,6 +75,7 @@ componentDidMount () { MKEmitter.addListener('submitStyle', this.getStyle) + MKEmitter.addListener('submitSearch', this.getSearch) MKEmitter.addListener('tabsChange', this.handleTabsChange) MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle) } @@ -86,6 +88,7 @@ return } MKEmitter.removeListener('submitStyle', this.getStyle) + MKEmitter.removeListener('submitSearch', this.getSearch) MKEmitter.removeListener('tabsChange', this.handleTabsChange) MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle) } @@ -215,6 +218,7 @@ this.tabLabelRef.handleConfirm().then(res => { editab.label = res.label editab.icon = res.icon + editab.hasSearch = res.hasSearch || '' editab.blacklist = res.blacklist if (editab.uuid) { @@ -288,6 +292,45 @@ this.props.updateConfig(tabs) } + getSearch = (config) => { + const { tabs } = this.state + + if (tabs.uuid !== config.uuid) return + + let _tabs = fromJS(tabs).toJS() + + _tabs.subtabs = _tabs.subtabs.map(t => { + if (t.uuid === config.tabId) { + t.search = config.search + } + return t + }) + + this.setState({ + tabs: _tabs + }) + this.props.updateConfig(_tabs) + } + + setSearch = (tab) => { + const { tabs } = this.state + let card = { + uuid: tabs.uuid, + tabId: tab.uuid, + search: tab.search + } + + if (!card.search) { + card.search = { + floor: 1, + setting: { type: 'title', field: '', title: '', focus: 'true', btn: 'hidden' }, + groups: [], + fields: [] + } + } + MKEmitter.emit('changeSearch', card) + } + clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -296,11 +339,11 @@ } render() { - const { tabs, dict, labelvisible, editab } = this.state + const { tabs, dict, labelvisible, editab, appType } = this.state let _style = resetStyle(tabs.style) return ( - <div className="menu-tabs-edit-box" style={_style} onClick={this.clickComponent} id={tabs.uuid}> + <div className={'menu-tabs-edit-box ' + tabs.setting.display} style={_style} onClick={this.clickComponent} id={tabs.uuid}> <DraggableTabs tabPosition={tabs.setting.position} type={tabs.setting.tabStyle} tabsMove={this.moveSwitch}> {tabs.subtabs.map(tab => ( <TabPane tab={ @@ -314,6 +357,8 @@ <span>{tab.icon ? <Icon type={tab.icon} /> : null}{tab.label}</span> </Popover> } key={tab.uuid}> + {appType === 'mob' && tabs.setting.position === 'top' && tabs.setting.display === 'inline-block' && tab.hasSearch === 'icon' ? + <Icon className="search-icon" onDoubleClick={() => this.setSearch(tab)} type="search" /> : null} <TabComponents config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> </TabPane> ))} @@ -343,6 +388,7 @@ <TabLabelComponent dict={dict} tab={editab} + setting={tabs.setting} inputSubmit={this.tabLabelSubmit} wrappedComponentRef={(inst) => this.tabLabelRef = inst} /> diff --git a/src/menu/components/tabs/antv-tabs/index.scss b/src/menu/components/tabs/antv-tabs/index.scss index 8282c7b..7ad16c9 100644 --- a/src/menu/components/tabs/antv-tabs/index.scss +++ b/src/menu/components/tabs/antv-tabs/index.scss @@ -83,8 +83,40 @@ } } } + .search-icon { + position: absolute; + top: 10px; + right: 40px; + font-size: 18px; + cursor: pointer; + padding: 3px; + } } .menu-tabs-edit-box:hover { z-index: 1; box-shadow: 0px 0px 4px #1890ff; } + +.mob-shell { + .menu-tabs-edit-box.flex { + >.ant-tabs.ant-tabs-top, >.ant-tabs.ant-tabs-bottom { + >.ant-tabs-bar { + >.ant-tabs-nav-container { + >.ant-tabs-nav-wrap { + >.ant-tabs-nav-scroll { + >.ant-tabs-nav { + display: block; + >div { + display: flex; + >.ant-tabs-tab { + flex: 1; + } + } + } + } + } + } + } + } + } +} diff --git a/src/menu/components/tabs/tablabelform/index.jsx b/src/menu/components/tabs/tablabelform/index.jsx index 784a9f9..335976a 100644 --- a/src/menu/components/tabs/tablabelform/index.jsx +++ b/src/menu/components/tabs/tablabelform/index.jsx @@ -1,18 +1,18 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Icon, Select } from 'antd' +import { Form, Row, Col, Input, Icon, Select, Radio } from 'antd' -// import { formRule } from '@/utils/option.js' import './index.scss' class SettingForm extends Component { static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - tab: PropTypes.object, // 鏁版嵁婧愰厤缃� - inputSubmit: PropTypes.func // 鍥炶溅浜嬩欢 + dict: PropTypes.object, + setting: PropTypes.object, + tab: PropTypes.object, + inputSubmit: PropTypes.func } - state = {roleList: []} + state = {roleList: [], appType: sessionStorage.getItem('appType')} UNSAFE_componentWillMount () { let roleList = sessionStorage.getItem('sysRoles') @@ -51,9 +51,9 @@ } render() { - const { tab } = this.props + const { tab, setting } = this.props const { getFieldDecorator } = this.props.form - const { roleList } = this.state + const { roleList, appType } = this.state const formItemLayout = { labelCol: { @@ -97,6 +97,18 @@ )} </Form.Item> </Col> + {appType === 'mob' && setting.position === 'top' && setting.display === 'inline-block' ? <Col span={24}> + <Form.Item label="鎼滅储"> + {getFieldDecorator('hasSearch', { + initialValue: tab.hasSearch || 'false' + })( + <Radio.Group> + <Radio value="false">鏃�</Radio> + <Radio value="icon">鏈�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} <Col span={24}> <Form.Item label="榛戝悕鍗�"> {getFieldDecorator('blacklist', { diff --git a/src/menu/components/tabs/tabsetting/settingform/index.jsx b/src/menu/components/tabs/tabsetting/settingform/index.jsx index a4aeb33..a8190c2 100644 --- a/src/menu/components/tabs/tabsetting/settingform/index.jsx +++ b/src/menu/components/tabs/tabsetting/settingform/index.jsx @@ -13,6 +13,7 @@ state = { appType: sessionStorage.getItem('appType'), + position: this.props.setting.position, roleList: [] } @@ -55,7 +56,7 @@ render() { const { setting } = this.props const { getFieldDecorator } = this.props.form - const { roleList, appType } = this.state + const { roleList, appType, position } = this.state const formItemLayout = { labelCol: { @@ -113,7 +114,7 @@ {getFieldDecorator('position', { initialValue: setting.position || 'top' })( - <Select> + <Select onChange={(val) => this.setState({position: val})}> <Select.Option key="top" value="top"> top </Select.Option> <Select.Option key="bottom" value="bottom"> bottom </Select.Option> <Select.Option key="left" value="left"> left </Select.Option> @@ -139,6 +140,18 @@ )} </Form.Item> </Col> : null} + {appType === 'mob' && (position === 'top' || position === 'bottom') ? <Col span={12}> + <Form.Item label="鏍囩鏄剧ず"> + {getFieldDecorator('display', { + initialValue: setting.display || 'flex' + })( + <Radio.Group> + <Radio value="flex">寮规�у竷灞�</Radio> + <Radio value="inline-block">瀹氬</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} <Col span={12}> <Form.Item label="榛戝悕鍗�"> {getFieldDecorator('blacklist', { diff --git a/src/mob/components/topbar/normal-navbar/index.jsx b/src/mob/components/topbar/normal-navbar/index.jsx index ca764ec..0ce1712 100644 --- a/src/mob/components/topbar/normal-navbar/index.jsx +++ b/src/mob/components/topbar/normal-navbar/index.jsx @@ -33,7 +33,7 @@ uuid: card.uuid, type: card.type, floor: card.floor, - width: card.width || 24, + width: 24, subtype: card.subtype, wrap: { type: 'navbar', height: 50, title: 'NavBar', back: 'true', search: 'false', logout: 'false' }, style: {borderBottomColor: '#bcbcbc', borderBottomWidth: '1px', paddingLeft: '10px', paddingRight: '10px', lineHeight: '2.8', fontSize: '18px' }, @@ -84,9 +84,6 @@ this.setState({ card: component }) - - component.width = component.wrap.width - component.name = component.wrap.name this.props.updateConfig(component) } diff --git a/src/mob/components/topbar/normal-navbar/wrapsetting/settingform/index.jsx b/src/mob/components/topbar/normal-navbar/wrapsetting/settingform/index.jsx index a933aa7..7656c0e 100644 --- a/src/mob/components/topbar/normal-navbar/wrapsetting/settingform/index.jsx +++ b/src/mob/components/topbar/normal-navbar/wrapsetting/settingform/index.jsx @@ -67,26 +67,18 @@ )} </Form.Item> </Col> - {type === 'navbar' ? <Col span={12}> - <Form.Item label="鏍囬"> + <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="浣跨敤鎼滅储鏍忔椂锛屾爣棰樼敤浜庢悳绱㈡潯浠堕殣钘忔椂鏄剧ず銆�"> + <Icon type="question-circle" /> + 鏍囬 + </Tooltip> + }> {getFieldDecorator('title', { initialValue: wrap.title || '' })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} </Form.Item> - </Col> : null} - {/* <Col span={12}> - <Form.Item label="楂樺害"> - {getFieldDecorator('height', { - initialValue: wrap.height || 50, - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + '楂樺害!' - } - ] - })(<InputNumber min={30} max={200} precision={0} onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> */} + </Col> <Col span={12}> <Form.Item label="杩斿洖"> {getFieldDecorator('back', { diff --git a/src/mob/searchconfig/searchdragelement/index.scss b/src/mob/searchconfig/searchdragelement/index.scss index 113604d..357ef51 100644 --- a/src/mob/searchconfig/searchdragelement/index.scss +++ b/src/mob/searchconfig/searchdragelement/index.scss @@ -98,6 +98,7 @@ .am-input-control { height: 25px; padding-top: 10px; + padding-left: 12px; } } } diff --git a/src/mob/searchconfig/settingform/index.jsx b/src/mob/searchconfig/settingform/index.jsx index 29099e7..8468602 100644 --- a/src/mob/searchconfig/settingform/index.jsx +++ b/src/mob/searchconfig/settingform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Radio, Select } from 'antd' +import { Form, Row, Col, Input, Radio, Select, Tooltip, Icon } from 'antd' import { formRule } from '@/utils/option.js' import './index.scss' @@ -83,8 +83,13 @@ )} </Form.Item> </Col> - {type === 'title' ? <Col span={12}> - <Form.Item label="鏍囬"> + <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="浣跨敤鎼滅储鏍忔椂锛屾爣棰樼敤浜庢悳绱㈡潯浠堕殣钘忔椂鏄剧ず銆�"> + <Icon type="question-circle" /> + 鏍囬 + </Tooltip> + }> {getFieldDecorator('title', { initialValue: config.setting.title, rules: [ @@ -95,7 +100,7 @@ ] })(<Input placeholder="" autoComplete="off" onPressEnter={this.handleSubmit} />)} </Form.Item> - </Col> : null} + </Col> {type === 'search' ? <Col span={12}> <Form.Item label="鎼滅储瀛楁"> {getFieldDecorator('field', { @@ -131,6 +136,19 @@ </Form.Item> </Col> : null} {type === 'search' ? <Col span={12}> + <Form.Item label="鍖归厤鏂瑰紡"> + {getFieldDecorator('match', { + initialValue: config.setting.match || 'like' + })( + <Radio.Group> + <Radio value="like">like</Radio> + <Radio value="not like">not like</Radio> + <Radio value="=">=</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {type === 'search' ? <Col span={12}> <Form.Item label="蹇呭~"> {getFieldDecorator('required', { initialValue: config.setting.required || 'false' @@ -143,6 +161,18 @@ </Form.Item> </Col> : null} {type === 'search' ? <Col span={12}> + <Form.Item label="闅愯棌"> + {getFieldDecorator('Hide', { + initialValue: config.setting.Hide || 'false' + })( + <Radio.Group> + <Radio value="true">鏄�</Radio> + <Radio value="false">鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} + {type === 'search' ? <Col span={12}> <Form.Item label="鑷姩鑱氱劍"> {getFieldDecorator('focus', { initialValue: config.setting.focus || 'true' diff --git a/src/tabviews/zshare/mutilform/checkCard/index.jsx b/src/tabviews/zshare/mutilform/checkCard/index.jsx index 34d8810..fd825fa 100644 --- a/src/tabviews/zshare/mutilform/checkCard/index.jsx +++ b/src/tabviews/zshare/mutilform/checkCard/index.jsx @@ -2,6 +2,7 @@ import PropTypes from 'prop-types' import { Col, Row } from 'antd' +import MKEmitter from '@/utils/events.js' import './index.scss' class CheckCard extends Component { @@ -29,12 +30,12 @@ } changeCard = (item) => { - const { multiple, readonly } = this.props.card + const { card } = this.props const { selectKeys } = this.state - if (readonly) return + if (card.readonly) return - if (multiple === 'true') { + if (card.multiple === 'true') { let keys = [] if (selectKeys.includes(item.$value)) { keys = selectKeys.filter(key => key !== item.$value) @@ -47,7 +48,13 @@ }, () => { this.props.onChange && this.props.onChange(keys.join(',')) }) - } else if (multiple !== 'true' && selectKeys !== item.$value) { + } else if (selectKeys !== item.$value) { + card.linkFields && card.linkFields.forEach((m, i) => { + setTimeout(() => { + MKEmitter.emit('mkSP', m.uuid, item.$value, 0) + }, (i + 1) * 10) + }) + this.setState({ selectKeys: item.$value }, () => { diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx index b2ee6cc..d97e992 100644 --- a/src/tabviews/zshare/topSearch/index.jsx +++ b/src/tabviews/zshare/topSearch/index.jsx @@ -166,7 +166,7 @@ let _list = _searchlist.map(item => { if (item.hidden) return item - if (linkFields[item.field] && (item.type === 'select' || item.type === 'link')) { + if (linkFields[item.field]) { item.linkFields = linkFields[item.field] } diff --git a/src/tabviews/zshare/topSearch/mkSelect/index.jsx b/src/tabviews/zshare/topSearch/mkSelect/index.jsx index 9b0c4fc..725c805 100644 --- a/src/tabviews/zshare/topSearch/mkSelect/index.jsx +++ b/src/tabviews/zshare/topSearch/mkSelect/index.jsx @@ -83,18 +83,16 @@ selectChange = (val) => { const { config } = this.state - - if (config.linkFields) { - config.linkFields.forEach((m, i) => { - setTimeout(() => { - MKEmitter.emit('mkSP', m.uuid, val, 0) - }, (i + 1) * 10) - }) - } if (config.type === 'multiselect') { this.props.onChange(val.join(',')) } else { + config.linkFields && config.linkFields.forEach((m, i) => { + setTimeout(() => { + MKEmitter.emit('mkSP', m.uuid, val, 0) + }, (i + 1) * 10) + }) + this.props.onChange(val) } diff --git a/src/templates/sharecomponent/searchcomponent/index.jsx b/src/templates/sharecomponent/searchcomponent/index.jsx index 2352d66..44d9716 100644 --- a/src/templates/sharecomponent/searchcomponent/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/index.jsx @@ -80,12 +80,14 @@ let linkableFields = [] searchlist.forEach(item => { - if (item.uuid !== card.uuid && (item.type === 'select' || item.type === 'link')) { - linkableFields.push({ - value: item.field, - text: item.label - }) - } + if (item.uuid === card.uuid) return + if (!['select', 'link', 'checkcard'].includes(item.type)) return + if (item.type === 'checkcard' && item.multiple === 'true') return + + linkableFields.push({ + value: item.field, + text: item.label + }) }) this.setState({ @@ -188,7 +190,7 @@ return } - if (['checkcard', 'select', 'multiselect', 'link'].includes() && res.resourceType === '1' && /\s/.test(res.dataSource)) { + if (['checkcard', 'select', 'multiselect', 'link'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) { this.setState({ sqlVerifing: true }) diff --git a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx index dac14ca..96c3459 100644 --- a/src/templates/sharecomponent/searchcomponent/searchform/index.jsx +++ b/src/templates/sharecomponent/searchcomponent/searchform/index.jsx @@ -97,7 +97,7 @@ datemonth: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'], daterange: ['label', 'field', 'initval', 'type', 'match', 'ratio', 'blacklist', 'required', 'Hide', 'labelShow', 'advanced'], group: ['label', 'type', 'field', 'datefield', 'initval', 'blacklist', 'ratio', 'items', 'required', 'labelShow'], - range: ['label', 'type', 'field', 'initval', 'blacklist', 'maxValue', 'minValue', 'step', 'labelShow'] + range: ['label', 'type', 'field', 'initval', 'match', 'blacklist', 'Hide', 'required', 'maxValue', 'minValue', 'step', 'labelShow'] } class MainSearch extends Component { diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx index 6ce34b8..2b1c010 100644 --- a/src/templates/zshare/formconfig.jsx +++ b/src/templates/zshare/formconfig.jsx @@ -2913,7 +2913,7 @@ type: 'text', key: 'supvalue', label: '鏄剧ず鍊�', - tooltip: '璇峰~鍐欐樉绀哄�硷紝鍙湁涓婄骇琛ㄥ崟鍊间笌鏄剧ず鍊肩浉鍚屾椂锛岃琛ㄥ崟鎵嶄細鏄剧ず锛屾敞锛氬涓�肩敤閫楀彿鍒嗛殧銆�', + tooltip: '璇峰~鍐欐樉绀哄�硷紝鍙湁涓婄骇琛ㄥ崟鍊间笌鏄剧ず鍊肩浉鍚屾椂锛岃琛ㄥ崟鎵嶄細鏄剧ず锛屾敞锛�1銆佸涓�肩敤閫楀彿鍒嗛殧锛�2銆佷笂绾ц〃鍗曞垵濮嬪�间负$first鏃舵殏鏈鐞嗐��', initVal: card.supvalue || '', required: true, readonly: false diff --git a/src/utils/utils.js b/src/utils/utils.js index a113202..8be2c14 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -246,7 +246,7 @@ return searches.map(item => { item.hidden = item.Hide === 'true' - item.required = item.required === 'true' + item.required = !item.hidden && item.required === 'true' item.advanced = item.advanced === 'true' if (item.type === 'date') { // 鏃堕棿鎼滅储 @@ -329,6 +329,7 @@ if (item.blacklist && item.blacklist.length > 0 && !item.hidden) { if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) { item.hidden = true + item.required = false } } -- Gitblit v1.8.0