king
2021-12-17 f2a2e8744370a606a9c74c97857b7217d072bed0
2021-12-17
5个文件已修改
101 ■■■■ 已修改文件
src/menu/components/card/cardcellcomponent/elementform/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/formconfig.jsx 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/index.jsx 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/tabviews/custom/components/card/cardcellList/index.jsx 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/utils-datamanage.js 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/menu/components/card/cardcellcomponent/elementform/index.jsx
@@ -81,7 +81,7 @@
          if (card.eleType === 'text') {
            item.options = item.oriOptions.filter(op => op.value !== 'percent' && op.value !== 'thdSeparator')
          } else if (card.eleType === 'number') {
            item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD')
            item.options = item.oriOptions.filter(op => !op.value || op.value === 'percent' || op.value === 'thdSeparator')
          }
        } else if (item.key === 'url') {
          item.required = card.eleType !== 'qrcode'
@@ -179,7 +179,7 @@
          if (value === 'text') {
            item.options = item.oriOptions.filter(op => op.value !== 'percent' && op.value !== 'thdSeparator')
          } else if (value === 'number') {
            item.options = item.oriOptions.filter(op => op.value !== 'YYYY-MM-DD')
            item.options = item.oriOptions.filter(op => !op.value || op.value === 'percent' || op.value === 'thdSeparator')
          }
        } else if (item.key === 'url') {
          item.required = value !== 'qrcode'
src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -136,7 +136,14 @@
        { value: '', text: '无' },
        { value: 'percent', text: '百分数' },
        { value: 'thdSeparator', text: '千分位' },
        { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' }
        { value: 'YYYY-MM-DD', text: 'YYYY-MM-DD' },
        { value: 'MM月DD日', text: 'MM月DD日' },
        { value: 'YYYY年MM月DD日', text: 'YYYY年MM月DD日' },
        { value: 'HH:mm', text: '时分(例:16:57)' },
        { value: 'ahh:mm', text: '自定义1(例:上午10:57)' },
        { value: 'MM月DD日 ahh:mm', text: '自定义2(例:12月17日 上午10:57)' },
        { value: 'calendar1', text: '自定义3(例:今天 上午10:57)' },
        { value: 'calendar2', text: '自定义4(例:刚刚、昨天、5天前)' },
      ]
    },
    {
src/menu/components/card/cardcellcomponent/index.jsx
@@ -622,9 +622,9 @@
        <div onDoubleClick={(e) => e.stopPropagation()}>
          {/* 编辑按钮:复制、编辑 */}
          <Modal
            title={'编辑元素'}
            title="编辑元素"
            visible={visible}
            width={800}
            width={850}
            maskClosable={false}
            onCancel={this.editModalCancel}
            onOk={this.handleSubmit}
src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -305,8 +305,61 @@
      }
      if (val !== '' && card.format) {
        if (card.format === 'YYYY-MM-DD' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1])/.test(val)) {
          val = `${val.substr(0, 4)}-${val.substr(5, 2)}-${val.substr(8, 2)}`
        let _val = null
        if (card.format === 'calendar1') {
          _val = moment(val).calendar(null, {
            sameDay: '[今天] ahh:mm',
            nextDay: '[明天] ahh:mm',
            nextWeek: 'MM月DD日 ahh:mm',
            lastDay: '[昨天] ahh:mm',
            lastWeek: 'dddd ahh:mm',
            sameElse: 'MM月DD日 ahh:mm'
          })
        } else if (card.format === 'calendar2') {
          let time = new Date(val).getTime()
          if (!isNaN(time)) {
            time = parseInt(time / 60000)                                     // 时间值
            let now = parseInt(new Date().getTime() / 60000)                  // 当前时间值
            let start = new Date(new Date().toDateString()).getTime() / 60000 // 今天零点时间值
            let split = now - time
            if (split < 0) { // 时间值在当前时间之后
              _val = moment(val).format('MM月DD日 HH:mm')
            } else if (split < 3) {
              _val = '刚刚'
            } else if (split < 5) {
              _val = '3分钟前'
            } else if (split < 10) {
              _val = '5分钟前'
            } else if (split < 20) {
              _val = '10分钟前'
            } else if (split < 30) {
              _val = '20分钟前'
            } else if (split < 60) {
              _val = '30分钟前'
            } else if (split < 420 || time > start) { // 7小时内或时间值在今天零点后
              _val = parseInt(split / 60) + '小时前'
            } else {                                  // 时间值在今天零点之前
              let _day = parseInt((start - time) / (24 * 60)) + 1
              if (_day === 1) {
                _val = '昨天'
              } else if (_day <= 30) {
                _val = _day + '天前'
              } else {
                _val = moment(val).format('MM月DD日 HH:mm')
              }
            }
          }
        } else {
          _val = moment(val).format(card.format)
        }
        // if (card.format === 'YYYY-MM-DD' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1])/.test(val)) {
        //   val = `${val.substr(0, 4)}-${val.substr(5, 2)}-${val.substr(8, 2)}`
        // }
        if (_val && _val !== 'Invalid date') {
          val = _val
        }
      }
src/utils/utils-datamanage.js
@@ -146,18 +146,23 @@
    let _search = ''
    
    if (setting.queryType === 'statistics' && _dataresource) { // 统计数据源,内容替换
      regoptions.forEach(item => {
        _dataresource = _dataresource.replace(item.reg, item.value)
      })
    } else if (_dataresource && !id) {
      _search = Utils.joinMainSearchkey(search)
      if (_search) {
        _search = 'where ' + _search
    if (_dataresource) {
      if (setting.queryType === 'statistics') { // 统计数据源,内容替换
        regoptions.forEach(item => {
          _dataresource = _dataresource.replace(item.reg, item.value)
        })
        if (id) {
          _dataresource = _dataresource + ` where ${setting.primaryKey || 'ID'}='${id}'`
        }
      } else if (!id) {
        _search = Utils.joinMainSearchkey(search)
        if (_search) {
          _search = 'where ' + _search
        }
      } else if (id) {
        _search = Utils.joinMainSearchkey(search)
        _search = `where ${_search ? _search + ' AND ' : ''} ${setting.primaryKey || 'ID'}='${id}'`
      }
    } else if (_dataresource && id) {
      _search = Utils.joinMainSearchkey(search)
      _search = `where ${_search ? _search + ' AND ' : ''} ${setting.primaryKey || 'ID'}='${id}'`
    }
    if (_customScript) {