From ac1d52c46ff9019fcc93cf3d5e7ab17cf850824e Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 10 八月 2023 16:05:24 +0800
Subject: [PATCH] 2023-08-10

---
 src/menu/components/form/simple-form/index.jsx |   62 ++++++++++++------------------
 1 files changed, 25 insertions(+), 37 deletions(-)

diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx
index 9cacce7..91474ce 100644
--- a/src/menu/components/form/simple-form/index.jsx
+++ b/src/menu/components/form/simple-form/index.jsx
@@ -9,7 +9,7 @@
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
 import { getModalForm } from '@/templates/zshare/formconfig'
-import { resetStyle, getTables } from '@/utils/utils-custom.js'
+import { resetStyle, getTables, checkComponent } from '@/utils/utils-custom.js'
 import MKEmitter from '@/utils/events.js'
 import Utils from '@/utils/utils.js'
 import getWrapForm from './options'
@@ -69,7 +69,7 @@
         scripts: [],
         subcards: [{
           uuid: Utils.getuuid(),
-          setting: {title: '绌�', align: 'left_right', enable: 'true'},
+          setting: {title: '', align: 'left_right', enable: 'true'},
           style: {},
           fields: [],
           subButton: {label: '鎻愪氦', type: 'submit', intertype: 'system', reload: 'false', sqlType: 'update', sql: '', Ot: 'notRequired', execSuccess: 'never', enable: 'true', style: {backgroundColor: '#1890ff', color: '#ffffff', paddingLeft: '25px', paddingRight: '25px', paddingTop: '5px', paddingBottom: '5px'}},
@@ -132,19 +132,9 @@
       if (supModule === 'empty') {
         supModule = ''
       }
-      let columns = card.columns.map(c => c.field)
 
-      if (card.setting.interType === 'system' && card.setting.execute !== 'false' && !card.setting.dataresource) {
-        card.errors.push({ level: 0, detail: '鏈缃暟鎹簮锛�'})
-      } else if (card.setting.interType === 'system' && card.setting.execute === 'false' && card.scripts.filter(script => script.status !== 'false').length === 0) {
-        card.errors.push({ level: 0, detail: '鏁版嵁婧愪腑鏃犲彲鐢ㄨ剼鏈紒'})
-      } else if (!card.setting.primaryKey) {
-        card.errors.push({ level: 0, detail: '鏈缃富閿紒'})
-      } else if (!columns.includes(card.setting.primaryKey)) {
-        card.errors.push({ level: 0, detail: '涓婚敭宸插け鏁堬紒'})
-      } else if (!card.setting.supModule) {
-        card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'})
-      }
+      card.$c_ds = true
+      card.errors = checkComponent(card)
 
       if (card.errors.length === 0) {
         card.$tables = getTables(card)
@@ -344,50 +334,48 @@
     let _linkableFields = []
     let _linksupFields = []
     let standardform = null
-
-    let uniq = new Map()
     let index = null
-    uniq.set(_form.field, true)
 
     card.subcards[0].fields.forEach((item, i) => {
       if (_form.uuid === item.uuid) {
         index = i
       }
 
-      if (['text', 'number', 'textarea', 'color'].includes(item.type) && _item.field !== item.field) {
+      if (!item.field || _form.field === item.field) return
+
+      if (['text', 'number', 'textarea', 'color'].includes(item.type)) {
         _inputfields.push({
           field: item.field,
           label: item.label
         })
       }
-      if (_form.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) {
+      if (item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) {
         _tabfields.push({
           field: item.field,
           label: item.label
         })
       }
 
-      if (item.type === 'switch') {
+      if (item.type === 'switch' || item.type === 'check') {
         _linksupFields.push({
           field: item.field,
           label: item.label
         })
       }
       
-      if (!['select', 'link', 'radio', 'checkcard'].includes(item.type)) return
-      if (item.type === 'checkcard' && item.multiple === 'true') return // 閫夐」鍗″閫�
-      if (item.field && !uniq.has(item.field)) {
-        uniq.set(item.field, true)
+      if (!['select', 'link', 'radio', 'checkcard', 'multiselect'].includes(item.type)) return
 
-        _linkableFields.push({
-          field: item.field,
-          label: item.label + '-琛ㄥ崟'
-        })
-        _linksupFields.push({
-          field: item.field,
-          label: item.label
-        })
-      }
+      _linksupFields.push({
+        field: item.field,
+        label: item.label
+      })
+
+      if (item.type === 'multiselect' || (item.type === 'checkcard' && item.multiple === 'true')) return
+
+      _linkableFields.push({
+        field: item.field,
+        label: item.label + '-琛ㄥ崟'
+      })
     })
 
     if (index !== null) {
@@ -398,10 +386,9 @@
       }
     }
 
+    let _fields = _linkableFields.map(cell => cell.field)
     card.columns.forEach(col => {
-      if (col.field && !uniq.has(col.field)) {
-        uniq.set(col.field, true)
-
+      if (col.field && !_fields.includes(col.field)) {
         _linkableFields.push({
           field: col.field,
           label: col.label + '-鏄剧ず鍒�'
@@ -673,7 +660,7 @@
           <div className="center">
             <div className="title" onDoubleClick={() => {
               let oInput = document.createElement('input')
-              oInput.value = card.uuid
+              oInput.value = 'anchor' + card.uuid
               document.body.appendChild(oInput)
               oInput.select()
               document.execCommand('Copy')
@@ -693,6 +680,7 @@
         </div>
         <Modal
           title="缂栬緫"
+          wrapClassName="mk-scroll-modal"
           visible={this.state.visible}
           width={950}
           maskClosable={false}

--
Gitblit v1.8.0