From c9e46b9fa50396d4001d8b195dc485d431e8d590 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 14 七月 2022 20:34:09 +0800
Subject: [PATCH] 2022-07-14

---
 src/tabviews/zshare/mutilform/index.jsx            |   51 +++++--------------------
 src/templates/zshare/modalform/index.jsx           |   11 +++--
 src/tabviews/zshare/mutilform/mkCascader/index.jsx |   22 +++++------
 src/templates/zshare/formconfig.jsx                |    8 ----
 4 files changed, 28 insertions(+), 64 deletions(-)

diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index ca9344d..2c79490 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -393,7 +393,7 @@
       let item = fieldMap.get(cell.field)
 
       // 涓嬬骇琛ㄥ崟鎺у埗-瀛楁鍐欏叆
-      if ((['select', 'radio', 'link'].includes(item.type) || (item.type === 'checkcard' && item.multiple !== 'true')) && item.linkSubField) {
+      if ((['select', 'radio', 'link'].includes(item.type) || (item.type === 'checkcard' && item.multiple !== 'true') || (item.type === 'cascader' && item.resourceType !== '2')) && item.linkSubField) {
         item.subFields = []
         item.linkSubField.forEach(m => {
           let n = fieldMap.get(m)
@@ -418,9 +418,6 @@
           item.options = fromJS(item.oriOptions).toJS()
         }
         item.linkSubField = null
-      } else if (item.type === 'cascader' && item.fillField) {
-        let n = fieldMap.get(item.fillField)
-        item.fillFieldId = n ? n.uuid : ''
       }
 
       // if (item.type === 'link') {
@@ -463,31 +460,18 @@
       }
 
       if (item.subFields && item.options.length > 0) {
+        let initval = item.initval
+        if (item.type === 'cascader' && item.separator) {
+          initval = initval.split(item.separator).pop()
+        }
         // eslint-disable-next-line
-        let option = item.options.filter(cell => item.initval == cell.value)[0]
+        let option = item.options.filter(cell => initval == cell.value)[0]
 
         if (option) {
           reFieldsVal = reFieldsVal || {}
           item.subFields.forEach(n => {
             reFieldsVal[n.field] = option[n.field]
           })
-        }
-      } else if (item.fillField && item.initval && item.separator && item.options.length > 0) {
-        let initvals = item.initval.split(item.separator)
-        let label = []
-        initvals.forEach(m => {
-          // eslint-disable-next-line
-          let option = item.options.filter(cell => m == cell.value)[0]
-          if (option) {
-            label.push(option.label)
-          }
-        })
-
-        label = label.join(item.separator)
-
-        if (label) {
-          reFieldsVal = reFieldsVal || {}
-          reFieldsVal[item.fillField] = label
         }
       }
       
@@ -737,31 +721,18 @@
         }
 
         if (item.subFields && item.options.length > 0) {
+          let initval = item.initval
+          if (item.type === 'cascader' && item.separator) {
+            initval = initval.split(item.separator).pop()
+          }
           // eslint-disable-next-line
-          let option = item.options.filter(cell => item.initval == cell.value)[0]
+          let option = item.options.filter(cell => initval == cell.value)[0]
   
           if (option) {
             reFieldsVal = reFieldsVal || {}
             item.subFields.forEach(n => {
               reFieldsVal[n.field] = option[n.field]
             })
-          }
-        } else if (item.fillField && item.initval && item.separator && item.options.length > 0) {
-          let initvals = item.initval.split(item.separator)
-          let label = []
-          initvals.forEach(m => {
-            // eslint-disable-next-line
-            let option = item.options.filter(cell => m == cell.value)[0]
-            if (option) {
-              label.push(option.label)
-            }
-          })
-  
-          label = label.join(item.separator)
-  
-          if (label) {
-            reFieldsVal = reFieldsVal || {}
-            reFieldsVal[item.fillField] = label
           }
         }
       }
