From d074bedd5c2834113fe0c4ed5a3c78ec905681c3 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 10 九月 2021 16:02:57 +0800
Subject: [PATCH] 2021-09-10

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

diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx
index e0927dc..99658a4 100644
--- a/src/components/normalform/modalform/index.jsx
+++ b/src/components/normalform/modalform/index.jsx
@@ -12,6 +12,7 @@
 const { TextArea } = Input
 
 const MKRadio = asyncComponent(() => import('./mkRadio'))
+const MKCheckbox = asyncComponent(() => import('./mkCheckbox'))
 const StyleInput = asyncComponent(() => import('./styleInput'))
 const MKFileUpload = asyncComponent(() => import('@/tabviews/zshare/fileupload'))
 const MKColor = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkColor'))
@@ -158,7 +159,19 @@
 
         current.controlFields.forEach(cell => {
           let m = map.get(cell.field)
-          m.hidden = current.hidden || !cell.values.includes(val)
+
+          if (current.hidden) {
+            m.hidden = true
+          } else if (current.type === 'checkbox') {
+            let vals = [...val, ...cell.values]
+            if (vals.length !== new Set(vals).size) {
+              m.hidden = false
+            } else {
+              m.hidden = true
+            }
+          } else {
+            m.hidden = !cell.values.includes(val)
+          }
 
           if (m.hidden) {
             m.initval = this.record[m.field]
@@ -209,6 +222,8 @@
         content = (<StyleInput config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
       } else if (item.type === 'radio') {
         content = (<MKRadio config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)}/>)
+      } else if (item.type === 'checkbox') {
+        content = (<MKCheckbox config={item} onChange={(val) => this.recordChange({[item.field]: val}, item)}/>)
       } else if (item.type === 'fileupload') {
         content = (<MKFileUpload config={item} onChange={(val) => this.recordChange({[item.field]: val})} />)
       } else if (item.type === 'cascader') {

--
Gitblit v1.8.0