From cc1a76df575c18f0d0ee96e8658461efdce3a918 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 17 一月 2023 18:01:01 +0800
Subject: [PATCH] 2023-01-17

---
 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx |   63 +++++++++++++++++++++----------
 1 files changed, 42 insertions(+), 21 deletions(-)

diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
index f2461f4..bcf4ee3 100644
--- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -6,7 +6,6 @@
 import moment from 'moment'
 
 import Api from '@/api'
-import options from '@/store/options.js'
 import asyncComponent from '@/utils/asyncComponent'
 import Utils, { getEditTableSql, getMark } from '@/utils/utils.js'
 import MkIcon from '@/components/mk-icon'
@@ -14,7 +13,7 @@
 import zhCN from '@/locales/zh-CN/main.js'
 import enUS from '@/locales/en-US/main.js'
 import CusSwitch from './cusSwitch'
-import '@/assets/css/table.scss'
+import Encrypts from '@/components/encrypts'
 import './index.scss'
 
 const { Paragraph } = Typography
@@ -301,9 +300,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 +386,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, '$&,')
@@ -501,7 +506,10 @@
         <CardCellComponent data={record} cards={config} elements={col.elements}/>
       )
     } else if (col.type === 'action') {
-      style.padding = '0px 5px'
+      style.padding = '0px'
+      if (col.style) {
+        style = {...style, ...col.style}
+      }
       children = (
         <CardCellComponent data={record} cards={config} elements={col.elements}/>
       )
@@ -722,9 +730,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 +775,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, '$&,')
@@ -880,7 +894,7 @@
   static propTpyes = {
     statFValue: PropTypes.any,       // 鍚堣瀛楁鏁版嵁
     MenuID: PropTypes.string,        // 鑿滃崟Id
-    setting: PropTypes.object,       // 琛ㄦ牸鍏ㄥ眬璁剧疆锛歵ableType锛堣〃鏍兼槸鍚﹀彲閫夈�佸崟閫夈�佸閫夛級銆乧olumnfixed锛堝垪鍥哄畾锛夈�乤ctionfixed锛堟寜閽浐瀹氾級
+    setting: PropTypes.object,       // 琛ㄦ牸鍏ㄥ眬璁剧疆锛歵ableType锛堣〃鏍兼槸鍚﹀彲閫夈�佸崟閫夈�佸閫夛級銆乤ctionfixed锛堟寜閽浐瀹氾級
     columns: PropTypes.array,        // 琛ㄦ牸鍒�
     lineMarks: PropTypes.any,        // 琛屾爣璁�
     fields: PropTypes.array,         // 缁勪欢瀛楁闆�
@@ -925,6 +939,10 @@
 
       if (item.type === 'text' && item.editable === 'true' && item.editType === 'select' && item.resourceType === '1') {
         let _option = Utils.getSelectQueryOptions(item)
+
+        if (window.GLOB.debugger === true || window.debugger === true) {
+          console.info(_option.sql)
+        }
 
         item.base_sql = window.btoa(window.encodeURIComponent(_option.sql))
         item.arr_field = _option.field
@@ -1095,11 +1113,6 @@
         localItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`)
       }
     })
-    
-    if (options.sysType !== 'local') {
-      localItems = [...localItems, ...mainItems]
-      mainItems = []
-    }
 
     // 鏈湴璇锋眰
     let param = {
@@ -1190,13 +1203,21 @@
       if (item.resourceType === '1' && result[item.uuid] && result[item.uuid].length > 0) {
         let options = []
         let _map = new Map()
+        let all = false
         result[item.uuid].forEach(cell => {
           let _cell = {key: Utils.getuuid()}
 
           _cell.value = cell[item.valueField]
           _cell.label = cell[item.valueText]
 
-          if (!_cell.label && _cell.label !== 0) return
+          if (!_cell.label && _cell.label !== 0) {
+            if (!all) {
+              _cell.label = '鍏ㄩ儴'
+              all = true
+            } else {
+              return
+            }
+          }
 
           if (_map.has(_cell.value)) return
           _map.set(_cell.value, 0)
@@ -1977,7 +1998,7 @@
           {!submit.hasAction && pickup ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> : null}
           <Switch title="缂栬緫" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" disabled={loading || this.props.loading} checked={pickup} onChange={this.pickupChange} />
         </div>
-        <div className={`edit-custom-table ${pickup ? 'editable' : ''} ${setting.tableHeader || ''} ${setting.operType || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''}`} id={tableId}>
+        <div className={`edit-custom-table ${pickup ? 'editable' : ''} ${setting.tableHeader || ''} ${setting.operType || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''} table-vertical-${setting.vertical || ''}`} id={tableId}>
           <Table
             rowKey="$$uuid"
             components={components}

--
Gitblit v1.8.0