From 93f67eceb286067a6ec5bbd747147f4824c1c6d2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 13 五月 2023 22:50:54 +0800
Subject: [PATCH] 2023-05-13

---
 src/menu/components/card/balcony/index.jsx                             |    4 +
 src/tabviews/custom/components/card/cardcellList/index.jsx             |    7 +
 src/tabviews/zshare/topSearch/index.jsx                                |    4 
 src/menu/components/card/cardcomponent/index.jsx                       |    3 
 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx  |    6 +
 src/tabviews/zshare/mutilform/index.jsx                                |    6 +
 src/menu/components/card/cardcellcomponent/formconfig.jsx              |    1 
 src/menu/components/share/actioncomponent/actionform/index.jsx         |   53 +++++++++++++
 src/menu/components/table/base-table/columns/index.jsx                 |   15 +++
 src/tabviews/zshare/actionList/normalbutton/index.jsx                  |    2 
 src/menu/components/table/edit-table/columns/editColumn/index.jsx      |   63 ++++++++++++++-
 src/menu/components/table/normal-table/columns/index.jsx               |   14 +++
 src/utils/utils.js                                                     |   28 +++---
 src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx |    2 
 src/menu/components/table/edit-table/columns/index.jsx                 |   13 +++
 15 files changed, 195 insertions(+), 26 deletions(-)

diff --git a/src/menu/components/card/balcony/index.jsx b/src/menu/components/card/balcony/index.jsx
index 9d29317..b883cf9 100644
--- a/src/menu/components/card/balcony/index.jsx
+++ b/src/menu/components/card/balcony/index.jsx
@@ -175,6 +175,10 @@
     newcard.datatype = 'dynamic'
     newcard.height = 1
 
+    if (card.wrap.datatype === 'static') {
+      newcard.datatype = 'static'
+    }
+
     // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌
     MKEmitter.emit('cardAddElement', card.uuid, newcard)
   }
diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx
index 746ce52..e7675ad 100644
--- a/src/menu/components/card/cardcellcomponent/formconfig.jsx
+++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -512,6 +512,7 @@
       options: [
         { value: 'tel', text: '鐢佃瘽' },
         { value: 'email', text: '閭' },
+        { value: 'qywx', text: '浼佷笟寰俊' },
         { value: 'other', text: '鍏朵粬' }
       ]
     },