diff --git a/src/tabviews/zshare/mutilform/mkCascader/index.jsx b/src/tabviews/zshare/mutilform/mkCascader/index.jsx
index 6fa2b82..2533b21 100644
--- a/src/tabviews/zshare/mutilform/mkCascader/index.jsx
+++ b/src/tabviews/zshare/mutilform/mkCascader/index.jsx
@@ -66,10 +66,7 @@
 
     options = options.filter(option => {
       if (option.ParentID === config.topmark) {
-        _options.push({
-          label: option.label,
-	        value: option.value
-        })
+        _options.push(option)
         return false
       }
       return true
@@ -84,10 +81,7 @@
 
       options = options.filter(option => {
         if (option.ParentID === parent.value) {
-          parent.children.push({
-            label: option.label,
-            value: option.value
-          })
+          parent.children.push(option)
           return false
         }
         return true
@@ -108,11 +102,15 @@
     let other = {}
 
     let _value = val.join(config.separator)
+    let _option = option[option.length - 1]
     
-    if (config.fillFieldId) {
-      let _label = option.map(m => m.label).join(config.separator)
-      other[config.fillField] = _label
-      MKEmitter.emit('mkFC', 'input', config.fillFieldId, _label)
+    if (config.subFields && _option) {
+      config.subFields.forEach((n, i) => {
+        other[n.field] = _option[n.field]
+        setTimeout(() => {
+          MKEmitter.emit('mkFC', 'input', n.uuid, _option[n.field])
+        }, i * 5)
+      })
     }
 
     this.props.onChange(_value, other)
diff --git a/src/templates/zshare/formconfig.jsx b/src/templates/zshare/formconfig.jsx
index f0155f1..6c3543b 100644
--- a/src/templates/zshare/formconfig.jsx
+++ b/src/templates/zshare/formconfig.jsx
@@ -3590,14 +3590,6 @@
       initVal: card.linkSubField || [],
       options: inputfields
     },
-    {
-      type: 'select',
-      key: 'fillField',
-      label: '濉厖琛ㄥ崟',
-      tooltip: '鍦ㄥ垏鎹㈤�夐」鏃朵細鎶婄骇鑱旇彍鍗曠殑鏂囨湰鑷姩濉叆鍏宠仈鐨勮〃鍗曚腑銆�',
-      initVal: card.fillField || '',
-      options: inputfields
-    },
     // {
     //   type: 'number',
     //   key: 'marginTop',
diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index c719d9a..d0eaccd 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -33,7 +33,7 @@
   datemonth: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'splitline', 'marginTop', 'marginBottom'],
   datetime: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'declareType', 'mode', 'splitline', 'marginTop', 'marginBottom', 'minDate', 'maxDate'],
   textarea: ['initval', 'readonly', 'required', 'hidden', 'readin', 'fieldlength', 'span', 'labelwidth', 'maxRows', 'encryption', 'interception', 'tooltip', 'extra', 'count', 'placeholder', 'marginTop', 'marginBottom', 'enterReplace'],
-  cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'separator', 'fillField'],
+  cascader: ['readonly', 'required', 'hidden', 'readin', 'resourceType', 'fieldlength', 'span', 'labelwidth', 'tooltip', 'extra', 'splitline', 'marginTop', 'marginBottom', 'separator'],
   color: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'tooltip', 'extra', 'marginTop', 'marginBottom'],
   rate: ['initval', 'readonly', 'required', 'hidden', 'readin', 'span', 'labelwidth', 'splitline', 'tooltip', 'extra', 'marginTop', 'marginBottom', 'allowHalf', 'rateCount', 'character', 'place'],
   hint: ['label', 'field', 'type', 'blacklist', 'message', 'span', 'labelwidth', 'splitline', 'marginTop', 'marginBottom'],
@@ -237,9 +237,9 @@
 
     if (type === 'cascader') {
       if (this.record.resourceType === '0') {        // 鑷畾涔夎祫婧�
-        shows.push('options', 'topmark')
+        shows.push('options', 'topmark', 'linkSubField')
       } else if (this.record.resourceType === '1') { // 鏁版嵁婧�
-        shows.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database', 'topmark', 'linkField')
+        shows.push('dataSource', 'valueField', 'valueText', 'orderBy', 'orderType', 'disableField', 'database', 'topmark', 'linkField', 'linkSubField')
       }
       reTypes.linkField = 'text'
       reTooltip.linkField = '鐢ㄤ簬鏋勫缓鏁版嵁缁撴瀯銆�'
@@ -641,13 +641,16 @@
         let linkSubFields = this.record.linkSubField || []
         
         if (type !== 'checkcard') {
-          if (!['select', 'radio', 'link'].includes(type)) {
+          if (!['select', 'radio', 'link', 'cascader'].includes(type)) {
             linkSubFields = []
           }
           if (type === 'radio' && this.record.linkField) {
             type = 'link'
           } else if (type === 'cascader') {
             type = 'link'
+            if (this.record.resourceType === '2') {        // 鑷畾涔夎祫婧�
+              linkSubFields = []
+            }
           }
           content = <EditTable type={type} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/>
         } else {

--
Gitblit v1.8.0