king
2021-01-18 4fcad7ab9334897449360194848cec1c998973df
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 {