From cb9ade2afd2a367ad767bc605ab7086c695dd010 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 09 十二月 2022 15:53:32 +0800
Subject: [PATCH] 2022-12-09

---
 src/tabviews/subtabtable/index.jsx |   79 +++++++++++++++++----------------------
 1 files changed, 35 insertions(+), 44 deletions(-)

diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx
index 9343c02..154233c 100644
--- a/src/tabviews/subtabtable/index.jsx
+++ b/src/tabviews/subtabtable/index.jsx
@@ -1,8 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
-import { notification, Spin} from 'antd'
+import { notification, Spin, Modal } from 'antd'
 
 import Api from '@/api'
 import zhCN from '@/locales/zh-CN/main.js'
@@ -40,7 +39,7 @@
     searchlist: null,     // 鎼滅储鏉′欢
     actions: null,        // 鎸夐挳闆�
     columns: null,        // 鏄剧ず鍒�
-    arr_field: '',        // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆�
+    arr_field: '',        // 鏌ヨ瀛楁闆�
     setting: null,        // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑
     data: [],             // 鍒楄〃鏁版嵁闆�
     selectedData: [],     // 宸查�夎〃鏍兼暟鎹�
@@ -61,7 +60,7 @@
    * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅
    */
   async loadconfig () {
-    const { permAction, Tab } = this.props
+    const { Tab } = this.props
 
     let param = {
       func: 'sPC_Get_LongParam',
@@ -128,9 +127,7 @@
       }
 
       // 鏉冮檺杩囨护
-      if (this.props.menuType !== 'HS') {
-        config.action = config.action.filter(item => permAction[item.uuid])
-      }
+      config.action = config.action.filter(item => item.hidden !== 'true')
 
       config.search = Utils.initSearchVal(config.search)
 
@@ -157,6 +154,15 @@
       config.columns.forEach(col => {
         if (col.field) {
           _arrField.push(col.field)
+
+          if (col.type === 'number') {
+            col.decimal = col.decimal || 0
+            col.round = Math.pow(10, col.decimal)
+
+            if (col.format === 'percent') {
+              col.decimal = col.decimal > 2 ? col.decimal - 2 : 0
+            }
+          }
 
           col.nameField && _arrField.push(col.nameField) // 閾炬帴鍚嶅瓧娈�
           if (col.Hide !== 'true' && col.type === 'number' && col.sum === 'true') {
@@ -207,6 +213,7 @@
         item.$menuId = this.props.MenuID
 
         if (item.position === 'toolbar') {
+          item.$toolbtn = true
           _actions.push(item)
         } else if (item.position === 'grid') {
           _operations.push(item)
@@ -257,7 +264,6 @@
 
         let userName = sessionStorage.getItem('User_Name') || ''
         let fullName = sessionStorage.getItem('Full_Name') || ''
-        let city = sessionStorage.getItem('city') || ''
 
         if (sessionStorage.getItem('isEditState') === 'true') {
           userName = sessionStorage.getItem('CloudUserName') || ''
@@ -266,8 +272,7 @@
 
         let regs = [
           { reg: /@userName@/ig, value: `'${userName}'` },
-          { reg: /@fullName@/ig, value: `'${fullName}'` },
-          { reg: /@login_city@/ig, value: `'${city}'` }
+          { reg: /@fullName@/ig, value: `'${fullName}'` }
         ]
 
         regs.forEach(cell => {
@@ -368,7 +373,7 @@
   loadOutResource = (searches) => {
     const { setting } = this.state
 
-    let param = UtilsDM.getPrevQueryParams(setting, searches, this.props.BID, this.props.menuType)
+    let param = UtilsDM.getPrevQueryParams(setting, searches, this.props.BID)
 
     if (setting.execType === 'sync') {
       this.setState({
@@ -482,15 +487,7 @@
       `))
       sql = sql.join('')
       
-      param = UtilsDM.getCallBackQueryParams(setting, sql, errSql)
-
-      if (this.props.BID) {
-        param.BID = this.props.BID
-      }
-
-      if (this.props.menuType === 'HS') { // 鍑芥暟 sPC_TableData_InUpDe 浜戠楠岃瘉
-        param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
-      }
+      param = UtilsDM.getCallBackQueryParams(setting, sql, errSql, this.props.BID)
     } else {
       let name = this.props.Tab ? (this.props.Tab.label || '') : ''
       param.func = 's_ex_result_back'
@@ -547,7 +544,7 @@
     })
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType)
+    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID)
 
     let result = await Api.genericInterface(param)
 
@@ -599,11 +596,17 @@
       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
+        })
+      }
     }
   }
 
@@ -617,7 +620,7 @@
     if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID, this.props.menuType)
+    let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID)
 
     Api.genericInterface(param).then(res => {
       if (res.status) {
@@ -666,7 +669,7 @@
     })
 
     let _orderBy = orderBy || setting.order
-    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id)
+    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, id)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
@@ -789,13 +792,13 @@
   /**
    * @description 瀵煎嚭Excel鏃讹紝鑾峰彇椤甸潰鎼滅储鎺掑簭绛夊弬鏁�
    */
-  queryModuleParam = (menuId, btnId) => {
+  queryModuleParam = (menuId, callback) => {
     const { Tab, MenuID } = this.props
     const { arr_field, orderBy, search, setting} = this.state
 
     if (MenuID !== menuId) return
 
-    MKEmitter.emit('returnModuleParam', MenuID, btnId, {
+    callback({
       arr_field: arr_field,
       orderBy: orderBy || setting.order,
       search: search,
@@ -854,7 +857,7 @@
       <div className="subtabtable" id={'subtabtable' + this.props.MenuID}>
         {loadingview && <Spin />}
         {searchlist && searchlist.length ?
-          <SubSearch BID={this.props.BID} setting={setting} searchlist={searchlist} menuType={this.props.menuType} refreshdata={this.refreshbysearch}/> : null
+          <SubSearch BID={this.props.BID} setting={setting} searchlist={searchlist} refreshdata={this.refreshbysearch}/> : null
         }
         {config ? <div style={{minHeight: '25px'}}>
           <SubAction
@@ -889,16 +892,4 @@
   }
 }
 
-const mapStateToProps = (state) => {
-  return {
-    menuType: state.editLevel,
-    permAction: state.permAction,
-    memberLevel: state.memberLevel
-  }
-}
-
-const mapDispatchToProps = () => {
-  return {}
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(SubTabModalTable)
\ No newline at end of file
+export default SubTabModalTable
\ No newline at end of file

--
Gitblit v1.8.0