From bdfec44c9f3a37dbbe05bf14a252ffec04132a86 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 06 九月 2022 21:24:28 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/tabviews/zshare/mutilform/index.jsx |   80 +++++++++++++++++++++++++++------------
 1 files changed, 55 insertions(+), 25 deletions(-)

diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index ffb77bc..710d82e 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -45,8 +45,10 @@
   record = {}
 
   componentDidMount () {
-    const { data, BData, action } = this.props
+    const { action } = this.props
 
+    let data = {}
+    let BData = {}
     let linkFields = {} // 鍏宠仈鑿滃崟
     let controlFields = {} // 鎺у埗琛ㄥ崟
     let deForms = []    // 闇�瑕佸姩鎬佽幏鍙栦笅鎷夎彍鍗曠殑琛ㄥ崟
@@ -55,6 +57,17 @@
     let formlist = fromJS(action.fields).toJS()
     let fieldMap = new Map()
     let check = action.setting.formType === 'check'
+
+    if (this.props.data) {
+      Object.keys(this.props.data).forEach(key => {
+        data[key.toLowerCase()] = this.props.data[key]
+      })
+    }
+    if (this.props.BData) {
+      Object.keys(this.props.BData).forEach(key => {
+        BData[key.toLowerCase()] = this.props.BData[key]
+      })
+    }
 
     formlist = formlist.filter(item => {
       if (item.supField) { // 澶氬眰琛ㄥ崟鎺у埗
@@ -87,8 +100,8 @@
 
       if (item.type === 'split' || item.type === 'formula') return true
       if (item.type === 'hint') {
-        if (item.field && data && data[item.field]) {
-          item.message = data[item.field]
+        if (item.field && data[item.field.toLowerCase()]) {
+          item.message = data[item.field.toLowerCase()]
         }
         delete item.field
         return true
@@ -113,6 +126,8 @@
       item.writein = item.writein !== 'false'
       item.hidden = item.hidden === 'true'
       item.fieldlength = item.fieldlength || 50
+
+      let key = item.field.toLowerCase()
 
       if (item.type === 'funcvar') {
         readin = false
@@ -145,11 +160,11 @@
 
       let newval = '$empty'
 
-      if (readin && data && data.hasOwnProperty(item.field)) {
-        newval = data[item.field]
+      if (readin && data.hasOwnProperty(key)) {
+        newval = data[key]
       }
       if (item.type === 'linkMain') {
-        newval = BData && BData[item.field] ? BData[item.field] : '$empty'
+        newval = BData[key] || '$empty'
       } else if (item.type === 'date') { // 鏃堕棿鎼滅储
         let format = 'YYYY-MM-DD'
         let _format = 'YYYY-MM-DD HH:mm:ss'
@@ -258,22 +273,27 @@
         if (item.regular) {
           if (item.regular === 'number') {
             _rules.push({
-              pattern: /^[0-9.-]*$/ig,
+              pattern: /^[0-9.-]*$/,
               message: formRule.input.numbermsg
             })
           } else if (item.regular === 'letter') {
             _rules.push({
-              pattern: /^[a-zA-Z]*$/ig,
+              pattern: /^[a-zA-Z]*$/,
               message: formRule.input.lettermsg
+            })
+          } else if (item.regular === 'letter_number') {
+            _rules.push({
+              pattern: /^[a-zA-Z0-9]*$/,
+              message: '璇疯緭鍏ユ暟瀛楁垨瀛楁瘝'
             })
           } else if (item.regular === 'letter&number') {
             _rules.push({
-              pattern: /^[a-zA-Z0-9@_.]*$/ig,
+              pattern: /^[a-zA-Z0-9@_.]*$/,
               message: '璇疯緭鍏ユ暟瀛椼�佸瓧姣嶄互鍙夽_.'
             })
           } 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,
+              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: '璇锋纭緭鍏ユ墜鏈哄彿'
             })
           } else if (item.regular === 'email') {
@@ -283,7 +303,7 @@
             })
           } else if (item.regular === 'funcname') {
             _rules.push({
-              pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/ig,
+              pattern: /^[\u4E00-\u9FA50-9a-zA-Z_]*$/,
               message: formRule.input.funcname
             })
           }
@@ -423,8 +443,8 @@
 
         if (fieldMap.has(item.linkField)) {
           item.supInitVal = fieldMap.get(item.linkField).initval || ''
-        } else if (data && data.hasOwnProperty(item.linkField)) {
-          item.supInitVal = data[item.linkField]
+        } else if (data.hasOwnProperty(item.linkField.toLowerCase())) {
+          item.supInitVal = data[item.linkField.toLowerCase()]
         }
         
         item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.value === '')
@@ -635,6 +655,10 @@
   
       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 => {
@@ -674,21 +698,29 @@
     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()
         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 (!_cell.label || map.has(_cell.ParentID + _cell.value)) return
+            
+            map.set(_cell.ParentID + _cell.value, 0)
           } else {
             _cell.$value = cell[item.cardValField]
             _cell = {..._cell, ...cell}
+
+            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]
@@ -881,7 +913,7 @@
         } 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 === 'brafteditor') {
           content = (<MKEditor config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
           label = item.hidelabel !== 'true' ? label : ''
@@ -947,10 +979,8 @@
             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 || ''))
+            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 || ''))
             }
           } else if (item.type.indexOf('date') > -1) {
             if (item.declareType === 'nvarchar(50)') {

--
Gitblit v1.8.0