king
2021-01-18 4fcad7ab9334897449360194848cec1c998973df
2021-01-18
9个文件已修改
2个文件已添加
289 ■■■■ 已修改文件
src/assets/css/main.scss 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/editor/index.jsx 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/editor/index.scss 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/scriptmanage/actionList/index.scss 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/verupmanage/actionList/index.scss 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/actionList/index.scss 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/customTextArea/index.jsx 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/customTextArea/index.scss 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/index.jsx 56 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/formconfig.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/modalform/index.jsx 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/main.scss
@@ -301,6 +301,34 @@
    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;
src/components/editor/index.jsx
@@ -4,7 +4,7 @@
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'
@@ -23,31 +23,57 @@
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)
    }
  }
src/components/editor/index.scss
@@ -17,4 +17,7 @@
    border: 1px solid rgba(0, 0, 0, 0.07);
    background: rgba(0, 0, 0, 0);
  }
  .mk-braft-delete {
    font-size: 16px;
  }
}
src/tabviews/scriptmanage/actionList/index.scss
@@ -15,30 +15,3 @@
    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);
  }
}
src/tabviews/verupmanage/actionList/index.scss
@@ -15,30 +15,3 @@
    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);
  }
}
src/tabviews/zshare/actionList/index.scss
@@ -24,31 +24,3 @@
    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);
  }
}
src/tabviews/zshare/mutilform/customTextArea/index.jsx
New file
@@ -0,0 +1,72 @@
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
src/tabviews/zshare/mutilform/customTextArea/index.scss
src/tabviews/zshare/mutilform/index.jsx
@@ -12,10 +12,10 @@
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'))
@@ -39,7 +39,6 @@
    writein: null,   // 执行时是否填入默认sql
    fieldlen: null,  // 字段长度
    formlist: [],    // 表单项
    encrypts: [],    // 加密字段
    intercepts: [],  // 截取字段
    record: {}       // 记录下拉表单关联字段,用于数据写入
  }
@@ -68,7 +67,6 @@
    let writein = {}
    let fieldlen = {}
    let formlist = []
    let encrypts = []
    let intercepts = []
    let _inputfields = []
@@ -99,9 +97,6 @@
        _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)
@@ -200,14 +195,7 @@
        }
      }
      // 加密字段,解密处理
      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) {
@@ -260,14 +248,13 @@
    })
    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')
@@ -1182,7 +1169,7 @@
                  },
                  ..._rules
                ]
              })(<TextArea autoSize={{ minRows: 2, maxRows: item.maxRows || 6 }} disabled={item.readonly === 'true'} />)}
              })(<CustomTextArea Item={item} />)}
            </Form.Item>
          </Col>
        )
@@ -1198,7 +1185,7 @@
              </Tooltip> : item.label
            }>
              {getFieldDecorator(item.field, {
                initialValue: item.initval || null,
                initialValue: item.initval || '',
                rules: [
                  {
                    required: item.required === 'true',
@@ -1209,7 +1196,7 @@
                    message: formRule.input.formMessage.replace('@max', _max)
                  }
                ]
              })(<Editor />)}
              })(<Editor Item={item}/>)}
            </Form.Item>
          </Col>
        )
@@ -1221,7 +1208,6 @@
  handleConfirm = () => {
    const { record, intercepts, writein } = this.state
    let _encrypts = fromJS(this.state.encrypts).toJS()
    let _format = {
      date: 'YYYY-MM-DD',
      datemonth: 'YYYY-MM',
@@ -1252,7 +1238,6 @@
              let _val = item.initval
              if (record.hasOwnProperty(item.field)) {
                _val = record[item.field]
                _encrypts = _encrypts.filter(_field => _field !== item.field) // 隐藏字段,不参与加密处理
              }
              
              _item = {
@@ -1353,23 +1338,6 @@
              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 {
src/templates/zshare/formconfig.jsx
@@ -1851,7 +1851,7 @@
    })
  }
  if (card.type === 'textarea' || card.type === 'fileupload' || card.type === 'multiselect' || card.type === 'checkbox') {
  if (['textarea', 'fileupload', 'multiselect', 'checkbox', 'brafteditor'].includes(card.type)) {
    _fieldlength = 512
  }
@@ -2346,7 +2346,7 @@
      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']
src/templates/zshare/modalform/index.jsx
@@ -30,7 +30,7 @@
  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']
}
@@ -256,6 +256,10 @@
            if (value === 'hint') {
              form.required = false
            }
          } else if (form.key === 'encryption') {
            if (value === 'brafteditor') {
              fieldValue.encryption = 'true'
            }
          }
          return form