From 910e22f4bccbe5e5d8951398bd53a7d6d636b852 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 16 十月 2019 11:42:37 +0800
Subject: [PATCH] complete-datamanage

---
 src/tabviews/datamanage/modules/action/index.jsx |   84 +++++++++++++++++++++--------------------
 1 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/src/tabviews/datamanage/modules/action/index.jsx b/src/tabviews/datamanage/modules/action/index.jsx
index 84b092d..83dfd8f 100644
--- a/src/tabviews/datamanage/modules/action/index.jsx
+++ b/src/tabviews/datamanage/modules/action/index.jsx
@@ -157,9 +157,8 @@
                     top: 92,
                     message: _this.props.dict['main.action.confirm.success']
                   })
-                  if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
-                    _this.props.refreshdata(item.ReloadForm)
-                  }
+
+                  _this.props.refreshdata(item.ReloadForm) // 鍒锋柊椤甸潰
                 }
               } else {
                 if (res.status) {
@@ -167,9 +166,8 @@
                     top: 92,
                     message: _this.props.dict['main.action.confirm.success']
                   })
-                  if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
-                    _this.props.refreshdata(item.ReloadForm)
-                  }
+                  
+                  _this.props.refreshdata(item.ReloadForm) // 鍒锋柊椤甸潰
                 } else {
                   notification.error({
                     top: 92,
@@ -202,9 +200,8 @@
                 top: 92,
                 message: this.props.dict['main.action.confirm.success']
               })
-              if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
-                this.props.refreshdata(item.ReloadForm)
-              }
+
+              this.props.refreshdata(item.ReloadForm) // 鍒锋柊椤甸潰
             }
           } else {
             if (res.status) {
@@ -212,9 +209,8 @@
                 top: 92,
                 message: this.props.dict['main.action.confirm.success']
               })
-              if (item.ReloadForm && item.ReloadForm !== 'false' && item.ReloadForm !== 'singlegrid') {
-                this.props.refreshdata(item.ReloadForm)
-              }
+              
+              this.props.refreshdata(item.ReloadForm) // 鍒锋柊椤甸潰
             } else {
               notification.error({
                 top: 92,
@@ -227,7 +223,7 @@
     } else if (item.OpenType === 'newpage') { // 鎵撳紑鏂伴〉闈�
       let src = '#/' + item.LinkUrl + '?param=' + window.btoa(JSON.stringify({UserId: sessionStorage.getItem('UserID'), ID: datalist[0][ID[0]], BID: BID.length === 1 ? datalist[0][BID[0]] : ''}))
       window.open(src)
-    } else if (item.OpenType === 'pop') {
+    } else if (item.OpenType === 'pop') { // 妯℃�佹
       this.setState({
         formdata: this.props.columns.map(column => {
           column.readonly = false
@@ -242,7 +238,7 @@
         bidkey: BID.length === 1 ? BID[0] : '',
         tabledata: datalist[0] || ''
       })
-    } else if (item.OpenType === 'tab') {
+    } else if (item.OpenType === 'tab') { // 鎵撳紑鏂版爣绛鹃〉
       let menu = {
         MenuNo: this.props.MenuNo,
         MenuID: item.MenuID,
@@ -284,8 +280,21 @@
         tabs.splice(_index + 1, 0, menu)
       }
       this.props.modifyTabview(tabs)
-    } else if (item.OpenType === 'blank') {
-      this.props.switchview(item)
+    } else if (item.OpenType === 'blank') { // 褰撳墠椤甸潰璺宠浆
+      this.props.switchformview({
+        formdata: this.props.columns.map(column => {
+          column.readonly = false
+          if (column.ReadOnly.includes(item.MenuID)) {
+            column.readonly = true
+          }
+          return column
+        }),
+        execAction: item,
+        primarykey: ID[0],
+        bidkey: BID.length === 1 ? BID[0] : '',
+        tabledata: datalist[0] || '',
+        defaultproc: this.state.defaultproc
+      })
     } else {
       notification.warning({
         top: 92,
@@ -295,19 +304,8 @@
     }
   }
 
-  changemenu(e) {
-    let menu = {}
-    let tabs = JSON.parse(JSON.stringify(this.props.tabviews))
-    tabs = tabs.filter(tab => {
-      tab.selected = false
-      return tab.MenuID !== menu.MenuID
-    })
-    menu.selected = true
-    tabs.push(menu)
-    this.props.modifyTabview(tabs)
-  }
-
   getModels = () => {
+    // 鑾峰彇寮圭獥琛ㄥ崟淇℃伅
     if (!this.state.execAction) return
     let cols = +this.state.execAction.FormLineQty
     if (![1, 2, 3].includes(cols)) {
@@ -341,23 +339,31 @@
         confirmLoading: true
       })
       let values = []
+      // 浠庤〃鍗曚腑鑾峰彇濉啓鏁版嵁
       this.props.columns.forEach(column => {
         let value = ''
-        if (res[column.FieldName] || res[column.FieldName] === 0) { // 渚濇閫夊彇琛ㄥ崟鍊笺�佽〃鏍兼暟鎹�笺�佸垵濮嬪��
+        if (res.hasOwnProperty(column.FieldName)) { // 渚濇閫夊彇琛ㄥ崟鍊笺�佸垵濮嬪��
           value = res[column.FieldName]
-        } else if (this.state.tabledata && this.state.tabledata[column.FieldName]) {
-          value = this.state.tabledata[column.FieldName]
         } else if (column.InitVal) {
           value = column.InitVal
         }
         values.push(value)
       })
-      Api.submitInterface({
+
+      let queryparam = { // 璇锋眰鍙傛暟
         func: this.state.execAction.AuditProc || this.state.defaultproc[this.state.execAction.Action],
-        AddLongText: values.join(','), // 琛ㄥ崟鏁版嵁
         ID: (this.state.tabledata && this.state.primarykey) ? this.state.tabledata[this.state.primarykey] : '', // 涓婚敭瀛楁
         BID: (this.state.tabledata && this.state.bidkey) ? this.state.tabledata[this.state.bidkey] : '' // BID瀛楁
-      }).then(result => {
+      }
+      // 娣诲姞鍜屼慨鏀硅姹傚弬鏁板瓧娈典笉鍚�
+      if (this.state.execAction.Action === 'Add') {
+        queryparam.AddLongText = values.join(',')
+      } else if (this.state.execAction.Action === 'Update') {
+        queryparam.UptLongText = values.join(',')
+      }
+
+      // 鎻愪氦璇锋眰
+      Api.submitInterface(queryparam).then(result => {
         if (result.status) {
           notification.success({
             top: 92,
@@ -367,9 +373,8 @@
             confirmLoading: false,
             visible: false
           })
-          if (this.state.execAction.ReloadForm && this.state.execAction.ReloadForm !== 'false' && this.state.execAction.ReloadForm !== 'singlegrid') {
-            this.props.refreshdata(this.state.execAction.ReloadForm)
-          }
+
+          this.props.refreshdata(this.state.execAction.ReloadForm) // 鍒锋柊椤甸潰
         } else {
           this.setState({
             confirmLoading: false
@@ -385,15 +390,12 @@
   }
 
   handleCancel = () => {
+    // 鍙栨秷
     this.setState({
       confirmLoading: false,
       visible: false
     })
     this.formRef.handleReset()
-  }
-
-  UNSAFE_componentWillMount () {
-
   }
 
   render() {

--
Gitblit v1.8.0