king
2023-03-08 8969147207be7ef066051da3525b473043ecff2a
src/tabviews/zshare/mutilform/index.jsx
@@ -27,6 +27,7 @@
const MKColor = asyncComponent(() => import('./mkColor'))
const MkFormula = asyncComponent(() => import('./mkFormula'))
const MkCascader = asyncComponent(() => import('./mkCascader'))
const MkVercode = asyncComponent(() => import('./mkVercode'))
const MKEditor = asyncComponent(() => import('@/components/editor'))
class MainSearch extends Component {
@@ -41,7 +42,10 @@
  state = {
    formlist: [],    // 表单项
    ID: ''
    ID: '',
    send_type: '',
    timestamp: '',
    n_id: ''
  }
  record = {}
@@ -114,7 +118,7 @@
        item.precision = 'second'
      }
      if (!item.field || !['text', 'number', 'switch', 'rate', 'select', 'link', 'cascader', 'linkMain', 'funcvar', 'date', 'datemonth', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color'].includes(item.type)) return false
      if (!item.field || !['text', 'number', 'switch', 'rate', 'select', 'link', 'cascader', 'linkMain', 'funcvar', 'date', 'datemonth', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color', 'vercode'].includes(item.type)) return false
      if (/^\s+$/.test(item.label)) {
        item.style = item.style || {}
@@ -351,7 +355,7 @@
            message: formRule.input.formMessage.replace('@max', item.fieldlength)
          }
        ]
      } else if (item.type === 'linkMain') {
      } else if (item.type === 'linkMain' || item.type === 'vercode') {
        item.rules = [
          {
            required: item.required === 'true',
@@ -957,6 +961,8 @@
          content = (<MKTextArea config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})}/>)
        } else if (item.type === 'rate') {
          content = (<Rate count={item.rateCount} disabled={item.readonly} style={{color: item.color || '#fadb14'}} onChange={(val) => this.recordChange({[item.field]: val})} character={item.character ? <MkIcon type={item.character}/> : <StarFilled />} allowHalf={item.allowHalf}/>)
        } else if (item.type === 'vercode') {
          content = (<MkVercode config={item} record={this.record} onSend={(send_type, timestamp, n_id) => this.setState({send_type, timestamp, n_id})} onChange={(val) => this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit}/>)
        } else if (item.type === 'brafteditor') {
          content = (<MKEditor config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
          label = item.hidelabel !== 'true' ? label : ''
@@ -988,7 +994,7 @@
  }
  handleConfirm = () => {
    const { formlist } = this.state
    const { formlist, send_type, timestamp, n_id } = this.state
    // 表单提交时检查输入值是否正确
    return new Promise((resolve, reject) => {
@@ -997,7 +1003,7 @@
          reject(err)
          return
        }
        let search = []
        let forms = []
        let record = {...this.record, ...values}
        formlist.forEach(item => {
@@ -1039,12 +1045,40 @@
            if (item.declareType === 'nvarchar(50)') {
              _item.type = 'text'
            }
          } else if (item.type === 'vercode') {
            _item.type = 'text'
            forms.push({
              type: 'text',
              readin: false,
              writein: false,
              fieldlen: 50,
              key: 'mk_timestamp',
              value: timestamp || ''
            })
            forms.push({
              type: 'text',
              readin: false,
              writein: false,
              fieldlen: 50,
              key: 'mk_send_type',
              value: send_type || ''
            })
            forms.push({
              type: 'text',
              readin: false,
              writein: false,
              fieldlen: 50,
              key: 'mk_n_id',
              value: n_id || ''
            })
          }
    
          search.push(_item)
          forms.push(_item)
        })
        resolve(search)
        resolve(forms)
      })
    })
  }