From d32c4297cc47342f0a5229d5108cc7c26809f50f Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 25 七月 2024 13:23:36 +0800
Subject: [PATCH] Merge branch 'master' into positec

---
 src/tabviews/custom/components/card/cardcellList/index.jsx                        |   23 +++++
 package-lock.json                                                                 |    6 
 src/components/normalform/modalform/index.jsx                                     |   33 ++++++++
 src/menu/components/card/cardcellcomponent/index.jsx                              |    8 ++
 src/menu/components/card/data-card/options.jsx                                    |    5 
 src/menu/components/share/actioncomponent/dragaction/card.jsx                     |    2 
 src/menu/components/card/cardcellcomponent/dragaction/action.jsx                  |    2 
 src/tabviews/zshare/actionList/printbutton/index.jsx                              |    7 +
 src/menu/components/share/actioncomponent/actionform/index.jsx                    |    4 
 src/menu/components/form/formaction/index.jsx                                     |    2 
 src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx |   92 ++++++++++++++++------
 src/api/index.js                                                                  |   22 +++++
 src/tabviews/custom/components/card/cardcellList/index.scss                       |    2 
 src/tabviews/zshare/actionList/normalbutton/index.jsx                             |   24 ++++--
 14 files changed, 186 insertions(+), 46 deletions(-)

