king
2019-12-10 bd06958321afa706f32287c71bd219eb0622c86c
src/templates/modalconfig/index.jsx
@@ -454,6 +454,19 @@
            value: 'false',
            text: this.state.dict['header.form.false']
          }]
        },
        {
          type: 'radio',
          key: 'required',
          label: this.state.dict['header.form.field.required'],
          initVal: card.required || 'false',
          options: [{
            value: 'true',
            text: this.state.dict['header.form.true']
          }, {
            value: 'false',
            text: this.state.dict['header.form.false']
          }]
        }
      ]
    })
@@ -468,7 +481,7 @@
  handleSubmit = () => {
    this.formRef.handleConfirm().then(res => {
      let _config = JSON.parse(JSON.stringify(this.state.config))
      console.log(res)
      if ((res.type === 'select' || res.type === 'link') && res.resourceType === '1') {
        let sql = 'select ' + res.valueField + ',' + res.valueText + ' from (' + res.dataSource + ')'
        if (res.orderBy) {
@@ -477,6 +490,17 @@
        res.dataSourceSql = Utils.formatOptions(sql)
      }
      if (_config.groups.length > 0) {
        _config.groups.forEach(group => {
          group.sublist = group.sublist.map(item => {
            if (item.uuid === res.uuid) {
              return res
            } else {
              return item
            }
          })
        })
      } else {
      _config.fields = _config.fields.map(item => {
        if (item.uuid === res.uuid) {
          return res
@@ -484,6 +508,8 @@
          return item
        }
      })
      }
      _config.fields = _config.fields.filter(item => !item.origin)
      this.setState({
@@ -510,13 +536,15 @@
      cancelText: this.state.dict['header.cancel'],
      onOk() {
        let _config = JSON.parse(JSON.stringify(_this.state.config))
        _config.fields = _config.fields.filter(item => {
          if (item.uuid === card.uuid) {
            return false
          } else {
            return true
          }
        if (_config.groups.length > 0) {
          _config.groups.forEach(group => {
            group.sublist = group.sublist.filter(item => !(item.uuid === card.uuid))
        })
        } else {
          _config.fields = _config.fields.filter(item => !(item.uuid === card.uuid))
        }
        _this.setState({
          config: _config,
          loading: true
@@ -742,7 +770,8 @@
          valueText: '',
          orderBy: '',
          orderType: 'asc',
          readonly: 'false'
          readonly: 'false',
          required: 'false'
        }
      })
      _config.groups[_config.groups.length - 1].sublist = [..._config.groups[_config.groups.length - 1].sublist, ..._additems]
@@ -786,7 +815,8 @@
            valueText: '',
            orderBy: '',
            orderType: 'asc',
            readonly: 'false'
            readonly: 'false',
            required: 'false'
          }
  
          items.push(newcard)