From d59f518f466274b2caeb2e01c10c92deafe7c93b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 09 二月 2022 11:48:29 +0800
Subject: [PATCH] 2022-02-09

---
 src/components/normalform/modalform/index.jsx |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx
index 010160f..7162b0c 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 = [
           {
@@ -109,6 +116,8 @@
           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 +186,8 @@
             } else {
               m.hidden = true
             }
+          } else if (cell.notNull) {
+            m.hidden = !val || JSON.stringify(val) === '[]'
           } else {
             m.hidden = !cell.values.includes(val)
           }
@@ -242,13 +253,15 @@
       } 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 columns={item.columns || []}/>)
       }
 
       if (!content) return

--
Gitblit v1.8.0