diff --git a/src/menu/components/card/cardcomponent/index.jsx b/src/menu/components/card/cardcomponent/index.jsx
index db2c7f5..fe9bfc9 100644
--- a/src/menu/components/card/cardcomponent/index.jsx
+++ b/src/menu/components/card/cardcomponent/index.jsx
@@ -121,6 +121,7 @@
   }
   
   addElement = () => {
+    const { cards } = this.props
     const { card } = this.state
 
     let newcard = {}
@@ -133,6 +134,8 @@
 
     if (card.$cardType === 'extendCard' && card.setting.cardRole === 'header') {
       newcard.datatype = 'static'
+    } else if (cards.subtype === 'propcard' && cards.wrap.datatype === 'static') {
+      newcard.datatype = 'static'
     }
 
     // 娉ㄥ唽浜嬩欢-娣诲姞鍏冪礌
diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index 786d4e3..9b4f575 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -921,6 +921,59 @@
           values.modal = card.modal || null
           values.config = card.config || null
 
+          if (card.OpenType === 'excelOut' && values.OpenType === 'excelIn') {
+            if (values.verify && values.verify.columns && values.verify.columns.length > 0) {
+              values.verify.columns = values.verify.columns.map(col => {
+                col.required = col.required || 'true'
+                col.type = col.type || 'Nvarchar(50)'
+                col.import = col.import || 'true'
+          
+                if (col.type === 'text' || col.type === 'image') {
+                  col.type = 'Nvarchar(50)'
+                } else if (col.type === 'number') {
+                  col.type = 'Decimal(18,2)'
+                }
+                
+                if (/^Nvarchar/ig.test(col.type)) {
+                  col.limit = col.type.match(/\d+/)[0]
+                } else if (/^Decimal/ig.test(col.type)) {
+                  col.limit = col.type.match(/\d+/ig)[1]
+                } else {
+                  col.limit = ''
+                }
+
+                delete col.output
+                delete col.abs
+                delete col.Width
+          
+                return col
+              })
+
+              values.verify.sheet = values.verify.sheet || 'Sheet1'
+            }
+          } else if (card.OpenType === 'excelIn' && values.OpenType === 'excelOut') {
+            if (values.verify && values.verify.columns && values.verify.columns.length > 0) {
+              values.verify.columns = values.verify.columns.map(col => {
+                col.type = col.type || 'text'
+                col.output = col.output || 'true'
+                col.required = col.required || 'false'
+                col.Width = 20
+          
+                if (!['text', 'image', 'number'].includes(col.type)) {
+                  if (/^Decimal/ig.test(col.type)) {
+                    col.type = 'number'
+                  } else {
+                    col.type = 'text'
+                  }
+                }
+
+                delete col.import
+          
+                return col
+              })
+            }
+          }
+
           if (values.OpenType === 'form') {
             if (values.formType !== 'scan') {
               if (/^(0|[1-9]\d*)$/.test(values.openVal) && /^(0|[1-9]\d*)$/.test(values.closeVal)) {
diff --git a/src/menu/components/table/base-table/columns/index.jsx b/src/menu/components/table/base-table/columns/index.jsx
index a95701f..e970390 100644
--- a/src/menu/components/table/base-table/columns/index.jsx
+++ b/src/menu/components/table/base-table/columns/index.jsx
@@ -46,7 +46,8 @@
 
     return !is(fromJS(this.props.column), fromJS(nextProps.column)) ||
       !is(fromJS(this.props.fields), fromJS(nextProps.fields)) ||
-      this.props.index !== nextProps.index
+      this.props.index !== nextProps.index ||
+      window.GLOB.columnId === nextProps.column.uuid || window.GLOB.precolumnId === nextProps.column.uuid
   }
 
   render() {
@@ -57,6 +58,10 @@
       if (column.Width) {
         style.width = column.Width
         style.minWidth = column.Width
+      }
+
+      if (window.GLOB.columnId === column.uuid) {
+        style.color = '#1890ff'
       }
 
       return connectDragSource(
@@ -83,6 +88,11 @@
         style.width = column.Width
         style.minWidth = column.Width
       }
+
+      if (window.GLOB.columnId === column.uuid) {
+        style.color = '#1890ff'
+      }
+
       return (
         <th {...restProps} style={style} key={column.uuid} onDoubleClick={() => this.props.editColumn(column)}>
           <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
@@ -453,6 +463,9 @@
       }
     }
 
+    window.GLOB.precolumnId = window.GLOB.columnId || ''
+    window.GLOB.columnId = col.uuid
+
     this.setState({card: null})
     this.updateCol(col)
   }
diff --git a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx
index 7b052f5..a4d00e0 100644
--- a/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx
+++ b/src/menu/components/table/edit-table/columns/editColumn/formconfig.jsx
@@ -370,7 +370,7 @@
       type: 'select',
       key: 'enter',
       label: '鍥炶溅鍒囨崲',
-      initVal: card.enter || '$next',
+      initVal: card.enter || '$noAct',
       tooltip: '鍖呮嫭鏂囨湰鎴栨暟鍊煎洖杞︿簨浠躲�佷笅鎷夎彍鍗曢�変腑浜嬩欢銆佸紑鍏冲垏鎹簨浠躲��',
       options: editCols
     },
diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.jsx b/src/menu/components/table/edit-table/columns/editColumn/index.jsx
index 6e92415..0f479c0 100644
--- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx
+++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx
@@ -3,7 +3,10 @@
 import { is, fromJS } from 'immutable'
 import { Form, Row, Col, Input, Select, InputNumber, Radio, Tooltip, Modal, notification, Popover } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
+import moment from 'moment'
 
+import Api from '@/api'
+import Utils from '@/utils/utils.js'
 import { getColumnForm } from './formconfig'
 import { formRule } from '@/utils/option.js'
 import CodeMirror from '@/templates/zshare/codemirror'
@@ -35,6 +38,7 @@
 
   state = {
     visible: false,
+    loading: false,
     formlist: null,
     transfield: {}
   }
@@ -405,22 +409,70 @@
             return
           }
         }