diff --git a/package-lock.json b/package-lock.json
index c560381..7e3b8fd 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -5508,9 +5508,9 @@
       }
     },
     "caniuse-lite": {
-      "version": "1.0.30001588",
-      "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001588.tgz",
-      "integrity": "sha512-+hVY9jE44uKLkH0SrUTqxjxqNTOWHsbnQDIKjwkZ3lNTzUUVdBLBGXtj/q5Mp5u98r3droaZAewQuEDzjQdZlQ=="
+      "version": "1.0.30001643",
+      "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001643.tgz",
+      "integrity": "sha512-ERgWGNleEilSrHM6iUz/zJNSQTP8Mr21wDWpdgvRwcTXGAq6jMtOUPP4dqFPTdKqZ2wKTdtB+uucZ3MRpAUSmg=="
     },
     "canvg": {
       "version": "3.0.10",
diff --git a/src/api/index.js b/src/api/index.js
index 5e93d05..78cdb4f 100644
--- a/src/api/index.js
+++ b/src/api/index.js
@@ -160,7 +160,27 @@
   /**
    * @description 鐩存帴璇锋眰
    */
-  directRequest (params) {
+  directRequest (params, script, position) {
+    if (script) {
+      try {
+        // eslint-disable-next-line
+        let func = new Function('axios', 'Api', 'param', 'position', 'systemType', 'notification', script)
+        let promise = func(axios, this, params, position, window.GLOB.systemType, notification)
+
+        if (promise instanceof Promise) {
+          return promise
+        }
+      } catch (e) {
+        console.warn(e)
+      }
+
+      return Promise.resolve({
+        status: false,
+        message: '鑷畾涔夎剼鏈墽琛岄敊璇�',
+        ErrCode: 'E'
+      })
+    }
+    
     return axios(params)
   }
 
diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx
index 59a1ea6..544716e 100644
--- a/src/components/normalform/modalform/index.jsx
+++ b/src/components/normalform/modalform/index.jsx
@@ -132,6 +132,9 @@
 
         let cell = fieldMap.get(item.field)
 
+        cell.$ctrls = cell.$ctrls || []
+        cell.$ctrls.push(key)
+
         if (cell.hidden) return
 
         if (cell.skip && supItem.forbid) { // 涓婄骇琛ㄥ崟绂佺敤鏃讹紝姝よ〃鍗曚笉鍙楁帶鍒�
@@ -161,6 +164,10 @@
 
     formlist = formlist.map(cell => {
       let item = fieldMap.get(cell.field)
+
+      if (item.$ctrls && item.$ctrls.length === 1) {
+        delete item.$ctrls
+      }
 
       if (item.linkField) {
         let supInitVal = fieldMap.get(item.linkField).initval || ''
@@ -230,6 +237,32 @@
             m.hidden = !cell.values.includes(val)
           }
 
+          if (!m.hidden && m.$ctrls) {
+            m.$ctrls.forEach(n => {
+              if (n === current.field || m.hidden) return
+
+              let oth = map.get(n)
+              let _val = this.record[n]
+
+              if (_val && JSON.stringify(_val) === '[]') {
+                _val = ''
+              }
+
+              let p = oth.controlFields.filter(q => q.field === m.field)[0]
+
+              if (oth.hidden || (p.notNull && !_val)) {
+                m.hidden = true
+              } else if (oth.type === 'checkbox' || oth.type === 'multiselect') {
+                let _vals = [...(_val || []), ...p.values]
+                if (_vals.length === new Set(_vals).size) {
+                  m.hidden = true
+                }
+              } else if (!p.values.includes(_val)) {
+                m.hidden = true
+              }
+            })
+          }
+
           if (m.hidden) {
             m.initval = this.record[m.field]
           }
diff --git a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx
index 44c1b19..729095c 100644
--- a/src/menu/components/card/cardcellcomponent/dragaction/action.jsx
+++ b/src/menu/components/card/cardcellcomponent/dragaction/action.jsx
@@ -102,7 +102,7 @@
         <CopyOutlined className="copy" title="澶嶅埗" onClick={() => copyCard(id)} />
         <CloseOutlined className="close" title="鍒犻櫎" onClick={() => delCard(id)} />
         <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => changeStyle(id)} />
-        {hasProfile ? <ProfileOutlined className="profile" title="setting" onClick={() => profileCard(id)} /> : null}
+        {hasProfile ? <ProfileOutlined className="profile" title="楠岃瘉淇℃伅" onClick={() => profileCard(id)} /> : null}
         {updateTime}
       </div>
     } trigger="hover">
diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx
index 5f5bbbf..5f36a3a 100644
--- a/src/menu/components/card/cardcellcomponent/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/index.jsx
@@ -393,6 +393,14 @@
         res.width = (res.width + '').replace(/.5/, 'x')
       }
 
+      if (res.eleType === 'formula' && res.eval === 'false' && res.noValue === 'hide') {
+        let keys = res.formula.match(/@[0-9a-z_]+@/ig)
+        if (keys) {
+          res.$keys = keys.map(key => key.slice(1, -1).toLowerCase())
+          res.$keys = Array.from(new Set(res.$keys))
+        }
+      }
+
       let _elements = elements.map(cell => {
         if (cell.uuid === res.uuid) {
           res.style = cell.style || {}
diff --git a/src/menu/components/card/data-card/options.jsx b/src/menu/components/card/data-card/options.jsx
index 6a799d2..1e59f01 100644
--- a/src/menu/components/card/data-card/options.jsx
+++ b/src/menu/components/card/data-card/options.jsx
@@ -645,20 +645,19 @@
         {value: 'true', label: '鍚敤'},
         {value: 'false', label: '绂佺敤'},
       ],
-      forbid: !!appType || isprint
+      forbid: !!appType || subtype === 'propcard' || isprint
     },
     {
       type: 'radio',
       field: 'searchBtn',
       label: '鎼滅储鎸夐挳',
       initval: wrap.searchBtn || 'hidden',
-      // tooltip: '鍚敤鎼滅储鏉′欢缂撳瓨鍚庯紝鍦ㄨ彍鍗曞埛鏂版椂鎼滅储鏉′欢涓嶅彉銆�',
       required: false,
       options: [
         {value: 'hidden', label: '闅愯棌'},
         {value: 'show', label: '鏄剧ず'},
       ],
-      forbid: appType === 'mob' || isprint,
+      forbid: appType === 'mob' || subtype === 'propcard' || isprint,
     },
     {
       type: 'radio',
diff --git a/src/menu/components/form/formaction/index.jsx b/src/menu/components/form/formaction/index.jsx
index 0287ff7..b577b18 100644
--- a/src/menu/components/form/formaction/index.jsx
+++ b/src/menu/components/form/formaction/index.jsx
@@ -223,7 +223,7 @@
           <div className="mk-popover-control">
             <EditOutlined className="edit" title="缂栬緫" onClick={() => this.handleAction(group.subButton)} />
             <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => this.handleStyle(group.subButton)}/>
-            <ProfileOutlined className="profile" title="setting" onClick={() => this.profileAction()} />
+            <ProfileOutlined className="profile" title="楠岃瘉淇℃伅" onClick={() => this.profileAction()} />
           </div>
         } trigger="hover">
           <Button type="link" className="submit" onDoubleClick={this.changeMenu} style={resetStyle(group.subButton.style)}>{group.subButton.label}</Button>
diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index 730898c..d730f6e 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -492,7 +492,9 @@
           shows.push('position')
         }
       } else if (_funcType === 'mkBinding' || _funcType === 'mkUnBinding') {
-        shows.push('execSuccess', 'execError')
+        shows.push('execSuccess', 'execError', 'tipTitle')
+      } else if (_funcType === 'mkUnsubscribe' || _funcType === 'reAuth') {
+        shows.push('tipTitle')
       } else if (_funcType === 'closetab') {
         shows.push('refreshTab')
       } else if (_funcType === 'scan') {
diff --git a/src/menu/components/share/actioncomponent/dragaction/card.jsx b/src/menu/components/share/actioncomponent/dragaction/card.jsx
index 5955f56..e65eb9b 100644
--- a/src/menu/components/share/actioncomponent/dragaction/card.jsx
+++ b/src/menu/components/share/actioncomponent/dragaction/card.jsx
@@ -111,7 +111,7 @@
         {!card.$fixed ? <CopyOutlined className="copy" onClick={() => copyCard(id)} /> : null}
         {!card.$fixed ? <CloseOutlined className="close" onClick={() => delCard(id)} /> : null}
         {type !== 'datacard' && type !== 'basetable' && !card.$fixed ? <FontColorsOutlined className="style" title="璋冩暣鏍峰紡" onClick={() => changeStyle(id)}/> : ''}
-        {hasProfile ? <ProfileOutlined className="profile" title="楠岃瘉" onClick={() => profileCard(id)} /> : null}
+        {hasProfile ? <ProfileOutlined className="profile" title="楠岃瘉淇℃伅" onClick={() => profileCard(id)} /> : null}
         {updateTime}
       </div>
     } trigger="hover">
diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx
index 9cf1af3..6e43711 100644
--- a/src/tabviews/custom/components/card/cardcellList/index.jsx
+++ b/src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -957,6 +957,29 @@
           val = ''
         } else if (data) {
           let _val = card.formula
+
+          if (card.$keys && card.noValue === 'hide') { // 绌哄�奸殣钘�
+            let _data = {}
+            let empty = true
+
+            Object.keys(data).forEach(key => {
+              _data[key.toLowerCase()] = data[key]
+            })
+            _data.username = sessionStorage.getItem('User_Name') || ''
+            _data.fullname = sessionStorage.getItem('Full_Name') || ''
+            _data.bid = data.$$BID || ''
+
+            card.$keys.forEach(key => {
+              if (!_data.hasOwnProperty(key)) {
+                empty = false
+              } else if (_data[key] && !/^1949-10-01/.test(_data[key])) {
+                empty = false
+              }
+            })
+
+            if (empty) return null
+          }
+
           if (/@username@|@fullName@|@bid@/ig.test(_val)) {
             _val = _val.replace(/@username@/ig, sessionStorage.getItem('User_Name') || '').replace(/@fullName@/ig, sessionStorage.getItem('Full_Name') || '').replace(/@bid@/ig, data.$$BID || '')
           }
diff --git a/src/tabviews/custom/components/card/cardcellList/index.scss b/src/tabviews/custom/components/card/cardcellList/index.scss
index b513a12..b13d11b 100644
--- a/src/tabviews/custom/components/card/cardcellList/index.scss
+++ b/src/tabviews/custom/components/card/cardcellList/index.scss
@@ -54,7 +54,7 @@
       overflow: visible;
       text-align: center;
     }
