From 2682e38fcea26a70d3bac34c79931973b989eab5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 10 十二月 2023 19:12:14 +0800
Subject: [PATCH] 2023-12-10

---
 src/components/normalform/modalform/index.jsx |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/components/normalform/modalform/index.jsx b/src/components/normalform/modalform/index.jsx
index a277d8a..aafd7bf 100644
--- a/src/components/normalform/modalform/index.jsx
+++ b/src/components/normalform/modalform/index.jsx
@@ -18,7 +18,8 @@
 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'))
+const MKColor = asyncComponent(() => import('@/mob/colorsketch'))
+// const MKColor = asyncComponent(() => import('@/tabviews/zshare/mutilform/mkColor'))
 const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
 const SourceComponent = asyncComponent(() => import('@/menu/components/share/sourcecomponent'))
 
@@ -110,7 +111,7 @@
       let supItem = fieldMap.get(key)
       let supval = supItem.initval
 
-      if (supItem.initval && supItem.type !== 'checkbox' && supItem.type !== 'multiselect' && JSON.stringify(supItem.initval) === '[]') {
+      if (supval && JSON.stringify(supval) === '[]') {
         supval = ''
       }
 
@@ -126,13 +127,13 @@
 
         } else if (supItem.hidden) {
           cell.hidden = true
+        } else if (item.notNull) {
+          cell.hidden = !supval
         } else if (supItem.type === 'checkbox' || supItem.type === 'multiselect') {
-          let vals = [...supval, ...item.values]
+          let vals = [...(supval || []), ...item.values]
           if (vals.length === new Set(vals).size) {
             cell.hidden = true
           }
-        } else if (item.notNull) {
-          cell.hidden = !supval
         } else if (!item.values.includes(supval)) {
           cell.hidden = true
         }
@@ -196,7 +197,7 @@
       let reset = (current) => {
         let val = this.record[current.field]
 
-        if (val && current.type !== 'checkbox' && current.type !== 'multiselect' && JSON.stringify(val) === '[]') {
+        if (val && JSON.stringify(val) === '[]') {
           val = ''
         }
 
@@ -205,15 +206,15 @@
 
           if (current.hidden) {
             m.hidden = true
+          } else if (cell.notNull) {
+            m.hidden = !val
           } else if (current.type === 'checkbox' || current.type === 'multiselect') {
-            let vals = [...val, ...cell.values]
+            let vals = [...(val || []), ...cell.values]
             if (vals.length !== new Set(vals).size) {
               m.hidden = false
             } else {
               m.hidden = true
             }
-          } else if (cell.notNull) {
-            m.hidden = !val
           } else {
             m.hidden = !cell.values.includes(val)
           }
@@ -287,7 +288,7 @@
       } else if (item.type === 'select' || item.type === 'multiselect') {
         content = (<MKSelect config={item} onChange={(val, other) => this.recordChange({[item.field]: val, ...other}, item)} />)
       } else if (item.type === 'color') {
-        content = (<MKColor config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
+        content = (<MKColor config={item} allowClear={item.allowClear} onChange={(val) => this.recordChange({[item.field]: val})}/>)
       } else if (item.type === 'styleInput') {
         content = (<StyleInput config={item} onChange={(val) => this.recordChange({[item.field]: val})}/>)
       } else if (item.type === 'radio') {

--
Gitblit v1.8.0