From ab262bbe2c64ba086a14f181e5a27eba4b46b555 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 13 十月 2023 17:59:53 +0800
Subject: [PATCH] 2023-10-13

---
 src/templates/zshare/modalform/index.jsx |   52 ++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 46 insertions(+), 6 deletions(-)

diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index 43d8efa..6b480c0 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -15,7 +15,6 @@
 const { TextArea } = Input
 const ColorSketch = asyncComponent(() => import('@/mob/colorsketch'))
 const FieldsTable = asyncComponent(() => import('./fieldtable'))
-const DataTable = asyncComponent(() => import('./datatable'))
 const MkEditIcon = asyncComponent(() => import('@/components/mkIcon'))
 
 const modalTypeOptions = {
@@ -457,13 +456,13 @@
             this.record.options = this.record.options.map(cell => {
               cell.Value = cell.Value || cell.$value || ''
               cell.Text = cell[field] || ''
-    
+              delete cell.$value
               return cell
             })
           } else {
             this.record.options = this.record.options.map(cell => {
               cell.Value = cell.Value || cell.$value || ''
-    
+              delete cell.$value
               return cell
             })
           }
@@ -778,7 +777,21 @@
               linkSubFields = []
             }
           }
-          content = <EditTable type={type} module="form" transfield={transfield} linkSubFields={linkSubFields} onChange={this.changeOptions}/>
+
+          let columns = []
+          if (type === 'link') {
+            columns.push({ title: 'ParentID', key: 'ParentID', strict: true })
+          }
+          columns.push({ title: 'Value', key: 'Value', strict: true })
+          columns.push({ title: 'Text', key: 'Text' })
+
+          linkSubFields.forEach(field => {
+            if (field === 'Value' || field === 'Text') return
+
+            columns.push({ title: transfield[field] || field, key: field })
+          })
+
+          content = <EditTable columns={columns} module="form" onChange={this.changeOptions}/>
         } else {
           if (this.record.multiple === 'true') {
             linkSubFields = []
@@ -786,7 +799,34 @@
           if (this.record.linkField) {
             type = 'link'
           }
-          content = <DataTable type={type} display={this.record.display} linkSubFields={linkSubFields} transfield={transfield} fields={this.record.fields || []} onChange={this.changeOptions}/>
+
+          let columns = []
+          let fields = this.record.fields || []
+          let keys = ['ParentID', 'pid']
+
+          if (type === 'link') {
+            columns.push({ title: 'ParentID', key: 'ParentID', strict: true })
+          }
+          columns.push({ title: 'Value', key: '$value', strict: true })
+
+          if (this.record.display === 'picture') {
+            columns.push({ title: 'url', key: '$url', type: 'file' })
+          } else if (this.record.display === 'color') {
+            columns.push({ title: 'Color', key: '$color' })
+          }
+
+          fields.forEach(item => {
+            keys.push(item.field)
+            columns.push({ title: item.field, key: item.field })
+          })
+
+          linkSubFields.forEach(m => {
+            if (keys.includes(m)) return
+
+            columns.push({ title: transfield[m] || m, key: m })
+          })
+
+          content = <EditTable columns={columns} onChange={this.changeOptions}/>
         }
       } else if (item.type === 'fields') {
         span = 24
@@ -836,7 +876,7 @@
 
     let isNumber = true
     options.forEach(item => {
-      if (!/^([0-9]|[1-9]\d{0,2})$/.test(item.Value)) {
+      if (!item.Value || isNaN(item.Value)) {
         isNumber = false
       }
     })

--
Gitblit v1.8.0