| | |
| | | cell.hidden = true |
| | | } |
| | | } else if (item.notNull) { |
| | | cell.hidden = !supItem.initval |
| | | cell.hidden = !supItem.initval || JSON.stringify(supItem.initval) === '[]' |
| | | } else if (!item.values.includes(supItem.initval)) { |
| | | cell.hidden = true |
| | | } |
| | |
| | | m.hidden = true |
| | | } |
| | | } else if (cell.notNull) { |
| | | m.hidden = !val |
| | | m.hidden = !val || JSON.stringify(val) === '[]' |
| | | } else { |
| | | m.hidden = !cell.values.includes(val) |
| | | } |
| | |
| | | } else if (item.type === 'fileupload') { |
| | | content = (<MKFileUpload config={item} onChange={(val) => this.recordChange({[item.field]: val})} />) |
| | | } else if (item.type === 'cascader') { |
| | | content = (<Cascader allowClear={!!item.allowClear} options={item.options} expandTrigger="hover" placeholder="" />) |
| | | content = (<Cascader allowClear={!!item.allowClear} onChange={(val) => this.recordChange({[item.field]: val}, item)} options={item.options} expandTrigger="hover" placeholder="" />) |
| | | } else if (item.type === 'textarea') { |
| | | content = (<TextArea rows={item.rows || 2} placeholder=""/>) |
| | | } else if (item.type === 'mkicon') { |
| | |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Tabs, Popover, Modal } from 'antd' |
| | | import { PlusOutlined, CloseOutlined, EditOutlined, SearchOutlined, DeleteOutlined, FontColorsOutlined, ToolOutlined } from '@ant-design/icons' |
| | | import { PlusOutlined, CloseOutlined, EditOutlined, DeleteOutlined, FontColorsOutlined, ToolOutlined } from '@ant-design/icons' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | |
| | | |
| | | editab.label = res.label |
| | | editab.icon = res.icon |
| | | editab.hasSearch = res.hasSearch || '' |
| | | // editab.hasSearch = res.hasSearch || '' |
| | | editab.controlVal = res.controlVal || '' |
| | | editab.blacklist = res.blacklist |
| | | |
| | | if (editab.uuid) { |
| | |
| | | getTabsForms = () => { |
| | | const { tabs } = this.state |
| | | |
| | | return getTabsSetForm(tabs.setting) |
| | | return getTabsSetForm(tabs.setting, tabs.uuid) |
| | | } |
| | | |
| | | updateTabs = (res) => { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { tabs, appType, defaultActiveKey } = this.state |
| | | const { tabs, defaultActiveKey } = this.state |
| | | let _style = resetStyle(tabs.style) |
| | | |
| | | return ( |
| | |
| | | <span>{tab.icon ? <MkIcon 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' ? |
| | | <SearchOutlined className="search-icon" onDoubleClick={() => this.setSearch(tab)}/> : null} |
| | | {/* {appType === 'mob' && tabs.setting.position === 'top' && tabs.setting.display === 'inline-block' && tab.hasSearch === 'icon' ? |
| | | <SearchOutlined className="search-icon" onDoubleClick={() => this.setSearch(tab)}/> : null} */} |
| | | <TabComponents config={tab} handleList={this.updateTabComponent} deleteCard={this.deleteCard} /> |
| | | </TabPane> |
| | | ))} |
| | |
| | | import MenuUtils from '@/utils/utils-custom.js' |
| | | |
| | | /** |
| | | * @description tab表单配置信息 |
| | | */ |
| | |
| | | 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: 'radio', |
| | | field: 'hasSearch', |
| | | label: '搜索', |
| | | initval: tab.hasSearch || 'false', |
| | | type: 'text', |
| | | field: 'controlVal', |
| | | label: '隐藏标记', |
| | | initval: tab.controlVal || '', |
| | | tooltip: '当禁用字段值与隐藏标记相等时,标签页会隐藏。', |
| | | required: false, |
| | | options: [ |
| | | {value: 'false', label: '无'}, |
| | | {value: 'icon', label: '有'}, |
| | | ], |
| | | forbid: appType !== 'mob' || setting.position !== 'top' || setting.display !== 'inline-block', |
| | | forbid: appType === 'mob', |
| | | span: 22 |
| | | }, |
| | | { |
| | |
| | | /** |
| | | * @description tabs表单配置信息 |
| | | */ |
| | | export function getTabsSetForm(setting) { |
| | | export function getTabsSetForm(setting, uuid) { |
| | | let appType = sessionStorage.getItem('appType') |
| | | let roleList = sessionStorage.getItem('sysRoles') |
| | | |
| | | let modules = MenuUtils.getSupModules(window.GLOB.customMenu.components, uuid) || [] |
| | | |
| | | if (roleList) { |
| | | try { |
| | |
| | | ] |
| | | }, |
| | | { |
| | | type: 'cascader', |
| | | field: 'supModule', |
| | | label: '上级组件', |
| | | initval: setting.supModule || [], |
| | | tooltip: '标签组可以选择上级组件,填入禁用字段,用于控制标签隐藏。', |
| | | required: false, |
| | | allowClear: true, |
| | | options: modules, |
| | | controlFields: [ |
| | | {field: 'controlField', notNull: true}, |
| | | ], |
| | | forbid: appType === 'mob', |
| | | }, |
| | | { |
| | | type: 'text', |
| | | field: 'controlField', |
| | | label: '禁用字段', |
| | | initval: setting.controlField || '', |
| | | tooltip: '用于控制标签隐藏的字段,在标签中填入隐藏标记。', |
| | | required: true, |
| | | forbid: appType === 'mob', |
| | | }, |
| | | { |
| | | type: 'multiselect', |
| | | field: 'blacklist', |
| | | label: '黑名单', |
| | |
| | | _selectKeys = selectKeys.filter(key => key !== index) |
| | | _selectedData = selectedData.filter(cell => cell.key !== index) |
| | | _activeKey = _selectKeys.slice(-1)[0] |
| | | _item = selectedData.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] || '' |
| | | _item = _selectedData.filter(cell => cell.key === activeKey)[0] || '' |
| | | } else { |
| | | _selectKeys = [...selectKeys, index] |
| | | _selectedData = [...selectedData, item] |
| | |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | const { config, bids } = this.props |
| | | |
| | | this.setState({ |
| | | tabs: config, |
| | | tabs: fromJS(config).toJS(), |
| | | parentIds: config.parentIds || [], |
| | | bids: bids ? bids : {} |
| | | }) |
| | |
| | | } |
| | | |
| | | resetParentParam = (MenuID, id, data) => { |
| | | const { parentIds, bids } = this.state |
| | | const { parentIds, bids, tabs } = this.state |
| | | |
| | | if (!parentIds.includes(MenuID)) return |
| | | if (parentIds.includes(MenuID)) { |
| | | this.setState({ |
| | | bids: {...bids, [MenuID]: id, [MenuID + '_data']: data} |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | bids: {...bids, [MenuID]: id, [MenuID + '_data']: data} |
| | | }) |
| | | if (tabs.setting.supModule === MenuID) { |
| | | if (!data || data[tabs.setting.controlField] === undefined) { |
| | | this.setState({ |
| | | tabs: {...tabs, subtabs: this.props.config.subtabs} |
| | | }) |
| | | } else { |
| | | let val = data[tabs.setting.controlField] |
| | | this.setState({ |
| | | tabs: {...tabs, subtabs: this.props.config.subtabs.filter(tab => { |
| | | if (tab.controlVal === val) { |
| | | return false |
| | | } else if (/,/ig.test(tab.controlVal)) { |
| | | return tab.controlVal.split(',').includes(val) |
| | | } |
| | | return true |
| | | })} |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | |
| | | autoSwitch = (interval) => { |