-    span {
+    span, div {
       text-indent: 0px;
       font-style: inherit;
       font-weight: inherit;
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 9c00d6e..b1555d2 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1386,7 +1386,21 @@
       method: btn.method || 'post'
     }
 
-    if (btn.cross === 'true') {
+    if (btn.ContentType) {
+      _params.headers = {
+        'Content-Type': btn.ContentType
+      }
+    }
+
+    if (btn.$outerScript) {
+      if (JSON.stringify(param) !== '{}') {
+        if (btn.stringify === 'qs') {
+          _params.data = qs.stringify(param)
+        } else {
+          _params.data = param
+        }
+      }
+    } else if (btn.cross === 'true') {
       if (JSON.stringify(param) !== '{}') {
         if (btn.stringify === 'qs') {
           _params.data = qs.stringify(param)
@@ -1420,13 +1434,7 @@
       _params.method = 'post'
     }
 
-    if (btn.ContentType) {
-      _params.headers = {
-        'Content-Type': btn.ContentType
-      }
-    }
-
-    Api.directRequest(_params).then(res => {
+    Api.directRequest(_params, btn.$outerScript, 'outer').then(res => {
       if (typeof(res) !== 'object') {
         let error = '鏈煡鐨勮繑鍥炵粨鏋滐紒'
 
diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx
index 6d2e96c..c27c005 100644
--- a/src/tabviews/zshare/actionList/printbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -1435,9 +1435,14 @@
           if (item.Field) {
             fields.push(item.Field)
             // 鏉$爜浜岀淮鐮佸瓧娈典笉鍙负绌�
-            if (item.Type === 'qrcode' || item.Type === 'barcode') {
+            if (item.Type === 'barcode') {
               nonEFields.push(item.Field)
             }
+          } else if (!item.Value) {
+            // 鏉$爜浜岀淮鐮佸唴瀹逛笉鍙负绌�
+            if (item.Type === 'barcode') {
+              error = '妯℃澘涓潯鐮�/浜岀淮鐮佸唴瀹逛笉鍙负绌猴紒'
+            }
           }
 
           control.push(item)
diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
index f0d8651..bfc57cb 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/customscript/index.jsx
@@ -1,4 +1,4 @@
-import React, {Component} from 'react'
+import React, { Component } from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
 import { Form, Row, Col, Button, notification, Modal, Tooltip, Radio, Select, Switch } from 'antd'
@@ -22,8 +22,7 @@
     editItem: null,
     usefulfields: null,
     loading: false,
-    skip: false,
-    verifySql: ''
+    skip: false
   }
 
   UNSAFE_componentWillMount () {
@@ -37,26 +36,12 @@
   }
 
   resetfield = (columns) => {
-    const { btn } = this.props
     columns = columns.filter(item => item.import !== 'false')
     let fields = columns.map(item => item.Column)
 
     fields.push('jskey')
-
-    let _dec = columns.map(item => item.Column + ' ' + item.type).join(',')
-    let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '')
-
-    if (_dec) {
-      _dec += ','
-    }
-
-    let _sql = `create table #${sheet} (${_dec}jskey nvarchar(50),BID nvarchar(50) )
-      Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512)
-      Select @ErrorCode='', @retmsg=''
-    `
     
     this.setState({
-      verifySql: _sql,
       usefulfields: fields.join(', ')
     })
   }
@@ -81,7 +66,7 @@
   }
 
   handleConfirm = () => {
-    const { type, btn, workFlow } = this.props
+    const { type, btn, workFlow, usefulfields } = this.props
     const { editItem, skip } = this.state
 
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
@@ -115,12 +100,6 @@
         let pass = checkSQL(values.sql, 'customscript')
 
         if (!pass) return
-
-        let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '')
-        let tail = `
-          drop table #${sheet}
-          aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg
-        `
 
         let _initCustomScript = '' // 鍒濆鍖栬剼鏈�
         let _prevCustomScript = '' // 榛樿sql鍓嶆墽琛岃剼鏈�
@@ -165,8 +144,71 @@
             `
           }
         }
+        
+        let sheet = btn.sheet.replace(/(.*)\.(.*)\.|@db@/ig, '')
+        let fields = []
+        let _dec = []
+        let vals = []
 
-        let sql = this.state.verifySql + _initCustomScript + _prevCustomScript + _backCustomScript + tail
+        usefulfields.forEach(col => {
+          if (col.import === 'false') return
+
+          fields.push(col.Column)
+          _dec.push(col.Column + ' ' + col.type)
+
+          let val = ''
+          if (col.import === 'init') {
+            if (/^Nvarchar/ig.test(col.type)) {
+              val = ''
+            } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) {
+              val = 0
+            } else if (col.type === 'date') {
+              val = '1949-10-01'
+            } else if (col.type === 'datetime') {
+              val = '1949-10-01 00:00:00'
+            }
+          } else if (/^Nvarchar/ig.test(col.type)) {
+            val = 'mk'
+          } else if (/^Decimal/ig.test(col.type) || /^int/ig.test(col.type)) {
+            val = 1
+          } else if (col.type === 'date') {
+            val = '1949-10-01'
+          } else if (col.type === 'datetime') {
+            val = '1949-10-01 00:00:00'
+          }
+
+          vals.push(`'${val}'`)
+        })
+
+        vals.push(`'${new Date().getTime()}000010'`)
+        vals.push(`'bid'`)
+        vals =  `Select ${vals.join(',')}`
+
+        fields.push('jskey')
+        fields = fields.join(',')
+        
+        _dec = _dec.join(',')
+        _dec = _dec ? _dec + ',' : ''
+
+        let sql = `create table #${sheet} (${_dec}jskey nvarchar(50),BID nvarchar(50) )
+          Declare @UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100),@ErrorCode nvarchar(50), @retmsg nvarchar(4000),@tbid Nvarchar(512)
+          Select @ErrorCode='', @retmsg='', @UserName='', @FullName='', @RoleID='', @mk_departmentcode='', @mk_organization='', @mk_user_type='', @mk_nation='', @mk_province='', @mk_city='', @mk_district='', @mk_address=''
+        
+          ${_initCustomScript}
+
+          Insert into #${sheet} (${fields},BID)
+
+          /* excel鏁版嵁*/
+          ${vals}
+
+          ${_prevCustomScript}
+
+          ${_backCustomScript}
+
+          drop table #${sheet}
+          aaa: select @ErrorCode as ErrorCode,@retmsg as retmsg
+        `
+
         sql = sql.replace(/@\$|\$@/ig, '').replace(/\$check@|@check\$/ig, '').replace(/@datam@/ig, `''`).replace(/@typename@/ig, `'debug'`)
         
         if (workFlow === 'true') {

--
Gitblit v1.8.0