From 95f2f60ba9eb343c2605e1ae68c221443d75f704 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 30 十一月 2019 00:55:07 +0800
Subject: [PATCH] commontable-update

---
 src/templates/comtableconfig/index.jsx |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index 7129967..ada6e79 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -600,6 +600,20 @@
         },
         {
           type: 'select',
+          key: 'method',
+          label: this.state.dict['header.form.request.method'],
+          initVal: card.method || 'POST',
+          required: true,
+          options: [{
+            MenuID: 'POST',
+            text: 'POST'
+          }, {
+            MenuID: 'GET',
+            text: 'GET'
+          }]
+        },
+        {
+          type: 'select',
           key: 'icon',
           label: this.state.dict['header.form.icon'],
           initVal: card.icon,
@@ -613,6 +627,13 @@
           initVal: card.class,
           required: false,
           options: []
+        },
+        {
+          type: 'textarea',
+          key: 'sql',
+          label: this.state.dict['header.form.datasource'],
+          initVal: card.sql || '',
+          required: false
         }
       ]
     })
@@ -713,6 +734,7 @@
   handleSubmit = () => {
     this.formRef.handleConfirm().then(res => {
       let _config = this.state.config
+      let isupdate = false
 
       if (res.type === 'search') {
         if ((res.values.type === 'select' || res.values.type === 'link') && res.values.resourceType === '1') {
@@ -727,6 +749,7 @@
       if (this.state.operaType === 'add') {
         _config[res.type] = _config[res.type].map(item => {
           if (item.uuid === res.values.uuid) {
+            isupdate = true
             return res.values
           } else {
             return item
@@ -736,11 +759,16 @@
       } else {
         _config[res.type] = _config[res.type].map(item => {
           if (item.uuid === res.values.uuid) {
+            isupdate = true
             return res.values
           } else {
             return item
           }
         })
+      }
+
+      if (!isupdate) { // 鎿嶄綔涓嶆槸淇敼锛屾坊鍔犲厓绱犺嚦鍒楄〃
+        _config[res.type].push(res.values)
       }
 
       this.setState({
@@ -1443,6 +1471,7 @@
                     placeholder={this.state.dict['header.form.action.placeholder']}
                     handleList={this.handleList}
                     handleMenu={this.handleAction}
+                    copyElement={this.handleAction}
                   /> : null
                 }
               </div>

--
Gitblit v1.8.0