From 7b0dbecd1d6155d26ec67be0a47a16264c738c85 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 09 五月 2023 14:48:10 +0800
Subject: [PATCH] 2023-05-09

---
 src/tabviews/zshare/mutilform/index.jsx |  364 ++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 254 insertions(+), 110 deletions(-)

diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index c2b9648..f6f2a1c 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -19,6 +19,7 @@
 
 const MKCheckCard = asyncComponent(() => import('./mkCheckCard'))
 const MKSwitch = asyncComponent(() => import('./mkSwitch'))
+const MKCheck = asyncComponent(() => import('./mkCheck'))
 const MKCheckbox = asyncComponent(() => import('./mkCheckbox'))
 const MKRadio = asyncComponent(() => import('./mkRadio'))
 const MKDatePicker = asyncComponent(() => import('./mkDatePicker'))
@@ -27,6 +28,7 @@
 const MKColor = asyncComponent(() => import('./mkColor'))
 const MkFormula = asyncComponent(() => import('./mkFormula'))
 const MkCascader = asyncComponent(() => import('./mkCascader'))
+const MkVercode = asyncComponent(() => import('./mkVercode'))
 const MKEditor = asyncComponent(() => import('@/components/editor'))
 
 class MainSearch extends Component {
@@ -35,17 +37,22 @@
     data: PropTypes.any,         // 琛ㄦ牸鏁版嵁
     BID: PropTypes.any,          // 涓昏〃ID
     BData: PropTypes.any,        // 涓昏〃鏁版嵁
+    unload: PropTypes.any,       // 涓嬫媺鑿滃崟涓嶅姞杞芥暟鎹�
     inputSubmit: PropTypes.func  // input鍥炶溅鎻愪氦
   }
 
   state = {
     formlist: [],    // 琛ㄥ崟椤�
+    ID: '',
+    send_type: '',
+    timestamp: '',
+    n_id: ''
   }
 
   record = {}
 
   componentDidMount () {
-    const { action } = this.props
+    const { action, unload } = this.props
 
     let data = {}
     let BData = {}
@@ -98,6 +105,12 @@
         delete item.style.marginRight
       }
 
+      if (item.type === 'split' && item.splitctrl) {
+        if (data.hasOwnProperty(item.splitctrl.toLowerCase()) && data[item.splitctrl.toLowerCase()] === '') {
+          return false
+        }
+      }
+
       if (item.type === 'split' || item.type === 'formula') return true
       if (item.type === 'hint') {
         if (item.field && data[item.field.toLowerCase()]) {
@@ -105,18 +118,20 @@
         }
         delete item.field
         return true
-      } else if (item.type === 'date') { // 鏃堕棿鎼滅储
+      } else if (item.type === 'date') {
         item.precision = item.precision || 'day'
       } else if (item.type === 'datetime') {
         item.type = 'date'
         item.precision = 'second'
       }
 
-      if (!item.field || !['text', 'number', 'switch', 'rate', 'select', 'link', 'cascader', 'linkMain', 'funcvar', 'date', 'datemonth', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color'].includes(item.type)) return false
+      if (!item.field || !['text', 'number', 'switch', 'check', 'rate', 'select', 'link', 'cascader', 'linkMain', 'funcvar', 'date', 'datemonth', 'radio', 'checkbox', 'checkcard', 'fileupload', 'textarea', 'multiselect', 'brafteditor', 'color', 'vercode'].includes(item.type)) return false
 
       if (/^\s+$/.test(item.label)) {
         item.style = item.style || {}
-        item.style.color = 'transparent'
+        item.style.opacity = 0
+        item.style.width = 1
+        item.style.display = 'inline-block'
       }
 
       // 鏁版嵁鑷姩濉厖
@@ -133,6 +148,9 @@
         readin = false
         item.readin = false
         item.hidden = true
+      } else if (item.type === 'linkMain') {
+        readin = false
+        item.readin = false
       } else if (item.type === 'number') {
         item.decimal = item.decimal || 0
         item.fieldlength = item.decimal
@@ -156,6 +174,23 @@
           })
         }
         item.oriOptions = fromJS(item.options).toJS()
