From ba7c54e0029456e6b1bf7f0e0d31af69a3d74db3 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 02 三月 2020 15:34:51 +0800
Subject: [PATCH] 2020-03-02

---
 src/tabviews/formtab/index.jsx |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx
index 9d11941..1ffd69f 100644
--- a/src/tabviews/formtab/index.jsx
+++ b/src/tabviews/formtab/index.jsx
@@ -120,13 +120,13 @@
         primaryId: this.props.param.primaryId || '',
         data: this.props.param.data || null,
         BIDs: {
-          mainTable: config.setting.onload === 'true' ? (this.props.param.primaryId || '') : '',
-          mainTabledata: config.setting.onload === 'true' ? (config.setting.datatype === 'query' ? '' : this.props.param.data) : ''
+          mainTable: config.setting.onload !== 'false' ? (this.props.param.primaryId || '') : '',
+          mainTabledata: config.setting.onload !== 'false' ? (config.setting.datatype === 'query' ? '' : this.props.param.data) : ''
         }
       }, () => {
         this.improveSelectOption(config.groups)
 
-        if (config.setting.datatype === 'query' && config.setting.onload === 'true') {
+        if (config.setting.datatype === 'query' && config.setting.onload !== 'false') {
           if (!this.props.param.primaryId) {
             notification.warning({
               top: 92,
@@ -378,7 +378,8 @@
       func: 'sPC_Get_TableData',
       obj_name: 'data',
       arr_field: arr_field,
-      appkey: window.GLOB.appkey || ''
+      appkey: window.GLOB.appkey || '',
+      ID: primaryId
     }
     
     let _dataresource = setting.dataresource
@@ -387,7 +388,11 @@
       _dataresource = '(' + _dataresource + ') tb'
     }
 
-    let LText = `select ${arr_field} from (select ${arr_field} ,ROW_NUMBER() from ${_dataresource}) tmptable where ${setting.primaryKey}=${primaryId}`
+    if (!/@ID@/ig.test(_dataresource)) {
+      _dataresource = `${_dataresource} where ${setting.primaryKey}='${primaryId}'`
+    }
+
+    let LText = `select ${arr_field} from ${_dataresource}`
 
     param.LText = Utils.formatOptions(LText)
     param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'

--
Gitblit v1.8.0