From 8acfcd6e349ef2d1b797a7483940a2f3f2dfcfe6 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期六, 03 二月 2024 17:49:25 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/menu/components/table/edit-table/columns/editColumn/index.jsx |   40 ++++++++++++++++++++++++++++------------
 1 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/src/menu/components/table/edit-table/columns/editColumn/index.jsx b/src/menu/components/table/edit-table/columns/editColumn/index.jsx
index 66e7e90..7458ba3 100644
--- a/src/menu/components/table/edit-table/columns/editColumn/index.jsx
+++ b/src/menu/components/table/edit-table/columns/editColumn/index.jsx
@@ -6,6 +6,7 @@
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
+import { checkSQL } from '@/utils/utils-custom.js'
 import { getColumnForm } from './formconfig'
 import asyncComponent from '@/utils/asyncComponent'
 import { formRule } from '@/utils/option.js'
@@ -30,6 +31,7 @@
 class EdiTableColumn extends Component {
   static propTpyes = {
     column: PropTypes.object,
+    wrap: PropTypes.object,
     columns: PropTypes.array,
     fields: PropTypes.array,
     submitCol: PropTypes.func,  // 鎻愪氦浜嬩欢
@@ -110,7 +112,7 @@
       return item
     })
 
-    let formlist = getColumnForm(column, fields, this.props.columns)
+    let formlist = getColumnForm(column, fields, this.props.columns, this.props.wrap)
     this.record = {}
 
     formlist.forEach(item => {
@@ -215,6 +217,21 @@
       }
     } else if (key === 'format' && value === 'percent') {
       this.props.form.setFieldsValue({postfix: '%'})
+    } else if (key === 'editType') {
+      let _options = this.getOptions()
+
+      this.setState({
+        formlist: this.state.formlist.map(item => {
+          if (item.key === 'enter' && item.options && item.options[item.options.length - 1].field === '$noActX') {
+            item.options[item.options.length - 1].disabled = value !== 'select'
+          }
+
+          item.initVal = this.record[item.key]
+          item.hidden = !_options.includes(item.key)
+
+          return item
+        })
+      })
     } else if (['editable', 'editType', 'resourceType', 'ctrlField', 'eval', 'Hide', 'IsSort'].includes(key)) {
       let _options = this.getOptions()
 
@@ -329,7 +346,7 @@
           getPopupContainer={() => document.getElementById('edit-table-column-winter')}
         >
           {options.map((option, i) =>
-            <Select.Option key={i} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}>
+            <Select.Option key={i} disabled={option.disabled === true} datatype={option.datatype || ''} label={option.label || ''} value={(option.value || option.field || option.MenuID)}>
               {(option.text || option.label || option.MenuName)}
             </Select.Option>
           )}
@@ -519,19 +536,18 @@
           }
         }
 
-        if (values.dataSource) {
-          let error = Utils.verifySql(values.dataSource)
-  
-          if (error) {
-            notification.warning({
-              top: 92,
-              message: '鏁版嵁婧愪腑涓嶅彲浣跨敤' + error,
-              duration: 5
-            })
-            return
+        if (values.type === 'text' && values.editable === 'true') {
+          if (values.editType !== 'select' && values.enter === '$noActX') {
+            values.enter = '$noAct'
           }
         }
 
+        if (values.dataSource) {
+          let pass = checkSQL(values.dataSource)
+
+          if (!pass) return
+        }
+
         if (values.editType === 'select' && values.resourceType === '1' && values.dataSource) {
           let _option = Utils.getSelectQueryOptions(values)
 

--
Gitblit v1.8.0