From af02b8f3c3ec9e5684be1084904d673429421d2b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 03 九月 2020 16:40:47 +0800
Subject: [PATCH] 2020-09-03

---
 src/tabviews/treepage/index.jsx |  153 +++++++++------------------------------------------
 1 files changed, 27 insertions(+), 126 deletions(-)

diff --git a/src/tabviews/treepage/index.jsx b/src/tabviews/treepage/index.jsx
index 3420fa2..0194697 100644
--- a/src/tabviews/treepage/index.jsx
+++ b/src/tabviews/treepage/index.jsx
@@ -3,13 +3,13 @@
 import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
 import { notification, Spin, Tabs, Icon, Modal, Button, message, Tree, Typography, Row, Col, Card, Input, Empty } from 'antd'
-import moment from 'moment'
 
 import Api from '@/api'
 import options from '@/store/options.js'
 import zhCN from '@/locales/zh-CN/main.js'
 import enUS from '@/locales/en-US/main.js'
 import Utils from '@/utils/utils.js'
+import UtilsDM from '@/utils/utils-datamanage.js'
 import asyncComponent from '@/utils/asyncComponent'
 import asyncSpinComponent from '@/utils/asyncSpinComponent'
 import {refreshTabView, modifyTabview} from '@/store/action'
@@ -141,6 +141,30 @@
         }
       })
 
+      // 鏁版嵁婧愪俊鎭澶勭悊
+      config.setting.laypage = false                                  // 鏄惁鍒嗛〉锛岃浆涓篵oolean 缁熶竴鏍煎紡
+      config.setting.execute = config.setting.default !== 'false'     // 榛樿sql鏄惁鎵ц锛岃浆涓篵oolean 缁熶竴鏍煎紡
+      config.setting.customScript = config.setting.customScript || '' // 鑷畾涔夎剼鏈�
+
+      if (!config.setting.execute) { // 榛樿sql 涓嶆墽琛屾椂 缃┖
+        config.setting.dataresource = ''
+      } else {
+        config.setting.dataresource = config.setting.dataresource || ''
+      }
+      if (/\s/.test(config.setting.dataresource)) {
+        config.setting.dataresource = '(' + config.setting.dataresource + ') tb'
+      }
+
+      if (this.props.dataManager) { // 鏁版嵁鏉冮檺
+        config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*')
+        config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/')
+        config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*')
+        config.setting.customScript = config.setting.customScript.replace(/@\$/ig, '*/')
+      } else {
+        config.setting.dataresource = config.setting.dataresource.replace(/@\$|\$@/ig, '')
+        config.setting.customScript = config.setting.customScript.replace(/@\$|\$@/ig, '')
+      }
+
       this.setState({
         BID: param && param.BID ? param.BID : '',
         loadingview: false,
@@ -247,26 +271,13 @@
    */ 
   async loadmaindata () {
     const { setting, searchKey, BID } = this.state
-    let param = ''
 
     this.setState({
       loading: true
     })
 
-    if (setting.interType !== 'inner' || (setting.interType === 'inner' && setting.innerFunc)) {
-      param = this.getCustomParam()
-    } else {
-      param = this.getDefaultParam()
-    }
-
-    if (BID) {
-      param.BID = BID
-    }
-
-    // 鏁版嵁绠$悊鏉冮檺
-    if (this.props.dataManager) {
-      param.dataM = 'Y'
-    }
+    let arr_field = `${setting.valueField},${setting.labelField},${setting.parentField}`
+    let param = UtilsDM.getQueryDataParams(setting, setting.customScript, arr_field, [], setting.order, '', '', BID, this.props.menuType, this.props.dataManager)
 
     let result = await Api.genericInterface(param)
     if (result.status) {
@@ -445,116 +456,6 @@
         selectedKeys: [_data.key]
       })
     }
-  }
-
-  /**
-   * @description 鑾峰彇鐢ㄦ埛鑷畾涔夊瓨鍌ㄨ繃绋嬩紶鍙�
-   */
-  getCustomParam = () => {
-    const { setting } = this.state
-
-    let param = {
-      OrderCol: setting.order
-    }
-
-    if (setting.interType === 'inner') {
-      param.func = setting.innerFunc
-    } else {
-      if (this.props.menuType === 'HS') {
-        if (setting.sysInterface === 'true' && options.cloudServiceApi) {
-          param.rduri = options.cloudServiceApi
-        } else if (setting.sysInterface !== 'true') {
-          param.rduri = setting.interface
-        }
-      } else {
-        if (setting.sysInterface === 'true' && window.GLOB.mainSystemApi) {
-          param.rduri = window.GLOB.mainSystemApi
-        } else if (setting.sysInterface !== 'true') {
-          param.rduri = setting.interface
-        }
-      }
-
-      if (setting.outerFunc) {
-        param.func = setting.outerFunc
-      }
-    }
-
-    return param
-  }
-
-  /**
-   * @description 鑾峰彇绯荤粺瀛樺偍杩囩▼ sPC_Get_TableData 鐨勫弬鏁�
-   */
-  getDefaultParam = () => {
-    const { setting } = this.state
-
-    let arr_field = `${setting.valueField},${setting.labelField},${setting.parentField}`
-    
-    let param = {
-      func: 'sPC_Get_TableData',
-      obj_name: 'data',
-      arr_field: arr_field,
-      custom_script: setting.customScript || '',
-      default_sql: setting.default || 'true'
-    }
-    
-    let _dataresource = setting.dataresource
-
-    if (/\s/.test(_dataresource)) {
-      _dataresource = '(' + _dataresource + ') tb'
-    }
-
-    if (this.props.dataManager) { // 鏁版嵁鏉冮檺
-      _dataresource = _dataresource.replace(/\$@/ig, '/*')
-      _dataresource = _dataresource.replace(/@\$/ig, '*/')
-      param.custom_script = param.custom_script.replace(/\$@/ig, '/*')
-      param.custom_script = param.custom_script.replace(/@\$/ig, '*/')
-    } else {
-      _dataresource = _dataresource.replace(/@\$|\$@/ig, '')
-      param.custom_script = param.custom_script.replace(/@\$|\$@/ig, '')
-    }
-
-    let LText = ''
-
-    if (setting.default !== 'false') {
-      LText = ` select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() over(order by ${setting.order}) as rows from ${_dataresource}) tmptable order by tmptable.rows `
-    }
-
-    if (param.custom_script) {
-      param.custom_script = param.custom_script.replace(/@orderBy@/ig, setting.order)
-
-      if (LText) {
-        LText += `
-          aaa:
-          if @ErrorCode!=''
-            insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@ 
-        `
-      } else {
-        param.custom_script += `
-          aaa:
-          if @ErrorCode!=''
-            insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,@UserID@
-        `
-      }
-    }
-    
-    // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞
-    if ((options.sysType === 'local' && !window.GLOB.systemType) || window.debugger === true) {
-      param.custom_script &&  console.log(`${LText ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${param.custom_script}`)
-      LText &&  console.log(LText)
-    }
-    
-    param.custom_script = Utils.formatOptions(param.custom_script)
-    param.LText = Utils.formatOptions(LText)
-    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
-    param.secretkey = Utils.encrypt(param.LText, param.timestamp)
-    param.DateCount = ''
-
-    if (this.props.menuType === 'HS') { // 浜戠鏁版嵁楠岃瘉
-      param.open_key = Utils.encrypt(param.secretkey, param.timestamp, true)
-    }
-
-    return param
   }
 
   /**

--
Gitblit v1.8.0