From 966ff7fb84181f0fa86a56569a8492453c3ae80a Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 26 八月 2021 14:56:42 +0800 Subject: [PATCH] 2021-08-26 --- src/templates/zshare/editTable/index.jsx | 27 ++ src/components/normalform/modalform/index.jsx | 2 src/mob/components/tabs/antv-tabs/index.jsx | 152 +++++++--------- src/mob/components/tabs/antv-tabs/options.jsx | 63 +++++++ src/views/pcdesign/index.jsx | 1 src/menu/components/share/actioncomponent/formconfig.jsx | 2 src/templates/zshare/verifycard/index.jsx | 3 src/components/normalform/index.scss | 3 src/menu/components/tabs/antv-tabs/options.jsx | 63 +++++++ src/templates/zshare/verifycard/billcodeform/index.jsx | 7 src/menu/components/search/main-search/index.jsx | 8 src/menu/components/tabs/antv-tabs/dragabletabs.jsx | 4 /dev/null | 0 src/components/normalform/index.jsx | 10 src/menu/components/table/normal-table/columns/index.jsx | 4 src/views/mobdesign/index.jsx | 1 src/menu/components/search/main-search/index.scss | 14 + src/menu/components/tabs/antv-tabs/index.jsx | 151 +++++++--------- src/templates/zshare/editTable/index.scss | 4 src/views/menudesign/index.jsx | 1 src/menu/datasource/verifycard/index.jsx | 4 src/mob/components/tabs/antv-tabs/dragabletabs.jsx | 4 22 files changed, 332 insertions(+), 196 deletions(-) diff --git a/src/components/normalform/index.jsx b/src/components/normalform/index.jsx index 2c3dfea..de675fb 100644 --- a/src/components/normalform/index.jsx +++ b/src/components/normalform/index.jsx @@ -24,7 +24,7 @@ } shouldComponentUpdate (nextProps, nextState) { - return !is(fromJS(this.state), fromJS(nextState)) + return !is(fromJS(this.state), fromJS(nextState)) || !is(fromJS(this.props.children), fromJS(nextProps.children)) } trigger = () => { @@ -62,12 +62,12 @@ } render () { - const { title, width, children } = this.props + const { title, width, children, double } = this.props const { visible, dict, formlist } = this.state return ( - <div className="normal-form-wrap"> - <span onClick={this.trigger}>{children}</span> + <> + {!double ? <span onClick={this.trigger}>{children}</span> : <span onDoubleClick={this.trigger}>{children}</span>} <Modal wrapClassName="popview-modal" title={title} @@ -85,7 +85,7 @@ wrappedComponentRef={(inst) => this.Ref = inst} /> </Modal> - </div> + </> ) } } diff --git a/src/components/normalform/index.scss b/src/components/normalform/index.scss index 57c7b66..e69de29 100644 --- a/src/components/normalform/index.scss +++ b/src/components/normalform/index.scss @@ -1,3 +0,0 @@ -.normal-form-wrap { - display: inline-block; -} \ No newline at end of file diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx index 5420d00..e0927dc 100644 --- a/src/components/normalform/modalform/index.jsx +++ b/src/components/normalform/modalform/index.jsx @@ -216,7 +216,7 @@ } else if (item.type === 'textarea') { content = (<TextArea rows={item.rows || 2} placeholder=""/>) } else if (item.type === 'mkicon') { - content = (<MkIcon />) + content = (<MkIcon allowClear={item.allowClear}/>) } else if (item.type === 'source') { content = (<SourceComponent type="" placement="right"/>) } diff --git a/src/menu/components/search/main-search/index.jsx b/src/menu/components/search/main-search/index.jsx index d17f664..91421d3 100644 --- a/src/menu/components/search/main-search/index.jsx +++ b/src/menu/components/search/main-search/index.jsx @@ -18,6 +18,7 @@ const { confirm } = Modal const WrapComponent = asyncIconComponent(() => import('./wrapsetting')) +const FieldsComponent = asyncIconComponent(() => import('@/templates/sharecomponent/fieldscomponent')) const SearchForm = asyncIconComponent(() => import('@/templates/sharecomponent/searchcomponent/searchform')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteComponent = asyncIconComponent(() => import('@/menu/components/share/pastecomponent')) @@ -363,6 +364,12 @@ }) } + updatefields = (config) => { + this.setState({card: config}, ()=> { + this.props.updateConfig(config) + }) + } + clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -376,6 +383,7 @@ return ( <div className={`main-search-edit-list ${card.wrap.float} ${card.wrap.show || ''}`} onClick={this.clickComponent} id={card.uuid} style={_style}> + <FieldsComponent config={card} type="search" updatefield={this.updatefields} /> <Switch checkedChildren={dict['model.switch.open']} size="small" unCheckedChildren={dict['model.switch.close']} defaultChecked={showField} onChange={this.onFieldChange} /> <DragElement list={card.search} diff --git a/src/menu/components/search/main-search/index.scss b/src/menu/components/search/main-search/index.scss index 09caf96..d7eb2f7 100644 --- a/src/menu/components/search/main-search/index.scss +++ b/src/menu/components/search/main-search/index.scss @@ -102,6 +102,20 @@ margin-left: 5px; } } + .quickly-add { + position: absolute; + z-index: 3; + right: 55px; + bottom: 3px; + .ant-btn-block { + background-color: transparent; + color: #1890ff; + border: none; + box-shadow: none!important; + height: 18px; + padding: 0 10px; + } + } } .main-search-edit-list:not(.right) { .pre-action { diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx index 36095da..c423af5 100644 --- a/src/menu/components/share/actioncomponent/formconfig.jsx +++ b/src/menu/components/share/actioncomponent/formconfig.jsx @@ -86,6 +86,8 @@ funTypes = [ { value: 'mkBinding', text: '寮�閫氭壂鐮佺櫥褰�' }, { value: 'mkUnBinding', text: '鐢ㄦ埛瑙g粦' }, + { value: 'scan', text: '鎵竴鎵�' }, + { value: 'reAuth', text: '閲嶆柊鎺堟潈' }, ] } else { opentypes = opentypes.filter(item => item.value !== 'tab') diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx index c88a996..cf22a7d 100644 --- a/src/menu/components/table/normal-table/columns/index.jsx +++ b/src/menu/components/table/normal-table/columns/index.jsx @@ -550,9 +550,9 @@ return ( <div className={`normal-table-columns ${config.setting.laypage} ${config.wrap.tableType} ${config.wrap.mode || ''}`} id={tableId}> <div className="col-control"> - <Icon title="澶嶅埗" type="copy" onClick={this.copycolumn} /> + <Icon title="澶嶅埗鏄剧ず鍒�" type="copy" onClick={this.copycolumn} /> <MarkColumn columns={fields} type="line" marks={lineMarks} onSubmit={this.updateLineMarks} /> - <Icon title="鍚屾" type="file-sync" onClick={this.syncfield} /> + <Icon title="鍚屾瀛楁闆�" type="file-sync" onClick={this.syncfield} /> </div> <DndProvider> <Table diff --git a/src/menu/components/tabs/antv-tabs/dragabletabs.jsx b/src/menu/components/tabs/antv-tabs/dragabletabs.jsx index b2d7ef7..fbb97de 100644 --- a/src/menu/components/tabs/antv-tabs/dragabletabs.jsx +++ b/src/menu/components/tabs/antv-tabs/dragabletabs.jsx @@ -90,7 +90,7 @@ render() { const { order } = this.state - const { children } = this.props + const { children, ...resProps } = this.props const tabs = [] React.Children.forEach(children, c => { tabs.push(c) @@ -118,7 +118,7 @@ return ( <DndProvider> - <Tabs renderTabBar={this.renderTabBar} {...this.props}> + <Tabs renderTabBar={this.renderTabBar} {...resProps}> {orderTabs} </Tabs> </DndProvider> diff --git a/src/menu/components/tabs/antv-tabs/index.jsx b/src/menu/components/tabs/antv-tabs/index.jsx index 7d64282..41e0b3d 100644 --- a/src/menu/components/tabs/antv-tabs/index.jsx +++ b/src/menu/components/tabs/antv-tabs/index.jsx @@ -10,14 +10,15 @@ import { resetStyle } from '@/utils/utils-custom.js' import MenuUtils from '@/utils/utils-custom.js' import Utils from '@/utils/utils.js' +import getTabForm from './options' import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' import './index.scss' const SettingComponent = asyncIconComponent(() => import('../tabsetting')) +const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteController = asyncIconComponent(() => import('@/menu/pastecontroller')) -const TabLabelComponent = asyncComponent(() => import('../tablabelform')) const TabComponents = asyncComponent(() => import('../tabcomponents')) const { TabPane } = Tabs @@ -35,7 +36,7 @@ appType: sessionStorage.getItem('appType'), tabs: null, editab: null, - labelvisible: false + defaultActiveKey: '' } UNSAFE_componentWillMount () { @@ -60,11 +61,13 @@ ] } this.setState({ + defaultActiveKey: _tabs.subtabs[0].uuid, tabs: _tabs }) this.props.updateConfig(_tabs) } else { this.setState({ + defaultActiveKey: window.GLOB.TabsMap.get(tabs.uuid) || '', tabs: fromJS(tabs).toJS() }) } @@ -187,63 +190,6 @@ this.props.updateConfig(tabs) } - tabAdd = (e) => { - const { tabs } = this.state - - e.stopPropagation() - - this.setState({ - editab: { - uuid: '', - parentId: tabs.uuid, - floor: tabs.floor, - label: '', - icon: '', - components: [] - }, - labelvisible: true - }) - } - - editTab = (tab) => { - this.setState({ - editab: tab, - labelvisible: true - }) - } - - tabLabelSubmit = () => { - let tabs = fromJS(this.state.tabs).toJS() - let editab = fromJS(this.state.editab).toJS() - - this.tabLabelRef.handleConfirm().then(res => { - editab.label = res.label - editab.icon = res.icon - editab.hasSearch = res.hasSearch || '' - editab.blacklist = res.blacklist - - if (editab.uuid) { - tabs.subtabs = tabs.subtabs.map(t => { - if (t.uuid === editab.uuid) { - return editab - } else { - return t - } - }) - } else { - editab.uuid = Utils.getuuid() - tabs.subtabs.push(editab) - } - - this.setState({ - editab: null, - labelvisible: false, - tabs - }) - this.props.updateConfig(tabs) - }) - } - delTab = (tab) => { let tabs = fromJS(this.state.tabs).toJS() const _this = this @@ -345,18 +291,76 @@ } } + getTabForms = (tab) => { + const { tabs } = this.state + + if (!tab) { + tab = { + uuid: '', + parentId: tabs.uuid, + floor: tabs.floor, + label: '', + icon: '', + components: [] + } + } + + this.setState({ + editab: tab + }) + + return getTabForm(tab, tabs.setting) + } + + updateTab = (res) => { + let tabs = fromJS(this.state.tabs).toJS() + let editab = fromJS(this.state.editab).toJS() + + editab.label = res.label + editab.icon = res.icon + editab.hasSearch = res.hasSearch || '' + editab.blacklist = res.blacklist + + if (editab.uuid) { + tabs.subtabs = tabs.subtabs.map(t => { + if (t.uuid === editab.uuid) { + return editab + } else { + return t + } + }) + } else { + editab.uuid = Utils.getuuid() + tabs.subtabs.push(editab) + } + + this.setState({ + editab: null, + tabs + }) + + this.props.updateConfig(tabs) + } + + onChange = (key) => { + const { tabs } = this.state + window.GLOB.TabsMap.set(tabs.uuid, key) + } + render() { - const { tabs, dict, labelvisible, editab, appType } = this.state + const { tabs, appType, defaultActiveKey } = this.state let _style = resetStyle(tabs.style) return ( <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}> + <DraggableTabs defaultActiveKey={defaultActiveKey} tabPosition={tabs.setting.position} type={tabs.setting.tabStyle} tabsMove={this.moveSwitch} onChange={this.onChange}> {tabs.subtabs.map(tab => ( <TabPane tab={ <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - <Icon className="edit" title="edit" type="edit" onClick={() => this.editTab(tab)} /> + <NormalForm title="鏍囩缂栬緫" width={600} update={this.updateTab} getForms={() => this.getTabForms(tab)}> + <Icon type="edit" style={{color: '#1890ff'}} title="缂栬緫"/> + </NormalForm> <PasteController type="tab" Tab={tab} insert={this.insert} /> <Icon className="close" title="delete" type="close" onClick={() => this.delTab(tab)} /> </div> @@ -372,7 +376,9 @@ </DraggableTabs> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - <Icon className="plus" title="娣诲姞鏍囩" type="plus" onClick={this.tabAdd} /> + <NormalForm title="娣诲姞鏍囩" width={600} update={this.updateTab} getForms={() => this.getTabForms()}> + <Icon type="plus" className="plus" title="娣诲姞鏍囩"/> + </NormalForm> <SettingComponent config={tabs} updateConfig={this.updateComponent} /> <CopyComponent type="tabs" card={tabs}/> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> @@ -381,25 +387,6 @@ } trigger="hover"> <Icon type="tool" /> </Popover> - <Modal - wrapClassName="popview-modal" - title={'鏍囩缂栬緫'} - visible={labelvisible} - width={600} - maskClosable={false} - okText={dict['model.submit']} - onOk={this.tabLabelSubmit} - onCancel={() => { this.setState({ labelvisible: false }) }} - destroyOnClose - > - <TabLabelComponent - dict={dict} - tab={editab} - setting={tabs.setting} - inputSubmit={this.tabLabelSubmit} - wrappedComponentRef={(inst) => this.tabLabelRef = inst} - /> - </Modal> </div> ) } diff --git a/src/menu/components/tabs/antv-tabs/options.jsx b/src/menu/components/tabs/antv-tabs/options.jsx new file mode 100644 index 0000000..c18ca35 --- /dev/null +++ b/src/menu/components/tabs/antv-tabs/options.jsx @@ -0,0 +1,63 @@ +/** + * @description Wrap琛ㄥ崟閰嶇疆淇℃伅 + */ +export default function (tab, setting) { + let appType = sessionStorage.getItem('appType') + let roleList = sessionStorage.getItem('sysRoles') + + if (roleList) { + try { + roleList = JSON.parse(roleList) + } catch { + roleList = [] + } + } else { + roleList = [] + } + + const tabForm = [ + { + type: 'text', + field: 'label', + label: '鍚嶇О', + initval: tab.label || '', + required: true, + focus: true, + span: 22 + }, + { + type: 'mkicon', + field: 'icon', + label: '鍥炬爣', + initval: tab.icon || '', + required: false, + allowClear: true, + span: 22 + }, + { + type: 'radio', + field: 'hasSearch', + label: '鎼滅储', + initval: tab.hasSearch || 'false', + required: false, + options: [ + {value: 'false', label: '鏃�'}, + {value: 'icon', label: '鏈�'}, + ], + forbid: appType !== 'mob' || setting.position !== 'top' || setting.display !== 'inline-block', + span: 22 + }, + { + type: 'multiselect', + field: 'blacklist', + label: '榛戝悕鍗�', + initval: tab.blacklist || [], + required: false, + options: roleList, + forbid: !!appType, + span: 22 + }, + ] + + return tabForm +} \ No newline at end of file diff --git a/src/menu/components/tabs/tablabelform/index.jsx b/src/menu/components/tabs/tablabelform/index.jsx deleted file mode 100644 index 335976a..0000000 --- a/src/menu/components/tabs/tablabelform/index.jsx +++ /dev/null @@ -1,135 +0,0 @@ -import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Input, Icon, Select, Radio } from 'antd' - -import './index.scss' - -class SettingForm extends Component { - static propTpyes = { - dict: PropTypes.object, - setting: PropTypes.object, - tab: PropTypes.object, - inputSubmit: PropTypes.func - } - - state = {roleList: [], appType: sessionStorage.getItem('appType')} - - UNSAFE_componentWillMount () { - let roleList = sessionStorage.getItem('sysRoles') - if (roleList) { - try { - roleList = JSON.parse(roleList) - } catch { - roleList = [] - } - } else { - roleList = [] - } - - this.setState({roleList}) - } - - handleConfirm = () => { - // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� - return new Promise((resolve, reject) => { - this.props.form.validateFieldsAndScroll((err, values) => { - if (!err) { - resolve(values) - } else { - reject(err) - } - }) - }) - } - - handleSubmit = (e) => { - e.preventDefault() - - if (this.props.inputSubmit) { - this.props.inputSubmit() - } - } - - render() { - const { tab, setting } = this.props - const { getFieldDecorator } = this.props.form - const { roleList, appType } = this.state - - const formItemLayout = { - labelCol: { - xs: { span: 24 }, - sm: { span: 8 } - }, - wrapperCol: { - xs: { span: 24 }, - sm: { span: 12 } - } - } - - return ( - <Form {...formItemLayout}> - <Row gutter={24}> - <Col span={24}> - <Form.Item label="鍚嶇О"> - {getFieldDecorator('label', { - initialValue: tab.label, - rules: [ - { - required: true, - message: this.props.dict['form.required.input'] + '鍚嶇О!' - } - ] - })(<Input placeholder={''} autoComplete="off" onPressEnter={this.handleSubmit} />)} - </Form.Item> - </Col> - <Col span={24}> - <Form.Item label="鍥炬爣"> - {getFieldDecorator('icon', { - initialValue: tab.icon || '' - })( - <Select> - <Select.Option key="empty" value=""> 鏃� </Select.Option> - <Select.Option key="android" value="android"> <Icon type="android" /> </Select.Option> - <Select.Option key="apple" value="apple"> <Icon type="apple" /> </Select.Option> - <Select.Option key="windows" value="windows"> <Icon type="windows" /> </Select.Option> - <Select.Option key="alipay" value="alipay"> <Icon type="alipay" /> </Select.Option> - </Select> - )} - </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', { - initialValue: tab.blacklist || [] - })( - <Select - showSearch - mode="multiple" - filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} - > - {roleList.map(option => - <Select.Option key={option.uuid} value={option.value}>{option.text}</Select.Option> - )} - </Select> - )} - </Form.Item> - </Col> - </Row> - </Form> - ) - } -} - -export default Form.create()(SettingForm) \ No newline at end of file diff --git a/src/menu/components/tabs/tablabelform/index.scss b/src/menu/components/tabs/tablabelform/index.scss deleted file mode 100644 index e69de29..0000000 --- a/src/menu/components/tabs/tablabelform/index.scss +++ /dev/null diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx index d3317fc..7a8e62e 100644 --- a/src/menu/datasource/verifycard/index.jsx +++ b/src/menu/datasource/verifycard/index.jsx @@ -707,8 +707,8 @@ type="fields" updatefield={this.updatefields} /> - <Icon type="copy" onClick={this.copyColumns} style={{position: 'absolute', cursor: 'pointer', zIndex: 1, top: '-35px', right: '0px', color: '#1890ff'}} /> - <EditTable actions={['edit', 'move', 'copy', 'del']} type="datasourcefield" data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> + <Icon type="copy" title="澶嶅埗瀛楁" onClick={this.copyColumns} style={{position: 'absolute', cursor: 'pointer', zIndex: 1, top: '-35px', right: '0px', color: '#1890ff'}} /> + <EditTable actions={['edit', 'move', 'copy', 'del', 'clear']} type="datasourcefield" data={columns} columns={colColumns} onChange={(columns) => this.setState({columns})}/> </TabPane> <TabPane tab={ <span> diff --git a/src/mob/components/tabs/antv-tabs/dragabletabs.jsx b/src/mob/components/tabs/antv-tabs/dragabletabs.jsx index b2d7ef7..fbb97de 100644 --- a/src/mob/components/tabs/antv-tabs/dragabletabs.jsx +++ b/src/mob/components/tabs/antv-tabs/dragabletabs.jsx @@ -90,7 +90,7 @@ render() { const { order } = this.state - const { children } = this.props + const { children, ...resProps } = this.props const tabs = [] React.Children.forEach(children, c => { tabs.push(c) @@ -118,7 +118,7 @@ return ( <DndProvider> - <Tabs renderTabBar={this.renderTabBar} {...this.props}> + <Tabs renderTabBar={this.renderTabBar} {...resProps}> {orderTabs} </Tabs> </DndProvider> diff --git a/src/mob/components/tabs/antv-tabs/index.jsx b/src/mob/components/tabs/antv-tabs/index.jsx index ee9041d..0c7d839 100644 --- a/src/mob/components/tabs/antv-tabs/index.jsx +++ b/src/mob/components/tabs/antv-tabs/index.jsx @@ -10,14 +10,16 @@ import { resetStyle } from '@/utils/utils-custom.js' import MenuUtils from '@/utils/utils-custom.js' import Utils from '@/utils/utils.js' +import getTabForm from './options' import zhCN from '@/locales/zh-CN/model.js' import enUS from '@/locales/en-US/model.js' import './index.scss' const SettingComponent = asyncIconComponent(() => import('@/menu/components/tabs/tabsetting')) +const NormalForm = asyncIconComponent(() => import('@/components/normalform')) const CopyComponent = asyncIconComponent(() => import('@/menu/components/share/copycomponent')) const PasteController = asyncIconComponent(() => import('@/menu/pastecontroller')) -const TabLabelComponent = asyncComponent(() => import('@/menu/components/tabs/tablabelform')) +// const TabLabelComponent = asyncComponent(() => import('@/menu/components/tabs/tablabelform')) const TabComponents = asyncComponent(() => import('../tabcomponents')) const { TabPane } = Tabs @@ -35,7 +37,7 @@ appType: sessionStorage.getItem('appType'), tabs: null, editab: null, - labelvisible: false + defaultActiveKey: '' } UNSAFE_componentWillMount () { @@ -65,11 +67,13 @@ } this.setState({ + defaultActiveKey: _tabs.subtabs[0].uuid, tabs: _tabs }) this.props.updateConfig(_tabs) } else { this.setState({ + defaultActiveKey: window.GLOB.TabsMap.get(tabs.uuid) || '', tabs: fromJS(tabs).toJS() }) } @@ -208,63 +212,6 @@ this.props.updateConfig(tabs) } - tabAdd = (e) => { - const { tabs } = this.state - - e.stopPropagation() - - this.setState({ - editab: { - uuid: '', - parentId: tabs.uuid, - floor: tabs.floor, - label: '', - icon: '', - components: [] - }, - labelvisible: true - }) - } - - editTab = (tab) => { - this.setState({ - editab: tab, - labelvisible: true - }) - } - - tabLabelSubmit = () => { - let tabs = fromJS(this.state.tabs).toJS() - let editab = fromJS(this.state.editab).toJS() - - this.tabLabelRef.handleConfirm().then(res => { - editab.label = res.label - editab.icon = res.icon - editab.hasSearch = res.hasSearch || '' - editab.blacklist = res.blacklist - - if (editab.uuid) { - tabs.subtabs = tabs.subtabs.map(t => { - if (t.uuid === editab.uuid) { - return editab - } else { - return t - } - }) - } else { - editab.uuid = Utils.getuuid() - tabs.subtabs.push(editab) - } - - this.setState({ - editab: null, - labelvisible: false, - tabs - }) - this.props.updateConfig(tabs) - }) - } - delTab = (tab) => { let tabs = fromJS(this.state.tabs).toJS() const _this = this @@ -359,6 +306,62 @@ MKEmitter.emit('changeSearch', card) } + getTabForms = (tab) => { + const { tabs } = this.state + + if (!tab) { + tab = { + uuid: '', + parentId: tabs.uuid, + floor: tabs.floor, + label: '', + icon: '', + components: [] + } + } + + this.setState({ + editab: tab + }) + + return getTabForm(tab, tabs.setting) + } + + updateTab = (res) => { + let tabs = fromJS(this.state.tabs).toJS() + let editab = fromJS(this.state.editab).toJS() + + editab.label = res.label + editab.icon = res.icon + editab.hasSearch = res.hasSearch || '' + editab.blacklist = res.blacklist + + if (editab.uuid) { + tabs.subtabs = tabs.subtabs.map(t => { + if (t.uuid === editab.uuid) { + return editab + } else { + return t + } + }) + } else { + editab.uuid = Utils.getuuid() + tabs.subtabs.push(editab) + } + + this.setState({ + editab: null, + tabs + }) + + this.props.updateConfig(tabs) + } + + onChange = (key) => { + const { tabs } = this.state + window.GLOB.TabsMap.set(tabs.uuid, key) + } + clickComponent = (e) => { if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') { e.stopPropagation() @@ -367,18 +370,20 @@ } render() { - const { tabs, dict, labelvisible, editab, appType } = this.state + const { tabs, appType, defaultActiveKey } = this.state let _style = resetStyle(tabs.style) let _tabStyle = resetStyle(tabs.tabStyle) return ( <div className={'mob-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}> + <DraggableTabs defaultActiveKey={defaultActiveKey} tabPosition={tabs.setting.position} type={tabs.setting.tabStyle} tabsMove={this.moveSwitch} onChange={this.onChange}> {tabs.subtabs.map(tab => ( <TabPane tab={ <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - <Icon className="edit" title="edit" type="edit" onClick={() => this.editTab(tab)} /> + <NormalForm title="鏍囩缂栬緫" width={600} update={this.updateTab} getForms={() => this.getTabForms(tab)}> + <Icon type="edit" style={{color: '#1890ff'}} title="缂栬緫"/> + </NormalForm> <PasteController type="tab" Tab={tab} insert={this.insert} /> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeTabStyle} type="font-colors" /> <Icon className="close" title="delete" type="close" onClick={() => this.delTab(tab)} /> @@ -395,7 +400,9 @@ </DraggableTabs> <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ <div className="mk-popover-control"> - <Icon className="plus" title="娣诲姞鏍囩" type="plus" onClick={this.tabAdd} /> + <NormalForm title="娣诲姞鏍囩" width={600} update={this.updateTab} getForms={() => this.getTabForms()}> + <Icon type="plus" className="plus" title="娣诲姞鏍囩"/> + </NormalForm> <SettingComponent config={tabs} updateConfig={this.updateComponent} /> <CopyComponent type="tabs" card={tabs}/> <Icon className="style" title="璋冩暣鏍峰紡" onClick={this.changeStyle} type="font-colors" /> @@ -404,25 +411,6 @@ } trigger="hover"> <Icon type="tool" /> </Popover> - <Modal - wrapClassName="popview-modal" - title={'鏍囩缂栬緫'} - visible={labelvisible} - width={600} - maskClosable={false} - okText={dict['model.submit']} - onOk={this.tabLabelSubmit} - onCancel={() => { this.setState({ labelvisible: false }) }} - destroyOnClose - > - <TabLabelComponent - dict={dict} - tab={editab} - setting={tabs.setting} - inputSubmit={this.tabLabelSubmit} - wrappedComponentRef={(inst) => this.tabLabelRef = inst} - /> - </Modal> </div> ) } diff --git a/src/mob/components/tabs/antv-tabs/options.jsx b/src/mob/components/tabs/antv-tabs/options.jsx new file mode 100644 index 0000000..c18ca35 --- /dev/null +++ b/src/mob/components/tabs/antv-tabs/options.jsx @@ -0,0 +1,63 @@ +/** + * @description Wrap琛ㄥ崟閰嶇疆淇℃伅 + */ +export default function (tab, setting) { + let appType = sessionStorage.getItem('appType') + let roleList = sessionStorage.getItem('sysRoles') + + if (roleList) { + try { + roleList = JSON.parse(roleList) + } catch { + roleList = [] + } + } else { + roleList = [] + } + + const tabForm = [ + { + type: 'text', + field: 'label', + label: '鍚嶇О', + initval: tab.label || '', + required: true, + focus: true, + span: 22 + }, + { + type: 'mkicon', + field: 'icon', + label: '鍥炬爣', + initval: tab.icon || '', + required: false, + allowClear: true, + span: 22 + }, + { + type: 'radio', + field: 'hasSearch', + label: '鎼滅储', + initval: tab.hasSearch || 'false', + required: false, + options: [ + {value: 'false', label: '鏃�'}, + {value: 'icon', label: '鏈�'}, + ], + forbid: appType !== 'mob' || setting.position !== 'top' || setting.display !== 'inline-block', + span: 22 + }, + { + type: 'multiselect', + field: 'blacklist', + label: '榛戝悕鍗�', + initval: tab.blacklist || [], + required: false, + options: roleList, + forbid: !!appType, + span: 22 + }, + ] + + return tabForm +} \ No newline at end of file diff --git a/src/templates/zshare/editTable/index.jsx b/src/templates/zshare/editTable/index.jsx index 5e1d00b..b431aca 100644 --- a/src/templates/zshare/editTable/index.jsx +++ b/src/templates/zshare/editTable/index.jsx @@ -14,6 +14,7 @@ let eTDict = sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS const EditableContext = React.createContext() +const { confirm } = Modal let dragingIndex = -1 const { Paragraph } = Typography @@ -185,12 +186,11 @@ operation = { title: (<div> {eTDict['model.operation']} - {actions.includes('copy') ? ( - <span className="copy-control"> - <Icon type="copy" onClick={() => this.copy()} /> - <Icon type="snippets" onClick={this.paste} /> - </span> - ) : null} + <span className="copy-control"> + {actions.includes('copy') ? <Icon type="copy" title="澶嶅埗" onClick={() => this.copy()} /> : null} + {actions.includes('copy') ? <Icon type="snippets" title="绮樿创" onClick={this.paste} /> : null} + {actions.includes('clear') ? <Icon type="delete" title="娓呯┖" onClick={this.clear} /> : null} + </span> </div>), dataIndex: 'operation', width: '140px', @@ -271,6 +271,21 @@ this.setState({ editingKey: '' }) } + clear = () => { + const _this = this + + confirm({ + title: '纭畾娓呯┖鍒楄〃鍚楋紵', + content: '', + onOk() { + _this.setState({ data: [], editingKey: '' }, () => { + _this.props.onChange([]) + }) + }, + onCancel() {} + }) + } + copy = (item) => { const { type } = this.props const { data } = this.state diff --git a/src/templates/zshare/editTable/index.scss b/src/templates/zshare/editTable/index.scss index 8713c7f..954f3ab 100644 --- a/src/templates/zshare/editTable/index.scss +++ b/src/templates/zshare/editTable/index.scss @@ -87,6 +87,10 @@ .anticon-snippets { color: purple; } + .anticon-delete { + margin-left: 7px; + color: #ff4d4f; + } } } diff --git a/src/templates/zshare/verifycard/billcodeform/index.jsx b/src/templates/zshare/verifycard/billcodeform/index.jsx index b8363ba..a885185 100644 --- a/src/templates/zshare/verifycard/billcodeform/index.jsx +++ b/src/templates/zshare/verifycard/billcodeform/index.jsx @@ -29,12 +29,7 @@ UNSAFE_componentWillMount() { let _modularDetail = [] - let _billFields = [{ - field: 'BID', - label: 'BID', - type: 'text', - uuid: 'BID' - }] + let _billFields = [] if (this.props.modular.length > 0) { _modularDetail = this.props.modularDetail.filter(item => item.BID === this.props.modular[0].ID) diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx index 9d16546..9346ec4 100644 --- a/src/templates/zshare/verifycard/index.jsx +++ b/src/templates/zshare/verifycard/index.jsx @@ -671,9 +671,6 @@ if (!hasBid) { // 鍞竴鎬ч獙璇佹坊鍔燘ID uniqueFields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) - } - - if (!hasBid && (card.sqlType === 'insert' || card.sqlType === 'insertOrUpdate')) { // 琛ㄥ崟涓鍔燘ID _fields.unshift({ uuid: 'BID', field: 'BID', label: 'BID', type: 'text' }) fieldArr.push('bid') _declare.push(`@bid nvarchar(50)`) diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index df22f0f..937c911 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -48,6 +48,7 @@ sessionStorage.setItem('appType', '') // 搴旂敤绫诲瀷 document.body.className = '' window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� +window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 window.GLOB.urlFields = [] // url鍙橀噺 window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 diff --git a/src/views/mobdesign/index.jsx b/src/views/mobdesign/index.jsx index cbd2393..1cb0f99 100644 --- a/src/views/mobdesign/index.jsx +++ b/src/views/mobdesign/index.jsx @@ -47,6 +47,7 @@ sessionStorage.setItem('appType', 'mob') // 搴旂敤绫诲瀷 document.body.className = '' window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� +window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 window.GLOB.CacheIndependent = new Map() window.GLOB.urlFields = [] // url鍙橀噺 window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 diff --git a/src/views/pcdesign/index.jsx b/src/views/pcdesign/index.jsx index f942e1c..bc5688a 100644 --- a/src/views/pcdesign/index.jsx +++ b/src/views/pcdesign/index.jsx @@ -47,6 +47,7 @@ sessionStorage.setItem('typename', 'pc') document.body.className = '' window.GLOB.UserComponentMap = new Map() // 缂撳瓨鐢ㄦ埛鑷畾涔夌粍浠� +window.GLOB.TabsMap = new Map() // 缂撳瓨鐢ㄦ埛鎿嶄綔鐨勬爣绛鹃〉 window.GLOB.CacheIndependent = new Map() window.GLOB.urlFields = [] // url鍙橀噺 window.GLOB.customMenu = null // 淇濆瓨鑿滃崟淇℃伅 -- Gitblit v1.8.0