From a8e94242166881639cecf3809e45ca527233ebd7 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 23 三月 2021 16:42:20 +0800 Subject: [PATCH] 2021-03-23 --- src/menu/datasource/verifycard/settingform/index.jsx | 66 ++++----------------------------- 1 files changed, 8 insertions(+), 58 deletions(-) diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx index 3a761bb..ae179b2 100644 --- a/src/menu/datasource/verifycard/settingform/index.jsx +++ b/src/menu/datasource/verifycard/settingform/index.jsx @@ -4,6 +4,7 @@ import { formRule } from '@/utils/option.js' import Utils from '@/utils/utils.js' +import MenuUtils from '@/utils/utils-custom.js' import CodeMirror from '@/templates/zshare/codemirror' import './index.scss' @@ -13,7 +14,7 @@ menu: PropTypes.any, // 鑿滃崟閰嶇疆淇℃伅 config: PropTypes.object, // 缁勪欢閰嶇疆 setting: PropTypes.object, // 鏁版嵁婧愰厤缃� - modules: PropTypes.array, // 鍒楄缃� + modules: PropTypes.array, // 鍙粦瀹氱殑涓婄骇缁勪欢 columns: PropTypes.array, // 鍒楄缃� scripts: PropTypes.array, // 鑷畾涔夎剼鏈� } @@ -30,7 +31,7 @@ UNSAFE_componentWillMount () { const { menu, config } = this.props - let modules = this.getModules(menu.components, config.uuid) + let modules = MenuUtils.getSupModules(menu.components, config.uuid) if (!modules) { modules = [] } @@ -52,57 +53,6 @@ } this.setState({modules, usefulFields}) - } - - getModules = (components, selfId) => { - let modules = components.map(item => { - if (item.uuid === selfId) { - return { - children: null - } - } else if (item.switchable) { - return { - value: item.uuid, - label: item.name - } - } else if (item.type === 'tabs') { - let _item = { - value: item.uuid, - label: item.name, - children: item.subtabs.map(f_tab => { - let subItem = { - value: f_tab.uuid, - label: f_tab.label, - children: this.getModules(f_tab.components, selfId) - } - - if (!subItem.children || subItem.children.length === 0) { - return {children: null} - } - return subItem - }) - } - - _item.children = _item.children.filter(t => t.children !== null) - - if (_item.children.length === 0) { - return {children: null} - } - - return _item - } else { - return { - children: null - } - } - }) - - modules = modules.filter(mod => mod.children !== null) - - if (modules.length === 0) { - return null - } - return modules } handleConfirm = () => { @@ -365,7 +315,7 @@ {config.format === 'array' ? <Col span={8}> <Form.Item label="榛樿鎺掑簭"> {getFieldDecorator('order', { - initialValue: setting.order || '', + initialValue: setting.order || 'ID asc', rules: [ { required: true, @@ -390,7 +340,7 @@ <Form.Item label={ <Tooltip placement="topLeft" title={'璇ョ粍浠跺鏋滃彈鍏朵粬缁勪欢鎺у埗锛岃閫夐」鐩稿簲鐨勭粍浠讹紝娌℃湁鏃堕�夆�滄棤鈥濄��'}> <Icon type="question-circle" /> - 涓婄骇妯″潡 + 涓婄骇缁勪欢 </Tooltip> }> {getFieldDecorator('supModule', { @@ -398,7 +348,7 @@ rules: [ { required: true, - message: this.props.dict['form.required.select'] + '涓婄骇妯″潡!' + message: this.props.dict['form.required.select'] + '涓婄骇缁勪欢!' } ] })( @@ -458,11 +408,11 @@ <Form.Item label={ <Tooltip placement="topLeft" title={'浼樺厛浣跨敤鍚岀骇鐨勬悳绱㈡潯浠剁粍浠讹紝鍚岀骇鎼滅储涓嶅瓨鍦ㄦ椂锛屼緷娆″悜涓婇�夊彇锛屼笌褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵竴鍚岀敤浣滄暟鎹繃婊わ紙褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵紭鍏堬級銆�'}> <Icon type="question-circle" /> - 澶栧眰鎼滅储 + 澶栭儴鎼滅储 </Tooltip> }> {getFieldDecorator('useMSearch', { - initialValue: setting.useMSearch || 'false' + initialValue: setting.useMSearch || 'true' })( <Radio.Group onChange={(e) => this.setState({useMSearch: e.target.value})}> <Radio value="true">浣跨敤</Radio> -- Gitblit v1.8.0