+
+        if (item.empty === 'hidden' && item.oriOptions.length === 0) {
+          item.hidden = true
+        }
+        if (item.type === 'checkcard' && item.readonly && item.unchecked === 'hidden') {
+          let selectKeys = item.initval
+          if (item.multiple === 'true') {
+            selectKeys = selectKeys ? selectKeys.split(',') : []
+            item.options = item.options.filter(item => selectKeys.includes(item.$value))
+          } else {
+            item.options = item.options.filter(item => selectKeys === item.$value)
+          }
+          item.oriOptions = fromJS(item.options).toJS()
+          if (item.options.length === 0) {
+            item.hidden = true
+          }
+        }
       }
 
       let newval = '$empty'
@@ -163,23 +198,16 @@
       if (readin && data.hasOwnProperty(key)) {
         newval = data[key]
       }
-      if (item.type === 'linkMain') {
-        newval = BData[key] || '$empty'
-      } else if (item.type === 'date') { // 鏃堕棿鎼滅储
-        let format = 'YYYY-MM-DD'
+      if (item.type === 'linkMain' && BData.hasOwnProperty(key)) {
+        newval = BData[key]
+      } else if (item.type === 'date') { // 鏃堕棿琛ㄥ崟锛屾彁浜ゅ�间负澶╂垨绉�
         let _format = 'YYYY-MM-DD HH:mm:ss'
         if (item.precision === 'day') {
           _format = 'YYYY-MM-DD'
-        } else if (item.precision === 'hour') {
-          format = 'YYYY-MM-DD HH'
-        } else if (item.precision === 'minute') {
-          format = 'YYYY-MM-DD HH:mm'
-        } else if (item.precision === 'second') {
-          format = 'YYYY-MM-DD HH:mm:ss'
         }
 
         if (newval !== '$empty') {
-          newval = moment(newval, format).format(_format)
+          newval = moment(newval, 'YYYY-MM-DD HH:mm:ss').format(_format)
           newval = newval === 'Invalid date' ? '$empty' : newval
         }
         if (newval === '$empty' && item.initval) {
@@ -193,19 +221,7 @@
         if (newval === '$empty' && item.initval) {
           newval = moment().subtract(item.initval, 'month').format('YYYY-MM')
         }
-      // } else if (item.type === 'datetime') {
-      //   if (newval !== '$empty') {
-      //     newval = moment(newval, 'YYYY-MM-DD HH:mm:ss').format('YYYY-MM-DD HH:mm:ss')
-      //     newval = newval === 'Invalid date' ? '$empty' : newval
-      //   }
-      //   if (newval === '$empty' && item.initval) {
-      //     if (item.initval === '0') {
-      //       newval = moment().format('YYYY-MM-DD HH:mm:ss')
-      //     } else {
-      //       newval = moment().subtract(item.initval, 'days').format('YYYY-MM-DD') + ' 00:00:00'
-      //     }
-      //   }
-      } else if (item.type === 'switch') { // 寮�鍏冲彧鎺ユ敹鍥哄畾鍊�
+      } else if (item.type === 'switch' || item.type === 'check') { // 寮�鍏冲嬀閫夋鍙帴鏀跺浐瀹氬��
         if (newval !== '$empty' && (newval === item.closeVal || newval === item.openVal)) {
 
         } else if (item.initval === true) {
@@ -221,7 +237,11 @@
         item.initval = ''
       }
 
-      if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && item.resourceType === '1') {
+      if (item.type === 'number') {
+        if (isNaN(item.initval)) {
+          item.initval = 0
+        }
+      } else if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && item.resourceType === '1') {
         deForms.push(item)
       } else if (item.type === 'rate') {
         item.rateCount = item.rateCount || 5
@@ -244,9 +264,7 @@
       }
 
       if (item.type === 'text') {
-        if (typeof(item.initval) === 'number') {
-          item.initval = item.initval + ''
-        }
+        item.initval = item.initval + ''
         let _rules = [{
           pattern: /^[^']*$/ig,
           message: '涓嶅彲浣跨敤鑻辨枃鐘舵�佺殑鍗曞紩鍙凤紒'
@@ -272,34 +290,50 @@
 
         if (item.regular) {
           if (item.regular === 'number') {
+            let reg = /^[0-9.-]*$/
+            if (item.regularExtra) {
+              reg = new RegExp('^[0-9.-' + item.regularExtra.replace(/\.|-/g, '') + ']*$')
+            }
             _rules.push({
-              pattern: /^[0-9.-]*$/ig,
-              message: formRule.input.numbermsg
+              pattern: reg,
+              message: item.regularText || formRule.input.numbermsg
             })
           } else if (item.regular === 'letter') {
+            let reg = /^[a-zA-Z]*$/
+            if (item.regularExtra) {
+              reg = new RegExp('^[a-zA-Z' + item.regularExtra + ']*$')
+            }
             _rules.push({
-              pattern: /^[a-zA-Z]*$/ig,
-              message: formRule.input.lettermsg
+              pattern: reg,
+              message: item.regularText || formRule.input.lettermsg
+            })
+          } else if (item.regular === 'letter_number') {
+            let reg = /^[a-zA-Z0-9]*$/
+            if (item.regularExtra) {
+              reg = new RegExp('^[a-zA-Z0-9' + item.regularExtra + ']*$')
+            }
+            _rules.push({
+              pattern: reg,
+              message: item.regularText || '璇疯緭鍏ユ暟瀛楁垨瀛楁瘝'
             })
           } else if (item.regular === 'letter&number') {
+            let reg = /^[a-zA-Z0-9@_.]*$/
+            if (item.regularExtra) {
+              reg = new RegExp('^[a-zA-Z0-9@_.' + item.regularExtra.replace(/\.|_|@/g, '') + ']*$')
+            }
             _rules.push({
-              pattern: /^[a-zA-Z0-9@_.]*$/ig,
-              message: '璇疯緭鍏ユ暟瀛椼�佸瓧姣嶄互鍙夽_.'
+              pattern: reg,
+              message: item.regularText || '璇疯緭鍏ユ暟瀛椼�佸瓧姣嶄互鍙夽_.'
             })
           } else if (item.regular === 'phone') {
             _rules.push({
-              pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/ig,
-              message: '璇锋纭緭鍏ユ墜鏈哄彿'
+              pattern: /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/,
+              message: item.regularText || '璇锋纭緭鍏ユ墜鏈哄彿'
             })
           } else if (item.regular === 'email') {
             _rules.push({
-              pattern: /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/,
-              message: '璇锋纭緭鍏ラ偖绠卞湴鍧�'
-            })
-          } else if (item.regular === 'funcname') {
-            _rules.push({
-              pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig,
-              message: formRule.input.funcname
+              pattern: /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/,
+              message: item.regularText || '璇锋纭緭鍏ラ偖绠卞湴鍧�'
             })
           }
         }
@@ -347,7 +381,7 @@
             message: formRule.input.formMessage.replace('@max', item.fieldlength)
           }
         ]
-      } else if (item.type === 'linkMain') {
+      } else if (item.type === 'linkMain' || item.type === 'vercode') {
         item.rules = [
           {
             required: item.required === 'true',
@@ -379,10 +413,13 @@
 
         let cell = fieldMap.get(item.field)
 
-        if (cell.hidden) return
-
+        // if (cell.hidden) return
+        
         if (supItem.hidden || !item.values.includes(supItem.initval)) {
           cell.hidden = true
+          if (cell.empty === 'hidden') {
+            cell.$hidden = true
+          }
           fieldMap.set(item.field, cell)
         }
 
@@ -445,17 +482,19 @@
         item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.value === '')
       }
 
-      if (['select', 'link', 'radio'].includes(item.type) && item.resourceType === '0') { // 閫変腑绗竴椤�
-        if (typeof(item.initval) === 'string' && item.initval.indexOf('$first') > -1) {
-          item.initval = item.options[0] ? item.options[0].value : ''
+      if (['select', 'link', 'radio'].includes(item.type)) { // 閫変腑绗竴椤�
+        if (/^\s*\$first\s*$/.test(item.initval)) {
+          item.$first = true
+          item.initval = ''
+        }
+        if (item.resourceType === '0') { // 閫変腑绗竴椤�
+          if (item.$first) {
+            item.initval = item.options[0] ? item.options[0].value : ''
+          }
         }
       }
 
-      if (typeof(item.initval) === 'string' && item.initval.indexOf('$first') > -1) {
-        record[item.field] = ''
-      } else {
-        record[item.field] = item.initval
-      }
+      record[item.field] = item.initval
 
       if (linkFields[item.field]) {
         item.linkFields = linkFields[item.field]
@@ -503,7 +542,9 @@
 
     this.record = record
 
-    this.setState({ formlist }, () => {
+    this.setState({ formlist, ID: this.props.data ? this.props.data.$$uuid || '' : '' }, () => {
+      if (unload) return
+      
       if (action.setting && action.setting.focus && fieldMap.has(action.setting.focus)) {
         setTimeout(() => {
           MKEmitter.emit('mkFC', 'focus', fieldMap.get(action.setting.focus).uuid)
@@ -530,19 +571,36 @@
     let mainItems = []  // 浜戠鎴栧崟鐐规暟鎹�
     let localItems = [] // 鏈湴鏁版嵁
     let cache = action.setting.cache !== 'false'
+    let debug = window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')
+
+    let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)  select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n`
+    let _sso = _sql
 
     deForms.forEach(item => {
       if (item.database === 'sso') {
-        mainItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`)
+        let sql = _sso + item.base_sql
+        _sso = ''
+
+        sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`)
+        sql = sql.replace(/@BID@/ig, `'${BID}'`)
+
+        if (debug) {
+          console.info(sql)
+        }
+        mainItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`)
       } else {
-        localItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${item.base_sql}' as LText`)
+        let sql = _sql + item.base_sql
+        _sql = ''
+
+        sql = sql.replace(/@ID@/ig, `'${this.state.ID || ''}'`)
+        sql = sql.replace(/@BID@/ig, `'${BID}'`)
+
+        if (debug) {
+          console.info(sql)
+        }
+        localItems.push(`select '${item.field}' as obj_name,'${item.arr_field}' as arr_field,'${window.btoa(window.encodeURIComponent(sql))}' as LText`)
       }
     })
-    
-    if (!window.GLOB.mkHS && options.sysType !== 'local') {
-      localItems = [...localItems, ...mainItems]
-      mainItems = []
-    }
 
     // 鏈湴璇锋眰
     let param = {
@@ -550,8 +608,7 @@
       LText: localItems.join(' union all '),
       obj_name: '',
       arr_field: '',
-      table_type: 'Y',
-      BID: BID || ''
+      table_type: 'Y'
     }
 
     if (param.LText) {
@@ -585,8 +642,7 @@
       LText: mainItems.join(' union all '),
       obj_name: '',
       arr_field: '',
-      table_type: 'Y',
-      BID: BID || ''
+      table_type: 'Y'
     }
 
     if (mainparam.LText) {
@@ -638,18 +694,31 @@
    */
   improveSimpleActionForm = (deForms) => {
     let cache = this.props.action.setting.cache !== 'false'
+    let debug = window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')
+    let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)  select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n`
 
     let deffers = deForms.map((form, index) => {
       let param = {
         func: 'sPC_Get_SelectedList',
-        LText: form.data_sql,
+        LText: _sql + form.base_sql,
         obj_name: form.field,
-        arr_field: form.arr_field,
-        BID: this.props.BID || ''
+        arr_field: form.arr_field
+      }
+
+      param.LText = param.LText.replace(/@ID@/ig, `'${this.state.ID || ''}'`)
+      param.LText = param.LText.replace(/@BID@/ig, `'${this.props.BID || ''}'`)
+
+      if (debug) {
+        console.info(param.LText)
       }
   
+      param.LText = Utils.formatOptions(param.LText)
       param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
       param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+
+      if (form.database === 'sso' && window.GLOB.mainSystemApi) {
+        param.rduri = window.GLOB.mainSystemApi
+      }
   
       return (
         new Promise(resolve => {
@@ -689,21 +758,44 @@
     let _formlist = fromJS(this.state.formlist).toJS().map(item => {
       if (['select', 'link', 'radio', 'checkbox', 'checkcard', 'multiselect', 'cascader'].includes(item.type) && result[item.field] && result[item.field].length > 0) {
         let options = []
+        let map = new Map()
+        let all = false
         result[item.field].forEach(cell => {
-          let _cell = { key: Utils.getuuid() }
+          let _cell = { key: Utils.getuuid() , ParentID: ''}
+
+          if (item.linkField && cell[item.linkField] !== undefined) {
+            _cell.ParentID = cell[item.linkField]
+          }
 
           if (item.type !== 'checkcard') {
             _cell.value = cell[item.valueField]
-            _cell.label = cell[item.valueText]
-            if (!_cell.label && _cell.label !== 0) return
+            _cell.label = cell[item.valueText] + ''
+            if (map.has(_cell.ParentID + _cell.value)) return
+            if (!_cell.label) {
+              if (!all) {
+                _cell.label = '鍏ㄩ儴'
+                all = true
+              } else {
+                return
+              }
+            }
+            
+            map.set(_cell.ParentID + _cell.value, 0)
           } else {
             _cell.$value = cell[item.cardValField]
             _cell = {..._cell, ...cell}
+
+            if (item.urlField) {
+              _cell.$url = cell[item.urlField] || ''
+            } else if (item.colorField) {
+              _cell.$color = cell[item.colorField] || ''
+            }
+
+            if (map.has(_cell.ParentID + _cell.$value)) return
+            
+            map.set(_cell.ParentID + _cell.$value, 0)
           }
-  
-          if (item.linkField) {
-            _cell.ParentID = cell[item.linkField] === undefined ? '' : cell[item.linkField]
-          }
+          
           if (item.subFields) {
             item.subFields.forEach(m => {
               _cell[m.field] = cell[m.field] === undefined ? '' : cell[m.field]
@@ -727,7 +819,7 @@
           item.options = item.oriOptions
         }
 
-        if (['select', 'link', 'radio'].includes(item.type) && typeof(item.initval) === 'string' && item.initval.indexOf('$first') > -1) { // 閫変腑绗竴椤�
+        if (['select', 'link', 'radio'].includes(item.type) && item.$first) { // 閫変腑绗竴椤�
           item.initval = item.options[0] ? item.options[0].value : ''
           this.record[item.field] = item.initval
         }
@@ -745,6 +837,25 @@
             item.subFields.forEach(n => {
               reFieldsVal[n.field] = option[n.field]
             })
+          }
+        }
+
+        if (item.empty === 'hidden' && item.oriOptions.length > 0 && !item.$hidden) {
+          item.hidden = false
+        }
+        if (item.type === 'checkcard' && item.readonly && item.unchecked === 'hidden') {
+          let selectKeys = item.initval
+          if (item.multiple === 'true') {
+            selectKeys = selectKeys ? selectKeys.split(',') : []
+            item.options = item.options.filter(item => selectKeys.includes(item.$value))
+          } else {
+            item.options = item.options.filter(item => selectKeys === item.$value)
+          }
+          item.oriOptions = fromJS(item.options).toJS()
+          if (item.options.length === 0) {
+            item.hidden = true
+          } else {
+            item.hidden = false
           }
         }
       }
@@ -805,6 +916,10 @@
       current.controlFields.forEach(cell => {
         let m = map.get(cell.field)
         m.hidden = current.hidden || !cell.values.includes(val)
+
+        if (m.empty === 'hidden' && m.oriOptions.length === 0) {
+          m.hidden = true
+        }
 
         if (m.hidden) {
           m.initval = this.record[m.field]
@@ -883,6 +998,8 @@
           content = (<MKCheckCard config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>)
         } else if (item.type === 'switch') {
           content = (<MKSwitch config={item} onChange={(val) => this.recordChange({[item.field]: val}, item)}/>)
+        } else if (item.type === 'check') {
+          content = (<MKCheck config={item} onChange={(val) => this.recordChange({[item.field]: val}, item)}/>)
         } else if (item.type === 'checkbox') {
           content = (<MKCheckbox config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
         } else if (item.type === 'radio') {
@@ -896,7 +1013,9 @@
         } else if (item.type === 'textarea') {
           content = (<MKTextArea config={item} onChange={(val, defer) => !defer && this.recordChange({[item.field]: val})}/>)
         } else if (item.type === 'rate') {
-          content = (<Rate count={item.rateCount} disabled={item.readonly} onChange={(val) => this.recordChange({[item.field]: val})} character={item.character ? <MkIcon type={item.character}/> : <StarFilled />} allowHalf={item.allowHalf}/>)
+          content = (<Rate count={item.rateCount} disabled={item.readonly} style={{color: item.color || '#fadb14'}} onChange={(val) => this.recordChange({[item.field]: val})} character={item.character ? <MkIcon type={item.character}/> : <StarFilled />} allowHalf={item.allowHalf}/>)
+        } else if (item.type === 'vercode') {
+          content = (<MkVercode config={item} record={this.record} onSend={(send_type, timestamp, n_id) => this.setState({send_type, timestamp, n_id})} onChange={(val) => this.recordChange({[item.field]: val})} onSubmit={this.props.inputSubmit}/>)
         } else if (item.type === 'brafteditor') {
           content = (<MKEditor config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
           label = item.hidelabel !== 'true' ? label : ''
@@ -928,7 +1047,7 @@
   }
 
   handleConfirm = () => {
-    const { formlist } = this.state
+    const { formlist, send_type, timestamp, n_id } = this.state
 
     // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
     return new Promise((resolve, reject) => {
@@ -937,7 +1056,7 @@
           reject(err)
           return
         }
-        let search = []
+        let forms = []
         let record = {...this.record, ...values}
 
         formlist.forEach(item => {
@@ -945,7 +1064,6 @@
     
           let _item = {
             type: item.type,
-            readonly: item.readonly,
             readin: item.readin,
             writein: item.writein,
             fieldlen: item.fieldlength,
@@ -956,38 +1074,64 @@
     
           if (item.type === 'funcvar') {
             _item.value = ''
-          } else if (_item.value && (item.type === 'text' || item.type === 'textarea' || item.type === 'linkMain') && typeof(_item.value) === 'string') {
-            _item.value = _item.value.replace(/\t*|\v*/g, '')       // 鍘婚櫎鍒惰〃绗�
-    
-            if (item.interception === 'true') {           // 鍘婚櫎棣栧熬绌烘牸
-              _item.value = _item.value.replace(/(^\s*|\s*$)/g, '')
-            }
-            if (item.type === 'text') { // 鐗规畩瀛楁鏇挎崲
-              _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey)
-              _item.value = _item.value.replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || ''))
-              _item.value = _item.value.replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || ''))
-            }
-          } else if (item.type.indexOf('date') > -1) {
-            if (item.declareType === 'nvarchar(50)') {
-              _item.type = 'text'
-            }
-          } else if (item.declare === 'decimal' && ['select', 'link', 'radio', 'checkcard'].includes(item.type)) {
+          } else if (item.declare === 'decimal') {
             _item.type = 'number'
             _item.fieldlen = item.decimal || 0
-          }
-
-          if (item.type === 'text' && item.lenControl && item.lenControl !== 'limit') {
-            if (item.lenControl === 'left') {
-              _item.value = _item.value.substr(0, item.fieldlength)
-            } else {
-              _item.value = _item.value.slice(-item.fieldlength)
+          } else if (['text', 'textarea', 'linkMain'].includes(item.type)) {
+            _item.value = _item.value + ''
+            _item.value = _item.value.replace(/\t*|\v*/g, '')       // 鍘婚櫎鍒惰〃绗�
+    
+            if (item.interception !== 'false') {                    // 鍘婚櫎棣栧熬绌烘牸
+              _item.value = _item.value.replace(/(^\s*|\s*$)/g, '')
             }
+            if (item.type === 'text' && /@appkey@|@SessionUid@|@bid@/ig.test(_item.value)) { // 鐗规畩瀛楁鏇挎崲
+              _item.value = _item.value.replace(/^(\s*)@appkey@(\s*)$/ig, window.GLOB.appkey).replace(/^(\s*)@SessionUid@(\s*)$/ig, (localStorage.getItem('SessionUid') || '')).replace(/^(\s*)@bid@(\s*)$/ig, (this.props.BID || ''))
+            }
+            if (item.type === 'text' && item.lenControl && item.lenControl !== 'limit') {
+              if (item.lenControl === 'left') {
+                _item.value = _item.value.substr(0, item.fieldlength)
+              } else {
+                _item.value = _item.value.slice(-item.fieldlength)
+              }
+            }
+          } else if (item.type === 'datemonth') {
+            _item.type = 'text'
+          } else  if (item.type === 'date') {
+            _item.type = item.declareType === 'nvarchar(50)' ? 'text' : 'date'
+          } else if (item.type === 'vercode') {
+            _item.type = 'text'
+            forms.push({
+              type: 'text',
+              readin: false,
+              writein: false,
+              fieldlen: 50,
+              key: 'mk_timestamp',
+              value: timestamp || ''
+            })
+
+            forms.push({
+              type: 'text',
+              readin: false,
+              writein: false,
+              fieldlen: 50,
+              key: 'mk_send_type',
+              value: send_type || ''
+            })
+
+            forms.push({
+              type: 'text',
+              readin: false,
+              writein: false,
+              fieldlen: 50,
+              key: 'mk_n_id',
+              value: n_id || ''
+            })
           }
     
-          search.push(_item)
+          forms.push(_item)
         })
 
-        resolve(search)
+        resolve(forms)
       })
     })
   }

--
Gitblit v1.8.0