-        this.setState({visible: false, formlist: null})
-        this.props.submitCol(values)
 
-        this.column = null
+        if (values.dataSource && /\s/.test(values.dataSource)) {
+          let error = Utils.verifySql(values.dataSource)
+
+          if (error) {
+            notification.warning({
+              top: 92,
+              message: '鏁版嵁婧愪腑涓嶅彲浣跨敤' + error,
+              duration: 5
+            })
+            return
+          }
+
+          this.setState({
+            loading: true
+          })
+    
+          let param = {
+            func: 's_debug_sql',
+            exec_type: 'y',
+            LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
+              ${values.dataSource}`
+          }
+    
+          param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+          param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
+          param.LText = param.LText.replace(/\n/g, ' ')
+          
+          param.LText = Utils.formatOptions(param.LText)
+          param.secretkey = Utils.encrypt('', param.timestamp)
+    
+          if (window.GLOB.mainSystemApi && values.database === 'sso') {
+            param.rduri = window.GLOB.mainSystemApi
+          }
+          
+          Api.genericInterface(param).then(result => {
+            if (result.status) {
+              this.setState({visible: false, loading: false, formlist: null})
+              this.props.submitCol(values)
+              this.column = null
+            } else {
+              this.setState({loading: false})
+              Modal.error({
+                title: result.message
+              })
+            }
+          })
+        } else {
+          this.setState({visible: false, formlist: null})
+          this.props.submitCol(values)
+          this.column = null
+        }
       }
     })
   }
 
   editModalCancel = () => {
-    this.setState({visible: false, formlist: null})
+    this.setState({visible: false, loading: false, formlist: null})
 
     this.props.cancelCol()
   }
 
   render() {
-    const { visible } = this.state
+    const { visible, loading } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -441,6 +493,7 @@
           maskClosable={false}
           onOk={this.handleSubmit}
           onCancel={this.editModalCancel}
+          confirmLoading={loading}
           destroyOnClose
         >
           <Form {...formItemLayout} className="commontable-column-form" id="edit-table-column-winter">
diff --git a/src/menu/components/table/edit-table/columns/index.jsx b/src/menu/components/table/edit-table/columns/index.jsx
index abd291a..cf70fdb 100644
--- a/src/menu/components/table/edit-table/columns/index.jsx
+++ b/src/menu/components/table/edit-table/columns/index.jsx
@@ -47,7 +47,8 @@
 
     return !is(fromJS(this.props.column), fromJS(nextProps.column)) ||
       !is(fromJS(this.props.fields), fromJS(nextProps.fields)) ||
-      this.props.index !== nextProps.index
+      this.props.index !== nextProps.index ||
+      window.GLOB.columnId === nextProps.column.uuid || window.GLOB.precolumnId === nextProps.column.uuid
   }
 
   render() {
@@ -64,6 +65,10 @@
       if (column.Width) {
         style.width = column.Width
         style.minWidth = column.Width
+      }
+
+      if (window.GLOB.columnId === column.uuid) {
+        style.color = '#1890ff'
       }
 
       return connectDragSource(
@@ -90,6 +95,9 @@
       if (column.Width) {
         style.width = column.Width
         style.minWidth = column.Width
+      }
+      if (window.GLOB.columnId === column.uuid) {
+        style.color = '#1890ff'
       }
 
       return (
@@ -416,6 +424,9 @@
       col.elements = card.type === 'action' ? (card.elements || []) : []
     }
 
+    window.GLOB.precolumnId = window.GLOB.columnId || ''
+    window.GLOB.columnId = col.uuid
+
     this.setState({card: null})
     this.updateCol(col)
   }
diff --git a/src/menu/components/table/normal-table/columns/index.jsx b/src/menu/components/table/normal-table/columns/index.jsx
index f8ae9cd..5362007 100644
--- a/src/menu/components/table/normal-table/columns/index.jsx
+++ b/src/menu/components/table/normal-table/columns/index.jsx
@@ -47,7 +47,8 @@
 
     return !is(fromJS(this.props.column), fromJS(nextProps.column)) ||
       !is(fromJS(this.props.fields), fromJS(nextProps.fields)) ||
-      this.props.index !== nextProps.index
+      this.props.index !== nextProps.index ||
+      window.GLOB.columnId === nextProps.column.uuid || window.GLOB.precolumnId === nextProps.column.uuid
   }
 
   render() {
@@ -58,6 +59,10 @@
       if (column.Width) {
         style.width = column.Width
         style.minWidth = column.Width
+      }
+
+      if (window.GLOB.columnId === column.uuid) {
+        style.color = '#1890ff'
       }
 
       return connectDragSource(
@@ -84,6 +89,10 @@
       if (column.Width) {
         style.width = column.Width
         style.minWidth = column.Width
+      }
+
+      if (window.GLOB.columnId === column.uuid) {
+        style.color = '#1890ff'
       }
 
       return (
@@ -410,6 +419,9 @@
       col.elements = card.type === 'action' ? (card.elements || []) : []
     }
 
+    window.GLOB.precolumnId = window.GLOB.columnId || ''
+    window.GLOB.columnId = col.uuid
+
     this.setState({card: null})
     this.updateCol(col)
   }
diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx
index 00fb6a8..4c7985a 100644
--- a/src/tabviews/custom/components/card/cardcellList/index.jsx
+++ b/src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -133,6 +133,13 @@
       }
       window.open(_url)
       return
+    } else if (card.linkType === 'qywx') {
+      notification.warning({
+        top: 92,
+        message: 'PC涓嶆敮鎸佹墦寮�浼佷笟寰俊锛�',
+        duration: 5
+      })
+      return
     }
 
     // positecgroup
diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
index 94d02eb..2329e72 100644
--- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -1135,6 +1135,9 @@
         if (debug) {
           console.info(sql)
         }
+
+        sql = sql.replace(/%/ig, ' mpercent ')
+
         mainItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`)
       } else {
         let sql = _sql + item.base_sql
@@ -1145,6 +1148,9 @@
         if (debug) {
           console.info(sql)
         }
+
+        sql = sql.replace(/%/ig, ' mpercent ')
+        
         localItems.push(`select '${item.uuid}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`)
       }
     })
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 3cab100..9f4b267 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -838,7 +838,7 @@
   getSysDeclareSql = (btn, formdata, data, columns, primaryId, BID = '') => {
     let datavars = {}                 // 澹版槑鐨勫彉閲忥紝琛ㄥ崟鍙婃樉绀哄垪
     // 闇�瑕佸0鏄庣殑鍙橀噺闆�
-    let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'bid']
+    let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid']
   
     // sql璇彞
     let _sql = ''
diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index f6f2a1c..eec20bd 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -587,6 +587,9 @@
         if (debug) {
           console.info(sql)
         }
+
+        sql = sql.replace(/%/ig, ' mpercent ')
+        
         mainItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`)
       } else {
         let sql = _sql + item.base_sql
@@ -598,6 +601,9 @@
         if (debug) {
           console.info(sql)
         }
+
+        sql = sql.replace(/%/ig, ' mpercent ')
+
         localItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`)
       }
     })
diff --git a/src/tabviews/zshare/topSearch/index.jsx b/src/tabviews/zshare/topSearch/index.jsx
index 7bef081..2ee1aaa 100644
--- a/src/tabviews/zshare/topSearch/index.jsx
+++ b/src/tabviews/zshare/topSearch/index.jsx
@@ -191,9 +191,9 @@
             })
           } else { // 鍚堝苟璇锋眰锛屽尯鍒嗘湰鍦板強绯荤粺
             if (item.database === 'sso') {
-              mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`)
+              mainItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql.replace(/%/ig, ' mpercent ')))}' as LText`)
             } else {
-              localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql))}' as LText`)
+              localItems.push(`select '${item.field}' as obj_name,'${_option.field}' as arr_field,'${window.btoa(window.encodeURIComponent(_option.sql.replace(/%/ig, ' mpercent ')))}' as LText`)
             }
           }
         }
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 58e7ba8..f09195e 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -142,19 +142,19 @@
   static verifySql (sql, type) {
     if (!sql) return ''
     let chars = [
-      {key: 'create', reg: /(^|\s)create\s/ig},
-      {key: 'insert', reg: /(^|\s)insert\s/ig},
-      {key: 'delete', reg: /(^|\s)delete\s/ig},
-      {key: 'update', reg: /(^|\s)update\s/ig},
-      {key: 'set', reg: /(^|\s)set\s/ig},
-      {key: 'drop', reg: /(^|\s)drop\s/ig},
-      {key: 'alter', reg: /(^|\s)alter\s/ig},
-      {key: 'truncate', reg: /(^|\s)truncate\s/ig},
-      {key: 'if', reg: /(^|\s)if\s/ig},
-      {key: 'exec', reg: /(^|\s)exec(\s|\()/ig},
-      {key: 'OBJECT', reg: /(^|\s)object(\s|\()/ig},
-      {key: 'sys.', reg: /(^|\s)sys\./ig},
-      {key: 'kill', reg: /(^|\s)kill\s/ig}
+      {key: 'create', reg: /(^|\s|\(|\))create\s/ig},
+      {key: 'insert', reg: /(^|\s|\(|\))insert\s/ig},
+      {key: 'delete', reg: /(^|\s|\(|\))delete\s/ig},
+      {key: 'update', reg: /(^|\s|\(|\))update\s/ig},
+      {key: 'set', reg: /(^|\s|\(|\))set\s/ig},
+      {key: 'drop', reg: /(^|\s|\(|\))drop\s/ig},
+      {key: 'alter', reg: /(^|\s|\(|\))alter\s/ig},
+      {key: 'truncate', reg: /(^|\s|\(|\))truncate\s/ig},
+      {key: 'if', reg: /(^|\s|\(|\))if\s/ig},
+      {key: 'exec', reg: /(^|\s|\(|\))exec(\s|\()/ig},
+      {key: 'OBJECT', reg: /(^|\s|\(|\))object(\s|\()/ig},
+      {key: 'sys.', reg: /(^|\s|\(|\))sys\./ig},
+      {key: 'kill', reg: /(^|\s|\(|\))kill\s/ig}
     ]
     
     if (type === 'customscript') {
@@ -1453,7 +1453,7 @@
   })
 
   // 闇�瑕佸0鏄庣殑鍙橀噺闆�
-  let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'bid']
+  let _vars = ['tbid', 'errorcode', 'retmsg', 'billcode', 'bvoucher', 'fibvoucherdate', 'fiyear', 'username', 'fullname', 'modulardetailcode', 'roleid', 'mk_departmentcode', 'mk_organization', 'mk_user_type', 'mk_nation', 'mk_province', 'mk_city', 'mk_district', 'mk_address', 'mk_deleted', 'bid']
 
   // 涓婚敭瀛楁
   let primaryKey = setting.primaryKey || 'id'

--
Gitblit v1.8.0