From 8d66ff34fae5b048a6b7923cc75d34f13a08be9d Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 02 八月 2022 11:42:43 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/components/normalform/modalform/index.jsx |   43 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx
index 91fe3e5..8bc59c5 100644
--- a/src/components/normalform/modalform/index.jsx
+++ b/src/components/normalform/modalform/index.jsx
@@ -13,6 +13,7 @@
 const { TextArea } = Input
 
 const MKRadio = asyncComponent(() => import('./mkRadio'))
+const MKTable = asyncComponent(() => import('./mkTable'))
 const MKCheckbox = asyncComponent(() => import('./mkCheckbox'))
 const StyleInput = asyncComponent(() => import('./styleInput'))
 const MKFileUpload = asyncComponent(() => import('@/tabviews/zshare/fileupload'))
@@ -66,13 +67,19 @@
           validator: (rule, value, callback) => this.handleConfirmPassword(rule, value, callback, item)
         }]
       } else if (item.type === 'textarea') {
-        let _rules = [
+        item.rules = [
           {
             required: item.required,
             message: item.label + '涓嶅彲涓虹┖!'
           }
         ]
-        item.rules = _rules
+      } else if (item.type === 'table') {
+        item.rules = [
+          {
+            required: item.required,
+            message: '璇锋坊鍔�' + item.label + '!'
+          }
+        ]
       } else {
         item.rules = [
           {
@@ -102,13 +109,17 @@
 
         if (cell.hidden) return
 
-        if (supItem.hidden) {
+        if (cell.skip && supItem.forbid) { // 涓婄骇琛ㄥ崟绂佺敤鏃讹紝姝よ〃鍗曚笉鍙楁帶鍒�
+
+        } else if (supItem.hidden) {
           cell.hidden = true
         } else if (supItem.type === 'checkbox') {
           let vals = [...supItem.initval, ...item.values]
           if (vals.length === new Set(vals).size) {
             cell.hidden = true
           }
+        } else if (item.notNull) {
+          cell.hidden = !supItem.initval || JSON.stringify(supItem.initval) === '[]'
         } else if (!item.values.includes(supItem.initval)) {
           cell.hidden = true
         }
@@ -177,6 +188,8 @@
             } else {
               m.hidden = true
             }
+          } else if (cell.notNull) {
+            m.hidden = !val || JSON.stringify(val) === '[]'
           } else {
             m.hidden = !cell.values.includes(val)
           }
@@ -197,10 +210,17 @@
 
       this.setState({
         formlist: this.state.formlist.map(cell => {
-          if (cell.field) {
-            return map.get(cell.field)
+          if (!cell.field) return cell
+
+          let item = map.get(cell.field)
+
+          if (item && item.linkField) {
+            let supInitVal = this.record[item.linkField] || ''
+            
+            item.options = item.oriOptions.filter(option => option.ParentID === supInitVal)
           }
-          return cell
+
+          return item || cell
         })
       })
     }
@@ -235,13 +255,22 @@
       } else if (item.type === 'fileupload') {
         content = (<MKFileUpload config={item} onChange={(val) => this.recordChange({[item.field]: val})} />)
       } else if (item.type === 'cascader') {
-        content = (<Cascader allowClear={!!item.allowClear} options={item.options} expandTrigger="hover" placeholder="" />)
+        content = (<Cascader allowClear={!!item.allowClear} onChange={(val) => this.recordChange({[item.field]: val}, item)} options={item.options} expandTrigger="hover" placeholder="" />)
       } else if (item.type === 'textarea') {
         content = (<TextArea rows={item.rows || 2} placeholder=""/>)
       } else if (item.type === 'mkicon') {
         content = (<MkEditIcon allowClear={item.allowClear}/>)
       } else if (item.type === 'source') {
         content = (<SourceComponent type="" placement="right"/>)
+      } else if (item.type === 'table') {
+        content = (<MKTable tip={item.tip || ''} columns={item.columns || []} actions={item.actions || []}/>)
+      } else if (item.type === 'hint') {
+        fields.push(
+          <Col span={24} key={index}>
+            <div style={{color: '#1890ff', borderBottom: '1px solid #e9e9e9', marginBottom: '15px', paddingLeft: '10px'}}>{item.label}</div>
+          </Col>
+        )
+        return
       }
 
       if (!content) return

--
Gitblit v1.8.0