From e8edfdadb561cd83bf6e1c3e00d55b8cc2aee6d5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 17 十月 2022 17:57:34 +0800 Subject: [PATCH] 2022-10-17 --- src/pc/createview/settingform/index.jsx | 73 ++++++++++++++++++++++++++++++------ 1 files changed, 61 insertions(+), 12 deletions(-) diff --git a/src/pc/createview/settingform/index.jsx b/src/pc/createview/settingform/index.jsx index f0be993..0405709 100644 --- a/src/pc/createview/settingform/index.jsx +++ b/src/pc/createview/settingform/index.jsx @@ -1,16 +1,13 @@ import React, {Component} from 'react' -import PropTypes from 'prop-types' -import { Form, Row, Col, Select, Input } from 'antd' +import { Form, Row, Col, Select, Input, Tooltip, Radio } from 'antd' +import { QuestionCircleOutlined } from '@ant-design/icons' import './index.scss' class SettingForm extends Component { - static propTpyes = { - dict: PropTypes.object, // 瀛楀吀椤� - } - state = { - appMenus: [] + appMenus: [], + copymenuId: '' } UNSAFE_componentWillMount () { @@ -18,6 +15,14 @@ if (appMenus) { try { appMenus = JSON.parse(appMenus) + appMenus = appMenus.map(item => { + item.name = item.MenuName + if (item.MenuNo && item.MenuNo !== item.MenuName) { + item.name = item.MenuName + `锛�${item.MenuNo}锛塦 + } + + return item + }) } catch (e) { appMenus = [] } @@ -43,7 +48,7 @@ render() { const { getFieldDecorator } = this.props.form - const { appMenus } = this.state + const { appMenus, copymenuId } = this.state const formItemLayout = { labelCol: { @@ -66,7 +71,7 @@ rules: [ { required: true, - message: this.props.dict['form.required.input'] + '鑿滃崟鍚嶇О!' + message: '璇疯緭鍏ヨ彍鍗曞悕绉�!' } ] })(<Input placeholder="" autoComplete="off" />)} @@ -79,9 +84,31 @@ rules: [ { required: true, - message: this.props.dict['form.required.input'] + '鑿滃崟鍙傛暟!' + message: '璇疯緭鍏ヨ彍鍗曞弬鏁�!' } ] + })(<Input placeholder="" autoComplete="off" />)} + </Form.Item> + </Col> + <Col span={20}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鑷畾涔夎彍鍗旾D鍊笺��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 鑿滃崟ID + </Tooltip> + }> + {getFieldDecorator('MenuId', { + initialValue: '', + rules: [{ + pattern: /^[0-9a-zA-Z]*$/ig, + message: '鑿滃崟ID鍙厑璁稿寘鍚暟瀛楁垨瀛楁瘝锛堝ぇ灏忓啓锛�' + }, { + min: 20, + message: '鑿滃崟ID鏈�鐭负20涓瓧绗�' + }, { + max: 40, + message: '鑿滃崟ID鏈�闀夸负40涓瓧绗�' + }] })(<Input placeholder="" autoComplete="off" />)} </Form.Item> </Col> @@ -90,14 +117,36 @@ {getFieldDecorator('copymenuId', { initialValue: '' })( - <Select allowClear showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}> + <Select + allowClear + showSearch + onChange={(val) => this.setState({copymenuId: val})} + filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} + > {appMenus.map(option => - <Select.Option key={option.MenuID} value={option.MenuID}>{option.MenuName}</Select.Option> + <Select.Option key={option.MenuID} value={option.MenuID}>{option.name}</Select.Option> )} </Select> )} </Form.Item> </Col> + {copymenuId ? <Col span={20}> + <Form.Item label={ + <Tooltip placement="topLeft" title="澶嶅埗鑿滃崟鏃讹紝鏄惁娓呯┖鍘熼〉闈腑鐨勫叧鑱旇彍鍗曘��"> + <QuestionCircleOutlined className="mk-form-tip" /> + 娓呯┖鍏宠仈鑿滃崟 + </Tooltip> + }> + {getFieldDecorator('clearMenu', { + initialValue: 'true' + })( + <Radio.Group> + <Radio value={'true'}>鏄�</Radio> + <Radio value={'false'}>鍚�</Radio> + </Radio.Group> + )} + </Form.Item> + </Col> : null} </Row> </Form> ) -- Gitblit v1.8.0