From b5c96c82c04f57d1d0e1e04d96e99e6d7829881f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 14 十月 2021 10:59:30 +0800 Subject: [PATCH] 2021-10-14 --- src/menu/components/card/cardcomponent/menus-wrap/menus/columnform/index.jsx | 67 ++++++++++++++++++++++++++------- 1 files changed, 52 insertions(+), 15 deletions(-) diff --git a/src/menu/components/card/cardcomponent/menus-wrap/menus/columnform/index.jsx b/src/menu/components/card/cardcomponent/menus-wrap/menus/columnform/index.jsx index 0637540..f86037a 100644 --- a/src/menu/components/card/cardcomponent/menus-wrap/menus/columnform/index.jsx +++ b/src/menu/components/card/cardcomponent/menus-wrap/menus/columnform/index.jsx @@ -1,24 +1,67 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Button, Input, Select, Cascader } from 'antd' +import { Form, Row, Col, Button, Input, Select, Cascader, notification } from 'antd' import './index.scss' -class ExcelOutColumn extends Component { +class MenusColumn extends Component { static propTpyes = { + menus: PropTypes.array, appType: PropTypes.string, menulist: PropTypes.array, - columnChange: PropTypes.func // 淇敼鍑芥暟 + columnChange: PropTypes.func } handleConfirm = () => { + const { appType, menus, menulist } = this.props // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭� this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { + if (menus.filter(item => item.sign === values.sign).length > 0) { + notification.warning({ + top: 92, + message: '鏍囪瘑宸插瓨鍦紒', + duration: 2 + }) + return + } + + if (!appType) { + let fId = values.menu[0] || '' + let sId = values.menu[1] || '' + let tId = values.menu[2] || '' + let label = '' + + menulist.forEach(f => { + if (!fId || fId !== f.value) return + label = f.label + + f.children.forEach(s => { + if (!sId || sId !== s.value) return + label += ' / ' + s.label + + s.children.forEach(t => { + if (!tId || tId !== t.value) return + label += ' / ' + t.label + + values.MenuID = t.MenuID + values.MenuName = t.MenuName + values.MenuNo = t.MenuNo + values.tabType = t.type + values.label = label + }) + }) + }) + } else { + menulist.forEach(f => { + if (values.menu !== f.value) return + values.label = f.label + }) + } + this.props.columnChange(values) this.props.form.setFieldsValue({ - Column: '', - Text: '', - Width: 20 + sign: '', + menu: appType ? '' : [] }) } }) @@ -43,14 +86,8 @@ <Row gutter={24}> <Col span={10}> <Form.Item label="鏍囪瘑"> - {getFieldDecorator('name', { - initialValue: '', - rules: [ - { - required: true, - message: '璇疯緭鍏ユ爣璇�!' - } - ] + {getFieldDecorator('sign', { + initialValue: '' })(<Input placeholder="" autoComplete="off" />)} </Form.Item> </Col> @@ -80,4 +117,4 @@ } } -export default Form.create()(ExcelOutColumn) \ No newline at end of file +export default Form.create()(MenusColumn) \ No newline at end of file -- Gitblit v1.8.0