From 46f79b491173d284a4900d19e7aecf7509481438 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 21 一月 2022 17:21:25 +0800
Subject: [PATCH] 2022-01-21

---
 src/tabviews/zshare/mutilform/index.jsx |   50 ++++++++++++++++++++++++++++++--------------------
 1 files changed, 30 insertions(+), 20 deletions(-)

diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index 5e054e8..9c61db0 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -1,8 +1,8 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Row, Col, notification, Tooltip, Icon, Rate } from 'antd'
-import { QuestionCircleOutlined } from '@ant-design/icons'
+import { Form, Row, Col, notification, Tooltip, Rate } from 'antd'
+import { QuestionCircleOutlined, StarFilled } from '@ant-design/icons'
 import moment from 'moment'
 
 import Api from '@/api'
@@ -14,6 +14,7 @@
 import MKInput from './mkInput'
 import MKNumberInput from './mkNumberInput'
 import MKSelect from './mkSelect'
+import MkIcon from '@/components/mk-icon'
 import './index.scss'
 
 const MKCheckCard = asyncComponent(() => import('./mkCheckCard'))
@@ -30,7 +31,6 @@
   static propTpyes = {
     menuType: PropTypes.object,  // 鑿滃崟绫诲瀷锛屾槸鍚︿负HS
     action: PropTypes.object,    // 鎸夐挳淇℃伅銆佽〃鍗曞垪琛�
-    dict: PropTypes.object,      // 瀛楀吀椤�
     data: PropTypes.any,         // 琛ㄦ牸鏁版嵁
     BID: PropTypes.any,          // 涓昏〃ID
     BData: PropTypes.any,        // 涓昏〃鏁版嵁
@@ -56,18 +56,23 @@
     let check = action.setting.formType === 'check'
 
     formlist = formlist.filter(item => {
-      if (item.supField && item.supvalue) { // 澶氬眰琛ㄥ崟鎺у埗
+      if (item.supField) { // 澶氬眰琛ㄥ崟鎺у埗
         let supvals = []
-        item.supvalue.split(',').forEach(val => {
-          supvals.push(val)
-          if (/^([-]?(0|[1-9][0-9]*)(\.[0-9]+)?)$/.test(val)) {
-            supvals.push(+val)
-          }
-        })
+        if (item.supvalue) {
+          item.supvalue.split(',').forEach(val => {
+            supvals.push(val)
+            if (/^([-]?(0|[1-9][0-9]*)(\.[0-9]+)?)$/.test(val)) {
+              supvals.push(+val)
+            }
+          })
+        } else {
+          supvals.push('')
+        }
         controlFields[item.supField] = controlFields[item.supField] || []
         controlFields[item.supField].push({field: item.field, values: supvals})
       }
-      if (item.type === 'link') {
+      // if (item.type === 'link') {
+      if (item.linkField) {
         linkFields[item.linkField] = linkFields[item.linkField] || []
         linkFields[item.linkField].push({field: item.field, uuid: item.uuid})
       }
@@ -317,7 +322,8 @@
       if (!cell.field || !fieldMap.has(cell.field)) return cell
       let item = fieldMap.get(cell.field)
 
-      if (item.type === 'link') {
+      // if (item.type === 'link') {
+      if (item.linkField) {
         item.supInitVal = ''
 
         if (fieldMap.has(item.linkField)) {
@@ -376,7 +382,9 @@
       if (item.enter === 'tab' || item.enter === 'sub') {
         if (fieldMap.has(item.tabField)) {
           item.tabUuid = fieldMap.get(item.tabField).uuid
-        } else {
+        } else if (item.enter === 'tab') {
+          item.enter = 'false'
+        } else if (item.enter === 'sub') {
           item.tabUuid = item.uuid
         }
       }
@@ -583,7 +591,7 @@
             _cell = {..._cell, ...cell}
           }
   
-          if (item.type === 'link') {
+          if (item.linkField) {
             _cell.ParentID = cell[item.linkField] === undefined ? '' : cell[item.linkField]
           }
           if (item.subFields) {
@@ -601,9 +609,11 @@
 
         item.oriOptions = [...item.oriOptions, ...options]
 
-        if (item.type === 'link') {
+        // if (item.type === 'link') {
+        if (item.linkField) {
           item.options = item.oriOptions.filter(option => option.ParentID === item.supInitVal || option.value === '')
-        } else if (['select', 'radio', 'checkbox', 'checkcard', 'multiselect'].includes(item.type)) {
+        // } else if (['select', 'radio', 'checkbox', 'checkcard', 'multiselect'].includes(item.type)) {
+        } else {
           item.options = item.oriOptions
         }
       }
@@ -694,7 +704,7 @@
       } else if (item.type === 'hint') {
         fields.push(
           <Col span={item.span || 24} key={index}>
-            <Form.Item className="hint" colon={!!item.label} label={item.label} labelCol={item.labelCol} wrapperCol={item.wrapperCol}>
+            <Form.Item className="hint" colon={!!item.label} label={item.label || ' '} labelCol={item.labelCol} wrapperCol={item.wrapperCol}>
               <div className="message">{item.message}</div>
             </Form.Item>
           </Col>
@@ -716,11 +726,11 @@
           className = 'checkcard'
           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})}/>)
+          content = (<MKSwitch 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') {
-          content = (<MKRadio config={item} onChange={(val) => this.recordChange({[item.field]: val}, item)}/>)
+          content = (<MKRadio config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>)
         } else if (item.type === 'date' || item.type === 'datemonth' || item.type === 'datetime') {
           content = (<MKDatePicker config={item} onChange={(val) => this.recordChange({[item.field]: val})} />)
         } else if (item.type === 'fileupload') {
@@ -730,7 +740,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 ? <Icon type={item.character}/> : <Icon type="star" theme="filled"/>} allowHalf={item.allowHalf}/>)
+          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}/>)
         } else if (item.type === 'brafteditor') {
           content = (<MKEditor config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
           label = item.hidelabel !== 'true' ? label : ''

--
Gitblit v1.8.0