From b8e1395f02c929eaa96b949cf6027ee2a43856a6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 06 九月 2022 19:03:37 +0800
Subject: [PATCH] 2022-09-06

---
 src/tabviews/subtabtable/index.jsx |   78 ++++++++++++++++++++------------------
 1 files changed, 41 insertions(+), 37 deletions(-)

diff --git a/src/tabviews/subtabtable/index.jsx b/src/tabviews/subtabtable/index.jsx
index 63ebd78..9b576d2 100644
--- a/src/tabviews/subtabtable/index.jsx
+++ b/src/tabviews/subtabtable/index.jsx
@@ -40,7 +40,7 @@
     searchlist: null,     // 鎼滅储鏉′欢
     actions: null,        // 鎸夐挳闆�
     columns: null,        // 鏄剧ず鍒�
-    arr_field: '',        // 浣跨敤 sPC_Get_TableData 鏃剁殑鏌ヨ瀛楁闆�
+    arr_field: '',        // 鏌ヨ瀛楁闆�
     setting: null,        // 椤甸潰鍏ㄥ眬璁剧疆锛氭暟鎹簮銆佹寜閽強鏄剧ず鍒楀浐瀹氥�佷富閿瓑
     data: [],             // 鍒楄〃鏁版嵁闆�
     selectedData: [],     // 宸查�夎〃鏍兼暟鎹�
@@ -128,8 +128,10 @@
       }
 
       // 鏉冮檺杩囨护
-      if (this.props.menuType !== 'HS') {
-        config.action = config.action.filter(item => permAction[item.uuid])
+      if (!window.GLOB.mkHS) {
+        config.action = config.action.filter(item => item.hidden !== 'true' && permAction[item.uuid])
+      } else {
+        config.action = config.action.filter(item => item.hidden !== 'true')
       }
 
       config.search = Utils.initSearchVal(config.search)
@@ -157,6 +159,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 +218,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 +269,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 +277,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 => {
@@ -280,6 +290,8 @@
         config.setting.selected = 'false'
       } else if (config.setting.selected === 'init' && config.setting.onload === 'false') {
         config.setting.selected = 'false'
+      } else {
+        config.setting.orisel = true
       }
 
       if (config.setting.controlField) {
@@ -321,7 +333,7 @@
     }
   }
 
-  loadData = () => {
+  loadData = (id) => {
     const { setting, search, hasReqFields, loadCustomApi } = this.state
 
     let searches = fromJS(search).toJS()
@@ -356,17 +368,17 @@
 
       this.loadOutResource(searches)
       if (setting.execType === 'async') {
-        this.loadmaindata()
+        this.loadmaindata(id)
       }
     } else {
-      this.loadmaindata()
+      this.loadmaindata(id)
     }
   }
 
   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({
@@ -480,15 +492,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'
@@ -500,7 +504,7 @@
         Sort: index + 1
       }))
 
-      if ((window.GLOB.systemType !== 'production' && options.sysType !== 'cloud') || window.debugger === true) {
+      if (window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')) {
         let sql = lines.map(item => (`
           ${item.insert}
           ${item.selects.join(` union all
@@ -534,7 +538,7 @@
   /**
    * @description 瀛愯〃鏁版嵁鍔犺浇
    */
-  async loadmaindata () {
+  async loadmaindata (id) {
     const { BID } = this.props
     const { setting, arr_field, search, orderBy, pageIndex, pageSize, absFields } = this.state
 
@@ -545,7 +549,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)
 
@@ -557,9 +561,9 @@
         start = pageSize * (pageIndex - 1) + 1
       }
 
-      if (setting.selected !== 'false') {
+      if (setting.selected !== 'false' || (setting.orisel && id)) {
         setTimeout(() => {
-          MKEmitter.emit('mkTableCheckTopLine', this.props.MenuID)
+          MKEmitter.emit('mkTableCheckTopLine', this.props.MenuID, id)
         }, 200)
         if (setting.selected === 'init') {
           this.setState({setting: {...setting, selected: 'false'}})
@@ -578,6 +582,7 @@
           }
           item.key = index
           item.$$uuid = item[setting.primaryKey] || ''
+          item.$$key = '' + item.key + item.$$uuid
           item.$$BID = BID || ''
           item.$Index = start + index + ''
 
@@ -614,7 +619,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) {
@@ -663,7 +668,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) {
@@ -688,6 +693,7 @@
           data = data.map(item => {
             if (item.$$uuid === _data.$$uuid) {
               _data.key = item.key
+              _data.$$key = '' + item.key + item.$$uuid
               _data.$Index = item.$Index
               return _data
             } else {
@@ -760,17 +766,17 @@
   /**
    * @description 琛ㄦ牸鍒锋柊
    */
-  reloadtable = (btn) => {
+  reloadtable = (btn, id) => {
     if (!btn || btn.resetPageIndex !== 'false') {
       MKEmitter.emit('resetTable', this.props.Tab.uuid) // 鍒楄〃閲嶇疆
       this.setState({
         pageIndex: 1
       }, () => {
-        this.loadData()
+        this.loadData(id)
       })
     } else {
       MKEmitter.emit('resetTable', this.props.Tab.uuid, 'false') // 鍒楄〃閲嶇疆
-      this.loadData()
+      this.loadData(id)
     }
     
   }
@@ -785,13 +791,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,
@@ -805,7 +811,7 @@
    * @param {*} position   // 鍒锋柊浣嶇疆
    * @param {*} btn        // 鎵ц鐨勬寜閽�
    */
-  refreshByButtonResult = (menuId, position, btn, id, lines) => {
+  refreshByButtonResult = (menuId, position, btn, id = '', lines) => {
     const { MenuID } = this.props
 
     if (MenuID !== menuId) return
@@ -813,7 +819,7 @@
     if (position === 'line' && lines && lines.length === 1) {
       this.loadmainLinedata(lines[0].$$uuid)
     } else {
-      this.reloadtable(btn)
+      this.reloadtable(btn, id)
     }
     MKEmitter.emit('refreshPopButton', this.props.Tab.uuid)
   }
@@ -850,7 +856,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
@@ -887,9 +893,7 @@
 
 const mapStateToProps = (state) => {
   return {
-    menuType: state.editLevel,
-    permAction: state.permAction,
-    memberLevel: state.memberLevel
+    permAction: state.permAction
   }
 }
 

--
Gitblit v1.8.0