king
2022-09-06 b8e1395f02c929eaa96b949cf6027ee2a43856a6
src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -14,6 +14,7 @@
import zhCN from '@/locales/zh-CN/main.js'
import enUS from '@/locales/en-US/main.js'
import CusSwitch from './cusSwitch'
import Encrypts from '@/components/encrypts'
import '@/assets/css/table.scss'
import './index.scss'
@@ -301,9 +302,13 @@
          content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)}`
        } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(content)) {
          content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}`
        } else if (col.textFormat === 'encryption') {
          content = <span>{col.prefix || ''}<Encrypts value={content} />{col.postfix || ''}</span>
        }
        content = (col.prefix || '') + content + (col.postfix || '')
        if (col.textFormat !== 'encryption') {
          content = (col.prefix || '') + content + (col.postfix || '')
        }
      }
      if (col.marks) {
@@ -383,15 +388,17 @@
      }
      if (content !== '') {
        let decimal = col.decimal || 0
        if (col.round) {
          content = Math.round(content * col.round) / col.round
        }
        if (col.format === 'percent') {
          content = content * 100
          decimal = decimal > 2 ? decimal - 2 : 0
        } else if (col.format === 'abs') {
          content = Math.abs(content)
        }
        content = content.toFixed(decimal)
        if (col.round) {
          content = content.toFixed(col.decimal)
        }
  
        if (col.format === 'thdSeparator') {
          content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
@@ -722,9 +729,13 @@
            content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)}`
          } else if (col.textFormat === 'YYYY-MM-DD HH:mm:ss' && /^[1-9]\d{3}(-|\/)(0[1-9]|1[0-2])(-|\/)(0[1-9]|[1-2][0-9]|3[0-1]).([0-1][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]/.test(content)) {
            content = `${content.substr(0, 4)}-${content.substr(5, 2)}-${content.substr(8, 2)} ${content.substr(11, 2)}:${content.substr(14, 2)}:${content.substr(17, 2)}`
          } else if (col.textFormat === 'encryption') {
            content = <span>{col.prefix || ''}<Encrypts value={content} />{col.postfix || ''}</span>
          }
          content = (col.prefix || '') + content + (col.postfix || '')
          if (col.textFormat !== 'encryption') {
            content = (col.prefix || '') + content + (col.postfix || '')
          }
        }
        if (col.marks) {
@@ -763,15 +774,17 @@
        }
        if (content !== '') {
          let decimal = col.decimal || 0
          if (col.round) {
            content = Math.round(content * col.round) / col.round
          }
          if (col.format === 'percent') {
            content = content * 100
            decimal = decimal > 2 ? decimal - 2 : 0
          } else if (col.format === 'abs') {
            content = Math.abs(content)
          }
          content = content.toFixed(decimal)
          if (col.round) {
            content = content.toFixed(col.decimal)
          }
    
          if (col.format === 'thdSeparator') {
            content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')