From c0930736f5b5955efecdac4c0ca85957d4f7b574 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 16 十二月 2019 22:55:17 +0800
Subject: [PATCH] 2019-12-16

---
 src/templates/modalconfig/index.jsx |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx
index 0b30439..cf0a7cb 100644
--- a/src/templates/modalconfig/index.jsx
+++ b/src/templates/modalconfig/index.jsx
@@ -75,6 +75,11 @@
       _config.setting.title = editAction.label
     }
 
+    if (menu.LongParam.tables && menu.LongParam.tables.length > 0 && _config.tables.length === 0) {
+      // 涓昏彍鍗曞凡鏈夐�夋嫨鐨勮〃鍚嶏紝妯℃�佹娌℃湁琛ㄥ悕鏃讹紝澶嶅埗涓昏彍鍗曡〃鍚�
+      _config.tables = menu.LongParam.tables
+    }
+
     this.setState({
       config: _config,
       selectedTables: _config.tables || [],
@@ -483,10 +488,14 @@
       let _config = JSON.parse(JSON.stringify(this.state.config))
 
       if ((res.type === 'select' || res.type === 'link') && res.resourceType === '1') {
-        let sql = 'select ' + res.valueField + ',' + res.valueText + ' from (' + res.dataSource + ')'
-        if (res.orderBy) {
-          sql = sql + ' ld order by ' + res.orderBy + ' ' + res.orderType
+        let sql = 'select ' + res.valueField + ',' + res.valueText + ' from ' + res.dataSource
+        if (res.type === 'link') {
+          sql = 'select ' + res.valueField + ',' + res.valueText + ',' + res.linkField + ' from ' + res.dataSource
         }
+        if (res.orderBy) {
+          sql = sql + ' order by ' + res.orderBy + ' ' + res.orderType
+        }
+        console.log(sql)
         res.dataSourceSql = Utils.formatOptions(sql)
       }
 

--
Gitblit v1.8.0