From 1f5c6ac307a134dfa45b64c5723f2481ead9f213 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 16 七月 2023 16:23:09 +0800
Subject: [PATCH] 2023-07-16

---
 src/templates/modalconfig/index.jsx |   62 ++++++++++++++----------------
 1 files changed, 29 insertions(+), 33 deletions(-)

diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx
index 97c1bdd..5e51140 100644
--- a/src/templates/modalconfig/index.jsx
+++ b/src/templates/modalconfig/index.jsx
@@ -126,6 +126,7 @@
   }
 
   componentDidMount() {
+    window.GLOB.formId = ''
     MKEmitter.addListener('submitStyle', this.getStyle)
     document.onkeydown = (event) => {
       let e = event || window.event
@@ -249,59 +250,51 @@
     let index = null
     uniq.set(card.field, true)
 
-    let _inputIndex = 1
-    let _tabIndex = 1
-    let _linkIndex = 1
     config.fields.forEach((item, i) => {
       if (card.uuid === item.uuid) {
         index = i
       }
 
-      let label = item.label || ''
-      if (item.field && item.field.toLowerCase() !== label.toLowerCase()) {
-        label = label + ' (' + item.field + ')'
-      }
+      if (!item.field) return
 
       if (['text', 'number', 'textarea', 'color'].includes(item.type) && card.field !== item.field) {
         _inputfields.push({
           field: item.field,
-          label: _inputIndex + '銆�' + label
+          label: item.label
         })
-        _inputIndex++
       }
       if (card.field !== item.field && item.hidden !== 'true' && ['text', 'number', 'select', 'link'].includes(item.type)) {
         _tabfields.push({
           field: item.field,
-          label: _tabIndex + '銆�' + label
+          label: item.label
         })
-        _tabIndex++
       }
 
-      if (item.type === 'switch') {
+      if (item.type === 'switch' || item.type === 'check') {
         _linksupFields.push({
           field: item.field,
-          label: _linkIndex + '銆�' + label
+          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)) {
+      if (!['select', 'link', 'radio', 'checkcard', 'multiselect'].includes(item.type)) return
+
+      _linksupFields.push({
+        field: item.field,
+        label: item.label
+      })
+
+      if (item.type === 'multiselect' || (item.type === 'checkcard' && item.multiple === 'true')) return
+
+      if (!uniq.has(item.field)) {
         uniq.set(item.field, true)
 
         _linkableFields.push({
           field: item.field,
-          label: _linkIndex + '銆�' + item.label + ' (琛ㄥ崟)'
+          label: item.label + '-琛ㄥ崟'
         })
-        _linksupFields.push({
-          field: item.field,
-          label: _linkIndex + '銆�' + label
-        })
-        _linkIndex++
       }
     })
-
-    _tabfields.unshift({field: '', label: '鍘熻〃鍗�'})
 
     if (index !== null) {
       if (index === 0) {
@@ -318,9 +311,8 @@
 
           _linkableFields.push({
             field: col.field,
-            label: _linkIndex + '銆�' + col.label + ' (鏄剧ず鍒�)'
+            label: col.label + '-鏄剧ず鍒�'
           })
-          _linkIndex++
         }
       })
     } else if (tabConfig) {
@@ -330,9 +322,8 @@
 
           _linkableFields.push({
             field: col.field,
-            label: _linkIndex + '銆�' + col.label + ' (鏄剧ず鍒�)'
+            label: col.label + '-鏄剧ず鍒�'
           })
-          _linkIndex++
         }
       })
     } else if (menu.LongParam) {
@@ -342,9 +333,8 @@
 
           _linkableFields.push({
             field: col.field,
-            label: _linkIndex + '銆�' + col.label + ' (鏄剧ず鍒�)'
+            label: col.label + '-鏄剧ず鍒�'
           })
-          _linkIndex++
         }
       })
     }
@@ -357,6 +347,9 @@
     if (!card.span && standardform && standardform.span) {
       card.span = standardform.span
       card.labelwidth = standardform.labelwidth
+    } else if (!card.span) {
+      card.span = 12
+      card.labelwidth = 33.3
     }
 
     this.setState({
@@ -404,6 +397,8 @@
 
       _config.fields = _config.fields.filter(item => !item.origin)
 
+      window.GLOB.formId = res.uuid
+
       if (['select', 'multiselect', 'link', 'checkbox', 'radio', 'checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) {
         this.setState({
           sqlVerifing: true
@@ -412,11 +407,13 @@
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
-          LText: res.dataSource
+          LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
+            ${res.dataSource}`
         }
 
         param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
         param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
+        param.LText = param.LText.replace(/\n/g, ' ')
         
         param.LText = Utils.formatOptions(param.LText)
         param.secretkey = Utils.encrypt('', param.timestamp)
@@ -744,7 +741,6 @@
     })
   }
 
-
   render () {
     const { editAction } = this.props
     const { config, openEdition } = this.state
@@ -781,7 +777,7 @@
                 <Button type="danger" onClick={this.clearConfig}>娓呯┖</Button>
                 <Versions MenuId={editAction.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/>
                 <ReplaceField type="form" config={config} updateConfig={this.updateconfig}/>
-                <EditComponent options={['form']} config={this.state.config} plusFields={this.plusFields}/>
+                <EditComponent options={['form']} type="formboard" config={this.state.config} plusFields={this.plusFields}/>
                 <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>淇濆瓨</Button>
                 <Button onClick={this.cancelConfig}>杩斿洖</Button>
               </div>

--
Gitblit v1.8.0