king
2022-03-10 99966d855531d813197190f68e84f409f4eb1e61
2022-03-10
9个文件已修改
169 ■■■■ 已修改文件
src/assets/css/main.scss 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/components/formdragelement/card.jsx 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/mob/modalconfig/source.jsx 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/index.jsx 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/zshare/mutilform/mkDatePicker/index.jsx 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/dragelement/card.jsx 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/modalconfig/source.jsx 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/formconfig.jsx 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/templates/zshare/modalform/index.jsx 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/assets/css/main.scss
@@ -124,15 +124,15 @@
// 重置时间插件时间滚动条
.ant-calendar-time-picker-select {
  overflow-y: auto;
  overflow-y: auto!important;
}
.ant-calendar-time-picker-select::-webkit-scrollbar {
  width: 7px;
  width: 6px;
}
.ant-calendar-time-picker-select::-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);
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.08);
  background: rgba(0, 0, 0, 0.08);
}
.ant-calendar-time-picker-select::-webkit-scrollbar-track {
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
src/mob/components/formdragelement/card.jsx
@@ -66,7 +66,15 @@
  } else if (card.type === 'select' || card.type === 'link') {
    formItem = (<div className="am-list-item"><div className="am-list-line"><div className="am-input-label">{card.label}</div><div className="am-input-control">{selectval || '请选择'}</div><div className="am-list-extra"><RightOutlined /></div></div></div>)
  } else if (card.type === 'date') {
    formItem = (<div className="am-list-item"><div className="am-list-line"><div className="am-input-label">{card.label}</div><div className="am-input-control">{card.initval ? moment().subtract(card.initval, 'days').format('YYYY-MM-DD') : '请选择'}</div><div className="am-list-extra"><RightOutlined /></div></div></div>)
    let format = 'YYYY-MM-DD'
    if (card.precision === 'hour') {
      format = 'YYYY-MM-DD HH'
    } else if (card.precision === 'minute') {
      format = 'YYYY-MM-DD HH:mm'
    } else if (card.precision === 'second') {
      format = 'YYYY-MM-DD HH:mm:ss'
    }
    formItem = (<div className="am-list-item"><div className="am-list-line"><div className="am-input-label">{card.label}</div><div className="am-input-control">{card.initval ? moment().subtract(card.initval, 'days').format(format) : '请选择'}</div><div className="am-list-extra"><RightOutlined /></div></div></div>)
  } else if (card.type === 'datemonth') {
    formItem = (<div className="am-list-item"><div className="am-list-line"><div className="am-input-label">{card.label}</div><div className="am-input-control">{card.initval ? moment().subtract(card.initval, 'month').format('YYYY-MM') : '请选择'}</div><div className="am-list-extra"><RightOutlined /></div></div></div>)
  } else if (card.type === 'datetime') {
src/mob/modalconfig/source.jsx
@@ -70,12 +70,12 @@
    subType: 'datemonth',
    url: ''
  },
  {
    type: 'form',
    label: '日期(分/秒)',
    subType: 'datetime',
    url: ''
  },
  // {
  //   type: 'form',
  //   label: '日期(分/秒)',
  //   subType: 'datetime',
  //   url: ''
  // },
  {
    type: 'form',
    label: CommonDict['model.form.textarea'],
src/tabviews/zshare/mutilform/index.jsx
@@ -84,9 +84,14 @@
        }
        delete item.field
        return true
      } else if (item.type === 'date') { // 时间搜索
        item.precision = item.precision || 'day'
      } else if (item.type === 'datetime') {
        item.type = 'date'
        item.precision = 'second'
      }
      if (!item.field || !['text', 'number', 'switch', 'rate', 'select', 'link', 'linkMain', 'funcvar', 'date', 'datemonth', 'datetime', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color'].includes(item.type)) return false
      if (!item.field || !['text', 'number', 'switch', 'rate', 'select', 'link', 'linkMain', 'funcvar', 'date', 'datemonth', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color'].includes(item.type)) return false
      // 数据自动填充
      let readin = item.readin !== 'false'
@@ -139,12 +144,24 @@
      if (item.type === 'linkMain') {
        newval = BData && BData[item.field] ? BData[item.field] : '$empty'
      } else if (item.type === 'date') { // 时间搜索
        let format = 'YYYY-MM-DD'
        let _format = 'YYYY-MM-DD HH:mm:ss'
        if (item.precision === 'day') {
          _format = 'YYYY-MM-DD'
        } else if (item.precision === 'hour') {
          format = 'YYYY-MM-DD HH'
        } else if (item.precision === 'minute') {
          format = 'YYYY-MM-DD HH:mm'
        } else if (item.precision === 'second') {
          format = 'YYYY-MM-DD HH:mm:ss'
        }
        if (newval !== '$empty') {
          newval = moment(newval, 'YYYY-MM-DD').format('YYYY-MM-DD')
          newval = moment(newval, format).format(_format)
          newval = newval === 'Invalid date' ? '$empty' : newval
        }
        if (newval === '$empty' && item.initval) {
          newval = moment().subtract(item.initval, 'days').format('YYYY-MM-DD')
          newval = moment().subtract(item.initval, 'days').format(_format)
        }
      } else if (item.type === 'datemonth') {
        if (newval !== '$empty') {
@@ -154,18 +171,18 @@
        if (newval === '$empty' && item.initval) {
          newval = moment().subtract(item.initval, 'month').format('YYYY-MM')
        }
      } else if (item.type === 'datetime') {
        if (newval !== '$empty') {
          newval = moment(newval, 'YYYY-MM-DD HH:mm:ss').format('YYYY-MM-DD HH:mm:ss')
          newval = newval === 'Invalid date' ? '$empty' : newval
        }
        if (newval === '$empty' && item.initval) {
          if (item.initval === '0') {
            newval = moment().format('YYYY-MM-DD HH:mm:ss')
          } else {
            newval = moment().subtract(item.initval, 'days').format('YYYY-MM-DD') + ' 00:00:00'
          }
        }
      // } else if (item.type === 'datetime') {
      //   if (newval !== '$empty') {
      //     newval = moment(newval, 'YYYY-MM-DD HH:mm:ss').format('YYYY-MM-DD HH:mm:ss')
      //     newval = newval === 'Invalid date' ? '$empty' : newval
      //   }
      //   if (newval === '$empty' && item.initval) {
      //     if (item.initval === '0') {
      //       newval = moment().format('YYYY-MM-DD HH:mm:ss')
      //     } else {
      //       newval = moment().subtract(item.initval, 'days').format('YYYY-MM-DD') + ' 00:00:00'
      //     }
      //   }
      } else if (item.type === 'switch') { // 开关只接收固定值
        if (newval !== '$empty' && (newval === item.closeVal || newval === item.openVal)) {
@@ -802,7 +819,7 @@
          content = (<MKCheckbox config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
        } else if (item.type === 'radio') {
          content = (<MKRadio config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>)
        } else if (item.type === 'date' || item.type === 'datemonth' || item.type === 'datetime') {
        } else if (item.type === 'date' || item.type === 'datemonth') {
          content = (<MKDatePicker config={item} onChange={(val) => this.recordChange({[item.field]: val})} />)
        } else if (item.type === 'fileupload') {
          className = item.readonly ? 'readonly' : ''
src/tabviews/zshare/mutilform/mkDatePicker/index.jsx
@@ -20,13 +20,19 @@
    if (config.type === 'datemonth') {
      mode = 'month'
      format = 'YYYY-MM'
    } else if (config.type === 'datetime') {
      mode = 'datetime'
    } else if (config.precision === 'day') {
      format = 'YYYY-MM-DD'
    } else if (config.precision === 'hour') {
      format = 'YYYY-MM-DD HH'
    } else if (config.precision === 'minute') {
      format = 'YYYY-MM-DD HH:mm'
    } else if (config.precision === 'second') {
      format = 'YYYY-MM-DD HH:mm:ss'
    }
    let value = config.initval || null
    if (value) {
      value = moment(value, format)
      value = moment(value, 'YYYY-MM-DD HH:mm:ss')
    }
    this.state = {
@@ -49,9 +55,19 @@
  }
  onChange = (val) => {
    const { format } = this.state
    const { config } = this.props
    const { format, mode } = this.state
    let _val = val ? moment(val).format(format) : ''
    this.props.onChange(val ? moment(val).format(format) : '')
    if (mode === 'date' && _val) {
      if (config.precision === 'hour') {
        _val = _val + ':00:00'
      } else if (config.precision === 'minute') {
        _val = _val + ':00'
      }
    }
    this.props.onChange(_val)
  }
  disabledDate = (current) => {
@@ -72,14 +88,12 @@
  render() {
    const { config } = this.props
    const { value, mode } = this.state
    const { value, mode, format } = this.state
    if (mode === 'date') {
      return <DatePicker defaultValue={value} disabledDate={this.disabledDate} disabled={config.readonly} onChange={this.onChange}/>
      return <DatePicker dropdownClassName={'mk-date-picker ' + config.precision} showTime={format !== 'YYYY-MM-DD'} format={format} defaultValue={value} disabledDate={this.disabledDate} disabled={config.readonly} onChange={this.onChange}/>
    } else if (mode === 'month') {
      return <MonthPicker defaultValue={value} disabled={config.readonly} onChange={this.onChange}/>
    } else if (mode === 'datetime') {
      return <DatePicker defaultValue={value} disabledDate={this.disabledDate} showTime disabled={config.readonly} onChange={this.onChange}/>
    }
  }
}
src/templates/modalconfig/dragelement/card.jsx
@@ -76,11 +76,19 @@
  } else if (card.type === 'color') {
    formItem = (<ColorSketch value={card.initval || 'transparent'}/>)
  } else if (card.type === 'date') {
    formItem = (<DatePicker value={card.initval ? moment().subtract(card.initval, 'days') : null} />)
    let format = 'YYYY-MM-DD'
    if (card.precision === 'hour') {
      format = 'YYYY-MM-DD HH'
    } else if (card.precision === 'minute') {
      format = 'YYYY-MM-DD HH:mm'
    } else if (card.precision === 'second') {
      format = 'YYYY-MM-DD HH:mm:ss'
    }
    formItem = (<DatePicker format={format} value={card.initval ? moment().subtract(card.initval, 'days') : null} />)
  } else if (card.type === 'datemonth') {
    formItem = (<MonthPicker value={card.initval ? moment().subtract(card.initval, 'month') : null} />)
  } else if (card.type === 'datetime') {
    formItem = (<DatePicker showTime value={card.initval ? moment().subtract(card.initval, 'days') : null} />)
    formItem = (<DatePicker format='YYYY-MM-DD HH:mm:ss' value={card.initval ? moment().subtract(card.initval, 'days') : null} />)
  } else if (card.type === 'textarea') {
    formItem = (<TextArea value={card.initval} placeholder={card.placeholder || ''} autoSize={{ minRows: 2, maxRows: 6 }} />)
  } else if (card.type === 'brafteditor') {
src/templates/modalconfig/source.jsx
@@ -134,11 +134,11 @@
    label: CommonDict['model.form.datemonth'],
    subType: 'datemonth',
  },
  {
    type: 'form',
    label: '日期(分/秒)',
    subType: 'datetime',
  },
  // {
  //   type: 'form',
  //   label: '日期(分/秒)',
  //   subType: 'datetime',
  // },
  {
    type: 'form',
    label: CommonDict['model.form.textarea'],
src/templates/zshare/formconfig.jsx
@@ -2288,9 +2288,9 @@
  }, {
    value: 'datemonth',
    text: Formdict['model.form.datemonth']
  }, {
    value: 'datetime',
    text: '日期(分/秒)'
  // }, {
  //   value: 'datetime',
  //   text: '日期(分/秒)'
  }, {
    value: 'textarea',
    text: Formdict['model.form.textarea']
@@ -2353,9 +2353,9 @@
    }, {
      value: 'datemonth',
      text: Formdict['model.form.datemonth']
    }, {
      value: 'datetime',
      text: '日期(分/秒)'
    // }, {
    //   value: 'datetime',
    //   text: '日期(分/秒)'
    }, {
      value: 'textarea',
      text: Formdict['model.form.textarea']
@@ -2381,6 +2381,9 @@
    _fieldlength = 512
  } else if (['textarea', 'brafteditor'].includes(card.type)) {
    _fieldlength = 8000
  } else if (card.type === 'datetime') {
    card.type = 'date'
    card.precision = 'second'
  }
  let options = card.options || []
@@ -2779,6 +2782,25 @@
      }]
    },
    {
      type: 'radio',
      key: 'precision',
      label: '精确度',
      initVal: card.precision || 'day',
      options: [{
        value: 'day',
        text: '天'
      }, {
        value: 'hour',
        text: '小时'
      }, {
        value: 'minute',
        text: '分钟'
      }, {
        value: 'second',
        text: '秒'
      }]
    },
    {
      type: 'number',
      key: 'fieldlength',
      min: 1,
src/templates/zshare/modalform/index.jsx
@@ -29,7 +29,7 @@
  link: ['initval', 'readonly', 'required', 'hidden', 'readin', 'resourceType', 'setAll', 'linkField', 'linkSubField', 'span', 'labelwidth', 'tooltip', 'extra', 'emptyText', 'enter', 'splitline', 'dropdown', 'marginTop', 'marginBottom'],
  fileupload: ['readonly', 'required', 'readin', 'fieldlength', 'maxfile', 'fileType', 'span', 'labelwidth', 'tooltip', 'extra', 'compress', 'splitline', 'marginTop', 'marginBottom'],
  switch: ['initval', 'openVal', 'closeVal', 'openText', 'closeText', 'readonly', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom'],
  date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'],
  date: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate', 'precision'],
  datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'splitline', 'marginTop', 'marginBottom'],
  datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'],
  textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'count', 'placeholder', 'marginTop', 'marginBottom', 'enterReplace'],