| | |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | } |
| | | // 设置模态框样式,规定最大最小高度,重置滚动条 |
| | | .action-modal { |
| | | .ant-modal { |
| | | max-width: 95vw; |
| | | top: 70px; |
| | | } |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 205px); |
| | | min-height: 150px; |
| | | overflow-y: auto; |
| | | padding-bottom: 35px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar { |
| | | width: 7px; |
| | | height: 7px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | } |
| | | |
| | | .ant-drawer { |
| | | z-index: 1080!important; |
| | |
| | | import BraftEditor from 'braft-editor' |
| | | import 'braft-editor/dist/index.css' |
| | | import 'braft-extensions/dist/table.css' |
| | | import 'braft-editor/dist/output.css' |
| | | // import 'braft-editor/dist/output.css' |
| | | import Table from 'braft-extensions/dist/table' |
| | | import SparkMD5 from 'spark-md5' |
| | | import moment from 'moment' |
| | |
| | | |
| | | class NormalEditor extends Component { |
| | | static propTpyes = { |
| | | card: PropTypes.object, // 条码设置 |
| | | value: PropTypes.any, // 条码值 |
| | | Item: PropTypes.object, // 表单元素 |
| | | onChange: PropTypes.func, // 表单更新 |
| | | } |
| | | |
| | | state = { |
| | | editorState: '' |
| | | editorState: '', |
| | | encryption: 'false', |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let initVal = null |
| | | let encryption = 'false' |
| | | |
| | | if (this.props['data-__meta']) { |
| | | initVal = this.props['data-__meta'].initialValue || null |
| | | } |
| | | |
| | | this.setState({editorState: BraftEditor.createEditorState(initVal)}) |
| | | if (this.props.Item && this.props.Item.encryption === 'true') { |
| | | encryption = 'true' |
| | | if (initVal) { |
| | | try { |
| | | initVal = window.decodeURIComponent(window.atob(initVal)) |
| | | } catch { |
| | | initVal = this.props['data-__meta'].initialValue || null |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | editorState: BraftEditor.createEditorState(initVal), |
| | | encryption |
| | | }) |
| | | } |
| | | shouldComponentUpdate (nextProps, nextState) { |
| | | return !is(fromJS(this.props), fromJS(nextProps)) |
| | | } |
| | | |
| | | handleEditorChange = (editorState) => { |
| | | const { encryption } = this.state |
| | | |
| | | this.setState({ editorState }) |
| | | if (this.props.onChange) { |
| | | this.props.onChange(editorState.toHTML()) |
| | | let val = editorState.toHTML() |
| | | if (encryption === 'true') { |
| | | try { |
| | | val = window.btoa(window.encodeURIComponent(val)) |
| | | } catch { |
| | | val = editorState.toHTML() |
| | | } |
| | | } |
| | | this.props.onChange(val) |
| | | } |
| | | } |
| | | |
| | |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | .mk-braft-delete { |
| | | font-size: 16px; |
| | | } |
| | | } |
| | |
| | | top: calc(50vh - 70px); |
| | | } |
| | | } |
| | | // 设置模态框样式,规定最大最小高度,重置滚动条 |
| | | .action-modal { |
| | | .ant-modal { |
| | | max-width: 95vw; |
| | | } |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 235px); |
| | | min-height: 150px; |
| | | overflow-y: auto; |
| | | padding-bottom: 35px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar { |
| | | width: 7px; |
| | | height: 7px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | } |
| | |
| | | top: calc(50vh - 70px); |
| | | } |
| | | } |
| | | // 设置模态框样式,规定最大最小高度,重置滚动条 |
| | | .action-modal { |
| | | .ant-modal { |
| | | max-width: 95vw; |
| | | } |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 235px); |
| | | min-height: 150px; |
| | | overflow-y: auto; |
| | | padding-bottom: 35px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar { |
| | | width: 7px; |
| | | height: 7px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | } |
| | |
| | | display: none; |
| | | } |
| | | } |
| | | // 设置模态框样式,规定最大最小高度,重置滚动条 |
| | | .action-modal { |
| | | .ant-modal { |
| | | max-width: 95vw; |
| | | top: 70px; |
| | | } |
| | | .ant-modal-body { |
| | | max-height: calc(100vh - 235px); |
| | | min-height: 150px; |
| | | overflow-y: auto; |
| | | padding-bottom: 35px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar { |
| | | width: 7px; |
| | | height: 7px; |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-thumb { |
| | | border-radius: 5px; |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13); |
| | | background: rgba(0, 0, 0, 0.13); |
| | | } |
| | | .ant-modal-body::-webkit-scrollbar-track { |
| | | box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05); |
| | | border-radius: 3px; |
| | | border: 1px solid rgba(0, 0, 0, 0.07); |
| | | background: rgba(0, 0, 0, 0); |
| | | } |
| | | } |
New file |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { Input } from 'antd' |
| | | |
| | | import './index.scss' |
| | | |
| | | const { TextArea } = Input |
| | | |
| | | class CustomTextArea extends Component { |
| | | static propTpyes = { |
| | | Item: PropTypes.bool, // 表单 |
| | | onChange: PropTypes.func // 数据切换 |
| | | } |
| | | |
| | | state = { |
| | | value: '', |
| | | encryption: 'false' |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | let value = '' |
| | | let encryption = 'false' |
| | | |
| | | if (this.props['data-__meta']) { |
| | | value = this.props['data-__meta'].initialValue || '' |
| | | } |
| | | |
| | | if (this.props.Item && this.props.Item.encryption === 'true') { |
| | | encryption = 'true' |
| | | if (value) { |
| | | try { |
| | | value = window.decodeURIComponent(window.atob(value)) |
| | | } catch { |
| | | value = this.props['data-__meta'].initialValue || '' |
| | | } |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | | value, |
| | | encryption |
| | | }) |
| | | } |
| | | |
| | | onChange = (e) => { |
| | | const { encryption } = this.state |
| | | let val = e.target.value |
| | | |
| | | this.setState({ value: val }) |
| | | |
| | | let _val = val |
| | | if (encryption === 'true') { |
| | | try { |
| | | _val = window.btoa(window.encodeURIComponent(_val)) |
| | | } catch { |
| | | _val = val |
| | | } |
| | | } |
| | | this.props.onChange(_val) |
| | | } |
| | | |
| | | render() { |
| | | const { Item } = this.props |
| | | const { value } = this.state |
| | | |
| | | return ( |
| | | <TextArea value={value} autoSize={{ minRows: 2, maxRows: Item.maxRows || 6 }} onChange={this.onChange} disabled={Item.readonly === 'true'} /> |
| | | ) |
| | | } |
| | | } |
| | | |
| | | export default CustomTextArea |
| | |
| | | import './index.scss' |
| | | |
| | | const { MonthPicker } = DatePicker |
| | | const { TextArea } = Input |
| | | |
| | | const CheckCard = asyncComponent(() => import('./checkCard')) |
| | | const CustomSwitch = asyncComponent(() => import('./customSwitch')) |
| | | const CustomTextArea = asyncComponent(() => import('./customTextArea')) |
| | | const FileUpload = asyncComponent(() => import('../fileupload')) |
| | | const ColorSketch = asyncComponent(() => import('@/mob/colorsketch')) |
| | | const Editor = asyncComponent(() => import('@/components/editor')) |
| | |
| | | writein: null, // 执行时是否填入默认sql |
| | | fieldlen: null, // 字段长度 |
| | | formlist: [], // 表单项 |
| | | encrypts: [], // 加密字段 |
| | | intercepts: [], // 截取字段 |
| | | record: {} // 记录下拉表单关联字段,用于数据写入 |
| | | } |
| | |
| | | let writein = {} |
| | | let fieldlen = {} |
| | | let formlist = [] |
| | | let encrypts = [] |
| | | let intercepts = [] |
| | | let _inputfields = [] |
| | | |
| | |
| | | _inputfields.push(item.field) |
| | | } else if (item.type === 'textarea') { |
| | | _inputfields.push(item.field) |
| | | if (item.encryption === 'true') { // 加密字段 |
| | | encrypts.push(item.field) |
| | | } |
| | | } else if (item.type === 'link') { |
| | | linkFields[item.linkField] = linkFields[item.linkField] || [] |
| | | linkFields[item.linkField].push(item.field) |
| | |
| | | } |
| | | } |
| | | |
| | | // 加密字段,解密处理 |
| | | if (item.type === 'textarea' && item.encryption === 'true' && newval !== '') { |
| | | try { |
| | | newval = window.decodeURIComponent(window.atob(newval)) |
| | | } catch (e) { |
| | | console.warn(e) |
| | | } |
| | | } else if (item.type === 'switch' && newval !== '') { // 开关只接收固定值 |
| | | if (item.type === 'switch' && newval !== '') { // 开关只接收固定值 |
| | | if (newval !== item.closeVal && newval !== item.openVal) { |
| | | newval = '' |
| | | } else if (newval === item.openVal) { |
| | |
| | | }) |
| | | |
| | | this.setState({ |
| | | readtype: readtype, |
| | | datatype: datatype, |
| | | readin: readin, |
| | | writein: writein, |
| | | fieldlen: fieldlen, |
| | | encrypts: encrypts, |
| | | intercepts: intercepts, |
| | | formlist: formlist |
| | | readin, |
| | | writein, |
| | | readtype, |
| | | datatype, |
| | | fieldlen, |
| | | intercepts, |
| | | formlist |
| | | }, () => { |
| | | if (action.setting && action.setting.focus) { |
| | | this.selectInput(action.setting.focus, 'init') |
| | |
| | | }, |
| | | ..._rules |
| | | ] |
| | | })(<TextArea autoSize={{ minRows: 2, maxRows: item.maxRows || 6 }} disabled={item.readonly === 'true'} />)} |
| | | })(<CustomTextArea Item={item} />)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | </Tooltip> : item.label |
| | | }> |
| | | {getFieldDecorator(item.field, { |
| | | initialValue: item.initval || null, |
| | | initialValue: item.initval || '', |
| | | rules: [ |
| | | { |
| | | required: item.required === 'true', |
| | |
| | | message: formRule.input.formMessage.replace('@max', _max) |
| | | } |
| | | ] |
| | | })(<Editor />)} |
| | | })(<Editor Item={item}/>)} |
| | | </Form.Item> |
| | | </Col> |
| | | ) |
| | |
| | | |
| | | handleConfirm = () => { |
| | | const { record, intercepts, writein } = this.state |
| | | let _encrypts = fromJS(this.state.encrypts).toJS() |
| | | let _format = { |
| | | date: 'YYYY-MM-DD', |
| | | datemonth: 'YYYY-MM', |
| | |
| | | let _val = item.initval |
| | | if (record.hasOwnProperty(item.field)) { |
| | | _val = record[item.field] |
| | | _encrypts = _encrypts.filter(_field => _field !== item.field) // 隐藏字段,不参与加密处理 |
| | | } |
| | | |
| | | _item = { |
| | |
| | | value: _value |
| | | }) |
| | | }) |
| | | |
| | | // 含有加密字段时,对表单值进行加密 |
| | | if (_encrypts && _encrypts.length > 0) { |
| | | search = search.map(item => { |
| | | let _value = item.value |
| | | if (_encrypts.includes(item.key)) { |
| | | try { |
| | | _value = window.btoa(window.encodeURIComponent(_value)) |
| | | } catch (e) { |
| | | console.warn(e) |
| | | } |
| | | } |
| | | item.value = _value |
| | | |
| | | return item |
| | | }) |
| | | } |
| | | |
| | | resolve(search) |
| | | } else { |
| | |
| | | }) |
| | | } |
| | | |
| | | if (card.type === 'textarea' || card.type === 'fileupload' || card.type === 'multiselect' || card.type === 'checkbox') { |
| | | if (['textarea', 'fileupload', 'multiselect', 'checkbox', 'brafteditor'].includes(card.type)) { |
| | | _fieldlength = 512 |
| | | } |
| | | |
| | |
| | | type: 'radio', |
| | | key: 'encryption', |
| | | label: '加密传输', |
| | | initVal: card.encryption || 'false', |
| | | initVal: card.type === 'brafteditor' ? (card.encryption || 'true') : (card.encryption || 'false'), |
| | | options: [{ |
| | | value: 'true', |
| | | text: Formdict['model.true'] |
| | |
| | | textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'maxRows', 'encryption', 'interception', 'tooltip'], |
| | | color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'entireLine', 'tooltip'], |
| | | hint: ['label', 'type', 'blacklist', 'message'], |
| | | brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'tooltip'], |
| | | brafteditor: ['required', 'hidelabel', 'hidden', 'readin', 'fieldlength', 'readonly', 'tooltip', 'encryption'], |
| | | funcvar: [], |
| | | linkMain: ['readonly', 'required', 'hidden', 'fieldlength', 'entireLine', 'tooltip'] |
| | | } |
| | |
| | | if (value === 'hint') { |
| | | form.required = false |
| | | } |
| | | } else if (form.key === 'encryption') { |
| | | if (value === 'brafteditor') { |
| | | fieldValue.encryption = 'true' |
| | | } |
| | | } |
| | | |
| | | return form |