From 4e1ff4a312e5c5655de7c2ba611bab70415f3eda Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 10 三月 2020 18:20:35 +0800
Subject: [PATCH] 2020-03-10

---
 src/tabviews/tableshare/verifycard/index.jsx            |   10 
 src/templates/comtableconfig/actionform/index.jsx       |    6 
 src/tabviews/tableshare/verifycard/actionform/index.jsx |    8 
 src/templates/subtableconfig/index.jsx                  |    9 
 src/tabviews/tableshare/actionList/index.jsx            |  626 ++++++++++++++++++++++++++++++++++++-----------
 src/templates/subtableconfig/actionform/index.jsx       |   79 +++++
 6 files changed, 570 insertions(+), 168 deletions(-)

diff --git a/src/tabviews/tableshare/actionList/index.jsx b/src/tabviews/tableshare/actionList/index.jsx
index 31c03eb..51cfdbe 100644
--- a/src/tabviews/tableshare/actionList/index.jsx
+++ b/src/tabviews/tableshare/actionList/index.jsx
@@ -218,11 +218,13 @@
   /**
    * @description 瑙﹀彂鎵撳嵃
    */
-  triggerPrint = (item, data, formdata) => {
-    console.log(item)
-    console.log(data)
-    console.log(formdata)
-    if (!item.verify || !item.verify.Template || !item.verify.linkUrl) {
+  triggerPrint = (btn, data, formlist = []) => {
+    let formdata = {}
+    formlist.forEach(_data => {
+      formdata[_data.key] = _data.value
+    })
+
+    if (!btn.verify || !btn.verify.Template || !btn.verify.linkUrl) {
       notification.warning({
         top: 92,
         message: '璇峰畬鍠勬墦鍗伴獙璇佷俊鎭紒',
@@ -231,160 +233,478 @@
       return
     }
 
+    let printlist = []
+    let templates = []
+
+    this.setState({loadingUuid: btn.uuid})
+
     new Promise(resolve => {
-      let param = {
-        func: 's_PrintTemplateMGetData',
-        Type: 'Y',
-        ID: item.verify.Template
-      }
+      if (btn.intertype === 'inner' && !btn.innerFunc) {
+        formdata.TemplateID = btn.verify.Template
+        templates.push(btn.verify.Template)
 
-      if (options.cloudServiceApi) {
-        param.rduri = options.cloudServiceApi.replace('dostars', 'dostar')
-      }
+        if (btn.Ot === 'notRequired') {
+          printlist.push(formdata)
+        } else {
+          printlist = data.map(cell => {
+            let _cell = {...cell, ...formdata}
 
-
-      Api.getLocalConfig(param).then(res => {
-        if (res.status) {
-          
-          if (!res.ConfigParam) {
-            notification.warning({
-              top: 92,
-              message: '鏈幏鍙栧埌鎵撳嵃妯℃澘淇℃伅锛�',
-              duration: 15
-            })
-            resolve(false)
-          } else {
-            let configParam = ''
-
-            try {
-              configParam = JSON.parse(window.decodeURIComponent(window.atob(res.ConfigParam)))
-            } catch (e) {
-              configParam = ''
-            }
-
-            if (!configParam) {
-              notification.warning({
-                top: 92,
-                message: '鎵撳嵃妯℃澘瑙f瀽閿欒锛�',
-                duration: 15
-              })
+            return _cell
+          })
+        }
+        resolve('getTemp')
+      } else {
+        this.getprintdata(btn, data, formdata, formlist).then(result => {
+          printlist = result.list.map(item => {
+            if (item.TemplateID) {
+              templates.push(item.TemplateID)
             } else {
-              resolve(configParam)
+              item.TemplateID = btn.verify.Template
             }
-          }
-        } else {
-          this.execError(res, item)
-          resolve(false)
-        }
-      })
-    }).then(res => {
-      console.log(res)
-      if (!res) return
+            return item
+          })
 
-      if (!socket || socket.readyState !== 1 || socket.url !== 'ws://' + item.verify.linkUrl) {
-        socket = new WebSocket('ws://' + item.verify.linkUrl)
-      }
-      // 鎵撳紑Socket
-      socket.onopen = () =>{
-        if (!item.printer) {
-          let request  = {
-            requestID: '',
-            version: '',
-            cmd: 'getPrinters'
-          }
-          socket.send(JSON.stringify(request))
-        } else {
-          let printdata = {
-            cmd: 'print',
-            requestID: '',
-            version: '',
-            task: {
-              taskID: '1',
-              preview: false,
-              printer: item.printer,
-              documents: [
-                {
-                  documentID: '9890000106027',
-                  contents: [
-                    {
-                      data: {
-                        barcode: '12345'
-                      },
-                      templateURL: '{"Version":"","Title":"1234","Author":"U000000001","Description":"","PrintTempNO":"","PageSetting":{"Width":210,"Height":297,"Left":"0","Right":"0","Top":"0","Bottom":"0","Landscape":false},"PageHeader":[],"ReportHeader":{"Control":[{"Name":"","Type":"barcode","Value":"","Field":"barcode","Left":71,"Top":32,"Width":52,"Height":26,"Rotate":0,"BorderSize":0.1,"BorderColor":"black","Align":"center","VerticalAlign":"middle","BackColor":"white","ForeColor":"black","BarcodeType":"code128","BarcodeWidth":31,"BarcodeHeight":10,"BarcodeLabel":true,"LabelSize":12}]},"ReportFooter":[],"PageFooter":[]}'
-                    }
-                  ]
-                }
-              ]
-            }
-          }
-
-          socket.send(JSON.stringify(printdata))
-        }
-      }
-      // 鐩戝惉娑堟伅
-      socket.onmessage = (event) => {
-        let data = JSON.parse(event.data)
-
-        if (data.defaultPrinter) {
-          let printdata = {
-            cmd: 'print',
-            requestID: '',
-            version: '',
-            task: {
-              taskID: '1',
-              preview: false,
-              printer: data.defaultPrinter,
-              documents: [
-                {
-                  documentID: '9890000106027',
-                  contents: [
-                    {
-                      data: {
-                        barcode: '12345'
-                      },
-                      templateURL: '{"Version":"","Title":"1234","Author":"U000000001","Description":"","PrintTempNO":"","PageSetting":{"Width":210,"Height":297,"Left":"0","Right":"0","Top":"0","Bottom":"0","Landscape":false},"PageHeader":[],"ReportHeader":{"Control":[{"Name":"","Type":"barcode","Value":"","Field":"barcode","Left":71,"Top":32,"Width":52,"Height":26,"Rotate":0,"BorderSize":0.1,"BorderColor":"black","Align":"center","VerticalAlign":"middle","BackColor":"white","ForeColor":"black","BarcodeType":"code128","BarcodeWidth":31,"BarcodeHeight":10,"BarcodeLabel":true,"LabelSize":12}]},"ReportFooter":[],"PageFooter":[]}'
-                    }
-                  ]
-                }
-              ]
-            }
-          }
-
-          socket.send(JSON.stringify(printdata))
-        }
-      }
-
-      socket.onerror = () => {
-        notification.warning({
-          top: 92,
-          message: '鏃犳硶杩炴帴鍒�:' + item.verify.linkUrl,
-          duration: 10
+          resolve(result.next)
         })
       }
-    })
+    }).then(res => {
+      if (!res) return
 
+      templates = Array.from(new Set(templates)) // 鍘婚噸
 
+      let deffers = templates.map(tempId => {
+        return new Promise(resolve => {
+          let param = {
+            func: 's_PrintTemplateMGetData',
+            Type: 'Y',
+            ID: tempId
+          }
     
-    // socket = new WebSocket('ws://127.0.0.1:13529')
+          if (options.cloudServiceApi) {
+            param.rduri = options.cloudServiceApi.replace('dostars', 'dostar')
+          }
+    
+          Api.getLocalConfig(param).then(result => {
+            result.tempId = tempId
+            resolve(result)
+          })
+        })
+      })
 
-    // // 鎵撳紑Socket
-    // socket.onopen = function(event) {
-    //     // 鐩戝惉娑堟伅
-    //     socket.onmessage = function(event)
-    //     {
-    //         //鍙栨墦鍗版満淇℃伅鐨勮繑鍥炴槸鍦ㄨ繖閲�,鎵�浠ョ涓�娆$殑鎵撳嵃姣旇緝楹荤儲,鐪嬫槸涓嶆槸鍙互鍦ㄨ皟鎵撳嵃鍓嶅厛鍒ゆ柇浣犳湁娌℃湁瀛樻墦鍗版満鍚�
-    //         //,娌℃湁灏辫皟getPrinters鏉ュ彇鎵撳嵃鏈哄幓璁剧疆,瑕佹槸璋冧簡鎵撳嵃鍐嶈皟鍙栨墦鍗版満,绗竴鏉℃墦鍗颁换鍔″氨瑕佸湪杩欓噷閲嶅彂,灏卞お楹荤儲浜�
-    //         //鎻愬墠鍙栨墦鍗版満灏卞彧鑳界敤127.0.0.1:13529鏉ュ彇,杩欎釜鍦板潃灏辫鍐欐浜�
-    //         console.log('Client received a message',event);
-    //     };
+      return Promise.all(deffers)
+    }).then(result => {
+      if (!result) return
 
-    //     // 鐩戝惉Socket鐨勫叧闂�
-    //     socket.onclose = function(event)
-    //     {
-    //         console.log('Client notified socket has closed',event);
-    //     };
+      let errorMsg = ''
+      let _temps = {}
 
-    // };
+      result.forEach(res => {
+        if (res.status && !errorMsg) {
+          let _temp = this.getPrintConfigParam(res)
+
+          if (_temp.error) {
+            errorMsg = {
+              ErrCode: 'N',
+              message: _temp.error,
+              ErrMesg: _temp.error,
+              status: false
+            }
+          } else {
+            _temps[res.tempId] = _temp.config
+          }
+        } else if (!errorMsg) {
+          errorMsg = res
+        }
+      })
+
+      if (!errorMsg) {
+        this.execPrint(btn, printlist, _temps)
+      } else {
+        this.execError(errorMsg, btn)
+      }
+    })
+  }
+
+  getprintdata = (btn, data, formdata, formlist) => {
+    const { setting } = this.props
+
+    let _list = []
+    return new Promise(resolve => {
+      let params = []
+      let param = {
+        BID: this.props.BID
+      }
+
+      if (btn.Ot === 'notRequired') {
+        let _param = { ...param, ...formdata }
+        params.push(_param)
+      } else if (btn.Ot === 'requiredSgl') {
+        param[setting.primaryKey] = data[0][setting.primaryKey]
+
+        let _param = { ...param, ...formdata }
+
+        params.push(_param)
+      } else if (btn.Ot === 'requiredOnce') {
+        let ids = data.map(d => { return d[setting.primaryKey]})
+        ids = ids.filter(Boolean)
+        ids = ids.join(',')
+
+        param[setting.primaryKey] = ids
+
+        let _param = { ...param, ...formdata }
+
+        params.push(_param)
+      } else if (btn.Ot === 'required') {
+        params = data.map((cell, index) => {
+          let _param = { ...param }
+          _param[setting.primaryKey] = cell[setting.primaryKey]
+
+          formlist.forEach(_data => {
+            if (index !== 0 && _data.readin && cell.hasOwnProperty(_data.key)) {
+              _param[_data.key] = cell[_data.key]
+            } else {
+              _param[_data.key] = _data.value
+            }
+          })
+          return _param
+        })
+      }
+
+      if (btn.intertype === 'inner') {
+        params = params.map(_param => {
+          _param.func = btn.innerFunc
+
+          return _param
+        })
+
+        if (params.length <= 20) {
+          let deffers = params.map(par => {
+            return new Promise(resolve => {
+              Api.genericInterface(par).then(res => {
+                resolve(res)
+              })
+            })
+          })
+          Promise.all(deffers).then(result => {
+            let errorMsg = ''
+            result.forEach(res => {
+              if (res.status) {
+                _list.push(res.data)
+              } else {
+                errorMsg = res
+              }
+            })
+            if (!errorMsg) {
+              resolve({next: 'getTemp', list: _list})
+            } else {
+              this.execError(errorMsg, btn)
+              resolve({next: false, list: _list})
+            }
+          })
+        } else {
+          this.printInnerLoopRequest(params, btn, _list, resolve)
+        }
+      } else {
+        this.printOuterLoopRequest(params, btn, _list, resolve)
+      }
+    })
+  }
+
+  /**
+   * @description 澶栭儴璇锋眰寰幆鎵ц
+   */
+  printOuterLoopRequest = (params, btn, _list, _resolve) => {
+    let param = params.shift()
+
+    new Promise(resolve => {
+      // 鍐呴儴璇锋眰
+      if (btn.innerFunc) {
+        param.func = btn.innerFunc
+        // 瀛樺湪鍐呴儴鍑芥暟鏃讹紝鏁版嵁棰勫鐞�
+        Api.genericInterface(param).then(res => {
+          if (res.status) {
+            delete res.ErrCode
+            delete res.ErrMesg
+            delete res.message
+            delete res.status
+
+            // 浣跨敤澶勭悊鍚庣殑鏁版嵁璋冪敤澶栭儴鎺ュ彛
+            resolve(res)
+          } else {
+            this.execError(res, btn)
+            resolve(false)
+            _resolve({next: false, list: _list})
+          }
+        })
+      } else {
+        resolve(param)
+      }
+    }).then(res => {
+      if (!res) return
+      // 澶栭儴璇锋眰
+
+      if (this.props.menuType === 'HS') {
+        if (btn.sysInterface === 'true' && options.cloudServiceApi) {
+          res.rduri = options.cloudServiceApi
+        } else if (btn.sysInterface !== 'true') {
+          res.rduri = btn.interface
+        }
+      } else {
+        if (btn.sysInterface === 'true') {
+          res.rduri = window.GLOB.mainSystemApi || window.GLOB.subSystemApi
+        } else {
+          res.rduri = btn.interface
+        }
+      }
+
+      if (btn.outerFunc) {
+        res.func = btn.outerFunc
+      }
+
+      res.appkey = window.GLOB.appkey || '' // 澶栭儴璇锋眰鏃讹紝缁熶竴娣诲姞appkey
+
+      return Api.genericInterface(res)
+    }).then(response => {
+      if (!response) return
+      // 鍥炶皟璇锋眰
+      if (response.status) {
+        // 涓�娆¤姹傛垚鍔燂紝杩涜涓嬩竴椤硅姹�
+        if (params.length === 0) {
+          _resolve({next: 'getTemp', list: _list})
+        } else {
+          this.printOuterLoopRequest(params, btn, _list, _resolve)
+        }
+      } else {
+        this.execError(response, btn)
+        _resolve({next: false, list: _list})
+      }
+    })
+  }
+
+  /**
+   * @description 鍐呴儴璇锋眰寰幆鎵ц
+   */
+  printInnerLoopRequest = (params, btn, _list, _resolve) => {
+    let param = params.shift()
+
+    Api.genericInterface(param).then(res => {
+      if (res.status) {
+        _list.push(res.data)
+
+        if (params.length === 0) {
+          _resolve({next: 'getTemp', list: _list})
+        } else {
+          this.printInnerLoopRequest(params, btn, _list, _resolve)
+        }
+      } else {
+        this.execError(res, btn)
+        _resolve({next: false, list: _list})
+      }
+    })
+  }
+
+  getPrintConfigParam = (res) => {
+    let error = ''
+    let configParam = ''
+    let _configparam = ''
+
+    if (!res.ConfigParam) {
+      error = '鏈幏鍙栧埌鎵撳嵃妯℃澘淇℃伅锛�'
+    } else {
+      try {
+        configParam = JSON.parse(window.decodeURIComponent(window.atob(res.ConfigParam)))
+      } catch (e) {
+        configParam = ''
+      }
+  
+      if (!configParam) {
+        error = '鎵撳嵃妯℃澘瑙f瀽閿欒锛�'
+      } else {
+        let control = configParam.elements.map(element => {
+          let item = {
+            Name: element.name || '',
+            Type: element.type,
+            Value: element.value || '',
+            Field: element.field || '',
+            Left: element.left,
+            Top: element.top,
+            Width: element.width,
+            Height: element.height,
+            Rotate: element.rotate,
+            BorderSize: element.borderSize / 10,
+            BorderColor: element.borderColor,
+            Align: element.align,
+            VerticalAlign: element.vertialAlign,
+            BackColor: element.background,
+            ForeColor: 'black'
+          }
+  
+          if (!item.Width || !item.Height) {
+            item.Type = 'line'
+            item.Value = ''
+            item.Field = ''
+            item.FontFamily = element.fontFamily || ''
+            item.FontSize = element.fontSize || ''
+            item.FontStyle = (!element.fontWeight || element.fontWeight === 'normal') ? 'regular' : element.fontWeight
+            item.Padding = 0
+            item.Trimming = ''
+          } else if (item.Type === 'image') {
+            item.ImageWidth = element.imgWidth
+            item.ImageHeight = element.imgHeight
+            item.Trimming = ''
+          } else if (item.Type === 'text') {
+            item.FontFamily = element.fontFamily
+            item.FontSize = element.fontSize
+            item.FontStyle = element.fontWeight === 'normal' ? 'regular' : element.fontWeight
+            item.Padding = element.padding / 2
+            item.Trimming = ''
+          } else if (item.Type === 'barcode') {
+            item.BarcodeType = element.barcodeType
+            item.BarcodeWidth = element.barcodeWidth
+            item.BarcodeHeight = element.barcodeHeight
+            item.BarcodeLabel = element.barcodeLabel
+            item.LabelSize = element.fontSize
+          } else if (item.Type === 'qrcode') {
+            item.Type = 'barcode'
+            item.BarcodeType = element.barcodeType
+            item.BarcodeWidth = element.qrcodeWidth
+            item.BarcodeHeight = element.qrcodeWidth
+            item.BarcodeLabel = false
+          }
+          return item
+        })
+  
+        _configparam = {
+          Version: '',
+          Title: configParam.name,
+          Author: sessionStorage.getItem('UserID'),
+          Description: configParam.remark,
+          PrintTempNO: configParam.PrintTempNO,
+          PageSetting: {
+            Width: configParam.width,
+            Height: configParam.height,
+            Left: '0',
+            Right: '0',
+            Top: '0',
+            Bottom: '0',
+            Landscape: false
+          },
+          PageHeader: [],
+          ReportHeader: {
+            Control: control
+          },
+          ReportFooter: [],
+          PageFooter: []
+        }
+      }
+    }
+
+    return {
+      error: error,
+      config: _configparam
+    }
+  }
+
+  execPrint = (item, list, template) => {
+    let printdata = {
+      cmd: 'print',
+      requestID: '',
+      version: '',
+      task: {
+        taskID: Utils.getuuid(),
+        preview: false,
+        printer: item.printer,
+        documents: list.map(cell => {
+          return {
+            documentID: Utils.getuuid(),
+            contents: [
+              {
+                data: cell,
+                templateURL: JSON.stringify(template[cell.TemplateID])
+              }
+            ]
+          }
+        })
+      }
+    }
+    console.log(JSON.stringify(printdata))
+    if (!socket || socket.readyState !== 1 || socket.url !== 'ws://' + item.verify.linkUrl) {
+      socket = new WebSocket('ws://' + item.verify.linkUrl)
+    } else {
+      if (!item.printer) {
+        let request  = {
+          requestID: '',
+          version: '',
+          cmd: 'getPrinters'
+        }
+        socket.send(JSON.stringify(request))
+      } else {
+        this.setState({loadingUuid: ''})
+        notification.success({
+          top: 92,
+          message: '鎵撳嵃璇锋眰宸插彂鍑恒��',
+          duration: 2
+        })
+        socket.send(JSON.stringify(printdata))
+      }
+    }
+    // 鎵撳紑Socket
+    socket.onopen = () =>{
+      if (!item.printer) {
+        let request  = {
+          requestID: '',
+          version: '',
+          cmd: 'getPrinters'
+        }
+        socket.send(JSON.stringify(request))
+      } else {
+        this.setState({loadingUuid: ''})
+        notification.success({
+          top: 92,
+          message: '鎵撳嵃璇锋眰宸插彂鍑恒��',
+          duration: 2
+        })
+        socket.send(JSON.stringify(printdata))
+      }
+    }
+    // 鐩戝惉娑堟伅
+    socket.onmessage = (event) => {
+      let data = ''
+
+      if (event.data) {
+        try {
+          data = JSON.parse(event.data)
+        } catch {
+          notification.warning({
+            top: 92,
+            message: event.data,
+            duration: 10
+          })
+          this.setState({loadingUuid: ''})
+          data = ''
+        }
+      }
+
+      if (data && data.defaultPrinter) {
+        printdata.task.printer = data.defaultPrinter
+        this.setState({loadingUuid: ''})
+        notification.success({
+          top: 92,
+          message: '鎵撳嵃璇锋眰宸插彂鍑恒��',
+          duration: 2
+        })
+        socket.send(JSON.stringify(printdata))
+      }
+    }
+
+    socket.onerror = () => {
+      notification.warning({
+        top: 92,
+        message: '鏃犳硶杩炴帴鍒�:' + item.verify.linkUrl,
+        duration: 10
+      })
+      this.setState({loadingUuid: ''})
+    }
   }
 
   /**
@@ -878,11 +1198,11 @@
       this.setState({
         visible: false
       })
-    } else if (btn.OpenType === 'excelOut' || btn.OpenType === 'excelIn') { // 瀵煎嚭excel
-      this.setState({
-        loadingUuid: ''
-      })
     }
+
+    this.setState({
+      loadingUuid: ''
+    })
 
     this.refreshdata(btn, 'success')
   }
@@ -915,11 +1235,9 @@
       message.error(res.message || res.ErrMesg)
     }
     
-    if (btn.OpenType === 'excelOut' || btn.OpenType === 'excelIn') {
-      this.setState({
-        loadingUuid: ''
-      })
-    }
+    this.setState({
+      loadingUuid: ''
+    })
     
     this.refreshdata(btn, 'error')
   }
diff --git a/src/tabviews/tableshare/verifycard/actionform/index.jsx b/src/tabviews/tableshare/verifycard/actionform/index.jsx
index b1297b6..a3fb165 100644
--- a/src/tabviews/tableshare/verifycard/actionform/index.jsx
+++ b/src/tabviews/tableshare/verifycard/actionform/index.jsx
@@ -60,6 +60,14 @@
   shortcutChange = (value) => {
     this.setState({
       shortcut: value
+    }, () => {
+      let shortkey = this.props.form.getFieldValue('shortcutkey')
+
+      if (shortkey && ((value === 'alt' && shortkey === 65) || (value === 'ctrl' && (shortkey === 67 || shortkey === 86))) ) {
+        this.props.form.setFieldsValue({
+          shortcutkey: ''
+        })
+      }
     })
   }
 
diff --git a/src/tabviews/tableshare/verifycard/index.jsx b/src/tabviews/tableshare/verifycard/index.jsx
index 5e06ffc..b46a5a6 100644
--- a/src/tabviews/tableshare/verifycard/index.jsx
+++ b/src/tabviews/tableshare/verifycard/index.jsx
@@ -130,8 +130,14 @@
         }
         // 鐩戝惉娑堟伅
         socket.onmessage = (event) => {
-          let data = JSON.parse(event.data)
-          if (data.defaultPrinter) {
+          let data = ''
+          try {
+            data = JSON.parse(event.data)
+          } catch {
+            data = ''
+          }
+
+          if (data && data.defaultPrinter) {
             let printers = Array.from(new Set(data.printers))
             
             let _config = JSON.parse(JSON.stringify(this.state.config))
diff --git a/src/templates/comtableconfig/actionform/index.jsx b/src/templates/comtableconfig/actionform/index.jsx
index 92a7802..1c42a0e 100644
--- a/src/templates/comtableconfig/actionform/index.jsx
+++ b/src/templates/comtableconfig/actionform/index.jsx
@@ -603,9 +603,11 @@
             values.Ot = 'notRequired'
           } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d
             values.linkTab = Utils.getuuid()
-          } else if (values.OpenType === 'funcbutton' && values.funcType === 'print') { // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡
-            values.OpenType = values.execMode
+          } else if (values.OpenType === 'funcbutton') { // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡
             values.position = 'toolbar'
+            if (values.funcType === 'print') {
+              values.OpenType = values.execMode
+            }
           }
 
           if (values.innerFunc === '' && values.sql === '') {
diff --git a/src/templates/subtableconfig/actionform/index.jsx b/src/templates/subtableconfig/actionform/index.jsx
index 1e1c9e9..6075f12 100644
--- a/src/templates/subtableconfig/actionform/index.jsx
+++ b/src/templates/subtableconfig/actionform/index.jsx
@@ -21,6 +21,7 @@
     formlist: null,
     openType: null,
     interType: null,
+    funcType: null,  // 鍔熻兘绫诲瀷
     position: null,
     reqOptionSgl: [{
       value: 'requiredSgl',
@@ -90,17 +91,24 @@
     let _intertype = ''
     let _position = ''
     let _tabType = ''
+    let _funcType = ''   // 鍔熻兘鎸夐挳绫诲瀷
     let _options = null
 
     this.props.formlist.forEach(form => {
       if (form.key === 'OpenType') {
-        _opentype = form.initVal
+        if (this.props.card.execMode) { // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡
+          _opentype = 'funcbutton'
+        } else {
+          _opentype = form.initVal
+        }
       } else if (form.key === 'intertype') {
         _intertype = form.initVal
       } else if (form.key === 'position') {
         _position = form.initVal
       } else if (form.key === 'tabType') {
         _tabType = form.initVal
+      } else if (form.key === 'funcType') {
+        _funcType = form.initVal
       }
     })
 
@@ -120,6 +128,18 @@
       } else {
         _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
       }
+    } else if (_opentype === 'funcbutton') {
+      if (!_funcType) {
+        _options = ['label', 'OpenType', 'funcType', 'icon', 'class']
+      } else if (_funcType === 'changeuser') {
+        _options = ['label', 'OpenType', 'funcType', 'icon', 'class']
+      } else if (_funcType === 'print') {
+        if (_intertype === 'outer') {
+          _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError']
+        } else {
+          _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError']
+        }
+      }
     } else {
       if (_intertype === 'outer') {
         _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError']
@@ -131,6 +151,7 @@
       openType: _opentype,
       interType: _intertype,
       position: _position,
+      funcType: _funcType,
       formlist: this.props.formlist.map(item => {
         if (item.key === 'class') {
           item.options = btnClasses
@@ -176,8 +197,12 @@
             }, {
               value: 'popview',
               text: this.props.dict['header.form.popview']
+            }, {
+              value: 'funcbutton',
+              text: this.props.dict['header.form.funcbutton']
             }
           ]
+          item.initVal = _opentype
         } else if (item.key === 'execSuccess') {
           item.options = this.state.closeOptions
         } else if (item.key === 'execError') {
@@ -224,6 +249,18 @@
         } else {
           _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
         }
+      } else if (value === 'funcbutton') {
+        if (!this.state.funcType) {
+          _options = ['label', 'OpenType', 'funcType', 'icon', 'class']
+        } else if (this.state.funcType === 'changeuser') {
+          _options = ['label', 'OpenType', 'funcType', 'icon', 'class']
+        } else if (this.state.funcType === 'print') {
+          if (this.state.interType === 'outer') {
+            _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError']
+          } else {
+            _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError']
+          }
+        }
       } else {
         if (this.state.interType === 'inner') {
           _options = ['label', 'position', 'OpenType', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError', 'sql', 'sqlType']
@@ -268,7 +305,7 @@
 
         this.setState({
           formlist: this.state.formlist.map(item => {
-            if (item.key === 'Ot') {
+            if (item.key === 'Ot' && !(value === 'funcbutton' && (!this.state.funcType || this.state.funcType === 'changeuser'))) {
               item.hidden = false
             } else if (item.key === 'sqlType' && ['prompt', 'exec', 'pop'].includes(value) && this.state.interType === 'inner') {
               item.hidden = false
@@ -332,6 +369,33 @@
           })
         })
       })
+    } else if (key === 'funcType') {
+      let _options = null
+      if (!value) {
+        _options = ['label', 'OpenType', 'funcType', 'icon', 'class']
+      } else if (value === 'changeuser') {
+        _options = ['label', 'OpenType', 'funcType', 'icon', 'class']
+      } else if (value === 'print') {
+        if (this.state.interType === 'outer') {
+          _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError']
+        } else {
+          _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError']
+        }
+      }
+
+      this.setState({
+        formlist: this.state.formlist.map(item => {
+          item.hidden = !_options.includes(item.key)
+
+          if (item.hidden) return item
+
+          if (item.key === 'Ot' && value === 'print') {
+            item.options = this.state.reqOptionsMutil
+          }
+
+          return item
+        })
+      })
     }
   }
 
@@ -352,6 +416,12 @@
           _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'callbackFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
         } else {
           _options = ['label', 'Ot', 'OpenType', 'intertype', 'innerFunc', 'icon', 'class', 'sheet', 'execSuccess', 'execError']
+        }
+      } else if (openType === 'funcbutton') {
+        if (value === 'outer') {
+          _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'sysInterface', 'interface', 'outerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError']
+        } else {
+          _options = ['label', 'OpenType', 'funcType', 'execMode', 'intertype', 'innerFunc', 'Ot', 'icon', 'class', 'execSuccess', 'execError']
         }
       } else {
         if (value === 'inner') {
@@ -571,6 +641,11 @@
             values.Ot = 'notRequired'
           } else if (values.OpenType === 'popview' && !values.linkTab) { // 娌℃湁鍏宠仈鏍囩锛堟柊寤烘椂锛夛紝鍒涘缓鏂版爣绛綢d
             values.linkTab = Utils.getuuid()
+          } else if (values.OpenType === 'funcbutton') { // 杞崲鎵撳嵃鏃舵墦寮�鏂瑰紡
+            values.position = 'toolbar'
+            if (values.funcType === 'print') {
+              values.OpenType = values.execMode
+            }
           }
 
           if (values.innerFunc === '' && values.sql === '') {
diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index 6cc9aab..1de6f80 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -2370,14 +2370,6 @@
                     <Icon type="unlock" />
                   </div>
                 </div>
-                {configAction.length > 0 ?
-                  <p className="config-btn-title">
-                    <Tooltip placement="topLeft" title="鐐瑰嚮鎸夐挳锛屽彲瀹屾垚鎴栨煡鐪嬫寜閽厤缃俊鎭��">
-                      <Icon type="question-circle" />
-                    </Tooltip>
-                    {this.state.dict['header.menu.action.configurable']}
-                  </p> : null
-                }
                 {configAction.map((item, index) => {
                   return (
                     <div key={index}>
@@ -2434,6 +2426,7 @@
                 <DragElement
                   type="action"
                   list={this.state.config.action}
+                  setting={this.state.config.setting}
                   handleList={this.handleList}
                   handleMenu={this.handleAction}
                   copyElement={(val) => this.handleAction(val, 'copy')}

--
Gitblit v1.8.0