From 29432c9167e3fcdf83f35d0bb9dbe9acb7c7ffbf Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 22 六月 2021 14:35:23 +0800 Subject: [PATCH] 2021-06-22 --- src/views/appmanage/submutilform/index.jsx | 69 ++++++++++++++++++++++++++++++++-- 1 files changed, 64 insertions(+), 5 deletions(-) diff --git a/src/views/appmanage/submutilform/index.jsx b/src/views/appmanage/submutilform/index.jsx index b069b3e..571b23a 100644 --- a/src/views/appmanage/submutilform/index.jsx +++ b/src/views/appmanage/submutilform/index.jsx @@ -1,6 +1,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' -import { Form, Row, Col, Select, Radio, Input } from 'antd' +import { Form, Row, Col, Select, Radio, Input, Tooltip, Icon, notification } from 'antd' import asyncComponent from '@/utils/asyncComponent' import './index.scss' @@ -14,7 +14,21 @@ inputSubmit: PropTypes.func // input鍥炶溅鎻愪氦 } - state = {} + state = {msgs: [], typename: 'mob', user_binding: []} + + UNSAFE_componentWillMount() { + const { card } = this.props + let msgs = sessionStorage.getItem('msgTemplate') + let user_binding = [] + let typename = 'mob' + + if (card) { + typename = card.typename || 'mob' + user_binding = card.user_binding ? card.user_binding.split(',') : [] + } + + this.setState({msgs: JSON.parse(msgs), typename, user_binding}) + } /** * @description 鑾峰彇琛ㄥ崟鍊� @@ -23,6 +37,15 @@ return new Promise(resolve => { this.props.form.validateFieldsAndScroll((err, values) => { if (!err) { + values.user_binding = values.user_binding ? values.user_binding.join(',') : '' + if (values.user_binding.indexOf('sms_vcode') > -1 && !values.sms_id) { + notification.warning({ + top: 92, + message: '鎵嬫満鍙风粦瀹氭椂锛岄渶瑕佺煭淇℃ā鏉匡紒', + duration: 5 + }) + return + } resolve(values) } }) @@ -40,6 +63,7 @@ render() { const { card, type } = this.props const { getFieldDecorator } = this.props.form + const { msgs, typename, user_binding } = this.state const formItemLayout = { labelCol: { xs: { span: 24 }, @@ -58,14 +82,14 @@ } return ( - <Form {...formItemLayout} className="mob-card-edit-form"> + <Form {...formItemLayout} className="sub-app-edit-form"> <Row gutter={24}> <Col span={12}> <Form.Item label="搴旂敤绫诲瀷"> {getFieldDecorator('typename', { - initialValue: card ? card.typename : 'mob' + initialValue: typename })( - <Select disabled={type === 'edit'}> + <Select disabled={type === 'edit'} onChange={(val) => this.setState({typename: val})}> <Select.Option value="mob">绉诲姩绔�(鍖呮嫭android銆乮os)</Select.Option> <Select.Option value="pad">Pad绔�</Select.Option> <Select.Option value="pc">PC绔�</Select.Option> @@ -109,6 +133,41 @@ )} </Form.Item> </Col> + {typename !== 'pc' ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="浣跨敤寰俊鎺堟潈鐧诲綍鏃讹紝鏄惁闇�瑕佺粦瀹氱敤鎴枫��"> + <Icon type="question-circle" /> + 鐢ㄦ埛缁戝畾 + </Tooltip> + }> + {getFieldDecorator('user_binding', { + initialValue: user_binding + })( + <Select mode="multiple"> + <Select.Option value="uname_pwd">鐢ㄦ埛鍚�</Select.Option> + <Select.Option value="sms_vcode">鎵嬫満鍙�</Select.Option> + </Select> + )} + </Form.Item> + </Col> : null} + {typename !== 'pc' ? <Col span={12}> + <Form.Item label={ + <Tooltip placement="topLeft" title="鐭俊妯℃澘鍙湪绠$悊绯荤粺 HS-濂囦簯鐭俊妯℃澘 澶勬坊鍔犮��"> + <Icon type="question-circle" /> + 鐭俊妯℃澘 + </Tooltip> + }> + {getFieldDecorator('sms_id', { + initialValue: card ? card.sms_id || '' : '' + })( + <Select allowClear> + {msgs.map(option => + <Select.Option key={option.ID} value={option.ID}>{option.SignName + ' - ' + option.TemplateCode}</Select.Option> + )} + </Select> + )} + </Form.Item> + </Col> : null} <Col span={12}> <Form.Item label="鐨偆"> {getFieldDecorator('css', { -- Gitblit v1.8.0