From 72419e2f826031a158173f46d723a672064e37cd Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 31 八月 2021 22:42:51 +0800
Subject: [PATCH] 2021-08-31

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx |   44 +++++++++++++++++++++++++++++++++++---------
 1 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index ff40ea8..737abd4 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -3,7 +3,7 @@
 import moment from 'moment'
 import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
-import { Button, Modal, notification, message, Drawer } from 'antd'
+import { Button, Modal, notification, message, Drawer, Icon } from 'antd'
 
 import Api from '@/api'
 import Utils, { getSysDefaultSql } from '@/utils/utils.js'
@@ -70,9 +70,8 @@
   componentDidMount () {
     const { position } = this.props
 
-    if (position === 'toolbar') {
-      MKEmitter.addListener('triggerBtnId', this.actionTrigger)
-    } else if (position === 'form') {
+    MKEmitter.addListener('triggerBtnId', this.actionTrigger)
+    if (position === 'form') {
       MKEmitter.addListener('triggerFormSubmit', this.actionSubmit)
     }
     MKEmitter.addListener('returnModuleParam', this.resetModuleParam)
@@ -353,6 +352,9 @@
             param.$callbacksql = callbacksql
           } else {
             param.LText = getSysDefaultSql(btn, setting, formdata, param, data[0], columns, this.props.Tab, false, this.moduleParams, Utils.getAllSearchOptions) // 鏁版嵁婧�
+            if (btn.OpenType === 'formSubmit' && btn.output) {
+              param.key_back_type = 'Y'
+            }
           }
           
           if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺
@@ -866,7 +868,7 @@
     })
 
     Api.directRequest(url, btn.method, param, btn.cross).then(res => {
-      if (typeof(res) !== 'object' || Array.isArray(res)) {
+      if (typeof(res) !== 'object') {
         let error = '鏈煡鐨勮繑鍥炵粨鏋滐紒'
 
         if (typeof(res) === 'string') {
@@ -881,6 +883,9 @@
 
         this.customCallbackRequest(params, result, record, _resolve)
       } else {
+        if (Array.isArray(res)) {
+          res = { data: res }
+        }
         res.mk_api_key = mkey
         this.customCallbackRequest(params, res, record, _resolve)
       }
@@ -1290,8 +1295,13 @@
       this.sendMessage()
     }
 
+    let id = ''
+    if (btn.output) {
+      id = res.mk_b_id || res[btn.output] || ''
+    }
+
     if (btn.execSuccess !== 'never') {
-      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess || '', btn)
+      MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execSuccess, btn, id)
     }
   }
 
@@ -1721,7 +1731,7 @@
             BData={this.props.BData}
             wrappedComponentRef={(inst) => this.formRef = inst}
           />
-          <div style={{ position: 'absolute', right: 0, bottom: 0, width: '100%', borderTop: '1px solid #e9e9e9', padding: '10px 16px', background: '#fff', textAlign: 'right'}}>
+          <div style={{ position: 'absolute', zIndex: 1, right: 0, bottom: 0, width: '100%', borderTop: '1px solid #e9e9e9', padding: '10px 16px', background: '#fff', textAlign: 'right'}}>
             <Button onClick={this.handleCancel} style={{ marginRight: 8 }}>
               鍙栨秷
             </Button>
@@ -1797,6 +1807,22 @@
         {this.getModels()}
       </div>
     } else { // icon銆乼ext銆� all 鍗$墖
+      let label = ''
+      let icon = ''
+
+      if (show === 'button') {
+        label = btn.label
+        icon = btn.icon || ''
+      } else if (show === 'link') {
+        label = <span>{btn.label}{btn.icon ? <Icon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span>
+        icon = ''
+      } else if (show === 'icon') {
+        icon = btn.icon || ''
+      // } else if (show === 'text') {
+      } else {
+        label = btn.label
+      }
+
       return <div style={{display: 'inline-block'}} onClick={(e) => e.stopPropagation()}>
         <Button
           type="link"
@@ -1804,9 +1830,9 @@
           loading={loading}
           disabled={disabled}
           style={btn.style || style}
-          icon={show === 'text' ? '' : (btn.icon || '')}
+          icon={icon}
           onClick={() => {this.actionTrigger()}}
-        >{show === 'icon' && btn.icon ? '' : btn.label}</Button>
+        >{label}</Button>
         {this.getModels()}
       </div>
     }

--
Gitblit v1.8.0