From abe961768cb069e84ed958f4c768c512cc3db598 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 04 八月 2021 18:24:57 +0800
Subject: [PATCH] 2021-08-04

---
 src/components/normalform/modalform/index.jsx |   27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx
index 9ad6f5d..851b686 100644
--- a/src/components/normalform/modalform/index.jsx
+++ b/src/components/normalform/modalform/index.jsx
@@ -1,13 +1,15 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-// import { fromJS } from 'immutable'
-import { Form, Row, Col, Tooltip, Icon, Cascader } from 'antd'
+import { fromJS } from 'immutable'
+import { Form, Row, Col, Tooltip, Icon, Cascader, Input } from 'antd'
 
 import asyncComponent from '@/utils/asyncComponent'
 import MKEInput from './mkInput'
 import MKNumberInput from './mkNumberInput'
 import MKSelect from './mkSelect'
 import './index.scss'
+
+const { TextArea } = Input
 
 const MKRadio = asyncComponent(() => import('./mkRadio'))
 const StyleInput = asyncComponent(() => import('./styleInput'))
@@ -37,6 +39,13 @@
       }
       
       item.hidden = false
+
+      if (item.forbid) {
+        item.hidden = true
+      }
+      if (item.options) {
+        item.oriOptions = fromJS(item.options).toJS()
+      }
 
       if (item.type === 'text') {
         let _rules = [{
@@ -103,7 +112,15 @@
     })
 
     formlist = formlist.map(cell => {
-      return fieldMap.get(cell.field) || cell
+      let item = fieldMap.get(cell.field)
+
+      if (item.linkField) {
+        let supInitVal = fieldMap.get(item.linkField).initval || ''
+        
+        item.options = item.oriOptions.filter(option => option.ParentID === supInitVal)
+      }
+
+      return item
     })
 
     this.record = record
@@ -173,7 +190,7 @@
     const fields = []
 
     formlist.forEach((item, index) => {
-      if (item.hidden) return
+      if (item.hidden || item.forbid) return
 
       let content = null
       let label = item.tooltip ? <Tooltip placement="topLeft" title={item.tooltip}><Icon type="question-circle" />{item.label}</Tooltip> : item.label
@@ -194,6 +211,8 @@
         content = (<MKFileUpload config={item} onChange={(val) => this.recordChange({[item.field]: val})} />)
       } else if (item.type === 'cascader') {
         content = (<Cascader options={item.options} expandTrigger="hover" placeholder="" />)
+      } else if (item.type === 'textarea') {
+        content = (<TextArea rows={item.rows || 2} placeholder=""/>)
       }
 
       if (!content) return

--
Gitblit v1.8.0