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 +++++++++++++--- src/menu/components/card/cardcomponent/menus-wrap/menus/index.jsx | 71 ++++++++++++++--- src/tabviews/custom/components/card/cardItem/index.jsx | 37 +++++++++ src/menu/components/card/cardcomponent/menus-wrap/menus/index.scss | 6 4 files changed, 148 insertions(+), 33 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 diff --git a/src/menu/components/card/cardcomponent/menus-wrap/menus/index.jsx b/src/menu/components/card/cardcomponent/menus-wrap/menus/index.jsx index 98f4c98..a324cb9 100644 --- a/src/menu/components/card/cardcomponent/menus-wrap/menus/index.jsx +++ b/src/menu/components/card/cardcomponent/menus-wrap/menus/index.jsx @@ -1,7 +1,8 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { fromJS } from 'immutable' +import { is, fromJS } from 'immutable' +import Utils from '@/utils/utils.js' import ColumnForm from './columnform' import asyncComponent from '@/utils/asyncComponent' import './index.scss' @@ -20,10 +21,11 @@ columns: [ { title: '鏍囪瘑', - dataIndex: 'name', + dataIndex: 'sign', inputType: 'input', editable: true, unique: true, + required: false, width: '30%' }, { @@ -33,13 +35,7 @@ editable: true, required: true, width: '40%', - render: (text) => { - if (text === 'image') { - return '鍥剧墖' - } else { - return '鏂囨湰' - } - }, + render: (text, record) => record.label, options: this.props.menulist } ] @@ -55,14 +51,62 @@ columnChange = (values) => { const { menus } = this.state + values.uuid = Utils.getuuid() + let _menus = [...menus, values] - this.setState({menus: [...menus, values]}) + this.setState({menus: _menus}) + this.props.update(_menus) } changeColumns = (columns) => { - // const { menus } = this.state + const { appType, menulist } = this.props + const { menus } = this.state + let m = {} + menus.forEach(item => { + m[item.uuid] = item + }) + + columns = columns.map(col => { + let ori = m[col.uuid] + if (ori && is(fromJS({...col, $index: 1}), fromJS({...ori, $index: 1}))) return col + if (!appType) { + let fId = col.menu[0] || '' + let sId = col.menu[1] || '' + let tId = col.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 + + col.MenuID = t.MenuID + col.MenuName = t.MenuName + col.MenuNo = t.MenuNo + col.tabType = t.type + col.label = label + }) + }) + }) + } else { + menulist.forEach(f => { + if (col.menu !== f.value) return + col.label = f.label + }) + } + return col + }) + this.setState({menus: columns}) + this.props.update(columns) } render() { @@ -71,9 +115,8 @@ return ( <div className="menus-box-wrap"> - <ColumnForm appType={appType} menulist={menulist} columnChange={this.columnChange}/> - {/* <div style={{color: '#959595', fontSize: '13px', paddingLeft: '10px'}}>濡傞渶瀵煎嚭搴忓彿锛岃浣跨敤瀛楁 $Index銆�</div> */} - <EditTable actions={['edit', 'move', 'del']} type="excelcolumn" data={menus} columns={columns} onChange={this.changeColumns}/> + <ColumnForm appType={appType} menus={menus} menulist={menulist} columnChange={this.columnChange}/> + <EditTable actions={['edit', 'move', 'copy', 'del']} type={appType + 'cardmenus'} data={menus} columns={columns} onChange={this.changeColumns}/> </div> ) } diff --git a/src/menu/components/card/cardcomponent/menus-wrap/menus/index.scss b/src/menu/components/card/cardcomponent/menus-wrap/menus/index.scss index dc5f201..c0421a0 100644 --- a/src/menu/components/card/cardcomponent/menus-wrap/menus/index.scss +++ b/src/menu/components/card/cardcomponent/menus-wrap/menus/index.scss @@ -1,3 +1,3 @@ -// .menus-box-wrap { - -// } \ No newline at end of file +.menus-box-wrap { + min-height: 250px; +} \ No newline at end of file diff --git a/src/tabviews/custom/components/card/cardItem/index.jsx b/src/tabviews/custom/components/card/cardItem/index.jsx index 5bb0f09..d67ca6a 100644 --- a/src/tabviews/custom/components/card/cardItem/index.jsx +++ b/src/tabviews/custom/components/card/cardItem/index.jsx @@ -44,7 +44,42 @@ openView = () => { const { card, data, cards } = this.props - if (card.setting.click === 'menu') { + if (card.setting.click === 'menus' && cards.subtype === 'datacard' && card.$cardType !== 'extendCard') { + let menu = null + + if (card.menus && card.menus.length > 0) { + let s = data[card.setting.menuType] || '' + card.menus.forEach(m => { + if (s !== m.sign) return + menu = m + }) + } + if (!menu || !menu.MenuID) { + notification.warning({ + top: 92, + message: '鏈煡璇㈠埌鑿滃崟淇℃伅锛�', + duration: 5 + }) + return + } + + menu.type = menu.tabType + + let newtab = { + ...menu, + param: {} + } + + if (card.setting.joint === 'true') { + newtab.param.$BID = data.$$uuid || '' + } + + if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { + MKEmitter.emit('modifyTabs', newtab, 'replace') + } else { + MKEmitter.emit('modifyTabs', newtab, 'plus', true) + } + } else if (card.setting.click === 'menu') { let menu = null if (card.setting.MenuID) { -- Gitblit v1.8.0