From afb39f8ab004b2607bb718edab02e99c7a010114 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 22 三月 2023 14:36:44 +0800
Subject: [PATCH] 2023-03-22

---
 src/tabviews/custom/components/table/edit-table/index.jsx |   61 +++++++++++++++++-------------
 1 files changed, 34 insertions(+), 27 deletions(-)

diff --git a/src/tabviews/custom/components/table/edit-table/index.jsx b/src/tabviews/custom/components/table/edit-table/index.jsx
index 893c5c0..3496def 100644
--- a/src/tabviews/custom/components/table/edit-table/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { notification } from 'antd'
+import { notification, Modal } from 'antd'
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
@@ -48,7 +48,6 @@
    */
   UNSAFE_componentWillMount () {
     let _config = fromJS(this.props.config).toJS()
-    let _cols = new Map()
     let setting = {..._config.setting, ..._config.wrap}
     setting.tableId = Utils.getuuid()
 
@@ -82,11 +81,6 @@
       setting.operType = 'btnMode'
     }
 
-    _config.columns.forEach(item => {
-      if (item.type !== 'number') return
-      _cols.set(item.field, item)
-    })
-
     let _columns = []
     let signAdd = false
     _config.cols.forEach(column => {
@@ -115,17 +109,6 @@
   
           return !cell.Hide
         })
-      }
-
-      if (column.type === 'custom') {
-        column.elements = column.elements.map(item => {
-          if (item.eleType === 'number' && item.field && _cols.has(item.field) && typeof(item.decimal) !== 'number') {
-            item.decimal = _cols.get(item.field).decimal || 0
-          }
-          return item
-        })
-      } else if (column.type === 'action') {
-        column.operations = column.elements
       }
 
       _columns.push(column)
@@ -186,7 +169,7 @@
         selectedData: [],
         total: 0
       })
-      reset && MKEmitter.emit('resetTable', config.uuid, repage) // 鍒楄〃閲嶇疆
+      reset && MKEmitter.emit('resetTable', config.uuid, 'true') // 鍒楄〃閲嶇疆
       return
     }
 
@@ -228,6 +211,15 @@
         item.$Index = start + index + ''
         item.$type = 'upt'
         item.$origin = true
+
+        if (config.absFields) {
+          config.absFields.forEach(f => {
+            if (!isNaN(item[f])) {
+              item[f] = Math.abs(item[f])
+            }
+          })
+        }
+
         return item
       })
 
@@ -243,11 +235,18 @@
       this.setState({
         loading: false
       })
-      notification.error({
-        top: 92,
-        message: result.message,
-        duration: 10
-      })
+      
+      if (result.ErrCode === 'N') {
+        Modal.error({
+          title: result.message,
+        })
+      } else {
+        notification.error({
+          top: 92,
+          message: result.message,
+          duration: 10
+        })
+      }
     }
   }
 
@@ -286,6 +285,14 @@
       _data.$$BData = BData || ''
       _data.$type = 'upt'
       _data.$origin = true
+
+      if (config.absFields) {
+        config.absFields.forEach(f => {
+          if (!isNaN(_data[f])) {
+            _data[f] = Math.abs(_data[f])
+          }
+        })
+      }
 
       try {
         data = data.map(item => {
@@ -467,7 +474,7 @@
   /**
    * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁�
    */
-  queryModuleParam = (menuId, btnId) => {
+  queryModuleParam = (menuId, callback) => {
     const { mainSearch } = this.props
     const { arr_field, config, orderBy, search, setting} = this.state
 
@@ -483,7 +490,7 @@
       })
     }
 
-    MKEmitter.emit('returnModuleParam', config.uuid, btnId, {
+    callback({
       arr_field: arr_field,
       orderBy: orderBy || setting.order,
       search: searches,
@@ -550,7 +557,7 @@
   UNSAFE_componentWillReceiveProps(nextProps) {
     const { config } = this.state
 
-    if (config.setting.syncRefresh && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
+    if (config.setting.useMSearch && nextProps.mainSearch && !is(fromJS(this.props.mainSearch), fromJS(nextProps.mainSearch))) {
       this.setState({pageIndex: 1}, () => {
         this.reloadtable()
       })

--
Gitblit v1.8.0